@stacksjs/stx 0.2.317 → 0.2.318

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/{chunk-vgwcpt59.js → chunk-0ggq64sc.js} +1 -1
  2. package/dist/{chunk-dexbmqrm.js → chunk-0saq3nwy.js} +1 -1
  3. package/dist/{chunk-6g4arx7a.js → chunk-1ppaw4xs.js} +1 -1
  4. package/dist/{chunk-gvw5agnj.js → chunk-5qseeh5t.js} +1 -1
  5. package/dist/{chunk-vah1scec.js → chunk-65hqene1.js} +1 -1
  6. package/dist/{chunk-bgj9ep3g.js → chunk-6c1ebjat.js} +1 -1
  7. package/dist/chunk-6xmx6stb.js +2 -0
  8. package/dist/{chunk-t088w4j2.js → chunk-8618n28z.js} +1 -1
  9. package/dist/{chunk-w3qdxrpv.js → chunk-8avktqwz.js} +1 -1
  10. package/dist/{chunk-knt8aerb.js → chunk-8z11nkyk.js} +1 -1
  11. package/dist/{chunk-s1enwpyh.js → chunk-95jjdgmb.js} +1 -1
  12. package/dist/{chunk-v7pagafp.js → chunk-9g14542g.js} +1 -1
  13. package/dist/{chunk-zrnh6ybt.js → chunk-9h4fkwtj.js} +1 -1
  14. package/dist/{chunk-1sv0pxa3.js → chunk-acctstj3.js} +1 -1
  15. package/dist/{chunk-43052kx3.js → chunk-b73h0vd8.js} +1 -1
  16. package/dist/{chunk-fxjyj3j9.js → chunk-bbq82jww.js} +5 -5
  17. package/dist/{chunk-dy6aq1fx.js → chunk-bxvqqejm.js} +1 -1
  18. package/dist/{chunk-asb365rs.js → chunk-djf1p5cy.js} +1 -1
  19. package/dist/{chunk-bnw3wnw8.js → chunk-egr5663e.js} +1 -1
  20. package/dist/{chunk-gg85dhn4.js → chunk-f9qrz82p.js} +1 -1
  21. package/dist/chunk-g8vf2fc7.js +2 -0
  22. package/dist/{chunk-j18h8dbg.js → chunk-gcavh7hk.js} +1 -1
  23. package/dist/{chunk-n25whneb.js → chunk-gpesxpwq.js} +2 -2
  24. package/dist/{chunk-x3s0e6wv.js → chunk-h63vszd3.js} +1 -1
  25. package/dist/{chunk-pn60d9sp.js → chunk-hxf6zg80.js} +1 -1
  26. package/dist/{chunk-7nes75cd.js → chunk-jdcn0ms1.js} +1 -1
  27. package/dist/{chunk-gd62grxx.js → chunk-jg2gbd58.js} +1 -1
  28. package/dist/{chunk-t9acxg0e.js → chunk-jr79tvvs.js} +1 -1
  29. package/dist/chunk-n0t2at1c.js +2 -0
  30. package/dist/{chunk-734mjk29.js → chunk-pknc4efv.js} +1 -1
  31. package/dist/{chunk-v1507pxw.js → chunk-prry9kgy.js} +1 -1
  32. package/dist/{chunk-tdrpxx1h.js → chunk-r3220h2n.js} +1 -1
  33. package/dist/{chunk-9yhtehv9.js → chunk-s2kxa1tb.js} +1 -1
  34. package/dist/{chunk-thhgk7x1.js → chunk-s5wwa0t4.js} +2 -2
  35. package/dist/{chunk-4zkwqprq.js → chunk-spzbfqjn.js} +17 -17
  36. package/dist/{chunk-60jcfv31.js → chunk-szkq9s8n.js} +1 -1
  37. package/dist/{chunk-860dhpmy.js → chunk-tqayztkh.js} +1 -1
  38. package/dist/{chunk-wvfed9sj.js → chunk-tzhcjtkr.js} +1 -1
  39. package/dist/{chunk-k2gsnfaa.js → chunk-v02j99gh.js} +2 -2
  40. package/dist/{chunk-46dsqwx0.js → chunk-v1j4myd8.js} +1 -1
  41. package/dist/chunk-vnh668fb.js +2 -0
  42. package/dist/{chunk-wd6skrxf.js → chunk-w33gx25k.js} +1 -1
  43. package/dist/{chunk-1zw2abe0.js → chunk-w3dfvxar.js} +1 -1
  44. package/dist/{chunk-vb16zpbw.js → chunk-w6ncyp18.js} +1 -1
  45. package/dist/{chunk-w84fgaqj.js → chunk-wb24hk90.js} +1 -1
  46. package/dist/{chunk-dm93r8kq.js → chunk-wcp0dt2c.js} +1 -1
  47. package/dist/{chunk-ndyxw7f5.js → chunk-wkcnyv6m.js} +1 -1
  48. package/dist/{chunk-gb3fk53c.js → chunk-ycgtkfbm.js} +1 -1
  49. package/dist/{chunk-f5mkztvk.js → chunk-yzb20ane.js} +1 -1
  50. package/dist/{chunk-9bc55xwj.js → chunk-yzy6e4je.js} +9 -9
  51. package/dist/{chunk-wb0n3rmf.js → chunk-z82sc99z.js} +1 -1
  52. package/dist/{chunk-r97y1cy2.js → chunk-zebypbks.js} +2 -2
  53. package/dist/cli.js +7 -7
  54. package/dist/craft-entry.js +1 -1
  55. package/dist/craft.js +1 -1
  56. package/dist/pwa.js +1 -1
  57. package/dist/ssg.js +2 -2
  58. package/package.json +5 -5
  59. package/dist/chunk-478m6jex.js +0 -2
  60. package/dist/chunk-50mk56ph.js +0 -2
  61. package/dist/chunk-mdbhyxnr.js +0 -2
  62. package/dist/chunk-sc70p4kj.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$r as X0,Lr as J0,Nr as _9,Or as q3,Pr as L9,Rs as _8,Vs as L8,Wr as k2,Zr as j8,ds as E2,dt as B7,es as B8,et as V7,gs as o0,hs as V8,os as K3,ps as h4,qs as e,rs as W0,ss as E0,ts as B9,us as Z2,vs as K0,ws as O9}from"./chunk-raxr83fs.js";import{jt as u0,kt as GZ}from"./chunk-397rqs12.js";import{pt as n2}from"./chunk-aqrp68m6.js";import{At as r8,Bt as a8,Ct as Y2,Dt as m2,Et as V9,Ft as T2,Gt as t6,Ht as h6,It as B1,Jt as n0,Kt as m9,Ot as R8,Pt as y9,au as N8,ut as i1,vt as v1,wt as w8,xt as k1,zt as H1}from"./chunk-bnw3wnw8.js";import{bu as e7}from"./chunk-jwnbwemq.js";import{fu as F7,gu as w7,hu as t2,iu as e2}from"./chunk-ry1key0g.js";import{ku as _7,mu as L7,nu as O7,pu as U2}from"./chunk-4ee1aaet.js";import{qu as C9}from"./chunk-ndyxw7f5.js";import{su as P8,tu as v8,uu as f8,vu as x8,wu as g8,yu as F8}from"./chunk-18p8dqya.js";import{Du as o2,Fu as h8,zu as D8}from"./chunk-64ttktzc.js";import{Pu as $1}from"./chunk-xcsf7my7.js";import{Su as A8}from"./chunk-2kv2gnzc.js";import{$u as s$,Tu as W3,Uu as YZ,Vu as o8,Wu as p1,_u as QZ,av as g6,cv as O4,fv as I4}from"./chunk-ttny9g8k.js";import{Av as q$,Rv as O8,Tv as AG,Uv as e9,Wv as z2,qv as R$,tv as N6}from"./chunk-fxjyj3j9.js";import{$v as R7}from"./chunk-9ebfmdyb.js";import{ew as x}from"./chunk-jryjwara.js";import b1 from"path";import y2 from"fs";var p$=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"]),i$={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"},HZ=new Set(["ctrl","alt","shift","meta"]),o$={left:0,middle:1,right:2};function n$($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.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(HZ.has(X))Z.systemKeys.push(X);else if(X in o$)Z.mouse=X;else if(X in i$||/^[a-z]$/.test(X))Z.keys.push(i$[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function r$($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=X.exec($))!==null){let[Q,G,z]=Y,q=Y.index,K=q+Q.length,W=`__stx_evt_${J++}`,U=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,V,F]=j,_=V.split("."),O=_[0];if(!p$.has(O))continue;U.push({attribute:`@${V}`,event:O,handler:F,modifiers:n$(_.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,F]=j,_=V.split("."),O=_[0];if(!p$.has(O))continue;U.push({attribute:`@${V}`,event:O,handler:F,modifiers:n$(_.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:Q,elementId:W,events:U,startIndex:q,endIndex:K})}return Z}function jZ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=o$[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function BZ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function g9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function VZ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=jZ($),Y=BZ(g9($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2
+ import{$r as X0,Lr as J0,Nr as _9,Or as q3,Pr as L9,Rs as _8,Vs as L8,Wr as k2,Zr as j8,ds as E2,dt as B7,es as B8,et as V7,gs as o0,hs as V8,os as K3,ps as h4,qs as e,rs as W0,ss as E0,ts as B9,us as Z2,vs as K0,ws as O9}from"./chunk-raxr83fs.js";import{jt as u0,kt as GZ}from"./chunk-397rqs12.js";import{pt as n2}from"./chunk-aqrp68m6.js";import{At as r8,Bt as a8,Ct as Y2,Dt as m2,Et as V9,Ft as T2,Gt as t6,Ht as h6,It as B1,Jt as n0,Kt as m9,Ot as R8,Pt as y9,au as N8,ut as i1,vt as v1,wt as w8,xt as k1,zt as H1}from"./chunk-egr5663e.js";import{bu as e7}from"./chunk-jwnbwemq.js";import{fu as F7,gu as w7,hu as t2,iu as e2}from"./chunk-ry1key0g.js";import{ku as _7,mu as L7,nu as O7,pu as U2}from"./chunk-4ee1aaet.js";import{qu as C9}from"./chunk-wkcnyv6m.js";import{su as P8,tu as v8,uu as f8,vu as x8,wu as g8,yu as F8}from"./chunk-18p8dqya.js";import{Du as o2,Fu as h8,zu as D8}from"./chunk-64ttktzc.js";import{Pu as $1}from"./chunk-xcsf7my7.js";import{Su as A8}from"./chunk-2kv2gnzc.js";import{$u as s$,Tu as W3,Uu as YZ,Vu as o8,Wu as p1,_u as QZ,av as g6,cv as O4,fv as I4}from"./chunk-ttny9g8k.js";import{Av as q$,Rv as O8,Tv as AG,Uv as e9,Wv as z2,qv as R$,tv as N6}from"./chunk-bbq82jww.js";import{$v as R7}from"./chunk-9ebfmdyb.js";import{ew as x}from"./chunk-jryjwara.js";import b1 from"path";import y2 from"fs";var p$=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"]),i$={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"},HZ=new Set(["ctrl","alt","shift","meta"]),o$={left:0,middle:1,right:2};function n$($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.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(HZ.has(X))Z.systemKeys.push(X);else if(X in o$)Z.mouse=X;else if(X in i$||/^[a-z]$/.test(X))Z.keys.push(i$[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function r$($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=X.exec($))!==null){let[Q,G,z]=Y,q=Y.index,K=q+Q.length,W=`__stx_evt_${J++}`,U=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,V,F]=j,_=V.split("."),O=_[0];if(!p$.has(O))continue;U.push({attribute:`@${V}`,event:O,handler:F,modifiers:n$(_.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,F]=j,_=V.split("."),O=_[0];if(!p$.has(O))continue;U.push({attribute:`@${V}`,event:O,handler:F,modifiers:n$(_.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:Q,elementId:W,events:U,startIndex:q,endIndex:K})}return Z}function jZ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=o$[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function BZ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function g9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function VZ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=jZ($),Y=BZ(g9($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${J}');
5
5
  if (!$el) return;
@@ -3219,7 +3219,7 @@ ${W}
3219
3219
  customElements.define('${Z}', ${G});
3220
3220
  `}async function H7($,Z,J,X){if(Z.length<1)return X0("WebComponent","@webcomponent directive requires at least the tag name parameter",J0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=d0.isAbsolute(G)?[d0.join(G,`${Y}.stx`),d0.join(d0.dirname(X),`${Y}.stx`)]:[d0.join(d0.dirname(X),G,`${Y}.stx`),d0.join(process.cwd(),G,`${Y}.stx`),d0.join(d0.dirname(X),`${Y}.stx`)],q=null;for(let U of z)if(await a(U)){q=await Bun.file(U).text();break}if(!q)return X0("WebComponent",`Component file not found: ${Y}.stx`,J0.FILE_NOT_FOUND);let K=XX(q,Y);return`<script type="module">
3221
3221
  ${YX(K)}
3222
- </script>`}var V5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:_7,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,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:g3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:H7,hasEndTag:!1,description:"Include a web component in the template"},B7,V7,U5,H5,n9,o9,r9,s9,P3,D3,r3,W5,...R7],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function GX($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=b0.join(Y,"resources","views"),G=b0.join(Y,"resources","layouts");if($9.existsSync(Q)&&$9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=b0.join(Y,"resources","views","pages");if($9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var j7=new Set,Z9=["partialsDir","componentsDir","layoutsDir"],_5=new WeakMap;function zX($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function qX($,Z){let J=!$.root,X=GX($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!j7.has(Y))j7.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!_5.has($)){let Y={};for(let Q of Z9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}_5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of Z9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(b0.isAbsolute(G)||zX(G,Y))continue;$[Q]=b0.join(Y,G)}}for(let Y of Z9){let Q=$[Y];if(typeof Q!=="string"||!Q||b0.isAbsolute(Q))continue;$[Y]=b0.resolve(Z,Q)}return $}function KX($,Z){let J=_5.get($);for(let X of Z9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=b0.isAbsolute(Y)?Y:b0.join(Z,Y);if($9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,q=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(q?`, resolved under root "${z}".`:"."))}}function WX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function UX($){if(L7($.stateDir),$.stateDir=O7(),$.cachePath=U2($.cachePath),$.build)$.build.cacheDir=U2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=U2($.media.cache.directory);if($.story)$.story.outDir=U2($.story.outDir)}var G1=null,L1=new Map,a2=new Map,H2=null;async function L5($){let Z=$?b0.resolve($):process.cwd(),J=a2.get(Z);if(J&&J.signature!==t2(J.graph)){let Q=L1.get(Z);if(L1.delete(Z),a2.delete(Z),!$)G1=null,H2=null;let{clearComponentCache:G}=await import("./chunk-vah1scec.js"),{partialsCache:z}=await import("./chunk-dm93r8kq.js");if(G(),z.clear(),Q&&J.configSignature===e2(J.graph)){let q=Q.then(async(K)=>{let W={...J.graph};await w7(W,Z),a2.set(Z,{graph:W,signature:t2(W),configSignature:e2(W)});let U={...K,_layerGraph:W};if(!$)G1=U;return U});return L1.set(Z,q),q}}if(!$){if(G1)return G1;if(H2)return H2}let X=L1.get(Z);if(X)return X;let Y=(async()=>{let G=(await QX({name:"stx",alias:"ui",cwd:Z,defaultConfig:V5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await F7(Z,V5);G=z.config,a2.set(Z,{graph:z.graph,signature:t2(z.graph),configSignature:e2(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-zr1r73p3.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:q}=await import("./chunk-t9acxg0e.js");await q(Z,G.runtimeConfig)}if(WX(G),UX(G),qX(G,Z),KX(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-wm86mmgq.js"),q=[],K=[];for(let W of G.plugins){let U=typeof W==="string"?W:W[0],H=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(U),B=b0.dirname(x.resolve(U))}catch{let F=b0.resolve(Z,U);j=await import(F),B=b0.dirname(F)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let F=Array.isArray(V.components)?V.components:[V.components];for(let _ of F)q.push(b0.resolve(B,_))}if(V.pages){let F=b0.resolve(B,V.pages),_=H.path||"/";K.push({dir:F,prefix:_})}if(V.setup){let F={addDirective:(_)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(_)},addRoute:(_,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[_]=O},addMiddleware:(_)=>{G.middleware=G.middleware||[],G.middleware.push(_)},pluginDir:B,config:G};await V.setup(H,F)}console.log(`[stx] Plugin loaded: ${V.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}G._pluginComponentDirs=q,G._pluginPageDirs=K}return G})();if(L1.set(Z,Y),Y.catch(()=>{if(L1.get(Z)===Y)L1.delete(Z)}),!$)H2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var N7=new Proxy(V5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!H2)L5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function WW($){return $}function UW($){let Z=[],J=[];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,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].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,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.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)J.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((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.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)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var F5=new Map;async function BX($,Z={}){try{if(!await a($))throw Error(`Markdown file not found: ${$}`);let X=(await HX.promises.stat($)).mtime.getTime();if(Z.cache&&F5.has($)){let U=F5.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=f3(Y),z=Z.markdown||N7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=q2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)K=await VX(K,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:K,data:Q||{}};if(Z.cache)F5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:H0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var J9=null;async function VX($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!J9)try{J9=await jX({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,q,K,W)=>{let U=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),H=K||(J?"text":"");if(!H)return z;try{if(!J9.getSupportedLanguages().includes(H))return z;return(await J9.highlight(U,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${K}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[q,K,W,U]=z,H=await Y(q,K,W,U);Q=Q.replace(q,H)}return Q}async function D7($,Z,J="",X={}){return await _X($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,q,K)=>{try{let W=z;if(!O5.isAbsolute(z))W=O5.resolve(O5.dirname(J),z);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of O){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),N=L.substring(w+1).trim(),A=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(A||T)N=N.substring(1,N.length-1);U[R]=N}}}}catch(_){if(X.debug)console.error("Error parsing context in @markdown-file directive:",_)}let{content:H,data:j}=await BX(W,X),B={...Z,...j,...U},V=H,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(_,O)=>{let L=O.trim();return B[L]!==void 0?String(B[L]):_}),V}catch(W){let U=W instanceof Error?W.message:String(W);return H0("Markdown File",`Error including markdown file: ${U}`,J,$,K,G)}})}async function _X($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],q=Y.index,K=Y;X.push(J(...K).then((W)=>({match:z,replacement:W,index:q})))}let Q=await Promise.all(X);Q.sort((z,q)=>q.index-z.index);let G=$;for(let{match:z,replacement:q}of Q)G=G.replace(z,()=>q);return G}function z1($,Z){try{let J=$.trim();if(W0(J))return K0(J,Object.keys(Z))(...Object.values(Z));else return e(J,Z)}catch{return!1}}class X9{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,J=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,J);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,J);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,J);if(X==='"'||X==="'")return this.readString(X,$,Z,J);if(X==="`")return this.readTemplateString($,Z,J);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,J);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,J);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:J}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:J}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:J};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,J);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:J};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:J};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J}}readWhitespace($,Z,J){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readLineComment($,Z,J){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3222
+ </script>`}var V5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:_7,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,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:g3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:H7,hasEndTag:!1,description:"Include a web component in the template"},B7,V7,U5,H5,n9,o9,r9,s9,P3,D3,r3,W5,...R7],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function GX($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=b0.join(Y,"resources","views"),G=b0.join(Y,"resources","layouts");if($9.existsSync(Q)&&$9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=b0.join(Y,"resources","views","pages");if($9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var j7=new Set,Z9=["partialsDir","componentsDir","layoutsDir"],_5=new WeakMap;function zX($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function qX($,Z){let J=!$.root,X=GX($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!j7.has(Y))j7.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!_5.has($)){let Y={};for(let Q of Z9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}_5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of Z9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(b0.isAbsolute(G)||zX(G,Y))continue;$[Q]=b0.join(Y,G)}}for(let Y of Z9){let Q=$[Y];if(typeof Q!=="string"||!Q||b0.isAbsolute(Q))continue;$[Y]=b0.resolve(Z,Q)}return $}function KX($,Z){let J=_5.get($);for(let X of Z9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=b0.isAbsolute(Y)?Y:b0.join(Z,Y);if($9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,q=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(q?`, resolved under root "${z}".`:"."))}}function WX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function UX($){if(L7($.stateDir),$.stateDir=O7(),$.cachePath=U2($.cachePath),$.build)$.build.cacheDir=U2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=U2($.media.cache.directory);if($.story)$.story.outDir=U2($.story.outDir)}var G1=null,L1=new Map,a2=new Map,H2=null;async function L5($){let Z=$?b0.resolve($):process.cwd(),J=a2.get(Z);if(J&&J.signature!==t2(J.graph)){let Q=L1.get(Z);if(L1.delete(Z),a2.delete(Z),!$)G1=null,H2=null;let{clearComponentCache:G}=await import("./chunk-65hqene1.js"),{partialsCache:z}=await import("./chunk-wcp0dt2c.js");if(G(),z.clear(),Q&&J.configSignature===e2(J.graph)){let q=Q.then(async(K)=>{let W={...J.graph};await w7(W,Z),a2.set(Z,{graph:W,signature:t2(W),configSignature:e2(W)});let U={...K,_layerGraph:W};if(!$)G1=U;return U});return L1.set(Z,q),q}}if(!$){if(G1)return G1;if(H2)return H2}let X=L1.get(Z);if(X)return X;let Y=(async()=>{let G=(await QX({name:"stx",alias:"ui",cwd:Z,defaultConfig:V5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await F7(Z,V5);G=z.config,a2.set(Z,{graph:z.graph,signature:t2(z.graph),configSignature:e2(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-zr1r73p3.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:q}=await import("./chunk-jr79tvvs.js");await q(Z,G.runtimeConfig)}if(WX(G),UX(G),qX(G,Z),KX(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-wm86mmgq.js"),q=[],K=[];for(let W of G.plugins){let U=typeof W==="string"?W:W[0],H=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(U),B=b0.dirname(x.resolve(U))}catch{let F=b0.resolve(Z,U);j=await import(F),B=b0.dirname(F)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let F=Array.isArray(V.components)?V.components:[V.components];for(let _ of F)q.push(b0.resolve(B,_))}if(V.pages){let F=b0.resolve(B,V.pages),_=H.path||"/";K.push({dir:F,prefix:_})}if(V.setup){let F={addDirective:(_)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(_)},addRoute:(_,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[_]=O},addMiddleware:(_)=>{G.middleware=G.middleware||[],G.middleware.push(_)},pluginDir:B,config:G};await V.setup(H,F)}console.log(`[stx] Plugin loaded: ${V.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}G._pluginComponentDirs=q,G._pluginPageDirs=K}return G})();if(L1.set(Z,Y),Y.catch(()=>{if(L1.get(Z)===Y)L1.delete(Z)}),!$)H2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var N7=new Proxy(V5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!H2)L5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function WW($){return $}function UW($){let Z=[],J=[];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,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].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,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.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)J.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((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.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)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var F5=new Map;async function BX($,Z={}){try{if(!await a($))throw Error(`Markdown file not found: ${$}`);let X=(await HX.promises.stat($)).mtime.getTime();if(Z.cache&&F5.has($)){let U=F5.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=f3(Y),z=Z.markdown||N7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=q2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)K=await VX(K,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:K,data:Q||{}};if(Z.cache)F5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:H0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var J9=null;async function VX($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!J9)try{J9=await jX({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,q,K,W)=>{let U=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),H=K||(J?"text":"");if(!H)return z;try{if(!J9.getSupportedLanguages().includes(H))return z;return(await J9.highlight(U,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${K}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[q,K,W,U]=z,H=await Y(q,K,W,U);Q=Q.replace(q,H)}return Q}async function D7($,Z,J="",X={}){return await _X($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,q,K)=>{try{let W=z;if(!O5.isAbsolute(z))W=O5.resolve(O5.dirname(J),z);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of O){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),N=L.substring(w+1).trim(),A=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(A||T)N=N.substring(1,N.length-1);U[R]=N}}}}catch(_){if(X.debug)console.error("Error parsing context in @markdown-file directive:",_)}let{content:H,data:j}=await BX(W,X),B={...Z,...j,...U},V=H,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(_,O)=>{let L=O.trim();return B[L]!==void 0?String(B[L]):_}),V}catch(W){let U=W instanceof Error?W.message:String(W);return H0("Markdown File",`Error including markdown file: ${U}`,J,$,K,G)}})}async function _X($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],q=Y.index,K=Y;X.push(J(...K).then((W)=>({match:z,replacement:W,index:q})))}let Q=await Promise.all(X);Q.sort((z,q)=>q.index-z.index);let G=$;for(let{match:z,replacement:q}of Q)G=G.replace(z,()=>q);return G}function z1($,Z){try{let J=$.trim();if(W0(J))return K0(J,Object.keys(Z))(...Object.values(Z));else return e(J,Z)}catch{return!1}}class X9{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,J=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,J);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,J);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,J);if(X==='"'||X==="'")return this.readString(X,$,Z,J);if(X==="`")return this.readTemplateString($,Z,J);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,J);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,J);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:J}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:J}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:J};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,J);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:J};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:J};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J}}readWhitespace($,Z,J){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readLineComment($,Z,J){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3223
3223
  `)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readBlockComment($,Z,J){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readString($,Z,J,X){this.advance();while(this.pos<this.source.length){let Y=this.source[this.pos];if(Y==="\\"){this.advance(2);continue}if(Y===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:J,column:X}}readTemplateString($,Z,J){this.advance();let X=0,Y=256;while(this.pos<this.source.length){let Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q==="$"&&this.peek(1)==="{"){if(X>=Y){this.pos=this.source.length;break}this.advance(2),X++;continue}if(Q==="{"&&X>0){X++,this.advance();continue}if(Q==="}"&&X>0){X--,this.advance();continue}if(Q==="`"&&X===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readNumber($,Z,J){if(this.source[this.pos]==="0"){let X=this.peek(1)?.toLowerCase();if(X==="x"||X==="o"||X==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readIdentifier($,Z,J){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readDirective($,Z,J){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
3224
3224
  `)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function L0($,Z,J,X=0){let Y=0,Q=X,G=null,z=0,q=!1;while(Q<$.length){let K=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&K==="\\"){q=!0,Q++;continue}if(q=!1,(K==='"'||K==="'"||K==="`")&&!G){G=K,Q++;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&K==="$"&&$[Q+1]==="{"){z++,Q+=2;continue}if(z>0&&K==="}"){z--,Q++;continue}if(K==="`"&&G==="`"&&z===0){G=null,Q++;continue}if(G){Q++;continue}if(K===Z)Y++;else if(K===J){if(Y--,Y===0)return Q}Q++}return-1}function A7($,Z){let J=Z,X={paren:0,bracket:0,brace:0},Y=null,Q=0;while(J<$.length){let G=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((G==='"'||G==="'")&&!Y){Y=G,J++;continue}if(G===Y&&Y!=="`"){Y=null,J++;continue}if(G==="`"&&!Y){Y="`",J++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,J++;continue}if(Y==="`"&&G==="$"&&$[J+1]==="{"){Q++,J+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;J++;continue}if(Y){J++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(J,J+2)==="}}"||$.slice(J,J+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}J++}return{expression:$.slice(Z,J),endPos:J}}function w5($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+=z+$[G+1],G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}if(z==="|"&&$[G-1]==="\\"&&!Y){J=J.slice(0,-1)+z;continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function q1($,Z){let J=LX($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function LX($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=L0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function OX($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function O1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let q=G.exec($),K=z.exec($),W=q?q.index:1/0,U=K?K.index:1/0;if(W<U)Y++,Q=W+q[0].length;else if(U<1/0){if(Y--,Y===0)return U;Q=U+K[0].length}else break}return-1}function M7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=q1($,X);if(!Y)return null;let Q=Y.endPos,G=O1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,W="if",U=Y.expression,H=0,j=0;while(K<z.length){let B=z.indexOf("@",K);if(B===-1)break;K=B;let V=z.substring(B);if(OX(z,B)){K++;continue}if(/^@if\s*\(/.test(V)){j++,K++;continue}if(/^@endif(?![a-z])/.test(V)){j--,K+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){q.push({type:W,condition:U,content:z.substring(H,K),start:Q+H,end:Q+K});let _=K+F[0].length,O=q1(z,_);if(!O){K++;continue}W="elseif",U=O.expression,K=O.endPos,H=K;continue}else if(/^@else(?![a-z])/.test(V)){q.push({type:W,condition:U,content:z.substring(H,K),start:Q+H,end:Q+K}),W="else",U=void 0,K+=5,H=K;continue}}K++}return q.push({type:W,condition:U,content:z.slice(H),start:Q+H,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function j2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=M7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function Y9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,q=z+Q[0].length-1,K=L0($,"(",")",q);if(K===-1){Q=Y.exec($);continue}let W=$.slice(q+1,K),U=K+1,H=O1($,Z,J,U);if(H===-1){Q=Y.exec($);continue}let j=$.slice(U,H),B=H+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:W,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function R5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=q1($,X);if(!Y)return null;let Q=Y.endPos,G=O1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,W=null,U=0;while(K<z.length){let H=z.slice(K),j=H.match(/^@switch\s*\(/),B=H.match(/^@endswitch(?![a-z])/);if(j){if(U++,W)W.content+=j[0];K+=j[0].length;continue}if(B){if(U--,W)W.content+=B[0];K+=B[0].length;continue}if(U>0){if(W)W.content+=z[K];K++;continue}let V=H.match(/^@case\s*/),F=H.match(/^@default(?![a-z])/),_=H.match(/^@break(?![a-z])/);if(V&&H.startsWith("@case")){if(W)q.push(W);let O=K+V[0].length,L=q1(z,O);if(!L){K++;continue}W={type:"case",value:L.expression,content:""},K=L.endPos}else if(F&&H.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},K+=F[0].length}else if(_&&H.startsWith("@break"))K+=_[0].length;else{if(W)W.content+=z[K];K++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:q,start:Z,end:G+10}}function FX($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",q=Q?z==="{{{"?"}}}":"!!}":"}}",K=G+z.length,W=wX($,K,q);if(W===-1){J=G+1;continue}let U=$.slice(K,W).trim(),H=W+q.length;Z.push({fullMatch:$.slice(G,H),expression:U,start:G,end:H,isRaw:Q}),J=H}return Z}function wX($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function RX($){let Z=w5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=NX(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function NX($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=L0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=k7(G);return{name:X,args:z}}function k7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function DX($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=L0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function AX($){let Z=[],X=new X9($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let q=z.value;if(Y++,Y>=X.length)break;let K=X[Y];if(K.type==="IDENTIFIER"){let W=K.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let U=Y<X.length?X[Y].start:$.length,H=I7(X,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:W,value:$.slice(U,H.endPos),exported:G,start:z.start,end:H.endPos})}}else if(K.type==="PUNCTUATION"&&(K.value==="{"||K.value==="[")){let W=K.start,U=K.value==="{"?"}":"]",H=L0($,K.value,U,W);if(H!==-1){let j=$.slice(W,H+1);if(Y=T7(X,H+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=I7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${q} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let q=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let K=X[Y];if(K.type==="IDENTIFIER"){let W=K.value;Y++;let U=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){U=X[Y].start;break}Y++}if(U!==-1){let H=L0($,"{","}",U);if(H!==-1)Z.push({type:"function",name:W,value:$.slice(q,H+1).replace(/^export\s+/,""),exported:G,start:q,end:H+1}),Y=T7(X,H+1)}}}else Y++}return Z}function I7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function T7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function MX($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=R5(X,G);if(!z)break;try{let q;if(W0(z.expression))q=K0(z.expression,Object.keys(Z))(...Object.values(Z));else q=e(z.expression,Z);let K="",W=!1;for(let U of z.cases)if(U.type==="default"){if(!W)K=U.content.trim()}else try{let H;if(U.value&&W0(U.value))H=K0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)H=e(U.value,Z);if(q===H){K=U.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+K+X.substring(z.end),Y=!0}catch(q){let K=q instanceof Error?q.message:String(q),W=X0("Switch",`Error evaluating @switch expression: ${K}`,J0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function IX($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function TX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function e0($,Z,J){let{masked:X,scripts:Y}=IX($);return TX(kX(X,Z,J),Y)}function kX($,Z,J){let X=$;X=MX(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=q1(X,z+7);if(!q)break;let K=q.endPos,W=O1(X,"unless","endunless",K);if(W===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(K,W),H=q.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,_=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,L=[],w;while((w=F.exec(U))!==null)L.push({pos:w.index,type:"open"});while((w=_.exec(U))!==null)L.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)L.push({pos:w.index,type:"else"});L.sort((R,N)=>R.pos-N.pos);for(let R of L)if(R.type==="open")V++;else if(R.type==="close")V--;else if(R.type==="else"&&V===0){j=R.pos;break}}let B;if(j!==-1){let V=U.slice(0,j),F=U.slice(j+5);B=`@if (${H})${F}@else ${V}@endif`}else B=`@if (!(${H}))${U}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=D5(X,Z,J),X=A5(X,Z,J),X=N5(X,Z);let Y=()=>{let Q=j2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let K=Q.length-1;K>=0;K--){let W=Q[K];try{let U="",H=!1;for(let j of W.branches){if(H)break;if(j.type==="else")U=j.content,H=!0;else try{let B;if(j.condition&&W0(j.condition))B=K0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=e(j.condition,Z);if(B)U=j.content,H=!0}catch(B){U=X0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,J0.EVALUATION_ERROR),H=!0}}G[K]=U}catch(U){let H=U instanceof Error?U.message:String(U);G[K]=X0("If",`Error processing @if block: ${H}`,J0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),q=0;for(let K=0;K<Q.length;K++){let W=Q[K];z[K*2]=X.slice(q,W.start),z[K*2+1]=G[K],q=W.end}return z[Q.length*2]=X.slice(q),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function E7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function N5($,Z){let J=$;function X(z,q,K,W){let U=1,H=W,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${K}(?![a-z])`,"g");while(H<z.length&&U>0){j.lastIndex=H,B.lastIndex=H;let V=j.exec(z),F=B.exec(z),_=V?V.index:1/0,O=F?F.index:1/0;if(_<O)U++,H=_+V[0].length;else if(O<1/0){if(U--,U===0)return O;H=O+F[0].length}else break}return-1}function Y(z,q,K){let W=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=U.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=H.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,_)=>F.pos-_.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let q=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,W,U,H=J.slice(K+5),j=E7(H);if(j)W=j.value,U=K+5+j.consumed;else U=K+5;let B=X(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${K} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(U,B),F=Y(V,"auth","endauth"),_;if(!Z.auth)_=!1;else _=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let O;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);O=_?L:w}else O=_?V:"";J=J.substring(0,K)+O+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let q=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,W,U,H=J.slice(K+6),j=E7(H);if(j)W=j.value,U=K+6+j.consumed;else U=K+6;let B=X(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${K} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(U,B),F=Y(V,"guest","endguest"),_;if(!Z.auth)_=!0;else _=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let O;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);O=_?L:w}else O=_?V:"";J=J.substring(0,K)+O+J.substring(B+9),z=!0}}function Q(z,q,K){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[z];if(q)W.push(q);if(K){let U=z1(K,Z);W.push(U)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let q=z.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 z of["can","cannot"]){let q=`end${z}`,K=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let U=J.match(new RegExp(`@${z}\\s*\\(`));if(!U||U.index===void 0)break;let H=U.index,j=J.slice(H+`@${z}`.length),B=G(j);if(!B)break;let V=H+`@${z}`.length+B.paramsEnd,F=X(J,z,q,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${H} has no matching @${q} \u2014 the block was skipped.`);break}let _=J.slice(V,F),O=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${K}\\s*\\(`,"g"),A=/@else(?![a-z])/g,T=[],D;while((D=w.exec(_))!==null)T.push({pos:D.index,type:"open"});while((D=R.exec(_))!==null)T.push({pos:D.index,type:"close"});while((D=N.exec(_))!==null)T.push({pos:D.index,type:"elseDirective"});while((D=A.exec(_))!==null)T.push({pos:D.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)O.push(b)}let M=[],k=0;for(let b=0;b<O.length;b++){let C=O[b];if(M.push({content:_.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let f=_.slice(C.pos+`@${K}`.length),u=G(f);if(u){M[M.length-1]={content:_.slice(k,C.pos)},k=C.pos+`@${K}`.length+u.paramsEnd,M.push({content:"",ability:u.ability,type:u.type,id:u.id}),M.pop();let P=O[b+1],h=P?P.pos:_.length;M.push({content:_.slice(k,h),ability:u.ability,type:u.type,id:u.id}),k=h}}else k=C.pos+5}if(k<_.length){let b=M[M.length-1];if(O.length>0&&O[O.length-1].type==="else")M.push({content:_.slice(k),isFinalElse:!0});else if(M.length===0)M.push({content:_.slice(k)})}let I=Q(B.ability,B.type,B.id),y=z==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let f=M[C];if(f.isFinalElse){E=f.content,b=!0;break}if(f.ability){let u=Q(f.ability,f.type,f.id);if(z==="can"?u:!u){E=f.content,b=!0;break}}}if(!b&&M.length>0){let C=M[M.length-1];if(C.isFinalElse)E=C.content}}J=J.substring(0,H)+E+J.substring(F+`@${q}`.length),W=!0}}return J}function D5($,Z,J){let X=$;function Y(Q,G,z,q,K){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),H=Q.match(U);if(!H||H.index===void 0)break;let j=H.index,B=q1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=O1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let _=Q.slice(V,F),O=B.expression,L=-1,w=0,R=0;while(R<_.length){let N=_.indexOf("@",R);if(N===-1)break;let A=_.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){L=N;break}R=N+1}try{let N=q(O.trim()),A;if(L!==-1){let T=_.slice(0,L),D=_.slice(L+5);A=N?T:D}else A=N?_:"";Q=Q.substring(0,j)+A+Q.substring(F+`@${z}`.length),W=!0}catch(N){let A=N instanceof Error?N.message:String(N),T=X0(K,`Error processing @${G} directive: ${A}`,J0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function A5($,Z,J){let X=$,Y="development";function Q(G,z,q,K){let W=new RegExp(`@${z}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),H=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let _=F.index,O=_+F[0].length;if(z==="env"){let I=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,K=Y===I[2]}let L=1,w=O,R=-1;while(L>0&&w<B.length){W.lastIndex=w,U.lastIndex=w;let I=W.exec(B),y=U.exec(B),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)L++,w=E+I[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(O,R),A=-1,T=0,D=0;while(D<N.length){let I=N.indexOf("@",D);if(I===-1)break;let y=N.substring(I);if(H.test(y)){T++,D=I+1;continue}if(j.test(y)){T--,D=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){A=I;break}D=I+1}let M;if(A!==-1){let I=N.slice(0,A),y=N.slice(A+5);M=K?I:y}else M=K?N:"";let k=`@${q}`.length;B=B.substring(0,_)+M+B.substring(R+k),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var M5=new WeakMap;function b7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function F1($,Z){if(!$)return Z?.nonceGenerator?.()??b7();let J=M5.get($);if(!J)J=Z?.nonceGenerator?.()??b7(),M5.set($,J);return J}function gW($){M5.delete($)}function y7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function T5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${y7($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var EX={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},I5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},bX={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},yX={"default-src":["'none'"],"frame-ancestors":["'none'"]};function hW($){return{enabled:!0,directives:{strict:EX,moderate:I5,relaxed:bX,api:yX}[$]||I5,useNonce:$==="strict",addMetaTag:!0}}function uW($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],q=[...new Set([...z,...Y])];J[Q]=q}}return J}function C7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?F1(J,Z):void 0,Y=T5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3225
3225
  ${Y}`)}function S7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function P7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?F1(Z,Q):void 0;return T5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return F1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=F1(Z,Q);return Y}var CX={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?F1(J,Q):void 0;return T5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},SX={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return F1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function dW(){return[CX,SX]}function mW($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function PX($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function lW($,Z){if(!$.enabled)return{};let J=$.useNonce?F1(Z,$):void 0,X=y7($.directives,J);return{[PX($.reportOnly)]:X}}var cW={enabled:!1,reportOnly:!1,directives:I5,useNonce:!1,addMetaTag:!0};import vX from"crypto";var fX=40,v7="_token",k5=null;function xX($=fX){let Z=vX.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return k5=Z,Z}function gX(){if(!k5)xX();return k5}function hX($=v7){let Z=gX();return`<input type="hidden" name="${$}" value="${Z}">`}function f7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return hX(X||v7)})}async function x7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await uX(Y,Q,Z,J,X);else Y=await dX(Y,Q,Z,J,X)}return Y}async function uX($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,q=`@end${Q}`,K=$,W=v1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],H=W.exec(K);while(H!==null){let[j,B="",V=""]=H,F=H.index||0;try{let _=B?g7(B):[],O=V.trim(),L=await G(O,_,J,X);U.push({original:j,processed:L,startIndex:F})}catch(_){let O=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);U.push({original:j,processed:X0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${O}`,J0.EVALUATION_ERROR),startIndex:F})}H=W.exec(K)}for(let j=U.length-1;j>=0;j--){let{original:B,processed:V}=U[j];K=K.replace(B,V)}return K}async function dX($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,q=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),K=[],W=q.exec(z);while(W!==null){let[j,B=""]=W,V=W.index||0;try{let F=g7(B),_=await G("",F,J,X);K.push({original:j,processed:_,startIndex:V})}catch(F){let _=F instanceof Error?F.message:String(F);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,F);K.push({original:j,processed:X0("CustomDirective",`Error in @${Q}(${B}): ${_}`,J0.EVALUATION_ERROR),startIndex:V})}W=q.exec(z)}let U=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=U.exec(z);while(H!==null){let[j]=H,B=H.index||0;try{let V=await G("",[],J,X);K.push({original:j,processed:V,startIndex:B})}catch(V){let F=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:j,processed:X0("CustomDirective",`Error in @${Q}: ${F}`,J0.EVALUATION_ERROR),startIndex:B})}H=U.exec(z)}for(let j=K.length-1;j>=0;j--){let{original:B,processed:V}=K[j];z=z.replace(B,V)}return z}function g7($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var h7=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,u7=/^[A-Za-z_$][\w$]*$/,mX=new Set(["light","dark","system"]);function w1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function lX($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(w1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))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(w1(J.key,"appearance.key"),w1(J.attribute,"appearance.attribute"),w1(J.default,"appearance.default"),w1(X.key,"colorMode.key"),w1(X.attribute,"colorMode.attribute"),w1(X.default,"colorMode.default"),!u7.test(J.key)||!u7.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!h7.test(J.attribute)||!h7.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!mX.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function cX($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function pX($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${cX($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){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{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function iX($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function d7($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=iX(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),q=e(`(${z})`,Z),K=pX(lX(q));J=J.slice(0,Y.index)+K+J.slice(G+1),X.lastIndex=Y.index+K.length}return J}import nX from"crypto";function O0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var b5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function sX($){return{...b5,...$.forms?.classes}}function Q9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function m0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function f1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${O0(Z)}"`}function E5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${O0(`${m0($)}-error`)}"`;return X}function oX(){return nX.randomUUID()}function ZU($,Z,J,X){let Y=sX(X),Q=$;return Q=aX(Q,Z),Q=_2(Q,Z),Q=y5(Q,Z,Y),Q=C5(Q,Z,Y),Q}function _2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=oX();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${O0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${O0(Q)}">`;return X}),J}function y5($,Z,J=b5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,q,K="")=>{let W=Q||G||"POST",U=z||q||"",H=K1(K),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${O0(B)}" action="${O0(U)}"${H?` ${H}`:""}>`;if(V+=`
@@ -3457,9 +3457,9 @@ ${Y}
3457
3457
  } finally {
3458
3458
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3459
3459
  }
3460
- })();`}function hY($,Z){if(s0($)){let Y=s0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:y1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],q=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${q}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var E4=0;function b4($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var Yj=new i1(500),C4=new Set;function Qj(){C4.clear()}function uY($){if($.__onceStore instanceof Set)return $.__onceStore;return C4}async function Y$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||Q0.join(Q0.dirname(J),"partials");if(G&&!Q0.isAbsolute(G))G=Q0.resolve(process.cwd(),G);let z=SY($,"@partial","@include"),q=uY(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,_)=>{let O=F.trim(),L=`${J}:${O}`;if(q.has(L))return"";return q.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let R=z.substring(O+1,w-1),N=R.match(/^\s*['"]([^'"]+)['"]/);if(!N){V.lastIndex=w;continue}let A=N[1],T=K(A,G,J),D="";if(T&&await Bun.file(T).exists())Y.add(T),D=`@include(${R})`;z=z.substring(0,_)+D+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let _=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=_.exec(z))!==null){let L=O.index,w=L+O[0].length-1,R=1,N=w+1;while(N<z.length&&R>0){if(z[N]==="(")R++;else if(z[N]===")")R--;N++}if(R!==0)break;let A=z.substring(w+1,N-1),T=X$(A,0);if(T===-1){_.lastIndex=N;continue}let D=A.substring(0,T).trim(),M=A.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){_.lastIndex=N;continue}let I=k[1],y=M.substring(k[0].length),E,b=X$(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${D})`,f;if(W0(C)){let h=K0(C,Object.keys(Z));f=Boolean(h(...Object.values(Z)))}else f=Boolean(e(C,Z));let u=F?!f:f,P="";if(u){let h=K(I,G,J);if(h&&await Bun.file(h).exists())Y.add(h);P=`@include('${I}'${E?`, ${E}`:""})`}z=z.substring(0,L)+P+z.substring(N),_.lastIndex=0}catch(C){let f=C instanceof Error?C.message:String(C),u=H0("Include",`Error evaluating ${V} condition: ${f}`,J,$,L);z=z.substring(0,L)+u+z.substring(N),_.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),N=z.substring(_,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){V.lastIndex=0,z=z.replace(N,"");continue}let[,T,D,M,k]=A;try{let I,y=D.trim();if(W0(y))I=K0(y,Object.keys(Z))(...Object.values(Z));else I=e(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},f=await H(T,C,$,_);E+=f}else if(k)E=await H(k,{},$,_);z=z.substring(0,_)+E+z.substring(w+1),V.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);z=z.substring(0,_)+H0("Each",`Error in @each: ${y}`,J,$,_)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),N=z.substring(_,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){V.lastIndex=0,z=z.replace(N,"");continue}let T=A[1],D=R.slice(A[0].length),M,k=D.match(/^\s*,\s*\{/);if(k){D=D.slice(k[0].length-1);let E=1,b=1;while(b<D.length&&E>0){if(D[b]==="{")E++;else if(D[b]==="}"){if(E--,E===0)break}b++}M=D.substring(0,b+1),D=D.slice(b+1)}let I,y=D.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=E0(M,Z)}catch(f){let u=f instanceof Error?f.message:String(f);if(X.debug){let P=H0("Include",`Error parsing includeFirst variables: ${u}`,J,$,_,N);z=z.replace(N,()=>P)}else z=z.replace(N,()=>I||"");continue}let C=!1;for(let f of E){let u=K(f,G,J);if(!u)continue;if(await a(u)){let P=await H(f,b,$,_);z=z.replace(N,()=>P),C=!0;break}}if(!C)if(I!==void 0)z=z.replace(N,()=>I);else if(X.debug){let f=H0("Include",`None of the includeFirst paths exist: ${T}`,J,$,_,N);z=z.replace(N,()=>f)}else z=z.replace(N,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=H0("Include",`Error processing @includeFirst: ${b}`,J,$,_,N);z=z.replace(N,()=>C)}V.lastIndex=0}}function K(V,F,_){try{let O=V;if(!V.endsWith(".stx"))O=`${V}.stx`;let L=Q0.resolve(F),w=Q0.resolve(Q0.dirname(_)),R;if(!O.startsWith("./")&&!O.startsWith("../")){for(let k of X._layerPartialDirs??[]){let I=Q0.resolve(k,O);if(I.startsWith(`${Q0.resolve(k)}${Q0.sep}`)&&CY(I))return I}R=Q0.resolve(F,O)}else R=Q0.resolve(w,O);let N=Q0.normalize(R),A=N.startsWith(L+Q0.sep)||N===L,T=N.startsWith(w+Q0.sep)||N===w,D=!1,M=Q0.dirname(w);if(N.startsWith(M+Q0.sep)){if(!Q0.relative(M,N).split(Q0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))D=!0}if(!A&&!T&&!D)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return N}catch(O){return console.error(`Error resolving path ${V}: ${O}`),null}}let W=Q0.resolve(J);Q.add(W);function U(V,F,_,O){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),H0("Include",F,J,_,O)}async function H(V,F={},_,O){let L=K(V,G,J);if(!L)return U(V,`Could not resolve path for include: ${V}`,_,O);let w=Q0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((N)=>Q0.basename(N)).join(" -> ");return U(V,`Circular include detected: ${R}`,_,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(P){let h=P instanceof Error?P.message:String(P);return U(V,`Error loading include file ${V}: ${h}`,_,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:P}=await import("./chunk-gg85dhn4.js");R=P(R,Z)}if(R&&(X.debug||!_9()&&!L9()))try{let{warnUnbalancedTags:P}=await import("./chunk-h78pksyp.js");P(R,L)}catch{}let N=R;try{let{processESImports:P}=await import("./chunk-wb0n3rmf.js");await P(R,Z,L,X,Y)}catch(P){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,P instanceof Error?P.message:P)}let A=G9(N);if(A)N=A.content.trim();let D=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(D)M=`<style${D[1]}>${D[2]}</style>`;let k=[];N=N.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(P,h,m)=>{if(!b4(h))return"";return k.push({attrs:h,body:m}),`__STX_DATA_BLOCK_${k.length-1}__`}),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};I.__stx_signals_gate=X1(R,L);for(let[P,h]of Object.entries(F))I[P]=h;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...R.matchAll(y)],b="",C=null;for(let P of E){let h=P[1]||"",m=P[2]||"";if(b4(h))continue;let j0=h.includes("server"),S0=A1(h);if(!j0&&m.trim()){let{interpolateScriptExpressions:Y0}=await import("./chunk-j18h8dbg.js");m=Y0(m,I)}let y0="";try{let{extractAndStripCssImports:Y0,renderVendorStyleTags:B0}=await import("./chunk-pn60d9sp.js"),M0=Y0(m,{filePath:L,projectRoot:process.cwd()});m=M0.code,y0=B0(M0.styles)}catch(Y0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,Y0 instanceof Error?Y0.message:Y0)}if(S0&&m.trim())m=M1(m);if(!j0){try{let{injectBrowserCoreAutoImports:B0}=await import("./chunk-pn60d9sp.js");m=B0(m).code;let{hasUserImports:M0,bundleClientScript:P0}=await import("./chunk-t088w4j2.js");if(M0(m))m=await P0(m,L,{projectRoot:process.cwd()})}catch(B0){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,B0 instanceof Error?B0.message:B0)}let{stripStxRuntimeImports:Y0}=await import("./chunk-vgwcpt59.js");m=Y0(m)}let h0=PY(m);if(h0&&!j0){C=`stx_scope_${Q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++E4}`;let Y0=$1(m),B0=k4(Y0,C);b+=`${y0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}">${B0}</script>
3461
- `;continue}if(j0)try{let{extractVariables:Y0}=await import("./chunk-x3s0e6wv.js");await Y0(m,I,L)}catch(Y0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,Y0)}if(!j0&&!h0){let Y0=h.replace(/\bclient\b/i,"").trim();C=`stx_scope_${Q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++E4}`;let B0=$1(m),M0=k4(B0,C);b+=`${y0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}"${Y0?` ${Y0}`:""}>${M0}</script>
3462
- `}}if(k.length>0){let{interpolateScriptExpressions:P}=await import("./chunk-j18h8dbg.js");N=N.replace(/__STX_DATA_BLOCK_(\d+)__/g,(h,m)=>{let j0=k[Number(m)];return`<script${j0.attrs}>${P(j0.body,I)}</script>`})}if(C){let P=hY(N,C);if(N=P.html,P.mergedIntoExisting){let m=C,j0=P.mergedIntoExisting;b=b.split(`'${m}'`).join(`'${j0}'`).split(`"${m}"`).join(`"${j0}"`),C=j0}else if(!P.stamped)console.warn(`[stx] ${Q0.relative(process.cwd(),L)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let h=P.stamped&&P.root!==null&&Z$(P.root);b=xY(b,h?C:null)}if(N.includes("@include")||N.includes("@partial"))N=await Y$(N,I,L,X,Y,Q);let{processLoops:f}=await import("./chunk-6g4arx7a.js"),u=f(N,I,L);if(u=e0(u,I,L),u=V1(u,I,L),M)u+=`
3460
+ })();`}function hY($,Z){if(s0($)){let Y=s0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:y1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],q=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${q}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var E4=0;function b4($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var Yj=new i1(500),C4=new Set;function Qj(){C4.clear()}function uY($){if($.__onceStore instanceof Set)return $.__onceStore;return C4}async function Y$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||Q0.join(Q0.dirname(J),"partials");if(G&&!Q0.isAbsolute(G))G=Q0.resolve(process.cwd(),G);let z=SY($,"@partial","@include"),q=uY(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,_)=>{let O=F.trim(),L=`${J}:${O}`;if(q.has(L))return"";return q.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let R=z.substring(O+1,w-1),N=R.match(/^\s*['"]([^'"]+)['"]/);if(!N){V.lastIndex=w;continue}let A=N[1],T=K(A,G,J),D="";if(T&&await Bun.file(T).exists())Y.add(T),D=`@include(${R})`;z=z.substring(0,_)+D+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let _=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=_.exec(z))!==null){let L=O.index,w=L+O[0].length-1,R=1,N=w+1;while(N<z.length&&R>0){if(z[N]==="(")R++;else if(z[N]===")")R--;N++}if(R!==0)break;let A=z.substring(w+1,N-1),T=X$(A,0);if(T===-1){_.lastIndex=N;continue}let D=A.substring(0,T).trim(),M=A.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){_.lastIndex=N;continue}let I=k[1],y=M.substring(k[0].length),E,b=X$(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${D})`,f;if(W0(C)){let h=K0(C,Object.keys(Z));f=Boolean(h(...Object.values(Z)))}else f=Boolean(e(C,Z));let u=F?!f:f,P="";if(u){let h=K(I,G,J);if(h&&await Bun.file(h).exists())Y.add(h);P=`@include('${I}'${E?`, ${E}`:""})`}z=z.substring(0,L)+P+z.substring(N),_.lastIndex=0}catch(C){let f=C instanceof Error?C.message:String(C),u=H0("Include",`Error evaluating ${V} condition: ${f}`,J,$,L);z=z.substring(0,L)+u+z.substring(N),_.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),N=z.substring(_,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){V.lastIndex=0,z=z.replace(N,"");continue}let[,T,D,M,k]=A;try{let I,y=D.trim();if(W0(y))I=K0(y,Object.keys(Z))(...Object.values(Z));else I=e(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},f=await H(T,C,$,_);E+=f}else if(k)E=await H(k,{},$,_);z=z.substring(0,_)+E+z.substring(w+1),V.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);z=z.substring(0,_)+H0("Each",`Error in @each: ${y}`,J,$,_)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),N=z.substring(_,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){V.lastIndex=0,z=z.replace(N,"");continue}let T=A[1],D=R.slice(A[0].length),M,k=D.match(/^\s*,\s*\{/);if(k){D=D.slice(k[0].length-1);let E=1,b=1;while(b<D.length&&E>0){if(D[b]==="{")E++;else if(D[b]==="}"){if(E--,E===0)break}b++}M=D.substring(0,b+1),D=D.slice(b+1)}let I,y=D.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=E0(M,Z)}catch(f){let u=f instanceof Error?f.message:String(f);if(X.debug){let P=H0("Include",`Error parsing includeFirst variables: ${u}`,J,$,_,N);z=z.replace(N,()=>P)}else z=z.replace(N,()=>I||"");continue}let C=!1;for(let f of E){let u=K(f,G,J);if(!u)continue;if(await a(u)){let P=await H(f,b,$,_);z=z.replace(N,()=>P),C=!0;break}}if(!C)if(I!==void 0)z=z.replace(N,()=>I);else if(X.debug){let f=H0("Include",`None of the includeFirst paths exist: ${T}`,J,$,_,N);z=z.replace(N,()=>f)}else z=z.replace(N,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=H0("Include",`Error processing @includeFirst: ${b}`,J,$,_,N);z=z.replace(N,()=>C)}V.lastIndex=0}}function K(V,F,_){try{let O=V;if(!V.endsWith(".stx"))O=`${V}.stx`;let L=Q0.resolve(F),w=Q0.resolve(Q0.dirname(_)),R;if(!O.startsWith("./")&&!O.startsWith("../")){for(let k of X._layerPartialDirs??[]){let I=Q0.resolve(k,O);if(I.startsWith(`${Q0.resolve(k)}${Q0.sep}`)&&CY(I))return I}R=Q0.resolve(F,O)}else R=Q0.resolve(w,O);let N=Q0.normalize(R),A=N.startsWith(L+Q0.sep)||N===L,T=N.startsWith(w+Q0.sep)||N===w,D=!1,M=Q0.dirname(w);if(N.startsWith(M+Q0.sep)){if(!Q0.relative(M,N).split(Q0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))D=!0}if(!A&&!T&&!D)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return N}catch(O){return console.error(`Error resolving path ${V}: ${O}`),null}}let W=Q0.resolve(J);Q.add(W);function U(V,F,_,O){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),H0("Include",F,J,_,O)}async function H(V,F={},_,O){let L=K(V,G,J);if(!L)return U(V,`Could not resolve path for include: ${V}`,_,O);let w=Q0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((N)=>Q0.basename(N)).join(" -> ");return U(V,`Circular include detected: ${R}`,_,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(P){let h=P instanceof Error?P.message:String(P);return U(V,`Error loading include file ${V}: ${h}`,_,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:P}=await import("./chunk-f9qrz82p.js");R=P(R,Z)}if(R&&(X.debug||!_9()&&!L9()))try{let{warnUnbalancedTags:P}=await import("./chunk-h78pksyp.js");P(R,L)}catch{}let N=R;try{let{processESImports:P}=await import("./chunk-z82sc99z.js");await P(R,Z,L,X,Y)}catch(P){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,P instanceof Error?P.message:P)}let A=G9(N);if(A)N=A.content.trim();let D=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(D)M=`<style${D[1]}>${D[2]}</style>`;let k=[];N=N.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(P,h,m)=>{if(!b4(h))return"";return k.push({attrs:h,body:m}),`__STX_DATA_BLOCK_${k.length-1}__`}),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};I.__stx_signals_gate=X1(R,L);for(let[P,h]of Object.entries(F))I[P]=h;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...R.matchAll(y)],b="",C=null;for(let P of E){let h=P[1]||"",m=P[2]||"";if(b4(h))continue;let j0=h.includes("server"),S0=A1(h);if(!j0&&m.trim()){let{interpolateScriptExpressions:Y0}=await import("./chunk-gcavh7hk.js");m=Y0(m,I)}let y0="";try{let{extractAndStripCssImports:Y0,renderVendorStyleTags:B0}=await import("./chunk-hxf6zg80.js"),M0=Y0(m,{filePath:L,projectRoot:process.cwd()});m=M0.code,y0=B0(M0.styles)}catch(Y0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,Y0 instanceof Error?Y0.message:Y0)}if(S0&&m.trim())m=M1(m);if(!j0){try{let{injectBrowserCoreAutoImports:B0}=await import("./chunk-hxf6zg80.js");m=B0(m).code;let{hasUserImports:M0,bundleClientScript:P0}=await import("./chunk-8618n28z.js");if(M0(m))m=await P0(m,L,{projectRoot:process.cwd()})}catch(B0){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,B0 instanceof Error?B0.message:B0)}let{stripStxRuntimeImports:Y0}=await import("./chunk-0ggq64sc.js");m=Y0(m)}let h0=PY(m);if(h0&&!j0){C=`stx_scope_${Q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++E4}`;let Y0=$1(m),B0=k4(Y0,C);b+=`${y0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}">${B0}</script>
3461
+ `;continue}if(j0)try{let{extractVariables:Y0}=await import("./chunk-h63vszd3.js");await Y0(m,I,L)}catch(Y0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,Y0)}if(!j0&&!h0){let Y0=h.replace(/\bclient\b/i,"").trim();C=`stx_scope_${Q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++E4}`;let B0=$1(m),M0=k4(B0,C);b+=`${y0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}"${Y0?` ${Y0}`:""}>${M0}</script>
3462
+ `}}if(k.length>0){let{interpolateScriptExpressions:P}=await import("./chunk-gcavh7hk.js");N=N.replace(/__STX_DATA_BLOCK_(\d+)__/g,(h,m)=>{let j0=k[Number(m)];return`<script${j0.attrs}>${P(j0.body,I)}</script>`})}if(C){let P=hY(N,C);if(N=P.html,P.mergedIntoExisting){let m=C,j0=P.mergedIntoExisting;b=b.split(`'${m}'`).join(`'${j0}'`).split(`"${m}"`).join(`"${j0}"`),C=j0}else if(!P.stamped)console.warn(`[stx] ${Q0.relative(process.cwd(),L)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let h=P.stamped&&P.root!==null&&Z$(P.root);b=xY(b,h?C:null)}if(N.includes("@include")||N.includes("@partial"))N=await Y$(N,I,L,X,Y,Q);let{processLoops:f}=await import("./chunk-1ppaw4xs.js"),u=f(N,I,L);if(u=e0(u,I,L),u=V1(u,I,L),M)u+=`
3463
3463
  `+M;if(b)u+=`
3464
3464
  `+b;return u}catch(R){let N=R instanceof Error?R.message:String(R);return U(V,`Error processing include ${V}: ${N}`,_,O)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,F=V+B[0].length-1,_=1,O=F+1;while(O<z.length&&_>0){if(z[O]==="(")_++;else if(z[O]===")")_--;O++}if(_!==0)break;let L=z.substring(V,O),w=z.substring(F+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=O;continue}let N=R[1],A,T=w.substring(R[0].length),D=X$(T,0);if(D!==-1)A=T.substring(D+1).trim();let M={};if(A)try{M=E0(A,Z)}catch(I){let y=I instanceof Error?I.message:String(I);z=z.replace(L,H0("Include",`Error parsing include variables for ${N}: ${y}`,J,$,V)),j.lastIndex=0;continue}let k=await H(N,M,$,V);z=z.substring(0,V)+k+z.substring(O),j.lastIndex=0}return z}function Q$($,Z){let J=$;function X(Y,Q,G,z){let q=Y,K=!0;while(K){K=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=q.match(W);if(!U||U.index===void 0)break;let H=U.index,j=U[1],B=H+U[0].length,V=new RegExp(`@${Q}\\(`),F=new RegExp(`@${G}(?![a-z])`),_=1,O=B,L=-1;while(_>0&&O<q.length){let R=q.slice(O),N=R.match(V),A=R.match(F),T=N?O+N.index:1/0,D=A?O+A.index:1/0;if(T<D)_++,O=T+(N[0].length||1);else if(D<1/0){if(_--,_===0){L=D;break}O=D+G.length+1}else break}if(L===-1)break;let w=q.slice(B,L);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);q=q.substring(0,H)+q.substring(L+`@${G}`.length),K=!0}return q}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function G$($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
3465
3465
  `)})}import*as z$ from"path";async function S4($,Z,J=""){if(z$.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return v4($,Z,J,"@js","@endjs")}async function P4($,Z,J=""){if(z$.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return v4($,Z,J,"@ts","@endts")}async function v4($,Z,J,X,Y){let Q=$,G=v1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],q;while((q=G.exec($))!==null)z.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:K,content:W,index:U}of z)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),V=W.trim();if(X==="@ts")V=V.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 _=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=_.length>0?`return { ${_.join(", ")} };`:"return {};",L=`
@@ -3522,14 +3522,14 @@ ${$.slice(J)}`}function R6($,Z={},J={},X){if(X??w$($))return $;return CQ($,Z,J)}
3522
3522
  ${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3523
3523
  `+$.slice(G)}if(s0($))return y1($,(G)=>`${G}
3524
3524
  ${Z}`);return`${Z}
3525
- ${$}`}async function M9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-dy6aq1fx.js"),{url:Q}=await Y("runtime",Z.debug===!0);return N$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return N$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-dy6aq1fx.js"),X=await J(Z.debug);return N$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function xQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function b6($){if($.includes("data-stx-tooltip-runtime")||!xQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${r5()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3525
+ ${$}`}async function M9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-bxvqqejm.js"),{url:Q}=await Y("runtime",Z.debug===!0);return N$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return N$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-bxvqqejm.js"),X=await J(Z.debug);return N$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function xQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function b6($){if($.includes("data-stx-tooltip-runtime")||!xQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${r5()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3526
3526
  ${Z}`;return`${$.slice(0,J)}${Z}
3527
3527
  ${$.slice(J)}`}var gQ=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function hQ($){return gQ.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function uQ($,Z){if(!$.includes("</body>"))return $;if(hQ($))return $;let J=Z?.router,X="";{let q={};if(J){if(J.container)q.container=J.container;if(J.interceptAllLinks!==void 0)q.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)q.progress=J.progress;if(J.viewTransitions!==void 0)q.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)q.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)q.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)q.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)q.prefetch=J.prefetch;if(J.cache!==void 0)q.cache=J.cache;if(J.progressColor!==void 0)q.progressColor=J.progressColor;if(J.progressHeight!==void 0)q.progressHeight=J.progressHeight}try{let K=await I6(Z?.pagesDir,Z?.root);if(K.length>0)q.ownedRoutes=K}catch{}if(Object.keys(q).length>0)X=`<script>window.__stxRouterConfig=${T6(q)};</script>
3528
- `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-dy6aq1fx.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Q("router")).url}"></script>`:`<script data-stx-router>${await Y()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
3528
+ `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-bxvqqejm.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Q("router")).url}"></script>`:`<script data-stx-router>${await Y()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
3529
3529
  </body>`+$.slice(z+7)}var y6=Symbol.for("stx.lazy-module-promises");function dQ(){let $=globalThis;return $[y6]??=new Map,$[y6]}function o($,Z){let J=dQ(),X=`${import.meta.url}\x00${$}`,Y=J.get(X);if(Y)return Y;let Q=Z();return J.set(X,Q),Q.catch(()=>{if(J.get(X)===Q)J.delete(X)}),Q}var D$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,u6=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,mQ=65536,lQ=4,T9=new Map;function bB(){T9.clear()}function cQ($){let Z=[];for(let J of T2($,Y2)){let X=J.token.match(/^<script\b([^>]*)>/i),Y=J.token.match(/<\/script\s*>$/i);if(!X||!Y)continue;let Q=X[0].length,G=J.token.length-Y[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Q,G),start:J.start,end:J.end}))}return Z}function pQ($,Z={}){let J=$.length>=mQ,X=J?T9.get($):void 0;if(X===void 0){if(X=cQ($),J)h6(T9,lQ),T9.set($,X)}let Y=Z.skipAttrs;if(!Y)return X.slice();let Q=[];for(let G of X)if(Y.lastIndex=0,!Y.test(G.attrs))Q.push(G);return Q}function d6($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=C6(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=C6(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function C6($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function I$($,Z){return g6($,Z)}function iQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Y=X[1];if(Y.startsWith("if"))J++;else if(Y==="endif")J--;else if(J===0)return!0}return!1}function nQ($){let Z=new Set,J=/<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|useModel)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function sQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${D$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=T2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of X){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(J),q=d6(z?.[1]??z?.[2]??""),K=[q.itemVar,q.indexVar].filter(Boolean);if(K.length===0)continue;let W=G[1],H=/\/\s*>$/.test(Q.token)||k9.has(W.toLowerCase())?Q.end:l6($,Q.start,W,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(K)})}return Y}var S6=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"]);function oQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function P6($,Z,J,X){if(!$)return!1;let Y=oQ($),Q=!1,G=!1,z=!1,q=/([a-zA-Z_$][\w$]*)/g,K;while((K=q.exec(Y))!==null){let j=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(S6.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(Y))!==null){let j=U[1];if(Y.slice(0,U.index).trimEnd().endsWith("."))continue;if(S6.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function I9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(u6);if(Q&&rQ(Q[3],Q[1])){let[,G,z,q]=Q;return`<${G}${z}${X}>${q}</${G}>`}return`<template${X}>${Y}</template>`}function rQ($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Y;while((Y=J.exec($))!==null)if(Y[1]){if(X--,X<0)return!1}else X++;return!0}function m6($,Z){let J=nQ($);function X(Y){let Q=Y,G=sQ(Y),z=(U)=>{let H=new Set;for(let j of G)if(U>j.start&&U<j.end)for(let B of j.vars)H.add(B);return H},q=/@if\s*\(/g,K,W=[];while((K=q.exec(Q))!==null){let U=K.index,H=U+K[0].length,j=1,B=H;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(H,B-1).trim(),F=B,_=1,O=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))_++;else if(w[1]==="endif"){if(_--,_===0){O=w.index+w[0].length;break}}if(_!==0)continue;let R=Q.substring(F,O-6).trim(),N;if(iQ(R)){let A=j2(Q.substring(U,O));if(A.length===0)continue;let T=A[0].branches.filter((I)=>I.type!=="else"),D=z(U);if(!(T.length>0&&T.every((I)=>P6(I.condition,J,Z,D))))continue;N=A[0].branches.map((I)=>{let y=X(I.content);if(I.type==="elseif")return I9(y,"@else-if",I.condition??"");if(I.type==="else")return I9(y,"@else");return I9(y,"@if",I.condition??"")}).join(`
3530
3530
  `)}else{if(!P6(V,J,Z,z(U)))continue;N=I9(X(R),"@if",V)}W.push({start:U,end:O,replacement:N}),q.lastIndex=O}for(let U=W.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=W[U];Q=Q.substring(0,H)+B+Q.substring(j)}return Q}return X($)}function aQ($){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 Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var k9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),v6=/<(script|style)\b/iy,tQ=/<\/script/gi,eQ=/<\/style/gi;function l6($,Z,J,X){if(k9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let q=$.indexOf("<",z);if(q===-1)return-1;if(z=q,$.startsWith("<!--",z)){let H=$.indexOf("-->",z+4);if(H===-1)return-1;z=H+3;continue}v6.lastIndex=z;let K=v6.exec($);if(K){let H=$.indexOf(">",z);if(H===-1)return-1;if($[H-1]==="/"){z=H+1;continue}let j=K[1].toLowerCase()==="script"?tQ:eQ;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let V=$.indexOf(">",B.index);if(V===-1)return-1;z=V+1;continue}if($[z+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!H){z++;continue}if(H[1].toLowerCase()===Y){if(G--,z+=H[0].length,G===0)return z;continue}z+=H[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!W){z++;continue}let U=$.indexOf(">",z);if(U===-1)return-1;if(W[1].toLowerCase()===Y){let H=$.slice(z,U+1);if(!(/\/\s*>$/.test(H)||k9.has(Y)))G++}z=U+1}return-1}var $G=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ZG($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Y=$.indexOf(">",J);if(Y===-1)return!1;let Q=$.slice(J,Y+1);return $G.test(Q)}function c6($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Y=(U)=>Z.some(([H,j])=>U>=H&&U<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[U,H,j,B,V,F,_]=z,O=aQ(V);if(O===void 0)continue;let L=z.index,w=L+U.length,A=!!_||/\/\s*>$/.test(U)||k9.has(H.toLowerCase())?w:l6($,L,H,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&ZG($,A)){Q.lastIndex=w;continue}if(O===!0){let D=`<${H}${j}${F}${_}>`;G.push({start:L,end:w,replacement:D});continue}G.push({start:L,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((U,H)=>U.start-H.start);let q=[],K=-1;for(let U of G){if(U.start<K)continue;q.push(U),K=U.end}let W=$;for(let U=q.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=q[U];W=W.substring(0,H)+B+W.substring(j)}return W}function T$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],q=Y.index,K=q+Y[0].length,W=1,U=K;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")")W--;U++}if(W!==0)continue;let H=J.substring(K,U-1).trim(),j=U,B=d6(H),V=z==="for"?"@endfor":"@endforeach",F=1,_=j,O=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");O.lastIndex=j;let L;while((L=O.exec(J))!==null)if(L[1].startsWith(z))F++;else if(F--,F===0){_=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:q,end:_,vars:M})};if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){w();continue}let k=M.split(/[.[(]/)[0].trim(),I=Z?k in Z:!1,y=G.some((E)=>q>E.start&&q<E.end&&E.vars.includes(k));if(k&&(I||y)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=J.substring(j,_-V.length).trim(),N=Z?{...Z}:{};if(B.itemVar)delete N[B.itemVar];if(B.indexVar)delete N[B.indexVar];let A=T$(R,N),T=A.match(u6),D;if(T){let[,M,k,I]=T;D=`<${M}${k} @for="${H}">${I}</${M}>`}else D=`<template @for="${H}">${A}</template>`;Q.push({start:q,end:_,replacement:D}),X.lastIndex=_}for(let z=Q.length-1;z>=0;z--){let{start:q,end:K,replacement:W}=Q[z];J=J.substring(0,q)+W+J.substring(K)}return J}function JG($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(W)=>{let U=X+1;while(U<Q){let H=$[U];if(H==="\\"){U+=2;continue}if(H===W)return U+1;U++}return Q},z=()=>{let W=X+2;while(W<Q&&$[W]!==`
3531
3531
  `)W++;return W},q=()=>{let W=X+2;while(W<Q-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Q},K=(W)=>{let U=W,H=0;while(U<Q){let j=$[U];if(j==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
3532
- `)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){H++,U++;continue}if(j===")"||j==="]"||j==="}"){H--,U++;continue}if(j===";"&&H===0)return U+1;U++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let U=z();J.push($.slice(X,U)),X=U;continue}if(W==="/"&&$[X+1]==="*"){let U=q();J.push($.slice(X,U)),X=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(X,U)),X=U;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=K(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var XG=new Set(["script","style","html","head","meta","link","title","!doctype"]);function A$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function YG($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!A$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function QG($,Z){if(YG($,"<body",Z)){let Y=new RegExp(`<body(${D$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!A$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${D$})>`,"gi"),X;while((X=J.exec($))!==null){if(A$(X.index,X.index+X[0].length,Z))continue;if(XG.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function GG($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,q=(K)=>{if(J!==null&&!z&&J>=G&&J<=K)Y.push($.slice(G,J),Q,$.slice(J,K)),z=!0;else Y.push($.slice(G,K))};for(let K of Z){if(K.start<G)continue;q(K.start),G=K.end}return q($.length),Y.join("")}async function zG($,Z,J){let X=pQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-t088w4j2.js"));for(let O of X){let L=O.body;if(A1(O.attrs))L=M1(L);if(Y.test(L)){Q.push({content:L,start:O.start,end:O.end});continue}if(!G(L))continue;try{let w=await z(a1(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:O.start,end:O.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let q=`${Z??""}\x00${Q.map((O)=>O.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,W=[];for(let O=0;O<Q.length;O++){let L=Q[O].bundled??a1(Q[O].content).code;if(!Q[O].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=UG(L);let w=$1(L);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
3532
+ `)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){H++,U++;continue}if(j===")"||j==="]"||j==="}"){H--,U++;continue}if(j===";"&&H===0)return U+1;U++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let U=z();J.push($.slice(X,U)),X=U;continue}if(W==="/"&&$[X+1]==="*"){let U=q();J.push($.slice(X,U)),X=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(X,U)),X=U;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=K(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var XG=new Set(["script","style","html","head","meta","link","title","!doctype"]);function A$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function YG($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!A$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function QG($,Z){if(YG($,"<body",Z)){let Y=new RegExp(`<body(${D$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!A$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${D$})>`,"gi"),X;while((X=J.exec($))!==null){if(A$(X.index,X.index+X[0].length,Z))continue;if(XG.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function GG($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,q=(K)=>{if(J!==null&&!z&&J>=G&&J<=K)Y.push($.slice(G,J),Q,$.slice(J,K)),z=!0;else Y.push($.slice(G,K))};for(let K of Z){if(K.start<G)continue;q(K.start),G=K.end}return q($.length),Y.join("")}async function zG($,Z,J){let X=pQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-8618n28z.js"));for(let O of X){let L=O.body;if(A1(O.attrs))L=M1(L);if(Y.test(L)){Q.push({content:L,start:O.start,end:O.end});continue}if(!G(L))continue;try{let w=await z(a1(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:O.start,end:O.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let q=`${Z??""}\x00${Q.map((O)=>O.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,W=[];for(let O=0;O<Q.length;O++){let L=Q[O].bundled??a1(Q[O].content).code;if(!Q[O].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=UG(L);let w=$1(L);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
3533
3533
  ${w}`)}let U=W.join(`
3534
3534
 
3535
3535
  `);U=JG(U);let H=qG(U),j=H.split(",").map((O)=>O.trim()).filter(Boolean),B=M$(U,J),V=`
@@ -3564,13 +3564,13 @@ ${q.join(`
3564
3564
  Tip: prefer useRef(), navigate(), and composables for component code`;if(y$.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}AG();import S$ from"path";var RG=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,NG=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function DG($,Z){if(!Z||!$.includes("/"))return $;let J=S$.dirname(Z);return $.replace(RG,(X,Y,Q,G)=>{let z=S$.resolve(J,G);return`${Y}${Q}${z.split(S$.sep).join("/")}${Q}`})}function Q8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(NG,(J,X,Y,Q)=>`${X}${DG(Y,Z)}${Q}`)}var E1="<!--PARENT_CONTENT_PLACEHOLDER-->";function G8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function IG($,Z){let J=$.length,X=Z,Y=!0,Q=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
3565
3565
  `,X+2),X===-1)return-1;X+=1,Y=!0;continue}if(z==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Y=!0;continue}if(z==="/"&&Y){let q=X+1,K=!1;while(q<J){let W=$[q];if(W==="\\"){q+=2;continue}if(W==="[")K=!0;else if(W==="]")K=!1;else if(W==="/"&&!K){q++;break}else if(W===`
3566
3566
  `){q=-1;break}q++}if(q===-1){X++,Y=!1;continue}while(q<J&&/[a-z]/.test($[q]))q++;X=q,Y=!1;continue}if(z==="'"||z==='"'){let q=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
3567
- `)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function M8($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}var z8=/<style\b[^>]*>/iy,q8=/<\/style>/gi,K8=/<script\b[^>]*>/iy;function W8($){let Z=0;while(Z<$.length){let J=$.indexOf("<",Z);if(J===-1)return-1;if($.startsWith("<!--",J)){let Y=$.indexOf("-->",J+4);Z=Y===-1?$.length:Y+3;continue}z8.lastIndex=J;let X=z8.exec($);if(X){q8.lastIndex=J+X[0].length;let Y=q8.exec($);Z=Y===null?$.length:Y.index+8;continue}if(K8.lastIndex=J,K8.test($))return J;Z=J+1}return-1}async function U8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await o("stx/client-module-registry",()=>import("./chunk-7nes75cd.js")),Y=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Y)return null;return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function TG($,Z=""){let J=M8($,"data-stx-runtime");if(!J)return $;let X=W8($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
3567
+ `)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function M8($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}var z8=/<style\b[^>]*>/iy,q8=/<\/style>/gi,K8=/<script\b[^>]*>/iy;function W8($){let Z=0;while(Z<$.length){let J=$.indexOf("<",Z);if(J===-1)return-1;if($.startsWith("<!--",J)){let Y=$.indexOf("-->",J+4);Z=Y===-1?$.length:Y+3;continue}z8.lastIndex=J;let X=z8.exec($);if(X){q8.lastIndex=J+X[0].length;let Y=q8.exec($);Z=Y===null?$.length:Y.index+8;continue}if(K8.lastIndex=J,K8.test($))return J;Z=J+1}return-1}async function U8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await o("stx/client-module-registry",()=>import("./chunk-jdcn0ms1.js")),Y=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Y)return null;return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function TG($,Z=""){let J=M8($,"data-stx-runtime");if(!J)return $;let X=W8($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
3568
3568
  `+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=W8(Q);if(G===-1)return Y+Z+`
3569
3569
  `+Q;return Q.slice(0,G)+Y+Z+`
3570
3570
  `+Q.slice(G)}async function v$($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=X1($,J);let Q=!Z.__stxProcessingDepth;V$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await C9(Z,J,X.runtimeConfig);if(Q)e$(Z),Z.__stx_head_injections=W$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!_9()&&!L9())&&J&&J.endsWith(".stx"))A8($,J);try{return await w8.timeAsync("template-processing",async()=>{let G=await kG($,Z,J,X,Y);if(Q)G=b$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},K=(Z.__stx_runtime_head||null)??D8(),W=(Z.__stx_head_raw||"").trim(),U,H=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)U=H[1].trim(),W=W.replace(H[0],"").trim();let j=Z.__sections?.title,B=K.title||U||j,V=!K.title&&(!!U||!!j),F=K.meta||[],_=new Set(F.map((A)=>o1(A)).filter(Boolean)),O={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((A)=>!_.has(o1(A))),...F],link:[...z.link||[],...K.link||[]],script:[...z.script||[],...K.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
3571
3571
  `),...K.htmlAttrs&&{htmlAttrs:O6(z.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...K.bodyAttrs}}},L=w$(G);if(G=R6(G,O,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=w6(G,z),G=F6(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let A=w[1],T=O8(A);G=G.replace(/<head\b[^>]*>/i,(D)=>`${D}
3572
3572
  <meta name="stx-layout" content="${G8(A)}">
3573
- <meta name="stx-layout-group" content="${G8(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),N=R?s0(G):null;if(R&&N&&!/\bdata-stx=/.test(N.tag)){G=y1(G,(T,D)=>`<body${D} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Q){let z=Z.__stx_head_injections??W$(),q=O$(G);if(q!==null)z.beforeClose.push(q);let K=B$(G);if(K!==null)z.afterOpen.push(K);G=Y6(G,z);let W=X.app?.colorMode;if(W)G=z6(G,W)}if(Q)if(M8(G,"data-stx-runtime")){let q=null,K=null,W=null,U=null;try{let{getStoreScript:j}=await o("stx/store-loader",()=>import("./chunk-sc70p4kj.js")),B=X.storesDir,V=await j(B);if(V)K=`<script data-stx-stores>${V}</script>`}catch{}q=await U8([G,K],X);try{let{getFrameworkComposableScript:j}=await o("stx/framework-composables",()=>import("./chunk-vb16zpbw.js"));U=await j(G)}catch{}try{let{getComposableScript:j}=await o("stx/composable-loader",()=>import("./chunk-w3qdxrpv.js")),B=X.composablesDir,V=[q,K,U].filter((_)=>_!==null),F=await j(X._layerComposableDirs??B,G,V);if(F)W=`<script data-stx-composables>${F}</script>`}catch{}let H=[q,K,W,U].filter((j)=>j!==null).map((j)=>`
3573
+ <meta name="stx-layout-group" content="${G8(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),N=R?s0(G):null;if(R&&N&&!/\bdata-stx=/.test(N.tag)){G=y1(G,(T,D)=>`<body${D} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Q){let z=Z.__stx_head_injections??W$(),q=O$(G);if(q!==null)z.beforeClose.push(q);let K=B$(G);if(K!==null)z.afterOpen.push(K);G=Y6(G,z);let W=X.app?.colorMode;if(W)G=z6(G,W)}if(Q)if(M8(G,"data-stx-runtime")){let q=null,K=null,W=null,U=null;try{let{getStoreScript:j}=await o("stx/store-loader",()=>import("./chunk-6xmx6stb.js")),B=X.storesDir,V=await j(B);if(V)K=`<script data-stx-stores>${V}</script>`}catch{}q=await U8([G,K],X);try{let{getFrameworkComposableScript:j}=await o("stx/framework-composables",()=>import("./chunk-w6ncyp18.js"));U=await j(G)}catch{}try{let{getComposableScript:j}=await o("stx/composable-loader",()=>import("./chunk-8avktqwz.js")),B=X.composablesDir,V=[q,K,U].filter((_)=>_!==null),F=await j(X._layerComposableDirs??B,G,V);if(F)W=`<script data-stx-composables>${F}</script>`}catch{}let H=[q,K,W,U].filter((j)=>j!==null).map((j)=>`
3574
3574
  ${j}`).join("");G=TG(G,H)}else{let q=await U8([G],X);if(q){let K=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(K!==-1)G=G.slice(0,K)+q+`
3575
3575
  `+G.slice(K)}}if(Q)G=q6(G);if(Q&&Z.__stx_inject_css!==!1)G=await N8(G,void 0,X.buildMode==="serve",!0);else if(Q)G=R8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=F8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=j6(Z);if(z){let q=/<head\b[^>]*>/i.exec(G),K=q?q.index+q[0].length:0;G=G.slice(0,K)+z+G.slice(K)}}return G})}catch(G){if(G instanceof j8)throw G;let z=G instanceof Error?G.message:String(G),q=new k2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(q,{filePath:J,context:Z}),V8.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),X.debug)throw q;return B8.createFallbackContent("Template Processing",q)}}async function kG($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!T0.isAbsolute(X.partialsDir)?T0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!T0.isAbsolute(X.componentsDir)?T0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!T0.isAbsolute(X.layoutsDir)?T0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,q=$;await yG(J,Z),bG(Z,z),q=await E2(()=>n4(q,Z,J,z),q,(L)=>{o0.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=B1(q,V9,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=K.output;let W=K.tokens,U=(L)=>W.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>W[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,H),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),q=t4(q),q=await r6(q,J,Y);let j={};q=Q$(q,j);let B={...Z.__sections||{}},V="",F=k3(T3($)),_=/@nolayout\b/.test(q)||F===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)V=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(V=F,!/@section\s*\(/.test(q))q=`@section('content')
3576
3576
  ${q.trim()}
@@ -3579,7 +3579,7 @@ ${q.trim()}
3579
3579
  @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let N=e(R.trim(),Z);if(N===void 0)return L;return B[w]=String(N??""),""}catch{return L}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",E1);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=G$(q,j),V){let L=[],w=n0(q),R=B1(w.output,m2,(N,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(N,A,T)=>{let D=A==="SCRIPT"?CG(w.scripts[Number(T)],J):R.tokens[Number(T)];if(D)L.push(D);return""}),L.length>0){let N=L.join(`
3580
3580
  `);B.content=B.content?`${B.content}
3581
3581
  ${N}`:N,Z.__sections=B}}if(V)try{let L;if(T0.isAbsolute(V))L=V,Y.add(V);else L=await E2(()=>r2(V,J,G,Y),null,()=>{throw new k2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let D=(I)=>{if(!I)return[];try{let y=T0.isAbsolute(I)?I:T0.resolve(process.cwd(),I);return MG.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...D(G.layoutsDir),...D(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),k=`Layout not found: ${V} (referenced from ${J})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(o0.log(Error(k),{layoutPath:V,filePath:J,available:M},"error"),console.error(`[stx] ${k}`),G.debug)throw new k2(k,J);return q}let w=await E2(()=>Bun.file(L).text(),"",()=>{throw new k2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=Q8(w,L);let R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let D={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return D[E]=b.trim(),""});for(let[y,E]of Object.entries(D))if(B[y]&&B[y].includes(E1)){let b=B[y].indexOf(E1);B[y]=B[y].slice(0,b)+E+B[y].slice(b+E1.length)}else if(!B[y])B[y]=E;let k={...Z,__sections:B},I=`@layout('${R[1]}')${M}`;return await v$(I,k,L,G,Y)}let N=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=Q$(N,j),T={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,M,k)=>{return T[M]=k.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(D,M,k)=>{if(B[M]){let I=B[M];if(I.includes(E1)){let y=T[M]||"",E=I.indexOf(E1);I=I.slice(0,E)+y+I.slice(E+E1.length)}return I}return k||""}),A=EG(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=G$(A,j),Z.__originalFilePath=J,q=await H8(A,Z,L,G,Y),q=`<!-- stx-layout: ${V} -->
3582
- ${q}`,U(q)}catch(L){return o0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return U(await H8(q,Z,J,G,Y))}function EG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function bG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function yG($,Z){await E2(()=>r4($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var P$="data-stx-source";function CG($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(P$))return $;return`<script ${P$}="${encodeURIComponent(Z)}"${$.slice(7)}`}function SG($){let Z=new RegExp(`${P$}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}async function PG($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=X.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;let q=SG(Q)??J;try{let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-x3s0e6wv.js"));await K(G,Z,q,{preserveExisting:!0})}catch(K){let W=K instanceof Error?K:Error(String(K));o0.log(W,{filePath:q,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${q}: ${W.message}`)}}}async function vG($,Z,J){try{let{interpolateScriptsInTemplate:X}=await o("stx/expressions",()=>import("./chunk-j18h8dbg.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return o0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function H8($,Z,J,X,Y){let Q=$,G=X;if(await PG(Q,Z,J),Q=await vG(Q,Z,J),Q=await S4(Q,Z,J),Q=await P4(Q,Z,J),Q=await x7(Q,Z,J,G),X1(Q))Q=m6(Q,Z),Q=T$(Q,Z);Q=c6(Q);let{processStreamDirectives:z}=await o("stx/streaming",()=>import("./chunk-gg85dhn4.js"));Q=z(Q,Z),Q=m4(Q,Z,J,G),Q=await J6(Q,Z,J,G,Y),Q=await J$(Q,Z,J,G,Y),Q=I3(Q,Z,J,G);let{processDeferDirectives:q}=await o("stx/defer",()=>import("./chunk-v33qvj8y.js"));Q=q(Q,Z,J);let{processTeleportDirectives:K}=await o("stx/teleport",()=>import("./chunk-7yzyn9k7.js"));Q=K(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:U}=await o("stx/transitions",()=>import("./chunk-ksqba0cq.js"));Q=W(Q,Z,J),Q=U(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-nnv8wytm.js"));Q=H(Q,Z,J);let{processSuspenseDirectives:j}=await o("stx/suspense",()=>import("./chunk-8q8gj45z.js"));Q=j(Q,Z,J);let{processAsyncDirectives:B}=await o("stx/async-components",()=>import("./chunk-t5kwx6fa.js"));Q=B(Q,Z,J);let{processKeepAliveDirectives:V}=await o("stx/keep-alive",()=>import("./chunk-wwghzbbg.js"));Q=V(Q,Z,J);let{processVirtualListDirectives:F,processVirtualGridDirectives:_,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-kexk6z9s.js"));Q=F(Q,Z,J),Q=_(Q,Z,J),Q=O(Q,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-bnq0p4r4.js"));Q=L(Q,Z,J),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:N}=await o("stx/computed",()=>import("./chunk-jd9nv63q.js"));Q=R(Q,Z,J),Q=N(Q,Z,J);let{processFormValidationDirectives:A}=await o("stx/forms-validation",()=>import("./chunk-604qr43v.js"));Q=A(Q,Z,J);let{processHeadDirective:T,processTitleDirective:D,processMetaDirective:M,resetHead:k}=await o("stx/head",()=>import("./chunk-ajhrz96a.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
3582
+ ${q}`,U(q)}catch(L){return o0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return U(await H8(q,Z,J,G,Y))}function EG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function bG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function yG($,Z){await E2(()=>r4($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var P$="data-stx-source";function CG($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(P$))return $;return`<script ${P$}="${encodeURIComponent(Z)}"${$.slice(7)}`}function SG($){let Z=new RegExp(`${P$}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}async function PG($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=X.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;let q=SG(Q)??J;try{let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-h63vszd3.js"));await K(G,Z,q,{preserveExisting:!0})}catch(K){let W=K instanceof Error?K:Error(String(K));o0.log(W,{filePath:q,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${q}: ${W.message}`)}}}async function vG($,Z,J){try{let{interpolateScriptsInTemplate:X}=await o("stx/expressions",()=>import("./chunk-gcavh7hk.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return o0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function H8($,Z,J,X,Y){let Q=$,G=X;if(await PG(Q,Z,J),Q=await vG(Q,Z,J),Q=await S4(Q,Z,J),Q=await P4(Q,Z,J),Q=await x7(Q,Z,J,G),X1(Q))Q=m6(Q,Z),Q=T$(Q,Z);Q=c6(Q);let{processStreamDirectives:z}=await o("stx/streaming",()=>import("./chunk-f9qrz82p.js"));Q=z(Q,Z),Q=m4(Q,Z,J,G),Q=await J6(Q,Z,J,G,Y),Q=await J$(Q,Z,J,G,Y),Q=I3(Q,Z,J,G);let{processDeferDirectives:q}=await o("stx/defer",()=>import("./chunk-v33qvj8y.js"));Q=q(Q,Z,J);let{processTeleportDirectives:K}=await o("stx/teleport",()=>import("./chunk-7yzyn9k7.js"));Q=K(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:U}=await o("stx/transitions",()=>import("./chunk-ksqba0cq.js"));Q=W(Q,Z,J),Q=U(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-nnv8wytm.js"));Q=H(Q,Z,J);let{processSuspenseDirectives:j}=await o("stx/suspense",()=>import("./chunk-8q8gj45z.js"));Q=j(Q,Z,J);let{processAsyncDirectives:B}=await o("stx/async-components",()=>import("./chunk-t5kwx6fa.js"));Q=B(Q,Z,J);let{processKeepAliveDirectives:V}=await o("stx/keep-alive",()=>import("./chunk-wwghzbbg.js"));Q=V(Q,Z,J);let{processVirtualListDirectives:F,processVirtualGridDirectives:_,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-kexk6z9s.js"));Q=F(Q,Z,J),Q=_(Q,Z,J),Q=O(Q,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-bnq0p4r4.js"));Q=L(Q,Z,J),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:N}=await o("stx/computed",()=>import("./chunk-jd9nv63q.js"));Q=R(Q,Z,J),Q=N(Q,Z,J);let{processFormValidationDirectives:A}=await o("stx/forms-validation",()=>import("./chunk-604qr43v.js"));Q=A(Q,Z,J);let{processHeadDirective:T,processTitleDirective:D,processMetaDirective:M,resetHead:k}=await o("stx/head",()=>import("./chunk-ajhrz96a.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
3583
3583
  `;if(Q=D(Q,Z),Q=M(Q,Z),Q=o4(Q),Q=N5(Q,Z),Q=f7(Q),Q=p4(Q),Q=await Y$(Q,Z,J,G,Y),Q=await J$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=$3(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=b$(Q),Q=e0(Q,Z,J),Q=b3(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=D5(Q,Z),Q=A5(Q,Z),Q=_2(Q,Z),Q=y5(Q,Z),Q=C5(Q,Z),Q=await D7(Q,Z,J,G),Q=await x3(Q,Z,J),Q=await _8(Q,Z,J,G),Q=L8(Q,Z,J,G),Q=G7(Q,Z,J,G),Q=z7(Q,Z,J),Q=q7(Q,Z,J,G),Q=P7(Q,Z,J,G),Q=k$(Q,Z),Q=E$(Q),Q=e6(Q),!G.skipEventDirectives)Q=a$(Q,Z,J);if(Q=S3(Q,Z,J),G.debug){let s=/\bx-data\s*=/.test(Q),p=I$($);if(s&&p)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3584
3584
  Both work on the same page, but they manage separate scopes.
3585
3585
  Prefer signals (state/derived/effect) for new components.`)}Q=w4(Q,Z),Q=await V1(Q,Z,J),Q=X8(Q),Q=Y8(Q),Q=O3(Q);let{processXElementDirectives:y}=await o("stx/x-element",()=>import("./chunk-y4dd2n2n.js"));Q=y(Q);let E=Z.__originalFilePath||J,b=E9(Z);if(Q=await p6(Q,G,E,b),Q=d7(Q,Z),Q=await s4(Q,Z,J,G),G.media?.image?.autoSiblings){let s=G.publicDir||"public",{rewriteImagesWithSiblings:p}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-vpbw6g2t.js"));Q=await p(Q,{publicDir:s})}if(G.seo?.enabled)Q=K7(Q,Z,G);let C=(s,p,q0=!0)=>{if(!p)return s;let Z0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),V0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Z0&&V0){if(q0)s=s.replace(V0[0],Z0[0]);if(p=p.replace(Z0[0],"").trim(),!p)return s}if(/<\/head>/i.test(s))return s.replace(/<\/head>/i,`${p}
@@ -3593,7 +3593,7 @@ ${V3()}
3593
3593
  `+j1}else Q=Q.replace("</head>",`${p}
3594
3594
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3595
3595
  ${p}`);else Q=p+`
3596
- `+Q}{let{scanScriptTags:s}=await o("stx/signal-processing",()=>import("./chunk-vgwcpt59.js")),p=[];for(let q0 of s(Q)){if(!/\bserver\b/i.test(q0.attrs))continue;let Z0=q0.start+q0.fullMatch.indexOf(">")+1,V0=IG(Q,Z0);if(V0===-1)continue;let k0=V0+9;while(k0<Q.length&&/\s/.test(Q[k0]))k0++;p.push({start:q0.start,end:k0})}if(p.length>0){let q0=Array(p.length+1),Z0=0;for(let V0=0;V0<p.length;V0++){let{start:k0,end:j1}=p[V0];q0[V0]=Q.slice(Z0,k0),Z0=j1}q0[p.length]=Q.slice(Z0),Q=q0.join("")}}let y0=y9(Q,J);if(y0.hasScoped)Q=y0.html;let h0=Z.__stx_event_bindings||[],Y0=!1,B0=[],M0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:P0}=await o("stx/signal-processing",()=>import("./chunk-vgwcpt59.js"));for(let s of P0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))B0.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:p,content:q0}of B0){Y0=!0;let Z0=q0;C$(q0,J,X.strict,Z.__originalFilePath);let V0=await b9(q0,{eventBindings:h0,attrs:p,hasColonDirectives:M0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(s,()=>V0)}if(Y0)Z.__stx_event_bindings=[];if(!Y0&&Z.__stxProcessingDepth===1){let s=Z.__stx_event_bindings||[];if(s.length>0){let p=h9(s);if(p){let q0=Q.lastIndexOf("</body>");Q=q0===-1?Q+p:Q.slice(0,q0)+p+`
3596
+ `+Q}{let{scanScriptTags:s}=await o("stx/signal-processing",()=>import("./chunk-0ggq64sc.js")),p=[];for(let q0 of s(Q)){if(!/\bserver\b/i.test(q0.attrs))continue;let Z0=q0.start+q0.fullMatch.indexOf(">")+1,V0=IG(Q,Z0);if(V0===-1)continue;let k0=V0+9;while(k0<Q.length&&/\s/.test(Q[k0]))k0++;p.push({start:q0.start,end:k0})}if(p.length>0){let q0=Array(p.length+1),Z0=0;for(let V0=0;V0<p.length;V0++){let{start:k0,end:j1}=p[V0];q0[V0]=Q.slice(Z0,k0),Z0=j1}q0[p.length]=Q.slice(Z0),Q=q0.join("")}}let y0=y9(Q,J);if(y0.hasScoped)Q=y0.html;let h0=Z.__stx_event_bindings||[],Y0=!1,B0=[],M0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:P0}=await o("stx/signal-processing",()=>import("./chunk-0ggq64sc.js"));for(let s of P0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))B0.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:p,content:q0}of B0){Y0=!0;let Z0=q0;C$(q0,J,X.strict,Z.__originalFilePath);let V0=await b9(q0,{eventBindings:h0,attrs:p,hasColonDirectives:M0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(s,()=>V0)}if(Y0)Z.__stx_event_bindings=[];if(!Y0&&Z.__stxProcessingDepth===1){let s=Z.__stx_event_bindings||[];if(s.length>0){let p=h9(s);if(p){let q0=Q.lastIndexOf("</body>");Q=q0===-1?Q+p:Q.slice(0,q0)+p+`
3597
3597
  `+Q.slice(q0)}Z.__stx_event_bindings=[]}}if(!k6(Q)&&E6(Q))Q=await M9(Q,G);if(Q=b6(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=S7(Q,Z.cspNonce);return Q}var fG=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],xG=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],gG=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function hG($){let Z=[],J=[];return uG($,Z),dG($,Z,J),mG($,J),lG($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function uG($,Z){let J=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(J!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${J} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function dG($,Z,J){for(let X of fG){let Y=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(Y)||[]).length,z=($.match(Q)||[]).length;if(X.altClose){let q=new RegExp(X.altClose,"g");z+=($.match(q)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${X.close} tag(s)`});else if(z>G)J.push({type:"directive",message:`Extra ${X.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function mG($,Z){for(let J of xG)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function lG($,Z){for(let J of gG)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function cG($,Z){let J=$.slice(0,Z).split(`
3598
3598
  `);return{line:J.length,column:J[J.length-1].length+1}}function pG($,Z,J){let X=[];switch($){case"if":case"elseif":case"unless":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(J.length===0||!J[0].includes(" as "))X.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(J.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(J.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(J.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function iG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function nG($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Y=X[1].toLowerCase();if(!Y.startsWith("end"))J.add(Y)}return Array.from(J)}import r0 from"path";import $2 from"process";var u8=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","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"],I8=new Set(u8),sG=new Set(["props","$props","defineProps"]),oG=new Set(["stx","@stacksjs/stx"]),T8=k1(128),k8=k1(64);function rG($){let Z=[],J=0,X=$.split(`
3599
3599
  `);for(let Y of X){let Q=J,G=null,z=!1;for(let q=0;q<Y.length;q++){let K=Y[q];if(z){z=!1;continue}if(K==="\\"){z=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&q+1<Y.length&&Y[q+1]==="/")break;if(K==="{")J++;else if(K==="}")J--}if(Q===0){let q=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let K=Y.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let U=K[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...U)}}}}return[...new Set(Z)]}function aG($){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 J(X){if(!X.includes(":"))return X;let Y=[],Q="",G=0,z=0,q=null;for(let K=0;K<X.length;K++){let W=X[K];if(q){if(Q+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,Q+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")z++;else if(W===")")z--;if(W===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=W}if(Q)Y.push(Q);return Y.map((K)=>{let W=K.trim(),U=W.startsWith("..."),H=U?W.slice(3):W,j=-1,B=0;for(let R=0;R<H.length;R++)if(H[R]==="<")B++;else if(H[R]===">")B--;else if(H[R]===":"&&B===0){j=R;break}if(j===-1)return K;let F=H.substring(0,j).trim().replace(/\?$/,""),_=H.substring(j+1),O=-1,L=0;for(let R=0;R<_.length;R++)if(_[R]==="<")L++;else if(_[R]===">")L--;else if(_[R]==="="&&L===0){O=R;break}let w=U?"...":"";if(O!==-1)return`${w}${F} = ${_.substring(O+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Y,Q)=>{if(!Q.includes(":"))return X;return`${Y}(${J(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=X.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=1,q=G+1,K=0,W=null;while(q<Z.length&&z>0){let j=Z[q];if(W){if(j===W)W=null;q++;continue}if(j==='"'||j==="'"||j==="`"){W=j,q++;continue}if(j==="<")K++;else if(j===">"&&K>0)K--;else if(K===0){if(j==="(")z++;else if(j===")")z--}if(z>0)q++}if(z!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let H=J(U);Q.push({start:G+1,end:q,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Q[G];Z=Z.substring(0,z)+K+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Y)=>{if(!Y.includes(":"))return X;if(Y.includes("{")||Y.includes("}"))return X;return`(${Y.split(",").map((G)=>{let[z,...q]=G.split("="),K=z.split(":")[0].trim();if(q.length>0)return`${K} = ${q.join("=").trim()}`;return K}).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,`
@@ -3615,11 +3615,11 @@ ${$[K]}`,K++;else break}return q=q.trim().replace(/;$/,""),{type:Q,name:G,value:
3615
3615
  ${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
3616
3616
  ${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function zz($,Z,J){let X=J,Y=Z+1;while(Y<$.length){let Q=p8(X);if(Q!==-1){if(L0(X,"{","}",Q)!==-1)break}let G=$[Y];X+=`
3617
3617
  ${G}`,Y++}return{functionCode:X,nextIndex:Y}}function S8($,Z){let J=e($,Z)??e(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...$2.env}})},Y=Object.keys(X).filter(Z2),Q=Y.map((G)=>X[G]);try{return Function(...Y,`'use strict'; return (${$});`)(...Q)}catch{try{return Function(...Y,`'use strict'; return ${$};`)(...Q)}catch{return}}}async function qz($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,z]=Q;try{let q=z.trim().replace(/;$/,""),K=S8(q,Z);if(K!==void 0)Z[G]=K}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,z]=Q;if(!(G in Z))try{let q=z.trim().replace(/;$/,""),K=S8(q,Z);if(K!==void 0)Z[G]=K}catch{}}}function Kz($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:X}}function Wz($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var b2=new i1(500),P9=new i1(1000),e8=33554432,h$=e8;function Uz($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===h$)return;h$=Z,v9.setMaxBytes(Z)}var v9=new i1(2000,{maxBytes:e8,sizeOf:($)=>$.output.length});function Hz($){let Z=new WeakSet;try{let J=(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(J);let Y={};for(let Q of Object.keys(X).sort())Y[Q]=J(X[Q]);return Y};return JSON.stringify(J($))}catch{return null}}function i8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function jz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!jz($)}var S9=new Map;function x$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=S9.get(Z);if(J)return J;if(S9.size>=16)S9.clear();let X=new Bun.Transpiler($);return S9.set(Z,X),X}var n8=new WeakMap,Bz=256;function M1($){try{let Z=x$({loader:"ts",target:"browser",define:t1()}),J=n8.get(Z);if(!J)J=new Map,n8.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Q=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`});let G=Z.transformSync(Y);for(let z=0;z<Q.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Q[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Q[z]);if(J.size>=Bz){let z=J.keys().next();if(!z.done)J.delete(z.value)}return J.set($,G),G}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Vz($){let Z=[],J=new Set,X=0,Y=0,Q=$.length,G=(W)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===W){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let W=1;while(Y<Q&&W>0)if($[Y]==="{")W++,Y++;else if($[Y]==="}")W--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},q=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3618
- `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let U=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(q())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))K();Y++}return Z}function _z($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Lz($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Oz($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let q of _z(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let W=Lz(K);if(W===-1)continue;let U=K.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let H=K.slice(W+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(Z2),B=Function(...j,`"use strict"; return (${H});`);Z[U]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}async function j9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(_)=>_.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),z=(_)=>_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=J.__importedComponents;if(q){for(let _ of[Q,Q.toLowerCase(),G(Q),z(Q)])if(q.has(_))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],W=typeof Y.root==="string"?g.resolve(Y.root):void 0,U=W??g.dirname(X),H=[],j=(_)=>{if(_&&!H.includes(_))H.push(_)},B=J.__originalFilePath;if(B)j(g.join(g.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(g.join(g.dirname(X),"components")),j(Y.componentsDir),W)j(g.resolve(W,"resources/views/components")),j(g.resolve(W,"resources/components")),j(g.resolve(W,"src/components")),j(g.resolve(W,"components"));for(let _ of Y._layerComponentDirs??[])j(_);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let _ of V)j(typeof _==="string"?_:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(g.resolve(g.dirname(X),`${Q}.stx`));let F=s8(g.resolve(import.meta.dir,"components"));for(let _ of H){let O=g.isAbsolute(_)?_:g.resolve(U,_);if(s8(O)===F)continue;for(let L of K)if(await a(g.join(O,L)))return!0}return!1}function s8($){try{return t8.realpathSync($)}catch{return $}}function Fz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function wz($){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 Rz($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function D1($,Z,J,X,Y,Q,G,z=new Set,q){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-x3s0e6wv.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&Fz(H)?H:"";try{let B=(d)=>d.split("-").map((l)=>l.charAt(0).toUpperCase()+l.slice(1)).join(""),V=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,_=null,O=Y.__importedComponents;if(O){let d=[F,F.toLowerCase(),B(F),V(F)];for(let l of d)if(O.has(l)){_=O.get(l);break}}let L=[];if(!_){let d=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],l=[...new Set(d)],G0=Y.__originalFilePath,n=[];if(n.push(...G._layerComponentDirs??[]),G0){let N0=g.join(g.dirname(G0),"components");n.push(N0)}if(X)n.push(X);let _0=G._rootComponentsDir;if(typeof _0==="string"&&!n.includes(_0))n.push(_0);let R0=g.join(g.dirname(Q),"components");if(!n.includes(R0))n.push(R0);if(G.componentsDir&&G.componentsDir!==X&&!n.includes(G.componentsDir))n.push(G.componentsDir);let f0=typeof G.root==="string"?g.resolve(G.root):void 0,c0=f0??g.dirname(Q),C0=[];if(f0)C0.push(g.resolve(f0,"resources/views/components")),C0.push(g.resolve(f0,"resources/components")),C0.push(g.resolve(f0,"src/components")),C0.push(g.resolve(f0,"components"));C0.push(g.resolve(import.meta.dir,"components"));for(let N0 of C0)if(!n.includes(N0))n.push(N0);let J1=G._pluginComponentDirs;if(Array.isArray(J1)){for(let N0 of J1)if(typeof N0==="string"&&!n.includes(N0))n.push(N0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let r=[...new Set(n.map((N0)=>{if(!N0)return N0;return g.isAbsolute(N0)?N0:g.resolve(c0,N0)}))];n.length=0,n.push(...r);let a0=`${F}\x00${Q}\x00${r.join("\x00")}`,S2=P9.get(a0);if(S2)if(await a(S2))_=S2;else P9.delete(a0);if(!_&&(F.startsWith("./")||F.startsWith("../")))_=g.resolve(g.dirname(Q),`${F}.stx`),L.push(_);else if(!_)for(let N0 of n){if(!N0)continue;for(let P2 of l){let v2=g.join(N0,P2);if(L.push(v2),await a(v2)){_=v2;break}}if(_)break;if(!_)try{let P2=await import("fs");if(!P2.statSync(N0,{throwIfNoEntry:!1})?.isDirectory())continue;let WZ=8,f9=[{path:N0,depth:0}];while(f9.length>0&&!_){let f2=f9.pop();if(f2.depth>=WZ)continue;let l$;try{l$=P2.readdirSync(f2.path,{withFileTypes:!0})}catch{continue}for(let x2 of l$){if(!x2.isDirectory())continue;if(x2.name==="node_modules"||x2.name.startsWith("."))continue;let c$=g.join(f2.path,x2.name);for(let UZ of l){let x9=g.join(c$,UZ);if(L.push(x9),await a(x9)){_=x9;break}}if(_)break;f9.push({path:c$,depth:f2.depth+1})}}}catch{}if(_)break}if(_)P9.set(a0,_)}if(!_||!await a(_)){let d=L.length>0?`
3618
+ `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let U=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(q())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))K();Y++}return Z}function _z($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Lz($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Oz($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let q of _z(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let W=Lz(K);if(W===-1)continue;let U=K.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let H=K.slice(W+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(Z2),B=Function(...j,`"use strict"; return (${H});`);Z[U]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}async function j9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(_)=>_.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),z=(_)=>_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=J.__importedComponents;if(q){for(let _ of[Q,Q.toLowerCase(),G(Q),z(Q)])if(q.has(_))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],W=typeof Y.root==="string"?g.resolve(Y.root):void 0,U=W??g.dirname(X),H=[],j=(_)=>{if(_&&!H.includes(_))H.push(_)},B=J.__originalFilePath;if(B)j(g.join(g.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(g.join(g.dirname(X),"components")),j(Y.componentsDir),W)j(g.resolve(W,"resources/views/components")),j(g.resolve(W,"resources/components")),j(g.resolve(W,"src/components")),j(g.resolve(W,"components"));for(let _ of Y._layerComponentDirs??[])j(_);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let _ of V)j(typeof _==="string"?_:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(g.resolve(g.dirname(X),`${Q}.stx`));let F=s8(g.resolve(import.meta.dir,"components"));for(let _ of H){let O=g.isAbsolute(_)?_:g.resolve(U,_);if(s8(O)===F)continue;for(let L of K)if(await a(g.join(O,L)))return!0}return!1}function s8($){try{return t8.realpathSync($)}catch{return $}}function Fz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function wz($){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 Rz($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function D1($,Z,J,X,Y,Q,G,z=new Set,q){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-h63vszd3.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&Fz(H)?H:"";try{let B=(d)=>d.split("-").map((l)=>l.charAt(0).toUpperCase()+l.slice(1)).join(""),V=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,_=null,O=Y.__importedComponents;if(O){let d=[F,F.toLowerCase(),B(F),V(F)];for(let l of d)if(O.has(l)){_=O.get(l);break}}let L=[];if(!_){let d=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],l=[...new Set(d)],G0=Y.__originalFilePath,n=[];if(n.push(...G._layerComponentDirs??[]),G0){let N0=g.join(g.dirname(G0),"components");n.push(N0)}if(X)n.push(X);let _0=G._rootComponentsDir;if(typeof _0==="string"&&!n.includes(_0))n.push(_0);let R0=g.join(g.dirname(Q),"components");if(!n.includes(R0))n.push(R0);if(G.componentsDir&&G.componentsDir!==X&&!n.includes(G.componentsDir))n.push(G.componentsDir);let f0=typeof G.root==="string"?g.resolve(G.root):void 0,c0=f0??g.dirname(Q),C0=[];if(f0)C0.push(g.resolve(f0,"resources/views/components")),C0.push(g.resolve(f0,"resources/components")),C0.push(g.resolve(f0,"src/components")),C0.push(g.resolve(f0,"components"));C0.push(g.resolve(import.meta.dir,"components"));for(let N0 of C0)if(!n.includes(N0))n.push(N0);let J1=G._pluginComponentDirs;if(Array.isArray(J1)){for(let N0 of J1)if(typeof N0==="string"&&!n.includes(N0))n.push(N0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let r=[...new Set(n.map((N0)=>{if(!N0)return N0;return g.isAbsolute(N0)?N0:g.resolve(c0,N0)}))];n.length=0,n.push(...r);let a0=`${F}\x00${Q}\x00${r.join("\x00")}`,S2=P9.get(a0);if(S2)if(await a(S2))_=S2;else P9.delete(a0);if(!_&&(F.startsWith("./")||F.startsWith("../")))_=g.resolve(g.dirname(Q),`${F}.stx`),L.push(_);else if(!_)for(let N0 of n){if(!N0)continue;for(let P2 of l){let v2=g.join(N0,P2);if(L.push(v2),await a(v2)){_=v2;break}}if(_)break;if(!_)try{let P2=await import("fs");if(!P2.statSync(N0,{throwIfNoEntry:!1})?.isDirectory())continue;let WZ=8,f9=[{path:N0,depth:0}];while(f9.length>0&&!_){let f2=f9.pop();if(f2.depth>=WZ)continue;let l$;try{l$=P2.readdirSync(f2.path,{withFileTypes:!0})}catch{continue}for(let x2 of l$){if(!x2.isDirectory())continue;if(x2.name==="node_modules"||x2.name.startsWith("."))continue;let c$=g.join(f2.path,x2.name);for(let UZ of l){let x9=g.join(c$,UZ);if(L.push(x9),await a(x9)){_=x9;break}}if(_)break;f9.push({path:c$,depth:f2.depth+1})}}}catch{}if(_)break}if(_)P9.set(a0,_)}if(!_||!await a(_)){let d=L.length>0?`
3619
3619
  Searched paths:
3620
3620
  ${L.map((l)=>` - ${l}`).join(`
3621
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(_);let w;if(b2.has(_))w=b2.get(_);else try{w=await Bun.file(_).text(),b2.set(_,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",g2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),N={};for(let[d,l]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))N[d]=l;let A=J;if(J.includes("@include")){let{processIncludes:d}=await o("stx/includes",()=>import("./chunk-dm93r8kq.js"));A=await d(J,Y,Q,G,q)}let T=n0(A),D=[],M=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,l)=>{let G0=T.scripts[Number(l)]||"",n=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",_0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),R0=!_0||["module","text/javascript","application/javascript"].includes(_0);if(!/\bserver\b/i.test(n)&&R0)return D.push(G0),"";return G0}),{extractSlotContent:k}=await o("stx/slots",()=>import("./chunk-s1enwpyh.js")),I=k(M),y={};if(I.defaultSlot?.trim())y.default=I.defaultSlot;for(let[d,l]of I.namedSlots)y[d]=l.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,C={...N,$uid:b,...Z,props:Z,slot:M,$slots:y,__processedComponents:U,__sections:{},__stx_signals_gate:X1(w)||wz(J)};Oz(w,C);let f=w,u=G9(f);if(u)f=u.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,h=[...w.matchAll(P)],m=[],j0=h.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),S0=null,y0=null,h0=null,Y0=0,B0=null;if(Uz(G),j0&&h$>0){let d=Hz({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((l)=>l.configFile),uid:b});if(d!==null){S0=`${_}\x00${H1(w)}\x00${d}`;let l=v9.get(S0);if(l){for(let G0 of l.dependencies)q.add(G0);if(X3(Y,l.clientFactories),E.n+=l.uidsConsumed,l.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let n of l.preservedClientExpressions)G0.add(n);Y.__stx_preserved_client_expressions=[...G0]}return l.output}y0=new Set(q),h0=Z3(Y),Y0=E.n,B0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let d of h){let l=d[1]||"",G0=d[2]||"",n=l.includes("server");if(A1(l)&&G0.trim())G0=M1(G0);if(n&&G0)try{await K(G0,C,_)}catch(R0){}if(!n){let R0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),f0=R0.includes("{{")&&R0.includes("}}"),c0=R0.includes("{!!")&&R0.includes("!!}");if(f0||c0)R0=c9(R0,C);let C0=l.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");m.push(`<script${C0}>${R0}</script>`)}}let M0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),P0=M0?M0[1]:"",s=M0?M0[2]:"",p="",q0=P0&&/\bscoped\b/i.test(P0);if(M0)p=`<style${P0}>${s}</style>`;let Z0=f;if(Z0=Z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),M0)Z0=Z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,l=[];if(Z0=Z0.replace(d,(G0,n)=>{let _0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(_0)l.push(`<style${_0[1]}>${_0[2]}</style>`);return""}),Z0=Z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),l.length>0)p=`${p}${l.join(`
3622
- `)}`}if(J&&Z0.includes("{{ text || slot }}"))Z0=Z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:V0}=await o("stx/slots",()=>import("./chunk-s1enwpyh.js")),{defaultSlot:k0,namedSlots:j1}=I,J2=m.some((d)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),C2=(d)=>J2?$8(d,b):d,S=new Map([...j1].map(([d,l])=>[d,{...l,content:C2(l.content)}]));Z0=await V0(Z0,C2(k0),S,C);let v=Rz(m),i=Array.isArray(C.__stx_client_signal_names)?C.__stx_client_signal_names:[];if(v.length>0||i.length>0)C.__stx_client_signal_names=[...new Set([...i,...v])];let $0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(_),skipSignalsRuntime:!0,skipEventDirectives:J2||m.length===0,defaultLayout:void 0};C.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let z0=await v$(Z0,C,_,$0,q),w0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let d of z0.matchAll(/\{\{([\s\S]*?)\}\}/g))w0.add(d[1].trim());if(w0.size>0)Y.__stx_preserved_client_expressions=[...w0];let l0=b,v0=z0;if(J2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${i8(JSON.stringify(Z))}"`}catch{}let l=j?` stx-hydrate="${i8(j)}"`:"";v0=`<div data-stx-scope="${l0}"${d}${l}>${z0}</div>`;let G0=await Promise.all(m.map(async(n)=>{let _0=n.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_0)return n;let[,R0,f0]=_0,{vendorStyleTags:c0,factoryBody:C0}=await Az(f0,_,G.buildMode==="compile"),J1=j?null:u9(Y,C0),r=J1?`window.__stxComponentFactories[${JSON.stringify(J1)}](${JSON.stringify(l0)});`:`(${C0})(${JSON.stringify(l0)});`;if(j)return`${c0}<script type="stx/island" data-stx-island="${l0}" data-stx-scoped data-stx-owner="${l0}"${R0}>${r}</script>`;return`${c0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${l0}"${R0}>${r}</script>`}));if(v0=v0+`
3621
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(_);let w;if(b2.has(_))w=b2.get(_);else try{w=await Bun.file(_).text(),b2.set(_,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",g2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),N={};for(let[d,l]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))N[d]=l;let A=J;if(J.includes("@include")){let{processIncludes:d}=await o("stx/includes",()=>import("./chunk-wcp0dt2c.js"));A=await d(J,Y,Q,G,q)}let T=n0(A),D=[],M=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,l)=>{let G0=T.scripts[Number(l)]||"",n=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",_0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),R0=!_0||["module","text/javascript","application/javascript"].includes(_0);if(!/\bserver\b/i.test(n)&&R0)return D.push(G0),"";return G0}),{extractSlotContent:k}=await o("stx/slots",()=>import("./chunk-95jjdgmb.js")),I=k(M),y={};if(I.defaultSlot?.trim())y.default=I.defaultSlot;for(let[d,l]of I.namedSlots)y[d]=l.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,C={...N,$uid:b,...Z,props:Z,slot:M,$slots:y,__processedComponents:U,__sections:{},__stx_signals_gate:X1(w)||wz(J)};Oz(w,C);let f=w,u=G9(f);if(u)f=u.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,h=[...w.matchAll(P)],m=[],j0=h.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),S0=null,y0=null,h0=null,Y0=0,B0=null;if(Uz(G),j0&&h$>0){let d=Hz({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((l)=>l.configFile),uid:b});if(d!==null){S0=`${_}\x00${H1(w)}\x00${d}`;let l=v9.get(S0);if(l){for(let G0 of l.dependencies)q.add(G0);if(X3(Y,l.clientFactories),E.n+=l.uidsConsumed,l.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let n of l.preservedClientExpressions)G0.add(n);Y.__stx_preserved_client_expressions=[...G0]}return l.output}y0=new Set(q),h0=Z3(Y),Y0=E.n,B0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let d of h){let l=d[1]||"",G0=d[2]||"",n=l.includes("server");if(A1(l)&&G0.trim())G0=M1(G0);if(n&&G0)try{await K(G0,C,_)}catch(R0){}if(!n){let R0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),f0=R0.includes("{{")&&R0.includes("}}"),c0=R0.includes("{!!")&&R0.includes("!!}");if(f0||c0)R0=c9(R0,C);let C0=l.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");m.push(`<script${C0}>${R0}</script>`)}}let M0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),P0=M0?M0[1]:"",s=M0?M0[2]:"",p="",q0=P0&&/\bscoped\b/i.test(P0);if(M0)p=`<style${P0}>${s}</style>`;let Z0=f;if(Z0=Z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),M0)Z0=Z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,l=[];if(Z0=Z0.replace(d,(G0,n)=>{let _0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(_0)l.push(`<style${_0[1]}>${_0[2]}</style>`);return""}),Z0=Z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),l.length>0)p=`${p}${l.join(`
3622
+ `)}`}if(J&&Z0.includes("{{ text || slot }}"))Z0=Z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:V0}=await o("stx/slots",()=>import("./chunk-95jjdgmb.js")),{defaultSlot:k0,namedSlots:j1}=I,J2=m.some((d)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),C2=(d)=>J2?$8(d,b):d,S=new Map([...j1].map(([d,l])=>[d,{...l,content:C2(l.content)}]));Z0=await V0(Z0,C2(k0),S,C);let v=Rz(m),i=Array.isArray(C.__stx_client_signal_names)?C.__stx_client_signal_names:[];if(v.length>0||i.length>0)C.__stx_client_signal_names=[...new Set([...i,...v])];let $0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(_),skipSignalsRuntime:!0,skipEventDirectives:J2||m.length===0,defaultLayout:void 0};C.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let z0=await v$(Z0,C,_,$0,q),w0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let d of z0.matchAll(/\{\{([\s\S]*?)\}\}/g))w0.add(d[1].trim());if(w0.size>0)Y.__stx_preserved_client_expressions=[...w0];let l0=b,v0=z0;if(J2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${i8(JSON.stringify(Z))}"`}catch{}let l=j?` stx-hydrate="${i8(j)}"`:"";v0=`<div data-stx-scope="${l0}"${d}${l}>${z0}</div>`;let G0=await Promise.all(m.map(async(n)=>{let _0=n.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_0)return n;let[,R0,f0]=_0,{vendorStyleTags:c0,factoryBody:C0}=await Az(f0,_,G.buildMode==="compile"),J1=j?null:u9(Y,C0),r=J1?`window.__stxComponentFactories[${JSON.stringify(J1)}](${JSON.stringify(l0)});`:`(${C0})(${JSON.stringify(l0)});`;if(j)return`${c0}<script type="stx/island" data-stx-island="${l0}" data-stx-scoped data-stx-owner="${l0}"${R0}>${r}</script>`;return`${c0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${l0}"${R0}>${r}</script>`}));if(v0=v0+`
3623
3623
  `+G0.join(`
3624
3624
  `),p)v0+=`
3625
3625
  `+p}else{if(p)v0+=`
@@ -3642,7 +3642,7 @@ ${t.yellow}${t.bold}Message:${t.reset} ${Z}
3642
3642
  `,z)W+=`
3643
3643
  ${t.blue}${t.bold}Context:${t.reset}
3644
3644
  ${t.dim}${z}${t.reset}
3645
- `;return W}function g_(){b2.clear(),P9.clear(),v9.clear()}function h_(){return{size:b2.size,maxSize:500}}var g$=k1(128);async function Az($,Z,J){let X=H1($,Z,J),Y=g$.get(X);if(Y){if(a8(Y.deps))return Y;g$.delete(X)}let Q=d$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=m$(Q.styles);G=a1(G).code;let{hasUserImports:q,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-t088w4j2.js")),W=[],U=!1;if(q(G)){let _=G;G=await K(_,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),U=G===_}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-vgwcpt59.js"));G=H(G);let j=$1(G),B=Vz(j),V=`function(__scopeId) {
3645
+ `;return W}function g_(){b2.clear(),P9.clear(),v9.clear()}function h_(){return{size:b2.size,maxSize:500}}var g$=k1(128);async function Az($,Z,J){let X=H1($,Z,J),Y=g$.get(X);if(Y){if(a8(Y.deps))return Y;g$.delete(X)}let Q=d$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=m$(Q.styles);G=a1(G).code;let{hasUserImports:q,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-8618n28z.js")),W=[],U=!1;if(q(G)){let _=G;G=await K(_,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),U=G===_}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-0ggq64sc.js"));G=H(G);let j=$1(G),B=Vz(j),V=`function(__scopeId) {
3646
3646
  ${p1("const",[...o8,...B],j)}
3647
3647
  const __scope = window.stx._scopes = window.stx._scopes || {};
3648
3648
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -3741,7 +3741,7 @@ else {
3741
3741
  // STX: auto-generated event bindings
3742
3742
  ${$.map((J,X)=>dz(J,X)).join(`
3743
3743
  `)}`}function XZ($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=X.length,G=0;while(G<Q){let z=X[G];if(z==="'"||z==='"'||z==="`"){let q=z;if(G++,q==="`"){let K=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&K===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){K++,G+=2;continue}if(X[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
3744
- `)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let q=X.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=K[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let H=U[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=U[0].length;continue}}G++}return Z}var lz=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 cz($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(H){let j;while((j=J.exec(H))!==null){let B=j[0];if(!lz.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function b9($,Z={}){let J=$,X="",Y=!1,Q=[],G=d$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=m$(G.styles),q=a1(J);J=q.code,Q=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:W}=await o("stx/client-script-bundler",()=>import("./chunk-t088w4j2.js"));if(K(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=qZ(J);J=L.code,X=KZ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${M$(J,Z.serverData)}${X}`,J=$1(J),!Y&&A1(Z.attrs||""))J=M1(J);let U=mz(Z.eventBindings||[]),H=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(H),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
3744
+ `)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let q=X.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=K[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let H=U[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=U[0].length;continue}}G++}return Z}var lz=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 cz($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(H){let j;while((j=J.exec(H))!==null){let B=j[0];if(!lz.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function b9($,Z={}){let J=$,X="",Y=!1,Q=[],G=d$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=m$(G.styles),q=a1(J);J=q.code,Q=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:W}=await o("stx/client-script-bundler",()=>import("./chunk-8618n28z.js"));if(K(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=qZ(J);J=L.code,X=KZ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${M$(J,Z.serverData)}${X}`,J=$1(J),!Y&&A1(Z.attrs||""))J=M1(J);let U=mz(Z.eventBindings||[]),H=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(H),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
3745
3745
  ${r1(`${X}${J}
3746
3746
  ${U}`)}
3747
3747
  </script>`}let V=QZ($),F=/function __stx_setup_/.test(J),_=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(L){let w=L.length>0?`