@stacksjs/stx 0.2.402 → 0.2.404

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 (183) hide show
  1. package/dist/app-shell.d.ts +12 -0
  2. package/dist/app-shell.js +13 -1
  3. package/dist/{chunk-4bb28mz5.js → chunk-015p3jq5.js} +1 -1
  4. package/dist/{chunk-saf4xhac.js → chunk-0n054h7w.js} +1 -1
  5. package/dist/{chunk-nn42gs3q.js → chunk-0nhpymyy.js} +1 -1
  6. package/dist/{chunk-msecn1gm.js → chunk-0seyntda.js} +1 -1
  7. package/dist/{chunk-ptad3t7a.js → chunk-0svp7s94.js} +190 -116
  8. package/dist/{chunk-h7qv6sc5.js → chunk-0tnsyynz.js} +1 -1
  9. package/dist/{chunk-g64qyhhb.js → chunk-1n2ng8nx.js} +1 -1
  10. package/dist/{chunk-9rp8f7jz.js → chunk-1phxzej9.js} +2 -2
  11. package/dist/{chunk-5kzcyx1w.js → chunk-1vrk5y92.js} +1 -1
  12. package/dist/{chunk-szcxpbfn.js → chunk-1x6c4ys1.js} +2 -2
  13. package/dist/{chunk-mnk5mdwp.js → chunk-245ft0zp.js} +1 -1
  14. package/dist/{chunk-cf05s8c1.js → chunk-2ched9vj.js} +1 -1
  15. package/dist/{chunk-etah20m0.js → chunk-2q216yrr.js} +3 -3
  16. package/dist/{chunk-kdqcb0r5.js → chunk-2r399td7.js} +1 -1
  17. package/dist/chunk-31pm3z44.js +2 -0
  18. package/dist/{chunk-j665en0c.js → chunk-36rnwhn2.js} +1 -1
  19. package/dist/{chunk-ddh21d04.js → chunk-3sea73fx.js} +1 -1
  20. package/dist/{chunk-gs67nnfb.js → chunk-46zx4pt8.js} +1 -1
  21. package/dist/chunk-4j9n5z1q.js +2 -0
  22. package/dist/{chunk-683tfkz4.js → chunk-4m4n1sfc.js} +1 -1
  23. package/dist/{chunk-v54tq312.js → chunk-4md4tj27.js} +1 -1
  24. package/dist/{chunk-fj6fbqgb.js → chunk-4n6ekt06.js} +1 -1
  25. package/dist/{chunk-za3zzk6p.js → chunk-4qjfwxn2.js} +1 -1
  26. package/dist/{chunk-fpqz7msz.js → chunk-4tsjysng.js} +1 -1
  27. package/dist/{chunk-fwc5p9bn.js → chunk-503wfstj.js} +1 -1
  28. package/dist/{chunk-092qw0ps.js → chunk-55g4qm7m.js} +1 -1
  29. package/dist/{chunk-d6rkgay9.js → chunk-59pakqdv.js} +2 -2
  30. package/dist/chunk-65ddb2cs.js +2 -0
  31. package/dist/chunk-68gspceh.js +2 -0
  32. package/dist/{chunk-mwh3ymwc.js → chunk-6de3hczw.js} +1 -1
  33. package/dist/{chunk-8ghwewek.js → chunk-7ba7x6jt.js} +2 -2
  34. package/dist/{chunk-mjearf0g.js → chunk-7q06md6v.js} +1 -1
  35. package/dist/{chunk-baa5pana.js → chunk-81zw5vw5.js} +1 -1
  36. package/dist/{chunk-x1c4vcds.js → chunk-83tefmh1.js} +1 -1
  37. package/dist/{chunk-h3zqzczc.js → chunk-86evvtw4.js} +1 -1
  38. package/dist/{chunk-21adgg8e.js → chunk-8bg1qmhg.js} +1 -1
  39. package/dist/{chunk-1t5vwavd.js → chunk-8mm86z5w.js} +1 -1
  40. package/dist/{chunk-nt03zdme.js → chunk-8t3h7fsk.js} +1 -1
  41. package/dist/{chunk-b89mqprp.js → chunk-971yqxa2.js} +1 -1
  42. package/dist/{chunk-b5na4j0k.js → chunk-9hxnn16r.js} +2 -2
  43. package/dist/chunk-9vne1mm0.js +2 -0
  44. package/dist/{chunk-4m2e8w2g.js → chunk-a01sf1sc.js} +1 -1
  45. package/dist/{chunk-2n3twnde.js → chunk-aa4ss5pb.js} +1 -1
  46. package/dist/chunk-aa91fsxk.js +2 -0
  47. package/dist/{chunk-cvkty3ha.js → chunk-abs56gdt.js} +1 -1
  48. package/dist/{chunk-ht9rdkf3.js → chunk-afwbqeb2.js} +2 -2
  49. package/dist/{chunk-rk8p4b1z.js → chunk-akzmq0jr.js} +2 -2
  50. package/dist/chunk-arrjqs96.js +2 -0
  51. package/dist/{chunk-j89wctm5.js → chunk-b6ckn02j.js} +2 -2
  52. package/dist/chunk-b891w7hr.js +2 -0
  53. package/dist/{chunk-3tmnemhq.js → chunk-bds4s9d8.js} +1 -1
  54. package/dist/{chunk-pj0jjn5b.js → chunk-bssgvjge.js} +2 -2
  55. package/dist/{chunk-fpxz25xz.js → chunk-c1f1vtjt.js} +1 -1
  56. package/dist/{chunk-2g3ffsc9.js → chunk-ca57sg6v.js} +2 -2
  57. package/dist/{chunk-bdy1fpqq.js → chunk-dj658wyq.js} +1 -1
  58. package/dist/{chunk-2andsajh.js → chunk-dxjtszaa.js} +1 -1
  59. package/dist/chunk-emx4ey5d.js +2 -0
  60. package/dist/chunk-evba73dn.js +2 -0
  61. package/dist/{chunk-y9f9g2kh.js → chunk-ffdxdgep.js} +2 -2
  62. package/dist/chunk-fy5jfqwe.js +2 -0
  63. package/dist/{chunk-452k8psm.js → chunk-g0w8dyat.js} +1 -1
  64. package/dist/{chunk-xe06rkka.js → chunk-ggymyyx4.js} +3 -3
  65. package/dist/chunk-gxyvpwvn.js +2 -0
  66. package/dist/chunk-h4w5sqg0.js +2 -0
  67. package/dist/{chunk-av7a1sct.js → chunk-jpnja3jy.js} +1 -1
  68. package/dist/{chunk-j6p78bma.js → chunk-jqm6tbtb.js} +1 -1
  69. package/dist/{chunk-e5aqq9ms.js → chunk-jw6s8rkk.js} +2 -2
  70. package/dist/{chunk-st9vrfw7.js → chunk-k4x5we49.js} +2 -2
  71. package/dist/chunk-k8g5feyd.js +2 -0
  72. package/dist/chunk-kjkkh5p6.js +2 -0
  73. package/dist/{chunk-n9nb4e1v.js → chunk-kzx28zd5.js} +10 -10
  74. package/dist/chunk-m81pxs52.js +2 -0
  75. package/dist/{chunk-ah8gs0q2.js → chunk-m8bdy2wt.js} +1 -1
  76. package/dist/{chunk-6rzwef28.js → chunk-mywrb5fy.js} +1 -1
  77. package/dist/chunk-n1yz08j4.js +2 -0
  78. package/dist/{chunk-9368t9jm.js → chunk-n4197kjq.js} +1 -1
  79. package/dist/chunk-nsese4as.js +2 -0
  80. package/dist/chunk-nxbr6mr1.js +2 -0
  81. package/dist/chunk-p5cs4xsd.js +2 -0
  82. package/dist/{chunk-7vftjm43.js → chunk-pgeh4g3a.js} +1 -1
  83. package/dist/{chunk-3t953qe0.js → chunk-pqhpcxsd.js} +1 -1
  84. package/dist/{chunk-8aa32p8v.js → chunk-py49bdsq.js} +1 -1
  85. package/dist/{chunk-b1hqgm6j.js → chunk-pyyccs6a.js} +1 -1
  86. package/dist/{chunk-4yc9gx6h.js → chunk-qcpnfw0k.js} +1 -1
  87. package/dist/{chunk-bd0eyzgz.js → chunk-qem2tw9r.js} +1 -1
  88. package/dist/{chunk-ezwtd7s2.js → chunk-qnq99ej3.js} +1 -1
  89. package/dist/chunk-r7g4a7m3.js +2 -0
  90. package/dist/{chunk-vaxepwj5.js → chunk-r909bddf.js} +1 -1
  91. package/dist/chunk-rk40an2d.js +2 -0
  92. package/dist/{chunk-9r2xgf5k.js → chunk-rkzfwgr8.js} +1 -1
  93. package/dist/{chunk-7eea1cse.js → chunk-rqr735w8.js} +1 -1
  94. package/dist/{chunk-qnye902b.js → chunk-rx0cntdm.js} +1 -1
  95. package/dist/{chunk-ndydf37f.js → chunk-s6c3ymq1.js} +3 -3
  96. package/dist/{chunk-xd2bapap.js → chunk-s745a8mb.js} +1 -1
  97. package/dist/{chunk-eg30ksd8.js → chunk-s7jkyw9t.js} +8 -8
  98. package/dist/{chunk-cks5rbzt.js → chunk-seqmzr8k.js} +1 -1
  99. package/dist/chunk-sgdp78fr.js +2 -0
  100. package/dist/chunk-sgmqfphy.js +2 -0
  101. package/dist/{chunk-m3s6kzxv.js → chunk-sptvg80e.js} +1 -1
  102. package/dist/{chunk-8e287qw8.js → chunk-stdkw5st.js} +1 -1
  103. package/dist/chunk-sttpb1p4.js +2 -0
  104. package/dist/{chunk-14rh4kd0.js → chunk-t0p5yhgf.js} +2 -2
  105. package/dist/chunk-t6dhnzwf.js +2 -0
  106. package/dist/{chunk-jct6cs2k.js → chunk-tfy07tmv.js} +1 -1
  107. package/dist/{chunk-kpg48dhw.js → chunk-twg0y6ga.js} +1 -1
  108. package/dist/{chunk-jbtzq3xt.js → chunk-v1ezqvek.js} +2 -2
  109. package/dist/chunk-v3mqx1pw.js +2 -0
  110. package/dist/{chunk-9vwpf0bk.js → chunk-vtjegbgy.js} +1 -1
  111. package/dist/{chunk-mntzk6ga.js → chunk-vtmhh3dp.js} +1 -1
  112. package/dist/{chunk-hw96m872.js → chunk-vyq86x5c.js} +1 -1
  113. package/dist/chunk-w568cjw6.js +2 -0
  114. package/dist/{chunk-2m17v3yx.js → chunk-w6n5c479.js} +1 -1
  115. package/dist/{chunk-2hy87cn4.js → chunk-wa32w7h2.js} +2 -2
  116. package/dist/chunk-wawcmcyg.js +2 -0
  117. package/dist/{chunk-gv6fnbw5.js → chunk-wgxcemm2.js} +2 -2
  118. package/dist/chunk-wj66sab5.js +2 -0
  119. package/dist/{chunk-wheh08v2.js → chunk-wpsx5avz.js} +1 -1
  120. package/dist/chunk-wqgyb4zb.js +2 -0
  121. package/dist/{chunk-tev79q0a.js → chunk-wxkn47vk.js} +1 -1
  122. package/dist/chunk-wz7ca99x.js +2 -0
  123. package/dist/{chunk-cevkpyn9.js → chunk-x7qyx7vn.js} +1 -1
  124. package/dist/{chunk-b5rc4t8t.js → chunk-x8zt0b72.js} +1 -1
  125. package/dist/{chunk-m28xqhyz.js → chunk-xakdgn9h.js} +1 -1
  126. package/dist/chunk-xw23twxw.js +2 -0
  127. package/dist/chunk-y3cz15x3.js +2 -0
  128. package/dist/{chunk-chn6e3en.js → chunk-yaegs66r.js} +2 -2
  129. package/dist/{chunk-bs2a7a2b.js → chunk-ydemsmqm.js} +2 -2
  130. package/dist/chunk-yf0v44v8.js +2 -0
  131. package/dist/{chunk-111tdjzz.js → chunk-yh9apppb.js} +1 -1
  132. package/dist/{chunk-90zfg77v.js → chunk-ypw4egcv.js} +1 -1
  133. package/dist/chunk-z523bq9b.js +2 -0
  134. package/dist/{chunk-qbc0bebg.js → chunk-z8zmp74b.js} +2 -2
  135. package/dist/{chunk-4azk3jdd.js → chunk-z9a0ft6h.js} +1 -1
  136. package/dist/{chunk-db1bf5yj.js → chunk-zfh1b1py.js} +2 -2
  137. package/dist/{chunk-9a79ev5a.js → chunk-zwb8wv5p.js} +1 -1
  138. package/dist/cli.js +14 -14
  139. package/dist/craft-entry.js +1 -1
  140. package/dist/craft.js +1 -1
  141. package/dist/database.js +1 -1
  142. package/dist/offline/app-service-worker.d.ts +28 -2
  143. package/dist/offline/app-service-worker.js +100 -7
  144. package/dist/pwa.js +2 -2
  145. package/dist/ssg.js +2 -2
  146. package/dist/visual-testing.js +1 -1
  147. package/package.json +5 -5
  148. package/dist/chunk-020a4q6e.js +0 -2
  149. package/dist/chunk-0j5wwmha.js +0 -2
  150. package/dist/chunk-1a569y4r.js +0 -2
  151. package/dist/chunk-1chgn7qv.js +0 -2
  152. package/dist/chunk-1hw8p2g4.js +0 -2
  153. package/dist/chunk-42tn0t54.js +0 -2
  154. package/dist/chunk-55d66wh7.js +0 -2
  155. package/dist/chunk-6jns68ee.js +0 -2
  156. package/dist/chunk-702rda41.js +0 -2
  157. package/dist/chunk-7r7qcpw2.js +0 -2
  158. package/dist/chunk-9csrj2k2.js +0 -2
  159. package/dist/chunk-9xs1ekk3.js +0 -2
  160. package/dist/chunk-bgyh22e9.js +0 -2
  161. package/dist/chunk-cqn8qq4v.js +0 -2
  162. package/dist/chunk-crjn0b04.js +0 -2
  163. package/dist/chunk-dnew7qmv.js +0 -2
  164. package/dist/chunk-ek069b44.js +0 -2
  165. package/dist/chunk-f4f5dzfg.js +0 -2
  166. package/dist/chunk-fkht7kzs.js +0 -2
  167. package/dist/chunk-gbwqy9py.js +0 -2
  168. package/dist/chunk-h37e97qq.js +0 -2
  169. package/dist/chunk-jmek11fc.js +0 -2
  170. package/dist/chunk-kvdd2zfn.js +0 -2
  171. package/dist/chunk-mjdsjxm5.js +0 -2
  172. package/dist/chunk-n9cgqpe2.js +0 -2
  173. package/dist/chunk-n9wmhtap.js +0 -2
  174. package/dist/chunk-pp8e3t71.js +0 -2
  175. package/dist/chunk-qmr1we72.js +0 -2
  176. package/dist/chunk-s35w8xjx.js +0 -2
  177. package/dist/chunk-scak53zc.js +0 -2
  178. package/dist/chunk-scn75qrm.js +0 -2
  179. package/dist/chunk-t3pfdz1r.js +0 -2
  180. package/dist/chunk-vwe0fvez.js +0 -2
  181. package/dist/chunk-vxxj6sqn.js +0 -2
  182. package/dist/chunk-wm07h8q1.js +0 -2
  183. package/dist/chunk-xn9t0hnt.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Vw as S,Yw as i}from"./chunk-d6rkgay9.js";import{$w as G,Zw as v,_w as k}from"./chunk-cevkpyn9.js";import A from"fs";import B from"path";function u(j){let q=0;for(let K=0;K<j.length;K++){let Q=j[K];q=(q<<5)-q+Q,q=q&q}return Math.abs(q).toString(16).padStart(8,"0")}function f(j,q){let K=B.basename(j);for(let Q of q)if(Q.startsWith("*.")){let Y=Q.slice(1);if(K.endsWith(Y))return!0}else if(Q.includes("*")){let Y=new RegExp(`^${Q.replace(/\*/g,".*")}$`);if(Y.test(K)||Y.test(j))return!0}else if(K===Q||j.includes(Q))return!0;return!1}function g(j,q,K){let Q=B.extname(j).toLowerCase(),Y=h[Q],X=(K.maxFileSizeKB||500)*1024;if(q>X)return!1;if(K.exclude&&f(j,K.exclude))return!1;if(K.include&&K.include.length>0){for(let Z of K.include)if(Z.startsWith("*.")){if(j.endsWith(Z.slice(1)))return!0}else if(j.includes(Z))return!0}if(Y&&K[Y]===!0)return!0;if(!Y)return!1;return!1}function T(j,q,K,Q){let Y=A.readdirSync(j,{withFileTypes:!0});for(let X of Y){let Z=B.join(j,X.name);if(X.isDirectory()){if(["node_modules",".git",".stx"].includes(X.name))continue;T(Z,q,K,Q)}else if(X.isFile()){let O=A.statSync(Z),_=B.relative(q,Z);if(g(_,O.size,K)){let $=A.readFileSync(Z),L=u($),V=`/${_.replace(/\\/g,"/")}`;Q.push({url:V,revision:L,size:O.size})}}}}function U(j,q){let K=q.pwa?.precache,Q=[];if(!K?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!A.existsSync(j))return{entries:[],totalSize:0,fileCount:0};T(j,j,K,Q),Q.sort((X,Z)=>X.url.localeCompare(Z.url));let Y=Q.reduce((X,Z)=>X+Z.size,0);return{entries:Q,totalSize:Y,fileCount:Q.length}}function J(j){if(j.entries.length===0)return"[]";return`[
2
+ import{Ww as S,Zw as i}from"./chunk-59pakqdv.js";import{$w as k,_w as v,ax as G}from"./chunk-x7qyx7vn.js";import A from"fs";import B from"path";function u(j){let q=0;for(let K=0;K<j.length;K++){let Q=j[K];q=(q<<5)-q+Q,q=q&q}return Math.abs(q).toString(16).padStart(8,"0")}function f(j,q){let K=B.basename(j);for(let Q of q)if(Q.startsWith("*.")){let Y=Q.slice(1);if(K.endsWith(Y))return!0}else if(Q.includes("*")){let Y=new RegExp(`^${Q.replace(/\*/g,".*")}$`);if(Y.test(K)||Y.test(j))return!0}else if(K===Q||j.includes(Q))return!0;return!1}function g(j,q,K){let Q=B.extname(j).toLowerCase(),Y=h[Q],X=(K.maxFileSizeKB||500)*1024;if(q>X)return!1;if(K.exclude&&f(j,K.exclude))return!1;if(K.include&&K.include.length>0){for(let Z of K.include)if(Z.startsWith("*.")){if(j.endsWith(Z.slice(1)))return!0}else if(j.includes(Z))return!0}if(Y&&K[Y]===!0)return!0;if(!Y)return!1;return!1}function T(j,q,K,Q){let Y=A.readdirSync(j,{withFileTypes:!0});for(let X of Y){let Z=B.join(j,X.name);if(X.isDirectory()){if(["node_modules",".git",".stx"].includes(X.name))continue;T(Z,q,K,Q)}else if(X.isFile()){let O=A.statSync(Z),_=B.relative(q,Z);if(g(_,O.size,K)){let $=A.readFileSync(Z),L=u($),V=`/${_.replace(/\\/g,"/")}`;Q.push({url:V,revision:L,size:O.size})}}}}function U(j,q){let K=q.pwa?.precache,Q=[];if(!K?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!A.existsSync(j))return{entries:[],totalSize:0,fileCount:0};T(j,j,K,Q),Q.sort((X,Z)=>X.url.localeCompare(Z.url));let Y=Q.reduce((X,Z)=>X+Z.size,0);return{entries:Q,totalSize:Y,fileCount:Q.length}}function J(j){if(j.entries.length===0)return"[]";return`[
3
3
  ${j.entries.map((K)=>` { url: '${K.url}', revision: '${K.revision}' }`).join(`,
4
4
  `)}
5
5
  ]`}function E(j){if(j<1024)return`${j} B`;if(j<1048576)return`${(j/1024).toFixed(1)} KB`;return`${(j/1048576).toFixed(2)} MB`}var h;var F=G(()=>{h={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function c(j){let q={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return q[j]||q["network-first"]}function R(j){return c(j).className}function M(j){let q=j.pwa;if(!q?.enabled)return"";let K=q.routes||[],Q=q.cacheStorage,Y=[];for(let X of K){let Z=R(X.strategy),O=[];if(X.maxAgeSeconds||X.maxEntries||Q?.maxEntries){let $=X.maxEntries||Q?.maxEntries||100,L=X.maxAgeSeconds||(Q?.maxAge?Q.maxAge*24*60*60:void 0);O.push(`new ExpirationPlugin({
@@ -1196,4 +1196,4 @@ if ('serviceWorker' in navigator) {
1196
1196
  });
1197
1197
  }
1198
1198
  </script>`}function Gj(){return'<link rel="manifest" href="/manifest.json">'}function Jj(j){return`<meta name="theme-color" content="${N(j)}">`}function N(j){return j.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}
1199
- export{U as Ok,J as Pk,E as Qk,F as Rk,y as Sk,z as Tk,C as Uk,Qj as Vk,H as Wk,I as Xk,Aj as Yk,Bj as Zk,Gj as _k,Jj as $k};
1199
+ export{U as Pk,J as Qk,E as Rk,F as Sk,y as Tk,z as Uk,C as Vk,Qj as Wk,H as Xk,I as Yk,Aj as Zk,Bj as _k,Gj as $k,Jj as al};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{zj as _}from"./chunk-mnk5mdwp.js";function Y(q,z){let B={};for(let C of q)B[C]=_(z(C));return new Proxy({},{get:(C,G)=>B[G]?.(),set:(C,G,L)=>{if(B[G])B[G].set(L);else B[G]=_(L);return!0},has:(C,G)=>(G in B),deleteProperty:(C,G)=>{return delete B[G],!0},ownKeys:()=>Reflect.ownKeys(B),getOwnPropertyDescriptor:(C,G)=>(G in B)?{enumerable:!0,configurable:!0,writable:!0,value:B[G]()}:void 0})}function T(q,z){let B={};for(let C of z)B[C]=q[C];return B}function $(q,z){let B=Object.keys(q),C=Y(B,(I)=>z?.[I]??q[I].getDefaultValue()),G=Y(B,()=>[]),L=Y(B,()=>!1),W=Y(B,()=>!1),X=Y(B,()=>!1),J=_(!1);async function M(I){X[I]=!0;let Q=await q[I].validate(C[I],C);return G[I]=Q,X[I]=!1,Q.length===0}async function O(){J.set(!0);let I=await Promise.all(B.map(M));return J.set(!1),I.every(Boolean)}function j(){for(let I of B)C[I]=z?.[I]??q[I].getDefaultValue(),G[I]=[],L[I]=!1,W[I]=!1}function A(I){for(let Q of B)if(Q in I)C[Q]=I[Q],W[Q]=!0}function H(I,Q){C[I]=Q,W[I]=!0}function K(I,Q=!0){if(L[I]=Q,Q)M(I)}function U(I){return{value:C[I],errors:G[I],touched:L[I],dirty:W[I],valid:G[I].length===0,validating:X[I]}}function k(I){return async(Q)=>{Q?.preventDefault?.();for(let N of B)L[N]=!0;if(await O())await I(T(C,B))}}return{values:C,errors:G,touched:L,dirty:W,get isValid(){return B.every((I)=>G[I].length===0)},get isValidating(){return J()||B.some((I)=>X[I])},get isDirty(){return B.some((I)=>W[I])},validate:O,validateField:M,reset:j,setValues:A,setFieldValue:H,setFieldTouched:K,getFieldState:U,handleSubmit:k}}var E=$;class Z{rules=[];defaultValue="";addRule(q){let z=new Z;return z.rules=[...this.rules,q],z.defaultValue=this.defaultValue,z}required(q="This field is required"){return this.addRule({name:"required",message:q,validate:(z)=>{if(z===null||z===void 0)return q;if(typeof z==="string"&&z.trim()==="")return q;if(Array.isArray(z)&&z.length===0)return q;return!0}})}email(q="Please enter a valid email"){return this.addRule({name:"email",message:q,validate:(z)=>{if(!z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(z))||q}})}url(q="Please enter a valid URL"){return this.addRule({name:"url",message:q,validate:(z)=>{if(!z)return!0;try{return new URL(String(z)),!0}catch{return q}}})}min(q,z){let B=z||`Must be at least ${q} characters`;return this.addRule({name:"min",message:B,validate:(C)=>{if(!C)return!0;return String(C).length>=q||B}})}max(q,z){let B=z||`Must be no more than ${q} characters`;return this.addRule({name:"max",message:B,validate:(C)=>{if(!C)return!0;return String(C).length<=q||B}})}length(q,z,B){let C=B||`Must be between ${q} and ${z} characters`;return this.addRule({name:"length",message:C,validate:(G)=>{if(!G)return!0;let L=String(G).length;return L>=q&&L<=z||C}})}pattern(q,z="Invalid format"){return this.addRule({name:"pattern",message:z,validate:(B)=>{if(!B)return!0;return q.test(String(B))||z}})}hasUppercase(q="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,q)}hasLowercase(q="Must contain a lowercase letter"){return this.pattern(/[a-z]/,q)}hasNumber(q="Must contain a number"){return this.pattern(/\d/,q)}hasSpecial(q="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,q)}alphanumeric(q="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,q)}startsWithLetter(q="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,q)}noSpaces(q="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:q,validate:(z)=>{if(!z)return!0;return!String(z).includes(" ")||q}})}number(q="Must be a number"){let z=this.addRule({name:"number",message:q,validate:(B)=>{if(!B&&B!==0)return!0;return!Number.isNaN(Number(B))||q}});return z.defaultValue=0,z}integer(q="Must be a whole number"){return this.addRule({name:"integer",message:q,validate:(z)=>{if(!z&&z!==0)return!0;return Number.isInteger(Number(z))||q}})}positive(q="Must be a positive number"){return this.addRule({name:"positive",message:q,validate:(z)=>{if(!z&&z!==0)return!0;return Number(z)>0||q}})}negative(q="Must be a negative number"){return this.addRule({name:"negative",message:q,validate:(z)=>{if(!z&&z!==0)return!0;return Number(z)<0||q}})}minValue(q,z){let B=z||`Must be at least ${q}`;return this.addRule({name:"minValue",message:B,validate:(C)=>{if(!C&&C!==0)return!0;return Number(C)>=q||B}})}maxValue(q,z){let B=z||`Must be no more than ${q}`;return this.addRule({name:"maxValue",message:B,validate:(C)=>{if(!C&&C!==0)return!0;return Number(C)<=q||B}})}between(q,z,B){let C=B||`Must be between ${q} and ${z}`;return this.addRule({name:"between",message:C,validate:(G)=>{if(!G&&G!==0)return!0;let L=Number(G);return L>=q&&L<=z||C}})}matches(q,z){let B=z||`Must match ${q}`;return this.addRule({name:"matches",message:B,validate:(C,G)=>{if(!G)return!0;return C===G[q]||B}})}oneOf(q,z){let B=z||`Must be one of: ${q.join(", ")}`;return this.addRule({name:"oneOf",message:B,validate:(C)=>{if(!C)return!0;return q.includes(C)||B}})}notOneOf(q,z){let B=z||`Cannot be one of: ${q.join(", ")}`;return this.addRule({name:"notOneOf",message:B,validate:(C)=>{if(!C)return!0;return!q.includes(C)||B}})}date(q="Must be a valid date"){return this.addRule({name:"date",message:q,validate:(z)=>{if(!z)return!0;let B=new Date(String(z));return!Number.isNaN(B.getTime())||q}})}before(q,z){let B=new Date(q),C=z||`Must be before ${B.toLocaleDateString()}`;return this.addRule({name:"before",message:C,validate:(G)=>{if(!G)return!0;return new Date(String(G))<B||C}})}after(q,z){let B=new Date(q),C=z||`Must be after ${B.toLocaleDateString()}`;return this.addRule({name:"after",message:C,validate:(G)=>{if(!G)return!0;return new Date(String(G))>B||C}})}custom(q,z="Invalid value"){return this.addRule({name:"custom",message:z,validate:q})}async(q,z="Invalid value"){return this.addRule({name:"async",message:z,async:!0,validate:q})}when(q,z){let B=new Z;B.rules=[...this.rules],B.defaultValue=this.defaultValue;for(let C of z.getRules())B.rules.push({...C,validate:(G,L)=>{if(!q(G,L||{}))return!0;return C.validate(G,L)}});return B}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(q){let z=new Z;return z.rules=[...this.rules],z.defaultValue=q,z}async validate(q,z){let B=[];for(let C of this.rules){let G=await C.validate(q,z);if(G!==!0)B.push(G)}return B}validateSync(q,z){let B=[];for(let C of this.rules){if(C.async)continue;let G=C.validate(q,z);if(G!==!0)B.push(G)}return B}}var y=new Z;function w(q,z,B){let C=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return q.replace(C,(G,L,W)=>{try{let X=L.trim().split("."),J=z;for(let O of X)if(J&&typeof J==="object"&&O in J)J=J[O];else return"";let M=J;if(!M||!Array.isArray(M)||M.length===0)return"";return M.map((O)=>{return W.replace(/\{\{\s*message\s*\}\}/g,O)}).join(`
2
+ import{Aj as _}from"./chunk-245ft0zp.js";function Y(q,z){let B={};for(let C of q)B[C]=_(z(C));return new Proxy({},{get:(C,G)=>B[G]?.(),set:(C,G,L)=>{if(B[G])B[G].set(L);else B[G]=_(L);return!0},has:(C,G)=>(G in B),deleteProperty:(C,G)=>{return delete B[G],!0},ownKeys:()=>Reflect.ownKeys(B),getOwnPropertyDescriptor:(C,G)=>(G in B)?{enumerable:!0,configurable:!0,writable:!0,value:B[G]()}:void 0})}function T(q,z){let B={};for(let C of z)B[C]=q[C];return B}function $(q,z){let B=Object.keys(q),C=Y(B,(I)=>z?.[I]??q[I].getDefaultValue()),G=Y(B,()=>[]),L=Y(B,()=>!1),W=Y(B,()=>!1),X=Y(B,()=>!1),J=_(!1);async function M(I){X[I]=!0;let Q=await q[I].validate(C[I],C);return G[I]=Q,X[I]=!1,Q.length===0}async function O(){J.set(!0);let I=await Promise.all(B.map(M));return J.set(!1),I.every(Boolean)}function j(){for(let I of B)C[I]=z?.[I]??q[I].getDefaultValue(),G[I]=[],L[I]=!1,W[I]=!1}function A(I){for(let Q of B)if(Q in I)C[Q]=I[Q],W[Q]=!0}function H(I,Q){C[I]=Q,W[I]=!0}function K(I,Q=!0){if(L[I]=Q,Q)M(I)}function U(I){return{value:C[I],errors:G[I],touched:L[I],dirty:W[I],valid:G[I].length===0,validating:X[I]}}function k(I){return async(Q)=>{Q?.preventDefault?.();for(let N of B)L[N]=!0;if(await O())await I(T(C,B))}}return{values:C,errors:G,touched:L,dirty:W,get isValid(){return B.every((I)=>G[I].length===0)},get isValidating(){return J()||B.some((I)=>X[I])},get isDirty(){return B.some((I)=>W[I])},validate:O,validateField:M,reset:j,setValues:A,setFieldValue:H,setFieldTouched:K,getFieldState:U,handleSubmit:k}}var E=$;class Z{rules=[];defaultValue="";addRule(q){let z=new Z;return z.rules=[...this.rules,q],z.defaultValue=this.defaultValue,z}required(q="This field is required"){return this.addRule({name:"required",message:q,validate:(z)=>{if(z===null||z===void 0)return q;if(typeof z==="string"&&z.trim()==="")return q;if(Array.isArray(z)&&z.length===0)return q;return!0}})}email(q="Please enter a valid email"){return this.addRule({name:"email",message:q,validate:(z)=>{if(!z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(z))||q}})}url(q="Please enter a valid URL"){return this.addRule({name:"url",message:q,validate:(z)=>{if(!z)return!0;try{return new URL(String(z)),!0}catch{return q}}})}min(q,z){let B=z||`Must be at least ${q} characters`;return this.addRule({name:"min",message:B,validate:(C)=>{if(!C)return!0;return String(C).length>=q||B}})}max(q,z){let B=z||`Must be no more than ${q} characters`;return this.addRule({name:"max",message:B,validate:(C)=>{if(!C)return!0;return String(C).length<=q||B}})}length(q,z,B){let C=B||`Must be between ${q} and ${z} characters`;return this.addRule({name:"length",message:C,validate:(G)=>{if(!G)return!0;let L=String(G).length;return L>=q&&L<=z||C}})}pattern(q,z="Invalid format"){return this.addRule({name:"pattern",message:z,validate:(B)=>{if(!B)return!0;return q.test(String(B))||z}})}hasUppercase(q="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,q)}hasLowercase(q="Must contain a lowercase letter"){return this.pattern(/[a-z]/,q)}hasNumber(q="Must contain a number"){return this.pattern(/\d/,q)}hasSpecial(q="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,q)}alphanumeric(q="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,q)}startsWithLetter(q="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,q)}noSpaces(q="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:q,validate:(z)=>{if(!z)return!0;return!String(z).includes(" ")||q}})}number(q="Must be a number"){let z=this.addRule({name:"number",message:q,validate:(B)=>{if(!B&&B!==0)return!0;return!Number.isNaN(Number(B))||q}});return z.defaultValue=0,z}integer(q="Must be a whole number"){return this.addRule({name:"integer",message:q,validate:(z)=>{if(!z&&z!==0)return!0;return Number.isInteger(Number(z))||q}})}positive(q="Must be a positive number"){return this.addRule({name:"positive",message:q,validate:(z)=>{if(!z&&z!==0)return!0;return Number(z)>0||q}})}negative(q="Must be a negative number"){return this.addRule({name:"negative",message:q,validate:(z)=>{if(!z&&z!==0)return!0;return Number(z)<0||q}})}minValue(q,z){let B=z||`Must be at least ${q}`;return this.addRule({name:"minValue",message:B,validate:(C)=>{if(!C&&C!==0)return!0;return Number(C)>=q||B}})}maxValue(q,z){let B=z||`Must be no more than ${q}`;return this.addRule({name:"maxValue",message:B,validate:(C)=>{if(!C&&C!==0)return!0;return Number(C)<=q||B}})}between(q,z,B){let C=B||`Must be between ${q} and ${z}`;return this.addRule({name:"between",message:C,validate:(G)=>{if(!G&&G!==0)return!0;let L=Number(G);return L>=q&&L<=z||C}})}matches(q,z){let B=z||`Must match ${q}`;return this.addRule({name:"matches",message:B,validate:(C,G)=>{if(!G)return!0;return C===G[q]||B}})}oneOf(q,z){let B=z||`Must be one of: ${q.join(", ")}`;return this.addRule({name:"oneOf",message:B,validate:(C)=>{if(!C)return!0;return q.includes(C)||B}})}notOneOf(q,z){let B=z||`Cannot be one of: ${q.join(", ")}`;return this.addRule({name:"notOneOf",message:B,validate:(C)=>{if(!C)return!0;return!q.includes(C)||B}})}date(q="Must be a valid date"){return this.addRule({name:"date",message:q,validate:(z)=>{if(!z)return!0;let B=new Date(String(z));return!Number.isNaN(B.getTime())||q}})}before(q,z){let B=new Date(q),C=z||`Must be before ${B.toLocaleDateString()}`;return this.addRule({name:"before",message:C,validate:(G)=>{if(!G)return!0;return new Date(String(G))<B||C}})}after(q,z){let B=new Date(q),C=z||`Must be after ${B.toLocaleDateString()}`;return this.addRule({name:"after",message:C,validate:(G)=>{if(!G)return!0;return new Date(String(G))>B||C}})}custom(q,z="Invalid value"){return this.addRule({name:"custom",message:z,validate:q})}async(q,z="Invalid value"){return this.addRule({name:"async",message:z,async:!0,validate:q})}when(q,z){let B=new Z;B.rules=[...this.rules],B.defaultValue=this.defaultValue;for(let C of z.getRules())B.rules.push({...C,validate:(G,L)=>{if(!q(G,L||{}))return!0;return C.validate(G,L)}});return B}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(q){let z=new Z;return z.rules=[...this.rules],z.defaultValue=q,z}async validate(q,z){let B=[];for(let C of this.rules){let G=await C.validate(q,z);if(G!==!0)B.push(G)}return B}validateSync(q,z){let B=[];for(let C of this.rules){if(C.async)continue;let G=C.validate(q,z);if(G!==!0)B.push(G)}return B}}var y=new Z;function w(q,z,B){let C=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return q.replace(C,(G,L,W)=>{try{let X=L.trim().split("."),J=z;for(let O of X)if(J&&typeof J==="object"&&O in J)J=J[O];else return"";let M=J;if(!M||!Array.isArray(M)||M.length===0)return"";return M.map((O)=>{return W.replace(/\{\{\s*message\s*\}\}/g,O)}).join(`
3
3
  `)}catch{return""}})}function D(q,z,B){let C=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return q.replace(C,(G,L,W)=>{try{let X=L.trim().split("."),J=z;for(let O of X)if(J&&typeof J==="object"&&O in J)J=J[O];else return"";let M=J;if(!M||!Array.isArray(M)||M.length===0)return"";return M.map((O)=>W.replace(/\{\{\s*message\s*\}\}/g,O)).join(`
4
- `)}catch{return""}})}function S(q,z,B){let C=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return q.replace(C,(G,L,W)=>{try{let X=L.trim().split("."),J=z;for(let O of X)if(J&&typeof J==="object"&&O in J)J=J[O];else return"";let M=J;if(!M||!Array.isArray(M)||M.length===0)return"";return W}catch{return""}})}function V(q,z,B){let C=q;return C=w(C,z,B),C=D(C,z,B),C=S(C,z,B),C}export{$ as $h,E as ai,Z as bi,y as ci,w as di,D as ei,S as fi,V as gi};
4
+ `)}catch{return""}})}function S(q,z,B){let C=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return q.replace(C,(G,L,W)=>{try{let X=L.trim().split("."),J=z;for(let O of X)if(J&&typeof J==="object"&&O in J)J=J[O];else return"";let M=J;if(!M||!Array.isArray(M)||M.length===0)return"";return W}catch{return""}})}function V(q,z,B){let C=q;return C=w(C,z,B),C=D(C,z,B),C=S(C,z,B),C}export{$ as ai,E as bi,Z as ci,y as di,w as ei,D as fi,S as gi,V as hi};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{rl as a,sl as b,tl as c,ul as d,vl as e,wl as f,xl as g}from"./chunk-2q216yrr.js";import"./chunk-wpsx5avz.js";import"./chunk-pgeh4g3a.js";import"./chunk-7q06md6v.js";import"./chunk-z8zmp74b.js";import"./chunk-x7qyx7vn.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Am as c,Bm as d,Cm as e,Dm as f,Em as g,Fm as h,Gm as i,Hm as j,Im as k,Jm as l,Km as m,Lm as n,Mm as o,Nm as p,Om as q,Pm as r,Qm as s,ym as a,zm as b}from"./chunk-0svp7s94.js";import"./chunk-ffdxdgep.js";import"./chunk-m8bdy2wt.js";import"./chunk-0n054h7w.js";import"./chunk-wpsx5avz.js";import"./chunk-tfy07tmv.js";import"./chunk-s6c3ymq1.js";import"./chunk-pgeh4g3a.js";import"./chunk-z9a0ft6h.js";import"./chunk-v1ezqvek.js";import"./chunk-7q06md6v.js";import"./chunk-1phxzej9.js";import"./chunk-7ba7x6jt.js";import"./chunk-akzmq0jr.js";import"./chunk-c1f1vtjt.js";import"./chunk-0nhpymyy.js";import"./chunk-4md4tj27.js";import"./chunk-z8zmp74b.js";import"./chunk-qcpnfw0k.js";import"./chunk-59pakqdv.js";import"./chunk-x7qyx7vn.js";export{j as usesSignalsInScript,s as unescapeHtml,q as resetRejectedExpressionWarnings,g as replaceInterpolations,c as registerFilters,b as registerFilter,o as processExpressions,n as interpolateScriptsInTemplate,l as interpolateScriptExpressions,m as interpolateScriptAttributes,d as getAllFilters,f as findMustacheEnd,r as evaluateExpression,i as escapeHtmlValue,h as escapeHtml,a as defaultFilters,k as clientLoopScopes,e as clearCustomFilters,p as applyFilters};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$e as z$}from"./chunk-b5rc4t8t.js";import{ag as n8,eg as j$,fg as a6,gg as x6,ig as L1,jg as s6,kg as B5,lg as O$,mg as N$,ng as r6,og as n6,sg as O5}from"./chunk-eg30ksd8.js";import{ej as c5}from"./chunk-szcxpbfn.js";import{Bj as e5,uj as l1,vj as I1,wj as R1,xj as r$,yj as n$,zj as a$}from"./chunk-mnk5mdwp.js";import{Yj as _$,Zj as U$}from"./chunk-2hy87cn4.js";import{Ak as s5,Bk as r5}from"./chunk-ht9rdkf3.js";import{Hk as G3,Ik as W3}from"./chunk-7eea1cse.js";import{al as B1}from"./chunk-14rh4kd0.js";import{vl as I5,wl as N7}from"./chunk-etah20m0.js";import{$m as L5,Aq as e0,Em as o0,Er as C$,Gr as n0,Hr as C0,Lr as k0,Oo as E0,Up as I0,Xm as p6,Zl as R7,Zo as t0,cn as T1,co as K$,dn as C1,no as H$,np as t8,po as c6,qm as r8,qo as D6,rr as B$,up as l6,vp as i6,vq as L6,wq as x1}from"./chunk-ptad3t7a.js";import{Ss as W5,kt as B,rt as L$,st as F$,wt as J0}from"./chunk-ndydf37f.js";import{Bt as p0}from"./chunk-7vftjm43.js";import{$u as J5,Ru as s1,Zu as Y5,cv as r1,gv as G5,jv as W$,kv as R6,wv as B6}from"./chunk-rk8p4b1z.js";import{Cw as v6,Dw as g6,Ew as f6,Fw as h6,Gw as d6,Hw as u6,Jw as m6,Ow as k6,hw as U5,iw as C6,mw as b6,nw as y6}from"./chunk-qbc0bebg.js";import{Vw as L3,Ww as I6,Yw as K5}from"./chunk-d6rkgay9.js";import{ax as s}from"./chunk-cevkpyn9.js";var $6={read:($)=>{try{return JSON.parse($)}catch{return $}},write:($)=>{return JSON.stringify($)}};function j3($,X,Z={}){let{storage:Q="local",serializer:Y=$6,mergeDefaults:J=!1,listenToStorageChanges:G=!0}=Z,W=new Set,K=typeof window<"u",_=()=>{if(!K)return null;return Q==="session"?sessionStorage:localStorage},U=()=>{let L=_();if(!L)return X;try{let O=L.getItem($);if(O===null)return X;let N=Y.read(O);if(J&&typeof X==="object"&&X!==null)return{...X,...N};return N}catch{return X}},F=(L)=>{let O=_();if(!O)return;try{if(L===null||L===void 0)O.removeItem($);else O.setItem($,Y.write(L))}catch(N){console.warn(`[useStorage] Failed to write key "${$}":`,N)}},z=U(),j=(L,O)=>{for(let N of W)try{N(L,O)}catch(V){console.error("[useStorage] Subscriber error:",V)}};if(K&&G){let L=(N)=>{if(N.key===$&&N.storageArea===_()){let V=z;try{z=N.newValue?Y.read(N.newValue):X}catch(M){console.warn(`[useStorage] Failed to read key "${$}" from a cross-tab update:`,M);return}j(z,V)}};window.addEventListener("storage",L);let O=globalThis.onDestroy;if(typeof O==="function")O(()=>window.removeEventListener("storage",L))}let H={get value(){return z},set value(L){let O=z;z=L,F(L),j(L,O)},get:()=>z,set:(L)=>{H.value=L},remove:()=>{let L=_();if(L){L.removeItem($);let O=z;z=X,j(X,O)}},subscribe:(L)=>{return W.add(L),L(z,void 0),()=>W.delete(L)}};return H}function s$($,X,Z,Q,Y={}){let{serializer:J=$6,mergeDefaults:G=!1,listenToStorageChanges:W=!0}=Y,K=typeof window<"u",_=()=>{if(!K)return null;return $==="session"?sessionStorage:localStorage},U=(j)=>{if(j===null||j===void 0)return Q;try{let H=J.read(j);if(G&&typeof Q==="object"&&Q!==null)return{...Q,...H};return H}catch(H){return console.warn(`[${X}] Failed to read key "${Z}":`,H),Q}},z=a$((()=>{let j=_();if(!j)return Q;try{return U(j.getItem(Z))}catch(H){return console.warn(`[${X}] Cannot read "${Z}":`,H),Q}})());if(e5(()=>{let j=z(),H=_();if(!H)return;try{if(j===null||j===void 0)H.removeItem(Z);else H.setItem(Z,J.write(j))}catch(L){console.warn(`[${X}] Cannot persist "${Z}":`,L)}}),K&&W){let j=(L)=>{if(L.key!==Z)return;if(L.storageArea&&L.storageArea!==_())return;z.set(U(L.newValue))};window.addEventListener("storage",j);let H=globalThis.onDestroy;if(typeof H==="function")H(()=>window.removeEventListener("storage",j))}return z}function H3($,X,Z){return s$("local","useLocalStorage",$,X,Z)}function O3($,X,Z){return s$("session","useSessionStorage",$,X,Z)}function N3($="local"){if(typeof window>"u")return;($==="session"?sessionStorage:localStorage).clear()}function q3($="local"){if(typeof window>"u")return[];let X=$==="session"?sessionStorage:localStorage;return Object.keys(X)}function A3($="local"){if(typeof window>"u")return 0;let X=$==="session"?sessionStorage:localStorage,Z=0;for(let Q in X)if(Object.prototype.hasOwnProperty.call(X,Q))Z+=(Q.length+(X.getItem(Q)?.length||0))*2;return Z}var X6="stx:kept:";function Z6($){return`${X6}${$===void 0||$===null||$===""||$===!1?"":`${$}:`}`}function V3($,X){return`${Z6(X)}${$}`}function M3($,X,Z={}){let{scope:Q}=Z;if(Q===!1||Q===null||Q==="")return a$(X);return s$("local","keptState",V3($,Q),X)}function E3($){if(typeof localStorage>"u")return;try{let X=Z6($);for(let Z=localStorage.length-1;Z>=0;Z--){let Q=localStorage.key(Z);if(Q?.startsWith(X))localStorage.removeItem(Q)}}catch{}}var t=null;function c1($,X,Z=new WeakSet){if(Object.is($,X))return!0;if(typeof $!=="object"||typeof X!=="object"||$===null||X===null)return!1;if(Z.has($))return!0;if(Z.add($),$ instanceof Date&&X instanceof Date)return $.getTime()===X.getTime();if($ instanceof RegExp&&X instanceof RegExp)return $.source===X.source&&$.flags===X.flags;if(Array.isArray($)){if(!Array.isArray(X)||$.length!==X.length)return!1;for(let J=0;J<$.length;J++)if(!c1($[J],X[J],Z))return!1;return!0}if(Array.isArray(X))return!1;if($ instanceof Map){if(!(X instanceof Map)||$.size!==X.size)return!1;for(let[J,G]of $)if(!X.has(J)||!c1(G,X.get(J),Z))return!1;return!0}if(X instanceof Map)return!1;if($ instanceof Set){if(!(X instanceof Set)||$.size!==X.size)return!1;for(let J of $)if(!X.has(J))return!1;return!0}if(X instanceof Set)return!1;let Q=Object.keys($),Y=Object.keys(X);if(Q.length!==Y.length)return!1;for(let J of Q){if(!Object.prototype.hasOwnProperty.call(X,J))return!1;if(!c1($[J],X[J],Z))return!1}return!0}function VJ($){t=$}function MJ(){return t}function EJ(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:I3()}}function I3(){return{refs:new Map,effects:new Set,cleanups:[]}}function IJ($){let X=new Set,Z=new Set,Q=$,Y=Symbol("ref"),J={get value(){let G=l1();if(G)Z.add(G);return Q},set value(G){if(!Object.is(G,Q)){let W=Q;Q=G;for(let K of X)K(G,W);for(let K of Z)if(r$())n$(K);else K()}},subscribe(G){return X.add(G),()=>{X.delete(G)}}};if(t)t.scope.refs.set(Y,J);return J}var Q6=new WeakMap;function R3($){let X=Q6.get($);if(X)return X;let Z=new Map,Q=(G)=>{let W=Z.get(G);if(!W)return;for(let K of[...W])if(r$())n$(K);else K()},Y=(G,W)=>{if(!Z.has(G))Z.set(G,new Set);return Z.get(G).add(W),()=>{Z.get(G)?.delete(W)}},J=new Proxy($,{get(G,W,K){let _=Reflect.get(G,W,K),U=l1();if(U)Y(W,U);if(_!==null&&typeof _==="object"&&!Array.isArray(_)){let F=Object.getPrototypeOf(_);if(F===Object.prototype||F===null)return R3(_)}return _},set(G,W,K,_){let U=Reflect.get(G,W,_),F=Reflect.set(G,W,K,_);if(!Object.is(K,U))Q(W);return F},deleteProperty(G,W){let K=Reflect.deleteProperty(G,W);return Q(W),K}});return Q6.set($,J),J}function RJ($){let X,Z=!0,Q=new Set,Y=new Set,J=()=>{Z=!0,G()},G=()=>{if(Z){let K=X,_=I1(J);if(X=$(),R1(_),Z=!1,!Object.is(X,K)){for(let U of Q)U(X,K);for(let U of Y)U()}}},W=I1(J);return X=$(),Z=!1,R1(W),{get value(){let K=l1();if(K)Y.add(K);return G(),X},set value(K){console.warn("[stx] Computed properties are readonly")},subscribe(K){return Q.add(K),()=>{Q.delete(K)}}}}function D3($){if(typeof requestAnimationFrame==="function"){requestAnimationFrame(()=>{requestAnimationFrame($)});return}setTimeout($,0)}function DJ($,X,Z={}){let{immediate:Q=!1,deep:Y=!1,flush:J="post"}=Z,G,W,K=!1,_=()=>{if(K)return;let H=j();if((Y?!c1(H,G):!Object.is(H,G))||Q)if(X(H,G),Y&&H!==null&&typeof H==="object")try{G=structuredClone(H)}catch{G=H}else G=H},U=(H)=>{if(J==="sync")H();else if(J==="pre")Promise.resolve().then(H);else D3(H)},F=!1,z=()=>{if(K||F)return;F=!0,U(()=>{F=!1,_()})},j=()=>{if(typeof $==="function"){let H=I1(z);try{return $()}finally{R1(H)}}return $.value};if(typeof $!=="function"){let H=$.subscribe(()=>{U(_)});W=()=>{K=!0,H()}}else W=()=>{K=!0};if(G=j(),Q)U(_);if(t)t.scope.cleanups.push(()=>W?.());return()=>W?.()}function wJ($,X,Z={}){let Q=[],Y=$.map((J)=>J.value);for(let J of $){let G=J.subscribe(()=>{let W=$.map((K)=>K.value);X(W,Y),Y=[...W]});Q.push(G)}if(Z.immediate){let J=$.map((G)=>G.value);X(J,Y)}return()=>{for(let J of Q)J()}}function TJ($){let X,Z=!1,Q=()=>{if(Z)return;if(X)X();let Y=I1(Q);X=$(),R1(Y)};if(Q(),t)t.scope.cleanups.push(()=>{if(Z=!0,X)X()});return()=>{if(Z=!0,X)X()}}function CJ($){if(t)t.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function kJ($){if(t)t.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function xJ($){if(t)t.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function SJ($){if(t)t.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function PJ($){if(t)t.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function bJ($){if(t)t.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function J1($,X){let Z=$.hooks[X];for(let Q of Z)await Q()}async function yJ($){await J1($,"beforeMount"),$.isMounted=!0,await J1($,"mounted")}async function vJ($){if(!$.isMounted||$.isUnmounted)return;await J1($,"beforeUpdate"),await J1($,"updated")}async function gJ($){if($.isUnmounted)return;await J1($,"beforeUnmount");for(let X of $.scope.cleanups)X();$.isUnmounted=!0,await J1($,"unmounted")}function fJ(){return`
2
+ import{$e as z$}from"./chunk-x8zt0b72.js";import{ag as n8,eg as j$,fg as a6,gg as x6,ig as L1,jg as s6,kg as B5,lg as O$,mg as N$,og as r6,pg as n6,tg as O5}from"./chunk-s7jkyw9t.js";import{fj as c5}from"./chunk-1x6c4ys1.js";import{Aj as a$,Cj as e5,vj as l1,wj as I1,xj as R1,yj as r$,zj as n$}from"./chunk-245ft0zp.js";import{Zj as _$,_j as U$}from"./chunk-wa32w7h2.js";import{Bk as s5,Ck as r5}from"./chunk-afwbqeb2.js";import{Ik as G3,Jk as W3}from"./chunk-rqr735w8.js";import{bl as B1}from"./chunk-t0p5yhgf.js";import{wl as I5,xl as N7}from"./chunk-2q216yrr.js";import{Bq as e0,Fm as o0,Fr as C$,Hr as n0,Ir as C0,Mr as k0,Po as E0,Vp as I0,Ym as p6,_l as R7,_o as t0,an as L5,dn as T1,do as K$,en as C1,oo as H$,op as t8,qo as c6,rm as r8,ro as D6,sr as B$,vp as l6,wp as i6,wq as L6,xq as x1}from"./chunk-0svp7s94.js";import{Ts as W5,lt as B,st as L$,tt as F$,xt as J0}from"./chunk-s6c3ymq1.js";import{Ct as p0}from"./chunk-pgeh4g3a.js";import{Su as s1,_u as Y5,av as J5,dv as r1,hv as G5,kv as W$,lv as R6,xv as B6}from"./chunk-akzmq0jr.js";import{Dw as v6,Ew as g6,Fw as f6,Gw as h6,Hw as d6,Iw as u6,Kw as m6,Pw as k6,iw as U5,jw as C6,nw as b6,ow as y6}from"./chunk-z8zmp74b.js";import{Ww as L3,Xw as I6,Zw as K5}from"./chunk-59pakqdv.js";import{bx as s}from"./chunk-x7qyx7vn.js";var $6={read:($)=>{try{return JSON.parse($)}catch{return $}},write:($)=>{return JSON.stringify($)}};function j3($,X,Z={}){let{storage:Q="local",serializer:Y=$6,mergeDefaults:J=!1,listenToStorageChanges:G=!0}=Z,W=new Set,K=typeof window<"u",_=()=>{if(!K)return null;return Q==="session"?sessionStorage:localStorage},U=()=>{let L=_();if(!L)return X;try{let O=L.getItem($);if(O===null)return X;let N=Y.read(O);if(J&&typeof X==="object"&&X!==null)return{...X,...N};return N}catch{return X}},F=(L)=>{let O=_();if(!O)return;try{if(L===null||L===void 0)O.removeItem($);else O.setItem($,Y.write(L))}catch(N){console.warn(`[useStorage] Failed to write key "${$}":`,N)}},z=U(),j=(L,O)=>{for(let N of W)try{N(L,O)}catch(V){console.error("[useStorage] Subscriber error:",V)}};if(K&&G){let L=(N)=>{if(N.key===$&&N.storageArea===_()){let V=z;try{z=N.newValue?Y.read(N.newValue):X}catch(M){console.warn(`[useStorage] Failed to read key "${$}" from a cross-tab update:`,M);return}j(z,V)}};window.addEventListener("storage",L);let O=globalThis.onDestroy;if(typeof O==="function")O(()=>window.removeEventListener("storage",L))}let H={get value(){return z},set value(L){let O=z;z=L,F(L),j(L,O)},get:()=>z,set:(L)=>{H.value=L},remove:()=>{let L=_();if(L){L.removeItem($);let O=z;z=X,j(X,O)}},subscribe:(L)=>{return W.add(L),L(z,void 0),()=>W.delete(L)}};return H}function s$($,X,Z,Q,Y={}){let{serializer:J=$6,mergeDefaults:G=!1,listenToStorageChanges:W=!0}=Y,K=typeof window<"u",_=()=>{if(!K)return null;return $==="session"?sessionStorage:localStorage},U=(j)=>{if(j===null||j===void 0)return Q;try{let H=J.read(j);if(G&&typeof Q==="object"&&Q!==null)return{...Q,...H};return H}catch(H){return console.warn(`[${X}] Failed to read key "${Z}":`,H),Q}},z=a$((()=>{let j=_();if(!j)return Q;try{return U(j.getItem(Z))}catch(H){return console.warn(`[${X}] Cannot read "${Z}":`,H),Q}})());if(e5(()=>{let j=z(),H=_();if(!H)return;try{if(j===null||j===void 0)H.removeItem(Z);else H.setItem(Z,J.write(j))}catch(L){console.warn(`[${X}] Cannot persist "${Z}":`,L)}}),K&&W){let j=(L)=>{if(L.key!==Z)return;if(L.storageArea&&L.storageArea!==_())return;z.set(U(L.newValue))};window.addEventListener("storage",j);let H=globalThis.onDestroy;if(typeof H==="function")H(()=>window.removeEventListener("storage",j))}return z}function H3($,X,Z){return s$("local","useLocalStorage",$,X,Z)}function O3($,X,Z){return s$("session","useSessionStorage",$,X,Z)}function N3($="local"){if(typeof window>"u")return;($==="session"?sessionStorage:localStorage).clear()}function q3($="local"){if(typeof window>"u")return[];let X=$==="session"?sessionStorage:localStorage;return Object.keys(X)}function A3($="local"){if(typeof window>"u")return 0;let X=$==="session"?sessionStorage:localStorage,Z=0;for(let Q in X)if(Object.prototype.hasOwnProperty.call(X,Q))Z+=(Q.length+(X.getItem(Q)?.length||0))*2;return Z}var X6="stx:kept:";function Z6($){return`${X6}${$===void 0||$===null||$===""||$===!1?"":`${$}:`}`}function V3($,X){return`${Z6(X)}${$}`}function M3($,X,Z={}){let{scope:Q}=Z;if(Q===!1||Q===null||Q==="")return a$(X);return s$("local","keptState",V3($,Q),X)}function E3($){if(typeof localStorage>"u")return;try{let X=Z6($);for(let Z=localStorage.length-1;Z>=0;Z--){let Q=localStorage.key(Z);if(Q?.startsWith(X))localStorage.removeItem(Q)}}catch{}}var t=null;function c1($,X,Z=new WeakSet){if(Object.is($,X))return!0;if(typeof $!=="object"||typeof X!=="object"||$===null||X===null)return!1;if(Z.has($))return!0;if(Z.add($),$ instanceof Date&&X instanceof Date)return $.getTime()===X.getTime();if($ instanceof RegExp&&X instanceof RegExp)return $.source===X.source&&$.flags===X.flags;if(Array.isArray($)){if(!Array.isArray(X)||$.length!==X.length)return!1;for(let J=0;J<$.length;J++)if(!c1($[J],X[J],Z))return!1;return!0}if(Array.isArray(X))return!1;if($ instanceof Map){if(!(X instanceof Map)||$.size!==X.size)return!1;for(let[J,G]of $)if(!X.has(J)||!c1(G,X.get(J),Z))return!1;return!0}if(X instanceof Map)return!1;if($ instanceof Set){if(!(X instanceof Set)||$.size!==X.size)return!1;for(let J of $)if(!X.has(J))return!1;return!0}if(X instanceof Set)return!1;let Q=Object.keys($),Y=Object.keys(X);if(Q.length!==Y.length)return!1;for(let J of Q){if(!Object.prototype.hasOwnProperty.call(X,J))return!1;if(!c1($[J],X[J],Z))return!1}return!0}function VJ($){t=$}function MJ(){return t}function EJ(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:I3()}}function I3(){return{refs:new Map,effects:new Set,cleanups:[]}}function IJ($){let X=new Set,Z=new Set,Q=$,Y=Symbol("ref"),J={get value(){let G=l1();if(G)Z.add(G);return Q},set value(G){if(!Object.is(G,Q)){let W=Q;Q=G;for(let K of X)K(G,W);for(let K of Z)if(r$())n$(K);else K()}},subscribe(G){return X.add(G),()=>{X.delete(G)}}};if(t)t.scope.refs.set(Y,J);return J}var Q6=new WeakMap;function R3($){let X=Q6.get($);if(X)return X;let Z=new Map,Q=(G)=>{let W=Z.get(G);if(!W)return;for(let K of[...W])if(r$())n$(K);else K()},Y=(G,W)=>{if(!Z.has(G))Z.set(G,new Set);return Z.get(G).add(W),()=>{Z.get(G)?.delete(W)}},J=new Proxy($,{get(G,W,K){let _=Reflect.get(G,W,K),U=l1();if(U)Y(W,U);if(_!==null&&typeof _==="object"&&!Array.isArray(_)){let F=Object.getPrototypeOf(_);if(F===Object.prototype||F===null)return R3(_)}return _},set(G,W,K,_){let U=Reflect.get(G,W,_),F=Reflect.set(G,W,K,_);if(!Object.is(K,U))Q(W);return F},deleteProperty(G,W){let K=Reflect.deleteProperty(G,W);return Q(W),K}});return Q6.set($,J),J}function RJ($){let X,Z=!0,Q=new Set,Y=new Set,J=()=>{Z=!0,G()},G=()=>{if(Z){let K=X,_=I1(J);if(X=$(),R1(_),Z=!1,!Object.is(X,K)){for(let U of Q)U(X,K);for(let U of Y)U()}}},W=I1(J);return X=$(),Z=!1,R1(W),{get value(){let K=l1();if(K)Y.add(K);return G(),X},set value(K){console.warn("[stx] Computed properties are readonly")},subscribe(K){return Q.add(K),()=>{Q.delete(K)}}}}function D3($){if(typeof requestAnimationFrame==="function"){requestAnimationFrame(()=>{requestAnimationFrame($)});return}setTimeout($,0)}function DJ($,X,Z={}){let{immediate:Q=!1,deep:Y=!1,flush:J="post"}=Z,G,W,K=!1,_=()=>{if(K)return;let H=j();if((Y?!c1(H,G):!Object.is(H,G))||Q)if(X(H,G),Y&&H!==null&&typeof H==="object")try{G=structuredClone(H)}catch{G=H}else G=H},U=(H)=>{if(J==="sync")H();else if(J==="pre")Promise.resolve().then(H);else D3(H)},F=!1,z=()=>{if(K||F)return;F=!0,U(()=>{F=!1,_()})},j=()=>{if(typeof $==="function"){let H=I1(z);try{return $()}finally{R1(H)}}return $.value};if(typeof $!=="function"){let H=$.subscribe(()=>{U(_)});W=()=>{K=!0,H()}}else W=()=>{K=!0};if(G=j(),Q)U(_);if(t)t.scope.cleanups.push(()=>W?.());return()=>W?.()}function wJ($,X,Z={}){let Q=[],Y=$.map((J)=>J.value);for(let J of $){let G=J.subscribe(()=>{let W=$.map((K)=>K.value);X(W,Y),Y=[...W]});Q.push(G)}if(Z.immediate){let J=$.map((G)=>G.value);X(J,Y)}return()=>{for(let J of Q)J()}}function TJ($){let X,Z=!1,Q=()=>{if(Z)return;if(X)X();let Y=I1(Q);X=$(),R1(Y)};if(Q(),t)t.scope.cleanups.push(()=>{if(Z=!0,X)X()});return()=>{if(Z=!0,X)X()}}function CJ($){if(t)t.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function kJ($){if(t)t.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function xJ($){if(t)t.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function SJ($){if(t)t.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function PJ($){if(t)t.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function bJ($){if(t)t.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function J1($,X){let Z=$.hooks[X];for(let Q of Z)await Q()}async function yJ($){await J1($,"beforeMount"),$.isMounted=!0,await J1($,"mounted")}async function vJ($){if(!$.isMounted||$.isUnmounted)return;await J1($,"beforeUpdate"),await J1($,"updated")}async function gJ($){if($.isUnmounted)return;await J1($,"beforeUnmount");for(let X of $.scope.cleanups)X();$.isUnmounted=!0,await J1($,"unmounted")}function fJ(){return`
3
3
  <script data-stx-client-runtime>
4
4
  (function() {
5
5
  'use strict';
@@ -697,7 +697,7 @@ else {
697
697
  <span class="frontmatter-label">${X}:</span>
698
698
  <span>${Array.isArray(Z)?Z.join(", "):String(Z)}</span>
699
699
  </div>`).join("")}
700
- </div>`}import M6 from"net";async function R4($){return new Promise((X)=>{let Z=M6.createServer();Z.once("error",()=>X(!1)),Z.once("listening",()=>{Z.close(()=>X(!0))}),Z.listen($,"0.0.0.0")})}async function D4($){return new Promise((X)=>{let Z=M6.createServer();Z.once("error",()=>X(!1)),Z.once("listening",()=>{Z.close(()=>X(!0))}),Z.listen($,"::")})}async function w4($){if(!await R4($))return!1;return await D4($)}async function u0($,X=20){$=Number($);for(let Z=0;Z<X;Z++){let Q=$+Z;if(await w4(Q))return Q}throw Error(`Could not find an available port between ${$} and ${$+X-1}`)}var T4={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0};async function C4(){try{let $=await import("./chunk-b1hqgm6j.js");if(typeof $.openDevWindow!=="function")return null;return $}catch{return null}}async function W1($,X={}){let Z={...T4,...X},Q=await C4();if(!Q)return console.log(`${B.yellow}\u26A0${B.reset} Native window requested, but @stacksjs/desktop is not available.`),console.log(" Install & build the desktop package to enable --native."),!1;try{let Y=await Q.openDevWindow($,{title:Z.title,width:Z.width,height:Z.height,darkMode:Z.darkMode,hotReload:Z.hotReload,titlebarHidden:Z.titlebarHidden,nativeSidebar:Z.nativeSidebar,sidebarWidth:Z.sidebarWidth,sidebarConfig:Z.sidebarConfig});if(Y&&Z.nativeSidebar)console.log(`${B.green}\u2713${B.reset} Native sidebar enabled (macOS Tahoe style)`);return Y}catch(Y){return console.log(`${B.red}\u2717${B.reset} Could not open native window:`,Y),!1}}function Z$($){if($.match(/<Sidebar[\s\S]*?variant=["'](?:tahoe|vibrancy|desktop)["'][\s\S]*?\/>/i)){let Y=$.match(/<script\s+server[^>]*>([\s\S]*?)<\/script>/i);if(Y){let J=Y[1];try{let G=`
700
+ </div>`}import M6 from"net";async function R4($){return new Promise((X)=>{let Z=M6.createServer();Z.once("error",()=>X(!1)),Z.once("listening",()=>{Z.close(()=>X(!0))}),Z.listen($,"0.0.0.0")})}async function D4($){return new Promise((X)=>{let Z=M6.createServer();Z.once("error",()=>X(!1)),Z.once("listening",()=>{Z.close(()=>X(!0))}),Z.listen($,"::")})}async function w4($){if(!await R4($))return!1;return await D4($)}async function u0($,X=20){$=Number($);for(let Z=0;Z<X;Z++){let Q=$+Z;if(await w4(Q))return Q}throw Error(`Could not find an available port between ${$} and ${$+X-1}`)}var T4={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0};async function C4(){try{let $=await import("./chunk-pyyccs6a.js");if(typeof $.openDevWindow!=="function")return null;return $}catch{return null}}async function W1($,X={}){let Z={...T4,...X},Q=await C4();if(!Q)return console.log(`${B.yellow}\u26A0${B.reset} Native window requested, but @stacksjs/desktop is not available.`),console.log(" Install & build the desktop package to enable --native."),!1;try{let Y=await Q.openDevWindow($,{title:Z.title,width:Z.width,height:Z.height,darkMode:Z.darkMode,hotReload:Z.hotReload,titlebarHidden:Z.titlebarHidden,nativeSidebar:Z.nativeSidebar,sidebarWidth:Z.sidebarWidth,sidebarConfig:Z.sidebarConfig});if(Y&&Z.nativeSidebar)console.log(`${B.green}\u2713${B.reset} Native sidebar enabled (macOS Tahoe style)`);return Y}catch(Y){return console.log(`${B.red}\u2717${B.reset} Could not open native window:`,Y),!1}}function Z$($){if($.match(/<Sidebar[\s\S]*?variant=["'](?:tahoe|vibrancy|desktop)["'][\s\S]*?\/>/i)){let Y=$.match(/<script\s+server[^>]*>([\s\S]*?)<\/script>/i);if(Y){let J=Y[1];try{let G=`
701
701
  ${J}
702
702
  return typeof sidebarConfig !== 'undefined' ? sidebarConfig : null;
703
703
  `,K=Function(G)();if(K)return K}catch(G){console.warn("Invalid sidebarConfig:",G)}}return{sections:[]}}let Z=$.match(/@nativeSidebar\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(Z)try{return JSON.parse(Z[1])}catch{console.warn("Invalid @nativeSidebar configuration")}let Q=$.match(/<script\s+native-sidebar[^>]*>([\s\S]*?)<\/script>/i);if(Q)try{let Y=Q[1].match(/(?:export\s+(?:default\s+)?|const\s+\w+\s*=\s*)(\{[\s\S]*\})/m);if(Y)return Function(`return ${Y[1]}`)()}catch(Y){console.warn("Invalid native-sidebar script configuration:",Y)}return}function X5(){console.log(`
@@ -1069,7 +1069,7 @@ else {
1069
1069
  };
1070
1070
  })();
1071
1071
  </script>
1072
- `}function y0($,X,Z={}){let Q=y4(X,Z),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Q+$.slice(Y);if($.includes("</html>"))return $.replace("</html>",`${Q}</html>`);return $+Q}function Q$($){let X=$.toLowerCase();return X.endsWith(".css")||X.endsWith(".scss")||X.endsWith(".sass")||X.endsWith(".less")}function Y$($){let X=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((Q)=>X.endsWith(Q))}function J$($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Z)=>Z.test($))}var _1=null;function G$($){if(!_1)_1=new E6($);return _1}function D1(){if(_1)_1.stop(),_1=null}import w1 from"path";K5();var U1={name:"bun-plugin-stx",async setup($){let Z={...await n0(),...$.config?.stx},Q=new Set,Y=Z.webComponents?.enabled?`./${w1.relative(w1.dirname($.config?.outdir||"dist"),Z.webComponents.outputDir||"dist/web-components")}`:"/web-components",J=[];if(Z.webComponents?.enabled)try{let G=await B$(Z,Q);if(J.push(...G),Z.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let W=new Set;if(Z.cache&&Z.cachePath){let L=await _$(G,Z);if(L){if(Z.debug)console.log(`Using cached version of ${G}`);return{contents:L,loader:"html"}}}let K=await G5(()=>Bun.file(G).text(),"",(L)=>{throw new J5(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${L.message}`)});if(!K)throw new J5(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:U,allScripts:F}=W5.time("script-extraction",()=>{let L=K,O=K$(K);if(O)L=O.content.trim();let N=K.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],V="",M=[];for(let A of N){let I=A.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",E=A.match(/<script\b([^>]*)>/i),w=E?E[1]:"";if(/\bserver\b/i.test(w))V=I;else M.push(A)}let q=L.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:V,templateContent:q,allScripts:M}}),z={__filename:G,__dirname:w1.dirname(G),__stx:{webComponentsPath:Y,builtComponents:J}};await G5(()=>E0(_,z,G),void 0,(L)=>{let O=new Y5(`Script execution failed in ${G}: ${L.message}`,G,void 0,void 0,_.substring(0,100));if(W$.log(O,{filePath:G,scriptContent:_}),Z.debug)throw O});let H=await W5.timeAsync("directive-processing",async()=>{return await I0(U,z,G,Z,W)});if(F.length>0){let{interpolateScriptsInTemplate:L}=await import("./chunk-scn75qrm.js"),O=L(F.join(`
1072
+ `}function y0($,X,Z={}){let Q=y4(X,Z),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Q+$.slice(Y);if($.includes("</html>"))return $.replace("</html>",`${Q}</html>`);return $+Q}function Q$($){let X=$.toLowerCase();return X.endsWith(".css")||X.endsWith(".scss")||X.endsWith(".sass")||X.endsWith(".less")}function Y$($){let X=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((Q)=>X.endsWith(Q))}function J$($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Z)=>Z.test($))}var _1=null;function G$($){if(!_1)_1=new E6($);return _1}function D1(){if(_1)_1.stop(),_1=null}import w1 from"path";K5();var U1={name:"bun-plugin-stx",async setup($){let Z={...await n0(),...$.config?.stx},Q=new Set,Y=Z.webComponents?.enabled?`./${w1.relative(w1.dirname($.config?.outdir||"dist"),Z.webComponents.outputDir||"dist/web-components")}`:"/web-components",J=[];if(Z.webComponents?.enabled)try{let G=await B$(Z,Q);if(J.push(...G),Z.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let W=new Set;if(Z.cache&&Z.cachePath){let L=await _$(G,Z);if(L){if(Z.debug)console.log(`Using cached version of ${G}`);return{contents:L,loader:"html"}}}let K=await G5(()=>Bun.file(G).text(),"",(L)=>{throw new J5(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${L.message}`)});if(!K)throw new J5(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:U,allScripts:F}=W5.time("script-extraction",()=>{let L=K,O=K$(K);if(O)L=O.content.trim();let N=K.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],V="",M=[];for(let A of N){let I=A.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",E=A.match(/<script\b([^>]*)>/i),w=E?E[1]:"";if(/\bserver\b/i.test(w))V=I;else M.push(A)}let q=L.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:V,templateContent:q,allScripts:M}}),z={__filename:G,__dirname:w1.dirname(G),__stx:{webComponentsPath:Y,builtComponents:J}};await G5(()=>E0(_,z,G),void 0,(L)=>{let O=new Y5(`Script execution failed in ${G}: ${L.message}`,G,void 0,void 0,_.substring(0,100));if(W$.log(O,{filePath:G,scriptContent:_}),Z.debug)throw O});let H=await W5.timeAsync("directive-processing",async()=>{return await I0(U,z,G,Z,W)});if(F.length>0){let{interpolateScriptsInTemplate:L}=await import("./chunk-kjkkh5p6.js"),O=L(F.join(`
1073
1073
  `),z),N=H.search(/<\/body>/i);if(N!==-1)H=H.slice(0,N)+O+`
1074
1074
  `+H.slice(N);else H+=`
1075
1075
  ${O}`}if(H=await D6(H),W.forEach((L)=>Q.add(L)),Z.cache&&Z.cachePath){if(await U$(G,H,W,Z),Z.debug)console.log(`Cached template ${G} with ${W.size} dependencies`)}return{contents:H,loader:"html"}}catch(W){let K=W instanceof Error?W:new Y5(`Plugin processing failed: ${String(W)}`,G);if(W$.log(K,{filePath:G,buildConfig:$.config}),R6.logDetailedError(K,{filePath:G,plugin:"bun-plugin-stx"}),Z.debug)console.error("stx Plugin Error:",K);let _=K,U=_.line||null,F=_.context||null;return{contents:Z.debug||I6()?`<!DOCTYPE html>
@@ -1132,7 +1132,7 @@ ${O}`}if(H=await D6(H),W.forEach((L)=>Q.add(L)),Z.cache&&Z.cachePath){if(await U
1132
1132
  <h1>Something went wrong</h1>
1133
1133
  <p>An internal error occurred. Please try again later.</p>
1134
1134
  </body>
1135
- </html>`,loader:"html"}}})}};async function g4($,X={}){let Z=X.port||3000,Q=X.watch!==!1,Y=X.hotReload!==!1&&Q,J=null,G=X.hmrPort||Z+1,W=Q0.resolve($);if(!R0.existsSync(W))return console.error(`${B.red}Error: File not found: ${B.bright}${W}${B.reset}`),!1;if(W.endsWith(".md"))return Q5(W,X);else if(!W.endsWith(".stx"))return console.error(`${B.red}Error: Unsupported file type: ${B.bright}${W}${B.reset}. Only .stx and .md files are supported.`),!1;let K=p0(process.cwd(),"output");R0.mkdirSync(K,{recursive:!0}),console.log(`${B.blue}Building ${B.bright}${$}${B.reset}...`);let _=null,U=async()=>{try{let I={name:"public-assets",setup(T){T.onResolve({filter:/^\/(images|fonts|assets|public)\//},(f)=>{return{path:f.path,external:!0}})}},E=await Bun.build({entrypoints:[W],outdir:K,plugins:[I,U1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!E.success)return console.error(`${B.red}Build failed:${B.reset}`,E.logs),!1;let w=E.outputs.find((T)=>T.path.endsWith(".html"));if(!w)return console.error(`${B.red}No HTML output found${B.reset}`),!1;return _=await Bun.file(w.path).text(),!0}catch(I){return console.error(`${B.red}Error building stx file:${B.reset}`,I),!1}};if(!await U())return!1;let z=Q0.dirname(W);await L$(z);let j=Z;try{if(j=await u0(Z),j!==Z)console.log(`${B.yellow}Port ${Z} is busy, using port ${j} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let I=X.hmrPort||j+1;J=G$({wsPort:I,verbose:!1}),G=J.start(I)}let H={},L=null,O;try{let{loadStxConfig:I}=await import("./chunk-42tn0t54.js"),E=await I();if(O=X.stxOptions?.serverApi??E.serverApi,E?.apiRouter)L=E?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(E?.apiRoutes){H=E.apiRoutes;let w=Object.keys(H).length;if(w>0)console.log(`${B.blue}Loaded ${B.bright}${w} API route${w>1?"s":""}${B.reset}`)}if(E?.broadcasting?.enabled)try{let{startBroadcasting:w,loadChannels:D}=await import("./chunk-2m17v3yx.js"),T=E.broadcasting;await w(T);let f=T.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${f}/ws${B.reset}`);let c=Q0.join(process.cwd(),"channels.ts");if(R0.existsSync(c))try{let v=await D(c);console.log(`${B.blue}Loaded ${B.bright}${v} broadcast channel${v!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(v){console.warn(`${B.yellow}Failed to load channels.ts: ${v.message}${B.reset}`)}}catch(w){console.warn(`${B.yellow}Broadcasting failed to start: ${w.message}${B.reset}`)}}catch{}let{createServerApi:N,isServerApiSource:V}=await import("./chunk-h37e97qq.js"),M=await N(process.cwd(),O);if(console.log(`${B.blue}Starting server on ${B.cyan}http://localhost:${j}/${B.reset}...`),Y)console.log(`${B.magenta}Hot reload enabled on ws://localhost:${G}${B.reset}`);let q=v4({port:j,async fetch(I){return z$(I,await(async()=>{let E=new URL(I.url);if([K,Q0.dirname(W),Q0.join(process.cwd(),"public")].some((v)=>V(Q0.join(v,E.pathname),process.cwd(),O)))return new Response("Not Found",{status:404});if(L)try{let v=await L.handleRequest(I);if(v.status!==404)return v}catch{}if(H[E.pathname])try{return await H[E.pathname](I)}catch(v){return new Response(JSON.stringify({error:v.message}),{status:500,headers:{"Content-Type":"application/json"}})}let w=await M(I);if(w)return w;if(E.pathname==="/")return(async()=>{let S=await J0(_||"");if(Y)S=y0(S,G);if(X.native)if(S.includes("<head>"))S=S.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(S.includes("<html"))S=S.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else S="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+S;if(X.titlebarHidden)if(S.includes("<head>"))S=S.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(S.includes("<html"))S=S.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else S=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${S}`;return S})().then((S)=>new Response(S,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let D=Q0.join(K,E.pathname);if(R0.existsSync(D)&&R0.statSync(D).isFile()){let v=Bun.file(D),S=Q0.extname(D).toLowerCase(),k="text/plain";if(S===".ts"||S===".tsx"){let N0=new Bun.Transpiler({loader:S===".tsx"?"tsx":"ts"}),W0=await v.text(),r0=N0.transformSync(W0);return new Response(r0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(S){case".html":k="text/html";break;case".css":k="text/css";break;case".js":k="text/javascript";break;case".json":k="application/json";break;case".png":k="image/png";break;case".jpg":case".jpeg":k="image/jpeg";break;case".gif":k="image/gif";break;case".woff":k="font/woff";break;case".woff2":k="font/woff2";break;case".ttf":k="font/ttf";break;case".otf":k="font/otf";break;case".eot":k="application/vnd.ms-fontobject";break}return new Response(v,{headers:{"Content-Type":k}})}let T=Q0.dirname(W),f=Q0.join(T,E.pathname);if(R0.existsSync(f)&&R0.statSync(f).isFile()){let v=Bun.file(f),S=Q0.extname(f).toLowerCase(),k="text/plain";if(S===".ts"||S===".tsx"){let N0=new Bun.Transpiler({loader:S===".tsx"?"tsx":"ts"}),W0=await v.text(),r0=N0.transformSync(W0);return new Response(r0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(S){case".html":k="text/html";break;case".css":k="text/css";break;case".js":k="text/javascript";break;case".json":k="application/json";break;case".png":k="image/png";break;case".jpg":case".jpeg":k="image/jpeg";break;case".gif":k="image/gif";break;case".svg":k="image/svg+xml";break;case".ico":k="image/x-icon";break;case".woff":k="font/woff";break;case".woff2":k="font/woff2";break;case".ttf":k="font/ttf";break;case".otf":k="font/otf";break;case".eot":k="application/vnd.ms-fontobject";break}return new Response(v,{headers:{"Content-Type":k}})}let c=Q0.join(process.cwd(),"public",E.pathname);if(R0.existsSync(c)&&R0.statSync(c).isFile()){let v=Bun.file(c),S=Q0.extname(c).toLowerCase(),k="application/octet-stream";if(S===".ts"||S===".tsx"){let N0=new Bun.Transpiler({loader:S===".tsx"?"tsx":"ts"}),W0=await v.text(),r0=N0.transformSync(W0);return new Response(r0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(S){case".html":k="text/html";break;case".css":k="text/css";break;case".js":k="text/javascript";break;case".json":k="application/json";break;case".png":k="image/png";break;case".jpg":case".jpeg":k="image/jpeg";break;case".gif":k="image/gif";break;case".svg":k="image/svg+xml";break;case".ico":k="image/x-icon";break;case".woff":k="font/woff";break;case".woff2":k="font/woff2";break;case".ttf":k="font/ttf";break;case".otf":k="font/otf";break;case".eot":k="application/vnd.ms-fontobject";break}return new Response(v,{headers:{"Content-Type":k}})}return new Response("Not Found",{status:404})})())},error(I){return new Response(`<pre>${I}
1135
+ </html>`,loader:"html"}}})}};async function g4($,X={}){let Z=X.port||3000,Q=X.watch!==!1,Y=X.hotReload!==!1&&Q,J=null,G=X.hmrPort||Z+1,W=Q0.resolve($);if(!R0.existsSync(W))return console.error(`${B.red}Error: File not found: ${B.bright}${W}${B.reset}`),!1;if(W.endsWith(".md"))return Q5(W,X);else if(!W.endsWith(".stx"))return console.error(`${B.red}Error: Unsupported file type: ${B.bright}${W}${B.reset}. Only .stx and .md files are supported.`),!1;let K=p0(process.cwd(),"output");R0.mkdirSync(K,{recursive:!0}),console.log(`${B.blue}Building ${B.bright}${$}${B.reset}...`);let _=null,U=async()=>{try{let I={name:"public-assets",setup(T){T.onResolve({filter:/^\/(images|fonts|assets|public)\//},(f)=>{return{path:f.path,external:!0}})}},E=await Bun.build({entrypoints:[W],outdir:K,plugins:[I,U1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!E.success)return console.error(`${B.red}Build failed:${B.reset}`,E.logs),!1;let w=E.outputs.find((T)=>T.path.endsWith(".html"));if(!w)return console.error(`${B.red}No HTML output found${B.reset}`),!1;return _=await Bun.file(w.path).text(),!0}catch(I){return console.error(`${B.red}Error building stx file:${B.reset}`,I),!1}};if(!await U())return!1;let z=Q0.dirname(W);await L$(z);let j=Z;try{if(j=await u0(Z),j!==Z)console.log(`${B.yellow}Port ${Z} is busy, using port ${j} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let I=X.hmrPort||j+1;J=G$({wsPort:I,verbose:!1}),G=J.start(I)}let H={},L=null,O;try{let{loadStxConfig:I}=await import("./chunk-gxyvpwvn.js"),E=await I();if(O=X.stxOptions?.serverApi??E.serverApi,E?.apiRouter)L=E?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(E?.apiRoutes){H=E.apiRoutes;let w=Object.keys(H).length;if(w>0)console.log(`${B.blue}Loaded ${B.bright}${w} API route${w>1?"s":""}${B.reset}`)}if(E?.broadcasting?.enabled)try{let{startBroadcasting:w,loadChannels:D}=await import("./chunk-w6n5c479.js"),T=E.broadcasting;await w(T);let f=T.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${f}/ws${B.reset}`);let c=Q0.join(process.cwd(),"channels.ts");if(R0.existsSync(c))try{let v=await D(c);console.log(`${B.blue}Loaded ${B.bright}${v} broadcast channel${v!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(v){console.warn(`${B.yellow}Failed to load channels.ts: ${v.message}${B.reset}`)}}catch(w){console.warn(`${B.yellow}Broadcasting failed to start: ${w.message}${B.reset}`)}}catch{}let{createServerApi:N,isServerApiSource:V}=await import("./chunk-k8g5feyd.js"),M=await N(process.cwd(),O);if(console.log(`${B.blue}Starting server on ${B.cyan}http://localhost:${j}/${B.reset}...`),Y)console.log(`${B.magenta}Hot reload enabled on ws://localhost:${G}${B.reset}`);let q=v4({port:j,async fetch(I){return z$(I,await(async()=>{let E=new URL(I.url);if([K,Q0.dirname(W),Q0.join(process.cwd(),"public")].some((v)=>V(Q0.join(v,E.pathname),process.cwd(),O)))return new Response("Not Found",{status:404});if(L)try{let v=await L.handleRequest(I);if(v.status!==404)return v}catch{}if(H[E.pathname])try{return await H[E.pathname](I)}catch(v){return new Response(JSON.stringify({error:v.message}),{status:500,headers:{"Content-Type":"application/json"}})}let w=await M(I);if(w)return w;if(E.pathname==="/")return(async()=>{let S=await J0(_||"");if(Y)S=y0(S,G);if(X.native)if(S.includes("<head>"))S=S.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(S.includes("<html"))S=S.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else S="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+S;if(X.titlebarHidden)if(S.includes("<head>"))S=S.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(S.includes("<html"))S=S.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else S=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${S}`;return S})().then((S)=>new Response(S,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let D=Q0.join(K,E.pathname);if(R0.existsSync(D)&&R0.statSync(D).isFile()){let v=Bun.file(D),S=Q0.extname(D).toLowerCase(),k="text/plain";if(S===".ts"||S===".tsx"){let N0=new Bun.Transpiler({loader:S===".tsx"?"tsx":"ts"}),W0=await v.text(),r0=N0.transformSync(W0);return new Response(r0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(S){case".html":k="text/html";break;case".css":k="text/css";break;case".js":k="text/javascript";break;case".json":k="application/json";break;case".png":k="image/png";break;case".jpg":case".jpeg":k="image/jpeg";break;case".gif":k="image/gif";break;case".woff":k="font/woff";break;case".woff2":k="font/woff2";break;case".ttf":k="font/ttf";break;case".otf":k="font/otf";break;case".eot":k="application/vnd.ms-fontobject";break}return new Response(v,{headers:{"Content-Type":k}})}let T=Q0.dirname(W),f=Q0.join(T,E.pathname);if(R0.existsSync(f)&&R0.statSync(f).isFile()){let v=Bun.file(f),S=Q0.extname(f).toLowerCase(),k="text/plain";if(S===".ts"||S===".tsx"){let N0=new Bun.Transpiler({loader:S===".tsx"?"tsx":"ts"}),W0=await v.text(),r0=N0.transformSync(W0);return new Response(r0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(S){case".html":k="text/html";break;case".css":k="text/css";break;case".js":k="text/javascript";break;case".json":k="application/json";break;case".png":k="image/png";break;case".jpg":case".jpeg":k="image/jpeg";break;case".gif":k="image/gif";break;case".svg":k="image/svg+xml";break;case".ico":k="image/x-icon";break;case".woff":k="font/woff";break;case".woff2":k="font/woff2";break;case".ttf":k="font/ttf";break;case".otf":k="font/otf";break;case".eot":k="application/vnd.ms-fontobject";break}return new Response(v,{headers:{"Content-Type":k}})}let c=Q0.join(process.cwd(),"public",E.pathname);if(R0.existsSync(c)&&R0.statSync(c).isFile()){let v=Bun.file(c),S=Q0.extname(c).toLowerCase(),k="application/octet-stream";if(S===".ts"||S===".tsx"){let N0=new Bun.Transpiler({loader:S===".tsx"?"tsx":"ts"}),W0=await v.text(),r0=N0.transformSync(W0);return new Response(r0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(S){case".html":k="text/html";break;case".css":k="text/css";break;case".js":k="text/javascript";break;case".json":k="application/json";break;case".png":k="image/png";break;case".jpg":case".jpeg":k="image/jpeg";break;case".gif":k="image/gif";break;case".svg":k="image/svg+xml";break;case".ico":k="image/x-icon";break;case".woff":k="font/woff";break;case".woff2":k="font/woff2";break;case".ttf":k="font/ttf";break;case".otf":k="font/otf";break;case".eot":k="application/vnd.ms-fontobject";break}return new Response(v,{headers:{"Content-Type":k}})}return new Response("Not Found",{status:404})})())},error(I){return new Response(`<pre>${I}
1136
1136
  ${I.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
1137
1137
  ${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
1138
1138
  ${B.bright}\u2192 ${B.cyan}http://localhost:${j}/${B.reset}`),console.log(`
@@ -1619,12 +1619,12 @@ ${H.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
1619
1619
  ${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
1620
1620
  ${B.bright}\u2192 ${B.cyan}http://localhost:${U}/${B.reset}`),console.log(`
1621
1621
  ${B.yellow}Routes:${B.reset}`);let z=new Set(W.map((H)=>H.routeTemplate)),j=Object.entries(G).filter(([H])=>!z.has(H)).sort(([H],[L])=>H.localeCompare(L)).map(([H,L])=>({route:H==="/"?"/":H,filePath:L0.relative(process.cwd(),L.filePath),fileType:L.fileType}));for(let H of W){let L=H.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");j.push({route:L,filePath:L0.relative(process.cwd(),H.filePath),fileType:"stx"})}if(j.sort((H,L)=>H.route.localeCompare(L.route)),j.forEach((H,L)=>{let N=L===j.length-1?"\u2514\u2500 ":"\u251C\u2500 ",V=H.fileType==="md"?`${B.magenta}(markdown)${B.reset}`:"";console.log(` ${B.green}${N}${H.route}${B.reset} \u2192 ${B.bright}${H.filePath}${B.reset} ${V}`)}),console.log(`
1622
- Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),m0(F.url.toString(),()=>{if(Q)c0.watch(J,{recursive:!0}).close();F.stop()}),Q){console.log(`${B.blue}Watching for changes...${B.reset}`);let H=c0.watch(J,{recursive:!0},async(L,O)=>{if(!O)return;if(O.endsWith(".stx")||O.endsWith(".js")||O.endsWith(".ts")||O.endsWith(".md"))console.log(`${B.yellow}File ${B.bright}${O}${B.yellow} changed, rebuilding...${B.reset}`),t0.clear(),e0(),await K()});process.on("SIGINT",()=>{H.close(),F.stop(),process.exit(0)})}return!0}function T6($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var{serve:d4}=globalThis.Bun;import e from"fs";import m from"path";async function P6($){try{return L5(await Bun.file($).text())}catch{return}}function _5($){let X=Bun.file($),Z=m.extname($).toLowerCase(),Q={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},J=[".js",".css",".json"].includes(Z)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(X,{headers:{"Content-Type":Q[Z]||"application/octet-stream",...J}})}async function u4($=".",X={}){let Z=X.port||3000,Q=X.watch!==!1,Y=X.hotReload!==!1&&Q,J=null,G=X.hmrPort||Z+1,W=m.resolve($),{loadStxConfig:K}=await import("./chunk-42tn0t54.js"),_=await K(W),{createServerApi:U,isServerApiSource:F}=await import("./chunk-h37e97qq.js"),z=X.stxOptions?.serverApi??_.serverApi,j=await U(W,z),H=_.root&&_.root!=="."?m.join(W,_.root):W,L=X.pagesDir||_.pagesDir||"pages",O=m.join(H,L);if(!e.existsSync(O)&&!_._layerPageDirs?.some((R)=>e.existsSync(R)))return console.error(`${B.red}Error: No '${L}' directory found${B.reset}`),console.log(`${B.dim}Looked in: ${B.bright}${O}${B.reset}`),console.log(`${B.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${B.reset}`),console.log(`${B.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${B.reset}`),console.log(`${B.dim}Starting fresh? Create ${L}/index.stx for the homepage.${B.reset}`),!1;let N=H$(H,{pagesDir:L,pagesDirs:_._layerPageDirs?[O,..._._layerPageDirs.slice(1)]:void 0});if(N.length===0)return console.error(`${B.red}Error: No page files found in ${B.bright}${O}${B.reset}`),!1;console.log(`${B.blue}Found ${B.bright}${N.length}${B.blue} routes${B.reset}`);let V=_?._pluginPageDirs||[],M=[];for(let{dir:R,prefix:x}of V)if(e.existsSync(R)){let P=H$(m.dirname(R),{pagesDir:m.basename(R)});for(let y of P){let Z0=x==="/"?y.pattern:`${x}${y.pattern==="/"?"":y.pattern}`;M.push({route:{...y,pattern:Z0},prefix:x})}if(P.length>0)console.log(`${B.blue}Plugin pages: ${B.bright}${P.length}${B.blue} routes at ${B.cyan}${x}${B.reset}`)}let q=new Map,A=null,I=null;if(X.stxOptions?.shell!==!1){if(I=await s6(W,X.stxOptions?.shell),I){if(A=await B5(I,X.stxOptions||{}),A)console.log(`${B.blue}Using app shell: ${B.bright}${m.relative(W,I)}${B.reset} ${B.dim}(deprecated: use layouts/default.stx instead)${B.reset}`)}}v6(),await f6(W);let E=g6();if(E.length>0)console.log(`${B.blue}Loaded ${B.bright}${E.length}${B.blue} middleware: ${B.dim}${E.join(", ")}${B.reset}`);let w={},D=null;try{let{loadStxConfig:R}=await import("./chunk-42tn0t54.js"),x=await R(W);if(x?.apiRouter)D=x?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(x?.apiRoutes){w=x.apiRoutes;let P=Object.keys(w).length;if(P>0)console.log(`${B.blue}Loaded ${B.bright}${P} API route${P>1?"s":""}${B.reset}`)}if(x?.broadcasting?.enabled)try{let{startBroadcasting:P,loadChannels:y}=await import("./chunk-2m17v3yx.js"),Z0=x.broadcasting;await P(Z0);let w0=Z0.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${w0}/ws${B.reset}`);let h0=m.join(process.cwd(),"channels.ts");if(e.existsSync(h0))try{let p=await y(h0);console.log(`${B.blue}Loaded ${B.bright}${p} broadcast channel${p!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(p){console.warn(`${B.yellow}Failed to load channels.ts: ${p.message}${B.reset}`)}}catch(P){console.warn(`${B.yellow}Broadcasting failed to start: ${P.message}${B.reset}`)}}catch{}let T=p0(W,"output");e.mkdirSync(T,{recursive:!0});let f=new Map,c=new Set,v=async(R)=>{let x=b6(O,R);if(!x)return null;try{let P=await Bun.build({entrypoints:[x],outdir:T,plugins:[U1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!P.success)return null;let y=P.outputs.find((Z0)=>Z0.path.endsWith(".html"));if(!y)return null;return await Bun.file(y.path).text()}catch{return null}},S=new Map,k=async(R,x)=>{try{let{processDirectives:P,extractVariables:y,defaultConfig:Z0,loadStxConfig:w0,injectRouterScript:h0}=await import("./chunk-42tn0t54.js"),{checkCache:p,cacheTemplate:u,readFileCached:g,templateCache:h}=await import("./chunk-vxxj6sqn.js"),Y0=await w0(W),d0=(i)=>{if(!i)return i;if(m.isAbsolute(i))return i;return m.resolve(W,i)},C={...Z0,...Y0,...X.stxOptions,autoShell:!0};if(X.debugDirectives)C.debug=!0;C.partialsDir=d0(C.partialsDir),C.componentsDir=d0(C.componentsDir),C.layoutsDir=d0(C.layoutsDir),C.storesDir=d0(C.storesDir||"stores"),C.cachePath=d0(C.cachePath)??p0(W,"cache");let X0=!x&&!X.profile,a=C.cache!==!1;if(a&&X0){let i=h.get(R.filePath);if(i)try{if((await e.promises.stat(R.filePath)).mtime.getTime()<=i.mtime){let M0=!0;for(let U0 of i.dependencies){if(!e.existsSync(U0)){M0=!1;break}if((await e.promises.stat(U0)).mtime.getTime()>i.mtime){M0=!1;break}}if(M0){let U0=i.output;if(A)U0=N$(U0,{preserveHead:!0});let E1=S.get(R.filePath);return{route:R,content:U0,status:E1?.status??await P6(R.filePath),headers:E1?.headers}}}}catch{}let A0=await p(R.filePath,C);if(A0){let V0=A0;if(A)V0=N$(V0,{preserveHead:!0});let M0=S.get(R.filePath);return{route:R,content:V0,status:M0?.status??await P6(R.filePath),headers:M0?.headers}}}let o=a?await g(R.filePath):await Bun.file(R.filePath).text(),_0=L5(o),{classifyAllScripts:d}=await import("./chunk-42tn0t54.js"),q0=d(o),T0=q0.server.map((i)=>i.content),r=o;for(let i of q0.server)r=r.replace(i.fullTag,"");let n={__filename:R.filePath,__dirname:m.dirname(R.filePath),__stx_options:C,params:x??{},__stx_runtime_head:{}};for(let i of T0)try{await y(i,n,R.filePath)}catch(A0){if(X.stxOptions?.debug)console.error("[stx] variable extraction error",R.filePath,A0?.message||A0)}let b0=new Set,H0;if(X.profile){let i=performance.now();H0=await P(r,n,R.filePath,C,b0);let A0=performance.now()-i,V0=m.relative(W,R.filePath)||R.filePath;console.log(`[stx:profile] ${V0} \u2192 ${A0.toFixed(2)}ms`)}else H0=await P(r,n,R.filePath,C,b0);if(!A)H0=await h0(H0,{router:C.router});{let{interpolateScriptExpressions:i}=await import("./chunk-scn75qrm.js");H0=H0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(A0,V0,M0)=>{if(!/function\s+__stx_setup_/.test(M0))return A0;return`<script${V0}>${i(M0,n)}</script>`})}if(A)H0=N$(H0,{preserveHead:!0});if(a&&X0)await u(R.filePath,H0,b0,C);let{extractStreamBoundaries:z3}=await import("./chunk-cqn8qq4v.js"),Y1=z3(n),M1=n.__streamTemplates;if(M1&&typeof M1==="object"&&Object.keys(M1).length>0){let i=n.streamBoundaries||{},A0={...C,autoShell:!1},V0=Object.keys(M1).map((U0)=>({id:U0,render:async()=>{let E1=typeof i[U0]==="function"?await i[U0]():void 0;return P(M1[U0],{...n,$boundary:E1},R.filePath,A0,new Set)}})),M0=new Set(V0.map((U0)=>U0.id));Y1=[...(Y1||[]).filter((U0)=>!M0.has(U0.id)),...V0]}if(Y1&&Y1.length>0)c.add(R.pattern);else Y1=void 0;let o5=T1(n),t5=C1(n);if(X0)S.set(R.filePath,{status:o5,headers:t5});return{route:R,content:H0,status:o5??_0,headers:t5,boundaries:Y1}}catch(P){return console.error(`${B.red}Error building ${B.bright}${R.pattern}${B.reset}:`,P),null}},N0=8,W0=async()=>{f.clear(),q.clear();for(let R=0;R<N.length;R+=N0){let x=N.slice(R,R+N0),P=await Promise.all(x.map((y)=>k(y)));for(let y of P)if(y)f.set(y.route.pattern,y)}for(let R=0;R<M.length;R+=N0){let x=M.slice(R,R+N0),P=await Promise.all(x.map(({route:y})=>k(y)));for(let y of P)if(y)q.set(y.route.pattern,y)}return f.size>0};if(console.log(`${B.blue}Building pages...${B.reset}`),!await W0())return console.error(`${B.red}No pages were successfully built${B.reset}`),!1;await L$(W);let f0=Z;try{if(f0=await u0(Z),f0!==Z)console.log(`${B.yellow}Port ${Z} is busy, using port ${f0} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let R=X.hmrPort||f0+1;J=G$({wsPort:R,verbose:!1}),G=J.start(R)}let j0=(R,x)=>{let y=`<script data-stx-route-params>(function(){var p=${JSON.stringify(x).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(R.includes("</head>"))return R.replace("</head>",`${y}</head>`);if(R.includes("<body"))return R.replace(/<body([^>]*)>/,`<body$1>${y}`);return y+R};console.log(`${B.blue}Starting server...${B.reset}`);let Q1=d4({port:f0,async fetch(R){let x=new URL(R.url),P=_?.publicDir||"public",y=m.join(W,P,x.pathname),Z0=m.join(W,x.pathname),w0=m.join(T,x.pathname);if([y,Z0,w0].some((C)=>F(C,W,z)))return new Response("Not Found",{status:404});let[h0,p,u]=await Promise.all([e.promises.stat(y).catch(()=>null),e.promises.stat(Z0).catch(()=>null),e.promises.stat(w0).catch(()=>null)]);if(h0?.isFile()&&!F(y,W,z))return _5(y);if(p?.isFile()&&!F(Z0,W,z))return _5(Z0);if(u?.isFile()&&!F(w0,W,z))return _5(w0);if(x.pathname.startsWith("/_stx/component/")){let C=decodeURIComponent(x.pathname.slice(16));if(C)try{let X0=`<${C} />`,a={...buildConfig,autoShell:!1},o=await processDirectives(X0,{},m.join(W,"components",`${C}.stx`),a,new Set);return new Response(o,{headers:{"Content-Type":"text/html"}})}catch(X0){return new Response(`<div class="stx-async-error">${X0.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(x.pathname==="/_stx/img"){let{handleImageRequest:C}=await import("./chunk-kvdd2zfn.js"),X0=await C(R,{publicDir:m.join(W,P),cacheDir:p0(W,"cache","img")});if(X0)return X0}if(D)try{let C=await D.handleRequest(R);if(C.status!==404)return C}catch{}if(w[x.pathname])try{return await w[x.pathname](R)}catch(C){return new Response(JSON.stringify({error:C.message}),{status:500,headers:{"Content-Type":"application/json"}})}let g=await j(R);if(g)return g;let h=U5(x.pathname,N);if(h){let C=f.get(h.route.pattern),X0=c.has(h.route.pattern);if(h.route.isDynamic&&Object.keys(h.params).length>0||X0){let a=await k(h.route,h.params);if(a)C=a}if(C){let a=C.status??200,o=C.headers??{},_0=(h.route.filePath?p6(await Bun.file(h.route.filePath).text().catch(()=>"")):null)??{};if(_0.validate){if(!await _0.validate({params:h.params})){let T0=await v(404);if(T0){let r=T0;if(r=await J0(r,W),Y)r=y0(r,G);return new Response(r,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(_0.middleware){let q0=h6(x.pathname,h.params,_0,x.search),T0=d6(q0,null,R,{isServer:!0}),r=await u6(_0.middleware,T0);if(r.redirect){let n=r.redirect.path,b0=r.redirect.options.redirectCode||302,H0=new Headers(r.responseHeaders);return H0.set("Location",n),new Response(null,{status:b0,headers:H0})}if(r.abort){let{statusCode:n,message:b0}=r.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${n}</title></head><body><h1>Error ${n}</h1><p>${b0}</p></body></html>`,{status:n,headers:{"Content-Type":"text/html"}})}if(Object.keys(r.state).length>0){let n=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(r.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;C.content=C.content.replace("</head>",`${n}</head>`)}}let d=C.content;if(A&&r6(R)){let q0=m6(d),T0=c6(d),r=d.match(/<title[^>]*>([\s\S]*?)<\/title>/i),n=r?a6(r[1].trim()):"";if(Object.keys(h.params).length>0)d=j0(d,h.params);d=await J0(d,W);let b0=_?.router?.container||"main";return d=n6(d,b0),new Response(d,{status:a,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":q0.layout,"X-STX-Layout-Group":q0.group,"X-STX-Runtime":T0?"true":"false",...n&&{"X-STX-Title":encodeURIComponent(n)},[l6]:i6(),...L1(),"Cache-Control":j$}})}if(A)d=O$(A,d);if(Object.keys(h.params).length>0)d=j0(d,h.params);if(d=await J0(d,W),Y)d=y0(d,G);if(X.native)if(d.includes("<head>"))d=d.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else d="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+d;if(X.titlebarHidden)if(d.includes("<head>"))d=d.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else d=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${d}`;if(C.boundaries&&C.boundaries.length>0){let{renderStreamingPage:q0,streamToResponse:T0}=await import("./chunk-cqn8qq4v.js");return T0(q0(d,C.boundaries,{timeoutMs:30000}),{status:a,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(d,{status:a,headers:{"Content-Type":"text/html",...L1(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...o}})}}if(M.length>0){let C=M.map((a)=>a.route),X0=U5(x.pathname,C);if(X0){let a=q.get(X0.route.pattern);if(a){let o=a.content;if(A)o=O$(A,o);if(Object.keys(X0.params).length>0)o=j0(o,X0.params);if(o=await J0(o,W),Y)o=y0(o,G);return new Response(o,{status:a.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:a}of V)if(a!=="/"&&x.pathname.startsWith(a)){let o=q.get(a)||q.get(a+"/");if(o){let _0=o.content;if(A)_0=O$(A,_0);if(_0=await J0(_0,W),Y)_0=y0(_0,G);return new Response(_0,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let Y0=f.get("/");if(Y0){let C=Y0.content;if(C=await J0(C,W),Y)C=y0(C,G);if(X.native)if(C.includes("<head>"))C=C.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else C="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+C;return new Response(C,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let d0=await v(404);if(d0){let C=d0;if(C=await J0(C,W),Y)C=y0(C,G);return new Response(C,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(R){let x=await v(500);if(x)return new Response(x,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${R}
1622
+ Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),m0(F.url.toString(),()=>{if(Q)c0.watch(J,{recursive:!0}).close();F.stop()}),Q){console.log(`${B.blue}Watching for changes...${B.reset}`);let H=c0.watch(J,{recursive:!0},async(L,O)=>{if(!O)return;if(O.endsWith(".stx")||O.endsWith(".js")||O.endsWith(".ts")||O.endsWith(".md"))console.log(`${B.yellow}File ${B.bright}${O}${B.yellow} changed, rebuilding...${B.reset}`),t0.clear(),e0(),await K()});process.on("SIGINT",()=>{H.close(),F.stop(),process.exit(0)})}return!0}function T6($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var{serve:d4}=globalThis.Bun;import e from"fs";import m from"path";async function P6($){try{return L5(await Bun.file($).text())}catch{return}}function _5($){let X=Bun.file($),Z=m.extname($).toLowerCase(),Q={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},J=[".js",".css",".json"].includes(Z)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(X,{headers:{"Content-Type":Q[Z]||"application/octet-stream",...J}})}async function u4($=".",X={}){let Z=X.port||3000,Q=X.watch!==!1,Y=X.hotReload!==!1&&Q,J=null,G=X.hmrPort||Z+1,W=m.resolve($),{loadStxConfig:K}=await import("./chunk-gxyvpwvn.js"),_=await K(W),{createServerApi:U,isServerApiSource:F}=await import("./chunk-k8g5feyd.js"),z=X.stxOptions?.serverApi??_.serverApi,j=await U(W,z),H=_.root&&_.root!=="."?m.join(W,_.root):W,L=X.pagesDir||_.pagesDir||"pages",O=m.join(H,L);if(!e.existsSync(O)&&!_._layerPageDirs?.some((R)=>e.existsSync(R)))return console.error(`${B.red}Error: No '${L}' directory found${B.reset}`),console.log(`${B.dim}Looked in: ${B.bright}${O}${B.reset}`),console.log(`${B.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${B.reset}`),console.log(`${B.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${B.reset}`),console.log(`${B.dim}Starting fresh? Create ${L}/index.stx for the homepage.${B.reset}`),!1;let N=H$(H,{pagesDir:L,pagesDirs:_._layerPageDirs?[O,..._._layerPageDirs.slice(1)]:void 0});if(N.length===0)return console.error(`${B.red}Error: No page files found in ${B.bright}${O}${B.reset}`),!1;console.log(`${B.blue}Found ${B.bright}${N.length}${B.blue} routes${B.reset}`);let V=_?._pluginPageDirs||[],M=[];for(let{dir:R,prefix:x}of V)if(e.existsSync(R)){let P=H$(m.dirname(R),{pagesDir:m.basename(R)});for(let y of P){let Z0=x==="/"?y.pattern:`${x}${y.pattern==="/"?"":y.pattern}`;M.push({route:{...y,pattern:Z0},prefix:x})}if(P.length>0)console.log(`${B.blue}Plugin pages: ${B.bright}${P.length}${B.blue} routes at ${B.cyan}${x}${B.reset}`)}let q=new Map,A=null,I=null;if(X.stxOptions?.shell!==!1){if(I=await s6(W,X.stxOptions?.shell),I){if(A=await B5(I,X.stxOptions||{}),A)console.log(`${B.blue}Using app shell: ${B.bright}${m.relative(W,I)}${B.reset} ${B.dim}(deprecated: use layouts/default.stx instead)${B.reset}`)}}v6(),await f6(W);let E=g6();if(E.length>0)console.log(`${B.blue}Loaded ${B.bright}${E.length}${B.blue} middleware: ${B.dim}${E.join(", ")}${B.reset}`);let w={},D=null;try{let{loadStxConfig:R}=await import("./chunk-gxyvpwvn.js"),x=await R(W);if(x?.apiRouter)D=x?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(x?.apiRoutes){w=x.apiRoutes;let P=Object.keys(w).length;if(P>0)console.log(`${B.blue}Loaded ${B.bright}${P} API route${P>1?"s":""}${B.reset}`)}if(x?.broadcasting?.enabled)try{let{startBroadcasting:P,loadChannels:y}=await import("./chunk-w6n5c479.js"),Z0=x.broadcasting;await P(Z0);let w0=Z0.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${w0}/ws${B.reset}`);let h0=m.join(process.cwd(),"channels.ts");if(e.existsSync(h0))try{let p=await y(h0);console.log(`${B.blue}Loaded ${B.bright}${p} broadcast channel${p!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(p){console.warn(`${B.yellow}Failed to load channels.ts: ${p.message}${B.reset}`)}}catch(P){console.warn(`${B.yellow}Broadcasting failed to start: ${P.message}${B.reset}`)}}catch{}let T=p0(W,"output");e.mkdirSync(T,{recursive:!0});let f=new Map,c=new Set,v=async(R)=>{let x=b6(O,R);if(!x)return null;try{let P=await Bun.build({entrypoints:[x],outdir:T,plugins:[U1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!P.success)return null;let y=P.outputs.find((Z0)=>Z0.path.endsWith(".html"));if(!y)return null;return await Bun.file(y.path).text()}catch{return null}},S=new Map,k=async(R,x)=>{try{let{processDirectives:P,extractVariables:y,defaultConfig:Z0,loadStxConfig:w0,injectRouterScript:h0}=await import("./chunk-gxyvpwvn.js"),{checkCache:p,cacheTemplate:u,readFileCached:g,templateCache:h}=await import("./chunk-b891w7hr.js"),Y0=await w0(W),d0=(i)=>{if(!i)return i;if(m.isAbsolute(i))return i;return m.resolve(W,i)},C={...Z0,...Y0,...X.stxOptions,autoShell:!0};if(X.debugDirectives)C.debug=!0;C.partialsDir=d0(C.partialsDir),C.componentsDir=d0(C.componentsDir),C.layoutsDir=d0(C.layoutsDir),C.storesDir=d0(C.storesDir||"stores"),C.cachePath=d0(C.cachePath)??p0(W,"cache");let X0=!x&&!X.profile,a=C.cache!==!1;if(a&&X0){let i=h.get(R.filePath);if(i)try{if((await e.promises.stat(R.filePath)).mtime.getTime()<=i.mtime){let M0=!0;for(let U0 of i.dependencies){if(!e.existsSync(U0)){M0=!1;break}if((await e.promises.stat(U0)).mtime.getTime()>i.mtime){M0=!1;break}}if(M0){let U0=i.output;if(A)U0=N$(U0,{preserveHead:!0});let E1=S.get(R.filePath);return{route:R,content:U0,status:E1?.status??await P6(R.filePath),headers:E1?.headers}}}}catch{}let A0=await p(R.filePath,C);if(A0){let V0=A0;if(A)V0=N$(V0,{preserveHead:!0});let M0=S.get(R.filePath);return{route:R,content:V0,status:M0?.status??await P6(R.filePath),headers:M0?.headers}}}let o=a?await g(R.filePath):await Bun.file(R.filePath).text(),_0=L5(o),{classifyAllScripts:d}=await import("./chunk-gxyvpwvn.js"),q0=d(o),T0=q0.server.map((i)=>i.content),r=o;for(let i of q0.server)r=r.replace(i.fullTag,"");let n={__filename:R.filePath,__dirname:m.dirname(R.filePath),__stx_options:C,params:x??{},__stx_runtime_head:{}};for(let i of T0)try{await y(i,n,R.filePath)}catch(A0){if(X.stxOptions?.debug)console.error("[stx] variable extraction error",R.filePath,A0?.message||A0)}let b0=new Set,H0;if(X.profile){let i=performance.now();H0=await P(r,n,R.filePath,C,b0);let A0=performance.now()-i,V0=m.relative(W,R.filePath)||R.filePath;console.log(`[stx:profile] ${V0} \u2192 ${A0.toFixed(2)}ms`)}else H0=await P(r,n,R.filePath,C,b0);if(!A)H0=await h0(H0,{router:C.router});{let{interpolateScriptExpressions:i}=await import("./chunk-kjkkh5p6.js");H0=H0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(A0,V0,M0)=>{if(!/function\s+__stx_setup_/.test(M0))return A0;return`<script${V0}>${i(M0,n)}</script>`})}if(A)H0=N$(H0,{preserveHead:!0});if(a&&X0)await u(R.filePath,H0,b0,C);let{extractStreamBoundaries:z3}=await import("./chunk-arrjqs96.js"),Y1=z3(n),M1=n.__streamTemplates;if(M1&&typeof M1==="object"&&Object.keys(M1).length>0){let i=n.streamBoundaries||{},A0={...C,autoShell:!1},V0=Object.keys(M1).map((U0)=>({id:U0,render:async()=>{let E1=typeof i[U0]==="function"?await i[U0]():void 0;return P(M1[U0],{...n,$boundary:E1},R.filePath,A0,new Set)}})),M0=new Set(V0.map((U0)=>U0.id));Y1=[...(Y1||[]).filter((U0)=>!M0.has(U0.id)),...V0]}if(Y1&&Y1.length>0)c.add(R.pattern);else Y1=void 0;let o5=T1(n),t5=C1(n);if(X0)S.set(R.filePath,{status:o5,headers:t5});return{route:R,content:H0,status:o5??_0,headers:t5,boundaries:Y1}}catch(P){return console.error(`${B.red}Error building ${B.bright}${R.pattern}${B.reset}:`,P),null}},N0=8,W0=async()=>{f.clear(),q.clear();for(let R=0;R<N.length;R+=N0){let x=N.slice(R,R+N0),P=await Promise.all(x.map((y)=>k(y)));for(let y of P)if(y)f.set(y.route.pattern,y)}for(let R=0;R<M.length;R+=N0){let x=M.slice(R,R+N0),P=await Promise.all(x.map(({route:y})=>k(y)));for(let y of P)if(y)q.set(y.route.pattern,y)}return f.size>0};if(console.log(`${B.blue}Building pages...${B.reset}`),!await W0())return console.error(`${B.red}No pages were successfully built${B.reset}`),!1;await L$(W);let f0=Z;try{if(f0=await u0(Z),f0!==Z)console.log(`${B.yellow}Port ${Z} is busy, using port ${f0} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let R=X.hmrPort||f0+1;J=G$({wsPort:R,verbose:!1}),G=J.start(R)}let j0=(R,x)=>{let y=`<script data-stx-route-params>(function(){var p=${JSON.stringify(x).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(R.includes("</head>"))return R.replace("</head>",`${y}</head>`);if(R.includes("<body"))return R.replace(/<body([^>]*)>/,`<body$1>${y}`);return y+R};console.log(`${B.blue}Starting server...${B.reset}`);let Q1=d4({port:f0,async fetch(R){let x=new URL(R.url),P=_?.publicDir||"public",y=m.join(W,P,x.pathname),Z0=m.join(W,x.pathname),w0=m.join(T,x.pathname);if([y,Z0,w0].some((C)=>F(C,W,z)))return new Response("Not Found",{status:404});let[h0,p,u]=await Promise.all([e.promises.stat(y).catch(()=>null),e.promises.stat(Z0).catch(()=>null),e.promises.stat(w0).catch(()=>null)]);if(h0?.isFile()&&!F(y,W,z))return _5(y);if(p?.isFile()&&!F(Z0,W,z))return _5(Z0);if(u?.isFile()&&!F(w0,W,z))return _5(w0);if(x.pathname.startsWith("/_stx/component/")){let C=decodeURIComponent(x.pathname.slice(16));if(C)try{let X0=`<${C} />`,a={...buildConfig,autoShell:!1},o=await processDirectives(X0,{},m.join(W,"components",`${C}.stx`),a,new Set);return new Response(o,{headers:{"Content-Type":"text/html"}})}catch(X0){return new Response(`<div class="stx-async-error">${X0.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(x.pathname==="/_stx/img"){let{handleImageRequest:C}=await import("./chunk-sgmqfphy.js"),X0=await C(R,{publicDir:m.join(W,P),cacheDir:p0(W,"cache","img")});if(X0)return X0}if(D)try{let C=await D.handleRequest(R);if(C.status!==404)return C}catch{}if(w[x.pathname])try{return await w[x.pathname](R)}catch(C){return new Response(JSON.stringify({error:C.message}),{status:500,headers:{"Content-Type":"application/json"}})}let g=await j(R);if(g)return g;let h=U5(x.pathname,N);if(h){let C=f.get(h.route.pattern),X0=c.has(h.route.pattern);if(h.route.isDynamic&&Object.keys(h.params).length>0||X0){let a=await k(h.route,h.params);if(a)C=a}if(C){let a=C.status??200,o=C.headers??{},_0=(h.route.filePath?p6(await Bun.file(h.route.filePath).text().catch(()=>"")):null)??{};if(_0.validate){if(!await _0.validate({params:h.params})){let T0=await v(404);if(T0){let r=T0;if(r=await J0(r,W),Y)r=y0(r,G);return new Response(r,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(_0.middleware){let q0=h6(x.pathname,h.params,_0,x.search),T0=d6(q0,null,R,{isServer:!0}),r=await u6(_0.middleware,T0);if(r.redirect){let n=r.redirect.path,b0=r.redirect.options.redirectCode||302,H0=new Headers(r.responseHeaders);return H0.set("Location",n),new Response(null,{status:b0,headers:H0})}if(r.abort){let{statusCode:n,message:b0}=r.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${n}</title></head><body><h1>Error ${n}</h1><p>${b0}</p></body></html>`,{status:n,headers:{"Content-Type":"text/html"}})}if(Object.keys(r.state).length>0){let n=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(r.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;C.content=C.content.replace("</head>",`${n}</head>`)}}let d=C.content;if(A&&r6(R)){let q0=m6(d),T0=c6(d),r=d.match(/<title[^>]*>([\s\S]*?)<\/title>/i),n=r?a6(r[1].trim()):"";if(Object.keys(h.params).length>0)d=j0(d,h.params);d=await J0(d,W);let b0=_?.router?.container||"main";return d=n6(d,b0),new Response(d,{status:a,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":q0.layout,"X-STX-Layout-Group":q0.group,"X-STX-Runtime":T0?"true":"false",...n&&{"X-STX-Title":encodeURIComponent(n)},[l6]:i6(),...L1(),"Cache-Control":j$}})}if(A)d=O$(A,d);if(Object.keys(h.params).length>0)d=j0(d,h.params);if(d=await J0(d,W),Y)d=y0(d,G);if(X.native)if(d.includes("<head>"))d=d.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else d="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+d;if(X.titlebarHidden)if(d.includes("<head>"))d=d.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else d=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${d}`;if(C.boundaries&&C.boundaries.length>0){let{renderStreamingPage:q0,streamToResponse:T0}=await import("./chunk-arrjqs96.js");return T0(q0(d,C.boundaries,{timeoutMs:30000}),{status:a,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(d,{status:a,headers:{"Content-Type":"text/html",...L1(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...o}})}}if(M.length>0){let C=M.map((a)=>a.route),X0=U5(x.pathname,C);if(X0){let a=q.get(X0.route.pattern);if(a){let o=a.content;if(A)o=O$(A,o);if(Object.keys(X0.params).length>0)o=j0(o,X0.params);if(o=await J0(o,W),Y)o=y0(o,G);return new Response(o,{status:a.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:a}of V)if(a!=="/"&&x.pathname.startsWith(a)){let o=q.get(a)||q.get(a+"/");if(o){let _0=o.content;if(A)_0=O$(A,_0);if(_0=await J0(_0,W),Y)_0=y0(_0,G);return new Response(_0,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let Y0=f.get("/");if(Y0){let C=Y0.content;if(C=await J0(C,W),Y)C=y0(C,G);if(X.native)if(C.includes("<head>"))C=C.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else C="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+C;return new Response(C,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let d0=await v(404);if(d0){let C=d0;if(C=await J0(C,W),Y)C=y0(C,G);return new Response(C,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(R){let x=await v(500);if(x)return new Response(x,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${R}
1623
1623
  ${R.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
1624
1624
  ${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
1625
1625
  ${B.bright}\u2192 ${B.cyan}http://localhost:${f0}/${B.reset}`),Y)console.log(`${B.dim} HMR: ws://localhost:${G}${B.reset}`);console.log(`
1626
1626
  ${B.yellow}Routes:${B.reset}`);let K0=[...y6(N,W)];for(let{route:R}of M)K0.push(`${R.pattern}`);if(K0.forEach((R,x)=>{let y=x===K0.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${B.green}${y}${B.reset}${R}`)}),console.log(`
1627
- Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),m0(Q1.url.toString(),()=>{if(J)D1();Q1.stop()}),X.native){let R,x=m.join(O,"index.stx");if(e.existsSync(x)){let y=await Bun.file(x).text();R=Z$(y)}let P=_?.app?.window??{};await W1(f0,{title:_?.app?.head?.title||m.basename(W)||"stx App",width:P.width,height:P.height,darkMode:P.darkMode,hotReload:P.hotReload,titlebarHidden:P.titlebarHidden??X.titlebarHidden===!0,nativeSidebar:!!R,sidebarConfig:R})}if(Q){console.log(`${B.blue}Watching for changes...${B.reset}`);let R=(p)=>{return p.startsWith("public/")||p.startsWith("public\\")},x=(p)=>{let u=p.toLowerCase();return u.endsWith(".stx")||u.endsWith(".html")||u.endsWith(".md")},P=new Map,y=()=>{let p=new Set([W,..._._layerGraph?.layers.map((u)=>u.root)??[],..._._layerGraph?.configDependencies.map((u)=>m.dirname(u))??[]].filter((u)=>e.existsSync(u)).map((u)=>e.realpathSync(u)));for(let u of _._layerGraph?.layers??[])for(let g of Object.values(u.resources)){if(!e.existsSync(g))continue;let h=e.realpathSync(g);if(![...p].some((Y0)=>h===Y0||h.startsWith(`${Y0}${m.sep}`)))p.add(h)}for(let[u,g]of P)if(!p.has(u))g.close(),P.delete(u);for(let u of p)if(!P.has(u)&&e.existsSync(u))P.set(u,e.watch(u,{recursive:!0},(g,h)=>{w0(u,g,h).catch((Y0)=>console.error("[stx] Layer rebuild failed:",Y0))}))},Z0=Promise.resolve(),w0=(p,u,g)=>{return Z0=Z0.catch(()=>{}).then(()=>h0(p,u,g)),Z0},h0=async(p,u,g)=>{if(!g||J$(g))return;if(Y$(g)){if(_._layerGraph){let h=await K(W);Object.assign(_,h),N.splice(0,N.length,...H$(H,{pagesDir:L,pagesDirs:h._layerPageDirs?[O,...h._layerPageDirs.slice(1)]:void 0})),y()}if(R(g)){if(console.log(`${B.cyan}${g} changed${B.reset}`),Y&&J)J.reload(g)}else if(x(g)){console.log(`${B.yellow}${g} changed, rebuilding...${B.reset}`),t0.clear(),e0();try{let{invalidateFileCache:h,templateCache:Y0}=await import("./chunk-vxxj6sqn.js");h(m.resolve(p,g)),Y0.delete(m.resolve(p,g))}catch{}if(I&&g){if(m.resolve(p,g)===I||m.basename(I)===g){let Y0=await B5(I,X.stxOptions||{});if(Y0)A=Y0}}if(await W0(),await F$(W),Y&&J)J.reload(g)}else{console.log(`${B.yellow}${g} changed, rebuilding...${B.reset}`),t0.clear(),e0();try{let{invalidateFileCache:h,templateCache:Y0}=await import("./chunk-vxxj6sqn.js");h(m.resolve(p,g)),Y0.delete(m.resolve(p,g))}catch{}if(await W0(),Y&&J)J.reload(g)}}else if(Q$(g)){if(console.log(`${B.cyan}CSS ${g} changed${B.reset}`),Y&&J)J.updateCss(g)}};y(),process.on("SIGINT",()=>{for(let p of P.values())p.close();if(J)D1();Q1.stop(),process.exit(0)})}return!0}var b={enabled:!1,components:new Map,stores:new Map,events:[],performance:[],selectedComponent:null,selectedStore:null,maxEvents:1000,maxPerformance:500};function m4($={}){if(typeof window>"u")return;b.enabled=!0,b.maxEvents=$.maxEvents||1000,b.maxPerformance=$.maxPerformance||500,window.__STX_DEVTOOLS__={getState:()=>b,getComponents:()=>Array.from(b.components.values()),getComponent:(X)=>b.components.get(X),getStores:()=>Array.from(b.stores.values()),getStore:(X)=>b.stores.get(X),getEvents:()=>b.events,getPerformance:()=>b.performance,selectComponent:(X)=>z5(X),selectStore:(X)=>c4(X),inspectElement:(X)=>l4(X),highlightComponent:(X)=>X7(X),clearHighlight:()=>Z7(),logComponentTree:()=>i4(),logStoreState:(X)=>a4(X),timeTravel:(X,Z)=>s4(X,Z)},n4(),r4(),console.log("%c[STX DevTools] Enabled","color: #10b981; font-weight: bold;")}function p4(){b.enabled=!1,delete window.__STX_DEVTOOLS__;let $=document.getElementById("stx-devtools-panel");if($)$.remove();console.log("%c[STX DevTools] Disabled","color: #ef4444;")}function o6($){if(!b.enabled)return;let X=b.components.get($);if(X){if(X.parentId){let Z=b.components.get(X.parentId);if(Z)Z.children=Z.children.filter((Q)=>Q!==$)}b.components.delete($),F5({timestamp:Date.now(),type:"component:unmounted",componentId:$,payload:{name:X.name}})}}function e6($,X,Z={},Q=[]){if(!b.enabled)return;let Y={id:$,state:X,getters:Z,actions:Q,history:[{timestamp:Date.now(),type:"state",name:"__init__",newValue:X}]};b.stores.set($,Y),F5({timestamp:Date.now(),type:"store:registered",payload:{id:$,state:X}})}function $7($,X,Z,Q,Y="state"){if(!b.enabled)return;let J=b.stores.get($);if(J){let G={timestamp:Date.now(),type:Y,name:X,oldValue:Z,newValue:Q,stack:Error().stack};if(J.history.push(G),J.history.length>100)J.history=J.history.slice(-100);if(Y==="state")J.state={...J.state,[X]:Q};F5({timestamp:Date.now(),type:`store:${Y}`,payload:{storeId:$,name:X,oldValue:Z,newValue:Q}})}}function F5($){if(!b.enabled)return;if(b.events.push($),b.events.length>b.maxEvents)b.events=b.events.slice(-b.maxEvents);if(typeof window<"u")window.dispatchEvent(new CustomEvent("stx:devtools:event",{detail:$}))}function z5($){b.selectedComponent=$;let X=b.components.get($);if(X)X7($),console.log("%c[STX DevTools] Selected component:","color: #3b82f6;",X);return X}function c4($){b.selectedStore=$;let X=b.stores.get($);if(X)console.log("%c[STX DevTools] Selected store:","color: #8b5cf6;",X);return X}function l4($){let X=$;while(X){let Z=X.getAttribute("data-stx-component-id");if(Z)return z5(Z);X=X.parentElement}console.log("%c[STX DevTools] No component found for element","color: #f59e0b;");return}function X7($){Z7();let X=b.components.get($);if(X?.element){let Z=document.createElement("div");Z.id="stx-devtools-highlight",Z.style.cssText=`
1627
+ Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),m0(Q1.url.toString(),()=>{if(J)D1();Q1.stop()}),X.native){let R,x=m.join(O,"index.stx");if(e.existsSync(x)){let y=await Bun.file(x).text();R=Z$(y)}let P=_?.app?.window??{};await W1(f0,{title:_?.app?.head?.title||m.basename(W)||"stx App",width:P.width,height:P.height,darkMode:P.darkMode,hotReload:P.hotReload,titlebarHidden:P.titlebarHidden??X.titlebarHidden===!0,nativeSidebar:!!R,sidebarConfig:R})}if(Q){console.log(`${B.blue}Watching for changes...${B.reset}`);let R=(p)=>{return p.startsWith("public/")||p.startsWith("public\\")},x=(p)=>{let u=p.toLowerCase();return u.endsWith(".stx")||u.endsWith(".html")||u.endsWith(".md")},P=new Map,y=()=>{let p=new Set([W,..._._layerGraph?.layers.map((u)=>u.root)??[],..._._layerGraph?.configDependencies.map((u)=>m.dirname(u))??[]].filter((u)=>e.existsSync(u)).map((u)=>e.realpathSync(u)));for(let u of _._layerGraph?.layers??[])for(let g of Object.values(u.resources)){if(!e.existsSync(g))continue;let h=e.realpathSync(g);if(![...p].some((Y0)=>h===Y0||h.startsWith(`${Y0}${m.sep}`)))p.add(h)}for(let[u,g]of P)if(!p.has(u))g.close(),P.delete(u);for(let u of p)if(!P.has(u)&&e.existsSync(u))P.set(u,e.watch(u,{recursive:!0},(g,h)=>{w0(u,g,h).catch((Y0)=>console.error("[stx] Layer rebuild failed:",Y0))}))},Z0=Promise.resolve(),w0=(p,u,g)=>{return Z0=Z0.catch(()=>{}).then(()=>h0(p,u,g)),Z0},h0=async(p,u,g)=>{if(!g||J$(g))return;if(Y$(g)){if(_._layerGraph){let h=await K(W);Object.assign(_,h),N.splice(0,N.length,...H$(H,{pagesDir:L,pagesDirs:h._layerPageDirs?[O,...h._layerPageDirs.slice(1)]:void 0})),y()}if(R(g)){if(console.log(`${B.cyan}${g} changed${B.reset}`),Y&&J)J.reload(g)}else if(x(g)){console.log(`${B.yellow}${g} changed, rebuilding...${B.reset}`),t0.clear(),e0();try{let{invalidateFileCache:h,templateCache:Y0}=await import("./chunk-b891w7hr.js");h(m.resolve(p,g)),Y0.delete(m.resolve(p,g))}catch{}if(I&&g){if(m.resolve(p,g)===I||m.basename(I)===g){let Y0=await B5(I,X.stxOptions||{});if(Y0)A=Y0}}if(await W0(),await F$(W),Y&&J)J.reload(g)}else{console.log(`${B.yellow}${g} changed, rebuilding...${B.reset}`),t0.clear(),e0();try{let{invalidateFileCache:h,templateCache:Y0}=await import("./chunk-b891w7hr.js");h(m.resolve(p,g)),Y0.delete(m.resolve(p,g))}catch{}if(await W0(),Y&&J)J.reload(g)}}else if(Q$(g)){if(console.log(`${B.cyan}CSS ${g} changed${B.reset}`),Y&&J)J.updateCss(g)}};y(),process.on("SIGINT",()=>{for(let p of P.values())p.close();if(J)D1();Q1.stop(),process.exit(0)})}return!0}var b={enabled:!1,components:new Map,stores:new Map,events:[],performance:[],selectedComponent:null,selectedStore:null,maxEvents:1000,maxPerformance:500};function m4($={}){if(typeof window>"u")return;b.enabled=!0,b.maxEvents=$.maxEvents||1000,b.maxPerformance=$.maxPerformance||500,window.__STX_DEVTOOLS__={getState:()=>b,getComponents:()=>Array.from(b.components.values()),getComponent:(X)=>b.components.get(X),getStores:()=>Array.from(b.stores.values()),getStore:(X)=>b.stores.get(X),getEvents:()=>b.events,getPerformance:()=>b.performance,selectComponent:(X)=>z5(X),selectStore:(X)=>c4(X),inspectElement:(X)=>l4(X),highlightComponent:(X)=>X7(X),clearHighlight:()=>Z7(),logComponentTree:()=>i4(),logStoreState:(X)=>a4(X),timeTravel:(X,Z)=>s4(X,Z)},n4(),r4(),console.log("%c[STX DevTools] Enabled","color: #10b981; font-weight: bold;")}function p4(){b.enabled=!1,delete window.__STX_DEVTOOLS__;let $=document.getElementById("stx-devtools-panel");if($)$.remove();console.log("%c[STX DevTools] Disabled","color: #ef4444;")}function o6($){if(!b.enabled)return;let X=b.components.get($);if(X){if(X.parentId){let Z=b.components.get(X.parentId);if(Z)Z.children=Z.children.filter((Q)=>Q!==$)}b.components.delete($),F5({timestamp:Date.now(),type:"component:unmounted",componentId:$,payload:{name:X.name}})}}function e6($,X,Z={},Q=[]){if(!b.enabled)return;let Y={id:$,state:X,getters:Z,actions:Q,history:[{timestamp:Date.now(),type:"state",name:"__init__",newValue:X}]};b.stores.set($,Y),F5({timestamp:Date.now(),type:"store:registered",payload:{id:$,state:X}})}function $7($,X,Z,Q,Y="state"){if(!b.enabled)return;let J=b.stores.get($);if(J){let G={timestamp:Date.now(),type:Y,name:X,oldValue:Z,newValue:Q,stack:Error().stack};if(J.history.push(G),J.history.length>100)J.history=J.history.slice(-100);if(Y==="state")J.state={...J.state,[X]:Q};F5({timestamp:Date.now(),type:`store:${Y}`,payload:{storeId:$,name:X,oldValue:Z,newValue:Q}})}}function F5($){if(!b.enabled)return;if(b.events.push($),b.events.length>b.maxEvents)b.events=b.events.slice(-b.maxEvents);if(typeof window<"u")window.dispatchEvent(new CustomEvent("stx:devtools:event",{detail:$}))}function z5($){b.selectedComponent=$;let X=b.components.get($);if(X)X7($),console.log("%c[STX DevTools] Selected component:","color: #3b82f6;",X);return X}function c4($){b.selectedStore=$;let X=b.stores.get($);if(X)console.log("%c[STX DevTools] Selected store:","color: #8b5cf6;",X);return X}function l4($){let X=$;while(X){let Z=X.getAttribute("data-stx-component-id");if(Z)return z5(Z);X=X.parentElement}console.log("%c[STX DevTools] No component found for element","color: #f59e0b;");return}function X7($){Z7();let X=b.components.get($);if(X?.element){let Z=document.createElement("div");Z.id="stx-devtools-highlight",Z.style.cssText=`
1628
1628
  position: absolute;
1629
1629
  background: rgba(59, 130, 246, 0.2);
1630
1630
  border: 2px solid #3b82f6;
@@ -2893,9 +2893,9 @@ describe('Example', () => {
2893
2893
  </footer>
2894
2894
  @yield('scripts')
2895
2895
  </body>
2896
- </html>`}function FZ(){return"<!-- Hero section -->"}function zZ(){return"<!-- Features -->"}function jZ(){return"<!-- Pricing -->"}function HZ(){return"<!-- Button -->"}function g1($){if(!v1($))V5($,{recursive:!0})}function OZ(){if(v1("bun.lockb"))return"bun";if(v1("pnpm-lock.yaml"))return"pnpm";if(v1("yarn.lock"))return"yarn";return"bun"}function M5($){return $.replace(/[-_\s]+(.)?/g,(X,Z)=>Z?Z.toUpperCase():"").replace(/^./,(X)=>X.toUpperCase())}function NZ($){return $.replace(/[-_\s]+(.)?/g,(X,Z)=>Z?Z.toUpperCase():"").replace(/^./,(X)=>X.toLowerCase())}function $1($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var{serve:qZ}=globalThis.Bun;import f1 from"fs";import D0 from"path";function YK($,X=200,Z={}){return new Response($,{status:X,headers:{"Content-Type":"text/html; charset=utf-8",...Z}})}async function E5($){let{loadStxConfig:X}=await import("./chunk-7r7qcpw2.js");return{...await X($.configDir??process.cwd()),...$.stxOptions??{}}}async function AZ($={}){let{port:X=3000,root:Z=".",watch:Q=!0,onRequest:Y,routes:J={},middleware:G=[],on404:W,onError:K}=$,_=D0.resolve(Z),U=await E5($),F=D0.resolve($.configDir??process.cwd()),z=await I5(F,U.serverApi),j=new Map;async function H(q){let A=f1.statSync(q),I=`${q}:${A.mtimeMs}`,E=j.get(I);if(E)return{content:E.content,status:E.status,headers:E.headers};for(let K0 of j.keys())if(K0.startsWith(`${q}:`)&&K0!==I)j.delete(K0);let w=await Bun.file(q).text(),D=w,T=K$(w);if(T)D=T.content.trim();let f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],v=[],S;while((S=f.exec(w))!==null){let K0=S[1],R=S[2],x=S[0];if(K0.includes("server"))v.push(R);else c.push(x)}let k=w.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi)||[],N0=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),W0={__filename:q,__dirname:D0.dirname(q),__stx_options:U};for(let K0 of v)await E0(K0,W0,q);let j0=await I0(N0,W0,q,U,new Set);if(k.length>0){let K0=k.join(`
2896
+ </html>`}function FZ(){return"<!-- Hero section -->"}function zZ(){return"<!-- Features -->"}function jZ(){return"<!-- Pricing -->"}function HZ(){return"<!-- Button -->"}function g1($){if(!v1($))V5($,{recursive:!0})}function OZ(){if(v1("bun.lockb"))return"bun";if(v1("pnpm-lock.yaml"))return"pnpm";if(v1("yarn.lock"))return"yarn";return"bun"}function M5($){return $.replace(/[-_\s]+(.)?/g,(X,Z)=>Z?Z.toUpperCase():"").replace(/^./,(X)=>X.toUpperCase())}function NZ($){return $.replace(/[-_\s]+(.)?/g,(X,Z)=>Z?Z.toUpperCase():"").replace(/^./,(X)=>X.toLowerCase())}function $1($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var{serve:qZ}=globalThis.Bun;import f1 from"fs";import D0 from"path";function YK($,X=200,Z={}){return new Response($,{status:X,headers:{"Content-Type":"text/html; charset=utf-8",...Z}})}async function E5($){let{loadStxConfig:X}=await import("./chunk-z523bq9b.js");return{...await X($.configDir??process.cwd()),...$.stxOptions??{}}}async function AZ($={}){let{port:X=3000,root:Z=".",watch:Q=!0,onRequest:Y,routes:J={},middleware:G=[],on404:W,onError:K}=$,_=D0.resolve(Z),U=await E5($),F=D0.resolve($.configDir??process.cwd()),z=await I5(F,U.serverApi),j=new Map;async function H(q){let A=f1.statSync(q),I=`${q}:${A.mtimeMs}`,E=j.get(I);if(E)return{content:E.content,status:E.status,headers:E.headers};for(let K0 of j.keys())if(K0.startsWith(`${q}:`)&&K0!==I)j.delete(K0);let w=await Bun.file(q).text(),D=w,T=K$(w);if(T)D=T.content.trim();let f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],v=[],S;while((S=f.exec(w))!==null){let K0=S[1],R=S[2],x=S[0];if(K0.includes("server"))v.push(R);else c.push(x)}let k=w.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi)||[],N0=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),W0={__filename:q,__dirname:D0.dirname(q),__stx_options:U};for(let K0 of v)await E0(K0,W0,q);let j0=await I0(N0,W0,q,U,new Set);if(k.length>0){let K0=k.join(`
2897
2897
  `);if(j0.match(/(<\/head>)/i))j0=j0.replace(/(<\/head>)/i,`${K0}
2898
- $1`)}if(c.length>0){let{interpolateScriptsInTemplate:K0}=await import("./chunk-scn75qrm.js"),R=K0(c.join(`
2898
+ $1`)}if(c.length>0){let{interpolateScriptsInTemplate:K0}=await import("./chunk-kjkkh5p6.js"),R=K0(c.join(`
2899
2899
  `),W0);if(j0.match(/(<\/body>)/i))j0=j0.replace(/(<\/body>)/i,`${R}
2900
2900
  $1`);else j0+=`
2901
2901
  ${R}`}let Q1=T1(W0),i$=C1(W0);return j.set(I,{content:j0,mtime:A.mtimeMs,status:Q1,headers:i$}),{content:j0,status:Q1,headers:i$}}async function L(q){let A=f1.statSync(q),I=`${q}:${A.mtimeMs}`,E=j.get(I);if(E)return E.content;let{content:w}=await k0(q,U);return j.set(I,{content:w,mtime:A.mtimeMs}),w}function O(q){let A=q.startsWith("/")?q.slice(1):q,I=[A,`${A}.stx`,`${A}.md`,`${A}.html`,D0.join(A,"index.stx"),D0.join(A,"index.md"),D0.join(A,"index.html")];for(let E of[_,...U._layerPageDirs??[]])for(let w of I){let D=D0.resolve(E,w);if(!D.startsWith(`${D0.resolve(E)}${D0.sep}`))continue;if(f1.existsSync(D)&&f1.statSync(D).isFile())return D}return null}async function N(q){if(U._layerGraph){let E=await E5($);if(E._layerGraph!==U._layerGraph)Object.assign(U,E),j.clear()}let A=new URL(q.url),I=async()=>{if(J[A.pathname])return await J[A.pathname](q);if(Y){let D=await Y(q);if(D)return D}if(U.apiRouter){let D=await U.apiRouter.handleRequest(q);if(D.status!==404)return D}if(U.apiRoutes?.[A.pathname])return U.apiRoutes[A.pathname](q);let E=await z(q);if(E)return E;let w=O(A.pathname);if(!w||N7(w,F,U.serverApi)){if(W)return await W(q);return new Response("Not Found",{status:404})}try{let D,T="text/html",f,c;if(w.endsWith(".stx")){let v=await H(w);D=v.content,f=v.status,c=v.headers}else if(w.endsWith(".md"))D=await L(w);else if(w.endsWith(".html"))D=await Bun.file(w).text();else if(w.endsWith(".css"))D=await Bun.file(w).text(),T="text/css";else if(w.endsWith(".js"))D=await Bun.file(w).text(),T="text/javascript";else if(w.endsWith(".json"))D=await Bun.file(w).text(),T="application/json";else return new Response(Bun.file(w));return new Response(D,{status:f??200,headers:{"Content-Type":T,...c}})}catch(D){if(K)return await K(D,q);let T=D instanceof Error?D.message:String(D),c=U?.debug===!0?`<h1>Error</h1><pre>${T}
@@ -4329,7 +4329,7 @@ else {
4329
4329
  \u26A0\uFE0F Built ${Z.views.length} views with ${Z.errors.length} errors`);return Z}function q_($,X){let Z=T$.watch($.viewsDir,{recursive:!0},async(Q,Y)=>{if(!Y)return;if(Y.endsWith(".stx")||Y.endsWith(".ts")||Y.endsWith(".js")){if($.debug)console.log(`
4330
4330
  File changed: ${Y}, rebuilding...`);let J=await pQ($);X?.(J)}});return{close:()=>Z.close()}}async function A_($,X={},Z={}){let Q={...Z,skipDefaultSeoTags:!0,skipSignalsRuntime:!0},Y=await v8($,X,Q);Y=await cQ(Y),Y=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Y=Y.replace(/<style\b([^>]*)>[\s\S]*?<\/style>/gi,(G,W)=>/\bdata-(?:css=["']generated["']|stx-)/i.test(W)?"":G),Y=Y.replace(/<!--\s*stx SEO Tags\s*-->/gi,""),Y=Y.replace(/\n\s*\n\s*\n/g,`
4331
4331
 
4332
- `).trim();let J=aQ(Y);return{html:Y,text:J}}async function cQ($){try{let{generateCss:X,extractClassNames:Z}=await import("./chunk-ezwtd7s2.js");if(Z($).size===0)return $;let Y=await X($);if(!Y)return $;let J=lQ(Y);if(J.size===0)return $;return $.replace(/(<[a-z][a-z0-9]*)((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s+)class\s*=\s*"([^"]*)"((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?>)/gi,(G,W,K,_,U,F)=>{let z=_.split(/\s+/).filter(Boolean),j=[];for(let N of z){let V=J.get(N);if(V)j.push(V)}if(j.length===0)return`${W}${K}class="${_}"${U}${F}`;let H=j.join("; "),O=`${K}${U}`.match(/style\s*=\s*"([^"]*)"/);if(O){let N=`${H}; ${O[1]}`,V=K.replace(/style\s*=\s*"[^"]*"/,`style="${N}"`),M=U.replace(/style\s*=\s*"[^"]*"/,`style="${N}"`);return`${W}${V}class="${_}"${M}${F}`}return`${W}${K}class="${_}" style="${H}"${U}${F}`})}catch{return $}}function lQ($){let X=new Map,Z=/\.([a-zA-Z0-9_-]+(?:\\:[a-zA-Z0-9_-]+)*)\s*\{([^}]+)\}/g,Q=Z.exec($);while(Q!==null){let Y=Q[1].replace(/\\/g,""),J=Q[2].split(";").map((G)=>G.trim()).filter(Boolean).join("; ");if(J)X.set(Y,J);Q=Z.exec($)}return X}function iQ($,X){let Z=X.replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim(),Q=$.replace(/&amp;/g,"&").trim();if(!Q||Q.startsWith("#")||/^javascript:/i.test(Q))return Z;let Y=Q.replace(/^mailto:/i,"").replace(/^https?:\/\//i,"").replace(/\/$/,"");if(!Z)return Q.replace(/^mailto:/i,"");if(Z.replace(/^https?:\/\//i,"").replace(/\/$/,"")===Y)return Z;return`${Z} (${Q.replace(/^mailto:/i,"")})`}function aQ($){return $.replace(/<head\b[\s\S]*?<\/head>/gi,"").replace(/<(style|script)\b[\s\S]*?<\/\1>/gi,"").replace(/<(div|span|p)\b[^>]*\bstyle="[^"]*display:\s*none[^"]*"[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<a\b[^>]*?\bhref\s*=\s*(?:"([^"]*)"|'([^']*)')[^>]*>([\s\S]*?)<\/a>/gi,(X,Z,Q,Y)=>iQ(Z??Q??"",Y)).replace(/<br\s*\/?>/gi,`
4332
+ `).trim();let J=aQ(Y);return{html:Y,text:J}}async function cQ($){try{let{generateCss:X,extractClassNames:Z}=await import("./chunk-qnq99ej3.js");if(Z($).size===0)return $;let Y=await X($);if(!Y)return $;let J=lQ(Y);if(J.size===0)return $;return $.replace(/(<[a-z][a-z0-9]*)((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s+)class\s*=\s*"([^"]*)"((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?>)/gi,(G,W,K,_,U,F)=>{let z=_.split(/\s+/).filter(Boolean),j=[];for(let N of z){let V=J.get(N);if(V)j.push(V)}if(j.length===0)return`${W}${K}class="${_}"${U}${F}`;let H=j.join("; "),O=`${K}${U}`.match(/style\s*=\s*"([^"]*)"/);if(O){let N=`${H}; ${O[1]}`,V=K.replace(/style\s*=\s*"[^"]*"/,`style="${N}"`),M=U.replace(/style\s*=\s*"[^"]*"/,`style="${N}"`);return`${W}${V}class="${_}"${M}${F}`}return`${W}${K}class="${_}" style="${H}"${U}${F}`})}catch{return $}}function lQ($){let X=new Map,Z=/\.([a-zA-Z0-9_-]+(?:\\:[a-zA-Z0-9_-]+)*)\s*\{([^}]+)\}/g,Q=Z.exec($);while(Q!==null){let Y=Q[1].replace(/\\/g,""),J=Q[2].split(";").map((G)=>G.trim()).filter(Boolean).join("; ");if(J)X.set(Y,J);Q=Z.exec($)}return X}function iQ($,X){let Z=X.replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim(),Q=$.replace(/&amp;/g,"&").trim();if(!Q||Q.startsWith("#")||/^javascript:/i.test(Q))return Z;let Y=Q.replace(/^mailto:/i,"").replace(/^https?:\/\//i,"").replace(/\/$/,"");if(!Z)return Q.replace(/^mailto:/i,"");if(Z.replace(/^https?:\/\//i,"").replace(/\/$/,"")===Y)return Z;return`${Z} (${Q.replace(/^mailto:/i,"")})`}function aQ($){return $.replace(/<head\b[\s\S]*?<\/head>/gi,"").replace(/<(style|script)\b[\s\S]*?<\/\1>/gi,"").replace(/<(div|span|p)\b[^>]*\bstyle="[^"]*display:\s*none[^"]*"[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<a\b[^>]*?\bhref\s*=\s*(?:"([^"]*)"|'([^']*)')[^>]*>([\s\S]*?)<\/a>/gi,(X,Z,Q,Y)=>iQ(Z??Q??"",Y)).replace(/<br\s*\/?>/gi,`
4333
4333
  `).replace(/<\/(p|div|h[1-6]|li|tr)>/gi,`
4334
4334
  `).replace(/<\/td>/gi,"\t").replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&copy;/g,"(c)").replace(/&middot;/g,"-").replace(/\n\s*\n\s*\n/g,`
4335
4335
 
@@ -4399,7 +4399,7 @@ ${I}`}function F0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").repla
4399
4399
  `;let Z=$.sitemap!==!1?`Sitemap: ${$.url.replace(/\/$/,"")}/sitemap.xml
4400
4400
  `:"";if(X==="disallow")return["User-agent: *","Disallow: /","",Z].filter(Boolean).join(`
4401
4401
  `);return["User-agent: *","Allow: /","",Z].filter(Boolean).join(`
4402
- `)}var V1=null;async function NY(){if(V1!==null)return V1;try{let $=await import("./chunk-9a79ev5a.js");if(typeof $.getRouterScript==="function")V1=$.getRouterScript();else V1=""}catch{V1=""}return V1}async function l5($,X){let Z=await NY();if(!Z)return $;let Q={interceptAllLinks:!0,container:"main",...X},J=`${`<script>window.__stxRouterConfig=${JSON.stringify(Q)};</script>
4402
+ `)}var V1=null;async function NY(){if(V1!==null)return V1;try{let $=await import("./chunk-zwb8wv5p.js");if(typeof $.getRouterScript==="function")V1=$.getRouterScript();else V1=""}catch{V1=""}return V1}async function l5($,X){let Z=await NY();if(!Z)return $;let Q={interceptAllLinks:!0,container:"main",...X},J=`${`<script>window.__stxRouterConfig=${JSON.stringify(Q)};</script>
4403
4403
  `}<script>${Z}</script>`;if(/<\/body>/i.test($))return $.replace(/<\/body>/i,`${J}
4404
4404
  </body>`);return`${$}
4405
4405
  ${J}`}var qY=`window.__stxThemeIcon=function(isDark){try{var want=isDark?'dark':'light';var pick=document.querySelector('link[rel~="icon"][media*="prefers-color-scheme: '+want+'"]');if(!pick)return;var live=document.querySelector('link[rel~="icon"]:not([media])');if(!live){live=document.createElement('link');live.setAttribute('rel','icon');document.head.appendChild(live)}if(pick.type)live.setAttribute('type',pick.type);var href=pick.getAttribute('href');if(live.getAttribute('href')!==href)live.setAttribute('href',href)}catch(e){}};`,AY=($,X,Z,Q)=>`(function(){${qY}function read(){try{var k=${JSON.stringify(X)};var t=localStorage.getItem(k);return t===null?(${JSON.stringify($)}==='dark'||(${JSON.stringify($)}==='auto'&&window.matchMedia('(prefers-color-scheme: dark)').matches)):t==='dark'}catch(e){return ${JSON.stringify($)}==='dark'}}function apply(){var isDark=read();var html=document.documentElement;html.classList[isDark?'add':'remove']('dark');var color=isDark?${JSON.stringify(Q)}:${JSON.stringify(Z)};if(!document.head)return;var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(!tc){tc=document.createElement('meta');tc.setAttribute('name','theme-color');tc.setAttribute('data-stx-theme-meta','1')}tc.setAttribute('content',color);if(tc!==document.head.firstChild){document.head.insertBefore(tc,document.head.firstChild)}if(window.__stxThemeIcon)window.__stxThemeIcon(isDark)}apply();window.addEventListener('stx:navigate',apply);window.addEventListener('popstate',apply)})();`,VY=($,X,Z)=>`document.addEventListener('click',function(e){var t=e.target&&e.target.closest&&e.target.closest('#theme-toggle');if(!t)return;var html=document.documentElement;var isDark=html.classList.toggle('dark');try{localStorage.setItem(${JSON.stringify($)},isDark?'dark':'light')}catch(e){}var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(tc)tc.setAttribute('content',isDark?${JSON.stringify(Z)}:${JSON.stringify(X)});if(window.__stxThemeIcon)window.__stxThemeIcon(isDark)});`;function b$($,X){if(X.theme===!1)return $;let Z=$.includes(t8),Q=typeof X.theme==="object"&&X.theme!==null?X.theme:{},Y=Q.default??"dark",J=Q.storageKey??"theme",G=Q.colors?.light??"#ffffff",W=Q.colors?.dark??"#000000";if(Y==="dark"&&!Z){if(!/<html\b[^>]*\bclass=/.test($))$=$.replace(/<html\b([^>]*)>/i,'<html$1 class="dark">');else if(!/<html\b[^>]*\bclass="[^"]*\bdark\b/.test($))$=$.replace(/<html\b([^>]*\bclass=")([^"]*)(")/i,"<html$1$2 dark$3")}if(!$.includes("data-stx-theme-meta")&&/<head\b[^>]*>/i.test($)){let K=['<meta name="color-scheme" content="dark light" data-stx-theme-meta="1">',`<meta name="theme-color" media="(prefers-color-scheme: light)" content="${G}" data-stx-theme-meta="1">`,`<meta name="theme-color" media="(prefers-color-scheme: dark)" content="${W}" data-stx-theme-meta="1">`].join(`
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ji as a,ki as b,li as c}from"./chunk-bssgvjge.js";import"./chunk-g0w8dyat.js";import"./chunk-t0p5yhgf.js";import"./chunk-2q216yrr.js";import"./chunk-dxjtszaa.js";import"./chunk-0svp7s94.js";import"./chunk-ffdxdgep.js";import"./chunk-m8bdy2wt.js";import"./chunk-0n054h7w.js";import"./chunk-wpsx5avz.js";import"./chunk-tfy07tmv.js";import"./chunk-s6c3ymq1.js";import"./chunk-pgeh4g3a.js";import"./chunk-z9a0ft6h.js";import"./chunk-v1ezqvek.js";import"./chunk-7q06md6v.js";import"./chunk-1phxzej9.js";import"./chunk-7ba7x6jt.js";import"./chunk-akzmq0jr.js";import"./chunk-c1f1vtjt.js";import"./chunk-0nhpymyy.js";import"./chunk-4md4tj27.js";import"./chunk-z8zmp74b.js";import"./chunk-qcpnfw0k.js";import"./chunk-59pakqdv.js";import"./chunk-x7qyx7vn.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
@@ -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 ws,$ as xs};
3
+ export{X as xs,$ as ys};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{createHash as Y}from"crypto";import{readFile as M,stat as w}from"fs/promises";async function G(q){try{let z=await M(q);return Y("sha256").update(z).digest("hex").slice(0,16)}catch{return""}}function u(q){return Y("sha256").update(q).digest("hex").slice(0,16)}function $(q){return Y("sha256").update(q).digest("hex").slice(0,16)}function X(q,z){let B=JSON.stringify(z,Object.keys(z).sort());return`${$(q)}-${$(B)}`}async function Z(q){try{return(await w(q)).mtimeMs}catch{return 0}}async function b(q){try{return await w(q),!0}catch{return!1}}import{mkdir as S,readFile as V,writeFile as E,readdir as A,rm as _,stat as j}from"fs/promises";import{join as U,dirname as x}from"path";var R=new Map,W={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function F(q){try{await S(q,{recursive:!0})}catch{}}function K(q,z,B){return U(q,B,`${z}.json`)}async function v(q,z,B){if((Date.now()-q.createdAt)/86400000>B)return!1;if(await Z(z)!==q.srcMtime)return!1;return!0}async function g(q,z,B,J=W){if(!J.enabled)return null;let I=X(q,z),L=R.get(I);if(L){if(await v(L,q,J.maxAge))return L.lastAccessedAt=Date.now(),L.data;R.delete(I)}let Q=K(J.directory,I,B);if(await b(Q))try{let N=await V(Q,"utf-8"),O=JSON.parse(N);if(await v(O,q,J.maxAge))return O.lastAccessedAt=Date.now(),R.set(I,O),O.data}catch{}return null}async function l(q,z,B,J,I=W){if(!I.enabled)return;let L=X(q,z),Q=await G(q),N=await Z(q),O={key:L,src:q,srcHash:Q,srcMtime:N,optionsHash:X("",z),data:B,createdAt:Date.now(),lastAccessedAt:Date.now()};R.set(L,O);let T=K(I.directory,L,J);try{await F(x(T)),await E(T,JSON.stringify(O,null,2))}catch(H){console.warn(`[stx-media] Failed to write cache: ${H}`)}}async function m(q,z=W){if(q==="all")R.clear();else R.clear();let B=q==="all"?["image","video"]:[q];for(let J of B){let I=U(z.directory,J);try{await _(I,{recursive:!0,force:!0})}catch{}}}async function y(q=W){let z={memoryEntries:R.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let B of["image","video"]){let J=U(q.directory,B);try{let I=await A(J);z.diskEntries[B]=I.length;for(let L of I){let Q=U(J,L),N=await j(Q);z.totalSizeMB+=N.size/1048576}}catch{}}return z}async function f(q=W){let z=0,B=q.maxAge*24*60*60*1000;for(let J of["image","video"]){let I=U(q.directory,J);try{let L=await A(I);for(let Q of L){let N=U(I,Q);try{let O=await V(N,"utf-8"),T=JSON.parse(O);if(Date.now()-T.createdAt>B)await _(N),R.delete(T.key),z++}catch{await _(N).catch(()=>{}),z++}}}catch{}}return z}
3
- export{G as mh,u as nh,$ as oh,X as ph,Z as qh,b as rh,g as sh,l as th,m as uh,y as vh,f as wh};
3
+ export{G as nh,u as oh,$ as ph,X as qh,Z as rh,b as sh,g as th,l as uh,m as vh,y as wh,f as xh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ev as a,Fv as b}from"./chunk-0nhpymyy.js";import"./chunk-x7qyx7vn.js";export{b as warnUnbalancedTags,a as findUnbalancedTags};
@@ -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 Mh,I as Nh,E as Oh,V as Ph,f as Qh,b as Rh,H as Sh,S as Th,h as Uh,g as Vh,v as Wh,u as Xh,x as Yh,y as Zh,r as _h};
397
+ export{B as Nh,I as Oh,E as Ph,V as Qh,f as Rh,b as Sh,H as Th,S as Uh,h as Vh,g as Wh,v as Xh,u as Yh,x as Zh,y as _h,r as $h};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{vi as a,wi as b,xi as c,yi as d,zi as e}from"./chunk-twg0y6ga.js";import"./chunk-x7qyx7vn.js";export{c as renderSSRSuspense,a as processSuspenseDirectives,e as generateSuspenseRuntime,d as generateSuspenseCSS,b as createSSRSuspense};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ye as a}from"./chunk-86evvtw4.js";import"./chunk-1n2ng8nx.js";import"./chunk-0svp7s94.js";import"./chunk-ffdxdgep.js";import"./chunk-m8bdy2wt.js";import"./chunk-0n054h7w.js";import"./chunk-wpsx5avz.js";import"./chunk-tfy07tmv.js";import"./chunk-s6c3ymq1.js";import"./chunk-pgeh4g3a.js";import"./chunk-z9a0ft6h.js";import"./chunk-v1ezqvek.js";import"./chunk-7q06md6v.js";import"./chunk-1phxzej9.js";import"./chunk-7ba7x6jt.js";import"./chunk-akzmq0jr.js";import"./chunk-c1f1vtjt.js";import"./chunk-0nhpymyy.js";import"./chunk-4md4tj27.js";import"./chunk-z8zmp74b.js";import"./chunk-qcpnfw0k.js";import"./chunk-59pakqdv.js";import"./chunk-x7qyx7vn.js";export{a as buildApp};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$o as c,Zo as a,_o as b,ap as d,bp as e,cp as f,dp as g}from"./chunk-0svp7s94.js";import"./chunk-ffdxdgep.js";import"./chunk-m8bdy2wt.js";import"./chunk-0n054h7w.js";import"./chunk-wpsx5avz.js";import"./chunk-tfy07tmv.js";import"./chunk-s6c3ymq1.js";import"./chunk-pgeh4g3a.js";import"./chunk-z9a0ft6h.js";import"./chunk-v1ezqvek.js";import"./chunk-7q06md6v.js";import"./chunk-1phxzej9.js";import"./chunk-7ba7x6jt.js";import"./chunk-akzmq0jr.js";import"./chunk-c1f1vtjt.js";import"./chunk-0nhpymyy.js";import"./chunk-4md4tj27.js";import"./chunk-z8zmp74b.js";import"./chunk-qcpnfw0k.js";import"./chunk-59pakqdv.js";import"./chunk-x7qyx7vn.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 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 xt,K as yt,O as zt,H as At,Q as Bt,W as Ct};
3
+ export{G as yt,K as zt,O as At,H as Bt,Q as Ct,W as Dt};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$t as d,Yt as a,Zt as b,_t as c,au as e,bu as f,cu as g,du as h,eu as i,fu as j,gu as k,hu as l}from"./chunk-9rp8f7jz.js";import"./chunk-8ghwewek.js";import"./chunk-rk8p4b1z.js";import"./chunk-d6rkgay9.js";import"./chunk-cevkpyn9.js";export{f as structuredDataDirective,j as scanForSitemapEntries,g as registerSeoDirectives,b as processStructuredData,c as processSeoDirective,a as processMetaDirectives,e as metaDirective,d as injectSeoTags,i as generateSitemapIndex,h as generateSitemap,k as generateRobotsTxt,l as generateDefaultRobotsTxt};
2
+ import{$t as c,Zt as a,_t as b,au as d,bu as e,cu as f,du as g,eu as h,fu as i,gu as j,hu as k,iu as l}from"./chunk-1phxzej9.js";import"./chunk-7ba7x6jt.js";import"./chunk-akzmq0jr.js";import"./chunk-59pakqdv.js";import"./chunk-x7qyx7vn.js";export{f as structuredDataDirective,j as scanForSitemapEntries,g as registerSeoDirectives,b as processStructuredData,c as processSeoDirective,a as processMetaDirectives,e as metaDirective,d as injectSeoTags,i as generateSitemapIndex,h as generateSitemap,k as generateRobotsTxt,l as generateDefaultRobotsTxt};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{mg as e,og as kF,pg as UF,qg as wF,yg as EF}from"./chunk-eg30ksd8.js";import{Bg as BF}from"./chunk-g64qyhhb.js";import{rj as l,sj as d}from"./chunk-szcxpbfn.js";import{Gk as HF,Hk as IF,Ik as KF}from"./chunk-7eea1cse.js";import{ql as YF,sl as ZF}from"./chunk-etah20m0.js";import{$m as s,Er as t,Gr as M,Ip as GF,Qp as VF,Up as r,Zp as o,no as zF,qp as $F,rm as p,tm as i}from"./chunk-ptad3t7a.js";import{Gs as XF}from"./chunk-wheh08v2.js";import{wt as qF}from"./chunk-ndydf37f.js";import{Qt as WF}from"./chunk-jbtzq3xt.js";import{Vt as QF}from"./chunk-mjearf0g.js";import{Lw as h,Ow as _F}from"./chunk-qbc0bebg.js";import G from"fs";import q from"path";import{createHash as NF}from"crypto";_F();function u(Q){return NF("sha256").update(Q).digest("hex").slice(0,8)}function c(Q=!1){let z=Q?d():l(),Z=u(z);return{content:z,filename:`runtime.${Z}.js`,hash:Z}}function a(){let Q=h(),z=u(Q);return{content:Q,filename:`router.${z}.js`,hash:z}}function bF(Q){return{runtimeTag:Q.runtime?`<script src="/__stx/${Q.runtime.filename}"></script>`:"",routerTag:Q.router?`<script src="/__stx/${Q.router.filename}"></script>`:"",cssTag:Q.css?`<link rel="stylesheet" href="/__stx/${Q.css.filename}">`:""}}import n from"path";import{createHash as OF}from"crypto";function TF(Q={}){let z=new Set;return{context:new Proxy(Q,{get(X,F){if(F in X)return X[F];if(typeof F==="string"&&!F.startsWith("__"))z.add(F);return},has(X,F){if(F in X)return!0;if(typeof F==="string"&&!F.startsWith("__"))z.add(F);return!1}}),accessedKeys:z}}async function FF(Q,z,Z={}){let X=n.resolve(Q),F=await Bun.file(X).text(),U=OF("sha256").update(F).digest("hex").slice(0,16);p();let w={};try{w=await M(Z.configDir)}catch{}let H=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(F))!==null){let E=k[1];if(/\bserver\b/.test(E))H.push(k[2])}let W=new Set(H.flatMap((E)=>o(E))),{context:_}=TF({__filename:X,__dirname:n.dirname(X),__stx_serverDeclared:W}),N=new Set,x={...t,...w,...Z,buildMode:"compile",strict:!1},I=await r(F,_,X,x,N),O=e(I),j=i();return{route:z,sourceFile:Q,html:I,fragment:O,placeholders:j,hasServerScripts:H.length>0,serverScriptContent:H,dependencies:Array.from(N),contentHash:U,status:s(F),streamTemplates:_.__streamTemplates}}var MF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function JF(Q,z){let Z=0,X=0;if(!G.existsSync(Q))return{copied:Z,bytes:X};G.mkdirSync(z,{recursive:!0});function F(U,w){let H=G.readdirSync(U,{withFileTypes:!0});for(let V of H){if(MF.has(V.name))continue;let k=q.join(U,V.name),W=q.join(w,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),F(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),Z++,X+=G.statSync(W).size}}}return F(Q,z),{copied:Z,bytes:X}}async function qJ(Q={}){let z=Date.now(),Z=q.resolve(Q.root||process.cwd()),X=q.resolve(Z,Q.outputDir||".output");console.log("[stx build] Starting production build...");let F=await M(Z),U=q.resolve(Z,Q.componentsDir??F.componentsDir??"components"),w=q.resolve(Z,Q.partialsDir??F.partialsDir??"partials"),H=q.resolve(Z,Q.layoutsDir??F.layoutsDir??"layouts"),V=Q.publicDir??F.publicDir??"public",k=F.app?.head||{},W=F.app?.colorMode,_=F.router?.container||"main",N=Q.routeRules??F.routeRules??{},x=BF(N),I=Q.serverApi??F.serverApi,O=typeof I==="object"?I:{};if(I)YF(Z,O);if(F.runtimeConfig)QF(F.runtimeConfig,{});if(G.existsSync(X))G.rmSync(X,{recursive:!0});let j=[q.join(X,"public","__stx"),q.join(X,"public","assets"),q.join(X,"server","pages"),q.join(X,"server","fragments")];for(let Y of j)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let E=zF(Z,{pagesDirs:F._layerPageDirs}),LF=["components","layouts","partials"],y=E.filter((Y)=>{return!LF.some((B)=>Y.pattern.startsWith(`/${B}/`)||Y.pattern===`/${B}`)});console.log(`[stx build] Found ${y.length} page routes (${E.length-y.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let L=c(Q.debug),K=a();await Bun.write(q.join(X,"public","__stx",L.filename),L.content),await Bun.write(q.join(X,"public","__stx",K.filename),K.content),console.log(`[stx build] Runtime: ${L.filename} (${(L.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${K.filename} (${(K.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let R=[],v=[];for(let Y of y){let B=x(Y.pattern),b=B.rendering==="prerender";if(b&&(Y.pattern.includes(":")||Y.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${Y.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let J=await FF(Y.filePath,Y.pattern,{configDir:Z,componentsDir:U,partialsDir:w,layoutsDir:H,debug:Q.debug});if(R.push(J),J.html=J.html.replace(/runtime\.__STX_HASH__\.js/g,L.filename).replace(/router\.__STX_HASH__\.js/g,K.filename),J.html=VF(J.html,k,{bodyScripts:[`<script src="/__stx/${K.filename}"></script>`],...W&&{colorMode:W}}),W)J.html=$F(J.html,W);if(k.htmlAttrs)J.html=GF(J.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(J.html)){let $=J.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if($&&$[1]){let m=$[1];J.html=J.html.replace(" "+m,""),J.html=J.html.replace(/<body([^>]*)>/,`<body$1 ${m}>`)}}if(J.html=J.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),J.html=await qF(J.html),b){let $=await EF(J,{params:{},request:new Request(`http://stx.build${Y.pattern}`),method:"GET",__stx_strict_hydration:!0});if($.redirect||$.cookies?.length||$.boundaries?.length||$.headers&&Object.keys($.headers).length)throw Error(`Prerendered route ${Y.pattern} cannot set response headers/cookies, redirect or stream`);J.html=$.html,J.status=$.status??J.status,J.hasServerScripts=!1,J.serverScriptContent=[],J.placeholders={}}J.fragment=kF(J.html,_);let C=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),g=q.join("server","pages",`${C}.compiled.json`),f=q.join("server","fragments",`${C}.html`);await Bun.write(q.join(X,g),JSON.stringify(J,null,2)),await Bun.write(q.join(X,f),J.fragment),v.push({pattern:Y.pattern,compiledPath:g,fragmentPath:f,isDynamic:J.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("["),prerendered:b}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(J){if(Object.keys(B).length)throw J;console.error(`[stx build] \u2717 ${Y.pattern}:`,J instanceof Error?J.message:J)}}let P=q.resolve(Z,V);if(G.existsSync(P)){let{copied:Y,bytes:B}=JF(P,q.join(X,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(B/1024).toFixed(1)}KB) from ${V}/`)}let A=KF(Z);if(A){let{copied:Y,bytes:B}=JF(A,q.join(X,"public",IF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(B/1024).toFixed(1)}KB) from ${HF}/`)}let S={runtime:L.filename,router:K.filename},T=UF(v,S,X);if(T.routeRules=N,T.routerContainer=_,I)T.apiRoutes=await ZF(Z,X,O);if(F.runtimeConfig)await Bun.write(q.join(X,"server/runtime-config.json"),JSON.stringify(F.runtimeConfig)),await WF(Z,F.runtimeConfig);if(F._layerGraph)await Bun.write(q.join(X,"server/layers.json"),JSON.stringify(XF(F._layerGraph),null,2));wF(T,X);let D=Date.now()-z;return console.log(`
2
+ import{mg as e,pg as kF,qg as UF,rg as wF,zg as EF}from"./chunk-s7jkyw9t.js";import{Cg as BF}from"./chunk-1n2ng8nx.js";import{sj as l,tj as d}from"./chunk-1x6c4ys1.js";import{Hk as HF,Ik as IF,Jk as KF}from"./chunk-rqr735w8.js";import{rl as YF,tl as ZF}from"./chunk-2q216yrr.js";import{Fr as t,Hr as M,Jp as GF,Rp as VF,Vp as r,_p as o,an as s,oo as zF,rp as $F,sm as p,um as i}from"./chunk-0svp7s94.js";import{Hs as XF}from"./chunk-wpsx5avz.js";import{xt as qF}from"./chunk-s6c3ymq1.js";import{Rt as WF}from"./chunk-v1ezqvek.js";import{Wt as QF}from"./chunk-7q06md6v.js";import{Mw as h,Pw as _F}from"./chunk-z8zmp74b.js";import G from"fs";import q from"path";import{createHash as NF}from"crypto";_F();function u(Q){return NF("sha256").update(Q).digest("hex").slice(0,8)}function c(Q=!1){let z=Q?d():l(),Z=u(z);return{content:z,filename:`runtime.${Z}.js`,hash:Z}}function a(){let Q=h(),z=u(Q);return{content:Q,filename:`router.${z}.js`,hash:z}}function bF(Q){return{runtimeTag:Q.runtime?`<script src="/__stx/${Q.runtime.filename}"></script>`:"",routerTag:Q.router?`<script src="/__stx/${Q.router.filename}"></script>`:"",cssTag:Q.css?`<link rel="stylesheet" href="/__stx/${Q.css.filename}">`:""}}import n from"path";import{createHash as OF}from"crypto";function TF(Q={}){let z=new Set;return{context:new Proxy(Q,{get(X,F){if(F in X)return X[F];if(typeof F==="string"&&!F.startsWith("__"))z.add(F);return},has(X,F){if(F in X)return!0;if(typeof F==="string"&&!F.startsWith("__"))z.add(F);return!1}}),accessedKeys:z}}async function FF(Q,z,Z={}){let X=n.resolve(Q),F=await Bun.file(X).text(),U=OF("sha256").update(F).digest("hex").slice(0,16);p();let w={};try{w=await M(Z.configDir)}catch{}let H=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(F))!==null){let E=k[1];if(/\bserver\b/.test(E))H.push(k[2])}let W=new Set(H.flatMap((E)=>o(E))),{context:_}=TF({__filename:X,__dirname:n.dirname(X),__stx_serverDeclared:W}),N=new Set,x={...t,...w,...Z,buildMode:"compile",strict:!1},I=await r(F,_,X,x,N),O=e(I),j=i();return{route:z,sourceFile:Q,html:I,fragment:O,placeholders:j,hasServerScripts:H.length>0,serverScriptContent:H,dependencies:Array.from(N),contentHash:U,status:s(F),streamTemplates:_.__streamTemplates}}var MF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function JF(Q,z){let Z=0,X=0;if(!G.existsSync(Q))return{copied:Z,bytes:X};G.mkdirSync(z,{recursive:!0});function F(U,w){let H=G.readdirSync(U,{withFileTypes:!0});for(let V of H){if(MF.has(V.name))continue;let k=q.join(U,V.name),W=q.join(w,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),F(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),Z++,X+=G.statSync(W).size}}}return F(Q,z),{copied:Z,bytes:X}}async function qJ(Q={}){let z=Date.now(),Z=q.resolve(Q.root||process.cwd()),X=q.resolve(Z,Q.outputDir||".output");console.log("[stx build] Starting production build...");let F=await M(Z),U=q.resolve(Z,Q.componentsDir??F.componentsDir??"components"),w=q.resolve(Z,Q.partialsDir??F.partialsDir??"partials"),H=q.resolve(Z,Q.layoutsDir??F.layoutsDir??"layouts"),V=Q.publicDir??F.publicDir??"public",k=F.app?.head||{},W=F.app?.colorMode,_=F.router?.container||"main",N=Q.routeRules??F.routeRules??{},x=BF(N),I=Q.serverApi??F.serverApi,O=typeof I==="object"?I:{};if(I)YF(Z,O);if(F.runtimeConfig)QF(F.runtimeConfig,{});if(G.existsSync(X))G.rmSync(X,{recursive:!0});let j=[q.join(X,"public","__stx"),q.join(X,"public","assets"),q.join(X,"server","pages"),q.join(X,"server","fragments")];for(let Y of j)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let E=zF(Z,{pagesDirs:F._layerPageDirs}),LF=["components","layouts","partials"],y=E.filter((Y)=>{return!LF.some((B)=>Y.pattern.startsWith(`/${B}/`)||Y.pattern===`/${B}`)});console.log(`[stx build] Found ${y.length} page routes (${E.length-y.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let L=c(Q.debug),K=a();await Bun.write(q.join(X,"public","__stx",L.filename),L.content),await Bun.write(q.join(X,"public","__stx",K.filename),K.content),console.log(`[stx build] Runtime: ${L.filename} (${(L.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${K.filename} (${(K.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let R=[],v=[];for(let Y of y){let B=x(Y.pattern),b=B.rendering==="prerender";if(b&&(Y.pattern.includes(":")||Y.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${Y.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let J=await FF(Y.filePath,Y.pattern,{configDir:Z,componentsDir:U,partialsDir:w,layoutsDir:H,debug:Q.debug});if(R.push(J),J.html=J.html.replace(/runtime\.__STX_HASH__\.js/g,L.filename).replace(/router\.__STX_HASH__\.js/g,K.filename),J.html=VF(J.html,k,{bodyScripts:[`<script src="/__stx/${K.filename}"></script>`],...W&&{colorMode:W}}),W)J.html=$F(J.html,W);if(k.htmlAttrs)J.html=GF(J.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(J.html)){let $=J.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if($&&$[1]){let m=$[1];J.html=J.html.replace(" "+m,""),J.html=J.html.replace(/<body([^>]*)>/,`<body$1 ${m}>`)}}if(J.html=J.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),J.html=await qF(J.html),b){let $=await EF(J,{params:{},request:new Request(`http://stx.build${Y.pattern}`),method:"GET",__stx_strict_hydration:!0});if($.redirect||$.cookies?.length||$.boundaries?.length||$.headers&&Object.keys($.headers).length)throw Error(`Prerendered route ${Y.pattern} cannot set response headers/cookies, redirect or stream`);J.html=$.html,J.status=$.status??J.status,J.hasServerScripts=!1,J.serverScriptContent=[],J.placeholders={}}J.fragment=kF(J.html,_);let C=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),g=q.join("server","pages",`${C}.compiled.json`),f=q.join("server","fragments",`${C}.html`);await Bun.write(q.join(X,g),JSON.stringify(J,null,2)),await Bun.write(q.join(X,f),J.fragment),v.push({pattern:Y.pattern,compiledPath:g,fragmentPath:f,isDynamic:J.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("["),prerendered:b}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(J){if(Object.keys(B).length)throw J;console.error(`[stx build] \u2717 ${Y.pattern}:`,J instanceof Error?J.message:J)}}let P=q.resolve(Z,V);if(G.existsSync(P)){let{copied:Y,bytes:B}=JF(P,q.join(X,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(B/1024).toFixed(1)}KB) from ${V}/`)}let A=KF(Z);if(A){let{copied:Y,bytes:B}=JF(A,q.join(X,"public",IF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(B/1024).toFixed(1)}KB) from ${HF}/`)}let S={runtime:L.filename,router:K.filename},T=UF(v,S,X);if(T.routeRules=N,T.routerContainer=_,I)T.apiRoutes=await ZF(Z,X,O);if(F.runtimeConfig)await Bun.write(q.join(X,"server/runtime-config.json"),JSON.stringify(F.runtimeConfig)),await WF(Z,F.runtimeConfig);if(F._layerGraph)await Bun.write(q.join(X,"server/layers.json"),JSON.stringify(XF(F._layerGraph),null,2));wF(T,X);let D=Date.now()-z;return console.log(`
3
3
  [stx build] Done in ${D}ms \u2014 ${R.length} pages compiled`),{pageCount:R.length,assets:S,outputDir:X,duration:D}}
4
4
  export{u as Vf,c as Wf,a as Xf,bF as Yf,FF as Zf,qJ as _f};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ax as y}from"./chunk-cevkpyn9.js";function b4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function RZ(){return typeof window<"u"&&typeof document<"u"}async function u4(){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 m4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function h4(Z){switch(Z){case"info":return"&#x2139;";case"success":return"&#x2714;";case"warning":return"&#x26A0;";case"error":return"&#x2716;";default:return"&#x2139;"}}function c4(Z="top-right"){if(!RZ())throw Error("Toast container requires browser environment");try{let Y=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if(Y)return Y}catch{}let $=document.createElement("div");$.className=`stx-toast-container ${Z}`,$.dataset.position=Z;try{if(document.body)document.body.appendChild($)}catch{}return $}function p4(Z){let{options:$}=Z,Y=h4($.type),J=$.type||"info",Q=$.duration!==0;return`
2
+ import{bx as y}from"./chunk-x7qyx7vn.js";function b4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function RZ(){return typeof window<"u"&&typeof document<"u"}async function u4(){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 m4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function h4(Z){switch(Z){case"info":return"&#x2139;";case"success":return"&#x2714;";case"warning":return"&#x26A0;";case"error":return"&#x2716;";default:return"&#x2139;"}}function c4(Z="top-right"){if(!RZ())throw Error("Toast container requires browser environment");try{let Y=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if(Y)return Y}catch{}let $=document.createElement("div");$.className=`stx-toast-container ${Z}`,$.dataset.position=Z;try{if(document.body)document.body.appendChild($)}catch{}return $}function p4(Z){let{options:$}=Z,Y=h4($.type),J=$.type||"info",Q=$.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">${Y}</div>
5
5
  <div class="stx-toast-content">
@@ -299,4 +299,4 @@ catch (error) {
299
299
  }
300
300
  })();
301
301
  </script>`}var N={name:"pwa.installButton",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return H(j,q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Q={name:"pwa.updatePrompt",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return J(j,q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},T={name:"pwa.offlineIndicator",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return L(j,q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},V={name:"pwa.pushSubscribe",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return M(j,q)},hasEndTag:!0,description:"Renders a push notification subscription button"},X=[N,Q,T,V];function Z(j){return[...j,...X]}
302
- export{N as Pw,Q as Qw,T as Rw,V as Sw,X as Tw,Z as Uw};
302
+ export{N as Qw,Q as Rw,T as Sw,V as Tw,X as Uw,Z as Vw};