@stacksjs/stx 0.2.843 → 0.2.844

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 (104) hide show
  1. package/dist/{chunk-dbsexg52.js → chunk-0q3vkfqt.js} +1 -1
  2. package/dist/{chunk-9rcpahyb.js → chunk-0tse1k5e.js} +1 -1
  3. package/dist/{chunk-cnav1x5k.js → chunk-1efmkw4t.js} +1 -1
  4. package/dist/{chunk-y4j82p7j.js → chunk-2524ayee.js} +4 -4
  5. package/dist/{chunk-3hfmeb1z.js → chunk-2jwsntc9.js} +1 -1
  6. package/dist/{chunk-25swv3t2.js → chunk-35e3qawb.js} +1 -1
  7. package/dist/{chunk-9zjr0ty9.js → chunk-3e1hmm3h.js} +1 -1
  8. package/dist/chunk-3g46mker.js +2 -0
  9. package/dist/{chunk-hp3n1b9r.js → chunk-46wqk1fb.js} +1 -1
  10. package/dist/{chunk-qz18x7f0.js → chunk-48vnw9t9.js} +1 -1
  11. package/dist/chunk-54eap9rq.js +2 -0
  12. package/dist/chunk-5fspjf7x.js +42 -0
  13. package/dist/{chunk-8cahff21.js → chunk-69b8mr68.js} +2 -2
  14. package/dist/{chunk-ge54kqfy.js → chunk-71fsg3az.js} +1 -1
  15. package/dist/{chunk-9egg8bb8.js → chunk-76a66cw3.js} +1 -1
  16. package/dist/{chunk-f39xf08q.js → chunk-7cxbt404.js} +4 -4
  17. package/dist/{chunk-dj0xp789.js → chunk-7k4npa5e.js} +1 -1
  18. package/dist/{chunk-80cnt2vg.js → chunk-9hzbqwrp.js} +1 -1
  19. package/dist/{chunk-gspxyygw.js → chunk-a28rhqq2.js} +1 -1
  20. package/dist/{chunk-4mqr462h.js → chunk-a3wv8q6g.js} +5 -5
  21. package/dist/chunk-b30fzxwd.js +2 -0
  22. package/dist/chunk-bgaq87h6.js +2 -0
  23. package/dist/chunk-c1vf7qev.js +2 -0
  24. package/dist/{chunk-6ygr2syc.js → chunk-c4by7m5b.js} +1 -1
  25. package/dist/{chunk-kaxsavhg.js → chunk-chetq1ce.js} +2 -2
  26. package/dist/{chunk-3vh945rk.js → chunk-cwwm14b3.js} +1 -1
  27. package/dist/{chunk-jfm28sz3.js → chunk-e3r9fybx.js} +2 -2
  28. package/dist/{chunk-y7rdw6td.js → chunk-e5seb8f7.js} +2 -2
  29. package/dist/chunk-eq8enrjw.js +2 -0
  30. package/dist/chunk-f404rga4.js +2 -0
  31. package/dist/chunk-fyesbfvr.js +2 -0
  32. package/dist/{chunk-xrhr7dmv.js → chunk-gd7vyzhw.js} +1 -1
  33. package/dist/{chunk-fdq4ryhv.js → chunk-gg63af5n.js} +1 -1
  34. package/dist/{chunk-y8nx9aa6.js → chunk-gz45xsbg.js} +11 -11
  35. package/dist/{chunk-53b8r8d2.js → chunk-hws9yb0b.js} +3 -3
  36. package/dist/{chunk-58pc09a1.js → chunk-japk9yf6.js} +5 -5
  37. package/dist/chunk-jbb9pjae.js +2 -0
  38. package/dist/{chunk-sw0e1sad.js → chunk-kbv5nwwd.js} +1 -1
  39. package/dist/{chunk-29chh7cd.js → chunk-ksaj3br7.js} +1 -1
  40. package/dist/chunk-mxrmed55.js +2 -0
  41. package/dist/{chunk-wyprsedf.js → chunk-my85fge2.js} +2 -2
  42. package/dist/{chunk-akw5585n.js → chunk-nsqx4xwn.js} +1 -1
  43. package/dist/{chunk-rs6evw29.js → chunk-pfzwgxk9.js} +1 -1
  44. package/dist/chunk-q5ehy99b.js +2 -0
  45. package/dist/{chunk-1474zjtx.js → chunk-qtkjbz4n.js} +1 -1
  46. package/dist/{chunk-r8pkv9s1.js → chunk-r10h4xmw.js} +1 -1
  47. package/dist/{chunk-756bf5nt.js → chunk-r8xwd8r1.js} +3 -3
  48. package/dist/{chunk-pdzt72p8.js → chunk-rb6vr5v9.js} +6 -6
  49. package/dist/{chunk-gfcgtxnb.js → chunk-rf0q3mva.js} +1 -1
  50. package/dist/{chunk-6wgbm5tc.js → chunk-rjenga8c.js} +1 -1
  51. package/dist/chunk-rm5pnhzx.js +3 -0
  52. package/dist/chunk-s37e6wjj.js +2 -0
  53. package/dist/{chunk-zjek9py2.js → chunk-sfww6v6m.js} +2 -2
  54. package/dist/{chunk-8k8m9vf2.js → chunk-sjcvc0bd.js} +1 -1
  55. package/dist/chunk-t2a78fzq.js +2 -0
  56. package/dist/chunk-t2sqxbv5.js +2 -0
  57. package/dist/chunk-t5mnysyw.js +2 -0
  58. package/dist/chunk-th7343bz.js +2 -0
  59. package/dist/{chunk-cjm92sfd.js → chunk-tpf8v2mb.js} +1 -1
  60. package/dist/{chunk-r7tr5dvd.js → chunk-txfz7gc3.js} +3 -3
  61. package/dist/{chunk-m95pk7fk.js → chunk-v7j50pfw.js} +1 -1
  62. package/dist/{chunk-qg3hp77v.js → chunk-v7rat63v.js} +1 -1
  63. package/dist/{chunk-jn8jny22.js → chunk-v9jfxbwx.js} +1 -1
  64. package/dist/{chunk-pz1y8krt.js → chunk-vhckqe4x.js} +4 -4
  65. package/dist/chunk-vq4nccm4.js +2 -0
  66. package/dist/{chunk-hnhq2f69.js → chunk-vrwdnefe.js} +1 -1
  67. package/dist/{chunk-rdmm3zvb.js → chunk-vyvjbydn.js} +1 -1
  68. package/dist/chunk-wj93vpy5.js +2 -0
  69. package/dist/chunk-wz30ghcf.js +2 -0
  70. package/dist/chunk-xjthcx9s.js +2 -0
  71. package/dist/{chunk-ast5jmcg.js → chunk-y49nzyxf.js} +4 -4
  72. package/dist/cli.js +7 -7
  73. package/dist/component-renderer.d.ts +1 -0
  74. package/dist/component-renderer.js +15 -1
  75. package/dist/craft-entry.js +1 -1
  76. package/dist/craft.js +1 -1
  77. package/dist/document-shell.d.ts +16 -0
  78. package/dist/pwa.js +3 -3
  79. package/dist/server-bindings.d.ts +1 -1
  80. package/dist/server-bindings.js +1 -1
  81. package/dist/ssg.js +2 -2
  82. package/package.json +5 -5
  83. package/dist/chunk-0571wwem.js +0 -2
  84. package/dist/chunk-0h3qftkx.js +0 -2
  85. package/dist/chunk-339cn2s8.js +0 -2
  86. package/dist/chunk-3kg5a5gp.js +0 -2
  87. package/dist/chunk-4a93qzdg.js +0 -2
  88. package/dist/chunk-689qm4h4.js +0 -2
  89. package/dist/chunk-9gkc04h5.js +0 -2
  90. package/dist/chunk-bv4rews8.js +0 -2
  91. package/dist/chunk-c0grsrqj.js +0 -2
  92. package/dist/chunk-fw7va7h4.js +0 -2
  93. package/dist/chunk-gvf0g8nf.js +0 -2
  94. package/dist/chunk-kxydr8z4.js +0 -2
  95. package/dist/chunk-mjhhvf6e.js +0 -2
  96. package/dist/chunk-nrn44374.js +0 -42
  97. package/dist/chunk-nv0hnx9x.js +0 -2
  98. package/dist/chunk-qtfj8z5d.js +0 -2
  99. package/dist/chunk-tp67ka3x.js +0 -2
  100. package/dist/chunk-vwyxvjnh.js +0 -2
  101. package/dist/chunk-vytbqwaz.js +0 -3
  102. package/dist/chunk-z8qdhn60.js +0 -2
  103. package/dist/chunk-zfmcbhv2.js +0 -2
  104. package/dist/chunk-zwzbcz37.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{jt,ae,_,u,f,P,t,ce,K,l,_e,Ti,z,Cn,$i,zt,Ri,cl,Ar,ll,at,ul,Pr,dl,En,Ai,pl,Ir,Nr,Ce,Pi}from"./chunk-756bf5nt.js";import{ui,Ic,o,C,Ne,fn,gn,De,fe,J,xr,mn,zs,Hc,Vc,yn,Er,Vs,Us,Uc,hi,Wc,qc,Kc,Xc,Le,je,Ws,ze,r,vn,h,p,W,Q,ke,E,ki}from"./chunk-y8nx9aa6.js";import{Lt}from"./chunk-47n5s7wk.js";import{kn}from"./chunk-cjm92sfd.js";import{b}from"./chunk-zjek9py2.js";import{hr,Is}from"./chunk-kxj5sp5w.js";import{hc,yc,fr,et,bc,O}from"./chunk-pz1y8krt.js";import{ti,ni,ri,si}from"./chunk-pdzt72p8.js";import{dc,ps}from"./chunk-nrn44374.js";import{cs,ls,us}from"./chunk-ast5jmcg.js";import{hs,Ko,Xo,ys,bs,Go}from"./chunk-r7tr5dvd.js";import{gs,Ho}from"./chunk-ge54kqfy.js";import{jo}from"./chunk-4dxq7ft1.js";import{oe,Vo,Uo,Wo}from"./chunk-qz18x7f0.js";import{lr,we,fc,ur,gc}from"./chunk-f39xf08q.js";import{B,Ze}from"./chunk-ybq56wam.js";import{wc,vc}from"./chunk-hp3n1b9r.js";import{T,Tn,Ii}from"./chunk-jabw4ck5.js";import Kn from"fs";import ie from"path";function dt(s){let e=fn(s),c=e.find((x)=>x.closing&&x.name.toLowerCase()==="head");if(!c)return s;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),g=0,n=[];for(let x=0;x<e.length;x++){let w=e[x];if(w.start<c.end)continue;let v=w.name.toLowerCase();if(a.has(v)){g=Math.max(0,g+(w.closing?-1:w.selfClosing?0:1));continue}if(v!=="style"||w.closing||g>0)continue;let k=e[x+1];if(k?.name.toLowerCase()==="style"&&k.closing){if(/@scope\s*\{/.test(s.slice(w.end,k.start)))continue;n.push({start:w.start,end:k.end}),x++}}if(!n.length)return s;let d=n.map((x)=>s.slice(x.start,x.end)).join(`
2
+ import{jt,ae,_,u,f,P,t,ce,K,l,_e,Ti,z,Cn,$i,zt,Ri,cl,Ar,ll,at,ul,Pr,dl,En,Ai,pl,Ir,Nr,Ce,Pi}from"./chunk-r8xwd8r1.js";import{ui,Ic,o,C,Ne,fn,gn,De,fe,J,xr,mn,zs,Hc,Vc,yn,Er,Vs,Us,Uc,hi,Wc,qc,Kc,Xc,Le,je,Ws,ze,r,vn,h,p,W,Q,ke,E,ki}from"./chunk-gz45xsbg.js";import{Lt}from"./chunk-47n5s7wk.js";import{kn}from"./chunk-tpf8v2mb.js";import{b}from"./chunk-sfww6v6m.js";import{hr,Is}from"./chunk-kxj5sp5w.js";import{hc,yc,fr,et,bc,O}from"./chunk-vhckqe4x.js";import{ti,ni,ri,si}from"./chunk-rb6vr5v9.js";import{dc,ps}from"./chunk-5fspjf7x.js";import{cs,ls,us}from"./chunk-y49nzyxf.js";import{hs,Ko,Xo,ys,bs,Go}from"./chunk-txfz7gc3.js";import{gs,Ho}from"./chunk-71fsg3az.js";import{jo}from"./chunk-4dxq7ft1.js";import{oe,Vo,Uo,Wo}from"./chunk-48vnw9t9.js";import{lr,we,fc,ur,gc}from"./chunk-7cxbt404.js";import{B,Ze}from"./chunk-ybq56wam.js";import{wc,vc}from"./chunk-46wqk1fb.js";import{T,Tn,Ii}from"./chunk-jabw4ck5.js";import Kn from"fs";import ie from"path";function dt(s){let e=fn(s),c=e.find((x)=>x.closing&&x.name.toLowerCase()==="head");if(!c)return s;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),g=0,n=[];for(let x=0;x<e.length;x++){let w=e[x];if(w.start<c.end)continue;let v=w.name.toLowerCase();if(a.has(v)){g=Math.max(0,g+(w.closing?-1:w.selfClosing?0:1));continue}if(v!=="style"||w.closing||g>0)continue;let k=e[x+1];if(k?.name.toLowerCase()==="style"&&k.closing){if(/@scope\s*\{/.test(s.slice(w.end,k.start)))continue;n.push({start:w.start,end:k.end}),x++}}if(!n.length)return s;let d=n.map((x)=>s.slice(x.start,x.end)).join(`
3
3
  `),y=[s.slice(0,c.start),d,`
4
4
  `],m=c.start;for(let x of n)y.push(s.slice(m,x.start)),m=x.end;return y.push(s.slice(m)),y.join("")}function pt(){return`
5
5
  // STX Lifecycle Runtime
@@ -1295,7 +1295,7 @@ ${R}
1295
1295
  </style>`;a=a.replace(x,D),y.lastIndex=0}catch(R){}}}return a}import it from"path";var Wn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Xn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function zn(s,e){if(!e||!s.includes("/"))return s;let c=it.dirname(e);return s.replace(Wn,(a,g,n,d)=>{let y=it.resolve(c,d);return`${g}${n}${y.split(it.sep).join("/")}${n}`})}function cr(s,e){if(!e||!s.includes("<script"))return s;return s.replace(Xn,(c,a,g,n)=>`${a}${zn(g,e)}${n}`)}var Ee="<!--PARENT_CONTENT_PLACEHOLDER-->";function dr(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vr(s,e){let c=s.length,a=e,g=!0,n=[],d=(y)=>y+9<=c&&s[y]==="<"&&s[y+1]==="/"&&(s[y+2]==="s"||s[y+2]==="S")&&(s[y+3]==="c"||s[y+3]==="C")&&(s[y+4]==="r"||s[y+4]==="R")&&(s[y+5]==="i"||s[y+5]==="I")&&(s[y+6]==="p"||s[y+6]==="P")&&(s[y+7]==="t"||s[y+7]==="T")&&(s[y+8]===">"||/\s/.test(s[y+8]));while(a<c){let y=s[a];if(d(a))return a;if(y==="/"&&s[a+1]==="/"){if(a=s.indexOf(`
1296
1296
  `,a+2),a===-1)return-1;a+=1,g=!0;continue}if(y==="/"&&s[a+1]==="*"){let m=s.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,g=!0;continue}if(y==="/"&&g){let m=a+1,x=!1;while(m<c){let w=s[m];if(w==="\\"){m+=2;continue}if(w==="[")x=!0;else if(w==="]")x=!1;else if(w==="/"&&!x){m++;break}else if(w===`
1297
1297
  `){m=-1;break}m++}if(m===-1){a++,g=!1;continue}while(m<c&&/[a-z]/.test(s[m]))m++;a=m,g=!1;continue}if(y==="'"||y==='"'){let m=y;a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]===m){a++;break}if(s[a]===`
1298
- `)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(y==="}"&&n.length>0){n.pop(),a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function kr(s,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var Gn=4096;async function ot(s,e,c){if(c.buildMode!=="serve"||e.length<Gn)return null;let{registerServeModuleBundle:a}=await import("./chunk-0571wwem.js");return`<script ${s} src="${a(e)}"></script>`}async function sr(s,e,c,a){try{let{registeredModuleIdsIn:g,buildModuleRegistryScript:n}=await o("stx/client-module-registry",()=>import("./chunk-29chh7cd.js")),d=[],y=await n(g(...s),{minify:Ii(e.buildMode,e.minifyClient),collectInputs:d});for(let m of d)c?.add(m);if(a)a.inputs=d,a.code=y??void 0;if(!y)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-0571wwem.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Zn(s,e,c,a){let g={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:k}=await o("stx/framework-composables",()=>import("./chunk-25swv3t2.js"));g.frameworkScript=await k(s)}catch{}let n=null;try{n=await o("stx/store-loader",()=>import("./chunk-bv4rews8.js"))}catch{}let d=e.storesDir,y=!!a.__stx_native_screen||(n?.pageStoresAll()??!0),m=y?"":s.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],w=[],v=null;for(let k=0;k<8;k++){let S=null,M="",A=!1;try{if(n){let N=y?await n.getStoreScript(d).then((F)=>F?{code:F,stores:["*"],functions:null}:null):await n.getStoreScriptFor(d,[m],{reads:n.storesReadInFiles([...x,...w]),runOnce:!0});if(N)S=N.code,M=N.stores.join(","),A=!!N.functions&&!y}}catch{}if(v!==null&&M===v)break;v=M;let R=A?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",D=S?`<script ${R}>${S}</script>`:null;g.storeCode=S,g.storeTag=S?await ot(R,S,e)??D:null;let j={};g.modulesTag=await sr([s,D],e,c,j),g.modulesCode=j.code??null,x=j.inputs??[],g.composableTag=null,g.composableCode=null,w=[];try{let{getComposableScript:N}=await o("stx/composable-loader",()=>import("./chunk-0h3qftkx.js")),F=e.composablesDir,I=[g.modulesCode??g.modulesTag,D,g.frameworkScript].filter((H)=>H!==null),L=await N(e._layerComposableDirs??F,s,I,w);if(L)g.composableCode=L,g.composableTag=await ot('data-stx-scoped data-stx-run="always" data-stx-composables',L,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}if(y||!n)break}return g}async function Jn(s,e,c,a={}){let{withModuleSubstitutes:g,moduleSubstitutionKey:n}=await import("./chunk-9egg8bb8.js"),d=await import("./chunk-xvtp7nyj.js"),{messages:y,webModules:m}=e,x=null,w=null,v=n()===""&&!a.__stx_native_screen;if(y&&d.pageMessagesEnabled(e)&&v)try{x=await d.loadPageMessages(process.cwd(),y)}catch(R){Qn(R)}if(m&&Object.keys(m).length&&v)try{w=await(await import("./chunk-hc1f1yq8.js")).loadWebModules(process.cwd(),m)}catch(R){Yn(R)}let k=new Map([...w??[],...x?.stubs??[]]),S=()=>Zn(s,e,c,a),M=k.size?await g(k,S):await S(),A=null;if(x){let R=d.messageAreasIn(M.modulesCode,M.storeCode,M.composableCode),D=d.pageMessagesScript(x,d.pageLanguages(s,x),R);if(D)A=await ot('data-stx-scoped data-stx-run="always" data-stx-messages',D,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${D.replace(/<\/script/gi,"<\\/script")}</script>`}return[A,M.modulesTag,M.storeTag,M.composableTag,M.frameworkScript].filter((R)=>R!==null)}var pr=!1;function Qn(s){if(pr)return;pr=!0,console.warn(`[stx] messages: ${s instanceof Error?s.message:String(s)}; pages ship every language`)}var gr=!1;function Yn(s){if(gr)return;gr=!0,console.warn(`[stx] ${s instanceof Error?s.message:String(s)}; pages bundle the real modules`)}function es(s,e=""){let c=kr(s,"data-stx-runtime");if(!c)return s;let a=lr(s);if(a===-1||a===c.start){if(!e)return s;return s.slice(0,c.end)+e+s.slice(c.end)}if(a<c.start)return s.slice(0,a)+s.slice(c.start,c.end)+e+`
1298
+ `)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(y==="}"&&n.length>0){n.pop(),a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function kr(s,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var Gn=4096;async function ot(s,e,c){if(c.buildMode!=="serve"||e.length<Gn)return null;let{registerServeModuleBundle:a}=await import("./chunk-eq8enrjw.js");return`<script ${s} src="${a(e)}"></script>`}async function sr(s,e,c,a){try{let{registeredModuleIdsIn:g,buildModuleRegistryScript:n}=await o("stx/client-module-registry",()=>import("./chunk-ksaj3br7.js")),d=[],y=await n(g(...s),{minify:Ii(e.buildMode,e.minifyClient),collectInputs:d});for(let m of d)c?.add(m);if(a)a.inputs=d,a.code=y??void 0;if(!y)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-eq8enrjw.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Zn(s,e,c,a){let g={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:k}=await o("stx/framework-composables",()=>import("./chunk-35e3qawb.js"));g.frameworkScript=await k(s)}catch{}let n=null;try{n=await o("stx/store-loader",()=>import("./chunk-wz30ghcf.js"))}catch{}let d=e.storesDir,y=!!a.__stx_native_screen||(n?.pageStoresAll()??!0),m=y?"":s.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],w=[],v=null;for(let k=0;k<8;k++){let S=null,M="",A=!1;try{if(n){let N=y?await n.getStoreScript(d).then((F)=>F?{code:F,stores:["*"],functions:null}:null):await n.getStoreScriptFor(d,[m],{reads:n.storesReadInFiles([...x,...w]),runOnce:!0});if(N)S=N.code,M=N.stores.join(","),A=!!N.functions&&!y}}catch{}if(v!==null&&M===v)break;v=M;let R=A?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",D=S?`<script ${R}>${S}</script>`:null;g.storeCode=S,g.storeTag=S?await ot(R,S,e)??D:null;let j={};g.modulesTag=await sr([s,D],e,c,j),g.modulesCode=j.code??null,x=j.inputs??[],g.composableTag=null,g.composableCode=null,w=[];try{let{getComposableScript:N}=await o("stx/composable-loader",()=>import("./chunk-54eap9rq.js")),F=e.composablesDir,I=[g.modulesCode??g.modulesTag,D,g.frameworkScript].filter((H)=>H!==null),L=await N(e._layerComposableDirs??F,s,I,w);if(L)g.composableCode=L,g.composableTag=await ot('data-stx-scoped data-stx-run="always" data-stx-composables',L,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}if(y||!n)break}return g}async function Jn(s,e,c,a={}){let{withModuleSubstitutes:g,moduleSubstitutionKey:n}=await import("./chunk-76a66cw3.js"),d=await import("./chunk-xvtp7nyj.js"),{messages:y,webModules:m}=e,x=null,w=null,v=n()===""&&!a.__stx_native_screen;if(y&&d.pageMessagesEnabled(e)&&v)try{x=await d.loadPageMessages(process.cwd(),y)}catch(R){Qn(R)}if(m&&Object.keys(m).length&&v)try{w=await(await import("./chunk-hc1f1yq8.js")).loadWebModules(process.cwd(),m)}catch(R){Yn(R)}let k=new Map([...w??[],...x?.stubs??[]]),S=()=>Zn(s,e,c,a),M=k.size?await g(k,S):await S(),A=null;if(x){let R=d.messageAreasIn(M.modulesCode,M.storeCode,M.composableCode),D=d.pageMessagesScript(x,d.pageLanguages(s,x),R);if(D)A=await ot('data-stx-scoped data-stx-run="always" data-stx-messages',D,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${D.replace(/<\/script/gi,"<\\/script")}</script>`}return[A,M.modulesTag,M.storeTag,M.composableTag,M.frameworkScript].filter((R)=>R!==null)}var pr=!1;function Qn(s){if(pr)return;pr=!0,console.warn(`[stx] messages: ${s instanceof Error?s.message:String(s)}; pages ship every language`)}var gr=!1;function Yn(s){if(gr)return;gr=!0,console.warn(`[stx] ${s instanceof Error?s.message:String(s)}; pages bundle the real modules`)}function es(s,e=""){let c=kr(s,"data-stx-runtime");if(!c)return s;let a=lr(s);if(a===-1||a===c.start){if(!e)return s;return s.slice(0,c.end)+e+s.slice(c.end)}if(a<c.start)return s.slice(0,a)+s.slice(c.start,c.end)+e+`
1299
1299
  `+s.slice(a,c.start)+s.slice(c.end);let g=s.slice(c.start,c.end),n=s.slice(0,c.start)+s.slice(c.end),d=lr(n);if(d===-1)return g+e+`
1300
1300
  `+n;return n.slice(0,d)+g+e+`
1301
1301
  `+n.slice(d)}function ts(s){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return s.replace(e,(c,a,g)=>{let n=s.slice(0,g);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(s,e,c,a,g){if(await _(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return s;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=ke(s,c);let n=!e.__stxProcessingDepth;yn(e);for(let d of a._layerGraph?.configDependencies??[])g.add(d);if(n&&a.runtimeConfig)await kn(e,c,a.runtimeConfig);if(n)Kc(e),e.__stx_scope_seq??={n:0,key:Ws(String(e.__filename??c))},e.__stx_head_injections=Ri(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!T()&&!Tn())&&c&&c.endsWith(".stx"))jo(s,c);try{return await ae.timeAsync("template-processing",async()=>{let d=await rs(s,e,c,a,g);if(n)d=hi(d);if(n&&a.autoShell&&a.buildMode!=="compile"){let y=Ce(a.app?.head,{known:Nr,source:"app.head"}),x=(e.__stx_runtime_head||null)??Pi(),w=(e.__stx_head_raw||"").trim(),v,k=w.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(k)v=k[1].trim(),w=w.replace(k[0],"").trim();let S=e.__sections?.title,M=S?E(S,e,c):void 0,A=x.title||v||M,R=!x.title&&(!!v||!!M),D=x.meta||[],j=new Set(D.map((V)=>at(V)).filter(Boolean)),N={...y,...A&&{title:A},meta:[...(y.meta||[]).filter((V)=>!j.has(at(V))),...D],link:[...y.link||[],...x.link||[]],script:[...y.script||[],...x.script||[]],headRaw:[y.headRaw,w].filter(Boolean).join(`
@@ -1310,7 +1310,7 @@ ${m.trim()}
1310
1310
  @endsection`}}if(D&&m.includes("<script")){let I=J(m),L=I.scripts.map((H)=>mr(H,c)??H);m=xr(I.output,L)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(I,L,H)=>(R[L]=H,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(I,L,H)=>{if(/^(['"]).*\1$/.test(H.trim()))return I;try{let V=u(H.trim(),e);if(V===void 0)return I;let ee=(e.__stx_inline_section_values??=[]).push(V)-1;return R[L]=`{{ __stx_inline_section_values[${ee}] }}`,""}catch{return I}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(I,L,H)=>{if(H.includes("@parent"))R[L]=H.replace("@parent",Ee);else R[L]=H.trim();return""}),e.__sections=R,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(I,L,H)=>R[L]||H||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||"");if(m=us(m,A),D){let I=[],L=J(m),H=fe(L.output,gn,(V,X)=>`\x00STX_ORPHAN_STYLE_${X}\x00`);if(m=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(V,X,ee)=>{let te=X==="SCRIPT"?mr(L.scripts[Number(ee)],c):H.tokens[Number(ee)];if(te)I.push(te);return""}),I.length>0){let V=I.join(`
1311
1311
  `);R.content=R.content?`${R.content}
1312
1312
  ${V}`:V,e.__sections=R}}if(D)try{let I;if(ie.isAbsolute(D))I=D,g.add(D);else I=await _e(()=>vn(D,c,d,g),null,()=>{throw new ce(`Failed to resolve layout path: ${D}`,c,void 0,void 0,`Layout referenced from ${c}`)});if(!I){let te=(G)=>{if(!G)return[];try{let me=ie.isAbsolute(G)?G:ie.resolve(process.cwd(),G);return Kn.readdirSync(me).filter((ve)=>ve.endsWith(".stx")).map((ve)=>ve.replace(/\.stx$/,""))}catch{return[]}},re=[...te(d.layoutsDir),...te(d.fallbackLayoutsDir)].filter((G,me,ve)=>ve.indexOf(G)===me).sort(),le=[d.layoutsDir,d.fallbackLayoutsDir].filter((G)=>typeof G==="string"&&G.length>0),de=le.length>0?` Searched: ${le.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",se=`Layout not found: ${D} (referenced from ${c})`+(re.length>0?`. Available layouts: ${re.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"")+de;if(z.log(Error(se),{layoutPath:D,filePath:c,available:re},"error"),console.error(`[stx] ${se}`),d.debug)throw new ce(se,c);return m}let L=await _e(()=>Bun.file(I).text(),"",()=>{throw new ce(`Failed to read layout file: ${I}`,c,void 0,void 0,"Layout content could not be loaded")});L=cr(L,I);let H=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(d.debug)console.log(`Found nested layout: ${H[1]} in ${I}`);let te={},re=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(se,G,me)=>(te[G]=me.trim(),""));for(let[se,G]of Object.entries(te))if(R[se]&&R[se].includes(Ee)){let me=R[se].indexOf(Ee);R[se]=R[se].slice(0,me)+G+R[se].slice(me+Ee.length)}else if(!R[se])R[se]=G;let le={...e,__sections:R},de=`@layout('${H[1]}')${re}`;return await i(de,le,I,d,g)}let V=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),X=ls(V,A),ee={};return X=X.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(te,re,le)=>(ee[re]=le.trim(),`@slot('${re}')`)),X=X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(te,re,le)=>{if(R[re]){let de=R[re];if(de.includes(Ee)){let se=ee[re]||"",G=de.indexOf(Ee);de=de.slice(0,G)+se+de.slice(G+Ee.length)}return de}return le||""}),X=ns(X,R),X=X.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||""),X=us(X,A),e.__originalFilePath=c,m=await wr(X,e,I,d,g),m=`<!-- stx-layout: ${D} -->
1313
- ${m}`,v(m)}catch(I){if(I instanceof K)throw I;throw new ce(`Error processing layout ${D}: ${I instanceof Error?I.message:String(I)}`,c)}return v(await wr(m,e,c,d,g))}function ns(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ss(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(c)&&n!==void 0)a[g]=n;s.$env=a}async function is(s,e){await _e(()=>Kt(s,e),void 0,(c)=>{z.log(c,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${c.message}`)})}var ct="data-stx-source";function mr(s,e){if(!s)return s;let c=/^<script\b([^>]*)>/i.exec(s);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(ct))return s;return`<script ${ct}="${encodeURIComponent(e)}"${s.slice(7)}`}function os(s){let e=new RegExp(`${ct}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function yr(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function br(s,e,c){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">${yr(s)}</span><span style="display:block;margin-top:4px">${yr(c)}</span></div>`}async function ds(s,e,c,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-9rcpahyb.js")),n=[],d=!T()&&!Tn();for(let m of g(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let w=m.start+m.fullMatch.indexOf(">")+1,v=vr(s,w);if(v===-1)continue;let k=s.slice(w,v);if(!k.trim())continue;let S=os(x)??c,M={index:m.start,length:v+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-r8pkv9s1.js"));await A(k,e,S,{preserveExisting:!0,onFailure:(R)=>{if(R.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:S,kind:R.kind,message:R.message}),!d)return;n.push({...M,markup:br(S,R.kind,R.message)})}})}catch(A){let R=A instanceof Error?A:Error(String(A));if(z.log(R,{filePath:S,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${S}: ${R.message}`),d)n.push({...M,markup:br(S,"unknown",R.message)})}}if(n.length===0)return s;let y=s;for(let m of n.sort((x,w)=>w.index-x.index))y=y.slice(0,m.index)+m.markup+y.slice(m.index+m.length);return y}async function fs(s,e,c){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-nv0hnx9x.js"));return a(s,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return z.log(g,{filePath:c,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${c}: ${g.message}`),s}}async function wr(s,e,c,a,g){let n=s;await _();let d=a;if(n=await ds(n,e,c,a),n=await Ht(n,e,c),n=await Bt(n,e,c),n=await fs(n,e,c),await _(),n=await Ct(n,e,c,d),ke(n))n=Ko(n,e),n=bs(n,e),n=ys(n,e);n=Xo(n),await _();let{processStreamDirectives:y}=await o("stx/streaming",()=>import("./chunk-mjhhvf6e.js"));n=y(n,e),n=await Ho(n,e,c,d,!0),await _(),n=await er(n,e,c,d,g),n=await ps(n,e,c,d,g),await _(),n=hc(n,e,c,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-8nq2snvy.js"));n=m(n,e,c);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-hpw6hq7p.js"));n=x(n,e,c);let{processTransitionDirectives:w,processTransitionAttributes:v}=await o("stx/transitions",()=>import("./chunk-k609nyan.js"));n=w(n,e,c),n=v(n);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:S}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=k(n,e,c),n=S(n);let{processSuspenseDirectives:M}=await o("stx/suspense",()=>import("./chunk-vzpbxgg7.js"));n=M(n,e,c);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-60jtrz9f.js"));n=A(n,e,c);let{processKeepAliveDirectives:R}=await o("stx/keep-alive",()=>import("./chunk-1cdxe8yt.js"));n=R(n,e,c);let{processVirtualListDirectives:D,processVirtualGridDirectives:j,processInfiniteListDirectives:N}=await o("stx/virtual-scrolling",()=>import("./chunk-40r740w1.js"));n=D(n,e,c),n=j(n,e,c),n=N(n,e,c),await _();let{processPartialHydrationDirectives:F,processStaticDirectives:I}=await o("stx/partial-hydration",()=>import("./chunk-8s27mteq.js"));n=F(n,e,c),n=I(n);let{processComputedDirectives:L,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=L(n,e,c),n=H(n,e,c);let{processFormValidationDirectives:V}=await o("stx/forms-validation",()=>import("./chunk-80cnt2vg.js"));n=V(n,e,c);let{processHeadDirective:X,processTitleDirective:ee,processMetaDirective:te,resetHead:re}=await o("stx/head",()=>import("./chunk-339cn2s8.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)re();let le=X(n);if(n=le.content,le.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${le.headContent}
1313
+ ${m}`,v(m)}catch(I){if(I instanceof K)throw I;throw new ce(`Error processing layout ${D}: ${I instanceof Error?I.message:String(I)}`,c)}return v(await wr(m,e,c,d,g))}function ns(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ss(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(c)&&n!==void 0)a[g]=n;s.$env=a}async function is(s,e){await _e(()=>Kt(s,e),void 0,(c)=>{z.log(c,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${c.message}`)})}var ct="data-stx-source";function mr(s,e){if(!s)return s;let c=/^<script\b([^>]*)>/i.exec(s);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(ct))return s;return`<script ${ct}="${encodeURIComponent(e)}"${s.slice(7)}`}function os(s){let e=new RegExp(`${ct}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function yr(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function br(s,e,c){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">${yr(s)}</span><span style="display:block;margin-top:4px">${yr(c)}</span></div>`}async function ds(s,e,c,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-0tse1k5e.js")),n=[],d=!T()&&!Tn();for(let m of g(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let w=m.start+m.fullMatch.indexOf(">")+1,v=vr(s,w);if(v===-1)continue;let k=s.slice(w,v);if(!k.trim())continue;let S=os(x)??c,M={index:m.start,length:v+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-r10h4xmw.js"));await A(k,e,S,{preserveExisting:!0,onFailure:(R)=>{if(R.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:S,kind:R.kind,message:R.message}),!d)return;n.push({...M,markup:br(S,R.kind,R.message)})}})}catch(A){let R=A instanceof Error?A:Error(String(A));if(z.log(R,{filePath:S,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${S}: ${R.message}`),d)n.push({...M,markup:br(S,"unknown",R.message)})}}if(n.length===0)return s;let y=s;for(let m of n.sort((x,w)=>w.index-x.index))y=y.slice(0,m.index)+m.markup+y.slice(m.index+m.length);return y}async function fs(s,e,c){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-t5mnysyw.js"));return a(s,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return z.log(g,{filePath:c,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${c}: ${g.message}`),s}}async function wr(s,e,c,a,g){let n=s;await _();let d=a;if(n=await ds(n,e,c,a),n=await Ht(n,e,c),n=await Bt(n,e,c),n=await fs(n,e,c),await _(),n=await Ct(n,e,c,d),ke(n))n=Ko(n,e),n=bs(n,e),n=ys(n,e);n=Xo(n),await _();let{processStreamDirectives:y}=await o("stx/streaming",()=>import("./chunk-vq4nccm4.js"));n=y(n,e),n=await Ho(n,e,c,d,!0),await _(),n=await er(n,e,c,d,g),n=await ps(n,e,c,d,g),await _(),n=hc(n,e,c,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-8nq2snvy.js"));n=m(n,e,c);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-hpw6hq7p.js"));n=x(n,e,c);let{processTransitionDirectives:w,processTransitionAttributes:v}=await o("stx/transitions",()=>import("./chunk-k609nyan.js"));n=w(n,e,c),n=v(n);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:S}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=k(n,e,c),n=S(n);let{processSuspenseDirectives:M}=await o("stx/suspense",()=>import("./chunk-vzpbxgg7.js"));n=M(n,e,c);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-60jtrz9f.js"));n=A(n,e,c);let{processKeepAliveDirectives:R}=await o("stx/keep-alive",()=>import("./chunk-1cdxe8yt.js"));n=R(n,e,c);let{processVirtualListDirectives:D,processVirtualGridDirectives:j,processInfiniteListDirectives:N}=await o("stx/virtual-scrolling",()=>import("./chunk-40r740w1.js"));n=D(n,e,c),n=j(n,e,c),n=N(n,e,c),await _();let{processPartialHydrationDirectives:F,processStaticDirectives:I}=await o("stx/partial-hydration",()=>import("./chunk-8s27mteq.js"));n=F(n,e,c),n=I(n);let{processComputedDirectives:L,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=L(n,e,c),n=H(n,e,c);let{processFormValidationDirectives:V}=await o("stx/forms-validation",()=>import("./chunk-9hzbqwrp.js"));n=V(n,e,c);let{processHeadDirective:X,processTitleDirective:ee,processMetaDirective:te,resetHead:re}=await o("stx/head",()=>import("./chunk-b30fzxwd.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)re();let le=X(n);if(n=le.content,le.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${le.headContent}
1314
1314
  `;if(n=ee(n,e),n=te(n,e,c),n=Xt(n),n=Vo(n,e),n=_t(n),n=Ut(n),n=await cs(n,e,c,d,g),n=await ps(n,e,c,d,g),await _(),n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=hi(n),n=oe(n,e,c),n=gs(n),await _(),e.__stxProcessingDepth===1)n=Xc(n,e);if(n=Hc(n,e,{filePath:c,buildMode:d.buildMode}),n=Uo(n,e),n=Wo(n,e),n=We(n,e),n=Pt(n,e),n=Nt(n,e),n=await wt(n,e,c,d),n=await bc(n,e,c),n=await wc(n,e,c,d),await _(),n=vc(n,e,c,d),n=ti(n,e,c,d),n=ni(n,e,c),n=ri(n,e,c,d),n=Et(n,e,c,d),n=Vs(n,e),n=Us(n),n=Uc(n),!d.skipEventDirectives)n=Ic(n,e,c);if(n=Vc(n,e,c,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await _(),d.debug){let U=/\bx-data\s*=/.test(n),q=hs(s);if(U&&q)console.warn(`[stx] ${c}: 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
1316
  Prefer signals (state/derived/effect) for new components.`)}n=dc(n,e),n=await ki(n,e,c),await _(),n=Wc(n),n=qc(n),n=mt(n);let{processXElementDirectives:de}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=de(n);let se=e.__originalFilePath||c,G=Le(e);if(n=await Go(n,d,se,G),await _(),n=Dt(n,e),n=await Wt(n,e,c,d),await _(),d.media?.image?.autoSiblings){let U=d.publicDir||"public",{rewriteImagesWithSiblings:q}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-as6x6be8.js"));n=await q(n,{publicDir:U})}if(d.seo?.enabled)n=si(n,e,d);let me=(U,q,Z=!0)=>{if(!q)return U;let he=q.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(U),pe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(he&&ne&&pe){if(Z){let Te=ne.index+pe.index;U=U.slice(0,Te)+he[0]+U.slice(Te+pe[0].length)}if(q=q.replace(he[0],"").trim(),!q)return U}if(/<\/head>/i.test(U))return U.replace(/<\/head>/i,`${q}
@@ -1318,12 +1318,12 @@ ${m}`,v(m)}catch(I){if(I instanceof K)throw I;throw new ce(`Error processing lay
1318
1318
  ${q}`);if(/<html\b[^>]*>/i.test(U))return U.replace(/(<html\b[^>]*>)/i,`$1
1319
1319
  <head>
1320
1320
  ${q}
1321
- </head>`);return U},{renderHead:ve,getHead:Sr}=await o("stx/head",()=>import("./chunk-339cn2s8.js")),Oe=e.__stx_runtime_head??Sr();if(Oe.title||Oe.meta?.length||Oe.link?.length){let U=ve(Oe);if(U)n=me(n,U)}if(le.headContent)n=me(n,le.headContent,!Oe.title);if(d.csp?.enabled&&d.csp.addMetaTag)n=St(n,d.csp,e);if(d.analytics?.enabled)n=ht(n,d);if(d.heatmap?.enabled)n=yc(n,d);if(d.pwa?.enabled&&d.pwa.autoInject!==!1){let{injectPwaTags:U}=await o("stx/pwa/inject",()=>import("./chunk-nfxd6y75.js"));n=U(n,d)}let $r=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(n),Tr=/\bSTX\.\w+/.test(n),_r=/window\.STX\s*=/.test(n);if($r&&Tr&&!_r){let q=`<script data-stx-scoped data-stx-run="once">
1321
+ </head>`);return U},{renderHead:ve,getHead:Sr}=await o("stx/head",()=>import("./chunk-b30fzxwd.js")),Oe=e.__stx_runtime_head??Sr();if(Oe.title||Oe.meta?.length||Oe.link?.length){let U=ve(Oe);if(U)n=me(n,U)}if(le.headContent)n=me(n,le.headContent,!Oe.title);if(d.csp?.enabled&&d.csp.addMetaTag)n=St(n,d.csp,e);if(d.analytics?.enabled)n=ht(n,d);if(d.heatmap?.enabled)n=yc(n,d);if(d.pwa?.enabled&&d.pwa.autoInject!==!1){let{injectPwaTags:U}=await o("stx/pwa/inject",()=>import("./chunk-nfxd6y75.js"));n=U(n,d)}let $r=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(n),Tr=/\bSTX\.\w+/.test(n),_r=/window\.STX\s*=/.test(n);if($r&&Tr&&!_r){let q=`<script data-stx-scoped data-stx-run="once">
1322
1322
  ${pt()}
1323
1323
  </script>`;if(n.includes("</head>")){let Z=n.indexOf("</head>"),ne=n.slice(0,Z).indexOf("<script");if(ne!==-1){let pe=n.slice(0,ne),Te=n.slice(ne);n=pe+q+`
1324
1324
  `+Te}else n=n.replace("</head>",`${q}
1325
1325
  </head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
1326
1326
  ${q}`);else n=q+`
1327
- `+n}{let{scanScriptTags:U}=await o("stx/signal-processing",()=>import("./chunk-9rcpahyb.js")),q=[];for(let Z of U(n)){if(!/\bserver\b/i.test(Z.attrs))continue;let he=Z.start+Z.fullMatch.indexOf(">")+1,ne=vr(n,he);if(ne===-1)continue;let pe=ne+9;while(pe<n.length&&/\s/.test(n[pe]))pe++;q.push({start:Z.start,end:pe})}if(q.length>0){let Z=Array(q.length+1),he=0;for(let ne=0;ne<q.length;ne++){let{start:pe,end:Te}=q[ne];Z[ne]=n.slice(he,pe),he=Te}Z[q.length]=n.slice(he),n=Z.join("")}}let lt=zs(n,c);if(lt.hasScoped)n=lt.html;let Cr=e.__stx_event_bindings||[],Ke=!1,ut=[],Rr=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:Mr}=await o("stx/signal-processing",()=>import("./chunk-9rcpahyb.js"));for(let U of Mr(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ut.push({match:U.fullMatch,attrs:U.attrs,content:U.body});for(let{match:U,attrs:q,content:Z}of ut){Ke=!0;let he=Z;Ne(Z,c,a.strict,e.__originalFilePath);let ne=await je(Z,{eventBindings:Cr,attrs:q,hasColonDirectives:Rr,templateContent:s,filePath:c,projectRoot:process.cwd(),production:Ii(a.buildMode,a.minifyClient),serverData:G});n=n.replace(U,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let U=e.__stx_event_bindings||[];if(U.length>0){let q=ui(U);if(q){let Z=n.lastIndexOf("</body>");n=Z===-1?n+q:n.slice(0,Z)+q+`
1327
+ `+n}{let{scanScriptTags:U}=await o("stx/signal-processing",()=>import("./chunk-0tse1k5e.js")),q=[];for(let Z of U(n)){if(!/\bserver\b/i.test(Z.attrs))continue;let he=Z.start+Z.fullMatch.indexOf(">")+1,ne=vr(n,he);if(ne===-1)continue;let pe=ne+9;while(pe<n.length&&/\s/.test(n[pe]))pe++;q.push({start:Z.start,end:pe})}if(q.length>0){let Z=Array(q.length+1),he=0;for(let ne=0;ne<q.length;ne++){let{start:pe,end:Te}=q[ne];Z[ne]=n.slice(he,pe),he=Te}Z[q.length]=n.slice(he),n=Z.join("")}}let lt=zs(n,c);if(lt.hasScoped)n=lt.html;let Cr=e.__stx_event_bindings||[],Ke=!1,ut=[],Rr=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:Mr}=await o("stx/signal-processing",()=>import("./chunk-0tse1k5e.js"));for(let U of Mr(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ut.push({match:U.fullMatch,attrs:U.attrs,content:U.body});for(let{match:U,attrs:q,content:Z}of ut){Ke=!0;let he=Z;Ne(Z,c,a.strict,e.__originalFilePath);let ne=await je(Z,{eventBindings:Cr,attrs:q,hasColonDirectives:Rr,templateContent:s,filePath:c,projectRoot:process.cwd(),production:Ii(a.buildMode,a.minifyClient),serverData:G});n=n.replace(U,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let U=e.__stx_event_bindings||[];if(U.length>0){let q=ui(U);if(q){let Z=n.lastIndexOf("</body>");n=Z===-1?n+q:n.slice(0,Z)+q+`
1328
1328
  `+n.slice(Z)}e.__stx_event_bindings=[]}}if(!d.skipSignalsRuntime&&!we(n)&&fc(n))n=await ur(n,d);if(n=gc(n),d.csp?.enabled&&d.csp.useNonce&&typeof e.cspNonce==="string")n=$t(n,e.cspNonce);return n}
1329
1329
  export{bt,Ae,ac,as,Mo,Lo,sr,i};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{F,Wf,Zo,a,O,Kh,Xh}from"./chunk-vhckqe4x.js";import"./chunk-46wqk1fb.js";import"./chunk-9mtyxvhk.js";import"./chunk-ncrrxp60.js";import"./chunk-rb6vr5v9.js";import"./chunk-kxj5sp5w.js";import"./chunk-gz45xsbg.js";import"./chunk-tpf8v2mb.js";import"./chunk-47n5s7wk.js";import"./chunk-r8xwd8r1.js";import"./chunk-zjqvbcwa.js";import"./chunk-n91sm385.js";export{O as config,F as defaultConfig,Kh as defineStxConfig,Zo as discoverConfig,a as loadStxConfig,Wf as resolveStxDirectories,Xh as validateConfig};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{x}from"./chunk-756bf5nt.js";function Qe(e,r){let n=y(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function y(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=x(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function k(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function xt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function v(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=Qe(e,c);if(!o)return null;let i=o.endPos,u=xt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,g=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(k(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){g++,t++;continue}if(/^@endif(?![a-z])/.test(d)){g--,t+=6;continue}if(g===0){let b=d.match(/^@elseif\s*/);if(b){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let E=t+b[0].length,m=Qe(a,E);if(!m){t++;continue}s="elseif",f=m.expression,t=m.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function un(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=v(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function vs(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=x(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=xt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let g=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:g,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function Jo(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=Qe(e,c);if(!o)return null;let i=o.endPos,u=xt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),g=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(g){if(f++,s)s.content+=g[0];t+=g[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),b=l.match(/^@default(?![a-z])/),E=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let m=t+d[0].length,P=Qe(a,m);if(!P){t++;continue}s={type:"case",value:P.expression,content:""},t=P.endPos}else if(b&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=b[0].length}else if(E&&l.startsWith("@break"))t+=E[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{Qe,xt,un,vs,Jo};
2
+ import{x}from"./chunk-r8xwd8r1.js";function Qe(e,r){let n=y(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function y(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=x(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function k(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function xt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function v(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=Qe(e,c);if(!o)return null;let i=o.endPos,u=xt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,g=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(k(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){g++,t++;continue}if(/^@endif(?![a-z])/.test(d)){g--,t+=6;continue}if(g===0){let b=d.match(/^@elseif\s*/);if(b){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let E=t+b[0].length,m=Qe(a,E);if(!m){t++;continue}s="elseif",f=m.expression,t=m.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function un(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=v(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function vs(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=x(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=xt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let g=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:g,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function Jo(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=Qe(e,c);if(!o)return null;let i=o.endPos,u=xt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),g=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(g){if(f++,s)s.content+=g[0];t+=g[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),b=l.match(/^@default(?![a-z])/),E=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let m=t+d[0].length,P=Qe(a,m);if(!P){t++;continue}s={type:"case",value:P.expression,content:""},t=P.endPos}else if(b&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=b[0].length}else if(E&&l.startsWith("@break"))t+=E[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{Qe,xt,un,vs,Jo};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Br,io,Ug,Rl,ao}from"./chunk-jfm28sz3.js";export{Ug as buildModuleRegistryScript,ao as buildSharedModuleRegistries,Rl as exportsMutableBinding,Br as registeredModuleIdsIn,io as registeredModuleNamesIn};
2
+ import{Br,io,Ug,Rl,ao}from"./chunk-e3r9fybx.js";export{Ug as buildModuleRegistryScript,ao as buildSharedModuleRegistries,Rl as exportsMutableBinding,Br as registeredModuleIdsIn,io as registeredModuleNamesIn};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{sr,i}from"./chunk-japk9yf6.js";import"./chunk-sfww6v6m.js";import"./chunk-y49nzyxf.js";import"./chunk-4dxq7ft1.js";import"./chunk-5fspjf7x.js";import"./chunk-rm5pnhzx.js";import"./chunk-71fsg3az.js";import"./chunk-48vnw9t9.js";import"./chunk-txfz7gc3.js";import{ve}from"./chunk-7cxbt404.js";import"./chunk-kbv5nwwd.js";import"./chunk-e5seb8f7.js";import"./chunk-vhckqe4x.js";import"./chunk-46wqk1fb.js";import"./chunk-9mtyxvhk.js";import"./chunk-ncrrxp60.js";import"./chunk-rb6vr5v9.js";import"./chunk-kxj5sp5w.js";import{Ne,Vs,Us}from"./chunk-gz45xsbg.js";import"./chunk-tpf8v2mb.js";import"./chunk-47n5s7wk.js";import"./chunk-r8xwd8r1.js";import"./chunk-zjqvbcwa.js";import"./chunk-n91sm385.js";export{sr as buildModulesTag,ve as injectRouterScript,i as processDirectives,Vs as processJsonDirective,Us as processOnceDirective,Ne as validateClientScript};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{pe,zc,Hs,yn,m,Le,je}from"./chunk-y8nx9aa6.js";import{fr,et,F}from"./chunk-pz1y8krt.js";import{sr,i}from"./chunk-58pc09a1.js";import{ve}from"./chunk-f39xf08q.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=fr(s),a=await(e.renderer??((n)=>et(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=pe(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
2
+ import{pe,zc,Hs,yn,m,Le,je}from"./chunk-gz45xsbg.js";import{fr,et,F}from"./chunk-vhckqe4x.js";import{sr,i}from"./chunk-japk9yf6.js";import{ve}from"./chunk-7cxbt404.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=fr(s),a=await(e.renderer??((n)=>et(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=pe(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -14,5 +14,5 @@ ${a.join(`
14
14
  `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=Le(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await je(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await sr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
15
  `);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
16
16
  $1`);else t+=`
17
- ${x}`}t=await ve(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-fdq4ryhv.js");t=await o(t)}catch{}return t}
17
+ ${x}`}t=await ve(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-gg63af5n.js");t=await o(t)}catch{}return t}
18
18
  export{Qa};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{an,Io,Oo,No,Ah,Do}from"./chunk-9zjr0ty9.js";import"./chunk-ncrrxp60.js";import"./chunk-kxj5sp5w.js";import"./chunk-47n5s7wk.js";export{Oo as buildServerApi,Ah as createServerApi,an as discoverServerApi,Io as generateApiTypes,Do as isServerApiSource,No as productionApiDispatcher};
2
+ import{an,Io,Oo,No,Ah,Do}from"./chunk-3e1hmm3h.js";import"./chunk-ncrrxp60.js";import"./chunk-kxj5sp5w.js";import"./chunk-47n5s7wk.js";export{Oo as buildServerApi,Ah as createServerApi,an as discoverServerApi,Io as generateApiTypes,Do as isServerApiSource,No as productionApiDispatcher};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Se,Ot,di,Bs,Dc,Mc,Lc,jc,Fs,fi,Bc,Fc,gi,bn}from"./chunk-y8nx9aa6.js";import{k}from"./chunk-n91sm385.js";import{a}from"./chunk-pz1y8krt.js";import{xo}from"./chunk-gspxyygw.js";import{c}from"./chunk-bygxt820.js";import{existsSync as B,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=bn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),he=[...new Set([...ee,...te])].sort(),be=new Set(ee),xe=new Set(te),ye=new Set(he),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function ke(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let f of t){if(f.offset===void 0)continue;let i=f.kind==="server"?be:xe;Y.lastIndex=0;for(let p of f.code.matchAll(Y)){let g=p.index+p[0].indexOf("{")+1;for(let d of p[1].matchAll(/[^,]+/g)){let y=d[0];if(/^\s*type\s/.test(y))continue;let b=/^\s*([A-Za-z_$][\w$]*)/.exec(y);if(!b)continue;let r=b[1];if(!ye.has(r)||i.has(r))continue;let o=f.offset+g+d.index+b[0].length-r.length,u=e.slice(0,o),S=u.split(`
2
+ import{Se,Ot,di,Bs,Dc,Mc,Lc,jc,Fs,fi,Bc,Fc,gi,bn}from"./chunk-gz45xsbg.js";import{k}from"./chunk-n91sm385.js";import{a}from"./chunk-vhckqe4x.js";import{xo}from"./chunk-a28rhqq2.js";import{c}from"./chunk-bygxt820.js";import{existsSync as B,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=bn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),he=[...new Set([...ee,...te])].sort(),be=new Set(ee),xe=new Set(te),ye=new Set(he),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function ke(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let f of t){if(f.offset===void 0)continue;let i=f.kind==="server"?be:xe;Y.lastIndex=0;for(let p of f.code.matchAll(Y)){let g=p.index+p[0].indexOf("{")+1;for(let d of p[1].matchAll(/[^,]+/g)){let y=d[0];if(/^\s*type\s/.test(y))continue;let b=/^\s*([A-Za-z_$][\w$]*)/.exec(y);if(!b)continue;let r=b[1];if(!ye.has(r)||i.has(r))continue;let o=f.offset+g+d.index+b[0].length-r.length,u=e.slice(0,o),S=u.split(`
3
3
  `).length;s.push({line:S,column:o-(u.lastIndexOf(`
4
4
  `)+1)+1,offset:o,length:r.length,name:r,kind:f.kind,message:ke(r,f.kind)})}}}return s}import E from"path";var we="@stacksjs/stx-typescript-plugin";function $e(e,t){let s=E.resolve(e);for(;;){let f=E.join(s,"tsconfig.json");if(t(f))return f;let i=E.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let f=$e(e,s);if(!f)return;let i=new Set,p=(g)=>{if(i.has(g))return;i.add(g);let d=t(g);if(!d)return;let y=d.compilerOptions?.plugins;if(Array.isArray(y)){let r=y.find((u)=>u?.name===we),o=Array.isArray(r?.libs)?r.libs.filter((u)=>typeof u==="string"):[];return r?{configPath:g,libs:o.map((u)=>E.resolve(E.dirname(g),u))}:null}let b=typeof d.extends==="string"?[d.extends]:Array.isArray(d.extends)?d.extends:[];for(let r of[...b].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let o=E.resolve(E.dirname(g),r.endsWith(".json")?r:`${r}.json`),u=p(o);if(u!==void 0)return u}return};return p(f)??void 0}function la(e,t="",s=""){let f=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",i=di(fi(e)+e.code,t),p=Bs(i.code),g=e.kind==="client"||e.kind==="plain"?Lc(t,e.code):"",d=(f+p).split(`
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Qg}from"./chunk-qtkjbz4n.js";import"./chunk-hws9yb0b.js";import"./chunk-v9jfxbwx.js";import"./chunk-3e1hmm3h.js";import"./chunk-rm5pnhzx.js";import"./chunk-7cxbt404.js";import"./chunk-vhckqe4x.js";import"./chunk-46wqk1fb.js";import"./chunk-9mtyxvhk.js";import"./chunk-ncrrxp60.js";import"./chunk-rb6vr5v9.js";import"./chunk-kxj5sp5w.js";import"./chunk-gz45xsbg.js";import"./chunk-tpf8v2mb.js";import"./chunk-47n5s7wk.js";import"./chunk-r8xwd8r1.js";import"./chunk-zjqvbcwa.js";import"./chunk-n91sm385.js";export{Qg as startProductionServer};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{He,D,Lt}from"./chunk-47n5s7wk.js";import{R}from"./chunk-756bf5nt.js";import{gt,Ee,j,Ke,Te,ma,bo,ha,Dn}from"./chunk-53b8r8d2.js";import{kt,de,tt}from"./chunk-kxj5sp5w.js";import{No}from"./chunk-9zjr0ty9.js";import{Mn}from"./chunk-py5x8fkq.js";import{we}from"./chunk-f39xf08q.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import V from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,H=new Map,z=0;function oe(t,e){if(e.length>J/8)return;H.set(t,e),z+=e.length;for(let[a,r]of H){if(z<=J)break;H.delete(a),z-=r.length}}async function Pn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=H.get(g);if(!l)l=r==="br"?await Y(V.brotliCompress)(i,{params:{[V.constants.BROTLI_PARAM_QUALITY]:h,[V.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(V.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new R(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",j(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ee(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,N=async()=>{let s=await a();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((C)=>C.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((C)=>C!=="x-stx-router"&&C!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",j(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return i();v=N().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let M=await v;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Qg(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=ma(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Mn(r.routeRules),f=new G,h=No(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?D(l):void 0,b=new Map,N=new Map,v=new Map,M=new Map;for(let n of r.routes)try{let C=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(C).text());if(m)c.html=Lt(c.html,m);b.set(n.pattern,c),v.set(n.pattern,tt(c.html)),M.set(n.pattern,we(c.html));let X=P.join(e,n.fragmentPath);if(Ke(c.html,r.routerContainer||"main")&&await Bun.file(X).exists()){let A=await Bun.file(X).text();N.set(n.pattern,m?Lt(A,m):A)}}catch(C){console.warn(`[stx] Failed to load route ${n.pattern}:`,C)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:C,params:c}=de(n.pattern,{page:!0});S.push({regex:C,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return Pn(n,await He(m??D(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let y=P.extname(u).toLowerCase(),B=ie[y]||"application/octet-stream",_=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Ee(n),w=null,q={};if(w=s.get(c)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let o=c.match(p);if(o){w=d,u.forEach((y,B)=>{q[y]=o[B+1]});break}}if(!w){let p=kt(c)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=i(c),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=b.get(w.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=N.get(w.pattern);if(o){let y=v.get(w.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(w.pattern)?{"X-STX-Runtime":M.get(w.pattern)?"true":"false"}:{},...y?{"X-STX-Layout":y.layout,"X-STX-Layout-Group":y.group}:{},...j(),...k.cache?{}:{"Cache-Control":gt}}})}}let d=bo(n.method),u=b.get(w.pattern);if(!u){let o=s.get("/500")||null;if(o){let y=b.get(o.pattern);if(y)return new Response(y.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...j(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:y,redirect:B,cookies:_,status:F,headers:I}=await Dn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return ha(B,_,I);if(y&&y.length>0){let{renderStreamingPage:T,streamToResponse:U}=await import("./chunk-mjhhvf6e.js"),L=new Headers({...j(),...I,"Cache-Control":"private, no-store"});for(let O of _??[])L.append("Set-Cookie",O);if(A&&!d&&Ke(o,r.routerContainer||"main")){let O=tt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",we(o)?"true":"false"),L.set("X-STX-Layout",O.layout),L.set("X-STX-Layout-Group",O.group)}return U(T(A&&!d&&Ke(o,r.routerContainer||"main")?Te(o,r.routerContainer||"main",!0):o,y,{timeoutMs:30000}),{status:F??u.status??200,headers:L})}let x=new Headers({"Content-Type":"text/html",...j(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let T of _??[])x.append("Set-Cookie",T);for(let[T,U]of Object.entries(I??{}))x.set(T,U);if(x.set("Vary",j(x.get("Vary")).Vary),A&&!d&&Ke(o,r.routerContainer||"main")){let T=tt(o);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",we(o)?"true":"false"),x.set("X-STX-Layout",T.layout),x.set("X-STX-Layout-Group",T.group),new Response(Te(o,r.routerContainer||"main",!0),{status:F??u.status??200,headers:x})}return new Response(o,{status:F??u.status??200,headers:x})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
2
+ import{He,D,Lt}from"./chunk-47n5s7wk.js";import{R}from"./chunk-r8xwd8r1.js";import{gt,Ee,j,Ke,Te,ma,bo,ha,Dn}from"./chunk-hws9yb0b.js";import{kt,de,tt}from"./chunk-kxj5sp5w.js";import{No}from"./chunk-3e1hmm3h.js";import{Mn}from"./chunk-py5x8fkq.js";import{we}from"./chunk-7cxbt404.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import V from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,H=new Map,z=0;function oe(t,e){if(e.length>J/8)return;H.set(t,e),z+=e.length;for(let[a,r]of H){if(z<=J)break;H.delete(a),z-=r.length}}async function Pn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=H.get(g);if(!l)l=r==="br"?await Y(V.brotliCompress)(i,{params:{[V.constants.BROTLI_PARAM_QUALITY]:h,[V.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(V.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new R(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",j(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ee(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,N=async()=>{let s=await a();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((C)=>C.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((C)=>C!=="x-stx-router"&&C!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",j(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return i();v=N().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let M=await v;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Qg(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=ma(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Mn(r.routeRules),f=new G,h=No(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?D(l):void 0,b=new Map,N=new Map,v=new Map,M=new Map;for(let n of r.routes)try{let C=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(C).text());if(m)c.html=Lt(c.html,m);b.set(n.pattern,c),v.set(n.pattern,tt(c.html)),M.set(n.pattern,we(c.html));let X=P.join(e,n.fragmentPath);if(Ke(c.html,r.routerContainer||"main")&&await Bun.file(X).exists()){let A=await Bun.file(X).text();N.set(n.pattern,m?Lt(A,m):A)}}catch(C){console.warn(`[stx] Failed to load route ${n.pattern}:`,C)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:C,params:c}=de(n.pattern,{page:!0});S.push({regex:C,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return Pn(n,await He(m??D(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let y=P.extname(u).toLowerCase(),B=ie[y]||"application/octet-stream",_=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Ee(n),w=null,q={};if(w=s.get(c)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let o=c.match(p);if(o){w=d,u.forEach((y,B)=>{q[y]=o[B+1]});break}}if(!w){let p=kt(c)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=i(c),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=b.get(w.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=N.get(w.pattern);if(o){let y=v.get(w.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(w.pattern)?{"X-STX-Runtime":M.get(w.pattern)?"true":"false"}:{},...y?{"X-STX-Layout":y.layout,"X-STX-Layout-Group":y.group}:{},...j(),...k.cache?{}:{"Cache-Control":gt}}})}}let d=bo(n.method),u=b.get(w.pattern);if(!u){let o=s.get("/500")||null;if(o){let y=b.get(o.pattern);if(y)return new Response(y.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...j(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:y,redirect:B,cookies:_,status:F,headers:I}=await Dn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return ha(B,_,I);if(y&&y.length>0){let{renderStreamingPage:T,streamToResponse:U}=await import("./chunk-vq4nccm4.js"),L=new Headers({...j(),...I,"Cache-Control":"private, no-store"});for(let O of _??[])L.append("Set-Cookie",O);if(A&&!d&&Ke(o,r.routerContainer||"main")){let O=tt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",we(o)?"true":"false"),L.set("X-STX-Layout",O.layout),L.set("X-STX-Layout-Group",O.group)}return U(T(A&&!d&&Ke(o,r.routerContainer||"main")?Te(o,r.routerContainer||"main",!0):o,y,{timeoutMs:30000}),{status:F??u.status??200,headers:L})}let x=new Headers({"Content-Type":"text/html",...j(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let T of _??[])x.append("Set-Cookie",T);for(let[T,U]of Object.entries(I??{}))x.set(T,U);if(x.set("Vary",j(x.get("Vary")).Vary),A&&!d&&Ke(o,r.routerContainer||"main")){let T=tt(o);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",we(o)?"true":"false"),x.set("X-STX-Layout",T.layout),x.set("X-STX-Layout-Group",T.group),new Response(Te(o,r.routerContainer||"main",!0),{status:F??u.status??200,headers:x})}return new Response(o,{status:F??u.status??200,headers:x})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
3
3
  export{Pn,Qg};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{bn,rg,sg,og,ig,ag,m,cg,yi,lg,Gc,Jc}from"./chunk-y8nx9aa6.js";import"./chunk-cjm92sfd.js";import"./chunk-47n5s7wk.js";import"./chunk-756bf5nt.js";import"./chunk-zjqvbcwa.js";import"./chunk-n91sm385.js";export{bn as STX_ENGINE_BINDING_NAMES,yi as convertToCommonJS,Gc as extractScriptFromTemplate,m as extractVariables,Jc as hasVariables,cg as isCompleteImport,ag as isMissingBindingFailure,og as isModuleResolutionFailure,ig as isSyntaxFailure,lg as splitDeclaration,rg as stripTypeScript,sg as withoutStxReferrer};
2
+ import{bn,rg,sg,og,ig,ag,m,cg,yi,lg,Gc,Jc}from"./chunk-gz45xsbg.js";import"./chunk-tpf8v2mb.js";import"./chunk-47n5s7wk.js";import"./chunk-r8xwd8r1.js";import"./chunk-zjqvbcwa.js";import"./chunk-n91sm385.js";export{bn as STX_ENGINE_BINDING_NAMES,yi as convertToCommonJS,Gc as extractScriptFromTemplate,m as extractVariables,Jc as hasVariables,cg as isCompleteImport,ag as isMissingBindingFailure,og as isModuleResolutionFailure,ig as isSyntaxFailure,lg as splitDeclaration,rg as stripTypeScript,sg as withoutStxReferrer};
@@ -67,6 +67,6 @@ ${mt.join(`
67
67
  </body>
68
68
  </html>`}var ye=/\s+/y,be=/<(script|style)\b[^>]*>/iy,sn=/<\/script>/gi,on=/<\/style>/gi,Ye=/<!DOCTYPE\b/iy,Je=/<html[\s>]/iy;function En(e){let n=0;while(n<e.length){if(ye.lastIndex=n,ye.exec(e)){n=ye.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}be.lastIndex=n;let i=be.exec(e);if(i){let s=i[1].toLowerCase()==="script"?sn:on;s.lastIndex=be.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(Ye.lastIndex=n,Ye.test(e))return!0;return Je.lastIndex=n,Je.test(e)}return!1}function Ai(e){return En(e)}function pl(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=n,c=e.slice(0,r),p=[];for(let g of i){let h=at(g);if(h&&c.includes(h))continue;p.push(` <meta ${I(g)}>`)}for(let g of s){if(g.href&&c.includes(`href="${g.href}"`))continue;p.push(` <link ${I(g)}>`)}for(let g of o)if(g.src){if(c.includes(`src="${g.src}"`))continue;p.push(` <script ${I(g,(h)=>h==="content")}></script>`)}else if(g.content){if(c.includes(Y(g)))continue;p.push(` ${et(g)}`)}if(a&&!c.includes(a))p.push(` ${a}`);if(p.length===0)return e;return`${e.slice(0,r)}${p.join(`
69
69
  `)}
70
- ${e.slice(r)}`}function Ir(e,n={},r={},i){if(i??Ai(e))return e;return rn(e,n,r)}var an=["og:","article:","book:","profile:","fb:","music:","video:"],cn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Or(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=ln(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=un(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=n.openGraph,c=n[o]??(it(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:an.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function ln(e,n){let r=de(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(cn.test(e.trim()))return e.trim();let i=Ht(e,n);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Ve(i.value)}`,code:t.TYPE_ERROR};return i.value}function un(e,n){let r=de(e);if(r!==null)return r;let i=Ht(e,n);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Ve(s)}`,code:t.TYPE_ERROR};return String(s)}var Nr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],Zs=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],rt={links:"link",metas:"meta",scripts:"script",styles:"style"},tt=new Set,nt=new WeakMap;function Ee(e){if(tt.has(e))return;tt.add(e),console.warn(e)}function gn(e,n){let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=n.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=a}}return r[n.length]}function pn(e,n){let r=e.toLowerCase(),i=n.find((p)=>p.toLowerCase()===r);if(i)return i;let s=rt[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let p of n){let g=gn(r,p.toLowerCase());if(g<a)o=p,a=g}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function Ce(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=nt.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let c=rt[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let g=Array.isArray(o[c])?o[c]:[];o[c]=[...g,...e[a]],delete o[a],Ee(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){Ee(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let p=pn(a,i);Ee(p?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${p}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return nt.set(e,o),o}var C={},dn=[],J={};function Pi(){return C}function iy(){return J}function ay(){C={},dn.length=0,J={}}function fl(e){C=Ue(C,Ce(e,{known:Zs,source:"useHead()"}))}function st(e,n,r){let i=[...e||[]];for(let s of n||[]){let o=r(s),a=o?i.findIndex((c)=>r(c)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Ue(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:st(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:st(e.link,n.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function Cg(e){fl(Qs(e))}function Qs(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let p=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:p})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(i)n.push({property:"og:description",content:i});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(s)n.push({name:"twitter:title",content:s});if(o)n.push({name:"twitter:description",content:o});if(a){n.push({name:"twitter:image",content:a});let p=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(p)n.push({name:"twitter:image:alt",content:p})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let p of e.articleTags)n.push({property:"article:tag",content:p});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:c}}function cy(e){if(J={...J,...e},e.title||e.description)Cg({title:e.title,description:e.description})}function ly(e){let n=typeof e==="function"?e():e;fl({title:n})}function uy(e=C){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${O(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${O(s)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${O(String(o))}"`).join(" ");n.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${O(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,c])=>c!==void 0).map(([a,c])=>{if(typeof c==="boolean")return c?a:"";return`${a}="${O(String(c))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${Y(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";n.push(`<style${i}>${r.content}</style>`)}return n.join(`
71
- `)}function dy(e=C){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${O(r)}"`).join(" ")}function py(e=C){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${O(r)}"`).join(" ")}function O(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function fy(e=C){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),n.name)i.setAttribute("name",n.name);if(n.property)i.setAttribute("property",n.property);document.head.appendChild(i)}i.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(n))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function gy(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
72
- `,"")),headContent:n.trim()}}function my(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,c=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ue(c,{title:a}),""})}function hy(e,n,r=""){if(!e.includes("@meta"))return e;return Ft(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Or(zt(i),n);if(o.kind==="error")return M("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ue(a,{meta:[o.tag]})}return""},(i)=>M("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{R,jt,ae,_,Xs,Ei,Gs,u,f,il,P,ot,Bt,d,Js,t,ce,$r,K,l,_e,Ti,z,Cn,x,al,$i,Ft,zt,Ht,Ve,it,M,Ys,Ri,cl,Rr,Ar,ll,at,ul,Pr,dl,En,Ai,pl,Ir,Or,Nr,Zs,Ce,Pi,iy,ay,fl,Ue,Cg,Qs,cy,ly,uy,dy,py,fy,gy,my,hy};
70
+ ${e.slice(r)}`}function Ir(e,n={},r={},i){if(i??Ai(e))return e;return rn(e,n,r)}var an=["og:","article:","book:","profile:","fb:","music:","video:"],cn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Or(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=ln(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=un(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=n.openGraph,c=n[o]??(it(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:an.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function ln(e,n){let r=de(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(cn.test(e.trim()))return e.trim();let i=Ht(e,n);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Ve(i.value)}`,code:t.TYPE_ERROR};return i.value}function un(e,n){let r=de(e);if(r!==null)return r;let i=Ht(e,n);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Ve(s)}`,code:t.TYPE_ERROR};return String(s)}var Nr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],Zs=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],rt={links:"link",metas:"meta",scripts:"script",styles:"style"},tt=new Set,nt=new WeakMap;function Ee(e){if(tt.has(e))return;tt.add(e),console.warn(e)}function gn(e,n){let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=n.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=a}}return r[n.length]}function pn(e,n){let r=e.toLowerCase(),i=n.find((p)=>p.toLowerCase()===r);if(i)return i;let s=rt[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let p of n){let g=gn(r,p.toLowerCase());if(g<a)o=p,a=g}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function Ce(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=nt.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let c=rt[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let g=Array.isArray(o[c])?o[c]:[];o[c]=[...g,...e[a]],delete o[a],Ee(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){Ee(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let p=pn(a,i);Ee(p?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${p}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return nt.set(e,o),o}var C={},dn=[],J={};function Pi(){return C}function ay(){return J}function cy(){C={},dn.length=0,J={}}function fl(e){C=Ue(C,Ce(e,{known:Zs,source:"useHead()"}))}function st(e,n,r){let i=[...e||[]];for(let s of n||[]){let o=r(s),a=o?i.findIndex((c)=>r(c)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Ue(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:st(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:st(e.link,n.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function Cg(e){fl(Qs(e))}function Qs(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let p=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:p})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(i)n.push({property:"og:description",content:i});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(s)n.push({name:"twitter:title",content:s});if(o)n.push({name:"twitter:description",content:o});if(a){n.push({name:"twitter:image",content:a});let p=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(p)n.push({name:"twitter:image:alt",content:p})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let p of e.articleTags)n.push({property:"article:tag",content:p});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:c}}function ly(e){if(J={...J,...e},e.title||e.description)Cg({title:e.title,description:e.description})}function uy(e){let n=typeof e==="function"?e():e;fl({title:n})}function dy(e=C){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${O(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${O(s)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${O(String(o))}"`).join(" ");n.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${O(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,c])=>c!==void 0).map(([a,c])=>{if(typeof c==="boolean")return c?a:"";return`${a}="${O(String(c))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${Y(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";n.push(`<style${i}>${r.content}</style>`)}return n.join(`
71
+ `)}function py(e=C){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${O(r)}"`).join(" ")}function fy(e=C){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${O(r)}"`).join(" ")}function O(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function gy(e=C){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),n.name)i.setAttribute("name",n.name);if(n.property)i.setAttribute("property",n.property);document.head.appendChild(i)}i.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(n))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function my(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
72
+ `,"")),headContent:n.trim()}}function hy(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,c=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ue(c,{title:a}),""})}function yy(e,n,r=""){if(!e.includes("@meta"))return e;return Ft(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Or(zt(i),n);if(o.kind==="error")return M("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ue(a,{meta:[o.tag]})}return""},(i)=>M("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{R,jt,ae,_,Xs,Ei,Gs,u,f,il,P,ot,Bt,d,Js,t,ce,$r,K,l,_e,Ti,z,Cn,x,al,$i,Ft,zt,Ht,Ve,it,M,Ys,Ri,cl,Rr,Ar,ll,at,ul,Pr,dl,En,Ai,pl,Ir,Or,Nr,Zs,Ce,Pi,ay,cy,fl,Ue,Cg,Qs,ly,uy,dy,py,fy,gy,my,hy,yy};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,l,Ft,zt,Ht,Ve,it,M,Ys,Or,Ue}from"./chunk-756bf5nt.js";var O=/(?<![\w$@])@meta\s*\(/g,I=/(?<![\w$@])@metaTag\s*\(/g,C=/(?<![\w$@])@structuredData\s*\(/g,k=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>M(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function N(e){return"property"in e?`<meta property="${c(e.property)}" content="${c(e.content)}">`:`<meta name="${c(e.name)}" content="${c(e.content)}">`}function ti(e,r,n,g){if(!e.includes("@meta"))return e;let i=Ft(e,O,(a,o)=>{let s=Or(zt(a),r);if(s.kind==="tag")return N(s.tag);if(s.kind==="empty")return"";return M("Meta",o,s.message,n,s.code)},_("Meta",n));return i=Ft(i,I,(a,o)=>{let s=Ht(a,r);if(!s.ok)return M("MetaTag",o,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";if(!it(s.value))return M("MetaTag",o,`expected an object such as { name, content }, got ${Ve(s.value)}`,n,t.TYPE_ERROR);let u=s.value;if(!u.name&&!u.property&&!u.httpEquiv)return M("MetaTag",o,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${c(u.name)}"`;if(u.property)p+=` property="${c(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${c(u.httpEquiv)}"`;return p+=` content="${c(u.content)}">`,p},_("MetaTag",n)),i}function b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(it(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(it))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function ni(e,r,n){if(!e.includes("@structuredData"))return e;return Ft(e,C,(g,i)=>{let a=Ht(g,r);if(!a.ok)return M("StructuredData",i,a.message,n,a.code);if(a.value===void 0||a.value===null)return"";let o=b(a.value);if(!o)return M("StructuredData",i,`expected an object or an array of objects, got ${Ve(a.value)}`,n,t.TYPE_ERROR);try{return E(o)}catch(s){let u=s instanceof Error?s.message:String(s);return M("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var j=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),A={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function ri(e,r,n,g){if(!e.includes("@seo"))return e;return Ft(e,k,(i,a)=>{if(!i.trim())return M("SEO",a,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let o=Ht(i,r);if(!o.ok)return M("SEO",a,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!it(o.value))return M("SEO",a,`expected an object such as { title, description }, got ${Ve(o.value)}`,n,t.TYPE_ERROR);try{return L(o.value,a,n)}catch(s){let u=s instanceof Error?s.message:String(s);return M("SEO",a,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function R(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(it(i))return i;Ys(n,`${r} must be an object, got ${Ve(i)}; its tags were left out`,g);return}function L(e,r,n){let g=Object.keys(e).filter((s)=>!j.has(s));if(g.length>0){let s=g.map((u)=>A[u]?`${u} (use ${A[u]})`:u).join(", ");Ys(r,`@seo does not read ${s}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${c(e.title)}</title>
2
+ import{t,l,Ft,zt,Ht,Ve,it,M,Ys,Or,Ue}from"./chunk-r8xwd8r1.js";var O=/(?<![\w$@])@meta\s*\(/g,I=/(?<![\w$@])@metaTag\s*\(/g,C=/(?<![\w$@])@structuredData\s*\(/g,k=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>M(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function N(e){return"property"in e?`<meta property="${c(e.property)}" content="${c(e.content)}">`:`<meta name="${c(e.name)}" content="${c(e.content)}">`}function ti(e,r,n,g){if(!e.includes("@meta"))return e;let i=Ft(e,O,(a,o)=>{let s=Or(zt(a),r);if(s.kind==="tag")return N(s.tag);if(s.kind==="empty")return"";return M("Meta",o,s.message,n,s.code)},_("Meta",n));return i=Ft(i,I,(a,o)=>{let s=Ht(a,r);if(!s.ok)return M("MetaTag",o,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";if(!it(s.value))return M("MetaTag",o,`expected an object such as { name, content }, got ${Ve(s.value)}`,n,t.TYPE_ERROR);let u=s.value;if(!u.name&&!u.property&&!u.httpEquiv)return M("MetaTag",o,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${c(u.name)}"`;if(u.property)p+=` property="${c(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${c(u.httpEquiv)}"`;return p+=` content="${c(u.content)}">`,p},_("MetaTag",n)),i}function b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(it(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(it))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function ni(e,r,n){if(!e.includes("@structuredData"))return e;return Ft(e,C,(g,i)=>{let a=Ht(g,r);if(!a.ok)return M("StructuredData",i,a.message,n,a.code);if(a.value===void 0||a.value===null)return"";let o=b(a.value);if(!o)return M("StructuredData",i,`expected an object or an array of objects, got ${Ve(a.value)}`,n,t.TYPE_ERROR);try{return E(o)}catch(s){let u=s instanceof Error?s.message:String(s);return M("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var j=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),A={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function ri(e,r,n,g){if(!e.includes("@seo"))return e;return Ft(e,k,(i,a)=>{if(!i.trim())return M("SEO",a,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let o=Ht(i,r);if(!o.ok)return M("SEO",a,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!it(o.value))return M("SEO",a,`expected an object such as { title, description }, got ${Ve(o.value)}`,n,t.TYPE_ERROR);try{return L(o.value,a,n)}catch(s){let u=s instanceof Error?s.message:String(s);return M("SEO",a,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function R(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(it(i))return i;Ys(n,`${r} must be an object, got ${Ve(i)}; its tags were left out`,g);return}function L(e,r,n){let g=Object.keys(e).filter((s)=>!j.has(s));if(g.length>0){let s=g.map((u)=>A[u]?`${u} (use ${A[u]})`:u).join(", ");Ys(r,`@seo does not read ${s}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${c(e.title)}</title>
3
3
  `,i+=`<meta name="title" content="${c(e.title)}">
4
4
  `;if(e.description)i+=`<meta name="description" content="${c(e.description)}">
5
5
  `;if(e.keywords){let s=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;i+=`<meta name="keywords" content="${c(s)}">
@@ -43,7 +43,7 @@ import{t,l,Ft,zt,Ht,Ve,it,M,Ys,Or,Ue}from"./chunk-756bf5nt.js";var O=/(?<![\w$@]
43
43
  ${y}
44
44
  `),h;return h.replace(/<head[^>]*>/,`$&
45
45
  ${y}
46
- `)}function q(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return x(e).length>0}function U(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function c(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Es={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=Or(r,n??{});if(i.kind==="error")return M("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Ue(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Ts={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return l("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return l("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return E(i)}catch(i){let a=i instanceof Error?i.message:String(i);return l("StructuredData",a,t.EVALUATION_ERROR)}},hasEndTag:!0};function Xh(){return[Es,Ts]}function Gh(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:i=0.5,includeLastmod:a=!0}=r,o=n.replace(/\/$/,""),s=(m)=>m.startsWith("http")?m:`${o}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=s(m.loc),f=m.lastmod||(a?new Date().toISOString().split("T")[0]:void 0),D=m.changefreq||g,y=m.priority??i,h=` <url>
46
+ `)}function q(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return x(e).length>0}function U(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function c(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Es={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=Or(r,n??{});if(i.kind==="error")return M("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Ue(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Ts={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return l("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return l("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return E(i)}catch(i){let a=i instanceof Error?i.message:String(i);return l("StructuredData",a,t.EVALUATION_ERROR)}},hasEndTag:!0};function Gh(){return[Es,Ts]}function Jh(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:i=0.5,includeLastmod:a=!0}=r,o=n.replace(/\/$/,""),s=(m)=>m.startsWith("http")?m:`${o}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=s(m.loc),f=m.lastmod||(a?new Date().toISOString().split("T")[0]:void 0),D=m.changefreq||g,y=m.priority??i,h=` <url>
47
47
  <loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
48
48
  <xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(s(w.href))}"/>`;if(f)h+=`
49
49
  <lastmod>${f}</lastmod>`;return h+=`
@@ -53,13 +53,13 @@ ${y}
53
53
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((m)=>m.alternates?.length)?' xmlns:xhtml="http://www.w3.org/1999/xhtml"':""}>
54
54
  ${u.join(`
55
55
  `)}
56
- </urlset>`}function Jh(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
56
+ </urlset>`}function Yh(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
57
57
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
58
58
  ${e.map((a)=>{let o=a.startsWith("http")?a:`${n}${a.startsWith("/")?"":"/"}${a}`;return` <sitemap>
59
59
  <loc>${T(o)}</loc>
60
60
  <lastmod>${g}</lastmod>
61
61
  </sitemap>`}).join(`
62
62
  `)}
63
- </sitemapindex>`}async function Yh(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],a=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,o=new Bun.Glob(`**/${a}`);for await(let s of o.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return s.includes(f.slice(1));return s.startsWith(f)||s.includes(`/${f}`)}))continue;let p=s.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${s}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return i.sort((s,u)=>s.loc.localeCompare(u.loc)),i}function $s(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
64
- `).trim()}function Zh(e){return $s({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
65
- export{ti,ni,ri,si,Es,Ts,Xh,Gh,Jh,Yh,$s,Zh};
63
+ </sitemapindex>`}async function Zh(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],a=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,o=new Bun.Glob(`**/${a}`);for await(let s of o.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return s.includes(f.slice(1));return s.startsWith(f)||s.includes(`/${f}`)}))continue;let p=s.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${s}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return i.sort((s,u)=>s.loc.localeCompare(u.loc)),i}function $s(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
64
+ `).trim()}function Qh(e){return $s({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
65
+ export{ti,ni,ri,si,Es,Ts,Gh,Jh,Yh,Zh,$s,Qh};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Bo,Fo,zo,Mh,ds,Lh}from"./chunk-nrn44374.js";export{ds as clearImageDeliveryCatalog,Mh as deliveredImage,zo as efficientDeliverySources,Bo as getImageDelivery,Fo as isTransparentImage,Lh as prepareImageDelivery};
2
+ import{Bo,Fo,zo,Mh,ds,Lh}from"./chunk-5fspjf7x.js";export{ds as clearImageDeliveryCatalog,Mh as deliveredImage,zo as efficientDeliverySources,Bo as getImageDelivery,Fo as isTransparentImage,Lh as prepareImageDelivery};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{nt}from"./chunk-kxj5sp5w.js";import{yt,Wn}from"./chunk-8qjf16yr.js";import{Ar,Pr,Ir,Nr,Ce}from"./chunk-756bf5nt.js";import{Me,hn,nl,rl}from"./chunk-y8nx9aa6.js";import{D}from"./chunk-47n5s7wk.js";import{_i}from"./chunk-cjm92sfd.js";import{b}from"./chunk-zjek9py2.js";import{i}from"./chunk-58pc09a1.js";import{F,a}from"./chunk-pz1y8krt.js";import{Ec}from"./chunk-ncrrxp60.js";import{Nn,qe,Te,fa,ga,Dn}from"./chunk-53b8r8d2.js";import{an,Oo}from"./chunk-9zjr0ty9.js";import{Mn}from"./chunk-py5x8fkq.js";import{Qt,er,tr}from"./chunk-rrj3gv46.js";import{G}from"./chunk-f39xf08q.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Wn():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);nl();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Me(R))),{context:A}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...F,..._,...o,buildMode:"compile",strict:!1},y=await i(e,A,r,j,w),C=Nn(y)+qe(y),P=rl();return{route:l,sourceFile:n,html:y,fragment:C,placeholders:P,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(w),contentHash:S,status:hn(e),streamTemplates:A.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function am(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Nr,source:"app.head"}),u=e.app?.colorMode,A=e.router?.container||"main",w=n.routeRules??e.routeRules??{},j=Mn(w),y=n.serverApi??e.serverApi,C=typeof y==="object"?y:{};if(y)an(o,C);if(e.runtimeConfig)D(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],H=[];for(let s of B){let f=j(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Ir(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ar(t.html,u);if(g.htmlAttrs)t.html=Pr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await Dn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,A,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=tr(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",er));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Qt}/`)}let N={runtime:v.filename,router:x.filename},T=fa(H,N,r);if(T.routeRules=w,T.routerContainer=A,y)T.apiRoutes=await Oo(o,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await _i(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Ec(e._layerGraph),null,2));ga(T,r);let K=Date.now()-l;return console.log(`
2
+ import{nt}from"./chunk-kxj5sp5w.js";import{yt,Wn}from"./chunk-8qjf16yr.js";import{Ar,Pr,Ir,Nr,Ce}from"./chunk-r8xwd8r1.js";import{Me,hn,nl,rl}from"./chunk-gz45xsbg.js";import{D}from"./chunk-47n5s7wk.js";import{_i}from"./chunk-tpf8v2mb.js";import{b}from"./chunk-sfww6v6m.js";import{i}from"./chunk-japk9yf6.js";import{F,a}from"./chunk-vhckqe4x.js";import{Ec}from"./chunk-ncrrxp60.js";import{Nn,qe,Te,fa,ga,Dn}from"./chunk-hws9yb0b.js";import{an,Oo}from"./chunk-3e1hmm3h.js";import{Mn}from"./chunk-py5x8fkq.js";import{Qt,er,tr}from"./chunk-rrj3gv46.js";import{G}from"./chunk-7cxbt404.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Wn():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);nl();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Me(R))),{context:A}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...F,..._,...o,buildMode:"compile",strict:!1},y=await i(e,A,r,j,w),C=Nn(y)+qe(y),P=rl();return{route:l,sourceFile:n,html:y,fragment:C,placeholders:P,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(w),contentHash:S,status:hn(e),streamTemplates:A.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function am(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Nr,source:"app.head"}),u=e.app?.colorMode,A=e.router?.container||"main",w=n.routeRules??e.routeRules??{},j=Mn(w),y=n.serverApi??e.serverApi,C=typeof y==="object"?y:{};if(y)an(o,C);if(e.runtimeConfig)D(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],H=[];for(let s of B){let f=j(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Ir(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ar(t.html,u);if(g.htmlAttrs)t.html=Pr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await Dn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,A,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=tr(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",er));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Qt}/`)}let N={runtime:v.filename,router:x.filename},T=fa(H,N,r);if(T.routeRules=w,T.routerContainer=A,y)T.apiRoutes=await Oo(o,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await _i(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Ec(e._layerGraph),null,2));ga(T,r);let K=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:N,outputDir:r,duration:K}}
4
4
  export{am};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{W}from"./chunk-gz45xsbg.js";function n(t){return W(t)}
3
+ export{n};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{jh,Lf,ps}from"./chunk-5fspjf7x.js";import"./chunk-rm5pnhzx.js";import"./chunk-48vnw9t9.js";import"./chunk-kbv5nwwd.js";import{Cr}from"./chunk-gz45xsbg.js";import"./chunk-tpf8v2mb.js";import"./chunk-47n5s7wk.js";import{ot}from"./chunk-r8xwd8r1.js";import"./chunk-zjqvbcwa.js";import"./chunk-n91sm385.js";export{ot as freeIdentifiers,ps as processComponents,Lf as processESImports,Cr as rendersAsElement,jh as resetTemplateLoopWarnings};