@stacksjs/stx 0.2.135 → 0.2.137

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:_7,getOwnPropertyNames:OQ,getOwnPropertyDescriptor:LQ}=Object,FQ=Object.prototype.hasOwnProperty;function VQ($){return this[$]}var J9=($)=>{var Z=(X9??=new WeakMap).get($),Y;if(Z)return Z;if(Z=_7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of OQ($))if(!FQ.call(Z,X))_7(Z,X,{get:VQ.bind($,X),enumerable:!(Y=LQ($,X))||Y.enumerable})}return X9.set($,Z),Z},X9;var wQ=($)=>$;function AQ($,Z){this[$]=wQ.bind(null,Z)}var s=($,Z)=>{for(var Y in Z)_7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:AQ.bind(Z,Y)})};var k=($,Z)=>()=>($&&(Z=$($=0)),Z);var K0=import.meta.require;import V$ from"fs";import w$ from"path";function TQ($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function MQ($,Z){let Y=w$.basename($);for(let X of Z)if(X.startsWith("*.")){let Q=X.slice(1);if(Y.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Y)||Q.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function IQ($,Z,Y){let X=w$.extname($).toLowerCase(),Q=NQ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&MQ($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let G of Y.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Y[Q]===!0)return!0;if(!Q)return!1;return!1}function U9($,Z,Y,X){let Q=V$.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=w$.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;U9(G,Z,Y,X)}else if(J.isFile()){let K=V$.statSync(G),q=w$.relative(Z,G);if(IQ(q,K.size,Y)){let W=V$.readFileSync(G),U=TQ(W),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:U,size:K.size})}}}}function T1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!V$.existsSync($))return{entries:[],totalSize:0,fileCount:0};U9($,$,Y,X),X.sort((J,G)=>J.url.localeCompare(G.url));let Q=X.reduce((J,G)=>J+G.size,0);return{entries:X,totalSize:Q,fileCount:X.length}}function A$($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:O7,getOwnPropertyNames:RQ,getOwnPropertyDescriptor:NQ}=Object,MQ=Object.prototype.hasOwnProperty;function TQ($){return this[$]}var G9=($)=>{var Z=(Q9??=new WeakMap).get($),Y;if(Z)return Z;if(Z=O7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of RQ($))if(!MQ.call(Z,X))O7(Z,X,{get:TQ.bind($,X),enumerable:!(Y=NQ($,X))||Y.enumerable})}return Q9.set($,Z),Z},Q9;var IQ=($)=>$;function DQ($,Z){this[$]=IQ.bind(null,Z)}var s=($,Z)=>{for(var Y in Z)O7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:DQ.bind(Z,Y)})};var k=($,Z)=>()=>($&&(Z=$($=0)),Z);var K0=import.meta.require;import w$ from"fs";import A$ from"path";function bQ($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function SQ($,Z){let Y=A$.basename($);for(let X of Z)if(X.startsWith("*.")){let Q=X.slice(1);if(Y.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Y)||Q.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function yQ($,Z,Y){let X=A$.extname($).toLowerCase(),Q=kQ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&SQ($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let G of Y.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Y[Q]===!0)return!0;if(!Q)return!1;return!1}function j9($,Z,Y,X){let Q=w$.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=A$.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;j9(G,Z,Y,X)}else if(J.isFile()){let K=w$.statSync(G),q=A$.relative(Z,G);if(yQ(q,K.size,Y)){let W=w$.readFileSync(G),U=bQ(W),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:U,size:K.size})}}}}function M1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!w$.existsSync($))return{entries:[],totalSize:0,fileCount:0};j9($,$,Y,X),X.sort((J,G)=>J.url.localeCompare(G.url));let Q=X.reduce((J,G)=>J+G.size,0);return{entries:X,totalSize:Q,fileCount:X.length}}function R$($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function z9($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var NQ;var E5=k(()=>{NQ={".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 DQ($){let Z={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Z[$]||Z["network-first"]}function H7($){return DQ($).className}function j9($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=H7(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let W=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
5
+ ]`}function B9($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var kQ;var k5=k(()=>{kQ={".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 PQ($){let Z={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Z[$]||Z["network-first"]}function L7($){return PQ($).className}function _9($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=L7(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let W=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
6
6
  maxEntries: ${W},
7
7
  ${U?`maxAgeSeconds: ${U},`:""}
8
8
  purgeOnQuotaError: true,
9
9
  })`)}if(J.strategy==="network-first"||J.strategy==="stale-while-revalidate")K.push(`new CacheableResponsePlugin({
10
10
  statuses: [0, 200],
11
- })`);let q=EQ(J.pattern);Q.push(`
11
+ })`);let q=CQ(J.pattern);Q.push(`
12
12
  // ${J.pattern}
13
13
  registerRoute(
14
14
  ${q},
15
15
  new ${G}({
16
- cacheName: '${J.cacheName||bQ(J.pattern)}',
16
+ cacheName: '${J.cacheName||xQ(J.pattern)}',
17
17
  ${K.length>0?`plugins: [
18
18
  ${K.join(`,
19
19
  `)}
20
20
  ],`:""}
21
21
  })
22
22
  );`)}return Q.join(`
23
- `)}function EQ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${kQ(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${SQ($).replace(/\\\*/g,".*")}')`}function kQ($){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[$.toLowerCase()]||"empty"}function bQ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function SQ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var O9={};s(O9,{isWorkboxEnabled:()=>H9,getServiceWorkerGenerator:()=>xQ,generateWorkboxServiceWorker:()=>_9,generateWorkboxConfig:()=>B9});function B9($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of Q)G.add(H7(W.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?T1(Z,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function _9($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=B9($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?T1(Z,$):null,q=K?A$(K):"[]",W=yQ(X.modules),U=j9($);return`/**
23
+ `)}function CQ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${vQ(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${fQ($).replace(/\\\*/g,".*")}')`}function vQ($){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[$.toLowerCase()]||"empty"}function xQ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function fQ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var F9={};s(F9,{isWorkboxEnabled:()=>L9,getServiceWorkerGenerator:()=>uQ,generateWorkboxServiceWorker:()=>O9,generateWorkboxConfig:()=>H9});function H9($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of Q)G.add(L7(W.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?M1(Z,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function O9($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=H9($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?M1(Z,$):null,q=K?R$(K):"[]",W=gQ(X.modules),U=_9($);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${X.cacheVersion}
26
26
  *
@@ -169,13 +169,13 @@ self.addEventListener('message', (event) => {
169
169
  }
170
170
  });
171
171
 
172
- ${J?.enabled?CQ(J):"// Push notifications disabled"}
172
+ ${J?.enabled?dQ(J):"// Push notifications disabled"}
173
173
 
174
- ${G?.enabled?vQ(G):"// Background sync disabled"}
174
+ ${G?.enabled?mQ(G):"// Background sync disabled"}
175
175
 
176
176
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
177
- `}function yQ($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${PQ(X)};`)}return Z.join(`
178
- `)}function PQ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function CQ($){return`
177
+ `}function gQ($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${hQ(X)};`)}return Z.join(`
178
+ `)}function hQ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function dQ($){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 vQ($){return`
247
+ `}function mQ($){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 H9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function xQ($){if(H9($))return _9;let{generateServiceWorker:Z}=(k5(),J9(F9));return Z}var L9=k(()=>{E5()});var F9={};s(F9,{isWorkboxEnabled:()=>V9,getServiceWorkerFileName:()=>r1,generateServiceWorkerAuto:()=>hQ,generateServiceWorker:()=>R$});function R$($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},Q=Y.routes||[],J=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,W=Y.backgroundSync,U=Y.cacheStorage,z=Z?T1(Z,$):null,j=z?A$(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
309
+ `}function L9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function uQ($){if(L9($))return O9;let{generateServiceWorker:Z}=(b5(),G9(w9));return Z}var V9=k(()=>{k5()});var w9={};s(w9,{isWorkboxEnabled:()=>A9,getServiceWorkerFileName:()=>a1,generateServiceWorkerAuto:()=>cQ,generateServiceWorker:()=>N$});function N$($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},Q=Y.routes||[],J=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,W=Y.backgroundSync,U=Y.cacheStorage,z=Z?M1(Z,$):null,j=z?R$(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${J}
312
312
  *
@@ -320,7 +320,7 @@ self.addEventListener('message', (event) => {
320
320
  * Additional features:
321
321
  * - Push notifications: ${q?.enabled?"enabled":"disabled"}
322
322
  * - Background sync: ${W?.enabled?"enabled":"disabled"}
323
- * - Cache limits: ${U?.maxSize?`${z9(U.maxSize*1024*1024)}`:"unlimited"}
323
+ * - Cache limits: ${U?.maxSize?`${B9(U.maxSize*1024*1024)}`:"unlimited"}
324
324
  */
325
325
 
326
326
  const CACHE_VERSION = '${J}';
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
501
501
  }
502
502
  });
503
503
 
504
- ${q?.enabled?fQ():"// Push notifications disabled"}
504
+ ${q?.enabled?lQ():"// Push notifications disabled"}
505
505
 
506
- ${W?.enabled?gQ():"// Background sync disabled"}
506
+ ${W?.enabled?pQ():"// 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 fQ(){return`
871
+ `}function lQ(){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 gQ(){return`
953
+ `}function pQ(){return`
954
954
  /**
955
955
  * Background sync queue storage (IndexedDB)
956
956
  */
@@ -1132,14 +1132,14 @@ self.addEventListener('message', (event) => {
1132
1132
  event.waitUntil(registerFormSync(event.data.payload));
1133
1133
  }
1134
1134
  });
1135
- `}function r1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function V9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function hQ($,Z){if(!$.pwa?.enabled)return"";if(V9($)){let{generateWorkboxServiceWorker:Y}=(L9(),J9(O9));return Y($,Z)}return R$($,Z)}var k5=k(()=>{E5()});var w9={};s(w9,{injectPwaTags:()=>L7,generateThemeColorMeta:()=>uQ,generateSwRegistrationScript:()=>dQ,generatePwaTags:()=>N$,generateManifestLink:()=>mQ});function N$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=r1($),J=`
1135
+ `}function a1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function A9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function cQ($,Z){if(!$.pwa?.enabled)return"";if(A9($)){let{generateWorkboxServiceWorker:Y}=(V9(),G9(F9));return Y($,Z)}return N$($,Z)}var b5=k(()=>{k5()});var R9={};s(R9,{injectPwaTags:()=>V7,generateThemeColorMeta:()=>oQ,generateSwRegistrationScript:()=>iQ,generatePwaTags:()=>M$,generateManifestLink:()=>nQ});function M$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=a1($),J=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
- <meta name="theme-color" content="${O7(Y?.themeColor||"#000000")}">
1138
+ <meta name="theme-color" content="${F7(Y?.themeColor||"#000000")}">
1139
1139
  <meta name="mobile-web-app-capable" content="yes">
1140
1140
  <meta name="apple-mobile-web-app-capable" content="yes">
1141
1141
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
1142
- <meta name="apple-mobile-web-app-title" content="${O7(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)J+=`
1142
+ <meta name="apple-mobile-web-app-title" content="${F7(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)J+=`
1143
1143
  <link rel="apple-touch-icon" href="${X}/apple-touch-icon.png">
1144
1144
  <link rel="apple-touch-icon" sizes="120x120" href="${X}/apple-touch-icon-120x120.png">
1145
1145
  <link rel="apple-touch-icon" sizes="152x152" href="${X}/apple-touch-icon-152x152.png">
@@ -1176,12 +1176,12 @@ if ('serviceWorker' in navigator) {
1176
1176
  });
1177
1177
  }
1178
1178
  </script>
1179
- <!-- End stx PWA -->`,J}function L7($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=N$(Z);return $.slice(0,Q)+J+`
1180
- `+$.slice(Q)}return $+N$(Z)}let X=N$(Z);return $.replace("</head>",`${X}
1181
- </head>`)}function dQ($){if(!$.pwa?.enabled)return"";return`<script>
1179
+ <!-- End stx PWA -->`,J}function V7($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=M$(Z);return $.slice(0,Q)+J+`
1180
+ `+$.slice(Q)}return $+M$(Z)}let X=M$(Z);return $.replace("</head>",`${X}
1181
+ </head>`)}function iQ($){if(!$.pwa?.enabled)return"";return`<script>
1182
1182
  if ('serviceWorker' in navigator) {
1183
1183
  window.addEventListener('load', function() {
1184
- navigator.serviceWorker.register('/${r1($)}')
1184
+ navigator.serviceWorker.register('/${a1($)}')
1185
1185
  .then(function(registration) {
1186
1186
  console.log('[PWA] Service Worker registered:', registration.scope);
1187
1187
  })
@@ -1190,7 +1190,7 @@ if ('serviceWorker' in navigator) {
1190
1190
  });
1191
1191
  });
1192
1192
  }
1193
- </script>`}function mQ(){return'<link rel="manifest" href="/manifest.json">'}function uQ($){return`<meta name="theme-color" content="${O7($)}">`}function O7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var T$=k(()=>{k5()});import b5 from"path";function N9($){R9=$?.trim()||null}function S5(){return process.env[sQ]?.trim()||R9||a1}function y5($=process.cwd(),...Z){let Y=S5();return b5.isAbsolute(Y)?b5.join(Y,...Z):b5.join($,Y,...Z)}function P5($){if(!$||b5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==a1&&!Z.startsWith(`${a1}/`))return $;let Y=Z.slice(a1.length+1);return Y?b5.join(S5(),Y):S5()}var a1=".stx",sQ="STX_DIR",R9=null;var M$=()=>{};var L0;var T9=k(()=>{L0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function M9($,Z,Y,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||U} -->`});let J=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(J,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var I9,D9;var F7=k(()=>{I9={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},D9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function rQ($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...X1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1193
+ </script>`}function nQ(){return'<link rel="manifest" href="/manifest.json">'}function oQ($){return`<meta name="theme-color" content="${F7($)}">`}function F7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var T$=k(()=>{b5()});import S5 from"path";function T9($){M9=$?.trim()||null}function y5(){return process.env[ZG]?.trim()||M9||t1}function P5($=process.cwd(),...Z){let Y=y5();return S5.isAbsolute(Y)?S5.join(Y,...Z):S5.join($,Y,...Z)}function C5($){if(!$||S5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==t1&&!Z.startsWith(`${t1}/`))return $;let Y=Z.slice(t1.length+1);return Y?S5.join(y5(),Y):y5()}var t1=".stx",ZG="STX_DIR",M9=null;var I$=()=>{};var O0;var I9=k(()=>{O0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function D9($,Z,Y,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||U} -->`});let J=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(J,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var E9,k9;var w7=k(()=>{E9={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},k9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function YG($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...J1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1194
1194
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1195
1195
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${J==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1196
1196
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1200,7 +1200,7 @@ if ('serviceWorker' in navigator) {
1200
1200
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1201
1201
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${J==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1202
1202
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1203
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function aQ(){return`
1203
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function XG(){return`
1204
1204
  <script data-stx-scoped>
1205
1205
  // Motion preferences handling
1206
1206
  (function() {
@@ -1228,7 +1228,7 @@ else {
1228
1228
  });
1229
1229
  })();
1230
1230
  </script>
1231
- `}function tQ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function eQ($=0.1,Z="0px"){return`
1231
+ `}function JG($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function QG($=0.1,Z="0px"){return`
1232
1232
  <script data-stx-scoped>
1233
1233
  // Intersection Observer for scroll animations
1234
1234
  (function() {
@@ -1271,7 +1271,7 @@ else {
1271
1271
  }
1272
1272
  })();
1273
1273
  </script>
1274
- `}function $G(){return`
1274
+ `}function GG(){return`
1275
1275
  <style id="stx-animation-base">
1276
1276
  :root {
1277
1277
  --stx-transition-duration: 300ms;
@@ -1386,7 +1386,7 @@ else {
1386
1386
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1387
1387
  }
1388
1388
  </style>
1389
- `}function ZG($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
1389
+ `}function KG($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
1390
1390
  <script data-stx-scoped>
1391
1391
  // Animation Group: ${$}
1392
1392
  (function() {
@@ -1423,11 +1423,11 @@ else {
1423
1423
  }
1424
1424
  })();
1425
1425
  </script>
1426
- `}function y9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!tQ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=$G();Q=Q.replace("</head>",`${K}
1427
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=eQ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
- `+Q.slice(W)}}return Q}var X1,E9,k9,b9,S9;var V7=k(()=>{X1={duration:300,delay:0,ease:"ease",direction:"both"};E9={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||X1.duration:X1.duration,G=Z.length>2?Z[2]||X1.ease:X1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||X1.delay:X1.delay,q=Z.length>4?Z[4]||X1.direction:X1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=rQ(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",j="";if(Q==="fade")j="stx-fade";else if(Q==="slide")j="stx-slide";else if(Q==="scale")j="stx-scale";else if(Q==="flip")j="stx-flip";else if(Q==="rotate")j="stx-rotate";return`<div id="${W}" class="${z} ${j} ${q==="out"?"stx-out":""}"
1429
- style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},k9={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${W}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},b9={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=ZG(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},S9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=aQ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as P9}from"stx-router";var C9=k(()=>{w7()});async function YG($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=P9();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var v9;var w7=k(()=>{C9();v9={name:"stxRouter",handler:YG,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function x9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...XG,...Z};return`
1426
+ `}function C9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!JG(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=GG();Q=Q.replace("</head>",`${K}
1427
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=QG(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
+ `+Q.slice(W)}}return Q}var J1,b9,S9,y9,P9;var A7=k(()=>{J1={duration:300,delay:0,ease:"ease",direction:"both"};b9={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||J1.duration:J1.duration,G=Z.length>2?Z[2]||J1.ease:J1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||J1.delay:J1.delay,q=Z.length>4?Z[4]||J1.direction:J1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=YG(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",j="";if(Q==="fade")j="stx-fade";else if(Q==="slide")j="stx-slide";else if(Q==="scale")j="stx-scale";else if(Q==="flip")j="stx-flip";else if(Q==="rotate")j="stx-rotate";return`<div id="${W}" class="${z} ${j} ${q==="out"?"stx-out":""}"
1429
+ style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},S9={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${W}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},y9={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=KG(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},P9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=XG();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as v9}from"stx-router";var x9=k(()=>{R7()});async function qG($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=v9();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var f9;var R7=k(()=>{x9();f9={name:"stxRouter",handler:qG,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function g9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...WG,...Z};return`
1431
1431
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1432
1432
  <script>
1433
1433
  (function() {
@@ -1810,10 +1810,10 @@ else {
1810
1810
  };
1811
1811
  })();
1812
1812
  </script>
1813
- `}function f9($,Z){let Y=x9(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function JG($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var XG,g9;var A7=k(()=>{XG={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};g9={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=JG(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return x9(Q)}}});function W1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function h9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function d9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
1814
- `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=K.slice(0,q).trim(),U=K.slice(q+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}J[W]=U}return{data:J,content:Q.trim()}}function C5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,j)=>{let _=J.length,B=z?` class="language-${W1(z)}"`:"";return J.push(`<pre><code${B}>${W1(j.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,z)=>`<code>${W1(z)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,j)=>{return`<img src="${h9(j)?W1(j):""}" alt="${W1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,j)=>{return`<a href="${h9(j)?W1(j):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1815
- `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,j)=>{let B=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${W1(L)}</th>`).join("")}</tr>`,H=j.trim().split(`
1816
- `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${W1(O)}</td>`).join("")}</tr>`}).join(`
1813
+ `}function h9($,Z){let Y=g9(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function UG($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var WG,d9;var N7=k(()=>{WG={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};d9={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=UG(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return g9(Q)}}});function U1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function m9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function u9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
1814
+ `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=K.slice(0,q).trim(),U=K.slice(q+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}J[W]=U}return{data:J,content:Q.trim()}}function v5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,j)=>{let _=J.length,B=z?` class="language-${U1(z)}"`:"";return J.push(`<pre><code${B}>${U1(j.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,z)=>`<code>${U1(z)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,j)=>{return`<img src="${m9(j)?U1(j):""}" alt="${U1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,j)=>{return`<a href="${m9(j)?U1(j):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1815
+ `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,j)=>{let B=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${U1(L)}</th>`).join("")}</tr>`,H=j.trim().split(`
1816
+ `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${U1(O)}</td>`).join("")}</tr>`}).join(`
1817
1817
  `);return`<table>
1818
1818
  <thead>
1819
1819
  ${B}
@@ -1830,29 +1830,29 @@ ${H}
1830
1830
  `),X)Q=Q.replace(/\n/g,`<br />
1831
1831
  `);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function n0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1832
1832
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1833
- `}),$}import QG from"process";function u0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(QG.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var M1=()=>{};var v5={};s(v5,{queueClientBundleBuild:()=>p9,hasUserImports:()=>KG,bundleClientScript:()=>WG});import j0 from"path";import y0 from"fs";function KG($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!m9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!m9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function qG($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let U of W)try{if(y0.existsSync(U)&&y0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(y0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(y0.existsSync(W)&&y0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=j0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:y0.readFileSync(G.path,"utf8"),loader:q}})}}}function p9($){let Z=globalThis,X=(Z[u9]??Promise.resolve()).then($,$);return Z[u9]=X.then(()=>{return},()=>{return}),X}async function WG($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||y5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${GG}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let _=Bun.file(W),B=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==l9||!Array.isArray(H.files))B=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(y0.statSync(L.path).mtimeMs!==L.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=R7.get(K);if(z)return await z;let j=p9(()=>UG($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));R7.set(K,j);try{return await j}finally{R7.delete(K)}}async function UG($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=y5(X,"bundle-tmp"),U=j0.join(W,`${G}.ts`),z=j0.join(W,"out",G);y0.mkdirSync(W,{recursive:!0}),y0.mkdirSync(z,{recursive:!0});let j=j0.dirname(Z),_=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=B.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)_.push(w)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let F=_.length>0?`
1834
- export { ${_.join(", ")} }`:"";await Bun.write(U,$+F),console.log("[stx:bundler] bundling:",G,"from:",j0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:Q,plugins:[qG(X,j,U,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...u0()},root:X});if(!V.success){let D=V.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let A=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let N=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let R=`__stxBundle_${G}`,T=A.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),M=A.map(([D])=>`var ${D} = undefined;`).join(`
1833
+ `}),$}import zG from"process";function u0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(zG.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var T1=()=>{};var x5={};s(x5,{queueClientBundleBuild:()=>i9,hasUserImports:()=>BG,bundleClientScript:()=>HG});import j0 from"path";import y0 from"fs";function BG($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!l9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!l9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function _G($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let U of W)try{if(y0.existsSync(U)&&y0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(y0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(y0.existsSync(W)&&y0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=j0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:y0.readFileSync(G.path,"utf8"),loader:q}})}}}function i9($){let Z=globalThis,X=(Z[p9]??Promise.resolve()).then($,$);return Z[p9]=X.then(()=>{return},()=>{return}),X}async function HG($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||P5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${jG}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let _=Bun.file(W),B=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==c9||!Array.isArray(H.files))B=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(y0.statSync(L.path).mtimeMs!==L.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=M7.get(K);if(z)return await z;let j=i9(()=>OG($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));M7.set(K,j);try{return await j}finally{M7.delete(K)}}async function OG($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=P5(X,"bundle-tmp"),U=j0.join(W,`${G}.ts`),z=j0.join(W,"out",G);y0.mkdirSync(W,{recursive:!0}),y0.mkdirSync(z,{recursive:!0});let j=j0.dirname(Z),_=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=B.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)_.push(w)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let F=_.length>0?`
1834
+ export { ${_.join(", ")} }`:"";await Bun.write(U,$+F),console.log("[stx:bundler] bundling:",G,"from:",j0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:Q,plugins:[_G(X,j,U,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...u0()},root:X});if(!V.success){let D=V.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let A=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let N=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let R=`__stxBundle_${G}`,M=A.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),T=A.map(([D])=>`var ${D} = undefined;`).join(`
1835
1835
  `),I=A.map(([D])=>`${D} = ${R}[${JSON.stringify(D)}];`).join(`
1836
1836
  `);if(w=`${N.join(`
1837
1837
  `)}
1838
- ${M}
1838
+ ${T}
1839
1839
  var ${R} = (function() {
1840
1840
  ${w}
1841
- return { ${T} };
1841
+ return { ${M} };
1842
1842
  })();
1843
- ${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",w.length,"bytes"),_.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${j0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;y0.mkdirSync(J,{recursive:!0}),await Bun.write(K,w);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:y0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(q,JSON.stringify({metadataVersion:l9,files:E})),w}catch(V){let w=V instanceof Error?V.message:String(V),A=V?.errors,N=Array.isArray(A)&&A.length>0?`
1843
+ ${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",w.length,"bytes"),_.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${j0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;y0.mkdirSync(J,{recursive:!0}),await Bun.write(K,w);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:y0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(q,JSON.stringify({metadataVersion:c9,files:E})),w}catch(V){let w=V instanceof Error?V.message:String(V),A=V?.errors,N=Array.isArray(A)&&A.length>0?`
1844
1844
  ${A.map((R)=>`- ${R?.message??R}`).join(`
1845
- `)}`:"";return console.warn(`[stx:bundler] error: ${w}${N}`),$}finally{try{y0.rmSync(U,{force:!0}),y0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var GG=5,l9=1,m9,R7,u9;var x5=k(()=>{M1();M$();m9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];R7=new Map,u9=Symbol.for("stx.client-bundle-build-queue")});var s9={};s(s9,{renderVendorStyleTags:()=>D$,processClientScript:()=>h5,injectBrowserCoreAutoImports:()=>t1,generateServerDataBridge:()=>E$,generateBrowserAutoImportDestructuring:()=>wG,generateAutoImportDestructuring:()=>N7,extractBridgeData:()=>g5,extractAndStripCssImports:()=>I$});import I1 from"path";import f5 from"fs";function jG($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function BG($,Z){let Y=Z;while(!0){let X=I1.join(Y,"node_modules",$,"package.json");if(f5.existsSync(X))return I1.dirname(X);let Q=I1.dirname(Y);if(Q===Y)return null;Y=Q}}function _G($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function HG($,Z){let Y=jG($);if(!Y||!Y.subpath)return null;let X=BG(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(f5.readFileSync(I1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=_G(Q.exports,J);if(!G)return null;let K=I1.resolve(X,G);return f5.existsSync(K)?K:null}function I$($,Z){let Y=Z.filePath?I1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(zG,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:I1.resolve(Y,q),!f5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=HG(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=f5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function OG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${OG(Z.source)}" data-stx-layer="vendor">
1845
+ `)}`:"";return console.warn(`[stx:bundler] error: ${w}${N}`),$}finally{try{y0.rmSync(U,{force:!0}),y0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var jG=5,c9=1,l9,M7,p9;var f5=k(()=>{T1();I$();l9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];M7=new Map,p9=Symbol.for("stx.client-bundle-build-queue")});var a9={};s(a9,{renderVendorStyleTags:()=>E$,processClientScript:()=>d5,injectBrowserCoreAutoImports:()=>e1,generateServerDataBridge:()=>k$,generateBrowserAutoImportDestructuring:()=>IG,generateAutoImportDestructuring:()=>T7,extractBridgeData:()=>h5,extractAndStripCssImports:()=>D$});import I1 from"path";import g5 from"fs";function FG($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function VG($,Z){let Y=Z;while(!0){let X=I1.join(Y,"node_modules",$,"package.json");if(g5.existsSync(X))return I1.dirname(X);let Q=I1.dirname(Y);if(Q===Y)return null;Y=Q}}function wG($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function AG($,Z){let Y=FG($);if(!Y||!Y.subpath)return null;let X=VG(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(g5.readFileSync(I1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=wG(Q.exports,J);if(!G)return null;let K=I1.resolve(X,G);return g5.existsSync(K)?K:null}function D$($,Z){let Y=Z.filePath?I1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(LG,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:I1.resolve(Y,q),!g5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=AG(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=g5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function RG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${RG(Z.source)}" data-stx-layer="vendor">
1846
1846
  @layer vendor {
1847
1847
  ${Z.contents}
1848
1848
  }
1849
1849
  </style>`}).join(`
1850
1850
  `)}
1851
- `}function t1($){let Z=new Set;for(let Q of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let J of Q[1].split(",")){let G=J.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(G)Z.add(G)}let Y=new Set;for(let Q of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(Q[1]);for(let Q of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of Q[1].split(",")){let G=J.trim().split(/[:=]/).pop()?.trim();if(G)Y.add(G)}let X=n9.filter((Q)=>{if(Z.has(Q)||Y.has(Q))return!1;return new RegExp(`\\b${Q}\\b`).test($)});if(X.length===0)return{code:$,imports:X};return{code:`import { ${X.join(", ")} } from '@stacksjs/browser'
1852
- ${$}`,imports:X}}function VG($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Y.exec($))!==null)if(!FG.has(X[1]))Z.add(X[1]);return Array.from(Z)}function o9($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),W==="stx"||W==="@stacksjs/stx")Z.add(z);else Y.add(z)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of LG){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of n9){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=VG(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function N7($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1851
+ `}function e1($){let Z=new Set;for(let Q of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let J of Q[1].split(",")){let G=J.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(G)Z.add(G)}let Y=new Set;for(let Q of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(Q[1]);for(let Q of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of Q[1].split(",")){let G=J.trim().split(/[:=]/).pop()?.trim();if(G)Y.add(G)}let X=s9.filter((Q)=>{if(Z.has(Q)||Y.has(Q))return!1;return new RegExp(`\\b${Q}\\b`).test($)});if(X.length===0)return{code:$,imports:X};return{code:`import { ${X.join(", ")} } from '@stacksjs/browser'
1852
+ ${$}`,imports:X}}function TG($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Y.exec($))!==null)if(!MG.has(X[1]))Z.add(X[1]);return Array.from(Z)}function r9($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),W==="stx"||W==="@stacksjs/stx")Z.add(z);else Y.add(z)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of NG){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of s9){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=TG(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function T7($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1853
1853
  ${Y.join(`
1854
1854
  `)}
1855
- ${AG($,Z)}`;return""}function wG($,Z=[]){let{browserImports:Y}=o9($),X=new Set(Z);return N7([],Y.filter((Q)=>!X.has(Q)))}function AG($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
1855
+ ${DG($,Z)}`;return""}function IG($,Z=[]){let{browserImports:Y}=r9($),X=new Set(Z);return T7([],Y.filter((Q)=>!X.has(Q)))}function DG($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
1856
1856
  [${Y.join(", ")}].forEach(function (e) {
1857
1857
  if (e[1] !== 'undefined') return;
1858
1858
  console.error(
@@ -1861,10 +1861,10 @@ ${AG($,Z)}`;return""}function wG($,Z=[]){let{browserImports:Y}=o9($),X=new Set(Z
1861
1861
  + 'or it should be imported from a relative path so the bundler includes it.'
1862
1862
  );
1863
1863
  });
1864
- `}function g5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;Z[Y]=X}return Z}function c9($,Z){let Y=new Set;for(let X of $.split(",")){let Q=X.trim().replace(/^\.\.\./,"").trim();if(!Q)continue;if(Z){let J=Q.lastIndexOf(":");if(J!==-1)Q=Q.slice(J+1).trim()}if(Q=Q.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Q))Y.add(Q)}return Y}function RG($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(c9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(c9(Y[1],!1).has(Z))return!0;return!1}function E$($,Z){if(!Z)return"";let Y=[];for(let[X,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(X))continue;if(!new RegExp(`\\b${X}\\b`).test($))continue;if(RG($,X))continue;let J;try{J=JSON.stringify(Q)}catch{continue}if(J===void 0)continue;Y.push(` var ${X} = ${J.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
1864
+ `}function h5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;Z[Y]=X}return Z}function n9($,Z){let Y=new Set;for(let X of $.split(",")){let Q=X.trim().replace(/^\.\.\./,"").trim();if(!Q)continue;if(Z){let J=Q.lastIndexOf(":");if(J!==-1)Q=Q.slice(J+1).trim()}if(Q=Q.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Q))Y.add(Q)}return Y}function EG($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(n9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(n9(Y[1],!1).has(Z))return!0;return!1}function k$($,Z){if(!Z)return"";let Y=[];for(let[X,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(X))continue;if(!new RegExp(`\\b${X}\\b`).test($))continue;if(EG($,X))continue;let J;try{J=JSON.stringify(Q)}catch{continue}if(J===void 0)continue;Y.push(` var ${X} = ${J.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
1865
1865
  ${Y.join(`
1866
1866
  `)}
1867
- `}function TG($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=NG[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function MG($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=TG(J),K=[];if(J.once)K.push("once: true");if(J.capture)K.push("capture: true");if(J.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
1867
+ `}function bG($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=kG[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function SG($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=bG(J),K=[];if(J.once)K.push("once: true");if(J.capture)K.push("capture: true");if(J.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
1868
1868
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
1869
1869
  };`;function j(_){if(/\$emit\s*\(/.test(_))return`${z}
1870
1870
  ${_}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -1907,11 +1907,11 @@ else {
1907
1907
  else {
1908
1908
  ${Q}
1909
1909
  }
1910
- }${q})`}function IG($){if($.length===0)return"";return`
1910
+ }${q})`}function yG($){if($.length===0)return"";return`
1911
1911
  // STX: auto-generated event bindings
1912
- ${$.map((Y,X)=>MG(Y,X)).join(`
1913
- `)}`}function i9($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
1914
- `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let j=W[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((j)=>{let _=j.trim(),B=_.indexOf(":"),H=B>=0?_.slice(B+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=U[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}}G++}return Z}function EG($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(j){let _;while((_=Y.exec(j))!==null){let B=_[0];if(!DG.has(B))Z.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=z.exec($))!==null)X(J[1]);return Z}async function h5($,Z={}){let Y=$,X="",Q=!1,J=[],G=I$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=D$(G.styles),q=t1(Y);Y=q.code,J=q.imports;let{hasUserImports:W,bundleClientScript:U}=await Promise.resolve().then(() => (x5(),v5));if(W(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let O=o9(Y);Y=O.code,X=N7(O.stxImports,O.browserImports.filter((V)=>!J.includes(V)))}if(X=`${E$(Y,Z.serverData)}${X}`,Y=n0(Y),!Q&&D1(Z.attrs||""))Y=E1(Y);let z=IG(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let O=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${V}>
1912
+ ${$.map((Y,X)=>SG(Y,X)).join(`
1913
+ `)}`}function o9($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
1914
+ `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let j=W[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((j)=>{let _=j.trim(),B=_.indexOf(":"),H=B>=0?_.slice(B+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=U[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}}G++}return Z}function CG($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(j){let _;while((_=Y.exec(j))!==null){let B=_[0];if(!PG.has(B))Z.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=z.exec($))!==null)X(J[1]);return Z}async function d5($,Z={}){let Y=$,X="",Q=!1,J=[],G=D$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=E$(G.styles),q=e1(Y);Y=q.code,J=q.imports;let{hasUserImports:W,bundleClientScript:U}=await Promise.resolve().then(() => (f5(),x5));if(W(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let O=r9(Y);Y=O.code,X=T7(O.stxImports,O.browserImports.filter((V)=>!J.includes(V)))}if(X=`${k$(Y,Z.serverData)}${X}`,Y=n0(Y),!Q&&D1(Z.attrs||""))Y=E1(Y);let z=yG(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let O=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${V}>
1915
1915
  ${X}${Y}
1916
1916
  ${z}
1917
1917
  </script>`}let B=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),H=/function __stx_setup_/.test(Y),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(O){let V=O.length>0?`
@@ -1920,12 +1920,20 @@ window.stx.mount(function() {
1920
1920
  'use strict';
1921
1921
  ${X}${Y}
1922
1922
  ${z}${V}
1923
- })</script>`}if(!L&&!H){if(B)return F(i9($));if(Z.templateContent){let O=i9($);if(O.length>0){let V=EG(Z.templateContent);if(O.some((A)=>V.has(A)))return F(O)}}}return`${K}<script data-stx-scoped>
1923
+ })</script>`}if(!L&&!H){if(B)return F(o9($));if(Z.templateContent){let O=o9($);if(O.length>0){let V=CG(Z.templateContent);if(O.some((A)=>V.has(A)))return F(O)}}}return`${K}<script data-stx-scoped>
1924
1924
  ;(function() {
1925
1925
  'use strict';
1926
1926
  ${X}${Y}
1927
1927
  ${z}
1928
- })()</script>`}var zG,LG,n9,FG,NG,DG;var d5=k(()=>{F0();zG=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;LG=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],n9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];FG=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"]);NG={left:0,middle:1,right:2};DG=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function yG($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function PG($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(bG.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&e9.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function CG($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!e9.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function k$($){let Z=$.trim(),Y=yG(Z);PG(Y,Z),CG(Z);for(let X of t9)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!a9.allowBracketNotation&&SG.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function vG($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||t9.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=T7(X);else Z[Y]=X}return Z}function T7($,Z=0){if(Z>=a9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>T7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=T7(Q,Z+1);else Y[X]=Q}return Y}function e($,Z){try{let Y=vG(Z),X=Object.keys(Y),Q=Object.values(Y);return J0($,X)(...Q)}catch{return}}function X0($){try{return k$($),!0}catch{return!1}}function V0($,Z){try{let Y=e($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function J0($,Z){let Y=k$($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let U=Z[W];if(!X.test(U))continue;if($8.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
1928
+ })()</script>`}var LG,NG,s9,MG,kG,PG;var m5=k(()=>{L0();LG=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;NG=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],s9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];MG=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"]);kG={left:0,middle:1,right:2};PG=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 vG}from"crypto";function t9($){let Z=$[b$];return Z instanceof Map?Z:null}function e9($){$[b$]=new Map}function $8($,Z){let Y=t9($);if(!Y)return null;let X=vG("sha256").update(Z).digest("hex").slice(0,16),Q=Y.get(X);if(Q)Q.instances++;else Y.set(X,{body:Z,instances:1});return X}function Z8($,Z){let Y=t9(Z);if(!Y?.size)return $;let X=$;for(let[q,W]of Y){if(W.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");X=X.replace(U,(z,j)=>`(${W.body})(${j});`)}let Q=[...Y].filter(([,q])=>q.instances>1);if(Q.length===0)return X;let G=`<script data-stx-scoped data-stx-component-factories>
1929
+ (function() {
1930
+ const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
1931
+ ${Q.map(([q,W])=>` factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body};`).join(`
1932
+ `)}
1933
+ })();
1934
+ </script>`,K=X.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(K<0)return`${G}
1935
+ ${X}`;return`${X.slice(0,K)}${G}
1936
+ ${X.slice(K)}`}var b$="__stx_component_client_factories";var I7=()=>{};function hG($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function dG($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(fG.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&Q8.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function mG($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!Q8.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function S$($){let Z=$.trim(),Y=hG(Z);dG(Y,Z),mG(Z);for(let X of J8)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!X8.allowBracketNotation&&gG.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function uG($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||J8.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=D7(X);else Z[Y]=X}return Z}function D7($,Z=0){if(Z>=X8.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>D7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=D7(Q,Z+1);else Y[X]=Q}return Y}function e($,Z){try{let Y=uG(Z),X=Object.keys(Y),Q=Object.values(Y);return J0($,X)(...Q)}catch{return}}function X0($){try{return S$($),!0}catch{return!1}}function F0($,Z){try{let Y=e($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function J0($,Z){let Y=S$($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let U=Z[W];if(!X.test(U))continue;if(G8.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
1929
1937
  'use strict';
1930
1938
  try {
1931
1939
  return ${Y};
@@ -1936,7 +1944,7 @@ catch (e) {
1936
1944
  }
1937
1945
  throw e;
1938
1946
  }
1939
- `),K=G([]);if(J.length===Z.length)return r9(K,J,G);return r9((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function r9($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let j=z instanceof Error?z.message:"",_=J.exec(j);if(!(z instanceof ReferenceError)||!_)return;let B=_[1];if(q.has(B)||$8.has(B))return;q.add(B),K.push(B),G=Y(K),X?.(K)}return}}function b$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var kG,a9,t9,bG,e9,SG,$8;var B0=k(()=>{kG={maxSanitizeDepth:10,allowBracketNotation:!1},a9={...kG},t9=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],bG=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),e9=new Set(["__proto__","constructor","prototype"]),SG=/[\w)\]]\s*\[\s*['"]/;$8=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 S$($,Z){let Y=xG++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return fG.set(X,{type:$,expression:Z}),X}var xG=0,fG;var Z8=k(()=>{fG=new Map});function G8($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function U1($,Z){return G8($,Z,Y8,X8)}function e1($,Z){return G8($,Z,J8,Q8)}function m5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function gG($,Z){if($.startsWith("<!--",Z)){let Y=m5($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[Y8,X8],[J8,Q8]]){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)continue;X.lastIndex=Y.lastIndex;let J=X.exec($);return J?J.index+J[0].length:$.length}return-1}function M7($,Z){let Y=[],X=0,Q=$.length,J=!1,G=null;while(X<Q){let K=$[X];if(J){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")J=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=gG($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))J=!0;X++}return Y}function a0($,Z,Y){let X=M7($,Z);if(X.length===0)return{output:$,tokens:[]};let Q=X.map((K)=>K.token),J="",G=0;for(let K=0;K<X.length;K++){let q=X[K];J+=$.slice(G,q.start),J+=Y(q.token,K),G=q.end}return J+=$.slice(G),{output:J,tokens:Q}}function z1($){let{output:Z,tokens:Y}=a0($,U1,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function u5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var Y8,X8,J8,Q8;var k1=k(()=>{Y8=/<script\b[^>]*>/iy,X8=/<\/script\s*>/ig,J8=/<style\b[^>]*>/iy,Q8=/<\/style\s*>/ig});var j8={};s(j8,{usesSignalsInScript:()=>$5,unescapeHtml:()=>I7,registerFilters:()=>dG,registerFilter:()=>W8,processExpressions:()=>j1,interpolateScriptsInTemplate:()=>uG,interpolateScriptExpressions:()=>y$,getAllFilters:()=>U8,evaluateExpression:()=>l0,escapeHtml:()=>o0,defaultFilters:()=>p5,clearCustomFilters:()=>mG,applyFilters:()=>z8});function hG($){let Z=K8.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),K8.set($,Z)}return Z.lastIndex=0,Z}function W8($,Z){if($ in p5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);l5[$]=Z}function dG($){for(let[Z,Y]of Object.entries($))W8(Z,Y)}function U8(){return{...p5,...l5}}function mG(){for(let $ of Object.keys(l5))delete l5[$]}function o0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function $5($){let{scripts:Z}=z1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let Q=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function q8($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function y$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=l0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=l0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function uG($,Z,Y={}){let{output:X,scripts:Q}=z1($),J=Q.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-1)return G;let U=K[1],z=K[2];if(/\bsrc\s*=/.test(U))return G;if(/\bdata-raw\b/.test(U))return G;if(/\btype\s*=\s*["']application\/json["']/.test(U))return G;if(Y.skipServer&&/\bserver\b/.test(U))return G;let j=y$(z,Z);return q[0]+j+G.slice(W)});return u5(X,J)}function j1($,Z,Y,X){let Q=$,J=(j,_)=>{let B=e1(j,_);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(_,B))?-1:B},G=(j,_,B,H)=>{let L=B.length,{output:F,tokens:O}=a0(j,_,(V,w)=>H(L+w));return B.push(...O),F},K=[];Q=G(Q,J,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let q=[];Q=G(Q,U1,q,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||$5($),U=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(j,_,B)=>{try{let H=l0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,B,j)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(j,_,B)=>{try{let H=l0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return S$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return S$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,B,j)}}),Q=G(Q,U1,q,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),Q=G(Q,J,K,(j)=>`<!--__STX_STYLE_${j}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(j,_,B)=>{let H=_.trim();if(z.has(H))return j;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],w=V&&((V in Z)||L.includes(V)),A=Boolean(V&&U.has(V)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=H.match(N),T=R&&!L.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=l0(_,Z);if(A)return j;if(W&&!q8(H,Z))return j;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return S$("expr",H);return M!==void 0&&M!==null?o0(String(M)):""}catch(M){if(A)return j;if(W&&!q8(H,Z))return j;if(T)return j;let I=M instanceof Error?M.message:String(M);return q0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,B,j)}});for(let j=0;j<q.length;j++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>q[j]);for(let j=0;j<K.length;j++)Q=Q.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return Q}function z8($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=l5[G]||p5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(U8()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[l0(`(${z})`,Y,!0)];else{let j=[],_="",B=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(B){if(_+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){j.push(_),_="";continue}_+=w}if(_)j.push(_);q=j.map((V)=>{let w=V.trim();return l0(w,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function lG($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function l0($,Z,Y=!1){try{let X=$.trim(),Q=lG(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=l0(J,Z,!0);return z8(K,G,Z)}if(!X0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return e(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return J0(X,J)(...G)}catch{return e(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=pG(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function pG($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=cG($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function cG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function I7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var l5,K8,p5;var t0=k(()=>{B0();F0();Z8();k1();l5={},K8=new Map;p5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return o0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(hG(q),String(W))}),K},t:($,Z,Y={})=>{return p5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});function Z5($="const",Z=[],Y){let X=Z.length?P$.filter((Q)=>!Z.includes(Q)):P$;if(Y!==void 0)X=X.filter((Q)=>{let J=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${J}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var P$,B8;var c5=k(()=>{P$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],B8=["onMount","onDestroy"]});class b1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function X5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!Y5.has(Y)){if(Y5.size>=iG){let X=Y5.keys().next().value;if(X)Y5.delete(X)}Y5.set(Y,new RegExp($,Z))}return Y5.get(Y)}class _8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
1947
+ `),K=G([]);if(J.length===Z.length)return Y8(K,J,G);return Y8((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function Y8($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let j=z instanceof Error?z.message:"",_=J.exec(j);if(!(z instanceof ReferenceError)||!_)return;let B=_[1];if(q.has(B)||G8.has(B))return;q.add(B),K.push(B),G=Y(K),X?.(K)}return}}function y$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var xG,X8,J8,fG,Q8,gG,G8;var B0=k(()=>{xG={maxSanitizeDepth:10,allowBracketNotation:!1},X8={...xG},J8=[/\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/],fG=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"]),Q8=new Set(["__proto__","constructor","prototype"]),gG=/[\w)\]]\s*\[\s*['"]/;G8=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 P$($,Z){let Y=lG++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return pG.set(X,{type:$,expression:Z}),X}var lG=0,pG;var K8=k(()=>{pG=new Map});function j8($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function z1($,Z){return j8($,Z,q8,W8)}function $5($,Z){return j8($,Z,U8,z8)}function u5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function cG($,Z){if($.startsWith("<!--",Z)){let Y=u5($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[q8,W8],[U8,z8]]){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)continue;X.lastIndex=Y.lastIndex;let J=X.exec($);return J?J.index+J[0].length:$.length}return-1}function E7($,Z){let Y=[],X=0,Q=$.length,J=!1,G=null;while(X<Q){let K=$[X];if(J){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")J=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=cG($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))J=!0;X++}return Y}function a0($,Z,Y){let X=E7($,Z);if(X.length===0)return{output:$,tokens:[]};let Q=X.map((K)=>K.token),J="",G=0;for(let K=0;K<X.length;K++){let q=X[K];J+=$.slice(G,q.start),J+=Y(q.token,K),G=q.end}return J+=$.slice(G),{output:J,tokens:Q}}function j1($){let{output:Z,tokens:Y}=a0($,z1,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function l5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var q8,W8,U8,z8;var k1=k(()=>{q8=/<script\b[^>]*>/iy,W8=/<\/script\s*>/ig,U8=/<style\b[^>]*>/iy,z8=/<\/style\s*>/ig});var F8={};s(F8,{usesSignalsInScript:()=>Z5,unescapeHtml:()=>k7,registerFilters:()=>nG,registerFilter:()=>H8,processExpressions:()=>B1,interpolateScriptsInTemplate:()=>sG,interpolateScriptExpressions:()=>C$,getAllFilters:()=>O8,evaluateExpression:()=>l0,escapeHtml:()=>o0,defaultFilters:()=>c5,clearCustomFilters:()=>oG,applyFilters:()=>L8});function iG($){let Z=B8.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),B8.set($,Z)}return Z.lastIndex=0,Z}function H8($,Z){if($ in c5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);p5[$]=Z}function nG($){for(let[Z,Y]of Object.entries($))H8(Z,Y)}function O8(){return{...c5,...p5}}function oG(){for(let $ of Object.keys(p5))delete p5[$]}function o0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Z5($){let{scripts:Z}=j1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let Q=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function _8($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function C$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=l0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=l0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function sG($,Z,Y={}){let{output:X,scripts:Q}=j1($),J=Q.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-1)return G;let U=K[1],z=K[2];if(/\bsrc\s*=/.test(U))return G;if(/\bdata-raw\b/.test(U))return G;if(/\btype\s*=\s*["']application\/json["']/.test(U))return G;if(Y.skipServer&&/\bserver\b/.test(U))return G;let j=C$(z,Z);return q[0]+j+G.slice(W)});return l5(X,J)}function B1($,Z,Y,X){let Q=$,J=(j,_)=>{let B=$5(j,_);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(_,B))?-1:B},G=(j,_,B,H)=>{let L=B.length,{output:F,tokens:O}=a0(j,_,(V,w)=>H(L+w));return B.push(...O),F},K=[];Q=G(Q,J,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let q=[];Q=G(Q,z1,q,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||Z5($),U=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(j,_,B)=>{try{let H=l0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,B,j)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(j,_,B)=>{try{let H=l0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return P$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return P$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,B,j)}}),Q=G(Q,z1,q,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),Q=G(Q,J,K,(j)=>`<!--__STX_STYLE_${j}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(j,_,B)=>{let H=_.trim();if(z.has(H))return j;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],w=V&&((V in Z)||L.includes(V)),A=Boolean(V&&U.has(V)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=H.match(N),M=R&&!L.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let T=l0(_,Z);if(A)return j;if(W&&!_8(H,Z))return j;if(T===void 0&&Z.__stx_buildMode==="compile"&&!W)return P$("expr",H);return T!==void 0&&T!==null?o0(String(T)):""}catch(T){if(A)return j;if(W&&!_8(H,Z))return j;if(M)return j;let I=T instanceof Error?T.message:String(T);return q0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,B,j)}});for(let j=0;j<q.length;j++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>q[j]);for(let j=0;j<K.length;j++)Q=Q.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return Q}function L8($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=p5[G]||c5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(O8()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[l0(`(${z})`,Y,!0)];else{let j=[],_="",B=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(B){if(_+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){j.push(_),_="";continue}_+=w}if(_)j.push(_);q=j.map((V)=>{let w=V.trim();return l0(w,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function rG($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function l0($,Z,Y=!1){try{let X=$.trim(),Q=rG(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=l0(J,Z,!0);return L8(K,G,Z)}if(!X0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return e(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return J0(X,J)(...G)}catch{return e(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=aG(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function aG($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=tG($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function tG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function k7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var p5,B8,c5;var t0=k(()=>{B0();L0();K8();k1();p5={},B8=new Map;c5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return o0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(iG(q),String(W))}),K},t:($,Z,Y={})=>{return c5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});function Y5($="const",Z=[],Y){let X=Z.length?v$.filter((Q)=>!Z.includes(Q)):v$;if(Y!==void 0)X=X.filter((Q)=>{let J=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${J}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var v$,V8;var i5=k(()=>{v$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],V8=["onMount","onDestroy"]});class b1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function J5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!X5.has(Y)){if(X5.size>=eG){let X=X5.keys().next().value;if(X)X5.delete(X)}X5.set(Y,new RegExp($,Z))}return X5.get(Y)}class w8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
1940
1948
  'use strict';
1941
1949
  try {
1942
1950
  return ${q};
@@ -1947,33 +1955,33 @@ catch (e) {
1947
1955
  }
1948
1956
  throw e;
1949
1957
  }
1950
- `),Q.set(W,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class H8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function nG(){if(!D7)D7=new H8;return D7}var Y5,iG=500,MH,D7=null,O8;var J5=k(()=>{Y5=new Map;MH=new _8;O8=new Proxy({},{get($,Z){return nG()[Z]}})});function L8($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function F8($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=E7($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let j=z[1],_=`${Z}_${j}`;W.set(j,_)}}for(let U of K){let z=V8(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1958
+ `),Q.set(W,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class A8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function $K(){if(!b7)b7=new A8;return b7}var X5,eG=500,CH,b7=null,R8;var Q5=k(()=>{X5=new Map;CH=new w8;R8=new Proxy({},{get($,Z){return $K()[Z]}})});function N8($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function M8($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=S7($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let j=z[1],_=`${Z}_${j}`;W.set(j,_)}}for(let U of K){let z=T8(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1951
1959
 
1952
- `)}function E7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,z,j]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:j.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=E7(j);Z.push({selector:`@${U} ${z.trim()}`,declarations:_.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
1953
- `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:j.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function V8($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=E7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>V8(j,Z,Y,X,Q,J)).join(`
1960
+ `)}function S7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,z,j]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:j.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=S7(j);Z.push({selector:`@${U} ${z.trim()}`,declarations:_.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
1961
+ `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:j.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function T8($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=S7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>T8(j,Z,Y,X,Q,J)).join(`
1954
1962
  `);return`${G} {
1955
1963
  ${z}
1956
- }`}return`${G} { ${K} }`}let q=oG(G,Z,Y,X),W=K;for(let[U,z]of Q)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function oG($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(W)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`);let q=sG(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function sG($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let Q=$.slice(0,X),J=$.slice(X);if(!Q)return"";let G=Q.length,K=0;for(let q=0;q<Q.length;q++){let W=Q[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${J}`}function A8($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let X=Y.trim();if(Z.has(X))return"";return Z.add(X),Y})}function C$($,Z){if(!rG.test($))return{html:$,hasScoped:!1};let Y=L8(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${k7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=aG(W,X),z=q.replace(new RegExp(k7,"gi"),"").trim(),j=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${j}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=eG(Q,X),{html:Q,hasScoped:!0}}function aG($,Z){return F8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function eG($,Z){let Y=a0($,(Q,J)=>{let G=U1(Q,J);return G>J?G:e1(Q,J)},(Q,J)=>tG(J)),X=$K(Y.output,Z);return w8.lastIndex=0,X.replace(w8,(Q,J)=>Y.tokens[Number(J)])}function $K($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var k7,rG,tG=($)=>`\x00stx-scope-mask-${$}\x00`,w8;var b7=k(()=>{k1();k7=String.raw`(?<![\w-])scoped(?![\w-])`,rG=new RegExp(`<style\\s+[^>]*${k7}`,"i");w8=/\u0000stx-scope-mask-(\d+)\u0000/g});function YK($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return ZK.test(Z)}function v$($){i5.lastIndex=0;let Z;while((Z=i5.exec($))!==null){if(Z[0].startsWith("</")||YK(Z[0]))continue;let Y=Z.index,X=i5.lastIndex,Q=1,J;while((J=i5.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:i5.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var i5,ZK;var S7=k(()=>{i5=/<\/?template\b[^>]*>/gi,ZK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var R8=()=>{};function P0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}var C7={};s(C7,{useTitle:()=>KK,useSeoMeta:()=>N8,usePageTitle:()=>KK,useHead:()=>P7,seoMetaToHeadConfig:()=>f$,resetHead:()=>QK,renderHtmlAttrs:()=>WK,renderHead:()=>qK,renderBodyAttrs:()=>UK,processTitleDirective:()=>BK,processMetaDirective:()=>_K,processHeadDirective:()=>jK,mergeHeadConfigs:()=>Q5,getPageMeta:()=>JK,getHead:()=>y7,definePageMeta:()=>GK,applyHead:()=>zK});function y7(){return B1}function JK(){return x$}function QK(){B1={},XK.length=0,x$={}}function P7($){B1=Q5(B1,$)}function Q5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function N8($){P7(f$($))}function f$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function GK($){if(x$={...x$,...$},$.title||$.description)N8({title:$.title,description:$.description})}function KK($){let Z=typeof $==="function"?$():$;P7({title:Z})}function qK($=B1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${S1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${S1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${S1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${S1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${S1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
1957
- `)}function WK($=B1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${S1(Y)}"`).join(" ")}function UK($=B1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${S1(Y)}"`).join(" ")}function S1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function zK($=B1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function jK($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1958
- `,""}),headContent:Z.trim()}}function BK($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=Q5(K,{title:G}),""})}function _K($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=Q5(j,{meta:[z]}),""})}var B1,XK,x$;var n5=k(()=>{B1={},XK=[],x$={}});var g$={};s(g$,{stripTypeScript:()=>E8,splitDeclaration:()=>y8,isCompleteImport:()=>k8,hasVariables:()=>v8,extractVariables:()=>y1,extractScriptFromTemplate:()=>C8,convertToCommonJS:()=>x7});import G5 from"path";import o5 from"process";function HK($){let Z=[],Y=0,X=$.split(`
1959
- `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((j)=>{let _=j.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...z)}}}}return[...new Set(Z)]}function E8($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let U=X[W];if(q){if(J+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,J+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")K++;else if(U===")")K--;if(U===","&&G===0&&K===0){Q.push(J),J="";continue}J+=U}if(J)Q.push(J);return Q.map((W)=>{let U=W.trim(),z=U.startsWith("..."),j=z?U.slice(3):U,_=-1,B=0;for(let A=0;A<j.length;A++)if(j[A]==="<")B++;else if(j[A]===">")B--;else if(j[A]===":"&&B===0){_=A;break}if(_===-1)return W;let L=j.substring(0,_).trim().replace(/\?$/,""),F=j.substring(_+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,U=null;while(q<Z.length&&K>0){let _=Z[q];if(U){if(_===U)U=null;q++;continue}if(_==='"'||_==="'"||_==="`"){U=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let j=Y(z);J.push({start:G+1,end:q,replacement:j})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
1964
+ }`}return`${G} { ${K} }`}let q=ZK(G,Z,Y,X),W=K;for(let[U,z]of Q)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function ZK($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(W)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`);let q=YK(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function YK($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let Q=$.slice(0,X),J=$.slice(X);if(!Q)return"";let G=Q.length,K=0;for(let q=0;q<Q.length;q++){let W=Q[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${J}`}function D8($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let X=Y.trim();if(Z.has(X))return"";return Z.add(X),Y})}function x$($,Z){if(!XK.test($))return{html:$,hasScoped:!1};let Y=N8(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${y7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=JK(W,X),z=q.replace(new RegExp(y7,"gi"),"").trim(),j=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${j}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=GK(Q,X),{html:Q,hasScoped:!0}}function JK($,Z){return M8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function GK($,Z){let Y=a0($,(Q,J)=>{let G=z1(Q,J);return G>J?G:$5(Q,J)},(Q,J)=>QK(J)),X=KK(Y.output,Z);return I8.lastIndex=0,X.replace(I8,(Q,J)=>Y.tokens[Number(J)])}function KK($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var y7,XK,QK=($)=>`\x00stx-scope-mask-${$}\x00`,I8;var P7=k(()=>{k1();y7=String.raw`(?<![\w-])scoped(?![\w-])`,XK=new RegExp(`<style\\s+[^>]*${y7}`,"i");I8=/\u0000stx-scope-mask-(\d+)\u0000/g});function WK($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return qK.test(Z)}function f$($){n5.lastIndex=0;let Z;while((Z=n5.exec($))!==null){if(Z[0].startsWith("</")||WK(Z[0]))continue;let Y=Z.index,X=n5.lastIndex,Q=1,J;while((J=n5.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:n5.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var n5,qK;var C7=k(()=>{n5=/<\/?template\b[^>]*>/gi,qK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var E8=()=>{};function P0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}var f7={};s(f7,{useTitle:()=>_K,useSeoMeta:()=>k8,usePageTitle:()=>_K,useHead:()=>x7,seoMetaToHeadConfig:()=>h$,resetHead:()=>jK,renderHtmlAttrs:()=>OK,renderHead:()=>HK,renderBodyAttrs:()=>LK,processTitleDirective:()=>wK,processMetaDirective:()=>AK,processHeadDirective:()=>VK,mergeHeadConfigs:()=>G5,getPageMeta:()=>zK,getHead:()=>v7,definePageMeta:()=>BK,applyHead:()=>FK});function v7(){return _1}function zK(){return g$}function jK(){_1={},UK.length=0,g$={}}function x7($){_1=G5(_1,$)}function G5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function k8($){x7(h$($))}function h$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function BK($){if(g$={...g$,...$},$.title||$.description)k8({title:$.title,description:$.description})}function _K($){let Z=typeof $==="function"?$():$;x7({title:Z})}function HK($=_1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${S1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${S1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${S1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${S1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${S1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
1965
+ `)}function OK($=_1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${S1(Y)}"`).join(" ")}function LK($=_1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${S1(Y)}"`).join(" ")}function S1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function FK($=_1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function VK($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1966
+ `,""}),headContent:Z.trim()}}function wK($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=G5(K,{title:G}),""})}function AK($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=G5(j,{meta:[z]}),""})}var _1,UK,g$;var o5=k(()=>{_1={},UK=[],g$={}});var d$={};s(d$,{stripTypeScript:()=>C8,splitDeclaration:()=>g8,isCompleteImport:()=>v8,hasVariables:()=>m8,extractVariables:()=>y1,extractScriptFromTemplate:()=>d8,convertToCommonJS:()=>h7});import K5 from"path";import s5 from"process";function RK($){let Z=[],Y=0,X=$.split(`
1967
+ `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((j)=>{let _=j.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...z)}}}}return[...new Set(Z)]}function C8($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let U=X[W];if(q){if(J+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,J+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")K++;else if(U===")")K--;if(U===","&&G===0&&K===0){Q.push(J),J="";continue}J+=U}if(J)Q.push(J);return Q.map((W)=>{let U=W.trim(),z=U.startsWith("..."),j=z?U.slice(3):U,_=-1,B=0;for(let A=0;A<j.length;A++)if(j[A]==="<")B++;else if(j[A]===">")B--;else if(j[A]===":"&&B===0){_=A;break}if(_===-1)return W;let L=j.substring(0,_).trim().replace(/\?$/,""),F=j.substring(_+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,U=null;while(q<Z.length&&K>0){let _=Z[q];if(U){if(_===U)U=null;q++;continue}if(_==='"'||_==="'"||_==="`"){U=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let j=Y(z);J.push({start:G+1,end:q,replacement:j})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
1960
1968
 
1961
- `),Z}async function y1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()}),P=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");P=P.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=C.transformSync(P)}catch{Q=E8($)}let J={exports:{}},G=J.exports,K=o5.cwd(),q={},W=[...Q.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 W)try{let P=G5.resolve(K,"node_modules",C),x=G5.join(P,"package.json"),u=JSON.parse(K0("fs").readFileSync(x,"utf8")),d=u.main||"index.js";if(u.exports){let W0=typeof u.exports==="string"?u.exports:u.exports["."];if(typeof W0==="string")d=W0;else if(W0?.bun)d=W0.bun;else if(W0?.import)d=W0.import;else if(W0?.default)d=W0.default}q[C]=await import(G5.resolve(P,d))}catch{}let U=(C)=>{if(q[C])return q[C];return K0(C)},z=Z.props||{},j=(C)=>{if(!C)return z;let P={};for(let[x,u]of Object.entries(C)){let d=z[x];if(d!==void 0)P[x]=d;else if(typeof u==="function")P[x]=u();else P[x]=u}return P};for(let[C,P]of Object.entries(z))Object.defineProperty(j,C,{value:P,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(j,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(C)=>{if(!C)return z;let P={...z};for(let[x,u]of Object.entries(C)){let d=u&&typeof u==="object"&&!Array.isArray(u)?u:{type:u};if(P[x]===void 0&&d.default!==void 0)P[x]=typeof d.default==="function"?d.default():d.default}return P},B=()=>Z.slots||{},H=(C,P)=>{let x={...C};for(let[u,d]of Object.entries(P))if(x[u]===void 0)if(typeof d==="function")x[u]=d();else x[u]=d;return x},L=(C)=>{let P=()=>C;return P.set=(x)=>{},P.update=(x)=>{},P},F=(C)=>{let P,x=!1;return()=>{if(!x)try{P=C(),x=!0}catch{P=void 0}return P}},O=(C)=>{},V=(C)=>C(),w=(C)=>{},A=(C)=>{},N=(C)=>{},R=()=>{let C=Z.__stxServeContext,P=Z.__stxServeSearch??C?.search??"",x=C?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(P)),path:x,name:"",fullPath:x+P,hash:"",matched:[]}},T=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),M=(C)=>{let P=Z.__stx_runtime_head||{};Z.__stx_runtime_head=Q5(P,C||{})},I=(C)=>{M(f$(C||{}))},E=(C)=>({value:C}),D=(C)=>C,y=(C)=>({value:typeof C==="function"?C():C}),S=(C,P)=>{},b=(C)=>{},v=(C)=>{},h=(C)=>C?C():Promise.resolve(),f=(C)=>(P,...x)=>{},m=(C)=>{},r=(C,P)=>{},T0=(C,P)=>P,M0=()=>({value:"light"}),d0=()=>L(!1),Z0=(C)=>L(!1),Y0=()=>L(!1),I0=()=>Z0("(prefers-color-scheme: dark)"),c0=()=>Z0("(prefers-color-scheme: light)"),K1=()=>Z0("(prefers-reduced-motion: reduce)"),o1=()=>Z0("(prefers-contrast: more)"),n={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:{}},$0=new Proxy(n,{get(C,P){if(P in C)return C[P];return},set(C,P,x){return C[P]=x,!0}}),z0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},H0=console;try{let C=x7(Q,Y),P=new Set(Object.keys(z)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),u=Object.keys(Z).filter((i)=>!P.has(i)&&i!=="props"&&x(i)),d=u.map((i)=>Z[i]),W0=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"]),O0=[],Z1=[];for(let[i,x0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(W0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(C))continue;O0.push(i),Z1.push(x0)}let S0=HK(C).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
1962
- `),i0=Z.params??{},R1=[],q1=[];for(let i=0;i<u.length;i++){if(u[i]==="params")continue;R1.push(u[i]),q1.push(d[i])}let G0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...O0,...R1,`return (async () => {
1969
+ `),Z}async function y1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()}),P=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");P=P.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=C.transformSync(P)}catch{Q=C8($)}let J={exports:{}},G=J.exports,K=s5.cwd(),q={},W=[...Q.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 W)try{let P=K5.resolve(K,"node_modules",C),x=K5.join(P,"package.json"),u=JSON.parse(K0("fs").readFileSync(x,"utf8")),d=u.main||"index.js";if(u.exports){let W0=typeof u.exports==="string"?u.exports:u.exports["."];if(typeof W0==="string")d=W0;else if(W0?.bun)d=W0.bun;else if(W0?.import)d=W0.import;else if(W0?.default)d=W0.default}q[C]=await import(K5.resolve(P,d))}catch{}let U=(C)=>{if(q[C])return q[C];return K0(C)},z=Z.props||{},j=(C)=>{if(!C)return z;let P={};for(let[x,u]of Object.entries(C)){let d=z[x];if(d!==void 0)P[x]=d;else if(typeof u==="function")P[x]=u();else P[x]=u}return P};for(let[C,P]of Object.entries(z))Object.defineProperty(j,C,{value:P,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(j,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(C)=>{if(!C)return z;let P={...z};for(let[x,u]of Object.entries(C)){let d=u&&typeof u==="object"&&!Array.isArray(u)?u:{type:u};if(P[x]===void 0&&d.default!==void 0)P[x]=typeof d.default==="function"?d.default():d.default}return P},B=()=>Z.slots||{},H=(C,P)=>{let x={...C};for(let[u,d]of Object.entries(P))if(x[u]===void 0)if(typeof d==="function")x[u]=d();else x[u]=d;return x},L=(C)=>{let P=()=>C;return P.set=(x)=>{},P.update=(x)=>{},P},F=(C)=>{let P,x=!1;return()=>{if(!x)try{P=C(),x=!0}catch{P=void 0}return P}},O=(C)=>{},V=(C)=>C(),w=(C)=>{},A=(C)=>{},N=(C)=>{},R=()=>{let C=Z.__stxServeContext,P=Z.__stxServeSearch??C?.search??"",x=C?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(P)),path:x,name:"",fullPath:x+P,hash:"",matched:[]}},M=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),T=(C)=>{let P=Z.__stx_runtime_head||{};Z.__stx_runtime_head=G5(P,C||{})},I=(C)=>{T(h$(C||{}))},E=(C)=>({value:C}),D=(C)=>C,y=(C)=>({value:typeof C==="function"?C():C}),S=(C,P)=>{},b=(C)=>{},v=(C)=>{},h=(C)=>C?C():Promise.resolve(),f=(C)=>(P,...x)=>{},m=(C)=>{},r=(C,P)=>{},M0=(C,P)=>P,T0=()=>({value:"light"}),d0=()=>L(!1),Z0=(C)=>L(!1),Y0=()=>L(!1),I0=()=>Z0("(prefers-color-scheme: dark)"),c0=()=>Z0("(prefers-color-scheme: light)"),q1=()=>Z0("(prefers-reduced-motion: reduce)"),o1=()=>Z0("(prefers-contrast: more)"),n={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:{}},$0=new Proxy(n,{get(C,P){if(P in C)return C[P];return},set(C,P,x){return C[P]=x,!0}}),z0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},A0=console;try{let C=h7(Q,Y),P=new Set(Object.keys(z)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),u=Object.keys(Z).filter((i)=>!P.has(i)&&i!=="props"&&x(i)),d=u.map((i)=>Z[i]),W0=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"]),H0=[],Z1=[];for(let[i,x0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(W0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(C))continue;H0.push(i),Z1.push(x0)}let S0=RK(C).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
1970
+ `),i0=Z.params??{},N1=[],W1=[];for(let i=0;i<u.length;i++){if(u[i]==="params")continue;N1.push(u[i]),W1.push(d[i])}let G0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...H0,...N1,`return (async () => {
1963
1971
  ${C}
1964
1972
  ${S0}
1965
1973
  return module.exports
1966
- })()`)(J,G,U,z,j,_,H,L,F,O,V,w,A,N,R,T,M,I,E,D,y,S,b,v,h,f,m,B,r,T0,M0,d0,Z0,Y0,I0,c0,K1,o1,$0,z0,H0,n.confirm,n.alert,n.fetch,i0,...Z1,...q1);if(X.preserveExisting){for(let[i,x0]of Object.entries(G0))if(!(i in Z)||Z[i]===void 0)Z[i]=x0}else Object.assign(Z,G0);for(let[i,x0]of Object.entries(z))if(!(i in Z))Z[i]=x0}catch(C){if(o5.env.STX_DEBUG){let P=C instanceof Error?C.message:String(C);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${P}`)}try{await wK(Q,Z,Y)}catch(P){if(o5.env.STX_DEBUG){let x=P instanceof Error?P.message:String(P);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function k8($){let Z=0,Y=null,X=!1,Q=!1;for(let J=0;J<$.length;J++){let G=$[J];if(Y){if(G===Y){if(Y=null,X||Z===0)Q=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",J)&&Z===0)X=!0}return Y===null&&Z===0&&Q}function x7($,Z){let Y=Z?G5.dirname(Z):o5.cwd(),X=$.split(`
1967
- `),Q=[],J=0;while(J<X.length){let G=X[J].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;J<X.length;J++){for(let q of X[J])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}J++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=J;W<X.length&&!q;W++){let U=null,z=!1,j=X[W];for(let _=0;_<j.length;_++){let B=j[_];if(z){z=!1;continue}if(B==="\\"){z=!0;continue}if(U){if(B===U)U=null;continue}if(B==='"'||B==="'"||B==="`"){U=B;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0){J=W+1,q=!0;break}}}}if(!q)J=X.length;continue}if(G.startsWith("import ")||G==="import"||G.startsWith("import{")){let K=G,q=0;while(!k8(K)&&J+q+1<X.length)q++,K=`${K} ${X[J+q].trim()}`;J+=q;let W=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=K.match(/^import\s+['"](.+?)['"]/),j=K,_=(B)=>{if(B.startsWith("."))return G5.resolve(Y,B);return B};if(W){let[,B,H]=W,L=_(H);Q.push(`const ${B} = await import('${L}')`),Q.push(`module.exports.${B} = ${B};`)}else if(U){let[,B,H]=U,L=B.trim(),F=_(H);Q.push(`const { ${L} } = await import('${F}')`);for(let O of L.split(",")){let V=O.trim().split(/\s+as\s+/).pop()?.trim();if(V)Q.push(`module.exports.${V} = ${V};`)}}else if(z){let B=_(z[1]);Q.push(`await import('${B}')`)}else Q.push(j);J++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(X[J]),J++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=T8(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=v7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=T8(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=v7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[J].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[J]=K;let W=v7(q,J);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);J=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),J++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=X[J].replace(/^export\s+/,""),U=0,z=J;for(;z<X.length;z++){let j=X[z];for(let _ of j)if(_==="{")U++;else if(_==="}")U--;if(z>J)W+=`
1968
- `+j;if(U<=0&&z>=J)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),J=z+1}else Q.push(G),J++}else if(G.includes("module.exports"))Q.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),J++;else J++}return OK(Q.join(`
1969
- `),Y)}function OK($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],U=$[Q+1];if(G){if(X+=W,W===`
1970
- `)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&U==="/"){X+=U,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&U==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&U==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=U,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let z=LK($,Q);if(z){let{quote:j,path:_,end:B}=z;if(_.startsWith(".")){let H=G5.resolve(Z,_);X+=`await import(${j}${H}${j})`,Q=B;continue}}}X+=W,Q++}return X}function LK($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function b8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=P0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function S8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=b8(Y,X);if(K){let q=S8(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function y8($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,X=(Q)=>Q===" "||Q==="\t";while(Y<$.length&&X($[Y]))Y++;if($[Y]===":"){let Q=0,J=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(J){if(G==="\\"){Y++;continue}if(G===J)J=null;continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Q++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Q--;continue}if(G==="="&&Q<=0){let K=$[Y+1],q=$[Y-1];if(K!=="="&&K!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&X($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function T8($,Z){let Y=$[Z].trim(),X=y8(Y),Q=X?[Y,X.type,X.name,X.value]:null;if(!Q){let U=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let z=Y.slice(U[0].length),j=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let B=z.startsWith("{")?"}":"]",H=z;for(let L=Z+1;L<$.length;L++)if(H+=" "+$[L].trim(),j=L,$[L].includes(B))break;z=H}let _=b8(z,0);if(_){let B=U[1],H=_.pattern,L=z.slice(_.endPos).trim();if(L.startsWith("=")){let F=L.slice(1).trim(),O=F,V=Math.max(j,Z);if(M8(F)){let R=I8($,V,F);O=R.value,V=R.nextIndex}else V=V+1;O=O.trim().replace(/;$/,"");let w=S8(H),A=`__stx_src_${Z}`,N=w.map((R)=>`module.exports.${R} = ${R};`).join(`
1974
+ })()`)(J,G,U,z,j,_,H,L,F,O,V,w,A,N,R,M,T,I,E,D,y,S,b,v,h,f,m,B,r,M0,T0,d0,Z0,Y0,I0,c0,q1,o1,$0,z0,A0,n.confirm,n.alert,n.fetch,i0,...Z1,...W1);if(X.preserveExisting){for(let[i,x0]of Object.entries(G0))if(!(i in Z)||Z[i]===void 0)Z[i]=x0}else Object.assign(Z,G0);for(let[i,x0]of Object.entries(z))if(!(i in Z))Z[i]=x0}catch(C){if(s5.env.STX_DEBUG){let P=C instanceof Error?C.message:String(C);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${P}`)}try{await DK(Q,Z,Y)}catch(P){if(s5.env.STX_DEBUG){let x=P instanceof Error?P.message:String(P);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function v8($){let Z=0,Y=null,X=!1,Q=!1;for(let J=0;J<$.length;J++){let G=$[J];if(Y){if(G===Y){if(Y=null,X||Z===0)Q=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",J)&&Z===0)X=!0}return Y===null&&Z===0&&Q}function h7($,Z){let Y=Z?K5.dirname(Z):s5.cwd(),X=$.split(`
1975
+ `),Q=[],J=0;while(J<X.length){let G=X[J].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;J<X.length;J++){for(let q of X[J])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}J++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=J;W<X.length&&!q;W++){let U=null,z=!1,j=X[W];for(let _=0;_<j.length;_++){let B=j[_];if(z){z=!1;continue}if(B==="\\"){z=!0;continue}if(U){if(B===U)U=null;continue}if(B==='"'||B==="'"||B==="`"){U=B;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0){J=W+1,q=!0;break}}}}if(!q)J=X.length;continue}if(G.startsWith("import ")||G==="import"||G.startsWith("import{")){let K=G,q=0;while(!v8(K)&&J+q+1<X.length)q++,K=`${K} ${X[J+q].trim()}`;J+=q;let W=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=K.match(/^import\s+['"](.+?)['"]/),j=K,_=(B)=>{if(B.startsWith("."))return K5.resolve(Y,B);return B};if(W){let[,B,H]=W,L=_(H);Q.push(`const ${B} = await import('${L}')`),Q.push(`module.exports.${B} = ${B};`)}else if(U){let[,B,H]=U,L=B.trim(),F=_(H);Q.push(`const { ${L} } = await import('${F}')`);for(let O of L.split(",")){let V=O.trim().split(/\s+as\s+/).pop()?.trim();if(V)Q.push(`module.exports.${V} = ${V};`)}}else if(z){let B=_(z[1]);Q.push(`await import('${B}')`)}else Q.push(j);J++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(X[J]),J++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=b8(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=g7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=b8(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=g7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[J].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[J]=K;let W=g7(q,J);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);J=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),J++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=X[J].replace(/^export\s+/,""),U=0,z=J;for(;z<X.length;z++){let j=X[z];for(let _ of j)if(_==="{")U++;else if(_==="}")U--;if(z>J)W+=`
1976
+ `+j;if(U<=0&&z>=J)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),J=z+1}else Q.push(G),J++}else if(G.includes("module.exports"))Q.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),J++;else J++}return NK(Q.join(`
1977
+ `),Y)}function NK($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],U=$[Q+1];if(G){if(X+=W,W===`
1978
+ `)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&U==="/"){X+=U,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&U==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&U==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=U,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let z=MK($,Q);if(z){let{quote:j,path:_,end:B}=z;if(_.startsWith(".")){let H=K5.resolve(Z,_);X+=`await import(${j}${H}${j})`,Q=B;continue}}}X+=W,Q++}return X}function MK($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function x8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=P0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function f8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=x8(Y,X);if(K){let q=f8(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function g8($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,X=(Q)=>Q===" "||Q==="\t";while(Y<$.length&&X($[Y]))Y++;if($[Y]===":"){let Q=0,J=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(J){if(G==="\\"){Y++;continue}if(G===J)J=null;continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Q++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Q--;continue}if(G==="="&&Q<=0){let K=$[Y+1],q=$[Y-1];if(K!=="="&&K!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&X($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function b8($,Z){let Y=$[Z].trim(),X=g8(Y),Q=X?[Y,X.type,X.name,X.value]:null;if(!Q){let U=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let z=Y.slice(U[0].length),j=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let B=z.startsWith("{")?"}":"]",H=z;for(let L=Z+1;L<$.length;L++)if(H+=" "+$[L].trim(),j=L,$[L].includes(B))break;z=H}let _=x8(z,0);if(_){let B=U[1],H=_.pattern,L=z.slice(_.endPos).trim();if(L.startsWith("=")){let F=L.slice(1).trim(),O=F,V=Math.max(j,Z);if(S8(F)){let R=y8($,V,F);O=R.value,V=R.nextIndex}else V=V+1;O=O.trim().replace(/;$/,"");let w=f8(H),A=`__stx_src_${Z}`,N=w.map((R)=>`module.exports.${R} = ${R};`).join(`
1971
1979
  `);return{type:B,name:A,value:`${O}; ${B} ${H} = ${A};
1972
- ${N}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,J,G,K]=Q,q=K,W=Z;if(M8(K)){let U=I8($,Z,K);q=U.value,W=U.nextIndex}else W=Z+1;while(W<$.length){let U=$[W].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
1973
- ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:J,name:G,value:q,nextIndex:W}}function v7($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(FK(Y)){let K=VK($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function M8($){let Z=$.trim();if(Z.startsWith("{"))return P0(Z,"{","}",0)===-1;if(Z.startsWith("["))return P0(Z,"[","]",0)===-1;return!P8(Z)}function P8($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function FK($){let Z=$.indexOf("{");if(Z===-1)return!0;return P0($,"{","}",Z)===-1}function I8($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!P8(X)){let J=$[Q];X+=`
1980
+ ${N}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,J,G,K]=Q,q=K,W=Z;if(S8(K)){let U=y8($,Z,K);q=U.value,W=U.nextIndex}else W=Z+1;while(W<$.length){let U=$[W].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
1981
+ ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:J,name:G,value:q,nextIndex:W}}function g7($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(TK(Y)){let K=IK($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function S8($){let Z=$.trim();if(Z.startsWith("{"))return P0(Z,"{","}",0)===-1;if(Z.startsWith("["))return P0(Z,"[","]",0)===-1;return!h8(Z)}function h8($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function TK($){let Z=$.indexOf("{");if(Z===-1)return!0;return P0($,"{","}",Z)===-1}function y8($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!h8(X)){let J=$[Q];X+=`
1974
1982
  ${J}`,Q++}while(Q<$.length){let J=$[Q].trim();if(J.startsWith(".")||J.startsWith("?."))X+=`
1975
- ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function VK($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(P0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1976
- ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function D8($,Z){let Y=e($,Z)??e(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...o5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function wK($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),W=D8(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of Q){let[,,G,K]=J;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=D8(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function C8($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function v8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var s5=k(()=>{n5();M1();B0()});var f7={};s(f7,{renderSlot:()=>f8,processSlots:()=>h8,parseSlots:()=>x8,parseSlotElement:()=>MK,extractSlotContent:()=>EK,applySlots:()=>kK});function AK($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function NK($,Z){let Y=null;for(let X=Z;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"){Y=Q;continue}if(Q===">")return X+1}return-1}function TK($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;if($.startsWith("<!--",J)){let j=$.indexOf("-->",J+4);Q=j===-1?$.length:j+3;continue}let G=NK($,J+1);if(G===-1)break;let K=$.slice(J,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Q=G;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let j=Y.lastIndexOf(U);if(j!==-1)Y.splice(j);Q=G;continue}if(U==="template"&&Y.length===0){let j=K.match(X);if(j){let _=AK($,G);if(_!==-1){let B=j[1]||j[2]||j[3];Z.push({start:J,end:_,slotName:B,content:$.slice(G,_-11).trim(),propsBinding:j[4]||void 0}),Q=_;continue}}}if(!/\/\s*>$/.test(K)&&!RK.has(U)){if(Y.push(U),U==="script"||U==="style"){let j=$.toLowerCase().indexOf(`</${U}>`,G);if(j!==-1){Q=j;continue}}}Q=G}return Z}function x8($){let Z={default:"",named:new Map},Y=$,X=TK($);for(let q of X)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});X.sort((q,W)=>W.start-q.start);for(let q of X)Y=Y.slice(0,q.start)+Y.slice(q.end);let Q=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=J.exec(Y))!==null){let[q,W,U,z,j,_]=G,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(B+H).trim(),F=`<${W}${L?" "+L:""}>${_}</${W}>`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,U,z,j]=G,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+B).trim(),L=`<${W}${H?" "+H:""} />`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:L})}Q.sort((q,W)=>W.start-q.start);for(let q of Q){let W=Z.named.get(q.slotName);if(W)W.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function MK($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function f8($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,U]=q.split(":").map((j)=>j.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=IK(Q,G)}return Q}function IK($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=g8(Q,Z);return o0(String(J??""))}catch{return`{{ ${X} }}`}})}function g8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!X0($))return;return J0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function h8($,Z,Y){let X=$;X=await DK(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",j=q||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(j))!==null){let L=H[1],F=H[2];_[L]=g8(F,Y)}return await f8(U,_,z,Y)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function DK($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:W}=Q[K];G=G.slice(0,W)+J[K]+G.slice(W+q.length)}return G}function EK($){let Z=x8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function kK($,Z,Y,X){return await h8($,{default:Z,named:Y},X)}var RK;var g7=k(()=>{t0();B0();RK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function _1($,Z){let Y=bK($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function bK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=P0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function SK($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function P1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function d8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=_1($,X);if(!Q)return null;let J=Q.endPos,G=P1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,j=0,_=0;while(W<K.length){let B=K.indexOf("@",W);if(B===-1)break;W=B;let H=K.substring(B);if(SK(K,B)){W++;continue}if(/^@if\s*\(/.test(H)){_++,W++;continue}if(/^@endif(?![a-z])/.test(H)){_--,W+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(j,W),start:J+j,end:J+W});let F=W+L[0].length,O=_1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,j=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(j,W),start:J+j,end:J+W}),U="else",z=void 0,W+=5,j=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(j),start:J+j,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function r5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=d8($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function h$($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=P0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,j=P1($,Z,Y,z);if(j===-1){J=Q.exec($);continue}let _=$.slice(z,j),B=j+`@${Y}`.length;X.push({fullMatch:$.slice(K,B),name:Z,params:U,content:_,start:K,end:B}),Q.lastIndex=B,J=Q.exec($)}return X}function h7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=_1($,X);if(!Q)return null;let J=Q.endPos,G=P1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let j=K.slice(W),_=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(_){if(z++,U)U.content+=_[0];W+=_[0].length;continue}if(B){if(z--,U)U.content+=B[0];W+=B[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=j.match(/^@case\s*/),L=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=_1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&j.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&j.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var m8=()=>{};var u8=()=>{};var d$=k(()=>{m8();u8()});function l$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(f0)X.add(f0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),a5)X.forEach((K)=>u$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),set:(J)=>Q.set(J),configurable:!0}),Q}function p$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,a5)X.forEach((G)=>u$.add(G));else X.forEach((G)=>G())},J=()=>{if(f0)X.add(f0);if(Y){let G=f0;f0=Q,m$.push(Q);try{Z=$()}finally{m$.pop(),f0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),configurable:!0}),J}function c$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=f0;f0=Q,m$.push(Q);try{Y=$()}finally{m$.pop(),f0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function d7($){if(a5){$();return}a5=!0;try{$()}finally{a5=!1,u$.forEach((Z)=>Z()),u$.clear()}}function m7($){vK.push($)}function u7($){xK.push($)}function i$($){return typeof $==="function"&&$._isSignal===!0}function n$($){return typeof $==="function"&&$._isDerived===!0}function l7($){if(i$($)||n$($))return $();return $}function o$($){let Z=f0;f0=null;try{return $()}finally{f0=Z}}function fK($,Z){let Y=typeof $==="function"?$:()=>$,X=l$([]),Q=p$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return c$(()=>{if(Y(),!J){J=!0;return}if(o$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((j)=>j!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var f0=null,m$,a5=!1,u$,vK,xK;var p7=k(()=>{m$=[],u$=new Set,vK=[],xK=[]});var p8={};s(p8,{useOptimistic:()=>fK,untrack:()=>l7,state:()=>l$,peek:()=>o$,onMount:()=>m7,onDestroy:()=>u7,isSignal:()=>i$,isDerived:()=>n$,generateSignalsRuntimeDev:()=>s$,generateSignalsRuntime:()=>l8,effect:()=>c$,derived:()=>p$,default:()=>hK,batch:()=>d7});function l8(){try{let $=gK(s$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return s$()}}function gK($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function s$(){return`
1983
+ ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function IK($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(P0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1984
+ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function P8($,Z){let Y=e($,Z)??e(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...s5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function DK($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),W=P8(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of Q){let[,,G,K]=J;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=P8(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function d8($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function m8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var r5=k(()=>{o5();T1();B0()});var d7={};s(d7,{renderSlot:()=>l8,processSlots:()=>c8,parseSlots:()=>u8,parseSlotElement:()=>yK,extractSlotContent:()=>vK,applySlots:()=>xK});function EK($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function bK($,Z){let Y=null;for(let X=Z;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"){Y=Q;continue}if(Q===">")return X+1}return-1}function SK($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;if($.startsWith("<!--",J)){let j=$.indexOf("-->",J+4);Q=j===-1?$.length:j+3;continue}let G=bK($,J+1);if(G===-1)break;let K=$.slice(J,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Q=G;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let j=Y.lastIndexOf(U);if(j!==-1)Y.splice(j);Q=G;continue}if(U==="template"&&Y.length===0){let j=K.match(X);if(j){let _=EK($,G);if(_!==-1){let B=j[1]||j[2]||j[3];Z.push({start:J,end:_,slotName:B,content:$.slice(G,_-11).trim(),propsBinding:j[4]||void 0}),Q=_;continue}}}if(!/\/\s*>$/.test(K)&&!kK.has(U)){if(Y.push(U),U==="script"||U==="style"){let j=$.toLowerCase().indexOf(`</${U}>`,G);if(j!==-1){Q=j;continue}}}Q=G}return Z}function u8($){let Z={default:"",named:new Map},Y=$,X=SK($);for(let q of X)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});X.sort((q,W)=>W.start-q.start);for(let q of X)Y=Y.slice(0,q.start)+Y.slice(q.end);let Q=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=J.exec(Y))!==null){let[q,W,U,z,j,_]=G,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(B+H).trim(),F=`<${W}${L?" "+L:""}>${_}</${W}>`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,U,z,j]=G,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+B).trim(),L=`<${W}${H?" "+H:""} />`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:L})}Q.sort((q,W)=>W.start-q.start);for(let q of Q){let W=Z.named.get(q.slotName);if(W)W.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function yK($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function l8($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,U]=q.split(":").map((j)=>j.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=PK(Q,G)}return Q}function PK($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=p8(Q,Z);return o0(String(J??""))}catch{return`{{ ${X} }}`}})}function p8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!X0($))return;return J0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function c8($,Z,Y){let X=$;X=await CK(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",j=q||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(j))!==null){let L=H[1],F=H[2];_[L]=p8(F,Y)}return await l8(U,_,z,Y)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function CK($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:W}=Q[K];G=G.slice(0,W)+J[K]+G.slice(W+q.length)}return G}function vK($){let Z=u8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function xK($,Z,Y,X){return await c8($,{default:Z,named:Y},X)}var kK;var m7=k(()=>{t0();B0();kK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function H1($,Z){let Y=fK($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function fK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=P0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function gK($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function P1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function i8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=H1($,X);if(!Q)return null;let J=Q.endPos,G=P1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,j=0,_=0;while(W<K.length){let B=K.indexOf("@",W);if(B===-1)break;W=B;let H=K.substring(B);if(gK(K,B)){W++;continue}if(/^@if\s*\(/.test(H)){_++,W++;continue}if(/^@endif(?![a-z])/.test(H)){_--,W+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(j,W),start:J+j,end:J+W});let F=W+L[0].length,O=H1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,j=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(j,W),start:J+j,end:J+W}),U="else",z=void 0,W+=5,j=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(j),start:J+j,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function a5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=i8($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function m$($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=P0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,j=P1($,Z,Y,z);if(j===-1){J=Q.exec($);continue}let _=$.slice(z,j),B=j+`@${Y}`.length;X.push({fullMatch:$.slice(K,B),name:Z,params:U,content:_,start:K,end:B}),Q.lastIndex=B,J=Q.exec($)}return X}function u7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=H1($,X);if(!Q)return null;let J=Q.endPos,G=P1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let j=K.slice(W),_=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(_){if(z++,U)U.content+=_[0];W+=_[0].length;continue}if(B){if(z--,U)U.content+=B[0];W+=B[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=j.match(/^@case\s*/),L=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=H1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&j.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&j.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var n8=()=>{};var o8=()=>{};var u$=k(()=>{n8();o8()});function c$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(f0)X.add(f0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),t5)X.forEach((K)=>p$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),set:(J)=>Q.set(J),configurable:!0}),Q}function i$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,t5)X.forEach((G)=>p$.add(G));else X.forEach((G)=>G())},J=()=>{if(f0)X.add(f0);if(Y){let G=f0;f0=Q,l$.push(Q);try{Z=$()}finally{l$.pop(),f0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),configurable:!0}),J}function n$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=f0;f0=Q,l$.push(Q);try{Y=$()}finally{l$.pop(),f0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function l7($){if(t5){$();return}t5=!0;try{$()}finally{t5=!1,p$.forEach((Z)=>Z()),p$.clear()}}function p7($){uK.push($)}function c7($){lK.push($)}function o$($){return typeof $==="function"&&$._isSignal===!0}function s$($){return typeof $==="function"&&$._isDerived===!0}function i7($){if(o$($)||s$($))return $();return $}function r$($){let Z=f0;f0=null;try{return $()}finally{f0=Z}}function pK($,Z){let Y=typeof $==="function"?$:()=>$,X=c$([]),Q=i$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return n$(()=>{if(Y(),!J){J=!0;return}if(r$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((j)=>j!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var f0=null,l$,t5=!1,p$,uK,lK;var n7=k(()=>{l$=[],p$=new Set,uK=[],lK=[]});var r8={};s(r8,{useOptimistic:()=>pK,untrack:()=>i7,state:()=>c$,peek:()=>r$,onMount:()=>p7,onDestroy:()=>c7,isSignal:()=>o$,isDerived:()=>s$,generateSignalsRuntimeDev:()=>a$,generateSignalsRuntime:()=>s8,effect:()=>n$,derived:()=>i$,default:()=>iK,batch:()=>l7});function s8(){try{let $=cK(a$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return a$()}}function cK($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function a$(){return`
1977
1985
  // STX Signals Runtime (Development Build)
1978
1986
  console.log('[stx] signals runtime loading');
1979
1987
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -8515,7 +8523,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
8515
8523
  }
8516
8524
  }
8517
8525
  })();
8518
- `}var hK;var c8=k(()=>{p7();p7();hK={state:l$,derived:p$,effect:c$,batch:d7,onMount:m7,onDestroy:u7,isSignal:i$,isDerived:n$,untrack:l7,peek:o$,generateSignalsRuntime:l8,generateSignalsRuntimeDev:s$}});var c7={};s(c7,{templateCache:()=>i8,readFileCached:()=>dK,invalidateFileCacheByDir:()=>uK,invalidateFileCache:()=>mK,hashFilePath:()=>t5,getCachedSignalsRuntime:()=>cK,getCachedRouterScript:()=>iK,clearDevCaches:()=>nK,checkCache:()=>oK,cacheTemplate:()=>sK,__setSignalsGeneratorsForTest:()=>pK});import H1 from"fs";import K5 from"path";async function dK($){let Y;for(let X=0;X<3;X++)try{let J=(await H1.promises.stat($)).mtime.getTime(),G=C1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await H1.promises.stat($)).mtime.getTime();if(W!==J)continue;return C1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw C1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function mK($){C1.delete($)}function uK($){for(let Z of C1.keys())if(Z.startsWith($))C1.delete(Z)}function pK($){n8=$}async function cK($=!1){let Z=n8??await Promise.resolve().then(() => (c8(),p8));if($)return Z.generateSignalsRuntimeDev();if(r$===null)r$=Z.generateSignalsRuntime();return r$}async function iK(){if(a$===null){let{getRouterScript:$}=await import("stx-router");a$=$()}return a$}function nK(){C1.clear(),s8(),r$=null,lK=null,a$=null}function o8($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function oK($,Z){try{if(!Z.cachePath)return null;let Y=K5.resolve(Z.cachePath),X=K5.join(Y,`${t5($)}.html`),Q=K5.join(Y,`${t5($)}.meta.json`);if(!await c(X)||!await c(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==o8(Z))return null;if((await H1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await H1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function sK($,Z,Y,X){try{if(!X.cachePath)return;let Q=K5.resolve(X.cachePath);await H1.promises.mkdir(Q,{recursive:!0});let J=K5.join(Q,`${t5($)}.html`),G=K5.join(Q,`${t5($)}.meta.json`),K=await H1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:o8(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),i8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function t5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,rK)}var i8,C1,r$=null,lK=null,n8=null,a$=null,rK=16;var i7=k(()=>{F0();i8=new Map,C1=new Map});function r8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
8526
+ `}var iK;var a8=k(()=>{n7();n7();iK={state:c$,derived:i$,effect:n$,batch:l7,onMount:p7,onDestroy:c7,isSignal:o$,isDerived:s$,untrack:i7,peek:r$,generateSignalsRuntime:s8,generateSignalsRuntimeDev:a$}});var o7={};s(o7,{templateCache:()=>t8,readFileCached:()=>nK,invalidateFileCacheByDir:()=>sK,invalidateFileCache:()=>oK,hashFilePath:()=>e5,getCachedSignalsRuntime:()=>tK,getCachedRouterScript:()=>eK,clearDevCaches:()=>$q,checkCache:()=>Zq,cacheTemplate:()=>Yq,__setSignalsGeneratorsForTest:()=>aK});import O1 from"fs";import q5 from"path";async function nK($){let Y;for(let X=0;X<3;X++)try{let J=(await O1.promises.stat($)).mtime.getTime(),G=C1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await O1.promises.stat($)).mtime.getTime();if(W!==J)continue;return C1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw C1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function oK($){C1.delete($)}function sK($){for(let Z of C1.keys())if(Z.startsWith($))C1.delete(Z)}function aK($){e8=$}async function tK($=!1){let Z=e8??await Promise.resolve().then(() => (a8(),r8));if($)return Z.generateSignalsRuntimeDev();if(t$===null)t$=Z.generateSignalsRuntime();return t$}async function eK(){if(e$===null){let{getRouterScript:$}=await import("stx-router");e$=$()}return e$}function $q(){C1.clear(),ZZ(),t$=null,rK=null,e$=null}function $Z($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function Zq($,Z){try{if(!Z.cachePath)return null;let Y=q5.resolve(Z.cachePath),X=q5.join(Y,`${e5($)}.html`),Q=q5.join(Y,`${e5($)}.meta.json`);if(!await c(X)||!await c(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==$Z(Z))return null;if((await O1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await O1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function Yq($,Z,Y,X){try{if(!X.cachePath)return;let Q=q5.resolve(X.cachePath);await O1.promises.mkdir(Q,{recursive:!0});let J=q5.join(Q,`${e5($)}.html`),G=q5.join(Q,`${e5($)}.meta.json`),K=await O1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:$Z(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),t8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function e5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Xq)}var t8,C1,t$=null,rK=null,e8=null,e$=null,Xq=16;var s7=k(()=>{L0();t8=new Map,C1=new Map});function YZ($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
8519
8527
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((X=Q.exec($))!==null)Y+=X[1]+`
8520
8528
  `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"].some((j)=>{return new RegExp(`\\b${j}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,W,U=!1;while((W=q.exec(Y))!==null)if(!K.has(W[1])){U=!0;break}if(!G&&!U)return $;let z=`<script type="module">
8521
8529
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -8524,50 +8532,49 @@ import '@stacksjs/browser'
8524
8532
  `+$.slice(B);return $.replace("</head>",`${z}
8525
8533
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
8526
8534
  ${z}`);return z+`
8527
- `+$}async function a8($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
8535
+ `+$}async function XZ($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
8528
8536
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
8529
8537
  `+$.slice(q)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
8530
8538
  `+$}if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
8531
8539
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
8532
8540
  `+$.slice(q)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
8533
- `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (i7(),c7)),Q=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
8541
+ `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (s7(),o7)),Q=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
8534
8542
  `+$.slice(J);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
8535
8543
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
8536
8544
  `+Q+$.slice(K+1)}return Q+`
8537
- `+$}async function t8($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8538
- `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (i7(),c7)),J=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
8539
- </body>`+$.slice(G+7)}var Z4={};s(Z4,{scanScriptTags:()=>QZ,rewriteStxImportSpecifiers:()=>WZ,processSignals:()=>a7,processScriptSetup:()=>KZ,preEvalLiteralReactiveIfs:()=>s7,parseLoopExpression:()=>GZ,hasSignalsSyntax:()=>$4,findMarkupIndexOutsideScripts:()=>e$,extractExports:()=>qZ,convertSignalLoopsToAttributes:()=>r7,convertSignalDirectivesToAttributes:()=>o7});function QZ($,Z={}){let Y=[];for(let X of M7($,U1)){let Q=X.token.match(/^<script\b([^>]*)>/i),J=X.token.match(/<\/script\s*>$/i);if(!Q||!J)continue;let G=Q[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=Q[0].length,q=X.token.length-J[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function GZ($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=$Z(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=$Z(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function $Z($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function $4($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function tK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function eK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function $q($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function YZ($,Z,Y){if(!$)return!1;let X=$q($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let j=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(ZZ.has(j))continue;if(Z.has(j))Q=!0;else if(Y&&j in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let j=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(ZZ.has(j)||Y&&j in Y)continue;G=!0}return(Q||G)&&!J}function t$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(JZ);if(J&&Zq(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function Zq($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function o7($,Z){let Y=eK($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,U=W+K[0].length,z=1,j=U;while(j<J.length&&z>0){if(J[j]==="(")z++;else if(J[j]===")")z--;j++}if(z!==0)continue;let _=J.substring(U,j-1).trim(),B=j,H=1,L=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(B,L-6).trim(),w;if(tK(V)){let A=r5(J.substring(W,L));if(A.length===0)continue;let N=A[0].branches.filter((M)=>M.type!=="else");if(!(N.length>0&&N.every((M)=>YZ(M.condition,Y,Z))))continue;w=A[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return t$(I,"@else-if",M.condition??"");if(M.type==="else")return t$(I,"@else");return t$(I,"@if",M.condition??"")}).join(`
8540
- `)}else{if(!YZ(_,Y,Z))continue;w=t$(X(V),"@if",_)}q.push({start:W,end:L,replacement:w}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:j}=q[W];J=J.substring(0,U)+j+J.substring(z)}return J}return X($)}function Yq($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function Xq($,Z,Y,X){if(n7.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let B=J.indexOf(`</${U[1].toLowerCase()}`,q);if(B===-1)return-1;let H=$.indexOf(">",B);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let j=$.indexOf(">",q);if(j===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,j+1);if(!(/\/\s*>$/.test(_)||n7.has(Q)))K++}q=j+1}return-1}function Qq($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return Jq.test(J)}function s7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([j,_])=>z>=j&&z<_),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[z,j,_,B,H,L,F]=K,O=Yq(H);if(O===void 0)continue;let V=K.index,w=V+z.length,R=!!F||/\/\s*>$/.test(z)||n7.has(j.toLowerCase())?w:Xq($,V,j,w);if(R===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Qq($,R)){J.lastIndex=w;continue}if(O===!0){let M=`<${j}${_}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:R,replacement:""}),J.lastIndex=R}if(G.length===0)return $;G.sort((z,j)=>z.start-j.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:j,end:_,replacement:B}=q[z];U=U.substring(0,j)+B+U.substring(_)}return U}function r7($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),j=U,_=GZ(z);if(_.iterable){let N=_.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let R=N.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let B=G==="for"?"@endfor":"@endforeach",H=1,L=j,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=j;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(j,L-B.length).trim(),w=V.match(JZ),A;if(w){let[,N,R,T]=w;A=`<${N}${R} @for="${z}">${T}</${N}>`}else A=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:A})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function Gq($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let j=$[z];if(j==="\\"){z+=2;continue}if(j===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
8545
+ `+$}async function JZ($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8546
+ `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (s7(),o7)),J=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
8547
+ </body>`+$.slice(G+7)}var X4={};s(X4,{scanScriptTags:()=>zZ,rewriteStxImportSpecifiers:()=>HZ,processSignals:()=>$3,processScriptSetup:()=>BZ,preEvalLiteralReactiveIfs:()=>t7,parseLoopExpression:()=>jZ,hasSignalsSyntax:()=>Y4,findMarkupIndexOutsideScripts:()=>Z4,extractExports:()=>_Z,convertSignalLoopsToAttributes:()=>e7,convertSignalDirectivesToAttributes:()=>a7});function zZ($,Z={}){let Y=[];for(let X of E7($,z1)){let Q=X.token.match(/^<script\b([^>]*)>/i),J=X.token.match(/<\/script\s*>$/i);if(!Q||!J)continue;let G=Q[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=Q[0].length,q=X.token.length-J[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function jZ($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=GZ(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=GZ(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function GZ($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function Y4($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function Qq($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function Gq($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function Kq($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function qZ($,Z,Y){if(!$)return!1;let X=Kq($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let j=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(KZ.has(j))continue;if(Z.has(j))Q=!0;else if(Y&&j in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let j=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(KZ.has(j)||Y&&j in Y)continue;G=!0}return(Q||G)&&!J}function $4($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(UZ);if(J&&qq(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function qq($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function a7($,Z){let Y=Gq($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,U=W+K[0].length,z=1,j=U;while(j<J.length&&z>0){if(J[j]==="(")z++;else if(J[j]===")")z--;j++}if(z!==0)continue;let _=J.substring(U,j-1).trim(),B=j,H=1,L=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(B,L-6).trim(),w;if(Qq(V)){let A=a5(J.substring(W,L));if(A.length===0)continue;let N=A[0].branches.filter((T)=>T.type!=="else");if(!(N.length>0&&N.every((T)=>qZ(T.condition,Y,Z))))continue;w=A[0].branches.map((T)=>{let I=X(T.content);if(T.type==="elseif")return $4(I,"@else-if",T.condition??"");if(T.type==="else")return $4(I,"@else");return $4(I,"@if",T.condition??"")}).join(`
8548
+ `)}else{if(!qZ(_,Y,Z))continue;w=$4(X(V),"@if",_)}q.push({start:W,end:L,replacement:w}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:j}=q[W];J=J.substring(0,U)+j+J.substring(z)}return J}return X($)}function Wq($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function Uq($,Z,Y,X){if(r7.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let B=J.indexOf(`</${U[1].toLowerCase()}`,q);if(B===-1)return-1;let H=$.indexOf(">",B);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let j=$.indexOf(">",q);if(j===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,j+1);if(!(/\/\s*>$/.test(_)||r7.has(Q)))K++}q=j+1}return-1}function jq($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return zq.test(J)}function t7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([j,_])=>z>=j&&z<_),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[z,j,_,B,H,L,F]=K,O=Wq(H);if(O===void 0)continue;let V=K.index,w=V+z.length,R=!!F||/\/\s*>$/.test(z)||r7.has(j.toLowerCase())?w:Uq($,V,j,w);if(R===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&jq($,R)){J.lastIndex=w;continue}if(O===!0){let T=`<${j}${_}${L}${F}>`;G.push({start:V,end:w,replacement:T});continue}G.push({start:V,end:R,replacement:""}),J.lastIndex=R}if(G.length===0)return $;G.sort((z,j)=>z.start-j.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:j,end:_,replacement:B}=q[z];U=U.substring(0,j)+B+U.substring(_)}return U}function e7($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),j=U,_=jZ(z);if(_.iterable){let N=_.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let R=N.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let B=G==="for"?"@endfor":"@endforeach",H=1,L=j,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=j;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(j,L-B.length).trim(),w=V.match(UZ),A;if(w){let[,N,R,M]=w;A=`<${N}${R} @for="${z}">${M}</${N}>`}else A=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:A})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function Bq($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let j=$[z];if(j==="\\"){z+=2;continue}if(j===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
8541
8549
  `)U++;return U},q=()=>{let U=X+2;while(U<J-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return J},W=(U)=>{let z=U,j=0;while(z<J){let _=$[z];if(_==="/"&&$[z+1]==="/"){let B=z+2;while(B<J&&$[B]!==`
8542
- `)B++;z=B;continue}if(_==="/"&&$[z+1]==="*"){let B=z+2;while(B<J-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(_==='"'||_==="'"||_==="`"){let B=z+1;while(B<J){if($[B]==="\\"){B+=2;continue}if($[B]===_){B++;break}B++}z=B;continue}if(_==="("||_==="["||_==="{"){j++,z++;continue}if(_===")"||_==="]"||_==="}"){j--,z++;continue}if(_===";"&&j===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let B=_[2],H=W(X+_[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),X=H;continue}Z.add(B),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function KZ($,Z,Y){let X=QZ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let L of X){let F=L.body;if(D1(L.attrs))F=E1(F);if(Q.test(F))J.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${aK++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (x5(),v5)),W=[];for(let L=0;L<J.length;L++){let F=J[L].content;if(F=t1(F).code,K(F))console.log("[stx:bundler] bundling signal script imports"),F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>WZ(w));let O=n0(F);W.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
8550
+ `)B++;z=B;continue}if(_==="/"&&$[z+1]==="*"){let B=z+2;while(B<J-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(_==='"'||_==="'"||_==="`"){let B=z+1;while(B<J){if($[B]==="\\"){B+=2;continue}if($[B]===_){B++;break}B++}z=B;continue}if(_==="("||_==="["||_==="{"){j++,z++;continue}if(_===")"||_==="]"||_==="}"){j--,z++;continue}if(_===";"&&j===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let B=_[2],H=W(X+_[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),X=H;continue}Z.add(B),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function BZ($,Z,Y){let X=zZ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let L of X){let F=L.body;if(D1(L.attrs))F=E1(F);if(Q.test(F))J.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${Jq++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (f5(),x5)),W=[];for(let L=0;L<J.length;L++){let F=J[L].content;if(F=e1(F).code,K(F))console.log("[stx:bundler] bundling signal script imports"),F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>HZ(w));let O=n0(F);W.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
8543
8551
  ${O}`)}let U=W.join(`
8544
8552
 
8545
- `);U=Gq(U);let z=qZ(U),j=z.split(",").map((L)=>L.trim()).filter(Boolean),_=E$(U,Y),B=`
8553
+ `);U=Bq(U);let z=_Z(U),j=z.split(",").map((L)=>L.trim()).filter(Boolean),_=k$(U,Y),B=`
8546
8554
  <script data-stx-scoped>
8547
8555
  function ${G}() {
8548
- ${Z5("const",j)}
8556
+ ${Y5("const",j)}
8549
8557
  ${_}${U}
8550
8558
  return { ${z} };
8551
8559
  }
8552
8560
  window.__stx_latestSetup=${G};
8553
8561
  if(window.stx)window.stx._latestSetup=${G};
8554
- </script>`,H=$;for(let L of J)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${e8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${e8})>`,"gi"),(O,V,w)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:H,setupCode:B}}function qZ($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let B=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!B){B=!0,J++;continue}if(H==="]"&&B){B=!1,J++;continue}if(H==="/"&&!B){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8562
+ </script>`,H=$;for(let L of J)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${QZ})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${QZ})>`,"gi"),(O,V,w)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:H,setupCode:B}}function _Z($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let B=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!B){B=!0,J++;continue}if(H==="]"&&B){B=!1,J++;continue}if(H==="/"&&!B){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8555
8563
  `)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(B)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===B){J++;return}J++}},z=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let B=1;while(J<G&&B>0)if(Z[J]==="{")B++,J++;else if(Z[J]==="}")B--,J++;else if(Z[J]==="'"||Z[J]==='"')U(Z[J]);else if(Z[J]==="`")z();else J++;continue}J++}},j=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
8556
- `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(Q!==0)return;let B=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(j())continue;if(Z[J]==="'"||Z[J]==='"'){U(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function a7($,Z,Y,X){if(!$4($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await KZ(Q,Y,X);if(Q=J,Q=await a8(Q,Z),Q=r8(Q),G){let U=e$(Q,/<\/head>/i),z=U===-1?e$(Q,/<body[^>]*>/i):-1;if(U!==-1)Q=`${Q.slice(0,U)}${G}
8564
+ `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(Q!==0)return;let B=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(j())continue;if(Z[J]==="'"||Z[J]==='"'){U(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function $3($,Z,Y,X){if(!Y4($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await BZ(Q,Y,X);if(Q=J,Q=await XZ(Q,Z),Q=YZ(Q),G){let U=Z4(Q,/<\/head>/i),z=U===-1?Z4(Q,/<body[^>]*>/i):-1;if(U!==-1)Q=`${Q.slice(0,U)}${G}
8557
8565
  ${Q.slice(U)}`;else if(z!==-1){let j=/<body[^>]*>/i.exec(Q.slice(z))[0],_=z+j.length;Q=`${Q.slice(0,_)}
8558
8566
  ${G}${Q.slice(_)}`}else Q=`${Q}
8559
- ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=e$(Q,U);if(z!==-1){let j=Q.slice(0,z),_=Q.slice(z).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=j+_}}return Q}function e$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([U,z])=>q>=U&&q<z))return q;G=q+Math.max(K[0].length,1)}return-1}function WZ($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return XZ;return`var ${Z.join(", ")}; ${XZ}`}var aK=0,e8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,JZ,ZZ,n7,Jq,XZ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var e5=k(()=>{d5();d$();c5();F0();k1();JZ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;ZZ=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"]);n7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Jq=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Kq from"fs";import g from"path";function Wq($){let Z=new WeakSet;try{let Y=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(Y);let Q={};for(let J of Object.keys(X).sort())Q[J]=Y(X[J]);return Q};return JSON.stringify(Y($))}catch{return null}}function UZ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Uq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function D1($){return!Uq($)}function E1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function zq($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(U)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let U=1;while(Q<J&&U>0)if($[Q]==="{")U++,Q++;else if($[Q]==="}")U--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
8560
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of B)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function jq($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function Bq($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function _q($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of jq(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=Bq(W);if(U===-1)continue;let z=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let j=W.slice(U+1).trim();if(!j)continue;try{let _=Object.keys(Z),B=Function(..._,`"use strict"; return (${j});`);Z[z]=B(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function J4($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?g.resolve(Q.root):void 0,z=U??g.dirname(X),j=[],_=(L)=>{if(L&&!j.includes(L))j.push(L)},B=Y.__originalFilePath;if(B)_(g.join(g.dirname(B),"components"));_(Z),_(Q._rootComponentsDir),_(g.join(g.dirname(X),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(U)_(g.resolve(U,"resources/views/components")),_(g.resolve(U,"resources/components")),_(g.resolve(U,"src/components")),_(g.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return c(g.resolve(g.dirname(X),`${J}.stx`));for(let L of j){let F=g.isAbsolute(L)?L:g.resolve(z,L);for(let O of W)if(await c(g.join(F,O)))return!0}return!1}function Hq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Oq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Lq($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Q;while((Q=Y.exec(X))!==null)Z.add(Q[1]);Y.lastIndex=0}return[...Z]}async function v1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (s5(),g$)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=j&&j!=="load"&&Hq(j)?j:"";try{let B=(P)=>P.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let P=[L,L.toLowerCase(),B(L),H(L)];for(let x of P)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let P=[`${L}.stx`,`${B(L)}.stx`,`${H(L)}.stx`],x=[...new Set(P)],u=Q.__originalFilePath,d=[];if(u){let G0=g.join(g.dirname(u),"components");d.push(G0)}if(X)d.push(X);let W0=G._rootComponentsDir;if(typeof W0==="string"&&!d.includes(W0))d.push(W0);let O0=g.join(g.dirname(J),"components");if(!d.includes(O0))d.push(O0);if(G.componentsDir&&G.componentsDir!==X&&!d.includes(G.componentsDir))d.push(G.componentsDir);let Z1=G._pluginComponentDirs;if(Array.isArray(Z1)){for(let G0 of Z1)if(typeof G0==="string"&&!d.includes(G0))d.push(G0)}let m0=typeof G.root==="string"?g.resolve(G.root):void 0,S0=m0??g.dirname(J),i0=[];if(m0)i0.push(g.resolve(m0,"resources/views/components")),i0.push(g.resolve(m0,"resources/components")),i0.push(g.resolve(m0,"src/components")),i0.push(g.resolve(m0,"components"));i0.push(g.resolve(import.meta.dir,"components"));for(let G0 of i0)if(!d.includes(G0))d.push(G0);let R1=[...new Set(d.map((G0)=>{if(!G0)return G0;return g.isAbsolute(G0)?G0:g.resolve(S0,G0)}))];d.length=0,d.push(...R1);let q1=`${L}\x00${J}\x00${R1.join("\x00")}`,s1=X4.get(q1);if(s1)if(await c(s1))F=s1;else X4.delete(q1);if(!F&&(L.startsWith("./")||L.startsWith("../")))F=g.resolve(g.dirname(J),`${L}.stx`),V.push(F);else if(!F)for(let G0 of d){if(!G0)continue;for(let i of x){let x0=g.join(G0,i);if(V.push(x0),await c(x0)){F=x0;break}}if(F)break;if(!F)try{let i=await import("fs");if(!i.statSync(G0,{throwIfNoEntry:!1})?.isDirectory())continue;let N1=8,D5=[{path:G0,depth:0}];while(D5.length>0&&!F){let L$=D5.pop();if(L$.depth>=N1)continue;let Z9;try{Z9=i.readdirSync(L$.path,{withFileTypes:!0})}catch{continue}for(let F$ of Z9){if(!F$.isDirectory())continue;if(F$.name==="node_modules"||F$.name.startsWith("."))continue;let Y9=g.join(L$.path,F$.name);for(let HQ of x){let B7=g.join(Y9,HQ);if(V.push(B7),await c(B7)){F=B7;break}}if(F)break;D5.push({path:Y9,depth:L$.depth+1})}}}catch{}if(F)break}if(F)X4.set(q1,F)}if(!F||!await c(F)){let P=V.length>0?`
8567
+ ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=Z4(Q,U);if(z!==-1){let j=Q.slice(0,z),_=Q.slice(z).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=j+_}}return Q}function Z4($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([U,z])=>q>=U&&q<z))return q;G=q+Math.max(K[0].length,1)}return-1}function HZ($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return WZ;return`var ${Z.join(", ")}; ${WZ}`}var Jq=0,QZ=`(?:"[^"]*"|'[^']*'|[^>"'])*`,UZ,KZ,r7,zq,WZ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var $$=k(()=>{m5();u$();i5();L0();k1();UZ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;KZ=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"]);r7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);zq=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import _q from"fs";import g from"path";function Oq($){let Z=new WeakSet;try{let Y=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(Y);let Q={};for(let J of Object.keys(X).sort())Q[J]=Y(X[J]);return Q};return JSON.stringify(Y($))}catch{return null}}function OZ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Lq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function D1($){return!Lq($)}function E1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Fq($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(U)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let U=1;while(Q<J&&U>0)if($[Q]==="{")U++,Q++;else if($[Q]==="}")U--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
8568
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of B)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function Vq($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function wq($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Aq($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of Vq(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=wq(W);if(U===-1)continue;let z=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let j=W.slice(U+1).trim();if(!j)continue;try{let _=Object.keys(Z),B=Function(..._,`"use strict"; return (${j});`);Z[z]=B(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function G4($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?g.resolve(Q.root):void 0,z=U??g.dirname(X),j=[],_=(L)=>{if(L&&!j.includes(L))j.push(L)},B=Y.__originalFilePath;if(B)_(g.join(g.dirname(B),"components"));_(Z),_(Q._rootComponentsDir),_(g.join(g.dirname(X),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(U)_(g.resolve(U,"resources/views/components")),_(g.resolve(U,"resources/components")),_(g.resolve(U,"src/components")),_(g.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return c(g.resolve(g.dirname(X),`${J}.stx`));for(let L of j){let F=g.isAbsolute(L)?L:g.resolve(z,L);for(let O of W)if(await c(g.join(F,O)))return!0}return!1}function Rq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Nq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Mq($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Q;while((Q=Y.exec(X))!==null)Z.add(Q[1]);Y.lastIndex=0}return[...Z]}async function v1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (r5(),d$)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=j&&j!=="load"&&Rq(j)?j:"";try{let B=(P)=>P.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let P=[L,L.toLowerCase(),B(L),H(L)];for(let x of P)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let P=[`${L}.stx`,`${B(L)}.stx`,`${H(L)}.stx`],x=[...new Set(P)],u=Q.__originalFilePath,d=[];if(u){let G0=g.join(g.dirname(u),"components");d.push(G0)}if(X)d.push(X);let W0=G._rootComponentsDir;if(typeof W0==="string"&&!d.includes(W0))d.push(W0);let H0=g.join(g.dirname(J),"components");if(!d.includes(H0))d.push(H0);if(G.componentsDir&&G.componentsDir!==X&&!d.includes(G.componentsDir))d.push(G.componentsDir);let Z1=G._pluginComponentDirs;if(Array.isArray(Z1)){for(let G0 of Z1)if(typeof G0==="string"&&!d.includes(G0))d.push(G0)}let m0=typeof G.root==="string"?g.resolve(G.root):void 0,S0=m0??g.dirname(J),i0=[];if(m0)i0.push(g.resolve(m0,"resources/views/components")),i0.push(g.resolve(m0,"resources/components")),i0.push(g.resolve(m0,"src/components")),i0.push(g.resolve(m0,"components"));i0.push(g.resolve(import.meta.dir,"components"));for(let G0 of i0)if(!d.includes(G0))d.push(G0);let N1=[...new Set(d.map((G0)=>{if(!G0)return G0;return g.isAbsolute(G0)?G0:g.resolve(S0,G0)}))];d.length=0,d.push(...N1);let W1=`${L}\x00${J}\x00${N1.join("\x00")}`,s1=Q4.get(W1);if(s1)if(await c(s1))F=s1;else Q4.delete(W1);if(!F&&(L.startsWith("./")||L.startsWith("../")))F=g.resolve(g.dirname(J),`${L}.stx`),V.push(F);else if(!F)for(let G0 of d){if(!G0)continue;for(let i of x){let x0=g.join(G0,i);if(V.push(x0),await c(x0)){F=x0;break}}if(F)break;if(!F)try{let i=await import("fs");if(!i.statSync(G0,{throwIfNoEntry:!1})?.isDirectory())continue;let E5=8,r1=[{path:G0,depth:0}];while(r1.length>0&&!F){let Y1=r1.pop();if(Y1.depth>=E5)continue;let F$;try{F$=i.readdirSync(Y1.path,{withFileTypes:!0})}catch{continue}for(let V$ of F$){if(!V$.isDirectory())continue;if(V$.name==="node_modules"||V$.name.startsWith("."))continue;let J9=g.join(Y1.path,V$.name);for(let AQ of x){let H7=g.join(J9,AQ);if(V.push(H7),await c(H7)){F=H7;break}}if(F)break;r1.push({path:J9,depth:Y1.depth+1})}}}catch{}if(F)break}if(F)Q4.set(W1,F)}if(!F||!await c(F)){let P=V.length>0?`
8561
8569
  Searched paths:
8562
8570
  ${V.map((x)=>` - ${x}`).join(`
8563
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}q.add(F);let w;if(Y4.has(F))w=Y4.get(F);else try{w=await Bun.file(F).text(),Y4.set(F,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[P,x]of Object.entries(Q))if(!P.startsWith("__")||A.has(P))N[P]=x;let{extractSlotContent:R}=await Promise.resolve().then(() => (g7(),f7)),T=R(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[P,x]of T.namedSlots)M[P]=x.content;let I={...N,...Z,props:Z,slot:Y,$slots:M,__processedComponents:z,__sections:{},...Oq(Y)&&{__stx_force_signals:!0}};_q(w,I);let E=w,D=v$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],b=[],v=S.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&S.every((P)=>/\bserver\b/.test(P[1]||"")),h=null,f=null;if(v){let P=Wq({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){h=`${F}\x00${P}`;let x=t7.get(h);if(x){for(let u of x.dependencies)q.add(u);return x.output}f=new Set(q)}}for(let P of S){let x=P[1]||"",u=P[2]||"",d=x.includes("server");if(D1(x)&&u.trim())u=E1(u);if(d&&u)try{await W(u,I,F)}catch(O0){}if(!d){let O0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Z1=O0.includes("{{")&&O0.includes("}}"),m0=O0.includes("{!!")&&O0.includes("!!}");if(Z1||m0)O0=y$(O0,I);let S0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${S0}>${O0}</script>`)}}let m=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),r=m?m[1]:"",T0=m?m[2]:"",M0="",d0=r&&/\bscoped\b/i.test(r);if(m)M0=`<style${r}>${T0}</style>`;let Z0=E;if(Z0=Z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),m)Z0=Z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(Z0=Z0.replace(P,(u,d)=>{let W0=d.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(W0)x.push(`<style${W0[1]}>${W0[2]}</style>`);return""}),Z0=Z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)M0=`${M0}${x.join(`
8564
- `)}`}if(Y&&Z0.includes("{{ text || slot }}"))Z0=Z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:Y0}=await Promise.resolve().then(() => (g7(),f7)),{defaultSlot:I0,namedSlots:c0}=T;Z0=await Y0(Z0,I0,c0,I);for(let[P,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let u=I7(x);I[P]=u}}let K1=b.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),o1=Lq(b);if(o1.length>0)I.__stx_client_signal_names=o1;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:K1||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let $0=await w0(Z0,I,F,n,q),z0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let P of $0.matchAll(/\{\{([\s\S]*?)\}\}/g))z0.add(P[1].trim());if(z0.size>0)Q.__stx_preserved_client_expressions=[...z0];let H0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++qq}_${Math.random().toString(36).slice(2,8)}`,C=$0;if(K1){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${UZ(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${UZ(_)}"`:"";C=`<div data-stx-scope="${H0}"${P}${x}>${$0}</div>`;let u=await Promise.all(b.map(async(d)=>{let W0=d.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!W0)return d;let[,O0,Z1]=W0,m0=I$(Z1,{filePath:F,projectRoot:process.cwd()}),S0=m0.code,i0=D$(m0.styles);S0=t1(S0).code;let{hasUserImports:R1,bundleClientScript:q1}=await Promise.resolve().then(() => (x5(),v5));if(R1(S0))S0=await q1(S0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:s1}=await Promise.resolve().then(() => (e5(),Z4));S0=S0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(N1,D5)=>s1(D5));let G0=n0(S0),i=zq(G0),x0=`
8565
- (function() {
8566
- ${Z5("const",[...B8,...i],G0)}
8571
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}q.add(F);let w;if(J4.has(F))w=J4.get(F);else try{w=await Bun.file(F).text(),J4.set(F,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let A=new Set(["__originalFilePath","__importedComponents",b$]),N={};for(let[P,x]of Object.entries(Q))if(!P.startsWith("__")||A.has(P))N[P]=x;let{extractSlotContent:R}=await Promise.resolve().then(() => (m7(),d7)),M=R(Y),T={};if(M.defaultSlot?.trim())T.default=M.defaultSlot;for(let[P,x]of M.namedSlots)T[P]=x.content;let I={...N,...Z,props:Z,slot:Y,$slots:T,__processedComponents:z,__sections:{},...Nq(Y)&&{__stx_force_signals:!0}};Aq(w,I);let E=w,D=f$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],b=[],v=S.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&S.every((P)=>/\bserver\b/.test(P[1]||"")),h=null,f=null;if(v){let P=Oq({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){h=`${F}\x00${P}`;let x=Z3.get(h);if(x){for(let u of x.dependencies)q.add(u);return x.output}f=new Set(q)}}for(let P of S){let x=P[1]||"",u=P[2]||"",d=x.includes("server");if(D1(x)&&u.trim())u=E1(u);if(d&&u)try{await W(u,I,F)}catch(H0){}if(!d){let H0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Z1=H0.includes("{{")&&H0.includes("}}"),m0=H0.includes("{!!")&&H0.includes("!!}");if(Z1||m0)H0=C$(H0,I);let S0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${S0}>${H0}</script>`)}}let m=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),r=m?m[1]:"",M0=m?m[2]:"",T0="",d0=r&&/\bscoped\b/i.test(r);if(m)T0=`<style${r}>${M0}</style>`;let Z0=E;if(Z0=Z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),m)Z0=Z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(Z0=Z0.replace(P,(u,d)=>{let W0=d.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(W0)x.push(`<style${W0[1]}>${W0[2]}</style>`);return""}),Z0=Z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)T0=`${T0}${x.join(`
8572
+ `)}`}if(Y&&Z0.includes("{{ text || slot }}"))Z0=Z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:Y0}=await Promise.resolve().then(() => (m7(),d7)),{defaultSlot:I0,namedSlots:c0}=M;Z0=await Y0(Z0,I0,c0,I);for(let[P,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let u=k7(x);I[P]=u}}let q1=b.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),o1=Mq(b);if(o1.length>0)I.__stx_client_signal_names=o1;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:q1||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let $0=await V0(Z0,I,F,n,q),z0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let P of $0.matchAll(/\{\{([\s\S]*?)\}\}/g))z0.add(P[1].trim());if(z0.size>0)Q.__stx_preserved_client_expressions=[...z0];let A0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++Hq}_${Math.random().toString(36).slice(2,8)}`,C=$0;if(q1){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${OZ(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${OZ(_)}"`:"";C=`<div data-stx-scope="${A0}"${P}${x}>${$0}</div>`;let u=await Promise.all(b.map(async(d)=>{let W0=d.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!W0)return d;let[,H0,Z1]=W0,m0=D$(Z1,{filePath:F,projectRoot:process.cwd()}),S0=m0.code,i0=E$(m0.styles);S0=e1(S0).code;let{hasUserImports:N1,bundleClientScript:W1}=await Promise.resolve().then(() => (f5(),x5));if(N1(S0))S0=await W1(S0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:s1}=await Promise.resolve().then(() => ($$(),X4));S0=S0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(Y1,F$)=>s1(F$));let G0=n0(S0),i=Fq(G0),x0=`function(__scopeId) {
8573
+ ${Y5("const",[...V8,...i],G0)}
8567
8574
  const __scope = window.stx._scopes = window.stx._scopes || {};
8568
- const __scopeVars = __scope['${H0}'] = __scope['${H0}'] || {};
8575
+ const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
8569
8576
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
8570
- window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="${H0}"]');
8577
+ window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
8571
8578
 
8572
8579
  // Scope-specific lifecycle callbacks
8573
8580
  __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
@@ -8581,7 +8588,7 @@ ${G0}
8581
8588
  // Register all defined signals and functions in this scope
8582
8589
  const __localVars = {};
8583
8590
  try {
8584
- ${i.map((N1)=>`if (typeof ${N1} !== 'undefined') __localVars['${N1}'] = ${N1};`).join(`
8591
+ ${i.map((Y1)=>`if (typeof ${Y1} !== 'undefined') __localVars['${Y1}'] = ${Y1};`).join(`
8585
8592
  `)}
8586
8593
  }
8587
8594
  catch (e) {}
@@ -8590,15 +8597,15 @@ catch (e) {}
8590
8597
  finally {
8591
8598
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
8592
8599
  }
8593
- })();`;if(_)return`${i0}<script type="stx/island" data-stx-island="${H0}" data-stx-scoped${O0}>${x0}</script>`;return`${i0}<script data-stx-scoped${O0}>${x0}</script>`}));if(C=C+`
8600
+ }`,E5=_?null:$8(Q,x0),r1=E5?`window.__stxComponentFactories[${JSON.stringify(E5)}](${JSON.stringify(A0)});`:`(${x0})(${JSON.stringify(A0)});`;if(_)return`${i0}<script type="stx/island" data-stx-island="${A0}" data-stx-scoped${H0}>${r1}</script>`;return`${i0}<script data-stx-scoped${H0}>${r1}</script>`}));if(C=C+`
8594
8601
  `+u.join(`
8595
- `),M0)C+=`
8596
- `+M0}else{if(M0)C+=`
8597
- `+M0;if(b.length>0){let P=I.__stx_event_bindings||[],x=g5(I),u=await Promise.all(b.map(async(d)=>{let W0=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W0)return d;return await h5(W0[1],{eventBindings:P,templateContent:C,filePath:F,projectRoot:process.cwd(),serverData:x})}));C+=`
8602
+ `),T0)C+=`
8603
+ `+T0}else{if(T0)C+=`
8604
+ `+T0;if(b.length>0){let P=I.__stx_event_bindings||[],x=h5(I),u=await Promise.all(b.map(async(d)=>{let W0=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W0)return d;return await d5(W0[1],{eventBindings:P,templateContent:C,filePath:F,projectRoot:process.cwd(),serverData:x})}));C+=`
8598
8605
  `+u.join(`
8599
- `),I.__stx_event_bindings=[]}}if(d0){let P=C$(C,F);if(P.hasScoped)C=P.html}if(h&&f)t7.set(h,{output:C,dependencies:[...q].filter((P)=>!f.has(P))});return C}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function e7($,Z){let Y=g.resolve(Z),X=g.resolve($),Q=Y.endsWith(g.sep)?Y:Y+g.sep;if(X===Y||X.startsWith(Q))return X;return null}async function $3($,Z,Y,X){let Q=await Fq($,Z,Y,X);if(Q===null)return null;let J=e7(Q,process.cwd());if(J)return J;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=g.isAbsolute(K)?K:g.resolve(process.cwd(),K);if(e7(Q,q))return g.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function Fq($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=g.dirname(Z),J=process.cwd();if($.startsWith("/")){let j=g.join(J,$),_=e7(j,J);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await c(_)&&X)X.add(_);return _}let G=g.join(Q,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let _=`${G}${j}`;if(await c(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=g.resolve(Q),W=process.cwd();for(let j=0;j<10;j++){let _=g.join(q,"layouts"),B=!1;try{B=Kq.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=_;break}let H=g.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,_=g.join(K,j);if(await c(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!j.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.layoutsDir){let j=g.isAbsolute(Y.layoutsDir)?Y.layoutsDir:g.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,B=g.join(j,_);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let H=`${B}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),_=g.join(Y.partialsDir||Q,"layouts",j[1]);if(await c(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.partialsDir){if(K=g.join(Y.partialsDir,"layouts"),await c(K)){let j=g.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let U=Y.partialsDir||g.join(process.cwd(),"views"),z=g.join(U,$);if(await c(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let j=`${z}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(X)X.add(j);return j}}if(Q.includes("temp")){let j=g.join(g.dirname(Q),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function zZ($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
8606
+ `),I.__stx_event_bindings=[]}}if(d0){let P=x$(C,F);if(P.hasScoped)C=P.html}if(h&&f)Z3.set(h,{output:C,dependencies:[...q].filter((P)=>!f.has(P))});return C}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function Y3($,Z){let Y=g.resolve(Z),X=g.resolve($),Q=Y.endsWith(g.sep)?Y:Y+g.sep;if(X===Y||X.startsWith(Q))return X;return null}async function X3($,Z,Y,X){let Q=await Tq($,Z,Y,X);if(Q===null)return null;let J=Y3(Q,process.cwd());if(J)return J;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=g.isAbsolute(K)?K:g.resolve(process.cwd(),K);if(Y3(Q,q))return g.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function Tq($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=g.dirname(Z),J=process.cwd();if($.startsWith("/")){let j=g.join(J,$),_=Y3(j,J);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await c(_)&&X)X.add(_);return _}let G=g.join(Q,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let _=`${G}${j}`;if(await c(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=g.resolve(Q),W=process.cwd();for(let j=0;j<10;j++){let _=g.join(q,"layouts"),B=!1;try{B=_q.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=_;break}let H=g.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,_=g.join(K,j);if(await c(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!j.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.layoutsDir){let j=g.isAbsolute(Y.layoutsDir)?Y.layoutsDir:g.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,B=g.join(j,_);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let H=`${B}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),_=g.join(Y.partialsDir||Q,"layouts",j[1]);if(await c(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.partialsDir){if(K=g.join(Y.partialsDir,"layouts"),await c(K)){let j=g.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let U=Y.partialsDir||g.join(process.cwd(),"views"),z=g.join(U,$);if(await c(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let j=`${z}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(X)X.add(j);return j}}if(Q.includes("temp")){let j=g.join(g.dirname(Q),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function LZ($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
8600
8607
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,Q=G[q].trim();let W=Math.max(0,q-2),U=Math.min(G.length,q+3);J=G.slice(W,U).map((z,j)=>{let _=W+j+1;return`${_===X?"> ":" "}${_}: ${z}`}).join(`
8601
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return zZ($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function q0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=zZ(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
8608
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return LZ($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function q0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=LZ(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
8602
8609
  `,Math.max(0,Q-1));W=Q-(z+1)+1}let U="";if(G>0)U+=`
8603
8610
  ${Y}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
8604
8611
  `;if(U+=`
@@ -8611,8 +8618,8 @@ ${a.yellow}${a.bold}Message:${a.reset} ${Z}
8611
8618
  `,K)U+=`
8612
8619
  ${a.blue}${a.bold}Context:${a.reset}
8613
8620
  ${a.dim}${K}${a.reset}
8614
- `;return U}function s8(){Y4.clear(),X4.clear(),t7.clear()}var Y4,X4,t7,qq=0,a;var F0=k(()=>{d5();t0();c5();J5();Q4();M1();b7();S7();R8();s5();Y4=new b1(500),X4=new b1(1000),t7=new b1(2000);a={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 jZ($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=K+G[0].length,z=1,j=U,_=-1;while(z>0&&j<$.length){let L=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
8615
- `||O==="\r"||O===" "||O===void 0)z++;j=L+9}else{if(z--,z===0){_=F;break}j=F+12}}if(_===-1)continue;let B=$.slice(U,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:W,content:B,index:K}),J.lastIndex=_+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((B)=>{let H=B.trim();if(H)z[H]=!0});let j={gfm:z.gfm??!0,breaks:z.breaks??!1},_=C5(W.trim(),j);X=X.split(K).join(_)}catch(z){let j=z instanceof Error?z.message:String(z),_=q0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,U,K);X=X.split(K).join(_)}return X}async function BZ($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),C5($.trim(),Q)}var Z3=k(()=>{F0()});function Aq($){if(Vq.set($.name,$),$.client)wq.set($.name,$.client)}function G4($){return Aq($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=Rq(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function Rq($,Z){let Y={...Z};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var Vq,wq;var Y3=k(()=>{Vq=new Map,wq=new Map});function X3($,Z=q5,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${Z$($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function _Z($,Z,Y=Nq,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${Z$($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function J3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Z),X.join(", ")}function Z$($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function Q3($){return Tq[$]||"application/octet-stream"}var q5,Nq,$$,Tq;var G3=k(()=>{q5=[320,480,640,768,1024,1280,1536,1920,2560],Nq=[1,1.5,2,3],$$=["avif","webp","jpeg"],Tq={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Iq(){try{return await import("ts-images")}catch{return null}}async function Dq($,Z={}){let Y={...Mq,...Z},X=await Iq();if(X)try{return await Eq($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return kq($,Y)}async function Eq($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function kq($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function HZ($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
8621
+ `;return U}function ZZ(){J4.clear(),Q4.clear(),Z3.clear()}var J4,Q4,Z3,Hq=0,a;var L0=k(()=>{m5();I7();t0();i5();Q5();K4();T1();P7();C7();E8();r5();J4=new b1(500),Q4=new b1(1000),Z3=new b1(2000);a={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 FZ($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=K+G[0].length,z=1,j=U,_=-1;while(z>0&&j<$.length){let L=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
8622
+ `||O==="\r"||O===" "||O===void 0)z++;j=L+9}else{if(z--,z===0){_=F;break}j=F+12}}if(_===-1)continue;let B=$.slice(U,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:W,content:B,index:K}),J.lastIndex=_+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((B)=>{let H=B.trim();if(H)z[H]=!0});let j={gfm:z.gfm??!0,breaks:z.breaks??!1},_=v5(W.trim(),j);X=X.split(K).join(_)}catch(z){let j=z instanceof Error?z.message:String(z),_=q0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,U,K);X=X.split(K).join(_)}return X}async function VZ($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),v5($.trim(),Q)}var J3=k(()=>{L0()});function Eq($){if(Iq.set($.name,$),$.client)Dq.set($.name,$.client)}function q4($){return Eq($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=kq(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function kq($,Z){let Y={...Z};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var Iq,Dq;var Q3=k(()=>{Iq=new Map,Dq=new Map});function G3($,Z=W5,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${Y$($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function wZ($,Z,Y=bq,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${Y$($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function K3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Z),X.join(", ")}function Y$($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function q3($){return Sq[$]||"application/octet-stream"}var W5,bq,Z$,Sq;var W3=k(()=>{W5=[320,480,640,768,1024,1280,1536,1920,2560],bq=[1,1.5,2,3],Z$=["avif","webp","jpeg"],Sq={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Pq(){try{return await import("ts-images")}catch{return null}}async function Cq($,Z={}){let Y={...yq,...Z},X=await Pq();if(X)try{return await vq($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return xq($,Y)}async function vq($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function xq($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function AZ($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
8616
8623
  #${$} {
8617
8624
  --stx-img-transition-duration: ${X}ms;
8618
8625
  --stx-img-transition-easing: ${Q};
@@ -8629,7 +8636,7 @@ ${a.dim}${K}${a.reset}
8629
8636
  #${$}.stx-img-loaded img {
8630
8637
  opacity: 1;
8631
8638
  }
8632
- `.trim()}async function OZ($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(K3.has(Y))return K3.get(Y);let X=await Dq($,Z);return K3.set(Y,X),X}var Mq,q3,K3;var LZ=k(()=>{Mq={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},q3=`
8639
+ `.trim()}async function RZ($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(U3.has(Y))return U3.get(Y);let X=await Cq($,Z);return U3.set(Y,X),X}var yq,z3,U3;var NZ=k(()=>{yq={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},z3=`
8633
8640
  .stx-img-placeholder {
8634
8641
  position: relative;
8635
8642
  overflow: hidden;
@@ -8658,8 +8665,8 @@ ${a.dim}${K}${a.reset}
8658
8665
  filter: blur(0);
8659
8666
  transform: scale(1);
8660
8667
  }
8661
- `.trim();K3=new Map});import{createHash as VZ}from"crypto";import{readFile as bq,stat as wZ}from"fs/promises";async function D0($){try{let Z=await bq($);return VZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function FZ($){return VZ("sha256").update($).digest("hex").slice(0,16)}function K4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${FZ($)}-${FZ(Y)}`}async function W3($){try{return(await wZ($)).mtimeMs}catch{return 0}}async function R0($){try{return await wZ($),!0}catch{return!1}}var x1=()=>{};import{mkdir as Sq,readFile as yq,writeFile as Pq,readdir as nO,rm as Cq,stat as oO}from"fs/promises";import{join as RZ,dirname as vq}from"path";async function xq($){try{await Sq($,{recursive:!0})}catch{}}function NZ($,Z,Y){return RZ($,Y,`${Z}.json`)}async function AZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await W3(Z)!==$.srcMtime)return!1;return!0}async function q4($,Z,Y,X=U3){if(!X.enabled)return null;let Q=K4($,Z),J=W5.get(Q);if(J){if(await AZ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;W5.delete(Q)}let G=NZ(X.directory,Q,Y);if(await R0(G))try{let K=await yq(G,"utf-8"),q=JSON.parse(K);if(await AZ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),W5.set(Q,q),q.data}catch{}return null}async function W4($,Z,Y,X,Q=U3){if(!Q.enabled)return;let J=K4($,Z),G=await D0($),K=await W3($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:K4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};W5.set(J,q);let W=NZ(Q.directory,J,X);try{await xq(vq(W)),await Pq(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function U4($,Z=U3){if($==="all")W5.clear();else W5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=RZ(Z.directory,X);try{await Cq(Q,{recursive:!0,force:!0})}catch{}}}var W5,U3;var z3=k(()=>{x1();W5=new Map,U3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class j4{config;constructor($={}){this.config={...fq,...$}}async get($,Z){return q4($,Z,"image",this.config)}async set($,Z,Y){return W4($,Z,Y,"image",this.config)}async clear(){return U4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function j3($){if(!z4)z4=new j4($);else if($)z4.updateConfig($);return z4}async function B4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return j3(X).get($,Z)}async function _4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return j3(Q).set($,Z,Y)}async function TZ(){return j3().clear()}var fq,z4=null;var B3=k(()=>{z3();fq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as gq,basename as hq,extname as dq,join as mq}from"path";import{mkdir as uq}from"fs/promises";async function _3(){try{return await import("ts-images")}catch{return null}}function MZ($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function lq($,Z){let Y=Z?MZ(Z):MZ("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function IZ($,Z,Y){let X=await _3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await B4($,Z,Y);if(Q)return Q;try{let J=gq($);if(!await R0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=lq(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await uq(K,{recursive:!0});let W=await D0(J),U=hq($,dq($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await H3(J,Z.transformations,X);for(let B of z){let H=G[B]||{},L=`${U}-${W}.${B}`,F=mq(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:B,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await X.generateThumbHash(J);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await X.generatePlaceholder(J,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await _4($,Z,j,Y),j}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function DZ($,Z,Y,X){let Q=await _3();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function H3($,Z,Y){let X=Y||await _3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var EZ=k(()=>{x1();B3()});import{resolve as pq,basename as cq,extname as iq,join as nq}from"path";import{mkdir as oq}from"fs/promises";async function sq(){try{return await import("ts-images")}catch{return null}}async function kZ($,Z,Y){let X=await sq();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=pq($);if(!await R0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||rq,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await oq(K,{recursive:!0});let W=await D0(Q),U=cq($,iq($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${B}`,O=nq(K,F),V=`${q}/${F}`;try{let w=z[B]?.quality||80;if(await R0(O)){j.byFormat[B].push({path:O,url:V,width:L,height:0,format:B,size:0}),H.push(`${V} ${L}w`);continue}let A=await X.processImage({input:Q,output:O,format:B,quality:w,resize:{width:L}});if(A)j.byFormat[B].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${L}w: ${w}`)}}j.srcsets[B]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await X.generateThumbHash(Q);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await X.generatePlaceholder(Q,{strategy:_,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||aq(J),j}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function aq($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function bZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var rq;var SZ=k(()=>{x1();rq=[320,480,640,768,1024,1280,1536,1920]});var yZ={};s(yZ,{setCachedImageResult:()=>_4,processImage:()=>IZ,optimizeImage:()=>DZ,getCachedImageResult:()=>B4,generateSrcset:()=>bZ,generateResponsiveVariants:()=>kZ,clearImageCache:()=>TZ,applyTransformations:()=>H3,ImageProcessorCache:()=>j4});var PZ=k(()=>{EZ();SZ();B3()});async function tq(){try{return await Promise.resolve().then(() => (PZ(),yZ))}catch($){if(!CZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),CZ=!0;return null}}async function H4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return YW(X,Y)}if(Y.processedResult?.processed)return V3($,Y.processedResult,Z);if(Y.responsiveVariants)return gZ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=q5,dpr:U,formats:z=$$,quality:j=O3,params:_={},placeholder:B="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":L4,decoding:V=O4,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return ZW($);let b,v,h=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{b=await OZ(Q,{strategy:B,...H}),v=HZ(h,b,H)}catch{}let f=U!==void 0&&G!==void 0,m;if(f)m=$W($,h,b,Z);else m=await eq($,h,b,Z);let r;if(F){let d0=z.includes("webp")?"webp":z[0],Z0=X3(Q,W,{..._,q:j},d0),Y0=typeof q==="object"?J3(q):q||"100vw";r=`<link rel="preload" as="image" imagesrcset="${Z0}" imagesizes="${Y0}" />`}let T0=[];if(!vZ&&B!=="none")T0.push(q3),vZ=!0;if(v)T0.push(v);let M0=L?fZ(h):void 0;return{html:m,preloadLink:r,css:T0.length>0?T0.join(`
8662
- `):void 0,script:M0}}async function eq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=q5,formats:U=$$,quality:z=O3,params:j={},lazy:_=!0,priority:B=!1,loading:H=B?"eager":L4,decoding:L=O4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,N=$.class,R=$.style,T=$.data||{},M=typeof q==="object"?J3(q):q||"100vw",I=[];for(let y of U){let S=X3(Q,W,{...j,q:z},y),b=Q3(y);if(_&&!B)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${M}" />`)}let E=L3({src:Z$(Q,{...j,q:z}),alt:J,width:G,height:K,loading:B?void 0:H,decoding:L,fetchpriority:B?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:xZ(N,Y),style:F3(R,O,V,Y),lazy:_&&!B,data:T}),D;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
8668
+ `.trim();U3=new Map});import{createHash as TZ}from"crypto";import{readFile as fq,stat as IZ}from"fs/promises";async function D0($){try{let Z=await fq($);return TZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function MZ($){return TZ("sha256").update($).digest("hex").slice(0,16)}function W4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${MZ($)}-${MZ(Y)}`}async function j3($){try{return(await IZ($)).mtimeMs}catch{return 0}}async function R0($){try{return await IZ($),!0}catch{return!1}}var x1=()=>{};import{mkdir as gq,readFile as hq,writeFile as dq,readdir as XL,rm as mq,stat as JL}from"fs/promises";import{join as EZ,dirname as uq}from"path";async function lq($){try{await gq($,{recursive:!0})}catch{}}function kZ($,Z,Y){return EZ($,Y,`${Z}.json`)}async function DZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await j3(Z)!==$.srcMtime)return!1;return!0}async function U4($,Z,Y,X=B3){if(!X.enabled)return null;let Q=W4($,Z),J=U5.get(Q);if(J){if(await DZ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;U5.delete(Q)}let G=kZ(X.directory,Q,Y);if(await R0(G))try{let K=await hq(G,"utf-8"),q=JSON.parse(K);if(await DZ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),U5.set(Q,q),q.data}catch{}return null}async function z4($,Z,Y,X,Q=B3){if(!Q.enabled)return;let J=W4($,Z),G=await D0($),K=await j3($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:W4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};U5.set(J,q);let W=kZ(Q.directory,J,X);try{await lq(uq(W)),await dq(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function j4($,Z=B3){if($==="all")U5.clear();else U5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=EZ(Z.directory,X);try{await mq(Q,{recursive:!0,force:!0})}catch{}}}var U5,B3;var _3=k(()=>{x1();U5=new Map,B3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class _4{config;constructor($={}){this.config={...pq,...$}}async get($,Z){return U4($,Z,"image",this.config)}async set($,Z,Y){return z4($,Z,Y,"image",this.config)}async clear(){return j4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function H3($){if(!B4)B4=new _4($);else if($)B4.updateConfig($);return B4}async function H4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return H3(X).get($,Z)}async function O4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return H3(Q).set($,Z,Y)}async function bZ(){return H3().clear()}var pq,B4=null;var O3=k(()=>{_3();pq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as cq,basename as iq,extname as nq,join as oq}from"path";import{mkdir as sq}from"fs/promises";async function L3(){try{return await import("ts-images")}catch{return null}}function SZ($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function rq($,Z){let Y=Z?SZ(Z):SZ("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function yZ($,Z,Y){let X=await L3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await H4($,Z,Y);if(Q)return Q;try{let J=cq($);if(!await R0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=rq(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await sq(K,{recursive:!0});let W=await D0(J),U=iq($,nq($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await F3(J,Z.transformations,X);for(let B of z){let H=G[B]||{},L=`${U}-${W}.${B}`,F=oq(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:B,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await X.generateThumbHash(J);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await X.generatePlaceholder(J,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await O4($,Z,j,Y),j}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function PZ($,Z,Y,X){let Q=await L3();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function F3($,Z,Y){let X=Y||await L3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var CZ=k(()=>{x1();O3()});import{resolve as aq,basename as tq,extname as eq,join as $W}from"path";import{mkdir as ZW}from"fs/promises";async function YW(){try{return await import("ts-images")}catch{return null}}async function vZ($,Z,Y){let X=await YW();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=aq($);if(!await R0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||XW,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await ZW(K,{recursive:!0});let W=await D0(Q),U=tq($,eq($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${B}`,O=$W(K,F),V=`${q}/${F}`;try{let w=z[B]?.quality||80;if(await R0(O)){j.byFormat[B].push({path:O,url:V,width:L,height:0,format:B,size:0}),H.push(`${V} ${L}w`);continue}let A=await X.processImage({input:Q,output:O,format:B,quality:w,resize:{width:L}});if(A)j.byFormat[B].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${L}w: ${w}`)}}j.srcsets[B]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await X.generateThumbHash(Q);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await X.generatePlaceholder(Q,{strategy:_,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||JW(J),j}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function JW($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function xZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var XW;var fZ=k(()=>{x1();XW=[320,480,640,768,1024,1280,1536,1920]});var gZ={};s(gZ,{setCachedImageResult:()=>O4,processImage:()=>yZ,optimizeImage:()=>PZ,getCachedImageResult:()=>H4,generateSrcset:()=>xZ,generateResponsiveVariants:()=>vZ,clearImageCache:()=>bZ,applyTransformations:()=>F3,ImageProcessorCache:()=>_4});var hZ=k(()=>{CZ();fZ();O3()});async function QW(){try{return await Promise.resolve().then(() => (hZ(),gZ))}catch($){if(!dZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),dZ=!0;return null}}async function L4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return WW(X,Y)}if(Y.processedResult?.processed)return R3($,Y.processedResult,Z);if(Y.responsiveVariants)return pZ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=W5,dpr:U,formats:z=Z$,quality:j=V3,params:_={},placeholder:B="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":V4,decoding:V=F4,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:M}=$,T=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return qW($);let b,v,h=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{b=await RZ(Q,{strategy:B,...H}),v=AZ(h,b,H)}catch{}let f=U!==void 0&&G!==void 0,m;if(f)m=KW($,h,b,Z);else m=await GW($,h,b,Z);let r;if(F){let d0=z.includes("webp")?"webp":z[0],Z0=G3(Q,W,{..._,q:j},d0),Y0=typeof q==="object"?K3(q):q||"100vw";r=`<link rel="preload" as="image" imagesrcset="${Z0}" imagesizes="${Y0}" />`}let M0=[];if(!mZ&&B!=="none")M0.push(z3),mZ=!0;if(v)M0.push(v);let T0=L?lZ(h):void 0;return{html:m,preloadLink:r,css:M0.length>0?M0.join(`
8669
+ `):void 0,script:T0}}async function GW($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=W5,formats:U=Z$,quality:z=V3,params:j={},lazy:_=!0,priority:B=!1,loading:H=B?"eager":V4,decoding:L=F4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,N=$.class,R=$.style,M=$.data||{},T=typeof q==="object"?K3(q):q||"100vw",I=[];for(let y of U){let S=G3(Q,W,{...j,q:z},y),b=q3(y);if(_&&!B)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${T}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${T}" />`)}let E=w3({src:Y$(Q,{...j,q:z}),alt:J,width:G,height:K,loading:B?void 0:H,decoding:L,fetchpriority:B?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:uZ(N,Y),style:A3(R,O,V,Y),lazy:_&&!B,data:M}),D;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
8663
8670
  <picture>
8664
8671
  ${I.join(`
8665
8672
  `)}
@@ -8669,9 +8676,9 @@ ${I.join(`
8669
8676
  ${I.join(`
8670
8677
  `)}
8671
8678
  <img ${E} />
8672
- </picture>`;return D}function $W($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=O3,params:U={},lazy:z=!0,priority:j=!1,loading:_=j?"eager":L4,decoding:B=O4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),T=_Z(Q,R,q,{...U,q:W}),M=L3({src:Z$(Q,{...U,w:R,q:W}),alt:J,width:G,height:K,loading:j?void 0:_,decoding:B,fetchpriority:j?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:xZ(w,Y),style:F3(A,L,F,Y),lazy:z&&!j,data:N}),I=z&&!j?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
8673
- <img ${M} ${I} />
8674
- </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function ZW($){let{src:Z,alt:Y,width:X,height:Q,loading:J=L4,decoding:G=O4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:j=!1}=$,_=$.class,B=$.style,H=$.id,L=$.data||{};return{html:`<img ${L3({src:Z,alt:Y,width:X,height:Q,loading:j?"eager":J,decoding:G,fetchpriority:j?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:_,style:F3(B,q,W),id:H,data:L})} />`}}function L3($){let Z=[];if($.lazy)Z.push(`data-src="${s0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${s0($.src)}"`);if(Z.push(`alt="${s0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${s0($.className)}"`);if($.style)Z.push(`style="${s0($.style)}"`);if($.id)Z.push(`id="${s0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${s0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function xZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function F3($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function s0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function fZ($){return`
8679
+ </picture>`;return D}function KW($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=V3,params:U={},lazy:z=!0,priority:j=!1,loading:_=j?"eager":V4,decoding:B=F4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),M=wZ(Q,R,q,{...U,q:W}),T=w3({src:Y$(Q,{...U,w:R,q:W}),alt:J,width:G,height:K,loading:j?void 0:_,decoding:B,fetchpriority:j?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:uZ(w,Y),style:A3(A,L,F,Y),lazy:z&&!j,data:N}),I=z&&!j?`data-srcset="${M}"`:`srcset="${M}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
8680
+ <img ${T} ${I} />
8681
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${T} ${I} />`}function qW($){let{src:Z,alt:Y,width:X,height:Q,loading:J=V4,decoding:G=F4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:j=!1}=$,_=$.class,B=$.style,H=$.id,L=$.data||{};return{html:`<img ${w3({src:Z,alt:Y,width:X,height:Q,loading:j?"eager":J,decoding:G,fetchpriority:j?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:_,style:A3(B,q,W),id:H,data:L})} />`}}function w3($){let Z=[];if($.lazy)Z.push(`data-src="${s0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${s0($.src)}"`);if(Z.push(`alt="${s0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${s0($.className)}"`);if($.style)Z.push(`style="${s0($.style)}"`);if($.id)Z.push(`id="${s0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${s0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function uZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function A3($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function s0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lZ($){return`
8675
8682
  (function() {
8676
8683
  const container = document.getElementById('${$}');
8677
8684
  if (!container) return;
@@ -8708,7 +8715,7 @@ ${I.join(`
8708
8715
 
8709
8716
  observer.observe(container);
8710
8717
  })();
8711
- `.trim()}async function YW($,Z){let Y=await tq();if(!Y)return H4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return gZ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return V3($,J,Z)}return H4({...$,process:!1},Z)}async function V3($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,j=$.class,_=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((v)=>v.format==="jpeg")||L.find((v)=>v.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((v)=>v.format===(F?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),w=new Map;for(let v of L){if(!w.has(v.format))w.set(v.format,[]);w.get(v.format).push(v)}let A=[],N=["avif","webp","jpeg","png"];for(let v of N){let h=w.get(v);if(h&&h.length>0){let f=h.map((r)=>`${r.url} ${r.width}w`).join(", "),m=Q3(v);if(G&&!K)A.push(` <source type="${m}" data-srcset="${f}" />`);else A.push(` <source type="${m}" srcset="${f}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${s0(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${s0(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${s0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)R.push(`width="${T}"`);if(M)R.push(`height="${M}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(U)R.push(`crossorigin="${U}"`);if(z)R.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)R.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)R.push(`class="${E.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[v,h]of Object.entries(H))R.push(`data-${v}="${s0(h)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let v=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${v}">
8718
+ `.trim()}async function WW($,Z){let Y=await QW();if(!Y)return L4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return pZ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return R3($,J,Z)}return L4({...$,process:!1},Z)}async function R3($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,j=$.class,_=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((v)=>v.format==="jpeg")||L.find((v)=>v.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((v)=>v.format===(F?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),w=new Map;for(let v of L){if(!w.has(v.format))w.set(v.format,[]);w.get(v.format).push(v)}let A=[],N=["avif","webp","jpeg","png"];for(let v of N){let h=w.get(v);if(h&&h.length>0){let f=h.map((r)=>`${r.url} ${r.width}w`).join(", "),m=q3(v);if(G&&!K)A.push(` <source type="${m}" data-srcset="${f}" />`);else A.push(` <source type="${m}" srcset="${f}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${s0(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${s0(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${s0(X)}"`);let M=Q||Z.originalWidth,T=J||Z.originalHeight;if(M)R.push(`width="${M}"`);if(T)R.push(`height="${T}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(U)R.push(`crossorigin="${U}"`);if(z)R.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)R.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)R.push(`class="${E.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[v,h]of Object.entries(H))R.push(`data-${v}="${s0(h)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let v=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${v}">
8712
8719
  <picture>
8713
8720
  ${A.join(`
8714
8721
  `)}
@@ -8718,12 +8725,12 @@ ${A.join(`
8718
8725
  ${A.join(`
8719
8726
  `)}
8720
8727
  <img ${R.join(" ")} />
8721
- </picture>`;let y=[];if(Z.placeholder)y.push(q3);let S=G?fZ(B):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:b,css:y.length>0?y.join(`
8722
- `):void 0,script:S}}async function gZ($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return V3($,X,Y)}var CZ=!1,O3=80,O4="async",L4="lazy",vZ=!1;var hZ=k(()=>{G3();LZ()});function XW(){return G4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=JW($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||q5,formats:G.formats||$$,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await H4(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
8728
+ </picture>`;let y=[];if(Z.placeholder)y.push(z3);let S=G?lZ(B):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:b,css:y.length>0?y.join(`
8729
+ `):void 0,script:S}}async function pZ($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return R3($,X,Y)}var dZ=!1,V3=80,F4="async",V4="lazy",mZ=!1;var cZ=k(()=>{W3();NZ()});function UW(){return q4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=zW($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||W5,formats:G.formats||Z$,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await L4(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
8723
8730
  `+U;if(W.css)U+=`
8724
8731
  <style>${W.css}</style>`;if(W.script)U+=`
8725
- <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function JW($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=QW(X),J=w3(Q[0],Y)||"",G=w3(Q[1],Y)||"",K={};if(Q[2]){let q=w3(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function QW($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function w3($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var dZ;var mZ=k(()=>{Y3();hZ();G3();dZ=XW()});class V4{config;constructor($={}){this.config={...GW,...$}}async get($,Z){return q4($,Z,"video",this.config)}async set($,Z,Y){return W4($,Z,Y,"video",this.config)}async clear(){return U4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function A3($){if(!F4)F4=new V4($);else if($)F4.updateConfig($);return F4}async function w4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return A3(X).get($,Z)}async function A4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return A3(Q).set($,Z,Y)}async function uZ(){return A3().clear()}var GW,F4=null;var R3=k(()=>{z3();GW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as N3,basename as T3,extname as M3,join as R4}from"path";import{mkdir as I3}from"fs/promises";async function D3(){try{return await import("ts-videos")}catch{return null}}async function N4($,Z,Y,X){let Q=await D3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=N3($);if(!await R0(J))return null;await I3(Y,{recursive:!0});let G=await D0(J),K=T3($,M3($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=R4(Y,U),j=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(j&&j.length>0){let _=j[0];return{path:z,url:`${X}/${U}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function T4($,Z,Y,X){let Q=await D3();if(!Q)return[];try{let J=N3($);if(!await R0(J))return[];await I3(Y,{recursive:!0});let G=await D0(J),K=T3($,M3($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,j=Z.count||10,_=Z.interval||z/j,B=[];for(let L=0;L<j&&L*_<z;L++)B.push(L*_);let H=await Q.extractThumbnails(J,{timestamps:B,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||R4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:B[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function lZ($,Z,Y,X){let Q=await D3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=N3($);if(!await R0(J))return null;await I3(Y,{recursive:!0});let G=await D0(J),K=T3($,M3($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,j=Z.interval||5,_=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/j),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=R4(Y,O),w=[];for(let N=0;N<L;N++)w.push(N*j);let A=await Q.extractThumbnails(J,{timestamps:w,width:_,height:B,format:H,quality:Z.quality||70,outputDir:R4(Y,".temp")});if(!A||A.length===0)return null;try{let N=await import("ts-images"),R=z*_,T=F*B,M=await N.createSprite({images:A.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:_,thumbnailHeight:B,interval:j,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var E3=k(()=>{x1()});import{resolve as cZ,basename as iZ,extname as nZ,join as f1}from"path";import{mkdir as M4,writeFile as oZ}from"fs/promises";async function sZ(){try{return await import("ts-videos")}catch{return null}}async function I4($,Z,Y,X,Q){let J=await sZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=cZ($);if(!await R0(G))return null;let K=await D0(G),q=iZ($,nZ($)),W=f1(Y,`${q}-${K}-hls`);await M4(W,{recursive:!0});let U=Z.length>0?Z:rZ,z=Q?.segmentDuration||6,B=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let w=f1(W,V.label);await M4(w,{recursive:!0});let A=`${V.label}.m3u8`,N=f1(w,A);try{let R=await J.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${A}`,path:N}),L+=R.segmentCount||Math.ceil(B/z)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=f1(W,"master.m3u8"),O=KW(H,X,q,K);return await oZ(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function KW($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
8726
- `)}async function D4($,Z,Y,X,Q){let J=await sZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=cZ($);if(!await R0(G))return null;let K=await D0(G),q=iZ($,nZ($)),W=f1(Y,`${q}-${K}-dash`);await M4(W,{recursive:!0});let U=Z.length>0?Z:rZ,z=Q?.segmentDuration||4,j=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of U){let N=f1(W,A.label);await M4(N,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:N,segmentDuration:z,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${X}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${X}/${q}-${K}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=f1(W,"manifest.mpd"),V=qW(L,F,H,z,j);await oZ(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function qW($,Z,Y,X,Q){let J=pZ(Y),G=pZ(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
8732
+ <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function zW($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=jW(X),J=N3(Q[0],Y)||"",G=N3(Q[1],Y)||"",K={};if(Q[2]){let q=N3(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function jW($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function N3($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var iZ;var nZ=k(()=>{Q3();cZ();W3();iZ=UW()});class A4{config;constructor($={}){this.config={...BW,...$}}async get($,Z){return U4($,Z,"video",this.config)}async set($,Z,Y){return z4($,Z,Y,"video",this.config)}async clear(){return j4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function M3($){if(!w4)w4=new A4($);else if($)w4.updateConfig($);return w4}async function R4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return M3(X).get($,Z)}async function N4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return M3(Q).set($,Z,Y)}async function oZ(){return M3().clear()}var BW,w4=null;var T3=k(()=>{_3();BW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as I3,basename as D3,extname as E3,join as M4}from"path";import{mkdir as k3}from"fs/promises";async function b3(){try{return await import("ts-videos")}catch{return null}}async function T4($,Z,Y,X){let Q=await b3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=I3($);if(!await R0(J))return null;await k3(Y,{recursive:!0});let G=await D0(J),K=D3($,E3($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=M4(Y,U),j=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(j&&j.length>0){let _=j[0];return{path:z,url:`${X}/${U}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function I4($,Z,Y,X){let Q=await b3();if(!Q)return[];try{let J=I3($);if(!await R0(J))return[];await k3(Y,{recursive:!0});let G=await D0(J),K=D3($,E3($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,j=Z.count||10,_=Z.interval||z/j,B=[];for(let L=0;L<j&&L*_<z;L++)B.push(L*_);let H=await Q.extractThumbnails(J,{timestamps:B,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||M4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:B[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function sZ($,Z,Y,X){let Q=await b3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=I3($);if(!await R0(J))return null;await k3(Y,{recursive:!0});let G=await D0(J),K=D3($,E3($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,j=Z.interval||5,_=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/j),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=M4(Y,O),w=[];for(let N=0;N<L;N++)w.push(N*j);let A=await Q.extractThumbnails(J,{timestamps:w,width:_,height:B,format:H,quality:Z.quality||70,outputDir:M4(Y,".temp")});if(!A||A.length===0)return null;try{let N=await import("ts-images"),R=z*_,M=F*B,T=await N.createSprite({images:A.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:_,thumbnailHeight:B,interval:j,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var S3=k(()=>{x1()});import{resolve as aZ,basename as tZ,extname as eZ,join as f1}from"path";import{mkdir as D4,writeFile as $2}from"fs/promises";async function Z2(){try{return await import("ts-videos")}catch{return null}}async function E4($,Z,Y,X,Q){let J=await Z2();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=aZ($);if(!await R0(G))return null;let K=await D0(G),q=tZ($,eZ($)),W=f1(Y,`${q}-${K}-hls`);await D4(W,{recursive:!0});let U=Z.length>0?Z:Y2,z=Q?.segmentDuration||6,B=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let w=f1(W,V.label);await D4(w,{recursive:!0});let A=`${V.label}.m3u8`,N=f1(w,A);try{let R=await J.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${A}`,path:N}),L+=R.segmentCount||Math.ceil(B/z)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=f1(W,"master.m3u8"),O=_W(H,X,q,K);return await $2(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function _W($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
8733
+ `)}async function k4($,Z,Y,X,Q){let J=await Z2();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=aZ($);if(!await R0(G))return null;let K=await D0(G),q=tZ($,eZ($)),W=f1(Y,`${q}-${K}-dash`);await D4(W,{recursive:!0});let U=Z.length>0?Z:Y2,z=Q?.segmentDuration||4,j=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of U){let N=f1(W,A.label);await D4(N,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:N,segmentDuration:z,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${X}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${X}/${q}-${K}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=f1(W,"manifest.mpd"),V=HW(L,F,H,z,j);await $2(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function HW($,Z,Y,X,Q){let J=rZ(Y),G=rZ(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
8727
8734
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
8728
8735
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8729
8736
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -8749,7 +8756,7 @@ ${A.join(`
8749
8756
  </Representation>
8750
8757
  `}K+=` </AdaptationSet>
8751
8758
  `}return K+=` </Period>
8752
- </MPD>`,K}function pZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var rZ;var k3=k(()=>{x1();rZ=[{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 aZ,basename as WW,extname as UW,join as zW}from"path";import{mkdir as jW}from"fs/promises";async function tZ(){try{return await import("ts-videos")}catch{return null}}function BW($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function _W($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function b3($){let Z=await tZ();if(!Z)return null;try{let Y=aZ($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function eZ($,Z,Y,X){let Q=await tZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await w4($,Z,Y);if(J)return J;try{let G=aZ($);if(!await R0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await jW(K,{recursive:!0});let W=await D0(G),U=WW($,UW($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await b3(G)||void 0;let j={};if(Z.quality)j.bitrate=BW(Z.quality);if(Z.platform)Object.assign(j,_W(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${U}-${W}.mp4`,B=zW(K,_);try{let H=await HW(G,B,j,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:B,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:j.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await N4(G,_,K,q);if(B)z.poster=B}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await T4(G,Y.thumbnails,K,q);if(_.length>0)z.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let B=await I4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,hls:B}}if(_.format==="dash"){let B=await D4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,dash:B}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await A4($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function HW($,Z,Y,X,Q){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var $2=k(()=>{x1();R3();E3();k3()});var Z2={};s(Z2,{setCachedVideoResult:()=>A4,processVideo:()=>eZ,getCachedVideoResult:()=>w4,generateThumbnails:()=>T4,generateSpriteSheet:()=>lZ,generatePoster:()=>N4,generateHLSManifest:()=>I4,generateDASHManifest:()=>D4,clearVideoCache:()=>uZ,analyzeVideo:()=>b3,VideoProcessorCache:()=>V4});var Y2=k(()=>{$2();E3();k3();R3()});async function J2(){try{return await Promise.resolve().then(() => (Y2(),Z2))}catch($){if(!X2)console.warn("[stx-media] Video processor not available, some features disabled:",$),X2=!0;return null}}async function E4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return AW(X,Y)}if(Y.processedResult?.processed)return q2($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await RW(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=Q2,autoplay:U=!1,muted:z=!1,loop:j=!1,preload:_=G2,playsinline:B=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:N=!1}=$,R=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return FW($,Z);if(F&&F!=="video")return LW(J||"",F,$);let E=G.length>0?G:J?[{src:J,type:K2(J)}]:[],D=[`id="${I}"`];if(W)D.push("controls");if(U)D.push("autoplay");if(z)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(N)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),R)D.push(`data-poster="${_0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),R)D.push(`poster="${_0(R)}"`);if(O)D.push(`width="${O}"`);if(V)D.push(`height="${V}"`);if(T)D.push(`class="${_0(T)}"`);if(M)D.push(`style="${_0(M)}"`);let y=E.map((v)=>{return` <source ${H?`data-src="${_0(v.src)}"`:`src="${_0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
8759
+ </MPD>`,K}function rZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var Y2;var y3=k(()=>{x1();Y2=[{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 X2,basename as OW,extname as LW,join as FW}from"path";import{mkdir as VW}from"fs/promises";async function J2(){try{return await import("ts-videos")}catch{return null}}function wW($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function AW($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function P3($){let Z=await J2();if(!Z)return null;try{let Y=X2($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function Q2($,Z,Y,X){let Q=await J2();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await R4($,Z,Y);if(J)return J;try{let G=X2($);if(!await R0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await VW(K,{recursive:!0});let W=await D0(G),U=OW($,LW($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await P3(G)||void 0;let j={};if(Z.quality)j.bitrate=wW(Z.quality);if(Z.platform)Object.assign(j,AW(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${U}-${W}.mp4`,B=FW(K,_);try{let H=await RW(G,B,j,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:B,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:j.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await T4(G,_,K,q);if(B)z.poster=B}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await I4(G,Y.thumbnails,K,q);if(_.length>0)z.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let B=await E4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,hls:B}}if(_.format==="dash"){let B=await k4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,dash:B}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await N4($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function RW($,Z,Y,X,Q){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var G2=k(()=>{x1();T3();S3();y3()});var K2={};s(K2,{setCachedVideoResult:()=>N4,processVideo:()=>Q2,getCachedVideoResult:()=>R4,generateThumbnails:()=>I4,generateSpriteSheet:()=>sZ,generatePoster:()=>T4,generateHLSManifest:()=>E4,generateDASHManifest:()=>k4,clearVideoCache:()=>oZ,analyzeVideo:()=>P3,VideoProcessorCache:()=>A4});var q2=k(()=>{G2();S3();y3();T3()});async function U2(){try{return await Promise.resolve().then(() => (q2(),K2))}catch($){if(!W2)console.warn("[stx-media] Video processor not available, some features disabled:",$),W2=!0;return null}}async function b4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return EW(X,Y)}if(Y.processedResult?.processed)return _2($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await kW(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=z2,autoplay:U=!1,muted:z=!1,loop:j=!1,preload:_=j2,playsinline:B=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:N=!1}=$,R=Q||K,M=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return TW($,Z);if(F&&F!=="video")return MW(J||"",F,$);let E=G.length>0?G:J?[{src:J,type:B2(J)}]:[],D=[`id="${I}"`];if(W)D.push("controls");if(U)D.push("autoplay");if(z)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(N)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),R)D.push(`data-poster="${_0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),R)D.push(`poster="${_0(R)}"`);if(O)D.push(`width="${O}"`);if(V)D.push(`height="${V}"`);if(M)D.push(`class="${_0(M)}"`);if(T)D.push(`style="${_0(T)}"`);let y=E.map((v)=>{return` <source ${H?`data-src="${_0(v.src)}"`:`src="${_0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
8753
8760
  `),S=`<video ${D.join(" ")}>
8754
8761
  ${y}
8755
8762
  Your browser does not support the video tag.
@@ -8788,9 +8795,9 @@ ${y}
8788
8795
 
8789
8796
  observer.observe(video);
8790
8797
  })();
8791
- `.trim();return{html:S,script:b}}function LW($,Z,Y){let{width:X=640,height:Q=360}=Y,J=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=VW($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=wW($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${_0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${_0(J)}"`);if(G)U.push(`style="${_0(G)}"`);if(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
8798
+ `.trim();return{html:S,script:b}}function MW($,Z,Y){let{width:X=640,height:Q=360}=Y,J=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=IW($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=DW($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${_0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${_0(J)}"`);if(G)U.push(`style="${_0(G)}"`);if(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
8792
8799
  <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
8793
- </div>`}}function FW($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:z=!0,width:j,height:_}=$,B=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:W,poster:Q,controls:J,title:$.title},O=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
8800
+ </div>`}}function TW($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:z=!0,width:j,height:_}=$,B=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:W,poster:Q,controls:J,title:$.title},O=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
8794
8801
  <div
8795
8802
  id="${L}"
8796
8803
  class="ts-video-player${B?" "+_0(B):""}"
@@ -8827,7 +8834,7 @@ ${y}
8827
8834
 
8828
8835
  // Load ts-video-player from CDN
8829
8836
  var script = document.createElement('script');
8830
- script.src = '${OW}';
8837
+ script.src = '${NW}';
8831
8838
  script.onload = initPlayer;
8832
8839
  script.onerror = function() {
8833
8840
  console.error('[stx] Failed to load ts-video-player');
@@ -8957,7 +8964,7 @@ else {
8957
8964
  .ts-video-player__play-button svg {
8958
8965
  margin-left: 4px;
8959
8966
  }
8960
- `.trim();return{html:V,script:w,css:A}}function K2($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function VW($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function wW($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function _0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function AW($,Z){let Y=await J2();if(!Y)return E4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return q2($,Q,Z);return E4({...$,process:!1},Z)}async function RW($,Z){let Y=await J2();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function q2($,Z,Y){let{controls:X=Q2,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=G2,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:j,disablePictureInPicture:_=!1,disableRemotePlayback:B=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=K2(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,N=[`id="${F}"`];if(X)N.push("controls");if(Q)N.push("autoplay");if(J)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(_)N.push("disablepictureinpicture");if(B)N.push("disableremoteplayback");if(j)N.push(`crossorigin="${j}"`);if(W){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),A)N.push(`data-poster="${_0(A)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),A)N.push(`poster="${_0(A)}"`);let R=U||Z.metadata?.width,T=z||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(T)N.push(`height="${T}"`);if(H)N.push(`class="${_0(H)}"`);if(L)N.push(`style="${_0(L)}"`);let I=` <source ${W?`data-src="${_0(O)}"`:`src="${_0(O)}"`} type="${V}" />`,E=`<video ${N.join(" ")}>
8967
+ `.trim();return{html:V,script:w,css:A}}function B2($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function IW($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function DW($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function _0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function EW($,Z){let Y=await U2();if(!Y)return b4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return _2($,Q,Z);return b4({...$,process:!1},Z)}async function kW($,Z){let Y=await U2();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function _2($,Z,Y){let{controls:X=z2,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=j2,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:j,disablePictureInPicture:_=!1,disableRemotePlayback:B=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=B2(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,N=[`id="${F}"`];if(X)N.push("controls");if(Q)N.push("autoplay");if(J)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(_)N.push("disablepictureinpicture");if(B)N.push("disableremoteplayback");if(j)N.push(`crossorigin="${j}"`);if(W){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),A)N.push(`data-poster="${_0(A)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),A)N.push(`poster="${_0(A)}"`);let R=U||Z.metadata?.width,M=z||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(M)N.push(`height="${M}"`);if(H)N.push(`class="${_0(H)}"`);if(L)N.push(`style="${_0(L)}"`);let I=` <source ${W?`data-src="${_0(O)}"`:`src="${_0(O)}"`} type="${V}" />`,E=`<video ${N.join(" ")}>
8961
8968
  ${I}
8962
8969
  Your browser does not support the video tag.
8963
8970
  </video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${_0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -9006,9 +9013,9 @@ ${E}
9006
9013
  width: 100%;
9007
9014
  height: auto;
9008
9015
  }
9009
- `.trim();return{html:E,script:D,css:y}}var X2=!1,Q2=!0,G2="metadata",OW="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var W2=k(()=>{y3()});function U2(){return G4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=NW($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await E4(G,q),U=W.html;if(W.css)U+=`
9016
+ `.trim();return{html:E,script:D,css:y}}var W2=!1,z2=!0,j2="metadata",NW="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var H2=k(()=>{v3()});function O2(){return q4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=bW($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await b4(G,q),U=W.html;if(W.css)U+=`
9010
9017
  <style>${W.css}</style>`;if(W.script)U+=`
9011
- <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function NW($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=TW(X),J=z2(Q[0],Y)||"",G={};if(Q[1]){let K=z2(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function TW($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function z2($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var S3;var y3=k(()=>{Y3();W2();S3=U2()});function MW($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
9018
+ <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function bW($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=SW(X),J=L2(Q[0],Y)||"",G={};if(Q[1]){let K=L2(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function SW($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function L2($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var C3;var v3=k(()=>{Q3();H2();C3=O2()});function yW($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
9012
9019
  ${$}
9013
9020
  </div>
9014
9021
  <script>
@@ -9053,7 +9060,7 @@ ${E}
9053
9060
  }
9054
9061
  }
9055
9062
  })();
9056
- </script>`}function IW($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
9063
+ </script>`}function PW($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
9057
9064
  <div class="stx-pwa-update-banner" style="
9058
9065
  position: fixed;
9059
9066
  bottom: 0;
@@ -9164,7 +9171,7 @@ else {
9164
9171
  // Also listen for custom event
9165
9172
  window.addEventListener('pwa-update-available', showUpdate);
9166
9173
  })();
9167
- </script>`}function DW($,Z){let Y=$.trim().length>0,X=`
9174
+ </script>`}function CW($,Z){let Y=$.trim().length>0,X=`
9168
9175
  <div class="stx-offline-indicator" style="
9169
9176
  position: fixed;
9170
9177
  top: 16px;
@@ -9225,7 +9232,7 @@ else {
9225
9232
  window.addEventListener('offline', updateStatus);
9226
9233
  updateStatus();
9227
9234
  })();
9228
- </script>`}function EW($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
9235
+ </script>`}function vW($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
9229
9236
  ${$}
9230
9237
  </div>
9231
9238
  <script>
@@ -9307,33 +9314,33 @@ catch (error) {
9307
9314
  init();
9308
9315
  }
9309
9316
  })();
9310
- </script>`}function nL($){return[...$,...P3]}var kW,bW,SW,yW,P3;var C3=k(()=>{kW={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return MW($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},bW={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return IW($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},SW={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return DW($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},yW={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return EW($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},P3=[kW,bW,SW,yW]});function v3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var k4=k(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function Y$(){return!1}function X$(){return!Y$()||process.env.STX_DEBUG==="true"}function b4(){return!1}import PW from"path";function S4(){return{...x3}}function y4($){if(!x3.showRelativePaths||!$)return $;let Z=x3.baseDir||process.cwd();try{let Y=PW.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var CW,x3,P4,g1,C4;var v4=k(()=>{k4();CW={showRelativePaths:!1,enableAutoRecovery:X$(),logRecoveryWarnings:!0},x3={...CW};P4=class P4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=y4(this.filePath)}};g1=class g1 extends P4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};C4=class C4 extends P4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function B2($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,j=J,_=G;if(!j&&K&&q!==void 0){let O=dW(K,q);j=O.line,_=O.column}let B=Q?y4(Q):void 0,H=X?v3(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:B,line:j,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=xW(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=fW(L,K,q);break;case"text":default:F=vW(L,K,q);break}return{formatted:F,data:L}}function vW($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
9311
- ${$.message}`),Z&&$.line){let J=gW(Z,$.line,2);if(J)X.push(`
9317
+ </script>`}function XF($){return[...$,...x3]}var xW,fW,gW,hW,x3;var f3=k(()=>{xW={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return yW($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},fW={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return PW($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},gW={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return CW($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},hW={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return vW($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},x3=[xW,fW,gW,hW]});function g3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var S4=k(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function X$(){return!1}function J$(){return!X$()||process.env.STX_DEBUG==="true"}function y4(){return!1}import dW from"path";function P4(){return{...h3}}function C4($){if(!h3.showRelativePaths||!$)return $;let Z=h3.baseDir||process.cwd();try{let Y=dW.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var mW,h3,v4,g1,x4;var f4=k(()=>{S4();mW={showRelativePaths:!1,enableAutoRecovery:J$(),logRecoveryWarnings:!0},h3={...mW};v4=class v4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=C4(this.filePath)}};g1=class g1 extends v4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};x4=class x4 extends v4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function V2($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,j=J,_=G;if(!j&&K&&q!==void 0){let O=nW(K,q);j=O.line,_=O.column}let B=Q?C4(Q):void 0,H=X?g3(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:B,line:j,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=lW(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=pW(L,K,q);break;case"text":default:F=uW(L,K,q);break}return{formatted:F,data:L}}function uW($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
9318
+ ${$.message}`),Z&&$.line){let J=cW(Z,$.line,2);if(J)X.push(`
9312
9319
  ${J}`)}if($.snippet)X.push(`
9313
9320
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
9314
- Suggestion: ${$.suggestion}`);return X.join(" ")}function xW($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${j2($.message)}`;if($.suggestion)X+=` | Suggestion: ${j2($.suggestion)}`;return X+=" -->",X}function fW($,Z,Y){let W=[],U=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
9321
+ Suggestion: ${$.suggestion}`);return X.join(" ")}function lW($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${F2($.message)}`;if($.suggestion)X+=` | Suggestion: ${F2($.suggestion)}`;return X+=" -->",X}function pW($,Z,Y){let W=[],U=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
9315
9322
  \x1B[90mat\x1B[0m ${z}`)}if(W.push(`
9316
9323
 
9317
- ${$.message}`),Z&&$.line){let z=hW(Z,$.line,2);if(z)W.push(`
9324
+ ${$.message}`),Z&&$.line){let z=iW(Z,$.line,2);if(z)W.push(`
9318
9325
 
9319
9326
  \x1B[90mContext:\x1B[0m
9320
9327
  ${z}`)}if($.suggestion)W.push(`
9321
9328
 
9322
9329
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
9323
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function gW($,Z,Y){let X=$.split(`
9330
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function cW($,Z,Y){let X=$.split(`
9324
9331
  `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G=[];for(let K=Q;K<=J;K++){let q=(K+1).toString().padStart(4),W=K===Z-1?">":" ";G.push(`${W}${q} | ${X[K]}`)}return G.join(`
9325
- `)}function hW($,Z,Y){let X=$.split(`
9332
+ `)}function iW($,Z,Y){let X=$.split(`
9326
9333
  `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",W=[];for(let U=Q;U<=J;U++){let z=(U+1).toString().padStart(4),j=U===Z-1,_=j?"\x1B[31m>\x1B[0m":" ",B=j?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;W.push(`${_}\x1B[90m${z}\x1B[0m | ${B}`)}return W.join(`
9327
- `)}function j2($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function dW($,Z){let X=$.substring(0,Z).split(`
9328
- `);return{line:X.length,column:X[X.length-1].length}}function t($,Z,Y){return B2({type:$,message:Z,code:Y,format:"html"}).formatted}async function U5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var _2=k(()=>{k4();v4()});class g3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(X)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
9334
+ `)}function F2($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function nW($,Z){let X=$.substring(0,Z).split(`
9335
+ `);return{line:X.length,column:X[X.length-1].length}}function t($,Z,Y){return V2({type:$,message:Z,code:Y,format:"html"}).formatted}async function z5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var w2=k(()=>{S4();f4()});class m3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(X)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
9329
9336
  `).slice(1).join(`
9330
9337
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
9331
9338
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),X=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(X))Z.mkdirSync(X,{recursive:!0});await this.rotateIfNeeded(Z);let Q=`${this.formatEntry($)}
9332
9339
  `;Z.appendFileSync(this.logFilePath,Q,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let X=`${this.logFilePath}.${Y}`,Q=`${this.logFilePath}.${Y+1}`;if($.existsSync(X))if(Y>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,Q)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let X=Y.error.constructor.name;$[X]=($[X]||0)+1;let Q=Y.level||"error";Z[Q]=(Z[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),Q=(await import("path")).dirname($);if(!Y.existsSync(Q))Y.mkdirSync(Q,{recursive:!0});if(Z==="json"){let J=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(J,null,2),"utf-8")}else{let J=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,J.join(`
9333
9340
 
9334
- `),"utf-8")}}async flush(){await this.writeQueue}}var f3,r0,h3;var H2=k(()=>{v4();f3={isEnabled(){return S4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=S4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let z=0;z<U;z++)Y+=`
9335
- @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(X$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};r0=new g3,h3={isDevelopment(){return X$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
9336
- `)}}});var O2=()=>{};var L2=k(()=>{k4();_2();H2();O2();v4()});var J1=k(()=>{L2()});function F2($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),z=q,j=U.length>1?U[1]:"";if(j&&Z[j])W=Z[j];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])W=Z.openGraph[U[1]];else W="";return W?`<meta property="${l(z)}" content="${l(W)}">`:""}return W?`<meta name="${l(q)}" content="${l(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,U=q+1;while(U<Q.length&&W>0){if(Q[U]==="(")W++;else if(Q[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=Q.substring(q+1,U).trim(),j=U+1,_=(()=>{try{let B=V0(z,Z);if(!B)return"";let H="<meta";if(B.name)H+=` name="${l(String(B.name))}"`;if(B.property)H+=` property="${l(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)H+=` content="${l(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return t("MetaTag",H,o.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(j),J.lastIndex=0}return Q}function V2($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=X.substring(K+1,W).trim(),z=W+1,j=(()=>{try{let _=V0(U,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let B=_ instanceof Error?_.message:String(_);return t("StructuredData",B,o.EVALUATION_ERROR)}})();X=X.substring(0,G)+j+X.substring(z),Q.lastIndex=0}return X}function w2($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,U=null,z=!1;while(W<Q.length&&q>0){let F=Q[W];if(z){z=!1,W++;continue}if(F==="\\"&&U){z=!0,W++;continue}if(U){if(F===U)U=null;W++;continue}if(F==='"'||F==="'"||F==="`"){U=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let j=Q.substring(W).match(/^\s*\)/);if(!j)break;let _=W+j[0].length,B=Q.substring(K,W),H=Q.substring(G.index,_),L=((F)=>{try{let O=V0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
9341
+ `),"utf-8")}}async flush(){await this.writeQueue}}var d3,r0,u3;var A2=k(()=>{f4();d3={isEnabled(){return P4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=P4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let z=0;z<U;z++)Y+=`
9342
+ @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(J$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};r0=new m3,u3={isDevelopment(){return J$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
9343
+ `)}}});var R2=()=>{};var N2=k(()=>{S4();w2();A2();R2();f4()});var Q1=k(()=>{N2()});function M2($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),z=q,j=U.length>1?U[1]:"";if(j&&Z[j])W=Z[j];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])W=Z.openGraph[U[1]];else W="";return W?`<meta property="${l(z)}" content="${l(W)}">`:""}return W?`<meta name="${l(q)}" content="${l(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,U=q+1;while(U<Q.length&&W>0){if(Q[U]==="(")W++;else if(Q[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=Q.substring(q+1,U).trim(),j=U+1,_=(()=>{try{let B=F0(z,Z);if(!B)return"";let H="<meta";if(B.name)H+=` name="${l(String(B.name))}"`;if(B.property)H+=` property="${l(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)H+=` content="${l(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return t("MetaTag",H,o.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(j),J.lastIndex=0}return Q}function T2($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=X.substring(K+1,W).trim(),z=W+1,j=(()=>{try{let _=F0(U,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let B=_ instanceof Error?_.message:String(_);return t("StructuredData",B,o.EVALUATION_ERROR)}})();X=X.substring(0,G)+j+X.substring(z),Q.lastIndex=0}return X}function I2($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,U=null,z=!1;while(W<Q.length&&q>0){let F=Q[W];if(z){z=!1,W++;continue}if(F==="\\"&&U){z=!0,W++;continue}if(U){if(F===U)U=null;W++;continue}if(F==='"'||F==="'"||F==="`"){U=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let j=Q.substring(W).match(/^\s*\)/);if(!j)break;let _=W+j[0].length,B=Q.substring(K,W),H=Q.substring(G.index,_),L=((F)=>{try{let O=F0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
9337
9344
  `,V+=`<meta name="title" content="${l(O.title)}">
9338
9345
  `;if(O.description)V+=`<meta name="description" content="${l(O.description)}">
9339
9346
  `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${l(w)}">
@@ -9355,7 +9362,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
9355
9362
  `}if(w.site)V+=`<meta name="twitter:site" content="${l(w.site)}">
9356
9363
  `;if(w.creator)V+=`<meta name="twitter:creator" content="${l(w.creator)}">
9357
9364
  `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
9358
- `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return t("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(B);Q=Q.substring(0,G.index)+L+Q.substring(_),J.lastIndex=G.index+L.length}return Q}function A2($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
9365
+ `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return t("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(B);Q=Q.substring(0,G.index)+L+Q.substring(_),J.lastIndex=G.index+L.length}return Q}function D2($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
9359
9366
  <!-- stx SEO Tags -->
9360
9367
  <meta name="title" content="${l(G)}">
9361
9368
  <meta name="description" content="${l(K)}">
@@ -9371,7 +9378,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
9371
9378
  `;let U=$;if(!J)U=U.replace(/<head[^>]*>/,`$&
9372
9379
  <title>${l(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
9373
9380
  ${W}
9374
- `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var R2,N2;var d3=k(()=>{J1();B0();R2={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return t("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(Q)}" content="${l(J)}">`},hasEndTag:!1},N2={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return t("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return t("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return t("StructuredData",J,o.EVALUATION_ERROR)}},hasEndTag:!0}});import J$ from"path";function mW($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let j=z[1],_=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)J=B[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=j.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function uW($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
9381
+ `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var E2,k2;var l3=k(()=>{Q1();B0();E2={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return t("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(Q)}" content="${l(J)}">`},hasEndTag:!1},k2={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return t("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return t("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return t("StructuredData",J,o.EVALUATION_ERROR)}},hasEndTag:!0}});import Q$ from"path";function oW($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let j=z[1],_=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)J=B[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=j.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function sW($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
9375
9382
  get ${z}() {
9376
9383
  return this.getAttribute('${z}') || '';
9377
9384
  }
@@ -9422,16 +9429,16 @@ ${U}
9422
9429
  }
9423
9430
 
9424
9431
  customElements.define('${Z}', ${G});
9425
- `}async function T2($,Z,Y,X){if(Z.length<1)return t("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[J$.join(J$.dirname(X),G,`${Q}.stx`),J$.join(process.cwd(),G,`${Q}.stx`),J$.join(J$.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await c(z)){q=await Bun.file(z).text();break}if(!q)return t("WebComponent",`Component file not found: ${Q}.stx`,o.FILE_NOT_FOUND);let W=mW(q,Q);return`<script type="module">
9426
- ${uW(W)}
9427
- </script>`}var M2=k(()=>{J1();F0()});var I2={};s(I2,{timingPlugin:()=>nW,pluginManager:()=>lW,definePlugin:()=>x4,debugPlugin:()=>iW,createVariablesPlugin:()=>oW,createFilterPlugin:()=>cW,createDirectivePlugin:()=>pW,PluginManager:()=>m3});function x4($){return $}class m3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function pW($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function cW($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function oW($){return x4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var lW,iW,nW;var D2=k(()=>{lW=new m3;iW=x4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),nW=x4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var k2={};s(k2,{validateConfig:()=>eW,loadStxConfig:()=>j5,defineStxConfig:()=>tW,defaultConfig:()=>h1,config:()=>l3});import u3 from"fs";import E0 from"path";import{loadConfigWithResult as sW}from"bunfig";function rW($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=E0.join(process.cwd(),"resources","views"),Q=E0.join(process.cwd(),"resources","layouts");if(u3.existsSync(X)&&u3.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=E0.join(process.cwd(),"resources","views","pages");if(u3.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function aW($){if(N9($.stateDir),$.stateDir=S5(),$.cachePath=P5($.cachePath),$.build)$.build.cacheDir=P5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=P5($.media.cache.directory);if($.story)$.story.outDir=P5($.story.outDir)}async function j5($){if(!$){if(z5)return z5;if(f4)return f4}let Z=$?E0.resolve($):process.cwd(),Y=E2.get(Z);if(Y)return Y;let X=(async()=>{let J=(await sW({name:"stx",alias:"ui",cwd:Z,defaultConfig:h1,verbose:!1})).config;aW(J);let G=rW(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!E0.isAbsolute(J.partialsDir))J.partialsDir=E0.join(K,J.partialsDir);if(J.componentsDir&&!E0.isAbsolute(J.componentsDir))J.componentsDir=E0.join(K,J.componentsDir);if(J.layoutsDir&&!E0.isAbsolute(J.layoutsDir))J.layoutsDir=E0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (D2(),I2)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],j=typeof U==="string"?{}:U[1]||{};try{let _,B;try{_=await import(z),B=E0.dirname(K0.resolve(z))}catch{let L=E0.resolve(process.cwd(),z);_=await import(L),B=E0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=E0.resolve(B,H.components);q.push(L)}if(H.pages){let L=E0.resolve(B,H.pages),F=j.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:B,config:J};await H.setup(j,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(_){console.warn(`[stx] Failed to load plugin ${z}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(E2.set(Z,X),!$)f4=X,X.then((Q)=>{z5=Q}).catch(()=>{});return X}function tW($){return $}function eW($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var h1,z5=null,E2,f4=null,l3;var B5=k(()=>{F7();V7();w7();A7();Z3();mZ();y3();C3();d3();M$();M2();h1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:a1,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:BZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:T2,hasEndTag:!1,description:"Include a web component in the template"},I9,D9,R2,N2,E9,b9,S9,k9,v9,g9,dZ,S3,...P3],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};E2=new Map;l3=new Proxy(h1,{get($,Z){if(z5&&Z in z5)return z5[Z];if(!f4)j5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import Q0 from"path";import{hasLocalConfig as $U}from"bunfig/discovery";function h4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function c3($,Z){if(d1.has($))d1.delete($);else if(d1.size>=y2)d1.delete(d1.keys().next().value);d1.set($,Z)}function ZU($){let Z=h4($);if(_5.has(Z))_5.delete(Z);else if(_5.size>=y2)_5.delete(_5.keys().next().value);return _5.set(Z,$),Z}async function YU($){if(!O1)return null;try{let Z=Bun.file(Q0.join(O1,`cw-${h4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function XU($,Z){if(!O1)return;try{if(!fs.existsSync(O1))fs.mkdirSync(O1,{recursive:!0});await Bun.write(Q0.join(O1,`cw-${h4($)}.css`),Z)}catch{}}async function S2($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function JU(){let $=[],Z=process.cwd();while(Z!==Q0.dirname(Z))$.push(Q0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Q0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Q0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Q0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Q0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Q0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=Q0.dirname(Z);return $}function QU(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[Q0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Q0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(Q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function GU(){if(b2)return Q1;b2=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await S2(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} CSS engine loaded from ${Q0.dirname(Q0.dirname(J))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let Q=Q0.resolve(process.env.CROSSWIND_SRC),J=await $([Q]);if(!J)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Q}`);return Q1=J,Q1}let Z=await $(JU());if(Z)return Q1=Z,Q1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await S2(Q);if(J){if(Q1=J,!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} CSS engine loaded`);return Q1}}let X=await $(QU());if(X)return Q1=X,Q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${L0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${L0.reset}`),console.warn(`${L0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${L0.reset}`),null}}async function KU($){try{if(!$U({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=Q0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${L0.yellow}[Crosswind]${L0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function qU($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function WU($,Z){try{let Y=await GU();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):qU($);if(X.size===0)return"";let Q=Z?Q0.resolve(Z):process.cwd();if(!O1)O1=y5(Q,"cache");let J=[...X].sort().join(" "),G=`${p3||"default"}::${J}`,K=d1.get(G);if(K!==void 0)return c3(G,K),K;let q=await YU(G);if(q!==null)return c3(G,q),q;if(!g4){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (B5(),k2)),R=await N(Q);if(R.css)if(typeof R.css==="string"){let T=Q0.isAbsolute(R.css)?R.css:Q0.resolve(Q,R.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${L0.green}[Crosswind]${L0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Q0.isAbsolute(R.css.config)?R.css.config:Q0.resolve(Q,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${L0.green}[Crosswind]${L0.reset} Using inline CSS config from stx.config.ts`)}}catch{}g4=A||await KU(Q);try{p3=h4(JSON.stringify(g4??{}))}catch{p3="unhashable"}}let W=Y.defaultConfig||Y.config,U=g4||{},z=W.theme||{},_=(U.theme||{}).extend||{},B={...z};if(Object.keys(_).length>0)B.extend=_;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of X)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
9428
- `);for(let[A,N]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of R){let E=I.startsWith("dark:"),S=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<w.length;b++){let v=w[b].trim();if(v===`${S} {`||v.startsWith(`${S} {`)){let h=b,f="";while(h<w.length){if(f+=w[h],w[h].includes("}"))break;h++}let m=f.match(/\{([^}]+)\}/);if(m)if(E)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
9429
- .${A} { ${T.join(" ")} }`;if(M.length)O+=`
9430
- @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return c3(G,O),XU(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function P2($,Z,Y=!1){let X=await WU($,Z);if(!X)return $;let Q=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${ZU(X)}.css">`:`<style data-crosswind="generated">
9432
+ `}async function b2($,Z,Y,X){if(Z.length<1)return t("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[Q$.join(Q$.dirname(X),G,`${Q}.stx`),Q$.join(process.cwd(),G,`${Q}.stx`),Q$.join(Q$.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await c(z)){q=await Bun.file(z).text();break}if(!q)return t("WebComponent",`Component file not found: ${Q}.stx`,o.FILE_NOT_FOUND);let W=oW(q,Q);return`<script type="module">
9433
+ ${sW(W)}
9434
+ </script>`}var S2=k(()=>{Q1();L0()});var y2={};s(y2,{timingPlugin:()=>$U,pluginManager:()=>rW,definePlugin:()=>g4,debugPlugin:()=>eW,createVariablesPlugin:()=>ZU,createFilterPlugin:()=>tW,createDirectivePlugin:()=>aW,PluginManager:()=>p3});function g4($){return $}class p3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function aW($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function tW($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function ZU($){return g4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var rW,eW,$U;var P2=k(()=>{rW=new p3;eW=g4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),$U=g4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var v2={};s(v2,{validateConfig:()=>GU,loadStxConfig:()=>B5,defineStxConfig:()=>QU,defaultConfig:()=>h1,config:()=>i3});import c3 from"fs";import E0 from"path";import{loadConfigWithResult as YU}from"bunfig";function XU($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=E0.join(process.cwd(),"resources","views"),Q=E0.join(process.cwd(),"resources","layouts");if(c3.existsSync(X)&&c3.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=E0.join(process.cwd(),"resources","views","pages");if(c3.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function JU($){if(T9($.stateDir),$.stateDir=y5(),$.cachePath=C5($.cachePath),$.build)$.build.cacheDir=C5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=C5($.media.cache.directory);if($.story)$.story.outDir=C5($.story.outDir)}async function B5($){if(!$){if(j5)return j5;if(h4)return h4}let Z=$?E0.resolve($):process.cwd(),Y=C2.get(Z);if(Y)return Y;let X=(async()=>{let J=(await YU({name:"stx",alias:"ui",cwd:Z,defaultConfig:h1,verbose:!1})).config;JU(J);let G=XU(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!E0.isAbsolute(J.partialsDir))J.partialsDir=E0.join(K,J.partialsDir);if(J.componentsDir&&!E0.isAbsolute(J.componentsDir))J.componentsDir=E0.join(K,J.componentsDir);if(J.layoutsDir&&!E0.isAbsolute(J.layoutsDir))J.layoutsDir=E0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (P2(),y2)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],j=typeof U==="string"?{}:U[1]||{};try{let _,B;try{_=await import(z),B=E0.dirname(K0.resolve(z))}catch{let L=E0.resolve(process.cwd(),z);_=await import(L),B=E0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=E0.resolve(B,H.components);q.push(L)}if(H.pages){let L=E0.resolve(B,H.pages),F=j.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:B,config:J};await H.setup(j,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(_){console.warn(`[stx] Failed to load plugin ${z}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(C2.set(Z,X),!$)h4=X,X.then((Q)=>{j5=Q}).catch(()=>{});return X}function QU($){return $}function GU($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var h1,j5=null,C2,h4=null,i3;var _5=k(()=>{w7();A7();R7();N7();J3();nZ();v3();f3();l3();I$();S2();h1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:t1,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:VZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:b2,hasEndTag:!1,description:"Include a web component in the template"},E9,k9,E2,k2,b9,y9,P9,S9,f9,d9,iZ,C3,...x3],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};C2=new Map;i3=new Proxy(h1,{get($,Z){if(j5&&Z in j5)return j5[Z];if(!h4)B5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import Q0 from"path";import{hasLocalConfig as KU}from"bunfig/discovery";function m4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function o3($,Z){if(d1.has($))d1.delete($);else if(d1.size>=g2)d1.delete(d1.keys().next().value);d1.set($,Z)}function qU($){let Z=m4($);if(H5.has(Z))H5.delete(Z);else if(H5.size>=g2)H5.delete(H5.keys().next().value);return H5.set(Z,$),Z}async function WU($){if(!L1)return null;try{let Z=Bun.file(Q0.join(L1,`cw-${m4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function UU($,Z){if(!L1)return;try{if(!fs.existsSync(L1))fs.mkdirSync(L1,{recursive:!0});await Bun.write(Q0.join(L1,`cw-${m4($)}.css`),Z)}catch{}}async function f2($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function zU(){let $=[],Z=process.cwd();while(Z!==Q0.dirname(Z))$.push(Q0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Q0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Q0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Q0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Q0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Q0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=Q0.dirname(Z);return $}function jU(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[Q0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Q0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(Q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function BU(){if(x2)return G1;x2=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await f2(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${Q0.dirname(Q0.dirname(J))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let Q=Q0.resolve(process.env.CROSSWIND_SRC),J=await $([Q]);if(!J)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Q}`);return G1=J,G1}let Z=await $(zU());if(Z)return G1=Z,G1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await f2(Q);if(J){if(G1=J,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return G1}}let X=await $(jU());if(X)return G1=X,G1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}async function _U($){try{if(!KU({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=Q0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function HU($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function OU($,Z){try{let Y=await BU();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):HU($);if(X.size===0)return"";let Q=Z?Q0.resolve(Z):process.cwd();if(!L1)L1=P5(Q,"cache");let J=[...X].sort().join(" "),G=`${n3||"default"}::${J}`,K=d1.get(G);if(K!==void 0)return o3(G,K),K;let q=await WU(G);if(q!==null)return o3(G,q),q;if(!d4){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (_5(),v2)),R=await N(Q);if(R.css)if(typeof R.css==="string"){let M=Q0.isAbsolute(R.css)?R.css:Q0.resolve(Q,R.css);if(await Bun.file(M).exists()){let T=await import(M);A=T.default||T,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let M=Q0.isAbsolute(R.css.config)?R.css.config:Q0.resolve(Q,R.css.config);if(await Bun.file(M).exists()){let T=await import(M);A={...T.default||T,...A}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}d4=A||await _U(Q);try{n3=m4(JSON.stringify(d4??{}))}catch{n3="unhashable"}}let W=Y.defaultConfig||Y.config,U=d4||{},z=W.theme||{},_=(U.theme||{}).extend||{},B={...z};if(Object.keys(_).length>0)B.extend=_;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of X)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let M of R)F.generate(M)}O=F.toCSS(!0,!1);let w=O.split(`
9435
+ `);for(let[A,N]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean),M=[],T=[];for(let I of R){let E=I.startsWith("dark:"),S=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<w.length;b++){let v=w[b].trim();if(v===`${S} {`||v.startsWith(`${S} {`)){let h=b,f="";while(h<w.length){if(f+=w[h],w[h].includes("}"))break;h++}let m=f.match(/\{([^}]+)\}/);if(m)if(E)T.push(m[1].trim());else M.push(m[1].trim());break}}}if(M.length)O+=`
9436
+ .${A} { ${M.join(" ")} }`;if(T.length)O+=`
9437
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${T.join(" ")} } }`}return o3(G,O),UU(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function h2($,Z,Y=!1){let X=await OU($,Z);if(!X)return $;let Q=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${qU(X)}.css">`:`<style data-crosswind="generated">
9431
9438
  ${X}
9432
9439
  </style>`,J=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(J.test($)){let G=!1;return $.replace(J,()=>{if(G)return"";return G=!0,Q})}if($.includes("</head>"))return $.replace("</head>",`${Q}
9433
9440
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
9434
- ${Q}`);return Q+$}var Q1=null,b2=!1,g4=null,y2=256,d1,_5,O1=null,p3=null;var C2=k(()=>{M$();T9();d1=new Map,_5=new Map});function v2(){return`
9441
+ ${Q}`);return Q+$}var G1=null,x2=!1,d4=null,g2=256,d1,H5,L1=null,n3=null;var d2=k(()=>{I$();I9();d1=new Map,H5=new Map});function m2(){return`
9435
9442
  // STX Lifecycle Runtime
9436
9443
  (function() {
9437
9444
  if (typeof window === 'undefined') return;
@@ -9776,7 +9783,7 @@ else {
9776
9783
 
9777
9784
  console.log('[stx] Lifecycle runtime initialized');
9778
9785
  })();
9779
- `}function i3($){return Symbol($)}var WV,UV,zV;var x2=k(()=>{WV=i3("theme"),UV=i3("router"),zV=i3("i18n")});import*as g2 from"crypto";function f2($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function UU(){return`stx-${g2.randomBytes(4).toString("hex")}`}function zU($){return/\$\w+\./.test($)}function jU($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(j)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(zU(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),f2(A).forEach((R)=>Y.add(R)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let B=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(B)H=B[1];else H=UU(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:f2(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function BU($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
9786
+ `}function s3($){return Symbol($)}var VV,wV,AV;var u2=k(()=>{VV=s3("theme"),wV=s3("router"),AV=s3("i18n")});import*as p2 from"crypto";function l2($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function LU(){return`stx-${p2.randomBytes(4).toString("hex")}`}function FU($){return/\$\w+\./.test($)}function VU($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(j)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(FU(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),l2(A).forEach((R)=>Y.add(R)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let B=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(B)H=B[1];else H=LU(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:l2(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function wU($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
9780
9787
  <script>
9781
9788
  (function() {
9782
9789
  'use strict';
@@ -9934,10 +9941,10 @@ else {
9934
9941
  }
9935
9942
  })();
9936
9943
  </script>
9937
- `,X}function h2($){let{html:Z,bindings:Y,stores:X}=jU($);if(Y.length===0)return $;let Q=BU(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var d2=()=>{};function _U($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return HU(Z);case"google-analytics":return OU(Z);case"plausible":return LU(Z);case"self-hosted":return FU(Z);case"custom":return VU(Z);default:return""}}function HU($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${g0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${g0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
9944
+ `,X}function c2($){let{html:Z,bindings:Y,stores:X}=VU($);if(Y.length===0)return $;let Q=wU(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var i2=()=>{};function AU($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return RU(Z);case"google-analytics":return NU(Z);case"plausible":return MU(Z);case"self-hosted":return TU(Z);case"custom":return IU(Z);default:return""}}function RU($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${g0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${g0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
9938
9945
  <!-- Fathom Analytics -->
9939
9946
  <script src="${g0(Y)}" ${Q.join(" ")}${X}></script>
9940
- `}function OU($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=g0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
9947
+ `}function NU($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=g0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
9941
9948
  <!-- Google Analytics -->
9942
9949
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
9943
9950
  <script>
@@ -9947,10 +9954,10 @@ else {
9947
9954
  gtag('config', '${Y}');
9948
9955
  ${X}
9949
9956
  </script>
9950
- `}function LU($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${g0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
9957
+ `}function MU($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${g0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
9951
9958
  <!-- Plausible Analytics -->
9952
9959
  <script defer data-domain="${g0(Z.domain)}" src="${g0(Q)}"></script>
9953
- `}function FU($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=g0(Z.siteId),X=g0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
9960
+ `}function TU($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=g0(Z.siteId),X=g0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
9954
9961
  d.addEventListener('click',function(e){
9955
9962
  var a=e.target.closest('a');
9956
9963
  if(a&&a.hostname!==location.hostname){
@@ -9983,7 +9990,7 @@ else {
9983
9990
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
9984
9991
  })();
9985
9992
  </script>
9986
- `}function VU($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
9993
+ `}function IU($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
9987
9994
  <!-- Custom Analytics -->
9988
9995
  <script>
9989
9996
  ${Z.inlineScript}
@@ -9991,7 +9998,7 @@ ${Z.inlineScript}
9991
9998
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${g0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,J]of Object.entries(Z.attributes))Y.push(`${g0(Q)}="${g0(J)}"`);return`
9992
9999
  <!-- Custom Analytics -->
9993
10000
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${g0(Z.scriptUrl)}" defer></script>
9994
- `}function m2($,Z){let Y=_U(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function g0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var u2=()=>{};function c2($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(wU.has(X))Z.systemKeys.push(X);else if(X in i2)Z.mouse=X;else if(X in p2||/^[a-z]$/.test(X))Z.keys.push(p2[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function n2($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,U=`__stx_evt_${Y++}`,z=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!l2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:c2(F.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!l2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:c2(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function AU($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=i2[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function RU($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function NU($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=AU($),Q=RU($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
10001
+ `}function n2($,Z){let Y=AU(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function g0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var o2=()=>{};function a2($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(DU.has(X))Z.systemKeys.push(X);else if(X in t2)Z.mouse=X;else if(X in r2||/^[a-z]$/.test(X))Z.keys.push(r2[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function e2($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,U=`__stx_evt_${Y++}`,z=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!s2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:a2(F.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!s2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:a2(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function EU($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=t2[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function kU($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function bU($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=EU($),Q=kU($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
9995
10002
  (function() {
9996
10003
  var $el = document.getElementById('${Y}');
9997
10004
  if (!$el) return;
@@ -10045,7 +10052,7 @@ else {
10045
10052
  __stx_runHandler('${K}', $event, $el);
10046
10053
  }
10047
10054
  }${G});
10048
- })();`}function TU($){if($.length===0)return"";return`
10055
+ })();`}function SU($){if($.length===0)return"";return`
10049
10056
  <script data-stx-events>
10050
10057
  (function() {
10051
10058
  'use strict';
@@ -10093,11 +10100,11 @@ else {
10093
10100
  }
10094
10101
 
10095
10102
  // Event listeners
10096
- ${$.flatMap((Y)=>Y.events).map(NU).join(`
10103
+ ${$.flatMap((Y)=>Y.events).map(bU).join(`
10097
10104
  `)}
10098
10105
  })();
10099
- </script>`}function MU($){let Z=n2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[Q],G=J.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${J.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of J.events)q.elementId=K[1]}for(let K of J.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(U,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function o2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=MU($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=n2($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let j of W.events)j.elementId=z[1]}for(let z of W.events){let j=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");U=U.replace(_,""),U=U.replace(B,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=TU(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
10100
- `+J.slice(K);else J+=G;return J}var l2,p2,wU,i2;var s2=k(()=>{l2=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"]),p2={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"},wU=new Set(["ctrl","alt","shift","meta"]),i2={left:0,middle:1,right:2}});function d4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function DU($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=r2(G,"x-data");if(!q)continue;let W=`__stx_scope_${t2++}`,U=r2(G,"x-init"),z=EU($,J,K+Q.length),j=$.slice(K,z.endIndex),_=kU(j);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:_})}return Z}function EU($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),W=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function kU($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=X.exec(Y))!==null){let[,J,G]=Q,K=bU(J);Z.set(G,K)}return Z}function bU($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${IU++}`}function SU(){return`
10106
+ </script>`}function yU($){let Z=e2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[Q],G=J.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${J.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of J.events)q.elementId=K[1]}for(let K of J.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(U,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function $Y($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=yU($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=e2($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let j of W.events)j.elementId=z[1]}for(let z of W.events){let j=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");U=U.replace(_,""),U=U.replace(B,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=SU(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
10107
+ `+J.slice(K);else J+=G;return J}var s2,r2,DU,t2;var ZY=k(()=>{s2=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),r2={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"},DU=new Set(["ctrl","alt","shift","meta"]),t2={left:0,middle:1,right:2}});function u4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function YY($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function CU($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=YY(G,"x-data");if(!q)continue;let W=`__stx_scope_${JY++}`,U=YY(G,"x-init"),z=vU($,J,K+Q.length),j=$.slice(K,z.endIndex),_=xU(j);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:_})}return Z}function vU($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),W=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function xU($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=X.exec(Y))!==null){let[,J,G]=Q,K=fU(J);Z.set(G,K)}return Z}function fU($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${PU++}`}function gU(){return`
10101
10108
  // STX Reactive Runtime - x-cloak and transition CSS
10102
10109
  (function() {
10103
10110
  var style = document.createElement('style');
@@ -10304,7 +10311,7 @@ window.__stx_reactive = (function() {
10304
10311
 
10305
10312
  return { initScope: initScope, reactive: reactive };
10306
10313
  })();
10307
- `}function a2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=l0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=l0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function yU($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=a2(X.stateExpr,Z),G=X.initExpr?a2(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
10314
+ `}function XY($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=l0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=l0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function hU($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=XY(X.stateExpr,Z),G=X.initExpr?XY(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
10308
10315
  (function() {
10309
10316
  var scopeEl = document.querySelector('${X.selector}');
10310
10317
  if (!scopeEl) return;
@@ -10313,16 +10320,16 @@ window.__stx_reactive = (function() {
10313
10320
  })();`}).join(`
10314
10321
  `);return`
10315
10322
  <script data-stx-scoped data-stx-reactive>
10316
- ${SU()}
10323
+ ${gU()}
10317
10324
  ${Y}
10318
- </script>`}function e2($,Z,Y){if(t2=0,!CU($))return $;let X=DU($);if(X.length===0)return $;let Q=PU($,X),J=yU(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
10319
- `+Q.slice(G);else Q+=J;return Q}function PU($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${d4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${d4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${d4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${d4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function CU($){return/x-data\s*=\s*["']/.test($)}var t2=0,IU=0;var $Y=k(()=>{t0()});import vU from"fs";import n3 from"path";import{createHighlighter as xU}from"ts-syntax-highlighter";async function fU($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await vU.promises.stat($)).mtime.getTime();if(Z.cache&&o3.has($)){let z=o3.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=d9(Q),K=Z.markdown||l3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=C5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await gU(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)o3.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:q0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function gU($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!m4)try{m4=await xU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=W||(Y?"text":"");if(!j)return K;try{if(!m4.getSupportedLanguages().includes(j))return K;return(await m4.highlight(z,j,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,j=await Q(q,W,U,z);J=J.replace(q,j)}return J}async function ZY($,Z,Y="",X={}){return await hU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!n3.isAbsolute(K))U=n3.resolve(n3.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),N=V.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);z[A]=N}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:_}=await fU(U,X),B={...Z,..._,...z},H=j,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return B[V]!==void 0?String(B[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return q0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function hU($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((U)=>({match:K,replacement:U,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var o3,m4=null;var YY=k(()=>{B5();F0();o3=new Map});function L1($,Z){try{let Y=$.trim();if(X0(Y))return J0(Y,Object.keys(Z))(...Object.values(Z));else return e(Y,Z)}catch{return!1}}var XY=k(()=>{B0()});function dU($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=h7(X,G);if(!K)break;try{let q;if(X0(K.expression))q=J0(K.expression,Object.keys(Z))(...Object.values(Z));else q=e(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let j;if(z.value&&X0(z.value))j=J0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)j=e(z.value,Z);if(q===j){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=t("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function m1($,Z,Y){let X=$;X=dU(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=_1(X,K+7);if(!q)break;let W=q.endPos,U=P1(X,"unless","endunless",W);if(U===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=X.slice(W,U),j=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let B;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);B=`@if (${j})${L}@else ${H}@endif`}else B=`@if (!(${j}))${z}@endif`;X=X.substring(0,K)+B+X.substring(U+10),J=!0}}X=r3(X,Z,Y),X=a3(X,Z,Y),X=s3(X,Z);let Q=()=>{let J=r5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&X0(U.condition))z=J0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=e(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=t(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=t("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function JY($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function s3($,Z){let Y=$;function X(K,q,W,U){let z=1,j=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g");while(j<K.length&&z>0){_.lastIndex=j,B.lastIndex=j;let H=_.exec(K),L=B.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,j=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;j=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,B=[],H;while((H=z.exec(K))!==null)B.push({pos:H.index,type:"open"});while((H=j.exec(K))!==null)B.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)B.push({pos:H.index,type:"else"});B.sort((L,F)=>L.pos-F.pos);for(let L of B)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,j=Y.slice(W+5),_=JY(j);if(_)U=_.value,z=W+5+_.consumed;else z=W+5;let B=X(Y,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,B),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?L1(`auth?.check && auth?.user?.[${U}]`,Z):L1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,j=Y.slice(W+6),_=JY(j);if(_)U=_.value,z=W+6+_.consumed;else z=W+6;let B=X(Y,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,B),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?L1(`!auth?.check || !auth?.user?.[${U}]`,Z):L1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(B+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(W){let z=L1(W,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let j=z.index,_=Y.slice(j+`@${K}`.length),B=G(_);if(!B)break;let H=j+`@${K}`.length+B.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((b,v)=>b.pos-v.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],E=0;for(let b=0;b<O.length;b++){let v=O[b];if(I.push({content:F.slice(E,v.pos),ability:void 0}),v.type==="elseDirective"){let h=F.slice(v.pos+`@${W}`.length),f=G(h);if(f){I[I.length-1]={content:F.slice(E,v.pos)},E=v.pos+`@${W}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let m=O[b+1],r=m?m.pos:F.length;I.push({content:F.slice(E,r),ability:f.ability,type:f.type,id:f.id}),E=r}}else E=v.pos+5}if(E<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(E)})}let D=J(B.ability,B.type,B.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let b=!1;for(let v=1;v<I.length;v++){let h=I[v];if(h.isFinalElse){S=h.content,b=!0;break}if(h.ability){let f=J(h.ability,h.type,h.id);if(K==="can"?f:!f){S=h.content,b=!0;break}}}if(!b&&I.length>0){let v=I[I.length-1];if(v.isFinalElse)S=v.content}}Y=Y.substring(0,j)+S+Y.substring(L+`@${q}`.length),U=!0}}return Y}function r3($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),j=J.match(z);if(!j||j.index===void 0)break;let _=j.index,B=_1(J,_+`@${G}`.length);if(!B)break;let H=B.endPos,L=P1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=B.expression,V=-1,w=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let R=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=N;break}A=N+1}try{let N=q(O.trim()),R;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);R=N?T:M}else R=N?F:"";J=J.substring(0,_)+R+J.substring(L+`@${K}`.length),U=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=t(W,`Error processing @${G} directive: ${R}`,o.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=L1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=L1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function a3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),B=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(B);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let D=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,W=Q===D[2]}let V=1,w=O,A=-1;while(V>0&&w<B.length){U.lastIndex=w,z.lastIndex=w;let D=U.exec(B),y=z.exec(B),S=D?D.index:1/0,b=y?y.index:1/0;if(S<b)V++,w=S+D[0].length;else if(b<1/0){if(V--,V===0){A=b;break}w=b+y[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(O,A),R=-1,T=0,M=0;while(M<N.length){let D=N.indexOf("@",M);if(D===-1)break;let y=N.substring(D);if(j.test(y)){T++,M=D+1;continue}if(_.test(y)){T--,M=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){R=D;break}M=D+1}let I;if(R!==-1){let D=N.slice(0,R),y=N.slice(R+5);I=W?D:y}else I=W?N:"";let E=`@${q}`.length;B=B.substring(0,F)+I+B.substring(A+E),H=!0}return B}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var u4=k(()=>{XY();J1();d$();B0()});function GY($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function l4($,Z){if(!$)return Z?.nonceGenerator?.()??GY();let Y=QY.get($);if(!Y)Y=Z?.nonceGenerator?.()??GY(),QY.set($,Y);return Y}function mU($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function KY($,Z){return`<meta http-equiv="Content-Security-Policy" content="${mU($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function qY($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?l4(Y,Z):void 0,Q=KY(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
10320
- ${Q}`)}function WY($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<script nonce="${Z}"${Q}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<style nonce="${Z}"${Q}>`}),Y}function UY($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?l4(Z,J):void 0;return KY(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return l4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=l4(Z,J);return Q}var QY;var zY=k(()=>{QY=new WeakMap});import uU from"crypto";function pU($=lU){let Z=uU.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return t3=Z,Z}function cU(){if(!t3)pU();return t3}function iU($=jY){let Z=cU();return`<input type="hidden" name="${$}" value="${Z}">`}function BY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return iU(X||jY)})}var lU=40,jY="_token",t3=null;var _Y=()=>{};async function HY($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await nU(Q,J,Z,Y,X);else Q=await oU(Q,J,Z,Y,X)}return Q}async function nU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=X5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],j=U.exec(W);while(j!==null){let[_,B="",H=""]=j,L=j.index||0;try{let F=B?OY(B):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:_,processed:t("CustomDirective",`Error in @${J}${B?`(${B})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:L})}j=U.exec(W)}for(let _=z.length-1;_>=0;_--){let{original:B,processed:H}=z[_];W=W.replace(B,H)}return W}async function oU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=X5(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[_,B=""]=U,H=U.index||0;try{let L=OY(B),F=await G("",L,Y,X);W.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:_,processed:t("CustomDirective",`Error in @${J}(${B}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=X5(`@${J}(?!\\w)(?!\\s*\\()`,"g"),j=z.exec(K);while(j!==null){let[_]=j,B=j.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:B})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:t("CustomDirective",`Error in @${J}: ${L}`,o.EVALUATION_ERROR),startIndex:B})}j=z.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:B,processed:H}=W[_];K=K.replace(B,H)}return K}function OY($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var LY=k(()=>{J1();J5()});function u1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function rU($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(u1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(u1(Y.key,"appearance.key"),u1(Y.attribute,"appearance.attribute"),u1(Y.default,"appearance.default"),u1(X.key,"colorMode.key"),u1(X.attribute,"colorMode.attribute"),u1(X.default,"colorMode.default"),!VY.test(Y.key)||!VY.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!FY.test(Y.attribute)||!FY.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((Q)=>typeof Q!=="string"||Q.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!sU.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function aU($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function tU($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${aU($)};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 eU($,Z){let Y=1,X=null,Q=!1;for(let J=Z+1;J<$.length;J++){let G=$[J];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return J}return-1}function wY($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index+Q[0].length-1,G=eU(Y,J);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(J+1,G).trim(),q=e(`(${K})`,Z),W=tU(rU(q));Y=Y.slice(0,Q.index)+W+Y.slice(G+1),X.lastIndex=Q.index+W.length}return Y}var FY,VY,sU;var AY=k(()=>{B0();FY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,VY=/^[A-Za-z_$][\w$]*$/,sU=new Set(["light","dark","system"])});import $z from"crypto";function A0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function p4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function Zz(){return $z.randomUUID()}function c4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=Zz();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${A0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${A0(J)}">`;return X}),Y}function TY($,Z,Y=NY){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",j=F1(W),_=U.toUpperCase(),B=["GET","POST"].includes(_)?_:"POST",H=`<form method="${A0(B)}" action="${A0(z)}"${j?` ${j}`:""}>`;if(H+=`
10321
- ${c4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
10322
- ${c4(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",j=F1(W),_=Q$(U,Z),B=_!==void 0&&_!==null?_:z||"",H=j.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=G$(U,Z),O=j.match(/class=['"]([^'"]+)['"]/i),V=p4(O?O[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${A0(L)}" name="${A0(U)}" value="${A0(B)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=F1(G),W=Q$(J,Z)||K.trim(),U=G$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),j=p4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${A0(J)}" class="${j}"${_?` ${_}`:""}>${A0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=F1(G),W=Q$(J,Z),U=G$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),j=p4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(W!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${A0(J)}" class="${j}"${_?` ${_}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=F1(K),W=Q$(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((B)=>String(B)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${A0(J)}" value="${A0(G)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=F1(K),W=Q$(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${A0(J)}" value="${A0(G)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=F1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=G$(J,Z),j=K.match(/class=['"]([^'"]+)['"]/i),_=p4(j?j[1]:"",Y.input,z,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${A0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${A0(W)}"`);if(U)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=F1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${A0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function MY($,Z,Y=NY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(G$(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return RY(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return RY(Q,Z)}let q=K.trim();if(X0(q)){let W=e(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function G$($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function RY($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function Q$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function F1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var NY;var IY=k(()=>{B0();NY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import Z6 from"path";async function Yz(){if(K$!==void 0)return K$;try{K$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{K$=null}return K$}function Xz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Jz($,Z){if({...J6,...Z.i18n}.cache&&Y6[$]){let Q=Y6[$],J=Z.i18n?.cacheMaxAge??0;if(!Xz(Q,J))return Q.translations}if(q$[$]?.state==="loading")return q$[$].promise;e3[$]="loading";let X=X6($,Z).then((Q)=>{return e3[$]="loaded",delete q$[$],Q}).catch((Q)=>{throw e3[$]="error",q$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return q$[$]={promise:X,state:"loading"},X}async function X6($,Z){let Y={...J6,...Z.i18n},X=Z6.isAbsolute(Y.translationsDir)?Y.translationsDir:Z6.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await Yz(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:Wz(Y.format)}):await Qz($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return X6(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)Y6[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return X6(Y.defaultLocale,Z);return{}}}async function Qz($,Z,Y){let X=Z6.join(Y,`${$}${Gz(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return Kz(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function Gz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Kz($){let Z={},Y=$.split(`
10323
- `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),j=U.trim();if(j==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=qz(j)}}return Z}function qz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function Wz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Uz($,Z){return Jz($,Z)}function zz($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function jz($,Z={}){return kY($,Z)}function kY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=Bz($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=_z(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function Bz($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function _z($,Z){let Y=Hz($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return Oz(Q,Y.slice(2).join(","),Z);case"select":return Fz(Q,Y.slice(2).join(","));case"selectordinal":return Vz(Q,Y.slice(2).join(","));case"number":return Az(Q,Y[2]?.trim());case"date":return Rz(Q,Y[2]?.trim());case"time":return Nz(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function Hz($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function Oz($,Z,Y){let X=Number($)||0,Q=Q6(Z),J=`=${X}`;if(Q[J])return $6(Q[J],X,Y);let G=Lz(X);if(Q[G])return $6(Q[G],X,Y);if(Q.other)return $6(Q.other,X,Y);return String(X)}function $6($,Z,Y){let X=$.replace(/#/g,String(Z));return kY(X,Y)}function Lz($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function Fz($,Z){let Y=String($||""),X=Q6(Z);if(X[Y])return X[Y];return X.other||String($)}function Vz($,Z){let Y=Number($)||0,X=Q6(Z),Q=wz(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function wz($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function Q6($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function Az($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function Rz($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function Nz($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function Tz($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function DY($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(Tz(G))return jz(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=zz(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function bY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...J6,...X.i18n},K=await Uz(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await EY(Q,J,async(U,z,j,_,B)=>{try{let H={};if(j)try{let F=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return V0(j,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return DY(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return t("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,j)=>console.warn(`Match ${j}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await EY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,j,_)=>{try{let B={};if(j)try{let H=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return V0(j,Z)}];for(let L of H)try{if(B=L(),Object.keys(B).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return DY(z,K,G.fallbackToKey,B)}catch(B){if(X.debug)console.error("Error processing @translate directive:",B);return t("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),Q}async function EY($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var K$,J6,Y6,q$,e3;var SY=k(()=>{J1();B0();J6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},Y6={},q$={},e3={}});var q6={};s(q6,{streamingSuspenseDirective:()=>CY,streamToResponse:()=>xz,streamTemplateSimple:()=>yz,streamTemplate:()=>Iz,renderStreamingPage:()=>Ez,registerStreamingDirectives:()=>Cz,processStreamDirectives:()=>bz,processSectionDirectives:()=>vz,islandDirective:()=>vY,generateHydrationRuntime:()=>fz,extractStreamBoundaries:()=>Sz,createStreamRenderer:()=>Pz,buildSuspenseResolveScript:()=>K6,SUSPENSE_RESOLVER_RUNTIME:()=>PY});import i4 from"path";function Mz($){let Z=[],Y=0,X;yY.lastIndex=0;while((X=yY.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function Iz($,Z={},Y={}){let X={...h1,...Y,streaming:{...G6,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:i4.dirname($)};if(q.trim())await y1(q,U,$);let z=Mz(W),j=new Set;if(!z.some((B)=>B.type==="suspense")){let B=X.streaming?.strategy||"auto",H=new RegExp(l1.source,"g");if(!(B!=="manual"&&H.test(W))){let F=await w0(W,U,$,X,j);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(l1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=W.slice(w,A.start);if(R.trim()){let T=await w0(R,U,$,X,j);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await w0(A.content,U,$,X,j);J.enqueue(N),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<W.length){let A=W.slice(w);if(A.trim()){let N=await w0(A,U,$,X,j);J.enqueue(N)}}}}else{let B=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await w0(L.content,U,$,X,j);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
10325
+ </script>`}function QY($,Z,Y){if(JY=0,!mU($))return $;let X=CU($);if(X.length===0)return $;let Q=dU($,X),J=hU(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
10326
+ `+Q.slice(G);else Q+=J;return Q}function dU($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${u4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${u4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${u4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${u4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function mU($){return/x-data\s*=\s*["']/.test($)}var JY=0,PU=0;var GY=k(()=>{t0()});import uU from"fs";import r3 from"path";import{createHighlighter as lU}from"ts-syntax-highlighter";async function pU($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await uU.promises.stat($)).mtime.getTime();if(Z.cache&&a3.has($)){let z=a3.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=u9(Q),K=Z.markdown||i3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=v5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await cU(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)a3.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:q0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function cU($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!l4)try{l4=await lU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=W||(Y?"text":"");if(!j)return K;try{if(!l4.getSupportedLanguages().includes(j))return K;return(await l4.highlight(z,j,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,j=await Q(q,W,U,z);J=J.replace(q,j)}return J}async function KY($,Z,Y="",X={}){return await iU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!r3.isAbsolute(K))U=r3.resolve(r3.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),N=V.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),M=N.startsWith("'")&&N.endsWith("'");if(R||M)N=N.substring(1,N.length-1);z[A]=N}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:_}=await pU(U,X),B={...Z,..._,...z},H=j,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return B[V]!==void 0?String(B[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return q0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function iU($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((U)=>({match:K,replacement:U,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var a3,l4=null;var qY=k(()=>{_5();L0();a3=new Map});function F1($,Z){try{let Y=$.trim();if(X0(Y))return J0(Y,Object.keys(Z))(...Object.values(Z));else return e(Y,Z)}catch{return!1}}var WY=k(()=>{B0()});function nU($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=u7(X,G);if(!K)break;try{let q;if(X0(K.expression))q=J0(K.expression,Object.keys(Z))(...Object.values(Z));else q=e(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let j;if(z.value&&X0(z.value))j=J0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)j=e(z.value,Z);if(q===j){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=t("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function m1($,Z,Y){let X=$;X=nU(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=H1(X,K+7);if(!q)break;let W=q.endPos,U=P1(X,"unless","endunless",W);if(U===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=X.slice(W,U),j=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let B;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);B=`@if (${j})${L}@else ${H}@endif`}else B=`@if (!(${j}))${z}@endif`;X=X.substring(0,K)+B+X.substring(U+10),J=!0}}X=e3(X,Z,Y),X=$6(X,Z,Y),X=t3(X,Z);let Q=()=>{let J=a5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&X0(U.condition))z=J0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=e(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=t(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=t("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function UY($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function t3($,Z){let Y=$;function X(K,q,W,U){let z=1,j=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g");while(j<K.length&&z>0){_.lastIndex=j,B.lastIndex=j;let H=_.exec(K),L=B.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,j=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;j=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,B=[],H;while((H=z.exec(K))!==null)B.push({pos:H.index,type:"open"});while((H=j.exec(K))!==null)B.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)B.push({pos:H.index,type:"else"});B.sort((L,F)=>L.pos-F.pos);for(let L of B)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,j=Y.slice(W+5),_=UY(j);if(_)U=_.value,z=W+5+_.consumed;else z=W+5;let B=X(Y,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,B),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?F1(`auth?.check && auth?.user?.[${U}]`,Z):F1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,j=Y.slice(W+6),_=UY(j);if(_)U=_.value,z=W+6+_.consumed;else z=W+6;let B=X(Y,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,B),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?F1(`!auth?.check || !auth?.user?.[${U}]`,Z):F1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(B+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(W){let z=F1(W,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let j=z.index,_=Y.slice(j+`@${K}`.length),B=G(_);if(!B)break;let H=j+`@${K}`.length+B.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),R=/@else(?![a-z])/g,M=[],T;while((T=w.exec(F))!==null)M.push({pos:T.index,type:"open"});while((T=A.exec(F))!==null)M.push({pos:T.index,type:"close"});while((T=N.exec(F))!==null)M.push({pos:T.index,type:"elseDirective"});while((T=R.exec(F))!==null)M.push({pos:T.index,type:"else"});M.sort((b,v)=>b.pos-v.pos);for(let b of M){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],E=0;for(let b=0;b<O.length;b++){let v=O[b];if(I.push({content:F.slice(E,v.pos),ability:void 0}),v.type==="elseDirective"){let h=F.slice(v.pos+`@${W}`.length),f=G(h);if(f){I[I.length-1]={content:F.slice(E,v.pos)},E=v.pos+`@${W}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let m=O[b+1],r=m?m.pos:F.length;I.push({content:F.slice(E,r),ability:f.ability,type:f.type,id:f.id}),E=r}}else E=v.pos+5}if(E<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(E)})}let D=J(B.ability,B.type,B.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let b=!1;for(let v=1;v<I.length;v++){let h=I[v];if(h.isFinalElse){S=h.content,b=!0;break}if(h.ability){let f=J(h.ability,h.type,h.id);if(K==="can"?f:!f){S=h.content,b=!0;break}}}if(!b&&I.length>0){let v=I[I.length-1];if(v.isFinalElse)S=v.content}}Y=Y.substring(0,j)+S+Y.substring(L+`@${q}`.length),U=!0}}return Y}function e3($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),j=J.match(z);if(!j||j.index===void 0)break;let _=j.index,B=H1(J,_+`@${G}`.length);if(!B)break;let H=B.endPos,L=P1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=B.expression,V=-1,w=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let R=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=N;break}A=N+1}try{let N=q(O.trim()),R;if(V!==-1){let M=F.slice(0,V),T=F.slice(V+5);R=N?M:T}else R=N?F:"";J=J.substring(0,_)+R+J.substring(L+`@${K}`.length),U=!0}catch(N){let R=N instanceof Error?N.message:String(N),M=t(W,`Error processing @${G} directive: ${R}`,o.EVALUATION_ERROR);J=J.substring(0,_)+M+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=F1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=F1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function $6($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),B=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(B);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let D=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,W=Q===D[2]}let V=1,w=O,A=-1;while(V>0&&w<B.length){U.lastIndex=w,z.lastIndex=w;let D=U.exec(B),y=z.exec(B),S=D?D.index:1/0,b=y?y.index:1/0;if(S<b)V++,w=S+D[0].length;else if(b<1/0){if(V--,V===0){A=b;break}w=b+y[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(O,A),R=-1,M=0,T=0;while(T<N.length){let D=N.indexOf("@",T);if(D===-1)break;let y=N.substring(D);if(j.test(y)){M++,T=D+1;continue}if(_.test(y)){M--,T=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){R=D;break}T=D+1}let I;if(R!==-1){let D=N.slice(0,R),y=N.slice(R+5);I=W?D:y}else I=W?N:"";let E=`@${q}`.length;B=B.substring(0,F)+I+B.substring(A+E),H=!0}return B}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var p4=k(()=>{WY();Q1();u$();B0()});function jY($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function c4($,Z){if(!$)return Z?.nonceGenerator?.()??jY();let Y=zY.get($);if(!Y)Y=Z?.nonceGenerator?.()??jY(),zY.set($,Y);return Y}function oU($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function BY($,Z){return`<meta http-equiv="Content-Security-Policy" content="${oU($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function _Y($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?c4(Y,Z):void 0,Q=BY(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
10327
+ ${Q}`)}function HY($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<script nonce="${Z}"${Q}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<style nonce="${Z}"${Q}>`}),Y}function OY($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?c4(Z,J):void 0;return BY(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return c4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=c4(Z,J);return Q}var zY;var LY=k(()=>{zY=new WeakMap});import sU from"crypto";function aU($=rU){let Z=sU.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return Z6=Z,Z}function tU(){if(!Z6)aU();return Z6}function eU($=FY){let Z=tU();return`<input type="hidden" name="${$}" value="${Z}">`}function VY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return eU(X||FY)})}var rU=40,FY="_token",Z6=null;var wY=()=>{};async function AY($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await $z(Q,J,Z,Y,X);else Q=await Zz(Q,J,Z,Y,X)}return Q}async function $z($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=J5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],j=U.exec(W);while(j!==null){let[_,B="",H=""]=j,L=j.index||0;try{let F=B?RY(B):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:_,processed:t("CustomDirective",`Error in @${J}${B?`(${B})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:L})}j=U.exec(W)}for(let _=z.length-1;_>=0;_--){let{original:B,processed:H}=z[_];W=W.replace(B,H)}return W}async function Zz($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=J5(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[_,B=""]=U,H=U.index||0;try{let L=RY(B),F=await G("",L,Y,X);W.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:_,processed:t("CustomDirective",`Error in @${J}(${B}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=J5(`@${J}(?!\\w)(?!\\s*\\()`,"g"),j=z.exec(K);while(j!==null){let[_]=j,B=j.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:B})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:t("CustomDirective",`Error in @${J}: ${L}`,o.EVALUATION_ERROR),startIndex:B})}j=z.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:B,processed:H}=W[_];K=K.replace(B,H)}return K}function RY($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var NY=k(()=>{Q1();Q5()});function u1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function Xz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(u1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(u1(Y.key,"appearance.key"),u1(Y.attribute,"appearance.attribute"),u1(Y.default,"appearance.default"),u1(X.key,"colorMode.key"),u1(X.attribute,"colorMode.attribute"),u1(X.default,"colorMode.default"),!TY.test(Y.key)||!TY.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!MY.test(Y.attribute)||!MY.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((Q)=>typeof Q!=="string"||Q.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!Yz.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function Jz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Qz($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Jz($)};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 Gz($,Z){let Y=1,X=null,Q=!1;for(let J=Z+1;J<$.length;J++){let G=$[J];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return J}return-1}function IY($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index+Q[0].length-1,G=Gz(Y,J);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(J+1,G).trim(),q=e(`(${K})`,Z),W=Qz(Xz(q));Y=Y.slice(0,Q.index)+W+Y.slice(G+1),X.lastIndex=Q.index+W.length}return Y}var MY,TY,Yz;var DY=k(()=>{B0();MY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,TY=/^[A-Za-z_$][\w$]*$/,Yz=new Set(["light","dark","system"])});import Kz from"crypto";function w0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function i4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function qz(){return Kz.randomUUID()}function n4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=qz();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${w0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${w0(J)}">`;return X}),Y}function bY($,Z,Y=kY){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",j=V1(W),_=U.toUpperCase(),B=["GET","POST"].includes(_)?_:"POST",H=`<form method="${w0(B)}" action="${w0(z)}"${j?` ${j}`:""}>`;if(H+=`
10328
+ ${n4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
10329
+ ${n4(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",j=V1(W),_=G$(U,Z),B=_!==void 0&&_!==null?_:z||"",H=j.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=K$(U,Z),O=j.match(/class=['"]([^'"]+)['"]/i),V=i4(O?O[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${w0(L)}" name="${w0(U)}" value="${w0(B)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=V1(G),W=G$(J,Z)||K.trim(),U=K$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),j=i4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${w0(J)}" class="${j}"${_?` ${_}`:""}>${w0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=V1(G),W=G$(J,Z),U=K$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),j=i4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(W!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${w0(J)}" class="${j}"${_?` ${_}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=V1(K),W=G$(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((B)=>String(B)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${w0(J)}" value="${w0(G)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=V1(K),W=G$(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${w0(J)}" value="${w0(G)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=V1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=K$(J,Z),j=K.match(/class=['"]([^'"]+)['"]/i),_=i4(j?j[1]:"",Y.input,z,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${w0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${w0(W)}"`);if(U)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=V1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${w0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function SY($,Z,Y=kY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(K$(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return EY(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return EY(Q,Z)}let q=K.trim();if(X0(q)){let W=e(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function K$($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function EY($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function G$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function V1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var kY;var yY=k(()=>{B0();kY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import J6 from"path";async function Wz(){if(q$!==void 0)return q$;try{q$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{q$=null}return q$}function Uz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function zz($,Z){if({...K6,...Z.i18n}.cache&&Q6[$]){let Q=Q6[$],J=Z.i18n?.cacheMaxAge??0;if(!Uz(Q,J))return Q.translations}if(W$[$]?.state==="loading")return W$[$].promise;Y6[$]="loading";let X=G6($,Z).then((Q)=>{return Y6[$]="loaded",delete W$[$],Q}).catch((Q)=>{throw Y6[$]="error",W$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return W$[$]={promise:X,state:"loading"},X}async function G6($,Z){let Y={...K6,...Z.i18n},X=J6.isAbsolute(Y.translationsDir)?Y.translationsDir:J6.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await Wz(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:Oz(Y.format)}):await jz($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return G6(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)Q6[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return G6(Y.defaultLocale,Z);return{}}}async function jz($,Z,Y){let X=J6.join(Y,`${$}${Bz(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return _z(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function Bz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function _z($){let Z={},Y=$.split(`
10330
+ `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),j=U.trim();if(j==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=Hz(j)}}return Z}function Hz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function Oz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Lz($,Z){return zz($,Z)}function Fz($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function Vz($,Z={}){return vY($,Z)}function vY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=wz($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=Az(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function wz($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function Az($,Z){let Y=Rz($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return Nz(Q,Y.slice(2).join(","),Z);case"select":return Tz(Q,Y.slice(2).join(","));case"selectordinal":return Iz(Q,Y.slice(2).join(","));case"number":return Ez(Q,Y[2]?.trim());case"date":return kz(Q,Y[2]?.trim());case"time":return bz(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function Rz($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function Nz($,Z,Y){let X=Number($)||0,Q=q6(Z),J=`=${X}`;if(Q[J])return X6(Q[J],X,Y);let G=Mz(X);if(Q[G])return X6(Q[G],X,Y);if(Q.other)return X6(Q.other,X,Y);return String(X)}function X6($,Z,Y){let X=$.replace(/#/g,String(Z));return vY(X,Y)}function Mz($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function Tz($,Z){let Y=String($||""),X=q6(Z);if(X[Y])return X[Y];return X.other||String($)}function Iz($,Z){let Y=Number($)||0,X=q6(Z),Q=Dz(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function Dz($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function q6($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function Ez($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function kz($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function bz($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function Sz($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function PY($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(Sz(G))return Vz(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=Fz(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function xY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...K6,...X.i18n},K=await Lz(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await CY(Q,J,async(U,z,j,_,B)=>{try{let H={};if(j)try{let F=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return F0(j,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return PY(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return t("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,j)=>console.warn(`Match ${j}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await CY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,j,_)=>{try{let B={};if(j)try{let H=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return F0(j,Z)}];for(let L of H)try{if(B=L(),Object.keys(B).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return PY(z,K,G.fallbackToKey,B)}catch(B){if(X.debug)console.error("Error processing @translate directive:",B);return t("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),Q}async function CY($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var q$,K6,Q6,W$,Y6;var fY=k(()=>{Q1();B0();K6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},Q6={},W$={},Y6={}});var z6={};s(z6,{streamingSuspenseDirective:()=>dY,streamToResponse:()=>lz,streamTemplateSimple:()=>hz,streamTemplate:()=>Pz,renderStreamingPage:()=>vz,registerStreamingDirectives:()=>mz,processStreamDirectives:()=>fz,processSectionDirectives:()=>uz,islandDirective:()=>mY,generateHydrationRuntime:()=>pz,extractStreamBoundaries:()=>gz,createStreamRenderer:()=>dz,buildSuspenseResolveScript:()=>U6,SUSPENSE_RESOLVER_RUNTIME:()=>hY});import o4 from"path";function yz($){let Z=[],Y=0,X;gY.lastIndex=0;while((X=gY.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function Pz($,Z={},Y={}){let X={...h1,...Y,streaming:{...W6,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:o4.dirname($)};if(q.trim())await y1(q,U,$);let z=yz(W),j=new Set;if(!z.some((B)=>B.type==="suspense")){let B=X.streaming?.strategy||"auto",H=new RegExp(l1.source,"g");if(!(B!=="manual"&&H.test(W))){let F=await V0(W,U,$,X,j);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(l1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=W.slice(w,A.start);if(R.trim()){let M=await V0(R,U,$,X,j);J.enqueue(M),await new Promise((T)=>setTimeout(T,0))}}let N=await V0(A.content,U,$,X,j);J.enqueue(N),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<W.length){let A=W.slice(w);if(A.trim()){let N=await V0(A,U,$,X,j);J.enqueue(N)}}}}else{let B=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await V0(L.content,U,$,X,j);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
10324
10331
  <template data-suspense-fallback>Loading...</template>
10325
- </div>`),B.set(L.name,w0(L.content,U,$,X,j))}J.enqueue(`
10332
+ </div>`),B.set(L.name,V0(L.content,U,$,X,j))}J.enqueue(`
10326
10333
  <script>
10327
10334
  (function() {
10328
10335
  window.__stxSuspense = window.__stxSuspense || {
@@ -10338,13 +10345,13 @@ ${Q}`)}function WY($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*
10338
10345
  }
10339
10346
  };
10340
10347
  })();
10341
- </script>`);let H=Array.from(B.entries()).map(async([L,F])=>{J.enqueue(await K6(L,F))});await Promise.all(H)}J.close()}catch(G){J.error(G)}}})}async function K6($,Z){try{let X=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
10348
+ </script>`);let H=Array.from(B.entries()).map(async([L,F])=>{J.enqueue(await U6(L,F))});await Promise.all(H)}J.close()}catch(G){J.error(G)}}})}async function U6($,Z){try{let X=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
10342
10349
  <script>
10343
10350
  window.__stxSuspense.resolve('${$}', \`${X}\`);
10344
10351
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
10345
10352
  <script>
10346
10353
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${o0(X)}</div>');
10347
- </script>`}}function Dz($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function Ez($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(PY),await Promise.all(Z.map(async(J)=>{let G=Dz(J.render(),X,J.id);Q.enqueue(await K6(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function bz($,Z){return $.replace(kz,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function Sz($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function yz($,Z={},Y={}){let X={...h1,...Y,streaming:{...G6,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:i4.dirname($)};if(q.trim())await y1(q,U,$);let z=new Set,j=X.streaming?.strategy||"auto",_=new RegExp(l1.source,"g");if(!(j!=="manual"&&_.test(W))){let H=await w0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(l1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let N=await w0(A,U,$,X,z);J.enqueue(N)}}let w=await w0(V.content,U,$,X,z);J.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await w0(V,U,$,X,z);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function Pz($,Z={}){let Y={...h1,...Z,streaming:{...G6,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;l1.lastIndex=0;while((W=l1.exec(G))!==null){let j=W[1],_=W[2];q[j]=_}let U=G.replace(l1,"");return{renderShell:async(j={})=>{let _={...j,__filename:$,__dirname:i4.dirname($)};return await y1(J,_,$),w0(U,_,$,Y,new Set)},renderSection:async(j,_={})=>{try{if(!q[j])return`<div class="error-message">Section "${o0(j)}" not found in template "${o0($)}"</div>`;let B={..._,__filename:$,__dirname:i4.dirname($)};await y1(J,B,$);let H=new Set;return await w0(q[j],B,$,Y,H)}catch(B){let H=B instanceof Error?B.message:String(B);return q0("Expression",H,$,q[j]||"",0,q[j]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function Cz($={}){let Z=[];if($.streaming?.enabled)Z.push(CY);if($.hydration?.enabled)Z.push(vY);return Z}async function vz($,Z,Y,X={}){return $}function xz($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function fz($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
10354
+ </script>`}}function Cz($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function vz($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(hY),await Promise.all(Z.map(async(J)=>{let G=Cz(J.render(),X,J.id);Q.enqueue(await U6(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function fz($,Z){return $.replace(xz,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function gz($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function hz($,Z={},Y={}){let X={...h1,...Y,streaming:{...W6,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:o4.dirname($)};if(q.trim())await y1(q,U,$);let z=new Set,j=X.streaming?.strategy||"auto",_=new RegExp(l1.source,"g");if(!(j!=="manual"&&_.test(W))){let H=await V0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(l1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let N=await V0(A,U,$,X,z);J.enqueue(N)}}let w=await V0(V.content,U,$,X,z);J.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await V0(V,U,$,X,z);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function dz($,Z={}){let Y={...h1,...Z,streaming:{...W6,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;l1.lastIndex=0;while((W=l1.exec(G))!==null){let j=W[1],_=W[2];q[j]=_}let U=G.replace(l1,"");return{renderShell:async(j={})=>{let _={...j,__filename:$,__dirname:o4.dirname($)};return await y1(J,_,$),V0(U,_,$,Y,new Set)},renderSection:async(j,_={})=>{try{if(!q[j])return`<div class="error-message">Section "${o0(j)}" not found in template "${o0($)}"</div>`;let B={..._,__filename:$,__dirname:o4.dirname($)};await y1(J,B,$);let H=new Set;return await V0(q[j],B,$,Y,H)}catch(B){let H=B instanceof Error?B.message:String(B);return q0("Expression",H,$,q[j]||"",0,q[j]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function mz($={}){let Z=[];if($.streaming?.enabled)Z.push(dY);if($.hydration?.enabled)Z.push(mY);return Z}async function uz($,Z,Y,X={}){return $}function lz($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function pz($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
10348
10355
  `);if(Z==="loader")return`
10349
10356
  (function() {
10350
10357
  window.__stx = window.__stx || {};
@@ -10486,7 +10493,7 @@ else {
10486
10493
  else {
10487
10494
  stx.hydrate();
10488
10495
  }
10489
- })();`}var G6,l1,yY,PY=`
10496
+ })();`}var W6,l1,gY,hY=`
10490
10497
  <script>
10491
10498
  (function(){
10492
10499
  window.__stxSuspense = window.__stxSuspense || {
@@ -10506,25 +10513,25 @@ else {
10506
10513
  }
10507
10514
  };
10508
10515
  })();
10509
- </script>`,kz,CY,vY;var W6=k(()=>{B5();t0();Q4();F0();G6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},l1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,yY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;kz=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;CY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},vY={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
10516
+ </script>`,xz,dY,mY;var j6=k(()=>{_5();t0();K4();L0();W6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},l1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,gY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;xz=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;dY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},mY={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
10510
10517
  ${W}
10511
10518
  <script type="application/json" data-island-props="${G}">
10512
10519
  ${q?`{${q}}`:"{}"}
10513
10520
  </script>
10514
- </div>`}}});var gY={};s(gY,{warnUnbalancedTags:()=>U6,findUnbalancedTags:()=>fY});function H5($){return $.replace(/[^\n]/g," ")}function fY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,H5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,H5).replace(/<!--[\s\S]*?-->/g,H5).replace(/\{\{\{[\s\S]*?\}\}\}/g,H5).replace(/\{\{[\s\S]*?\}\}/g,H5).replace(/\{!![\s\S]*?!!\}/g,H5),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(gz.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
10515
- `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(hz.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function U6($,Z){let Y;try{Y=fY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(xY.has(X))return;xY.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var gz,hz,xY;var z6=k(()=>{gz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),hz=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);xY=new Set});import p0 from"path";import j6 from"fs";function hY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function dY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class mY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let _=[Q,Q.toLowerCase(),hY(Q),dY(Q)];for(let B of _)if(J.has(B))return J.get(B)}let G=[...new Set([`${Q}.stx`,`${hY(Q)}.stx`,`${dY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=p0.resolve(p0.dirname(Z),`${Q}.stx`);if(await c(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(p0.join(p0.dirname(W),"components"));if(q)K.push(q);let U=p0.join(p0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),j=[p0.resolve(z,"src/components"),p0.resolve(z,"components"),p0.resolve(import.meta.dir,"components")];for(let _ of j)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let B of G){let H=p0.join(_,B);if(await c(H))return H}try{if(!j6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=j6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=p0.join(_,L.name);for(let O of G){let V=p0.join(F,O);if(await c(V))return V}}}catch{}}return null}}var C0;var B6=k(()=>{F0();C0=new mY});function k0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function O5($,Z){let Y=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let J=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)Y.push(k0(J));continue}Y.push(`${k0(J)}="${k0(Q)}"`)}return Y}var n4=()=>{};function W$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function dz($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var _6;var H6=k(()=>{n4();_6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=dz($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${W$(X.value)}"`);else q.push(`href="${W$(X.value)}"`);if(Q)q.push(`class="${W$(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${W$(J)}"`),q.push(`data-stx-exact-active-class="${W$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...O5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function N0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function L6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function uY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=mz[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function F6($,Z,Y,X){return Z.map((Q)=>`${U$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function uz($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${U$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function U$($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function lz($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var mz,O6,V6;var w6=k(()=>{n4();mz={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},O6=[320,640,768,1024,1280,1536,1920];V6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=b0($,"src")||"",Q=b0($,"alt")||"",J=b0($,"width"),G=b0($,"height"),K=b0($,"sizes"),q=b0($,"srcset"),W=b0($,"densities"),U=b0($,"format"),z=b0($,"placeholder"),j=b0($,"placeholderColor")||"#e5e7eb",_=b0($,"provider"),B=b0($,"class")||b0($,"className")||"",H=b0($,"style")||"",L=b0($,"quality"),F=L6($,"lazy",!0),O=L6($,"preload",!1),V=L6($,"picture",!1)||!!U,w=J?Number.parseInt(J):void 0,A=G?Number.parseInt(G):void 0,N=q||"",R="";if(!N&&K)N=F6(X,O6,_,U),R=uY(K);else if(!N&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));N=uz(X,S,w,_,U)}else if(K)R=uY(K);let T=[];if(H)T.push(H);if(w&&A)T.push(`aspect-ratio:${w}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=lz(w||16,A||9,j);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${N0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=U$(X,w,A,_,U),I=[];if(I.push(`src="${N0(M)}"`),I.push(`alt="${N0(Q)}"`),J)I.push(`width="${N0(J)}"`);if(G)I.push(`height="${N0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${N0(B)}"`);if(T.length>0)I.push(`style="${N0(T.join(";"))}"`);if(N)I.push(`srcset="${N0(N)}"`);if(R)I.push(`sizes="${N0(R)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...O5($,E));let D=`<img ${I.join(" ")} />`,y="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${N0(M)}"${b?` type="${b}"`:""}${N?` imagesrcset="${N0(N)}"`:""}${R?` imagesizes="${N0(R)}"`:""} />
10516
- `}if(V){let S=[];if(U==="avif"||U==="auto"){let b=U$(X,w,A,_,"avif"),v=N?F6(X,O6,_,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${N0(v)}"${R?` sizes="${N0(R)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=U$(X,w,A,_,"webp"),v=N?F6(X,O6,_,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${N0(v)}"${R?` sizes="${N0(R)}"`:""} />`)}return`${y}<picture>
10521
+ </div>`}}});var pY={};s(pY,{warnUnbalancedTags:()=>B6,findUnbalancedTags:()=>lY});function O5($){return $.replace(/[^\n]/g," ")}function lY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,O5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,O5).replace(/<!--[\s\S]*?-->/g,O5).replace(/\{\{\{[\s\S]*?\}\}\}/g,O5).replace(/\{\{[\s\S]*?\}\}/g,O5).replace(/\{!![\s\S]*?!!\}/g,O5),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(cz.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
10522
+ `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(iz.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function B6($,Z){let Y;try{Y=lY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(uY.has(X))return;uY.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var cz,iz,uY;var _6=k(()=>{cz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),iz=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);uY=new Set});import p0 from"path";import H6 from"fs";function cY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function iY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class nY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let _=[Q,Q.toLowerCase(),cY(Q),iY(Q)];for(let B of _)if(J.has(B))return J.get(B)}let G=[...new Set([`${Q}.stx`,`${cY(Q)}.stx`,`${iY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=p0.resolve(p0.dirname(Z),`${Q}.stx`);if(await c(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(p0.join(p0.dirname(W),"components"));if(q)K.push(q);let U=p0.join(p0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),j=[p0.resolve(z,"src/components"),p0.resolve(z,"components"),p0.resolve(import.meta.dir,"components")];for(let _ of j)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let B of G){let H=p0.join(_,B);if(await c(H))return H}try{if(!H6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=H6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=p0.join(_,L.name);for(let O of G){let V=p0.join(F,O);if(await c(V))return V}}}catch{}}return null}}var C0;var O6=k(()=>{L0();C0=new nY});function k0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function L5($,Z){let Y=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let J=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)Y.push(k0(J));continue}Y.push(`${k0(J)}="${k0(Q)}"`)}return Y}var s4=()=>{};function U$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nz($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var L6;var F6=k(()=>{s4();L6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=nz($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${U$(X.value)}"`);else q.push(`href="${U$(X.value)}"`);if(Q)q.push(`class="${U$(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${U$(J)}"`),q.push(`data-stx-exact-active-class="${U$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...L5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function N0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function w6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function oY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=oz[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function A6($,Z,Y,X){return Z.map((Q)=>`${z$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function sz($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${z$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function z$($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function rz($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var oz,V6,R6;var N6=k(()=>{s4();oz={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},V6=[320,640,768,1024,1280,1536,1920];R6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=b0($,"src")||"",Q=b0($,"alt")||"",J=b0($,"width"),G=b0($,"height"),K=b0($,"sizes"),q=b0($,"srcset"),W=b0($,"densities"),U=b0($,"format"),z=b0($,"placeholder"),j=b0($,"placeholderColor")||"#e5e7eb",_=b0($,"provider"),B=b0($,"class")||b0($,"className")||"",H=b0($,"style")||"",L=b0($,"quality"),F=w6($,"lazy",!0),O=w6($,"preload",!1),V=w6($,"picture",!1)||!!U,w=J?Number.parseInt(J):void 0,A=G?Number.parseInt(G):void 0,N=q||"",R="";if(!N&&K)N=A6(X,V6,_,U),R=oY(K);else if(!N&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));N=sz(X,S,w,_,U)}else if(K)R=oY(K);let M=[];if(H)M.push(H);if(w&&A)M.push(`aspect-ratio:${w}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=rz(w||16,A||9,j);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")M.push(`background-image:url(${N0(z)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=z$(X,w,A,_,U),I=[];if(I.push(`src="${N0(T)}"`),I.push(`alt="${N0(Q)}"`),J)I.push(`width="${N0(J)}"`);if(G)I.push(`height="${N0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${N0(B)}"`);if(M.length>0)I.push(`style="${N0(M.join(";"))}"`);if(N)I.push(`srcset="${N0(N)}"`);if(R)I.push(`sizes="${N0(R)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...L5($,E));let D=`<img ${I.join(" ")} />`,y="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${N0(T)}"${b?` type="${b}"`:""}${N?` imagesrcset="${N0(N)}"`:""}${R?` imagesizes="${N0(R)}"`:""} />
10523
+ `}if(V){let S=[];if(U==="avif"||U==="auto"){let b=z$(X,w,A,_,"avif"),v=N?A6(X,V6,_,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${N0(v)}"${R?` sizes="${N0(R)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=z$(X,w,A,_,"webp"),v=N?A6(X,V6,_,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${N0(v)}"${R?` sizes="${N0(R)}"`:""} />`)}return`${y}<picture>
10517
10524
  ${S.join(`
10518
10525
  `)}
10519
10526
  ${D}
10520
- </picture>`}return`${y}${D}`}}});function z$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function L5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var lY="/images/safe-image-default.svg",pz,A6;var R6=k(()=>{n4();pz=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${lY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,A6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=L5($,"src")||"",Q=L5($,"alt")||"",J=L5($,"fallback")||lY,G=L5($,"class")||L5($,"className")||"",K=L5($,"fallbackClassName")||"",q=[];if(q.push(`src="${z$(X)}"`),q.push(`alt="${z$(Q)}"`),G)q.push(`class="${z$(G)}"`);if(q.push(`data-fallback="${z$(J)}"`),K)q.push(`data-fallback-class="${z$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...O5($,W));let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${pz}${U}`;return U}}});function N6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function j$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function o4($,Z,Y){let X=j$($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var T6;var M6=k(()=>{T6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=N6(j$($,"color")||"#6366f1"),Q=N6(j$($,"initialColor")||j$($,"initial-color")||""),J=N6(j$($,"height")||"3px"),G=o4($,"duration",2000),K=o4($,"throttle",200),q=o4($,"zIndex",999999)||o4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
10527
+ </picture>`}return`${y}${D}`}}});function j$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function F5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var sY="/images/safe-image-default.svg",az,M6;var T6=k(()=>{s4();az=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${sY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,M6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=F5($,"src")||"",Q=F5($,"alt")||"",J=F5($,"fallback")||sY,G=F5($,"class")||F5($,"className")||"",K=F5($,"fallbackClassName")||"",q=[];if(q.push(`src="${j$(X)}"`),q.push(`alt="${j$(Q)}"`),G)q.push(`class="${j$(G)}"`);if(q.push(`data-fallback="${j$(J)}"`),K)q.push(`data-fallback-class="${j$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...L5($,W));let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${az}${U}`;return U}}});function I6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function B$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function r4($,Z,Y){let X=B$($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var D6;var E6=k(()=>{D6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=I6(B$($,"color")||"#6366f1"),Q=I6(B$($,"initialColor")||B$($,"initial-color")||""),J=I6(B$($,"height")||"3px"),G=r4($,"duration",2000),K=r4($,"throttle",200),q=r4($,"zIndex",999999)||r4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
10521
10528
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${J};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
10522
10529
  <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>
10523
10530
  </div>
10524
10531
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
10525
10532
  <script>
10526
10533
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${K})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
10527
- </script>`}}});function cY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function cz($,Z,Y){let X=cY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var pY,I6;var D6=k(()=>{pY={"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%)"},I6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=k0(cY($,"position")||"top-right"),Q=cz($,"max",5),J=pY[X]||pY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
10534
+ </script>`}}});function aY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function tz($,Z,Y){let X=aY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var rY,k6;var b6=k(()=>{rY={"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%)"},k6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=k0(aY($,"position")||"top-right"),Q=tz($,"max",5),J=rY[X]||rY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
10528
10535
  <style>
10529
10536
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
10530
10537
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -10532,7 +10539,7 @@ ${D}
10532
10539
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
10533
10540
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
10534
10541
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
10535
- </style>`}}});function s4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var iY,E6;var k6=k(()=>{iY={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},E6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=s4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=k0(X),J=s4($,"size")||"md",G=s4($,"closeOnBackdrop")!=="false",K=s4($,"closeOnEscape")!=="false",q=iY[J]||iY.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
10542
+ </style>`}}});function a4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var tY,S6;var y6=k(()=>{tY={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)"},S6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=a4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=k0(X),J=a4($,"size")||"md",G=a4($,"closeOnBackdrop")!=="false",K=a4($,"closeOnEscape")!=="false",q=tY[J]||tY.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
10536
10543
  <div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
10537
10544
  <div style="padding:1.5rem">${Z}</div>
10538
10545
  </div>
@@ -10541,7 +10548,7 @@ ${D}
10541
10548
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
10542
10549
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
10543
10550
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
10544
- </style>`}}});function F5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var nY,b6;var S6=k(()=>{nY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},b6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=F5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=k0(X),J=F5($,"side")||"right",G=F5($,"size")||"md",K=F5($,"closeOnBackdrop")!=="false",q=F5($,"closeOnEscape")!=="false",W=F5($,"overlay")!=="false",U=nY[G]||nY.md,z=J==="left",j=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",B=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
10551
+ </style>`}}});function V5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var eY,P6;var C6=k(()=>{eY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},P6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=V5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=k0(X),J=V5($,"side")||"right",G=V5($,"size")||"md",K=V5($,"closeOnBackdrop")!=="false",q=V5($,"closeOnEscape")!=="false",W=V5($,"overlay")!=="false",U=eY[G]||eY.md,z=J==="left",j=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",B=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
10545
10552
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${j};width:${U};max-width:100vw;transform:${_};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
10546
10553
  <div style="padding:1.5rem">${Z}</div>
10547
10554
  </div>
@@ -10550,18 +10557,18 @@ ${D}
10550
10557
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
10551
10558
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
10552
10559
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
10553
- </style>`}}});import{existsSync as iz,readFileSync as nz}from"fs";function oz($){if(oY.has($))return;oY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function sz($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(iz(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return K0.resolve(Y)}catch{}return null}function rz($){if(r4.has($))return r4.get($);let Z=sz($);if(!Z)return oz($),null;try{let Y=JSON.parse(nz(Z,"utf8"));return r4.set($,Y.icons),Y.icons}catch{return null}}function V5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var r4,oY,y6;var P6=k(()=>{r4=new Map,oY=new Set;y6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=V5($,"name")??V5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=k0(V5($,"size")||"24"),K=k0(V5($,"color")||"currentColor"),q=k0(V5($,"class")||""),W=k0(V5($,"style")||""),U=r4.get(Q)??rz(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let j=z.width||24,_=z.height||24,B=`0 0 ${j} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${L}${F}>${H}</svg>`}}});function sY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function rY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var C6;var v6=k(()=>{C6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=rY(Z,"fallback"),Q=X.rest,J=rY(Q,"error"),G=J.rest,K=X.region??sY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??sY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function a4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var x6;var f6=k(()=>{x6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(a4($,"name")||"v").replace(/["'<>]/g,""),Q=(a4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=a4($,"class"),G=a4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function aY(){C0.registerBuiltin(_6),C0.registerBuiltin(V6),C0.registerBuiltin(A6),C0.registerBuiltin(T6),C0.registerBuiltin(I6),C0.registerBuiltin(E6),C0.registerBuiltin(b6),C0.registerBuiltin(y6),C0.registerBuiltin(C6),C0.registerBuiltin(x6)}var tY=k(()=>{H6();w6();R6();M6();D6();k6();S6();P6();v6();f6();B6();H6();w6();R6();M6();D6();k6();S6();P6();v6();f6()});function t4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function eY($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,j=-1,_=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,_=!0;break}if(H===">"){j=W+1;break}W++}if(j===-1){Q=J+1;continue}let B=$.slice(z,_?j-2:j-1).trim();if(_)X.push({fullMatch:$.slice(J,j),tagName:q,attributes:B,content:"",startIndex:J,endIndex:j,isSelfClosing:!0}),Q=j;else{let H=`<${q}`,L=`</${q}>`,F=1,O=j,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(N!==-1&&N<R){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
10554
- `||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){Q=j;continue}let w=$.slice(j,V),A=V+L.length;X.push({fullMatch:$.slice(J,A),tagName:q,attributes:B,content:w,startIndex:J,endIndex:A,isSelfClosing:!1}),Q=A}}return X}function $X($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var ZX=k(()=>{B0();F0();k1()});var qX={};s(qX,{processESImports:()=>GX,processComponents:()=>$7});import e4 from"fs";import h0 from"path";function tz($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=J(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!Q.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let U=J(W.slice(6));X.serverDynamic[U]=$X(q,Y);continue}if(W.startsWith(":")){let U=J(W.slice(1)),z=q===g6?U:q;if(U==="if"||U==="for"||U==="show"){X.clientReactive[U]=z;continue}try{if(!X0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);X.clientReactive[U]=z;continue}let j=Object.keys(Z),B=J0(z,j)(...Object.values(Z));if(B===void 0){let H=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!j.includes(O))){X.clientReactive[U]=z;continue}}X.serverDynamic[U]=B}catch{X.clientReactive[U]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let U=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(X0(z)){let _=J0(z,Object.keys(Z))(...Object.values(Z));G(W,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${z}`);G(W,q)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,z);G(W,q)}else{let z=q,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(q))!==null)try{let B=_[1];if(!X0(B)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);continue}let L=J0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(_[0],String(L??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,B)}G(W,z)}continue}G(W,q===g6?"true":q)}return X}function ez($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]=g6}return Z}function XX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $j($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(C0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function Zj($){let Z=JX.get($);if(Z)return Z;let Y=new Map,X=[h0.join($,"src"),h0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=e4.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=h0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return JX.set($,Y),Y}function Yj($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=h0.join(Y,"node_modules",$);try{if(e4.statSync(X).isDirectory())return X}catch{}let Q=h0.dirname(Y);if(Q===Y)return null;Y=Q}}async function GX($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=h0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,B,H=[];while((B=j.exec(z))!==null){let[L,F,O,V]=B,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=h0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(e4.statSync(M).isFile())A=M}catch{try{if(e4.statSync(T).isDirectory())w=T}catch{}}}}else w=Yj(V,G);if(!w&&!A)continue;let N=!1,R=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&A)R(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),M=w?Zj(w):null;for(let{source:I,local:E}of T){let D=null;if(A)D=A;else if(M)D=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)R(E,D),N=!0}}if(N)H.push({start:B.index,end:B.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${U}>${_}</script>`}),K}async function Xj($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of z){let _=j.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[h0.resolve(h0.dirname(Y),`${j}.stx`),h0.resolve(h0.dirname(Y),j),h0.resolve(X.componentsDir||"components",`${j}.stx`),h0.resolve(X.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${j}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function Jj($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,j=1,_=z+1;while(_<J.length&&j>0){if(J[_]==="(")j++;else if(J[_]===")"){if(j--,j===0)break}_++}if(j!==0)break;let B=J.substring(z+1,_),H=_+1,L=B.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=B.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=V0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(U,H),`[Error parsing component props: ${D}]`);continue}let N="",R=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await v1(F,A,N,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(R),q.lastIndex=0}return J}async function Qj($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=z1(J);return J=q.output,J=await j(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await j(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await j(J,/[a-z][a-z0-9]*/,!1,az),J=u5(J,q.scripts),J;async function j(_,B,H,L){if(!_)return _;let F=_,O=eY(F,B,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?t4(w.tagName):w.tagName,N=ez(w.attributes),R=tz(N,Z,X),T=C0.getBuiltin(w.tagName),M=T?await J4(A,G,Z,Y,X):!1;if(T&&!M){let y={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(R,w.content,y);if(Object.keys(R.clientReactive).length>0)S=QX(S,R.clientReactive);if(Object.keys(R.events).length>0){let b=Object.entries(R.events).map(([v,h])=>`${v}="${XX(h)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,w.startIndex)+S+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await J4(A,G,Z,Y,X))continue;let I={};for(let[y,S]of Object.entries(R.static))I[y]=S;for(let[y,S]of Object.entries(R.serverDynamic))I[y]=S;let D=await v1(A,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(R.clientReactive).length>0)D=QX(D,R.clientReactive);if(Object.keys(R.events).length>0){let y=KX(D);if(y){let S=Object.entries(R.events).map(([v,h])=>`${v}="${XX(h)}"`).join(" "),b=Object.keys(R.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${S}`+D.substring(y.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function QX($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),Q=Object.entries(Z).filter(([U])=>!Y.has(U)),J=Q.filter(([U])=>!X.has(U)).map(([U])=>t4(U)).join(" "),G=$,K=Q.length>0?KX(G):null;if(K){let U=Q.map(([j,_])=>`:${t4(j)}="${_.replace(/"/g,"&quot;")}"`).join(" "),z=J?` data-stx-parent-bindings="${J}"`:"";G=G.substring(0,K.insertPos)+`${z} ${U}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function KX($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),Q=X.match(/^\s+/);if(Q){Y+=Q[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let K=`</${J[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+J[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function $7($,Z,Y,X,Q){if(!YX)aY(),YX=!0;let J=await GX($,Z,Y,X,Q);J=await Xj(J,Z,Y,X,Q),J=await Jj(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=a0(J,m5,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...q.tokens);let W=J;if(J=await Qj(q.output,Z,Y,X,Q),J===W)break}if(G.length>0)J=J.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=$j(J);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return J}var YX=!1,g6="\x00stx-boolean-attribute",az,JX;var h6=k(()=>{B6();tY();ZX();k1();F0();B0();az=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);JX=new Map});var HX={};s(HX,{processLoops:()=>d6});function qj($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,j=U.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let _=j[1],B=U.slice(j[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let L=B.slice(H[0].length).trim();if(!L)continue;try{let F=V0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function Z7($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let B=X[W];if(z){z=!1,W++;continue}if(B==="\\"&&U){z=!0,W++;continue}if(U){if(B===U)U=null;W++;continue}if(B==='"'||B==="'"||B==="`"){U=B,W++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}W++}if(q!==0)break;let j=X.substring(K+1,W),_=Y(j);X=X.substring(0,G)+_+X.substring(W+1)}return X}function Wj($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);k$(J);let W=J0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function Uj($,Z){let Y=$;return Y=Z7(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(e(J,Z));return G?Y7:""}catch{return""}}),Y=Z7(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(e(J,Z));return G?X7:""}catch{return""}}),Y}function zj($){let Z=$;return Z=Z.replace(/@break(?!\()/g,Y7),Z=Z.replace(/@continue(?!\()/g,X7),Z}function WX($){let Z=$.includes(Y7),Y=Z?$.substring(0,$.indexOf(Y7)):$;return{hasBreak:Z,content:Y}}function UX($){let Z=$.includes(X7),Y=Z?$.substring(0,$.indexOf(X7)):$;return{hasContinue:Z,content:Y}}function jX($){let Z=$;return Z=Z7(Z,"@break",(Y)=>{let X=Y.trim();if(!b$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=Z7(Z,"@continue",(Y)=>{let X=Y.trim();if(!b$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function jj($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,j=K.length-1,_=0;while(z<=j){let B=z+j>>1;if(K[B].pos<=U)_=K[B].depth,z=B+1;else j=B-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,j=1,_=z+1,B=-1;while(_<$.length&&j>0){if($[_]==="(")j++;else if($[_]===")"){if(j--,j===0){B=_;break}}_++}if(B===-1)continue;let H=$.substring(z+1,B),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=B+1,w=1,A=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let S=N.exec($),b=R.exec($);if(!b)break;if(S&&S.index<b.index)w++,A=S.index+S[0].length;else{if(w--,w===0){T=b.index;break}A=b.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,E=-1,D=0,y=0;while(y<M.length){let S=M.indexOf("@",y);if(S===-1)break;let b=M.substring(S);if(/^@forelse\s*\(/.test(b))D++,y=S+1;else if(b.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&b.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function zX($,Z){let Y=$;while(!0){let X=jj(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(X0(G))U=J0(G,Object.keys(Z))(...Object.values(Z));else U=e(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),j=t("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+j+Y.substring(J)}}return Y}function d6($,Z,Y,X){let Q=$;Q=zX(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,j=U.index+U[0].length-1,_=1,B=j+1,H=-1;while(B<q.length&&_>0){if(q[B]==="(")_++;else if(q[B]===")"){if(_--,_===0){H=B;break}}B++}if(H===-1)continue;let L=q.substring(j+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),w=L.substring(F+4),A=H+1,N=1,R=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,M.lastIndex=R;let I=T.exec(q),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let D=q.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:V,itemVar:w,content:D}}R=E.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:j,end:_,arrayExpr:B,itemVar:H,content:L}=z;try{let F=B.trim(),O;if(X0(F))O=J0(F,Object.keys(W))(...Object.values(W));else O=e(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let E=t("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);U=U.substring(0,j)+E+U.substring(_);continue}let w=X?.loops?.useAltLoopVariable??Kj,A=H.trim(),N=null,R,T=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1],T=!0;else R=A}else R=A;let M="",I=O;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...W,loop:y,$loop:y};if(R.startsWith("[")&&R.endsWith("]")){let f=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(D))f.forEach((m,r)=>{if(m)S[m]=D[r]});else S[R]=D}else S[R]=D;if(N)if(!T&&V&&Array.isArray(D)&&D.length===2)S[N]=D[0],S[R]=D[1];else S[N]=E;let b=Uj(L,S),v=UX(b);if(v.hasContinue){M+=v.content;continue}let h=WX(b);if(h.hasBreak){M+=h.content;break}if(b=zX(b,S),b=G(b,S),b=m1(b,S,Y),b=zj(b),h=WX(b),h.hasBreak){M+=h.content;break}if(v=UX(b),v.hasContinue){M+=v.content;continue}b=j1(b,S,Y),b=Wj(b,S),b=qj(b,S),M+=b}U=U.substring(0,j)+M+U.substring(_)}catch(F){let O=t("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);U=U.substring(0,j)+O+U.substring(_)}}return U}Q=G(Q,Z),Q=_X(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??Gj;return Q=Hj(Q,Z,K),Q}function BX($){return b$($)}function _X($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=P0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,j=h$(Q.slice(K),"for","endfor");if(j.length===0)break;let _=j[0].content,B=K+j[0].end;if(!BX(U)){let H=t("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(B),J=!0;continue}try{let H=Bj(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let N=_j({forExpr:U,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+N+Q.substring(B),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=jX(V);let A=Function(...F,`
10560
+ </style>`}}});import{existsSync as ez,readFileSync as $j}from"fs";function Zj($){if($X.has($))return;$X.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Yj($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(ez(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return K0.resolve(Y)}catch{}return null}function Xj($){if(t4.has($))return t4.get($);let Z=Yj($);if(!Z)return Zj($),null;try{let Y=JSON.parse($j(Z,"utf8"));return t4.set($,Y.icons),Y.icons}catch{return null}}function w5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var t4,$X,v6;var x6=k(()=>{t4=new Map,$X=new Set;v6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=w5($,"name")??w5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=k0(w5($,"size")||"24"),K=k0(w5($,"color")||"currentColor"),q=k0(w5($,"class")||""),W=k0(w5($,"style")||""),U=t4.get(Q)??Xj(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let j=z.width||24,_=z.height||24,B=`0 0 ${j} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${L}${F}>${H}</svg>`}}});function ZX($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function YX($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var f6;var g6=k(()=>{f6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=YX(Z,"fallback"),Q=X.rest,J=YX(Q,"error"),G=J.rest,K=X.region??ZX($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??ZX($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function e4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var h6;var d6=k(()=>{h6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(e4($,"name")||"v").replace(/["'<>]/g,""),Q=(e4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=e4($,"class"),G=e4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function XX(){C0.registerBuiltin(L6),C0.registerBuiltin(R6),C0.registerBuiltin(M6),C0.registerBuiltin(D6),C0.registerBuiltin(k6),C0.registerBuiltin(S6),C0.registerBuiltin(P6),C0.registerBuiltin(v6),C0.registerBuiltin(f6),C0.registerBuiltin(h6)}var JX=k(()=>{F6();N6();T6();E6();b6();y6();C6();x6();g6();d6();O6();F6();N6();T6();E6();b6();y6();C6();x6();g6();d6()});function $7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function QX($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,j=-1,_=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,_=!0;break}if(H===">"){j=W+1;break}W++}if(j===-1){Q=J+1;continue}let B=$.slice(z,_?j-2:j-1).trim();if(_)X.push({fullMatch:$.slice(J,j),tagName:q,attributes:B,content:"",startIndex:J,endIndex:j,isSelfClosing:!0}),Q=j;else{let H=`<${q}`,L=`</${q}>`,F=1,O=j,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(N!==-1&&N<R){let M=$[N+H.length];if(M===" "||M===">"||M==="/"||M===`
10561
+ `||M==="\t")F++;O=N+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){Q=j;continue}let w=$.slice(j,V),A=V+L.length;X.push({fullMatch:$.slice(J,A),tagName:q,attributes:B,content:w,startIndex:J,endIndex:A,isSelfClosing:!1}),Q=A}}return X}function GX($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var KX=k(()=>{B0();L0();k1()});var _X={};s(_X,{processESImports:()=>jX,processComponents:()=>Y7});import Z7 from"fs";import h0 from"path";function Qj($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=J(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!Q.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let U=J(W.slice(6));X.serverDynamic[U]=GX(q,Y);continue}if(W.startsWith(":")){let U=J(W.slice(1)),z=q===m6?U:q;if(U==="if"||U==="for"||U==="show"){X.clientReactive[U]=z;continue}try{if(!X0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);X.clientReactive[U]=z;continue}let j=Object.keys(Z),B=J0(z,j)(...Object.values(Z));if(B===void 0){let H=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!j.includes(O))){X.clientReactive[U]=z;continue}}X.serverDynamic[U]=B}catch{X.clientReactive[U]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let U=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(X0(z)){let _=J0(z,Object.keys(Z))(...Object.values(Z));G(W,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${z}`);G(W,q)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,z);G(W,q)}else{let z=q,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(q))!==null)try{let B=_[1];if(!X0(B)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);continue}let L=J0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(_[0],String(L??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,B)}G(W,z)}continue}G(W,q===m6?"true":q)}return X}function Gj($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]=m6}return Z}function WX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kj($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(C0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function qj($){let Z=UX.get($);if(Z)return Z;let Y=new Map,X=[h0.join($,"src"),h0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=Z7.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=h0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return UX.set($,Y),Y}function Wj($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=h0.join(Y,"node_modules",$);try{if(Z7.statSync(X).isDirectory())return X}catch{}let Q=h0.dirname(Y);if(Q===Y)return null;Y=Q}}async function jX($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=h0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,B,H=[];while((B=j.exec(z))!==null){let[L,F,O,V]=B,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let M=h0.resolve(G,V);if(M.endsWith(".stx"))A=M;else{let T=`${M}.stx`;try{if(Z7.statSync(T).isFile())A=T}catch{try{if(Z7.statSync(M).isDirectory())w=M}catch{}}}}else w=Wj(V,G);if(!w&&!A)continue;let N=!1,R=(M,T)=>{J.set(M,T),J.set(M.toLowerCase(),T);let I=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,T),Q.add(T)};if(O&&A)R(O,A),N=!0;else if(F){let M=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),T=w?qj(w):null;for(let{source:I,local:E}of M){let D=null;if(A)D=A;else if(T)D=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)R(E,D),N=!0}}if(N)H.push({start:B.index,end:B.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${U}>${_}</script>`}),K}async function Uj($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of z){let _=j.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[h0.resolve(h0.dirname(Y),`${j}.stx`),h0.resolve(h0.dirname(Y),j),h0.resolve(X.componentsDir||"components",`${j}.stx`),h0.resolve(X.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${j}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function zj($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,j=1,_=z+1;while(_<J.length&&j>0){if(J[_]==="(")j++;else if(J[_]===")"){if(j--,j===0)break}_++}if(j!==0)break;let B=J.substring(z+1,_),H=_+1,L=B.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=B.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=F0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(U,H),`[Error parsing component props: ${D}]`);continue}let N="",R=H,T=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)N=T[1].trim(),R=H+T[0].length;let I=await v1(F,A,N,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(R),q.lastIndex=0}return J}async function jj($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=j1(J);return J=q.output,J=await j(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await j(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await j(J,/[a-z][a-z0-9]*/,!1,Jj),J=l5(J,q.scripts),J;async function j(_,B,H,L){if(!_)return _;let F=_,O=QX(F,B,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?$7(w.tagName):w.tagName,N=Gj(w.attributes),R=Qj(N,Z,X),M=C0.getBuiltin(w.tagName),T=M?await G4(A,G,Z,Y,X):!1;if(M&&!T){let y={context:Z,filePath:Y,options:X,dependencies:Q},S=M.render(R,w.content,y);if(Object.keys(R.clientReactive).length>0)S=zX(S,R.clientReactive);if(Object.keys(R.events).length>0){let b=Object.entries(R.events).map(([v,h])=>`${v}="${WX(h)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,w.startIndex)+S+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await G4(A,G,Z,Y,X))continue;let I={};for(let[y,S]of Object.entries(R.static))I[y]=S;for(let[y,S]of Object.entries(R.serverDynamic))I[y]=S;let D=await v1(A,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(R.clientReactive).length>0)D=zX(D,R.clientReactive);if(Object.keys(R.events).length>0){let y=BX(D);if(y){let S=Object.entries(R.events).map(([v,h])=>`${v}="${WX(h)}"`).join(" "),b=Object.keys(R.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${S}`+D.substring(y.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function zX($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),Q=Object.entries(Z).filter(([U])=>!Y.has(U)),J=Q.filter(([U])=>!X.has(U)).map(([U])=>$7(U)).join(" "),G=$,K=Q.length>0?BX(G):null;if(K){let U=Q.map(([j,_])=>`:${$7(j)}="${_.replace(/"/g,"&quot;")}"`).join(" "),z=J?` data-stx-parent-bindings="${J}"`:"";G=G.substring(0,K.insertPos)+`${z} ${U}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function BX($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),Q=X.match(/^\s+/);if(Q){Y+=Q[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let K=`</${J[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+J[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function Y7($,Z,Y,X,Q){if(!qX)XX(),qX=!0;let J=await jX($,Z,Y,X,Q);J=await Uj(J,Z,Y,X,Q),J=await zj(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=a0(J,u5,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...q.tokens);let W=J;if(J=await jj(q.output,Z,Y,X,Q),J===W)break}if(G.length>0)J=J.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=Kj(J);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return J}var qX=!1,m6="\x00stx-boolean-attribute",Jj,UX;var u6=k(()=>{O6();JX();KX();k1();L0();B0();Jj=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);UX=new Map});var AX={};s(AX,{processLoops:()=>l6});function Hj($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,j=U.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let _=j[1],B=U.slice(j[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let L=B.slice(H[0].length).trim();if(!L)continue;try{let F=F0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function X7($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let B=X[W];if(z){z=!1,W++;continue}if(B==="\\"&&U){z=!0,W++;continue}if(U){if(B===U)U=null;W++;continue}if(B==='"'||B==="'"||B==="`"){U=B,W++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}W++}if(q!==0)break;let j=X.substring(K+1,W),_=Y(j);X=X.substring(0,G)+_+X.substring(W+1)}return X}function Oj($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);S$(J);let W=J0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function Lj($,Z){let Y=$;return Y=X7(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(e(J,Z));return G?J7:""}catch{return""}}),Y=X7(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(e(J,Z));return G?Q7:""}catch{return""}}),Y}function Fj($){let Z=$;return Z=Z.replace(/@break(?!\()/g,J7),Z=Z.replace(/@continue(?!\()/g,Q7),Z}function HX($){let Z=$.includes(J7),Y=Z?$.substring(0,$.indexOf(J7)):$;return{hasBreak:Z,content:Y}}function OX($){let Z=$.includes(Q7),Y=Z?$.substring(0,$.indexOf(Q7)):$;return{hasContinue:Z,content:Y}}function FX($){let Z=$;return Z=X7(Z,"@break",(Y)=>{let X=Y.trim();if(!y$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=X7(Z,"@continue",(Y)=>{let X=Y.trim();if(!y$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function Vj($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,j=K.length-1,_=0;while(z<=j){let B=z+j>>1;if(K[B].pos<=U)_=K[B].depth,z=B+1;else j=B-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,j=1,_=z+1,B=-1;while(_<$.length&&j>0){if($[_]==="(")j++;else if($[_]===")"){if(j--,j===0){B=_;break}}_++}if(B===-1)continue;let H=$.substring(z+1,B),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=B+1,w=1,A=V,N=/@forelse\s*\(/g,R=/@endforelse/g,M=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let S=N.exec($),b=R.exec($);if(!b)break;if(S&&S.index<b.index)w++,A=S.index+S[0].length;else{if(w--,w===0){M=b.index;break}A=b.index+11}}if(M===-1)continue;let T=$.substring(V,M),I=M+11,E=-1,D=0,y=0;while(y<T.length){let S=T.indexOf("@",y);if(S===-1)break;let b=T.substring(S);if(/^@forelse\s*\(/.test(b))D++,y=S+1;else if(b.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&b.startsWith("@empty")){if(T.length<=S+6||!/[a-z]/i.test(T[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function LX($,Z){let Y=$;while(!0){let X=Vj(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(X0(G))U=J0(G,Object.keys(Z))(...Object.values(Z));else U=e(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),j=t("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+j+Y.substring(J)}}return Y}function l6($,Z,Y,X){let Q=$;Q=LX(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,j=U.index+U[0].length-1,_=1,B=j+1,H=-1;while(B<q.length&&_>0){if(q[B]==="(")_++;else if(q[B]===")"){if(_--,_===0){H=B;break}}B++}if(H===-1)continue;let L=q.substring(j+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),w=L.substring(F+4),A=H+1,N=1,R=A,M=/@foreach\s*\(/g,T=/@endforeach/g;while(N>0&&R<q.length){M.lastIndex=R,T.lastIndex=R;let I=M.exec(q),E=T.exec(q);if(!E)break;if(I&&I.index<E.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let D=q.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:V,itemVar:w,content:D}}R=E.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:j,end:_,arrayExpr:B,itemVar:H,content:L}=z;try{let F=B.trim(),O;if(X0(F))O=J0(F,Object.keys(W))(...Object.values(W));else O=e(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let E=t("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);U=U.substring(0,j)+E+U.substring(_);continue}let w=X?.loops?.useAltLoopVariable??_j,A=H.trim(),N=null,R,M=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1],M=!0;else R=A}else R=A;let T="",I=O;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...W,loop:y,$loop:y};if(R.startsWith("[")&&R.endsWith("]")){let f=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(D))f.forEach((m,r)=>{if(m)S[m]=D[r]});else S[R]=D}else S[R]=D;if(N)if(!M&&V&&Array.isArray(D)&&D.length===2)S[N]=D[0],S[R]=D[1];else S[N]=E;let b=Lj(L,S),v=OX(b);if(v.hasContinue){T+=v.content;continue}let h=HX(b);if(h.hasBreak){T+=h.content;break}if(b=LX(b,S),b=G(b,S),b=m1(b,S,Y),b=Fj(b),h=HX(b),h.hasBreak){T+=h.content;break}if(v=OX(b),v.hasContinue){T+=v.content;continue}b=B1(b,S,Y),b=Oj(b,S),b=Hj(b,S),T+=b}U=U.substring(0,j)+T+U.substring(_)}catch(F){let O=t("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);U=U.substring(0,j)+O+U.substring(_)}}return U}Q=G(Q,Z),Q=wX(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??Bj;return Q=Rj(Q,Z,K),Q}function VX($){return y$($)}function wX($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=P0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,j=m$(Q.slice(K),"for","endfor");if(j.length===0)break;let _=j[0].content,B=K+j[0].end;if(!VX(U)){let H=t("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(B),J=!0;continue}try{let H=wj(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let N=Aj({forExpr:U,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+N+Q.substring(B),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=FX(V);let A=Function(...F,`
10555
10562
  let result = '';
10556
10563
  for (${U}) {
10557
10564
  result += \`${V}\`;
10558
10565
  }
10559
10566
  return result;
10560
- `)(...O);Q=Q.substring(0,K)+A+Q.substring(B),J=!0}catch(H){let L=t("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(B),J=!0}}return Q}function Bj($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let j=q.slice(W+1).trim(),_=j.indexOf("=");return(_>=0?j.slice(0,_):j).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function _j($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
10567
+ `)(...O);Q=Q.substring(0,K)+A+Q.substring(B),J=!0}catch(H){let L=t("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(B),J=!0}}return Q}function wj($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let j=q.slice(W+1).trim(),_=j.indexOf("=");return(_>=0?j.slice(0,_):j).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function Aj($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
10561
10568
  for (${Z}) {
10562
10569
  __pushIter([${X.join(", ")}])
10563
10570
  }
10564
- `),U=[];W(...q,(_)=>{U.push(_)});let z=J??"inline.stx",j="";for(let _ of U){let B={...Q};X.forEach((L,F)=>{B[L]=_[F]});let H=_X(Y,B,J,G);H=m1(H,B,z),H=j1(H,B,z),j+=H}return j}function Hj($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=P0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=h$(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,j=G+U[0].end;if(!BX(W)){let _=t("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(j),Q=!0;continue}try{let _=Object.keys(Z),B=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=jX(H);let F=Function(..._,`
10571
+ `),U=[];W(...q,(_)=>{U.push(_)});let z=J??"inline.stx",j="";for(let _ of U){let B={...Q};X.forEach((L,F)=>{B[L]=_[F]});let H=wX(Y,B,J,G);H=m1(H,B,z),H=B1(H,B,z),j+=H}return j}function Rj($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=P0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=m$(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,j=G+U[0].end;if(!VX(W)){let _=t("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(j),Q=!0;continue}try{let _=Object.keys(Z),B=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=FX(H);let F=Function(..._,`
10565
10572
  let result = '';
10566
10573
  let maxIterations = ${Y}; // Configurable safety limit
10567
10574
  let counter = 0;
@@ -10573,21 +10580,21 @@ ${D}
10573
10580
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
10574
10581
  }
10575
10582
  return result;
10576
- `)(...B);X=X.substring(0,G)+F+X.substring(j),Q=!0}catch(_){let B=t("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(j),Q=!0}}return X}var Gj=1000,Kj=!1,Y7="<!--__STX_BREAK__-->",X7="<!--__STX_CONTINUE__-->";var m6=k(()=>{u4();J1();t0();d$();B0()});import U0 from"path";function u6($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function Oj($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function Lj($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function LX($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
10577
- `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!X.has(B))Y.push(B),X.add(B);return}let j=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Y.push(B),X.add(B);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!X.has(B))Y.push(B),X.add(B)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function FX($,Z=""){let Y=LX($).split(",").map((X)=>X.trim()).filter(Boolean);return`
10583
+ `)(...B);X=X.substring(0,G)+F+X.substring(j),Q=!0}catch(_){let B=t("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(j),Q=!0}}return X}var Bj=1000,_j=!1,J7="<!--__STX_BREAK__-->",Q7="<!--__STX_CONTINUE__-->";var p6=k(()=>{p4();Q1();t0();u$();B0()});import U0 from"path";function c6($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function Nj($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function Mj($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function NX($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
10584
+ `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!X.has(B))Y.push(B),X.add(B);return}let j=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Y.push(B),X.add(B);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!X.has(B))Y.push(B),X.add(B)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function MX($,Z=""){let Y=NX($).split(",").map((X)=>X.trim()).filter(Boolean);return`
10578
10585
  (function() {
10579
- ${Z5("var",Y)}
10586
+ ${Y5("var",Y)}
10580
10587
  var __destroyHooks = [];
10581
10588
  var __origOnDestroy = onDestroy;
10582
10589
  onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
10583
10590
 
10584
10591
  ${$}
10585
10592
  ${Z}})();
10586
- `}function VX($,Z){return`
10593
+ `}function TX($,Z){return`
10587
10594
  // Register scope variables for STX runtime
10588
10595
  if (!window.stx._scopes) window.stx._scopes = {};
10589
10596
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
10590
- ${LX($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
10597
+ ${NX($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
10591
10598
  `)}
10592
10599
  // #1767: when the bundler renamed a component const that collided with an
10593
10600
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -10595,7 +10602,7 @@ ${LX($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
10595
10602
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
10596
10603
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
10597
10604
  window.stx._scopes['${Z}'] = __scopeRegistration;
10598
- `}function Fj($,Z){let Y=VX($,Z),X=`
10605
+ `}function Tj($,Z){let Y=TX($,Z),X=`
10599
10606
  (function() {
10600
10607
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
10601
10608
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -10604,33 +10611,33 @@ ${LX($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
10604
10611
  } finally {
10605
10612
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
10606
10613
  }
10607
- })();`;return X+FX($,Y)+`
10614
+ })();`;return X+MX($,Y)+`
10608
10615
  } finally {
10609
10616
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
10610
10617
  }
10611
- })();`}function Vj($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function Aj($){if($.__onceStore instanceof Set)return $.__onceStore;return wj}async function l6($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=Oj($,"@partial","@include"),q=Aj(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let B=/@includeIf\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=V;continue}let N=A[1],R=W(N,G,Y),T="";if(R&&await Bun.file(R).exists())Q.add(R),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),B.lastIndex=0}}for(let[B,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let N=K.substring(V+1,A-1),R=u6(N,0);if(R===-1){L.lastIndex=A;continue}let T=N.substring(0,R).trim(),M=N.substring(R+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],D=M.substring(I[0].length),y,S=u6(D,0);if(S!==-1)y=D.substring(S+1).trim();try{let b=`Boolean(${T})`,v;if(X0(b)){let m=J0(b,Object.keys(Z));v=Boolean(m(...Object.values(Z)))}else v=Boolean(e(b,Z));let h=H?!v:v,f="";if(h){let m=W(E,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}catch(b){let v=b instanceof Error?b.message:String(b),h=q0("Include",`Error evaluating ${B} condition: ${v}`,Y,$,O);K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}}}{let B=/@each\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){B.lastIndex=0,K=K.replace(A,"");continue}let[,R,T,M,I]=N;try{let E,D=T.trim();if(X0(D))E=J0(D,Object.keys(Z))(...Object.values(Z));else E=e(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[M]:S},v=await z(R,b,$,L);y+=v}else if(I)y=await z(I,{},$,L);K=K.substring(0,L)+y+K.substring(V+1),B.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+q0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){B.lastIndex=0,K=K.replace(A,"");continue}let R=N[1],T=w.slice(N[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let y=1,S=1;while(S<T.length&&y>0){if(T[S]==="{")y++;else if(T[S]==="}"){if(y--,y===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(R.replace(/'/g,'"')),S={};if(M)try{S=V0(M,Z)}catch(v){let h=v instanceof Error?v.message:String(v);if(X.debug){let f=q0("Include",`Error parsing includeFirst variables: ${h}`,Y,$,L,A);K=K.replace(A,()=>f)}else K=K.replace(A,()=>E||"");continue}let b=!1;for(let v of y){let h=W(v,G,Y);if(!h)continue;if(await c(h)){let f=await z(v,S,$,L);K=K.replace(A,()=>f),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(A,()=>E);else if(X.debug){let v=q0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);K=K.replace(A,()=>v)}else K=K.replace(A,"")}catch(y){let S=y instanceof Error?y.message:String(y),b=q0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>b)}B.lastIndex=0}}function W(B,H,L){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let A=U0.normalize(w),N=A.startsWith(O+U0.sep)||A===O,R=A.startsWith(V+U0.sep)||A===V,T=!1,M=U0.dirname(V);if(A.startsWith(M+U0.sep)){if(!U0.relative(M,A).split(U0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))T=!0}if(!N&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let U=U0.resolve(Y);J.add(U);async function z(B,H={},L,F){let O=W(B,G,Y);if(!O)return q0("Include",`Could not resolve path for include: ${B}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let w=[...J,V].map((A)=>U0.basename(A)).join(" -> ");return q0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let m=f instanceof Error?f.message:String(f);return q0("Include",`Error loading include file ${B}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (W6(),q6));w=f(w,Z)}if(w&&(X.debug||!Y$()&&!b4()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (z6(),gY));f(w,O)}catch{}let A=w;try{let{processESImports:f}=await Promise.resolve().then(() => (h6(),qX));await f(w,Z,O,X,Q)}catch(f){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let N=v$(A);if(N)A=N.content.trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,m]of Object.entries(H))I[f]=m;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",S=null;for(let f of D){let m=f[1]||"",r=f[2]||"",T0=m.includes("server"),M0=D1(m),d0="";try{let{extractAndStripCssImports:Y0,renderVendorStyleTags:I0}=await Promise.resolve().then(() => (d5(),s9)),c0=Y0(r,{filePath:O,projectRoot:process.cwd()});r=c0.code,d0=I0(c0.styles)}catch(Y0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Y0 instanceof Error?Y0.message:Y0)}if(M0&&r.trim())r=E1(r);if(!T0)try{let{hasUserImports:Y0,bundleClientScript:I0}=await Promise.resolve().then(() => (x5(),v5));if(Y0(r))r=await I0(r,O,{projectRoot:process.cwd()})}catch(Y0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,Y0 instanceof Error?Y0.message:Y0)}let Z0=Lj(r);if(Z0&&!T0){S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++OX}`;let Y0=n0(r),I0=Fj(Y0,S);y+=`${d0}<script data-stx-scoped>${I0}</script>
10612
- `;continue}if(T0)try{let{extractVariables:Y0}=await Promise.resolve().then(() => (s5(),g$));await Y0(r,I,O)}catch(Y0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Y0)}if(!T0&&!Z0){let Y0=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++OX}`;let I0=n0(r),c0=VX(I0,S),K1=FX(I0,c0);y+=`${d0}<script data-stx-scoped${Y0?` ${Y0}`:""}>${K1}</script>
10613
- `}}if(S){let f=Vj(A,S);if(A=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await l6(A,I,O,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (m6(),HX)),v=b(A,I,O);v=m1(v,I,O);let h=$5(w);if(v=j1(v,I,O,{forceSignals:h}),M)v+=`
10614
- `+M;if(y)v+=`
10615
- `+y;return v}catch(w){let A=w instanceof Error?w.message:String(w);return q0("Include",`Error processing include ${B}: ${A}`,Y,L,F)}}let j=/@include\s*\(/g,_;while((_=j.exec(K))!==null){let B=_.index,H=B+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(B,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let A=w[1],N,R=V.substring(w[0].length),T=u6(R,0);if(T!==-1)N=R.substring(T+1).trim();let M={};if(N)try{M=V0(N,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,q0("Include",`Error parsing include variables for ${A}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let I=await z(A,M,$,B);K=K.substring(0,B)+I+K.substring(F),j.lastIndex=0}return K}function p6($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),z=q.match(U);if(!z||z.index===void 0)break;let j=z.index,_=z[1],B=j+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=B,V=-1;while(F>0&&O<q.length){let A=q.slice(O),N=A.match(H),R=A.match(L),T=N?O+N.index:1/0,M=R?O+R.index:1/0;if(T<M)F++,O=T+(N[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(B,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);q=q.substring(0,j)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function c6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
10616
- `)})}var OX=0,TA,wj;var wX=k(()=>{S7();u4();t0();c5();J5();B0();F0();TA=new b1(500),wj=new Set});import*as i6 from"path";async function AX($,Z,Y=""){if(i6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return NX($,Z,Y,"@js","@endjs")}async function RX($,Z,Y=""){if(i6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return NX($,Z,Y,"@ts","@endts")}async function NX($,Z,Y,X,Q){let J=$,G=X5(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let j=Object.keys(Z),_=Object.values(Z),B=U.trim();if(X==="@ts")B=B.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=(B.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
10618
+ })();`}function Ij($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function Ej($){if($.__onceStore instanceof Set)return $.__onceStore;return Dj}async function i6($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=Nj($,"@partial","@include"),q=Ej(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let B=/@includeIf\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=V;continue}let N=A[1],R=W(N,G,Y),M="";if(R&&await Bun.file(R).exists())Q.add(R),M=`@include(${w})`;K=K.substring(0,L)+M+K.substring(V),B.lastIndex=0}}for(let[B,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let N=K.substring(V+1,A-1),R=c6(N,0);if(R===-1){L.lastIndex=A;continue}let M=N.substring(0,R).trim(),T=N.substring(R+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],D=T.substring(I[0].length),y,S=c6(D,0);if(S!==-1)y=D.substring(S+1).trim();try{let b=`Boolean(${M})`,v;if(X0(b)){let m=J0(b,Object.keys(Z));v=Boolean(m(...Object.values(Z)))}else v=Boolean(e(b,Z));let h=H?!v:v,f="";if(h){let m=W(E,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}catch(b){let v=b instanceof Error?b.message:String(b),h=q0("Include",`Error evaluating ${B} condition: ${v}`,Y,$,O);K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}}}{let B=/@each\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){B.lastIndex=0,K=K.replace(A,"");continue}let[,R,M,T,I]=N;try{let E,D=M.trim();if(X0(D))E=J0(D,Object.keys(Z))(...Object.values(Z));else E=e(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[T]:S},v=await z(R,b,$,L);y+=v}else if(I)y=await z(I,{},$,L);K=K.substring(0,L)+y+K.substring(V+1),B.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+q0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){B.lastIndex=0,K=K.replace(A,"");continue}let R=N[1],M=w.slice(N[0].length),T,I=M.match(/^\s*,\s*\{/);if(I){M=M.slice(I[0].length-1);let y=1,S=1;while(S<M.length&&y>0){if(M[S]==="{")y++;else if(M[S]==="}"){if(y--,y===0)break}S++}T=M.substring(0,S+1),M=M.slice(S+1)}let E,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(R.replace(/'/g,'"')),S={};if(T)try{S=F0(T,Z)}catch(v){let h=v instanceof Error?v.message:String(v);if(X.debug){let f=q0("Include",`Error parsing includeFirst variables: ${h}`,Y,$,L,A);K=K.replace(A,()=>f)}else K=K.replace(A,()=>E||"");continue}let b=!1;for(let v of y){let h=W(v,G,Y);if(!h)continue;if(await c(h)){let f=await z(v,S,$,L);K=K.replace(A,()=>f),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(A,()=>E);else if(X.debug){let v=q0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);K=K.replace(A,()=>v)}else K=K.replace(A,"")}catch(y){let S=y instanceof Error?y.message:String(y),b=q0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>b)}B.lastIndex=0}}function W(B,H,L){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let A=U0.normalize(w),N=A.startsWith(O+U0.sep)||A===O,R=A.startsWith(V+U0.sep)||A===V,M=!1,T=U0.dirname(V);if(A.startsWith(T+U0.sep)){if(!U0.relative(T,A).split(U0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))M=!0}if(!N&&!R&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let U=U0.resolve(Y);J.add(U);async function z(B,H={},L,F){let O=W(B,G,Y);if(!O)return q0("Include",`Could not resolve path for include: ${B}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let w=[...J,V].map((A)=>U0.basename(A)).join(" -> ");return q0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let m=f instanceof Error?f.message:String(f);return q0("Include",`Error loading include file ${B}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (j6(),z6));w=f(w,Z)}if(w&&(X.debug||!X$()&&!y4()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (_6(),pY));f(w,O)}catch{}let A=w;try{let{processESImports:f}=await Promise.resolve().then(() => (u6(),_X));await f(w,Z,O,X,Q)}catch(f){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let N=f$(A);if(N)A=N.content.trim();let M=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(M)T=`<style${M[1]}>${M[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,m]of Object.entries(H))I[f]=m;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",S=null;for(let f of D){let m=f[1]||"",r=f[2]||"",M0=m.includes("server"),T0=D1(m),d0="";try{let{extractAndStripCssImports:Y0,renderVendorStyleTags:I0}=await Promise.resolve().then(() => (m5(),a9)),c0=Y0(r,{filePath:O,projectRoot:process.cwd()});r=c0.code,d0=I0(c0.styles)}catch(Y0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Y0 instanceof Error?Y0.message:Y0)}if(T0&&r.trim())r=E1(r);if(!M0)try{let{hasUserImports:Y0,bundleClientScript:I0}=await Promise.resolve().then(() => (f5(),x5));if(Y0(r))r=await I0(r,O,{projectRoot:process.cwd()})}catch(Y0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,Y0 instanceof Error?Y0.message:Y0)}let Z0=Mj(r);if(Z0&&!M0){S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++RX}`;let Y0=n0(r),I0=Tj(Y0,S);y+=`${d0}<script data-stx-scoped>${I0}</script>
10619
+ `;continue}if(M0)try{let{extractVariables:Y0}=await Promise.resolve().then(() => (r5(),d$));await Y0(r,I,O)}catch(Y0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Y0)}if(!M0&&!Z0){let Y0=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++RX}`;let I0=n0(r),c0=TX(I0,S),q1=MX(I0,c0);y+=`${d0}<script data-stx-scoped${Y0?` ${Y0}`:""}>${q1}</script>
10620
+ `}}if(S){let f=Ij(A,S);if(A=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await i6(A,I,O,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (p6(),AX)),v=b(A,I,O);v=m1(v,I,O);let h=Z5(w);if(v=B1(v,I,O,{forceSignals:h}),T)v+=`
10621
+ `+T;if(y)v+=`
10622
+ `+y;return v}catch(w){let A=w instanceof Error?w.message:String(w);return q0("Include",`Error processing include ${B}: ${A}`,Y,L,F)}}let j=/@include\s*\(/g,_;while((_=j.exec(K))!==null){let B=_.index,H=B+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(B,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let A=w[1],N,R=V.substring(w[0].length),M=c6(R,0);if(M!==-1)N=R.substring(M+1).trim();let T={};if(N)try{T=F0(N,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,q0("Include",`Error parsing include variables for ${A}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let I=await z(A,T,$,B);K=K.substring(0,B)+I+K.substring(F),j.lastIndex=0}return K}function n6($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),z=q.match(U);if(!z||z.index===void 0)break;let j=z.index,_=z[1],B=j+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=B,V=-1;while(F>0&&O<q.length){let A=q.slice(O),N=A.match(H),R=A.match(L),M=N?O+N.index:1/0,T=R?O+R.index:1/0;if(M<T)F++,O=M+(N[0].length||1);else if(T<1/0){if(F--,F===0){V=T;break}O=T+G.length+1}else break}if(V===-1)break;let w=q.slice(B,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);q=q.substring(0,j)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function o6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
10623
+ `)})}var RX=0,CA,Dj;var IX=k(()=>{C7();p4();t0();i5();Q5();B0();L0();CA=new b1(500),Dj=new Set});import*as s6 from"path";async function DX($,Z,Y=""){if(s6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return kX($,Z,Y,"@js","@endjs")}async function EX($,Z,Y=""){if(s6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return kX($,Z,Y,"@ts","@endts")}async function kX($,Z,Y,X,Q){let J=$,G=J5(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let j=Object.keys(Z),_=Object.values(Z),B=U.trim();if(X==="@ts")B=B.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=(B.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
10617
10624
  ${B}
10618
10625
  ${F}
10619
- `,w=Function(...j,O)(..._);if(w&&typeof w==="object")Object.assign(Z,w);J=J.replace(W,"")}catch(j){console.error(`Error executing ${X} code block in ${Y}:`,j);let _=j instanceof Error?j.message:String(j),B=q0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,W);console.error(B),J=J.replace(W,"")}return J}var TX=k(()=>{J5();F0()});function Rj($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function MX($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return Rj(X,J||"_method")})}async function IX($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=q0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
10626
+ `,w=Function(...j,O)(..._);if(w&&typeof w==="object")Object.assign(Z,w);J=J.replace(W,"")}catch(j){console.error(`Error executing ${X} code block in ${Y}:`,j);let _=j instanceof Error?j.message:String(j),B=q0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,W);console.error(B),J=J.replace(W,"")}return J}var bX=k(()=>{Q5();L0()});function kj($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function SX($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return kj(X,J||"_method")})}async function yX($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=q0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
10620
10627
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${o0(W)}</div>
10621
- `)}}}return J}async function DX($,Z,Y,X){return IX($,Z,Y,X,"before")}async function EX($,Z,Y,X){return IX($,Z,Y,X,"after")}var kX=k(()=>{t0();F0()});import{defineRoute as fA,defineRoutes as gA,resetRoutes as hA,route as dA,setAppUrl as mA}from"stx-router";import{route as Nj}from"stx-router";function bX($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?V0(Q,{}):{};return Nj(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var SX=k(()=>{B0()});async function yX($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(B$.exact[$])for(let X of B$.exact[$])await Promise.resolve(X(Z,$));if(B$.exact[Y])for(let X of B$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of B$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var B$;var PX=k(()=>{B$={patterns:[],exact:{}}});function CX($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>CX(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function vX($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,_=U,B=!1;while((j=z.exec(U))!==null){let H=j[1],L=j[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let N=CX(A);if(N){let R=_.match(/\sclass="([^"]*)"/);if(R)_=_.replace(R[0],` class="${R[1]} ${N}"`);else _=_.replace(j[0],` class="${N}"`)}else _=_.replace(j[0],"");B=!0;continue}if(Tj.has(H)){if(A)_=_.replace(j[0],` ${H}`);else _=_.replace(j[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(j[0],"");else{let N=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(j[0],` ${H}="${N}"`)}B=!0}catch{continue}}if(B){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:j}=q[W];Y=Y.slice(0,U)+j+Y.slice(z)}return Y}var Tj;var xX=k(()=>{Tj=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function p1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let Q=/\/\s*>$/.test(X[0])||Mj.has(X[1].toLowerCase()),J=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:J,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function Dj($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function e0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=Dj($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function fX($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function w5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function V1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function w1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function Ej($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function kj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;let Q=w5(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=V1(X.attrs,"v-for"),U=V1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=e0(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=w1(j,{...X,start:0,end:X.end-X.start},U),B=`@foreach(${q})
10628
+ `)}}}return J}async function PX($,Z,Y,X){return yX($,Z,Y,X,"before")}async function CX($,Z,Y,X){return yX($,Z,Y,X,"after")}var vX=k(()=>{t0();L0()});import{defineRoute as nA,defineRoutes as oA,resetRoutes as sA,route as rA,setAppUrl as aA}from"stx-router";import{route as bj}from"stx-router";function xX($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?F0(Q,{}):{};return bj(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var fX=k(()=>{B0()});async function gX($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(_$.exact[$])for(let X of _$.exact[$])await Promise.resolve(X(Z,$));if(_$.exact[Y])for(let X of _$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of _$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var _$;var hX=k(()=>{_$={patterns:[],exact:{}}});function dX($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>dX(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function mX($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,_=U,B=!1;while((j=z.exec(U))!==null){let H=j[1],L=j[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let N=dX(A);if(N){let R=_.match(/\sclass="([^"]*)"/);if(R)_=_.replace(R[0],` class="${R[1]} ${N}"`);else _=_.replace(j[0],` class="${N}"`)}else _=_.replace(j[0],"");B=!0;continue}if(Sj.has(H)){if(A)_=_.replace(j[0],` ${H}`);else _=_.replace(j[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(j[0],"");else{let N=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(j[0],` ${H}="${N}"`)}B=!0}catch{continue}}if(B){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:j}=q[W];Y=Y.slice(0,U)+j+Y.slice(z)}return Y}var Sj;var uX=k(()=>{Sj=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function p1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let Q=/\/\s*>$/.test(X[0])||yj.has(X[1].toLowerCase()),J=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:J,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function Cj($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function e0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=Cj($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function lX($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function A5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function w1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function A1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function vj($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function xj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;let Q=A5(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=w1(X.attrs,"v-for"),U=w1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=e0(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=A1(j,{...X,start:0,end:X.end-X.start},U),B=`@foreach(${q})
10622
10629
  `,H=`${B}${_}
10623
- @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+B.length}return Z}function bj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;let Q=w5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=e0(Z,X),K=V1(X.attrs,"v-if"),q=w1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=p1(Z,W+L);if(!F){U=!1;break}let O=w5(F.attrs,"v-else-if"),V=fX(F.attrs,"v-else");if(O!==null){let w=e0(Z,F),A=V1(F.attrs,"v-else-if"),N=w1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=e0(Z,F),A=V1(F.attrs,"v-else"),N=w1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
10630
+ @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+B.length}return Z}function fj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;let Q=A5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=e0(Z,X),K=w1(X.attrs,"v-if"),q=A1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=p1(Z,W+L);if(!F){U=!1;break}let O=A5(F.attrs,"v-else-if"),V=lX(F.attrs,"v-else");if(O!==null){let w=e0(Z,F),A=w1(F.attrs,"v-else-if"),N=A1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=e0(Z,F),A=w1(F.attrs,"v-else"),N=A1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
10624
10631
  ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
10625
10632
  ${H.element}`);else z.push(`@else
10626
10633
  ${H.element}`);z.push("@endif");let j=z.join(`
10627
- `),_=J[0].outerStart,B=J[J.length-1].outerEnd;Z=Z.slice(0,_)+j+Z.slice(B),Y=_+j.length}return Z}function Sj($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function yj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=K[2],j=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${j}" @update:${U}="${j} = $event"`,K=Q.match(G)}if(J){let U=e0(Z,X),z=Z.slice(U.outerStart,U.outerEnd),j=w1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),Y=U.outerStart+j.length;continue}let q=w5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(Ij.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=e0(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=w1(j,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=e0(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=w1(j,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function Pj($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Cj($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function vj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;let Q=w5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=e0(Z,X),G=V1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function xj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;let Q=w5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=e0(Z,X),G=V1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function fj($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function gj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;if(!fX(X.attrs,"v-once")){Y=X.end;continue}let Q=V1(X.attrs,"v-once"),J=e0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
10628
- ${w1(G,{...X,start:0,end:X.end-X.start},Q)}
10629
- @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function hj($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function dj($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function gX($){if(!Ej($))return $;let Z=$;return Z=kj(Z),Z=bj(Z),Z=gj(Z),Z=Pj(Z),Z=Cj(Z),Z=yj(Z),Z=Sj(Z),Z=dj(Z),Z=vj(Z),Z=xj(Z),Z=fj(Z),Z=hj(Z),Z}var Mj,Ij;var hX=k(()=>{Mj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ij=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 J7($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function dX($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=e(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${J7(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let j=U.attrs.trim(),_={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(j))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=e(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await v1(z,_,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${J7(j)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J=await mj(J,Z,Y,X,Q),J}async function mj($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=e(U.expr,Z);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${J7(U.expr)}" -->`;J=J.slice(0,U.index)+B+J.slice(U.index+U.full.length);continue}let j=X.componentsDir||"components",_=await v1(z,{},"",j,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${J7(j)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J}var mX=k(()=>{F0();B0()});function uX($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
10630
- ${$.slice(Z)}`}function uj($){let Z=[],Y=0;while(Y<$.length){let J=$.slice(Y),G=J.match(/^\s+/);if(G){Y+=G[0].length;continue}if(J.startsWith("<!--")){let z=$.indexOf("-->",Y);if(z===-1)break;Y=z+3;continue}let K=J.match(/^<script\b[^>]*>/i);if(K){let z=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(z===-1)break;Y=z+9;continue}let q=J.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=J.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let U=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){Z.push(U[0]),Y+=U[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Q=0;while(Q<$.length&&Q<Y){let J=$.slice(Q),G=J.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let K=J.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){Q+=K[0].length;continue}let q=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Q+=q[0].length;continue}X+=$[Q],Q++}return X+=$.slice(Y),{body:X,hoisted:Z}}function lj($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
10631
- `),H=G.map((R)=>{return` <link ${Object.entries(R).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
10632
- `),L=K.map((R)=>{if(R.src)return` <script ${Object.entries(R).filter(([M])=>M!=="content").map(([M,I])=>`${M}="${I}"`).join(" ")}></script>`;if(R.content)return` <script>${R.content}</script>`;return""}).filter(Boolean).join(`
10633
- `),F=Object.entries(U).map(([R,T])=>` ${R}="${T}"`).join(""),O=W?` class="${W}"`:"",{body:V,hoisted:w}=uj($),A=[B,` <title>${z}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((R)=>` ${R}`),...w.map((R)=>` ${R}`),...(Y.headScripts||[]).map((R)=>` ${R}`),Y.headStack||""].filter(Boolean),N=[V,...(Y.bodyScripts||[]).map((R)=>R),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
10634
+ `),_=J[0].outerStart,B=J[J.length-1].outerEnd;Z=Z.slice(0,_)+j+Z.slice(B),Y=_+j.length}return Z}function gj($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function hj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=K[2],j=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${j}" @update:${U}="${j} = $event"`,K=Q.match(G)}if(J){let U=e0(Z,X),z=Z.slice(U.outerStart,U.outerEnd),j=A1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),Y=U.outerStart+j.length;continue}let q=A5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(Pj.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=e0(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=A1(j,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=e0(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=A1(j,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function dj($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function mj($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function uj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;let Q=A5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=e0(Z,X),G=w1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function lj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;let Q=A5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=e0(Z,X),G=w1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function pj($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function cj($){let Z=$,Y=0;while(Y<Z.length){let X=p1(Z,Y);if(!X)break;if(!lX(X.attrs,"v-once")){Y=X.end;continue}let Q=w1(X.attrs,"v-once"),J=e0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
10635
+ ${A1(G,{...X,start:0,end:X.end-X.start},Q)}
10636
+ @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function ij($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function nj($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function pX($){if(!vj($))return $;let Z=$;return Z=xj(Z),Z=fj(Z),Z=cj(Z),Z=dj(Z),Z=mj(Z),Z=hj(Z),Z=gj(Z),Z=nj(Z),Z=uj(Z),Z=lj(Z),Z=pj(Z),Z=ij(Z),Z}var yj,Pj;var cX=k(()=>{yj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Pj=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 G7($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function iX($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=e(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${G7(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let j=U.attrs.trim(),_={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(j))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=e(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await v1(z,_,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${G7(j)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J=await oj(J,Z,Y,X,Q),J}async function oj($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=e(U.expr,Z);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${G7(U.expr)}" -->`;J=J.slice(0,U.index)+B+J.slice(U.index+U.full.length);continue}let j=X.componentsDir||"components",_=await v1(z,{},"",j,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${G7(j)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J}var nX=k(()=>{L0();B0()});function oX($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
10637
+ ${$.slice(Z)}`}function sj($){let Z=[],Y=0;while(Y<$.length){let J=$.slice(Y),G=J.match(/^\s+/);if(G){Y+=G[0].length;continue}if(J.startsWith("<!--")){let z=$.indexOf("-->",Y);if(z===-1)break;Y=z+3;continue}let K=J.match(/^<script\b[^>]*>/i);if(K){let z=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(z===-1)break;Y=z+9;continue}let q=J.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=J.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let U=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){Z.push(U[0]),Y+=U[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Q=0;while(Q<$.length&&Q<Y){let J=$.slice(Q),G=J.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let K=J.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){Q+=K[0].length;continue}let q=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Q+=q[0].length;continue}X+=$[Q],Q++}return X+=$.slice(Y),{body:X,hoisted:Z}}function rj($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
10638
+ `),H=G.map((R)=>{return` <link ${Object.entries(R).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
10639
+ `),L=K.map((R)=>{if(R.src)return` <script ${Object.entries(R).filter(([T])=>T!=="content").map(([T,I])=>`${T}="${I}"`).join(" ")}></script>`;if(R.content)return` <script>${R.content}</script>`;return""}).filter(Boolean).join(`
10640
+ `),F=Object.entries(U).map(([R,M])=>` ${R}="${M}"`).join(""),O=W?` class="${W}"`:"",{body:V,hoisted:w}=sj($),A=[B,` <title>${z}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((R)=>` ${R}`),...w.map((R)=>` ${R}`),...(Y.headScripts||[]).map((R)=>` ${R}`),Y.headStack||""].filter(Boolean),N=[V,...(Y.bodyScripts||[]).map((R)=>R),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
10634
10641
  <html lang="${Q}">
10635
10642
  <head>
10636
10643
  ${A.join(`
@@ -10640,33 +10647,33 @@ ${A.join(`
10640
10647
  ${N.join(`
10641
10648
  `)}
10642
10649
  </body>
10643
- </html>`}function n6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function lX($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,j])=>`${z}="${j}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
10650
+ </html>`}function r6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function sX($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,j])=>`${z}="${j}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
10644
10651
  `)}
10645
- ${$.slice(Y)}`}function pX($,Z={},Y={}){if(n6($))return $;return lj($,Z,Y)}import A5 from"path";function cX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function iX($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=A5.join(Q,$);if(await Bun.file(G).exists())return G;Q=A5.dirname(Q)}X=A5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=A5.resolve(Z,$);else X=A5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function nX($,Z,Y){let X=$,Q=A5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,j]=G;if(cX(z))continue;let _=await iX(z,Q,Z);if(_)try{let B=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:u0()});if(L.outputs.length>0)B=await L.outputs[0].text()}let H=`<script>
10652
+ ${$.slice(Y)}`}function rX($,Z={},Y={}){if(r6($))return $;return rj($,Z,Y)}import R5 from"path";function aX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function tX($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=R5.join(Q,$);if(await Bun.file(G).exists())return G;Q=R5.dirname(Q)}X=R5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=R5.resolve(Z,$);else X=R5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function eX($,Z,Y){let X=$,Q=R5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,j]=G;if(aX(z))continue;let _=await tX(z,Q,Z);if(_)try{let B=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:u0()});if(L.outputs.length>0)B=await L.outputs[0].text()}let H=`<script>
10646
10653
  // Source: ${z}
10647
10654
  ${B}
10648
- </script>`;X=X.replace(W,H),J.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,j]=q,_=U+j;if(cX(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await iX(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
10655
+ </script>`;X=X.replace(W,H),J.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,j]=q,_=U+j;if(aX(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await tX(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
10649
10656
  /* Source: ${z} */
10650
10657
  ${L}
10651
- </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var oX=k(()=>{M1()});function Q7($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),j=Y.substring(J,q+1),_=-1,B=0,H=null,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),w;if(X0(V))w=J0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+N+Y.substring(q+1),X.lastIndex=J+N.length}catch(V){r0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+j.length}}return Y}function G7($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function sX($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),j=z.indexOf("@endmemo");if(j===-1)continue;let _=z.slice(0,j),B=U+j+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[R,T,M="",I]=A,E=`<${T}${M} data-stx-memo="${W}"${I}>`;N=_.slice(0,L)+E+w.slice(R.length)+_.slice(L+w.length)}else N=`${_.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${_.slice(L+w.length)}`;Q.push({start:J,end:B,replacement:N}),Y.lastIndex=B}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function o6($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function rX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let j=$.slice(U+1),_=j.indexOf("</"),B=_>=0?j.slice(0,_):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function aX($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,H=$.toLowerCase().indexOf(B,J);if(H!==-1)Z.lastIndex=H+B.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let B=$[K];if(q){if(B==="'")q=!1}else if(W){if(B==='"')W=!1}else if(B==="'")q=!0;else if(B==='"')W=!0;else if(B===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!pj.test(z))continue;let j=$[U-1]==="/",_=j?U-1:U;Y+=`${$.slice(X,_)} x-cloak${j?" ":""}`,X=_}return Y+=$.slice(X),Y}var pj;var s6=k(()=>{J1();B0();pj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function K7($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of cj){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
10658
+ </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var $J=k(()=>{T1()});function K7($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),j=Y.substring(J,q+1),_=-1,B=0,H=null,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),w;if(X0(V))w=J0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+N+Y.substring(q+1),X.lastIndex=J+N.length}catch(V){r0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+j.length}}return Y}function q7($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function ZJ($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),j=z.indexOf("@endmemo");if(j===-1)continue;let _=z.slice(0,j),B=U+j+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[R,M,T="",I]=A,E=`<${M}${T} data-stx-memo="${W}"${I}>`;N=_.slice(0,L)+E+w.slice(R.length)+_.slice(L+w.length)}else N=`${_.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${_.slice(L+w.length)}`;Q.push({start:J,end:B,replacement:N}),Y.lastIndex=B}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function a6($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function YJ($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let j=$.slice(U+1),_=j.indexOf("</"),B=_>=0?j.slice(0,_):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function XJ($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,H=$.toLowerCase().indexOf(B,J);if(H!==-1)Z.lastIndex=H+B.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let B=$[K];if(q){if(B==="'")q=!1}else if(W){if(B==='"')W=!1}else if(B==="'")q=!0;else if(B==='"')W=!0;else if(B===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!aj.test(z))continue;let j=$[U-1]==="/",_=j?U-1:U;Y+=`${$.slice(X,_)} x-cloak${j?" ":""}`,X=_}return Y+=$.slice(X),Y}var aj;var t6=k(()=>{Q1();B0();aj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function W7($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of tj){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
10652
10659
  `),z=[];U.forEach((_,B)=>{if(G.lastIndex=0,G.test(_))z.push(B+1)});let j=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";J.push(` \u2717 ${K}${j}
10653
10660
  \u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
10654
10661
  ${J.join(`
10655
10662
  `)}
10656
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var cj;var r6=k(()=>{cj=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var tX={};s(tX,{getStoreScript:()=>ij,clearStoreCache:()=>nj});import q7 from"path";async function ij($){let Z;if($)Z=q7.resolve($);else{let U=await j5();Z=q7.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=R5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=q7.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return R5.set(Z,""),null}if(Q.length===0)return R5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()});for(let U of G)try{let z=await Bun.file(U).text(),j=q7.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${j}
10657
- ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return R5.set(Z,""),null;let W=`;(function(){
10663
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var tj;var e6=k(()=>{tj=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var JJ={};s(JJ,{getStoreScript:()=>ej,clearStoreCache:()=>$B});import U7 from"path";async function ej($){let Z;if($)Z=U7.resolve($);else{let U=await B5();Z=U7.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=N5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=U7.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return N5.set(Z,""),null}if(Q.length===0)return N5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()});for(let U of G)try{let z=await Bun.file(U).text(),j=U7.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${j}
10664
+ ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return N5.set(Z,""),null;let W=`;(function(){
10658
10665
  ${K.join(`
10659
10666
 
10660
10667
  `)}
10661
- })();`;return R5.set(Z,W),W}function nj(){R5.clear()}var R5;var eX=k(()=>{B5();M1();R5=new Map});var ZJ={};s(ZJ,{getComposableScript:()=>aj,clearComposableCache:()=>tj});import _$ from"path";function $J($){let Z=_$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function sj($){if($)return _$.resolve($);let Z=`<default>:${process.cwd()}`,Y=a6.get(Z);if(Y!==void 0)return Y;let X=await rj();return a6.set(Z,X),X}async function rj(){let $=await j5(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return _$.resolve(Z,Y);for(let X of oj){let Q=_$.resolve(Z,X);try{let J=new Bun.Glob("**/*.ts");for await(let G of J.scan({cwd:Q,absolute:!0}))if(!$J(G))return Q}catch{}}return null}async function aj($){let Z=await sj($);if(!Z)return null;let Y=N5.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let _=new Bun.Glob("**/*.ts");for await(let B of _.scan({cwd:Z,absolute:!0})){if($J(B))continue;X.push(B)}}catch{return N5.set(Z,""),null}if(X.length===0)return N5.set(Z,""),null;X.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()}),J=[],G=new Set,K=new Set;for(let _ of X)try{let B=await Bun.file(_).text(),H=_$.basename(_,".ts");for(let L of B.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of Q.scan(B).exports)if(L!=="default")G.add(L)}catch{}B=n0(B),B=B.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),B=B.replace(/^export\s+(default\s+)?/gm,""),B=Q.transformSync(B),J.push(`// Composable: ${H}
10662
- ${B.trim()}`)}catch(B){console.warn(`[stx] Failed to load composable ${_}:`,B)}if(J.length===0||G.size===0)return N5.set(Z,""),null;let q=[...G].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
10668
+ })();`;return N5.set(Z,W),W}function $B(){N5.clear()}var N5;var QJ=k(()=>{_5();T1();N5=new Map});var KJ={};s(KJ,{getComposableScript:()=>JB,clearComposableCache:()=>QB});import H$ from"path";function GJ($){let Z=H$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function YB($){if($)return H$.resolve($);let Z=`<default>:${process.cwd()}`,Y=$9.get(Z);if(Y!==void 0)return Y;let X=await XB();return $9.set(Z,X),X}async function XB(){let $=await B5(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return H$.resolve(Z,Y);for(let X of ZB){let Q=H$.resolve(Z,X);try{let J=new Bun.Glob("**/*.ts");for await(let G of J.scan({cwd:Q,absolute:!0}))if(!GJ(G))return Q}catch{}}return null}async function JB($){let Z=await YB($);if(!Z)return null;let Y=M5.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let _=new Bun.Glob("**/*.ts");for await(let B of _.scan({cwd:Z,absolute:!0})){if(GJ(B))continue;X.push(B)}}catch{return M5.set(Z,""),null}if(X.length===0)return M5.set(Z,""),null;X.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()}),J=[],G=new Set,K=new Set;for(let _ of X)try{let B=await Bun.file(_).text(),H=H$.basename(_,".ts");for(let L of B.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of Q.scan(B).exports)if(L!=="default")G.add(L)}catch{}B=n0(B),B=B.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),B=B.replace(/^export\s+(default\s+)?/gm,""),B=Q.transformSync(B),J.push(`// Composable: ${H}
10669
+ ${B.trim()}`)}catch(B){console.warn(`[stx] Failed to load composable ${_}:`,B)}if(J.length===0||G.size===0)return M5.set(Z,""),null;let q=[...G].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
10663
10670
  `),W=JSON.stringify([...G]),U=J.join(`
10664
10671
 
10665
10672
  `),j=`;(function(){
10666
10673
  window.__composables = window.__composables || {};
10667
10674
  var __c = window.__composables;
10668
10675
  var __stx = window.stx || {};
10669
- ${P$.filter((_)=>!K.has(_)&&new RegExp(`\\b${_}\\b`).test(U)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
10676
+ ${v$.filter((_)=>!K.has(_)&&new RegExp(`\\b${_}\\b`).test(U)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
10670
10677
  `)}
10671
10678
  ${U}
10672
10679
  ${q}
@@ -10683,7 +10690,7 @@ ${q}
10683
10690
  }
10684
10691
  window[__n] = __c[__n];
10685
10692
  }
10686
- })();`;return N5.set(Z,j),j}function tj(){N5.clear(),a6.clear()}var N5,a6,oj;var YJ=k(()=>{B5();M1();c5();N5=new Map,a6=new Map,oj=["composables","functions"]});var JJ={};s(JJ,{processDeferDirectives:()=>XB});function ej(){return`stx-defer-${++XJ}`}function $B($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function ZB($,Z,Y){let{trigger:X,value:Q}=$B(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function YB($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
10693
+ })();`;return M5.set(Z,j),j}function QB(){M5.clear(),$9.clear()}var M5,$9,ZB;var qJ=k(()=>{_5();T1();i5();M5=new Map,$9=new Map,ZB=["composables","functions"]});var UJ={};s(UJ,{processDeferDirectives:()=>UB});function GB(){return`stx-defer-${++WJ}`}function KB($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function qB($,Z,Y){let{trigger:X,value:Q}=KB(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function WB($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
10687
10694
  const observer = new IntersectionObserver((entries) => {
10688
10695
  if (entries[0].isIntersecting) {
10689
10696
  observer.disconnect();
@@ -10756,7 +10763,7 @@ else {
10756
10763
  ${Q}
10757
10764
  })();
10758
10765
  </script>
10759
- `}function XB($,Z,Y){XJ=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=ej(),q=ZB(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",j=`<div data-defer-content style="display: none;">${q.content}</div>`,_=YB(K,q);return`
10766
+ `}function UB($,Z,Y){WJ=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=GB(),q=qB(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",j=`<div data-defer-content style="display: none;">${q.content}</div>`,_=WB(K,q);return`
10760
10767
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
10761
10768
  ${W}
10762
10769
  ${U}
@@ -10764,7 +10771,7 @@ else {
10764
10771
  ${z}
10765
10772
  </div>
10766
10773
  ${_}
10767
- `})}var XJ=0;var GJ={};s(GJ,{processTeleportDirectives:()=>KB,ensureTeleportTargets:()=>qB});function JB(){return`stx-teleport-${++QJ}`}function QB($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function GB($,Z){return`
10774
+ `})}var WJ=0;var jJ={};s(jJ,{processTeleportDirectives:()=>_B,ensureTeleportTargets:()=>HB});function zB(){return`stx-teleport-${++zJ}`}function jB($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function BB($,Z){return`
10768
10775
  <script>
10769
10776
  (function() {
10770
10777
  const source = document.getElementById('${$}');
@@ -10810,12 +10817,12 @@ else {
10810
10817
  });
10811
10818
  })();
10812
10819
  </script>
10813
- `}function KB($,Z,Y){QJ=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=JB(),{target:q,disabled:W}=QB(J),U=G.trim();if(W)try{let j=!1;if(W==="true")j=!0;else if(W==="false")j=!1;else if(W in Z)j=Boolean(Z[W]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=GB(K,q);return`
10820
+ `}function _B($,Z,Y){zJ=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=zB(),{target:q,disabled:W}=jB(J),U=G.trim();if(W)try{let j=!1;if(W==="true")j=!0;else if(W==="false")j=!1;else if(W in Z)j=Boolean(Z[W]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=BB(K,q);return`
10814
10821
  <div id="${K}" class="stx-teleport-source" style="display: none;">
10815
10822
  <template>${U}</template>
10816
10823
  </div>
10817
10824
  ${z}
10818
- `})}function qB(){return`
10825
+ `})}function HB(){return`
10819
10826
  <script>
10820
10827
  (function() {
10821
10828
  // Common teleport targets
@@ -10832,7 +10839,7 @@ else {
10832
10839
  });
10833
10840
  })();
10834
10841
  </script>
10835
- `}var QJ=0;var UJ={};s(UJ,{processTransitionDirectives:()=>jB,processTransitionAttributes:()=>OB,performLeave:()=>zB,performEnter:()=>UB,generateTransitionRuntime:()=>HB,generateTransitionCSS:()=>_B});function KJ($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function WB($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function qJ($,Z){return new Promise((Y)=>{let X=Z??WB($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function WJ($){$.offsetHeight}async function UB($,Z={}){let Y=Z.name||"stx",X=KJ(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),WJ($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await qJ($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function zB($,Z={}){let Y=Z.name||"stx",X=KJ(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),WJ($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await qJ($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function jB($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=BB(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10842
+ `}var zJ=0;var OJ={};s(OJ,{processTransitionDirectives:()=>VB,processTransitionAttributes:()=>NB,performLeave:()=>FB,performEnter:()=>LB,generateTransitionRuntime:()=>RB,generateTransitionCSS:()=>AB});function BJ($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function OB($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function _J($,Z){return new Promise((Y)=>{let X=Z??OB($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function HJ($){$.offsetHeight}async function LB($,Z={}){let Y=Z.name||"stx",X=BJ(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),HJ($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await _J($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function FB($,Z={}){let Y=Z.name||"stx",X=BJ(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),HJ($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await _J($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function VB($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=wB(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10836
10843
  <div
10837
10844
  class="stx-transition-wrapper"
10838
10845
  data-transition="${q}"
@@ -10874,7 +10881,7 @@ else {
10874
10881
  });
10875
10882
  })();
10876
10883
  </script>
10877
- `})}function BB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function _B(){return`
10884
+ `})}function wB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function AB(){return`
10878
10885
  /* STX Transition Presets */
10879
10886
 
10880
10887
  /* Fade */
@@ -11061,7 +11068,7 @@ else {
11061
11068
  opacity: 1;
11062
11069
  max-height: 1000px;
11063
11070
  }
11064
- `}function HB(){return`
11071
+ `}function RB(){return`
11065
11072
  // STX Transition Runtime
11066
11073
  (function() {
11067
11074
  if (typeof window === 'undefined') return;
@@ -11150,7 +11157,7 @@ else {
11150
11157
 
11151
11158
  console.log('[stx] Transition runtime initialized');
11152
11159
  })();
11153
- `}function OB($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var jJ={};s(jJ,{withErrorBoundary:()=>zJ,processErrorBoundaryDirectives:()=>VB,generateErrorBoundaryRuntime:()=>TB,generateErrorBoundaryCSS:()=>NB,createErrorBoundary:()=>RB});function FB(){return`eb-${++LB}-${Date.now().toString(36)}`}function VB($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=FB(),W=wB(J||"");return AB(q,G.trim(),K.trim(),W)})}function wB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function AB($,Z,Y,X){let Q=X.logErrors!==!1;return`
11160
+ `}function NB($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var FJ={};s(FJ,{withErrorBoundary:()=>LJ,processErrorBoundaryDirectives:()=>IB,generateErrorBoundaryRuntime:()=>SB,generateErrorBoundaryCSS:()=>bB,createErrorBoundary:()=>kB});function TB(){return`eb-${++MB}-${Date.now().toString(36)}`}function IB($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=TB(),W=DB(J||"");return EB(q,G.trim(),K.trim(),W)})}function DB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function EB($,Z,Y,X){let Q=X.logErrors!==!1;return`
11154
11161
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
11155
11162
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
11156
11163
  ${Z}
@@ -11270,7 +11277,7 @@ else {
11270
11277
  };
11271
11278
  })();
11272
11279
  </script>
11273
- `}async function zJ($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function RB($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>zJ(X,$,Y)}function NB(){return`
11280
+ `}async function LJ($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function kB($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>LJ(X,$,Y)}function bB(){return`
11274
11281
  /* STX Error Boundary Styles */
11275
11282
  .stx-error-boundary {
11276
11283
  position: relative;
@@ -11314,7 +11321,7 @@ else {
11314
11321
  color: #fecaca;
11315
11322
  }
11316
11323
  }
11317
- `}function TB(){return`
11324
+ `}function SB(){return`
11318
11325
  // STX Error Boundary Runtime
11319
11326
  (function() {
11320
11327
  if (typeof window === 'undefined') return;
@@ -11379,7 +11386,7 @@ else {
11379
11386
 
11380
11387
  console.log('[stx] Error boundary runtime initialized');
11381
11388
  })();
11382
- `}var LB=0;var BJ={};s(BJ,{renderSSRSuspense:()=>SB,processSuspenseDirectives:()=>DB,generateSuspenseRuntime:()=>PB,generateSuspenseCSS:()=>yB,createSSRSuspense:()=>bB});function IB(){return`suspense-${++MB}-${Date.now().toString(36)}`}function DB($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=IB(),W=EB(J||"");return kB(q,G.trim(),K.trim(),W)})}function EB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function kB($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
11389
+ `}var MB=0;var VJ={};s(VJ,{renderSSRSuspense:()=>gB,processSuspenseDirectives:()=>CB,generateSuspenseRuntime:()=>dB,generateSuspenseCSS:()=>hB,createSSRSuspense:()=>fB});function PB(){return`suspense-${++yB}-${Date.now().toString(36)}`}function CB($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=PB(),W=vB(J||"");return xB(q,G.trim(),K.trim(),W)})}function vB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function xB($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
11383
11390
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
11384
11391
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
11385
11392
  ${Y}
@@ -11569,7 +11576,7 @@ else {
11569
11576
  }, 0);
11570
11577
  })();
11571
11578
  </script>
11572
- `}function bB($,Z,Y){return{id:$,fallback:Y,content:Z}}async function SB($){let Z=$.map((X)=>`
11579
+ `}function fB($,Z,Y){return{id:$,fallback:Y,content:Z}}async function gB($){let Z=$.map((X)=>`
11573
11580
  <div id="stx-ssr-suspense-${X.id}" class="stx-ssr-suspense">
11574
11581
  ${X.fallback}
11575
11582
  </div>
@@ -11594,7 +11601,7 @@ else {
11594
11601
  }
11595
11602
  })();
11596
11603
  </script>
11597
- `}}return{initial:Z,streaming:Y()}}function yB(){return`
11604
+ `}}return{initial:Z,streaming:Y()}}function hB(){return`
11598
11605
  /* STX Suspense Styles */
11599
11606
  .stx-suspense {
11600
11607
  position: relative;
@@ -11650,7 +11657,7 @@ else {
11650
11657
  background-size: 200% 100%;
11651
11658
  }
11652
11659
  }
11653
- `}function PB(){return`
11660
+ `}function dB(){return`
11654
11661
  // STX Suspense Runtime
11655
11662
  (function() {
11656
11663
  if (typeof window === 'undefined') return;
@@ -11717,7 +11724,7 @@ else {
11717
11724
 
11718
11725
  console.log('[stx] Suspense runtime initialized');
11719
11726
  })();
11720
- `}var MB=0;var LJ={};s(LJ,{processAsyncDirectives:()=>vB,isAsyncComponent:()=>fB,generateAsyncComponentRuntime:()=>hB,generateAsyncComponentCSS:()=>gB,defineAsyncComponent:()=>xB});function _J(){return`async-${++CB}-${Date.now().toString(36)}`}function vB($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=_J(),z=HJ(K);return OJ(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=_J(),U=HJ(K);return OJ(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function HJ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function OJ($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
11727
+ `}var yB=0;var NJ={};s(NJ,{processAsyncDirectives:()=>uB,isAsyncComponent:()=>pB,generateAsyncComponentRuntime:()=>iB,generateAsyncComponentCSS:()=>cB,defineAsyncComponent:()=>lB});function wJ(){return`async-${++mB}-${Date.now().toString(36)}`}function uB($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=wJ(),z=AJ(K);return RJ(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=wJ(),U=AJ(K);return RJ(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function AJ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function RJ($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
11721
11728
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
11722
11729
  <div class="stx-async-loading" data-async-loading="${$}">
11723
11730
  ${Y}
@@ -11944,7 +11951,7 @@ catch (error) {
11944
11951
  loadComponent();
11945
11952
  })();
11946
11953
  </script>
11947
- `}function xB($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function fB($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function gB(){return`
11954
+ `}function lB($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function pB($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function cB(){return`
11948
11955
  /* STX Async Component Styles */
11949
11956
  .stx-async-component {
11950
11957
  position: relative;
@@ -12018,7 +12025,7 @@ catch (error) {
12018
12025
  background-size: 200% 100%;
12019
12026
  }
12020
12027
  }
12021
- `}function hB(){return`
12028
+ `}function iB(){return`
12022
12029
  // STX Async Component Runtime
12023
12030
  (function() {
12024
12031
  if (typeof window === 'undefined') return;
@@ -12072,7 +12079,7 @@ catch (error) {
12072
12079
 
12073
12080
  console.log('[stx] Async component runtime initialized');
12074
12081
  })();
12075
- `}var CB=0;var VJ={};s(VJ,{shouldCacheComponent:()=>cB,processKeepAliveDirectives:()=>mB,onDeactivated:()=>sB,onActivated:()=>oB,generateKeepAliveRuntime:()=>nB,generateKeepAliveCSS:()=>iB,createKeepAliveCache:()=>pB});function FJ(){return`keep-alive-${++dB}-${Date.now().toString(36)}`}function mB($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=FJ(),q=uB(J||"");return lB(K,G.trim(),q)})}function uB($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function lB($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
12082
+ `}var mB=0;var TJ={};s(TJ,{shouldCacheComponent:()=>tB,processKeepAliveDirectives:()=>oB,onDeactivated:()=>Y_,onActivated:()=>Z_,generateKeepAliveRuntime:()=>$_,generateKeepAliveCSS:()=>eB,createKeepAliveCache:()=>aB});function MJ(){return`keep-alive-${++nB}-${Date.now().toString(36)}`}function oB($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=MJ(),q=sB(J||"");return rB(K,G.trim(),q)})}function sB($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function rB($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
12076
12083
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
12077
12084
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
12078
12085
  ${Z}
@@ -12359,7 +12366,7 @@ else {
12359
12366
  });
12360
12367
  })();
12361
12368
  </script>
12362
- `}function pB($={}){return{id:$.id||FJ(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function cB($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function iB(){return`
12369
+ `}function aB($={}){return{id:$.id||MJ(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function tB($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function eB(){return`
12363
12370
  /* STX Keep-Alive Styles */
12364
12371
  .stx-keep-alive {
12365
12372
  position: relative;
@@ -12384,7 +12391,7 @@ else {
12384
12391
  .stx-keep-alive-content > [data-activated] {
12385
12392
  opacity: 1;
12386
12393
  }
12387
- `}function nB(){return`
12394
+ `}function $_(){return`
12388
12395
  // STX Keep-Alive Runtime
12389
12396
  (function() {
12390
12397
  if (typeof window === 'undefined') return;
@@ -12420,7 +12427,7 @@ else {
12420
12427
 
12421
12428
  console.log('[stx] Keep-alive runtime initialized');
12422
12429
  })();
12423
- `}function oB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function sB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var dB=0;var TJ={};s(TJ,{useVirtualList:()=>AJ,processVirtualListDirectives:()=>e6,processVirtualGridDirectives:()=>NJ,processInfiniteListDirectives:()=>RJ,generateVirtualListCSS:()=>wJ,default:()=>rB,createVirtualList:()=>t6});function t6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function j(){if(G)return _();let N=Math.max(0,Math.floor(U/Y)-Q),R=Math.ceil(X/Y),T=Math.min(W.length-1,N+R+Q*2);return{startIndex:N,endIndex:T}}function _(){let N=0,R=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(N+I>U){R=Math.max(0,M-Q);break}N+=I}N=0;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(N+=I,N>U+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:R,endIndex:T}}function B(){if(G){let N=0;for(let R=0;R<W.length;R++)N+=z.get(R)||K;return N}return W.length*Y}function H(N){if(G){let R=0;for(let T=0;T<N;T++)R+=z.get(T)||K;return R}return N*Y}function L(){let{startIndex:N,endIndex:R}=j();return{startIndex:N,endIndex:R,scrollTop:U,totalHeight:B(),visibleItems:W.slice(N,R+1),itemHeights:new Map(z)}}function F(N,R="auto"){let T=H(N);O(T,R)}function O(N,R="auto"){U=Math.max(0,Math.min(N,B()-X))}function V(){j()}function w(N){W=[...N],z.clear(),V()}function A(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function e6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,B=0,H=Math.min(W.length-1,j+_),L="";for(let O=B;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
12430
+ `}function Z_($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function Y_($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var nB=0;var bJ={};s(bJ,{useVirtualList:()=>DJ,processVirtualListDirectives:()=>Y9,processVirtualGridDirectives:()=>kJ,processInfiniteListDirectives:()=>EJ,generateVirtualListCSS:()=>IJ,default:()=>X_,createVirtualList:()=>Z9});function Z9($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function j(){if(G)return _();let N=Math.max(0,Math.floor(U/Y)-Q),R=Math.ceil(X/Y),M=Math.min(W.length-1,N+R+Q*2);return{startIndex:N,endIndex:M}}function _(){let N=0,R=0,M=W.length-1;for(let T=0;T<W.length;T++){let I=z.get(T)||K;if(N+I>U){R=Math.max(0,T-Q);break}N+=I}N=0;for(let T=0;T<W.length;T++){let I=z.get(T)||K;if(N+=I,N>U+X){M=Math.min(W.length-1,T+Q);break}}return{startIndex:R,endIndex:M}}function B(){if(G){let N=0;for(let R=0;R<W.length;R++)N+=z.get(R)||K;return N}return W.length*Y}function H(N){if(G){let R=0;for(let M=0;M<N;M++)R+=z.get(M)||K;return R}return N*Y}function L(){let{startIndex:N,endIndex:R}=j();return{startIndex:N,endIndex:R,scrollTop:U,totalHeight:B(),visibleItems:W.slice(N,R+1),itemHeights:new Map(z)}}function F(N,R="auto"){let M=H(N);O(M,R)}function O(N,R="auto"){U=Math.max(0,Math.min(N,B()-X))}function V(){j()}function w(N){W=[...N],z.clear(),V()}function A(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function Y9($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,B=0,H=Math.min(W.length-1,j+_),L="";for(let O=B;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
12424
12431
  <div class="virtual-item ${U.itemClass||""}"
12425
12432
  style="position: absolute; top: ${O*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
12426
12433
  data-index="${O}">
@@ -12497,7 +12504,7 @@ else {
12497
12504
  };
12498
12505
  })();
12499
12506
  </script>
12500
- `})}function wJ(){return`
12507
+ `})}function IJ(){return`
12501
12508
  .virtual-list-container {
12502
12509
  position: relative;
12503
12510
  overflow-y: auto;
@@ -12545,7 +12552,7 @@ else {
12545
12552
  0% { background-position: 200% 0; }
12546
12553
  100% { background-position: -200% 0; }
12547
12554
  }
12548
- `}function AJ($,Z){let Y=null,X=()=>{if(!Y)Y=t6($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function RJ($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.trim(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();z={...z,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,_=e6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
12555
+ `}function DJ($,Z){let Y=null,X=()=>{if(!Y)Y=Z9($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function EJ($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.trim(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();z={...z,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,_=Y9(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
12549
12556
  // Infinite scroll detection
12550
12557
  container.addEventListener('scroll', function() {
12551
12558
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -12563,11 +12570,11 @@ else {
12563
12570
  ${q}
12564
12571
  </div>
12565
12572
  </div>
12566
- `})}function NJ($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();U={...U,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(W.length/U.columns),_=j*(U.rowHeight+(U.gap||0)),B=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(j-1,B+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<U.columns;w++){let A=V*U.columns+w;if(A>=W.length)break;let N=W[A],R=w*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof N==="object"&&N!==null)return String(N[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
12573
+ `})}function kJ($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();U={...U,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(W.length/U.columns),_=j*(U.rowHeight+(U.gap||0)),B=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(j-1,B+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<U.columns;w++){let A=V*U.columns+w;if(A>=W.length)break;let N=W[A],R=w*(100/U.columns),M=V*(U.rowHeight+(U.gap||0)),T=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof N==="object"&&N!==null)return String(N[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
12567
12574
  <div class="virtual-grid-item"
12568
- style="position: absolute; top: ${T}px; left: ${R}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
12575
+ style="position: absolute; top: ${M}px; left: ${R}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
12569
12576
  data-index="${A}">
12570
- ${M}
12577
+ ${T}
12571
12578
  </div>`}return`
12572
12579
  <div id="${z}"
12573
12580
  class="virtual-grid-container"
@@ -12633,7 +12640,7 @@ else {
12633
12640
  });
12634
12641
  })();
12635
12642
  </script>
12636
- `})}var rB;var MJ=k(()=>{rB={createVirtualList:t6,processVirtualListDirectives:e6,processInfiniteListDirectives:RJ,processVirtualGridDirectives:NJ,generateVirtualListCSS:wJ,useVirtualList:AJ}});function IJ(){return`<script data-stx-hydration-runtime>
12643
+ `})}var X_;var SJ=k(()=>{X_={createVirtualList:Z9,processVirtualListDirectives:Y9,processInfiniteListDirectives:EJ,processVirtualGridDirectives:kJ,generateVirtualListCSS:IJ,useVirtualList:DJ}});function yJ(){return`<script data-stx-hydration-runtime>
12637
12644
  (function() {
12638
12645
  'use strict';
12639
12646
 
@@ -12793,7 +12800,7 @@ else {
12793
12800
  stxIslands.initIslands();
12794
12801
  }
12795
12802
  })();
12796
- </script>`}function DJ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function EJ($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var hJ={};s(hJ,{processStaticDirectives:()=>fJ,processPartialHydrationDirectives:()=>bJ,onHydrated:()=>xJ,isHydrated:()=>vJ,hydrateIsland:()=>yJ,hydrateByStrategy:()=>PJ,hydrateAll:()=>CJ,generatePartialHydrationCSS:()=>SJ,generateIslandManifest:()=>gJ,default:()=>J_,createIslandRegistry:()=>kJ});function kJ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function aB($){return`
12803
+ </script>`}function PJ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function CJ($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var cJ={};s(cJ,{processStaticDirectives:()=>lJ,processPartialHydrationDirectives:()=>xJ,onHydrated:()=>uJ,isHydrated:()=>mJ,hydrateIsland:()=>gJ,hydrateByStrategy:()=>hJ,hydrateAll:()=>dJ,generatePartialHydrationCSS:()=>fJ,generateIslandManifest:()=>pJ,default:()=>z_,createIslandRegistry:()=>vJ});function vJ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function J_($){return`
12797
12804
  <script data-hydrate="${$}">
12798
12805
  (function() {
12799
12806
  const island = document.querySelector('[data-island="${$}"]');
@@ -12804,7 +12811,7 @@ else {
12804
12811
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
12805
12812
  })();
12806
12813
  </script>
12807
- `}function tB($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
12814
+ `}function Q_($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
12808
12815
  <script data-hydrate="${$}">
12809
12816
  (function() {
12810
12817
  const island = document.querySelector('[data-island="${$}"]');
@@ -12840,7 +12847,7 @@ else {
12840
12847
  }
12841
12848
  })();
12842
12849
  </script>
12843
- `}function eB($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
12850
+ `}function G_($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
12844
12851
  <script data-hydrate="${$}">
12845
12852
  (function() {
12846
12853
  const island = document.querySelector('[data-island="${$}"]');
@@ -12873,7 +12880,7 @@ else {
12873
12880
  }
12874
12881
  })();
12875
12882
  </script>
12876
- `}function $_($,Z){let Y=Z.media||"(min-width: 768px)";return`
12883
+ `}function K_($,Z){let Y=Z.media||"(min-width: 768px)";return`
12877
12884
  <script data-hydrate="${$}">
12878
12885
  (function() {
12879
12886
  const island = document.querySelector('[data-island="${$}"]');
@@ -12902,7 +12909,7 @@ else {
12902
12909
  }
12903
12910
  })();
12904
12911
  </script>
12905
- `}function Z_($){return`
12912
+ `}function q_($){return`
12906
12913
  <script data-hydrate="${$}">
12907
12914
  (function() {
12908
12915
  const island = document.querySelector('[data-island="${$}"]');
@@ -12924,7 +12931,7 @@ else {
12924
12931
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
12925
12932
  })();
12926
12933
  </script>
12927
- `}function Y_($,Z){let Y=Z.event||"stx:activate";return`
12934
+ `}function W_($,Z){let Y=Z.event||"stx:activate";return`
12928
12935
  <script data-hydrate="${$}">
12929
12936
  (function() {
12930
12937
  const island = document.querySelector('[data-island="${$}"]');
@@ -12945,9 +12952,9 @@ else {
12945
12952
  });
12946
12953
  })();
12947
12954
  </script>
12948
- `}function bJ($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=T5(X,"load",Z),X=T5(X,"idle",Z),X=T5(X,"visible",Z),X=T5(X,"media",Z),X=X_(X),X=T5(X,"hover",Z),X=T5(X,"event",Z),Q=J&&X!==$,Q)X+=`
12949
- `+IJ();return X}function T5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=DJ(G.trim()),U=EJ(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(W)z.push(`data-component="${W}"`);let _=Object.keys(U).length>0?`
12950
- <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",B="";switch(Z){case"load":B=aB(q);break;case"idle":B=tB(q,K);break;case"visible":B=eB(q,K);break;case"media":B=$_(q,K);break;case"hover":B=Z_(q);break;case"event":B=Y_(q,K);break}return`
12955
+ `}function xJ($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=T5(X,"load",Z),X=T5(X,"idle",Z),X=T5(X,"visible",Z),X=T5(X,"media",Z),X=U_(X),X=T5(X,"hover",Z),X=T5(X,"event",Z),Q=J&&X!==$,Q)X+=`
12956
+ `+yJ();return X}function T5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=PJ(G.trim()),U=CJ(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(W)z.push(`data-component="${W}"`);let _=Object.keys(U).length>0?`
12957
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",B="";switch(Z){case"load":B=J_(q);break;case"idle":B=Q_(q,K);break;case"visible":B=G_(q,K);break;case"media":B=K_(q,K);break;case"hover":B=q_(q);break;case"event":B=W_(q,K);break}return`
12951
12958
  <div data-island="${q}"
12952
12959
  data-strategy="${Z}"
12953
12960
  ${z.join(`
@@ -12957,7 +12964,7 @@ else {
12957
12964
  ${G.trim()}${_}
12958
12965
  </div>
12959
12966
  ${B}
12960
- `})}function X_($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
12967
+ `})}function U_($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
12961
12968
  <div data-island="${Q}"
12962
12969
  data-strategy="only"
12963
12970
  class="stx-island stx-client-only">
@@ -12976,7 +12983,7 @@ else {
12976
12983
  }
12977
12984
  })();
12978
12985
  </script>
12979
- `})}function SJ(){return`
12986
+ `})}function fJ(){return`
12980
12987
  /* Island base styles */
12981
12988
  .stx-island {
12982
12989
  display: contents;
@@ -13017,11 +13024,11 @@ else {
13017
13024
  .stx-island.hydrated {
13018
13025
  opacity: 1;
13019
13026
  }
13020
- `}function yJ($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function PJ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function CJ(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function vJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function xJ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function fJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function gJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
13027
+ `}function gJ($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function hJ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function dJ(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function mJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function uJ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function lJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function pJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
13021
13028
  <script type="application/json" id="stx-island-manifest">
13022
13029
  ${JSON.stringify(Z)}
13023
13030
  </script>
13024
- `}var J_;var dJ=k(()=>{J_={processPartialHydrationDirectives:bJ,processStaticDirectives:fJ,generatePartialHydrationCSS:SJ,generateIslandManifest:gJ,createIslandRegistry:kJ,hydrateIsland:yJ,hydrateByStrategy:PJ,hydrateAll:CJ,isHydrated:vJ,onHydrated:xJ}});var aJ={};s(aJ,{watchMultiple:()=>cJ,watchEffect:()=>iJ,watch:()=>pJ,unref:()=>mJ,toRefs:()=>uJ,throttledComputed:()=>rJ,stxWatchMultiple:()=>cJ,stxWatchEffect:()=>iJ,stxWatch:()=>pJ,stxUnref:()=>mJ,stxToRefs:()=>uJ,stxThrottledComputed:()=>rJ,stxShallowRef:()=>lJ,stxRef:()=>M5,stxIsRef:()=>A1,stxDebouncedComputed:()=>sJ,stxComputed:()=>O$,shallowRef:()=>lJ,ref:()=>M5,processWatchDirectives:()=>oJ,processComputedDirectives:()=>nJ,isRef:()=>A1,default:()=>Q_,debouncedComputed:()=>sJ,computed:()=>O$});function M5($){let Z=$,Y=new Set,X={get value(){if($1){let Q=H$.get(X);if(!Q)Q=new Set,H$.set(X,Q);Q.add($1)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=H$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function A1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function mJ($){return A1($)?$.value:$}function uJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=M5($[Y]);return Z}function lJ($){return M5($)}function O$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let j=z.value;q.forEach((_)=>_(j))}};function U(){K.clear();let j=$1;$1=W,W7.push(W);try{return Y()}finally{W7.pop(),$1=j}}let z={get value(){if($1){let j=H$.get(z);if(!j)j=new Set,H$.set(z,j);j.add($1)}if(G){let j=U();if(!Q(J,j))J=j;G=!1}return J},set value(j){if(X)X(j);else console.warn("Computed property is readonly")},subscribe(j){return q.add(j),()=>q.delete(j)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function pJ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(A1($))return Q?c1($.value):$.value;return $()},z=()=>{if(!q||W)return;let B=U();if(K!==void 0&&Object.is(K,B)&&!Q)return;let H=()=>{if(Z(B,K),K=Q?c1(B):B,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},j=null;if(A1($))j=$.subscribe(()=>z());else j=O$($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let _=()=>{if(q=!1,j)j(),j=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function cJ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>A1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((j)=>A1(j)?j.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(A1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function iJ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=$1;$1=G,W7.push(G);try{X=$()}finally{W7.pop(),$1=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function nJ($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function oJ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
13031
+ `}var z_;var iJ=k(()=>{z_={processPartialHydrationDirectives:xJ,processStaticDirectives:lJ,generatePartialHydrationCSS:fJ,generateIslandManifest:pJ,createIslandRegistry:vJ,hydrateIsland:gJ,hydrateByStrategy:hJ,hydrateAll:dJ,isHydrated:mJ,onHydrated:uJ}});var XQ={};s(XQ,{watchMultiple:()=>aJ,watchEffect:()=>tJ,watch:()=>rJ,unref:()=>nJ,toRefs:()=>oJ,throttledComputed:()=>YQ,stxWatchMultiple:()=>aJ,stxWatchEffect:()=>tJ,stxWatch:()=>rJ,stxUnref:()=>nJ,stxToRefs:()=>oJ,stxThrottledComputed:()=>YQ,stxShallowRef:()=>sJ,stxRef:()=>I5,stxIsRef:()=>R1,stxDebouncedComputed:()=>ZQ,stxComputed:()=>L$,shallowRef:()=>sJ,ref:()=>I5,processWatchDirectives:()=>$Q,processComputedDirectives:()=>eJ,isRef:()=>R1,default:()=>j_,debouncedComputed:()=>ZQ,computed:()=>L$});function I5($){let Z=$,Y=new Set,X={get value(){if($1){let Q=O$.get(X);if(!Q)Q=new Set,O$.set(X,Q);Q.add($1)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=O$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function R1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function nJ($){return R1($)?$.value:$}function oJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=I5($[Y]);return Z}function sJ($){return I5($)}function L$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let j=z.value;q.forEach((_)=>_(j))}};function U(){K.clear();let j=$1;$1=W,z7.push(W);try{return Y()}finally{z7.pop(),$1=j}}let z={get value(){if($1){let j=O$.get(z);if(!j)j=new Set,O$.set(z,j);j.add($1)}if(G){let j=U();if(!Q(J,j))J=j;G=!1}return J},set value(j){if(X)X(j);else console.warn("Computed property is readonly")},subscribe(j){return q.add(j),()=>q.delete(j)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function rJ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(R1($))return Q?c1($.value):$.value;return $()},z=()=>{if(!q||W)return;let B=U();if(K!==void 0&&Object.is(K,B)&&!Q)return;let H=()=>{if(Z(B,K),K=Q?c1(B):B,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},j=null;if(R1($))j=$.subscribe(()=>z());else j=L$($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let _=()=>{if(q=!1,j)j(),j=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function aJ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>R1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((j)=>R1(j)?j.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(R1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function tJ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=$1;$1=G,z7.push(G);try{X=$()}finally{z7.pop(),$1=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function eJ($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function $Q($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
13025
13032
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
13026
13033
  (function() {
13027
13034
  // Watch implementation for ${J}
@@ -13033,9 +13040,9 @@ else {
13033
13040
  }
13034
13041
  })();
13035
13042
  </script>
13036
- `})}function c1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>c1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(c1(Q),c1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(c1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=c1($[Y]);return Z}function sJ($,Z=100){let Y=M5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return O$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function rJ($,Z=100){let Y=M5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return O$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var $1=null,W7,H$,Q_;var tJ=k(()=>{W7=[],H$=new WeakMap;Q_={ref:M5,computed:O$,watch:pJ,watchMultiple:cJ,watchEffect:iJ,isRef:A1,unref:mJ,toRefs:uJ,shallowRef:lJ,debouncedComputed:sJ,throttledComputed:rJ,processComputedDirectives:nJ,processWatchDirectives:oJ}});var YQ={};s(YQ,{v:()=>G_,processHasErrorsDirective:()=>ZQ,processFormValidationDirectives:()=>q_,processErrorsDirective:()=>$Q,processErrorDirective:()=>eJ,defineForm:()=>K_,Validator:()=>I5});class I5{rules=[];defaultValue="";addRule($){let Z=new I5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new I5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new I5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function K_($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function j(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function B(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)J[A]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:j,setFieldValue:_,setFieldTouched:B,getFieldState:H,handleSubmit:L}}function eJ($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
13037
- `)}catch{return""}})}function $Q($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
13038
- `)}catch{return""}})}function ZQ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function q_($,Z,Y){let X=$;return X=eJ(X,Z,Y),X=$Q(X,Z,Y),X=ZQ(X,Z,Y),X}var G_;var XQ=k(()=>{G_=new I5});var GQ={};s(GQ,{processXElementDirectives:()=>W_,hasXElementDirectives:()=>QQ,generateXElementRuntime:()=>JQ});function JQ(){return`<script data-stx-scoped data-stx-x-element-runtime>
13043
+ `})}function c1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>c1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(c1(Q),c1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(c1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=c1($[Y]);return Z}function ZQ($,Z=100){let Y=I5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return L$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function YQ($,Z=100){let Y=I5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return L$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var $1=null,z7,O$,j_;var JQ=k(()=>{z7=[],O$=new WeakMap;j_={ref:I5,computed:L$,watch:rJ,watchMultiple:aJ,watchEffect:tJ,isRef:R1,unref:nJ,toRefs:oJ,shallowRef:sJ,debouncedComputed:ZQ,throttledComputed:YQ,processComputedDirectives:eJ,processWatchDirectives:$Q}});var qQ={};s(qQ,{v:()=>B_,processHasErrorsDirective:()=>KQ,processFormValidationDirectives:()=>H_,processErrorsDirective:()=>GQ,processErrorDirective:()=>QQ,defineForm:()=>__,Validator:()=>D5});class D5{rules=[];defaultValue="";addRule($){let Z=new D5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new D5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new D5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function __($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function j(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function B(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)J[A]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:j,setFieldValue:_,setFieldTouched:B,getFieldState:H,handleSubmit:L}}function QQ($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
13044
+ `)}catch{return""}})}function GQ($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
13045
+ `)}catch{return""}})}function KQ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function H_($,Z,Y){let X=$;return X=QQ(X,Z,Y),X=GQ(X,Z,Y),X=KQ(X,Z,Y),X}var B_;var WQ=k(()=>{B_=new D5});var jQ={};s(jQ,{processXElementDirectives:()=>O_,hasXElementDirectives:()=>zQ,generateXElementRuntime:()=>UQ});function UQ(){return`<script data-stx-scoped data-stx-x-element-runtime>
13039
13046
  (function() {
13040
13047
  'use strict';
13041
13048
 
@@ -13319,45 +13326,45 @@ else {
13319
13326
  // Expose for manual initialization
13320
13327
  window.XElement = XElement;
13321
13328
  })();
13322
- </script>`}function QQ($){return/\bx-data(?:\s|=)/.test($)}function W_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],X=Y.length>0?$.replace(Z,""):$;if(!QQ(X))return X;let Q=Y[0]?.trim()||JQ(),J=X.lastIndexOf("</body>");if(J!==-1)return X.slice(0,J)+Q+`
13329
+ </script>`}function zQ($){return/\bx-data(?:\s|=)/.test($)}function O_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],X=Y.length>0?$.replace(Z,""):$;if(!zQ(X))return X;let Q=Y[0]?.trim()||UQ(),J=X.lastIndexOf("</body>");if(J!==-1)return X.slice(0,J)+Q+`
13323
13330
  `+X.slice(J);return X+`
13324
- `+Q}var KQ={};s(KQ,{rewriteImagesWithSiblings:()=>j_});import G1 from"path";async function j_($,Z){let Y=Z.formats??z_;if(!Z.publicDir)return $;let X=H_($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],j=z.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(O_(K.index,X))continue;G.push({idx:K.index,length:z.length,src:j[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let j=await B_(z.src,Z.publicDir,Y);return{match:z,sources:j}}));for(let{match:z,sources:j}of q){if(j.length===0)continue;let B=`<picture>${j.map((H)=>`<source type="${H.mime}" srcset="${L_(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:B})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function B_($,Z,Y){if(!__($))return[];let X=G1.extname($).toLowerCase();if(!U_.has(X))return[];if(!$.startsWith("/"))return[];let Q=G1.join(Z,$.slice(1)),J=G1.dirname(Q),G=G1.basename(Q,X),K=G1.resolve(J),q=G1.resolve(Z);if(!K.startsWith(q))return[];let W=G1.posix.dirname($),U=Y.map(async(j)=>{let _=G1.join(J,`${G}${j.ext}`);if(!await Bun.file(_).exists())return null;return{url:G1.posix.join(W,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(U)).filter((j)=>j!==null)}function __($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function H_($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function O_($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function L_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var U_,z_;var qQ=k(()=>{U_=new Set([".jpg",".jpeg",".png",".gif"]),z_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var jQ={};s(jQ,{validateClientScript:()=>K7,processOnceDirective:()=>G7,processJsonDirective:()=>Q7,processDirectives:()=>w0,injectRouterScript:()=>t8});import v0 from"path";import{deriveLayoutGroup as F_}from"stx-router/layout-metadata";function WQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function V_($,Z){let Y=$.length,X=Z,Q=!0,J=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
13331
+ `+Q}var BQ={};s(BQ,{rewriteImagesWithSiblings:()=>V_});import K1 from"path";async function V_($,Z){let Y=Z.formats??F_;if(!Z.publicDir)return $;let X=R_($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],j=z.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(N_(K.index,X))continue;G.push({idx:K.index,length:z.length,src:j[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let j=await w_(z.src,Z.publicDir,Y);return{match:z,sources:j}}));for(let{match:z,sources:j}of q){if(j.length===0)continue;let B=`<picture>${j.map((H)=>`<source type="${H.mime}" srcset="${M_(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:B})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function w_($,Z,Y){if(!A_($))return[];let X=K1.extname($).toLowerCase();if(!L_.has(X))return[];if(!$.startsWith("/"))return[];let Q=K1.join(Z,$.slice(1)),J=K1.dirname(Q),G=K1.basename(Q,X),K=K1.resolve(J),q=K1.resolve(Z);if(!K.startsWith(q))return[];let W=K1.posix.dirname($),U=Y.map(async(j)=>{let _=K1.join(J,`${G}${j.ext}`);if(!await Bun.file(_).exists())return null;return{url:K1.posix.join(W,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(U)).filter((j)=>j!==null)}function A_($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function R_($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function N_($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function M_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var L_,F_;var _Q=k(()=>{L_=new Set([".jpg",".jpeg",".png",".gif"]),F_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var FQ={};s(FQ,{validateClientScript:()=>W7,processOnceDirective:()=>q7,processJsonDirective:()=>K7,processDirectives:()=>V0,injectRouterScript:()=>JZ});import v0 from"path";import{deriveLayoutGroup as T_}from"stx-router/layout-metadata";function HQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function I_($,Z){let Y=$.length,X=Z,Q=!0,J=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
13325
13332
  `,X+2),X===-1)return-1;X+=1,Q=!0;continue}if(K==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Q=!0;continue}if(K==="/"&&Q){let q=X+1,W=!1;while(q<Y){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")W=!0;else if(U==="]")W=!1;else if(U==="/"&&!W){q++;break}else if(U===`
13326
13333
  `){q=-1;break}q++}if(q===-1){X++,Q=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;X=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
13327
- `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}function U7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,J=$.indexOf("</script>",Q);if(J===-1)return null;let G=$.indexOf(">",J);if(G===-1)return null;return{start:X.index,end:G+1}}function UQ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let J=$.indexOf("-->",Y+4);Z=J===-1?$.length:J+3;continue}let X=$.slice(Y),Q=/^<style\b[^>]*>/i.exec(X);if(Q){let J=$.toLowerCase().indexOf("</style>",Y+Q[0].length);Z=J===-1?$.length:J+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function w_($){let Z=U7($,"data-stx-runtime");if(!Z)return $;let Y=UQ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=UQ(Q);if(J===-1)return X+`
13334
+ `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}function j7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,J=$.indexOf("</script>",Q);if(J===-1)return null;let G=$.indexOf(">",J);if(G===-1)return null;return{start:X.index,end:G+1}}function OQ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let J=$.indexOf("-->",Y+4);Z=J===-1?$.length:J+3;continue}let X=$.slice(Y),Q=/^<style\b[^>]*>/i.exec(X);if(Q){let J=$.toLowerCase().indexOf("</style>",Y+Q[0].length);Z=J===-1?$.length:J+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function D_($){let Z=j7($,"data-stx-runtime");if(!Z)return $;let Y=OQ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=OQ(Q);if(J===-1)return X+`
13328
13335
  `+Q;return Q.slice(0,J)+X+`
13329
- `+Q.slice(J)}async function w0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!Y$()&&!b4())&&Y&&Y.endsWith(".stx"))U6($,Y);try{return await O8.timeAsync("template-processing",async()=>{let G=await A_($,Z,Y,X,Q);if(J)G=o6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??y7(),U=(Z.__stx_head_raw||"").trim(),z,j=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)z=j[1].trim(),U=U.replace(j[0],"").trim();let _=Z.__sections?.title,B=W.title||z||_,H={...K,...B&&{title:B},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
13330
- `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=n6(G);if(G=pX(G,H),L)G=lX(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=F_(V);G=G.replace("<head>",`<head>
13331
- <meta name="stx-layout" content="${WQ(V)}">
13332
- <meta name="stx-layout-group" content="${WQ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=uX(G),G=w_(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (eX(),tX)),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=U7(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
13333
- `+U+G.slice(z.end)}}catch{}if(J)try{let{getComposableScript:K}=await Promise.resolve().then(() => (YJ(),ZJ)),q=X.composablesDir,W=await K(q);if(W){let U=`<script data-stx-composables>${W}</script>`,z=U7(G,"data-stx-stores")||U7(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
13334
- `+U+G.slice(z.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await P2(G,void 0,X.buildMode==="serve");if(J)G=A8(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof C4)throw G;let K=G instanceof Error?G.message:String(G),q=new g1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(r0.log(q,{filePath:Y,context:Z}),h3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return f3.createFallbackContent("Template Processing",q)}}async function A_($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!v0.isAbsolute(X.partialsDir)?v0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!v0.isAbsolute(X.componentsDir)?v0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!v0.isAbsolute(X.layoutsDir)?v0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await T_(Y,Z),N_(Z,K),q=await U5(()=>DX(q,Z,Y,K),q,(O)=>{r0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=a0(q,m5,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>U[Number(w)]??""),j="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,j),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=gX(q),q=await nX(q,Y,Q);let _={};q=p6(q,_);let B={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",A=v0.dirname(Y),N=K.layoutsDir?v0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let T=v0.join(A,"_layout.stx");if(await c(T)){w=T;break}let M=v0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(w)H=w;else if(K.layoutsDir){let R=v0.isAbsolute(K.layoutsDir)?K.layoutsDir:v0.resolve(process.cwd(),K.layoutsDir),T=v0.join(R,`${K.defaultLayout}.stx`);if(await c(T))H=T}if(H&&!V)q=`@section('content')
13336
+ `+Q.slice(J)}async function V0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(J)e9(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!X$()&&!y4())&&Y&&Y.endsWith(".stx"))B6($,Y);try{return await R8.timeAsync("template-processing",async()=>{let G=await E_($,Z,Y,X,Q);if(J)G=a6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??v7(),U=(Z.__stx_head_raw||"").trim(),z,j=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)z=j[1].trim(),U=U.replace(j[0],"").trim();let _=Z.__sections?.title,B=W.title||z||_,H={...K,...B&&{title:B},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
13337
+ `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=r6(G);if(G=rX(G,H),L)G=sX(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=T_(V);G=G.replace("<head>",`<head>
13338
+ <meta name="stx-layout" content="${HQ(V)}">
13339
+ <meta name="stx-layout-group" content="${HQ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=oX(G),G=D_(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (QJ(),JJ)),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=j7(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
13340
+ `+U+G.slice(z.end)}}catch{}if(J)try{let{getComposableScript:K}=await Promise.resolve().then(() => (qJ(),KJ)),q=X.composablesDir,W=await K(q);if(W){let U=`<script data-stx-composables>${W}</script>`,z=j7(G,"data-stx-stores")||j7(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
13341
+ `+U+G.slice(z.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await h2(G,void 0,X.buildMode==="serve");if(J)G=D8(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof x4)throw G;let K=G instanceof Error?G.message:String(G),q=new g1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(r0.log(q,{filePath:Y,context:Z}),u3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return d3.createFallbackContent("Template Processing",q)}}async function E_($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!v0.isAbsolute(X.partialsDir)?v0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!v0.isAbsolute(X.componentsDir)?v0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!v0.isAbsolute(X.layoutsDir)?v0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await S_(Y,Z),b_(Z,K),q=await z5(()=>PX(q,Z,Y,K),q,(O)=>{r0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=a0(q,u5,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>U[Number(w)]??""),j="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,j),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=pX(q),q=await eX(q,Y,Q);let _={};q=n6(q,_);let B={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",A=v0.dirname(Y),N=K.layoutsDir?v0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let M=v0.join(A,"_layout.stx");if(await c(M)){w=M;break}let T=v0.dirname(A);if(T===A||T.length<N.length)break;A=T}if(w)H=w;else if(K.layoutsDir){let R=v0.isAbsolute(K.layoutsDir)?K.layoutsDir:v0.resolve(process.cwd(),K.layoutsDir),M=v0.join(R,`${K.defaultLayout}.stx`);if(await c(M))H=M}if(H&&!V)q=`@section('content')
13335
13342
  ${q.trim()}
13336
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return B[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=e(w.trim(),Z);if(A===void 0)return O;return B[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))B[V]=w.replace("@parent",i1);else B[V]=w.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return B[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=c6(q,_),H){let O=[],V=z1(q),w=a0(V.output,e1,(A,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(q=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,N,R)=>{let T=N==="SCRIPT"?V.scripts[Number(R)]:w.tokens[Number(R)];if(T)O.push(T);return""}),O.length>0){let A=O.join(`
13343
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return B[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=e(w.trim(),Z);if(A===void 0)return O;return B[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))B[V]=w.replace("@parent",i1);else B[V]=w.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return B[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=o6(q,_),H){let O=[],V=j1(q),w=a0(V.output,$5,(A,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(q=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,N,R)=>{let M=N==="SCRIPT"?V.scripts[Number(R)]:w.tokens[Number(R)];if(M)O.push(M);return""}),O.length>0){let A=O.join(`
13337
13344
  `);B.content=B.content?`${B.content}
13338
- ${A}`:A,Z.__sections=B}}if(H)try{let O;if(v0.isAbsolute(H))O=H,Q.add(H);else O=await U5(()=>$3(H,Y,G,Q),null,()=>{throw new g1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(r0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new g1(T,Y);return q}let V=await U5(()=>Bun.file(O).text(),"",()=>{throw new g1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,y,S)=>{return T[y]=S.trim(),""});for(let[D,y]of Object.entries(T))if(B[D]&&B[D].includes(i1)){let S=B[D].indexOf(i1);B[D]=B[D].slice(0,S)+y+B[D].slice(S+i1.length)}else if(!B[D])B[D]=y;let I={...Z,__sections:B},E=`@layout('${w[1]}')${M}`;return await w0(E,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=p6(A,_),R={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return R[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(B[M]){let E=B[M];if(E.includes(i1)){let D=R[M]||"",y=E.indexOf(i1);E=E.slice(0,y)+D+E.slice(y+i1.length)}return E}return I||""}),N=R_(N,B),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),N=c6(N,_),Z.__originalFilePath=Y,q=await zQ(N,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
13339
- ${q}`,z(q)}catch(O){return r0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await zQ(q,Z,Y,G,Q))}function R_($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function N_($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function T_($,Z){await U5(()=>yX($,Z),void 0,(Y)=>{r0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function M_($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (s5(),g$));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));r0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function I_($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (t0(),j8));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return r0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function zQ($,Z,Y,X,Q){let J=$,G=X;if(await M_(J,Z,Y),J=await I_(J,Z,Y),J=await AX(J,Z,Y),J=await RX(J,Z,Y),J=await HY(J,Z,Y,G),$5(J))J=o7(J,Z),J=r7(J,Z);J=s7(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (W6(),q6));J=K(J,Z),J=d6(J,Z,Y,G),J=await $7(J,Z,Y,G,Q),J=await dX(J,Z,Y,G,Q),J=y9(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => JJ);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => GJ);J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await Promise.resolve().then(() => UJ);J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:j}=await Promise.resolve().then(() => jJ);J=j(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => BJ);J=_(J,Z,Y);let{processAsyncDirectives:B}=await Promise.resolve().then(() => LJ);J=B(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => VJ);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (MJ(),TJ));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (dJ(),hJ));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (tJ(),aJ));J=A(J,Z,Y),J=N(J,Z,Y);let{processFormValidationDirectives:R}=await Promise.resolve().then(() => (XQ(),YQ));J=R(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:E}=await Promise.resolve().then(() => (n5(),C7));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=T(J);if(J=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
13340
- `;if(J=M(J,Z),J=I(J,Z),J=bX(J),J=s3(J,Z),J=BY(J),J=MX(J),J=await l6(J,Z,Y,G,Q),J=await $7(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=o6(J),J=m1(J,Z,Y),J=r3(J,Z),J=a3(J,Z),J=c4(J,Z),J=TY(J,Z),J=MY(J,Z),J=await ZY(J,Z,Y,G),J=await jZ(J,Z,Y),J=await bY(J,Z,Y,G),J=M9(J,Z,Y,G),J=F2(J,Z,Y,G),J=V2(J,Z,Y),J=w2(J,Z,Y,G),J=UY(J,Z,Y,G),J=Q7(J,Z),J=G7(J),J=sX(J),!G.skipEventDirectives)J=o2(J,Z,Y);if(J=e2(J,Z,Y),G.debug){let n=/\bx-data\s*=/.test(J),$0=$4($);if(n&&$0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
13345
+ ${A}`:A,Z.__sections=B}}if(H)try{let O;if(v0.isAbsolute(H))O=H,Q.add(H);else O=await z5(()=>X3(H,Y,G,Q),null,()=>{throw new g1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let M=`Layout not found: ${H} (referenced from ${Y})`;if(r0.log(Error(M),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new g1(M,Y);return q}let V=await z5(()=>Bun.file(O).text(),"",()=>{throw new g1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let M={},T=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,y,S)=>{return M[y]=S.trim(),""});for(let[D,y]of Object.entries(M))if(B[D]&&B[D].includes(i1)){let S=B[D].indexOf(i1);B[D]=B[D].slice(0,S)+y+B[D].slice(S+i1.length)}else if(!B[D])B[D]=y;let I={...Z,__sections:B},E=`@layout('${w[1]}')${T}`;return await V0(E,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=n6(A,_),R={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,T,I)=>{return R[T]=I.trim(),`@slot('${T}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,T,I)=>{if(B[T]){let E=B[T];if(E.includes(i1)){let D=R[T]||"",y=E.indexOf(i1);E=E.slice(0,y)+D+E.slice(y+i1.length)}return E}return I||""}),N=k_(N,B),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),N=o6(N,_),Z.__originalFilePath=Y,q=await LQ(N,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
13346
+ ${q}`,z(q)}catch(O){return r0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await LQ(q,Z,Y,G,Q))}function k_($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function b_($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function S_($,Z){await z5(()=>gX($,Z),void 0,(Y)=>{r0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function y_($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (r5(),d$));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));r0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function P_($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (t0(),F8));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return r0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function LQ($,Z,Y,X,Q){let J=$,G=X;if(await y_(J,Z,Y),J=await P_(J,Z,Y),J=await DX(J,Z,Y),J=await EX(J,Z,Y),J=await AY(J,Z,Y,G),Z5(J))J=a7(J,Z),J=e7(J,Z);J=t7(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (j6(),z6));J=K(J,Z),J=l6(J,Z,Y,G),J=await Y7(J,Z,Y,G,Q),J=await iX(J,Z,Y,G,Q),J=C9(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => UJ);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => jJ);J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await Promise.resolve().then(() => OJ);J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:j}=await Promise.resolve().then(() => FJ);J=j(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => VJ);J=_(J,Z,Y);let{processAsyncDirectives:B}=await Promise.resolve().then(() => NJ);J=B(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => TJ);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (SJ(),bJ));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (iJ(),cJ));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (JQ(),XQ));J=A(J,Z,Y),J=N(J,Z,Y);let{processFormValidationDirectives:R}=await Promise.resolve().then(() => (WQ(),qQ));J=R(J,Z,Y);let{processHeadDirective:M,processTitleDirective:T,processMetaDirective:I,resetHead:E}=await Promise.resolve().then(() => (o5(),f7));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=M(J);if(J=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
13347
+ `;if(J=T(J,Z),J=I(J,Z),J=xX(J),J=t3(J,Z),J=VY(J),J=SX(J),J=await i6(J,Z,Y,G,Q),J=await Y7(J,Z,Y,G,Q),Z.__stxProcessingDepth===1)J=Z8(J,Z);if(J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=a6(J),J=m1(J,Z,Y),J=e3(J,Z),J=$6(J,Z),J=n4(J,Z),J=bY(J,Z),J=SY(J,Z),J=await KY(J,Z,Y,G),J=await FZ(J,Z,Y),J=await xY(J,Z,Y,G),J=D9(J,Z,Y,G),J=M2(J,Z,Y,G),J=T2(J,Z,Y),J=I2(J,Z,Y,G),J=OY(J,Z,Y,G),J=K7(J,Z),J=q7(J),J=ZJ(J),!G.skipEventDirectives)J=$Y(J,Z,Y);if(J=QY(J,Z,Y),G.debug){let n=/\bx-data\s*=/.test(J),$0=Y4($);if(n&&$0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
13341
13348
  Both work on the same page, but they manage separate scopes.
13342
- Prefer signals (state/derived/effect) for new components.`)}J=vX(J,Z),J=await j1(J,Z,Y),J=rX(J),J=aX(J),J=h2(J);let{processXElementDirectives:y}=await Promise.resolve().then(() => GQ);J=y(J);let S=Z.__originalFilePath||Y,b=g5(Z);if(J=await a7(J,G,S,b),J=wY(J,Z),J=await EX(J,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:$0}=await Promise.resolve().then(() => (qQ(),KQ));J=await $0(J,{publicDir:n})}if(G.seo?.enabled)J=A2(J,Z,G);let v=(n,$0,z0=!0)=>{if(!$0)return n;let H0=$0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(H0&&C){if(z0)n=n.replace(C[0],H0[0]);if($0=$0.replace(H0[0],"").trim(),!$0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${$0}
13349
+ Prefer signals (state/derived/effect) for new components.`)}J=mX(J,Z),J=await B1(J,Z,Y),J=YJ(J),J=XJ(J),J=c2(J);let{processXElementDirectives:y}=await Promise.resolve().then(() => jQ);J=y(J);let S=Z.__originalFilePath||Y,b=h5(Z);if(J=await $3(J,G,S,b),J=IY(J,Z),J=await CX(J,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:$0}=await Promise.resolve().then(() => (_Q(),BQ));J=await $0(J,{publicDir:n})}if(G.seo?.enabled)J=D2(J,Z,G);let v=(n,$0,z0=!0)=>{if(!$0)return n;let A0=$0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(A0&&C){if(z0)n=n.replace(C[0],A0[0]);if($0=$0.replace(A0[0],"").trim(),!$0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${$0}
13343
13350
  </head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
13344
13351
  ${$0}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
13345
13352
  <head>
13346
13353
  ${$0}
13347
- </head>`);return n},{renderHead:h,getHead:f}=await Promise.resolve().then(() => (n5(),C7)),r=Z.__stx_runtime_head??f();if(r.title||r.meta?.length||r.link?.length){let n=h(r);if(n)J=v(J,n)}if(D.headContent)J=v(J,D.headContent,!r.title);if(G.csp?.enabled&&G.csp.addMetaTag)J=qY(J,G.csp,Z);if(G.analytics?.enabled)J=m2(J,G);if(G.heatmap?.enabled)J=f9(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await Promise.resolve().then(() => (T$(),w9));J=n(J,G)}let T0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),M0=/\bSTX\.\w+/.test(J),d0=/window\.STX\s*=/.test(J);if(T0&&M0&&!d0){let $0=`<script data-stx-scoped>
13348
- ${v2()}
13354
+ </head>`);return n},{renderHead:h,getHead:f}=await Promise.resolve().then(() => (o5(),f7)),r=Z.__stx_runtime_head??f();if(r.title||r.meta?.length||r.link?.length){let n=h(r);if(n)J=v(J,n)}if(D.headContent)J=v(J,D.headContent,!r.title);if(G.csp?.enabled&&G.csp.addMetaTag)J=_Y(J,G.csp,Z);if(G.analytics?.enabled)J=n2(J,G);if(G.heatmap?.enabled)J=h9(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await Promise.resolve().then(() => (T$(),R9));J=n(J,G)}let M0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),T0=/\bSTX\.\w+/.test(J),d0=/window\.STX\s*=/.test(J);if(M0&&T0&&!d0){let $0=`<script data-stx-scoped>
13355
+ ${m2()}
13349
13356
  </script>`;if(J.includes("</head>")){let z0=J.indexOf("</head>"),C=J.slice(0,z0).indexOf("<script");if(C!==-1){let P=J.slice(0,C),x=J.slice(C);J=P+$0+`
13350
13357
  `+x}else J=J.replace("</head>",`${$0}
13351
13358
  </head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
13352
13359
  ${$0}`);else J=$0+`
13353
- `+J}{let{scanScriptTags:n}=await Promise.resolve().then(() => (e5(),Z4)),$0=[];for(let z0 of n(J)){if(!/\bserver\b/i.test(z0.attrs))continue;let H0=z0.start+z0.fullMatch.indexOf(">")+1,C=V_(J,H0);if(C===-1)continue;let P=C+9;while(P<J.length&&/\s/.test(J[P]))P++;$0.push({start:z0.start,end:P})}for(let z0=$0.length-1;z0>=0;z0--){let{start:H0,end:C}=$0[z0];J=J.substring(0,H0)+J.substring(C)}}let Z0=C$(J,Y);if(Z0.hasScoped)J=Z0.html;let Y0=Z.__stx_event_bindings||[],I0=!1,c0=[],K1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:o1}=await Promise.resolve().then(() => (e5(),Z4));for(let n of o1(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))c0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:$0,content:z0}of c0){I0=!0;let H0=z0;K7(z0,Y,X.strict);let C=await h5(z0,{eventBindings:Y0,attrs:$0,hasColonDirectives:K1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(n,()=>C)}if(I0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")J=WY(J,Z.cspNonce);return J}var i1="<!--PARENT_CONTENT_PLACEHOLDER-->";var Q4=k(()=>{C2();k1();F7();x2();d2();u2();A7();V7();s2();d5();$Y();YY();u4();zY();_Y();LY();AY();J1();n5();t0();IY();SY();wX();TX();m6();Z3();kX();J5();SX();d3();F0();PX();xX();hX();mX();b7();e5();h6();oX();s6();r6();B0();z6();s6();r6()});import S_ from"fs";import $9 from"path";import RQ from"fs";import Y1 from"path";var Q9=[72,96,128,144,152,192,384,512],G9=[120,152,167,180],K9=[16,32];async function q9($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=Y1.isAbsolute(X.src)?X.src:Y1.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=Y1.resolve(Z,X.outputDir||"pwa-icons");try{RQ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||Q9,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
13354
- Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await W.default(Q).metadata();if(z.width&&z.width<512)Y.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=Y1.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=Y1.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of G9){let O=Y1.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=Y1.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of K9){let F=Y1.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let j=512,_=Y1.join(J,`icon-maskable-${j}x${j}.png`),B=Math.floor(j*0.1),H=j-B*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:B,bottom:B,left:B,right:B,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function v_($){let Z=$.sizes||Q9,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of G9)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of K9)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function W9(){try{return await import("sharp"),!0}catch{return!1}}T$();function lQ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function pQ($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function cQ($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function iQ($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function nQ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function oQ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:lQ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=pQ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((j)=>({src:j.src,sizes:j.sizes,type:j.type,label:j.label,form_factor:j.platform}));let W=cQ($);if(W)q.share_target=W;let U=iQ($);if(U)q.file_handlers=U;let z=nQ($);if(z)q.protocol_handlers=z;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function A9($){let Z=oQ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function c_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function i_($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import BQ from"path";async function _Q($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=BQ.isAbsolute(Z.page)?Z.page:BQ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (Q4(),jQ)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return D_($)}function D_($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
13360
+ `+J}{let{scanScriptTags:n}=await Promise.resolve().then(() => ($$(),X4)),$0=[];for(let z0 of n(J)){if(!/\bserver\b/i.test(z0.attrs))continue;let A0=z0.start+z0.fullMatch.indexOf(">")+1,C=I_(J,A0);if(C===-1)continue;let P=C+9;while(P<J.length&&/\s/.test(J[P]))P++;$0.push({start:z0.start,end:P})}for(let z0=$0.length-1;z0>=0;z0--){let{start:A0,end:C}=$0[z0];J=J.substring(0,A0)+J.substring(C)}}let Z0=x$(J,Y);if(Z0.hasScoped)J=Z0.html;let Y0=Z.__stx_event_bindings||[],I0=!1,c0=[],q1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:o1}=await Promise.resolve().then(() => ($$(),X4));for(let n of o1(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))c0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:$0,content:z0}of c0){I0=!0;let A0=z0;W7(z0,Y,X.strict);let C=await d5(z0,{eventBindings:Y0,attrs:$0,hasColonDirectives:q1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(n,()=>C)}if(I0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")J=HY(J,Z.cspNonce);return J}var i1="<!--PARENT_CONTENT_PLACEHOLDER-->";var K4=k(()=>{d2();k1();w7();u2();i2();o2();N7();A7();ZY();m5();GY();qY();p4();LY();wY();NY();DY();Q1();o5();t0();yY();fY();IX();bX();p6();J3();vX();Q5();fX();l3();L0();hX();uX();cX();nX();P7();$$();u6();$J();t6();e6();B0();_6();I7();t6();e6()});import g_ from"fs";import X9 from"path";import EQ from"fs";import X1 from"path";var K9=[72,96,128,144,152,192,384,512],q9=[120,152,167,180],W9=[16,32];async function U9($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=X1.isAbsolute(X.src)?X.src:X1.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=X1.resolve(Z,X.outputDir||"pwa-icons");try{EQ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||K9,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
13361
+ Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await W.default(Q).metadata();if(z.width&&z.width<512)Y.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=X1.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=X1.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of q9){let O=X1.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=X1.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of W9){let F=X1.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let j=512,_=X1.join(J,`icon-maskable-${j}x${j}.png`),B=Math.floor(j*0.1),H=j-B*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:B,bottom:B,left:B,right:B,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function u_($){let Z=$.sizes||K9,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of q9)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of W9)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function z9(){try{return await import("sharp"),!0}catch{return!1}}T$();function sQ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function rQ($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function aQ($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function tQ($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function eQ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function $G($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:sQ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=rQ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((j)=>({src:j.src,sizes:j.sizes,type:j.type,label:j.label,form_factor:j.platform}));let W=aQ($);if(W)q.share_target=W;let U=tQ($);if(U)q.file_handlers=U;let z=eQ($);if(z)q.protocol_handlers=z;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function N9($){let Z=$G($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function t_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function e_($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import VQ from"path";async function wQ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=VQ.isAbsolute(Z.page)?Z.page:VQ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (K4(),FQ)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return C_($)}function C_($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
13355
13362
  <html lang="en">
13356
13363
  <head>
13357
13364
  <meta charset="UTF-8">
13358
13365
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
13359
13366
  <meta name="theme-color" content="${J}">
13360
- <title>${z7(X)} - ${z7(G)}</title>
13367
+ <title>${B7(X)} - ${B7(G)}</title>
13361
13368
  <style>
13362
13369
  :root {
13363
13370
  --theme-color: ${J};
@@ -13527,8 +13534,8 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
13527
13534
  <circle cx="12" cy="20" r="1"/>
13528
13535
  </svg>
13529
13536
 
13530
- <h1>${z7(X)}</h1>
13531
- <p>${z7(Q)}</p>
13537
+ <h1>${B7(X)}</h1>
13538
+ <p>${B7(Q)}</p>
13532
13539
 
13533
13540
  <button class="retry-btn" onclick="window.location.reload()">
13534
13541
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -13584,9 +13591,9 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
13584
13591
  }, 5000);
13585
13592
  </script>
13586
13593
  </body>
13587
- </html>`}function z7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}E5();k5();import n1 from"fs";import j7 from"path";function E_($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function k_($){let Z=[],Y=j7.join($,"manifest.json"),X=n1.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let U=JSON.parse(n1.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=j7.join($,"sw.js"),J=n1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=j7.join($,"offline.html"),K=n1.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=j7.join($,"pwa-icons");if(n1.existsSync(q)){let U=n1.readdirSync(q).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:U.length>0,message:U.length>0?`${U.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function b_($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function HN($,Z){let Y=E_($),X=Z&&n1.existsSync(Z)?k_(Z):[];return b_([...Y,...X])}function ON($){let Z=[];Z.push(`
13594
+ </html>`}function B7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}k5();b5();import n1 from"fs";import _7 from"path";function v_($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function x_($){let Z=[],Y=_7.join($,"manifest.json"),X=n1.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let U=JSON.parse(n1.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=_7.join($,"sw.js"),J=n1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=_7.join($,"offline.html"),K=n1.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=_7.join($,"pwa-icons");if(n1.existsSync(q)){let U=n1.readdirSync(q).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:U.length>0,message:U.length>0?`${U.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function f_($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function IN($,Z){let Y=v_($),X=Z&&n1.existsSync(Z)?x_(Z):[];return f_([...Y,...X])}function DN($){let Z=[];Z.push(`
13588
13595
  === PWA Audit Report ===
13589
13596
  `);let Y=$.score>=90?"32":$.score>=70?"33":"31";Z.push(`Score: \x1B[${Y}m${$.score}/100\x1B[0m`),Z.push(`Passed: ${$.passed} | Failed: ${$.failed} | Warnings: ${$.warnings}
13590
13597
  `);let X=["required","recommended","optional"];for(let Q of X){let J=$.checks.filter((G)=>G.category===Q);if(J.length===0)continue;Z.push(`
13591
13598
  ${Q.toUpperCase()}:`);for(let G of J){let K=G.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(Z.push(` ${K} ${G.name}: ${G.message}`),G.details)Z.push(` ${G.details}`)}}return Z.push(""),Z.join(`
13592
- `)}C3();T$();E5();k5();async function IN($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{S_.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=A9($);if(J){let G=$9.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await W9()){let G=await q9($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await _Q($);if(J){let G=$9.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=T1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=R$($,Z);if(J){let G=r1($),K=$9.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function DN($,Z){return L7($,Z)}function EN($){return $.pwa?.enabled===!0}export{i_ as validateManifest,HN as runPwaAudit,nL as registerPwaDirectives,bW as pwaUpdateDirective,yW as pwaPushDirective,SW as pwaOfflineDirective,kW as pwaInstallDirective,P3 as pwaDirectives,DN as processPwaHtml,c_ as mergeManifestConfig,V9 as isWorkboxEnabled,W9 as isSharpAvailable,EN as isPwaEnabled,L7 as injectPwaTags,r1 as getServiceWorkerFileName,v_ as getExpectedIconPaths,uQ as generateThemeColorMeta,dQ as generateSwRegistrationScript,hQ as generateServiceWorkerAuto,R$ as generateServiceWorker,N$ as generatePwaTags,q9 as generatePwaIcons,A$ as generatePrecacheManifestJs,T1 as generatePrecacheManifest,_Q as generateOfflinePage,mQ as generateManifestLink,A9 as generateManifestJson,oQ as generateManifest,z9 as formatSize,ON as formatAuditResult,b_ as calculateAuditResult,IN as buildPwaAssets,E_ as auditConfig,k_ as auditBuildOutput,K9 as FAVICON_SIZES,Q9 as DEFAULT_ICON_SIZES,G9 as APPLE_TOUCH_ICON_SIZES};
13599
+ `)}f3();T$();k5();b5();async function fN($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{g_.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=N9($);if(J){let G=X9.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await z9()){let G=await U9($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await wQ($);if(J){let G=X9.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=M1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=N$($,Z);if(J){let G=a1($),K=X9.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function gN($,Z){return V7($,Z)}function hN($){return $.pwa?.enabled===!0}export{e_ as validateManifest,IN as runPwaAudit,XF as registerPwaDirectives,fW as pwaUpdateDirective,hW as pwaPushDirective,gW as pwaOfflineDirective,xW as pwaInstallDirective,x3 as pwaDirectives,gN as processPwaHtml,t_ as mergeManifestConfig,A9 as isWorkboxEnabled,z9 as isSharpAvailable,hN as isPwaEnabled,V7 as injectPwaTags,a1 as getServiceWorkerFileName,u_ as getExpectedIconPaths,oQ as generateThemeColorMeta,iQ as generateSwRegistrationScript,cQ as generateServiceWorkerAuto,N$ as generateServiceWorker,M$ as generatePwaTags,U9 as generatePwaIcons,R$ as generatePrecacheManifestJs,M1 as generatePrecacheManifest,wQ as generateOfflinePage,nQ as generateManifestLink,N9 as generateManifestJson,$G as generateManifest,B9 as formatSize,DN as formatAuditResult,f_ as calculateAuditResult,fN as buildPwaAssets,v_ as auditConfig,x_ as auditBuildOutput,W9 as FAVICON_SIZES,K9 as DEFAULT_ICON_SIZES,q9 as APPLE_TOUCH_ICON_SIZES};