@stacksjs/stx 0.2.871 → 0.2.872

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 (120) hide show
  1. package/dist/{chunk-8q37c0jm.js → chunk-18a3vdnq.js} +1 -1
  2. package/dist/{chunk-1ptjecaz.js → chunk-1c8j9zdp.js} +1 -1
  3. package/dist/{chunk-3z3y475q.js → chunk-1p9rb7rt.js} +1 -1
  4. package/dist/{chunk-5kc0r06s.js → chunk-2jccw1km.js} +1 -1
  5. package/dist/chunk-2nd3h37q.js +2 -0
  6. package/dist/{chunk-gqjt1va8.js → chunk-2yrd286h.js} +1 -1
  7. package/dist/chunk-3k5g4tbn.js +2 -0
  8. package/dist/chunk-3qewdhvh.js +2 -0
  9. package/dist/{chunk-xga3xhzr.js → chunk-4ay62hs9.js} +1 -1
  10. package/dist/{chunk-80x7c8d8.js → chunk-4p51hk75.js} +5 -5
  11. package/dist/{chunk-jz76vn4n.js → chunk-4v70bs2q.js} +1 -1
  12. package/dist/{chunk-21vrwgap.js → chunk-5nj2k8zf.js} +1 -1
  13. package/dist/{chunk-qnky63y3.js → chunk-6mkn81pd.js} +1 -1
  14. package/dist/{chunk-3fkbbkkt.js → chunk-6s7q8kw3.js} +2 -2
  15. package/dist/{chunk-ts61qx11.js → chunk-71hjqg16.js} +4 -4
  16. package/dist/{chunk-17ttwt50.js → chunk-7j0qkye5.js} +1 -1
  17. package/dist/chunk-7mqnbn1x.js +2 -0
  18. package/dist/chunk-7q3ar8ay.js +2 -0
  19. package/dist/chunk-808fbm83.js +2 -0
  20. package/dist/chunk-832m6nwr.js +2051 -0
  21. package/dist/{chunk-89xpfwy4.js → chunk-9bnggqhj.js} +8 -8
  22. package/dist/{chunk-98832y5h.js → chunk-9c07p1vq.js} +2 -2
  23. package/dist/{chunk-rpep1ve3.js → chunk-9fyw1xkh.js} +2 -2
  24. package/dist/{chunk-az07qe58.js → chunk-a8164hnf.js} +1 -1
  25. package/dist/{chunk-b7qfjv65.js → chunk-asrzmw7w.js} +1 -1
  26. package/dist/{chunk-fn2j7g8g.js → chunk-av2vknrs.js} +2 -2
  27. package/dist/chunk-b2kkezey.js +2 -0
  28. package/dist/{chunk-n16ba3wz.js → chunk-b8vs32dw.js} +3 -3
  29. package/dist/{chunk-k82hqmma.js → chunk-ba86dkhs.js} +1 -1
  30. package/dist/{chunk-ce49k18q.js → chunk-bbq79tap.js} +5 -5
  31. package/dist/{chunk-wvtmex14.js → chunk-bfvr4byj.js} +5 -5
  32. package/dist/{chunk-jafn6jh0.js → chunk-bmbqr2br.js} +1 -1
  33. package/dist/{chunk-q28q8w89.js → chunk-bqs9wyje.js} +1 -1
  34. package/dist/chunk-c63027nw.js +2 -0
  35. package/dist/{chunk-pffksrxb.js → chunk-csymxc5a.js} +8 -8
  36. package/dist/chunk-cv9vmz5x.js +2 -0
  37. package/dist/{chunk-hgmjxq7t.js → chunk-d0h18m2r.js} +1 -1
  38. package/dist/{chunk-sb8n32rn.js → chunk-dhbpbjt3.js} +1 -1
  39. package/dist/{chunk-a3rqpyt8.js → chunk-dv1edvz8.js} +1 -1
  40. package/dist/{chunk-1dt8e7ew.js → chunk-e2t7mk29.js} +2 -2
  41. package/dist/{chunk-1n7vjs3t.js → chunk-e549f7a9.js} +2 -2
  42. package/dist/chunk-eczy00w6.js +2 -0
  43. package/dist/{chunk-34mx6czk.js → chunk-f5gg0pxj.js} +1 -1
  44. package/dist/chunk-gc4bgven.js +2 -0
  45. package/dist/{chunk-5d0csn7w.js → chunk-hcaedzck.js} +1 -1
  46. package/dist/{chunk-wz1h33pz.js → chunk-hd4vn78w.js} +1 -1
  47. package/dist/{chunk-dy7vqv1x.js → chunk-hhbt8grm.js} +2 -2
  48. package/dist/{chunk-7mbezqy6.js → chunk-j89p53vx.js} +2 -2
  49. package/dist/{chunk-has2s6zj.js → chunk-jcr69v95.js} +2 -2
  50. package/dist/{chunk-c8d5cv6w.js → chunk-jf3n1f32.js} +2 -2
  51. package/dist/chunk-jkevn2jy.js +2 -0
  52. package/dist/{chunk-aktk5r6c.js → chunk-jnj9s2yw.js} +1 -1
  53. package/dist/{chunk-ak6edtk2.js → chunk-jpgc0j8x.js} +2 -2
  54. package/dist/{chunk-avfsad8j.js → chunk-kkevjppm.js} +2 -2
  55. package/dist/{chunk-38tdqbf1.js → chunk-kx6y1cqw.js} +4 -4
  56. package/dist/{chunk-a7drjyq6.js → chunk-kzhget9h.js} +1 -1
  57. package/dist/{chunk-2sw68zck.js → chunk-m131znxe.js} +4 -4
  58. package/dist/chunk-me7cxs0e.js +2 -0
  59. package/dist/{chunk-3972v2g1.js → chunk-mm00bb1p.js} +1 -1
  60. package/dist/{chunk-6npyrm89.js → chunk-my6tp8rn.js} +1 -1
  61. package/dist/chunk-pc8jnkb3.js +2 -0
  62. package/dist/{chunk-2pt2feg2.js → chunk-pj1znb6y.js} +1 -1
  63. package/dist/{chunk-zebk7htd.js → chunk-pnqdwqw9.js} +54 -54
  64. package/dist/{chunk-k7m8659h.js → chunk-q50x1gfd.js} +2 -2
  65. package/dist/{chunk-4gx0z28s.js → chunk-q8d0wf0w.js} +1 -1
  66. package/dist/{chunk-sghbhdtj.js → chunk-qk1fkfvj.js} +1 -1
  67. package/dist/{chunk-hcp8qese.js → chunk-qt4dha3g.js} +3 -3
  68. package/dist/{chunk-hs11350k.js → chunk-qvxtq5vb.js} +1 -1
  69. package/dist/{chunk-5qfrnjkd.js → chunk-rvbw12e1.js} +1 -1
  70. package/dist/{chunk-vrcr4b13.js → chunk-s584xnzx.js} +1 -1
  71. package/dist/{chunk-ptfhh54v.js → chunk-s70e5jbq.js} +9 -9
  72. package/dist/{chunk-04pkrxse.js → chunk-tahw02kf.js} +1 -1
  73. package/dist/{chunk-nbvpjwj1.js → chunk-tc36b3r4.js} +18 -18
  74. package/dist/{chunk-teasmth3.js → chunk-teahvty8.js} +1 -1
  75. package/dist/chunk-tfsf9pes.js +2 -0
  76. package/dist/chunk-thyxsg54.js +2 -0
  77. package/dist/chunk-txjtd4gj.js +2 -0
  78. package/dist/{chunk-ms60vwmg.js → chunk-v4ab2jzz.js} +1 -1
  79. package/dist/{chunk-pczh82f8.js → chunk-v99hgmsx.js} +1 -1
  80. package/dist/chunk-vf91b9b9.js +20 -0
  81. package/dist/{chunk-z4zqtpqn.js → chunk-vmq773pb.js} +1 -1
  82. package/dist/{chunk-s41wm1as.js → chunk-vv9anbw1.js} +1 -1
  83. package/dist/{chunk-74vp2yw4.js → chunk-vvxcebpn.js} +2 -2
  84. package/dist/{chunk-5h9d6jew.js → chunk-wk2rge05.js} +3 -3
  85. package/dist/{chunk-1217683z.js → chunk-y48ykf1n.js} +4 -4
  86. package/dist/chunk-y69hhxn8.js +2 -0
  87. package/dist/{chunk-gkdgg83x.js → chunk-ycb07ppz.js} +1 -1
  88. package/dist/chunk-z0qxrx9r.js +3 -0
  89. package/dist/chunk-z2wfgva6.js +2 -0
  90. package/dist/{chunk-x7redxyd.js → chunk-z9xe3xkg.js} +2 -2
  91. package/dist/{chunk-583rbj5e.js → chunk-zfrzdje6.js} +1 -1
  92. package/dist/cli.js +13 -13
  93. package/dist/component-library.js +140 -36
  94. package/dist/craft-entry.js +1 -1
  95. package/dist/craft.js +1 -1
  96. package/dist/pwa.js +2 -2
  97. package/dist/ssg.js +5 -5
  98. package/package.json +5 -5
  99. package/dist/chunk-3mb2pw1s.js +0 -3
  100. package/dist/chunk-3zm4bwha.js +0 -2
  101. package/dist/chunk-55bne11m.js +0 -2
  102. package/dist/chunk-5mfymtae.js +0 -2
  103. package/dist/chunk-6jc67p70.js +0 -2
  104. package/dist/chunk-9d5cqgy7.js +0 -2
  105. package/dist/chunk-ajaqa958.js +0 -2
  106. package/dist/chunk-ax0ntjxy.js +0 -2
  107. package/dist/chunk-bz52y1cb.js +0 -2
  108. package/dist/chunk-dst4twmx.js +0 -2
  109. package/dist/chunk-f14pyq81.js +0 -20
  110. package/dist/chunk-hb6r4pxp.js +0 -2
  111. package/dist/chunk-j0cfkp98.js +0 -2
  112. package/dist/chunk-kpjtptnx.js +0 -2
  113. package/dist/chunk-ktrfk613.js +0 -2
  114. package/dist/chunk-msvh8rda.js +0 -2042
  115. package/dist/chunk-n1g75yxa.js +0 -2
  116. package/dist/chunk-npayn9fr.js +0 -2
  117. package/dist/chunk-p8t5mnes.js +0 -2
  118. package/dist/chunk-rhhq8k9f.js +0 -2
  119. package/dist/chunk-w3n2jpk5.js +0 -2
  120. package/dist/chunk-ymmcv5g3.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Vt,fe,E,d,m,O,t,se,Y,u,$e,Ni,W,Rn,Di,qt,Mi,bl,Dr,wl,pt,vl,Mr,xl,An,Li,Sl,Lr,Br,Re,ji}from"./chunk-pffksrxb.js";import{hi,Hc,o,T,je,Lt,bn,Be,ye,ee,Er,wn,qs,Zc,Qc,xn,Pr,Xs,Gs,el,ki,tl,nl,rl,sl,ze,He,Js,We,s,_n,y,g,G,re,Te,R,Ai}from"./chunk-zebk7htd.js";import{Ht}from"./chunk-60yppcbb.js";import{Tn}from"./chunk-3972v2g1.js";import{x}from"./chunk-fn2j7g8g.js";import{xr,Ls}from"./chunk-dy7vqv1x.js";import{Cc,Ec,br,st,Tc,M}from"./chunk-has2s6zj.js";import{ii,ai,ci,li}from"./chunk-qnky63y3.js";import{vc,bs}from"./chunk-38tdqbf1.js";import{gs,ms,hs}from"./chunk-ptfhh54v.js";import{xs,Zo,Qo,Ss,ks,ei}from"./chunk-wvtmex14.js";import{ws,Ko}from"./chunk-1217683z.js";import{Vo}from"./chunk-q1wxgw5s.js";import{ue,Xo,Go,Jo}from"./chunk-74vp2yw4.js";import{gr,ke,Sc,mr,kc}from"./chunk-80x7c8d8.js";import{V,nt}from"./chunk-4068rmzv.js";import{Rc,Ac}from"./chunk-3fkbbkkt.js";import{A,Pn,Bi}from"./chunk-rpep1ve3.js";import{D,c,f}from"./chunk-fd1bpv35.js";import Jn from"fs";import ae from"path";function mt(n){let e=Lt(n),l=e.find((S)=>S.closing&&S.name.toLowerCase()==="head");if(!l)return n;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),h=0,r=[];for(let S=0;S<e.length;S++){let v=e[S];if(v.start<l.end)continue;let k=v.name.toLowerCase();if(a.has(k)){h=Math.max(0,h+(v.closing?-1:v.selfClosing?0:1));continue}if(k!=="style"||v.closing||h>0)continue;let C=e[S+1];if(C?.name.toLowerCase()==="style"&&C.closing){if(/@scope\s*\{/.test(n.slice(v.end,C.start)))continue;r.push({start:v.start,end:C.end}),S++}}if(!r.length)return n;let p=r.map((S)=>n.slice(S.start,S.end)).join(`
2
+ import{Vt,ge,E,d,m,O,t,oe,Z,u,$e,Ni,W,Rn,Di,qt,Mi,bl,Dr,wl,pt,vl,Mr,xl,An,Li,Sl,Lr,Br,Re,ji}from"./chunk-csymxc5a.js";import{hi,Hc,o,T,je,Lt,bn,Be,be,te,Er,wn,qs,Zc,Qc,xn,Pr,Xs,Gs,el,ki,tl,nl,rl,sl,ze,He,Js,We,s,_n,y,g,G,se,Te,R,Ai}from"./chunk-pnqdwqw9.js";import{Ht}from"./chunk-60yppcbb.js";import{Tn}from"./chunk-mm00bb1p.js";import{x}from"./chunk-av2vknrs.js";import{xr,Ls}from"./chunk-hhbt8grm.js";import{Cc,Ec,br,st,Tc,M}from"./chunk-jcr69v95.js";import{ii,ai,ci,li}from"./chunk-6mkn81pd.js";import{vc,bs}from"./chunk-kx6y1cqw.js";import{gs,ms,hs}from"./chunk-s70e5jbq.js";import{xs,Zo,Qo,Ss,ks,ei}from"./chunk-bfvr4byj.js";import{ws,Ko}from"./chunk-y48ykf1n.js";import{Vo}from"./chunk-q1wxgw5s.js";import{de,Xo,Go,Jo}from"./chunk-vvxcebpn.js";import{gr,ke,Sc,mr,kc}from"./chunk-4p51hk75.js";import{V,nt}from"./chunk-4068rmzv.js";import{Rc,Ac}from"./chunk-6s7q8kw3.js";import{A,Pn,Bi}from"./chunk-9fyw1xkh.js";import{D,c,f}from"./chunk-fd1bpv35.js";import Jn from"fs";import ae from"path";function mt(n){let e=Lt(n),l=e.find((S)=>S.closing&&S.name.toLowerCase()==="head");if(!l)return n;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),h=0,r=[];for(let S=0;S<e.length;S++){let v=e[S];if(v.start<l.end)continue;let k=v.name.toLowerCase();if(a.has(k)){h=Math.max(0,h+(v.closing?-1:v.selfClosing?0:1));continue}if(k!=="style"||v.closing||h>0)continue;let C=e[S+1];if(C?.name.toLowerCase()==="style"&&C.closing){if(/@scope\s*\{/.test(n.slice(v.end,C.start)))continue;r.push({start:v.start,end:C.end}),S++}}if(!r.length)return n;let p=r.map((S)=>n.slice(S.start,S.end)).join(`
3
3
  `),w=[n.slice(0,l.start),p,`
4
4
  `],b=l.start;for(let S of r)w.push(n.slice(b,S.start)),b=S.end;return w.push(n.slice(b)),w.join("")}function ht(){return`
5
5
  // STX Lifecycle Runtime
@@ -565,9 +565,9 @@ ${e.inlineScript}
565
565
  <!-- Custom Analytics -->
566
566
  <script${l.length>0?` ${l.join(" ")}`:""} src="${pe(e.scriptUrl)}" defer></script>
567
567
  `}function vt(n,e){let l=qr(e);if(!l)return n;if(!n.includes("</head>")){let a=c(n);if(a!==-1)return n.slice(0,a)+l+n.slice(a);return n+l}return f(n,l,"")}function pe(n){return n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kt(n){let e=n.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function xt(n){let e=n?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}import Gr from"fs";import et from"path";import{createHighlighter as Zr}from"ts-syntax-highlighter";var tt=new Map;async function Ne(n,e={}){try{if(!await s(n))throw Error(`Markdown file not found: ${n}`);let a=(await Gr.promises.stat(n)).mtime.getTime();if(e.cache&&tt.has(n)){let k=tt.get(n);if(k.updatedAt>=a)return{content:k.content,data:k.data}}let h=await Bun.file(n).text(),{data:r,content:p}=br(h),w=e.markdown||M.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},S=st(p,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)S=await Jr(S,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let v={content:S,data:r||{}};if(e.cache)tt.set(n,{...v,updatedAt:a});return v}catch(l){if(e.debug)console.error(`Error reading/parsing markdown file ${n}:`,l);let a=l instanceof Error?l.message:String(l);return{content:y("Markdown File",`Error reading/parsing markdown file: ${a}`,n,"",0,""),data:{}}}}var Xe=null;async function Jr(n,e,l){let a=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Xe)try{Xe=await Zr({theme:e||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),n}let h=async(w,b,S,v)=>{let k=v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),C=S||(l?"text":"");if(!C)return w;try{if(!Xe.getSupportedLanguages().includes(C))return w;return(await Xe.highlight(k,C,{theme:e})).html}catch(_){console.error(`Error highlighting code block with language ${S}:`,_)}return w},r=n,p=n.matchAll(a);for(let w of p){let[b,S,v,k]=w,C=await h(b,S,v,k);r=r.replace(b,C)}return r}async function St(n,e,l="",a={}){return await Qr(n,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(p,w,b,S)=>{try{let v=w;if(!et.isAbsolute(w))v=et.resolve(et.dirname(l),w);let k={};if(b)try{try{k=JSON.parse(b)}catch{if(a.debug)console.warn("Using safer alternative for parsing JS object literal");let B=b.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of B){let q=F.indexOf(":");if(q>0){let H=F.substring(0,q).trim(),N=F.substring(q+1).trim(),U=N.startsWith('"')&&N.endsWith('"'),K=N.startsWith("'")&&N.endsWith("'");if(U||K)N=N.substring(1,N.length-1);k[H]=N}}}}catch(j){if(a.debug)console.error("Error parsing context in @markdown-file directive:",j)}let{content:C,data:_}=await Ne(v,a),P={...e,..._,...k},I=C,L=/\{\{([^}]+)\}\}/g;return I=I.replace(L,(j,B)=>{let F=B.trim();return P[F]!==void 0?String(P[F]):j}),I}catch(v){let k=v instanceof Error?v.message:String(v);return y("Markdown File",`Error including markdown file: ${k}`,l,n,S,p)}})}async function Qr(n,e,l){let a=[],h;while((h=e.exec(n))!==null){let w=h[0],b=h.index,S=h;a.push(l(...S).then((v)=>({match:w,replacement:v,index:b})))}let r=await Promise.all(a);r.sort((w,b)=>b.index-w.index);let p=n;for(let{match:w,replacement:b}of r)p=p.replace(w,()=>b);return p}var $t=new WeakMap;function Et(n=16){let e=new Uint8Array(n);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function Ke(n,e){if(!n)return e?.nonceGenerator?.()??Et();let l=$t.get(n);if(!l)l=e?.nonceGenerator?.()??Et(),$t.set(n,l);return l}function Yr(n,e){let l=[];for(let[a,h]of Object.entries(n)){if(h===void 0||h===null)continue;if(typeof h==="boolean"){if(h)l.push(a);continue}if(Array.isArray(h)){let r=[...h];if(e&&(a==="script-src"||a==="style-src"))r=r.filter((p)=>!p.startsWith("'nonce-")),r.push(`'nonce-${e}'`);if(r.length>0)l.push(`${a} ${r.join(" ")}`)}}return l.join("; ")}function Ct(n,e){return`<meta http-equiv="Content-Security-Policy" content="${Yr(n,e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function _t(n,e,l){if(!e.enabled||!e.addMetaTag)return n;if(n.includes('http-equiv="Content-Security-Policy"'))return n;if(!n.includes("<head>")&&!n.includes("<head "))return n;let a=e.useNonce?Ke(l,e):void 0,h=Ct(e.directives,a);return n.replace(/<head([^>]*)>/,`<head$1>
568
- ${h}`)}function Tt(n,e){let l=n;return l=l.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<script nonce="${e}"${h}>`}),l=l.replace(/<style([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<style nonce="${e}"${h}>`}),l}function At(n,e,l,a){let h=n,r=a.csp;if(h=h.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let p=r.useNonce?Ke(e,r):void 0;return Ct(r.directives,p)}),h=h.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return Ke(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=Ke(e,r);return h}import en from"crypto";var tn=40,Rt="_token",rt=null;function rn(n=tn){let e=en.randomBytes(Math.ceil(n/2)).toString("hex").slice(0,n);return rt=e,e}function nn(){if(!rt)rn();return rt}function sn(n=Rt){let e=nn();return`<input type="hidden" name="${n}" value="${e}">`}function Mt(n){return n.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,l,a)=>sn(a||Rt))}async function Dt(n,e,l,a){if(!a.customDirectives||a.customDirectives.length===0)return n;let h=n;for(let r of a.customDirectives){if(!r.name||typeof r.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",r);continue}if(r.hasEndTag)h=await on(h,r,e,l,a);else h=await an(h,r,e,l,a)}return h}async function on(n,e,l,a,h){let{name:r,handler:p}=e,w=`@${r}`,b=`@end${r}`,S=n,v=Vt(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${b}`,"g"),k=[],C=v.exec(S);while(C!==null){let[_,P="",I=""]=C,L=C.index||0;try{let j=P?It(e,P):[],B=I.trim(),F=await p(B,j,l,a);k.push({original:_,processed:F,startIndex:L})}catch(j){let B=j instanceof Error?j.message:String(j);if(h.debug)console.error(`Error processing custom directive @${r}:`,j);k.push({original:_,processed:u("CustomDirective",`Error in @${r}${P?`(${P})`:""}: ${B}`,t.EVALUATION_ERROR),startIndex:L})}C=v.exec(S)}for(let _=k.length-1;_>=0;_--){let{original:P,processed:I}=k[_];S=S.replace(P,I)}return S}async function an(n,e,l,a,h){let{name:r,handler:p}=e,w=n,b=[],S=[];if(e.rawParams){for(let C of Di(w,Vt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(C.end!==-1)S.push({fullMatch:C.call,paramString:C.args,startIndex:C.start})}else{let C=Vt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");C.lastIndex=0;let _=C.exec(w);while(_!==null)S.push({fullMatch:_[0],paramString:_[1]??"",startIndex:_.index||0}),_=C.exec(w)}for(let{fullMatch:C,paramString:_,startIndex:P}of S)try{let I=It(e,_),L=await p("",I,l,a);b.push({original:C,processed:L,startIndex:P})}catch(I){let L=I instanceof Error?I.message:String(I);if(h.debug)console.error(`Error processing custom directive @${r}:`,I);b.push({original:C,processed:u("CustomDirective",`Error in @${r}(${_}): ${L}`,t.EVALUATION_ERROR),startIndex:P})}let v=Vt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),k=v.exec(w);while(k!==null){let[C]=k,_=k.index||0;try{let P=await p("",[],l,a);b.push({original:C,processed:P,startIndex:_})}catch(P){let I=P instanceof Error?P.message:String(P);if(h.debug)console.error(`Error processing custom directive @${r}:`,P);b.push({original:C,processed:u("CustomDirective",`Error in @${r}: ${I}`,t.EVALUATION_ERROR),startIndex:_})}k=v.exec(w)}for(let C=b.length-1;C>=0;C--){let{original:_,processed:P}=b[C];w=w.replace(_,P)}return w}function It(n,e){return n.rawParams?qt(e):cn(e)}function cn(n){if(!n.trim())return[];let e=[],l="",a=!1,h="";for(let r=0;r<n.length;r++){let p=n[r];if((p==='"'||p==="'")&&(r===0||n[r-1]!=="\\"))if(!a)a=!0,h=p;else if(p===h)a=!1;else l+=p;else if(p===","&&!a)e.push(l.trim()),l="";else l+=p}if(l.trim())e.push(l.trim());return e.map((r)=>{let p=r.trim();if(p.startsWith('"')&&p.endsWith('"')||p.startsWith("'")&&p.endsWith("'"))return p.substring(1,p.length-1);return p})}var Ot=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Pt=/^[A-Za-z_$][\w$]*$/,ln=new Set(["light","dark","system"]);function Ce(n,e){if(typeof n!=="string"||n.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function un(n){if(!n||typeof n!=="object"||Array.isArray(n))throw Error("@appearanceBootstrap expects an options object");let e=n,{appearance:l,colorMode:a}=e;if(Ce(e.storageKey,"storageKey"),l!==void 0&&(!l||typeof l!=="object"||Array.isArray(l)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!a||typeof a!=="object"||Array.isArray(a))throw Error("@appearanceBootstrap colorMode must be an object");if(Ce(a.key,"colorMode.key"),Ce(a.attribute,"colorMode.attribute"),Ce(a.default,"colorMode.default"),!Pt.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Ot.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!ln.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let h=null;if(l){if(Ce(l.key,"appearance.key"),Ce(l.attribute,"appearance.attribute"),Ce(l.default,"appearance.default"),!Pt.test(l.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Ot.test(l.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(l.allowed)||l.allowed.length===0||l.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!l.allowed.includes(l.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");h={key:l.key,attribute:l.attribute,allowed:[...new Set(l.allowed)],default:l.default}}return{storageKey:e.storageKey,appearance:h,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function dn(n){return JSON.stringify(n).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function pn(n){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${dn(n)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}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());if(config.appearance)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,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function fn(n,e){let l=1,a=null,h=!1;for(let r=e+1;r<n.length;r++){let p=n[r];if(h){h=!1;continue}if(a){if(p==="\\")h=!0;else if(p===a)a=null;continue}if(p==='"'||p==="'"||p==="`"){a=p;continue}if(p==="(")l++;else if(p===")"&&--l===0)return r}return-1}function jt(n,e){let l=n,a=/@appearanceBootstrap\s*\(/g,h;while((h=a.exec(l))!==null){let r=h.index+h[0].length-1,p=fn(l,r);if(p===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=l.slice(r+1,p).trim(),b=d(`(${w})`,e),S=pn(un(b));l=l.slice(0,h.index)+S+l.slice(p+1),a.lastIndex=h.index+S.length}return l}import gn from"crypto";function te(n){return G(String(n??""))}var Bt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ge(n,e,l,a){let h=n||e;return l?`${h} ${a}`:h}function he(n){return String(n).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ie(n,e){if(/\bid\s*=/i.test(n))return"";return` id="${te(e)}"`}function it(n,e,l){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(l))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(l))a+=` aria-describedby="${te(`${he(n)}-error`)}"`;return a}function mn(){return gn.randomUUID()}function Ze(n,e){let l=n;return l=l.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=mn();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${te(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),l=l.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,h)=>{let r=h.toUpperCase();if(h&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${te(r)}">`;return a}),l}function Ft(n,e,l=Bt){let a=n;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(h,r,p,w,b,S="")=>{let v=r||p||"POST",k=w||b||"",C=xe(S),_=v.toUpperCase(),P=["GET","POST"].includes(_)?_:"POST",I=`<form method="${te(P)}" action="${te(k)}"${C?` ${C}`:""}>`;if(I+=`
568
+ ${h}`)}function Tt(n,e){let l=n;return l=l.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<script nonce="${e}"${h}>`}),l=l.replace(/<style([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<style nonce="${e}"${h}>`}),l}function At(n,e,l,a){let h=n,r=a.csp;if(h=h.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let p=r.useNonce?Ke(e,r):void 0;return Ct(r.directives,p)}),h=h.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return Ke(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=Ke(e,r);return h}import en from"crypto";var tn=40,Rt="_token",rt=null;function rn(n=tn){let e=en.randomBytes(Math.ceil(n/2)).toString("hex").slice(0,n);return rt=e,e}function nn(){if(!rt)rn();return rt}function sn(n=Rt){let e=nn();return`<input type="hidden" name="${n}" value="${e}">`}function Mt(n){return n.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,l,a)=>sn(a||Rt))}async function Dt(n,e,l,a){if(!a.customDirectives||a.customDirectives.length===0)return n;let h=n;for(let r of a.customDirectives){if(!r.name||typeof r.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",r);continue}if(r.hasEndTag)h=await on(h,r,e,l,a);else h=await an(h,r,e,l,a)}return h}async function on(n,e,l,a,h){let{name:r,handler:p}=e,w=`@${r}`,b=`@end${r}`,S=n,v=Vt(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${b}`,"g"),k=[],C=v.exec(S);while(C!==null){let[_,P="",I=""]=C,L=C.index||0;try{let j=P?It(e,P):[],B=I.trim(),F=await p(B,j,l,a);k.push({original:_,processed:F,startIndex:L})}catch(j){let B=j instanceof Error?j.message:String(j);if(h.debug)console.error(`Error processing custom directive @${r}:`,j);k.push({original:_,processed:u("CustomDirective",`Error in @${r}${P?`(${P})`:""}: ${B}`,t.EVALUATION_ERROR),startIndex:L})}C=v.exec(S)}for(let _=k.length-1;_>=0;_--){let{original:P,processed:I}=k[_];S=S.replace(P,I)}return S}async function an(n,e,l,a,h){let{name:r,handler:p}=e,w=n,b=[],S=[];if(e.rawParams){for(let C of Di(w,Vt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(C.end!==-1)S.push({fullMatch:C.call,paramString:C.args,startIndex:C.start})}else{let C=Vt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");C.lastIndex=0;let _=C.exec(w);while(_!==null)S.push({fullMatch:_[0],paramString:_[1]??"",startIndex:_.index||0}),_=C.exec(w)}for(let{fullMatch:C,paramString:_,startIndex:P}of S)try{let I=It(e,_),L=await p("",I,l,a);b.push({original:C,processed:L,startIndex:P})}catch(I){let L=I instanceof Error?I.message:String(I);if(h.debug)console.error(`Error processing custom directive @${r}:`,I);b.push({original:C,processed:u("CustomDirective",`Error in @${r}(${_}): ${L}`,t.EVALUATION_ERROR),startIndex:P})}let v=Vt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),k=v.exec(w);while(k!==null){let[C]=k,_=k.index||0;try{let P=await p("",[],l,a);b.push({original:C,processed:P,startIndex:_})}catch(P){let I=P instanceof Error?P.message:String(P);if(h.debug)console.error(`Error processing custom directive @${r}:`,P);b.push({original:C,processed:u("CustomDirective",`Error in @${r}: ${I}`,t.EVALUATION_ERROR),startIndex:_})}k=v.exec(w)}for(let C=b.length-1;C>=0;C--){let{original:_,processed:P}=b[C];w=w.replace(_,P)}return w}function It(n,e){return n.rawParams?qt(e):cn(e)}function cn(n){if(!n.trim())return[];let e=[],l="",a=!1,h="";for(let r=0;r<n.length;r++){let p=n[r];if((p==='"'||p==="'")&&(r===0||n[r-1]!=="\\"))if(!a)a=!0,h=p;else if(p===h)a=!1;else l+=p;else if(p===","&&!a)e.push(l.trim()),l="";else l+=p}if(l.trim())e.push(l.trim());return e.map((r)=>{let p=r.trim();if(p.startsWith('"')&&p.endsWith('"')||p.startsWith("'")&&p.endsWith("'"))return p.substring(1,p.length-1);return p})}var Ot=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Pt=/^[A-Za-z_$][\w$]*$/,ln=new Set(["light","dark","system"]);function Ce(n,e){if(typeof n!=="string"||n.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function un(n){if(!n||typeof n!=="object"||Array.isArray(n))throw Error("@appearanceBootstrap expects an options object");let e=n,{appearance:l,colorMode:a}=e;if(Ce(e.storageKey,"storageKey"),l!==void 0&&(!l||typeof l!=="object"||Array.isArray(l)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!a||typeof a!=="object"||Array.isArray(a))throw Error("@appearanceBootstrap colorMode must be an object");if(Ce(a.key,"colorMode.key"),Ce(a.attribute,"colorMode.attribute"),Ce(a.default,"colorMode.default"),!Pt.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Ot.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!ln.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let h=null;if(l){if(Ce(l.key,"appearance.key"),Ce(l.attribute,"appearance.attribute"),Ce(l.default,"appearance.default"),!Pt.test(l.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Ot.test(l.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(l.allowed)||l.allowed.length===0||l.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!l.allowed.includes(l.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");h={key:l.key,attribute:l.attribute,allowed:[...new Set(l.allowed)],default:l.default}}return{storageKey:e.storageKey,appearance:h,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function dn(n){return JSON.stringify(n).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function pn(n){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${dn(n)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}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());if(config.appearance)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,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function fn(n,e){let l=1,a=null,h=!1;for(let r=e+1;r<n.length;r++){let p=n[r];if(h){h=!1;continue}if(a){if(p==="\\")h=!0;else if(p===a)a=null;continue}if(p==='"'||p==="'"||p==="`"){a=p;continue}if(p==="(")l++;else if(p===")"&&--l===0)return r}return-1}function jt(n,e){let l=n,a=/@appearanceBootstrap\s*\(/g,h;while((h=a.exec(l))!==null){let r=h.index+h[0].length-1,p=fn(l,r);if(p===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=l.slice(r+1,p).trim(),b=d(`(${w})`,e),S=pn(un(b));l=l.slice(0,h.index)+S+l.slice(p+1),a.lastIndex=h.index+S.length}return l}import gn from"crypto";function ee(n){return G(String(n??""))}var Bt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ge(n,e,l,a){let h=n||e;return l?`${h} ${a}`:h}function he(n){return String(n).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ie(n,e){if(/\bid\s*=/i.test(n))return"";return` id="${ee(e)}"`}function it(n,e,l){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(l))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(l))a+=` aria-describedby="${ee(`${he(n)}-error`)}"`;return a}function mn(){return gn.randomUUID()}function Ze(n,e){let l=n;return l=l.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=mn();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${ee(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),l=l.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,h)=>{let r=h.toUpperCase();if(h&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${ee(r)}">`;return a}),l}function Ft(n,e,l=Bt){let a=n;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(h,r,p,w,b,S="")=>{let v=r||p||"POST",k=w||b||"",C=xe(S),_=v.toUpperCase(),P=["GET","POST"].includes(_)?_:"POST",I=`<form method="${ee(P)}" action="${ee(k)}"${C?` ${C}`:""}>`;if(I+=`
569
569
  ${Ze("@csrf",e)}`,!["GET","POST"].includes(_))I+=`
570
- ${Ze(`@method('${_}')`,e)}`;return I}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(h,r,p,w,b,S="")=>{let v=r||p||"",k=w||b||"",C=xe(S),_=Fe(v,e),P=_!==void 0&&_!==null?_:k||"",I=C.match(/type=['"]([^'"]+)['"]/i),L=I?I[1]:"text",j=Ue(v,e),B=C.match(/class=['"]([^'"]+)['"]/i),F=Ge(B?B[1]:"",l.input,j,l.inputError),q=C.replace(/class=['"][^'"]+['"]/i,"");return q=q.replace(/type=['"][^'"]+['"]/i,""),`<input type="${te(L)}" name="${te(v)}"${Ie(C,he(v))} value="${te(P)}" class="${F}"${it(v,j,C)}${q?` ${q}`:""}>`}),a=a.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(h,r,p="",w="")=>{let b=xe(p),S=Fe(r,e)||w.trim(),v=Ue(r,e),k=b.match(/class=['"]([^'"]+)['"]/i),C=Ge(k?k[1]:"",l.input,v,l.inputError),_=b.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${te(r)}"${Ie(b,he(r))} class="${C}"${it(r,v,b)}${_?` ${_}`:""}>${te(S)}</textarea>`}),a=a.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(h,r,p="",w)=>{let b=xe(p),S=Fe(r,e),v=Ue(r,e),k=b.match(/class=['"]([^'"]+)['"]/i),C=Ge(k?k[1]:"",l.input,v,l.inputError),_=b.replace(/class=['"][^'"]+['"]/i,""),P=w;if(S!==void 0)P=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(I,L,j)=>{if((Array.isArray(S)?S.some((F)=>String(F)===j):String(S)===j)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return I});return`<select name="${te(r)}"${Ie(b,he(r))} class="${C}"${it(r,v,b)}${_?` ${_}`:""}>${P}</select>`}),a=a.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(h,r,p,w="")=>{let b=p===void 0?"1":p,S=p===void 0?he(r):`${he(r)}-${he(b)}`,v=xe(w),k=Fe(r,e),C=k!==void 0&&(Array.isArray(k)?k.some((L)=>String(L)===b):k===!0||String(k)===b),_=v.match(/class=['"]([^'"]+)['"]/i),P=_?_[1]:l.checkInput,I=v.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${te(r)}"${Ie(v,S)} value="${te(b)}" class="${P}"${C?" checked":""}${I?` ${I}`:""}>`}),a=a.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(h,r,p,w="")=>{let b=xe(w),S=Fe(r,e),v=S!==void 0&&S===p,k=b.match(/class=['"]([^'"]+)['"]/i),C=k?k[1]:l.checkInput,_=b.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${te(r)}"${Ie(b,`${he(r)}-${he(p)}`)} value="${te(p)}" class="${C}"${v?" checked":""}${_?` ${_}`:""}>`}),a=a.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(h,r,p="")=>{let w=xe(p),b=w.match(/accept=['"]([^'"]+)['"]/i),S=b?b[1]:"",v=w.includes("multiple"),k=Ue(r,e),C=w.match(/class=['"]([^'"]+)['"]/i),_=Ge(C?C[1]:"",l.input,k,l.inputError),P=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),I=[`<input type="file" name="${te(r)}"${Ie(w,he(r))}`,`class="${_}"`];if(S)I.push(`accept="${te(S)}"`);if(v)I.push("multiple");if(P)I.push(P);return`${I.join(" ")}>`}),a=a.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(h,r,p="",w)=>{let b=xe(p),S=b.match(/class=['"]([^'"]+)['"]/i),v=S?S[1]:l.label,k=b.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${te(he(r))}" class="${v}"${k?` ${k}`:""}>${w}</label>`}),a}function Ut(n,e,l=Bt){return n.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(a,h,r)=>{try{if(Ue(h,e)){let p=r.replace(/\{\{([^}]+)\}\}/g,(w,b,S)=>{let v=(k)=>re(r,S,String(k??""),!1,w.length);try{if(b.trim()==="$message"||b.trim()==="message")return v(Nt(h,e));if(b.trim().includes("errors.first")||b.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return v(e.errors.first(h));return v(Nt(h,e))}let k=b.trim();if(m(k)){let C=d(k,e);return C!==void 0?v(C):k}return k}catch{return b}});return`<div id="${te(`${he(h)}-error`)}" role="alert">${p}</div>`}return""}catch(p){return console.error("Error processing @error directive:",p),a}})}function Ue(n,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(n);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,n);return!1}function Nt(n,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(n);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,n)){let l=e.errors[n];return Array.isArray(l)?l[0]:String(l)}return""}function Fe(n,e){let l;if(e.old&&typeof e.old==="function")return e.old(n);if(e.old&&typeof e.old==="object")return e.old[n];if(n.endsWith("[]")){let a=n.slice(0,-2);if(l=e[a],l!==void 0)return l}return e[n]}function xe(n){if(!n.trim())return"";let e=[],l=n.trim(),a=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,h;while((h=a.exec(l))!==null){let[,r,,p]=h;e.push(`${r}="${p.trim()}"`)}return e.join(" ")}import*as ot from"path";async function Wt(n,e,l=""){if(ot.basename(l)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,n.replace(/@js[\s\S]*?@endjs/g,"");return zt(n,e,l,"@js","@endjs")}async function Xt(n,e,l=""){if(ot.basename(l)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((r)=>({...r,displayName:`User ${r.id}: ${r.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return n.replace(/@ts[\s\S]*?@endts/g,"")}return zt(n,e,l,"@ts","@endts")}async function zt(n,e,l,a,h){let r=n,p=Vt(`${a}([\\s\\S]*?)${h}`,"g"),w=[],b;while((b=p.exec(n))!==null)w.push({fullMatch:b[0],content:b[1]||"",index:b.index});for(let{fullMatch:S,content:v,index:k}of w)try{let C={...e,global:e},_=Object.keys(C),P=Object.values(C),I=v.trim();if(a==="@ts")I=I.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 j=(I.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),B=j.length>0?`return { ${j.join(", ")} };`:"return {};",F=`
570
+ ${Ze(`@method('${_}')`,e)}`;return I}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(h,r,p,w,b,S="")=>{let v=r||p||"",k=w||b||"",C=xe(S),_=Fe(v,e),P=_!==void 0&&_!==null?_:k||"",I=C.match(/type=['"]([^'"]+)['"]/i),L=I?I[1]:"text",j=Ue(v,e),B=C.match(/class=['"]([^'"]+)['"]/i),F=Ge(B?B[1]:"",l.input,j,l.inputError),q=C.replace(/class=['"][^'"]+['"]/i,"");return q=q.replace(/type=['"][^'"]+['"]/i,""),`<input type="${ee(L)}" name="${ee(v)}"${Ie(C,he(v))} value="${ee(P)}" class="${F}"${it(v,j,C)}${q?` ${q}`:""}>`}),a=a.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(h,r,p="",w="")=>{let b=xe(p),S=Fe(r,e)||w.trim(),v=Ue(r,e),k=b.match(/class=['"]([^'"]+)['"]/i),C=Ge(k?k[1]:"",l.input,v,l.inputError),_=b.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${ee(r)}"${Ie(b,he(r))} class="${C}"${it(r,v,b)}${_?` ${_}`:""}>${ee(S)}</textarea>`}),a=a.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(h,r,p="",w)=>{let b=xe(p),S=Fe(r,e),v=Ue(r,e),k=b.match(/class=['"]([^'"]+)['"]/i),C=Ge(k?k[1]:"",l.input,v,l.inputError),_=b.replace(/class=['"][^'"]+['"]/i,""),P=w;if(S!==void 0)P=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(I,L,j)=>{if((Array.isArray(S)?S.some((F)=>String(F)===j):String(S)===j)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return I});return`<select name="${ee(r)}"${Ie(b,he(r))} class="${C}"${it(r,v,b)}${_?` ${_}`:""}>${P}</select>`}),a=a.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(h,r,p,w="")=>{let b=p===void 0?"1":p,S=p===void 0?he(r):`${he(r)}-${he(b)}`,v=xe(w),k=Fe(r,e),C=k!==void 0&&(Array.isArray(k)?k.some((L)=>String(L)===b):k===!0||String(k)===b),_=v.match(/class=['"]([^'"]+)['"]/i),P=_?_[1]:l.checkInput,I=v.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${ee(r)}"${Ie(v,S)} value="${ee(b)}" class="${P}"${C?" checked":""}${I?` ${I}`:""}>`}),a=a.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(h,r,p,w="")=>{let b=xe(w),S=Fe(r,e),v=S!==void 0&&S===p,k=b.match(/class=['"]([^'"]+)['"]/i),C=k?k[1]:l.checkInput,_=b.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${ee(r)}"${Ie(b,`${he(r)}-${he(p)}`)} value="${ee(p)}" class="${C}"${v?" checked":""}${_?` ${_}`:""}>`}),a=a.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(h,r,p="")=>{let w=xe(p),b=w.match(/accept=['"]([^'"]+)['"]/i),S=b?b[1]:"",v=w.includes("multiple"),k=Ue(r,e),C=w.match(/class=['"]([^'"]+)['"]/i),_=Ge(C?C[1]:"",l.input,k,l.inputError),P=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),I=[`<input type="file" name="${ee(r)}"${Ie(w,he(r))}`,`class="${_}"`];if(S)I.push(`accept="${ee(S)}"`);if(v)I.push("multiple");if(P)I.push(P);return`${I.join(" ")}>`}),a=a.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(h,r,p="",w)=>{let b=xe(p),S=b.match(/class=['"]([^'"]+)['"]/i),v=S?S[1]:l.label,k=b.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${ee(he(r))}" class="${v}"${k?` ${k}`:""}>${w}</label>`}),a}function Ut(n,e,l=Bt){return n.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(a,h,r)=>{try{if(Ue(h,e)){let p=r.replace(/\{\{([^}]+)\}\}/g,(w,b,S)=>{let v=(k)=>se(r,S,String(k??""),!1,w.length);try{if(b.trim()==="$message"||b.trim()==="message")return v(Nt(h,e));if(b.trim().includes("errors.first")||b.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return v(e.errors.first(h));return v(Nt(h,e))}let k=b.trim();if(m(k)){let C=d(k,e);return C!==void 0?v(C):k}return k}catch{return b}});return`<div id="${ee(`${he(h)}-error`)}" role="alert">${p}</div>`}return""}catch(p){return console.error("Error processing @error directive:",p),a}})}function Ue(n,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(n);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,n);return!1}function Nt(n,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(n);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,n)){let l=e.errors[n];return Array.isArray(l)?l[0]:String(l)}return""}function Fe(n,e){let l;if(e.old&&typeof e.old==="function")return e.old(n);if(e.old&&typeof e.old==="object")return e.old[n];if(n.endsWith("[]")){let a=n.slice(0,-2);if(l=e[a],l!==void 0)return l}return e[n]}function xe(n){if(!n.trim())return"";let e=[],l=n.trim(),a=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,h;while((h=a.exec(l))!==null){let[,r,,p]=h;e.push(`${r}="${p.trim()}"`)}return e.join(" ")}import*as ot from"path";async function Wt(n,e,l=""){if(ot.basename(l)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,n.replace(/@js[\s\S]*?@endjs/g,"");return zt(n,e,l,"@js","@endjs")}async function Xt(n,e,l=""){if(ot.basename(l)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((r)=>({...r,displayName:`User ${r.id}: ${r.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return n.replace(/@ts[\s\S]*?@endts/g,"")}return zt(n,e,l,"@ts","@endts")}async function zt(n,e,l,a,h){let r=n,p=Vt(`${a}([\\s\\S]*?)${h}`,"g"),w=[],b;while((b=p.exec(n))!==null)w.push({fullMatch:b[0],content:b[1]||"",index:b.index});for(let{fullMatch:S,content:v,index:k}of w)try{let C={...e,global:e},_=Object.keys(C),P=Object.values(C),I=v.trim();if(a==="@ts")I=I.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 j=(I.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),B=j.length>0?`return { ${j.join(", ")} };`:"return {};",F=`
571
571
  ${I}
572
572
  ${B}
573
573
  `,H=Function(..._,F)(...P);if(H&&typeof H==="object")Object.assign(e,H);r=r.replace(S,"")}catch(C){console.error(`Error executing ${a} code block in ${l}:`,C);let _=C instanceof Error?C.message:String(C),P=y(`${a} Directive`,`Error executing code: ${_}`,l,n,k,S);console.error(P),r=r.replace(S,"")}return r}function hn(n,e="_method"){let l=n.toUpperCase();if(l==="GET"||l==="POST")return"";return`<input type="hidden" name="${e}" value="${l}">`}function Kt(n){return n.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,l,a,h,r)=>hn(a,r||"_method"))}async function Gt(n,e,l,a,h){if(!a.middleware||a.middleware.length===0)return n;let r=n,p=a.middleware.filter((w)=>w.timing===h);if(p.length===0)return r;for(let w of p){if(!w.name||typeof w.handler!=="function"){if(a.debug)console.warn("Invalid middleware:",w);continue}try{let b=await w.handler(r,e,l,a);if(typeof b==="string")r=b;else if(a.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(b){if(a.debug)console.error(`Error in middleware ${w.name}:`,b);if(a.debug){let S=y("Middleware",`Error in middleware '${w.name}': ${b instanceof Error?b.message:String(b)}`,l,n);r=r.replace(/<body[^>]*>/,`$&
@@ -1295,33 +1295,33 @@ ${L}
1295
1295
  </style>`;a=a.replace(S,j),w.lastIndex=0}catch(L){}}}return a}import lt from"path";var Kn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Gn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Zn(n,e){if(!e||!n.includes("/"))return n;let l=lt.dirname(e);return n.replace(Kn,(a,h,r,p)=>{let w=lt.resolve(l,p);return`${h}${r}${w.split(lt.sep).join("/")}${r}`})}function fr(n,e){if(!e||!n.includes("<script"))return n;return n.replace(Gn,(l,a,h,r)=>`${a}${Zn(h,e)}${r}`)}var Me="<!--PARENT_CONTENT_PLACEHOLDER-->";function hr(n){return n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Cr(n,e){let l=n.length,a=e,h=!0,r=[],p=(w)=>w+9<=l&&n[w]==="<"&&n[w+1]==="/"&&(n[w+2]==="s"||n[w+2]==="S")&&(n[w+3]==="c"||n[w+3]==="C")&&(n[w+4]==="r"||n[w+4]==="R")&&(n[w+5]==="i"||n[w+5]==="I")&&(n[w+6]==="p"||n[w+6]==="P")&&(n[w+7]==="t"||n[w+7]==="T")&&(n[w+8]===">"||/\s/.test(n[w+8]));while(a<l){let w=n[a];if(p(a))return a;if(w==="/"&&n[a+1]==="/"){if(a=n.indexOf(`
1296
1296
  `,a+2),a===-1)return-1;a+=1,h=!0;continue}if(w==="/"&&n[a+1]==="*"){let b=n.indexOf("*/",a+2);if(b===-1)return-1;a=b+2,h=!0;continue}if(w==="/"&&h){let b=a+1,S=!1;while(b<l){let v=n[b];if(v==="\\"){b+=2;continue}if(v==="[")S=!0;else if(v==="]")S=!1;else if(v==="/"&&!S){b++;break}else if(v===`
1297
1297
  `){b=-1;break}b++}if(b===-1){a++,h=!1;continue}while(b<l&&/[a-z]/.test(n[b]))b++;a=b,h=!1;continue}if(w==="'"||w==='"'){let b=w;a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]===b){a++;break}if(n[a]===`
1298
- `)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}if(r.length===0)h=!1;continue}if(w==="}"&&r.length>0){r.pop(),a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,h=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function _r(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let h=a.index+a[0].length,r=n.indexOf("</script>",h);if(r===-1)return null;let p=n.indexOf(">",r);if(p===-1)return null;return{start:a.index,end:p+1}}var Qn=4096;async function ut(n,e,l){if(l.buildMode!=="serve"||e.length<Qn)return null;let{registerServeModuleBundle:a}=await import("./chunk-ms60vwmg.js");return`<script ${n} src="${a(e)}"></script>`}async function cr(n,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:r}=await o("stx/client-module-registry",()=>import("./chunk-6npyrm89.js")),p=[],w=await r(h(...n),{minify:Bi(e.buildMode,e.minifyClient),collectInputs:p});for(let b of p)l?.add(b);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:b}=await import("./chunk-ms60vwmg.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${b(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Yn(n,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:C}=await o("stx/framework-composables",()=>import("./chunk-a7drjyq6.js"));h.frameworkScript=await C(n)}catch{}let r=null;try{r=await o("stx/store-loader",()=>import("./chunk-bz52y1cb.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(r?.pageStoresAll()??!0),b=w?"":n.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),S=[],v=[],k=null;for(let C=0;C<8;C++){let _=null,P="",I=!1;try{if(r){let F=w?await r.getStoreScript(p).then((q)=>q?{code:q,stores:["*"],functions:null}:null):await r.getStoreScriptFor(p,[b],{reads:r.storesReadInFiles([...S,...v]),runOnce:!0});if(F)_=F.code,P=F.stores.join(","),I=!!F.functions&&!w}}catch{}if(k!==null&&P===k)break;k=P;let L=I?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",j=_?`<script ${L}>${_}</script>`:null;h.storeCode=_,h.storeTag=_?await ut(L,_,e)??j:null;let B={};h.modulesTag=await cr([n,j],e,l,B),h.modulesCode=B.code??null,S=B.inputs??[],h.composableTag=null,h.composableCode=null,v=[];try{let{getComposableScript:F}=await o("stx/composable-loader",()=>import("./chunk-n1g75yxa.js")),q=e.composablesDir,H=[h.modulesCode??h.modulesTag,j,h.frameworkScript].filter((U)=>U!==null),N=await F(e._layerComposableDirs??q,n,H,v);if(N)h.composableCode=N,h.composableTag=await ut('data-stx-scoped data-stx-run="always" data-stx-composables',N,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${N}</script>`}catch{}if(w||!r)break}return h}async function es(n,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:r}=await import("./chunk-sghbhdtj.js"),p=await import("./chunk-m9cperj4.js"),{messages:w,webModules:b}=e,S=null,v=null,k=r()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{S=await p.loadPageMessages(process.cwd(),w)}catch(L){ts(L)}if(b&&Object.keys(b).length&&k)try{v=await(await import("./chunk-8hhhmscy.js")).loadWebModules(process.cwd(),b)}catch(L){rs(L)}let C=new Map([...v??[],...S?.stubs??[]]),_=()=>Yn(n,e,l,a),P=C.size?await h(C,_):await _(),I=null;if(S){let L=p.messageAreasIn(P.modulesCode,P.storeCode,P.composableCode),j=p.pageMessagesScript(S,p.pageLanguages(n,S),L);if(j)I=await ut('data-stx-scoped data-stx-run="always" data-stx-messages',j,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${j.replace(/<\/script/gi,"<\\/script")}</script>`}return[I,P.modulesTag,P.storeTag,P.composableTag,P.frameworkScript].filter((L)=>L!==null)}var yr=!1;function ts(n){if(yr)return;yr=!0,console.warn(`[stx] messages: ${n instanceof Error?n.message:String(n)}; pages ship every language`)}var wr=!1;function rs(n){if(wr)return;wr=!0,console.warn(`[stx] ${n instanceof Error?n.message:String(n)}; pages bundle the real modules`)}function ns(n,e=""){let l=_r(n,"data-stx-runtime");if(!l)return n;let a=gr(n);if(a===-1||a===l.start){if(!e)return n;return n.slice(0,l.end)+e+n.slice(l.end)}if(a<l.start)return n.slice(0,a)+n.slice(l.start,l.end)+e+`
1298
+ `)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}if(r.length===0)h=!1;continue}if(w==="}"&&r.length>0){r.pop(),a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,h=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function _r(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let h=a.index+a[0].length,r=n.indexOf("</script>",h);if(r===-1)return null;let p=n.indexOf(">",r);if(p===-1)return null;return{start:a.index,end:p+1}}var Qn=4096;async function ut(n,e,l){if(l.buildMode!=="serve"||e.length<Qn)return null;let{registerServeModuleBundle:a}=await import("./chunk-v4ab2jzz.js");return`<script ${n} src="${a(e)}"></script>`}async function cr(n,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:r}=await o("stx/client-module-registry",()=>import("./chunk-my6tp8rn.js")),p=[],w=await r(h(...n),{minify:Bi(e.buildMode,e.minifyClient),collectInputs:p});for(let b of p)l?.add(b);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:b}=await import("./chunk-v4ab2jzz.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${b(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Yn(n,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:C}=await o("stx/framework-composables",()=>import("./chunk-kzhget9h.js"));h.frameworkScript=await C(n)}catch{}let r=null;try{r=await o("stx/store-loader",()=>import("./chunk-tfsf9pes.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(r?.pageStoresAll()??!0),b=w?"":n.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),S=[],v=[],k=null;for(let C=0;C<8;C++){let _=null,P="",I=!1;try{if(r){let F=w?await r.getStoreScript(p).then((q)=>q?{code:q,stores:["*"],functions:null}:null):await r.getStoreScriptFor(p,[b],{reads:r.storesReadInFiles([...S,...v]),runOnce:!0});if(F)_=F.code,P=F.stores.join(","),I=!!F.functions&&!w}}catch{}if(k!==null&&P===k)break;k=P;let L=I?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",j=_?`<script ${L}>${_}</script>`:null;h.storeCode=_,h.storeTag=_?await ut(L,_,e)??j:null;let B={};h.modulesTag=await cr([n,j],e,l,B),h.modulesCode=B.code??null,S=B.inputs??[],h.composableTag=null,h.composableCode=null,v=[];try{let{getComposableScript:F}=await o("stx/composable-loader",()=>import("./chunk-7mqnbn1x.js")),q=e.composablesDir,H=[h.modulesCode??h.modulesTag,j,h.frameworkScript].filter((U)=>U!==null),N=await F(e._layerComposableDirs??q,n,H,v);if(N)h.composableCode=N,h.composableTag=await ut('data-stx-scoped data-stx-run="always" data-stx-composables',N,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${N}</script>`}catch{}if(w||!r)break}return h}async function es(n,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:r}=await import("./chunk-qk1fkfvj.js"),p=await import("./chunk-m9cperj4.js"),{messages:w,webModules:b}=e,S=null,v=null,k=r()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{S=await p.loadPageMessages(process.cwd(),w)}catch(L){ts(L)}if(b&&Object.keys(b).length&&k)try{v=await(await import("./chunk-8hhhmscy.js")).loadWebModules(process.cwd(),b)}catch(L){rs(L)}let C=new Map([...v??[],...S?.stubs??[]]),_=()=>Yn(n,e,l,a),P=C.size?await h(C,_):await _(),I=null;if(S){let L=p.messageAreasIn(P.modulesCode,P.storeCode,P.composableCode),j=p.pageMessagesScript(S,p.pageLanguages(n,S),L);if(j)I=await ut('data-stx-scoped data-stx-run="always" data-stx-messages',j,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${j.replace(/<\/script/gi,"<\\/script")}</script>`}return[I,P.modulesTag,P.storeTag,P.composableTag,P.frameworkScript].filter((L)=>L!==null)}var yr=!1;function ts(n){if(yr)return;yr=!0,console.warn(`[stx] messages: ${n instanceof Error?n.message:String(n)}; pages ship every language`)}var wr=!1;function rs(n){if(wr)return;wr=!0,console.warn(`[stx] ${n instanceof Error?n.message:String(n)}; pages bundle the real modules`)}function ns(n,e=""){let l=_r(n,"data-stx-runtime");if(!l)return n;let a=gr(n);if(a===-1||a===l.start){if(!e)return n;return n.slice(0,l.end)+e+n.slice(l.end)}if(a<l.start)return n.slice(0,a)+n.slice(l.start,l.end)+e+`
1299
1299
  `+n.slice(a,l.start)+n.slice(l.end);let h=n.slice(l.start,l.end),r=n.slice(0,l.start)+n.slice(l.end),p=gr(r);if(p===-1)return h+e+`
1300
1300
  `+r;return r.slice(0,p)+h+e+`
1301
- `+r.slice(p)}function ss(n){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return n.replace(e,(l,a,h)=>{let r=n.slice(0,h);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(n,e,l,a,h){if(await E(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return n;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Te(n,l);let r=!e.__stxProcessingDepth;xn(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(r&&a.runtimeConfig)await Tn(e,l,a.runtimeConfig);if(r)rl(e),e.__stx_scope_seq??={n:0,key:Js(String(e.__filename??l))},e.__stx_head_injections=Mi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!A()&&!Pn())&&l&&l.endsWith(".stx"))Vo(n,l);try{return await fe.timeAsync("template-processing",async()=>{let p=await is(n,e,l,a,h);if(r)p=ki(p);if(r&&a.autoShell&&a.buildMode!=="compile"){let w=Re(a.app?.head,{known:Br,source:"app.head"}),S=(e.__stx_runtime_head||null)??ji(),v=(e.__stx_head_raw||"").trim(),k,C=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(C)k=C[1].trim(),v=v.replace(C[0],"").trim();let _=e.__sections?.title,P=_?R(_,e,l):void 0,I=S.title||k||P,L=!S.title&&(!!k||!!P),j=S.meta||[],B=new Set(j.map((K)=>pt(K)).filter(Boolean)),F={...w,...I&&{title:I},meta:[...(w.meta||[]).filter((K)=>!B.has(pt(K))),...j],link:[...w.link||[],...S.link||[]],script:[...w.script||[],...S.script||[]],headRaw:[w.headRaw,v].filter(Boolean).join(`
1302
- `),...S.htmlAttrs&&{htmlAttrs:vl(w.htmlAttrs,S.htmlAttrs)},...S.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...S.bodyAttrs}}},q=Li(p);if(p=Lr(p,F,{...L&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},q),q)p=Sl(p,w),p=Mr(p,F.htmlAttrs);let H=p.match(/<!-- stx-layout: ([^ ]+) -->/);if(H&&p.includes("<head")){let K=H[1],le=Ls(K);p=p.replace(/<head\b[^>]*>/i,(Z)=>`${Z}
1301
+ `+r.slice(p)}function ss(n){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return n.replace(e,(l,a,h)=>{let r=n.slice(0,h);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(n,e,l,a,h){if(await E(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return n;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Te(n,l);let r=!e.__stxProcessingDepth;xn(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(r&&a.runtimeConfig)await Tn(e,l,a.runtimeConfig);if(r)rl(e),e.__stx_scope_seq??={n:0,key:Js(String(e.__filename??l))},e.__stx_head_injections=Mi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!A()&&!Pn())&&l&&l.endsWith(".stx"))Vo(n,l);try{return await ge.timeAsync("template-processing",async()=>{let p=await is(n,e,l,a,h);if(r)p=ki(p);if(r&&a.autoShell&&a.buildMode!=="compile"){let w=Re(a.app?.head,{known:Br,source:"app.head"}),S=(e.__stx_runtime_head||null)??ji(),v=(e.__stx_head_raw||"").trim(),k,C=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(C)k=C[1].trim(),v=v.replace(C[0],"").trim();let _=e.__sections?.title,P=_?R(_,e,l):void 0,I=S.title||k||P,L=!S.title&&(!!k||!!P),j=S.meta||[],B=new Set(j.map((K)=>pt(K)).filter(Boolean)),F={...w,...I&&{title:I},meta:[...(w.meta||[]).filter((K)=>!B.has(pt(K))),...j],link:[...w.link||[],...S.link||[]],script:[...w.script||[],...S.script||[]],headRaw:[w.headRaw,v].filter(Boolean).join(`
1302
+ `),...S.htmlAttrs&&{htmlAttrs:vl(w.htmlAttrs,S.htmlAttrs)},...S.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...S.bodyAttrs}}},q=Li(p);if(p=Lr(p,F,{...L&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},q),q)p=Sl(p,w),p=Mr(p,F.htmlAttrs);let H=p.match(/<!-- stx-layout: ([^ ]+) -->/);if(H&&p.includes("<head")){let K=H[1],le=Ls(K);p=p.replace(/<head\b[^>]*>/i,(J)=>`${J}
1303
1303
  <meta name="stx-layout" content="${hr(K)}">
1304
- <meta name="stx-layout-group" content="${hr(le)}">`)}let N=p.match(/function (__stx_setup_\w+)\(/),U=N?V(p):null;if(N&&U&&!/\bdata-stx=/.test(U.tag)){p=nt(p,(le,Z)=>`<body${Z} data-stx="${N[1]}">`);let K=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${N[1]}"`,"i");p=p.replace(K,"$1")}}if(r){let w=e.__stx_head_injections??Mi(),b=xl(p);if(b!==null)w.beforeClose.push(b);let S=or(p);if(S!==null)w.afterOpen.push(S);if(a.offline?.enabled&&!p.includes("data-stx-offline"))w.beforeClose.push(ar);p=bl(p,w);let v=a.app?.colorMode;if(v)p=Dr(p,v)}if(r)if(_r(p,"data-stx-runtime")){let b=await es(p,a,h,e);p=ns(p,b.map((S)=>`
1304
+ <meta name="stx-layout-group" content="${hr(le)}">`)}let N=p.match(/function (__stx_setup_\w+)\(/),U=N?V(p):null;if(N&&U&&!/\bdata-stx=/.test(U.tag)){p=nt(p,(le,J)=>`<body${J} data-stx="${N[1]}">`);let K=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${N[1]}"`,"i");p=p.replace(K,"$1")}}if(r){let w=e.__stx_head_injections??Mi(),b=xl(p);if(b!==null)w.beforeClose.push(b);let S=or(p);if(S!==null)w.afterOpen.push(S);if(a.offline?.enabled&&!p.includes("data-stx-offline"))w.beforeClose.push(ar);p=bl(p,w);let v=a.app?.colorMode;if(v)p=Dr(p,v)}if(r)if(_r(p,"data-stx-runtime")){let b=await es(p,a,h,e);p=ns(p,b.map((S)=>`
1305
1305
  ${S}`).join(""))}else{let b=await cr([p],a,h);if(b){let S=p.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(S!==-1)p=p.slice(0,S)+b+`
1306
- `+p.slice(S)}}if(r)p=wl(p);if(r&&e.__stx_inject_css!==!1)p=await x(p,void 0,a.buildMode==="serve",!0);else if(r)p=wn(p);if(r)p=mt(p);if(p=p.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),p=ss(p),r&&e.__stx_runtime_config)p=Ht(p,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let w=Pr(e);if(w){let b=/<head\b[^>]*>/i.exec(p),S=b?b.index+b[0].length:0;p=p.slice(0,S)+w+p.slice(S)}}return p})}catch(p){if(p instanceof Y)throw p;let w=p instanceof Error?p.message:String(p),b=new se(`Template processing failed: ${w}`,l,void 0,void 0,n.substring(0,200)+(n.length>200?"...":""));if(W.log(b,{filePath:l,context:e}),Rn.logDetailedError(b,{filePath:l,template:n.substring(0,500)}),A()&&!a.debug)console.error(`[stx] ${ae.relative(process.cwd(),l)||l}: ${b.message}`);if(a.debug)throw b;return Ni.createFallbackContent("Template Processing",b)}}async function is(n,e,l,a,h){let r=process.cwd(),p={...a,partialsDir:a.partialsDir&&!ae.isAbsolute(a.partialsDir)?ae.resolve(r,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!ae.isAbsolute(a.componentsDir)?ae.resolve(r,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!ae.isAbsolute(a.layoutsDir)?ae.resolve(r,a.layoutsDir):a.layoutsDir},w=p,b=n;await cs(l,e),as(e,w),b=await $e(()=>Zt(b,e,l,w),b,(H)=>{W.log(H,{filePath:l,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${l}: ${H.message}`)}),b=b.replace(/\{\{--[\s\S]*?--\}\}/g,"");let S=ye(b,Be,(H,N)=>`\x00STX_HTML_COMMENT_${N}\x00`);b=S.output;let v=S.tokens,k=(H)=>v.length===0?H:H.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(N,U)=>v[Number(U)]??""),C="\x00STX_ESCAPED_AT\x00",_="\x00STX_ESC_MUSTACHE_OPEN\x00",P="\x00STX_ESC_MUSTACHE_CLOSE\x00";b=b.replace(/@@/g,C),b=b.replace(/@\{\{([\s\S]*?)\}\}/g,(H,N)=>`${_}${N}${P}`),b=tr(b),b=await pr(b,l,h);let I={};b=ms(b,I);let L={...e.__sections||{}},j="",B=xt(kt(n)),F=/@nolayout\b/.test(b)||B===!1;if(/@nolayout\b/.test(b))b=b.replace(/@nolayout\b\s*/g,"");let q=b.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(q)j=q[1],b=b.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof B==="string"){if(j=B,!/@section\s*\(/.test(b))b=`@section('content')
1306
+ `+p.slice(S)}}if(r)p=wl(p);if(r&&e.__stx_inject_css!==!1)p=await x(p,void 0,a.buildMode==="serve",!0);else if(r)p=wn(p);if(r)p=mt(p);if(p=p.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),p=ss(p),r&&e.__stx_runtime_config)p=Ht(p,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let w=Pr(e);if(w){let b=/<head\b[^>]*>/i.exec(p),S=b?b.index+b[0].length:0;p=p.slice(0,S)+w+p.slice(S)}}return p})}catch(p){if(p instanceof Z)throw p;let w=p instanceof Error?p.message:String(p),b=new oe(`Template processing failed: ${w}`,l,void 0,void 0,n.substring(0,200)+(n.length>200?"...":""));if(W.log(b,{filePath:l,context:e}),Rn.logDetailedError(b,{filePath:l,template:n.substring(0,500)}),A()&&!a.debug)console.error(`[stx] ${ae.relative(process.cwd(),l)||l}: ${b.message}`);if(a.debug)throw b;return Ni.createFallbackContent("Template Processing",b)}}async function is(n,e,l,a,h){let r=process.cwd(),p={...a,partialsDir:a.partialsDir&&!ae.isAbsolute(a.partialsDir)?ae.resolve(r,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!ae.isAbsolute(a.componentsDir)?ae.resolve(r,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!ae.isAbsolute(a.layoutsDir)?ae.resolve(r,a.layoutsDir):a.layoutsDir},w=p,b=n;await cs(l,e),as(e,w),b=await $e(()=>Zt(b,e,l,w),b,(H)=>{W.log(H,{filePath:l,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${l}: ${H.message}`)}),b=b.replace(/\{\{--[\s\S]*?--\}\}/g,"");let S=be(b,Be,(H,N)=>`\x00STX_HTML_COMMENT_${N}\x00`);b=S.output;let v=S.tokens,k=(H)=>v.length===0?H:H.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(N,U)=>v[Number(U)]??""),C="\x00STX_ESCAPED_AT\x00",_="\x00STX_ESC_MUSTACHE_OPEN\x00",P="\x00STX_ESC_MUSTACHE_CLOSE\x00";b=b.replace(/@@/g,C),b=b.replace(/@\{\{([\s\S]*?)\}\}/g,(H,N)=>`${_}${N}${P}`),b=tr(b),b=await pr(b,l,h);let I={};b=ms(b,I);let L={...e.__sections||{}},j="",B=xt(kt(n)),F=/@nolayout\b/.test(b)||B===!1;if(/@nolayout\b/.test(b))b=b.replace(/@nolayout\b\s*/g,"");let q=b.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(q)j=q[1],b=b.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof B==="string"){if(j=B,!/@section\s*\(/.test(b))b=`@section('content')
1307
1307
  ${b.trim()}
1308
- @endsection`}if(!j&&!F&&w.defaultLayout){let H=An(b),N=/@section\s*\(/.test(b);if(!H||N){let U="",K=ae.dirname(l),le=w.layoutsDir?ae.dirname(w.layoutsDir):process.cwd();for(let Z=0;Z<20;Z++){let de=ae.join(K,"_layout.stx");if(await s(de)){U=de;break}let ce=ae.dirname(K);if(ce===K||ce.length<le.length)break;K=ce}if(U)j=U;else if(w.layoutsDir){let Z=ae.isAbsolute(w.layoutsDir)?w.layoutsDir:ae.resolve(process.cwd(),w.layoutsDir),de=ae.join(Z,`${w.defaultLayout}.stx`);if(await s(de))j=de}if(j&&!N)b=`@section('content')
1308
+ @endsection`}if(!j&&!F&&w.defaultLayout){let H=An(b),N=/@section\s*\(/.test(b);if(!H||N){let U="",K=ae.dirname(l),le=w.layoutsDir?ae.dirname(w.layoutsDir):process.cwd();for(let J=0;J<20;J++){let ue=ae.join(K,"_layout.stx");if(await s(ue)){U=ue;break}let ce=ae.dirname(K);if(ce===K||ce.length<le.length)break;K=ce}if(U)j=U;else if(w.layoutsDir){let J=ae.isAbsolute(w.layoutsDir)?w.layoutsDir:ae.resolve(process.cwd(),w.layoutsDir),ue=ae.join(J,`${w.defaultLayout}.stx`);if(await s(ue))j=ue}if(j&&!N)b=`@section('content')
1309
1309
  ${b.trim()}
1310
- @endsection`}}if(j&&b.includes("<script")){let H=ee(b),N=H.scripts.map((U)=>vr(U,l)??U);b=Er(H.output,N)}if(b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,N,U)=>(L[N]=U,"")),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(H,N,U)=>{if(/^(['"]).*\1$/.test(U.trim()))return H;try{let K=d(U.trim(),e);if(K===void 0)return H;let Z=(e.__stx_inline_section_values??=[]).push(K)-1;return L[N]=`{{ __stx_inline_section_values[${Z}] }}`,""}catch{return H}}),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(H,N,U)=>{if(U.includes("@parent"))L[N]=U.replace("@parent",Me);else L[N]=U.trim();return""}),e.__sections=L,b=b.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(H,N,U)=>L[N]||U||""),!("slot"in e)||e.slot===void 0)b=b.replace(/\{\{\s*slot\s*\}\}/g,()=>L.content||"");if(b=hs(b,I),j){let H=[],N=ee(b),U=ye(N.output,bn,(K,le)=>`\x00STX_ORPHAN_STYLE_${le}\x00`);if(b=U.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(K,le,Z)=>{let de=le==="SCRIPT"?vr(N.scripts[Number(Z)],l):U.tokens[Number(Z)];if(de)H.push(de);return""}),H.length>0){let K=H.join(`
1310
+ @endsection`}}if(j&&b.includes("<script")){let H=te(b),N=H.scripts.map((U)=>vr(U,l)??U);b=Er(H.output,N)}if(b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,N,U)=>(L[N]=U,"")),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(H,N,U)=>{if(/^(['"]).*\1$/.test(U.trim()))return H;try{let K=d(U.trim(),e);if(K===void 0)return H;let J=(e.__stx_inline_section_values??=[]).push(K)-1;return L[N]=`{{ __stx_inline_section_values[${J}] }}`,""}catch{return H}}),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(H,N,U)=>{if(U.includes("@parent"))L[N]=U.replace("@parent",Me);else L[N]=U.trim();return""}),e.__sections=L,b=b.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(H,N,U)=>L[N]||U||""),!("slot"in e)||e.slot===void 0)b=b.replace(/\{\{\s*slot\s*\}\}/g,()=>L.content||"");if(b=hs(b,I),j){let H=[],N=te(b),U=be(N.output,bn,(K,le)=>`\x00STX_ORPHAN_STYLE_${le}\x00`);if(b=U.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(K,le,J)=>{let ue=le==="SCRIPT"?vr(N.scripts[Number(J)],l):U.tokens[Number(J)];if(ue)H.push(ue);return""}),H.length>0){let K=H.join(`
1311
1311
  `);L.content=L.content?`${L.content}
1312
- ${K}`:K,e.__sections=L}}if(j)try{let H;if(ae.isAbsolute(j))H=j,h.add(j);else H=await $e(()=>_n(j,l,p,h),null,()=>{throw new se(`Failed to resolve layout path: ${j}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!H){let ce=(J)=>{if(!J)return[];try{let ve=ae.isAbsolute(J)?J:ae.resolve(process.cwd(),J);return Jn.readdirSync(ve).filter((Ee)=>Ee.endsWith(".stx")).map((Ee)=>Ee.replace(/\.stx$/,""))}catch{return[]}},ne=[...ce(p.layoutsDir),...ce(p.fallbackLayoutsDir)].filter((J,ve,Ee)=>Ee.indexOf(J)===ve).sort(),we=[p.layoutsDir,p.fallbackLayoutsDir].filter((J)=>typeof J==="string"&&J.length>0),ge=we.length>0?` Searched: ${we.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ie=`Layout not found: ${j} (referenced from ${l})`+(ne.length>0?`. Available layouts: ${ne.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"")+ge;if(W.log(Error(ie),{layoutPath:j,filePath:l,available:ne},"error"),console.error(`[stx] ${ie}`),p.debug)throw new se(ie,l);return b}let N=await $e(()=>Bun.file(H).text(),"",()=>{throw new se(`Failed to read layout file: ${H}`,l,void 0,void 0,"Layout content could not be loaded")});N=fr(N,H),N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(U.includes(H)){let ce=[...U.slice(U.indexOf(H)),H];throw new se(ce.length===2?`Circular layout: ${H} extends itself`:`Circular layout: ${ce.join(" -> ")}`,l,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let K=N.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(K){if(p.debug)console.log(`Found nested layout: ${K[1]} in ${H}`);let ce={},ne=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,J,ve)=>(ce[J]=ve.trim(),""));for(let[ie,J]of Object.entries(ce))if(L[ie]&&L[ie].includes(Me)){let ve=L[ie].indexOf(Me);L[ie]=L[ie].slice(0,ve)+J+L[ie].slice(ve+Me.length)}else if(!L[ie])L[ie]=J;let we={...e,__sections:L,__layoutChain:[...U,H]},ge=`@layout('${K[1]}')${ne}`;return await i(ge,we,H,p,h)}let le=N.replace(/\{\{--[\s\S]*?--\}\}/g,""),Z=ms(le,I),de={};return Z=Z.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ce,ne,we)=>(de[ne]=we.trim(),`@slot('${ne}')`)),Z=Z.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ce,ne,we)=>{if(L[ne]){let ge=L[ne];if(ge.includes(Me)){let ie=de[ne]||"",J=ge.indexOf(Me);ge=ge.slice(0,J)+ie+ge.slice(J+Me.length)}return ge}return we||""}),Z=os(Z,L),Z=Z.replace(/\{\{\s*slot\s*\}\}/g,()=>L.content||""),Z=hs(Z,I),e.__originalFilePath=l,b=await $r(Z,e,H,p,h),b=`<!-- stx-layout: ${j} -->
1313
- ${b}`,k(b)}catch(H){if(H instanceof Y)throw H;throw new se(`Error processing layout ${j}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await $r(b,e,l,p,h))}function os(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return h||""})}function as(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,r]of Object.entries(process.env))if(h.startsWith(l)&&r!==void 0)a[h]=r;n.$env=a}async function cs(n,e){await $e(()=>Yt(n,e),void 0,(l)=>{W.log(l,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${l.message}`)})}var dt="data-stx-source";function vr(n,e){if(!n)return n;let l=/^<script\b([^>]*)>/i.exec(n);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(dt))return n;return`<script ${dt}="${encodeURIComponent(e)}"${n.slice(7)}`}function ls(n){let e=new RegExp(`${dt}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function kr(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Sr(n,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${kr(n)}</span><span style="display:block;margin-top:4px">${kr(l)}</span></div>`}async function us(n,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-2pt2feg2.js")),r=[],p=!A()&&!Pn();for(let b of h(n)){let S=b.attrs;if(!/\bserver\b/.test(S))continue;let v=b.start+b.fullMatch.indexOf(">")+1,k=Cr(n,v);if(k===-1)continue;let C=n.slice(v,k);if(!C.trim())continue;let _=ls(S)??l,P={index:b.start,length:k+9-b.start};try{let{extractVariables:I}=await o("stx/variable-extractor",()=>import("./chunk-teasmth3.js"));await I(C,e,_,{preserveExisting:!0,onFailure:(L)=>{if(L.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:_,kind:L.kind,message:L.message}),!p)return;r.push({...P,markup:Sr(_,L.kind,L.message)})}})}catch(I){let L=I instanceof Error?I:Error(String(I));if(W.log(L,{filePath:_,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${_}: ${L.message}`),p)r.push({...P,markup:Sr(_,"unknown",L.message)})}}if(r.length===0)return n;let w=n;for(let b of r.sort((S,v)=>v.index-S.index))w=w.slice(0,b.index)+b.markup+w.slice(b.index+b.length);return w}async function ds(n,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-34mx6czk.js"));return a(n,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return W.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),n}}async function $r(n,e,l,a,h){let r=n;await E();let p=a;if(r=await us(r,e,l,a),r=await Wt(r,e,l),r=await Xt(r,e,l),r=await ds(r,e,l),await E(),r=await Dt(r,e,l,p),Te(r))r=Zo(r,e),r=ks(r,e),r=Ss(r,e);r=Qo(r),await E();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-ax0ntjxy.js"));r=w(r,e),r=await Ko(r,e,l,p,!0),await E(),r=await ir(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=Cc(r,e,l,p);let{processDeferDirectives:b}=await o("stx/defer",()=>import("./chunk-6pczzq5f.js"));r=b(r,e,l);let{processTeleportDirectives:S}=await o("stx/teleport",()=>import("./chunk-ba91r7q9.js"));r=S(r,e,l);let{processTransitionDirectives:v,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-7wqevtks.js"));r=v(r,e,l),r=k(r);let{processErrorBoundaryDirectives:C,stripRenderFailedMarkers:_}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=C(r,e,l),r=_(r);let{processSuspenseDirectives:P}=await o("stx/suspense",()=>import("./chunk-j4zrq17p.js"));r=P(r,e,l);let{processAsyncDirectives:I}=await o("stx/async-components",()=>import("./chunk-f52b9hjv.js"));r=I(r,e,l);let{processKeepAliveDirectives:L}=await o("stx/keep-alive",()=>import("./chunk-meqsd5bt.js"));r=L(r,e,l);let{processVirtualListDirectives:j,processVirtualGridDirectives:B,processInfiniteListDirectives:F}=await o("stx/virtual-scrolling",()=>import("./chunk-2asyyky3.js"));r=j(r,e,l),r=B(r,e,l),r=F(r,e,l),await E();let{processPartialHydrationDirectives:q,processStaticDirectives:H}=await o("stx/partial-hydration",()=>import("./chunk-73k579v7.js"));r=q(r,e,l),r=H(r);let{processComputedDirectives:N,processWatchDirectives:U}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=N(r,e,l),r=U(r,e,l);let{processFormValidationDirectives:K}=await o("stx/forms-validation",()=>import("./chunk-q28q8w89.js"));r=K(r,e,l);let{processHeadDirective:le,processTitleDirective:Z,processMetaDirective:de,resetHead:ce}=await o("stx/head",()=>import("./chunk-jz76vn4n.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ce();let ne=le(r);if(r=ne.content,ne.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ne.headContent}
1314
- `;if(r=Z(r,e),r=de(r,e,l),r=Qt(r),r=Xo(r,e),r=Mt(r),r=Kt(r),r=await gs(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=ki(r),r=ue(r,e,l),r=ws(r),await E(),e.__stxProcessingDepth===1)r=sl(r,e);if(r=Zc(r,e,{filePath:l,buildMode:p.buildMode}),r=Go(r,e),r=Jo(r,e),r=Ze(r,e),r=Ft(r,e),r=Ut(r,e),r=await St(r,e,l,p),r=await Tc(r,e,l),r=await Rc(r,e,l,p),await E(),r=Ac(r,e,l,p),r=ii(r,e,l,p),r=ai(r,e,l),r=ci(r,e,l,p),r=At(r,e,l,p),r=Xs(r,e),r=Gs(r),r=el(r),!p.skipEventDirectives)r=Hc(r,e,l);if(r=Qc(r,e,l,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await E(),p.debug){let X=/\bx-data\s*=/.test(r),z=xs(n);if(X&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
1312
+ ${K}`:K,e.__sections=L}}if(j)try{let H;if(ae.isAbsolute(j))H=j,h.add(j);else H=await $e(()=>_n(j,l,p,h),null,()=>{throw new oe(`Failed to resolve layout path: ${j}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!H){let ce=(Q)=>{if(!Q)return[];try{let ve=ae.isAbsolute(Q)?Q:ae.resolve(process.cwd(),Q);return Jn.readdirSync(ve).filter((Ee)=>Ee.endsWith(".stx")).map((Ee)=>Ee.replace(/\.stx$/,""))}catch{return[]}},re=[...ce(p.layoutsDir),...ce(p.fallbackLayoutsDir)].filter((Q,ve,Ee)=>Ee.indexOf(Q)===ve).sort(),we=[p.layoutsDir,p.fallbackLayoutsDir].filter((Q)=>typeof Q==="string"&&Q.length>0),fe=we.length>0?` Searched: ${we.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ne=`Layout not found: ${j} (referenced from ${l})`+(re.length>0?`. Available layouts: ${re.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"")+fe;if(W.log(Error(ne),{layoutPath:j,filePath:l,available:re},"error"),console.error(`[stx] ${ne}`),p.debug)throw new oe(ne,l);return b}let N=await $e(()=>Bun.file(H).text(),"",()=>{throw new oe(`Failed to read layout file: ${H}`,l,void 0,void 0,"Layout content could not be loaded")});N=fr(N,H),N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(U.includes(H)){let ce=[...U.slice(U.indexOf(H)),H];throw new oe(ce.length===2?`Circular layout: ${H} extends itself`:`Circular layout: ${ce.join(" -> ")}`,l,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let K=N.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(K){if(p.debug)console.log(`Found nested layout: ${K[1]} in ${H}`);let ce={},re=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ne,Q,ve)=>(ce[Q]=ve.trim(),""));for(let[ne,Q]of Object.entries(ce))if(L[ne]&&L[ne].includes(Me)){let ve=L[ne].indexOf(Me);L[ne]=L[ne].slice(0,ve)+Q+L[ne].slice(ve+Me.length)}else if(!L[ne])L[ne]=Q;let we={...e,__sections:L,__layoutChain:[...U,H]},fe=`@layout('${K[1]}')${re}`;return await i(fe,we,H,p,h)}let le=N.replace(/\{\{--[\s\S]*?--\}\}/g,""),J=ms(le,I),ue={};return J=J.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ce,re,we)=>(ue[re]=we.trim(),`@slot('${re}')`)),J=J.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ce,re,we)=>{if(L[re]){let fe=L[re];if(fe.includes(Me)){let ne=ue[re]||"",Q=fe.indexOf(Me);fe=fe.slice(0,Q)+ne+fe.slice(Q+Me.length)}return fe}return we||""}),J=os(J,L),J=J.replace(/\{\{\s*slot\s*\}\}/g,()=>L.content||""),J=hs(J,I),e.__originalFilePath=l,b=await $r(J,e,H,p,h),b=`<!-- stx-layout: ${j} -->
1313
+ ${b}`,k(b)}catch(H){if(H instanceof Z)throw H;throw new oe(`Error processing layout ${j}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await $r(b,e,l,p,h))}function os(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return h||""})}function as(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,r]of Object.entries(process.env))if(h.startsWith(l)&&r!==void 0)a[h]=r;n.$env=a}async function cs(n,e){await $e(()=>Yt(n,e),void 0,(l)=>{W.log(l,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${l.message}`)})}var dt="data-stx-source";function vr(n,e){if(!n)return n;let l=/^<script\b([^>]*)>/i.exec(n);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(dt))return n;return`<script ${dt}="${encodeURIComponent(e)}"${n.slice(7)}`}function ls(n){let e=new RegExp(`${dt}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function kr(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Sr(n,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${kr(n)}</span><span style="display:block;margin-top:4px">${kr(l)}</span></div>`}async function us(n,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-pj1znb6y.js")),r=[],p=!A()&&!Pn();for(let b of h(n)){let S=b.attrs;if(!/\bserver\b/.test(S))continue;let v=b.start+b.fullMatch.indexOf(">")+1,k=Cr(n,v);if(k===-1)continue;let C=n.slice(v,k);if(!C.trim())continue;let _=ls(S)??l,P={index:b.start,length:k+9-b.start};try{let{extractVariables:I}=await o("stx/variable-extractor",()=>import("./chunk-teahvty8.js"));await I(C,e,_,{preserveExisting:!0,onFailure:(L)=>{if(L.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:_,kind:L.kind,message:L.message}),!p)return;r.push({...P,markup:Sr(_,L.kind,L.message)})}})}catch(I){let L=I instanceof Error?I:Error(String(I));if(W.log(L,{filePath:_,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${_}: ${L.message}`),p)r.push({...P,markup:Sr(_,"unknown",L.message)})}}if(r.length===0)return n;let w=n;for(let b of r.sort((S,v)=>v.index-S.index))w=w.slice(0,b.index)+b.markup+w.slice(b.index+b.length);return w}async function ds(n,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-f5gg0pxj.js"));return a(n,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return W.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),n}}async function $r(n,e,l,a,h){let r=n;await E();let p=a;if(r=await us(r,e,l,a),r=await Wt(r,e,l),r=await Xt(r,e,l),r=await ds(r,e,l),await E(),r=await Dt(r,e,l,p),Te(r))r=Zo(r,e),r=ks(r,e),r=Ss(r,e);r=Qo(r),await E();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-jkevn2jy.js"));r=w(r,e),r=await Ko(r,e,l,p,!0),await E(),r=await ir(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=Cc(r,e,l,p);let{processDeferDirectives:b}=await o("stx/defer",()=>import("./chunk-6pczzq5f.js"));r=b(r,e,l);let{processTeleportDirectives:S}=await o("stx/teleport",()=>import("./chunk-ba91r7q9.js"));r=S(r,e,l);let{processTransitionDirectives:v,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-7wqevtks.js"));r=v(r,e,l),r=k(r);let{processErrorBoundaryDirectives:C,stripRenderFailedMarkers:_}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=C(r,e,l),r=_(r);let{processSuspenseDirectives:P}=await o("stx/suspense",()=>import("./chunk-j4zrq17p.js"));r=P(r,e,l);let{processAsyncDirectives:I}=await o("stx/async-components",()=>import("./chunk-f52b9hjv.js"));r=I(r,e,l);let{processKeepAliveDirectives:L}=await o("stx/keep-alive",()=>import("./chunk-meqsd5bt.js"));r=L(r,e,l);let{processVirtualListDirectives:j,processVirtualGridDirectives:B,processInfiniteListDirectives:F}=await o("stx/virtual-scrolling",()=>import("./chunk-2asyyky3.js"));r=j(r,e,l),r=B(r,e,l),r=F(r,e,l),await E();let{processPartialHydrationDirectives:q,processStaticDirectives:H}=await o("stx/partial-hydration",()=>import("./chunk-73k579v7.js"));r=q(r,e,l),r=H(r);let{processComputedDirectives:N,processWatchDirectives:U}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=N(r,e,l),r=U(r,e,l);let{processFormValidationDirectives:K}=await o("stx/forms-validation",()=>import("./chunk-bqs9wyje.js"));r=K(r,e,l);let{processHeadDirective:le,processTitleDirective:J,processMetaDirective:ue,resetHead:ce}=await o("stx/head",()=>import("./chunk-4v70bs2q.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ce();let re=le(r);if(r=re.content,re.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${re.headContent}
1314
+ `;if(r=J(r,e),r=ue(r,e,l),r=Qt(r),r=Xo(r,e),r=Mt(r),r=Kt(r),r=await gs(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=ki(r),r=de(r,e,l),r=ws(r),await E(),e.__stxProcessingDepth===1)r=sl(r,e);if(r=Zc(r,e,{filePath:l,buildMode:p.buildMode}),r=Go(r,e),r=Jo(r,e),r=Ze(r,e),r=Ft(r,e),r=Ut(r,e),r=await St(r,e,l,p),r=await Tc(r,e,l),r=await Rc(r,e,l,p),await E(),r=Ac(r,e,l,p),r=ii(r,e,l,p),r=ai(r,e,l),r=ci(r,e,l,p),r=At(r,e,l,p),r=Xs(r,e),r=Gs(r),r=el(r),!p.skipEventDirectives)r=Hc(r,e,l);if(r=Qc(r,e,l,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await E(),p.debug){let X=/\bx-data\s*=/.test(r),z=xs(n);if(X&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
1315
1315
  Both work on the same page, but they manage separate scopes.
1316
- Prefer signals (state/derived/effect) for new components.`)}r=vc(r,e),r=await Ai(r,e,l),await E(),r=tl(r),r=nl(r),r=wt(r);let{processXElementDirectives:we}=await o("stx/x-element",()=>import("./chunk-b666d8m6.js"));r=we(r);let ge=e.__originalFilePath||l,ie=ze(e);if(r=await ei(r,p,ge,ie),await E(),r=jt(r,e),r=await Jt(r,e,l,p),await E(),p.media?.image?.autoSiblings){let X=p.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-ytzzth34.js"));r=await z(r,{publicDir:X})}if(p.seo?.enabled)r=li(r,e,p);let J=(X,z,Q=!0)=>{if(!z)return X;let be=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),oe=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(X),me=oe?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(oe[0]):null;if(be&&oe&&me){if(Q){let De=oe.index+me.index;X=X.slice(0,De)+be[0]+X.slice(De+me[0].length)}if(z=z.replace(be[0],"").trim(),!z)return X}if(/<\/head>/i.test(X))return f(X,z);if(/<head\b[^>]*>/i.test(X))return X.replace(/(<head\b[^>]*>)/i,`$1
1316
+ Prefer signals (state/derived/effect) for new components.`)}r=vc(r,e),r=await Ai(r,e,l),await E(),r=tl(r),r=nl(r),r=wt(r);let{processXElementDirectives:we}=await o("stx/x-element",()=>import("./chunk-b666d8m6.js"));r=we(r);let fe=e.__originalFilePath||l,ne=ze(e);if(r=await ei(r,p,fe,ne),await E(),r=jt(r,e),r=await Jt(r,e,l,p),await E(),p.media?.image?.autoSiblings){let X=p.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-ytzzth34.js"));r=await z(r,{publicDir:X})}if(p.seo?.enabled)r=li(r,e,p);let Q=(X,z,Y=!0)=>{if(!z)return X;let ye=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ie=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(X),me=ie?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ie[0]):null;if(ye&&ie&&me){if(Y){let De=ie.index+me.index;X=X.slice(0,De)+ye[0]+X.slice(De+me[0].length)}if(z=z.replace(ye[0],"").trim(),!z)return X}if(/<\/head>/i.test(X))return f(X,z);if(/<head\b[^>]*>/i.test(X))return X.replace(/(<head\b[^>]*>)/i,`$1
1317
1317
  ${z}`);if(/<html\b[^>]*>/i.test(X))return X.replace(/(<html\b[^>]*>)/i,`$1
1318
1318
  <head>
1319
1319
  ${z}
1320
- </head>`);return X},{renderHead:ve,getHead:Ee}=await o("stx/head",()=>import("./chunk-jz76vn4n.js")),Pe=e.__stx_runtime_head??Ee();if(Pe.title||Pe.meta?.length||Pe.link?.length){let X=ve(Pe);if(X)r=J(r,X)}if(ne.headContent)r=J(r,ne.headContent,!Pe.title);if(p.csp?.enabled&&p.csp.addMetaTag)r=_t(r,p.csp,e);if(p.analytics?.enabled)r=vt(r,p);if(p.heatmap?.enabled)r=Ec(r,p);if(p.pwa?.enabled&&p.pwa.autoInject!==!1){let{injectPwaTags:X}=await o("stx/pwa/inject",()=>import("./chunk-3zm4bwha.js"));r=X(r,p)}let Tr=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(r),Ar=/\bSTX\.\w+/.test(r),Rr=/window\.STX\s*=/.test(r);if(Tr&&Ar&&!Rr){let z=`<script data-stx-scoped data-stx-run="once">
1320
+ </head>`);return X},{renderHead:ve,getHead:Ee}=await o("stx/head",()=>import("./chunk-4v70bs2q.js")),Pe=e.__stx_runtime_head??Ee();if(Pe.title||Pe.meta?.length||Pe.link?.length){let X=ve(Pe);if(X)r=Q(r,X)}if(re.headContent)r=Q(r,re.headContent,!Pe.title);if(p.csp?.enabled&&p.csp.addMetaTag)r=_t(r,p.csp,e);if(p.analytics?.enabled)r=vt(r,p);if(p.heatmap?.enabled)r=Ec(r,p);if(p.pwa?.enabled&&p.pwa.autoInject!==!1){let{injectPwaTags:X}=await o("stx/pwa/inject",()=>import("./chunk-me7cxs0e.js"));r=X(r,p)}let Tr=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(r),Ar=/\bSTX\.\w+/.test(r),Rr=/window\.STX\s*=/.test(r);if(Tr&&Ar&&!Rr){let z=`<script data-stx-scoped data-stx-run="once">
1321
1321
  ${ht()}
1322
- </script>`;if(r.includes("</head>")){let Q=D(r),oe=r.slice(0,Q).indexOf("<script");if(oe!==-1){let me=r.slice(0,oe),De=r.slice(oe);r=me+z+`
1322
+ </script>`;if(r.includes("</head>")){let Y=D(r),ie=r.slice(0,Y).indexOf("<script");if(ie!==-1){let me=r.slice(0,ie),De=r.slice(ie);r=me+z+`
1323
1323
  `+De}else r=f(r,z)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
1324
1324
  ${z}`);else r=z+`
1325
- `+r}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-2pt2feg2.js")),z=[];for(let Q of X(r)){if(!/\bserver\b/i.test(Q.attrs))continue;let be=Q.start+Q.fullMatch.indexOf(">")+1,oe=Cr(r,be);if(oe===-1)continue;let me=oe+9;while(me<r.length&&/\s/.test(r[me]))me++;z.push({start:Q.start,end:me})}if(z.length>0){let Q=Array(z.length+1),be=0;for(let oe=0;oe<z.length;oe++){let{start:me,end:De}=z[oe];Q[oe]=r.slice(be,me),be=De}Q[z.length]=r.slice(be),r=Q.join("")}}let ft=qs(r,l);if(ft.hasScoped)r=ft.html;let Ir=e.__stx_event_bindings||[],Qe=!1,gt=[],Or=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:jr}=await o("stx/signal-processing",()=>import("./chunk-2pt2feg2.js"));for(let X of jr(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))gt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:Q}of gt){Qe=!0;let be=Q;je(Q,l,a.strict,e.__originalFilePath);let oe=await He(Q,{eventBindings:Ir,attrs:z,hasColonDirectives:Or,templateContent:n,filePath:l,projectRoot:process.cwd(),production:Bi(a.buildMode,a.minifyClient),serverData:ie});r=r.replace(X,()=>oe)}if(Qe)e.__stx_event_bindings=[];if(!Qe&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=hi(X);if(z){let Q=c(r);r=Q===-1?r+z:r.slice(0,Q)+z+`
1326
- `+r.slice(Q)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!ke(r)&&Sc(r))r=await mr(r,p);if(r=kc(r),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")r=Tt(r,e.cspNonce);return r}
1325
+ `+r}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-pj1znb6y.js")),z=[];for(let Y of X(r)){if(!/\bserver\b/i.test(Y.attrs))continue;let ye=Y.start+Y.fullMatch.indexOf(">")+1,ie=Cr(r,ye);if(ie===-1)continue;let me=ie+9;while(me<r.length&&/\s/.test(r[me]))me++;z.push({start:Y.start,end:me})}if(z.length>0){let Y=Array(z.length+1),ye=0;for(let ie=0;ie<z.length;ie++){let{start:me,end:De}=z[ie];Y[ie]=r.slice(ye,me),ye=De}Y[z.length]=r.slice(ye),r=Y.join("")}}let ft=qs(r,l);if(ft.hasScoped)r=ft.html;let Ir=e.__stx_event_bindings||[],Qe=!1,gt=[],Or=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:jr}=await o("stx/signal-processing",()=>import("./chunk-pj1znb6y.js"));for(let X of jr(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))gt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:Y}of gt){Qe=!0;let ye=Y;je(Y,l,a.strict,e.__originalFilePath);let ie=await He(Y,{eventBindings:Ir,attrs:z,hasColonDirectives:Or,templateContent:n,filePath:l,projectRoot:process.cwd(),production:Bi(a.buildMode,a.minifyClient),serverData:ne});r=r.replace(X,()=>ie)}if(Qe)e.__stx_event_bindings=[];if(!Qe&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=hi(X);if(z){let Y=c(r);r=Y===-1?r+z:r.slice(0,Y)+z+`
1326
+ `+r.slice(Y)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!ke(r)&&Sc(r))r=await mr(r,p);if(r=kc(r),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")r=Tt(r,e.cspNonce);return r}
1327
1327
  export{kt,Ne,hc,ps,zo,Ho,cr,i};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Sn,mg,hg,yg,bg,wg,h,vg,_i,xg,ol,il}from"./chunk-zebk7htd.js";import"./chunk-3972v2g1.js";import"./chunk-60yppcbb.js";import"./chunk-pffksrxb.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Sn as STX_ENGINE_BINDING_NAMES,_i as convertToCommonJS,ol as extractScriptFromTemplate,h as extractVariables,il as hasVariables,vg as isCompleteImport,wg as isMissingBindingFailure,yg as isModuleResolutionFailure,bg as isSyntaxFailure,xg as splitDeclaration,mg as stripTypeScript,hg as withoutStxReferrer};
2
+ import{Sn,mg,hg,yg,bg,wg,h,vg,_i,xg,ol,il}from"./chunk-pnqdwqw9.js";import"./chunk-mm00bb1p.js";import"./chunk-60yppcbb.js";import"./chunk-csymxc5a.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Sn as STX_ENGINE_BINDING_NAMES,_i as convertToCommonJS,ol as extractScriptFromTemplate,h as extractVariables,il as hasVariables,vg as isCompleteImport,wg as isMissingBindingFailure,yg as isModuleResolutionFailure,bg as isSyntaxFailure,xg as splitDeclaration,mg as stripTypeScript,hg as withoutStxReferrer};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{xh,Co,Sh,kh,_h,Ch}from"./chunk-jf3n1f32.js";import"./chunk-vf91b9b9.js";import"./chunk-kkevjppm.js";import"./chunk-9zrvh3pz.js";import"./chunk-bfvr4byj.js";import"./chunk-4p51hk75.js";import"./chunk-a8164hnf.js";import"./chunk-jcr69v95.js";import"./chunk-6s7q8kw3.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-6mkn81pd.js";import"./chunk-hhbt8grm.js";import"./chunk-pnqdwqw9.js";import"./chunk-mm00bb1p.js";import"./chunk-60yppcbb.js";import"./chunk-csymxc5a.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Ch as clearStoreCache,xh as getStoreScript,_h as getStoreScriptFor,kh as pageStoresAll,Co as storesRead,Sh as storesReadInFiles};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Jh,Yh,Gf,bs}from"./chunk-kx6y1cqw.js";import"./chunk-z0qxrx9r.js";import"./chunk-vvxcebpn.js";import"./chunk-a8164hnf.js";import{Ar}from"./chunk-pnqdwqw9.js";import"./chunk-mm00bb1p.js";import"./chunk-60yppcbb.js";import{ut}from"./chunk-csymxc5a.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{ut as freeIdentifiers,bs as processComponents,Gf as processESImports,Ar as rendersAsElement,Jh as resetMarginStackWarnings,Yh as resetTemplateLoopWarnings};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{La,ja,Ba,Fa,Bh}from"./chunk-9bnggqhj.js";import"./chunk-pywz8q4k.js";import"./chunk-e549f7a9.js";import"./chunk-wk2rge05.js";import"./chunk-tc36b3r4.js";import"./chunk-av2vknrs.js";import"./chunk-s70e5jbq.js";import"./chunk-q1wxgw5s.js";import"./chunk-kx6y1cqw.js";import"./chunk-z0qxrx9r.js";import"./chunk-y48ykf1n.js";import"./chunk-vvxcebpn.js";import"./chunk-bfvr4byj.js";import"./chunk-4p51hk75.js";import"./chunk-a8164hnf.js";import"./chunk-1p9rb7rt.js";import"./chunk-jcr69v95.js";import"./chunk-6s7q8kw3.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-6mkn81pd.js";import"./chunk-hhbt8grm.js";import"./chunk-pnqdwqw9.js";import"./chunk-mm00bb1p.js";import"./chunk-60yppcbb.js";import"./chunk-csymxc5a.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{La as buildNative,Bh as default,ja as findCraftBinary,Fa as getAvailableFormats,Ba as getAvailableTargets};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{eg,Qh,ey,ty,ny,tg,ng,ry,sy,ni,oy,hr,yr,Es}from"./chunk-3z3y475q.js";import{at}from"./chunk-n3jw3xpj.js";import"./chunk-zebk7htd.js";import"./chunk-3972v2g1.js";import"./chunk-60yppcbb.js";import"./chunk-pffksrxb.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{ny as __setSignalsGeneratorsForTest,at as cacheEngineFingerprint,yr as cacheTemplate,hr as checkCache,oy as clearDevCaches,ng as getCachedRouterScript,tg as getCachedSignalsRuntime,ry as getServeClientAsset,ni as getServeModuleBundle,Es as hashFilePath,ey as invalidateFileCache,ty as invalidateFileCacheByDir,Qh as readFileCached,sy as registerServeModuleBundle,eg as templateCache};
2
+ import{eg,Qh,ey,ty,ny,tg,ng,ry,sy,ni,oy,hr,yr,Es}from"./chunk-1p9rb7rt.js";import{at}from"./chunk-n3jw3xpj.js";import"./chunk-pnqdwqw9.js";import"./chunk-mm00bb1p.js";import"./chunk-60yppcbb.js";import"./chunk-csymxc5a.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{ny as __setSignalsGeneratorsForTest,at as cacheEngineFingerprint,yr as cacheTemplate,hr as checkCache,oy as clearDevCaches,ng as getCachedRouterScript,tg as getCachedSignalsRuntime,ry as getServeClientAsset,ni as getServeModuleBundle,Es as hashFilePath,ey as invalidateFileCache,ty as invalidateFileCacheByDir,Qh as readFileCached,sy as registerServeModuleBundle,eg as templateCache};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{J,Be}from"./chunk-zebk7htd.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function an(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Be(t,s);if(p>s){c=p;continue}let a=J(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
2
+ import{J,Be}from"./chunk-pnqdwqw9.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function an(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Be(t,s);if(p>s){c=p;continue}let a=J(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
3
3
  export{an};
@@ -0,0 +1,20 @@
1
+ // @bun
2
+ import{ar,Oe}from"./chunk-9zrvh3pz.js";import{K,S,Cr,Vs,T}from"./chunk-pnqdwqw9.js";import{a,M}from"./chunk-jcr69v95.js";import{Fo}from"./chunk-kkevjppm.js";import{at}from"./chunk-n3jw3xpj.js";import{l}from"./chunk-46pxmpeb.js";import{r,Y}from"./chunk-z9xe3xkg.js";import d from"path";import j from"fs";import{AsyncLocalStorage as lt}from"async_hooks";import{randomUUID as $t}from"crypto";var wt=11;function J(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Fo(t,e,n)}var ct=2;function Nf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of St(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function St(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=j.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((c,p)=>p.length-c.length),rt.set(e,n)}return n}function vt(t,e){try{let n=j.statSync(t),i=d.resolve(e),c=t.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,t):t,...c?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(j.readFileSync(t)).toString(36)}}catch{return null}}function ut(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function Bt(t,e){for(let n of t){let i=ut(n,e);try{let c=j.statSync(i);if(c.size!==n.size)return!1;if(c.mtimeMs!==n.mtimeMs&&Bun.hash(j.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var dt=new Map,jt=100;function Df(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function Et(t){let e=G.get(t)??0;if(e>0&&e<jt){G.set(t,e+1);return}G.set(t,1);try{let n=(await j.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=Df();if(n.length<=i)return;let p=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await j.promises.stat(d.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,b)=>b.at-o.at);for(let o of p.slice(i)){let b=o.name.slice(0,-3);await j.promises.rm(d.join(t,`${b}.js`),{force:!0}),await j.promises.rm(d.join(t,`${b}.deps.json`),{force:!0})}N("pruned bundle cache to",i,"entries")}catch{}}function xe(t){return dt.get(t)??[]}function q(t,e){if(t)dt.set(t,e)}function Mf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function N(...t){if(Mf())console.log("[stx:bundler]",...t)}var tt=[];function pc(t,e,n){tt.push({filePath:t||"<inline>",message:e,details:n})}function cn(){return tt.slice()}function ln(){tt.length=0}var Z;function Fh(t){Z=t}function fc(){if(Z)return Z;try{let t=M.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function un(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let c=n[1];if(!Q.some((o)=>o.test(c)))return N("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let c=n[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!Q.some((o)=>o.test(c)))return N("detected side-effect import:",c),!0}return!1}var ir="stx-module:",_t=/\.(?:[cm]?[jt]sx?|json)$/i;function Lf(t,e){return d.relative(t,e).split(d.sep).join("/")}function jf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,c,p)=>{let o=e.get(p);return o&&!p.startsWith(ir)?`${i}${c}${o}${c}`:n})}function Bf(t,e){let n=0,i=(p)=>{let o=`__stxMod${n++}`,b=JSON.stringify(p);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let b of p.split(",")){let C=b.trim();if(!C)continue;let R=C.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!R)continue;let w=R[1].startsWith('"')?JSON.parse(R[1]):R[1],f=R[2]??w;e.push(`var ${f} = ${o}[${JSON.stringify(w)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,b)=>{let C=b.slice(ir.length),R=i(C),w=o.trim(),f=w.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!w.startsWith("{")&&!w.startsWith("*"))e.push(`var ${f[1]} = ${R}.default;`),w=w.slice(f[0].length).trim();let v=w.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${R};`);else if(w.startsWith("{"))c(w.replace(/^\{|\}$/g,""),R);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(ir.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(j.existsSync(n)&&j.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var X=new lt;function ds(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,c]of[...t].sort(([p],[o])=>p<o?-1:p>o?1:0))n.update(`${i}\x00${c}\x00`);return X.run({modules:t,key:n.digest("hex").slice(0,12)},e)}var pt=new lt;function Ff(t){return pt.run(!0,t)}function zf(){return pt.getStore()===!0}function gc(t){if(!zf())return;throw Error(`The client script of ${t} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function dn(){return X.getStore()?.key??""}function ft(t,e,n,i,c,p,o=new Map,b,C,R){let w=new Map([[n,i],...R??[]]),f=(B)=>B!==void 0&&w.has(B),v=(B,s,u)=>{if(J(s,t,b))return null;if(!p||!f(B)||!_t.test(s))return null;try{if(!j.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(s);let E=`${ir}${Lf(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(B,s)=>{let u=f(B)?e:d.dirname(B),E=d.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),B.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))c.add(u);return{path:u}}return{path:s.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(s)=>{let u=d.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let h of E)if(j.existsSync(h)&&j.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(s.importer,h,s.path);if(D)return D;return N(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),c.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${ir}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(w.has(s.path))return{contents:w.get(s.path),loader:"ts"};if(J(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=d.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))c.add(s.path);let h=C?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:j.readFileSync(s.path,"utf8"),loader:E}})}}}var H=new Map,z=S(64),ot=Symbol.for("stx.client-bundle-build-queue");function Hf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function pn(t,e,n={}){let i=n.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,C=n.cacheDir||Nf(i),R=X.getStore(),w=new Bun.CryptoHasher("md5");w.update(`${wt}\x00${at()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${p?"minified":"readable"}\x00${R?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let f=w.digest("hex").slice(0,12),v=d.join(C,`${f}.js`),y=z.get(v);if(y){if(Vs(y.files)&&y.files.every((h)=>!J(h.path,i,c))){N("memo hit:",f);let h=y.files.map((D)=>D.path);return q(e,h),n.collectInputs?.push(...h),y.code}z.delete(v),N("memo invalidated by dep change:",f)}let B=d.join(C,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(B),D=!1,k=null;if(await h.exists())try{let O=JSON.parse(await h.text());if(O.metadataVersion===ct&&Array.isArray(O.files)&&Bt(O.files,i))k=Cr(O.files.map((g)=>ut(g,i))),D=k.length===O.files.length&&!k.some((g)=>J(g.path,i,c))}catch{D=!1}if(D){if(N("cache hit:",f),k)q(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let O=await s.text(),g=new Date;if(j.promises.utimes(v,g,g).catch(()=>{}),k)z.set(v,{code:O,files:k});return O}N("cache invalidated by dep change:",f)}let u=H.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(z.get(v)?.files??[]).map((D)=>D.path));return h}gc(e);let E=Hf(()=>Mt(t,e,{projectRoot:i,minify:p,cacheDir:C,hash:f,cachePath:v,depsPath:B,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:c,expose:b,throwOnFailure:n.throwOnFailure,substitutes:R?.modules}));H.set(f,E);try{return await E}finally{H.delete(f)}}function mc(t){return`${t}-${process.pid}-${$t()}`}async function zh(t,e){let{projectRoot:n}=e,i=mc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(n,"bundle-tmp"),"out",i);j.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,b=0;for(let[f,v]of t){let y=d.join(n,`.stx-split-${i}-${b++}.ts`);p.set(y,v),o.set(d.basename(y).replace(/\.ts$/,""),f)}let[C,R]=[...p][0],w=new Set;gc(e.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ft(n,d.dirname(e.filePath),C,R,w,!1,new Map,void 0,X.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...T()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let B=d.basename(y.path);if(y.kind==="entry-point"){let s=o.get(B.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...w),v}finally{try{j.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Mt(t,e,n){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:b,depsPath:C,externalizeUserModules:R}=n,w=l(i,"bundle-tmp"),f=mc(o),v=d.join(i,`.stx-client-${f}.ts`),y=d.join(w,"out",f);j.mkdirSync(y,{recursive:!0});let B=d.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:D,balanced:k}=Y(h),O=(F)=>!k||D[F]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((F)=>{let m=Rt(F);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!O(g.index))continue;let F=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(F&&Q.some((m)=>m.test(F)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let F of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of F[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let mt=s.size>0?`
3
+ export { ${[...s].join(", ")} }`:"";N("bundling:",o,"from:",d.basename(e));let et=new Set,nt=new Map;try{let F=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:c?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ft(i,B,v,t+mt,et,R,nt,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":c?'"production"':'"development"',...T()},root:i});if(!F.success){let I=F.logs.filter((A)=>A.level==="error").map((A)=>A.message).join(", ")||`Unable to bundle ${d.basename(e)}`,P=ar(F.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",I),pc(e||"",I,P),n.throwOnFailure||fc()==="error")throw Error(I);return t}let m="";for(let x of F.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of x[1].split(",")){let P=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(P){_.push([P[2],P[1]]);continue}let A=I.trim();if(/^[A-Za-z_$][\w$]*$/.test(A))_.push([A,A])}if(n.expose){let x=new Set(n.expose);for(let I=_.length-1;I>=0;I--)if(!x.has(_[I][0]))_.splice(I,1)}let L=[];m=Bf(jf(m,nt),L);let gt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),c&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let V=`__stxBundle_${o}`,ht=new Set(K(t,!0).split(",").map((x)=>x.trim())),xt=_.map(([x,I])=>`get ${JSON.stringify(x)}() { return ${I} }${ht.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${I}) { ${I} = __stxValue_${I} }`:""}`).join(", "),yt=_.map(([x])=>`var ${x} = undefined;`).join(`
4
+ `),bt=_.map(([x])=>`${x} = ${V}[${JSON.stringify(x)}];`).join(`
5
+ `);if(m=`${gt.join(`
6
+ `)}
7
+ ${yt}
8
+ var ${V} = (function() {
9
+ ${L.join(`
10
+ `)}
11
+ ${m}
12
+ return { ${xt} };
13
+ })();
14
+ ${bt}
15
+ var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiveBindings;
16
+ Object.keys(${V}).forEach(function(name) {
17
+ if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
18
+ Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${V}, name));
19
+ });`.trim(),N("bundled:",o,"output:",m.length,"bytes"),s.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${o}); serving the unbundled source and not caching this result`),t;j.mkdirSync(p,{recursive:!0}),await Bun.write(b,m);let W=Cr(et);return await Bun.write(C,JSON.stringify({metadataVersion:ct,files:W.map((x)=>vt(x.path,i)).filter((x)=>x!==null)})),q(e,W.map((x)=>x.path)),n.collectInputs?.push(...W.map((x)=>x.path)),z.set(b,{code:m,files:W}),await Et(p),m}catch(F){let m=ar(F,e||void 0),_=Oe(F,e||void 0);if(console.warn(`[stx:bundler] error: ${_}`),pc(e||"",_,m),n.throwOnFailure||fc()==="error")throw F;return t}finally{try{j.rmSync(y,{recursive:!0,force:!0})}catch{}}}function Rt(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let i=e.indexOf(":");if(i!==-1)e=e.slice(i+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
20
+ export{Nf,Df,xe,Mf,pc,cn,ln,Fh,fc,un,ir,Lf,jf,Bf,ds,Ff,zf,gc,dn,Hf,pn,mc,zh};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{St,Gn,$h}from"./chunk-2sw68zck.js";import{me,Jn,Rh,Yn,To,ns,rs,Ah,Ph,Ih,Zn,Qn,$o,ss,Oh}from"./chunk-1dt8e7ew.js";import"./chunk-qjey0jk6.js";export{To as batch,$h as default,Jn as derived,Yn as effect,St as generateSignalsRuntime,Gn as generateSignalsRuntimeDev,Qn as isDerived,Zn as isSignal,Rh as memo,rs as onDestroy,ns as onMount,ss as peek,Ih as pendingLifecycleCounts,Ph as runDestroyCallbacks,Ah as runMountCallbacks,me as state,$o as untrack,Oh as useOptimistic};
2
+ import{St,Gn,$h}from"./chunk-m131znxe.js";import{he,Jn,Rh,Yn,To,ns,rs,Ah,Ph,Ih,Zn,Qn,$o,ss,Oh}from"./chunk-e2t7mk29.js";import"./chunk-qjey0jk6.js";export{To as batch,$h as default,Jn as derived,Yn as effect,St as generateSignalsRuntime,Gn as generateSignalsRuntimeDev,Qn as isDerived,Zn as isSignal,Rh as memo,rs as onDestroy,ns as onMount,ss as peek,Ih as pendingLifecycleCounts,Ph as runDestroyCallbacks,Ah as runMountCallbacks,he as state,$o as untrack,Oh as useOptimistic};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{fn,Lo,jo,Bo,Hh,Fo}from"./chunk-avfsad8j.js";import"./chunk-rw5492e2.js";import"./chunk-dy7vqv1x.js";import"./chunk-60yppcbb.js";export{jo as buildServerApi,Hh as createServerApi,fn as discoverServerApi,Lo as generateApiTypes,Fo as isServerApiSource,Bo as productionApiDispatcher};
2
+ import{fn,Lo,jo,Bo,Hh,Fo}from"./chunk-kkevjppm.js";import"./chunk-rw5492e2.js";import"./chunk-hhbt8grm.js";import"./chunk-60yppcbb.js";export{jo as buildServerApi,Hh as createServerApi,fn as discoverServerApi,Lo as generateApiTypes,Fo as isServerApiSource,Bo as productionApiDispatcher};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{d,m,hl,p,t,u}from"./chunk-pffksrxb.js";import{rt,Et,hn,ti}from"./chunk-az07qe58.js";function L(w,e){try{let g=w.trim();if(m(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let n=w,v=!0;while(v){v=!1;let a=n.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let f=a.index,s=ti(n,f);if(!s)break;try{let o;if(m(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let b;if(i.value&&m(i.value))b=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)b=d(i.value,e);if(o===b){r=i.content.trim(),c=!0;break}}catch{continue}n=n.substring(0,f)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,f)+c+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,n)=>e[Number(n)]??g)}function ue(w,e,g){let{masked:n,scripts:v}=H(w);return J(K(n,e,g),v)}function K(w,e,g){let n=w;n=Q(n,e,g);{let a=!0;while(a){a=!1;let f=n.match(/@unless\s*\(/);if(!f||f.index===void 0)break;let s=f.index,o=rt(n,s+7);if(!o)break;let r=o.endPos,c=Et(n,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,c),b=o.expression,y=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){y=P.pos;break}}let l;if(y!==-1){let x=i.slice(0,y),k=i.slice(y+5);l=`@if (${b})${k}@else ${x}@endif`}else l=`@if (!(${b}))${i}@endif`;n=n.substring(0,s)+l+n.substring(c+10),a=!0}}n=Go(n,e,g),n=Jo(n,e,g),n=Xo(n,e);let v=()=>{let a=hn(n);if(a.length===0)return!1;let f=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",b=!1;for(let y of c.branches){if(b)break;if(y.type==="else")i=y.content,b=!0;else try{if(y.condition?hl(y.condition,e):!1)i=y.content,b=!0}catch(l){i=u(y.type==="if"?"If":"Elseif",`Error in @${y.type}(${y.condition}): ${l instanceof Error?l.message:String(l)}`,t.EVALUATION_ERROR),b=!0}}f[r]=i}catch(i){let b=i instanceof Error?i.message:String(i);f[r]=u("If",`Error processing @if block: ${b}`,t.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=n.slice(o,c.start),s[r*2+1]=f[r],o=c.end}return s[a.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let a=n;if(!v())break;if(n===a)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===g){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function Xo(w,e){let g=w;function n(s,o,r,c){let i=1,b=c,y=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(b<s.length&&i>0){y.lastIndex=b,l.lastIndex=b;let x=y.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,b=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;b=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),b=new RegExp(`@${r}(?![a-z])`,"g"),y=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=b.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+5),y=q(b);if(y)c=y.value,i=r+5+y.consumed;else i=r+5;let l=n(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+6),y=q(b);if(y)c=y.value,i=r+6+y.consumed;else i=r+6;let l=n(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function f(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let b=i.index,y=g.slice(b+`@${s}`.length),l=f(y);if(!l)break;let x=b+`@${s}`.length+l.paramsEnd,k=n(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${b} has no matching @${o} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=f(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,b)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function Go(w,e,g){let n=w;function v(a,f,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${f}\\s*\\(`),b=a.match(i);if(!b||b.index===void 0)break;let y=b.index,l=rt(a,y+`@${f}`.length);if(!l)break;let x=l.endPos,k=Et(a,f,s,x);if(k===-1){console.warn(`[stx] @${f} directive at position ${y} has no matching @${s} \u2014 the block was skipped.`);break}let h=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";a=a.substring(0,y)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${f} directive: ${T}`,t.EVALUATION_ERROR);a=a.substring(0,y)+_+a.substring(k+`@${s}`.length);break}}return a}return n=v(n,"isset","endisset",(a)=>{let f=L(a,e);return f!==void 0&&f!==null},"Isset"),n=v(n,"empty","endempty",(a)=>{let f=L(a,e);return f===void 0||f===null||f===""||f===0||f===!1||Array.isArray(f)&&f.length===0||typeof f==="object"&&f!==null&&Object.keys(f).length===0},"Empty"),n}function Jo(w,e,g){let n=w,v="development";function a(f,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),b=new RegExp(`^@${s}(?![a-z])`),y=new RegExp(`^@${o}(?![a-z])`),l=f,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(b.test(j)){_++,M=O+1;continue}if(y.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return n=a(n,"env","endenv",!1),n=a(n,"production","endproduction",v==="production"),n=a(n,"development","enddevelopment",v==="development"),n=a(n,"staging","endstaging",v==="staging"),n=a(n,"testing","endtesting",v==="testing"),n}
3
- export{ue,Xo,Go,Jo};
2
+ import{d,m,hl,p,t,u}from"./chunk-csymxc5a.js";import{rt,Et,hn,ti}from"./chunk-a8164hnf.js";function L(w,e){try{let g=w.trim();if(m(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let n=w,v=!0;while(v){v=!1;let a=n.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let f=a.index,s=ti(n,f);if(!s)break;try{let o;if(m(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let b;if(i.value&&m(i.value))b=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)b=d(i.value,e);if(o===b){r=i.content.trim(),c=!0;break}}catch{continue}n=n.substring(0,f)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,f)+c+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,n)=>e[Number(n)]??g)}function de(w,e,g){let{masked:n,scripts:v}=H(w);return J(K(n,e,g),v)}function K(w,e,g){let n=w;n=Q(n,e,g);{let a=!0;while(a){a=!1;let f=n.match(/@unless\s*\(/);if(!f||f.index===void 0)break;let s=f.index,o=rt(n,s+7);if(!o)break;let r=o.endPos,c=Et(n,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,c),b=o.expression,y=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){y=P.pos;break}}let l;if(y!==-1){let x=i.slice(0,y),k=i.slice(y+5);l=`@if (${b})${k}@else ${x}@endif`}else l=`@if (!(${b}))${i}@endif`;n=n.substring(0,s)+l+n.substring(c+10),a=!0}}n=Go(n,e,g),n=Jo(n,e,g),n=Xo(n,e);let v=()=>{let a=hn(n);if(a.length===0)return!1;let f=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",b=!1;for(let y of c.branches){if(b)break;if(y.type==="else")i=y.content,b=!0;else try{if(y.condition?hl(y.condition,e):!1)i=y.content,b=!0}catch(l){i=u(y.type==="if"?"If":"Elseif",`Error in @${y.type}(${y.condition}): ${l instanceof Error?l.message:String(l)}`,t.EVALUATION_ERROR),b=!0}}f[r]=i}catch(i){let b=i instanceof Error?i.message:String(i);f[r]=u("If",`Error processing @if block: ${b}`,t.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=n.slice(o,c.start),s[r*2+1]=f[r],o=c.end}return s[a.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let a=n;if(!v())break;if(n===a)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===g){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function Xo(w,e){let g=w;function n(s,o,r,c){let i=1,b=c,y=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(b<s.length&&i>0){y.lastIndex=b,l.lastIndex=b;let x=y.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,b=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;b=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),b=new RegExp(`@${r}(?![a-z])`,"g"),y=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=b.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+5),y=q(b);if(y)c=y.value,i=r+5+y.consumed;else i=r+5;let l=n(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+6),y=q(b);if(y)c=y.value,i=r+6+y.consumed;else i=r+6;let l=n(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function f(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let b=i.index,y=g.slice(b+`@${s}`.length),l=f(y);if(!l)break;let x=b+`@${s}`.length+l.paramsEnd,k=n(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${b} has no matching @${o} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=f(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,b)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function Go(w,e,g){let n=w;function v(a,f,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${f}\\s*\\(`),b=a.match(i);if(!b||b.index===void 0)break;let y=b.index,l=rt(a,y+`@${f}`.length);if(!l)break;let x=l.endPos,k=Et(a,f,s,x);if(k===-1){console.warn(`[stx] @${f} directive at position ${y} has no matching @${s} \u2014 the block was skipped.`);break}let h=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";a=a.substring(0,y)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${f} directive: ${T}`,t.EVALUATION_ERROR);a=a.substring(0,y)+_+a.substring(k+`@${s}`.length);break}}return a}return n=v(n,"isset","endisset",(a)=>{let f=L(a,e);return f!==void 0&&f!==null},"Isset"),n=v(n,"empty","endempty",(a)=>{let f=L(a,e);return f===void 0||f===null||f===""||f===0||f===!1||Array.isArray(f)&&f.length===0||typeof f==="object"&&f!==null&&Object.keys(f).length===0},"Empty"),n}function Jo(w,e,g){let n=w,v="development";function a(f,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),b=new RegExp(`^@${s}(?![a-z])`),y=new RegExp(`^@${o}(?![a-z])`),l=f,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(b.test(j)){_++,M=O+1;continue}if(y.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return n=a(n,"env","endenv",!1),n=a(n,"production","endproduction",v==="production"),n=a(n,"development","enddevelopment",v==="development"),n=a(n,"staging","endstaging",v==="staging"),n=a(n,"testing","endtesting",v==="testing"),n}
3
+ export{de,Xo,Go,Jo};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function Ze(e="stx",n=x()){if(!S.has(n))S.add(n),O({root:n});let r=D(s(n,L(e)));if(z())return H(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return G(),i.add(r),r}function le(e){if(y.has(e))return;if(p(e),i.delete(e),i.size===0)f()}function H(e){try{k(s(e,v),`kept by pid ${t.pid}
3
- `)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function cc(e,n){let r=Ze(e);try{return await n(r)}finally{le(r)}}
4
- export{Ze,le,cc};
2
+ import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function Ze(e="stx",n=x()){if(!S.has(n))S.add(n),O({root:n});let r=D(s(n,L(e)));if(z())return H(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return G(),i.add(r),r}function ue(e){if(y.has(e))return;if(p(e),i.delete(e),i.size===0)f()}function H(e){try{k(s(e,v),`kept by pid ${t.pid}
3
+ `)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function cc(e,n){let r=Ze(e);try{return await n(r)}finally{ue(r)}}
4
+ export{Ze,ue,cc};