@stacksjs/stx 0.2.330 → 0.2.332

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 (65) hide show
  1. package/dist/{chunk-xjaen1xx.js → chunk-0ck064qf.js} +1 -1
  2. package/dist/{chunk-hfwwqvmn.js → chunk-0tyw6va3.js} +1 -1
  3. package/dist/chunk-1f43h46q.js +2 -0
  4. package/dist/{chunk-denfdjdr.js → chunk-2evvkp6k.js} +1 -1
  5. package/dist/{chunk-d3mdskgy.js → chunk-2gfjp8q1.js} +1 -1
  6. package/dist/{chunk-ncfbxy9j.js → chunk-2h6pmz31.js} +1 -1
  7. package/dist/{chunk-ey4sca09.js → chunk-2jzntvfr.js} +21 -10
  8. package/dist/{chunk-qqceavq5.js → chunk-41fhbhbn.js} +1 -1
  9. package/dist/chunk-424e1tyj.js +33 -0
  10. package/dist/{chunk-zt78vydy.js → chunk-476dmgkd.js} +1 -1
  11. package/dist/{chunk-8kvd3g8y.js → chunk-4zwjqcw4.js} +1 -1
  12. package/dist/{chunk-5cncs85f.js → chunk-6t9xcjag.js} +1 -1
  13. package/dist/{chunk-7cvdxe22.js → chunk-73sq0e73.js} +1 -1
  14. package/dist/{chunk-858xqty6.js → chunk-793gxvjv.js} +1 -1
  15. package/dist/{chunk-z1121pkn.js → chunk-7ymv9pd6.js} +1 -1
  16. package/dist/{chunk-gzzgnw3t.js → chunk-85e05tzn.js} +1 -1
  17. package/dist/{chunk-ff5ztp8g.js → chunk-94c8we2y.js} +1 -1
  18. package/dist/{chunk-c24ykq78.js → chunk-axe4hgv2.js} +1 -1
  19. package/dist/{chunk-4mb08201.js → chunk-b9jknz2y.js} +1 -1
  20. package/dist/{chunk-cbzb7wa6.js → chunk-be5es9s3.js} +1 -1
  21. package/dist/{chunk-eak7y9sv.js → chunk-cvedh4a7.js} +1 -1
  22. package/dist/{chunk-xjw29mp3.js → chunk-d9ajsetq.js} +1 -1
  23. package/dist/{chunk-xqqfajvm.js → chunk-epm72mma.js} +1 -1
  24. package/dist/{chunk-x3p8ardj.js → chunk-fw4nxafz.js} +1 -1
  25. package/dist/{chunk-pew5av90.js → chunk-g5e5kja6.js} +1 -1
  26. package/dist/{chunk-n26hw8ak.js → chunk-htsetvt7.js} +1 -1
  27. package/dist/{chunk-8n96ck39.js → chunk-j762mz1x.js} +1 -1
  28. package/dist/{chunk-vd0bvmas.js → chunk-kbv4km5j.js} +1 -1
  29. package/dist/{chunk-r7pr9mch.js → chunk-kgxbad5v.js} +1 -1
  30. package/dist/{chunk-mk51d96e.js → chunk-kptkb3j4.js} +1 -1
  31. package/dist/{chunk-he0pgw47.js → chunk-kx30cykj.js} +2 -2
  32. package/dist/{chunk-dr0thyq9.js → chunk-kxtfmwy0.js} +2 -2
  33. package/dist/{chunk-x1ra8wrz.js → chunk-m3ya2dvf.js} +1 -1
  34. package/dist/{chunk-1e4sb5dk.js → chunk-mbaew5a8.js} +2 -2
  35. package/dist/{chunk-dr0hzy88.js → chunk-mkk731dy.js} +1 -1
  36. package/dist/{chunk-wd71swap.js → chunk-mv6dw7dn.js} +1 -1
  37. package/dist/{chunk-e8z1hde4.js → chunk-n2y2941z.js} +1 -1
  38. package/dist/{chunk-ykhhn5ed.js → chunk-qjh40e31.js} +1 -1
  39. package/dist/{chunk-7zjqjcc9.js → chunk-r6g1n649.js} +17 -17
  40. package/dist/chunk-rsp59c5x.js +2 -0
  41. package/dist/{chunk-v91ge29x.js → chunk-sj3k3jwt.js} +1 -1
  42. package/dist/{chunk-dgjfm31x.js → chunk-tbsgchrd.js} +1 -1
  43. package/dist/{chunk-jsff6z2m.js → chunk-tz7t6ybm.js} +2 -2
  44. package/dist/{chunk-5pvfm908.js → chunk-v82r1j02.js} +1 -1
  45. package/dist/{chunk-7cp9tswt.js → chunk-w4ckece4.js} +9 -9
  46. package/dist/{chunk-gtgnt6kn.js → chunk-wbtamqdk.js} +1 -1
  47. package/dist/{chunk-m9b8ahkp.js → chunk-x3evfp7c.js} +1 -1
  48. package/dist/chunk-x7qbgqps.js +2 -0
  49. package/dist/{chunk-pm3t0mdq.js → chunk-xgeps3fn.js} +1 -1
  50. package/dist/{chunk-yns8ygvd.js → chunk-zgnk8tpp.js} +1 -1
  51. package/dist/{chunk-pkbj0aht.js → chunk-zhtttwz2.js} +1 -1
  52. package/dist/chunk-znn3ngey.js +2 -0
  53. package/dist/cli.js +7 -7
  54. package/dist/composable-loader.js +10 -5
  55. package/dist/craft-entry.js +1 -1
  56. package/dist/craft.js +1 -1
  57. package/dist/process.js +1 -1
  58. package/dist/pwa.js +1 -1
  59. package/dist/ssg.js +2 -2
  60. package/package.json +5 -5
  61. package/dist/chunk-3vhf96nd.js +0 -2
  62. package/dist/chunk-8g05y0eh.js +0 -2
  63. package/dist/chunk-cs0brex5.js +0 -2
  64. package/dist/chunk-erzhx49f.js +0 -28
  65. package/dist/chunk-tm5rsehg.js +0 -2
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Le as c,Me as d,Ne as e,Oe as f,Pe as g,Qe as h}from"./chunk-dr0hzy88.js";import{Xf as a,_f as b}from"./chunk-ncfbxy9j.js";import"./chunk-erzhx49f.js";import"./chunk-xwxdwqn9.js";import"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{d as virtualPathFor,g as typecheckStxFiles,e as sourcePathFor,h as formatTypecheckDiagnostics,f as findRuntimeTypeDeclarations,b as extractTemplateExpressions,a as extractScriptBlocks,c as buildVirtualSource};
2
+ import{Le as c,Me as d,Ne as e,Oe as f,Pe as g,Qe as h}from"./chunk-mkk731dy.js";import{Xf as a,_f as b}from"./chunk-2h6pmz31.js";import"./chunk-424e1tyj.js";import"./chunk-xwxdwqn9.js";import"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{d as virtualPathFor,g as typecheckStxFiles,e as sourcePathFor,h as formatTypecheckDiagnostics,f as findRuntimeTypeDeclarations,b as extractTemplateExpressions,a as extractScriptBlocks,c as buildVirtualSource};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ar as g,Em as O,So as R,dq as H,vq as x}from"./chunk-7zjqjcc9.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
2
+ import{Ar as g,Em as O,So as R,dq as H,vq as x}from"./chunk-r6g1n649.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),w.set(Z.name,H(Z.content,j,q,G,$))}K.enqueue(`
5
5
  <script>
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pi as a,Qi as b}from"./chunk-d9ajsetq.js";import"./chunk-xwxdwqn9.js";import"./chunk-qjh40e31.js";import"./chunk-kxtfmwy0.js";import"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{a as getStoreScript,b as clearStoreCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$j as h,Uj as a,Vj as b,Wj as c,Xj as d,Yj as e,Zj as f,_j as g,ak as i,bk as j,ck as k,dk as l}from"./chunk-x1ra8wrz.js";import"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,l as hashFilePath,h as getServeClientAsset,f as getCachedSignalsRuntime,g as getCachedRouterScript,i as clearDevCaches,j as checkCache,k as cacheTemplate,e as __setSignalsGeneratorsForTest};
2
+ import{$j as h,Uj as a,Vj as b,Wj as c,Xj as d,Yj as e,Zj as f,_j as g,ak as i,bk as j,ck as k,dk as l}from"./chunk-m3ya2dvf.js";import"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,l as hashFilePath,h as getServeClientAsset,f as getCachedSignalsRuntime,g as getCachedRouterScript,i as clearDevCaches,j as checkCache,k as cacheTemplate,e as __setSignalsGeneratorsForTest};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Oo as a,Po as b,Qo as c,Ro as d,So as e,To as f,Uo as g,Vo as h,Wo as i,Xo as j}from"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
2
+ import{Oo as a,Po as b,Qo as c,Ro as d,So as e,To as f,Uo as g,Vo as h,Wo as i,Xo as j}from"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{fm as e,go as f,ho as h,io as u,jo as l,ro as m}from"./chunk-7zjqjcc9.js";import{nt as D}from"./chunk-fc1g65e0.js";import{fv as g}from"./chunk-tjhzxbxa.js";import JJ from"path";import C from"fs";import S from"path";function k(K,Z,$,J){let Q=0;for(let j=Z;j<K.length;j++)if(K[j]===$)Q++;else if(K[j]===J&&!(J===">"&&K[j-1]==="=")){if(--Q===0)return j}return-1}function WJ(K){let Z=D(K),$=0,J=0,Q=[];for(let j=0;j<Z.length;j++)if("([{".includes(Z[j]))$++;else if(")]}".includes(Z[j]))$--;else if(Z[j]===","&&$===0)Q.push(K.slice(J,j).trim()),J=j+1;return Q.push(K.slice(J).trim()),Q}function R(K,Z){let $=D(K),J=new RegExp(`\\b(?:${Z.map((Q)=>Q.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Q of $.matchAll(J)){let j=Q.index+Q[0].length,G="";if($[j]==="<"){let U=k($,j,"<",">");if(U<0)continue;G=K.slice(j+1,U),j=U+1;while(/\s/.test($[j]||"")&&j<$.length)j++}if($[j]!=="(")continue;let W=k($,j,"(",")");if(W>=0)return{type:G,args:WJ(K.slice(j+1,W))}}return null}var x=`
2
+ import{fm as e,go as f,ho as h,io as u,jo as l,ro as m}from"./chunk-r6g1n649.js";import{nt as D}from"./chunk-fc1g65e0.js";import{fv as g}from"./chunk-tjhzxbxa.js";import JJ from"path";import C from"fs";import S from"path";function k(K,Z,$,J){let Q=0;for(let j=Z;j<K.length;j++)if(K[j]===$)Q++;else if(K[j]===J&&!(J===">"&&K[j-1]==="=")){if(--Q===0)return j}return-1}function WJ(K){let Z=D(K),$=0,J=0,Q=[];for(let j=0;j<Z.length;j++)if("([{".includes(Z[j]))$++;else if(")]}".includes(Z[j]))$--;else if(Z[j]===","&&$===0)Q.push(K.slice(J,j).trim()),J=j+1;return Q.push(K.slice(J).trim()),Q}function R(K,Z){let $=D(K),J=new RegExp(`\\b(?:${Z.map((Q)=>Q.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Q of $.matchAll(J)){let j=Q.index+Q[0].length,G="";if($[j]==="<"){let U=k($,j,"<",">");if(U<0)continue;G=K.slice(j+1,U),j=U+1;while(/\s/.test($[j]||"")&&j<$.length)j++}if($[j]!=="(")continue;let W=k($,j,"(",")");if(W>=0)return{type:G,args:WJ(K.slice(j+1,W))}}return null}var x=`
3
3
  type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
4
4
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
5
5
  type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{pw as Ee,qw as d}from"./chunk-5ep11kvc.js";function N(t){return t.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>v.includes(a))}function w(t){return N(t.replace(/^\//,""))}var v;var k=d(()=>{v=["components","layouts","partials","emails"]});import f from"fs";import b from"path";function A(t,e){let a=t.filter((s)=>!w(s.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let s of a){let l=[];for(let c of s.params){let u=s.pattern.includes(`:${c}?`)?"?":"";l.push(`${c}${u}: string`)}let i=l.join("; ");r.push(` '${s.pattern}': { ${i} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
2
+ import{pw as Re,qw as d}from"./chunk-5ep11kvc.js";function N(t){return t.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>v.includes(a))}function w(t){return N(t.replace(/^\//,""))}var v;var k=d(()=>{v=["components","layouts","partials","emails"]});import f from"fs";import b from"path";function A(t,e){let a=t.filter((s)=>!w(s.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let s of a){let l=[];for(let c of s.params){let u=s.pattern.includes(`:${c}?`)?"?":"";l.push(`${c}${u}: string`)}let i=l.join("; ");r.push(` '${s.pattern}': { ${i} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
3
  `),o=b.join(e,"route-types.d.ts");try{if(f.existsSync(o)&&f.readFileSync(o,"utf8")===n)return;f.mkdirSync(e,{recursive:!0}),f.writeFileSync(o,n)}catch{}}function C(t,e,a){let r=process.cwd(),n=b.relative(r,a),o=t.filter((l)=>!w(l.pattern)),s=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let l of o){let i=b.relative(r,l.filePath).replace(/\\/g,"/"),c=JSON.stringify(l.params),u=l.layout?`, layout: '${b.relative(r,l.layout).replace(/\\/g,"/")}'`:"";s.push(` { pattern: '${l.pattern}', filePath: '${i}', isDynamic: ${l.isDynamic}, params: ${c}${u} },`)}s.push("] as const",""),s.push("export type RouteName = typeof routes[number]['pattern']",""),f.mkdirSync(e,{recursive:!0}),f.writeFileSync(b.join(e,"routes.ts"),s.join(`
4
- `))}var P=d(()=>{k()});import K from"path";function T(t,e){let r=K.relative(e,t).replace(/\.(stx|md)$/,"");if(r=r.split(K.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function x(t){let e=[],a="",r=0;while(r<t.length){let n=t.slice(r),o=/^\/:([^/?*]+)\?/.exec(n);if(o){e.push(o[1]),a+="(?:/([^/]+))?",r+=o[0].length;continue}let s=/^:([^/?*]+)\*/.exec(n);if(s){e.push(s[1]),a+="(.+)",r+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(n);if(l){e.push(l[1]),a+="([^/]+)",r+=l[0].length;continue}a+=t[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:e}}function $(t,e){let a=t===""?"/":t;for(let r of e){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((s,l)=>{o[s]=n[l+1]}),{route:r,params:o}}}return null}function z(t){let e=t.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return x(e)}var B=()=>{};import Ce from"fs";import G from"path";function R(t,e){let a=[],r=G.dirname(t);while(r.startsWith(e)||r===e){let n=G.join(r,"_layout.stx");if(Ce.existsSync(n))a.unshift(n);if(r===e)break;r=G.dirname(r)}return a}var U=()=>{};import E from"fs";import p from"path";function Y(t,e){let a=[];if(!E.existsSync(t))return a;let r=E.readdirSync(t,{withFileTypes:!0});for(let n of r){let o=p.join(t,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(v.includes(n.name))continue;a.push(...Y(o,e))}else if(n.isFile()){let s=p.extname(n.name);if(e.includes(s)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class L{routes;pagesDir;pagesDirs;config;constructor(t,e={}){this.config=e;let a=e.pagesDirs&&e.pagesDirs.length>0?e.pagesDirs:[e.pagesDir||"pages"];this.pagesDirs=a.map((i)=>p.resolve(t,i)),this.pagesDir=this.pagesDirs[0];let r=e.extensions||[".stx"],n=(i)=>{let c=p.resolve(t,i);try{return E.realpathSync(c)}catch{return c}},o=(e.exclude??[]).filter((i)=>typeof i==="string"&&i.trim()!=="").map(n),s=(i)=>{if(o.length===0)return!1;let c=n(i);return o.some((u)=>c===u||c.startsWith(`${u}${p.sep}`))},l=new Set;this.routes=[];for(let i of this.pagesDirs){let c=Y(i,r).filter((h)=>!s(h)),u=new Map;for(let h of c){let m=T(h,i),y=e.pagesDirs?m.replace(/:[\w]+/g,":param"):m;if(e.pagesDirs&&u.has(y))throw Error(`Conflicting layer pages for ${m}: ${u.get(y)} and ${h}`);if(u.set(y,h),l.has(y))continue;l.add(y);let{regex:Ae,params:W}=x(m),I=e.layouts!==!1?R(h,i):[];this.routes.push({pattern:m,regex:Ae,params:W,filePath:h,isDynamic:W.length>0,layout:I.length>0?I[I.length-1]:void 0})}}if(this.routes.sort((i,c)=>{if(!i.isDynamic&&c.isDynamic)return-1;if(i.isDynamic&&!c.isDynamic)return 1;let u=i.pattern.split("/").length,h=c.pattern.split("/").length;if(u!==h)return h-u;return i.pattern.localeCompare(c.pattern)}),e.emit!==!1){let i=p.resolve(t,e.stateDir||process.env.STX_DIR?.trim()||".stx");A(this.routes,i),C(this.routes,i,this.pagesDir)}}match(t){let e=t===""?"/":t;for(let a of this.routes){let r=e.match(a.regex);if(r){let n={};return a.params.forEach((o,s)=>{n[o]=r[s+1]}),{route:a,params:n}}}return null}resolve(t,e){let a=this.routes.find((n)=>n.pattern===t||n.filePath.includes(t));if(!a)return"#not-found";let r=a.pattern;if(e)for(let[n,o]of Object.entries(e))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(t){this.routes.push(t),this.routes.sort((e,a)=>{if(!e.isDynamic&&a.isDynamic)return-1;if(e.isDynamic&&!a.isDynamic)return 1;return e.pattern.localeCompare(a.pattern)})}getLayout(t){return t.layout??null}}function J(t,e){return new L(t,e)}function Z(t,e){let a=[`${e}.stx`,"error.stx"];for(let r of a){let n=p.join(t,r);if(E.existsSync(n))return n}return null}function Q(t,e){return t.map((a)=>{let r=p.relative(e,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var ee=d(()=>{P();B();U();k()});function te(t){_=t.replace(/\/$/,"")}function re(t,e,a={}){g[t]={path:e,name:t,params:a}}function ae(t){for(let[e,a]of Object.entries(t))if(typeof a==="string")g[e]={path:a,name:e};else g[e]={...a,name:e}}function ne(t,e={},a=!1){let r=g[t];if(!r)return console.warn(`Route [${t}] not defined.`),"#undefined-route";let n={...r.params,...e},o=r.path;o=o.replace(/:(\w+)/g,(l,i)=>{let c=n[i];if(c===void 0)return console.warn(`Missing parameter [${i}] for route [${t}].`),`:${i}`;return delete n[i],encodeURIComponent(String(c))});let s=Object.entries(n);if(s.length>0){let l=s.map(([i,c])=>`${encodeURIComponent(i)}=${encodeURIComponent(String(c))}`).join("&");o+=(o.includes("?")?"&":"?")+l}return a&&_?`${_}${o}`:o}function se(){for(let t of Object.keys(g))delete g[t];_=""}var g,_="";var oe=d(()=>{g={}});import ie from"fs";import le from"path";function ce(t,e={}){return{type:"redirect",path:t,options:{replace:e.replace??!1,external:e.external??!1,redirectCode:e.redirectCode??302}}}function ue(t){return{type:"abort",error:typeof t==="string"?{statusCode:500,message:t}:t}}function he(t,e={}){return{handler:t,mode:e.mode??"universal"}}function X(t){let e={};if(!t)return e;let a=t.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let s=n.trim(),l=o.join("=").trim();if(s)e[s]=decodeURIComponent(l)}}return e}function O(t,e,a={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(e)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function j(t,e){let a=t.headers.get("cookie")||"",r=X(a);return{get(n){return r[n]},set(n,o,s={}){r[n]=o,e.append("Set-Cookie",O(n,o,s))},delete(n){delete r[n],e.append("Set-Cookie",O(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function q(){return{get(t){if(typeof document>"u")return;return X(document.cookie)[t]},set(t,e,a={}){if(typeof document>"u")return;document.cookie=O(t,e,a)},delete(t){if(typeof document>"u")return;document.cookie=O(t,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return X(document.cookie)}}}function H(){let t=typeof window<"u"&&typeof window.localStorage<"u";return{get(e){if(!t)return null;try{return window.localStorage.getItem(e)}catch{return null}},set(e,a){if(!t)return;try{window.localStorage.setItem(e,a)}catch{}},remove(e){if(!t)return;try{window.localStorage.removeItem(e)}catch{}},isAvailable(){return t}}}function M(t,e){S.set(t,e)}function V(t){return S.get(t)}function de(t){return S.has(t)}function pe(){S.clear()}function fe(){return Array.from(S.keys())}async function ge(t,e="middleware"){let a=le.resolve(t,e);if(!ie.existsSync(a))return;let r=ie.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),s=le.join(a,n);try{let i=(await import(s)).default;if(i&&typeof i.handler==="function")M(o,i);else if(typeof i==="function")M(o,{handler:i,mode:"universal"})}catch(l){console.warn(`Failed to load middleware '${o}' from ${s}:`,l)}}}function Te(t){let e={};if(!t)return e;let a=new URLSearchParams(t);for(let[r,n]of a)e[r]=n;return e}function me(t,e,a,r=""){return{path:t,params:e,query:Te(r),fullPath:r?`${t}?${r}`:t,meta:a}}function ye(t,e,a,r){let n=r?.isServer??typeof window>"u",o=!n,s=new Headers;return{to:t,from:e,isClient:o,isServer:n,cookies:n&&a?j(a,s):q(),storage:H(),state:{},request:a,responseHeaders:s}}async function ve(t,e){let a=Array.isArray(t)?t:[t],r=e.isServer;for(let n of a){let o=V(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:e.state,responseHeaders:e.responseHeaders};if(o.mode==="server"&&!r)continue;try{let s=await o.handler(e);if(s){if(s.type==="redirect")return{passed:!1,redirect:s,state:e.state,responseHeaders:e.responseHeaders};if(s.type==="abort")return{passed:!1,abort:s,state:e.state,responseHeaders:e.responseHeaders}}}catch(s){return console.error(`Error in middleware '${n}':`,s),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:s instanceof Error?s.message:"Middleware error"}},state:e.state,responseHeaders:e.responseHeaders}}}return{passed:!0,state:e.state,responseHeaders:e.responseHeaders}}var S;var we=d(()=>{S=new Map});function D(t){let a=t.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function be(t){let e=t.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=t.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=t.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=e?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||D(n)}}var xe=()=>{};function Re(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}function Se(){if(F)return F;return F=Re(`
4
+ `))}var P=d(()=>{k()});import K from"path";function T(t,e){let r=K.relative(e,t).replace(/\.(stx|md)$/,"");if(r=r.split(K.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function x(t){let e=[],a="",r=0;while(r<t.length){let n=t.slice(r),o=/^\/:([^/?*]+)\?/.exec(n);if(o){e.push(o[1]),a+="(?:/([^/]+))?",r+=o[0].length;continue}let s=/^:([^/?*]+)\*/.exec(n);if(s){e.push(s[1]),a+="(.+)",r+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(n);if(l){e.push(l[1]),a+="([^/]+)",r+=l[0].length;continue}a+=t[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:e}}function $(t,e){let a=t===""?"/":t;for(let r of e){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((s,l)=>{o[s]=n[l+1]}),{route:r,params:o}}}return null}function z(t){let e=t.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return x(e)}var B=()=>{};import Ce from"fs";import G from"path";function E(t,e){let a=[],r=G.dirname(t);while(r.startsWith(e)||r===e){let n=G.join(r,"_layout.stx");if(Ce.existsSync(n))a.unshift(n);if(r===e)break;r=G.dirname(r)}return a}var U=()=>{};import R from"fs";import p from"path";function Y(t,e){let a=[];if(!R.existsSync(t))return a;let r=R.readdirSync(t,{withFileTypes:!0});for(let n of r){let o=p.join(t,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(v.includes(n.name))continue;a.push(...Y(o,e))}else if(n.isFile()){let s=p.extname(n.name);if(e.includes(s)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class L{routes;pagesDir;pagesDirs;config;constructor(t,e={}){this.config=e;let a=e.pagesDirs&&e.pagesDirs.length>0?e.pagesDirs:[e.pagesDir||"pages"];this.pagesDirs=a.map((i)=>p.resolve(t,i)),this.pagesDir=this.pagesDirs[0];let r=e.extensions||[".stx"],n=(i)=>{let c=p.resolve(t,i);try{return R.realpathSync(c)}catch{return c}},o=(e.exclude??[]).filter((i)=>typeof i==="string"&&i.trim()!=="").map(n),s=(i)=>{if(o.length===0)return!1;let c=n(i);return o.some((u)=>c===u||c.startsWith(`${u}${p.sep}`))},l=new Set;this.routes=[];for(let i of this.pagesDirs){let c=Y(i,r).filter((h)=>!s(h)),u=new Map;for(let h of c){let m=T(h,i),y=e.pagesDirs?m.replace(/:[\w]+/g,":param"):m;if(e.pagesDirs&&u.has(y))throw Error(`Conflicting layer pages for ${m}: ${u.get(y)} and ${h}`);if(u.set(y,h),l.has(y))continue;l.add(y);let{regex:Ae,params:W}=x(m),I=e.layouts!==!1?E(h,i):[];this.routes.push({pattern:m,regex:Ae,params:W,filePath:h,isDynamic:W.length>0,layout:I.length>0?I[I.length-1]:void 0})}}if(this.routes.sort((i,c)=>{if(!i.isDynamic&&c.isDynamic)return-1;if(i.isDynamic&&!c.isDynamic)return 1;let u=i.pattern.split("/").length,h=c.pattern.split("/").length;if(u!==h)return h-u;return i.pattern.localeCompare(c.pattern)}),e.emit!==!1){let i=p.resolve(t,e.stateDir||process.env.STX_DIR?.trim()||".stx");A(this.routes,i),C(this.routes,i,this.pagesDir)}}match(t){let e=t===""?"/":t;for(let a of this.routes){let r=e.match(a.regex);if(r){let n={};return a.params.forEach((o,s)=>{n[o]=r[s+1]}),{route:a,params:n}}}return null}resolve(t,e){let a=this.routes.find((n)=>n.pattern===t||n.filePath.includes(t));if(!a)return"#not-found";let r=a.pattern;if(e)for(let[n,o]of Object.entries(e))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(t){this.routes.push(t),this.routes.sort((e,a)=>{if(!e.isDynamic&&a.isDynamic)return-1;if(e.isDynamic&&!a.isDynamic)return 1;return e.pattern.localeCompare(a.pattern)})}getLayout(t){return t.layout??null}}function J(t,e){return new L(t,e)}function Z(t,e){let a=[`${e}.stx`,"error.stx"];for(let r of a){let n=p.join(t,r);if(R.existsSync(n))return n}return null}function Q(t,e){return t.map((a)=>{let r=p.relative(e,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var ee=d(()=>{P();B();U();k()});function te(t){_=t.replace(/\/$/,"")}function re(t,e,a={}){g[t]={path:e,name:t,params:a}}function ae(t){for(let[e,a]of Object.entries(t))if(typeof a==="string")g[e]={path:a,name:e};else g[e]={...a,name:e}}function ne(t,e={},a=!1){let r=g[t];if(!r)return console.warn(`Route [${t}] not defined.`),"#undefined-route";let n={...r.params,...e},o=r.path;o=o.replace(/:(\w+)/g,(l,i)=>{let c=n[i];if(c===void 0)return console.warn(`Missing parameter [${i}] for route [${t}].`),`:${i}`;return delete n[i],encodeURIComponent(String(c))});let s=Object.entries(n);if(s.length>0){let l=s.map(([i,c])=>`${encodeURIComponent(i)}=${encodeURIComponent(String(c))}`).join("&");o+=(o.includes("?")?"&":"?")+l}return a&&_?`${_}${o}`:o}function se(){for(let t of Object.keys(g))delete g[t];_=""}var g,_="";var oe=d(()=>{g={}});import ie from"fs";import le from"path";function ce(t,e={}){return{type:"redirect",path:t,options:{replace:e.replace??!1,external:e.external??!1,redirectCode:e.redirectCode??302}}}function ue(t){return{type:"abort",error:typeof t==="string"?{statusCode:500,message:t}:t}}function he(t,e={}){return{handler:t,mode:e.mode??"universal"}}function X(t){let e={};if(!t)return e;let a=t.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let s=n.trim(),l=o.join("=").trim();if(s)e[s]=decodeURIComponent(l)}}return e}function O(t,e,a={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(e)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function j(t,e){let a=t.headers.get("cookie")||"",r=X(a);return{get(n){return r[n]},set(n,o,s={}){r[n]=o,e.append("Set-Cookie",O(n,o,s))},delete(n){delete r[n],e.append("Set-Cookie",O(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function q(){return{get(t){if(typeof document>"u")return;return X(document.cookie)[t]},set(t,e,a={}){if(typeof document>"u")return;document.cookie=O(t,e,a)},delete(t){if(typeof document>"u")return;document.cookie=O(t,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return X(document.cookie)}}}function H(){let t=typeof window<"u"&&typeof window.localStorage<"u";return{get(e){if(!t)return null;try{return window.localStorage.getItem(e)}catch{return null}},set(e,a){if(!t)return;try{window.localStorage.setItem(e,a)}catch{}},remove(e){if(!t)return;try{window.localStorage.removeItem(e)}catch{}},isAvailable(){return t}}}function M(t,e){S.set(t,e)}function V(t){return S.get(t)}function de(t){return S.has(t)}function pe(){S.clear()}function fe(){return Array.from(S.keys())}async function ge(t,e="middleware"){let a=le.resolve(t,e);if(!ie.existsSync(a))return;let r=ie.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),s=le.join(a,n);try{let i=(await import(s)).default;if(i&&typeof i.handler==="function")M(o,i);else if(typeof i==="function")M(o,{handler:i,mode:"universal"})}catch(l){console.warn(`Failed to load middleware '${o}' from ${s}:`,l)}}}function Te(t){let e={};if(!t)return e;let a=new URLSearchParams(t);for(let[r,n]of a)e[r]=n;return e}function me(t,e,a,r=""){return{path:t,params:e,query:Te(r),fullPath:r?`${t}?${r}`:t,meta:a}}function ye(t,e,a,r){let n=r?.isServer??typeof window>"u",o=!n,s=new Headers;return{to:t,from:e,isClient:o,isServer:n,cookies:n&&a?j(a,s):q(),storage:H(),state:{},request:a,responseHeaders:s}}async function ve(t,e){let a=Array.isArray(t)?t:[t],r=e.isServer;for(let n of a){let o=V(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:e.state,responseHeaders:e.responseHeaders};if(o.mode==="server"&&!r)continue;try{let s=await o.handler(e);if(s){if(s.type==="redirect")return{passed:!1,redirect:s,state:e.state,responseHeaders:e.responseHeaders};if(s.type==="abort")return{passed:!1,abort:s,state:e.state,responseHeaders:e.responseHeaders}}}catch(s){return console.error(`Error in middleware '${n}':`,s),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:s instanceof Error?s.message:"Middleware error"}},state:e.state,responseHeaders:e.responseHeaders}}}return{passed:!0,state:e.state,responseHeaders:e.responseHeaders}}var S;var we=d(()=>{S=new Map});function D(t){let a=t.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function be(t){let e=t.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=t.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=t.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=e?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||D(n)}}var xe=()=>{};function Ee(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}function Se(){if(F)return F;return F=Ee(`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=7;
@@ -327,6 +327,15 @@ import{pw as Ee,qw as d}from"./chunk-5ep11kvc.js";function N(t){return t.split(/
327
327
  function isModuleRegistryScript(s){
328
328
  return !!s&&((s.hasAttribute&&s.hasAttribute('data-stx-modules'))||REGISTRY_TEXT.test(s.textContent||''));
329
329
  }
330
+ // The page's composables (resources/functions and friends), published as
331
+ // globals its templates call. Each page ships the ones it reaches, so the
332
+ // next page can need one the first never loaded: it runs right after the
333
+ // registry, before anything that calls into it. Guarded per bundle, so a
334
+ // repeat is a no-op.
335
+ var COMPOSABLES_TEXT=/__stxComposableBundles/;
336
+ function isComposablesScript(s){
337
+ return !!s&&((s.hasAttribute&&s.hasAttribute('data-stx-composables'))||COMPOSABLES_TEXT.test(s.textContent||''));
338
+ }
330
339
  function runsAlways(declared, code){
331
340
  if(declared==='always')return true;
332
341
  if(declared==='once')return false;
@@ -981,7 +990,8 @@ else {
981
990
  var runDecl=(attrs.match(/data-stx-run\\s*=\\s*["']?(always|once)["']?/i)||[])[1];
982
991
  var ownerDecl=(attrs.match(/data-stx-owner\\s*=\\s*["']([^"']+)["']/i)||[])[1]||'';
983
992
  var registry=/(?:^|\\s)data-stx-modules(?:\\s|=|$)/i.test(attrs)||REGISTRY_TEXT.test(code);
984
- fragScripts.push({text:code,slot:slot,setupName:generatedSetupName(code),scoped:scoped,run:runDecl?runDecl.toLowerCase():'',owner:ownerDecl,registry:registry});
993
+ var composables=/(?:^|\\s)data-stx-composables(?:\\s|=|$)/i.test(attrs)||COMPOSABLES_TEXT.test(code);
994
+ fragScripts.push({text:code,slot:slot,setupName:generatedSetupName(code),scoped:scoped,run:runDecl?runDecl.toLowerCase():'',owner:ownerDecl,registry:registry,composables:composables});
985
995
  // Retain scoped setup code in its inert placeholder. A placeholder
986
996
  // inside template.content is unreachable through document, so the
987
997
  // repeated component runtime must execute it for each clone.
@@ -1057,7 +1067,7 @@ else {
1057
1067
  // after the content it serves: a component that imports a package ran
1058
1068
  // ahead of it and threw "is not registered on this page". The full
1059
1069
  // document path orders them the same way (registryFirst, below).
1060
- function fragOrder(entry){return entry.registry?0:entry.setupName?2:1}
1070
+ function fragOrder(entry){return entry.registry?0:entry.composables?1:entry.setupName?3:2}
1061
1071
  fragScripts.sort(function(a,b){return fragOrder(a)-fragOrder(b)});
1062
1072
  function runFragScripts(){
1063
1073
  fragScripts.forEach(function(entry){
@@ -1337,7 +1347,7 @@ else {
1337
1347
  var slot='document-'+(++routedBodyScriptId);
1338
1348
  var setupName=generatedSetupName(text);
1339
1349
  if(setupName)incomingSetupName=setupName;
1340
- routedBodyScripts.push({text:text,runAlways:true,slot:slot,setupName:setupName,run:s.getAttribute('data-stx-run')||'',owner:s.getAttribute('data-stx-owner')||'',registry:isModuleRegistryScript(s)});
1350
+ routedBodyScripts.push({text:text,runAlways:true,slot:slot,setupName:setupName,run:s.getAttribute('data-stx-run')||'',owner:s.getAttribute('data-stx-owner')||'',registry:isModuleRegistryScript(s),composables:isComposablesScript(s)});
1341
1351
  s.textContent='';
1342
1352
  s.setAttribute('type','application/stx-pending');
1343
1353
  s.setAttribute('data-stx-route-script',slot);
@@ -1419,7 +1429,7 @@ else {
1419
1429
 
1420
1430
  var scripts=routedBodyScripts.slice();
1421
1431
  function addScript(text, runAlways, slot, owner){
1422
- scripts.push({text:text,runAlways:!!runAlways,slot:slot||'',owner:owner||'',registry:REGISTRY_TEXT.test(text)});
1432
+ scripts.push({text:text,runAlways:!!runAlways,slot:slot||'',owner:owner||'',registry:REGISTRY_TEXT.test(text),composables:COMPOSABLES_TEXT.test(text)});
1423
1433
  }
1424
1434
  if(isLayoutChange){
1425
1435
  // Also collect setup functions from <head>, and the page's module
@@ -1435,7 +1445,7 @@ else {
1435
1445
  if(s.hasAttribute('src'))return;
1436
1446
  if(!text.trim())return;
1437
1447
  if(isSignalsRuntimeScript(s,text))return;
1438
- if(isModuleRegistryScript(s))addScript(text,true,'','');
1448
+ if(isModuleRegistryScript(s)||isComposablesScript(s))addScript(text,true,'','');
1439
1449
  else if(text.indexOf('__stx_setup_')!==-1)addScript(text,true);
1440
1450
  });
1441
1451
  } else {
@@ -1489,7 +1499,8 @@ else {
1489
1499
  // so without this a component in the page body could run ahead of the
1490
1500
  // registry it imports from. Stable: the order within each group holds.
1491
1501
  var registryFirst=scripts.filter(function(e){return e.registry});
1492
- if(registryFirst.length)scripts=registryFirst.concat(scripts.filter(function(e){return !e.registry}));
1502
+ var composablesNext=scripts.filter(function(e){return !e.registry&&e.composables});
1503
+ if(registryFirst.length||composablesNext.length)scripts=registryFirst.concat(composablesNext,scripts.filter(function(e){return !e.registry&&!e.composables}));
1493
1504
 
1494
1505
  // Push history state (before active link updates so location.pathname is current)
1495
1506
  if(pushState!==false)writeHistory(pushState,url+(hash||''));
@@ -2093,5 +2104,5 @@ else {
2093
2104
 
2094
2105
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
2095
2106
  })();
2096
- `),F}var F;var ke=()=>{};var Le={};Ee(Le,{setAppUrl:()=>te,runMiddleware:()=>ve,route:()=>ne,resolveLayoutChain:()=>R,resetRoutes:()=>se,registerMiddleware:()=>M,patternToRegex:()=>x,navigateTo:()=>ce,matchRoute:()=>$,loadMiddlewareFromDirectory:()=>ge,isNonPageRoutePattern:()=>w,isNonPageRoutePath:()=>N,hasMiddleware:()=>de,getRouterScript:()=>Se,getMiddlewareNames:()=>fe,getMiddleware:()=>V,generateRouteTypes:()=>A,generateRouteManifest:()=>C,formatRoutes:()=>Q,findErrorPage:()=>Z,filePathToPattern:()=>T,extractLayoutMetadata:()=>be,deriveLayoutGroup:()=>D,defineRoutes:()=>ae,defineRoute:()=>re,defineMiddleware:()=>he,createStorageManager:()=>H,createServerCookieManager:()=>j,createRouter:()=>J,createRouteLocation:()=>me,createMiddlewareContext:()=>ye,createClientCookieManager:()=>q,clearMiddleware:()=>pe,bracketPathToRegex:()=>z,abortNavigation:()=>ue,Router:()=>L,NON_PAGE_DIRS:()=>v});var _e=d(()=>{ee();B();oe();we();U();xe();P();k();ke()});
2097
- export{v as wv,N as xv,w as yv,A as zv,C as Av,T as Bv,x as Cv,$ as Dv,z as Ev,R as Fv,L as Gv,J as Hv,Z as Iv,Q as Jv,te as Kv,re as Lv,ae as Mv,ne as Nv,se as Ov,ce as Pv,ue as Qv,he as Rv,j as Sv,q as Tv,H as Uv,M as Vv,V as Wv,de as Xv,pe as Yv,fe as Zv,ge as _v,me as $v,ye as aw,ve as bw,D as cw,be as dw,xe as ew,Se as fw,Le as gw,_e as hw};
2107
+ `),F}var F;var ke=()=>{};var Le={};Re(Le,{setAppUrl:()=>te,runMiddleware:()=>ve,route:()=>ne,resolveLayoutChain:()=>E,resetRoutes:()=>se,registerMiddleware:()=>M,patternToRegex:()=>x,navigateTo:()=>ce,matchRoute:()=>$,loadMiddlewareFromDirectory:()=>ge,isNonPageRoutePattern:()=>w,isNonPageRoutePath:()=>N,hasMiddleware:()=>de,getRouterScript:()=>Se,getMiddlewareNames:()=>fe,getMiddleware:()=>V,generateRouteTypes:()=>A,generateRouteManifest:()=>C,formatRoutes:()=>Q,findErrorPage:()=>Z,filePathToPattern:()=>T,extractLayoutMetadata:()=>be,deriveLayoutGroup:()=>D,defineRoutes:()=>ae,defineRoute:()=>re,defineMiddleware:()=>he,createStorageManager:()=>H,createServerCookieManager:()=>j,createRouter:()=>J,createRouteLocation:()=>me,createMiddlewareContext:()=>ye,createClientCookieManager:()=>q,clearMiddleware:()=>pe,bracketPathToRegex:()=>z,abortNavigation:()=>ue,Router:()=>L,NON_PAGE_DIRS:()=>v});var _e=d(()=>{ee();B();oe();we();U();xe();P();k();ke()});
2108
+ export{v as wv,N as xv,w as yv,A as zv,C as Av,T as Bv,x as Cv,$ as Dv,z as Ev,E as Fv,L as Gv,J as Hv,Z as Iv,Q as Jv,te as Kv,re as Lv,ae as Mv,ne as Nv,se as Ov,ce as Pv,ue as Qv,he as Rv,j as Sv,q as Tv,H as Uv,M as Vv,V as Wv,de as Xv,pe as Yv,fe as Zv,ge as _v,me as $v,ye as aw,ve as bw,D as cw,be as dw,xe as ew,Se as fw,Le as gw,_e as hw};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Du as a,Eu as b}from"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-5ep11kvc.js";export{a as prepareRuntimeConfig,b as generateRuntimeConfigTypes};
2
+ import{Du as a,Eu as b}from"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-5ep11kvc.js";export{a as prepareRuntimeConfig,b as generateRuntimeConfigTypes};
@@ -0,0 +1,33 @@
1
+ // @bun
2
+ import{Ui as D,Vi as S,Wi as R}from"./chunk-xwxdwqn9.js";import{Cr as k,gm as I,lq as K}from"./chunk-r6g1n649.js";import{av as x,bv as F}from"./chunk-tp6wkx7g.js";import{fv as y}from"./chunk-tjhzxbxa.js";import P from"path";var U=new Map,T=new Map,u=["composables","functions"];function b(q){let z=P.basename(q,".ts");return z==="index"||z==="types"||q.endsWith(".d.ts")}async function p(q){if(q)return P.resolve(q);let z=`<default>:${process.cwd()}`,W=T.get(z);if(W!==void 0)return W;let H=await m();if(H!==null)T.set(z,H);return H}async function m(){let q=await k(),z=q.root||process.cwd(),W=q.composablesDir;if(W)return P.resolve(z,W);for(let H of u){let Q=P.resolve(z,H);try{let V=new Bun.Glob("**/*.ts");for await(let Z of V.scan({cwd:Q,absolute:!0}))if(!b(Z))return Q}catch{}}return null}async function g(q){let z=Array.isArray(q)?q:q?[P.resolve(q)]:(await k())._layerComposableDirs??[await p()].filter((H)=>!!H),W=new Map;for(let H of z){let Q=new Bun.Glob("**/*.ts");try{for await(let V of Q.scan({cwd:H,absolute:!0})){let Z=P.relative(H,V);if(!b(V)&&!W.has(Z))W.set(Z,V)}}catch{}}return{key:z.join("\x00"),files:[...W.values()].sort()}}async function e(q){let{files:z}=await g(q),W=K({loader:"ts",target:"browser",define:I()}),H=[];for(let Q of z)try{let V=await Bun.file(Q).text(),Z=W.scan(V).exports.filter(($)=>$!=="default");if(Z.length>0)H.push({file:Q,names:Z})}catch{}return H}function t(q,z){return new RegExp(`\\b${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(q)}function n(q,z,W){let H=new Map;for(let{file:$,names:G}of q)for(let O of G)if(!H.has(O))H.set(O,$);let Q=($)=>{let G=[];for(let[O,j]of H)if(t($,O))G.push(j);return G},V=new Set,Z=W.flatMap(Q);while(Z.length>0){let $=[];for(let G of Z){if(V.has(G))continue;V.add(G);for(let O of Q(z.get(G)??""))if(!V.has(O))$.push(O)}Z=$}return V}async function qq(q,z,W){let{key:H,files:Q}=await g(q);if(!H)return null;let V=D(Q);if(Q.length===0)return R(U,H,V,""),null;Q.sort();let Z=K({loader:"ts",target:"browser",define:I()}),$=new Map,G=[];for(let J of Q)try{let Y=await Bun.file(J).text();$.set(J,Y);let L=Z.scan(Y).exports.filter((X)=>X!=="default");if(L.length>0)G.push({file:J,names:L})}catch{$.set(J,"")}let O=z===void 0?new Set(Q):n(G,$,W?[z,...W]:[z]);if(O.size===0)return null;let j=Q.filter((J)=>O.has(J)),A=`${H}\x00${j.join("\x00")}`,B=S(U,A,V);if(B!==void 0)return B||null;let M=[],w=new Set,_=new Set;for(let J of j)try{let Y=$.get(J)??await Bun.file(J).text(),L=P.basename(J,".ts");for(let X of Y.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(X[1])_.add(X[1]);try{for(let X of Z.scan(Y).exports)if(X!=="default")w.add(X)}catch{}Y=x(Y),Y=F(Y),Y=Y.replace(/^export\s+(default\s+)?/gm,""),Y=Z.transformSync(Y),M.push(`// Composable: ${L}
3
+ ${Y.trim()}`)}catch(Y){console.warn(`[stx] Failed to load composable ${J}:`,Y)}if(M.length===0||w.size===0)return R(U,A,V,""),null;let h=[...w].map((J)=>` try { if (!(${JSON.stringify(J)} in __c)) __c[${JSON.stringify(J)}] = ${J}; } catch (e) {}`).join(`
4
+ `),v=JSON.stringify([...w]),E=M.join(`
5
+
6
+ `),f=y.filter((J)=>!_.has(J)&&new RegExp(`\\b${J}\\b`).test(E)).map((J)=>`var ${J} = __stx[${JSON.stringify(J)}];`).join(`
7
+ `),C=JSON.stringify(new Bun.CryptoHasher("md5").update(`${v}\x00${E}`).digest("hex").slice(0,12)),N=`;(function(){
8
+ var __bundles = window.__stxComposableBundles || (window.__stxComposableBundles = {});
9
+ if (__bundles[${C}]) return;
10
+ __bundles[${C}] = true;
11
+ var __published = window.__stxComposableGlobals || (window.__stxComposableGlobals = {});
12
+ window.__composables = window.__composables || {};
13
+ var __c = window.__composables;
14
+ var __stx = window.stx || {};
15
+ ${f}
16
+ ${E}
17
+ ${h}
18
+ var __names = ${v};
19
+ for (var __i = 0; __i < __names.length; __i++) {
20
+ var __n = __names[__i];
21
+ if (!(__n in __c) || __published[__n]) continue;
22
+ var __takenByBuiltin = !!(window.stx && __n in window.stx);
23
+ if (__takenByBuiltin || __n in window) {
24
+ console.warn('[stx] composable "' + __n + '" is not available as a bare identifier: '
25
+ + (__takenByBuiltin ? 'a built-in of that name already exists' : 'window already defines that property')
26
+ + '. Rename it, or use: import { ' + __n + ' } from "@composables"');
27
+ continue;
28
+ }
29
+ window[__n] = __c[__n];
30
+ __published[__n] = true;
31
+ }
32
+ })();`;return R(U,A,V,N),N}function zq(){U.clear(),T.clear()}
33
+ export{e as Ri,qq as Si,zq as Ti};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Te as a}from"./chunk-mk51d96e.js";import"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{a as startInteractive};
2
+ import{Te as a}from"./chunk-kptkb3j4.js";import"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{a as startInteractive};
@@ -17,7 +17,7 @@ catch (e) {
17
17
  }
18
18
  throw e;
19
19
  }
20
- `),U.set(X,q)}return q(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:W,context:Q.slice()});return W}clear(){this.pool.length=0,this.fnCache.clear()}}var CQ=new bJ;class kJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let W={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(W);while(this.violations.length>this.maxViolations)this.violations.shift();for(let V of this.violationHandlers)try{V(W)}catch{}let j=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(F)throw Error(j);else console.warn(j);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var $J=null;function WQ(){if(!$J)$J=new kJ;return $J}var gQ=new Proxy({},{get(J,Q){return WQ()[Q]}});var xJ=[];function SJ(J){let Q=new ZJ(J);return xJ.push(Q),Q}function mQ(){for(let J of xJ)J.clear()}function UJ(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function hQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:EJ.statSync(Z).mtimeMs})}catch{}return Q}function iQ(J){for(let Q of J)try{if(EJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var O=null,WJ=!1,H=null,T="",A=!1,dJ=256,D=new Map,L=new Map,N=null,b=null;function y(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function FJ(J,Q){if(D.has(J))D.delete(J);else if(D.size>=dJ)D.delete(D.keys().next().value);D.set(J,Q)}function VQ(J){let Q=y(J);if(L.has(Q))L.delete(Q);else if(L.size>=dJ)L.delete(L.keys().next().value);return L.set(Q,J),Q}function eQ(J){let Q=L.get(J);if(Q===void 0)return;return L.delete(J),L.set(J,Q),Q}async function XQ(J){if(!N)return null;try{let Q=Bun.file(z.join(N,`cw-${y(J)}.css`));if(!await Q.exists())return null;return await Q.text()}catch{return null}}async function jQ(J,Q){if(!N)return;try{if(!fs.existsSync(N))fs.mkdirSync(N,{recursive:!0});await Bun.write(z.join(N,`cw-${y(J)}.css`),Q)}catch{}}async function fJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var qQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],GQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zQ(){let J=[],Q=process.cwd();while(Q!==z.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of qQ)J.push(z.join(Q,Z,...$));Q=z.dirname(Q)}return J}function YQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&z.join(Q,"Code","Tools","ts-css"),Q&&z.join(Q,"Code","Tools","crosswind"),Q&&z.join(Q,"repos","stacks-org","ts-css"),Q&&z.join(Q,"repos","stacks-org","crosswind"),z.join(process.cwd(),"..","ts-css"),z.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(z.join($,"packages","toolkit","dist","engine","index.js")),J.push(z.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(z.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function pJ(){if(WJ)return O;WJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let W=await fJ(F);if(W){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${z.dirname(z.dirname(F))}`);return W}}return null};if(process.env.CROSSWIND_SRC){let U=z.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return O=F,O}let Q=await J(zQ());if(Q)return O=Q,O;let Z=GQ;for(let U of Z){let F=await fJ(U);if(F){if(O=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return O}}let $=await J(YQ());if($)return O=$,O;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function J0(){VJ.clear(),O=null,WJ=!1,H=null,T="",D.clear(),L.clear(),b=null}var CJ=!1;async function mJ(J){try{let Q=yJ({name:"css",cwd:J})?"css":yJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!CJ)CJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=z.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function wQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-gzzgnw3t.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=z.isAbsolute($.css)?$.css:z.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=z.isAbsolute($.css.config)?$.css.config:z.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await mJ(J)}function BQ(J){try{let Q=new WeakSet;return y(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function HQ(J){if(A)return T;A=!0;try{let Q=await pJ();if(!Q||!Q.build)return A=!1,"";if(!H)H=await mJ(J);if(!H)return A=!1,"";let Z=Q.defaultConfig?.theme||{},$=H.theme||{},U={...Q.defaultConfig,...H,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),W=await Q.build(U),j=performance.now()-F;if(T=W.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${W.classes.size} classes in ${j.toFixed(1)}ms`),U.output){let V=z.isAbsolute(U.output)?U.output:z.join(J,U.output),X=z.dirname(V);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(V,W.css)}return A=!1,W.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),A=!1,T}}async function Q0(J){H=null,await HQ(J)}function $0(){return T}function OQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let W of $[1].split(/\s+/))if(W.trim())Q.add(W.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let W=F[1].match(/'([^']+)'/g);if(W){for(let j of W)for(let V of j.slice(1,-1).split(/\s+/))if(V.trim())Q.add(V.trim())}F=U.exec(J)}return Q}var VJ=SJ(64);async function LQ(J,Q){let Z=VJ.get(UJ(J,Q,b));if(Z!==void 0)return Z;let $=await KQ(J,Q);if($)VJ.set(UJ(J,Q,b),$);return $}async function KQ(J,Q){try{let Z=await pJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):OQ(J);if($.size===0)return"";let U=Q?z.resolve(Q):process.cwd();if(!N)N=uJ(U,"cache");let F=[...$].sort().join(" "),W=`${b||"default"}::${F}`,j=D.get(W);if(j!==void 0)return FJ(W,j),j;let V=await XQ(W);if(V!==null)return FJ(W,V),V;if(!H)H=await wQ(U),b=BQ(H);let X=Z.defaultConfig||Z.config,q=H||{},G=LJ(X,q),{safelist:w,includePreflight:K,minify:M,tokenCSS:hJ}=G,XJ=G.config,_=new Z.CSSGenerator(XJ);for(let B of w)_.generate(B);for(let B of $)_.generate(B);let I=_.toCSS(K,M),jJ=XJ.shortcuts||q.shortcuts||{};for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean);for(let R of C)_.generate(R)}I=_.toCSS(K,M);let v=I.split(`
20
+ `),U.set(X,q)}return q(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:W,context:Q.slice()});return W}clear(){this.pool.length=0,this.fnCache.clear()}}var CQ=new bJ;class kJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let W={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(W);while(this.violations.length>this.maxViolations)this.violations.shift();for(let V of this.violationHandlers)try{V(W)}catch{}let j=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(F)throw Error(j);else console.warn(j);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var $J=null;function WQ(){if(!$J)$J=new kJ;return $J}var gQ=new Proxy({},{get(J,Q){return WQ()[Q]}});var xJ=[];function SJ(J){let Q=new ZJ(J);return xJ.push(Q),Q}function mQ(){for(let J of xJ)J.clear()}function UJ(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function hQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:EJ.statSync(Z).mtimeMs})}catch{}return Q}function iQ(J){for(let Q of J)try{if(EJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var O=null,WJ=!1,H=null,T="",A=!1,dJ=256,D=new Map,L=new Map,N=null,b=null;function y(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function FJ(J,Q){if(D.has(J))D.delete(J);else if(D.size>=dJ)D.delete(D.keys().next().value);D.set(J,Q)}function VQ(J){let Q=y(J);if(L.has(Q))L.delete(Q);else if(L.size>=dJ)L.delete(L.keys().next().value);return L.set(Q,J),Q}function eQ(J){let Q=L.get(J);if(Q===void 0)return;return L.delete(J),L.set(J,Q),Q}async function XQ(J){if(!N)return null;try{let Q=Bun.file(z.join(N,`cw-${y(J)}.css`));if(!await Q.exists())return null;return await Q.text()}catch{return null}}async function jQ(J,Q){if(!N)return;try{if(!fs.existsSync(N))fs.mkdirSync(N,{recursive:!0});await Bun.write(z.join(N,`cw-${y(J)}.css`),Q)}catch{}}async function fJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var qQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],GQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zQ(){let J=[],Q=process.cwd();while(Q!==z.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of qQ)J.push(z.join(Q,Z,...$));Q=z.dirname(Q)}return J}function YQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&z.join(Q,"Code","Tools","ts-css"),Q&&z.join(Q,"Code","Tools","crosswind"),Q&&z.join(Q,"repos","stacks-org","ts-css"),Q&&z.join(Q,"repos","stacks-org","crosswind"),z.join(process.cwd(),"..","ts-css"),z.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(z.join($,"packages","toolkit","dist","engine","index.js")),J.push(z.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(z.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function pJ(){if(WJ)return O;WJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let W=await fJ(F);if(W){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${z.dirname(z.dirname(F))}`);return W}}return null};if(process.env.CROSSWIND_SRC){let U=z.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return O=F,O}let Q=await J(zQ());if(Q)return O=Q,O;let Z=GQ;for(let U of Z){let F=await fJ(U);if(F){if(O=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return O}}let $=await J(YQ());if($)return O=$,O;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function J0(){VJ.clear(),O=null,WJ=!1,H=null,T="",D.clear(),L.clear(),b=null}var CJ=!1;async function mJ(J){try{let Q=yJ({name:"css",cwd:J})?"css":yJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!CJ)CJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=z.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function wQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-85e05tzn.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=z.isAbsolute($.css)?$.css:z.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=z.isAbsolute($.css.config)?$.css.config:z.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await mJ(J)}function BQ(J){try{let Q=new WeakSet;return y(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function HQ(J){if(A)return T;A=!0;try{let Q=await pJ();if(!Q||!Q.build)return A=!1,"";if(!H)H=await mJ(J);if(!H)return A=!1,"";let Z=Q.defaultConfig?.theme||{},$=H.theme||{},U={...Q.defaultConfig,...H,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),W=await Q.build(U),j=performance.now()-F;if(T=W.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${W.classes.size} classes in ${j.toFixed(1)}ms`),U.output){let V=z.isAbsolute(U.output)?U.output:z.join(J,U.output),X=z.dirname(V);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(V,W.css)}return A=!1,W.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),A=!1,T}}async function Q0(J){H=null,await HQ(J)}function $0(){return T}function OQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let W of $[1].split(/\s+/))if(W.trim())Q.add(W.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let W=F[1].match(/'([^']+)'/g);if(W){for(let j of W)for(let V of j.slice(1,-1).split(/\s+/))if(V.trim())Q.add(V.trim())}F=U.exec(J)}return Q}var VJ=SJ(64);async function LQ(J,Q){let Z=VJ.get(UJ(J,Q,b));if(Z!==void 0)return Z;let $=await KQ(J,Q);if($)VJ.set(UJ(J,Q,b),$);return $}async function KQ(J,Q){try{let Z=await pJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):OQ(J);if($.size===0)return"";let U=Q?z.resolve(Q):process.cwd();if(!N)N=uJ(U,"cache");let F=[...$].sort().join(" "),W=`${b||"default"}::${F}`,j=D.get(W);if(j!==void 0)return FJ(W,j),j;let V=await XQ(W);if(V!==null)return FJ(W,V),V;if(!H)H=await wQ(U),b=BQ(H);let X=Z.defaultConfig||Z.config,q=H||{},G=LJ(X,q),{safelist:w,includePreflight:K,minify:M,tokenCSS:hJ}=G,XJ=G.config,_=new Z.CSSGenerator(XJ);for(let B of w)_.generate(B);for(let B of $)_.generate(B);let I=_.toCSS(K,M),jJ=XJ.shortcuts||q.shortcuts||{};for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean);for(let R of C)_.generate(R)}I=_.toCSS(K,M);let v=I.split(`
21
21
  `);for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean),R=[],g=[];for(let u of C){let qJ=u.startsWith("dark:"),GJ=`.${(qJ?u.slice(5):u).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<v.length;k++){let zJ=v[k].trim();if(zJ===`${GJ} {`||zJ.startsWith(`${GJ} {`)){let E=k,YJ="";while(E<v.length){if(YJ+=v[E],v[E].includes("}"))break;E++}let d=YJ.match(/\{([^}]+)\}/);if(d)if(qJ)g.push(d[1].trim());else R.push(d[1].trim());break}}}if(R.length)I+=`
22
22
  .${B} { ${R.join(" ")} }`;if(g.length)I+=`
23
23
  @media (prefers-color-scheme: dark) { .dark .${B} { ${g.join(" ")} } }`}return I=hJ+I,FJ(W,I),jQ(W,I),I}catch(Z){return console.warn("Failed to generate Css CSS:",Z),""}}async function Z0(J,Q,Z=!1,$=!1){let U=await LQ(J,Q);if(!U)return $?QJ(J):J;let F=Z?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${VQ(U)}.css">`:`<style data-css="generated">
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Hg as I}from"./chunk-dvvx1wny.js";import{Cr as H}from"./chunk-7zjqjcc9.js";import{rw as G}from"./chunk-5ep11kvc.js";import L from"path";async function Q(k={}){let J=performance.now(),A=k.root||process.cwd(),j=await H(A),B=k.ssr?.routeRules??j.routeRules??{};if(I(B),!j.ssr&&Object.keys(B).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!j.ssr&&(k.ssr?.serverApi??j.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let q=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${q.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let D,E;if(q==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");D=await z({pagesDir:L.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,router:j.router,...k.ssg})}else{let{buildForProduction:z}=await import("./chunk-3vhf96nd.js");E=await z({root:A,outputDir:".output",debug:k.debug,...k.ssr})}let K=Math.round(performance.now()-J);return{mode:q,ssg:D,ssr:E,duration:K}}
2
+ import{Hg as I}from"./chunk-dvvx1wny.js";import{Cr as H}from"./chunk-r6g1n649.js";import{rw as G}from"./chunk-5ep11kvc.js";import L from"path";async function Q(k={}){let J=performance.now(),A=k.root||process.cwd(),j=await H(A),B=k.ssr?.routeRules??j.routeRules??{};if(I(B),!j.ssr&&Object.keys(B).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!j.ssr&&(k.ssr?.serverApi??j.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let q=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${q.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let D,E;if(q==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");D=await z({pagesDir:L.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,router:j.router,...k.ssg})}else{let{buildForProduction:z}=await import("./chunk-rsp59c5x.js");E=await z({root:A,outputDir:".output",debug:k.debug,...k.ssr})}let K=Math.round(performance.now()-J);return{mode:q,ssg:D,ssr:E,duration:K}}
3
3
  export{Q as Ue};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{So as a,Uo as b,Wo as c,Xo as d,eq as e,fq as f,gq as g,hq as h,iq as i,jq as j,kq as k,lq as l,mq as m,nq as n,oq as o,pq as p,qq as q,rq as r,sq as s,tq as t,uq as u,vq as v,wq as w,xq as x}from"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{e as validateTemplate,g as validateDirective,n as userComponentFileExists,m as transpileTypeScript,p as slotContentHasExpressions,k as shouldTranspileTypeScript,t as resolveTemplatePath,r as renderComponentWithSlot,j as isJavaScriptScript,o as isHydrateTrigger,d as hasVariables,h as hasDirectives,u as getSourceLineInfo,l as getSharedTranspiler,f as getPositionInfo,x as getComponentCacheStats,s as fileExists,a as extractVariables,c as extractScriptFromTemplate,i as extractDirectiveNames,v as createDetailedErrorMessage,b as convertToCommonJS,q as componentClientSignalNames,w as clearComponentCache};
2
+ import{So as a,Uo as b,Wo as c,Xo as d,eq as e,fq as f,gq as g,hq as h,iq as i,jq as j,kq as k,lq as l,mq as m,nq as n,oq as o,pq as p,qq as q,rq as r,sq as s,tq as t,uq as u,vq as v,wq as w,xq as x}from"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{e as validateTemplate,g as validateDirective,n as userComponentFileExists,m as transpileTypeScript,p as slotContentHasExpressions,k as shouldTranspileTypeScript,t as resolveTemplatePath,r as renderComponentWithSlot,j as isJavaScriptScript,o as isHydrateTrigger,d as hasVariables,h as hasDirectives,u as getSourceLineInfo,l as getSharedTranspiler,f as getPositionInfo,x as getComponentCacheStats,s as fileExists,a as extractVariables,c as extractScriptFromTemplate,i as extractDirectiveNames,v as createDetailedErrorMessage,b as convertToCommonJS,q as componentClientSignalNames,w as clearComponentCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gl as a,hl as b,il as c,jl as d,kl as e,ll as f,ml as g,nl as h,ol as i,pl as j,ql as k,rl as l,sl as m,tl as n,ul as o}from"./chunk-ykhhn5ed.js";import"./chunk-dr0thyq9.js";import"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{o as tempBuildName,b as shouldLogBundlerDiagnostics,f as setBundlerFallbackMode,l as rewriteRegistryImports,g as resolveBundlerFallback,j as registryIdForPath,c as recordBundleFailure,m as queueClientBundleBuild,k as normalizeRegistrySpecifiers,h as hasUserImports,d as getBundleFailures,a as clientBundleDependencies,e as clearBundleFailures,n as bundleClientScript,i as MODULE_SPECIFIER_PREFIX};
2
+ import{gl as a,hl as b,il as c,jl as d,kl as e,ll as f,ml as g,nl as h,ol as i,pl as j,ql as k,rl as l,sl as m,tl as n,ul as o}from"./chunk-qjh40e31.js";import"./chunk-kxtfmwy0.js";import"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{o as tempBuildName,b as shouldLogBundlerDiagnostics,f as setBundlerFallbackMode,l as rewriteRegistryImports,g as resolveBundlerFallback,j as registryIdForPath,c as recordBundleFailure,m as queueClientBundleBuild,k as normalizeRegistrySpecifiers,h as hasUserImports,d as getBundleFailures,a as clientBundleDependencies,e as clearBundleFailures,n as bundleClientScript,i as MODULE_SPECIFIER_PREFIX};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Gu as H,Ju as F}from"./chunk-7080py5f.js";import{rw as I}from"./chunk-5ep11kvc.js";import J from"fs";import z from"path";async function N(w,A,j){if(w.__stx_runtime_config)return;let b=H();if(b||j){w.__stx_runtime_config=b??F(j);return}let q=z.dirname(z.resolve(A));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((D)=>J.existsSync(z.join(q,D)))){let{loadStxConfig:D}=await import("./chunk-gzzgnw3t.js"),G=await D(q);if(G.runtimeConfig)w.__stx_runtime_config=F(G.runtimeConfig);return}let B=z.dirname(q);if(B===q)return;q=B}}async function O(w,A){function j(b){if(b===null)return"null";if(Array.isArray(b))return`Array<${b.length?[...new Set(b.map(j))].join(" | "):"unknown"}>`;if(typeof b==="object")return`{ ${Object.entries(b).map(([q,B])=>`readonly ${JSON.stringify(q)}: ${j(B)}`).join("; ")} }`;return typeof b}await Bun.write(z.join(w,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{Gu as H,Ju as F}from"./chunk-7080py5f.js";import{rw as I}from"./chunk-5ep11kvc.js";import J from"fs";import z from"path";async function N(w,A,j){if(w.__stx_runtime_config)return;let b=H();if(b||j){w.__stx_runtime_config=b??F(j);return}let q=z.dirname(z.resolve(A));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((D)=>J.existsSync(z.join(q,D)))){let{loadStxConfig:D}=await import("./chunk-85e05tzn.js"),G=await D(q);if(G.runtimeConfig)w.__stx_runtime_config=F(G.runtimeConfig);return}let B=z.dirname(q);if(B===q)return;q=B}}async function O(w,A){function j(b){if(b===null)return"null";if(Array.isArray(b))return`Array<${b.length?[...new Set(b.map(j))].join(" | "):"unknown"}>`;if(typeof b==="object")return`{ ${Object.entries(b).map(([q,B])=>`readonly ${JSON.stringify(q)}: ${j(B)}`).join("; ")} }`;return typeof b}await Bun.write(z.join(w,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${j(A.public??{})} }
4
4
  `),await Bun.write(z.join(w,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${j(A.private??{})} }
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ar as a,Br as b,Cr as c,Dr as d,Er as e,Fr as f}from"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
2
+ import{Ar as a,Br as b,Cr as c,Dr as d,Er as e,Fr as f}from"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$o as a,ap as b,bp as c,cp as d,dp as e,ep as f,fp as g}from"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{a as resetUnscopedSignalWarnings,g as processStackReplacements,f as processStackPushDirectives,e as processIncludes,b as partialsCache,c as onceStore,d as clearOnceStore};
2
+ import{$o as a,ap as b,bp as c,cp as d,dp as e,ep as f,fp as g}from"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{a as resetUnscopedSignalWarnings,g as processStackReplacements,f as processStackPushDirectives,e as processIncludes,b as partialsCache,c as onceStore,d as clearOnceStore};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Yo as a,Zo as b,_o as c}from"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{b as reportDeferredLoopWarnings,c as processLoops,a as parseLoopBinding};
2
+ import{Yo as a,Zo as b,_o as c}from"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{b as reportDeferredLoopWarnings,c as processLoops,a as parseLoopBinding};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{fm as c,im as d,jm as e,km as f,lm as g,mm as h,nm as i,om as j,pm as k,qm as l,rm as m,sm as n}from"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import{mt as a,nt as b}from"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{h as transformAutoImports,b as stripCommentsAndLiterals,e as renderVendorStyleTags,i as referencesName,n as processClientScript,g as injectBrowserCoreAutoImports,m as generateServerDataBridge,k as generateBrowserAutoImportDestructuring,j as generateAutoImportDestructuring,a as findInterpolationEnd,l as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
2
+ import{fm as c,im as d,jm as e,km as f,lm as g,mm as h,nm as i,om as j,pm as k,qm as l,rm as m,sm as n}from"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import{mt as a,nt as b}from"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{h as transformAutoImports,b as stripCommentsAndLiterals,e as renderVendorStyleTags,i as referencesName,n as processClientScript,g as injectBrowserCoreAutoImports,m as generateServerDataBridge,k as generateBrowserAutoImportDestructuring,j as generateAutoImportDestructuring,a as findInterpolationEnd,l as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  import{rw as H}from"./chunk-5ep11kvc.js";import P from"path";var $=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function G(...v){let w=new Set;for(let q of v){if(!q||!q.includes("__stxModules["))continue;for(let z of q.matchAll($))try{w.add(JSON.parse(`"${z[1]}"`))}catch{}}return[...w].sort()}async function T(v,w={}){if(v.length===0)return null;let q=process.cwd(),z=[],J=[];v.forEach((j,X)=>{let Z=j.startsWith("npm:")?j.slice(4):P.resolve(q,j),N=`__stxRegistered${X}`,O=JSON.stringify(j);z.push(`import * as ${N} from ${JSON.stringify(Z)};`),J.push(`if (!globalThis.__stxModules[${O}]) globalThis.__stxModules[${O}] = ${N};`)});let L=[...z,"globalThis.__stxModules = globalThis.__stxModules || {};",...J].join(`
3
- `),B;try{let{bundleClientScript:j}=await import("./chunk-858xqty6.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:w.minify,externalizeUserModules:!1})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-4mb08201.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-k14sz6cz.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
3
+ `),B;try{let{bundleClientScript:j}=await import("./chunk-793gxvjv.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:w.minify,externalizeUserModules:!1})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-b9jknz2y.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-k14sz6cz.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
4
4
  `)}export{G as registeredModuleIdsIn,T as buildModuleRegistryScript};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Bg as WJ,Dg as YJ,Fg as jJ,lg as ZJ,ng as g,pg as A,vg as n,yg as GJ}from"./chunk-1e4sb5dk.js";import{Ig as $J}from"./chunk-dvvx1wny.js";import{zl as XJ}from"./chunk-dr0thyq9.js";import{wo as h}from"./chunk-7zjqjcc9.js";import{yt as e}from"./chunk-8kvd3g8y.js";import{Fu as QJ,Ju as i,Lu as p}from"./chunk-7080py5f.js";import{Cv as KJ,dw as l,hw as VJ}from"./chunk-ey4sca09.js";import{rw as DJ}from"./chunk-5ep11kvc.js";import JJ from"fs";import k from"path";var{serve:wJ}=globalThis.Bun;VJ();import y from"zlib";import{promisify as a}from"util";var IJ=a(y.brotliCompress),OJ=a(y.gzip),UJ=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],BJ=["text/event-stream","multipart/x-mixed-replace"],_J=1024;function zJ(K){if(!K)return!1;let J=K.toLowerCase();if(BJ.some((G)=>J.startsWith(G)))return!1;return UJ.some((G)=>J.startsWith(G))}function FJ(K){let J=new Map;for(let G of K.split(",")){let[Z,...W]=G.trim().split(";"),O=Z.trim().toLowerCase();if(!O)continue;let U=1;for(let B of W){let w=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(B);if(!w)continue;let F=Number.parseFloat(w[1]);if(Number.isFinite(F))U=F}J.set(O,U)}return J}function LJ(K){if(!K)return null;let J=FJ(K),G=J.get("*"),Z=(W)=>J.get(W)??G??0;if(Z("br")>0)return"br";if(Z("gzip")>0)return"gzip";return null}async function t(K,J,G={}){if(J.headers.get("content-encoding"))return J;if(J.status===204||J.status===304||!J.body)return J;if(!zJ(J.headers.get("content-type")))return J;let Z=LJ(K.headers.get("accept-encoding"));if(!Z)return J;let W;try{W=new Uint8Array(await J.arrayBuffer())}catch{return J}let O=()=>new Response(W,{status:J.status,statusText:J.statusText,headers:s(J.headers)});if(W.length<(G.threshold??_J))return O();try{let U=Z==="br"?await IJ(W,{params:{[y.constants.BROTLI_PARAM_QUALITY]:G.quality??5,[y.constants.BROTLI_PARAM_SIZE_HINT]:W.length}}):await OJ(W);if(U.length>=W.length)return O();let B=s(J.headers);return B.set("Content-Encoding",Z),B.set("Content-Length",String(U.length)),new Response(U,{status:J.status,statusText:J.statusText,headers:B})}catch{return O()}}function s(K){let J=new Headers(K),G=J.get("Vary");if(!G)return J.set("Vary","Accept-Encoding"),J;if(!G.split(",").some((W)=>W.trim().toLowerCase()==="accept-encoding"))J.set("Vary",`${G}, Accept-Encoding`);return J}class d{now;entries=new e(1000,{maxBytes:33554432,sizeOf:(K)=>K.body.byteLength+JSON.stringify(K.headers).length*2});pending=new Map;generation=0;constructor(K=Date.now){this.now=K}invalidate(K){this.generation++,this.pending.clear();for(let J of Array.from(this.entries.keys()))if(K===void 0||this.entries.get(J)?.path===K)this.entries.delete(J)}async respond(K,J,G){let Z,W=async()=>{let X=Z??await G();return X.headers.set("Cache-Control","private, no-store"),X.headers.set("Vary",A(X.headers.get("Vary")).Vary),X};if(!J||K.method!=="GET"||K.headers.has("Cookie")||K.headers.has("Authorization")||K.headers.has("Range"))return W();let O=new URL(K.url),U=`${O.origin}${O.pathname}${O.search}|${g(K)?"fragment":"document"}`,B=this.entries.get(U),w=(X)=>{let T=new Headers(X.headers);return T.set("Cache-Control","private, no-store"),T.set("Age",String(Math.max(0,Math.floor((this.now()-X.created)/1000)))),new Response(X.body.slice(0),{headers:T})},F=B?(this.now()-B.created)/1000:1/0;if(B&&F<J.maxAge)return w(B);let S=this.generation,q=async()=>{let X=await G();Z=X;let T=(X.headers.get("Vary")??"").toLowerCase().split(",").map((L)=>L.trim()).filter(Boolean);if(X.status!==200||X.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(X.headers.get("Cache-Control")??"")||T.some((L)=>L!=="x-stx-router"&&L!=="accept-encoding"))return null;let M=await X.clone().arrayBuffer();if(M.byteLength>1048576)return null;X.headers.set("Vary",A(X.headers.get("Vary")).Vary);let Q={body:M,headers:Array.from(X.headers.entries()),created:this.now(),path:O.pathname};if(this.generation===S)this.entries.set(U,Q);return Q},H=this.pending.get(U);if(!H){if(this.pending.size>=1000)return W();H=q().finally(()=>{if(this.pending.get(U)===H)this.pending.delete(U)}),this.pending.set(U,H)}if(B&&F<J.maxAge+(J.swr??0))return H.catch(()=>{}),w(B);let x=await H;return x?w(x):W()}}var HJ={".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 uJ(K={}){let J=k.resolve(K.outputDir||".output"),G=K.port??3000,Z=GJ(J);if(!Z)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${Z.routes.length} routes...`);let W=$J(Z.routeRules),O=new d,U=XJ(J,Z.apiRoutes??[]),B=Bun.file(k.join(J,"server/runtime-config.json")),w=K.runtimeConfig??(await B.exists()?await B.json():void 0),F=w?i(w):void 0,S=new Map,q=new Map,H=new Map,x=new Map;for(let Q of Z.routes)try{let L=k.join(J,Q.compiledPath),Y=JSON.parse(await Bun.file(L).text());if(F)Y.html=p(Y.html,F);S.set(Q.pattern,Y),H.set(Q.pattern,l(Y.html)),x.set(Q.pattern,h(Y.html));let C=k.join(J,Q.fragmentPath);if(await Bun.file(C).exists()){let P=await Bun.file(C).text();q.set(Q.pattern,F?p(P,F):P)}}catch(L){console.warn(`[stx] Failed to load route ${Q.pattern}:`,L)}let X=new Map,T=[];for(let Q of Z.routes)if(Q.hasParams){let{regex:L,params:Y}=KJ(Q.pattern);T.push({regex:L,route:Q,paramNames:Y})}else X.set(Q.pattern,Q);let M=wJ({port:G,async fetch(Q){return t(Q,await QJ(F??i(),async()=>{let Y=new URL(Q.url).pathname;if(K.onRequest){let j=await K.onRequest(Q);if(j)return j}if(K.apiRouter){let j=await K.apiRouter.handleRequest(Q);if(j.status!==404)return j}if(K.apiRoutes?.[Y])return K.apiRoutes[Y](Q);let C=await U(Q);if(C)return C;if((Q.method==="GET"||Q.method==="HEAD")&&Y!=="/"){let j=k.resolve(J,"public"),_;try{_=decodeURIComponent(Y)}catch{_=Y}if(!_.includes("\x00")){let I=k.resolve(j,`.${_}`);if(I===j||I.startsWith(`${j}${k.sep}`))try{if(JJ.existsSync(I)&&JJ.statSync(I).isFile()){let z=k.extname(I).toLowerCase(),E=HJ[z]||"application/octet-stream",v=Y.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(Y);return new Response(Bun.file(I),{headers:{"Content-Type":E,"Cache-Control":v?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=g(Q),D=null,o={};if(D=X.get(Y)||null,!D)for(let{regex:j,route:_,paramNames:I}of T){let $=Y.match(j);if($){D=_,I.forEach((z,E)=>{o[z]=$[E+1]});break}}if(!D){let j=X.get("/404")||null;if(j){let _=S.get(j.pattern);if(_)return new Response(_.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}let R=W(Y),r=Object.keys(R).length>0;return O.respond(Q,R.cache,async()=>{let j=S.get(D.pattern);if(P&&Q.method==="GET"&&j&&!j.hasServerScripts&&Object.keys(j.placeholders).length===0){let $=q.get(D.pattern);if($){let z=H.get(D.pattern);return new Response($,{status:j.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...x.has(D.pattern)?{"X-STX-Runtime":x.get(D.pattern)?"true":"false"}:{},...z?{"X-STX-Layout":z.layout,"X-STX-Layout-Group":z.group}:{},...A(),...R.cache?{}:{"Cache-Control":ZJ}}})}}let _=WJ(Q.method),I=S.get(D.pattern);if(!I){let $=X.get("/500")||null;if($){let z=S.get($.pattern);if(z)return new Response(z.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(D.prerendered&&_)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!_&&!I.hasServerScripts&&Object.keys(I.placeholders).length===0)return new Response(I.html,{status:I.status??200,headers:{"Content-Type":"text/html",...A(),"Cache-Control":"public, max-age=60"}});try{let{html:$,boundaries:z,redirect:E,cookies:v,status:m,headers:c}=await jJ(I,{params:o,request:Q,method:Q.method,__stx_strict_hydration:r,__stx_runtime_config:F});if(E)return YJ(E,v,c);if(z&&z.length>0){let{renderStreamingPage:N,streamToResponse:u}=await import("./chunk-pkbj0aht.js"),b=new Headers({...A(),...c,"Cache-Control":"private, no-store"});for(let f of v??[])b.append("Set-Cookie",f);if(P&&!_){let f=l($);b.set("X-STX-Fragment","true"),b.set("X-STX-Runtime",h($)?"true":"false"),b.set("X-STX-Layout",f.layout),b.set("X-STX-Layout-Group",f.group)}return u(N(P&&!_?n($,Z.routerContainer||"main"):$,z,{timeoutMs:30000}),{status:m??I.status??200,headers:b})}let V=new Headers({"Content-Type":"text/html",...A(),...R.cache?{}:{"Cache-Control":"private, no-store"}});for(let N of v??[])V.append("Set-Cookie",N);for(let[N,u]of Object.entries(c??{}))V.set(N,u);if(V.set("Vary",A(V.get("Vary")).Vary),P&&!_){let N=l($);return V.set("X-STX-Fragment","true"),V.set("X-STX-Runtime",h($)?"true":"false"),V.set("X-STX-Layout",N.layout),V.set("X-STX-Layout-Group",N.group),new Response(n($,Z.routerContainer||"main"),{status:m??I.status??200,headers:V})}return new Response($,{status:m??I.status??200,headers:V})}catch($){if(console.error(`[stx] Hydration error for ${Y}:`,$),r)return new Response("Internal Server Error",{status:500});return new Response(I.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${M.port}`),console.log(`[stx] Serving ${Z.routes.length} routes (${S.size} pre-loaded)`),{port:M.port,stop:()=>{O.invalidate(),M.stop()},invalidate:(Q)=>O.invalidate(Q)}}
2
+ import{Bg as WJ,Dg as YJ,Fg as jJ,lg as ZJ,ng as g,pg as A,vg as n,yg as GJ}from"./chunk-mbaew5a8.js";import{Ig as $J}from"./chunk-dvvx1wny.js";import{zl as XJ}from"./chunk-kxtfmwy0.js";import{wo as h}from"./chunk-r6g1n649.js";import{yt as e}from"./chunk-4zwjqcw4.js";import{Fu as QJ,Ju as i,Lu as p}from"./chunk-7080py5f.js";import{Cv as KJ,dw as l,hw as VJ}from"./chunk-2jzntvfr.js";import{rw as DJ}from"./chunk-5ep11kvc.js";import JJ from"fs";import k from"path";var{serve:wJ}=globalThis.Bun;VJ();import y from"zlib";import{promisify as a}from"util";var IJ=a(y.brotliCompress),OJ=a(y.gzip),UJ=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],BJ=["text/event-stream","multipart/x-mixed-replace"],_J=1024;function zJ(K){if(!K)return!1;let J=K.toLowerCase();if(BJ.some((G)=>J.startsWith(G)))return!1;return UJ.some((G)=>J.startsWith(G))}function FJ(K){let J=new Map;for(let G of K.split(",")){let[Z,...W]=G.trim().split(";"),O=Z.trim().toLowerCase();if(!O)continue;let U=1;for(let B of W){let w=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(B);if(!w)continue;let F=Number.parseFloat(w[1]);if(Number.isFinite(F))U=F}J.set(O,U)}return J}function LJ(K){if(!K)return null;let J=FJ(K),G=J.get("*"),Z=(W)=>J.get(W)??G??0;if(Z("br")>0)return"br";if(Z("gzip")>0)return"gzip";return null}async function t(K,J,G={}){if(J.headers.get("content-encoding"))return J;if(J.status===204||J.status===304||!J.body)return J;if(!zJ(J.headers.get("content-type")))return J;let Z=LJ(K.headers.get("accept-encoding"));if(!Z)return J;let W;try{W=new Uint8Array(await J.arrayBuffer())}catch{return J}let O=()=>new Response(W,{status:J.status,statusText:J.statusText,headers:s(J.headers)});if(W.length<(G.threshold??_J))return O();try{let U=Z==="br"?await IJ(W,{params:{[y.constants.BROTLI_PARAM_QUALITY]:G.quality??5,[y.constants.BROTLI_PARAM_SIZE_HINT]:W.length}}):await OJ(W);if(U.length>=W.length)return O();let B=s(J.headers);return B.set("Content-Encoding",Z),B.set("Content-Length",String(U.length)),new Response(U,{status:J.status,statusText:J.statusText,headers:B})}catch{return O()}}function s(K){let J=new Headers(K),G=J.get("Vary");if(!G)return J.set("Vary","Accept-Encoding"),J;if(!G.split(",").some((W)=>W.trim().toLowerCase()==="accept-encoding"))J.set("Vary",`${G}, Accept-Encoding`);return J}class d{now;entries=new e(1000,{maxBytes:33554432,sizeOf:(K)=>K.body.byteLength+JSON.stringify(K.headers).length*2});pending=new Map;generation=0;constructor(K=Date.now){this.now=K}invalidate(K){this.generation++,this.pending.clear();for(let J of Array.from(this.entries.keys()))if(K===void 0||this.entries.get(J)?.path===K)this.entries.delete(J)}async respond(K,J,G){let Z,W=async()=>{let X=Z??await G();return X.headers.set("Cache-Control","private, no-store"),X.headers.set("Vary",A(X.headers.get("Vary")).Vary),X};if(!J||K.method!=="GET"||K.headers.has("Cookie")||K.headers.has("Authorization")||K.headers.has("Range"))return W();let O=new URL(K.url),U=`${O.origin}${O.pathname}${O.search}|${g(K)?"fragment":"document"}`,B=this.entries.get(U),w=(X)=>{let T=new Headers(X.headers);return T.set("Cache-Control","private, no-store"),T.set("Age",String(Math.max(0,Math.floor((this.now()-X.created)/1000)))),new Response(X.body.slice(0),{headers:T})},F=B?(this.now()-B.created)/1000:1/0;if(B&&F<J.maxAge)return w(B);let S=this.generation,q=async()=>{let X=await G();Z=X;let T=(X.headers.get("Vary")??"").toLowerCase().split(",").map((L)=>L.trim()).filter(Boolean);if(X.status!==200||X.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(X.headers.get("Cache-Control")??"")||T.some((L)=>L!=="x-stx-router"&&L!=="accept-encoding"))return null;let M=await X.clone().arrayBuffer();if(M.byteLength>1048576)return null;X.headers.set("Vary",A(X.headers.get("Vary")).Vary);let Q={body:M,headers:Array.from(X.headers.entries()),created:this.now(),path:O.pathname};if(this.generation===S)this.entries.set(U,Q);return Q},H=this.pending.get(U);if(!H){if(this.pending.size>=1000)return W();H=q().finally(()=>{if(this.pending.get(U)===H)this.pending.delete(U)}),this.pending.set(U,H)}if(B&&F<J.maxAge+(J.swr??0))return H.catch(()=>{}),w(B);let x=await H;return x?w(x):W()}}var HJ={".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 uJ(K={}){let J=k.resolve(K.outputDir||".output"),G=K.port??3000,Z=GJ(J);if(!Z)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${Z.routes.length} routes...`);let W=$J(Z.routeRules),O=new d,U=XJ(J,Z.apiRoutes??[]),B=Bun.file(k.join(J,"server/runtime-config.json")),w=K.runtimeConfig??(await B.exists()?await B.json():void 0),F=w?i(w):void 0,S=new Map,q=new Map,H=new Map,x=new Map;for(let Q of Z.routes)try{let L=k.join(J,Q.compiledPath),Y=JSON.parse(await Bun.file(L).text());if(F)Y.html=p(Y.html,F);S.set(Q.pattern,Y),H.set(Q.pattern,l(Y.html)),x.set(Q.pattern,h(Y.html));let C=k.join(J,Q.fragmentPath);if(await Bun.file(C).exists()){let P=await Bun.file(C).text();q.set(Q.pattern,F?p(P,F):P)}}catch(L){console.warn(`[stx] Failed to load route ${Q.pattern}:`,L)}let X=new Map,T=[];for(let Q of Z.routes)if(Q.hasParams){let{regex:L,params:Y}=KJ(Q.pattern);T.push({regex:L,route:Q,paramNames:Y})}else X.set(Q.pattern,Q);let M=wJ({port:G,async fetch(Q){return t(Q,await QJ(F??i(),async()=>{let Y=new URL(Q.url).pathname;if(K.onRequest){let j=await K.onRequest(Q);if(j)return j}if(K.apiRouter){let j=await K.apiRouter.handleRequest(Q);if(j.status!==404)return j}if(K.apiRoutes?.[Y])return K.apiRoutes[Y](Q);let C=await U(Q);if(C)return C;if((Q.method==="GET"||Q.method==="HEAD")&&Y!=="/"){let j=k.resolve(J,"public"),_;try{_=decodeURIComponent(Y)}catch{_=Y}if(!_.includes("\x00")){let I=k.resolve(j,`.${_}`);if(I===j||I.startsWith(`${j}${k.sep}`))try{if(JJ.existsSync(I)&&JJ.statSync(I).isFile()){let z=k.extname(I).toLowerCase(),E=HJ[z]||"application/octet-stream",v=Y.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(Y);return new Response(Bun.file(I),{headers:{"Content-Type":E,"Cache-Control":v?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=g(Q),D=null,o={};if(D=X.get(Y)||null,!D)for(let{regex:j,route:_,paramNames:I}of T){let $=Y.match(j);if($){D=_,I.forEach((z,E)=>{o[z]=$[E+1]});break}}if(!D){let j=X.get("/404")||null;if(j){let _=S.get(j.pattern);if(_)return new Response(_.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}let R=W(Y),r=Object.keys(R).length>0;return O.respond(Q,R.cache,async()=>{let j=S.get(D.pattern);if(P&&Q.method==="GET"&&j&&!j.hasServerScripts&&Object.keys(j.placeholders).length===0){let $=q.get(D.pattern);if($){let z=H.get(D.pattern);return new Response($,{status:j.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...x.has(D.pattern)?{"X-STX-Runtime":x.get(D.pattern)?"true":"false"}:{},...z?{"X-STX-Layout":z.layout,"X-STX-Layout-Group":z.group}:{},...A(),...R.cache?{}:{"Cache-Control":ZJ}}})}}let _=WJ(Q.method),I=S.get(D.pattern);if(!I){let $=X.get("/500")||null;if($){let z=S.get($.pattern);if(z)return new Response(z.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(D.prerendered&&_)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!_&&!I.hasServerScripts&&Object.keys(I.placeholders).length===0)return new Response(I.html,{status:I.status??200,headers:{"Content-Type":"text/html",...A(),"Cache-Control":"public, max-age=60"}});try{let{html:$,boundaries:z,redirect:E,cookies:v,status:m,headers:c}=await jJ(I,{params:o,request:Q,method:Q.method,__stx_strict_hydration:r,__stx_runtime_config:F});if(E)return YJ(E,v,c);if(z&&z.length>0){let{renderStreamingPage:N,streamToResponse:u}=await import("./chunk-zhtttwz2.js"),b=new Headers({...A(),...c,"Cache-Control":"private, no-store"});for(let f of v??[])b.append("Set-Cookie",f);if(P&&!_){let f=l($);b.set("X-STX-Fragment","true"),b.set("X-STX-Runtime",h($)?"true":"false"),b.set("X-STX-Layout",f.layout),b.set("X-STX-Layout-Group",f.group)}return u(N(P&&!_?n($,Z.routerContainer||"main"):$,z,{timeoutMs:30000}),{status:m??I.status??200,headers:b})}let V=new Headers({"Content-Type":"text/html",...A(),...R.cache?{}:{"Cache-Control":"private, no-store"}});for(let N of v??[])V.append("Set-Cookie",N);for(let[N,u]of Object.entries(c??{}))V.set(N,u);if(V.set("Vary",A(V.get("Vary")).Vary),P&&!_){let N=l($);return V.set("X-STX-Fragment","true"),V.set("X-STX-Runtime",h($)?"true":"false"),V.set("X-STX-Layout",N.layout),V.set("X-STX-Layout-Group",N.group),new Response(n($,Z.routerContainer||"main"),{status:m??I.status??200,headers:V})}return new Response($,{status:m??I.status??200,headers:V})}catch($){if(console.error(`[stx] Hydration error for ${Y}:`,$),r)return new Response("Internal Server Error",{status:500});return new Response(I.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${M.port}`),console.log(`[stx] Serving ${Z.routes.length} routes (${S.size} pre-loaded)`),{port:M.port,stop:()=>{O.invalidate(),M.stop()},invalidate:(Q)=>O.invalidate(Q)}}
3
3
  export{zJ as Ve,LJ as We,t as Xe,uJ as Ye};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ui as O,Vi as w,Wi as Z}from"./chunk-xwxdwqn9.js";import{gl as R,nl as U,tl as T}from"./chunk-ykhhn5ed.js";import{Cr as C,Ko as W,gm as M,lq as k}from"./chunk-7zjqjcc9.js";import{av as E,bv as L}from"./chunk-tp6wkx7g.js";import{fv as B}from"./chunk-tjhzxbxa.js";import $ from"path";var Y=new Map;function b(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function l(Q){let z;if(Q)z=$.resolve(Q);else{let q=await C();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>R(q))])],K=O(V()),P=w(Y,z,K);if(P!==void 0)return P||null;if(H.length===0)return Z(Y,z,K,""),null;let A=[];for(let q of H){let y=await Bun.file(q).text();A.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}A.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let N=A.map((q)=>q.file),G=[],X=new Set,F=k({loader:"ts",target:"browser",define:M()});for(let q of N)try{let y=await Bun.file(q).text(),I=$.basename(q,".ts");if(b(y,X),U(y))y=await T(y,q,{projectRoot:process.cwd(),externalizeUserModules:!1});y=W(y),y=E(y),y=L(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=F.transformSync(y),G.push(`// Store: ${I}
2
+ import{Ui as O,Vi as w,Wi as Z}from"./chunk-xwxdwqn9.js";import{gl as R,nl as U,tl as T}from"./chunk-qjh40e31.js";import{Cr as C,Ko as W,gm as M,lq as k}from"./chunk-r6g1n649.js";import{av as E,bv as L}from"./chunk-tp6wkx7g.js";import{fv as B}from"./chunk-tjhzxbxa.js";import $ from"path";var Y=new Map;function b(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function l(Q){let z;if(Q)z=$.resolve(Q);else{let q=await C();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>R(q))])],K=O(V()),P=w(Y,z,K);if(P!==void 0)return P||null;if(H.length===0)return Z(Y,z,K,""),null;let A=[];for(let q of H){let y=await Bun.file(q).text();A.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}A.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let N=A.map((q)=>q.file),G=[],X=new Set,F=k({loader:"ts",target:"browser",define:M()});for(let q of N)try{let y=await Bun.file(q).text(),I=$.basename(q,".ts");if(b(y,X),U(y))y=await T(y,q,{projectRoot:process.cwd(),externalizeUserModules:!1});y=W(y),y=E(y),y=L(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=F.transformSync(y),G.push(`// Store: ${I}
3
3
  ${y.trim()}`)}catch(y){console.warn(`[stx] Failed to load store ${q}:`,y)}if(G.length===0)return Z(Y,z,K,""),null;let j=G.join(`
4
4
 
5
5
  `),x=`;(function(){
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ri as a,Si as b,Ti as c}from"./chunk-erzhx49f.js";import"./chunk-xwxdwqn9.js";import"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
2
+ import{Ri as a,Si as b,Ti as c}from"./chunk-424e1tyj.js";import"./chunk-xwxdwqn9.js";import"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{gm as x,lq as M}from"./chunk-7zjqjcc9.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import{Bt as B,Dt as P}from"./chunk-8kvd3g8y.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-z1121pkn.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-ey4sca09.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
2
+ import{gm as x,lq as M}from"./chunk-r6g1n649.js";import"./chunk-cqp01pgs.js";import"./chunk-1czvb2wx.js";import"./chunk-fc1g65e0.js";import"./chunk-3wvdm033.js";import{Bt as B,Dt as P}from"./chunk-4zwjqcw4.js";import"./chunk-c2mvx2m8.js";import"./chunk-bsm13y1j.js";import"./chunk-gne68nyp.js";import"./chunk-7ymv9pd6.js";import"./chunk-7080py5f.js";import"./chunk-yjkaqxtc.js";import"./chunk-tp6wkx7g.js";import"./chunk-557n2zx7.js";import"./chunk-tjhzxbxa.js";import"./chunk-2jzntvfr.js";import"./chunk-qnx0eb8x.js";import"./chunk-5ep11kvc.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
3
3
  ${A.transformSync(j).trim()}`);for(let $ of I)C.add($)}catch($){console.warn(`[stx] framework composable ${G.basename(q)} could not be bundled:`,$)}}let Y=Q.filter((q)=>!C.has(q)&&!g(H,q));if(Y.length>0)console.warn(`[stx] could not bundle ${Y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return K.set(z,""),null;let k=[...C].map((q)=>` try { if (!(${JSON.stringify(q)} in __s)) { __s[${JSON.stringify(q)}] = ${q}; if (!(${JSON.stringify(q)} in window)) window[${JSON.stringify(q)}] = ${q}; } } catch (e) {}`).join(`
4
4
  `),w=`<script data-stx-framework-composables>
5
5
  ;(function(){