@stacksjs/stx 0.2.303 → 0.2.305

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 (271) hide show
  1. package/dist/api-client.d.ts +26 -0
  2. package/dist/api-client.js +22 -0
  3. package/dist/api-handler.d.ts +6 -0
  4. package/dist/api-handler.js +3 -0
  5. package/dist/app-shell.js +11 -2
  6. package/dist/application-layers.d.ts +30 -0
  7. package/dist/application-layers.js +202 -0
  8. package/dist/build.js +9 -1
  9. package/dist/{chunk-rdg1n42s.js → chunk-00rtz7nw.js} +2 -2
  10. package/dist/chunk-02hm88m5.js +2 -0
  11. package/dist/chunk-044mychj.js +2 -0
  12. package/dist/{chunk-7eea1cse.js → chunk-09zjty4k.js} +1 -1
  13. package/dist/{chunk-7nfn7nj9.js → chunk-0gz0rhvs.js} +1 -1
  14. package/dist/chunk-113y4ywy.js +2 -0
  15. package/dist/{chunk-jsfch50r.js → chunk-1c2j4eby.js} +1 -1
  16. package/dist/{chunk-2m6x8tcx.js → chunk-1jbjrc0w.js} +2 -2
  17. package/dist/{chunk-m6wz1hf5.js → chunk-2h94c5hm.js} +2 -2
  18. package/dist/{chunk-mjpqz66q.js → chunk-2ver2s2y.js} +1 -1
  19. package/dist/chunk-3eervtf9.js +2 -0
  20. package/dist/{chunk-2rp09y5j.js → chunk-4evbx7sz.js} +1 -1
  21. package/dist/chunk-4jgr954p.js +2 -0
  22. package/dist/chunk-4mrhxtn3.js +18 -0
  23. package/dist/chunk-57ea6ye2.js +2 -0
  24. package/dist/{chunk-7eg7ep8f.js → chunk-5tefa8qb.js} +2 -2
  25. package/dist/{chunk-683tfkz4.js → chunk-64djh88a.js} +1 -1
  26. package/dist/{chunk-btrmvj2y.js → chunk-695fkras.js} +1 -1
  27. package/dist/{chunk-y7dcdjav.js → chunk-6zt2y7q3.js} +2 -2
  28. package/dist/chunk-7gqbr8nr.js +2 -0
  29. package/dist/{chunk-x4prtyjs.js → chunk-7kw3grq5.js} +1 -1
  30. package/dist/chunk-7m4yhzhb.js +6 -0
  31. package/dist/{chunk-7jebw3ea.js → chunk-7skk34dh.js} +2 -2
  32. package/dist/chunk-8ee62a9q.js +2 -0
  33. package/dist/{chunk-jj6yp7gm.js → chunk-8jam44my.js} +1 -1
  34. package/dist/chunk-8z0n5mtg.js +2 -0
  35. package/dist/chunk-92zzryxw.js +2 -0
  36. package/dist/{chunk-3bc8bqw2.js → chunk-9368t9jm.js} +1 -1
  37. package/dist/{chunk-3jwmcf4k.js → chunk-9c835qjn.js} +1 -1
  38. package/dist/chunk-9nf3hgvq.js +7 -0
  39. package/dist/chunk-a87jqtmd.js +2 -0
  40. package/dist/{chunk-5d9cy7a0.js → chunk-awj7yy37.js} +1 -1
  41. package/dist/chunk-b4xwbh8a.js +2 -0
  42. package/dist/{chunk-1evf3bdg.js → chunk-bd9wrcq1.js} +205 -19
  43. package/dist/chunk-bezqaxqt.js +2 -0
  44. package/dist/chunk-bk95q0bw.js +12 -0
  45. package/dist/{chunk-q25mr70f.js → chunk-c131k3mt.js} +1 -1
  46. package/dist/chunk-c1ae6afc.js +30 -0
  47. package/dist/{chunk-6btbgxh1.js → chunk-c79nfdyj.js} +1 -1
  48. package/dist/{chunk-cfgpk6bh.js → chunk-cbgh359m.js} +1 -1
  49. package/dist/{chunk-weqpt9nt.js → chunk-cr8v8k53.js} +1 -1
  50. package/dist/{chunk-p3wwm6k4.js → chunk-d19tvdvv.js} +1 -1
  51. package/dist/{chunk-nb1zdh1y.js → chunk-d3srvh3q.js} +1 -1
  52. package/dist/{chunk-rqrfq305.js → chunk-d57gb0v2.js} +1 -1
  53. package/dist/{chunk-1xyhk1wr.js → chunk-d5cqnwdd.js} +1 -1
  54. package/dist/chunk-dgpjxmhs.js +2 -0
  55. package/dist/chunk-dvvx1wny.js +3 -0
  56. package/dist/chunk-eans1ct0.js +43 -0
  57. package/dist/{chunk-ctz53mbz.js → chunk-ej8mv2k6.js} +1 -1
  58. package/dist/{chunk-zn6xcc0a.js → chunk-ek8cgwcg.js} +2 -2
  59. package/dist/{chunk-dv3z80gt.js → chunk-env6knrs.js} +1 -1
  60. package/dist/chunk-er848s6f.js +2 -0
  61. package/dist/{chunk-rf10fkrf.js → chunk-ess2pgt5.js} +1 -1
  62. package/dist/chunk-f1cgyd2h.js +3 -0
  63. package/dist/{chunk-hp3rjwnb.js → chunk-f325jzsk.js} +2 -2
  64. package/dist/{chunk-0tbgvp70.js → chunk-fczfdsab.js} +21 -5
  65. package/dist/chunk-fg0nf7cv.js +3754 -0
  66. package/dist/{chunk-xdq52pwj.js → chunk-fp7ms6e7.js} +1 -1
  67. package/dist/{chunk-qg6pg6ze.js → chunk-fqq5k9ve.js} +1 -1
  68. package/dist/{chunk-5t0w4h6z.js → chunk-g912mb7x.js} +1 -1
  69. package/dist/chunk-g97atepq.js +2 -0
  70. package/dist/{chunk-wj25qt72.js → chunk-gbwhbasw.js} +1 -1
  71. package/dist/chunk-gecmqs6p.js +17 -0
  72. package/dist/{chunk-cratkhhb.js → chunk-ghw5p1yk.js} +1 -1
  73. package/dist/{chunk-f0g2q51j.js → chunk-gssbag3e.js} +1 -1
  74. package/dist/{chunk-c9vhtjtr.js → chunk-gt8ja700.js} +2 -2
  75. package/dist/chunk-hftqr8ej.js +2 -0
  76. package/dist/{chunk-ftvmk1nj.js → chunk-hg2afckn.js} +1 -1
  77. package/dist/{chunk-hhnzd03k.js → chunk-hrcxfvh1.js} +1 -1
  78. package/dist/chunk-hzav4hyd.js +2 -0
  79. package/dist/{chunk-29gjwajm.js → chunk-jfzfrmzy.js} +1 -1
  80. package/dist/{chunk-ddqkj56r.js → chunk-jp2f8yzw.js} +1 -1
  81. package/dist/{chunk-ry3a2674.js → chunk-jsg1rthc.js} +1 -1
  82. package/dist/chunk-jxxv18a0.js +5 -0
  83. package/dist/{chunk-95t0k8cz.js → chunk-k23r03qj.js} +1 -1
  84. package/dist/{chunk-6b4k8fay.js → chunk-kxavsh3m.js} +1 -1
  85. package/dist/{chunk-4tffxxpd.js → chunk-m31n9pkr.js} +1 -1
  86. package/dist/{chunk-fj6fbqgb.js → chunk-m3a20mmb.js} +1 -1
  87. package/dist/chunk-m537zgay.js +2 -0
  88. package/dist/chunk-m8n0s4tk.js +28 -0
  89. package/dist/{chunk-j21csh4j.js → chunk-mbmqpaq1.js} +1 -1
  90. package/dist/{chunk-whm6bybj.js → chunk-mv5fdcwc.js} +3 -3
  91. package/dist/{chunk-y9nyqcha.js → chunk-mwh3ymwc.js} +1 -1
  92. package/dist/{chunk-51g95yts.js → chunk-mygq61f5.js} +2 -2
  93. package/dist/chunk-n99ajrwv.js +2 -0
  94. package/dist/chunk-ncrfrp95.js +2 -0
  95. package/dist/chunk-nqq7y7m9.js +3 -0
  96. package/dist/chunk-nws8fbde.js +2 -0
  97. package/dist/{chunk-q6xfyasj.js → chunk-pcvayb2f.js} +1 -1
  98. package/dist/chunk-phcvbqzn.js +2 -0
  99. package/dist/{chunk-nvxv2wxv.js → chunk-ppyz9623.js} +1 -1
  100. package/dist/{chunk-jb2r696a.js → chunk-qev11kg8.js} +1 -1
  101. package/dist/{chunk-6njgsr6w.js → chunk-qeyw5za9.js} +1 -1
  102. package/dist/chunk-qpzxgkc5.js +2 -0
  103. package/dist/chunk-qt2dmyq5.js +2 -0
  104. package/dist/chunk-r2k2sewg.js +2 -0
  105. package/dist/chunk-r808fpme.js +2 -0
  106. package/dist/chunk-rrankpmj.js +3 -0
  107. package/dist/chunk-rvyfyc43.js +2 -0
  108. package/dist/{chunk-3p0zgfgz.js → chunk-rzevgemj.js} +2 -2
  109. package/dist/{chunk-f62fh1fw.js → chunk-s3dnk3gc.js} +2 -2
  110. package/dist/{chunk-aa6kt84c.js → chunk-sart9ehj.js} +1 -1
  111. package/dist/chunk-sen2cxqm.js +2 -0
  112. package/dist/{chunk-jptkc64r.js → chunk-t3qb9s6s.js} +2 -2
  113. package/dist/{chunk-w8yac9xp.js → chunk-t41aaehf.js} +1 -1
  114. package/dist/{chunk-qjkzpd68.js → chunk-t51mwjyq.js} +1 -1
  115. package/dist/chunk-t8fqjb25.js +19 -0
  116. package/dist/{chunk-c6b5nqct.js → chunk-ta398s3d.js} +287 -352
  117. package/dist/chunk-tc6gqeha.js +2 -0
  118. package/dist/chunk-tt4r8q4v.js +2 -0
  119. package/dist/chunk-twbw18vs.js +2 -0
  120. package/dist/{chunk-6rzwef28.js → chunk-vd5xvsnv.js} +1 -1
  121. package/dist/chunk-w6d91maa.js +4 -0
  122. package/dist/{chunk-dcxtrqfy.js → chunk-wfffa8zm.js} +1 -1
  123. package/dist/chunk-wjdfhfj6.js +2 -0
  124. package/dist/chunk-wnamjw6n.js +3 -0
  125. package/dist/{chunk-22p0ezj6.js → chunk-wx13qmaw.js} +1 -1
  126. package/dist/chunk-x10mrzgp.js +2 -0
  127. package/dist/chunk-xd5ahrtn.js +2 -0
  128. package/dist/chunk-xsfwcj6x.js +2 -0
  129. package/dist/{chunk-91007tan.js → chunk-xwxdwqn9.js} +1 -1
  130. package/dist/{chunk-634gaa9d.js → chunk-xz3evxqp.js} +1 -1
  131. package/dist/chunk-xzgvcrnz.js +2 -0
  132. package/dist/{chunk-v8474ah4.js → chunk-y4nzmkea.js} +1 -1
  133. package/dist/{chunk-6w8fa3b8.js → chunk-ya5m5vbn.js} +1 -1
  134. package/dist/chunk-yd7jyyr7.js +2 -0
  135. package/dist/{chunk-ew6tr7b1.js → chunk-ydgdq45a.js} +2 -2
  136. package/dist/{chunk-ps20v1ah.js → chunk-ym3r8ktq.js} +1 -1
  137. package/dist/chunk-yyyxt326.js +2 -0
  138. package/dist/{chunk-yfwyvh02.js → chunk-ze44hhxb.js} +2 -2
  139. package/dist/{chunk-mdf3jbe6.js → chunk-zhcs8m2a.js} +2 -2
  140. package/dist/{chunk-f9d27v49.js → chunk-zs5y7xnt.js} +1 -1
  141. package/dist/chunk-zs95z9tf.js +2 -0
  142. package/dist/cli.js +14 -14
  143. package/dist/client-script-bundler.js +22 -11
  144. package/dist/component-contract-checks.d.ts +19 -0
  145. package/dist/component-contract-checks.js +147 -0
  146. package/dist/component-contract.d.ts +20 -0
  147. package/dist/component-contract.js +108 -0
  148. package/dist/component-model.d.ts +29 -0
  149. package/dist/component-model.js +59 -0
  150. package/dist/component-registry.js +7 -64
  151. package/dist/component-renderer.d.ts +1 -26
  152. package/dist/component-renderer.js +4 -239
  153. package/dist/component-resolution.d.ts +21 -0
  154. package/dist/component-resolution.js +118 -0
  155. package/dist/component-tags.d.ts +9 -0
  156. package/dist/component-tags.js +174 -0
  157. package/dist/composable-loader.d.ts +2 -13
  158. package/dist/composable-loader.js +15 -26
  159. package/dist/composables/index.d.ts +1 -0
  160. package/dist/composables/index.js +1 -0
  161. package/dist/composables/use-fetch.d.ts +117 -42
  162. package/dist/composables/use-fetch.js +47 -4
  163. package/dist/composition-api.d.ts +43 -19
  164. package/dist/config.d.ts +1 -1
  165. package/dist/config.js +46 -4
  166. package/dist/craft-entry.js +1 -1
  167. package/dist/craft.js +1 -1
  168. package/dist/database.js +1 -1
  169. package/dist/dev-server/serve-app.js +57 -17
  170. package/dist/dev-server/serve-file.js +8 -1
  171. package/dist/expressions.js +1 -1
  172. package/dist/imported-signals.js +1 -1
  173. package/dist/includes.js +27 -3
  174. package/dist/index.d.ts +11 -0
  175. package/dist/index.js +7 -0
  176. package/dist/manifest.d.ts +6 -0
  177. package/dist/misc-directives.d.ts +2 -0
  178. package/dist/misc-directives.js +39 -1
  179. package/dist/process.js +18 -1
  180. package/dist/production-builder.d.ts +4 -0
  181. package/dist/production-builder.js +47 -8
  182. package/dist/production-server.d.ts +4 -1
  183. package/dist/production-server.js +119 -71
  184. package/dist/pwa.js +2 -2
  185. package/dist/render.js +9 -2
  186. package/dist/route-response-cache.d.ts +7 -0
  187. package/dist/route-response-cache.js +72 -0
  188. package/dist/route-rules.d.ts +17 -0
  189. package/dist/route-rules.js +40 -0
  190. package/dist/router.d.ts +1 -0
  191. package/dist/runtime-config-loader.d.ts +5 -0
  192. package/dist/runtime-config-loader.js +42 -0
  193. package/dist/runtime-config-server.d.ts +26 -0
  194. package/dist/runtime-config-server.js +77 -0
  195. package/dist/runtime-config-types.d.ts +2 -0
  196. package/dist/runtime-config-types.js +0 -0
  197. package/dist/runtime-config.d.ts +5 -0
  198. package/dist/runtime-config.js +9 -0
  199. package/dist/runtime-globals.js +3 -0
  200. package/dist/serve.js +32 -10
  201. package/dist/server-api.d.ts +27 -0
  202. package/dist/server-api.js +181 -0
  203. package/dist/server-data.d.ts +17 -0
  204. package/dist/server-data.js +40 -0
  205. package/dist/signal-processing.js +2 -2
  206. package/dist/signals.js +138 -15
  207. package/dist/ssg.js +2 -2
  208. package/dist/stx-virtual-ts.d.ts +6 -0
  209. package/dist/stx-virtual-ts.js +31 -7
  210. package/dist/stx.d.ts +28 -0
  211. package/dist/template-compiler.d.ts +1 -0
  212. package/dist/template-compiler.js +1 -1
  213. package/dist/template-hydrator.js +15 -4
  214. package/dist/typecheck.d.ts +1 -0
  215. package/dist/typecheck.js +4 -3
  216. package/dist/types/config-types.d.ts +17 -0
  217. package/dist/utils.js +15 -5
  218. package/dist/variable-extractor.d.ts +1 -1
  219. package/dist/variable-extractor.js +12 -1
  220. package/dist/visual-testing.js +1 -1
  221. package/dist/vue-template.js +19 -41
  222. package/package.json +5 -5
  223. package/stx.d.ts +28 -0
  224. package/dist/chunk-0p44z42s.js +0 -2
  225. package/dist/chunk-2jd9bxmf.js +0 -2
  226. package/dist/chunk-2yp8ang5.js +0 -2
  227. package/dist/chunk-35x7s4cr.js +0 -2
  228. package/dist/chunk-3bqz5zre.js +0 -2
  229. package/dist/chunk-48p0k8y7.js +0 -2
  230. package/dist/chunk-4b625drg.js +0 -2
  231. package/dist/chunk-593kby1d.js +0 -2
  232. package/dist/chunk-5nac67r4.js +0 -18
  233. package/dist/chunk-70cf5h11.js +0 -2
  234. package/dist/chunk-78akhaws.js +0 -2
  235. package/dist/chunk-9a4q74r6.js +0 -2
  236. package/dist/chunk-9f5329rv.js +0 -2
  237. package/dist/chunk-9rv7akqq.js +0 -30
  238. package/dist/chunk-apjy1a72.js +0 -12
  239. package/dist/chunk-b3p3bzax.js +0 -3
  240. package/dist/chunk-c5hk1fxt.js +0 -2
  241. package/dist/chunk-c9rs5g1s.js +0 -2
  242. package/dist/chunk-dkd0bg8g.js +0 -2
  243. package/dist/chunk-dxhtry04.js +0 -2
  244. package/dist/chunk-ehp6fez3.js +0 -2
  245. package/dist/chunk-em3jb1dn.js +0 -4
  246. package/dist/chunk-ev4djb0p.js +0 -2
  247. package/dist/chunk-frejnjh9.js +0 -2
  248. package/dist/chunk-fvcr26a0.js +0 -22
  249. package/dist/chunk-g6ttsdz1.js +0 -2
  250. package/dist/chunk-gd73rpks.js +0 -2
  251. package/dist/chunk-ggwnrdqz.js +0 -17
  252. package/dist/chunk-h3t6fjba.js +0 -2
  253. package/dist/chunk-jc57j887.js +0 -2
  254. package/dist/chunk-jw248h1d.js +0 -2
  255. package/dist/chunk-k5xtf38q.js +0 -3
  256. package/dist/chunk-m78y5qys.js +0 -19
  257. package/dist/chunk-mc4rtf5d.js +0 -2
  258. package/dist/chunk-mx2wcb15.js +0 -2
  259. package/dist/chunk-p4w3wjbv.js +0 -2
  260. package/dist/chunk-pm3k8dyk.js +0 -2
  261. package/dist/chunk-qr59yfq9.js +0 -2
  262. package/dist/chunk-qsmdvy1z.js +0 -2
  263. package/dist/chunk-rsxmjfxq.js +0 -3754
  264. package/dist/chunk-s4sp78fn.js +0 -2
  265. package/dist/chunk-v2fp9vkh.js +0 -2
  266. package/dist/chunk-vwnnbzsp.js +0 -2
  267. package/dist/chunk-w0g99tx9.js +0 -2
  268. package/dist/chunk-x2pk87q2.js +0 -3
  269. package/dist/chunk-xn0asg46.js +0 -2
  270. package/dist/chunk-xwmw1wtk.js +0 -2
  271. package/dist/chunk-zdx9s3z0.js +0 -28
@@ -0,0 +1,43 @@
1
+ // @bun
2
+ import{do as f,em as e,eo as h,fo as u,go as l,oo as m}from"./chunk-fg0nf7cv.js";import{ht as D}from"./chunk-t51mwjyq.js";import{Su as g}from"./chunk-rrankpmj.js";import JJ from"path";import C from"fs";import S from"path";function k(K,Z,$,J){let Q=0;for(let j=Z;j<K.length;j++)if(K[j]===$)Q++;else if(K[j]===J&&!(J===">"&&K[j-1]==="=")){if(--Q===0)return j}return-1}function WJ(K){let Z=D(K),$=0,J=0,Q=[];for(let j=0;j<Z.length;j++)if("([{".includes(Z[j]))$++;else if(")]}".includes(Z[j]))$--;else if(Z[j]===","&&$===0)Q.push(K.slice(J,j).trim()),J=j+1;return Q.push(K.slice(J).trim()),Q}function R(K,Z){let $=D(K),J=new RegExp(`\\b(?:${Z.map((Q)=>Q.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Q of $.matchAll(J)){let j=Q.index+Q[0].length,G="";if($[j]==="<"){let U=k($,j,"<",">");if(U<0)continue;G=K.slice(j+1,U),j=U+1;while(/\s/.test($[j]||"")&&j<$.length)j++}if($[j]!=="(")continue;let W=k($,j,"(",")");if(W>=0)return{type:G,args:WJ(K.slice(j+1,W))}}return null}var x=`
3
+ type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
4
+ type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
5
+ type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
6
+ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
7
+ type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
8
+ type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
9
+ type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
10
+ `;function b(K,Z){let $=[],J={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},Q=D(K),j=K.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(F,H,q,B,Y)=>{if(Q.slice(Y,Y+6)!=="import")return F;if(B.endsWith(".stx"))return"";let N=`${Z}Import${$.length}`;if($.push(`import * as ${N} from ${JSON.stringify(B)};`),H.startsWith("*"))return`import ${H.replace(/^\*\s+as\s+/,"")} = ${N};`;if(!H.startsWith("{"))return`import ${H} = ${N}.default;`;return H.slice(1,-1).split(",").map((M)=>{let[w,O=w]=M.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!w)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(B)&&w in J)J[w].push(O);return`import ${O} = ${N}.${w};`}).join(`
11
+ `)}),G=R(K,J.defineProps),W=R(K,J.defineEmits),U=R(K,J.withDefaults);if(!G&&!W)return{declarations:"",props:null,events:null};let z=[],V=null,X=null;if(G){z.push(`const __options = (${G.args[0]||"{}"}) as const;`),z.push(`const __defaults = (${U?.args[1]||"{}"});`);let F=G.type||"__StxOptions<typeof __options>";z.push(`export type __StxProps = __StxDefaults<${F}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),V=`${Z}.__StxProps`}if(W)z.push(`const __events = (${W.args[0]||"[]"}) as const;`),z.push(`export type __StxEvents = ${W.type||"Record<(typeof __events)[number], any[]>"};`),X=`${Z}.__StxEvents`;return{declarations:`${$.join(`
12
+ `)}
13
+ namespace ${Z} {
14
+ ${j}
15
+ ${z.join(`
16
+ `)}
17
+ }`,props:V,events:X}}function*UJ(K){let Z=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,$;while($=Z.exec(K)){let J=Z.lastIndex,Q=[];while(J<K.length){while(/\s/.test(K[J]||""))J++;if(K[J]===">"||K.slice(J,J+2)==="/>"){J+=K[J]===">"?1:2;break}let j=/^[^\s=/>]+/.exec(K.slice(J))?.[0];if(!j){J++;continue}let G=J;J+=j.length;while(/\s/.test(K[J]||""))J++;if(K[J]!=="="){Q.push({name:j,value:!0,offset:G,braced:!1});continue}J++;while(/\s/.test(K[J]||""))J++;let W=K[J],U=W==="{",z=W==='"'||W==="'";if(z||U)J++;let V=J;if(U){let X=D(K.slice(J)),F=1,H=0;for(;H<X.length;H++){if(X[H]==="{")F++;if(X[H]==="}"&&--F===0)break}J+=H}else if(z)while(J<K.length&&K[J]!==W)J++;else while(J<K.length&&!/[\s/>]/.test(K[J]))J++;if(Q.push({name:j,value:K.slice(V,J),offset:V,braced:U}),z||U)J++}Z.lastIndex=J,yield{name:$[1],offset:$.index,attributes:Q}}}function p(K,Z,$){let J=[],Q=[x,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],j=new Map,G=new Map,W=new Map,U=$.scriptCode(K,$.filePath),z=D(U);for(let q of U.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(z.slice(q.index,q.index+6)!=="import")continue;let B=q[2],Y=S.isAbsolute(B)||B.startsWith(".")?S.resolve(S.dirname($.filePath),B):h(B,S.dirname($.filePath));if(!Y)continue;let N=Y.endsWith(".stx")?Y:C.existsSync(`${Y}.stx`)?`${Y}.stx`:void 0,M=N?null:f(Y,!1),w=q[1].startsWith("{")?q[1].slice(1,-1).split(","):[q[1]];for(let O of w){let[L,P=L]=O.trim().split(/\s+as\s+/),I=N||M?.get(L)||M?.get(L.toLowerCase());if(I)W.set(P,I),W.set(P.toLowerCase(),I),W.set(P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),I)}}for(let q of Z.matchAll(/@import\s*\(([^)]+)\)/g))for(let B of q[1].matchAll(/['"]([^'"]+)['"]/g)){let Y=u(B[1],$.filePath,$).find((N)=>C.statSync(N,{throwIfNoEntry:!1})?.isFile());if(Y)W.set(S.basename(B[1]).replace(/\.stx$/,""),Y)}let V={__importedComponents:W},X=new Map,F=(q,B,Y)=>{let N=K.slice(0,q);return{code:B,offset:q,attribute:Y,anchor:!0,kind:"directive",line:N.split(`
18
+ `).length,column:q-N.lastIndexOf(`
19
+ `)}},H=(q,B,Y)=>J.push({expression:q,statement:{text:B+q.code+Y,prefixLength:B.length}});for(let q of UJ(Z)){if(m(q.name)||q.name==="component")continue;let B=l(q.name,$.filePath,$,V);if(!B)continue;let Y=X.get(B);if(!Y){let M;try{M=$.readComponent?$.readComponent(B):C.readFileSync(B,"utf8")}catch{continue}if(M===void 0)continue;G.set(B,M),Y=b($.scriptCode(M,B),`__StxComponent${X.size}`),X.set(B,Y),Q.push(Y.declarations)}let N=[];for(let M of q.attributes){let{name:w,offset:O}=M,L=M.value===!0?"true":M.value;if(w.startsWith("@")||w.startsWith("v-on:")){if(Y.events&&M.value!==!0)j.set(O,`__StxEvent<${Y.events}, ${JSON.stringify(w.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let P=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(w);if(w.startsWith("v-")&&!w.startsWith("v-bind:")&&!P)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(w))continue;let I=(P?P[1]||"modelValue":w.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(TJ,zJ)=>zJ.toUpperCase());if(N.push(I),!Y.props)continue;let jJ=w.startsWith(":")||w.startsWith("v-bind:")||!!P||M.braced?L:M.value!==!0?JSON.stringify(L):"true";H(F(O,jJ,w),";void ((",`) satisfies __StxProp<${Y.props}, ${JSON.stringify(I)}>);`)}if(Y.props){let M=[...new Set(N)].map((O)=>`${JSON.stringify(O)}: undefined as any`).join(", "),w=F(q.offset,`<${q.name}>`);J.push({expression:w,statement:{text:`;void ({ ${M} } satisfies ${Y.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:X.size?Q.join(`
20
+ `):"",checks:J,events:j,dependencies:G}}var d=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function GJ(K){let Z=($)=>$.replace(/[^\n]/g," ");return K.replace(/<!--[\s\S]*?-->/g,Z).replace(/\{\{--[\s\S]*?--\}\}/g,Z)}function c(K){let Z=[],$=GJ(K);d.lastIndex=0;let J;while((J=d.exec($))!==null){let Q=(J[1]||"").trim(),j=(J[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,G=(J[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,W=J.index+j,U=J.index+J[0].length-G,z=K.slice(W,U);if(/\bsrc\s*=/.test(Q))continue;let V=Q.match(/\btype\s*=\s*["']([^"']+)["']/i);if(V&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(V[1]))continue;let X=/\bserver\b/.test(Q)?"server":/\bclient\b/.test(Q)?"client":"plain",F=_(K,W);Z.push({kind:X,code:z,startLine:F,attrs:Q})}return Z}function _(K,Z){let $=1;for(let J=0;J<Z&&J<K.length;J++)if(K.charCodeAt(J)===10)$++;return $}function T(K,Z){let $=K.lastIndexOf(`
21
+ `,Z-1)+1;return Z-$+1}function y(K){let Z=K.split(""),$=(Q,j)=>{for(let G=Q;G<j&&G<Z.length;G++)if(Z[G]!==`
22
+ `)Z[G]=" "},J=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let Q of J){Q.lastIndex=0;let j;while((j=Q.exec(K))!==null)$(j.index,j.index+j[0].length)}return Z.join("")}function FJ(K){let Z=0,$="";for(let J=0;J<K.length;J++){let Q=K[J];if($){if(Q==="\\"){J++;continue}if(Q===$)$="";continue}if(Q==='"'||Q==="'"||Q==="`"){$=Q;continue}if(Q==="("||Q==="["||Q==="{"){Z++;continue}if(Q===")"||Q==="]"||Q==="}"){Z--;continue}if(Q==="|"&&Z===0){if(K[J+1]==="|"){J++;continue}if(K[J-1]==="|")continue;return K.slice(0,J)}}return K}var KJ=new Set([":for","x-for","v-for"]),A=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,E="__stx_interpolated",i="__StxElement",QJ="__StxTemplateValue",XJ=`type ${QJ}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function n(K){return K.replace(/\{\{[\s\S]*?\}\}/g,E).replace(/\{!![\s\S]*?!!\}/g,E)}function nJ(K){return K.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(Z)=>{let $=Z.split(`
23
+ `).length-1,J=Z.length-$;return`0${" ".repeat(Math.max(0,J-1))}${`
24
+ `.repeat($)}`})}var VJ=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],HJ=new RegExp(String.raw`^[ \t]*@(?:${VJ.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function rJ(K){return K.replace(HJ,(Z)=>Z.replace(/[^\n]/g," "))}var r=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function YJ(K){let Z=y(K),$=[],J=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,Q;while((Q=J.exec(Z))!==null){if(Q[1]||Q[3])continue;let G=Q[2]??Q[4]??"",W=Q[2]!==void 0?2:3,U=FJ(G);if(!U.trim())continue;let z=Q.index+W+(U.length-U.trimStart().length);$.push({code:U.trim(),line:_(Z,z),column:T(Z,z),offset:z,kind:"interpolation"})}A.lastIndex=0;while((Q=A.exec(Z))!==null){let j=Q[1],G=Q[3]??"",W=j.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(r.has(W)||r.has(j))continue;if(!G.trim())continue;let U=Q.index+Q[0].indexOf(Q[2],Q[0].indexOf(j)+j.length)+1;if(KJ.has(W)){let V=G.match(/\s+(?:in|of)\s+/);if(!V||V.index===void 0)continue;let X=G.slice(V.index+V[0].length),F=V.index+V[0].length+(X.length-X.trimStart().length);$.push({code:n(X.trim()),line:_(Z,U+F),column:T(Z,U+F),offset:U+F,kind:"directive",attribute:W});continue}let z=G.length-G.trimStart().length;$.push({code:n(G.trim()),line:_(Z,U+z),column:T(Z,U+z),offset:U+z,kind:"directive",attribute:W})}return $.sort((j,G)=>j.line-G.line||j.column-G.column),$}var qJ=2000;function BJ(K,Z){let $=0,J=Math.min(K.length,Z+qJ);for(let Q=Z;Q<J;Q++){let j=K[Q];if(j==="(")$++;else if(j===")"){if($--,$===0)return K.slice(Z+1,Q)}}return null}function wJ(K){let Z=new Map,$=(W,U)=>{let z=W.split(/[,[\]{}()\s]+/).filter(Boolean);for(let V of z){let X=V.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(X))continue;let F=z.length===1?U:void 0,H=Z.get(X);if(!H)Z.set(X,{name:X,iterable:F});else if(H.iterable!==F)H.iterable=void 0}},J=/^\$?[A-Z_$][\w$]*$/i,Q=(W)=>{let U=W.trim();return J.test(U)?U:void 0};for(let W of K.matchAll(/@for(?:each|else)\s*\(/g)){let U=BJ(K,W.index+W[0].length-1);if(U===null)continue;let z=U.match(/^([\s\S]*?)\bas\b([\s\S]*)$/);if(!z)continue;$(z[2].replace(/=>/g," "),Q(z[1]))}for(let W of K.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)/g))$(W[1]);let j=y(K);A.lastIndex=0;let G;while((G=A.exec(j))!==null){let W=G[1].replace(/\..*$/,"");if(!KJ.has(W))continue;let U=G[3].match(/\s+(?:in|of)\s+/);if(!U||U.index===void 0)continue;$(G[3].slice(0,U.index),Q(G[3].slice(U.index+U[0].length)))}for(let W of K.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let U of W[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))$(U[1]);return[...Z.values()].sort((W,U)=>W.name.localeCompare(U.name))}function v(K){let Z=new Set;for(let $ of K.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))Z.add($[1]);for(let $ of K.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))Z.add($[1]);for(let $ of K.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))Z.add($[1]);for(let $ of K.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let J of $[1].split(",")){let Q=J.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(Q))Z.add(Q)}return[...Z].sort()}function MJ(){return["declare var window: any",...g.map((K)=>`declare var ${K}: any`)].join(`
25
+ `)}var NJ=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"];function DJ(){return NJ.map((K)=>`declare var ${K}: any`).join(`
26
+ `)}function ZJ(K){let Z=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,$,J=!1,Q=new Set,j=D(K);while(($=Z.exec(j))!==null){J=!0;for(let G of OJ($[1])){let W=G.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(W))Q.add(W)}}return J?[...Q]:null}function OJ(K){let Z=[],$=0,J="";for(let Q of K){if(Q===","&&$===0){Z.push(J),J="";continue}if(Q==="("||Q==="["||Q==="{")$++;else if(Q===")"||Q==="]"||Q==="}")$--;J+=Q}return Z.push(J),Z.filter((Q)=>Q.trim().length>0)}function PJ(K){let Z=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,$=[],J=K.replace(Z,(Q)=>{return $.push(Q.trim()),Q.split(`
27
+ `).map(()=>"").join(`
28
+ `)});return{imports:$.join(`
29
+ `),body:J}}function $J(K){let Z=D(K),$=Array(Z.length),J=0;for(let W=0;W<Z.length;W++){let U=Z[W];if(U==="}"||U===")"||U==="]")J=Math.max(0,J-1);if($[W]=J,U==="{"||U==="("||U==="[")J++}let Q=[],j=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,G;while((G=j.exec(Z))!==null){if($[G.index]!==0)continue;let W=G[1],U=G[2],z;if(W==="interface"){let V=Z.indexOf("{",G.index);if(V===-1)continue;let X=0;z=-1;for(let F=V;F<Z.length;F++)if(Z[F]==="{")X++;else if(Z[F]==="}"&&--X===0){z=F+1;break}if(z===-1)continue}else{let V=0;z=Z.length;for(let X=Z.indexOf("=",G.index)+1;X<Z.length;X++){let F=Z[X];if(F==="{"||F==="["||F==="("||F==="<")V++;else if(F==="}"||F==="]"||F===")"||F===">")V--;else if(V<=0&&(F===";"||F===`
30
+ `&&!/[=|&,<([{]\s*$/.test(Z.slice(Math.max(0,X-40),X)))){z=F===";"?X+1:X;break}}}Q.push({name:U,text:K.slice(G.index,z).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=z}return Q}function IJ(K){return new Set($J(K).map((Z)=>Z.name))}function aJ(K,Z=""){let $=ZJ(K),J=IJ(Z),Q=$J(K).filter((z)=>!J.has(z.name)).map((z)=>z.text);if(!$){let z=v(K);if(z.length===0&&Q.length===0)return"";return["",`// ${SJ}`,...Q,...z.map((V)=>`declare var ${V}: any`)].join(`
31
+ `)}if($.length===0)return Q.length>0?["",`// ${a}`,...Q].join(`
32
+ `):"";let{imports:j,body:G}=PJ(K),W=G.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),U=["",`// ${a}`];if(j)U.push(j);return U.push(...Q),U.push(`async function ${o}() {`,W,` return { ${$.join(", ")} }`,"}",`type ${t} = Awaited<ReturnType<typeof ${o}>>`,...$.map((z)=>`declare var ${z}: ${t}[${JSON.stringify(z)}]`)),U.join(`
33
+ `)}function LJ(K){let $=D(K).split(""),J=0;for(let Q=0;Q<$.length;Q++){let j=$[Q];if(j==="{"||j==="("||j==="["){J++;continue}if(j==="}"||j===")"||j==="]"){J=Math.max(0,J-1);continue}if(J>0&&j!==`
34
+ `)$[Q]=" "}return v($.join(""))}function oJ(K,Z){if(ZJ(K)!==null)return[];let $=D(Z),J=new Set(g);return LJ(K).filter((Q)=>{if(J.has(Q))return!1;if(v(Z).includes(Q))return!1;return new RegExp(`(?<![.#\\w$])${Q}(?![\\w$])`).test($)})}var a="stx: types for the declared client payload (#1868)",SJ="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",o="__stxServerScope",t="__StxClientPayload";var vJ=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var _J=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function yJ(K,Z){let $=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,J=[],Q;while((Q=$.exec(K))!==null){if(Q.index>=Z)break;let j=Q[1];if(j==="endif"||j==="endunless"){J.pop();continue}let G="";if(Q[2]==="("){let W=0,U=Q.index+Q[0].length-1,z=U+1;for(;U<K.length;U++){let V=K[U];if(V==="(")W++;else if(V===")"){if(W--,W===0)break}}G=K.slice(z,U).trim(),$.lastIndex=U+1}if(j==="if")J.push({seen:[],current:G});else if(j==="unless")J.push({seen:[],current:`!(${G})`});else if(j==="elseif"||j==="else"){let W=J[J.length-1];if(!W)continue;if(W.current)W.seen.push(W.current);W.current=j==="elseif"?G:null}}return J.flatMap((j)=>[...j.seen.map((G)=>`!(${G})`),...j.current?[j.current]:[]]).filter(Boolean)}function AJ(K){let Z=K.code.trim();if(!Z)return null;if(K.attribute?.startsWith("@")){if(_J.test(Z))return null;let J=";(($event: any): void => { ";return{text:`${J}${Z} });`,prefixLength:J.length}}let $=";void ((";return{text:`${$}${Z}));`,prefixLength:$.length}}var RJ=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function s(K,Z){if(!Z)return K;return K.replace(RJ,($,J,Q,j)=>{let G=JJ.resolve(Z,j).replace(/\\/g,"/");return`${J}${Q}${G}${Q}`})}function tJ(K,Z={}){let $=c(K),J=K.split(`
35
+ `),Q=Array.from({length:J.length},()=>""),j=new Map,G=Z.filePath&&Z.templateExpressions!==!1?p(K,y(K),{filePath:Z.filePath,componentsDir:Z.componentsDir,projectRoot:Z.projectRoot,readComponent:Z.readComponent,scriptCode:(U,z)=>c(U).map((V)=>s(V.code,JJ.dirname(z))).join(`
36
+ `)}):void 0;for(let U of $)s(U.code,Z.originDir??"").split(`
37
+ `).forEach((V,X)=>{let F=U.startLine-1+X;if(F<Q.length)Q[F]=V});let W=(U,z)=>{for(let[V,X]of U.split(`
38
+ `).entries())if(Q.push(X),z)j.set(Q.length,V===0?z:{...z,line:z.line+V,column:1,prefixLength:0})};if(Z.globals!==!1){if(W(""),Z.runtimeGlobals!==!1)for(let z of MJ().split(`
39
+ `))W(z);for(let z of DJ().split(`
40
+ `))W(z);for(let z of e)W(`declare var ${z}: any`);for(let z of vJ)W(`declare var ${z}: any`);W(`declare var ${E}: any`);let U=new Set($.flatMap((z)=>v(z.code)));W(`type ${i}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let z of wJ(K)){if(U.has(z.name))continue;let V=z.iterable&&U.has(z.iterable)?`${i}<typeof ${z.iterable}>`:"any";W(`declare var ${z.name}: ${V}`)}}if(Z.templateExpressions!==!1){if(G?.declarations)for(let z of G.declarations.split(`
41
+ `))W(z);let U=YJ(K).map((z)=>{let V=G?.events.get(z.offset??-1);if(V){z.anchor=!0;let X=z.code.trim(),F=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(X),H=F?`void ((${F[2]}) satisfies __StxAssignedValue<typeof ${F[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(X)?`${X}($event)`:X,q=`;(($event: ${V}): void => { `;return{expression:z,statement:{text:`${q}${H} });`,prefixLength:q.length}}}return{expression:z,statement:AJ(z)}}).filter((z)=>z.statement!==null);if(U.push(...G?.checks||[]),U.length>0){let z=y(K),X=[...new Set($.flatMap((H)=>v(H.code)))].filter((H)=>/^[A-Z_$][\w$]*$/i.test(H)),F=0;if(X.length>0){W(XJ);for(let H of X)W(`type __StxT_${H} = ${QJ}<typeof ${H}>`);W(`;((${X.map((H)=>`${H}: __StxT_${H}`).join(", ")}) => {`),F=1}for(let{expression:H,statement:q}of U){let B=" ".repeat(F),Y=H.offset===void 0?[]:yJ(z,H.offset),N=Y.length>0?`${Y.map((w)=>`if (${w}) `).join("")}{ `:"",M=Y.length>0?" }":"";W(B+N+q.text+M,{line:H.line,column:H.column,expression:H,prefixLength:q.prefixLength+B.length+N.length})}if(F>0)W("});")}}return W("export {}"),{text:Q.join(`
42
+ `),lineMap:j,sourceLineCount:J.length,componentDependencies:G?.dependencies}}function sJ(K,Z,$){let J=K.lineMap.get(Z);if(!J)return Z<=K.sourceLineCount?{line:Z,column:$}:null;let Q=J.expression?.anchor?0:Math.max(0,$-1-(J.prefixLength??0));return{line:J.line,column:J.column+Q,expression:J.expression}}
43
+ export{c as Xf,nJ as Yf,rJ as Zf,YJ as _f,v as $f,DJ as ag,aJ as bg,oJ as cg,s as dg,tJ as eg,sJ as fg};
@@ -348,4 +348,4 @@ else {
348
348
  console.log('[stx] Keep-alive runtime initialized');
349
349
  })();
350
350
  `}function Z(f){if(typeof document<"u")document.addEventListener("stx:activated",(j)=>{f(j.detail)})}function _(f){if(typeof document<"u")document.addEventListener("stx:deactivated",(j)=>{f(j.detail)})}
351
- export{Q as Li,T as Mi,W as Ni,X as Oi,Y as Pi,Z as Qi,_ as Ri};
351
+ export{Q as Bi,T as Ci,W as Di,X as Ei,Y as Fi,Z as Gi,_ as Hi};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Hp as X,wm as W}from"./chunk-rsxmjfxq.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
2
+ import{Im as W,_p as X}from"./chunk-fg0nf7cv.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
3
3
  ${j.bold}${q[0]}${j.reset} - ${A.description}`),console.log(` Usage: ${j.cyan}${A.usage}${j.reset}
4
4
  `)}else{console.log(`
5
5
  ${j.bold}Available Commands:${j.reset}
@@ -21,4 +21,4 @@ ${j.bold}${j.blue}stx Interactive Mode${j.reset}
21
21
  ${j.dim}Type 'help' for available commands, 'exit' to quit${j.reset}
22
22
  `);let B=()=>{let G=z.cwd.replace(process.env.HOME||"","~");A.question(`${j.cyan}stx${j.reset} ${j.dim}${G}${j.reset} ${j.green}>${j.reset} `,async(I)=>{let K=I.trim();if(!K){if(z.running)B();return}z.history.push(K);let L=K.match(/(?:[^\s"]|"[^"]*")+/g)||[],J=L[0]?.toLowerCase(),O=L.slice(1).map((U)=>U.replace(/^"|"$/g,""));if(J&&Q[J])try{await Q[J].handler(O,z)}catch(U){console.log(`${j.red}Error:${j.reset}`,U)}else if(J)if(K.includes("{{")||K.includes("}}"))try{let U=await W(K,z.context,"eval");console.log(`${j.green}\u2192${j.reset} ${U}`)}catch{console.log(`${j.red}Unknown command: ${J}${j.reset}`),console.log(`${j.dim}Type 'help' for available commands${j.reset}`)}else console.log(`${j.red}Unknown command: ${J}${j.reset}`),console.log(`${j.dim}Type 'help' for available commands${j.reset}`);if(z.running)B();else A.close()})};A.on("SIGINT",()=>{console.log(`
23
23
  ${j.dim}(Use 'exit' to quit)${j.reset}`),B()}),B()}
24
- export{R as Xe};
24
+ export{R as Te};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Zs as _}from"./chunk-qjkzpd68.js";import"./chunk-ddqkj56r.js";function W(j,G,H=240){return j.slice(G,G+H)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(j)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(j)||/\b(?:const|let|var)\s+alert\s*=/.test(j)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(j,G)=>{let H=j.indexOf("(",G);if(H===-1)return!0;let Q=j.slice(H+1,j.indexOf(")",H)+1);return!/\b(?:location|search|href|url)\b/i.test(Q)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(j,G)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(W(j,G,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(j,G)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(W(j,G))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(j)=>/setTimeout\s*\(/.test(j)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],U=["confirm","tooltip",...v.map((j)=>j.rule)];function N(j,G){let H=1;for(let Q=0;Q<G;Q++)if(j[Q]===`
2
+ import{ht as _}from"./chunk-t51mwjyq.js";import"./chunk-jp2f8yzw.js";function W(j,G,H=240){return j.slice(G,G+H)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(j)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(j)||/\b(?:const|let|var)\s+alert\s*=/.test(j)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(j,G)=>{let H=j.indexOf("(",G);if(H===-1)return!0;let Q=j.slice(H+1,j.indexOf(")",H)+1);return!/\b(?:location|search|href|url)\b/i.test(Q)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(j,G)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(W(j,G,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(j,G)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(W(j,G))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(j)=>/setTimeout\s*\(/.test(j)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],U=["confirm","tooltip",...v.map((j)=>j.rule)];function N(j,G){let H=1;for(let Q=0;Q<G;Q++)if(j[Q]===`
3
3
  `)H++;return H}function P(j,G){let H=j.lastIndexOf(`
4
4
  `,G)+1,Q=j.indexOf(`
5
5
  `,G);return j.slice(H,Q===-1?j.length:Q).trim().slice(0,120)}function q(j,G){let H=j.slice(0,G),Q=H.lastIndexOf("function"),X=H.lastIndexOf("=>"),M=Math.max(Q,X);if(M===-1)return!1;let z=j.slice(Math.max(0,M-120),M);return/\basync\b[^;{}]*$/.test(z)}function L(j){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(j)||/\b(?:const|let|var)\s+confirm\s*=/.test(j)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(j)}function O(j,G,H){if(L(j))return j;let Q=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,X=F(j),M="",z=0,Y;while((Y=Q.exec(X))!==null){let Z=Y.index+Y[1].length,$=N(j,Z),J=P(j,Z);if(/stxConfirm\s*\($/.test(j.slice(0,Z+8)))continue;let D=q(j,Z);if(H.push({file:G,line:$,rule:"confirm",applied:D,snippet:J,reason:D?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),D)M+=j.slice(z,Z)+"await stxConfirm(",z=Z+(Y[0].length-Y[1].length)}return M+j.slice(z)}function w(j,G,H){let Q=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,X=C(j),M="",z=0,Y;while((Y=Q.exec(X))!==null){let[Z,$,J,D]=Y,K=N(j,Y.index),B=P(j,Y.index),V=$.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(V)){H.push({file:G,line:K,rule:"tooltip",applied:!1,snippet:B,reason:`\`title\` on <${V}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test($)||D.trim()===""){H.push({file:G,line:K,rule:"tooltip",applied:!1,snippet:B,reason:/\bx-tooltip[=\s]/.test($)?"already has x-tooltip":"empty title"});continue}H.push({file:G,line:K,rule:"tooltip",applied:!0,snippet:B}),M+=j.slice(z,Y.index)+`${$} x-tooltip=${J}${D}${J} title=${J}${D}${J}`,z=Y.index+Z.length}return M+j.slice(z)}function C(j){return j.replace(/<!--[\s\S]*?-->/g,(G)=>G.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(G)=>G.replace(/[^\n]/g," "))}function E(j){let G=(H)=>H.replace(/[^\n]/g," ");return j.replace(/\/\*[\s\S]*?\*\//g,G).replace(/\/\/[^\n]*/g,G)}function F(j,G=!1){let H=C(j);return(G?E(H):_(H)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(X,M)=>/\bclient\b/i.test(M)?X:X.replace(/[^\n]/g," "))}function S(j,G,H,Q){let X=F(j),M=F(j,!0);for(let z of v){if(!H.includes(z.rule))continue;if(z.requires&&!z.requires(j))continue;z.pattern.lastIndex=0;let Y,Z=/['"]/.test(z.pattern.source)?M:X;z.pattern.lastIndex=0;while((Y=z.pattern.exec(Z))!==null){if(z.reject?.(j,Y.index))continue;Q.push({file:G,line:N(j,Y.index),rule:z.rule,applied:!1,snippet:P(j,Y.index),reason:`${z.primitive} \u2014 ${z.why}`})}}}function k(j,G={}){let H=G.rules??U,Q=G.file??"<source>",X=[];S(j,Q,H,X);let M=j;if(H.includes("confirm"))M=O(M,Q,X);if(H.includes("tooltip"))M=w(M,Q,X);X.sort((Z,$)=>Z.line-$.line);let z=new Set,Y=X.filter((Z)=>{let $=`${Z.rule}:${Z.line}`;if(z.has($))return!1;return z.add($),!0});return{code:M,findings:Y}}var I=new Set(["confirm","tooltip"]);function A(j,G){if(j.length===0)return"No hand-rolled equivalents found.";let H=j.filter((z)=>z.applied),Q=j.filter((z)=>!z.applied&&I.has(z.rule)),X=j.filter((z)=>!z.applied&&!I.has(z.rule)),M=[];if(H.length>0){M.push(G?`Rewrote ${H.length} site(s):`:`Would rewrite ${H.length} site(s) (pass --fix):`);for(let z of H)M.push(` ${z.file}:${z.line} [${z.rule}] ${z.snippet}`)}if(Q.length>0){M.push("",`Needs a human \u2014 ${Q.length} site(s):`);for(let z of Q)M.push(` ${z.file}:${z.line} [${z.rule}] ${z.snippet}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Xp as b,Yp as c,Zp as d,_p as e,uo as a}from"./chunk-fg0nf7cv.js";import"./chunk-2h94c5hm.js";import"./chunk-8jam44my.js";import"./chunk-t51mwjyq.js";import"./chunk-wfffa8zm.js";import"./chunk-mv5fdcwc.js";import"./chunk-4evbx7sz.js";import"./chunk-jxxv18a0.js";import"./chunk-c131k3mt.js";import"./chunk-9nf3hgvq.js";import"./chunk-nqq7y7m9.js";import"./chunk-1c2j4eby.js";import"./chunk-kxavsh3m.js";import"./chunk-qev11kg8.js";import"./chunk-rrankpmj.js";import"./chunk-fczfdsab.js";import"./chunk-fp7ms6e7.js";import"./chunk-jp2f8yzw.js";export{d as validateClientScript,c as processOnceDirective,b as processJsonDirective,e as processDirectives,a as injectRouterScript};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Af as w,Bf as x,Cf as y,Df as z,Ef as A,Ff as B,Gf as C,Hf as D,If as E,xf as t,yf as u,zf as v}from"./chunk-3p0zgfgz.js";import{Lg as r,Mg as s}from"./chunk-51g95yts.js";import{Fh as b,Gh as c,Hh as d,Ih as e,Jh as f,Kh as g,Lh as h,Nh as i,Oh as j,Ph as k,Qh as l,Rh as m,Sh as n,Th as o,Uh as p,Vh as q}from"./chunk-jptkc64r.js";import{ri as a}from"./chunk-y9nyqcha.js";import"./chunk-dcxtrqfy.js";import"./chunk-ddqkj56r.js";export{D as writeImageManifest,a as rewriteImagesWithSiblings,t as renderImageComponent,v as processImageComponents,g as processImage,u as parseImageComponent,A as optimizeImage,B as optimizeDirectory,e as isSharpAvailable,m as isImageFile,f as isImageBackendAvailable,y as imageDirective,r as handleImageRequest,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,h as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,C as generateImageManifest,p as formatSize,E as defaultImageConfig,z as createImagePlugin,s as createImageHandler,x as createImageDirective,w as clearImageCache,q as ImageProcessingError,b as DEFAULT_WIDTHS,d as DEFAULT_QUALITY,c as DEFAULT_FORMATS};
2
+ import{mf as t,nf as u,of as v,pf as w,qf as x,rf as y,sf as z,tf as A,uf as B,vf as C,wf as D,xf as E}from"./chunk-rzevgemj.js";import{yf as r,zf as s}from"./chunk-mygq61f5.js";import{Af as b,Bf as c,Cf as d,Df as e,Ef as f,Ff as g,Gf as h,If as i,Jf as j,Kf as k,Lf as l,Mf as m,Nf as n,Of as o,Pf as p,Qf as q}from"./chunk-t3qb9s6s.js";import{hi as a}from"./chunk-mwh3ymwc.js";import"./chunk-wfffa8zm.js";import"./chunk-jp2f8yzw.js";export{D as writeImageManifest,a as rewriteImagesWithSiblings,t as renderImageComponent,v as processImageComponents,g as processImage,u as parseImageComponent,A as optimizeImage,B as optimizeDirectory,e as isSharpAvailable,m as isImageFile,f as isImageBackendAvailable,y as imageDirective,r as handleImageRequest,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,h as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,C as generateImageManifest,p as formatSize,E as defaultImageConfig,z as createImagePlugin,s as createImageHandler,x as createImageDirective,w as clearImageCache,q as ImageProcessingError,b as DEFAULT_WIDTHS,d as DEFAULT_QUALITY,c as DEFAULT_FORMATS};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{Hg as I}from"./chunk-dvvx1wny.js";import{xr as H}from"./chunk-fg0nf7cv.js";import{cw as G}from"./chunk-jp2f8yzw.js";import L from"path";async function Q(k={}){let J=performance.now(),A=k.root||process.cwd(),j=await H(A),B=k.ssr?.routeRules??j.routeRules??{};if(I(B),!j.ssr&&Object.keys(B).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!j.ssr&&(k.ssr?.serverApi??j.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let q=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${q.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let D,E;if(q==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");D=await z({pagesDir:L.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,router:j.router,...k.ssg})}else{let{buildForProduction:z}=await import("./chunk-m537zgay.js");E=await z({root:A,outputDir:".output",debug:k.debug,...k.ssr})}let K=Math.round(performance.now()-J);return{mode:q,ssg:D,ssr:E,duration:K}}
3
+ export{Q as Ue};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{wv as H}from"./chunk-ddqkj56r.js";import P from"path";var $=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function G(...v){let w=new Set;for(let q of v){if(!q||!q.includes("__stxModules["))continue;for(let z of q.matchAll($))try{w.add(JSON.parse(`"${z[1]}"`))}catch{}}return[...w].sort()}async function T(v,w={}){if(v.length===0)return null;let q=process.cwd(),z=[],J=[];v.forEach((j,X)=>{let Z=j.startsWith("npm:")?j.slice(4):P.resolve(q,j),N=`__stxRegistered${X}`,O=JSON.stringify(j);z.push(`import * as ${N} from ${JSON.stringify(Z)};`),J.push(`if (!globalThis.__stxModules[${O}]) globalThis.__stxModules[${O}] = ${N};`)});let L=[...z,"globalThis.__stxModules = globalThis.__stxModules || {};",...J].join(`
3
- `),B;try{let{bundleClientScript:j}=await import("./chunk-ev4djb0p.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:w.minify,externalizeUserModules:!1})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-mx2wcb15.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-qr59yfq9.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
2
+ import{cw as H}from"./chunk-jp2f8yzw.js";import P from"path";var $=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function G(...v){let w=new Set;for(let q of v){if(!q||!q.includes("__stxModules["))continue;for(let z of q.matchAll($))try{w.add(JSON.parse(`"${z[1]}"`))}catch{}}return[...w].sort()}async function T(v,w={}){if(v.length===0)return null;let q=process.cwd(),z=[],J=[];v.forEach((j,X)=>{let Z=j.startsWith("npm:")?j.slice(4):P.resolve(q,j),N=`__stxRegistered${X}`,O=JSON.stringify(j);z.push(`import * as ${N} from ${JSON.stringify(Z)};`),J.push(`if (!globalThis.__stxModules[${O}]) globalThis.__stxModules[${O}] = ${N};`)});let L=[...z,"globalThis.__stxModules = globalThis.__stxModules || {};",...J].join(`
3
+ `),B;try{let{bundleClientScript:j}=await import("./chunk-sen2cxqm.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:w.minify,externalizeUserModules:!1})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-tc6gqeha.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-nws8fbde.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
4
4
  `)}export{G as registeredModuleIdsIn,T as buildModuleRegistryScript};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{uv as Ae,vv as u}from"./chunk-ddqkj56r.js";function _(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>g.includes(a))}function m(e){return _(e.replace(/^\//,""))}var g;var b=u(()=>{g=["components","layouts","partials","emails"]});import h from"fs";import y from"path";function x(e,t){let a=e.filter((o)=>!m(o.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let o of a){let i=[];for(let c of o.params){let f=o.pattern.includes(`:${c}?`)?"?":"";i.push(`${c}${f}: string`)}let l=i.join("; ");r.push(` '${o.pattern}': { ${l} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
- `),s=y.join(t,"route-types.d.ts");try{if(h.existsSync(s)&&h.readFileSync(s,"utf8")===n)return;h.mkdirSync(t,{recursive:!0}),h.writeFileSync(s,n)}catch{}}function S(e,t,a){let r=process.cwd(),n=y.relative(r,a),s=e.filter((i)=>!m(i.pattern)),o=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let i of s){let l=y.relative(r,i.filePath).replace(/\\/g,"/"),c=JSON.stringify(i.params),f=i.layout?`, layout: '${y.relative(r,i.layout).replace(/\\/g,"/")}'`:"";o.push(` { pattern: '${i.pattern}', filePath: '${l}', isDynamic: ${i.isDynamic}, params: ${c}${f} },`)}o.push("] as const",""),o.push("export type RouteName = typeof routes[number]['pattern']",""),h.mkdirSync(t,{recursive:!0}),h.writeFileSync(y.join(t,"routes.ts"),o.join(`
4
- `))}var F=u(()=>{b()});import V from"path";function k(e,t){let r=V.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(V.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function v(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),s=/^\/:([^/?*]+)\?/.exec(n);if(s){t.push(s[1]),a+="(?:/([^/]+))?",r+=s[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){t.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function D(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let s={};return r.params.forEach((o,i)=>{s[o]=n[i+1]}),{route:r,params:s}}}return null}function W(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return v(t)}var M=()=>{};import xe from"fs";import I from"path";function A(e,t){let a=[],r=I.dirname(e);while(r.startsWith(t)||r===t){let n=I.join(r,"_layout.stx");if(xe.existsSync(n))a.unshift(n);if(r===t)break;r=I.dirname(r)}return a}var N=()=>{};import P from"fs";import d from"path";function K(e,t){let a=[];if(!P.existsSync(e))return a;let r=P.readdirSync(e,{withFileTypes:!0});for(let n of r){let s=d.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(g.includes(n.name))continue;a.push(...K(s,t))}else if(n.isFile()){let o=d.extname(n.name);if(t.includes(o)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(s)}}}return a}class C{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((o)=>d.resolve(e,o)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=new Set;this.routes=[];for(let o of this.pagesDirs){let i=K(o,r);for(let l of i){let c=k(l,o);if(n.has(c))continue;n.add(c);let{regex:f,params:H}=v(c),O=t.layouts!==!1?A(l,o):[];this.routes.push({pattern:c,regex:f,params:H,filePath:l,isDynamic:H.length>0,layout:O.length>0?O[O.length-1]:void 0})}}this.routes.sort((o,i)=>{if(!o.isDynamic&&i.isDynamic)return-1;if(o.isDynamic&&!i.isDynamic)return 1;let l=o.pattern.split("/").length,c=i.pattern.split("/").length;if(l!==c)return c-l;return o.pattern.localeCompare(i.pattern)});let s=d.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");x(this.routes,s),S(this.routes,s,this.pagesDir)}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((s,o)=>{n[s]=r[o+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,s]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(s));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function $(e,t){return new C(e,t)}function z(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=d.join(e,r);if(P.existsSync(n))return n}return null}function Y(e,t){return e.map((a)=>{let r=d.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var J=u(()=>{F();M();N();b()});function Z(e){T=e.replace(/\/$/,"")}function Q(e,t,a={}){p[e]={path:t,name:e,params:a}}function ee(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")p[t]={path:a,name:t};else p[t]={...a,name:t}}function te(e,t={},a=!1){let r=p[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},s=r.path;s=s.replace(/:(\w+)/g,(i,l)=>{let c=n[l];if(c===void 0)return console.warn(`Missing parameter [${l}] for route [${e}].`),`:${l}`;return delete n[l],encodeURIComponent(String(c))});let o=Object.entries(n);if(o.length>0){let i=o.map(([l,c])=>`${encodeURIComponent(l)}=${encodeURIComponent(String(c))}`).join("&");s+=(s.includes("?")?"&":"?")+i}return a&&T?`${T}${s}`:s}function re(){for(let e of Object.keys(p))delete p[e];T=""}var p,T="";var ae=u(()=>{p={}});import ne from"fs";import oe from"path";function se(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function ie(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function le(e,t={}){return{handler:e,mode:t.mode??"universal"}}function B(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...s]=r.split("=");if(n){let o=n.trim(),i=s.join("=").trim();if(o)t[o]=decodeURIComponent(i)}}return t}function E(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function G(e,t){let a=e.headers.get("cookie")||"",r=B(a);return{get(n){return r[n]},set(n,s,o={}){r[n]=s,t.append("Set-Cookie",E(n,s,o))},delete(n){delete r[n],t.append("Set-Cookie",E(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function U(){return{get(e){if(typeof document>"u")return;return B(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=E(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=E(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return B(document.cookie)}}}function X(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}function R(e,t){w.set(e,t)}function j(e){return w.get(e)}function ce(e){return w.has(e)}function ue(){w.clear()}function he(){return Array.from(w.keys())}async function de(e,t="middleware"){let a=oe.resolve(e,t);if(!ne.existsSync(a))return;let r=ne.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let s=n.replace(/\.(ts|js)$/,""),o=oe.join(a,n);try{let l=(await import(o)).default;if(l&&typeof l.handler==="function")R(s,l);else if(typeof l==="function")R(s,{handler:l,mode:"universal"})}catch(i){console.warn(`Failed to load middleware '${s}' from ${o}:`,i)}}}function Se(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function pe(e,t,a,r=""){return{path:e,params:t,query:Se(r),fullPath:r?`${e}?${r}`:e,meta:a}}function fe(e,t,a,r){let n=r?.isServer??typeof window>"u",s=!n,o=new Headers;return{to:e,from:t,isClient:s,isServer:n,cookies:n&&a?G(a,o):U(),storage:X(),state:{},request:a,responseHeaders:o}}async function ge(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let s=j(n);if(!s)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(s.mode==="server"&&!r)continue;try{let o=await s.handler(t);if(o){if(o.type==="redirect")return{passed:!1,redirect:o,state:t.state,responseHeaders:t.responseHeaders};if(o.type==="abort")return{passed:!1,abort:o,state:t.state,responseHeaders:t.responseHeaders}}}catch(o){return console.error(`Error in middleware '${n}':`,o),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:o instanceof Error?o.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}var w;var me=u(()=>{w=new Map});function q(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function ye(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||q(n)}}var ve=()=>{};function ke(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function we(){if(L)return L;return L=ke(`
2
+ import{aw as Te,bw as u}from"./chunk-jp2f8yzw.js";function F(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>m.includes(a))}function y(e){return F(e.replace(/^\//,""))}var m;var x=u(()=>{m=["components","layouts","partials","emails"]});import d from"fs";import v from"path";function S(e,t){let a=e.filter((o)=>!y(o.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let o of a){let i=[];for(let c of o.params){let h=o.pattern.includes(`:${c}?`)?"?":"";i.push(`${c}${h}: string`)}let l=i.join("; ");r.push(` '${o.pattern}': { ${l} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
+ `),s=v.join(t,"route-types.d.ts");try{if(d.existsSync(s)&&d.readFileSync(s,"utf8")===n)return;d.mkdirSync(t,{recursive:!0}),d.writeFileSync(s,n)}catch{}}function k(e,t,a){let r=process.cwd(),n=v.relative(r,a),s=e.filter((i)=>!y(i.pattern)),o=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let i of s){let l=v.relative(r,i.filePath).replace(/\\/g,"/"),c=JSON.stringify(i.params),h=i.layout?`, layout: '${v.relative(r,i.layout).replace(/\\/g,"/")}'`:"";o.push(` { pattern: '${i.pattern}', filePath: '${l}', isDynamic: ${i.isDynamic}, params: ${c}${h} },`)}o.push("] as const",""),o.push("export type RouteName = typeof routes[number]['pattern']",""),d.mkdirSync(t,{recursive:!0}),d.writeFileSync(v.join(t,"routes.ts"),o.join(`
4
+ `))}var M=u(()=>{x()});import D from"path";function A(e,t){let r=D.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(D.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function w(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),s=/^\/:([^/?*]+)\?/.exec(n);if(s){t.push(s[1]),a+="(?:/([^/]+))?",r+=s[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){t.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function W(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let s={};return r.params.forEach((o,i)=>{s[o]=n[i+1]}),{route:r,params:s}}}return null}function K(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return w(t)}var I=()=>{};import ke from"fs";import N from"path";function C(e,t){let a=[],r=N.dirname(e);while(r.startsWith(t)||r===t){let n=N.join(r,"_layout.stx");if(ke.existsSync(n))a.unshift(n);if(r===t)break;r=N.dirname(r)}return a}var B=()=>{};import P from"fs";import p from"path";function $(e,t){let a=[];if(!P.existsSync(e))return a;let r=P.readdirSync(e,{withFileTypes:!0});for(let n of r){let s=p.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(m.includes(n.name))continue;a.push(...$(s,t))}else if(n.isFile()){let o=p.extname(n.name);if(t.includes(o)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(s)}}}return a}class T{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((o)=>p.resolve(e,o)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=new Set;this.routes=[];for(let o of this.pagesDirs){let i=$(o,r),l=new Map;for(let c of i){let h=A(c,o),g=t.pagesDirs?h.replace(/:[\w]+/g,":param"):h;if(t.pagesDirs&&l.has(g))throw Error(`Conflicting layer pages for ${h}: ${l.get(g)} and ${c}`);if(l.set(g,c),n.has(g))continue;n.add(g);let{regex:Se,params:V}=w(h),O=t.layouts!==!1?C(c,o):[];this.routes.push({pattern:h,regex:Se,params:V,filePath:c,isDynamic:V.length>0,layout:O.length>0?O[O.length-1]:void 0})}}this.routes.sort((o,i)=>{if(!o.isDynamic&&i.isDynamic)return-1;if(o.isDynamic&&!i.isDynamic)return 1;let l=o.pattern.split("/").length,c=i.pattern.split("/").length;if(l!==c)return c-l;return o.pattern.localeCompare(i.pattern)});let s=p.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");S(this.routes,s),k(this.routes,s,this.pagesDir)}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((s,o)=>{n[s]=r[o+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,s]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(s));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function z(e,t){return new T(e,t)}function J(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=p.join(e,r);if(P.existsSync(n))return n}return null}function Y(e,t){return e.map((a)=>{let r=p.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var Z=u(()=>{M();I();B();x()});function Q(e){R=e.replace(/\/$/,"")}function ee(e,t,a={}){f[e]={path:t,name:e,params:a}}function te(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function re(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},s=r.path;s=s.replace(/:(\w+)/g,(i,l)=>{let c=n[l];if(c===void 0)return console.warn(`Missing parameter [${l}] for route [${e}].`),`:${l}`;return delete n[l],encodeURIComponent(String(c))});let o=Object.entries(n);if(o.length>0){let i=o.map(([l,c])=>`${encodeURIComponent(l)}=${encodeURIComponent(String(c))}`).join("&");s+=(s.includes("?")?"&":"?")+i}return a&&R?`${R}${s}`:s}function ae(){for(let e of Object.keys(f))delete f[e];R=""}var f,R="";var ne=u(()=>{f={}});import oe from"fs";import se from"path";function ie(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function le(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function ce(e,t={}){return{handler:e,mode:t.mode??"universal"}}function G(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...s]=r.split("=");if(n){let o=n.trim(),i=s.join("=").trim();if(o)t[o]=decodeURIComponent(i)}}return t}function E(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function U(e,t){let a=e.headers.get("cookie")||"",r=G(a);return{get(n){return r[n]},set(n,s,o={}){r[n]=s,t.append("Set-Cookie",E(n,s,o))},delete(n){delete r[n],t.append("Set-Cookie",E(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function X(){return{get(e){if(typeof document>"u")return;return G(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=E(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=E(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return G(document.cookie)}}}function j(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}function L(e,t){b.set(e,t)}function q(e){return b.get(e)}function ue(e){return b.has(e)}function he(){b.clear()}function de(){return Array.from(b.keys())}async function pe(e,t="middleware"){let a=se.resolve(e,t);if(!oe.existsSync(a))return;let r=oe.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let s=n.replace(/\.(ts|js)$/,""),o=se.join(a,n);try{let l=(await import(o)).default;if(l&&typeof l.handler==="function")L(s,l);else if(typeof l==="function")L(s,{handler:l,mode:"universal"})}catch(i){console.warn(`Failed to load middleware '${s}' from ${o}:`,i)}}}function Ae(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function fe(e,t,a,r=""){return{path:e,params:t,query:Ae(r),fullPath:r?`${e}?${r}`:e,meta:a}}function ge(e,t,a,r){let n=r?.isServer??typeof window>"u",s=!n,o=new Headers;return{to:e,from:t,isClient:s,isServer:n,cookies:n&&a?U(a,o):X(),storage:j(),state:{},request:a,responseHeaders:o}}async function me(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let s=q(n);if(!s)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(s.mode==="server"&&!r)continue;try{let o=await s.handler(t);if(o){if(o.type==="redirect")return{passed:!1,redirect:o,state:t.state,responseHeaders:t.responseHeaders};if(o.type==="abort")return{passed:!1,abort:o,state:t.state,responseHeaders:t.responseHeaders}}}catch(o){return console.error(`Error in middleware '${n}':`,o),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:o instanceof Error?o.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}var b;var ye=u(()=>{b=new Map});function H(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function ve(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||H(n)}}var we=()=>{};function Ce(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function be(){if(_)return _;return _=Ce(`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=7;
@@ -14,6 +14,17 @@ import{uv as Ae,vv as u}from"./chunk-ddqkj56r.js";function _(e){return e.split(/
14
14
  var debug=!!o.debug;
15
15
  function log(){if(debug&&typeof console!=='undefined'&&console.log)console.log.apply(console,arguments)}
16
16
 
17
+ // Replace, never merge: absent payloads must forget the outgoing page's data.
18
+ // Run at the committed swap, not during prefetch or a superseded navigation.
19
+ function hydrateServerData(html){
20
+ window.__STX_RUNTIME_CONFIG__={};
21
+ var configMatch=html.match(/<script\\b[^>]*\\bdata-stx-runtime-config\\b[^>]*>([\\s\\S]*?)<\\/script>/i);
22
+ if(configMatch){try{var configValues=JSON.parse(configMatch[1]);if(configValues&&typeof configValues==='object'&&!Array.isArray(configValues))window.__STX_RUNTIME_CONFIG__=configValues}catch(e){}}
23
+ window.__STX_DATA__={};
24
+ var match=html.match(/<script\\b[^>]*\\bdata-stx-server-data\\b[^>]*>([\\s\\S]*?)<\\/script>/i);
25
+ if(match){try{var values=JSON.parse(match[1]);if(values&&typeof values==='object'&&!Array.isArray(values))window.__STX_DATA__=values}catch(e){}}
26
+ }
27
+
17
28
  // \u2500\u2500 Build skew (stacksjs/stx#1772) \u2500\u2500
18
29
  // The build that rendered THIS document, and therefore the build the runtime
19
30
  // executing right now came from. Under bun --watch a save restarts the server,
@@ -902,6 +913,7 @@ else {
902
913
  return Promise.resolve(false);
903
914
  }
904
915
  function doFragSwap(){
916
+ hydrateServerData(html);
905
917
  // Extract scripts from fragment before injecting HTML
906
918
  var fragScripts=[];
907
919
  var fragScriptId=0;
@@ -1332,6 +1344,10 @@ else {
1332
1344
  if(incomingSetupName)document.body.setAttribute('data-stx',incomingSetupName);
1333
1345
  }
1334
1346
 
1347
+ // Teardown (including outgoing layout chrome) has finished. Its destroy
1348
+ // callbacks must not be able to invalidate the incoming page's snapshot.
1349
+ hydrateServerData(html);
1350
+
1335
1351
  // \u2500\u2500 Load new external <head> scripts \u2500\u2500
1336
1352
  var loadedSrcs={};
1337
1353
  document.querySelectorAll('head script[src]').forEach(function(s){loadedSrcs[s.src]=1});
@@ -1980,5 +1996,5 @@ else {
1980
1996
 
1981
1997
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
1982
1998
  })();
1983
- `),L}var L;var be=()=>{};var Ce={};Ae(Ce,{setAppUrl:()=>Z,runMiddleware:()=>ge,route:()=>te,resolveLayoutChain:()=>A,resetRoutes:()=>re,registerMiddleware:()=>R,patternToRegex:()=>v,navigateTo:()=>se,matchRoute:()=>D,loadMiddlewareFromDirectory:()=>de,isNonPageRoutePattern:()=>m,isNonPageRoutePath:()=>_,hasMiddleware:()=>ce,getRouterScript:()=>we,getMiddlewareNames:()=>he,getMiddleware:()=>j,generateRouteTypes:()=>x,generateRouteManifest:()=>S,formatRoutes:()=>Y,findErrorPage:()=>z,filePathToPattern:()=>k,extractLayoutMetadata:()=>ye,deriveLayoutGroup:()=>q,defineRoutes:()=>ee,defineRoute:()=>Q,defineMiddleware:()=>le,createStorageManager:()=>X,createServerCookieManager:()=>G,createRouter:()=>$,createRouteLocation:()=>pe,createMiddlewareContext:()=>fe,createClientCookieManager:()=>U,clearMiddleware:()=>ue,bracketPathToRegex:()=>W,abortNavigation:()=>ie,Router:()=>C,NON_PAGE_DIRS:()=>g});var Te=u(()=>{J();M();ae();me();N();ve();F();b();be()});
1984
- export{g as Bu,_ as Cu,m as Du,x as Eu,S as Fu,k as Gu,v as Hu,D as Iu,W as Ju,A as Ku,C as Lu,$ as Mu,z as Nu,Y as Ou,Z as Pu,Q as Qu,ee as Ru,te as Su,re as Tu,se as Uu,ie as Vu,le as Wu,G as Xu,U as Yu,X as Zu,R as _u,j as $u,ce as av,ue as bv,he as cv,de as dv,pe as ev,fe as fv,ge as gv,q as hv,ye as iv,ve as jv,we as kv,Ce as lv,Te as mv};
1999
+ `),_}var _;var xe=()=>{};var Re={};Te(Re,{setAppUrl:()=>Q,runMiddleware:()=>me,route:()=>re,resolveLayoutChain:()=>C,resetRoutes:()=>ae,registerMiddleware:()=>L,patternToRegex:()=>w,navigateTo:()=>ie,matchRoute:()=>W,loadMiddlewareFromDirectory:()=>pe,isNonPageRoutePattern:()=>y,isNonPageRoutePath:()=>F,hasMiddleware:()=>ue,getRouterScript:()=>be,getMiddlewareNames:()=>de,getMiddleware:()=>q,generateRouteTypes:()=>S,generateRouteManifest:()=>k,formatRoutes:()=>Y,findErrorPage:()=>J,filePathToPattern:()=>A,extractLayoutMetadata:()=>ve,deriveLayoutGroup:()=>H,defineRoutes:()=>te,defineRoute:()=>ee,defineMiddleware:()=>ce,createStorageManager:()=>j,createServerCookieManager:()=>U,createRouter:()=>z,createRouteLocation:()=>fe,createMiddlewareContext:()=>ge,createClientCookieManager:()=>X,clearMiddleware:()=>he,bracketPathToRegex:()=>K,abortNavigation:()=>le,Router:()=>T,NON_PAGE_DIRS:()=>m});var Ee=u(()=>{Z();I();ne();ye();B();we();M();x();xe()});
2000
+ export{m as hv,F as iv,y as jv,S as kv,k as lv,A as mv,w as nv,W as ov,K as pv,C as qv,T as rv,z as sv,J as tv,Y as uv,Q as vv,ee as wv,te as xv,re as yv,ae as zv,ie as Av,le as Bv,ce as Cv,U as Dv,X as Ev,j as Fv,L as Gv,q as Hv,ue as Iv,he as Jv,de as Kv,pe as Lv,fe as Mv,ge as Nv,me as Ov,H as Pv,ve as Qv,we as Rv,be as Sv,Re as Tv,Ee as Uv};