@stacksjs/stx 0.2.355 → 0.2.357

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 (197) hide show
  1. package/dist/chunk-0c49cy69.js +2 -0
  2. package/dist/chunk-0chkqvs1.js +2 -0
  3. package/dist/chunk-0d6qgbks.js +2 -0
  4. package/dist/{chunk-84bhnp6p.js → chunk-0dj2gne3.js} +2 -2
  5. package/dist/{chunk-57atgbyq.js → chunk-0knxnyq6.js} +1 -1
  6. package/dist/{chunk-m6dstr44.js → chunk-0smr2xjs.js} +2 -2
  7. package/dist/{chunk-e4g8wz6t.js → chunk-0t1yyn1d.js} +1 -1
  8. package/dist/{chunk-xvh1k1a4.js → chunk-19m7hed6.js} +1 -1
  9. package/dist/{chunk-vhta1be7.js → chunk-1nnza3m6.js} +1 -1
  10. package/dist/chunk-284kattb.js +2 -0
  11. package/dist/{chunk-n5657hm3.js → chunk-2gtwha4k.js} +1 -1
  12. package/dist/{chunk-f5veee11.js → chunk-2s3wvns6.js} +1 -1
  13. package/dist/chunk-2x3zy811.js +2 -0
  14. package/dist/chunk-38mpg3kn.js +2 -0
  15. package/dist/chunk-3f782ywp.js +2 -0
  16. package/dist/{chunk-mmnf2pac.js → chunk-3kd0zn9c.js} +2 -2
  17. package/dist/{chunk-avye7h5s.js → chunk-3kyydhzt.js} +1 -1
  18. package/dist/{chunk-msq8xvhp.js → chunk-3ssjb8cx.js} +309 -312
  19. package/dist/{chunk-6r3aavbv.js → chunk-3y8vvkar.js} +2 -2
  20. package/dist/{chunk-8cc4vdkh.js → chunk-4gtsf1xw.js} +1 -1
  21. package/dist/chunk-4mkqzhfh.js +2 -0
  22. package/dist/{chunk-xj6bcwqa.js → chunk-5270fyk7.js} +1 -1
  23. package/dist/chunk-54w1tgzq.js +2 -0
  24. package/dist/chunk-5x0zjm34.js +2 -0
  25. package/dist/{chunk-8bxtvsgm.js → chunk-634gaa9d.js} +1 -1
  26. package/dist/{chunk-pwh8pbks.js → chunk-6gsgayq3.js} +1 -1
  27. package/dist/{chunk-a8ghkfh6.js → chunk-6qhatdte.js} +2 -2
  28. package/dist/{chunk-6zrg2mmc.js → chunk-6yfccnr7.js} +2 -2
  29. package/dist/{chunk-z23sc9p4.js → chunk-79fj9zem.js} +2 -2
  30. package/dist/{chunk-2ver2s2y.js → chunk-7hb89n3z.js} +1 -1
  31. package/dist/{chunk-05zfez2g.js → chunk-7jcntsp4.js} +1 -1
  32. package/dist/{chunk-nf7k53ap.js → chunk-7kw3grq5.js} +1 -1
  33. package/dist/chunk-7nf8azjh.js +2 -0
  34. package/dist/{chunk-62nz9v8t.js → chunk-7v1g7prf.js} +2 -2
  35. package/dist/chunk-8wgsjh65.js +2 -0
  36. package/dist/{chunk-34f8c48f.js → chunk-8xjasa91.js} +1 -1
  37. package/dist/{chunk-w5j9tbsk.js → chunk-94dz7hrj.js} +1 -1
  38. package/dist/{chunk-6h3r8v55.js → chunk-9qdn9y72.js} +1 -1
  39. package/dist/{chunk-g7msqva8.js → chunk-a4jhcbsh.js} +3 -3
  40. package/dist/chunk-a6x0czvr.js +2 -0
  41. package/dist/{chunk-72x62kch.js → chunk-aa8015mk.js} +1 -1
  42. package/dist/{chunk-64n10kpa.js → chunk-aacfyyya.js} +1 -1
  43. package/dist/chunk-abtxpqna.js +2 -0
  44. package/dist/{chunk-c30qnb6z.js → chunk-apbr1kb1.js} +2 -2
  45. package/dist/{chunk-nm60wh6r.js → chunk-awyyskad.js} +1 -1
  46. package/dist/{chunk-ppzz953j.js → chunk-b8ywrx2w.js} +1 -1
  47. package/dist/{chunk-18018jkn.js → chunk-bcpjhcpn.js} +1 -1
  48. package/dist/{chunk-kw9cgyfc.js → chunk-c17ybabd.js} +1 -1
  49. package/dist/chunk-c4rpdtvw.js +2 -0
  50. package/dist/{chunk-zk6ghjnj.js → chunk-c79nfdyj.js} +1 -1
  51. package/dist/{chunk-a1knndrh.js → chunk-cf9gt3h9.js} +10 -10
  52. package/dist/chunk-cgs5xpsn.js +2 -0
  53. package/dist/{chunk-avwywzsj.js → chunk-czj6nq0b.js} +2 -2
  54. package/dist/{chunk-9kmhwbwy.js → chunk-czypgdc1.js} +1 -1
  55. package/dist/{chunk-epqd3eah.js → chunk-degz74nv.js} +2 -2
  56. package/dist/chunk-dpyc7pht.js +2 -0
  57. package/dist/{chunk-hay8nwv3.js → chunk-dtdwjpvf.js} +2 -2
  58. package/dist/chunk-e0f3qs59.js +2 -0
  59. package/dist/{chunk-dsztk2kp.js → chunk-e48050x3.js} +1 -1
  60. package/dist/{chunk-3nx7z086.js → chunk-ec8jsqgm.js} +3 -3
  61. package/dist/{chunk-86c461ca.js → chunk-eg8k598q.js} +1 -1
  62. package/dist/{chunk-bgrkxzr7.js → chunk-ej8mv2k6.js} +1 -1
  63. package/dist/{chunk-y2f41kaq.js → chunk-ejwfnttb.js} +1 -1
  64. package/dist/{chunk-ejqpq0wc.js → chunk-emjmshj8.js} +1 -1
  65. package/dist/{chunk-59906baj.js → chunk-ep034wt0.js} +1 -1
  66. package/dist/{chunk-njx93b4z.js → chunk-ez003q74.js} +1 -1
  67. package/dist/{chunk-ws0282jr.js → chunk-f11z7q5g.js} +1 -1
  68. package/dist/{chunk-g5mhck0r.js → chunk-f2jypsax.js} +2 -2
  69. package/dist/chunk-f3eb1f6z.js +2 -0
  70. package/dist/{chunk-6k5a03pw.js → chunk-f72c62s7.js} +2 -2
  71. package/dist/{chunk-1z1efvtw.js → chunk-fqq5k9ve.js} +1 -1
  72. package/dist/{chunk-c0n802j1.js → chunk-frp9fc7j.js} +1 -1
  73. package/dist/chunk-fzq2n865.js +2 -0
  74. package/dist/{chunk-g6czgcg4.js → chunk-g1vxsvqv.js} +1 -1
  75. package/dist/chunk-g3cmkyk2.js +2 -0
  76. package/dist/{chunk-7r9vgzg4.js → chunk-g7bpkpd4.js} +1 -1
  77. package/dist/{chunk-at622hg0.js → chunk-gn2qc03b.js} +1 -1
  78. package/dist/chunk-gxgrzeeh.js +2 -0
  79. package/dist/{chunk-a9w1ds4w.js → chunk-h99qxgbr.js} +1 -1
  80. package/dist/{chunk-dgv43ccd.js → chunk-hcf8399w.js} +1 -1
  81. package/dist/{chunk-hbkjzx1h.js → chunk-hh0aaxxy.js} +1 -1
  82. package/dist/{chunk-tc4pj651.js → chunk-hkrzv980.js} +2 -2
  83. package/dist/{chunk-7qp3zphs.js → chunk-hy79zwyy.js} +2 -2
  84. package/dist/chunk-j6kec9kp.js +2 -0
  85. package/dist/{chunk-e631svvs.js → chunk-j8wycqve.js} +1 -1
  86. package/dist/chunk-jmdxn2mq.js +2 -0
  87. package/dist/{chunk-a959m68j.js → chunk-k33778kc.js} +1 -1
  88. package/dist/{chunk-wvc7t11n.js → chunk-kaet6r9w.js} +1 -1
  89. package/dist/{chunk-9e20mgwc.js → chunk-kjd9hbg4.js} +3 -3
  90. package/dist/{chunk-8m0g0h4x.js → chunk-krt45cqy.js} +2 -2
  91. package/dist/{chunk-2wb3pgp4.js → chunk-kyyt9xhs.js} +1 -1
  92. package/dist/chunk-m0eg86q3.js +20 -0
  93. package/dist/{chunk-0k1mtwby.js → chunk-mdbj7sq8.js} +1 -1
  94. package/dist/{chunk-d86q27j8.js → chunk-mere396d.js} +1 -1
  95. package/dist/{chunk-1c9453w0.js → chunk-ms25gb16.js} +1 -1
  96. package/dist/{chunk-ym3r8ktq.js → chunk-n0d7nwhd.js} +1 -1
  97. package/dist/{chunk-7h9fajgs.js → chunk-n1y0hjk1.js} +2 -2
  98. package/dist/{chunk-bk1zb1xp.js → chunk-n5tpqzcb.js} +1 -1
  99. package/dist/{chunk-b5hank5e.js → chunk-nybn003d.js} +2 -2
  100. package/dist/chunk-p78b80dp.js +2 -0
  101. package/dist/chunk-pr3hz3ec.js +2 -0
  102. package/dist/{chunk-gtqbvt3a.js → chunk-q4kgqqed.js} +2 -2
  103. package/dist/{chunk-san1eq0r.js → chunk-qbz6yn8c.js} +2 -2
  104. package/dist/{chunk-fvsefztj.js → chunk-qjvny3wf.js} +1 -1
  105. package/dist/{chunk-v0e259x2.js → chunk-qnptmtqh.js} +1 -1
  106. package/dist/{chunk-msywnv5n.js → chunk-qrvey4wk.js} +2 -2
  107. package/dist/{chunk-7we3xfde.js → chunk-ra1s4s6b.js} +1 -1
  108. package/dist/{chunk-99b5tfxc.js → chunk-rcbt11p8.js} +1 -1
  109. package/dist/{chunk-9nrgjtah.js → chunk-rtfwn4cm.js} +1 -1
  110. package/dist/chunk-rydb5n5b.js +2 -0
  111. package/dist/chunk-sa6cgj9h.js +2 -0
  112. package/dist/chunk-skdfq4hq.js +2 -0
  113. package/dist/{chunk-ngjkzaj7.js → chunk-t23kccpz.js} +3 -3
  114. package/dist/{chunk-89mqnh67.js → chunk-tf16jtj4.js} +1 -1
  115. package/dist/{chunk-swvm1wgn.js → chunk-trva71am.js} +2 -2
  116. package/dist/{chunk-rwwfzkz4.js → chunk-tv04k7gq.js} +1 -1
  117. package/dist/{chunk-5wbdbcvf.js → chunk-v1qm7p7t.js} +2 -2
  118. package/dist/chunk-w1a8dwgx.js +2 -0
  119. package/dist/chunk-w9gserf7.js +2 -0
  120. package/dist/{chunk-y6xzr30x.js → chunk-wkyt4j9e.js} +1 -1
  121. package/dist/{chunk-p3p4d6g1.js → chunk-wz4fnsat.js} +2 -2
  122. package/dist/chunk-x131a0jq.js +2 -0
  123. package/dist/{chunk-f5cw54q3.js → chunk-x21hdhjw.js} +1 -1
  124. package/dist/chunk-x5b8az2h.js +2 -0
  125. package/dist/chunk-xk782v5z.js +2 -0
  126. package/dist/chunk-xxrv2p42.js +2 -0
  127. package/dist/{chunk-qsbjtp60.js → chunk-y4nzmkea.js} +1 -1
  128. package/dist/{chunk-sqvqwd0p.js → chunk-y4zddt5r.js} +1 -1
  129. package/dist/{chunk-vgfd9582.js → chunk-ya5m5vbn.js} +1 -1
  130. package/dist/{chunk-1vb2rj09.js → chunk-yg0qm73a.js} +2 -2
  131. package/dist/{chunk-8y1ve8tc.js → chunk-ykevda74.js} +2 -2
  132. package/dist/chunk-ynj1y0qm.js +2 -0
  133. package/dist/{chunk-v6e35j4g.js → chunk-z50ex86m.js} +1 -1
  134. package/dist/chunk-z8gccz1q.js +2 -0
  135. package/dist/{chunk-wj21f1e0.js → chunk-zxfejz72.js} +1 -1
  136. package/dist/chunk-zxnf0c9x.js +2 -0
  137. package/dist/cli.js +14 -14
  138. package/dist/craft-entry.js +1 -1
  139. package/dist/craft.js +1 -1
  140. package/dist/database.js +1 -1
  141. package/dist/engine-bindings.d.ts +35 -0
  142. package/dist/engine-bindings.js +55 -0
  143. package/dist/pwa.js +2 -2
  144. package/dist/ssg.js +2 -2
  145. package/dist/stx-module-imports.d.ts +24 -0
  146. package/dist/stx-module-imports.js +57 -0
  147. package/dist/stx-module.d.ts +154 -0
  148. package/dist/stx-plugin-config.d.ts +17 -0
  149. package/dist/stx-plugin-config.js +42 -0
  150. package/dist/stx-virtual-ts.d.ts +74 -1
  151. package/dist/stx-virtual-ts.js +81 -21
  152. package/dist/typecheck.d.ts +13 -0
  153. package/dist/typecheck.js +82 -64
  154. package/dist/variable-extractor.d.ts +2 -22
  155. package/dist/variable-extractor.js +3 -55
  156. package/dist/visual-testing.js +1 -1
  157. package/package.json +7 -6
  158. package/stx-module.d.ts +154 -0
  159. package/dist/chunk-04x3vny9.js +0 -19
  160. package/dist/chunk-1apnswz7.js +0 -2
  161. package/dist/chunk-1qvf8ase.js +0 -2
  162. package/dist/chunk-1vt1h19d.js +0 -2
  163. package/dist/chunk-32x78na8.js +0 -2
  164. package/dist/chunk-3z4d7kmp.js +0 -2
  165. package/dist/chunk-4b2vsawv.js +0 -2
  166. package/dist/chunk-616fn77w.js +0 -2
  167. package/dist/chunk-70zk8tj2.js +0 -2
  168. package/dist/chunk-86q2h34b.js +0 -2
  169. package/dist/chunk-88e14er7.js +0 -2
  170. package/dist/chunk-8yydz0hk.js +0 -2
  171. package/dist/chunk-a7yxvxke.js +0 -2
  172. package/dist/chunk-aanwshk6.js +0 -2
  173. package/dist/chunk-ahfj7dc7.js +0 -2
  174. package/dist/chunk-bed5f4bp.js +0 -2
  175. package/dist/chunk-dxkjvajv.js +0 -2
  176. package/dist/chunk-e7np0h2q.js +0 -2
  177. package/dist/chunk-erb294sv.js +0 -2
  178. package/dist/chunk-evfr2zgg.js +0 -2
  179. package/dist/chunk-f85f75jh.js +0 -2
  180. package/dist/chunk-gsc2vds7.js +0 -2
  181. package/dist/chunk-h5jt4mxx.js +0 -2
  182. package/dist/chunk-hke0k33t.js +0 -2
  183. package/dist/chunk-hysq9e9t.js +0 -2
  184. package/dist/chunk-kq30wqp6.js +0 -2
  185. package/dist/chunk-m2j5skez.js +0 -2
  186. package/dist/chunk-ntzzhw3w.js +0 -2
  187. package/dist/chunk-px0bs815.js +0 -2
  188. package/dist/chunk-qw92p9za.js +0 -2
  189. package/dist/chunk-rjwnw5hj.js +0 -2
  190. package/dist/chunk-tmr3xq5d.js +0 -2
  191. package/dist/chunk-tpk6wm38.js +0 -2
  192. package/dist/chunk-vw4b7g24.js +0 -2
  193. package/dist/chunk-x054qzma.js +0 -2
  194. package/dist/chunk-x2n1x19t.js +0 -2
  195. package/dist/chunk-zks9ft7n.js +0 -2
  196. package/dist/chunk-zkxnarrh.js +0 -2
  197. package/dist/chunk-zp14ksx1.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$m as T,Ho as k,Jp as w,Sl as A,Tl as b,Zn as M,an as y,km as B,lo as R,mm as F,qr as P,zo as x}from"./chunk-msq8xvhp.js";import{Nw as v}from"./chunk-ejqpq0wc.js";function j(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,Y){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(Y?.some((X)=>q>=X.start&&N<=X.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,Y)=>J.start-Y.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function D(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>b(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as f,resolve as H}from"path";function S(K){let z=K,G=M(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],Y=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],X=$[2],E=$[0],Z=N.includes("server");if(Y(X))J.push(E);else if(Z)Q.push(X);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,X,E=[];while((X=N.exec(q))!==null){let Z=X.index+X[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:X.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function g(K,z){return`<!DOCTYPE html>
2
+ import{Ao as x,Io as k,Kp as w,Tl as A,Ul as b,_n as M,an as T,bn as y,lm as B,mo as R,nm as F,ur as P}from"./chunk-3ssjb8cx.js";import{Rw as v}from"./chunk-emjmshj8.js";function j(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,Y){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(Y?.some((X)=>q>=X.start&&N<=X.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,Y)=>J.start-Y.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function D(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>b(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as f,resolve as H}from"path";function S(K){let z=K,G=M(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],Y=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],X=$[2],E=$[0],Z=N.includes("server");if(Y(X))J.push(E);else if(Z)Q.push(X);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,X,E=[];while((X=N.exec(q))!==null){let Z=X.index+X[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:X.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function g(K,z){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -14,5 +14,5 @@ ${Q.join(`
14
14
  `)}`}else{if(G.processClientScripts!==!1&&Q.length>0){let N=Y.__stx_event_bindings||[],X=B(Y),Z=(await Promise.all(Q.map(async(I)=>{let W=I.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W)return I;return await F(W[1],{eventBindings:N,templateContent:q,serverData:X,filePath:z})}))).join(`
15
15
  `);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${Z}
16
16
  $1`);else q+=`
17
- ${Z}`}q=await R(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-avye7h5s.js");q=await N(q)}catch{}return q}
18
- export{j as ok,C as pk,D as qk,o as rk,r as sk,V as tk};
17
+ ${Z}`}q=await R(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-3kyydhzt.js");q=await N(q)}catch{}return q}
18
+ export{j as pk,C as qk,D as rk,o as sk,r as tk,V as uk};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Qg as a,Rg as b,Sg as c,Tg as d,Ug as e,Vg as f,Wg as g,Xg as h,Yg as i}from"./chunk-rwwfzkz4.js";import"./chunk-18018jkn.js";import"./chunk-ejqpq0wc.js";export{c as setCachedImageResult,e as processImage,f as optimizeImage,b as getCachedImageResult,i as generateSrcset,h as generateResponsiveVariants,d as clearImageCache,g as applyTransformations,a as ImageProcessorCache};
2
+ import{Rg as a,Sg as b,Tg as c,Ug as d,Vg as e,Wg as f,Xg as g,Yg as h,Zg as i}from"./chunk-tv04k7gq.js";import"./chunk-bcpjhcpn.js";import"./chunk-emjmshj8.js";export{c as setCachedImageResult,e as processImage,f as optimizeImage,b as getCachedImageResult,i as generateSrcset,h as generateResponsiveVariants,d as clearImageCache,g as applyTransformations,a as ImageProcessorCache};
@@ -348,4 +348,4 @@ else {
348
348
  console.log('[stx] Keep-alive runtime initialized');
349
349
  })();
350
350
  `}function Z(f){if(typeof document<"u")document.addEventListener("stx:activated",(j)=>{f(j.detail)})}function _(f){if(typeof document<"u")document.addEventListener("stx:deactivated",(j)=>{f(j.detail)})}
351
- export{Q as Ai,T as Bi,W as Ci,X as Di,Y as Ei,Z as Fi,_ as Gi};
351
+ export{Q as Bi,T as Ci,W as Di,X as Ei,Y as Fi,Z as Gi,_ as Hi};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import C from"path";var G=".stx",K="STX_DIR",J=null;function O(j){J=j?.trim()||null}function H(){return process.env[K]?.trim()||J||G}function Q(j=process.cwd(),...q){let B=H();return C.isAbsolute(B)?C.join(B,...q):C.join(j,B,...q)}function W(j){if(!j||C.isAbsolute(j))return j;let q=j.replace(/\\/g,"/");if(q!==G&&!q.startsWith(`${G}/`))return j;let B=q.slice(G.length+1);return B?C.join(H(),B):H()}
3
- export{G as jt,K as kt,O as lt,H as mt,Q as nt,W as ot};
3
+ export{G as nt,K as ot,O as pt,H as qt,Q as rt,W as st};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var{defineProperty:e,getOwnPropertyNames:g,getOwnPropertyDescriptor:h}=Object,i=Object.prototype.hasOwnProperty;function j(a){return this[a]}var m=(a)=>{var b=(f??=new WeakMap).get(a),c;if(b)return b;if(b=e({},"__esModule",{value:!0}),a&&typeof a==="object"||typeof a==="function"){for(var d of g(a))if(!i.call(b,d))e(b,d,{get:j.bind(a,d),enumerable:!(c=h(a,d))||c.enumerable})}return f.set(a,b),b},f;var k=(a)=>a;function l(a,b){this[a]=k.bind(null,b)}var n=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0,configurable:!0,set:l.bind(b,c)})};var o=(a,b)=>()=>(a&&(b=a(a=0)),b);var p=import.meta.require;
3
- export{m as Kw,n as Lw,o as Mw,p as Nw};
3
+ export{m as Ow,n as Pw,o as Qw,p as Rw};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{l as a,m as b,n as c}from"./chunk-q9n5swx7.js";import"./chunk-ejqpq0wc.js";export{c as updateContextTree,b as updateContextStoryFiles,a as createContext};
2
+ import{l as a,m as b,n as c}from"./chunk-q9n5swx7.js";import"./chunk-emjmshj8.js";export{c as updateContextTree,b as updateContextStoryFiles,a as createContext};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{existsSync as U,statSync as V}from"fs";import z from"path";var W=/[*?[\]{}]/;function X(D){return W.test(D)}async function $(D,E={}){let H=E.cwd??process.cwd(),N=E.recursive!==!1,Q=E.ignorePaths??[],J=globalThis.Bun.Glob,K=new Set,F=(j)=>{if(j.includes(`${z.sep}node_modules${z.sep}`)||j.includes(`${z.sep}dist${z.sep}`))return;if(Q.some((q)=>q&&j.includes(z.normalize(q))))return;K.add(j)},R=async(j)=>{try{for await(let q of new J(j).scan({cwd:H,absolute:!0}))F(q)}catch{}};for(let j of D){if(!j)continue;if(X(j)){await R(j);continue}let q=z.resolve(H,j);if(!U(q))continue;if(V(q).isDirectory()){for await(let T of new J(N?"**/*.stx":"*.stx").scan({cwd:q,absolute:!0}))F(T);continue}F(q)}return[...K].sort()}
3
- export{X as is,$ as js};
3
+ export{X as ms,$ as ns};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-ejqpq0wc.js";import v from"fs";import H from"path";import{gzipSync as z}from"zlib";import{createHash as g}from"crypto";var D={".js":"js",".mjs":"js",".cjs":"js",".ts":"js",".jsx":"js",".tsx":"js",".css":"css",".scss":"css",".sass":"css",".less":"css",".html":"html",".htm":"html",".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".svg":"image",".webp":"image",".avif":"image",".ico":"image",".woff":"font",".woff2":"font",".ttf":"font",".eot":"font",".otf":"font"},b=[/node_modules/,/vendor/,/bower_components/,/\.min\./],B=[/index\.(js|ts|html)$/,/main\.(js|ts)$/,/app\.(js|ts)$/,/entry\.(js|ts)$/];async function L(X,Z={}){let{includeSourceMaps:Q=!1,parseImports:$=!0,detectDuplicates:U=!0,topModulesCount:K=20}=Z;if(!v.existsSync(X))throw Error(`Build directory not found: ${X}`);if(!v.statSync(X).isDirectory())throw Error(`Not a directory: ${X}`);let q=await k(X,Q),J=[],F=[];for(let A of q)try{let O=await f(A,X,$);J.push(O)}catch(O){F.push(`Failed to process ${A}: ${O}`)}let Y=c(J,X),V=J.reduce((A,O)=>A+O.size,0),_=J.reduce((A,O)=>A+O.gzipSize,0),w=m(J),G=U?p(J):[],C=[...J].sort((A,O)=>O.size-A.size).slice(0,K);return{timestamp:Date.now(),buildDir:H.resolve(X),chunks:Y,totalSize:V,totalGzipSize:_,moduleCount:J.length,duplicates:G,byType:w,largestModules:C,warnings:F}}async function k(X,Z){let Q=[];async function $(U){let K=await v.promises.readdir(U,{withFileTypes:!0});for(let j of K){let q=H.join(U,j.name);if(j.isDirectory()){if(!j.name.startsWith(".")&&j.name!=="node_modules")await $(q)}else if(j.isFile()){if(!Z&&j.name.endsWith(".map"))continue;Q.push(q)}}}return await $(X),Q}async function f(X,Z,Q){let $=await v.promises.readFile(X),U=H.relative(Z,X),K=H.extname(X).toLowerCase(),j=$.length,q=y($),J=h($,K),F=g("md5").update($).digest("hex").slice(0,8),Y=D[K]||"other",V=[];if(Q&&Y==="js")V.push(...d($.toString("utf-8")));return{id:U,path:U,size:j,gzipSize:q,parsedSize:J,extension:K,type:Y,imports:V,importedBy:[],hash:F}}function y(X){try{let Z=z(X,{level:9}).length;return Math.min(Z,X.length)}catch{return X.length}}function h(X,Z){if(Z.includes(".min.")||X.length<1000)return X.length;let $=D[Z];if($==="js")return Math.round(X.length*0.6);if($==="css")return Math.round(X.length*0.7);return X.length}function d(X){let Z=[],Q=/import\s+(?:[\w*{}\s,]+\s+from\s+)?['"]([^'"]+)['"]/g,$;while(($=Q.exec(X))!==null)Z.push($[1]);let U=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=U.exec(X))!==null)Z.push($[1]);let K=/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=K.exec(X))!==null)Z.push($[1]);return[...new Set(Z)]}function c(X,Z){let Q=new Map;for(let U of X){let K=U.path.split(H.sep),j;if(K.length===1)j=H.basename(U.path,U.extension);else j=K[0];let q=Q.get(j)||[];q.push(U),Q.set(j,q)}let $=[];for(let[U,K]of Q){let j=K.reduce((Y,V)=>Y+V.size,0),q=K.reduce((Y,V)=>Y+V.gzipSize,0),J=K.some((Y)=>B.some((V)=>V.test(Y.path))),F=K.some((Y)=>b.some((V)=>V.test(Y.path)));$.push({name:U,files:K.map((Y)=>Y.path),modules:K,size:j,gzipSize:q,isEntry:J,isVendor:F})}return $.sort((U,K)=>K.size-U.size)}function m(X){let Z={js:{count:0,size:0,gzipSize:0},css:{count:0,size:0,gzipSize:0},html:{count:0,size:0,gzipSize:0},image:{count:0,size:0,gzipSize:0},font:{count:0,size:0,gzipSize:0},other:{count:0,size:0,gzipSize:0}};for(let Q of X)Z[Q.type].count++,Z[Q.type].size+=Q.size,Z[Q.type].gzipSize+=Q.gzipSize;return Z}function p(X){let Z=new Map;for(let $ of X){let U=Z.get($.hash)||[];U.push($),Z.set($.hash,U)}let Q=[];for(let[,$]of Z)if($.length>1){let U=$[0];Q.push({path:U.path,count:$.length,wastedBytes:U.size*($.length-1),locations:$.map((K)=>K.path)})}return Q.sort(($,U)=>U.wastedBytes-$.wastedBytes)}function W(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(2)} KB`;return`${(X/1048576).toFixed(2)} MB`}function I(X){let Z=X.match(/^([\d.]+)\s*(B|KB|MB|GB)?$/i);if(!Z)return 0;let Q=Number.parseFloat(Z[1]);switch((Z[2]||"B").toUpperCase()){case"KB":return Q*1024;case"MB":return Q*1024*1024;case"GB":return Q*1024*1024*1024;default:return Q}}function E(X,Z){if(Z===0)return"0%";return`${(X/Z*100).toFixed(1)}%`}function R(X,Z){switch(Z.format){case"json":return u(X,Z);case"markdown":return l(X,Z);case"text":default:return r(X,Z)}}function u(X,Z){let Q=N(X,Z);return JSON.stringify({timestamp:X.timestamp,buildDir:X.buildDir,summary:{totalSize:X.totalSize,totalSizeFormatted:W(X.totalSize),totalGzipSize:X.totalGzipSize,totalGzipSizeFormatted:W(X.totalGzipSize),moduleCount:X.moduleCount,chunkCount:X.chunks.length,duplicateCount:X.duplicates.length},byType:Object.fromEntries(Object.entries(X.byType).map(([$,U])=>[$,{...U,sizeFormatted:W(U.size),gzipSizeFormatted:W(U.gzipSize)}])),chunks:X.chunks.map(($)=>({name:$.name,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),moduleCount:$.modules.length,isEntry:$.isEntry,isVendor:$.isVendor})),largestModules:X.largestModules.slice(0,Z.topModules||10).map(($)=>({path:$.path,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),type:$.type})),duplicates:X.duplicates,analysis:Q,warnings:X.warnings},null,2)}function r(X,Z){let Q=[],$=Z.showGzip!==!1;if(Q.push(""),Q.push("Bundle Analysis Report"),Q.push("\u2550".repeat(50)),Q.push(""),Q.push("Summary"),Q.push("\u2500".repeat(50)),$)Q.push(`Total Size: ${W(X.totalSize)} (${W(X.totalGzipSize)} gzip)`);else Q.push(`Total Size: ${W(X.totalSize)}`);if(Q.push(`Modules: ${X.moduleCount}`),Q.push(`Chunks: ${X.chunks.length}`),X.duplicates.length>0)Q.push(`Duplicates: ${X.duplicates.length}`);if(Q.push(""),Z.threshold&&X.totalSize>Z.threshold)Q.push(`\u26A0\uFE0F Bundle exceeds threshold of ${W(Z.threshold)}!`),Q.push("");Q.push("Size by Type"),Q.push("\u2500".repeat(50));let U=["js","css","html","image","font","other"];for(let j of U){let q=X.byType[j];if(q.count>0){let J=E(q.size,X.totalSize),F=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${j.padEnd(8)} ${W(q.size).padStart(12)}${F} ${J.padStart(6)} (${q.count} files)`)}}Q.push(""),Q.push("Chunks"),Q.push("\u2500".repeat(50));for(let j of X.chunks.slice(0,10)){let q=[];if(j.isEntry)q.push("entry");if(j.isVendor)q.push("vendor");let J=q.length>0?` [${q.join(", ")}]`:"",F=$?` (${W(j.gzipSize)} gzip)`:"";Q.push(` ${j.name.padEnd(20)} ${W(j.size).padStart(12)}${F}${J}`)}if(X.chunks.length>10)Q.push(` ... and ${X.chunks.length-10} more chunks`);Q.push("");let K=Z.topModules||10;Q.push(`Largest Modules (Top ${K})`),Q.push("\u2500".repeat(50));for(let j=0;j<Math.min(K,X.largestModules.length);j++){let q=X.largestModules[j],J=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${(j+1).toString().padStart(2)}. ${q.path}`),Q.push(` ${W(q.size)}${J}`)}if(Q.push(""),X.duplicates.length>0){Q.push("Duplicate Modules"),Q.push("\u2500".repeat(50));for(let j of X.duplicates.slice(0,5))Q.push(` ${j.path}`),Q.push(` ${j.count} copies, wasting ${W(j.wastedBytes)}`);if(X.duplicates.length>5)Q.push(` ... and ${X.duplicates.length-5} more duplicates`);Q.push("")}if(Z.recommendations!==!1){let j=N(X,Z);if(j.recommendations.length>0){Q.push("Recommendations"),Q.push("\u2500".repeat(50));for(let q of j.recommendations.slice(0,5)){let J=q.impact==="high"?"\u26A1":q.impact==="medium"?"\uD83D\uDCCA":"\uD83D\uDCA1";Q.push(` ${J} ${q.title}`),Q.push(` ${q.description}`)}Q.push("")}}if(X.warnings.length>0){Q.push("Warnings"),Q.push("\u2500".repeat(50));for(let j of X.warnings)Q.push(` \u26A0\uFE0F ${j}`);Q.push("")}return Q.join(`
2
+ import"./chunk-emjmshj8.js";import v from"fs";import H from"path";import{gzipSync as z}from"zlib";import{createHash as g}from"crypto";var D={".js":"js",".mjs":"js",".cjs":"js",".ts":"js",".jsx":"js",".tsx":"js",".css":"css",".scss":"css",".sass":"css",".less":"css",".html":"html",".htm":"html",".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".svg":"image",".webp":"image",".avif":"image",".ico":"image",".woff":"font",".woff2":"font",".ttf":"font",".eot":"font",".otf":"font"},b=[/node_modules/,/vendor/,/bower_components/,/\.min\./],B=[/index\.(js|ts|html)$/,/main\.(js|ts)$/,/app\.(js|ts)$/,/entry\.(js|ts)$/];async function L(X,Z={}){let{includeSourceMaps:Q=!1,parseImports:$=!0,detectDuplicates:U=!0,topModulesCount:K=20}=Z;if(!v.existsSync(X))throw Error(`Build directory not found: ${X}`);if(!v.statSync(X).isDirectory())throw Error(`Not a directory: ${X}`);let q=await k(X,Q),J=[],F=[];for(let A of q)try{let O=await f(A,X,$);J.push(O)}catch(O){F.push(`Failed to process ${A}: ${O}`)}let Y=c(J,X),V=J.reduce((A,O)=>A+O.size,0),_=J.reduce((A,O)=>A+O.gzipSize,0),w=m(J),G=U?p(J):[],C=[...J].sort((A,O)=>O.size-A.size).slice(0,K);return{timestamp:Date.now(),buildDir:H.resolve(X),chunks:Y,totalSize:V,totalGzipSize:_,moduleCount:J.length,duplicates:G,byType:w,largestModules:C,warnings:F}}async function k(X,Z){let Q=[];async function $(U){let K=await v.promises.readdir(U,{withFileTypes:!0});for(let j of K){let q=H.join(U,j.name);if(j.isDirectory()){if(!j.name.startsWith(".")&&j.name!=="node_modules")await $(q)}else if(j.isFile()){if(!Z&&j.name.endsWith(".map"))continue;Q.push(q)}}}return await $(X),Q}async function f(X,Z,Q){let $=await v.promises.readFile(X),U=H.relative(Z,X),K=H.extname(X).toLowerCase(),j=$.length,q=y($),J=h($,K),F=g("md5").update($).digest("hex").slice(0,8),Y=D[K]||"other",V=[];if(Q&&Y==="js")V.push(...d($.toString("utf-8")));return{id:U,path:U,size:j,gzipSize:q,parsedSize:J,extension:K,type:Y,imports:V,importedBy:[],hash:F}}function y(X){try{let Z=z(X,{level:9}).length;return Math.min(Z,X.length)}catch{return X.length}}function h(X,Z){if(Z.includes(".min.")||X.length<1000)return X.length;let $=D[Z];if($==="js")return Math.round(X.length*0.6);if($==="css")return Math.round(X.length*0.7);return X.length}function d(X){let Z=[],Q=/import\s+(?:[\w*{}\s,]+\s+from\s+)?['"]([^'"]+)['"]/g,$;while(($=Q.exec(X))!==null)Z.push($[1]);let U=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=U.exec(X))!==null)Z.push($[1]);let K=/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;while(($=K.exec(X))!==null)Z.push($[1]);return[...new Set(Z)]}function c(X,Z){let Q=new Map;for(let U of X){let K=U.path.split(H.sep),j;if(K.length===1)j=H.basename(U.path,U.extension);else j=K[0];let q=Q.get(j)||[];q.push(U),Q.set(j,q)}let $=[];for(let[U,K]of Q){let j=K.reduce((Y,V)=>Y+V.size,0),q=K.reduce((Y,V)=>Y+V.gzipSize,0),J=K.some((Y)=>B.some((V)=>V.test(Y.path))),F=K.some((Y)=>b.some((V)=>V.test(Y.path)));$.push({name:U,files:K.map((Y)=>Y.path),modules:K,size:j,gzipSize:q,isEntry:J,isVendor:F})}return $.sort((U,K)=>K.size-U.size)}function m(X){let Z={js:{count:0,size:0,gzipSize:0},css:{count:0,size:0,gzipSize:0},html:{count:0,size:0,gzipSize:0},image:{count:0,size:0,gzipSize:0},font:{count:0,size:0,gzipSize:0},other:{count:0,size:0,gzipSize:0}};for(let Q of X)Z[Q.type].count++,Z[Q.type].size+=Q.size,Z[Q.type].gzipSize+=Q.gzipSize;return Z}function p(X){let Z=new Map;for(let $ of X){let U=Z.get($.hash)||[];U.push($),Z.set($.hash,U)}let Q=[];for(let[,$]of Z)if($.length>1){let U=$[0];Q.push({path:U.path,count:$.length,wastedBytes:U.size*($.length-1),locations:$.map((K)=>K.path)})}return Q.sort(($,U)=>U.wastedBytes-$.wastedBytes)}function W(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(2)} KB`;return`${(X/1048576).toFixed(2)} MB`}function I(X){let Z=X.match(/^([\d.]+)\s*(B|KB|MB|GB)?$/i);if(!Z)return 0;let Q=Number.parseFloat(Z[1]);switch((Z[2]||"B").toUpperCase()){case"KB":return Q*1024;case"MB":return Q*1024*1024;case"GB":return Q*1024*1024*1024;default:return Q}}function E(X,Z){if(Z===0)return"0%";return`${(X/Z*100).toFixed(1)}%`}function R(X,Z){switch(Z.format){case"json":return u(X,Z);case"markdown":return l(X,Z);case"text":default:return r(X,Z)}}function u(X,Z){let Q=N(X,Z);return JSON.stringify({timestamp:X.timestamp,buildDir:X.buildDir,summary:{totalSize:X.totalSize,totalSizeFormatted:W(X.totalSize),totalGzipSize:X.totalGzipSize,totalGzipSizeFormatted:W(X.totalGzipSize),moduleCount:X.moduleCount,chunkCount:X.chunks.length,duplicateCount:X.duplicates.length},byType:Object.fromEntries(Object.entries(X.byType).map(([$,U])=>[$,{...U,sizeFormatted:W(U.size),gzipSizeFormatted:W(U.gzipSize)}])),chunks:X.chunks.map(($)=>({name:$.name,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),moduleCount:$.modules.length,isEntry:$.isEntry,isVendor:$.isVendor})),largestModules:X.largestModules.slice(0,Z.topModules||10).map(($)=>({path:$.path,size:$.size,sizeFormatted:W($.size),gzipSize:$.gzipSize,gzipSizeFormatted:W($.gzipSize),type:$.type})),duplicates:X.duplicates,analysis:Q,warnings:X.warnings},null,2)}function r(X,Z){let Q=[],$=Z.showGzip!==!1;if(Q.push(""),Q.push("Bundle Analysis Report"),Q.push("\u2550".repeat(50)),Q.push(""),Q.push("Summary"),Q.push("\u2500".repeat(50)),$)Q.push(`Total Size: ${W(X.totalSize)} (${W(X.totalGzipSize)} gzip)`);else Q.push(`Total Size: ${W(X.totalSize)}`);if(Q.push(`Modules: ${X.moduleCount}`),Q.push(`Chunks: ${X.chunks.length}`),X.duplicates.length>0)Q.push(`Duplicates: ${X.duplicates.length}`);if(Q.push(""),Z.threshold&&X.totalSize>Z.threshold)Q.push(`\u26A0\uFE0F Bundle exceeds threshold of ${W(Z.threshold)}!`),Q.push("");Q.push("Size by Type"),Q.push("\u2500".repeat(50));let U=["js","css","html","image","font","other"];for(let j of U){let q=X.byType[j];if(q.count>0){let J=E(q.size,X.totalSize),F=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${j.padEnd(8)} ${W(q.size).padStart(12)}${F} ${J.padStart(6)} (${q.count} files)`)}}Q.push(""),Q.push("Chunks"),Q.push("\u2500".repeat(50));for(let j of X.chunks.slice(0,10)){let q=[];if(j.isEntry)q.push("entry");if(j.isVendor)q.push("vendor");let J=q.length>0?` [${q.join(", ")}]`:"",F=$?` (${W(j.gzipSize)} gzip)`:"";Q.push(` ${j.name.padEnd(20)} ${W(j.size).padStart(12)}${F}${J}`)}if(X.chunks.length>10)Q.push(` ... and ${X.chunks.length-10} more chunks`);Q.push("");let K=Z.topModules||10;Q.push(`Largest Modules (Top ${K})`),Q.push("\u2500".repeat(50));for(let j=0;j<Math.min(K,X.largestModules.length);j++){let q=X.largestModules[j],J=$?` (${W(q.gzipSize)} gzip)`:"";Q.push(` ${(j+1).toString().padStart(2)}. ${q.path}`),Q.push(` ${W(q.size)}${J}`)}if(Q.push(""),X.duplicates.length>0){Q.push("Duplicate Modules"),Q.push("\u2500".repeat(50));for(let j of X.duplicates.slice(0,5))Q.push(` ${j.path}`),Q.push(` ${j.count} copies, wasting ${W(j.wastedBytes)}`);if(X.duplicates.length>5)Q.push(` ... and ${X.duplicates.length-5} more duplicates`);Q.push("")}if(Z.recommendations!==!1){let j=N(X,Z);if(j.recommendations.length>0){Q.push("Recommendations"),Q.push("\u2500".repeat(50));for(let q of j.recommendations.slice(0,5)){let J=q.impact==="high"?"\u26A1":q.impact==="medium"?"\uD83D\uDCCA":"\uD83D\uDCA1";Q.push(` ${J} ${q.title}`),Q.push(` ${q.description}`)}Q.push("")}}if(X.warnings.length>0){Q.push("Warnings"),Q.push("\u2500".repeat(50));for(let j of X.warnings)Q.push(` \u26A0\uFE0F ${j}`);Q.push("")}return Q.join(`
3
3
  `)}function l(X,Z){let Q=[],$=Z.showGzip!==!1;if(Q.push("# Bundle Analysis Report"),Q.push(""),Q.push(`Generated: ${new Date(X.timestamp).toISOString()}`),Q.push(""),Q.push("## Summary"),Q.push(""),Q.push("| Metric | Value |"),Q.push("|--------|-------|"),Q.push(`| Total Size | ${W(X.totalSize)} |`),$)Q.push(`| Gzip Size | ${W(X.totalGzipSize)} |`);Q.push(`| Modules | ${X.moduleCount} |`),Q.push(`| Chunks | ${X.chunks.length} |`),Q.push(`| Duplicates | ${X.duplicates.length} |`),Q.push(""),Q.push("## Size by Type"),Q.push(""),Q.push("| Type | Size | Gzip | % | Files |"),Q.push("|------|------|------|---|-------|");let U=["js","css","html","image","font","other"];for(let j of U){let q=X.byType[j];if(q.count>0)Q.push(`| ${j} | ${W(q.size)} | ${W(q.gzipSize)} | ${E(q.size,X.totalSize)} | ${q.count} |`)}Q.push(""),Q.push("## Chunks"),Q.push(""),Q.push("| Name | Size | Gzip | Modules | Type |"),Q.push("|------|------|------|---------|------|");for(let j of X.chunks.slice(0,15)){let q=j.isEntry?"Entry":j.isVendor?"Vendor":"-";Q.push(`| ${j.name} | ${W(j.size)} | ${W(j.gzipSize)} | ${j.modules.length} | ${q} |`)}Q.push("");let K=Z.topModules||10;Q.push(`## Largest Modules (Top ${K})`),Q.push(""),Q.push("| # | Path | Size | Gzip |"),Q.push("|---|------|------|------|");for(let j=0;j<Math.min(K,X.largestModules.length);j++){let q=X.largestModules[j];Q.push(`| ${j+1} | \`${q.path}\` | ${W(q.size)} | ${W(q.gzipSize)} |`)}if(Q.push(""),X.duplicates.length>0){Q.push("## Duplicates"),Q.push(""),Q.push("| Path | Copies | Wasted |"),Q.push("|------|--------|--------|");for(let j of X.duplicates.slice(0,10))Q.push(`| \`${j.path}\` | ${j.count} | ${W(j.wastedBytes)} |`);Q.push("")}if(Z.recommendations!==!1){let j=N(X,Z);if(j.recommendations.length>0){Q.push("## Recommendations"),Q.push("");for(let q of j.recommendations)Q.push(`### ${q.title}`),Q.push(""),Q.push(q.description),Q.push(""),Q.push(`- **Impact:** ${q.impact}`),Q.push(`- **Effort:** ${q.effort}`),Q.push("")}}return Q.join(`
4
4
  `)}function N(X,Z){let Q=[],$=[];if(Z.threshold&&X.totalSize>Z.threshold)Q.push({severity:"error",message:`Bundle size (${W(X.totalSize)}) exceeds threshold (${W(Z.threshold)})`});if(X.totalSize>1048576)Q.push({severity:"warning",message:`Bundle is over 1MB (${W(X.totalSize)})`,details:"Large bundles can significantly impact load time"});if(X.duplicates.length>0){let q=X.duplicates.reduce((J,F)=>J+F.wastedBytes,0);Q.push({severity:"warning",message:`${X.duplicates.length} duplicate modules found, wasting ${W(q)}`}),$.push({title:"Remove Duplicate Modules",description:"Consider using import aliases or ensuring consistent package versions to eliminate duplicates.",impact:"medium",effort:"low"})}if(X.byType.js.size/X.totalSize>0.8&&X.totalSize>512000)$.push({title:"Code Splitting",description:"Over 80% of your bundle is JavaScript. Consider splitting code by route or feature.",impact:"high",effort:"medium"});let K=X.largestModules.filter((q)=>q.size>102400);if(K.length>0){Q.push({severity:"info",message:`${K.length} modules are over 100KB`});for(let q of K){if(q.path.includes("lodash")&&!q.path.includes("lodash-es"))$.push({title:"Use lodash-es instead of lodash",description:"lodash-es supports tree-shaking and can significantly reduce bundle size.",impact:"high",effort:"low"});if(q.path.includes("moment"))$.push({title:"Replace moment.js",description:"Consider using date-fns or dayjs for smaller date handling libraries.",impact:"high",effort:"medium"})}}if(X.byType.image.size>512000)$.push({title:"Optimize Images",description:`Images account for ${W(X.byType.image.size)}. Consider using WebP/AVIF formats and responsive images.`,impact:"high",effort:"low"});let j=100;if(X.totalSize>1048576)j-=20;else if(X.totalSize>512000)j-=10;if(j-=Math.min(20,X.duplicates.length*2),j-=Math.min(15,K.length*3),Z.threshold&&X.totalSize>Z.threshold)j-=25;return{score:Math.max(0,j),issues:Q,recommendations:$}}var i={lodash:{alternative:"lodash-es or individual imports",savings:"~70%"},moment:{alternative:"date-fns or dayjs",savings:"~90%"},"chart.js":{alternative:"chart.js with tree-shaking",savings:"~50%"},"highlight.js":{alternative:"Selective language imports",savings:"~80%"},fontawesome:{alternative:"Individual icon imports",savings:"~90%"},"material-ui":{alternative:"Named imports from @mui/*",savings:"~60%"}};function n(X){for(let[Z,Q]of Object.entries(i))if(X.includes(Z))return{title:`Optimize ${Z}`,description:`Consider using ${Q.alternative}. Potential savings: ${Q.savings}`,impact:"high",effort:"low"};return null}var o={default:{js:"#f7df1e",css:"#264de4",html:"#e34c26",image:"#4caf50",font:"#9c27b0",other:"#607d8b",vendor:"#ff5722"},pastel:{js:"#fff3b0",css:"#b0d4ff",html:"#ffb0b0",image:"#b0ffb0",font:"#e0b0ff",other:"#d0d0d0",vendor:"#ffcfb0"},monochrome:{js:"#333333",css:"#555555",html:"#777777",image:"#999999",font:"#bbbbbb",other:"#dddddd",vendor:"#444444"}};function x(X,Z={}){let{title:Q="Bundle Analysis",gzip:$=!0,colorScheme:U="default"}=Z,K=o[U],j=a(X),q=JSON.stringify(j);return`<!DOCTYPE html>
5
5
  <html lang="en">
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{wg as I}from"./chunk-57atgbyq.js";import{sr as H}from"./chunk-msq8xvhp.js";import{Nw as G}from"./chunk-ejqpq0wc.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-88e14er7.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
- export{Q as Ue};
2
+ import{xg as I}from"./chunk-0knxnyq6.js";import{wr as H}from"./chunk-3ssjb8cx.js";import{Rw as G}from"./chunk-emjmshj8.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-w9gserf7.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
+ export{Q as Ve};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ei as a}from"./chunk-g1vxsvqv.js";import"./chunk-emjmshj8.js";export{a as rewriteImagesWithSiblings};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{ag as ZJ,cg as g,eg as A,kg as n,ng as GJ,qg as WJ,sg as YJ,ug as jJ}from"./chunk-g7msqva8.js";import{xg as $J}from"./chunk-57atgbyq.js";import{ql as XJ}from"./chunk-ngjkzaj7.js";import{ko as h}from"./chunk-msq8xvhp.js";import{Cs as e}from"./chunk-9e20mgwc.js";import{Dt as QJ,Ht as i,Jt as p}from"./chunk-vhta1be7.js";import{Dw as VJ,Xv as KJ,yw as l}from"./chunk-swvm1wgn.js";import{Nw as DJ}from"./chunk-ejqpq0wc.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-h5jt4mxx.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
- export{zJ as Ve,LJ as We,t as Xe,uJ as Ye};
2
+ import{bg as ZJ,dg as g,fg as A,lg as n,og as GJ,rg as WJ,tg as YJ,vg as jJ}from"./chunk-a4jhcbsh.js";import{yg as $J}from"./chunk-0knxnyq6.js";import{rl as XJ}from"./chunk-t23kccpz.js";import{lo as h}from"./chunk-3ssjb8cx.js";import{Gs as e}from"./chunk-kjd9hbg4.js";import{Ht as QJ,Lt as i,Nt as p}from"./chunk-1nnza3m6.js";import{$v as KJ,Cw as l,Hw as VJ}from"./chunk-trva71am.js";import{Rw as DJ}from"./chunk-emjmshj8.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-0d6qgbks.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
+ export{zJ as We,LJ as Xe,t as Ye,uJ as Ze};
@@ -81,4 +81,4 @@ else {
81
81
  </div>
82
82
  ${U}
83
83
  `})}
84
- export{_ as hi};
84
+ export{_ as ii};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import k from"fs";import q from"path";var x="resources/assets",D="assets";function F(m=process.cwd()){let g=q.resolve(m,x);return k.existsSync(g)&&k.statSync(g).isDirectory()?g:null}
3
- export{x as Ck,D as Dk,F as Ek};
3
+ export{x as Dk,D as Ek,F as Fk};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ro as a,So as b,To as c,Uo as d,Vo as e,Wo as f,Xo as g}from"./chunk-3ssjb8cx.js";import"./chunk-ykevda74.js";import"./chunk-ez003q74.js";import"./chunk-kyyt9xhs.js";import"./chunk-tf16jtj4.js";import"./chunk-19m7hed6.js";import"./chunk-kjd9hbg4.js";import"./chunk-ejwfnttb.js";import"./chunk-5270fyk7.js";import"./chunk-q4kgqqed.js";import"./chunk-1nnza3m6.js";import"./chunk-hkrzv980.js";import"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-zxfejz72.js";import"./chunk-mere396d.js";import"./chunk-aa8015mk.js";import"./chunk-trva71am.js";import"./chunk-rtfwn4cm.js";import"./chunk-emjmshj8.js";export{a as resetUnscopedSignalWarnings,g as processStackReplacements,f as processStackPushDirectives,e as processIncludes,b as partialsCache,c as onceStore,d as clearOnceStore};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import G from"path";var L=new Set([".jpg",".jpeg",".png",".gif"]),O=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function M(j,z){let H=z.formats??O;if(!z.publicDir)return j;let C=N(j),J=[],Y=/<img\b[^>]*?>/gi,K=[],Q;while((Q=Y.exec(j))!==null){let q=Q[0],y=q.match(/\bsrc=["']([^"']+)["']/i);if(!y)continue;if(_(Q.index,C))continue;K.push({idx:Q.index,length:q.length,src:y[1],raw:q})}if(K.length===0)return j;let Z=await Promise.all(K.map(async(q)=>{let y=await X(q.src,z.publicDir,H);return{match:q,sources:y}}));for(let{match:q,sources:y}of Z){if(y.length===0)continue;let I=`<picture>${y.map(($)=>`<source type="${$.mime}" srcset="${w($.url)}">`).join("")}${q.raw}</picture>`;J.push({start:q.idx,end:q.idx+q.length,replacement:I})}if(J.length===0)return j;let V="",W=0;for(let q of J)V+=j.slice(W,q.start),V+=q.replacement,W=q.end;return V+=j.slice(W),V}async function X(j,z,H){if(!F(j))return[];let C=G.extname(j).toLowerCase();if(!L.has(C))return[];if(!j.startsWith("/"))return[];let J=G.join(z,j.slice(1)),Y=G.dirname(J),K=G.basename(J,C),Q=G.resolve(Y),Z=G.resolve(z);if(!Q.startsWith(Z))return[];let V=G.posix.dirname(j),W=H.map(async(y)=>{let k=G.join(Y,`${K}${y.ext}`);if(!await Bun.file(k).exists())return null;return{url:G.posix.join(V,`${K}${y.ext}`),mime:y.mime}});return(await Promise.all(W)).filter((y)=>y!==null)}function F(j){if(!j)return!1;if(j.startsWith("http://")||j.startsWith("https://"))return!1;if(j.startsWith("//"))return!1;if(j.startsWith("data:"))return!1;return!0}function N(j){let z=[],H=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,C;while((C=H.exec(j))!==null)z.push([C.index,C.index+C[0].length]);return z}function _(j,z){for(let[H,C]of z)if(j>=H&&j<C)return!0;return!1}function w(j){return j.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}
3
- export{M as di};
3
+ export{M as ei};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ii as a}from"./chunk-fqq5k9ve.js";import"./chunk-emjmshj8.js";export{a as processDeferDirectives};
@@ -213,4 +213,4 @@ function w(Z,M){let{itemHeight:K,containerHeight:P,overscan:F=3,keyProperty:$="i
213
213
  })();
214
214
  </script>
215
215
  `})}var v={createVirtualList:w,processVirtualListDirectives:C,processInfiniteListDirectives:E,processVirtualGridDirectives:f,generateVirtualListCSS:b,useVirtualList:L};
216
- export{w as Bh,C as Ch,b as Dh,L as Eh,E as Fh,f as Gh,v as Hh};
216
+ export{w as Ch,C as Dh,b as Eh,L as Fh,E as Gh,f as Hh,v as Ih};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{hu as a,iu as b,ju as c,ku as d,lu as e,mu as f,nu as g,ou as h,pu as i,qu as j,ru as k,su as l,tu as m,uu as n,vu as o,wu as p}from"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-ejqpq0wc.js";export{i as useTitle,f as useSeoMeta,i as usePageTitle,d as useHead,g as seoMetaToHeadConfig,c as resetHead,k as renderHtmlAttrs,j as renderHead,l as renderBodyAttrs,o as processTitleDirective,p as processMetaDirective,n as processHeadDirective,e as mergeHeadConfigs,b as getPageMeta,a as getHead,h as definePageMeta,m as applyHead};
2
+ import{Au as p,lu as a,mu as b,nu as c,ou as d,pu as e,qu as f,ru as g,su as h,tu as i,uu as j,vu as k,wu as l,xu as m,yu as n,zu as o}from"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-emjmshj8.js";export{i as useTitle,f as useSeoMeta,i as usePageTitle,d as useHead,g as seoMetaToHeadConfig,c as resetHead,k as renderHtmlAttrs,j as renderHead,l as renderBodyAttrs,o as processTitleDirective,p as processMetaDirective,n as processHeadDirective,e as mergeHeadConfigs,b as getPageMeta,a as getHead,h as definePageMeta,m as applyHead};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{uv as a,vv as b}from"./chunk-zxfejz72.js";import"./chunk-emjmshj8.js";export{a as transformStoreImports,b as stripModuleImports};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ls as _}from"./chunk-2wb3pgp4.js";import"./chunk-ejqpq0wc.js";function W(j,G,H=240){return j.slice(G,G+H)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(j)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(j)||/\b(?:const|let|var)\s+alert\s*=/.test(j)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(j,G)=>{let H=j.indexOf("(",G);if(H===-1)return!0;let Q=j.slice(H+1,j.indexOf(")",H)+1);return!/\b(?:location|search|href|url)\b/i.test(Q)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(j,G)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(W(j,G,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(j,G)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(W(j,G))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(j)=>/setTimeout\s*\(/.test(j)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],U=["confirm","tooltip",...v.map((j)=>j.rule)];function N(j,G){let H=1;for(let Q=0;Q<G;Q++)if(j[Q]===`
2
+ import{ps as _}from"./chunk-kyyt9xhs.js";import"./chunk-emjmshj8.js";function W(j,G,H=240){return j.slice(G,G+H)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(j)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(j)||/\b(?:const|let|var)\s+alert\s*=/.test(j)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(j,G)=>{let H=j.indexOf("(",G);if(H===-1)return!0;let Q=j.slice(H+1,j.indexOf(")",H)+1);return!/\b(?:location|search|href|url)\b/i.test(Q)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(j,G)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(W(j,G,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(j,G)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(W(j,G))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(j)=>/setTimeout\s*\(/.test(j)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],U=["confirm","tooltip",...v.map((j)=>j.rule)];function N(j,G){let H=1;for(let Q=0;Q<G;Q++)if(j[Q]===`
3
3
  `)H++;return H}function P(j,G){let H=j.lastIndexOf(`
4
4
  `,G)+1,Q=j.indexOf(`
5
5
  `,G);return j.slice(H,Q===-1?j.length:Q).trim().slice(0,120)}function q(j,G){let H=j.slice(0,G),Q=H.lastIndexOf("function"),X=H.lastIndexOf("=>"),M=Math.max(Q,X);if(M===-1)return!1;let z=j.slice(Math.max(0,M-120),M);return/\basync\b[^;{}]*$/.test(z)}function L(j){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(j)||/\b(?:const|let|var)\s+confirm\s*=/.test(j)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(j)}function O(j,G,H){if(L(j))return j;let Q=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,X=F(j),M="",z=0,Y;while((Y=Q.exec(X))!==null){let Z=Y.index+Y[1].length,$=N(j,Z),J=P(j,Z);if(/stxConfirm\s*\($/.test(j.slice(0,Z+8)))continue;let D=q(j,Z);if(H.push({file:G,line:$,rule:"confirm",applied:D,snippet:J,reason:D?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),D)M+=j.slice(z,Z)+"await stxConfirm(",z=Z+(Y[0].length-Y[1].length)}return M+j.slice(z)}function w(j,G,H){let Q=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,X=C(j),M="",z=0,Y;while((Y=Q.exec(X))!==null){let[Z,$,J,D]=Y,K=N(j,Y.index),B=P(j,Y.index),V=$.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(V)){H.push({file:G,line:K,rule:"tooltip",applied:!1,snippet:B,reason:`\`title\` on <${V}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test($)||D.trim()===""){H.push({file:G,line:K,rule:"tooltip",applied:!1,snippet:B,reason:/\bx-tooltip[=\s]/.test($)?"already has x-tooltip":"empty title"});continue}H.push({file:G,line:K,rule:"tooltip",applied:!0,snippet:B}),M+=j.slice(z,Y.index)+`${$} x-tooltip=${J}${D}${J} title=${J}${D}${J}`,z=Y.index+Z.length}return M+j.slice(z)}function C(j){return j.replace(/<!--[\s\S]*?-->/g,(G)=>G.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(G)=>G.replace(/[^\n]/g," "))}function E(j){let G=(H)=>H.replace(/[^\n]/g," ");return j.replace(/\/\*[\s\S]*?\*\//g,G).replace(/\/\/[^\n]*/g,G)}function F(j,G=!1){let H=C(j);return(G?E(H):_(H)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(X,M)=>/\bclient\b/i.test(M)?X:X.replace(/[^\n]/g," "))}function S(j,G,H,Q){let X=F(j),M=F(j,!0);for(let z of v){if(!H.includes(z.rule))continue;if(z.requires&&!z.requires(j))continue;z.pattern.lastIndex=0;let Y,Z=/['"]/.test(z.pattern.source)?M:X;z.pattern.lastIndex=0;while((Y=z.pattern.exec(Z))!==null){if(z.reject?.(j,Y.index))continue;Q.push({file:G,line:N(j,Y.index),rule:z.rule,applied:!1,snippet:P(j,Y.index),reason:`${z.primitive} \u2014 ${z.why}`})}}}function k(j,G={}){let H=G.rules??U,Q=G.file??"<source>",X=[];S(j,Q,H,X);let M=j;if(H.includes("confirm"))M=O(M,Q,X);if(H.includes("tooltip"))M=w(M,Q,X);X.sort((Z,$)=>Z.line-$.line);let z=new Set,Y=X.filter((Z)=>{let $=`${Z.rule}:${Z.line}`;if(z.has($))return!1;return z.add($),!0});return{code:M,findings:Y}}var I=new Set(["confirm","tooltip"]);function A(j,G){if(j.length===0)return"No hand-rolled equivalents found.";let H=j.filter((z)=>z.applied),Q=j.filter((z)=>!z.applied&&I.has(z.rule)),X=j.filter((z)=>!z.applied&&!I.has(z.rule)),M=[];if(H.length>0){M.push(G?`Rewrote ${H.length} site(s):`:`Would rewrite ${H.length} site(s) (pass --fix):`);for(let z of H)M.push(` ${z.file}:${z.line} [${z.rule}] ${z.snippet}`)}if(Q.length>0){M.push("",`Needs a human \u2014 ${Q.length} site(s):`);for(let z of Q)M.push(` ${z.file}:${z.line} [${z.rule}] ${z.snippet}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ah as h,th as a,uh as b,vh as c,wh as d,xh as e,yh as f,zh as g}from"./chunk-sqvqwd0p.js";import"./chunk-ejqpq0wc.js";export{g as timingPlugin,c as pluginManager,a as definePlugin,f as debugPlugin,h as createVariablesPlugin,e as createFilterPlugin,d as createDirectivePlugin,b as PluginManager};
2
+ import{Ah as g,Bh as h,uh as a,vh as b,wh as c,xh as d,yh as e,zh as f}from"./chunk-y4zddt5r.js";import"./chunk-emjmshj8.js";export{g as timingPlugin,c as pluginManager,a as definePlugin,f as debugPlugin,h as createVariablesPlugin,e as createFilterPlugin,d as createDirectivePlugin,b as PluginManager};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Nw as y}from"./chunk-ejqpq0wc.js";function w4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function jZ(){return typeof window<"u"&&typeof document<"u"}async function B4(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var g=new Map;function f4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function v4(Z){switch(Z){case"info":return"&#x2139;";case"success":return"&#x2714;";case"warning":return"&#x26A0;";case"error":return"&#x2716;";default:return"&#x2139;"}}function y4(Z="top-right"){if(!jZ())throw Error("Toast container requires browser environment");try{let $=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if($)return $}catch{}let Y=document.createElement("div");Y.className=`stx-toast-container ${Z}`,Y.dataset.position=Z;try{if(document.body)document.body.appendChild(Y)}catch{}return Y}function g4(Z){let{options:Y}=Z,$=v4(Y.type),J=Y.type||"info",Q=Y.duration!==0;return`
2
+ import{Rw as y}from"./chunk-emjmshj8.js";function w4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function jZ(){return typeof window<"u"&&typeof document<"u"}async function B4(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var g=new Map;function f4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function v4(Z){switch(Z){case"info":return"&#x2139;";case"success":return"&#x2714;";case"warning":return"&#x26A0;";case"error":return"&#x2716;";default:return"&#x2139;"}}function y4(Z="top-right"){if(!jZ())throw Error("Toast container requires browser environment");try{let $=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if($)return $}catch{}let Y=document.createElement("div");Y.className=`stx-toast-container ${Z}`,Y.dataset.position=Z;try{if(document.body)document.body.appendChild(Y)}catch{}return Y}function g4(Z){let{options:Y}=Z,$=v4(Y.type),J=Y.type||"info",Q=Y.duration!==0;return`
3
3
  <div class="stx-toast ${J}" data-alert-id="${Z.id}" role="alert" aria-live="polite">
4
4
  <div class="stx-toast-icon">${$}</div>
5
5
  <div class="stx-toast-content">
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$t as _,au as H,bu as A,cu as X,du as U,eu as K,fu as S,gu as C,lu as T}from"./chunk-san1eq0r.js";import{Du as I,Tu as L}from"./chunk-avwywzsj.js";var h=/(?<![\w$@])@meta\s*\(/g,u=/(?<![\w$@])@metaTag\s*\(/g,f=/(?<![\w$@])@structuredData\s*\(/g,p=/(?<![\w$@])@seo\s*\(/g;function b(z,J){return(Q)=>K(z,Q,"the call has no closing parenthesis",J,I.INVALID_DIRECTIVE_SYNTAX)}function g(z){return"property"in z?`<meta property="${B(z.property)}" content="${B(z.content)}">`:`<meta name="${B(z.name)}" content="${B(z.content)}">`}function Qz(z,J,Q,N){if(!z.includes("@meta"))return z;let W=_(z,h,(Z,G)=>{let $=C(H(Z),J);if($.kind==="tag")return g($.tag);if($.kind==="empty")return"";return K("Meta",G,$.message,Q,$.code)},b("Meta",Q));return W=_(W,u,(Z,G)=>{let $=A(Z,J);if(!$.ok)return K("MetaTag",G,$.message,Q,$.code);if($.value===void 0||$.value===null)return"";if(!U($.value))return K("MetaTag",G,`expected an object such as { name, content }, got ${X($.value)}`,Q,I.TYPE_ERROR);let q=$.value;if(!q.name&&!q.property&&!q.httpEquiv)return K("MetaTag",G,"the tag needs a name, property or httpEquiv",Q,I.INVALID_DIRECTIVE_SYNTAX);if(q.content===void 0||q.content===null||q.content===""||q.content===!1)return"";let j="<meta";if(q.name)j+=` name="${B(q.name)}"`;if(q.property)j+=` property="${B(q.property)}"`;if(q.httpEquiv)j+=` http-equiv="${B(q.httpEquiv)}"`;return j+=` content="${B(q.content)}">`,j},b("MetaTag",Q)),W}function v(z){let J=(Q)=>Q["@context"]?{...Q}:{...Q,"@context":"https://schema.org"};if(U(z))return J(z);if(Array.isArray(z)&&z.length>0&&z.every(U))return z.map(J);return null}function E(z){return`<script type="application/ld+json">${JSON.stringify(z).replace(/<\//g,"<\\/")}</script>`}function Wz(z,J,Q){if(!z.includes("@structuredData"))return z;return _(z,f,(N,W)=>{let Z=A(N,J);if(!Z.ok)return K("StructuredData",W,Z.message,Q,Z.code);if(Z.value===void 0||Z.value===null)return"";let G=v(Z.value);if(!G)return K("StructuredData",W,`expected an object or an array of objects, got ${X(Z.value)}`,Q,I.TYPE_ERROR);try{return E(G)}catch($){let q=$ instanceof Error?$.message:String($);return K("StructuredData",W,`the data cannot be written as JSON: ${q}`,Q,I.EVALUATION_ERROR)}},b("StructuredData",Q))}var m=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),D={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Zz(z,J,Q,N){if(!z.includes("@seo"))return z;return _(z,p,(W,Z)=>{if(!W.trim())return K("SEO",Z,"expected an object: @seo({ title, description }) or @seo(seoVariable)",Q,I.INVALID_DIRECTIVE_SYNTAX);let G=A(W,J);if(!G.ok)return K("SEO",Z,G.message,Q,G.code);if(G.value===void 0||G.value===null)return"";if(!U(G.value))return K("SEO",Z,`expected an object such as { title, description }, got ${X(G.value)}`,Q,I.TYPE_ERROR);try{return c(G.value,Z,Q)}catch($){let q=$ instanceof Error?$.message:String($);return K("SEO",Z,`Error processing @seo directive: ${q}`,Q,I.EVALUATION_ERROR)}},b("SEO",Q))}function y(z,J,Q,N){let W=z[J];if(W===void 0||W===null||W===!1)return;if(U(W))return W;S(Q,`${J} must be an object, got ${X(W)}; its tags were left out`,N);return}function c(z,J,Q){let N=Object.keys(z).filter(($)=>!m.has($));if(N.length>0){let $=N.map((q)=>D[q]?`${q} (use ${D[q]})`:q).join(", ");S(J,`@seo does not read ${$}; ${N.length===1?"it was":"they were"} ignored`,Q)}let W="";if(z.title)W+=`<title>${B(z.title)}</title>
2
+ import{du as _,eu as H,fu as A,gu as X,hu as U,iu as K,ju as S,ku as C,pu as T}from"./chunk-qbz6yn8c.js";import{Hu as I,Xu as L}from"./chunk-czj6nq0b.js";var h=/(?<![\w$@])@meta\s*\(/g,u=/(?<![\w$@])@metaTag\s*\(/g,f=/(?<![\w$@])@structuredData\s*\(/g,p=/(?<![\w$@])@seo\s*\(/g;function b(z,J){return(Q)=>K(z,Q,"the call has no closing parenthesis",J,I.INVALID_DIRECTIVE_SYNTAX)}function g(z){return"property"in z?`<meta property="${B(z.property)}" content="${B(z.content)}">`:`<meta name="${B(z.name)}" content="${B(z.content)}">`}function Qz(z,J,Q,N){if(!z.includes("@meta"))return z;let W=_(z,h,(Z,G)=>{let $=C(H(Z),J);if($.kind==="tag")return g($.tag);if($.kind==="empty")return"";return K("Meta",G,$.message,Q,$.code)},b("Meta",Q));return W=_(W,u,(Z,G)=>{let $=A(Z,J);if(!$.ok)return K("MetaTag",G,$.message,Q,$.code);if($.value===void 0||$.value===null)return"";if(!U($.value))return K("MetaTag",G,`expected an object such as { name, content }, got ${X($.value)}`,Q,I.TYPE_ERROR);let q=$.value;if(!q.name&&!q.property&&!q.httpEquiv)return K("MetaTag",G,"the tag needs a name, property or httpEquiv",Q,I.INVALID_DIRECTIVE_SYNTAX);if(q.content===void 0||q.content===null||q.content===""||q.content===!1)return"";let j="<meta";if(q.name)j+=` name="${B(q.name)}"`;if(q.property)j+=` property="${B(q.property)}"`;if(q.httpEquiv)j+=` http-equiv="${B(q.httpEquiv)}"`;return j+=` content="${B(q.content)}">`,j},b("MetaTag",Q)),W}function v(z){let J=(Q)=>Q["@context"]?{...Q}:{...Q,"@context":"https://schema.org"};if(U(z))return J(z);if(Array.isArray(z)&&z.length>0&&z.every(U))return z.map(J);return null}function E(z){return`<script type="application/ld+json">${JSON.stringify(z).replace(/<\//g,"<\\/")}</script>`}function Wz(z,J,Q){if(!z.includes("@structuredData"))return z;return _(z,f,(N,W)=>{let Z=A(N,J);if(!Z.ok)return K("StructuredData",W,Z.message,Q,Z.code);if(Z.value===void 0||Z.value===null)return"";let G=v(Z.value);if(!G)return K("StructuredData",W,`expected an object or an array of objects, got ${X(Z.value)}`,Q,I.TYPE_ERROR);try{return E(G)}catch($){let q=$ instanceof Error?$.message:String($);return K("StructuredData",W,`the data cannot be written as JSON: ${q}`,Q,I.EVALUATION_ERROR)}},b("StructuredData",Q))}var m=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),D={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Zz(z,J,Q,N){if(!z.includes("@seo"))return z;return _(z,p,(W,Z)=>{if(!W.trim())return K("SEO",Z,"expected an object: @seo({ title, description }) or @seo(seoVariable)",Q,I.INVALID_DIRECTIVE_SYNTAX);let G=A(W,J);if(!G.ok)return K("SEO",Z,G.message,Q,G.code);if(G.value===void 0||G.value===null)return"";if(!U(G.value))return K("SEO",Z,`expected an object such as { title, description }, got ${X(G.value)}`,Q,I.TYPE_ERROR);try{return c(G.value,Z,Q)}catch($){let q=$ instanceof Error?$.message:String($);return K("SEO",Z,`Error processing @seo directive: ${q}`,Q,I.EVALUATION_ERROR)}},b("SEO",Q))}function y(z,J,Q,N){let W=z[J];if(W===void 0||W===null||W===!1)return;if(U(W))return W;S(Q,`${J} must be an object, got ${X(W)}; its tags were left out`,N);return}function c(z,J,Q){let N=Object.keys(z).filter(($)=>!m.has($));if(N.length>0){let $=N.map((q)=>D[q]?`${q} (use ${D[q]})`:q).join(", ");S(J,`@seo does not read ${$}; ${N.length===1?"it was":"they were"} ignored`,Q)}let W="";if(z.title)W+=`<title>${B(z.title)}</title>
3
3
  `,W+=`<meta name="title" content="${B(z.title)}">
4
4
  `;if(z.description)W+=`<meta name="description" content="${B(z.description)}">
5
5
  `;if(z.keywords){let $=Array.isArray(z.keywords)?z.keywords.join(", "):z.keywords;W+=`<meta name="keywords" content="${B($)}">
@@ -61,4 +61,4 @@ ${z.map((Z)=>{let G=Z.startsWith("http")?Z:`${Q}${Z.startsWith("/")?"":"/"}${Z}`
61
61
  `)}
62
62
  </sitemapindex>`}async function Nz(z,J){let{extensions:Q=[".stx",".html",".htm"],ignore:N=["_*",".*","node_modules","components","partials","layouts"]}=J,W=[],Z=Q.length===1?`*${Q[0]}`:`*{${Q.join(",")}}`,G=new Bun.Glob(`**/${Z}`);for await(let $ of G.scan(z)){if(N.some((V)=>{if(V.startsWith("*"))return $.includes(V.slice(1));return $.startsWith(V)||$.includes(`/${V}`)}))continue;let j=$.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!j.startsWith("/"))j=`/${j}`;if(j!=="/"&&j.endsWith("/"))j=j.slice(0,-1);let Y=`${z}/${$}`,O;try{let V=await Bun.file(Y).stat();if(V)O=new Date(V.mtime).toISOString().split("T")[0]}catch{}W.push({loc:j||"/",lastmod:O,priority:j==="/"?1:0.5})}return W.sort(($,q)=>$.loc.localeCompare(q.loc)),W}function a(z){let J=[];for(let Q of z.rules){if(J.push(`User-agent: ${Q.userAgent}`),Q.allow)for(let N of Q.allow)J.push(`Allow: ${N}`);if(Q.disallow)for(let N of Q.disallow)J.push(`Disallow: ${N}`);if(Q.crawlDelay!==void 0)J.push(`Crawl-delay: ${Q.crawlDelay}`);J.push("")}if(z.sitemap){let Q=Array.isArray(z.sitemap)?z.sitemap:[z.sitemap];for(let N of Q)J.push(`Sitemap: ${N}`)}if(z.host)J.push(`Host: ${z.host}`);return J.join(`
63
63
  `).trim()}function jz(z){return a({rules:[{userAgent:"*",allow:["/"]}],sitemap:z})}function d(z){return z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
64
- export{Qz as Kt,Wz as Lt,Zz as Mt,$z as Nt,i as Ot,l as Pt,Gz as Qt,qz as Rt,Bz as St,Nz as Tt,a as Ut,jz as Vt};
64
+ export{Qz as Ot,Wz as Pt,Zz as Qt,$z as Rt,i as St,l as Tt,Gz as Ut,qz as Vt,Bz as Wt,Nz as Xt,a as Yt,jz as Zt};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Nw as l}from"./chunk-ejqpq0wc.js";import U from"fs";import G from"path";import I from"os";import H from"crypto";import{generatePlaceholder as m,processImage as g}from"ts-images";var d=[320,640,768,1024,1280,1536,1920],h=["webp","jpeg"],b=80,u=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],P={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},N=null,W=!1;async function Y(){if(W)return N;W=!0;try{let J=await import("sharp");return N=J.default||J,N}catch{return null}}async function e(){return await Y()!==null}async function t(){return!0}async function JJ(J,K={}){let{widths:Z=d,formats:$=h,quality:q=b,fit:C="cover",placeholder:X="none",outputDir:Q=".stx/images",baseUrl:_="/images"}=K,j,x;if(typeof J==="string"){if(x=J,!await Bun.file(J).exists())throw new L(`Image not found: ${J}`,"NOT_FOUND");j=await Bun.file(J).arrayBuffer().then((V)=>Buffer.from(V))}else x="buffer-input",j=J;let w=H.createHash("sha256").update(j).digest("hex").slice(0,12),y=await O(j),{width:B,height:D}=y,A=B/D;await U.promises.mkdir(Q,{recursive:!0});let T=[],v=G.basename(x,G.extname(x)),z=Z.filter((V)=>V<=B);if(!z.includes(B)&&B<=Math.max(...Z))z.push(B);z.sort((V,R)=>V-R);for(let V of z){let R=Math.round(V/A);for(let F of $){let S=`${v}-${V}w-${w}.${F}`,k=G.join(Q,S),c=`${_}/${S}`,E=await n(j,{width:V,height:R,format:F,quality:q,fit:C});await Bun.write(k,E),T.push({path:k,url:c,width:V,height:R,format:F,size:E.length})}}let M;if(X!=="none")M=await o(j,X);return{src:x,variants:T,placeholder:M,width:B,height:D,aspectRatio:A,hash:w}}async function O(J){let K=typeof J==="string"?Buffer.from(await Bun.file(J).arrayBuffer()):J,Z=await Y();if(Z){let q=await Z(K).metadata();return{width:q.width||0,height:q.height||0,format:q.format||"unknown",hasAlpha:q.hasAlpha}}return p(K)}function p(J){if(J[0]===137&&J[1]===80&&J[2]===78&&J[3]===71){let K=J.readUInt32BE(16),Z=J.readUInt32BE(20);return{width:K,height:Z,format:"png",hasAlpha:!0}}if(J[0]===255&&J[1]===216){let K=2;while(K<J.length){if(J[K]!==255)break;let Z=J[K+1];if(Z>=192&&Z<=207&&Z!==196&&Z!==200&&Z!==204){let q=J.readUInt16BE(K+5);return{width:J.readUInt16BE(K+7),height:q,format:"jpeg",hasAlpha:!1}}let $=J.readUInt16BE(K+2);K+=2+$}}if(J.toString("utf8",0,4)==="RIFF"&&J.toString("utf8",8,12)==="WEBP"){let K=J.toString("utf8",12,16);if(K==="VP8 "){let Z=J.readUInt16LE(26)&16383,$=J.readUInt16LE(28)&16383;return{width:Z,height:$,format:"webp",hasAlpha:!1}}if(K==="VP8L"){let Z=J.readUInt32LE(21),$=(Z&16383)+1,q=(Z>>14&16383)+1;return{width:$,height:q,format:"webp",hasAlpha:!0}}}if(J.toString("utf8",0,3)==="GIF"){let K=J.readUInt16LE(6),Z=J.readUInt16LE(8);return{width:K,height:Z,format:"gif",hasAlpha:!0}}throw new L("Unable to parse image dimensions","PARSE_ERROR")}async function n(J,K){let Z=await Y();if(Z){let q=Z(J).resize(K.width,K.height,{fit:K.fit});switch(K.format){case"webp":q=q.webp({quality:K.quality});break;case"avif":q=q.avif({quality:K.quality});break;case"jpeg":q=q.jpeg({quality:K.quality});break;case"png":q=q.png({quality:K.quality});break}return q.toBuffer()}let $=G.join(I.tmpdir(),`stx-img-${H.randomBytes(8).toString("hex")}.${K.format}`);try{return await g({input:J,output:$,format:K.format,quality:K.quality,resize:{width:K.width,height:K.height,fit:K.fit}}),Buffer.from(await Bun.file($).arrayBuffer())}finally{await U.promises.unlink($).catch(()=>{})}}async function o(J,K){let Z=await Y();if(K==="blur"&&Z){let X=(await Z(J).resize(20).blur(10).toBuffer()).toString("base64"),Q=await O(J);return`data:${P[Q.format]||"image/jpeg"};base64,${X}`}if(K==="dominant-color"&&Z){let{dominant:C}=await Z(J).resize(1,1).toBuffer().then(async(X)=>{let Q=await Z(X).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${C.r}, ${C.g}, ${C.b})`}let $=await O(J),q=G.join(I.tmpdir(),`stx-ph-${H.randomBytes(8).toString("hex")}.${$.format==="unknown"?"bin":$.format}`);try{await Bun.write(q,J);let C=K==="blur"?"blur":K==="thumbhash"?"thumbhash":"dominant-color",Q=await m(q,{strategy:C,width:C==="thumbhash"?void 0:32});if(K==="dominant-color"&&Q.dominantColor)return Q.dominantColor;if(Q.dataURL)return Q.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await U.promises.unlink(q).catch(()=>{})}}function KJ(J,K){return(K?J.filter(($)=>$.format===K):J).sort(($,q)=>$.width-q.width).map(($)=>`${$.url} ${$.width}w`).join(", ")}function ZJ(J){if(!J||Object.keys(J).length===0)return"100vw";return Object.entries(J).sort((Z,$)=>{let q=Number.parseInt(Z[0].replace(/\D/g,""))||0;return(Number.parseInt($[0].replace(/\D/g,""))||0)-q}).map(([Z,$])=>`(max-width: ${Z}) ${$}`).join(", ")+", 100vw"}function $J(J){let K=J.filter(($)=>$.format==="jpeg");if(K.length===0)return J[Math.floor(J.length/2)];let Z=K.sort(($,q)=>$.width-q.width);return Z[Math.floor(Z.length/2)]}function qJ(J){let K=new Map;for(let Z of J){let $=K.get(Z.format)||[];$.push(Z),K.set(Z.format,$)}return K}function CJ(J){let K=G.extname(J).toLowerCase();return u.includes(K)}function QJ(J){return P[J]||"application/octet-stream"}function VJ(J){return J.reduce((K,Z)=>K+Z.size,0)}function XJ(J){if(J<1024)return`${J} B`;if(J<1048576)return`${(J/1024).toFixed(1)} KB`;return`${(J/1048576).toFixed(2)} MB`}class L extends Error{code;constructor(J,K){super(J);this.name="ImageProcessingError",this.code=K}}
3
- export{d as Af,h as Bf,b as Cf,e as Df,t as Ef,JJ as Ff,O as Gf,n as Hf,KJ as If,ZJ as Jf,$J as Kf,qJ as Lf,CJ as Mf,QJ as Nf,VJ as Of,XJ as Pf,L as Qf};
2
+ import{Rw as l}from"./chunk-emjmshj8.js";import U from"fs";import G from"path";import I from"os";import H from"crypto";import{generatePlaceholder as m,processImage as g}from"ts-images";var d=[320,640,768,1024,1280,1536,1920],h=["webp","jpeg"],b=80,u=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],P={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},N=null,W=!1;async function Y(){if(W)return N;W=!0;try{let J=await import("sharp");return N=J.default||J,N}catch{return null}}async function e(){return await Y()!==null}async function t(){return!0}async function JJ(J,K={}){let{widths:Z=d,formats:$=h,quality:q=b,fit:C="cover",placeholder:X="none",outputDir:Q=".stx/images",baseUrl:_="/images"}=K,j,x;if(typeof J==="string"){if(x=J,!await Bun.file(J).exists())throw new L(`Image not found: ${J}`,"NOT_FOUND");j=await Bun.file(J).arrayBuffer().then((V)=>Buffer.from(V))}else x="buffer-input",j=J;let w=H.createHash("sha256").update(j).digest("hex").slice(0,12),y=await O(j),{width:B,height:D}=y,A=B/D;await U.promises.mkdir(Q,{recursive:!0});let T=[],v=G.basename(x,G.extname(x)),z=Z.filter((V)=>V<=B);if(!z.includes(B)&&B<=Math.max(...Z))z.push(B);z.sort((V,R)=>V-R);for(let V of z){let R=Math.round(V/A);for(let F of $){let S=`${v}-${V}w-${w}.${F}`,k=G.join(Q,S),c=`${_}/${S}`,E=await n(j,{width:V,height:R,format:F,quality:q,fit:C});await Bun.write(k,E),T.push({path:k,url:c,width:V,height:R,format:F,size:E.length})}}let M;if(X!=="none")M=await o(j,X);return{src:x,variants:T,placeholder:M,width:B,height:D,aspectRatio:A,hash:w}}async function O(J){let K=typeof J==="string"?Buffer.from(await Bun.file(J).arrayBuffer()):J,Z=await Y();if(Z){let q=await Z(K).metadata();return{width:q.width||0,height:q.height||0,format:q.format||"unknown",hasAlpha:q.hasAlpha}}return p(K)}function p(J){if(J[0]===137&&J[1]===80&&J[2]===78&&J[3]===71){let K=J.readUInt32BE(16),Z=J.readUInt32BE(20);return{width:K,height:Z,format:"png",hasAlpha:!0}}if(J[0]===255&&J[1]===216){let K=2;while(K<J.length){if(J[K]!==255)break;let Z=J[K+1];if(Z>=192&&Z<=207&&Z!==196&&Z!==200&&Z!==204){let q=J.readUInt16BE(K+5);return{width:J.readUInt16BE(K+7),height:q,format:"jpeg",hasAlpha:!1}}let $=J.readUInt16BE(K+2);K+=2+$}}if(J.toString("utf8",0,4)==="RIFF"&&J.toString("utf8",8,12)==="WEBP"){let K=J.toString("utf8",12,16);if(K==="VP8 "){let Z=J.readUInt16LE(26)&16383,$=J.readUInt16LE(28)&16383;return{width:Z,height:$,format:"webp",hasAlpha:!1}}if(K==="VP8L"){let Z=J.readUInt32LE(21),$=(Z&16383)+1,q=(Z>>14&16383)+1;return{width:$,height:q,format:"webp",hasAlpha:!0}}}if(J.toString("utf8",0,3)==="GIF"){let K=J.readUInt16LE(6),Z=J.readUInt16LE(8);return{width:K,height:Z,format:"gif",hasAlpha:!0}}throw new L("Unable to parse image dimensions","PARSE_ERROR")}async function n(J,K){let Z=await Y();if(Z){let q=Z(J).resize(K.width,K.height,{fit:K.fit});switch(K.format){case"webp":q=q.webp({quality:K.quality});break;case"avif":q=q.avif({quality:K.quality});break;case"jpeg":q=q.jpeg({quality:K.quality});break;case"png":q=q.png({quality:K.quality});break}return q.toBuffer()}let $=G.join(I.tmpdir(),`stx-img-${H.randomBytes(8).toString("hex")}.${K.format}`);try{return await g({input:J,output:$,format:K.format,quality:K.quality,resize:{width:K.width,height:K.height,fit:K.fit}}),Buffer.from(await Bun.file($).arrayBuffer())}finally{await U.promises.unlink($).catch(()=>{})}}async function o(J,K){let Z=await Y();if(K==="blur"&&Z){let X=(await Z(J).resize(20).blur(10).toBuffer()).toString("base64"),Q=await O(J);return`data:${P[Q.format]||"image/jpeg"};base64,${X}`}if(K==="dominant-color"&&Z){let{dominant:C}=await Z(J).resize(1,1).toBuffer().then(async(X)=>{let Q=await Z(X).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${C.r}, ${C.g}, ${C.b})`}let $=await O(J),q=G.join(I.tmpdir(),`stx-ph-${H.randomBytes(8).toString("hex")}.${$.format==="unknown"?"bin":$.format}`);try{await Bun.write(q,J);let C=K==="blur"?"blur":K==="thumbhash"?"thumbhash":"dominant-color",Q=await m(q,{strategy:C,width:C==="thumbhash"?void 0:32});if(K==="dominant-color"&&Q.dominantColor)return Q.dominantColor;if(Q.dataURL)return Q.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await U.promises.unlink(q).catch(()=>{})}}function KJ(J,K){return(K?J.filter(($)=>$.format===K):J).sort(($,q)=>$.width-q.width).map(($)=>`${$.url} ${$.width}w`).join(", ")}function ZJ(J){if(!J||Object.keys(J).length===0)return"100vw";return Object.entries(J).sort((Z,$)=>{let q=Number.parseInt(Z[0].replace(/\D/g,""))||0;return(Number.parseInt($[0].replace(/\D/g,""))||0)-q}).map(([Z,$])=>`(max-width: ${Z}) ${$}`).join(", ")+", 100vw"}function $J(J){let K=J.filter(($)=>$.format==="jpeg");if(K.length===0)return J[Math.floor(J.length/2)];let Z=K.sort(($,q)=>$.width-q.width);return Z[Math.floor(Z.length/2)]}function qJ(J){let K=new Map;for(let Z of J){let $=K.get(Z.format)||[];$.push(Z),K.set(Z.format,$)}return K}function CJ(J){let K=G.extname(J).toLowerCase();return u.includes(K)}function QJ(J){return P[J]||"application/octet-stream"}function VJ(J){return J.reduce((K,Z)=>K+Z.size,0)}function XJ(J){if(J<1024)return`${J} B`;if(J<1048576)return`${(J/1024).toFixed(1)} KB`;return`${(J/1048576).toFixed(2)} MB`}class L extends Error{code;constructor(J,K){super(J);this.name="ImageProcessingError",this.code=K}}
3
+ export{d as Bf,h as Cf,b as Df,e as Ef,t as Ff,JJ as Gf,O as Hf,n as If,KJ as Jf,ZJ as Kf,$J as Lf,qJ as Mf,CJ as Nf,QJ as Of,VJ as Pf,XJ as Qf,L as Rf};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$j as d,Yj as a,Zj as b,_j as c}from"./chunk-x21hdhjw.js";import"./chunk-emjmshj8.js";export{d as default,c as createHotReloadServer,b as compileToNative,a as NATIVE_COMPONENTS};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{At as i,pt as a,tt as b,ut as c,vt as d,wt as e,xt as f,yt as g,zt as h}from"./chunk-xj6bcwqa.js";import"./chunk-ejqpq0wc.js";export{a as webpHeaderHasAlpha,g as snapshotImageDelivery,b as setImageEncoderIdentity,i as prepareImageDelivery,e as isTransparentImage,h as installImageDelivery,c as imageEncoderIdentity,d as getImageDelivery,f as clearImageDeliveryCatalog};
2
+ import{At as e,Bt as f,Ct as g,Dt as h,Et as i,tt as a,xt as b,yt as c,zt as d}from"./chunk-5270fyk7.js";import"./chunk-emjmshj8.js";export{a as webpHeaderHasAlpha,g as snapshotImageDelivery,b as setImageEncoderIdentity,i as prepareImageDelivery,e as isTransparentImage,h as installImageDelivery,c as imageEncoderIdentity,d as getImageDelivery,f as clearImageDeliveryCatalog};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Am as g,Bm as h,Cm as i,Dm as j,Em as k,Fm as l,Gm as m,Hm as n,Im as o,Jm as p,Km as q,Lm as r,um as a,vm as b,wm as c,xm as d,ym as e,zm as f}from"./chunk-3ssjb8cx.js";import"./chunk-ykevda74.js";import"./chunk-ez003q74.js";import"./chunk-kyyt9xhs.js";import"./chunk-tf16jtj4.js";import"./chunk-19m7hed6.js";import"./chunk-kjd9hbg4.js";import"./chunk-ejwfnttb.js";import"./chunk-5270fyk7.js";import"./chunk-q4kgqqed.js";import"./chunk-1nnza3m6.js";import"./chunk-hkrzv980.js";import"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-zxfejz72.js";import"./chunk-mere396d.js";import"./chunk-aa8015mk.js";import"./chunk-trva71am.js";import"./chunk-rtfwn4cm.js";import"./chunk-emjmshj8.js";export{j as usesSignalsInScript,r as unescapeHtml,p as resetRejectedExpressionWarnings,g as replaceInterpolations,c as registerFilters,b as registerFilter,n as processExpressions,m as interpolateScriptsInTemplate,k as interpolateScriptExpressions,l as interpolateScriptAttributes,d as getAllFilters,f as findMustacheEnd,q as evaluateExpression,i as escapeHtmlValue,h as escapeHtml,a as defaultFilters,e as clearCustomFilters,o as applyFilters};
@@ -394,4 +394,4 @@ else {
394
394
  ${JSON.stringify(j)}
395
395
  </script>
396
396
  `}var r={processPartialHydrationDirectives:b,processStaticDirectives:x,generatePartialHydrationCSS:H,generateIslandManifest:y,createIslandRegistry:f,hydrateIsland:S,hydrateByStrategy:h,hydrateAll:g,isHydrated:v,onHydrated:u};
397
- export{B as Ih,I as Jh,E as Kh,V as Lh,f as Mh,b as Nh,H as Oh,S as Ph,h as Qh,g as Rh,v as Sh,u as Th,x as Uh,y as Vh,r as Wh};
397
+ export{B as Jh,I as Kh,E as Lh,V as Mh,f as Nh,b as Oh,H as Ph,S as Qh,h as Rh,g as Sh,v as Th,u as Uh,x as Vh,y as Wh,r as Xh};
@@ -5,4 +5,4 @@ import Q from"fs";import U from"path";function W(H){let v=[],j=H.pwa;if(v.push({
5
5
  `);let J=["required","recommended","optional"];for(let L of J){let N=H.checks.filter((K)=>K.category===L);if(N.length===0)continue;v.push(`
6
6
  ${L.toUpperCase()}:`);for(let K of N){let T=K.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(v.push(` ${T} ${K.name}: ${K.message}`),K.details)v.push(` ${K.details}`)}}return v.push(""),v.join(`
7
7
  `)}
8
- export{W as Fk,X as Gk,Y as Hk,A as Ik,B as Jk};
8
+ export{W as Gk,X as Hk,Y as Ik,A as Jk,B as Kk};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{nt as SJ}from"./chunk-y2f41kaq.js";import{Nw as EJ}from"./chunk-ejqpq0wc.js";import G from"path";import{hasLocalConfig as bJ}from"bunfig";var FJ={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function y(J){return`--stx-${J}`}function f(J,Q){let Z=Q.lastIndexOf("-");if(Z===-1)return typeof J[Q]==="string"?J[Q]:void 0;let $=J[Q.slice(0,Z)];if(!$||typeof $!=="object")return;let U=$[Q.slice(Z+1)];return typeof U==="string"?U:void 0}function jJ(J){let Q={};for(let[Z,$]of Object.entries(FJ)){let U=f(J,$.light);if(U===void 0)continue;Q[Z]=`var(${y(Z)}, ${U})`}return Q}function WJ(J){let Q=[],Z=[];for(let[$,U]of Object.entries(FJ)){let F=f(J,U.light),j=f(J,U.dark);if(F===void 0)continue;if(Q.push(` ${y($)}: ${F};`),j!==void 0)Z.push(` ${y($)}: ${j};`)}if(Q.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...Q,"}",".dark {",...Z,"}",""].join(`
2
+ import{rt as SJ}from"./chunk-ejwfnttb.js";import{Rw as EJ}from"./chunk-emjmshj8.js";import G from"path";import{hasLocalConfig as bJ}from"bunfig";var FJ={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function y(J){return`--stx-${J}`}function f(J,Q){let Z=Q.lastIndexOf("-");if(Z===-1)return typeof J[Q]==="string"?J[Q]:void 0;let $=J[Q.slice(0,Z)];if(!$||typeof $!=="object")return;let U=$[Q.slice(Z+1)];return typeof U==="string"?U:void 0}function jJ(J){let Q={};for(let[Z,$]of Object.entries(FJ)){let U=f(J,$.light);if(U===void 0)continue;Q[Z]=`var(${y(Z)}, ${U})`}return Q}function WJ(J){let Q=[],Z=[];for(let[$,U]of Object.entries(FJ)){let F=f(J,U.light),j=f(J,U.dark);if(F===void 0)continue;if(Q.push(` ${y($)}: ${F};`),j!==void 0)Z.push(` ${y($)}: ${j};`)}if(Q.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...Q,"}",".dark {",...Z,"}",""].join(`
3
3
  `)}var XJ={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function VJ(J){return`--stx-radius-${J}`}function qJ(){let J={};for(let[Q,Z]of Object.entries(XJ))J[Q]=`var(${VJ(Q)}, ${Z.value})`;return J}function zJ(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(XJ).map(([J,Q])=>` ${VJ(J)}: ${Q.value};`),"}",""].join(`
4
4
  `)}function GJ(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}function C(J,Q){let Z={...J};for(let[$,U]of Object.entries(Q))Z[$]=GJ(U)&&GJ(Z[$])?C(Z[$],U):U;return Z}function YJ(J={},Q={}){let Z=J.theme||{},$=Q.theme||{},{extend:U,...F}=$,{extend:j,...V}=Z,W=V.colors||{};V.colors={...W,...jJ(W)};let X=V.borderRadius||{};V.borderRadius={...X,...qJ()};let q=C(V,F),z=C(j||{},U||{});if(Object.keys(z).length>0)q.extend=z;let w=[...J.safelist||[],...Q.safelist||[]],O={...J.shortcuts||{},...Q.shortcuts||{}},K=[...J.preflights||[],...Q.preflights||[]];return{config:{...J,...Q,theme:q,safelist:w,shortcuts:O,...K.length>0?{preflights:K}:{},content:[],output:""},safelist:w,shortcuts:O,includePreflight:Q.preflight!==!1,minify:Q.minify===!0,tokenCSS:WJ(W)+zJ()}}var v=/<script\b[^>]*>/iy,p=/<\/script\s*>/ig,R=/<style\b[^>]*>/iy,m=/<\/style\s*>/ig;function wJ(J,Q,Z,$){Z.lastIndex=Q;let U=Z.exec(J);if(!U||U.index!==Q)return-1;$.lastIndex=Z.lastIndex;let F=$.exec(J);if(!F)return-1;return F.index+F[0].length}function h(J,Q){return wJ(J,Q,v,p)}function LJ(J,Q){return wJ(J,Q,R,m)}function pJ(J,Q){if(!J.startsWith("<!--",Q))return-1;let Z=J.indexOf("-->",Q+4);if(Z===-1)return-1;return Z+3}function BJ(J,Q){if(J.startsWith("<!--",Q)){let U=pJ(J,Q);return U===-1?J.length:U}if(v.lastIndex=Q,v.exec(J)?.index===Q){p.lastIndex=v.lastIndex;let U=p.exec(J);return U?U.index+U[0].length:J.length}if(R.lastIndex=Q,R.exec(J)?.index===Q){m.lastIndex=R.lastIndex;let U=m.exec(J);return U?U.index+U[0].length:J.length}return-1}function mJ(J,Q){let Z=[],$=0,U=J.length,F=!1,j=null;while($<U){let V=J[$];if(F){if(j){if(V===j)j=null}else if(V==='"'||V==="'")j=V;else if(V===">")F=!1;$++;continue}if(V!=="<"){let z=J.indexOf("<",$+1);if(z===-1)break;$=z;continue}let W=Q(J,$);if(W>$){Z.push({start:$,end:W,token:J.slice($,W)}),$=W;continue}let X=BJ(J,$);if(X>$){$=X;continue}let q=J.charCodeAt($+1);if(q>=65&&q<=90||q>=97&&q<=122)F=!0;$++}return Z}function NQ(J){let Q=0,Z=0,$=0,U=!1,F=null;while($<J.length){if(U){let z=J[$];if(F){if(z===F)F=null}else if(z==='"'||z==="'")F=z;else if(z===">")U=!1;$++;continue}let j=J.indexOf("<",$),V=j===-1?J.length:j;while($<V){let z=J[$++];if(z==="{")Q++;else if(z==="}")Z++;if(Q>=2&&Z>=2)return!0}if(j===-1)break;let W=BJ(J,j);if(W>j){$=W;continue}let X=J.charCodeAt(j+1),q=X===47?J.charCodeAt(j+2):X;if(q>=65&&q<=90||q>=97&&q<=122)U=!0;$=j+1}return!1}function HJ(J,Q){while(J.size>=Q){let Z=J.keys().next();if(Z.done)return;J.delete(Z.value)}}var hJ=65536,iJ=12,g=new Map;function i(J,Q,Z,$){let U=$!==void 0&&J.length>=hJ,F=U?`${$}\x00${J}`:"";if(U){let q=g.get(F);if(q)return{output:q.output,tokens:q.tokens.slice()}}let j=mJ(J,Q);if(j.length===0)return{output:J,tokens:[]};let V=j.map((q)=>q.token),W="",X=0;for(let q=0;q<j.length;q++){let z=j[q];W+=J.slice(X,z.start),W+=Z(z.token,q),X=z.end}if(W+=J.slice(X),U)return HJ(g,iJ),g.set(F,{output:W,tokens:V}),{output:W,tokens:V.slice()};return{output:W,tokens:V}}var nJ=65536,cJ=4,u=new Map;function d(J,Q,Z){return{output:Q,scripts:Z,restore:($)=>$===Q?J:rJ($,Z)}}function MQ(J){let Q=J.length>=nJ;if(Q){let U=u.get(J);if(U)return d(J,U.output,U.scripts.slice())}let{output:Z,tokens:$}=i(J,h,(U,F)=>`\x00STX_SCRIPT_${F}\x00`);if(Q)return HJ(u,cJ),u.set(J,{output:Z,scripts:$}),d(J,Z,$.slice());return d(J,Z,$)}function rJ(J,Q){if(Q.length===0)return J;return J.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,$)=>Q[+$]??"")}function OJ(J,Q=""){let Z=`${J}${Q}`,$=0;for(let U=0;U<Z.length;U++){let F=Z.charCodeAt(U);$=($<<5)-$+F,$=$&$}return`stx-${Math.abs($).toString(36)}`}function KJ(J,Q,Z={}){let{prefix:$="",preserveHost:U=!0,scopeKeyframes:F=!0,scopeCustomProperties:j=!1}=Z;if(!J.trim())return"";let V=n(J),W=[],X=new Map;if(F)for(let q of V){let z=q.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let w=z[1],O=`${Q}_${w}`;X.set(w,O)}}for(let q of V){let z=IJ(q,Q,$,U,X,j);W.push(z)}return W.join(`
5
5
 
@@ -18,7 +18,7 @@ catch (e) {
18
18
  }
19
19
  throw e;
20
20
  }
21
- `),U.set(X,q)}return q(...V)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:j,context:Q.slice()});return j}clear(){this.pool.length=0,this.fnCache.clear()}}var xQ=new AJ;class _J{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 j={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(j);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(j)}catch{}let V=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(V);break;case"warn":console.warn(V);break;case"error":console.error(V);break;case"throw":if(F)throw Error(V);else console.warn(V);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 a=null;function ZQ(){if(!a)a=new _J;return a}var EQ=new Proxy({},{get(J,Q){return ZQ()[Q]}});var RJ=[];function TJ(J){let Q=new s(J);return RJ.push(Q),Q}function CQ(){for(let J of RJ)J.clear()}function t(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function gQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:vJ.statSync(Z).mtimeMs})}catch{}return Q}function uQ(J){for(let Q of J)try{if(vJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var B=null,JJ=!1,D=null,_="",M=!1,yJ=256,I=new Map,H=new Map,T=null,fJ=null,b=new Map;function k(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function e(J,Q){if(I.has(J))I.delete(J);else if(I.size>=yJ)I.delete(I.keys().next().value);I.set(J,Q)}function UQ(J){let Q=k(J);if(H.has(Q))H.delete(Q);else if(H.size>=yJ)H.delete(H.keys().next().value);return H.set(Q,J),Q}function lQ(J){let Q=H.get(J);if(Q===void 0)return;return H.delete(J),H.set(J,Q),Q}async function FQ(J,Q=T){if(!Q)return null;try{let Z=Bun.file(G.join(Q,`cw-${k(J)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function jQ(J,Q,Z=T){if(!Z)return;try{if(!fs.existsSync(Z))fs.mkdirSync(Z,{recursive:!0});await Bun.write(G.join(Z,`cw-${k(J)}.css`),Q)}catch{}}async function kJ(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 WQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],XQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function VQ(){let J=[],Q=process.cwd();while(Q!==G.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of WQ)J.push(G.join(Q,Z,...$));Q=G.dirname(Q)}return J}function qQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&G.join(Q,"Code","Tools","ts-css"),Q&&G.join(Q,"Code","Tools","crosswind"),Q&&G.join(Q,"repos","stacks-org","ts-css"),Q&&G.join(Q,"repos","stacks-org","crosswind"),G.join(process.cwd(),"..","ts-css"),G.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(G.join($,"packages","toolkit","dist","engine","index.js")),J.push(G.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(G.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function CJ(){if(JJ)return B;JJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let j=await kJ(F);if(j){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${G.dirname(G.dirname(F))}`);return j}}return null};if(process.env.CROSSWIND_SRC){let U=G.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return B=F,B}let Q=await J(VQ());if(Q)return B=Q,B;let Z=XQ;for(let U of Z){let F=await kJ(U);if(F){if(B=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return B}}let $=await J(qQ());if($)return B=$,B;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 oQ(){QJ.clear(),B=null,JJ=!1,D=null,_="",I.clear(),H.clear(),fJ=null,b.clear()}var xJ=!1;async function gJ(J){try{let Q=bJ({name:"css",cwd:J})?"css":bJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!xJ)xJ=!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=G.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 zQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-32x78na8.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=G.isAbsolute($.css)?$.css:G.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=G.isAbsolute($.css.config)?$.css.config:G.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 gJ(J)}function GQ(J){try{let Q=new WeakSet;return k(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 YQ(J){if(M)return _;M=!0;try{let Q=await CJ();if(!Q||!Q.build)return M=!1,"";if(!D)D=await gJ(J);if(!D)return M=!1,"";let Z=Q.defaultConfig?.theme||{},$=D.theme||{},U={...Q.defaultConfig,...D,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),j=await Q.build(U),V=performance.now()-F;if(_=j.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${j.classes.size} classes in ${V.toFixed(1)}ms`),U.output){let W=G.isAbsolute(U.output)?U.output:G.join(J,U.output),X=G.dirname(W);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(W,j.css)}return M=!1,j.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),M=!1,_}}async function aQ(J){D=null,await YQ(J)}function sQ(){return _}function wQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let j of $[1].split(/\s+/))if(j.trim())Q.add(j.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let j=F[1].match(/'([^']+)'/g);if(j){for(let V of j)for(let W of V.slice(1,-1).split(/\s+/))if(W.trim())Q.add(W.trim())}F=U.exec(J)}return Q}var QJ=TJ(64);async function LQ(J,Q){let Z=()=>b.get(Q?G.resolve(Q):process.cwd())?.fingerprint??null,$=QJ.get(t(J,Q,Z()));if($!==void 0)return $;let U=await BQ(J,Q);if(U)QJ.set(t(J,Q,Z()),U);return U}async function BQ(J,Q){try{let Z=await CJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):wQ(J);if($.size===0)return"";let U=Q?G.resolve(Q):process.cwd(),F=SJ(U,"cache");if(!T)T=F;let j=b.get(U);if(!j){let L=await zQ(U);j={config:L,fingerprint:GQ(L)},b.set(U,j),fJ=j.fingerprint}let V=[...$].sort().join(" "),W=`${j.fingerprint||"default"}::${V}`,X=I.get(W);if(X!==void 0)return e(W,X),X;let q=await FQ(W,F);if(q!==null)return e(W,q),q;let z=Z.defaultConfig||Z.config,w=j.config||{},O=YJ(z,w),{safelist:K,includePreflight:$J,minify:ZJ,tokenCSS:uJ}=O,x=O.config,E=new Z.CSSGenerator(x),S=x.shortcuts||w.shortcuts||{},UJ=Object.keys(S).filter((L)=>$.has(L)||K.includes(L));for(let L of K)if(!S[L])E.generate(L);for(let L of $)if(!S[L])E.generate(L);let P="";if(UJ.length>0){let L=new Z.CSSGenerator(x);for(let dJ of UJ)L.generate(dJ);if(P=L.toCSS(!1,ZJ),P&&!P.endsWith(`
21
+ `),U.set(X,q)}return q(...V)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:j,context:Q.slice()});return j}clear(){this.pool.length=0,this.fnCache.clear()}}var xQ=new AJ;class _J{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 j={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(j);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(j)}catch{}let V=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(V);break;case"warn":console.warn(V);break;case"error":console.error(V);break;case"throw":if(F)throw Error(V);else console.warn(V);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 a=null;function ZQ(){if(!a)a=new _J;return a}var EQ=new Proxy({},{get(J,Q){return ZQ()[Q]}});var RJ=[];function TJ(J){let Q=new s(J);return RJ.push(Q),Q}function CQ(){for(let J of RJ)J.clear()}function t(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function gQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:vJ.statSync(Z).mtimeMs})}catch{}return Q}function uQ(J){for(let Q of J)try{if(vJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var B=null,JJ=!1,D=null,_="",M=!1,yJ=256,I=new Map,H=new Map,T=null,fJ=null,b=new Map;function k(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function e(J,Q){if(I.has(J))I.delete(J);else if(I.size>=yJ)I.delete(I.keys().next().value);I.set(J,Q)}function UQ(J){let Q=k(J);if(H.has(Q))H.delete(Q);else if(H.size>=yJ)H.delete(H.keys().next().value);return H.set(Q,J),Q}function lQ(J){let Q=H.get(J);if(Q===void 0)return;return H.delete(J),H.set(J,Q),Q}async function FQ(J,Q=T){if(!Q)return null;try{let Z=Bun.file(G.join(Q,`cw-${k(J)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function jQ(J,Q,Z=T){if(!Z)return;try{if(!fs.existsSync(Z))fs.mkdirSync(Z,{recursive:!0});await Bun.write(G.join(Z,`cw-${k(J)}.css`),Q)}catch{}}async function kJ(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 WQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],XQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function VQ(){let J=[],Q=process.cwd();while(Q!==G.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of WQ)J.push(G.join(Q,Z,...$));Q=G.dirname(Q)}return J}function qQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&G.join(Q,"Code","Tools","ts-css"),Q&&G.join(Q,"Code","Tools","crosswind"),Q&&G.join(Q,"repos","stacks-org","ts-css"),Q&&G.join(Q,"repos","stacks-org","crosswind"),G.join(process.cwd(),"..","ts-css"),G.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(G.join($,"packages","toolkit","dist","engine","index.js")),J.push(G.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(G.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function CJ(){if(JJ)return B;JJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let j=await kJ(F);if(j){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${G.dirname(G.dirname(F))}`);return j}}return null};if(process.env.CROSSWIND_SRC){let U=G.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return B=F,B}let Q=await J(VQ());if(Q)return B=Q,B;let Z=XQ;for(let U of Z){let F=await kJ(U);if(F){if(B=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return B}}let $=await J(qQ());if($)return B=$,B;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 oQ(){QJ.clear(),B=null,JJ=!1,D=null,_="",I.clear(),H.clear(),fJ=null,b.clear()}var xJ=!1;async function gJ(J){try{let Q=bJ({name:"css",cwd:J})?"css":bJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!xJ)xJ=!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=G.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 zQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-c4rpdtvw.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=G.isAbsolute($.css)?$.css:G.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=G.isAbsolute($.css.config)?$.css.config:G.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 gJ(J)}function GQ(J){try{let Q=new WeakSet;return k(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 YQ(J){if(M)return _;M=!0;try{let Q=await CJ();if(!Q||!Q.build)return M=!1,"";if(!D)D=await gJ(J);if(!D)return M=!1,"";let Z=Q.defaultConfig?.theme||{},$=D.theme||{},U={...Q.defaultConfig,...D,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),j=await Q.build(U),V=performance.now()-F;if(_=j.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${j.classes.size} classes in ${V.toFixed(1)}ms`),U.output){let W=G.isAbsolute(U.output)?U.output:G.join(J,U.output),X=G.dirname(W);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(W,j.css)}return M=!1,j.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),M=!1,_}}async function aQ(J){D=null,await YQ(J)}function sQ(){return _}function wQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let j of $[1].split(/\s+/))if(j.trim())Q.add(j.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let j=F[1].match(/'([^']+)'/g);if(j){for(let V of j)for(let W of V.slice(1,-1).split(/\s+/))if(W.trim())Q.add(W.trim())}F=U.exec(J)}return Q}var QJ=TJ(64);async function LQ(J,Q){let Z=()=>b.get(Q?G.resolve(Q):process.cwd())?.fingerprint??null,$=QJ.get(t(J,Q,Z()));if($!==void 0)return $;let U=await BQ(J,Q);if(U)QJ.set(t(J,Q,Z()),U);return U}async function BQ(J,Q){try{let Z=await CJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):wQ(J);if($.size===0)return"";let U=Q?G.resolve(Q):process.cwd(),F=SJ(U,"cache");if(!T)T=F;let j=b.get(U);if(!j){let L=await zQ(U);j={config:L,fingerprint:GQ(L)},b.set(U,j),fJ=j.fingerprint}let V=[...$].sort().join(" "),W=`${j.fingerprint||"default"}::${V}`,X=I.get(W);if(X!==void 0)return e(W,X),X;let q=await FQ(W,F);if(q!==null)return e(W,q),q;let z=Z.defaultConfig||Z.config,w=j.config||{},O=YJ(z,w),{safelist:K,includePreflight:$J,minify:ZJ,tokenCSS:uJ}=O,x=O.config,E=new Z.CSSGenerator(x),S=x.shortcuts||w.shortcuts||{},UJ=Object.keys(S).filter((L)=>$.has(L)||K.includes(L));for(let L of K)if(!S[L])E.generate(L);for(let L of $)if(!S[L])E.generate(L);let P="";if(UJ.length>0){let L=new Z.CSSGenerator(x);for(let dJ of UJ)L.generate(dJ);if(P=L.toCSS(!1,ZJ),P&&!P.endsWith(`
22
22
  `))P+=`
23
23
  `}let A=P+E.toCSS($J,ZJ);return A=uJ+A,e(W,A),jQ(W,A,F),A}catch(Z){return console.warn("Failed to generate Css CSS:",Z),""}}async function tQ(J,Q,Z=!1,$=!1){let U=await LQ(J,Q);if(!U)return $?o(J):J;let F=Z?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${UQ(U)}.css">`:`<style data-css="generated">
24
24
  ${U}
@@ -29,4 +29,4 @@ ${F}`);return F+J}function HQ(J,Q){let Z=l(J).map((W)=>({...W,replacement:""})),
29
29
  ${Q}`});else Z.push({start:0,end:0,replacement:Q})}}Z.sort((W,X)=>W.start-X.start||W.end-X.end);for(let W=1;W<Z.length;W++)if(Z[W].start<Z[W-1].end)return OQ(o(J),Q);let F=Array(Z.length*2+1),j=0,V=0;for(let W of Z)F[V++]=J.slice(j,W.start),F[V++]=W.replacement,j=W.end;return F[V]=J.slice(j),F.join("")}function OQ(J,Q){let Z=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(Z.test(J)){let $=!1;return J.replace(Z,()=>{if($)return"";return $=!0,Q})}if(J.includes("</head>"))return J.replace("</head>",`${Q}
30
30
  </head>`);if(J.includes("<body"))return J.replace(/<body([^>]*)>/,`<body$1>
31
31
  ${Q}`);return Q+J}
32
- export{s as Cs,kQ as Ds,EQ as Es,TJ as Fs,CQ as Gs,t as Hs,gQ as Is,uQ as Js,h as Ks,LJ as Ls,pJ as Ms,mJ as Ns,NQ as Os,HJ as Ps,i as Qs,MQ as Rs,rJ as Ss,C as Ts,YJ as Us,l as Vs,o as Ws,RQ as Xs,Y as Ys,lQ as Zs,CJ as _s,oQ as $s,gJ as at,zQ as bt,GQ as ct,YQ as dt,aQ as et,sQ as ft,wQ as gt,LQ as ht,tQ as it};
32
+ export{s as Gs,kQ as Hs,EQ as Is,TJ as Js,CQ as Ks,t as Ls,gQ as Ms,uQ as Ns,h as Os,LJ as Ps,pJ as Qs,mJ as Rs,NQ as Ss,HJ as Ts,i as Us,MQ as Vs,rJ as Ws,C as Xs,YJ as Ys,l as Zs,o as _s,RQ as $s,Y as at,lQ as bt,CJ as ct,oQ as dt,gJ as et,zQ as ft,GQ as gt,YQ as ht,aQ as it,sQ as jt,wQ as kt,LQ as lt,tQ as mt};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Aj as M,Ej as P,Fj as T,Gj as x,Hj as C,vj as B,wj as F,xj as H,yj as O,zj as I}from"./chunk-e4g8wz6t.js";import{Jv as L,Lv as R,Nv as S}from"./chunk-72x62kch.js";var w=null;function j(){return w}function g(z,W){if(w)w.provides.set(z,W);else V.set(z,W)}function v(z,W){let Q=w;while(Q){if(Q.provides.has(z))return Q.provides.get(z);Q=Q.parent}if(V.has(z))return V.get(z);return W}var V=new Map;function m(z,W){V.set(z,W)}function U(z){let W=w,Q=W?.el,Z=Array.isArray(z)?z:z&&typeof z==="object"?Object.keys(z):[];if(Q&&Z.length>0){let $=Q.__stx_component_emits||=Object.create(null);for(let Y of Z)$[Y]=!0}let _=($,...Y)=>{if(typeof document>"u")return;if(Q){let A=Q.__stx_component_emits||=Object.create(null);A[$]=!0,Q.dispatchEvent(new CustomEvent($,{detail:Y.length===1?Y[0]:Y,bubbles:!0,cancelable:!0}))}};if(W)W.emit=_;return _}function y(z){if(w)w.exposed=z}function h(z){let W=Promise.resolve();return z?W.then(z):W}function p(z){if(w)w.errorCapturedHooks.push(z)}function u(z,W,Q){let Z=W?.parent;while(Z){for(let _ of Z.errorCapturedHooks)if(_(z,W,Q)===!1)return;Z=Z.parent}}function l(){return w?.slots??{}}function d(){return w?.slots??{}}function i(){return w?.attrs??{}}function c(z){let W=z.__provides?new Map(Object.entries(z.__provides)):new Map;return{...z,__provides:W,__provide(Q,Z){W.set(Q,Z)},__inject(Q,Z){if(W.has(Q))return W.get(Q);if(z.__provides){let _=z.__provides instanceof Map?z.__provides:new Map(Object.entries(z.__provides));if(_.has(Q))return _.get(Q)}return Z}}}function o(){return`
2
+ import{Aj as I,Bj as M,Fj as P,Gj as T,Hj as x,Ij as C,wj as B,xj as F,yj as H,zj as O}from"./chunk-0t1yyn1d.js";import{Nv as L,Pv as R,Rv as S}from"./chunk-aa8015mk.js";var w=null;function j(){return w}function g(z,W){if(w)w.provides.set(z,W);else V.set(z,W)}function v(z,W){let Q=w;while(Q){if(Q.provides.has(z))return Q.provides.get(z);Q=Q.parent}if(V.has(z))return V.get(z);return W}var V=new Map;function m(z,W){V.set(z,W)}function U(z){let W=w,Q=W?.el,Z=Array.isArray(z)?z:z&&typeof z==="object"?Object.keys(z):[];if(Q&&Z.length>0){let $=Q.__stx_component_emits||=Object.create(null);for(let Y of Z)$[Y]=!0}let _=($,...Y)=>{if(typeof document>"u")return;if(Q){let A=Q.__stx_component_emits||=Object.create(null);A[$]=!0,Q.dispatchEvent(new CustomEvent($,{detail:Y.length===1?Y[0]:Y,bubbles:!0,cancelable:!0}))}};if(W)W.emit=_;return _}function y(z){if(w)w.exposed=z}function h(z){let W=Promise.resolve();return z?W.then(z):W}function p(z){if(w)w.errorCapturedHooks.push(z)}function u(z,W,Q){let Z=W?.parent;while(Z){for(let _ of Z.errorCapturedHooks)if(_(z,W,Q)===!1)return;Z=Z.parent}}function l(){return w?.slots??{}}function d(){return w?.slots??{}}function i(){return w?.attrs??{}}function c(z){let W=z.__provides?new Map(Object.entries(z.__provides)):new Map;return{...z,__provides:W,__provide(Q,Z){W.set(Q,Z)},__inject(Q,Z){if(W.has(Q))return W.get(Q);if(z.__provides){let _=z.__provides instanceof Map?z.__provides:new Map(Object.entries(z.__provides));if(_.has(Q))return _.get(Q)}return Z}}}function o(){return`
3
3
  // STX Composition API Runtime
4
4
  (function() {
5
5
  const _provides = new Map();
@@ -8869,4 +8869,4 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
8869
8869
  }
8870
8870
  })();
8871
8871
  `}var _z={state:B,derived:F,effect:H,batch:O,onMount:I,onDestroy:M,isSignal:P,isDerived:T,untrack:x,peek:C,generateSignalsRuntime:f,generateSignalsRuntimeDev:b};
8872
- export{g as _i,v as $i,m as aj,U as bj,y as cj,h as dj,p as ej,u as fj,l as gj,d as hj,i as ij,c as jj,o as kj,r as lj,D as mj,f as nj,b as oj,_z as pj};
8872
+ export{g as $i,v as aj,m as bj,U as cj,y as dj,h as ej,p as fj,u as gj,l as hj,d as ij,i as jj,c as kj,o as lj,r as mj,D as nj,f as oj,b as pj,_z as qj};