@stacksjs/stx 0.2.344 → 0.2.345

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 (55) hide show
  1. package/dist/{chunk-020hpw7m.js → chunk-1qyg1q6d.js} +1 -1
  2. package/dist/{chunk-efx05ah0.js → chunk-1t4ece3v.js} +1 -1
  3. package/dist/{chunk-1bct7pfj.js → chunk-1vtdege3.js} +1 -1
  4. package/dist/{chunk-a1ghxrb1.js → chunk-1vv9g6cj.js} +1 -1
  5. package/dist/{chunk-4kbaky4w.js → chunk-223makqc.js} +1 -1
  6. package/dist/{chunk-j5qygdy9.js → chunk-2fhk4e68.js} +1 -1
  7. package/dist/{chunk-8tjg4wbr.js → chunk-3zm4hgcf.js} +1 -1
  8. package/dist/{chunk-5atmahe4.js → chunk-4spaszfn.js} +16 -16
  9. package/dist/{chunk-q5gzpn1n.js → chunk-57t402mn.js} +1 -1
  10. package/dist/{chunk-csv48xrx.js → chunk-66tgkvqw.js} +1 -1
  11. package/dist/{chunk-dx2s51rr.js → chunk-6fwp7gee.js} +1 -1
  12. package/dist/{chunk-3n8avn17.js → chunk-6wmjwbq9.js} +1 -1
  13. package/dist/{chunk-7kcfbc0j.js → chunk-72yrrggn.js} +1 -1
  14. package/dist/{chunk-zkwk82ss.js → chunk-77p1kjg2.js} +1 -1
  15. package/dist/{chunk-tscr6bs8.js → chunk-7g5vk4c3.js} +1 -1
  16. package/dist/{chunk-nexpxxsa.js → chunk-7m9qk7da.js} +1 -1
  17. package/dist/{chunk-7d2gfyk8.js → chunk-8rhjt6fh.js} +1 -1
  18. package/dist/{chunk-tthrw91n.js → chunk-9qtf2b1p.js} +1 -1
  19. package/dist/{chunk-ewpbxy5m.js → chunk-aapqf6bj.js} +1 -1
  20. package/dist/{chunk-39qy76ek.js → chunk-b5mnam29.js} +1 -1
  21. package/dist/{chunk-gmm82dst.js → chunk-c4tf1vpy.js} +1 -1
  22. package/dist/{chunk-zwhnkxgy.js → chunk-c8e2deyp.js} +1 -1
  23. package/dist/{chunk-5apmxb4e.js → chunk-cypg8qwn.js} +1 -1
  24. package/dist/{chunk-1exk54qt.js → chunk-e7gs18rc.js} +1 -1
  25. package/dist/{chunk-9yqt0nf2.js → chunk-ek2m0kkw.js} +1 -1
  26. package/dist/{chunk-9p5gbhwp.js → chunk-eqzc88et.js} +1 -1
  27. package/dist/{chunk-xh9paa2g.js → chunk-esjcyxa9.js} +2 -2
  28. package/dist/{chunk-hsbbfp0c.js → chunk-fp868yhg.js} +1 -1
  29. package/dist/{chunk-72x5v5an.js → chunk-gvemapw4.js} +1 -1
  30. package/dist/{chunk-jzfk5ect.js → chunk-h1vax4wg.js} +1 -1
  31. package/dist/{chunk-mz4breg8.js → chunk-jnbg3e4r.js} +1 -1
  32. package/dist/{chunk-krfx5562.js → chunk-kqzpmwx2.js} +8 -8
  33. package/dist/{chunk-6z9pm31g.js → chunk-mr8ccsnm.js} +1 -1
  34. package/dist/{chunk-mvat8js5.js → chunk-nqz501eq.js} +2 -2
  35. package/dist/{chunk-3xpk99z4.js → chunk-nrt99ptw.js} +1 -1
  36. package/dist/{chunk-g28fs4aa.js → chunk-pajk5680.js} +2 -2
  37. package/dist/{chunk-cdq28mek.js → chunk-qkdcbeaw.js} +1 -1
  38. package/dist/{chunk-e4yskgtb.js → chunk-qr3zcm87.js} +1 -1
  39. package/dist/{chunk-fs2t4rs3.js → chunk-r38xq7fp.js} +2 -2
  40. package/dist/{chunk-bpb3xkg4.js → chunk-rzda6bd6.js} +1 -1
  41. package/dist/{chunk-mpyjnwje.js → chunk-vhg91hnw.js} +1 -1
  42. package/dist/{chunk-cmccdayf.js → chunk-xq0e2y4x.js} +1 -1
  43. package/dist/{chunk-cappe4hd.js → chunk-xrjx7b2v.js} +1 -1
  44. package/dist/{chunk-94sxzp5x.js → chunk-ybx8n794.js} +1 -1
  45. package/dist/{chunk-5yhv1pe5.js → chunk-yca761bm.js} +1 -1
  46. package/dist/{chunk-7t6h8crt.js → chunk-z8wb7kbj.js} +1 -1
  47. package/dist/{chunk-wfwj4390.js → chunk-zmazqcb8.js} +1 -1
  48. package/dist/{chunk-a29x23g7.js → chunk-zwr4bn6a.js} +1 -1
  49. package/dist/cli.js +7 -7
  50. package/dist/craft-entry.js +1 -1
  51. package/dist/craft.js +1 -1
  52. package/dist/pwa.js +1 -1
  53. package/dist/ssg.js +2 -2
  54. package/dist/theme-tokens.js +6 -0
  55. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Tr as h8,Xr as u8,fs as x7,gs as f7}from"./chunk-8y1ve8tc.js";import{ls as H0,ms as ZJ}from"./chunk-bqdfbwdf.js";import{os as m7,ps as d7,qs as J9,rs as X9}from"./chunk-89mqnh67.js";import{xs as t2}from"./chunk-xvh1k1a4.js";import{Cs as o1,Ds as w1,Es as l8,Fs as y1,Hs as H1,Is as iZ,Js as nZ,Ks as K2,Ls as n2,Ms as R9,Ns as y2,Os as A8,Ps as U8,Qs as B1,Rs as u0,Ss as X5,Ws as c8,Xs as f9,it as p8}from"./chunk-fs2t4rs3.js";import{jt as g7,lt as h7,mt as u7,ot as L2}from"./chunk-y2f41kaq.js";import{qt as w4,rt as R4,st as N4,vt as M4,wt as A4}from"./chunk-xj6bcwqa.js";import{Bt as g9}from"./chunk-7t6h8crt.js";import{Dt as IZ,Et as TZ,Ft as kZ,Gt as EZ,Ht as bZ,Jt as d8}from"./chunk-vhta1be7.js";import{Kt as s8,Lt as o8,Mt as r8,Nt as a8,Ot as l7,Pt as c7}from"./chunk-tc4pj651.js";import{Wt as v5,Xt as M0,Zt as x5,_t as G4,au as z4,hu as i8,lu as yZ,nu as CZ}from"./chunk-san1eq0r.js";import{$u as g8,Du as N0,Fu as N9,Gu as P$,Hu as D9,Ou as C2,Ru as x8,Tu as D0,Xu as S2,Yu as f8,_u as n0,gv as v$,hv as H6,jv as Y0,kv as j0,lv as d0,mv as w9,nv as Y2,ov as W0,pv as M9}from"./chunk-avwywzsj.js";import{qv as a0}from"./chunk-wj21f1e0.js";import{tv as n8}from"./chunk-d86q27j8.js";import{Bv as $J,Cv as V$,Dv as H8,Fv as c4,Iv as t4,uv as x$,vv as v2,wv as pZ,xv as s1}from"./chunk-72x62kch.js";import{$v as o6,Aw as V5,Dw as U2,Yv as g3,gw as A3,xw as m8,zw as bz}from"./chunk-yg5r7bnm.js";import{Iw as p7}from"./chunk-9nrgjtah.js";import{Nw as x}from"./chunk-ejqpq0wc.js";import P1 from"path";import f2 from"fs";var KJ=new Set(["touchstart","touchmove","wheel","mousewheel"]);function r9($,Z){if(Z.passive)return!0;if(Z.prevent||Z.nonpassive)return!1;return KJ.has($.toLowerCase())}var U$=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"]),j$={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"},qJ=new Set(["ctrl","alt","shift","meta"]),L$={left:0,middle:1,right:2};function B$($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!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(X==="nonpassive")Z.nonpassive=!0;else if(qJ.has(X))Z.systemKeys.push(X);else if(X in L$)Z.mouse=X;else if(X in j$||/^[a-z]$/.test(X))Z.keys.push(j$[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 O$($){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,K=Y.index,q=K+Q.length,W=`__stx_evt_${J++}`,H=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(z))!==null){let[,V,_]=j,O=V.split("."),F=O[0];if(!U$.has(F))continue;H.push({attribute:`@${V}`,event:F,handler:_,modifiers:B$(O.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,_]=j,O=V.split("."),F=O[0];if(!U$.has(F))continue;H.push({attribute:`@${V}`,event:F,handler:_,modifiers:B$(O.slice(1)),elementId:W})}if(H.length>0)Z.push({originalTag:Q,elementId:W,events:H,startIndex:K,endIndex:q})}return Z}function WJ($){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=L$[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 HJ($,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 a9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function UJ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=WJ($),Y=HJ(a9($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(r9($.event,Z))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{Tr as h8,Xr as u8,fs as x7,gs as f7}from"./chunk-8y1ve8tc.js";import{ls as H0,ms as ZJ}from"./chunk-bqdfbwdf.js";import{os as m7,ps as d7,qs as J9,rs as X9}from"./chunk-89mqnh67.js";import{xs as t2}from"./chunk-xvh1k1a4.js";import{Cs as o1,Ds as w1,Es as l8,Fs as y1,Hs as H1,Is as iZ,Js as nZ,Ks as K2,Ls as n2,Ms as R9,Ns as y2,Os as A8,Ps as U8,Qs as B1,Rs as u0,Ss as X5,Ws as c8,Xs as f9,it as p8}from"./chunk-r38xq7fp.js";import{jt as g7,lt as h7,mt as u7,ot as L2}from"./chunk-y2f41kaq.js";import{qt as w4,rt as R4,st as N4,vt as M4,wt as A4}from"./chunk-xj6bcwqa.js";import{Bt as g9}from"./chunk-z8wb7kbj.js";import{Dt as IZ,Et as TZ,Ft as kZ,Gt as EZ,Ht as bZ,Jt as d8}from"./chunk-vhta1be7.js";import{Kt as s8,Lt as o8,Mt as r8,Nt as a8,Ot as l7,Pt as c7}from"./chunk-tc4pj651.js";import{Wt as v5,Xt as M0,Zt as x5,_t as G4,au as z4,hu as i8,lu as yZ,nu as CZ}from"./chunk-san1eq0r.js";import{$u as g8,Du as N0,Fu as N9,Gu as P$,Hu as D9,Ou as C2,Ru as x8,Tu as D0,Xu as S2,Yu as f8,_u as n0,gv as v$,hv as H6,jv as Y0,kv as j0,lv as d0,mv as w9,nv as Y2,ov as W0,pv as M9}from"./chunk-avwywzsj.js";import{qv as a0}from"./chunk-wj21f1e0.js";import{tv as n8}from"./chunk-d86q27j8.js";import{Bv as $J,Cv as V$,Dv as H8,Fv as c4,Iv as t4,uv as x$,vv as v2,wv as pZ,xv as s1}from"./chunk-72x62kch.js";import{$v as o6,Aw as V5,Dw as U2,Yv as g3,gw as A3,xw as m8,zw as bz}from"./chunk-yg5r7bnm.js";import{Iw as p7}from"./chunk-9nrgjtah.js";import{Nw as x}from"./chunk-ejqpq0wc.js";import P1 from"path";import f2 from"fs";var KJ=new Set(["touchstart","touchmove","wheel","mousewheel"]);function r9($,Z){if(Z.passive)return!0;if(Z.prevent||Z.nonpassive)return!1;return KJ.has($.toLowerCase())}var U$=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"]),j$={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"},qJ=new Set(["ctrl","alt","shift","meta"]),L$={left:0,middle:1,right:2};function B$($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!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(X==="nonpassive")Z.nonpassive=!0;else if(qJ.has(X))Z.systemKeys.push(X);else if(X in L$)Z.mouse=X;else if(X in j$||/^[a-z]$/.test(X))Z.keys.push(j$[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 O$($){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,K=Y.index,q=K+Q.length,W=`__stx_evt_${J++}`,H=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(z))!==null){let[,V,_]=j,O=V.split("."),F=O[0];if(!U$.has(F))continue;H.push({attribute:`@${V}`,event:F,handler:_,modifiers:B$(O.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,_]=j,O=V.split("."),F=O[0];if(!U$.has(F))continue;H.push({attribute:`@${V}`,event:F,handler:_,modifiers:B$(O.slice(1)),elementId:W})}if(H.length>0)Z.push({originalTag:Q,elementId:W,events:H,startIndex:K,endIndex:q})}return Z}function WJ($){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=L$[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 HJ($,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 a9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function UJ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=WJ($),Y=HJ(a9($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(r9($.event,Z))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;
@@ -3167,7 +3167,7 @@ ${W}
3167
3167
  customElements.define('${Z}', ${G});
3168
3168
  `}async function P7($,Z,J,X){if(Z.length<1)return D0("WebComponent","@webcomponent directive requires at least the tag name parameter",N0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=f0.isAbsolute(G)?[f0.join(G,`${Y}.stx`),f0.join(f0.dirname(X),`${Y}.stx`)]:[f0.join(f0.dirname(X),G,`${Y}.stx`),f0.join(process.cwd(),G,`${Y}.stx`),f0.join(f0.dirname(X),`${Y}.stx`)],K=null;for(let H of z)if(await t(H)){K=await Bun.file(H).text();break}if(!K)return D0("WebComponent",`Component file not found: ${Y}.stx`,N0.FILE_NOT_FOUND);let q=JY(K,Y);return`<script type="module">
3169
3169
  ${XY(q)}
3170
- </script>`}var E5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:g7,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:j7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:P7,hasEndTag:!1,description:"Include a web component in the template"},x7,f7,l7,c7,q5,H5,U5,W5,q7,t$,A7,I5,...p7],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,scrollRestoration:!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 QY($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=S0.join(Y,"resources","views"),G=S0.join(Y,"resources","layouts");if(Y9.existsSync(Q)&&Y9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Y,"resources","views","pages");if(Y9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var v7=new Set,Q9=["partialsDir","componentsDir","layoutsDir"],b5=new WeakMap;function GY($,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 zY($,Z){let J=!$.root,X=QY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!v7.has(Y))v7.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(!b5.has($)){let Y={};for(let Q of Q9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}b5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of Q9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||GY(G,Y))continue;$[Q]=S0.join(Y,G)}}for(let Y of Q9){let Q=$[Y];if(typeof Q!=="string"||!Q||S0.isAbsolute(Q))continue;$[Y]=S0.resolve(Z,Q)}return $}function KY($,Z){let J=b5.get($);for(let X of Q9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=S0.isAbsolute(Y)?Y:S0.join(Z,Y);if(Y9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function qY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function WY($){if(h7($.stateDir),$.stateDir=u7(),$.cachePath=L2($.cachePath),$.build)$.build.cacheDir=L2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=L2($.media.cache.directory);if($.story)$.story.outDir=L2($.story.outDir)}var G1=null,O1=new Map,Z9=new Map,O2=null;async function y5($){let Z=$?S0.resolve($):process.cwd(),J=Z9.get(Z);if(J&&J.signature!==J9(J.graph)){let Q=O1.get(Z);if(O1.delete(Z),Z9.delete(Z),!$)G1=null,O2=null;let{clearComponentCache:G}=await import("./chunk-94sxzp5x.js"),{partialsCache:z}=await import("./chunk-cmccdayf.js");if(G(),z.clear(),Q&&J.configSignature===X9(J.graph)){let K=Q.then(async(q)=>{let W={...J.graph};await d7(W,Z),Z9.set(Z,{graph:W,signature:J9(W),configSignature:X9(W)});let H={...q,_layerGraph:W};if(!$)G1=H;return H});return O1.set(Z,K),K}}if(!$){if(G1)return G1;if(O2)return O2}let X=O1.get(Z);if(X)return X;let Y=(async()=>{let G=(await YY({name:"stx",alias:"ui",cwd:Z,defaultConfig:E5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await m7(Z,E5);G=z.config,Z9.set(Z,{graph:z.graph,signature:J9(z.graph),configSignature:X9(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-34f8c48f.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:K}=await import("./chunk-cappe4hd.js");await K(Z,G.runtimeConfig)}if(qY(G),WY(G),zY(G,Z),KY(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-dgv43ccd.js"),K=[],q=[];for(let W of G.plugins){let H=typeof W==="string"?W:W[0],U=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(H),B=S0.dirname(x.resolve(H))}catch{let _=S0.resolve(Z,H);j=await import(_),B=S0.dirname(_)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let _=Array.isArray(V.components)?V.components:[V.components];for(let O of _)K.push(S0.resolve(B,O))}if(V.pages){let _=S0.resolve(B,V.pages),O=U.path||"/";q.push({dir:_,prefix:O})}if(V.setup){let _={addDirective:(O)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(O)},addRoute:(O,F)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[O]=F},addMiddleware:(O)=>{G.middleware=G.middleware||[],G.middleware.push(O)},pluginDir:B,config:G};await V.setup(U,_)}console.log(`[stx] Plugin loaded: ${V.name||H}`)}catch(j){console.warn(`[stx] Failed to load plugin ${H}:`,j.message)}}G._pluginComponentDirs=K,G._pluginPageDirs=q}return G})();if(O1.set(Z,Y),Y.catch(()=>{if(O1.get(Z)===Y)O1.delete(Z)}),!$)O2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var i7=new Proxy(E5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!O2)y5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function mH($){return $}function dH($){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 S5=new Map;async function jY($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await HY.promises.stat($)).mtime.getTime();if(Z.cache&&S5.has($)){let H=S5.get($);if(H.updatedAt>=X)return{content:H.content,data:H.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=H7(Y),z=Z.markdown||i7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=j2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await BY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:q,data:Q||{}};if(Z.cache)S5.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:_0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var G9=null;async function BY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!G9)try{G9=await UY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,W)=>{let H=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=q||(J?"text":"");if(!U)return z;try{if(!G9.getSupportedLanguages().includes(U))return z;return(await G9.highlight(H,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,W,H]=z,U=await Y(K,q,W,H);Q=Q.replace(K,U)}return Q}async function n7($,Z,J="",X={}){return await VY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let W=z;if(!C5.isAbsolute(z))W=C5.resolve(C5.dirname(J),z);let H={};if(K)try{try{H=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let F=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let N=L.substring(0,w).trim(),R=L.substring(w+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);H[N]=R}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await jY(W,X),B={...Z,...j,...H},V=U,_=/\{\{([^}]+)\}\}/g;return V=V.replace(_,(O,F)=>{let L=F.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(W){let H=W instanceof Error?W.message:String(W);return _0("Markdown File",`Error including markdown file: ${H}`,J,$,q,G)}})}async function VY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((W)=>({match:z,replacement:W,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(j0(J))return W0(J,Object.keys(Z))(...Object.values(Z));else return Y0(J,Z)}catch{return!1}}function K1($,Z){let J=LY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function LY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=M0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function OY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function _1($,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 K=G.exec($),q=z.exec($),W=K?K.index:1/0,H=q?q.index:1/0;if(W<H)Y++,Q=W+K[0].length;else if(H<1/0){if(Y--,Y===0)return H;Q=H+q[0].length}else break}return-1}function s7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W="if",H=Y.expression,U=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(OY(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let _=V.match(/^@elseif\s*/);if(_){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+_[0].length,F=K1(z,O);if(!F){q++;continue}W="elseif",H=F.expression,q=F.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q}),W="else",H=void 0,q+=5,U=q;continue}}q++}return K.push({type:W,condition:H,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function _2($){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=s7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function z9($,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,K=z+Q[0].length-1,q=M0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let W=$.slice(K+1,q),H=q+1,U=_1($,Z,J,H);if(U===-1){Q=Y.exec($);continue}let j=$.slice(H,U),B=U+`@${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 P5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W=null,H=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(H++,W)W.content+=j[0];q+=j[0].length;continue}if(B){if(H--,W)W.content+=B[0];q+=B[0].length;continue}if(H>0){if(W)W.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),_=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(W)K.push(W);let F=q+V[0].length,L=K1(z,F);if(!L){q++;continue}W={type:"case",value:L.expression,content:""},q=L.endPos}else if(_&&U.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},q+=_[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(W)W.content+=z[q];q++}}if(W)K.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function FY($){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)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,W=wY($,q,K);if(W===-1){J=G+1;continue}let H=$.slice(q,W).trim(),U=W+K.length;Z.push({fullMatch:$.slice(G,U),expression:H,start:G,end:U,isRaw:Q}),J=U}return Z}function wY($,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 RY($){let Z=x5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=NY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function NY($){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=M0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=a7(G);return{name:X,args:z}}function a7($){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 DY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=M0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function MY($){let Z=[],X=new v5($).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 K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let H=Y<X.length?X[Y].start:$.length,U=o7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:W,value:$.slice(H,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let W=q.start,H=q.value==="{"?"}":"]",U=M0($,q.value,H,W);if(U!==-1){let j=$.slice(W,U+1);if(Y=r7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=o7(X,Y,$);Y=V.nextIndex;let _=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:_,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${_}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;Y++;let H=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){H=X[Y].start;break}Y++}if(H!==-1){let U=M0($,"{","}",H);if(U!==-1)Z.push({type:"function",name:W,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=r7(X,U+1)}}}else Y++}return Z}function o7($,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 r7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function AY($,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=P5(X,G);if(!z)break;try{let K;if(j0(z.expression))K=W0(z.expression,Object.keys(Z))(...Object.values(Z));else K=Y0(z.expression,Z);let q="",W=!1;for(let H of z.cases)if(H.type==="default"){if(!W)q=H.content.trim()}else try{let U;if(H.value&&j0(H.value))U=W0(H.value,Object.keys(Z))(...Object.values(Z));else if(H.value)U=Y0(H.value,Z);if(K===U){q=H.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),W=D0("Switch",`Error evaluating @switch expression: ${q}`,N0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function IY($){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 TY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function r0($,Z,J){let{masked:X,scripts:Y}=IY($);return TY(kY(X,Z,J),Y)}function kY($,Z,J){let X=$;X=AY(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,K=K1(X,z+7);if(!K)break;let q=K.endPos,W=_1(X,"unless","endunless",q);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 H=X.slice(q,W),U=K.expression,j=-1;{let V=0,_=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=_.exec(H))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(H))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(H))!==null)L.push({pos:w.index,type:"else"});L.sort((N,R)=>N.pos-R.pos);for(let N of L)if(N.type==="open")V++;else if(N.type==="close")V--;else if(N.type==="else"&&V===0){j=N.pos;break}}let B;if(j!==-1){let V=H.slice(0,j),_=H.slice(j+5);B=`@if (${U})${_}@else ${V}@endif`}else B=`@if (!(${U}))${H}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=g5(X,Z,J),X=h5(X,Z,J),X=f5(X,Z);let Y=()=>{let Q=_2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let W=Q[q];try{let H="",U=!1;for(let j of W.branches){if(U)break;if(j.type==="else")H=j.content,U=!0;else try{let B;if(j.condition&&j0(j.condition))B=W0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=Y0(j.condition,Z);if(B)H=j.content,U=!0}catch(B){H=D0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,N0.EVALUATION_ERROR),U=!0}}G[q]=H}catch(H){let U=H instanceof Error?H.message:String(H);G[q]=D0("If",`Error processing @if block: ${U}`,N0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let W=Q[q];z[q*2]=X.slice(K,W.start),z[q*2+1]=G[q],K=W.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function t7($){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 f5($,Z){let J=$;function X(z,K,q,W){let H=1,U=W,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&H>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),_=B.exec(z),O=V?V.index:1/0,F=_?_.index:1/0;if(O<F)H++,U=O+V[0].length;else if(F<1/0){if(H--,H===0)return F;U=F+_[0].length}else break}return-1}function Y(z,K,q){let W=0,H=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=H.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=U.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((_,O)=>_.pos-O.pos);for(let _ of B)if(_.type==="open")W++;else if(_.type==="close")W--;else if(_.type==="else"&&W===0)return _.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+5),j=t7(U);if(j)W=j.value,H=q+5+j.consumed;else H=q+5;let B=X(J,"auth","endauth",H);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(H,B),_=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let F;if(_!==-1){let L=V.slice(0,_),w=V.slice(_+5);F=O?L:w}else F=O?V:"";J=J.substring(0,q)+F+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+6),j=t7(U);if(j)W=j.value,H=q+6+j.consumed;else H=q+6;let B=X(J,"guest","endguest",H);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(H,B),_=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let F;if(_!==-1){let L=V.slice(0,_),w=V.slice(_+5);F=O?L:w}else F=O?V:"";J=J.substring(0,q)+F+J.substring(B+9),z=!0}}function Q(z,K,q){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(K)W.push(K);if(q){let H=z1(q,Z);W.push(H)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let H=J.match(new RegExp(`@${z}\\s*\\(`));if(!H||H.index===void 0)break;let U=H.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,_=X(J,z,K,V);if(_===-1){console.warn(`[stx] @${z} directive at position ${U} has no matching @${K} \u2014 the block was skipped.`);break}let O=J.slice(V,_),F=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),N=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],D;while((D=w.exec(O))!==null)T.push({pos:D.index,type:"open"});while((D=N.exec(O))!==null)T.push({pos:D.index,type:"close"});while((D=R.exec(O))!==null)T.push({pos:D.index,type:"elseDirective"});while((D=M.exec(O))!==null)T.push({pos:D.index,type:"else"});T.sort((y,b)=>y.pos-b.pos);for(let y of T){if(y.type==="open"){L++;continue}if(y.type==="close"){L--;continue}if(L===0)F.push(y)}let I=[],k=0;for(let y=0;y<F.length;y++){let b=F[y];if(I.push({content:O.slice(k,b.pos),ability:void 0}),b.type==="elseDirective"){let P=O.slice(b.pos+`@${q}`.length),h=G(P);if(h){I[I.length-1]={content:O.slice(k,b.pos)},k=b.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=F[y+1],g=p?p.pos:O.length;I.push({content:O.slice(k,g),ability:h.ability,type:h.type,id:h.id}),k=g}}else k=b.pos+5}if(k<O.length){let y=I[I.length-1];if(F.length>0&&F[F.length-1].type==="else")I.push({content:O.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(k)})}let A=Q(B.ability,B.type,B.id),E=z==="can"?A:!A,C="";if(E)C=I[0]?.content||"";else{let y=!1;for(let b=1;b<I.length;b++){let P=I[b];if(P.isFinalElse){C=P.content,y=!0;break}if(P.ability){let h=Q(P.ability,P.type,P.id);if(z==="can"?h:!h){C=P.content,y=!0;break}}}if(!y&&I.length>0){let b=I[I.length-1];if(b.isFinalElse)C=b.content}}J=J.substring(0,U)+C+J.substring(_+`@${K}`.length),W=!0}}return J}function g5($,Z,J){let X=$;function Y(Q,G,z,K,q){let W=!0;while(W){W=!1;let H=new RegExp(`@${G}\\s*\\(`),U=Q.match(H);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,_=_1(Q,G,z,V);if(_===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Q.slice(V,_),F=B.expression,L=-1,w=0,N=0;while(N<O.length){let R=O.indexOf("@",N);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,N=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){L=R;break}N=R+1}try{let R=K(F.trim()),M;if(L!==-1){let T=O.slice(0,L),D=O.slice(L+5);M=R?T:D}else M=R?O:"";Q=Q.substring(0,j)+M+Q.substring(_+`@${z}`.length),W=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=D0(q,`Error processing @${G} directive: ${M}`,N0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(_+`@${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 h5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let W=new RegExp(`@${z}(?![a-z])`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let _=W.exec(B);if(!_)break;let O=_.index,F=O+_[0].length;if(z==="env"){let A=B.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;F+=A[0].length,q=Y===A[2]}let L=1,w=F,N=-1;while(L>0&&w<B.length){W.lastIndex=w,H.lastIndex=w;let A=W.exec(B),E=H.exec(B),C=A?A.index:1/0,y=E?E.index:1/0;if(C<y)L++,w=C+A[0].length;else if(y<1/0){if(L--,L===0){N=y;break}w=y+E[0].length}else break}if(N===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let R=B.substring(F,N),M=-1,T=0,D=0;while(D<R.length){let A=R.indexOf("@",D);if(A===-1)break;let E=R.substring(A);if(U.test(E)){T++,D=A+1;continue}if(j.test(E)){T--,D=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(E)){M=A;break}D=A+1}let I;if(M!==-1){let A=R.slice(0,M),E=R.slice(M+5);I=q?A:E}else I=q?R:"";let k=`@${K}`.length;B=B.substring(0,O)+I+B.substring(N+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 u5=new WeakMap;function e7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function F1($,Z){if(!$)return Z?.nonceGenerator?.()??e7();let J=u5.get($);if(!J)J=Z?.nonceGenerator?.()??e7(),u5.set($,J);return J}function BU($){u5.delete($)}function $4($,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 d5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${$4($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var EY={"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},m5={"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},bY={"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'"]},yY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function VU($){return{enabled:!0,directives:{strict:EY,moderate:m5,relaxed:bY,api:yY}[$]||m5,useNonce:$==="strict",addMetaTag:!0}}function LU($,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:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function Z4($,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=d5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3170
+ </script>`}var E5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:g7,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:j7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:P7,hasEndTag:!1,description:"Include a web component in the template"},x7,f7,l7,c7,q5,H5,U5,W5,q7,t$,A7,I5,...p7],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,scrollRestoration:!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 QY($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=S0.join(Y,"resources","views"),G=S0.join(Y,"resources","layouts");if(Y9.existsSync(Q)&&Y9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=S0.join(Y,"resources","views","pages");if(Y9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var v7=new Set,Q9=["partialsDir","componentsDir","layoutsDir"],b5=new WeakMap;function GY($,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 zY($,Z){let J=!$.root,X=QY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!v7.has(Y))v7.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(!b5.has($)){let Y={};for(let Q of Q9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}b5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of Q9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||GY(G,Y))continue;$[Q]=S0.join(Y,G)}}for(let Y of Q9){let Q=$[Y];if(typeof Q!=="string"||!Q||S0.isAbsolute(Q))continue;$[Y]=S0.resolve(Z,Q)}return $}function KY($,Z){let J=b5.get($);for(let X of Q9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=S0.isAbsolute(Y)?Y:S0.join(Z,Y);if(Y9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function qY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function WY($){if(h7($.stateDir),$.stateDir=u7(),$.cachePath=L2($.cachePath),$.build)$.build.cacheDir=L2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=L2($.media.cache.directory);if($.story)$.story.outDir=L2($.story.outDir)}var G1=null,O1=new Map,Z9=new Map,O2=null;async function y5($){let Z=$?S0.resolve($):process.cwd(),J=Z9.get(Z);if(J&&J.signature!==J9(J.graph)){let Q=O1.get(Z);if(O1.delete(Z),Z9.delete(Z),!$)G1=null,O2=null;let{clearComponentCache:G}=await import("./chunk-ybx8n794.js"),{partialsCache:z}=await import("./chunk-xq0e2y4x.js");if(G(),z.clear(),Q&&J.configSignature===X9(J.graph)){let K=Q.then(async(q)=>{let W={...J.graph};await d7(W,Z),Z9.set(Z,{graph:W,signature:J9(W),configSignature:X9(W)});let H={...q,_layerGraph:W};if(!$)G1=H;return H});return O1.set(Z,K),K}}if(!$){if(G1)return G1;if(O2)return O2}let X=O1.get(Z);if(X)return X;let Y=(async()=>{let G=(await YY({name:"stx",alias:"ui",cwd:Z,defaultConfig:E5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await m7(Z,E5);G=z.config,Z9.set(Z,{graph:z.graph,signature:J9(z.graph),configSignature:X9(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-34f8c48f.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:K}=await import("./chunk-xrjx7b2v.js");await K(Z,G.runtimeConfig)}if(qY(G),WY(G),zY(G,Z),KY(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-dgv43ccd.js"),K=[],q=[];for(let W of G.plugins){let H=typeof W==="string"?W:W[0],U=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(H),B=S0.dirname(x.resolve(H))}catch{let _=S0.resolve(Z,H);j=await import(_),B=S0.dirname(_)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let _=Array.isArray(V.components)?V.components:[V.components];for(let O of _)K.push(S0.resolve(B,O))}if(V.pages){let _=S0.resolve(B,V.pages),O=U.path||"/";q.push({dir:_,prefix:O})}if(V.setup){let _={addDirective:(O)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(O)},addRoute:(O,F)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[O]=F},addMiddleware:(O)=>{G.middleware=G.middleware||[],G.middleware.push(O)},pluginDir:B,config:G};await V.setup(U,_)}console.log(`[stx] Plugin loaded: ${V.name||H}`)}catch(j){console.warn(`[stx] Failed to load plugin ${H}:`,j.message)}}G._pluginComponentDirs=K,G._pluginPageDirs=q}return G})();if(O1.set(Z,Y),Y.catch(()=>{if(O1.get(Z)===Y)O1.delete(Z)}),!$)O2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var i7=new Proxy(E5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!O2)y5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function mH($){return $}function dH($){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 S5=new Map;async function jY($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await HY.promises.stat($)).mtime.getTime();if(Z.cache&&S5.has($)){let H=S5.get($);if(H.updatedAt>=X)return{content:H.content,data:H.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=H7(Y),z=Z.markdown||i7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=j2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await BY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:q,data:Q||{}};if(Z.cache)S5.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:_0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var G9=null;async function BY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!G9)try{G9=await UY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,W)=>{let H=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=q||(J?"text":"");if(!U)return z;try{if(!G9.getSupportedLanguages().includes(U))return z;return(await G9.highlight(H,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,W,H]=z,U=await Y(K,q,W,H);Q=Q.replace(K,U)}return Q}async function n7($,Z,J="",X={}){return await VY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let W=z;if(!C5.isAbsolute(z))W=C5.resolve(C5.dirname(J),z);let H={};if(K)try{try{H=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let F=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let N=L.substring(0,w).trim(),R=L.substring(w+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);H[N]=R}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await jY(W,X),B={...Z,...j,...H},V=U,_=/\{\{([^}]+)\}\}/g;return V=V.replace(_,(O,F)=>{let L=F.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(W){let H=W instanceof Error?W.message:String(W);return _0("Markdown File",`Error including markdown file: ${H}`,J,$,q,G)}})}async function VY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((W)=>({match:z,replacement:W,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(j0(J))return W0(J,Object.keys(Z))(...Object.values(Z));else return Y0(J,Z)}catch{return!1}}function K1($,Z){let J=LY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function LY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=M0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function OY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function _1($,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 K=G.exec($),q=z.exec($),W=K?K.index:1/0,H=q?q.index:1/0;if(W<H)Y++,Q=W+K[0].length;else if(H<1/0){if(Y--,Y===0)return H;Q=H+q[0].length}else break}return-1}function s7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W="if",H=Y.expression,U=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(OY(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let _=V.match(/^@elseif\s*/);if(_){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+_[0].length,F=K1(z,O);if(!F){q++;continue}W="elseif",H=F.expression,q=F.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q}),W="else",H=void 0,q+=5,U=q;continue}}q++}return K.push({type:W,condition:H,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function _2($){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=s7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function z9($,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,K=z+Q[0].length-1,q=M0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let W=$.slice(K+1,q),H=q+1,U=_1($,Z,J,H);if(U===-1){Q=Y.exec($);continue}let j=$.slice(H,U),B=U+`@${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 P5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=_1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W=null,H=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(H++,W)W.content+=j[0];q+=j[0].length;continue}if(B){if(H--,W)W.content+=B[0];q+=B[0].length;continue}if(H>0){if(W)W.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),_=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(W)K.push(W);let F=q+V[0].length,L=K1(z,F);if(!L){q++;continue}W={type:"case",value:L.expression,content:""},q=L.endPos}else if(_&&U.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},q+=_[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(W)W.content+=z[q];q++}}if(W)K.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function FY($){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)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,W=wY($,q,K);if(W===-1){J=G+1;continue}let H=$.slice(q,W).trim(),U=W+K.length;Z.push({fullMatch:$.slice(G,U),expression:H,start:G,end:U,isRaw:Q}),J=U}return Z}function wY($,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 RY($){let Z=x5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=NY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function NY($){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=M0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=a7(G);return{name:X,args:z}}function a7($){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 DY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=M0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function MY($){let Z=[],X=new v5($).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 K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let H=Y<X.length?X[Y].start:$.length,U=o7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:W,value:$.slice(H,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let W=q.start,H=q.value==="{"?"}":"]",U=M0($,q.value,H,W);if(U!==-1){let j=$.slice(W,U+1);if(Y=r7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=o7(X,Y,$);Y=V.nextIndex;let _=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:_,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${_}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;Y++;let H=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){H=X[Y].start;break}Y++}if(H!==-1){let U=M0($,"{","}",H);if(U!==-1)Z.push({type:"function",name:W,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=r7(X,U+1)}}}else Y++}return Z}function o7($,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 r7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function AY($,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=P5(X,G);if(!z)break;try{let K;if(j0(z.expression))K=W0(z.expression,Object.keys(Z))(...Object.values(Z));else K=Y0(z.expression,Z);let q="",W=!1;for(let H of z.cases)if(H.type==="default"){if(!W)q=H.content.trim()}else try{let U;if(H.value&&j0(H.value))U=W0(H.value,Object.keys(Z))(...Object.values(Z));else if(H.value)U=Y0(H.value,Z);if(K===U){q=H.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),W=D0("Switch",`Error evaluating @switch expression: ${q}`,N0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function IY($){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 TY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function r0($,Z,J){let{masked:X,scripts:Y}=IY($);return TY(kY(X,Z,J),Y)}function kY($,Z,J){let X=$;X=AY(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,K=K1(X,z+7);if(!K)break;let q=K.endPos,W=_1(X,"unless","endunless",q);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 H=X.slice(q,W),U=K.expression,j=-1;{let V=0,_=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=_.exec(H))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(H))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(H))!==null)L.push({pos:w.index,type:"else"});L.sort((N,R)=>N.pos-R.pos);for(let N of L)if(N.type==="open")V++;else if(N.type==="close")V--;else if(N.type==="else"&&V===0){j=N.pos;break}}let B;if(j!==-1){let V=H.slice(0,j),_=H.slice(j+5);B=`@if (${U})${_}@else ${V}@endif`}else B=`@if (!(${U}))${H}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=g5(X,Z,J),X=h5(X,Z,J),X=f5(X,Z);let Y=()=>{let Q=_2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let W=Q[q];try{let H="",U=!1;for(let j of W.branches){if(U)break;if(j.type==="else")H=j.content,U=!0;else try{let B;if(j.condition&&j0(j.condition))B=W0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=Y0(j.condition,Z);if(B)H=j.content,U=!0}catch(B){H=D0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,N0.EVALUATION_ERROR),U=!0}}G[q]=H}catch(H){let U=H instanceof Error?H.message:String(H);G[q]=D0("If",`Error processing @if block: ${U}`,N0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let W=Q[q];z[q*2]=X.slice(K,W.start),z[q*2+1]=G[q],K=W.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function t7($){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 f5($,Z){let J=$;function X(z,K,q,W){let H=1,U=W,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&H>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),_=B.exec(z),O=V?V.index:1/0,F=_?_.index:1/0;if(O<F)H++,U=O+V[0].length;else if(F<1/0){if(H--,H===0)return F;U=F+_[0].length}else break}return-1}function Y(z,K,q){let W=0,H=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=H.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=U.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((_,O)=>_.pos-O.pos);for(let _ of B)if(_.type==="open")W++;else if(_.type==="close")W--;else if(_.type==="else"&&W===0)return _.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+5),j=t7(U);if(j)W=j.value,H=q+5+j.consumed;else H=q+5;let B=X(J,"auth","endauth",H);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(H,B),_=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let F;if(_!==-1){let L=V.slice(0,_),w=V.slice(_+5);F=O?L:w}else F=O?V:"";J=J.substring(0,q)+F+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+6),j=t7(U);if(j)W=j.value,H=q+6+j.consumed;else H=q+6;let B=X(J,"guest","endguest",H);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(H,B),_=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let F;if(_!==-1){let L=V.slice(0,_),w=V.slice(_+5);F=O?L:w}else F=O?V:"";J=J.substring(0,q)+F+J.substring(B+9),z=!0}}function Q(z,K,q){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(K)W.push(K);if(q){let H=z1(q,Z);W.push(H)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let H=J.match(new RegExp(`@${z}\\s*\\(`));if(!H||H.index===void 0)break;let U=H.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,_=X(J,z,K,V);if(_===-1){console.warn(`[stx] @${z} directive at position ${U} has no matching @${K} \u2014 the block was skipped.`);break}let O=J.slice(V,_),F=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),N=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],D;while((D=w.exec(O))!==null)T.push({pos:D.index,type:"open"});while((D=N.exec(O))!==null)T.push({pos:D.index,type:"close"});while((D=R.exec(O))!==null)T.push({pos:D.index,type:"elseDirective"});while((D=M.exec(O))!==null)T.push({pos:D.index,type:"else"});T.sort((y,b)=>y.pos-b.pos);for(let y of T){if(y.type==="open"){L++;continue}if(y.type==="close"){L--;continue}if(L===0)F.push(y)}let I=[],k=0;for(let y=0;y<F.length;y++){let b=F[y];if(I.push({content:O.slice(k,b.pos),ability:void 0}),b.type==="elseDirective"){let P=O.slice(b.pos+`@${q}`.length),h=G(P);if(h){I[I.length-1]={content:O.slice(k,b.pos)},k=b.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=F[y+1],g=p?p.pos:O.length;I.push({content:O.slice(k,g),ability:h.ability,type:h.type,id:h.id}),k=g}}else k=b.pos+5}if(k<O.length){let y=I[I.length-1];if(F.length>0&&F[F.length-1].type==="else")I.push({content:O.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(k)})}let A=Q(B.ability,B.type,B.id),E=z==="can"?A:!A,C="";if(E)C=I[0]?.content||"";else{let y=!1;for(let b=1;b<I.length;b++){let P=I[b];if(P.isFinalElse){C=P.content,y=!0;break}if(P.ability){let h=Q(P.ability,P.type,P.id);if(z==="can"?h:!h){C=P.content,y=!0;break}}}if(!y&&I.length>0){let b=I[I.length-1];if(b.isFinalElse)C=b.content}}J=J.substring(0,U)+C+J.substring(_+`@${K}`.length),W=!0}}return J}function g5($,Z,J){let X=$;function Y(Q,G,z,K,q){let W=!0;while(W){W=!1;let H=new RegExp(`@${G}\\s*\\(`),U=Q.match(H);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,_=_1(Q,G,z,V);if(_===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Q.slice(V,_),F=B.expression,L=-1,w=0,N=0;while(N<O.length){let R=O.indexOf("@",N);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,N=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){L=R;break}N=R+1}try{let R=K(F.trim()),M;if(L!==-1){let T=O.slice(0,L),D=O.slice(L+5);M=R?T:D}else M=R?O:"";Q=Q.substring(0,j)+M+Q.substring(_+`@${z}`.length),W=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=D0(q,`Error processing @${G} directive: ${M}`,N0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(_+`@${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 h5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let W=new RegExp(`@${z}(?![a-z])`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let _=W.exec(B);if(!_)break;let O=_.index,F=O+_[0].length;if(z==="env"){let A=B.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;F+=A[0].length,q=Y===A[2]}let L=1,w=F,N=-1;while(L>0&&w<B.length){W.lastIndex=w,H.lastIndex=w;let A=W.exec(B),E=H.exec(B),C=A?A.index:1/0,y=E?E.index:1/0;if(C<y)L++,w=C+A[0].length;else if(y<1/0){if(L--,L===0){N=y;break}w=y+E[0].length}else break}if(N===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let R=B.substring(F,N),M=-1,T=0,D=0;while(D<R.length){let A=R.indexOf("@",D);if(A===-1)break;let E=R.substring(A);if(U.test(E)){T++,D=A+1;continue}if(j.test(E)){T--,D=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(E)){M=A;break}D=A+1}let I;if(M!==-1){let A=R.slice(0,M),E=R.slice(M+5);I=q?A:E}else I=q?R:"";let k=`@${K}`.length;B=B.substring(0,O)+I+B.substring(N+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 u5=new WeakMap;function e7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function F1($,Z){if(!$)return Z?.nonceGenerator?.()??e7();let J=u5.get($);if(!J)J=Z?.nonceGenerator?.()??e7(),u5.set($,J);return J}function BU($){u5.delete($)}function $4($,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 d5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${$4($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var EY={"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},m5={"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},bY={"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'"]},yY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function VU($){return{enabled:!0,directives:{strict:EY,moderate:m5,relaxed:bY,api:yY}[$]||m5,useNonce:$==="strict",addMetaTag:!0}}function LU($,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:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function Z4($,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=d5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3171
3171
  ${Y}`)}function J4($,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 X4($,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 d5(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 CY={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 d5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},SY={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 OU(){return[CY,SY]}function _U($){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 PY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function FU($,Z){if(!$.enabled)return{};let J=$.useNonce?F1(Z,$):void 0,X=$4($.directives,J);return{[PY($.reportOnly)]:X}}var wU={enabled:!1,reportOnly:!1,directives:m5,useNonce:!1,addMetaTag:!0};import vY from"crypto";var xY=40,Y4="_token",l5=null;function fY($=xY){let Z=vY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return l5=Z,Z}function gY(){if(!l5)fY();return l5}function hY($=Y4){let Z=gY();return`<input type="hidden" name="${$}" value="${Z}">`}function Q4($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return hY(X||Y4)})}async function K4($,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 uY(Y,Q,Z,J,X);else Y=await mY(Y,Q,Z,J,X)}return Y}async function uY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,K=`@end${Q}`,q=$,W=w1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),H=[],U=W.exec(q);while(U!==null){let[j,B="",V=""]=U,_=U.index||0;try{let O=B?q4(Z,B):[],F=V.trim(),L=await G(F,O,J,X);H.push({original:j,processed:L,startIndex:_})}catch(O){let F=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);H.push({original:j,processed:D0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${F}`,N0.EVALUATION_ERROR),startIndex:_})}U=W.exec(q)}for(let j=H.length-1;j>=0;j--){let{original:B,processed:V}=H[j];q=q.replace(B,V)}return q}async function mY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,K=[],q=[];if(Z.rawParams){for(let U of G4(z,w1(`(?<![\\w$@])@${Q}\\s*\\(`,"g")))if(U.end!==-1)q.push({fullMatch:U.call,paramString:U.args,startIndex:U.start})}else{let U=w1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");U.lastIndex=0;let j=U.exec(z);while(j!==null)q.push({fullMatch:j[0],paramString:j[1]??"",startIndex:j.index||0}),j=U.exec(z)}for(let{fullMatch:U,paramString:j,startIndex:B}of q)try{let V=q4(Z,j),_=await G("",V,J,X);K.push({original:U,processed:_,startIndex:B})}catch(V){let _=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:U,processed:D0("CustomDirective",`Error in @${Q}(${j}): ${_}`,N0.EVALUATION_ERROR),startIndex:B})}let W=w1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=W.exec(z);while(H!==null){let[U]=H,j=H.index||0;try{let B=await G("",[],J,X);K.push({original:U,processed:B,startIndex:j})}catch(B){let V=B instanceof Error?B.message:String(B);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,B);K.push({original:U,processed:D0("CustomDirective",`Error in @${Q}: ${V}`,N0.EVALUATION_ERROR),startIndex:j})}H=W.exec(z)}for(let U=K.length-1;U>=0;U--){let{original:j,processed:B}=K[U];z=z.replace(j,B)}return z}function q4($,Z){return $.rawParams?z4(Z):dY(Z)}function dY($){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 W4=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,H4=/^[A-Za-z_$][\w$]*$/,lY=new Set(["light","dark","system"]);function R1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function cY($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(R1(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(R1(J.key,"appearance.key"),R1(J.attribute,"appearance.attribute"),R1(J.default,"appearance.default"),R1(X.key,"colorMode.key"),R1(X.attribute,"colorMode.attribute"),R1(X.default,"colorMode.default"),!H4.test(J.key)||!H4.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!W4.test(J.attribute)||!W4.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(!lY.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 pY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function iY($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${pY($)};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 nY($,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 U4($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=nY(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),K=Y0(`(${z})`,Z),q=iY(cY(K));J=J.slice(0,Y.index)+q+J.slice(G+1),X.lastIndex=Y.index+q.length}return J}import sY from"crypto";function A0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var p5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function oY($){return{...p5,...$.forms?.classes}}function K9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function g0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function h1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${A0(Z)}"`}function c5($,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="${A0(`${g0($)}-error`)}"`;return X}function rY(){return sY.randomUUID()}function CU($,Z,J,X){let Y=oY(X),Q=$;return Q=tY(Q,Z),Q=R2(Q,Z),Q=i5(Q,Z,Y),Q=n5(Q,Z,Y),Q}function R2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=rY();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${A0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${A0(Q)}">`;return X}),J}function i5($,Z,J=p5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"POST",H=z||K||"",U=q1(q),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${A0(B)}" action="${A0(H)}"${U?` ${U}`:""}>`;if(V+=`
3172
3172
  ${R2("@csrf",Z)}`,!["GET","POST"].includes(j))V+=`
3173
3173
  ${R2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"",H=z||K||"",U=q1(q),j=F2(W,Z),B=j!==void 0&&j!==null?j:H||"",V=U.match(/type=['"]([^'"]+)['"]/i),_=V?V[1]:"text",O=w2(W,Z),F=U.match(/class=['"]([^'"]+)['"]/i),L=K9(F?F[1]:"",J.input,O,J.inputError),w=U.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${A0(_)}" name="${A0(W)}"${h1(U,g0(W))} value="${A0(B)}" class="${L}"${c5(W,O,U)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let K=q1(G),q=F2(Q,Z)||z.trim(),W=w2(Q,Z),H=K.match(/class=['"]([^'"]+)['"]/i),U=K9(H?H[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${A0(Q)}"${h1(K,g0(Q))} class="${U}"${c5(Q,W,K)}${j?` ${j}`:""}>${A0(q)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let K=q1(G),q=F2(Q,Z),W=w2(Q,Z),H=K.match(/class=['"]([^'"]+)['"]/i),U=K9(H?H[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,""),B=z;if(q!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,_,O)=>{if((Array.isArray(q)?q.some((L)=>String(L)===O):String(q)===O)&&!_.includes("selected"))return _.replace(/(<option)/,"$1 selected");return V});return`<select name="${A0(Q)}"${h1(K,g0(Q))} class="${U}"${c5(Q,W,K)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=G===void 0?"1":G,q=G===void 0?g0(Q):`${g0(Q)}-${g0(K)}`,W=q1(z),H=F2(Q,Z),U=H!==void 0&&(Array.isArray(H)?H.some((_)=>String(_)===K):H===!0||String(H)===K),j=W.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${A0(Q)}"${h1(W,q)} value="${A0(K)}" class="${B}"${U?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=q1(z),q=F2(Q,Z),W=q!==void 0&&q===G,H=K.match(/class=['"]([^'"]+)['"]/i),U=H?H[1]:J.checkInput,j=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${A0(Q)}"${h1(K,`${g0(Q)}-${g0(G)}`)} value="${A0(G)}" class="${U}"${W?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=q1(G),K=z.match(/accept=['"]([^'"]+)['"]/i),q=K?K[1]:"",W=z.includes("multiple"),H=w2(Q,Z),U=z.match(/class=['"]([^'"]+)['"]/i),j=K9(U?U[1]:"",J.input,H,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${A0(Q)}"${h1(z,g0(Q))}`,`class="${j}"`];if(q)V.push(`accept="${A0(q)}"`);if(W)V.push("multiple");if(B)V.push(B);return`${V.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let K=q1(G),q=K.match(/class=['"]([^'"]+)['"]/i),W=q?q[1]:J.label,H=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${A0(g0(Q))}" class="${W}"${H?` ${H}`:""}>${z}</label>`}),X}function n5($,Z,J=p5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(w2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return j4(Y,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return j4(Y,Z)}let q=K.trim();if(j0(q)){let W=Y0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return`<div id="${A0(`${g0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function w2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function j4($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function F2($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(J=Z[X],J!==void 0)return J}return Z[$]}function q1($){if(!$.trim())return"";let Z=[],J=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=X.exec(J))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var B4={required:($,Z,J)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${J} field is required.`;return null},email:($,Z,J)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${J} field must be a valid email address.`;return null},min:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${J} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${J} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${J} field must have at least ${X} items.`;return null},max:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${J} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${J} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${J} field must not have more than ${X} items.`;return null},confirmed:($,Z,J)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${J} confirmation does not match.`;return null},numeric:($,Z,J)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${J} field must be a number.`;return null},integer:($,Z,J)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${J} field must be an integer.`;return null},alpha:($,Z,J)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${J} field must only contain letters.`;return null},alphanumeric:($,Z,J)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${J} field must only contain letters and numbers.`;return null},url:($,Z,J)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${J} field must be a valid URL.`}},regex:($,Z,J)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${J} field format is invalid.`;return null}catch{return`The ${J} field has an invalid validation pattern.`}},in:($,Z,J)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${J} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,J)=>{if(!$)return null;if(Z.includes(String($)))return`The ${J} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,J)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${J} field must be a valid date.`;return null},before:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X>=Y)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X<=Y)return`The ${J} field must be after ${Z[0]}.`;return null}};function SU($,Z){B4[$]=Z}function s5($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function aY($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=s5(G),K=B4[z.name];if(!K){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let W=`${$}_confirmation`;z.params=[X[W]]}let q=K(Z,z.params||[],$);if(q)Y.push(z.message||q)}return{field:$,valid:Y.length===0,errors:Y}}function PU($,Z){let J={};for(let[X,Y]of Object.entries(Z)){let Q=aY(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function tY($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Y,Q)=>{let G=Y.split("|").map((K)=>K.trim()),z=[];for(let K of G){let q=s5(K);switch(q.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),q.name==="integer")z.push('step="1"');break;case"min":if(q.params?.[0])z.push(`minlength="${q.params[0]}"`);break;case"max":if(q.params?.[0])z.push(`maxlength="${q.params[0]}"`);break;case"regex":if(q.params?.[0])z.push(`pattern="${q.params[0]}"`);break}}return`<!-- @validate:${X}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var V4={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length>=J||`Must be at least ${J} characters`;if(typeof $==="number")return $>=J||`Must be at least ${J}`;if(Array.isArray($))return $.length>=J||`Must have at least ${J} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length<=J||`Must be no more than ${J} characters`;if(typeof $==="number")return $<=J||`Must be no more than ${J}`;if(Array.isArray($))return $.length<=J||`Must have no more than ${J} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[J,X]=Z.map(Number);if(typeof $==="string")return $.length>=J&&$.length<=X||`Must be between ${J} and ${X} characters`;if(typeof $==="number")return $>=J&&$<=X||`Must be between ${J} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,J)=>{let X=Object.keys(J);for(let Y of X)if(Y.endsWith("_confirmation")&&J[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length===J||`Must be exactly ${J} characters`;if(Array.isArray($))return $.length===J||`Must have exactly ${J} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function vU($){V4[$.name]=$}function eY($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=s5(Q),z=V4[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let K=z.validate($,G.params||[],J);if(K!==!0)X.push(K)}return{valid:X.length===0,errors:X}}function xU($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=eY($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function fU($,Z){let J=JSON.stringify(Z);return`
@@ -3403,9 +3403,9 @@ ${Y}
3403
3403
  } finally {
3404
3404
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3405
3405
  }
3406
- })();`}function dQ($,Z){if(p0($)){let Y=p0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:v1($,(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],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var Z6=0,F3=new Set;function gB(){F3.clear()}function J6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var hB=new o1(500),Y6=new Set;function uB(){Y6.clear()}function lQ($){if($.__onceStore instanceof Set)return $.__onceStore;return Y6}async function w3($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||z0.join(z0.dirname(J),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let z=xQ($,"@partial","@include"),K=lQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,_,O)=>{let F=_.trim(),L=`${J}:${F}`;if(K.has(L))return"";return K.add(L),_});{let V=/@includeIf\s*\(/g,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let N=z.substring(F+1,w-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),D="";if(T&&await Bun.file(T).exists())Y.add(T),D=`@include(${N})`;z=z.substring(0,O)+D+z.substring(w),V.lastIndex=0}}for(let[V,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(z))!==null){let L=F.index,w=L+F[0].length-1,N=1,R=w+1;while(R<z.length&&N>0){if(z[R]==="(")N++;else if(z[R]===")")N--;R++}if(N!==0)break;let M=z.substring(w+1,R-1),T=_3(M,0);if(T===-1){O.lastIndex=R;continue}let D=M.substring(0,T).trim(),I=M.substring(T+1).trim(),k=I.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=R;continue}let A=k[1],E=I.substring(k[0].length),C,y=_3(E,0);if(y!==-1)C=E.substring(y+1).trim();try{let b=`Boolean(${D})`,P;if(j0(b)){let g=W0(b,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(Y0(b,Z));let h=_?!P:P,p="";if(h){let g=q(A,G,J);if(g&&await Bun.file(g).exists())Y.add(g);p=`@include('${A}'${C?`, ${C}`:""})`}z=z.substring(0,L)+p+z.substring(R),O.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),h=_0("Include",`Error evaluating ${V} condition: ${P}`,J,$,L);z=z.substring(0,L)+h+z.substring(R),O.lastIndex=0}}}{let V=/@each\s*\(/g,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+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 N=z.substring(F+1,w),R=z.substring(O,w+1),M=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,D,I,k]=M;try{let A,E=D.trim();if(j0(E))A=W0(E,Object.keys(Z))(...Object.values(Z));else A=Y0(E,Z);let C="";if(Array.isArray(A)&&A.length>0)for(let y of A){let b={...Z,[I]:y},P=await U(T,b,$,O);C+=P}else if(k)C=await U(k,{},$,O);z=z.substring(0,O)+C+z.substring(w+1),V.lastIndex=0}catch(A){let E=A instanceof Error?A.message:String(A);z=z.substring(0,O)+_0("Each",`Error in @each: ${E}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+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 N=z.substring(F+1,w),R=z.substring(O,w+1),M=N.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],D=N.slice(M[0].length),I,k=D.match(/^\s*,\s*\{/);if(k){D=D.slice(k[0].length-1);let C=1,y=1;while(y<D.length&&C>0){if(D[y]==="{")C++;else if(D[y]==="}"){if(C--,C===0)break}y++}I=D.substring(0,y+1),D=D.slice(y+1)}let A,E=D.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)A=E[1];try{let C=JSON.parse(T.replace(/'/g,'"')),y={};if(I)try{y=d0(I,Z)}catch(P){let h=P instanceof Error?P.message:String(P);if(X.debug){let p=_0("Include",`Error parsing includeFirst variables: ${h}`,J,$,O,R);z=z.replace(R,()=>p)}else z=z.replace(R,()=>A||"");continue}let b=!1;for(let P of C){let h=q(P,G,J);if(!h)continue;if(await t(h)){let p=await U(P,y,$,O);z=z.replace(R,()=>p),b=!0;break}}if(!b)if(A!==void 0)z=z.replace(R,()=>A);else if(X.debug){let P=_0("Include",`None of the includeFirst paths exist: ${T}`,J,$,O,R);z=z.replace(R,()=>P)}else z=z.replace(R,"")}catch(C){let y=C instanceof Error?C.message:String(C),b=_0("Include",`Error processing @includeFirst: ${y}`,J,$,O,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,_,O){try{let F=V;if(!V.endsWith(".stx"))F=`${V}.stx`;let L=z0.resolve(_),w=z0.resolve(z0.dirname(O)),N;if(!F.startsWith("./")&&!F.startsWith("../")){for(let k of X._layerPartialDirs??[]){let A=z0.resolve(k,F);if(A.startsWith(`${z0.resolve(k)}${z0.sep}`)&&vQ(A))return A}N=z0.resolve(_,F)}else N=z0.resolve(w,F);let R=z0.normalize(N),M=R.startsWith(L+z0.sep)||R===L,T=R.startsWith(w+z0.sep)||R===w,D=!1,I=z0.dirname(w);if(R.startsWith(I+z0.sep)){if(!z0.relative(I,R).split(z0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))D=!0}if(!M&&!T&&!D)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return R}catch(F){return console.error(`Error resolving path ${V}: ${F}`),null}}let W=z0.resolve(J);Q.add(W);function H(V,_,O,F){return X.onIncludeError?.({includePath:V,templatePath:J,message:_,partialsDir:G}),_0("Include",_,J,O,F)}async function U(V,_={},O,F){let L=q(V,G,J);if(!L)return H(V,`Could not resolve path for include: ${V}`,O,F);let w=z0.resolve(L);if(Q.has(w)){let N=[...Q,w].map((R)=>z0.basename(R)).join(" -> ");return H(V,`Circular include detected: ${N}`,O,F)}try{Y.add(L);let N;if(!N)try{N=await Bun.file(L).text()}catch(i){let q0=i instanceof Error?i.message:String(i);return H(V,`Error loading include file ${V}: ${q0}`,O,F)}if(N)N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(N&&N.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-39qy76ek.js");N=i(N,Z)}if(N&&(X.debug||!N9()&&!D9()))try{let{warnUnbalancedTags:i}=await import("./chunk-x054qzma.js");i(N,L)}catch{}let R=N;try{let{processESImports:i}=await import("./chunk-1exk54qt.js");await i(N,Z,L,X,Y)}catch(i){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,i instanceof Error?i.message:i)}let M=q9(R);if(M)R=M.content.trim();let D=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(D)I=`<style${D[1]}>${D[2]}</style>`;let k=[];R=R.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(i,q0,r)=>{if(!J6(q0))return"";return k.push({attrs:q0,body:r}),`__STX_DATA_BLOCK_${k.length-1}__`}),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=X1(N,L);for(let[i,q0]of Object.entries(_))A[i]=q0;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...N.matchAll(E)],y="",b=null,P=!1;for(let i of C){let q0=i[1]||"",r=i[2]||"";if(J6(q0))continue;let L0=q0.includes("server"),e0=I1(q0);if(!L0&&r.trim()){let{interpolateScriptExpressions:u}=await import("./chunk-hsbbfp0c.js");r=u(r,A,V)}let $1="";try{let{extractAndStripCssImports:u,renderVendorStyleTags:o}=await import("./chunk-020hpw7m.js"),Q0=u(r,{filePath:L,projectRoot:process.cwd()});r=Q0.code,$1=o(Q0.styles)}catch(u){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,u instanceof Error?u.message:u)}if(e0&&r.trim())r=T1(r);if(!L0){try{let{injectBrowserCoreAutoImports:o}=await import("./chunk-020hpw7m.js");r=o(r).code;let{hasUserImports:Q0,bundleClientScript:B0}=await import("./chunk-tscr6bs8.js");if(Q0(r))r=await B0(r,L,{projectRoot:process.cwd()})}catch(o){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,o instanceof Error?o.message:o)}let{stripStxRuntimeImports:u}=await import("./chunk-8tjg4wbr.js");r=u(r)}let l=fQ(r);if(l&&!L0){P=!0,b=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Z6}`;let u=a0(r),o=$6(u,b);y+=`${$1}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${o}</script>
3407
- `;continue}if(L0)try{let{extractVariables:u}=await import("./chunk-jzfk5ect.js");await u(r,A,L)}catch(u){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,u)}if(!L0&&!l){let u=q0.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Z6}`;let o=a0(r),Q0=$6(o,b);y+=`${$1}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${u?` ${u}`:""}>${Q0}</script>
3408
- `}}if(k.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-hsbbfp0c.js");R=R.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q0,r)=>{let L0=k[Number(r)];return`<script${L0.attrs}>${i(L0.body,A,V)}</script>`})}if(b){let i=dQ(R,b);if(R=i.html,i.mergedIntoExisting){let r=b,L0=i.mergedIntoExisting;y=y.split(`'${r}'`).join(`'${L0}'`).split(`"${r}"`).join(`"${L0}"`),b=L0}else if(!i.stamped&&P&&!F3.has(L))F3.add(L),console.warn(`[stx] ${z0.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 q0=i.stamped&&i.root!==null&&T2(i.root);y=uQ(y,q0?b:null)}if(R.includes("@include")||R.includes("@partial"))R=await w3(R,A,L,X,Y,Q);let{processLoops:h,reportDeferredLoopWarnings:p}=await import("./chunk-6z9pm31g.js"),g=h(R,A,L,void 0,!0);g=r0(g,A,L),g=p(g);let{processMetaDirectives:Z0,processSeoDirective:J0,processStructuredData:e}=await import("./chunk-bk1zb1xp.js");if(g=Z0(g,A,L,X),g=e(g,A,L),g=J0(g,A,L,X),g=V1(g,A,L),I)g+=`
3406
+ })();`}function dQ($,Z){if(p0($)){let Y=p0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:v1($,(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],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var Z6=0,F3=new Set;function gB(){F3.clear()}function J6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var hB=new o1(500),Y6=new Set;function uB(){Y6.clear()}function lQ($){if($.__onceStore instanceof Set)return $.__onceStore;return Y6}async function w3($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||z0.join(z0.dirname(J),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let z=xQ($,"@partial","@include"),K=lQ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,_,O)=>{let F=_.trim(),L=`${J}:${F}`;if(K.has(L))return"";return K.add(L),_});{let V=/@includeIf\s*\(/g,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let N=z.substring(F+1,w-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){V.lastIndex=w;continue}let M=R[1],T=q(M,G,J),D="";if(T&&await Bun.file(T).exists())Y.add(T),D=`@include(${N})`;z=z.substring(0,O)+D+z.substring(w),V.lastIndex=0}}for(let[V,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(z))!==null){let L=F.index,w=L+F[0].length-1,N=1,R=w+1;while(R<z.length&&N>0){if(z[R]==="(")N++;else if(z[R]===")")N--;R++}if(N!==0)break;let M=z.substring(w+1,R-1),T=_3(M,0);if(T===-1){O.lastIndex=R;continue}let D=M.substring(0,T).trim(),I=M.substring(T+1).trim(),k=I.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=R;continue}let A=k[1],E=I.substring(k[0].length),C,y=_3(E,0);if(y!==-1)C=E.substring(y+1).trim();try{let b=`Boolean(${D})`,P;if(j0(b)){let g=W0(b,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(Y0(b,Z));let h=_?!P:P,p="";if(h){let g=q(A,G,J);if(g&&await Bun.file(g).exists())Y.add(g);p=`@include('${A}'${C?`, ${C}`:""})`}z=z.substring(0,L)+p+z.substring(R),O.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),h=_0("Include",`Error evaluating ${V} condition: ${P}`,J,$,L);z=z.substring(0,L)+h+z.substring(R),O.lastIndex=0}}}{let V=/@each\s*\(/g,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+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 N=z.substring(F+1,w),R=z.substring(O,w+1),M=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let[,T,D,I,k]=M;try{let A,E=D.trim();if(j0(E))A=W0(E,Object.keys(Z))(...Object.values(Z));else A=Y0(E,Z);let C="";if(Array.isArray(A)&&A.length>0)for(let y of A){let b={...Z,[I]:y},P=await U(T,b,$,O);C+=P}else if(k)C=await U(k,{},$,O);z=z.substring(0,O)+C+z.substring(w+1),V.lastIndex=0}catch(A){let E=A instanceof Error?A.message:String(A);z=z.substring(0,O)+_0("Each",`Error in @each: ${E}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,_;while((_=V.exec(z))!==null){let O=_.index,F=O+_[0].length-1,L=1,w=F+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 N=z.substring(F+1,w),R=z.substring(O,w+1),M=N.match(/^\s*(\[[^\]]+\])/);if(!M){V.lastIndex=0,z=z.replace(R,"");continue}let T=M[1],D=N.slice(M[0].length),I,k=D.match(/^\s*,\s*\{/);if(k){D=D.slice(k[0].length-1);let C=1,y=1;while(y<D.length&&C>0){if(D[y]==="{")C++;else if(D[y]==="}"){if(C--,C===0)break}y++}I=D.substring(0,y+1),D=D.slice(y+1)}let A,E=D.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)A=E[1];try{let C=JSON.parse(T.replace(/'/g,'"')),y={};if(I)try{y=d0(I,Z)}catch(P){let h=P instanceof Error?P.message:String(P);if(X.debug){let p=_0("Include",`Error parsing includeFirst variables: ${h}`,J,$,O,R);z=z.replace(R,()=>p)}else z=z.replace(R,()=>A||"");continue}let b=!1;for(let P of C){let h=q(P,G,J);if(!h)continue;if(await t(h)){let p=await U(P,y,$,O);z=z.replace(R,()=>p),b=!0;break}}if(!b)if(A!==void 0)z=z.replace(R,()=>A);else if(X.debug){let P=_0("Include",`None of the includeFirst paths exist: ${T}`,J,$,O,R);z=z.replace(R,()=>P)}else z=z.replace(R,"")}catch(C){let y=C instanceof Error?C.message:String(C),b=_0("Include",`Error processing @includeFirst: ${y}`,J,$,O,R);z=z.replace(R,()=>b)}V.lastIndex=0}}function q(V,_,O){try{let F=V;if(!V.endsWith(".stx"))F=`${V}.stx`;let L=z0.resolve(_),w=z0.resolve(z0.dirname(O)),N;if(!F.startsWith("./")&&!F.startsWith("../")){for(let k of X._layerPartialDirs??[]){let A=z0.resolve(k,F);if(A.startsWith(`${z0.resolve(k)}${z0.sep}`)&&vQ(A))return A}N=z0.resolve(_,F)}else N=z0.resolve(w,F);let R=z0.normalize(N),M=R.startsWith(L+z0.sep)||R===L,T=R.startsWith(w+z0.sep)||R===w,D=!1,I=z0.dirname(w);if(R.startsWith(I+z0.sep)){if(!z0.relative(I,R).split(z0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))D=!0}if(!M&&!T&&!D)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return R}catch(F){return console.error(`Error resolving path ${V}: ${F}`),null}}let W=z0.resolve(J);Q.add(W);function H(V,_,O,F){return X.onIncludeError?.({includePath:V,templatePath:J,message:_,partialsDir:G}),_0("Include",_,J,O,F)}async function U(V,_={},O,F){let L=q(V,G,J);if(!L)return H(V,`Could not resolve path for include: ${V}`,O,F);let w=z0.resolve(L);if(Q.has(w)){let N=[...Q,w].map((R)=>z0.basename(R)).join(" -> ");return H(V,`Circular include detected: ${N}`,O,F)}try{Y.add(L);let N;if(!N)try{N=await Bun.file(L).text()}catch(i){let q0=i instanceof Error?i.message:String(i);return H(V,`Error loading include file ${V}: ${q0}`,O,F)}if(N)N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(N&&N.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-b5mnam29.js");N=i(N,Z)}if(N&&(X.debug||!N9()&&!D9()))try{let{warnUnbalancedTags:i}=await import("./chunk-x054qzma.js");i(N,L)}catch{}let R=N;try{let{processESImports:i}=await import("./chunk-e7gs18rc.js");await i(N,Z,L,X,Y)}catch(i){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,i instanceof Error?i.message:i)}let M=q9(R);if(M)R=M.content.trim();let D=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(D)I=`<style${D[1]}>${D[2]}</style>`;let k=[];R=R.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(i,q0,r)=>{if(!J6(q0))return"";return k.push({attrs:q0,body:r}),`__STX_DATA_BLOCK_${k.length-1}__`}),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=X1(N,L);for(let[i,q0]of Object.entries(_))A[i]=q0;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...N.matchAll(E)],y="",b=null,P=!1;for(let i of C){let q0=i[1]||"",r=i[2]||"";if(J6(q0))continue;let L0=q0.includes("server"),e0=I1(q0);if(!L0&&r.trim()){let{interpolateScriptExpressions:u}=await import("./chunk-fp868yhg.js");r=u(r,A,V)}let $1="";try{let{extractAndStripCssImports:u,renderVendorStyleTags:o}=await import("./chunk-1qyg1q6d.js"),Q0=u(r,{filePath:L,projectRoot:process.cwd()});r=Q0.code,$1=o(Q0.styles)}catch(u){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,u instanceof Error?u.message:u)}if(e0&&r.trim())r=T1(r);if(!L0){try{let{injectBrowserCoreAutoImports:o}=await import("./chunk-1qyg1q6d.js");r=o(r).code;let{hasUserImports:Q0,bundleClientScript:B0}=await import("./chunk-7g5vk4c3.js");if(Q0(r))r=await B0(r,L,{projectRoot:process.cwd()})}catch(o){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,o instanceof Error?o.message:o)}let{stripStxRuntimeImports:u}=await import("./chunk-3zm4hgcf.js");r=u(r)}let l=fQ(r);if(l&&!L0){P=!0,b=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Z6}`;let u=a0(r),o=$6(u,b);y+=`${$1}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${o}</script>
3407
+ `;continue}if(L0)try{let{extractVariables:u}=await import("./chunk-h1vax4wg.js");await u(r,A,L)}catch(u){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,u)}if(!L0&&!l){let u=q0.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Z6}`;let o=a0(r),Q0=$6(o,b);y+=`${$1}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${u?` ${u}`:""}>${Q0}</script>
3408
+ `}}if(k.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-fp868yhg.js");R=R.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q0,r)=>{let L0=k[Number(r)];return`<script${L0.attrs}>${i(L0.body,A,V)}</script>`})}if(b){let i=dQ(R,b);if(R=i.html,i.mergedIntoExisting){let r=b,L0=i.mergedIntoExisting;y=y.split(`'${r}'`).join(`'${L0}'`).split(`"${r}"`).join(`"${L0}"`),b=L0}else if(!i.stamped&&P&&!F3.has(L))F3.add(L),console.warn(`[stx] ${z0.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 q0=i.stamped&&i.root!==null&&T2(i.root);y=uQ(y,q0?b:null)}if(R.includes("@include")||R.includes("@partial"))R=await w3(R,A,L,X,Y,Q);let{processLoops:h,reportDeferredLoopWarnings:p}=await import("./chunk-mr8ccsnm.js"),g=h(R,A,L,void 0,!0);g=r0(g,A,L),g=p(g);let{processMetaDirectives:Z0,processSeoDirective:J0,processStructuredData:e}=await import("./chunk-bk1zb1xp.js");if(g=Z0(g,A,L,X),g=e(g,A,L),g=J0(g,A,L,X),g=V1(g,A,L),I)g+=`
3409
3409
  `+I;if(y)g+=`
3410
3410
  `+y;return g}catch(N){let R=N instanceof Error?N.message:String(N);return H(V,`Error processing include ${V}: ${R}`,O,F)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,_=V+B[0].length-1,O=1,F=_+1;while(F<z.length&&O>0){if(z[F]==="(")O++;else if(z[F]===")")O--;F++}if(O!==0)break;let L=z.substring(V,F),w=z.substring(_+1,F-1),N=w.match(/^\s*['"]([^'"]+)['"]/);if(!N){j.lastIndex=F;continue}let R=N[1],M,T=w.substring(N[0].length),D=_3(T,0);if(D!==-1)M=T.substring(D+1).trim();let I={};if(M)try{I=d0(M,Z)}catch(A){let E=A instanceof Error?A.message:String(A);z=z.replace(L,_0("Include",`Error parsing include variables for ${R}: ${E}`,J,$,V)),j.lastIndex=0;continue}let k=await U(R,I,$,V);z=z.substring(0,V)+k+z.substring(F),j.lastIndex=0}return z}function R3($,Z){let J=$;function X(Y,Q,G,z){let K=Y,q=!0;while(q){q=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),H=K.match(W);if(!H||H.index===void 0)break;let U=H.index,j=H[1],B=U+H[0].length,V=new RegExp(`@${Q}\\(`),_=new RegExp(`@${G}(?![a-z])`),O=1,F=B,L=-1;while(O>0&&F<K.length){let N=K.slice(F),R=N.match(V),M=N.match(_),T=R?F+R.index:1/0,D=M?F+M.index:1/0;if(T<D)O++,F=T+(R[0].length||1);else if(D<1/0){if(O--,O===0){L=D;break}F=D+G.length+1}else break}if(L===-1)break;let w=K.slice(B,L);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);K=K.substring(0,U)+K.substring(L+`@${G}`.length),q=!0}return K}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function N3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
3411
3411
  `)})}import*as D3 from"path";async function Q6($,Z,J=""){if(D3.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 z6($,Z,J,"@js","@endjs")}async function G6($,Z,J=""){if(D3.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 z6($,Z,J,"@ts","@endts")}async function z6($,Z,J,X,Y){let Q=$,G=w1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],K;while((K=G.exec($))!==null)z.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:q,content:W,index:H}of z)try{let U={...Z,global:Z},j=Object.keys(U),B=Object.values(U),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 O=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
@@ -3468,14 +3468,14 @@ ${$.slice(J)}`}function s6($,Z={},J={},X){if(X??f3($))return $;return gG($,Z,J)}
3468
3468
  ${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3469
3469
  `+$.slice(G)}if(p0($))return v1($,(G)=>`${G}
3470
3470
  ${Z}`);return`${Z}
3471
- ${$}`}async function y9($,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-e4yskgtb.js"),{url:Q}=await Y("runtime",Z.debug===!0);return h3($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return h3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-e4yskgtb.js"),X=await J(Z.debug);return h3($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function lG($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function X8($){if($.includes("data-stx-tooltip-runtime")||!lG($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${U3()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3471
+ ${$}`}async function y9($,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-qr3zcm87.js"),{url:Q}=await Y("runtime",Z.debug===!0);return h3($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return h3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-qr3zcm87.js"),X=await J(Z.debug);return h3($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function lG($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function X8($){if($.includes("data-stx-tooltip-runtime")||!lG($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${U3()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3472
3472
  ${Z}`;return`${$.slice(0,J)}${Z}
3473
3473
  ${$.slice(J)}`}var cG=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function pG($){return cG.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function iG($,Z){if(!$.includes("</body>"))return $;if(pG($))return $;let J=Z?.router,X="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.scrollRestoration!==void 0)K.scrollRestoration=J.scrollRestoration;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let q=await e6(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${$8(K)};</script>
3474
- `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-e4yskgtb.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+`
3474
+ `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-qr3zcm87.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+`
3475
3475
  </body>`+$.slice(z+7)}var Y8=Symbol.for("stx.lazy-module-promises");function nG(){let $=globalThis;return $[Y8]??=new Map,$[Y8]}function s($,Z){let J=nG(),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 u3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,j8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,sG=65536,oG=4,S9=new Map;function UL(){S9.clear()}function rG($){let Z=[];for(let J of y2($,K2)){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 aG($,Z={}){let J=$.length>=sG,X=J?S9.get($):void 0;if(X===void 0){if(X=rG($),J)U8(S9,oG),S9.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 B8($){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}=Q8(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}=Q8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Q8($){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 l3($,Z){return H8($,Z)}function tG($){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 eG($){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 $z($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${u3})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=y2($,(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),K=B8(z?.[1]??z?.[2]??""),q=[K.itemVar,K.indexVar].filter(Boolean);if(q.length===0)continue;let W=G[1],U=/\/\s*>$/.test(Q.token)||P9.has(W.toLowerCase())?Q.end:L8($,Q.start,W,Q.end);if(U!==-1)Y.push({start:Q.start,end:U,vars:new Set(q)})}return Y}var G8=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 Zz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function z8($,Z,J,X){if(!$)return!1;let Y=Zz($),Q=!1,G=!1,z=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(Y))!==null){let j=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(G8.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,H;while((H=W.exec(Y))!==null){let j=H[1];if(Y.slice(0,H.index).trimEnd().endsWith("."))continue;if(G8.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function C9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(j8);if(Q&&Jz(Q[3],Q[1])){let[,G,z,K]=Q;return`<${G}${z}${X}>${K}</${G}>`}return`<template${X}>${Y}</template>`}function Jz($,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 V8($,Z){let J=eG($);function X(Y){let Q=Y,G=$z(Y),z=(H)=>{let U=new Set;for(let j of G)if(H>j.start&&H<j.end)for(let B of j.vars)U.add(B);return U},K=/@if\s*\(/g,q,W=[];while((q=K.exec(Q))!==null){let H=q.index,U=H+q[0].length,j=1,B=U;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(U,B-1).trim(),_=B,O=1,F=_,L=/@(if\s*\(|endif)/g;L.lastIndex=_;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){F=w.index+w[0].length;break}}if(O!==0)continue;let N=Q.substring(_,F-6).trim(),R;if(tG(N)){let M=_2(Q.substring(H,F));if(M.length===0)continue;let T=M[0].branches.filter((A)=>A.type!=="else"),D=z(H);if(!(T.length>0&&T.every((A)=>z8(A.condition,J,Z,D))))continue;R=M[0].branches.map((A)=>{let E=X(A.content);if(A.type==="elseif")return C9(E,"@else-if",A.condition??"");if(A.type==="else")return C9(E,"@else");return C9(E,"@if",A.condition??"")}).join(`
3476
3476
  `)}else{if(!z8(V,J,Z,z(H)))continue;R=C9(X(N),"@if",V)}W.push({start:H,end:F,replacement:R}),K.lastIndex=F}for(let H=W.length-1;H>=0;H--){let{start:U,end:j,replacement:B}=W[H];Q=Q.substring(0,U)+B+Q.substring(j)}return Q}return X($)}function Xz($){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 P9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),K8=/<(script|style)\b/iy,Yz=/<\/script/gi,Qz=/<\/style/gi;function L8($,Z,J,X){if(P9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let K=$.indexOf("<",z);if(K===-1)return-1;if(z=K,$.startsWith("<!--",z)){let U=$.indexOf("-->",z+4);if(U===-1)return-1;z=U+3;continue}K8.lastIndex=z;let q=K8.exec($);if(q){let U=$.indexOf(">",z);if(U===-1)return-1;if($[U-1]==="/"){z=U+1;continue}let j=q[1].toLowerCase()==="script"?Yz:Qz;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 U=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!U){z++;continue}if(U[1].toLowerCase()===Y){if(G--,z+=U[0].length,G===0)return z;continue}z+=U[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!W){z++;continue}let H=$.indexOf(">",z);if(H===-1)return-1;if(W[1].toLowerCase()===Y){let U=$.slice(z,H+1);if(!(/\/\s*>$/.test(U)||P9.has(Y)))G++}z=H+1}return-1}var Gz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function zz($,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 Gz.test(Q)}function O8($){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=(H)=>Z.some(([U,j])=>H>=U&&H<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[H,U,j,B,V,_,O]=z,F=Xz(V);if(F===void 0)continue;let L=z.index,w=L+H.length,M=!!O||/\/\s*>$/.test(H)||P9.has(U.toLowerCase())?w:L8($,L,U,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&zz($,M)){Q.lastIndex=w;continue}if(F===!0){let D=`<${U}${j}${_}${O}>`;G.push({start:L,end:w,replacement:D});continue}G.push({start:L,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((H,U)=>H.start-U.start);let K=[],q=-1;for(let H of G){if(H.start<q)continue;K.push(H),q=H.end}let W=$;for(let H=K.length-1;H>=0;H--){let{start:U,end:j,replacement:B}=K[H];W=W.substring(0,U)+B+W.substring(j)}return W}function c3($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],K=Y.index,q=K+Y[0].length,W=1,H=q;while(H<J.length&&W>0){if(J[H]==="(")W++;else if(J[H]===")")W--;H++}if(W!==0)continue;let U=J.substring(q,H-1).trim(),j=H,B=B8(U),V=z==="for"?"@endfor":"@endforeach",_=1,O=j,F=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");F.lastIndex=j;let L;while((L=F.exec(J))!==null)if(L[1].startsWith(z))_++;else if(_--,_===0){O=L.index+L[0].length;break}if(_!==0)continue;let w=()=>{let I=[B.itemVar,B.indexVar].filter(Boolean);if(I.length)G.push({start:K,end:O,vars:I})};if(B.iterable){let I=B.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){w();continue}let k=I.split(/[.[(]/)[0].trim(),A=Z?k in Z:!1,E=G.some((C)=>K>C.start&&K<C.end&&C.vars.includes(k));if(k&&(A||E)){w();continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let N=J.substring(j,O-V.length).trim(),R=Z?{...Z}:{};if(B.itemVar)delete R[B.itemVar];if(B.indexVar)delete R[B.indexVar];let M=c3(N,R),T=M.match(j8),D;if(T){let[,I,k,A]=T;D=`<${I}${k} @for="${U}">${A}</${I}>`}else D=`<template @for="${U}">${M}</template>`;Q.push({start:K,end:O,replacement:D}),X.lastIndex=O}for(let z=Q.length-1;z>=0;z--){let{start:K,end:q,replacement:W}=Q[z];J=J.substring(0,K)+W+J.substring(q)}return J}function Kz($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(W)=>{let H=X+1;while(H<Q){let U=$[H];if(U==="\\"){H+=2;continue}if(U===W)return H+1;H++}return Q},z=()=>{let W=X+2;while(W<Q&&$[W]!==`
3477
3477
  `)W++;return W},K=()=>{let W=X+2;while(W<Q-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Q},q=(W)=>{let H=W,U=0;while(H<Q){let j=$[H];if(j==="/"&&$[H+1]==="/"){let B=H+2;while(B<Q&&$[B]!==`
3478
- `)B++;H=B;continue}if(j==="/"&&$[H+1]==="*"){let B=H+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;H=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=H+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}H=B;continue}if(j==="("||j==="["||j==="{"){U++,H++;continue}if(j===")"||j==="]"||j==="}"){U--,H++;continue}if(j===";"&&U===0)return H+1;H++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let H=z();J.push($.slice(X,H)),X=H;continue}if(W==="/"&&$[X+1]==="*"){let H=K();J.push($.slice(X,H)),X=H;continue}if(W==='"'||W==="'"||W==="`"){let H=G(W);J.push($.slice(X,H)),X=H;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let H=X>0?$[X-1]:"";if(H===""||/\s/.test(H)||H===";"||H==="}"||H==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(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 qz=new Set(["script","style","html","head","meta","link","title","!doctype"]);function m3($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function Wz($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!m3(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function Hz($,Z){if(Wz($,"<body",Z)){let Y=new RegExp(`<body(${u3})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!m3(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(${u3})>`,"gi"),X;while((X=J.exec($))!==null){if(m3(X.index,X.index+X[0].length,Z))continue;if(qz.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Uz($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function jz($,Z,J){let X=aG($,{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 s("stx/client-script-bundler",()=>import("./chunk-tscr6bs8.js"));for(let F of X){let L=F.body;if(I1(F.attrs))L=T1(L);if(Y.test(L)){Q.push({content:L,start:F.start,end:F.end});continue}if(!G(L))continue;try{let w=await z($2(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:F.start,end:F.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((F)=>F.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,W=[];for(let F=0;F<Q.length;F++){let L=Q[F].bundled??$2(Q[F].content).code;if(!Q[F].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=Oz(L);let w=a0(L);W.push(`// \u2500\u2500 merged signal script #${F+1} \u2500\u2500
3478
+ `)B++;H=B;continue}if(j==="/"&&$[H+1]==="*"){let B=H+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;H=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=H+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}H=B;continue}if(j==="("||j==="["||j==="{"){U++,H++;continue}if(j===")"||j==="]"||j==="}"){U--,H++;continue}if(j===";"&&U===0)return H+1;H++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let H=z();J.push($.slice(X,H)),X=H;continue}if(W==="/"&&$[X+1]==="*"){let H=K();J.push($.slice(X,H)),X=H;continue}if(W==='"'||W==="'"||W==="`"){let H=G(W);J.push($.slice(X,H)),X=H;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let H=X>0?$[X-1]:"";if(H===""||/\s/.test(H)||H===";"||H==="}"||H==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(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 qz=new Set(["script","style","html","head","meta","link","title","!doctype"]);function m3($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function Wz($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!m3(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function Hz($,Z){if(Wz($,"<body",Z)){let Y=new RegExp(`<body(${u3})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!m3(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(${u3})>`,"gi"),X;while((X=J.exec($))!==null){if(m3(X.index,X.index+X[0].length,Z))continue;if(qz.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Uz($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function jz($,Z,J){let X=aG($,{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 s("stx/client-script-bundler",()=>import("./chunk-7g5vk4c3.js"));for(let F of X){let L=F.body;if(I1(F.attrs))L=T1(L);if(Y.test(L)){Q.push({content:L,start:F.start,end:F.end});continue}if(!G(L))continue;try{let w=await z($2(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:F.start,end:F.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((F)=>F.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,W=[];for(let F=0;F<Q.length;F++){let L=Q[F].bundled??$2(Q[F].content).code;if(!Q[F].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=Oz(L);let w=a0(L);W.push(`// \u2500\u2500 merged signal script #${F+1} \u2500\u2500
3479
3479
  ${w}`)}let H=W.join(`
3480
3480
 
3481
3481
  `);H=Kz(H);let U=Bz(H),j=U.split(",").map((F)=>F.trim()).filter(Boolean),B=d3(H,J),V=`
@@ -3510,13 +3510,13 @@ ${K.join(`
3510
3510
  Tip: prefer useRef(), navigate(), and composables for component code`;if(s3.set(Q,U),Y.failOnViolation)throw Error(U);else console.warn(U)}bz();import r3 from"path";var Tz=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,kz=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Ez($,Z){if(!Z||!$.includes("/"))return $;let J=r3.dirname(Z);return $.replace(Tz,(X,Y,Q,G)=>{let z=r3.resolve(J,G);return`${Y}${Q}${z.split(r3.sep).join("/")}${Q}`})}function C8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(kz,(J,X,Y,Q)=>`${X}${Ez(Y,Z)}${Q}`)}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";function S8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Cz($,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(`
3511
3511
  `,X+2),X===-1)return-1;X+=1,Y=!0;continue}if(z==="/"&&$[X+1]==="*"){let K=$.indexOf("*/",X+2);if(K===-1)return-1;X=K+2,Y=!0;continue}if(z==="/"&&Y){let K=X+1,q=!1;while(K<J){let W=$[K];if(W==="\\"){K+=2;continue}if(W==="[")q=!0;else if(W==="]")q=!1;else if(W==="/"&&!q){K++;break}else if(W===`
3512
3512
  `){K=-1;break}K++}if(K===-1){X++,Y=!1;continue}while(K<J&&/[a-z]/.test($[K]))K++;X=K,Y=!1;continue}if(z==="'"||z==='"'){let K=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===K){X++;break}if($[X]===`
3513
- `)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 t8($,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}}async function P8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await s("stx/client-module-registry",()=>import("./chunk-7kcfbc0j.js")),Y=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Y)return null;if(Z.buildMode==="serve"){let{registerServeModuleBundle:Q}=await import("./chunk-e4yskgtb.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${Q(Y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function Sz($,Z=""){let J=t8($,"data-stx-runtime");if(!J)return $;let X=W2($);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+`
3513
+ `)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 t8($,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}}async function P8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await s("stx/client-module-registry",()=>import("./chunk-72yrrggn.js")),Y=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Y)return null;if(Z.buildMode==="serve"){let{registerServeModuleBundle:Q}=await import("./chunk-qr3zcm87.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${Q(Y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function Sz($,Z=""){let J=t8($,"data-stx-runtime");if(!J)return $;let X=W2($);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+`
3514
3514
  `+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=W2(Q);if(G===-1)return Y+Z+`
3515
3515
  `+Q;return Q.slice(0,G)+Y+Z+`
3516
3516
  `+Q.slice(G)}async function t3($,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;C3(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await g9(Z,J,X.runtimeConfig);if(Q)w$(Z),Z.__stx_head_injections=T3(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!N9()&&!D9())&&J&&J.endsWith(".stx"))n8($,J);try{return await l8.timeAsync("template-processing",async()=>{let G=await Pz($,Z,J,X,Y);if(Q)G=n3(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},q=(Z.__stx_runtime_head||null)??i8(),W=(Z.__stx_head_raw||"").trim(),H,U=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)H=U[1].trim(),W=W.replace(U[0],"").trim();let j=Z.__sections?.title,B=q.title||H||j,V=!q.title&&(!!H||!!j),_=q.meta||[],O=new Set(_.map((M)=>t1(M)).filter(Boolean)),F={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((M)=>!O.has(t1(M))),..._],link:[...z.link||[],...q.link||[]],script:[...z.script||[],...q.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
3517
3517
  `),...q.htmlAttrs&&{htmlAttrs:p6(z.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...q.bodyAttrs}}},L=f3(G);if(G=s6(G,F,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=n6(G,z),G=i6(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],T=m8(M);G=G.replace(/<head\b[^>]*>/i,(D)=>`${D}
3518
3518
  <meta name="stx-layout" content="${S8(M)}">
3519
- <meta name="stx-layout-group" content="${S8(T)}">`)}let N=G.match(/function (__stx_setup_\w+)\(/),R=N?p0(G):null;if(N&&R&&!/\bdata-stx=/.test(R.tag)){G=v1(G,(T,D)=>`<body${D} data-stx="${N[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${N[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??T3(),K=v3(G);if(K!==null)z.beforeClose.push(K);let q=y3(G);if(q!==null)z.afterOpen.push(q);G=y6(G,z);let W=X.app?.colorMode;if(W)G=P6(G,W)}if(Q)if(t8(G,"data-stx-runtime")){let K=null,q=null,W=null,H=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-9p5gbhwp.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await P8([G,q],X);try{let{getFrameworkComposableScript:j}=await s("stx/framework-composables",()=>import("./chunk-3n8avn17.js"));H=await j(G)}catch{}try{let{getComposableScript:j}=await s("stx/composable-loader",()=>import("./chunk-a29x23g7.js")),B=X.composablesDir,V=[K,q,H].filter((O)=>O!==null),_=await j(X._layerComposableDirs??B,G,V);if(_)W=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${_}</script>`}catch{}let U=[K,q,W,H].filter((j)=>j!==null).map((j)=>`
3519
+ <meta name="stx-layout-group" content="${S8(T)}">`)}let N=G.match(/function (__stx_setup_\w+)\(/),R=N?p0(G):null;if(N&&R&&!/\bdata-stx=/.test(R.tag)){G=v1(G,(T,D)=>`<body${D} data-stx="${N[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${N[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let z=Z.__stx_head_injections??T3(),K=v3(G);if(K!==null)z.beforeClose.push(K);let q=y3(G);if(q!==null)z.afterOpen.push(q);G=y6(G,z);let W=X.app?.colorMode;if(W)G=P6(G,W)}if(Q)if(t8(G,"data-stx-runtime")){let K=null,q=null,W=null,H=null;try{let{getStoreScript:j}=await s("stx/store-loader",()=>import("./chunk-eqzc88et.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await P8([G,q],X);try{let{getFrameworkComposableScript:j}=await s("stx/framework-composables",()=>import("./chunk-6wmjwbq9.js"));H=await j(G)}catch{}try{let{getComposableScript:j}=await s("stx/composable-loader",()=>import("./chunk-zwr4bn6a.js")),B=X.composablesDir,V=[K,q,H].filter((O)=>O!==null),_=await j(X._layerComposableDirs??B,G,V);if(_)W=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${_}</script>`}catch{}let U=[K,q,W,H].filter((j)=>j!==null).map((j)=>`
3520
3520
  ${j}`).join("");G=Sz(G,U)}else{let K=await P8([G],X);if(K){let q=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(q!==-1)G=G.slice(0,q)+K+`
3521
3521
  `+G.slice(q)}}if(Q)G=v6(G);if(Q&&Z.__stx_inject_css!==!1)G=await p8(G,void 0,X.buildMode==="serve",!0);else if(Q)G=c8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=d8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=u6(Z);if(z){let K=/<head\b[^>]*>/i.exec(G),q=K?K.index+K[0].length:0;G=G.slice(0,q)+z+G.slice(q)}}return G})}catch(G){if(G instanceof x8)throw G;let z=G instanceof Error?G.message:String(G),K=new C2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(n0.log(K,{filePath:J,context:Z}),g8.logDetailedError(K,{filePath:J,template:$.substring(0,500)}),X.debug)throw K;return f8.createFallbackContent("Template Processing",K)}}async function Pz($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!y0.isAbsolute(X.partialsDir)?y0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!y0.isAbsolute(X.componentsDir)?y0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!y0.isAbsolute(X.layoutsDir)?y0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,K=$;await fz(J,Z),xz(Z,z),K=await S2(()=>w6(K,Z,J,z),K,(L)=>{n0.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=B1(K,R9,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);K=q.output;let W=q.tokens,H=(L)=>W.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,N)=>W[Number(N)]??""),U="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,U),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),K=A6(K),K=await D8(K,J,Y);let j={};K=R3(K,j);let B={...Z.__sections||{}},V="",_=X7(J7($)),O=/@nolayout\b/.test(K)||_===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let F=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)V=F[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof _==="string"){if(V=_,!/@section\s*\(/.test(K))K=`@section('content')
3522
3522
  ${K.trim()}
@@ -3525,7 +3525,7 @@ ${K.trim()}
3525
3525
  @endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,N)=>{return B[w]=N,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,N)=>{if(/^(['"]).*\1$/.test(N.trim()))return L;try{let R=Y0(N.trim(),Z);if(R===void 0)return L;return B[w]=String(R??""),""}catch{return L}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,N)=>{if(N.includes("@parent"))B[w]=N.replace("@parent",C1);else B[w]=N.trim();return""}),Z.__sections=B,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,N)=>{return B[w]||N||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(K=N3(K,j),V){let L=[],w=u0(K),N=B1(w.output,n2,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(K=N.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let D=M==="SCRIPT"?gz(w.scripts[Number(T)],J):N.tokens[Number(T)];if(D)L.push(D);return""}),L.length>0){let R=L.join(`
3526
3526
  `);B.content=B.content?`${B.content}
3527
3527
  ${R}`:R,Z.__sections=B}}if(V)try{let L;if(y0.isAbsolute(V))L=V,Y.add(V);else L=await S2(()=>$9(V,J,G,Y),null,()=>{throw new C2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let D=(A)=>{if(!A)return[];try{let E=y0.isAbsolute(A)?A:y0.resolve(process.cwd(),A);return yz.readdirSync(E).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,""))}catch{return[]}},I=[...D(G.layoutsDir),...D(G.fallbackLayoutsDir)].filter((A,E,C)=>C.indexOf(A)===E).sort(),k=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(n0.log(Error(k),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${k}`),G.debug)throw new C2(k,J);return K}let w=await S2(()=>Bun.file(L).text(),"",()=>{throw new C2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=C8(w,L);let N=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(N){if(G.debug)console.log(`Found nested layout: ${N[1]} in ${L}`);let D={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,C,y)=>{return D[C]=y.trim(),""});for(let[E,C]of Object.entries(D))if(B[E]&&B[E].includes(C1)){let y=B[E].indexOf(C1);B[E]=B[E].slice(0,y)+C+B[E].slice(y+C1.length)}else if(!B[E])B[E]=C;let k={...Z,__sections:B},A=`@layout('${N[1]}')${I}`;return await t3(A,k,L,G,Y)}let R=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=R3(R,j),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,I,k)=>{return T[I]=k.trim(),`@slot('${I}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(D,I,k)=>{if(B[I]){let A=B[I];if(A.includes(C1)){let E=T[I]||"",C=A.indexOf(C1);A=A.slice(0,C)+E+A.slice(C+C1.length)}return A}return k||""}),M=vz(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=N3(M,j),Z.__originalFilePath=J,K=await v8(M,Z,L,G,Y),K=`<!-- stx-layout: ${V} -->
3528
- ${K}`,H(K)}catch(L){return n0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return H(await v8(K,Z,J,G,Y))}function vz($,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 xz($,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 fz($,Z){await S2(()=>D6($,Z),void 0,(J)=>{n0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var a3="data-stx-source";function gz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(a3))return $;return`<script ${a3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function hz($){let Z=new RegExp(`${a3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}async function uz($,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 K=hz(Q)??J;try{let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-jzfk5ect.js"));await q(G,Z,K,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));n0.log(W,{filePath:K,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${K}: ${W.message}`)}}}async function mz($,Z,J){try{let{interpolateScriptsInTemplate:X}=await s("stx/expressions",()=>import("./chunk-hsbbfp0c.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return n0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function v8($,Z,J,X,Y){let Q=$,G=X;if(await uz(Q,Z,J),Q=await mz(Q,Z,J),Q=await Q6(Q,Z,J),Q=await G6(Q,Z,J),Q=await K4(Q,Z,J,G),X1(Q))Q=V8(Q,Z),Q=c3(Q,Z);Q=O8(Q);let{processStreamDirectives:z}=await s("stx/streaming",()=>import("./chunk-39qy76ek.js"));Q=z(Q,Z),Q=V6(Q,Z,J,G,!0),Q=await E6(Q,Z,J,G,Y),Q=await O3(Q,Z,J,G,Y),Q=Z7(Q,Z,J,G);let{processDeferDirectives:K}=await s("stx/defer",()=>import("./chunk-86q2h34b.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await s("stx/teleport",()=>import("./chunk-1vt1h19d.js"));Q=q(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:H}=await s("stx/transitions",()=>import("./chunk-w5j9tbsk.js"));Q=W(Q,Z,J),Q=H(Q);let{processErrorBoundaryDirectives:U}=await s("stx/error-boundaries",()=>import("./chunk-mph46gkj.js"));Q=U(Q,Z,J);let{processSuspenseDirectives:j}=await s("stx/suspense",()=>import("./chunk-m2j5skez.js"));Q=j(Q,Z,J);let{processAsyncDirectives:B}=await s("stx/async-components",()=>import("./chunk-ppzz953j.js"));Q=B(Q,Z,J);let{processKeepAliveDirectives:V}=await s("stx/keep-alive",()=>import("./chunk-1c9453w0.js"));Q=V(Q,Z,J);let{processVirtualListDirectives:_,processVirtualGridDirectives:O,processInfiniteListDirectives:F}=await s("stx/virtual-scrolling",()=>import("./chunk-dsztk2kp.js"));Q=_(Q,Z,J),Q=O(Q,Z,J),Q=F(Q,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await s("stx/partial-hydration",()=>import("./chunk-v6e35j4g.js"));Q=L(Q,Z,J),Q=w(Q);let{processComputedDirectives:N,processWatchDirectives:R}=await s("stx/computed",()=>import("./chunk-99b5tfxc.js"));Q=N(Q,Z,J),Q=R(Q,Z,J);let{processFormValidationDirectives:M}=await s("stx/forms-validation",()=>import("./chunk-evfr2zgg.js"));Q=M(Q,Z,J);let{processHeadDirective:T,processTitleDirective:D,processMetaDirective:I,resetHead:k}=await s("stx/head",()=>import("./chunk-at622hg0.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let A=T(Q);if(Q=A.content,A.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${A.headContent}
3528
+ ${K}`,H(K)}catch(L){return n0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return H(await v8(K,Z,J,G,Y))}function vz($,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 xz($,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 fz($,Z){await S2(()=>D6($,Z),void 0,(J)=>{n0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var a3="data-stx-source";function gz($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(a3))return $;return`<script ${a3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function hz($){let Z=new RegExp(`${a3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}async function uz($,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 K=hz(Q)??J;try{let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-h1vax4wg.js"));await q(G,Z,K,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));n0.log(W,{filePath:K,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${K}: ${W.message}`)}}}async function mz($,Z,J){try{let{interpolateScriptsInTemplate:X}=await s("stx/expressions",()=>import("./chunk-fp868yhg.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return n0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function v8($,Z,J,X,Y){let Q=$,G=X;if(await uz(Q,Z,J),Q=await mz(Q,Z,J),Q=await Q6(Q,Z,J),Q=await G6(Q,Z,J),Q=await K4(Q,Z,J,G),X1(Q))Q=V8(Q,Z),Q=c3(Q,Z);Q=O8(Q);let{processStreamDirectives:z}=await s("stx/streaming",()=>import("./chunk-b5mnam29.js"));Q=z(Q,Z),Q=V6(Q,Z,J,G,!0),Q=await E6(Q,Z,J,G,Y),Q=await O3(Q,Z,J,G,Y),Q=Z7(Q,Z,J,G);let{processDeferDirectives:K}=await s("stx/defer",()=>import("./chunk-86q2h34b.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await s("stx/teleport",()=>import("./chunk-1vt1h19d.js"));Q=q(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:H}=await s("stx/transitions",()=>import("./chunk-w5j9tbsk.js"));Q=W(Q,Z,J),Q=H(Q);let{processErrorBoundaryDirectives:U}=await s("stx/error-boundaries",()=>import("./chunk-mph46gkj.js"));Q=U(Q,Z,J);let{processSuspenseDirectives:j}=await s("stx/suspense",()=>import("./chunk-m2j5skez.js"));Q=j(Q,Z,J);let{processAsyncDirectives:B}=await s("stx/async-components",()=>import("./chunk-ppzz953j.js"));Q=B(Q,Z,J);let{processKeepAliveDirectives:V}=await s("stx/keep-alive",()=>import("./chunk-1c9453w0.js"));Q=V(Q,Z,J);let{processVirtualListDirectives:_,processVirtualGridDirectives:O,processInfiniteListDirectives:F}=await s("stx/virtual-scrolling",()=>import("./chunk-dsztk2kp.js"));Q=_(Q,Z,J),Q=O(Q,Z,J),Q=F(Q,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await s("stx/partial-hydration",()=>import("./chunk-v6e35j4g.js"));Q=L(Q,Z,J),Q=w(Q);let{processComputedDirectives:N,processWatchDirectives:R}=await s("stx/computed",()=>import("./chunk-99b5tfxc.js"));Q=N(Q,Z,J),Q=R(Q,Z,J);let{processFormValidationDirectives:M}=await s("stx/forms-validation",()=>import("./chunk-evfr2zgg.js"));Q=M(Q,Z,J);let{processHeadDirective:T,processTitleDirective:D,processMetaDirective:I,resetHead:k}=await s("stx/head",()=>import("./chunk-at622hg0.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let A=T(Q);if(Q=A.content,A.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${A.headContent}
3529
3529
  `;if(Q=D(Q,Z),Q=I(Q,Z,J),Q=N6(Q),Q=f5(Q,Z),Q=Q4(Q),Q=_6(Q),Q=await w3(Q,Z,J,G,Y),Q=await O3(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=R$(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=n3(Q),Q=r0(Q,Z,J),Q=M3(Q),Q=Q7(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=g5(Q,Z),Q=h5(Q,Z),Q=R2(Q,Z),Q=i5(Q,Z),Q=n5(Q,Z),Q=await n7(Q,Z,J,G),Q=await U7(Q,Z,J),Q=await h8(Q,Z,J,G),Q=u8(Q,Z,J,G),Q=s8(Q,Z,J,G),Q=o8(Q,Z,J),Q=r8(Q,Z,J,G),Q=X4(Q,Z,J,G),Q=p3(Q,Z),Q=i3(Q),Q=I8(Q),!G.skipEventDirectives)Q=_$(Q,Z,J);if(Q=K7(Q,Z,J),G.debug){let l=/\bx-data\s*=/.test(Q),u=l3($);if(l&&u)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3530
3530
  Both work on the same page, but they manage separate scopes.
3531
3531
  Prefer signals (state/derived/effect) for new components.`)}Q=i4(Q,Z),Q=await V1(Q,Z,J),Q=b8(Q),Q=y8(Q),Q=n$(Q);let{processXElementDirectives:E}=await s("stx/x-element",()=>import("./chunk-0k1mtwby.js"));Q=E(Q);let C=Z.__originalFilePath||J,y=v9(Z);if(Q=await _8(Q,G,C,y),Q=U4(Q,Z),Q=await R6(Q,Z,J,G),G.media?.image?.autoSiblings){let l=G.publicDir||"public",{rewriteImagesWithSiblings:u}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-kq30wqp6.js"));Q=await u(Q,{publicDir:l})}if(G.seo?.enabled)Q=a8(Q,Z,G);let b=(l,u,o=!0)=>{if(!u)return l;let Q0=u.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),B0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Q0&&B0){if(o)l=l.replace(B0[0],Q0[0]);if(u=u.replace(Q0[0],"").trim(),!u)return l}if(/<\/head>/i.test(l))return l.replace(/<\/head>/i,`${u}
@@ -3539,7 +3539,7 @@ ${c$()}
3539
3539
  `+c0}else Q=Q.replace("</head>",`${u}
3540
3540
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3541
3541
  ${u}`);else Q=u+`
3542
- `+Q}{let{scanScriptTags:l}=await s("stx/signal-processing",()=>import("./chunk-8tjg4wbr.js")),u=[];for(let o of l(Q)){if(!/\bserver\b/i.test(o.attrs))continue;let Q0=o.start+o.fullMatch.indexOf(">")+1,B0=Cz(Q,Q0);if(B0===-1)continue;let K0=B0+9;while(K0<Q.length&&/\s/.test(Q[K0]))K0++;u.push({start:o.start,end:K0})}if(u.length>0){let o=Array(u.length+1),Q0=0;for(let B0=0;B0<u.length;B0++){let{start:K0,end:c0}=u[B0];o[B0]=Q.slice(Q0,K0),Q0=c0}o[u.length]=Q.slice(Q0),Q=o.join("")}}let i=f9(Q,J);if(i.hasScoped)Q=i.html;let q0=Z.__stx_event_bindings||[],r=!1,L0=[],e0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:$1}=await s("stx/signal-processing",()=>import("./chunk-8tjg4wbr.js"));for(let l of $1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))L0.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:u,content:o}of L0){r=!0;let Q0=o;o3(o,J,X.strict,Z.__originalFilePath);let B0=await x9(o,{eventBindings:q0,attrs:u,hasColonDirectives:e0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:y});Q=Q.replace(l,()=>B0)}if(r)Z.__stx_event_bindings=[];if(!r&&Z.__stxProcessingDepth===1){let l=Z.__stx_event_bindings||[];if(l.length>0){let u=t9(l);if(u){let o=Q.lastIndexOf("</body>");Q=o===-1?Q+u:Q.slice(0,o)+u+`
3542
+ `+Q}{let{scanScriptTags:l}=await s("stx/signal-processing",()=>import("./chunk-3zm4hgcf.js")),u=[];for(let o of l(Q)){if(!/\bserver\b/i.test(o.attrs))continue;let Q0=o.start+o.fullMatch.indexOf(">")+1,B0=Cz(Q,Q0);if(B0===-1)continue;let K0=B0+9;while(K0<Q.length&&/\s/.test(Q[K0]))K0++;u.push({start:o.start,end:K0})}if(u.length>0){let o=Array(u.length+1),Q0=0;for(let B0=0;B0<u.length;B0++){let{start:K0,end:c0}=u[B0];o[B0]=Q.slice(Q0,K0),Q0=c0}o[u.length]=Q.slice(Q0),Q=o.join("")}}let i=f9(Q,J);if(i.hasScoped)Q=i.html;let q0=Z.__stx_event_bindings||[],r=!1,L0=[],e0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:$1}=await s("stx/signal-processing",()=>import("./chunk-3zm4hgcf.js"));for(let l of $1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))L0.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:u,content:o}of L0){r=!0;let Q0=o;o3(o,J,X.strict,Z.__originalFilePath);let B0=await x9(o,{eventBindings:q0,attrs:u,hasColonDirectives:e0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:y});Q=Q.replace(l,()=>B0)}if(r)Z.__stx_event_bindings=[];if(!r&&Z.__stxProcessingDepth===1){let l=Z.__stx_event_bindings||[];if(l.length>0){let u=t9(l);if(u){let o=Q.lastIndexOf("</body>");Q=o===-1?Q+u:Q.slice(0,o)+u+`
3543
3543
  `+Q.slice(o)}Z.__stx_event_bindings=[]}}if(!Z8(Q)&&J8(Q))Q=await y9(Q,G);if(Q=X8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=J4(Q,Z.cspNonce);return Q}import UZ from"path";import $$ from"fs";import P2 from"path";function e8($,Z,J,X){let Y=0;for(let Q=Z;Q<$.length;Q++)if($[Q]===J)Y++;else if($[Q]===X&&!(X===">"&&$[Q-1]==="=")){if(--Y===0)return Q}return-1}function dz($){let Z=H0($),J=0,X=0,Y=[];for(let Q=0;Q<Z.length;Q++)if("([{".includes(Z[Q]))J++;else if(")]}".includes(Z[Q]))J--;else if(Z[Q]===","&&J===0)Y.push($.slice(X,Q).trim()),X=Q+1;return Y.push($.slice(X).trim()),Y}function e3($,Z){let J=H0($),X=new RegExp(`\\b(?:${Z.map((Y)=>Y.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Y of J.matchAll(X)){let Q=Y.index+Y[0].length,G="";if(J[Q]==="<"){let K=e8(J,Q,"<",">");if(K<0)continue;G=$.slice(Q+1,K),Q=K+1;while(/\s/.test(J[Q]||"")&&Q<J.length)Q++}if(J[Q]!=="(")continue;let z=e8(J,Q,"(",")");if(z>=0)return{type:G,args:dz($.slice(Q+1,z))}}return null}var $Z=`
3544
3544
  type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
3545
3545
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
@@ -3604,8 +3604,8 @@ ${G}`,Y++}return{functionCode:X,nextIndex:Y}}function AZ($,Z){let J=Y0($,Z)??Y0(
3604
3604
  `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let _=V.trim().split(":");return _[_.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 H=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let B=H[2];if(!J.has(B))Z.push(B),J.add(B);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[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(K())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])))q();Y++}return Z}function nK($){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 sK($){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 oK($,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 K=$[X];if(K==="}")Q++;else if(K==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let K of nK(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let W=sK(q);if(W===-1)continue;let H=q.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(H))continue;if(Z[H]!==void 0)continue;let U=q.slice(W+1).trim();if(!U)continue;try{let j=Object.keys(Z).filter(Y2),B=Function(...j,`"use strict"; return (${U});`);Z[H]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}var rK=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function aK($,Z){let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!J)return null;let X=J[2].toLowerCase();if(!rK.has(X))return null;if(($.match(new RegExp(`<${X}(?=[\\s/>])`,"gi"))??[]).length!==1)return null;if(!new RegExp(`</${X}>\\s*$`,"i").test($))return null;let Q=J[0].length;return $.slice(0,Q)+Z+$.slice(Q)}async function F9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),z=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=J.__importedComponents;if(K){for(let O of[Q,Q.toLowerCase(),G(Q),z(Q)])if(K.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],W=typeof Y.root==="string"?f.resolve(Y.root):void 0,H=W??f.dirname(X),U=[],j=(O)=>{if(O&&!U.includes(O))U.push(O)},B=J.__originalFilePath;if(B)j(f.join(f.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(f.join(f.dirname(X),"components")),j(Y.componentsDir),W)j(f.resolve(W,"resources/views/components")),j(f.resolve(W,"resources/components")),j(f.resolve(W,"src/components")),j(f.resolve(W,"components"));for(let O of Y._layerComponentDirs??[])j(O);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let O of V)j(typeof O==="string"?O:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(f.resolve(f.dirname(X),`${Q}.stx`));let _=mZ(f.resolve(import.meta.dir,"components"));for(let O of U){let F=f.isAbsolute(O)?O:f.resolve(H,O);if(mZ(F)===_)continue;for(let L of q)if(await t(f.join(F,L)))return!0}return!1}function mZ($){try{return sZ.realpathSync($)}catch{return $}}function tK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function eK($){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 $q($,Z,J){if(!$.includes("{{")&&!$.includes("{!!"))return $;let X=(Y,Q)=>{let G;try{G=C0(Y,Z)}catch{return Q}if(G===void 0||G===null)return"";let z=String(G);if(/<\/style/i.test(z))return console.warn(`[stx] a <style> expression in ${J??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return z};return $.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>X(Q,Y)).replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>X(Q,Y))}var dZ=new Set;function lZ($,Z,J,X){let Y=`${$}\x00${Z}\x00${X??""}`;if(!process.env.STX_DEBUG&&dZ.has(Y))return;dZ.add(Y);let Q=Z?` used in ${Z}`:"",G=X?` Cause: ${X}.`:"",z=J.length>0?`
3605
3605
  searched:
3606
3606
  ${J.map((K)=>` - ${K}`).join(`
3607
- `)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function cZ($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Zq($){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 A1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-jzfk5ect.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let H=new Set(W);H.add($);let U=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=U&&U!=="load"&&tK(U)?U:"";try{let B=(m)=>m.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),V=(m)=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Y.__importedComponents;if(F){let m=[_,_.toLowerCase(),B(_),V(_)];for(let c of m)if(F.has(c)){O=F.get(c);break}}let L=[];if(!O){let m=[`${_}.stx`,`${B(_)}.stx`,`${V(_)}.stx`],c=[...new Set(m)],G0=Y.__originalFilePath,n=[];if(n.push(...G._layerComponentDirs??[]),G0){let I0=f.join(f.dirname(G0),"components");n.push(I0)}if(X)n.push(X);let R0=G._rootComponentsDir;if(typeof R0==="string"&&!n.includes(R0))n.push(R0);let O0=f.join(f.dirname(Q),"components");if(!n.includes(O0))n.push(O0);if(G.componentsDir&&G.componentsDir!==X&&!n.includes(G.componentsDir))n.push(G.componentsDir);let b0=typeof G.root==="string"?f.resolve(G.root):void 0,J1=b0??f.dirname(Q),v0=[];if(b0)v0.push(f.resolve(b0,"resources/views/components")),v0.push(f.resolve(b0,"resources/components")),v0.push(f.resolve(b0,"src/components")),v0.push(f.resolve(b0,"components"));v0.push(f.resolve(import.meta.dir,"components"));for(let I0 of v0)if(!n.includes(I0))n.push(I0);let a=G._pluginComponentDirs;if(Array.isArray(a)){for(let I0 of a)if(typeof I0==="string"&&!n.includes(I0))n.push(I0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let h0=[...new Set(n.map((I0)=>{if(!I0)return I0;return f.isAbsolute(I0)?I0:f.resolve(J1,I0)}))];n.length=0,n.push(...h0);let j1=`${_}\x00${Q}\x00${h0.join("\x00")}`,n9=l9.get(j1);if(n9)if(await t(n9))O=n9;else l9.delete(j1);if(!O&&(_.startsWith("./")||_.startsWith("../")))O=f.resolve(f.dirname(Q),`${_}.stx`),L.push(O);else if(!O)for(let I0 of n){if(!I0)continue;for(let g2 of c){let h2=f.join(I0,g2);if(L.push(h2),await t(h2)){O=h2;break}}if(O)break;if(!O)try{let g2=await import("fs");if(!g2.statSync(I0,{throwIfNoEntry:!1})?.isDirectory())continue;let GJ=8,s9=[{path:I0,depth:0}];while(s9.length>0&&!O){let u2=s9.pop();if(u2.depth>=GJ)continue;let W$;try{W$=g2.readdirSync(u2.path,{withFileTypes:!0})}catch{continue}for(let m2 of W$){if(!m2.isDirectory())continue;if(m2.name==="node_modules"||m2.name.startsWith("."))continue;let H$=f.join(u2.path,m2.name);for(let zJ of c){let o9=f.join(H$,zJ);if(L.push(o9),await t(o9)){O=o9;break}}if(O)break;s9.push({path:H$,depth:u2.depth+1})}}}catch{}if(O)break}if(O)l9.set(j1,O)}if(!O||!await t(O))return lZ($,Q,L),cZ($);K.add(O);let w;if(x2.has(O))w=x2.get(O);else try{w=await Bun.file(O).text(),x2.set(O,w)}catch(m){let c=m instanceof Error?m.message:String(m);return lZ($,Q,[O],c),cZ($)}let N=new Set(["__originalFilePath","__importedComponents",d2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[m,c]of Object.entries(Y))if(!m.startsWith("__")||N.has(m))R[m]=c;let M=J;if(J.includes("@include")){let{processIncludes:m}=await s("stx/includes",()=>import("./chunk-cmccdayf.js"));M=await m(J,Y,Q,G,K)}let T=u0(M),D=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(m,c)=>{let G0=T.scripts[Number(c)]||"",n=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",R0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),O0=!R0||["module","text/javascript","application/javascript"].includes(R0);if(!/\bserver\b/i.test(n)&&O0)return D.push(G0),"";return G0}),{extractSlotContent:k}=await s("stx/slots",()=>import("./chunk-ewpbxy5m.js")),A=k(I),E={};if(A.defaultSlot?.trim())E.default=A.defaultSlot;for(let[m,c]of A.namedSlots)E[m]=c.content;let C=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},y=`stx_${_.replace(/[^a-zA-Z0-9]/g,"_")}_${++C.n}_${C.key}`,b={...R,$uid:y,...Z,props:Z,slot:I,$slots:E,__processedComponents:H,__sections:{},__stx_signals_gate:X1(w)||eK(J)};oK(w,b);let P=w,h=q9(P);if(h)P=h.content.trim();let p=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(p)],Z0=[],J0=g.some((m)=>/\bserver\b/.test(m[1]||"")&&/\bcache\b/.test(m[1]||"")),e=null,i=null,q0=null,r=0,L0=null;if(dK(G),J0&&G$>0){let m=lK({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((c)=>c.configFile),uid:y});if(m!==null){e=`${O}\x00${H1(w)}\x00${m}`;let c=c9.get(e);if(c){for(let G0 of c.dependencies)K.add(G0);if(M$(Y,c.clientFactories),C.n+=c.uidsConsumed,c.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let n of c.preservedClientExpressions)G0.add(n);Y.__stx_preserved_client_expressions=[...G0]}return c.output}i=new Set(K),q0=N$(Y),r=C.n,L0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let e0=new Set;for(let m of g){let c=m[1]||"",G0=m[2]||"",n=c.includes("server");if(I1(c)&&G0.trim())G0=T1(G0);if(n&&G0){for(let O0 of S1(G0))e0.add(O0);try{await q(G0,b,O)}catch(O0){}}if(!n){let O0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),b0=O0.includes("{{")&&O0.includes("}}"),J1=O0.includes("{!!")&&O0.includes("!!}");if(b0||J1)O0=G5(O0,b,O);let v0=c.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Z0.push(`<script${v0}>${O0}</script>`)}}let l=u0(w).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),u=l?l[1]:"",o=l?l[2]:"",Q0="",B0=u&&/\bscoped\b/i.test(u);if(l)Q0=`<style${u}>${$q(o,b,O)}</style>`;let K0=P;if(K0=K0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)K0=K0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let m=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(K0=K0.replace(m,(G0,n)=>{let R0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(R0)c.push(`<style${R0[1]}>${R0[2]}</style>`);return""}),K0=K0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)Q0=`${Q0}${c.join(`
3608
- `)}`}if(J&&K0.includes("{{ text || slot }}"))K0=K0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:c0}=await s("stx/slots",()=>import("./chunk-ewpbxy5m.js")),{defaultSlot:p9,namedSlots:i9}=A,Q2=Z0.some((m)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(m)),S=(m)=>Q2?T8(m,y):m,v=new Map([...i9].map(([m,c])=>[m,{...c,content:S(c.content)}]));K0=await c0(K0,S(p9),v,b);let d=Zq(Z0),X0=(Array.isArray(b.__stx_client_signal_names)?b.__stx_client_signal_names:[]).filter((m)=>!e0.has(m));if(d.length>0||X0.length>0)b.__stx_client_signal_names=[...new Set([...X0,...d])];else delete b.__stx_client_signal_names;let U0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:Q2||Z0.length===0,defaultLayout:void 0};b.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let w0=await t3(K0,b,O,U0,K),Z1=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let m of w0.matchAll(/\{\{([\s\S]*?)\}\}/g))Z1.add(m[1].trim());if(Z1.size>0)Y.__stx_preserved_client_expressions=[...Z1];let U1=y,P0=w0;if(Q2){let m="";if(Object.keys(Z).length>0)try{m=` data-stx-props="${hZ(JSON.stringify(Z))}"`}catch{}let c=j?` stx-hydrate="${hZ(j)}"`:"",G0=` data-stx-scope="${U1}"${m}${c}`;P0=aK(w0,G0)??`<div${G0}>${w0}</div>`;let n=await Promise.all(Z0.map(async(R0)=>{let O0=R0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!O0)return R0;let[,b0,J1]=O0,{vendorStyleTags:v0,factoryBody:a}=await Yq(J1,O,G.buildMode==="compile"),h0=j?null:e9(Y,a),j1=h0?`window.__stxComponentFactories[${JSON.stringify(h0)}](${JSON.stringify(U1)});`:`(${a})(${JSON.stringify(U1)});`;if(j)return`${v0}<script type="stx/island" data-stx-island="${U1}" data-stx-scoped data-stx-owner="${U1}"${b0}>${j1}</script>`;return`${v0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${U1}"${b0}>${j1}</script>`}));if(P0=P0+`
3607
+ `)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function cZ($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Zq($){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 A1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await s("stx/variable-extractor",()=>import("./chunk-h1vax4wg.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let H=new Set(W);H.add($);let U=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=U&&U!=="load"&&tK(U)?U:"";try{let B=(m)=>m.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),V=(m)=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Y.__importedComponents;if(F){let m=[_,_.toLowerCase(),B(_),V(_)];for(let c of m)if(F.has(c)){O=F.get(c);break}}let L=[];if(!O){let m=[`${_}.stx`,`${B(_)}.stx`,`${V(_)}.stx`],c=[...new Set(m)],G0=Y.__originalFilePath,n=[];if(n.push(...G._layerComponentDirs??[]),G0){let I0=f.join(f.dirname(G0),"components");n.push(I0)}if(X)n.push(X);let R0=G._rootComponentsDir;if(typeof R0==="string"&&!n.includes(R0))n.push(R0);let O0=f.join(f.dirname(Q),"components");if(!n.includes(O0))n.push(O0);if(G.componentsDir&&G.componentsDir!==X&&!n.includes(G.componentsDir))n.push(G.componentsDir);let b0=typeof G.root==="string"?f.resolve(G.root):void 0,J1=b0??f.dirname(Q),v0=[];if(b0)v0.push(f.resolve(b0,"resources/views/components")),v0.push(f.resolve(b0,"resources/components")),v0.push(f.resolve(b0,"src/components")),v0.push(f.resolve(b0,"components"));v0.push(f.resolve(import.meta.dir,"components"));for(let I0 of v0)if(!n.includes(I0))n.push(I0);let a=G._pluginComponentDirs;if(Array.isArray(a)){for(let I0 of a)if(typeof I0==="string"&&!n.includes(I0))n.push(I0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let h0=[...new Set(n.map((I0)=>{if(!I0)return I0;return f.isAbsolute(I0)?I0:f.resolve(J1,I0)}))];n.length=0,n.push(...h0);let j1=`${_}\x00${Q}\x00${h0.join("\x00")}`,n9=l9.get(j1);if(n9)if(await t(n9))O=n9;else l9.delete(j1);if(!O&&(_.startsWith("./")||_.startsWith("../")))O=f.resolve(f.dirname(Q),`${_}.stx`),L.push(O);else if(!O)for(let I0 of n){if(!I0)continue;for(let g2 of c){let h2=f.join(I0,g2);if(L.push(h2),await t(h2)){O=h2;break}}if(O)break;if(!O)try{let g2=await import("fs");if(!g2.statSync(I0,{throwIfNoEntry:!1})?.isDirectory())continue;let GJ=8,s9=[{path:I0,depth:0}];while(s9.length>0&&!O){let u2=s9.pop();if(u2.depth>=GJ)continue;let W$;try{W$=g2.readdirSync(u2.path,{withFileTypes:!0})}catch{continue}for(let m2 of W$){if(!m2.isDirectory())continue;if(m2.name==="node_modules"||m2.name.startsWith("."))continue;let H$=f.join(u2.path,m2.name);for(let zJ of c){let o9=f.join(H$,zJ);if(L.push(o9),await t(o9)){O=o9;break}}if(O)break;s9.push({path:H$,depth:u2.depth+1})}}}catch{}if(O)break}if(O)l9.set(j1,O)}if(!O||!await t(O))return lZ($,Q,L),cZ($);K.add(O);let w;if(x2.has(O))w=x2.get(O);else try{w=await Bun.file(O).text(),x2.set(O,w)}catch(m){let c=m instanceof Error?m.message:String(m);return lZ($,Q,[O],c),cZ($)}let N=new Set(["__originalFilePath","__importedComponents",d2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),R={};for(let[m,c]of Object.entries(Y))if(!m.startsWith("__")||N.has(m))R[m]=c;let M=J;if(J.includes("@include")){let{processIncludes:m}=await s("stx/includes",()=>import("./chunk-xq0e2y4x.js"));M=await m(J,Y,Q,G,K)}let T=u0(M),D=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(m,c)=>{let G0=T.scripts[Number(c)]||"",n=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",R0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),O0=!R0||["module","text/javascript","application/javascript"].includes(R0);if(!/\bserver\b/i.test(n)&&O0)return D.push(G0),"";return G0}),{extractSlotContent:k}=await s("stx/slots",()=>import("./chunk-aapqf6bj.js")),A=k(I),E={};if(A.defaultSlot?.trim())E.default=A.defaultSlot;for(let[m,c]of A.namedSlots)E[m]=c.content;let C=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},y=`stx_${_.replace(/[^a-zA-Z0-9]/g,"_")}_${++C.n}_${C.key}`,b={...R,$uid:y,...Z,props:Z,slot:I,$slots:E,__processedComponents:H,__sections:{},__stx_signals_gate:X1(w)||eK(J)};oK(w,b);let P=w,h=q9(P);if(h)P=h.content.trim();let p=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(p)],Z0=[],J0=g.some((m)=>/\bserver\b/.test(m[1]||"")&&/\bcache\b/.test(m[1]||"")),e=null,i=null,q0=null,r=0,L0=null;if(dK(G),J0&&G$>0){let m=lK({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((c)=>c.configFile),uid:y});if(m!==null){e=`${O}\x00${H1(w)}\x00${m}`;let c=c9.get(e);if(c){for(let G0 of c.dependencies)K.add(G0);if(M$(Y,c.clientFactories),C.n+=c.uidsConsumed,c.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let n of c.preservedClientExpressions)G0.add(n);Y.__stx_preserved_client_expressions=[...G0]}return c.output}i=new Set(K),q0=N$(Y),r=C.n,L0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let e0=new Set;for(let m of g){let c=m[1]||"",G0=m[2]||"",n=c.includes("server");if(I1(c)&&G0.trim())G0=T1(G0);if(n&&G0){for(let O0 of S1(G0))e0.add(O0);try{await q(G0,b,O)}catch(O0){}}if(!n){let O0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),b0=O0.includes("{{")&&O0.includes("}}"),J1=O0.includes("{!!")&&O0.includes("!!}");if(b0||J1)O0=G5(O0,b,O);let v0=c.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Z0.push(`<script${v0}>${O0}</script>`)}}let l=u0(w).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),u=l?l[1]:"",o=l?l[2]:"",Q0="",B0=u&&/\bscoped\b/i.test(u);if(l)Q0=`<style${u}>${$q(o,b,O)}</style>`;let K0=P;if(K0=K0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)K0=K0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let m=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(K0=K0.replace(m,(G0,n)=>{let R0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(R0)c.push(`<style${R0[1]}>${R0[2]}</style>`);return""}),K0=K0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)Q0=`${Q0}${c.join(`
3608
+ `)}`}if(J&&K0.includes("{{ text || slot }}"))K0=K0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:c0}=await s("stx/slots",()=>import("./chunk-aapqf6bj.js")),{defaultSlot:p9,namedSlots:i9}=A,Q2=Z0.some((m)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(m)),S=(m)=>Q2?T8(m,y):m,v=new Map([...i9].map(([m,c])=>[m,{...c,content:S(c.content)}]));K0=await c0(K0,S(p9),v,b);let d=Zq(Z0),X0=(Array.isArray(b.__stx_client_signal_names)?b.__stx_client_signal_names:[]).filter((m)=>!e0.has(m));if(d.length>0||X0.length>0)b.__stx_client_signal_names=[...new Set([...X0,...d])];else delete b.__stx_client_signal_names;let U0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:Q2||Z0.length===0,defaultLayout:void 0};b.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let w0=await t3(K0,b,O,U0,K),Z1=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let m of w0.matchAll(/\{\{([\s\S]*?)\}\}/g))Z1.add(m[1].trim());if(Z1.size>0)Y.__stx_preserved_client_expressions=[...Z1];let U1=y,P0=w0;if(Q2){let m="";if(Object.keys(Z).length>0)try{m=` data-stx-props="${hZ(JSON.stringify(Z))}"`}catch{}let c=j?` stx-hydrate="${hZ(j)}"`:"",G0=` data-stx-scope="${U1}"${m}${c}`;P0=aK(w0,G0)??`<div${G0}>${w0}</div>`;let n=await Promise.all(Z0.map(async(R0)=>{let O0=R0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!O0)return R0;let[,b0,J1]=O0,{vendorStyleTags:v0,factoryBody:a}=await Yq(J1,O,G.buildMode==="compile"),h0=j?null:e9(Y,a),j1=h0?`window.__stxComponentFactories[${JSON.stringify(h0)}](${JSON.stringify(U1)});`:`(${a})(${JSON.stringify(U1)});`;if(j)return`${v0}<script type="stx/island" data-stx-island="${U1}" data-stx-scoped data-stx-owner="${U1}"${b0}>${j1}</script>`;return`${v0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${U1}"${b0}>${j1}</script>`}));if(P0=P0+`
3609
3609
  `+n.join(`
3610
3610
  `),Q0)P0+=`
3611
3611
  `+Q0}else{if(Q0)P0+=`
@@ -3628,7 +3628,7 @@ ${$0.yellow}${$0.bold}Message:${$0.reset} ${Z}
3628
3628
  `,z)W+=`
3629
3629
  ${$0.blue}${$0.bold}Context:${$0.reset}
3630
3630
  ${$0.dim}${z}${$0.reset}
3631
- `;return W}function l_(){x2.clear(),l9.clear(),c9.clear()}function c_(){return{size:x2.size,maxSize:500}}var Q$=y1(128);async function Yq($,Z,J){let X=H1($,Z,J),Y=Q$.get(X);if(Y){if(nZ(Y.deps))return Y;Q$.delete(X)}let Q=K$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=q$(Q.styles);G=$2(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-tscr6bs8.js")),W=[],H=!1;if(K(G)){let O=G;G=await q(O,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),H=G===O}let{stripStxRuntimeImports:U}=await s("stx/signal-processing",()=>import("./chunk-8tjg4wbr.js"));G=U(G);let j=a0(G),B=iK(j),V=`function(__scopeId) {
3631
+ `;return W}function l_(){x2.clear(),l9.clear(),c9.clear()}function c_(){return{size:x2.size,maxSize:500}}var Q$=y1(128);async function Yq($,Z,J){let X=H1($,Z,J),Y=Q$.get(X);if(Y){if(nZ(Y.deps))return Y;Q$.delete(X)}let Q=K$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=q$(Q.styles);G=$2(G).code;let{hasUserImports:K,bundleClientScript:q}=await s("stx/client-script-bundler",()=>import("./chunk-7g5vk4c3.js")),W=[],H=!1;if(K(G)){let O=G;G=await q(O,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),H=G===O}let{stripStxRuntimeImports:U}=await s("stx/signal-processing",()=>import("./chunk-3zm4hgcf.js"));G=U(G);let j=a0(G),B=iK(j),V=`function(__scopeId) {
3632
3632
  ${s1("const",[...pZ,...B],j)}
3633
3633
  const __scope = window.stx._scopes = window.stx._scopes || {};
3634
3634
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -3727,7 +3727,7 @@ else {
3727
3727
  // STX: auto-generated event bindings
3728
3728
  ${$.map((J,X)=>Rq(J,X)).join(`
3729
3729
  `)}`}function eZ($){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 K=z;if(G++,K==="`"){let q=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&q===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(X[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===K){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
3730
- `)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 K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=q[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((U)=>{let j=U.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 H=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(H){let U=H[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=H[0].length;continue}}G++}return Z}var Dq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Mq($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!Dq.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 K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let H=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=H.exec($))!==null)X(Q[1]);return Z}async function x9($,Z={}){let J=$,X="",Y=!1,Q=[],G=K$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=q$(G.styles),K=$2(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:W}=await s("stx/client-script-bundler",()=>import("./chunk-tscr6bs8.js"));if(q(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=XJ(J);J=L.code,X=QJ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${d3(J,Z.serverData)}${X}`,J=a0(J),!Y&&I1(Z.attrs||""))J=T1(J);let H=Nq(Z.eventBindings||[]),U=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(U),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
3730
+ `)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 K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=q[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((U)=>{let j=U.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 H=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(H){let U=H[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=H[0].length;continue}}G++}return Z}var Dq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Mq($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!Dq.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 K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let H=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=H.exec($))!==null)X(Q[1]);return Z}async function x9($,Z={}){let J=$,X="",Y=!1,Q=[],G=K$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=q$(G.styles),K=$2(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:W}=await s("stx/client-script-bundler",()=>import("./chunk-7g5vk4c3.js"));if(q(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=XJ(J);J=L.code,X=QJ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${d3(J,Z.serverData)}${X}`,J=a0(J),!Y&&I1(Z.attrs||""))J=T1(J);let H=Nq(Z.eventBindings||[]),U=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(U),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
3731
3731
  ${e1(`${X}${J}
3732
3732
  ${H}`)}
3733
3733
  </script>`}let V=$J($),_=/function __stx_setup_/.test(J),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(L){let w=L.length>0?`