@stacksjs/stx 0.2.859 → 0.2.862

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 (288) hide show
  1. package/dist/analytics.js +3 -2
  2. package/dist/animation.js +3 -3
  3. package/dist/app-shell.js +4 -3
  4. package/dist/{chunk-14cvwsy1.js → chunk-01c16zw4.js} +2 -2
  5. package/dist/chunk-0bfgsv31.js +2 -0
  6. package/dist/chunk-0c9c9v03.js +14 -0
  7. package/dist/{chunk-wjamjgx6.js → chunk-0fh47gp0.js} +2 -2
  8. package/dist/chunk-0fpx3ctt.js +2 -0
  9. package/dist/chunk-0twkeh31.js +2 -0
  10. package/dist/chunk-0xtda6aw.js +2 -0
  11. package/dist/chunk-12sv6b9c.js +2 -0
  12. package/dist/chunk-194t5qat.js +2 -0
  13. package/dist/chunk-1crn4fv0.js +2 -0
  14. package/dist/chunk-1d3swbqw.js +2 -0
  15. package/dist/{chunk-4yfbd8ny.js → chunk-1mqcttg3.js} +6 -6
  16. package/dist/chunk-1qf07v41.js +2 -0
  17. package/dist/chunk-24hq8mka.js +3 -0
  18. package/dist/chunk-2asyyky3.js +2 -0
  19. package/dist/chunk-2dpessnc.js +54 -0
  20. package/dist/{chunk-ews9yzr7.js → chunk-2jgtfjyr.js} +5 -5
  21. package/dist/chunk-2kfayg4t.js +712 -0
  22. package/dist/chunk-2rff5mbj.js +4 -0
  23. package/dist/chunk-2s7rmn9r.js +3 -0
  24. package/dist/{chunk-v9h7s8ce.js → chunk-2srjavsn.js} +2 -2
  25. package/dist/chunk-2zqh7xct.js +2 -0
  26. package/dist/chunk-321fbxnm.js +1327 -0
  27. package/dist/chunk-3gk1e2b1.js +2 -0
  28. package/dist/chunk-3ryp43f3.js +2 -0
  29. package/dist/{chunk-12r22pf0.js → chunk-3z1mmar2.js} +2 -2
  30. package/dist/{chunk-zhxdpzga.js → chunk-46ddesnf.js} +3 -3
  31. package/dist/chunk-46pxmpeb.js +3 -0
  32. package/dist/chunk-4pr29yrx.js +2 -0
  33. package/dist/{chunk-wfd9e224.js → chunk-4xanjv22.js} +125 -126
  34. package/dist/chunk-4ykgjewy.js +16 -0
  35. package/dist/{chunk-ftwdjgzd.js → chunk-55zq2ha8.js} +5 -5
  36. package/dist/{chunk-9a3rv0rj.js → chunk-5a0d3048.js} +3 -3
  37. package/dist/chunk-5ertqfs3.js +2 -0
  38. package/dist/chunk-627hzzs3.js +2 -0
  39. package/dist/chunk-64ebysb4.js +2 -0
  40. package/dist/{chunk-k8pzk8v9.js → chunk-669b2bya.js} +4 -4
  41. package/dist/{chunk-ktnb1j54.js → chunk-67dgp45w.js} +2 -2
  42. package/dist/chunk-6fstz73t.js +2 -0
  43. package/dist/{chunk-gndxakrh.js → chunk-6ftee542.js} +2 -2
  44. package/dist/{chunk-5wr1qqz3.js → chunk-6k4ac74t.js} +2 -2
  45. package/dist/{chunk-astcp7bc.js → chunk-6m63rc7m.js} +8 -8
  46. package/dist/{chunk-q3cyycnh.js → chunk-6m6y9bbx.js} +1 -1
  47. package/dist/chunk-6pczzq5f.js +2 -0
  48. package/dist/{chunk-6t0xy3wk.js → chunk-7ayvybdy.js} +3 -3
  49. package/dist/chunk-7mjf144y.js +2 -0
  50. package/dist/{chunk-9qe4qsc7.js → chunk-7mpqfg98.js} +21 -21
  51. package/dist/chunk-7q5h2cve.js +2 -0
  52. package/dist/chunk-7wqevtks.js +2 -0
  53. package/dist/chunk-84ztb43k.js +2 -0
  54. package/dist/{chunk-6e44f8w8.js → chunk-8502xb4n.js} +39 -39
  55. package/dist/{chunk-ywk6t76q.js → chunk-85j9qh7v.js} +45 -46
  56. package/dist/{chunk-cxpq2zna.js → chunk-8arfg8kp.js} +3 -3
  57. package/dist/{chunk-33x46g87.js → chunk-8hhhmscy.js} +2 -2
  58. package/dist/{chunk-x9c4njvx.js → chunk-8me8hamk.js} +2 -2
  59. package/dist/{chunk-pb09xy77.js → chunk-8s6s6nd0.js} +2 -2
  60. package/dist/chunk-8v1zpdef.js +2 -0
  61. package/dist/chunk-94mpe1ny.js +3 -0
  62. package/dist/chunk-94wnfxnd.js +2 -0
  63. package/dist/chunk-9jxs8sw2.js +2 -0
  64. package/dist/{chunk-2w7csg0c.js → chunk-9y9jecky.js} +1 -1
  65. package/dist/{chunk-mzes9ds7.js → chunk-9zrvh3pz.js} +2 -2
  66. package/dist/{chunk-hf9pvmq2.js → chunk-adb045wf.js} +3 -3
  67. package/dist/{chunk-fpkp0bqf.js → chunk-adqh1gp1.js} +1 -1
  68. package/dist/chunk-az5xw3w8.js +2 -0
  69. package/dist/chunk-ba91r7q9.js +2 -0
  70. package/dist/{chunk-qkcn0exq.js → chunk-brzjass3.js} +6 -6
  71. package/dist/chunk-bv7g3b3b.js +2 -0
  72. package/dist/chunk-bwdbj60y.js +3 -0
  73. package/dist/chunk-bwz2ehq9.js +33 -0
  74. package/dist/{chunk-ts4t2n6b.js → chunk-bx5d87xx.js} +6 -7
  75. package/dist/chunk-bz6dg4k8.js +3 -0
  76. package/dist/chunk-c34qn4k8.js +16 -0
  77. package/dist/{chunk-0es47pwe.js → chunk-cqhwzd9y.js} +5 -5
  78. package/dist/chunk-cvgbtmxp.js +2 -0
  79. package/dist/chunk-czpn3n1p.js +2 -0
  80. package/dist/chunk-dhnw2qwq.js +25 -0
  81. package/dist/{chunk-3w3fxcyx.js → chunk-dpmayc2w.js} +2 -2
  82. package/dist/{chunk-6mza6zr3.js → chunk-dtarm8x9.js} +9 -9
  83. package/dist/chunk-dydy9zrq.js +3 -0
  84. package/dist/chunk-eafqxbr0.js +2 -0
  85. package/dist/{chunk-52b6czss.js → chunk-eeq8k81z.js} +155 -157
  86. package/dist/{chunk-26jt4jvh.js → chunk-ew5cey88.js} +1 -1
  87. package/dist/chunk-fa97kz5j.js +2 -0
  88. package/dist/{chunk-xppm4cs4.js → chunk-farh4p7f.js} +3 -3
  89. package/dist/{chunk-3248qphb.js → chunk-fnxg6134.js} +10 -10
  90. package/dist/chunk-g075cc67.js +2 -0
  91. package/dist/{chunk-618t6hxp.js → chunk-g5xth2yx.js} +6 -6
  92. package/dist/{chunk-xpg52hsz.js → chunk-gbtbfg7e.js} +3 -3
  93. package/dist/{chunk-xytq7q8j.js → chunk-gd56arnm.js} +2 -2
  94. package/dist/chunk-gmm3kffd.js +2 -0
  95. package/dist/{chunk-dbm963p9.js → chunk-gp8hgpt9.js} +4 -4
  96. package/dist/chunk-h2qgqjkn.js +2 -0
  97. package/dist/chunk-h65shwe9.js +2 -0
  98. package/dist/chunk-hdjn7nw9.js +20 -0
  99. package/dist/{chunk-yd6ej23e.js → chunk-hev4t4d5.js} +6 -6
  100. package/dist/chunk-hf5fj7pr.js +2 -0
  101. package/dist/{chunk-cj9rev2p.js → chunk-hmdkf6c6.js} +2 -2
  102. package/dist/chunk-hsp9h3jn.js +2 -0
  103. package/dist/{chunk-p9jfn4yh.js → chunk-j1efsjsb.js} +5 -5
  104. package/dist/chunk-j4zrq17p.js +2 -0
  105. package/dist/chunk-jx5mss16.js +2 -0
  106. package/dist/chunk-jz84z19v.js +2 -0
  107. package/dist/{chunk-5rxks14t.js → chunk-k32q90b2.js} +2 -2
  108. package/dist/{chunk-4a0x737h.js → chunk-kbdz4762.js} +8 -8
  109. package/dist/chunk-kw11yydy.js +2 -0
  110. package/dist/{chunk-v4rrgphj.js → chunk-kwk3kxrx.js} +3 -3
  111. package/dist/chunk-kyer53x3.js +2 -0
  112. package/dist/chunk-m9cperj4.js +2 -0
  113. package/dist/{chunk-fxxh149b.js → chunk-mcnwvh06.js} +6 -6
  114. package/dist/chunk-meqsd5bt.js +2 -0
  115. package/dist/{chunk-s4592dy0.js → chunk-mfa07erx.js} +16 -16
  116. package/dist/chunk-mj4wbrw7.js +2 -0
  117. package/dist/{chunk-0yw86e75.js → chunk-mjy98ppb.js} +9 -9
  118. package/dist/{chunk-jh2v1vvb.js → chunk-mrh08821.js} +3 -3
  119. package/dist/{chunk-gq9h36jf.js → chunk-n058hznh.js} +5 -5
  120. package/dist/{chunk-9n8t7v78.js → chunk-n3jw3xpj.js} +2 -2
  121. package/dist/chunk-nz9z3ct9.js +2 -0
  122. package/dist/chunk-p0tkhd12.js +2 -0
  123. package/dist/chunk-p2etn78y.js +2 -0
  124. package/dist/{chunk-1nankvf6.js → chunk-pbakxcv8.js} +2 -2
  125. package/dist/{chunk-t5q31st4.js → chunk-q1wxgw5s.js} +2 -2
  126. package/dist/chunk-qa5y30sy.js +72 -0
  127. package/dist/{chunk-m1qqqc2j.js → chunk-qbghf76y.js} +4 -4
  128. package/dist/{chunk-a9c3gndq.js → chunk-qcxrcypb.js} +2 -2
  129. package/dist/{chunk-fkh4xece.js → chunk-qjey0jk6.js} +2 -2
  130. package/dist/chunk-rqa92xm4.js +2 -0
  131. package/dist/chunk-rvhrtnv3.js +12 -0
  132. package/dist/{chunk-7m17m22p.js → chunk-s0sad753.js} +2 -2
  133. package/dist/chunk-s92j8k4z.js +2 -0
  134. package/dist/chunk-s9df8srx.js +6 -0
  135. package/dist/{chunk-rgjjt1mb.js → chunk-sb8n32rn.js} +1 -1
  136. package/dist/chunk-snz2cxqv.js +2 -0
  137. package/dist/{chunk-14h4n1sj.js → chunk-srgnevws.js} +2 -2
  138. package/dist/chunk-srgpz94e.js +42 -0
  139. package/dist/{chunk-2sq9pdg3.js → chunk-tnp2ta5q.js} +2 -2
  140. package/dist/{chunk-5t1k0dxm.js → chunk-v37zmez0.js} +2 -2
  141. package/dist/chunk-v408qsze.js +2 -0
  142. package/dist/{chunk-qgxwf9xr.js → chunk-v4xes880.js} +3 -3
  143. package/dist/chunk-vfx1p83g.js +33 -0
  144. package/dist/chunk-vk98r75z.js +2 -0
  145. package/dist/{chunk-ypgegzh2.js → chunk-vvzys1x7.js} +3 -3
  146. package/dist/{chunk-f1vvhbmw.js → chunk-w6pzkcjp.js} +2 -2
  147. package/dist/chunk-x0s68p47.js +2 -0
  148. package/dist/{chunk-g17q4y5k.js → chunk-x512h2gv.js} +4 -4
  149. package/dist/{chunk-shke1fcm.js → chunk-x7redxyd.js} +4 -4
  150. package/dist/chunk-xjxcwrqs.js +2 -0
  151. package/dist/chunk-xsq2jf96.js +2 -0
  152. package/dist/chunk-xymr4ys9.js +3 -0
  153. package/dist/{chunk-wdcz6d20.js → chunk-y3qg95wa.js} +8 -8
  154. package/dist/chunk-y7f2x57s.js +2 -0
  155. package/dist/chunk-ymdw4fhd.js +3 -0
  156. package/dist/chunk-ymjjn9pw.js +20 -0
  157. package/dist/chunk-ynkbv9jq.js +4 -0
  158. package/dist/{chunk-49j3cn9h.js → chunk-ysfeg3cn.js} +2 -2
  159. package/dist/chunk-ytzzth34.js +2 -0
  160. package/dist/chunk-yxpjj003.js +2 -0
  161. package/dist/chunk-z1rs6b4x.js +2 -0
  162. package/dist/{chunk-yehdcjn1.js → chunk-z512gt4v.js} +3 -3
  163. package/dist/chunk-z6ntmv5x.js +2 -0
  164. package/dist/{chunk-5n7m8vqx.js → chunk-zbvfjm4a.js} +2 -2
  165. package/dist/chunk-zsnmk5me.js +2 -0
  166. package/dist/cli.js +35 -35
  167. package/dist/craft-entry.js +2 -2
  168. package/dist/craft.js +2 -2
  169. package/dist/dev-server/serve-app.js +3 -2
  170. package/dist/dev-server/serve-multi.js +3 -4
  171. package/dist/dev-server/ts-css.js +4 -5
  172. package/dist/document-shell.js +4 -3
  173. package/dist/document-tags.d.ts +8 -0
  174. package/dist/document-tags.js +37 -0
  175. package/dist/events.js +2 -1
  176. package/dist/head-injection.js +2 -1
  177. package/dist/heatmap.js +2 -1
  178. package/dist/hot-reload.js +3 -1
  179. package/dist/index.d.ts +1 -0
  180. package/dist/index.js +1 -0
  181. package/dist/native-build.js +3 -3
  182. package/dist/process.js +5 -6
  183. package/dist/production-build.js +3 -3
  184. package/dist/pwa/inject.js +3 -3
  185. package/dist/pwa.js +3 -3
  186. package/dist/reactive-bindings.js +2 -1
  187. package/dist/reactive.js +2 -1
  188. package/dist/render.js +2 -6
  189. package/dist/runtime-injection.js +6 -6
  190. package/dist/serve.js +2 -6
  191. package/dist/site-builder/build.js +2 -2
  192. package/dist/site-builder/i18n.js +2 -2
  193. package/dist/site-builder/router.js +2 -5
  194. package/dist/site-builder/theme.js +2 -2
  195. package/dist/ssg.js +30 -31
  196. package/dist/template-hydrator.js +2 -1
  197. package/dist/web-components/css-scoping.js +3 -3
  198. package/dist/x-element.js +2 -1
  199. package/package.json +5 -5
  200. package/dist/chunk-13fe3avf.js +0 -2
  201. package/dist/chunk-1hebvmaj.js +0 -2
  202. package/dist/chunk-1p47cg0g.js +0 -2
  203. package/dist/chunk-1v95w26e.js +0 -20
  204. package/dist/chunk-1z46g29d.js +0 -2
  205. package/dist/chunk-228cbw2p.js +0 -2
  206. package/dist/chunk-2bggrzv0.js +0 -2
  207. package/dist/chunk-2dnd2s2a.js +0 -3
  208. package/dist/chunk-2kc0vsnb.js +0 -54
  209. package/dist/chunk-34rh88vd.js +0 -2
  210. package/dist/chunk-3cqp0m62.js +0 -2
  211. package/dist/chunk-3dtzcc9j.js +0 -2
  212. package/dist/chunk-3rgqrs3c.js +0 -2
  213. package/dist/chunk-403a4pqm.js +0 -25
  214. package/dist/chunk-51kb36f7.js +0 -2
  215. package/dist/chunk-53ezn1tw.js +0 -2
  216. package/dist/chunk-5va6c7jf.js +0 -14
  217. package/dist/chunk-636j1nmd.js +0 -2
  218. package/dist/chunk-6w5a5ns4.js +0 -18
  219. package/dist/chunk-756rpwn0.js +0 -2
  220. package/dist/chunk-7pq02v7n.js +0 -2
  221. package/dist/chunk-7sht1rkv.js +0 -2
  222. package/dist/chunk-7trdtz0c.js +0 -3
  223. package/dist/chunk-7ycmnsh5.js +0 -2
  224. package/dist/chunk-8mdhencj.js +0 -42
  225. package/dist/chunk-9nh48zvm.js +0 -72
  226. package/dist/chunk-9rgp005c.js +0 -2
  227. package/dist/chunk-9xr628ew.js +0 -3
  228. package/dist/chunk-aq8r4rbs.js +0 -3
  229. package/dist/chunk-azvx5gaa.js +0 -2
  230. package/dist/chunk-b1kc0ka1.js +0 -712
  231. package/dist/chunk-ebk1723c.js +0 -2
  232. package/dist/chunk-emc7zqry.js +0 -2
  233. package/dist/chunk-eppv6knk.js +0 -2
  234. package/dist/chunk-f18rxz70.js +0 -2
  235. package/dist/chunk-f935fec7.js +0 -2
  236. package/dist/chunk-g0v1shhr.js +0 -2
  237. package/dist/chunk-g5pg0pg1.js +0 -2
  238. package/dist/chunk-g8x32bq2.js +0 -2
  239. package/dist/chunk-g978f9qg.js +0 -18
  240. package/dist/chunk-hk7vjyqa.js +0 -2
  241. package/dist/chunk-jd4dr23j.js +0 -3
  242. package/dist/chunk-jhm1228j.js +0 -4
  243. package/dist/chunk-jmaw2cdt.js +0 -2
  244. package/dist/chunk-jw75rmpw.js +0 -2
  245. package/dist/chunk-kgrvvtcy.js +0 -3
  246. package/dist/chunk-kpsxhm4x.js +0 -33
  247. package/dist/chunk-kvc9cwvx.js +0 -12
  248. package/dist/chunk-m3fq72f8.js +0 -2
  249. package/dist/chunk-n54twtm7.js +0 -2
  250. package/dist/chunk-np6y9evb.js +0 -2
  251. package/dist/chunk-p95fsnbk.js +0 -2
  252. package/dist/chunk-pk0mxjxw.js +0 -2
  253. package/dist/chunk-q87hkwfg.js +0 -3
  254. package/dist/chunk-q9r13taa.js +0 -2
  255. package/dist/chunk-qd87dk1d.js +0 -1329
  256. package/dist/chunk-qe6631me.js +0 -2
  257. package/dist/chunk-qqjhq0hb.js +0 -2
  258. package/dist/chunk-qsjkewah.js +0 -2
  259. package/dist/chunk-qttq8cje.js +0 -2
  260. package/dist/chunk-qw80eta1.js +0 -2
  261. package/dist/chunk-r51bfc2y.js +0 -2
  262. package/dist/chunk-rbrvepr3.js +0 -2
  263. package/dist/chunk-rwxg4m3h.js +0 -3
  264. package/dist/chunk-se4ny3q0.js +0 -2
  265. package/dist/chunk-shy2hkvj.js +0 -2
  266. package/dist/chunk-sxvv9w8t.js +0 -2
  267. package/dist/chunk-sy703233.js +0 -2
  268. package/dist/chunk-syzn6mq5.js +0 -2
  269. package/dist/chunk-t2nhr2tc.js +0 -2
  270. package/dist/chunk-tc31my2p.js +0 -20
  271. package/dist/chunk-v3r1wwec.js +0 -2
  272. package/dist/chunk-vd5d1yb9.js +0 -2
  273. package/dist/chunk-vj1bwnvs.js +0 -4
  274. package/dist/chunk-vmdsj8r5.js +0 -2
  275. package/dist/chunk-vmg3f76h.js +0 -2
  276. package/dist/chunk-w1d8t47c.js +0 -33
  277. package/dist/chunk-w1stsxm3.js +0 -3
  278. package/dist/chunk-w63c96ce.js +0 -2
  279. package/dist/chunk-wcgca1q6.js +0 -2
  280. package/dist/chunk-wv8qmwqp.js +0 -2
  281. package/dist/chunk-x90f7h2g.js +0 -2
  282. package/dist/chunk-xhnpgey5.js +0 -2
  283. package/dist/chunk-y54pj23g.js +0 -2
  284. package/dist/chunk-yhrkqcqd.js +0 -2
  285. package/dist/chunk-ykxpzjgy.js +0 -2
  286. package/dist/chunk-zhyrhxdp.js +0 -2
  287. package/dist/chunk-zn5tewws.js +0 -2
  288. package/dist/chunk-zvra3bmk.js +0 -2
@@ -0,0 +1,72 @@
1
+ // @bun
2
+ import{Y}from"./chunk-bwdbj60y.js";import{M}from"./chunk-s9df8srx.js";import Ve from"path";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function ee(e){for(let[n,r]of Object.entries(t))if(r===e)return n;return}import bt from"path";var Et={showRelativePaths:!1,enableAutoRecovery:Y(),logRecoveryWarnings:!0},te={...Et};function F(){return{...te}}function z(e){if(!te.showRelativePaths||!e)return e;let n=te.baseDir||process.cwd();try{let r=bt.relative(n,e);return r.startsWith("..")?e:r}catch{return e}}class D extends Error{code;filePath;line;column;context;numericCode;constructor(e,n,r,i,s,o,a){super(e);this.code=n;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=a||t.EVALUATION_ERROR,this.filePath)this.filePath=z(this.filePath)}}class re extends D{constructor(e,n,r,i,s,o){super(e,"stx_RUNTIME_ERROR",n,r,i,s,o||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Or extends D{constructor(e,n,r,i,s,o){super(e,"stx_FILE_ERROR",n,r,i,s,o||t.FILE_NOT_FOUND);this.name="StxFileError"}}class J extends D{isFatal=!0;constructor(e,n,r,i,s,o){super(e,"stx_VALIDATION_ERROR",n,r,i,s,o||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function ve(e){let{type:n,message:r,code:i,filePath:s,line:o,column:a,template:c,offset:g,snippet:l,suggestion:h,format:f="text"}=e,y=o,x=a;if(!y&&c&&g!==void 0){let Q=Tt(c,g);y=Q.line,x=Q.column}let v=s?z(s):void 0,w=i?ee(i):void 0,R={type:n,code:i,codeName:w,message:r,filePath:v,line:y,column:x,snippet:l,suggestion:h,timestamp:new Date().toISOString()},A;switch(f){case"html":A=wt(R);break;case"json":A=JSON.stringify(R,null,2);break;case"console":A=vt(R,c,g);break;case"text":default:A=xt(R,c,g);break}return{formatted:A,data:R}}function xt(e,n,r){let i=[],s=e.code?` [${e.codeName||e.code}]`:"";if(i.push(`[${e.type} Error${s}]`),e.filePath){let o=e.filePath;if(e.line){if(o+=`:${e.line}`,e.column)o+=`:${e.column}`}i.push(`at ${o}`)}if(i.push(`
3
+ ${e.message}`),n&&e.line){let o=St(n,e.line,2);if(o)i.push(`
4
+ ${o}`)}if(e.snippet)i.push(`
5
+ Snippet: ${e.snippet}`);if(e.suggestion)i.push(`
6
+ Suggestion: ${e.suggestion}`);return i.join(" ")}function wt(e){let n=e.code?` [${e.code}]`:"",r=e.filePath?` in ${e.filePath}${e.line?`:${e.line}`:""}`:"",i=`<!-- [${e.type} Error${n}]${r}: ${we(e.message)}`;if(e.suggestion)i+=` | Suggestion: ${we(e.suggestion)}`;return i+=" -->",i}function vt(e,n,r){let l=[],h=e.code?` [${e.codeName||e.code}]`:"";if(l.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${e.type} Error${h} \u2501\u2501\u2501${"\x1B[0m"}`),e.filePath){let f=`\x1B[36m${e.filePath}\x1B[0m`;if(e.line){if(f+=`\x1B[90m:${e.line}\x1B[0m`,e.column)f+=`\x1B[90m:${e.column}\x1B[0m`}l.push(`
7
+ \x1B[90mat\x1B[0m ${f}`)}if(l.push(`
8
+
9
+ ${e.message}`),n&&e.line){let f=kt(n,e.line,2);if(f)l.push(`
10
+
11
+ \x1B[90mContext:\x1B[0m
12
+ ${f}`)}if(e.suggestion)l.push(`
13
+
14
+ \x1B[33mSuggestion:\x1B[0m ${e.suggestion}`);return l.push(`
15
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),l.join("")}function St(e,n,r){let i=e.split(`
16
+ `),s=Math.max(0,n-r-1),o=Math.min(i.length-1,n+r-1),a=[];for(let c=s;c<=o;c++){let g=(c+1).toString().padStart(4),l=c===n-1?">":" ";a.push(`${l}${g} | ${i[c]}`)}return a.join(`
17
+ `)}function kt(e,n,r){let i=e.split(`
18
+ `),s=Math.max(0,n-r-1),o=Math.min(i.length-1,n+r-1),a="\x1B[90m",c="\x1B[31m",g="\x1B[0m",l=[];for(let h=s;h<=o;h++){let f=(h+1).toString().padStart(4),y=h===n-1,x=y?"\x1B[31m>\x1B[0m":" ",v=y?`\x1B[31m${i[h]}\x1B[0m`:`\x1B[90m${i[h]}\x1B[0m`;l.push(`${x}\x1B[90m${f}\x1B[0m | ${v}`)}return l.join(`
19
+ `)}function we(e){return e.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Tt(e,n){let i=e.substring(0,n).split(`
20
+ `);return{line:i.length,column:i[i.length-1].length}}function u(e,n,r){return ve({type:e,message:n,code:r,format:"html"}).formatted}async function $e(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var Ni={isEnabled(){return F().enableAutoRecovery},fixCommonSyntaxErrors(e){let n=F();if(!n.enableAutoRecovery)return{fixed:e,fixes:[]};let r=e,i=[],s=(r.match(/\{\{/g)||[]).length,o=(r.match(/\}\}/g)||[]).length;if(s>o){let c=s-o;r+="}}".repeat(c),i.push(`Added ${c} missing closing braces '}}'`)}let a=["if","foreach","for","switch","section"];for(let c of a){let g=(r.match(new RegExp(`@${c}\\b`,"g"))||[]).length,l=(r.match(new RegExp(`@end${c}\\b`,"g"))||[]).length;if(g>l){let h=g-l;for(let f=0;f<h;f++)r+=`
21
+ @end${c}`;i.push(`Added ${h} missing @end${c}`)}}if(i.length>0&&n.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((c)=>console.warn(` - ${c}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,n){if(Y())return`<!-- ${e} failed: ${n.message} -->`;return"<!-- stx rendering error -->"}};class ne{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,n,r="error"){let i={timestamp:new Date,error:e,context:n,level:r};if(this.errors.push(i),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(r))this.writeToFile(i)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let n=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)n.push(` Stack: ${e.error.stack.split(`
22
+ `).slice(1).join(`
23
+ `)}`);if(e.context)n.push(` Context: ${JSON.stringify(e.context)}`);return n.join(`
24
+ `)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let n=await import("fs"),r=await import("path"),i=r.dirname(this.logFilePath);if(!n.existsSync(i))n.mkdirSync(i,{recursive:!0});await this.rotateIfNeeded(n);let s=`${this.formatEntry(e)}
25
+ `;n.appendFileSync(this.logFilePath,s,"utf-8")}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",n)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let r=this.maxLogFiles-1;r>=1;r--){let i=`${this.logFilePath}.${r}`,s=`${this.logFilePath}.${r+1}`;if(e.existsSync(i))if(r>=this.maxLogFiles-1)e.unlinkSync(i);else e.renameSync(i,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",n)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((n)=>n.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((n)=>n.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},n={error:0,warning:0,info:0};for(let r of this.errors){let i=r.error.constructor.name;e[i]=(e[i]||0)+1;let s=r.level||"error";n[s]=(n[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:n}}async exportToFile(e,n="json"){let r=await import("fs"),i=await import("path"),s=i.dirname(e);if(!r.existsSync(s))r.mkdirSync(s,{recursive:!0});if(n==="json"){let o=this.errors.map((a)=>({timestamp:a.timestamp.toISOString(),level:a.level||"error",type:a.error.constructor.name,message:a.error.message,stack:a.error.stack,context:a.context}));r.writeFileSync(e,JSON.stringify(o,null,2),"utf-8")}else{let o=this.errors.map((a)=>this.formatEntry(a));r.writeFileSync(e,o.join(`
26
+
27
+ `),"utf-8")}}async flush(){await this.writeQueue}}var U=new ne,Rn={isDevelopment(){return Y()},logDetailedError(e,n){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),n)console.error("Context:",n);console.error("========================")},createErrorReport(e,n){let r=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(n)r.push(`Context: ${JSON.stringify(n,null,2)}`);return r.push("========================"),r.join(`
28
+ `)}};function k(e,n,r,i=0){let s=0,o=i,a=null,c=0,g=!1;while(o<e.length){let l=e[o];if(a&&g){g=!1,o++;continue}if(a&&l==="\\"){g=!0,o++;continue}if(g=!1,(l==='"'||l==="'"||l==="`")&&!a){a=l,o++;continue}if(l===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&l==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&l==="}"){c--,o++;continue}if(l==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(l===n)s++;else if(l===r){if(s--,s===0)return o}o++}return-1}function yl(e,n){let r=n,i={paren:0,bracket:0,brace:0},s=null,o=0;while(r<e.length){let a=e[r];if((r>0?e[r-1]:"")==="\\"&&s){r++;continue}if((a==='"'||a==="'")&&!s){s=a,r++;continue}if(a===s&&s!=="`"){s=null,r++;continue}if(a==="`"&&!s){s="`",r++;continue}if(a==="`"&&s==="`"&&o===0){s=null,r++;continue}if(s==="`"&&a==="$"&&e[r+1]==="{"){o++,r+=2;continue}if(o>0){if(a==="{")o++;else if(a==="}")o--;r++;continue}if(s){r++;continue}if(i.paren===0&&i.bracket===0&&i.brace===0){if(e.slice(r,r+2)==="}}"||e.slice(r,r+3)==="!!}")break;if(a===","||a===";")break}if(a==="(")i.paren++;else if(a===")"){if(i.paren--,i.paren<0)break}else if(a==="[")i.bracket++;else if(a==="]"){if(i.bracket--,i.bracket<0)break}else if(a==="{")i.brace++;else if(a==="}"){if(i.brace--,i.brace<0)break}r++}return{expression:e.slice(n,r),endPos:r}}class P{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let r=this.options?this.options.sizeOf(n):0;if(this.options&&r>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+r>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,r),this.bytes+=r}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var N=new Map,Rt=500;function Vt(e,n){if(n?.includes("g"))return new RegExp(e,n);let r=`${e}:${n||""}`;if(!N.has(r)){if(N.size>=Rt){let i=N.keys().next().value;if(i)N.delete(i)}N.set(r,new RegExp(e,n))}return N.get(r)}class ke{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),r=n.sort().join(","),i=this.pool.find((c)=>c.context.join(",")===r);if(i)return i.func;let s=this.fnCache,o=this.fnCacheMaxSize,a=(...c)=>(g)=>{try{let l=`${r}:${g}`,h=s.get(l);if(!h){if(s.size>=o){let f=s.keys().next().value;if(f)s.delete(f)}h=Function(...n,`
29
+ 'use strict';
30
+ try {
31
+ return ${g};
32
+ }
33
+ catch (e) {
34
+ if (e instanceof ReferenceError || e instanceof TypeError) {
35
+ return undefined;
36
+ }
37
+ throw e;
38
+ }
39
+ `),s.set(l,h)}return h(...c)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:a,context:n.slice()});return a}clear(){this.pool.length=0,this.fnCache.clear()}}var ar=new ke;class Te{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,n){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...n})}setBudgets(e){for(let[n,r]of Object.entries(e))this.setBudget(n,r)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[n,r]of this.budgets.entries())e[n]=r;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let n=this.violationHandlers.indexOf(e);if(n!==-1)this.violationHandlers.splice(n,1)}time(e,n){if(!this.enabled)return n();let r=performance.now(),i=n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}async timeAsync(e,n){if(!this.enabled)return n();let r=performance.now(),i=await n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}checkBudget(e,n){let r=this.budgets.get(e);if(!r)return;let i=n/r.maxTime*100,s=r.warnThreshold!==void 0?n>=r.maxTime*r.warnThreshold&&n<r.maxTime:!1,o=n>=r.maxTime;if(!s&&!o)return;let a={label:e,actualTime:n,budgetTime:r.maxTime,exceedancePercent:i,timestamp:new Date,isWarning:s};this.violations.push(a);while(this.violations.length>this.maxViolations)this.violations.shift();for(let g of this.violationHandlers)try{g(a)}catch{}let c=s?`[Performance Warning] "${e}" took ${n.toFixed(2)}ms (${i.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${n.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(i-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(c);break;case"warn":console.warn(c);break;case"error":console.error(c);break;case"throw":if(o)throw Error(c);else console.warn(c);break}}recordTime(e,n){let r=this.metrics.get(e);if(r)r.count++,r.totalTime+=n,r.maxTime=Math.max(r.maxTime,n),r.minTime=Math.min(r.minTime,n);else this.metrics.set(e,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(e){if(e){let r=this.metrics.get(e);if(!r)return{};let i=this.budgets.get(e);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:i?.maxTime,budgetUtilization:i?r.totalTime/r.count/i.maxTime*100:void 0}}let n={};for(let[r,i]of this.metrics.entries()){let s=this.budgets.get(r);n[r]={count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:s?.maxTime,budgetUtilization:s?i.totalTime/i.count/s.maxTime*100:void 0}}return n}getViolations(e){if(e)return this.violations.filter((n)=>n.label===e);return[...this.violations]}getViolationStats(){let e={},n=0,r=0;for(let i of this.violations)if(e[i.label]=(e[i.label]||0)+1,i.isWarning)n++;else r++;return{total:this.violations.length,byLabel:e,warnings:n,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var ie=null;function $t(){if(!ie)ie=new Te;return ie}var pe=new Proxy({},{get(e,n){return $t()[n]}});var Se=0;async function E(){if(performance.now()-Se<16)return;await new Promise((e)=>setTimeout(e,0)),Se=performance.now()}var Ct={maxSanitizeDepth:10,allowBracketNotation:!1},Me={...Ct};var V=/\bnew\s+/,W="__stx_safe_ctors",Ne=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],se=[...Ne,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],Ce=se.map(()=>{return}),oe=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),ce=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,V,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],le=new Set([...Ne,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",W]),ue=new Set(["__proto__","constructor","prototype"]);function De(e){let n="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)n+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}n+=a,r.push(o)}return{text:n,map:r}}function Fe(e){return De(e).text}var ze=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],je=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of ze)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),At=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,Ae=/(?<![\w$])new(?![\w$])/g,_e=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${ze.join(",")}}() are allowed`;function _t(e){let{text:n,map:r}=De(e),i=[];Ae.lastIndex=0;let s;while((s=Ae.exec(n))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,a)))continue;let c=At.exec(n.slice(a)),g=c?.[3],l=!c?null:g?`Intl_${g}`:c[2];if(!c||!l||!(l in je))throw new S(`matched /${V.source}/; ${_e}`,e);let h=a+c[0].length,f=r[a],y=r[h-1]+1;if(e.slice(f,y)!==n.slice(a,h))throw new S(`matched /${V.source}/; ${_e}`,e);let x=f+3+c[1].length;i.push({start:x,end:x+c[2].length,key:l})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${W}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,n,r){super(r??`Potentially unsafe expression (${e}): ${n}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=n}}function Qs(e){try{return ge(e),null}catch(n){return n instanceof S?n.rule:n instanceof Error?n.message:String(n)}}function Be(e,n){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(le.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&ue.has(s))throw new S(`matched /.${s}/; property ${s}`,n)}}function He(e,n=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),g=/^'(?:[^'\\]|\\.)*'$/.test(c),l=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(g||l){let f=c.slice(1,-1);if(ue.has(f))throw new S(`bracket key ${f}`,e);if(!Me.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(n&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function ge(e){let n=e.trim(),r=Fe(n);Be(r,n);let i=He(n);for(let s of ce){if(s===V)continue;if(s.test(r))throw new S(`matched /${s.source}/`,n)}return{..._t(n),dynamicKeys:i}}function Oi(e){return ge(e),e.trim()}var eo=Symbol("stx.sanitizeCache"),It=4000,j=new Map;function Ot(e){let n=j.get(e);if(n===void 0){if(n=ce.some((r)=>r.test(e)),j.size>=It)j.clear();j.set(e,n)}return n}function K(e){let n={},r=e[eo];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=oe,n.parseInt=Number.parseInt,n.parseFloat=Number.parseFloat,n.isNaN=Number.isNaN,n.isFinite=Number.isFinite,n.encodeURIComponent=encodeURIComponent,n.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||Ot(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=ae(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function ae(e,n=0){if(n>=Me.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>ae(i,n+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=ae(s,n+1);else r[i]=s}return r}function d(e,n){try{let r=K(n),i=Object.keys(r),s=Object.values(r);return p(e,i)(...s)}catch{return}}function m(e){try{return Oi(e),!0}catch{return!1}}function hl(e,n){try{let r=K(n),i=Object.keys(r),s=Object.values(r),o=!1,c=p(e,i,()=>{o=!0})(...s);return!o&&Boolean(c)}catch{return!1}}function O(e,n){try{let r=d(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Ue=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),Ie=`stx-compile-probe:${globalThis.crypto.randomUUID()}`,Pt=0,Lt=0;function Mt(e,n){let r="__stx_compile_probe";while(e.includes(r))r+="_";let i=Array.from({length:e.length+1});i[e.length]=Ie;for(let s=0;s<16;s++){let o=`c${++Pt}`,a=`'use strict';if(${r}===${JSON.stringify(Ie)})return ${JSON.stringify(o)};`,c=Function(...e,r,a+n);if(c(...i)===o)return c;Lt++}throw Error("[stx] the JavaScript runtime repeatedly returned code compiled from a different source; refusing to evaluate with it.")}var Nt=2000,H=new Map;function Oe(e,n){let r=`${e.join(",")}\x00${n}`,i=H.get(r);if(i)return i;let s=Mt(e,n);if(H.size>=Nt)H.clear();return H.set(r,s),s}function ut(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var Dt=/^[A-Za-z_$][\w$]*$/;function Ut(e){return Dt.test(e)&&!Ue.has(e)}var Pe=new P(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function p(e,n,r){let i=JSON.stringify([e,n]),s=Pe.get(i);if(!s)s=Ft(e,[...n]),s.sourceBytes+=i.length*2,Pe.set(i,s);return zt(jt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function Ft(e,n){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=ge(e),o=[];for(let f=0;f<n.length;f++){if(!Ut(n[f]))continue;if(n[f]===W||n[f]==="Object"||le.has(n[f]))continue;o.push({key:n[f],index:f})}o.sort((f,y)=>f.key<y.key?-1:1);let a=o.map((f)=>f.key),c=o.map((f)=>f.index),g=`
40
+ 'use strict';
41
+ try {
42
+ return ${r};
43
+ }
44
+ catch (e) {
45
+ if (e instanceof TypeError) {
46
+ return undefined;
47
+ }
48
+ throw e;
49
+ }
50
+ `,l=i?(f)=>{let y=Oe([W,"Object",...se,...a,...f],g);return(...x)=>y(je,oe,...Ce,...x)}:(f)=>{let y=Oe(["Object",...se,...a,...f],g);return(...x)=>y(oe,...Ce,...x)},h=l([]);return{sourceBytes:e.length*2+n.reduce((f,y)=>f+y.length*2,0),contextKeys:n,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(f)=>f.length===0?h:l(f)}}function zt(e,n,r){if(r.length===0)return e;let i=r.map((s)=>n.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ue.has(a))return}return e(...s)}}function jt(e,n,r,i,s,o){let a=e([]),c=i.every((l,h)=>l.index===h);if(n.length===r.length&&c)return Le(a,n,e,void 0,o);return Le((...l)=>{let h=Array(s.length);for(let f=0;f<s.length;f++)h[f]=l[s[f]];return a(...h)},n,e,(l)=>{a=e(l)},o)}function Le(e,n,r,i,s){let a=/^(\w+) is not defined$/,c=e,g=[],l=new Set(n);return(...h)=>{for(let f=0;f<=8;f++)try{return c(...h)}catch(y){let x=y instanceof Error?y.message:"",v=a.exec(x);if(!(y instanceof ReferenceError)||!v)return;let w=v[1];if(l.has(w)||Ue.has(w)||le.has(w))return;if(s?.(w),l.add(w),g.push(w),i)i(g);else c=r(g)}return}}function to(e){let n=e.trim();try{let r=Fe(n);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;Be(r,n),He(n);for(let i of ce)if(i.test(r))return!1}catch{return!1}return!0}function Mi(e,n){let r=[];n.lastIndex=0;let i;while((i=n.exec(e))!==null){let s=i.index,o=s+i[0].length-1,a=k(e,"(",")",o);if(a===-1){r.push({start:s,end:-1,args:"",call:e.slice(s,Math.min(e.length,s+80))}),n.lastIndex=o+1;continue}r.push({start:s,end:a+1,args:e.slice(o+1,a),call:e.slice(s,a+1)}),n.lastIndex=a+1}return r}function Wt(e,n,r,i){let s="",o=0;for(let a of Mi(e,n)){if(s+=e.slice(o,a.start),a.end===-1){s+=i(a.call),o=a.start;continue}s+=r(a.args,a.call),o=a.end}return s+e.slice(o)}function qt(e){let n=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let a=e[o];if(i){if(s+=a,a==="\\"&&o+1<e.length){s+=e[++o];continue}if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`")i=a;else if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0){n.push(s.trim()),s="";continue}s+=a}if(s.trim())n.push(s.trim());return n}function fe(e){let n=e.trim(),r=n[0];if(r!=="'"&&r!=='"'&&r!=="`"||n.length<2||n.at(-1)!==r)return null;let i="";for(let s=1;s<n.length-1;s++){let o=n[s];if(o==="\\"&&s+1<n.length-1){let a=n[++s];i+=a==="n"?`
51
+ `:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var Bt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Kt(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=Qs(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=K(n),o;try{o=p(r,Object.keys(s))(...Object.values(s))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(ut(r))].filter((c)=>!Bt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((g)=>`"${g}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:o}}function Ke(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function dt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function We(e){if(!e)return"";return Ve.isAbsolute(e)?Ve.relative(process.cwd(),e)||e:e}function de(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function B(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${We(i)}`:"";return console.warn(`[stx] ${de(n)}${o}: ${r}`),u(e,`${de(n)}: ${r}`,s)}function no(e,n,r){let i=r?` in ${We(r)}`:"";console.warn(`[stx] ${de(e)}${i}: ${n}`)}function Di(){return{afterOpen:[],beforeClose:[]}}function Ht(e){return e.afterOpen.length>0||e.beforeClose.length>0}function bl(e,n){if(!Ht(n))return e;let r=n.afterOpen.join(""),i=n.beforeClose.join(""),s=M(e),o=r?Nr(e):null,a=i&&s!==-1?s:null;if(o===null&&a===null)return e;if(o!==null&&a!==null)return`${e.slice(0,o)}${r}${e.slice(o,a)}${i}${e.slice(a)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,a)}${i}${e.slice(a)}`}var Xe=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Nr(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;Xe.lastIndex=r;let i=Xe.exec(e);return i?r+i[0].length:r}var he="data-stx-color-mode-boot",qe="__STX_COLOR_MODE__",Xt=new Set(["light","dark","auto","system"]),Gt=new Set(["auto","system"]),Yt=/^[a-z][\w:-]*$/i,Jt=/^[\w-]+$/;function Zt(e){let n=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",i=e.darkClass===void 0?"dark":e.darkClass,s=e.attribute??null,o=e.autoValue??null,a=e.respectExisting===!0;if(typeof n!=="string"||n.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Xt.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(i!==null&&(typeof i!=="string"||!Jt.test(i)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(i)}`);if(s!==null&&(typeof s!=="string"||!Yt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Gt.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(i===null&&s===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(a&&s===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:n,initialMode:r==="system"?"auto":r,darkClass:i,attribute:s,autoValue:o,respectExisting:a}}function Qt(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ye(e={}){let n=Zt(e),r=Qt(n),i=`(function(){"use strict";var o=window.${qe};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${qe}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${he}>${i}</script>`}function Mr(e,n={}){if(e.includes(he))return e;let r=me(e);if(r===null)return e;let i=ye(n);return`${e.slice(0,r)}
52
+ ${i}${e.slice(r)}`}var me=Nr,en=new RegExp(`<script\\b[^>]*\\b${he}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),Ye=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Je=/<\/head>/gi;function tn(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;Je.lastIndex=r;let i=Je.exec(e),s=i?i.index:e.length;Ye.lastIndex=r;let o=Ye.exec(e);if(!o||o.index>=s)return e;if(e.slice(r,o.index).trim()==="")return e;let a=o.index+o[0].length;return`${e.slice(0,r)}
53
+ ${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function wl(e){return nn(tn(e))}function nn(e){let n=en.exec(e);if(!n)return e;let r=me(e);if(r===null)return e;if(n.index<=r||e.slice(r,n.index).trim()==="")return e;let i=e.slice(0,n.index)+e.slice(n.index+n[0].length),s=me(i);if(s===null)return e;return`${i.slice(0,s)}
54
+ ${n[0]}${i.slice(s)}`}var rn="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",et=`<style data-stx-cloak>[x-cloak]{display:none !important}${rn}</style>`,X="data-stx-html-attrs",q="data-stx-html-class",tt=/^[A-Za-z_:][\w:.-]*$/;function T(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sn(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pt(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function on(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let i of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function _(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${T(String(i))}"`).join(" ")}function G(e){let n=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?n.replace(/<\//g,"<\\/"):n}function nt(e){let n=_(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${G(e)}</script>`}function an(e={},n="en"){let r=[],i=[],s="",o=n;for(let[c,g]of Object.entries(e||{})){if(g==null)continue;let l=c.trim();if(!tt.test(l))continue;let h=l.toLowerCase();if(h==="lang"){o=String(g);continue}if(h==="class"){s=String(g).trim();continue}r.push(` ${l}="${T(String(g))}"`),i.push(l)}let a=` lang="${T(o)}"`;if(s)a+=` class="${T(s)}"`;if(a+=r.join(""),s)a+=` ${q}="${T(s)}"`;if(i.length)a+=` ${X}="${T(i.join(" "))}"`;return a}function vl(e={},n={}){let r={...e,...n};if(e.class&&n.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of n.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function Dr(e,n={}){if(!n||Object.keys(n).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let i={},s=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=o.exec(r[1]))!==null){let h=a[1];if(!(h in i))s.push(h);i[h]=a[2]??a[3]??a[4]??""}let c=[],g=[];for(let[h,f]of Object.entries(n)){if(f==null)continue;let y=h.trim();if(!tt.test(y))continue;let x=y.toLowerCase();if(x==="class"){let v=(i.class||"").split(/\s+/).filter(Boolean);for(let w of String(f).split(/\s+/).filter(Boolean))if(!v.includes(w))v.push(w),c.push(w);if(!("class"in i))s.push("class");i.class=v.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(f),x!=="lang")g.push(y)}if(c.length){if(!(q in i))s.push(q);i[q]=c.join(" ")}if(g.length){if(!(X in i))s.push(X);i[X]=g.join(" ")}let l=s.map((h)=>` ${h}="${T(i[h])}"`).join("");return e.replace(r[0],()=>`<html${l}>`)}function xl(e){if(e.includes("data-stx-cloak"))return null;if(M(e)===-1)return null;return`${et}
55
+ `}function cn(e){let n=[],r=0;while(r<e.length){let o=e.slice(r),a=o.match(/^\s+/);if(a){r+=a[0].length;continue}if(o.startsWith("<!--")){let f=e.indexOf("-->",r);if(f===-1)break;r=f+3;continue}let c=o.match(/^<script\b[^>]*>/i);if(c){let f=e.toLowerCase().indexOf("</script>",r+c[0].length);if(f===-1)break;r=f+9;continue}let g=o.match(/^<link\b[^>]*>/i);if(g){n.push(g[0]),r+=g[0].length;continue}let l=o.match(/^<meta\b[^>]*>/i);if(l){n.push(l[0]),r+=l[0].length;continue}let h=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(h){n.push(h[0]),r+=h[0].length;continue}break}if(n.length===0)return{body:e,hoisted:n};let i="",s=0;while(s<e.length&&s<r){let o=e.slice(s),a=o.match(/^<link\b[^>]*>/i);if(a&&n.includes(a[0])){s+=a[0].length;continue}let c=o.match(/^<meta\b[^>]*>/i);if(c&&n.includes(c[0])){s+=c[0].length;continue}let g=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(g&&n.includes(g[0])){s+=g[0].length;continue}i+=e[s],s++}return i+=e.slice(r),{body:i,hoisted:n}}function ln(e,n={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:a=[],script:c=[],headRaw:g="",htmlAttrs:l={},bodyClass:h="",bodyAttrs:f={}}=n,y=r.title||i,x=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],v=new Set(o.map(pt).filter(Boolean)),{body:w,hoisted:R}=cn(e),A=new Set(R.flatMap((b)=>{let L=on(b);return L?[pt(L)].filter(Boolean):[]})),at=[...x.filter((b)=>!v.has(pt(b))),...o].filter((b)=>!A.has(pt(b))).map((b)=>` <meta ${_(b)}>`).join(`
56
+ `),ct=a.map((b)=>` <link ${_(b)}>`).join(`
57
+ `),lt=c.map((b)=>{if(b.src)return` <script ${_(b,(L)=>L==="content")}></script>`;if(b.content)return` ${nt(b)}`;return""}).filter(Boolean).join(`
58
+ `),gt=an(l,s),ft=Object.entries(f).map(([b,L])=>` ${b}="${T(String(L))}"`).join(""),mt=h?` class="${T(h)}"`:"",ht=[at,r.colorMode?` ${ye(r.colorMode)}`:"",` <title>${r.titleIsHtml?y:sn(y)}</title>`,` ${et}`,ct,lt,g?` ${g}`:"",...(r.styles||[]).map((b)=>` ${b}`),...R.map((b)=>` ${b}`),...(r.headScripts||[]).map((b)=>` ${b}`),r.headStack||""].filter(Boolean),yt=[w,...(r.bodyScripts||[]).map((b)=>b),r.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
59
+ <html${gt}>
60
+ <head>
61
+ ${ht.join(`
62
+ `)}
63
+ </head>
64
+ <body${mt}${ft}>
65
+ ${yt.join(`
66
+ `)}
67
+ </body>
68
+ </html>`}var be=/\s+/y,Ee=/<(script|style)\b[^>]*>/iy,un=/<\/script>/gi,gn=/<\/style>/gi,Ze=/<!DOCTYPE\b/iy,Qe=/<html[\s>]/iy;function An(e){let n=0;while(n<e.length){if(be.lastIndex=n,be.exec(e)){n=be.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}Ee.lastIndex=n;let i=Ee.exec(e);if(i){let s=i[1].toLowerCase()==="script"?un:gn;s.lastIndex=Ee.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(Ze.lastIndex=n,Ze.test(e))return!0;return Qe.lastIndex=n,Qe.test(e)}return!1}function Li(e){return An(e)}function Sl(e,n={}){let r=M(e);if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=n,c=e.slice(0,r),g=[];for(let l of i){let h=pt(l);if(h&&c.includes(h))continue;g.push(` <meta ${_(l)}>`)}for(let l of s){if(l.href&&c.includes(`href="${l.href}"`))continue;g.push(` <link ${_(l)}>`)}for(let l of o)if(l.src){if(c.includes(`src="${l.src}"`))continue;g.push(` <script ${_(l,(h)=>h==="content")}></script>`)}else if(l.content){if(c.includes(G(l)))continue;g.push(` ${nt(l)}`)}if(a&&!c.includes(a))g.push(` ${a}`);if(g.length===0)return e;return`${e.slice(0,r)}${g.join(`
69
+ `)}
70
+ ${e.slice(r)}`}function Lr(e,n={},r={},i){if(i??Li(e))return e;return ln(e,n,r)}var pn=["og:","article:","book:","profile:","fb:","music:","video:"],dn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function jr(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=fn(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=mn(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=n.openGraph,c=n[o]??(dt(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:pn.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function fn(e,n){let r=fe(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(dn.test(e.trim()))return e.trim();let i=Kt(e,n);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Ke(i.value)}`,code:t.TYPE_ERROR};return i.value}function mn(e,n){let r=fe(e);if(r!==null)return r;let i=Kt(e,n);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Ke(s)}`,code:t.TYPE_ERROR};return String(s)}var Br=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],ro=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],st={links:"link",metas:"meta",scripts:"script",styles:"style"},rt=new Set,it=new WeakMap;function xe(e){if(rt.has(e))return;rt.add(e),console.warn(e)}function hn(e,n){let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=n.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=a}}return r[n.length]}function yn(e,n){let r=e.toLowerCase(),i=n.find((g)=>g.toLowerCase()===r);if(i)return i;let s=st[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let g of n){let l=hn(r,g.toLowerCase());if(l<a)o=g,a=l}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function Re(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=it.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let c=st[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let l=Array.isArray(o[c])?o[c]:[];o[c]=[...l,...e[a]],delete o[a],xe(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){xe(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let g=yn(a,i);xe(g?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${g}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return it.set(e,o),o}var C={},bn=[],Z={};function ji(){return C}function vy(){return Z}function xy(){C={},bn.length=0,Z={}}function kl(e){C=Ge(C,Re(e,{known:ro,source:"useHead()"}))}function ot(e,n,r){let i=[...e||[]];for(let s of n||[]){let o=r(s),a=o?i.findIndex((c)=>r(c)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Ge(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:ot(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:ot(e.link,n.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function Lg(e){kl(so(e))}function so(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let g=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:g})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(i)n.push({property:"og:description",content:i});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(s)n.push({name:"twitter:title",content:s});if(o)n.push({name:"twitter:description",content:o});if(a){n.push({name:"twitter:image",content:a});let g=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(g)n.push({name:"twitter:image:alt",content:g})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let g of e.articleTags)n.push({property:"article:tag",content:g});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:c}}function Sy(e){if(Z={...Z,...e},e.title||e.description)Lg({title:e.title,description:e.description})}function ky(e){let n=typeof e==="function"?e():e;kl({title:n})}function _y(e=C){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(s)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${I(String(o))}"`).join(" ");n.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${I(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,c])=>c!==void 0).map(([a,c])=>{if(typeof c==="boolean")return c?a:"";return`${a}="${I(String(c))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${G(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";n.push(`<style${i}>${r.content}</style>`)}return n.join(`
71
+ `)}function Cy(e=C){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function Ey(e=C){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ty(e=C){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),n.name)i.setAttribute("name",n.name);if(n.property)i.setAttribute("property",n.property);document.head.appendChild(i)}i.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(n))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function $y(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
72
+ `,"")),headContent:n.trim()}}function Ry(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,c=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ge(c,{title:a}),""})}function Ay(e,n,r=""){if(!e.includes("@meta"))return e;return Wt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=jr(qt(i),n);if(o.kind==="error")return B("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ge(a,{meta:[o.tag]})}return""},(i)=>B("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{P,Vt,pe,E,Qs,Oi,eo,d,m,hl,O,ut,Ut,p,to,t,re,Or,J,u,$e,Ni,U,Rn,k,yl,Mi,Wt,qt,Kt,Ke,dt,B,no,Di,bl,Nr,Mr,wl,pt,vl,Dr,xl,An,Li,Sl,Lr,jr,Br,ro,Re,ji,vy,xy,kl,Ge,Lg,so,Sy,ky,_y,Cy,Ey,Ty,$y,Ry,Ay};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{qe,Pn,Fi}from"./chunk-jh2v1vvb.js";function so(e,a){let t=e.pwa;if(!t?.enabled)return"";let c=t.serviceWorker||{},d=t.routes||[],i=c.cacheVersion||"1.0.0",o=t.offline,l=o?.page?"/offline.html":"/offline.html",{push:r,backgroundSync:s,cacheStorage:n}=t,u=a?qe(a,e):null,h=u?Pn(u):"[]",f=["/","/manifest.json",...o?.enabled?[l]:[],...o?.precacheAssets||[]];return`/**
2
+ import{Xe,Nn,Vi}from"./chunk-mrh08821.js";function ao(e,a){let t=e.pwa;if(!t?.enabled)return"";let c=t.serviceWorker||{},d=t.routes||[],i=c.cacheVersion||"1.0.0",o=t.offline,l=o?.page?"/offline.html":"/offline.html",{push:r,backgroundSync:s,cacheStorage:n}=t,u=a?Xe(a,e):null,h=u?Nn(u):"[]",f=["/","/manifest.json",...o?.enabled?[l]:[],...o?.precacheAssets||[]];return`/**
3
3
  * Service Worker - Auto-generated by stx
4
4
  * Cache Version: ${i}
5
5
  *
@@ -13,7 +13,7 @@ import{qe,Pn,Fi}from"./chunk-jh2v1vvb.js";function so(e,a){let t=e.pwa;if(!t?.en
13
13
  * Additional features:
14
14
  * - Push notifications: ${r?.enabled?"enabled":"disabled"}
15
15
  * - Background sync: ${s?.enabled?"enabled":"disabled"}
16
- * - Cache limits: ${n?.maxSize?`${Fi(n.maxSize*1024*1024)}`:"unlimited"}
16
+ * - Cache limits: ${n?.maxSize?`${Vi(n.maxSize*1024*1024)}`:"unlimited"}
17
17
  */
18
18
 
19
19
  const CACHE_VERSION = '${i}';
@@ -825,5 +825,5 @@ self.addEventListener('message', (event) => {
825
825
  event.waitUntil(registerFormSync(event.data.payload));
826
826
  }
827
827
  });
828
- `}function Wt(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function Il(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function Bg(e,a){if(!e.pwa?.enabled)return"";if(Il(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-cxpq2zna.js");return t(e,a)}return so(e,a)}
829
- export{so,Wt,Il,Bg};
828
+ `}function Gt(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function Dl(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function Vg(e,a){if(!e.pwa?.enabled)return"";if(Dl(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-8arfg8kp.js");return t(e,a)}return ao(e,a)}
829
+ export{ao,Gt,Dl,Vg};
@@ -72,7 +72,7 @@ else {
72
72
  ${t}
73
73
  })();
74
74
  </script>
75
- `}function rh(i,n,o){f=0;let l=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return i.replace(l,(t,e,s)=>{let a=v(),r=p(t,e,s),d=r.placeholder?`<div data-defer-placeholder>${r.placeholder}</div>`:"",c=r.loading?`<div data-defer-loading style="display: none;">${r.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',g=r.error?`<div data-defer-error style="display: none;">${r.error}</div>`:"",u=`<div data-defer-content style="display: none;">${r.content}</div>`,h=E(a,r);return`
75
+ `}function ah(i,n,o){f=0;let l=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return i.replace(l,(t,e,s)=>{let a=v(),r=p(t,e,s),d=r.placeholder?`<div data-defer-placeholder>${r.placeholder}</div>`:"",c=r.loading?`<div data-defer-loading style="display: none;">${r.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',g=r.error?`<div data-defer-error style="display: none;">${r.error}</div>`:"",u=`<div data-defer-content style="display: none;">${r.content}</div>`,h=E(a,r);return`
76
76
  <div id="${a}" class="stx-defer" data-defer-trigger="${r.trigger}">
77
77
  ${d}
78
78
  ${c}
@@ -81,4 +81,4 @@ else {
81
81
  </div>
82
82
  ${h}
83
83
  `})}
84
- export{rh};
84
+ export{ah};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Lr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Lr(i,n,r+1,o))return!0}return!1}var k=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],vl=["onMount","onDestroy"];function ut(e="const",t=[],r){let o=t.length?k.filter((s)=>!t.includes(s)):k;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=k.filter((e)=>!y.includes(e));function Li(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function xl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Li(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Lr(r[1],t))return!0;return!1}function Sl(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function kl(e){return R.includes(e.toLowerCase())}var no=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_=["x-init","x-transition","x-effect","x-on"],_l=[...no,..._];function Cl(){return`{${no.map((e)=>`'${e}':1`).join(",")}}`}var ji=["class","style","text","html","show","model","if","ref"];function El(){return`{${ji.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function Tl(){return`/^(${p.join("|")})(?:\\.|$)/`}function $l(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=w;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
- export{Lr,k,vl,ut,Li,xl,Sl,kl,no,_l,Cl,ji,El,Tl,$l};
2
+ import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Fr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Fr(i,n,r+1,o))return!0}return!1}var C=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],_l=["onMount","onDestroy"];function ft(e="const",t=[],r){let o=t.length?C.filter((s)=>!t.includes(s)):C;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=C.filter((e)=>!y.includes(e));function Fi(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function Cl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Fi(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Fr(r[1],t))return!0;return!1}function El(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Tl(e){return R.includes(e.toLowerCase())}var oo=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_=["x-init","x-transition","x-effect","x-on"],$l=[...oo,..._];function Rl(){return`{${oo.map((e)=>`'${e}':1`).join(",")}}`}var zi=["class","style","text","html","show","model","if","ref"];function Al(){return`{${zi.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function Pl(){return`/^(${p.join("|")})(?:\\.|$)/`}function Il(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=w;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
+ export{Fr,C,_l,ft,Fi,Cl,El,Tl,oo,$l,Rl,zi,Al,Pl,Il};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{vm,xm,Sm,km,Ql,_m,Cm,Em,Tm,$m,Rm,Am}from"./chunk-6ftee542.js";export{Rm as Broadcast,Am as BroadcastServer,Ql as broadcast,Tm as broadcastPresence,Em as broadcastPrivate,$m as channel,vm as getBroadcastServer,km as loadChannels,xm as startBroadcasting,Sm as stopBroadcasting,_m as toUser,Cm as toUsers};
@@ -0,0 +1,12 @@
1
+ // @bun
2
+ import"./chunk-qjey0jk6.js";import"./chunk-farh4p7f.js";import"./chunk-qa5y30sy.js";import{S,_,T,te}from"./chunk-2kfayg4t.js";import"./chunk-k32q90b2.js";import"./chunk-0fh47gp0.js";import{pr}from"./chunk-01c16zw4.js";import{existsSync as C}from"fs";import l from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var u=new Map,h=S(64),w=new Set,v=0,E=new Set(b);function z(){u.clear(),h.clear()}function R(s){let o=new Map;for(let t of s){let i=l.basename(t);if(i.endsWith(".d.ts"))continue;let r=i.replace(/\.[jt]s$/,"");if(r==="index")continue;if(r===i)continue;let a=o.get(r);if(a&&!a.endsWith(".js"))continue;o.set(r,t)}return[...o.values()].sort()}function P(s,o){let t=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${t}\\b`).test(s)}function I(s){if(!s)return[];let o=_(s,v),t=h.get(o);if(t)return t.slice();let i=s.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),r=[];for(let a of E){if(w.has(a))continue;let p=a.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${p}\\s*\\(`).test(i))r.push(a)}return r.sort(),h.set(o,r),r.slice()}function M(){let s=l.join(import.meta.dir,"composables"),o=import.meta.url.endsWith(".ts")?"ts":"js";if(C(l.join(s,`index.${o}`)))return s;let t=pr("@stacksjs/stx/composables");return t?l.dirname(t):void 0}async function V(s,o){let t=I(s);if(t.length===0)return null;let i=o??M();if(!i)return null;let r=`${i}\x00${t.join(",")}`,a=u.get(r);if(a!==void 0)return a||null;let p=te({loader:"ts",target:"browser",define:T()}),k=new Set(t),m=[],d=new Set,f=[];try{let n=new Bun.Glob("*.{ts,js}");for await(let e of n.scan({cwd:i,absolute:!0}))f.push(e)}catch{return u.set(r,""),null}f=R(f);for(let n of f){let e;try{e=await Bun.file(n).text()}catch{continue}let g=[];try{g=p.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>k.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${l.basename(n).replace(/\.[jt]s$/,"")}
3
+ ${p.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${l.basename(n)} could not be bundled:`,c)}}let x=t.filter((n)=>!d.has(n)&&!P(s,n));if(x.length>0)console.warn(`[stx] could not bundle ${x.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return u.set(r,""),null;let O=[...d].map((n)=>` try { if (!(${JSON.stringify(n)} in __s)) { __s[${JSON.stringify(n)}] = ${n}; if (!(${JSON.stringify(n)} in window)) window[${JSON.stringify(n)}] = ${n}; } } catch (e) {}`).join(`
4
+ `),y=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
+ ;(function(){
6
+ var __s = window.stx = window.stx || {};
7
+ ${m.join(`
8
+
9
+ `)}
10
+ ${O}
11
+ })();
12
+ </script>`;return u.set(r,y),y}function q(s){w.clear();for(let o of s)w.add(o);v++}export{q as __setRuntimeOwnedForTest,z as clearFrameworkComposableCache,V as getFrameworkComposableScript,I as referencedFrameworkComposables,R as selectComposableFiles};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{a}from"./chunk-wfd9e224.js";import{xo}from"./chunk-12r22pf0.js";import p from"path";async function im(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(xo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-7sht1rkv.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
3
- export{im};
2
+ import{a}from"./chunk-4xanjv22.js";import{_o}from"./chunk-3z1mmar2.js";import p from"path";async function um(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(_o(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-94wnfxnd.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
3
+ export{um};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Hl,cm}from"./chunk-v37zmez0.js";export{Hl as captureScreenshot,cm as captureScreenshots};
@@ -0,0 +1,6 @@
1
+ // @bun
2
+ var i=/<!--[\s\S]*?-->|<(script|style|textarea|title)\b[^>]*>[\s\S]*?<\/\1\s*>|<\/(head|body)\s*>/gi;function o(e,r,t){if(!e.includes(`</${r}`)&&!e.includes(`</${r.toUpperCase()}`))return-1;let n=-1;i.lastIndex=0;for(let s=i.exec(e);s;s=i.exec(e)){if(s[2]?.toLowerCase()!==r)continue;if(n=s.index,t==="first")break}return i.lastIndex=0,n}function M(e){return o(e,"head","first")}function c(e){return o(e,"body","last")}function f(e,r,t=`
3
+ `){let n=M(e);if(n===-1)return e;return`${e.slice(0,n)}${r}${t}${e.slice(n)}`}function Ui(e,r,t=`
4
+ `){let n=c(e);if(n===-1)return`${e}
5
+ ${r}`;return`${e.slice(0,n)}${r}${t}${e.slice(n)}`}
6
+ export{M,c,f,Ui};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{r}from"./chunk-shke1fcm.js";function y(e,n,i=240){return e.slice(n,n+i)}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:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let i=e.indexOf("(",n);if(i===-1)return!0;let o=e.slice(i+1,e.indexOf(")",i)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{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:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,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:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{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:(e)=>/setTimeout\s*\(/.test(e)},{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"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let i=1;for(let o=0;o<n;o++)if(e[o]===`
2
+ import{r}from"./chunk-x7redxyd.js";function y(e,n,i=240){return e.slice(n,n+i)}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:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let i=e.indexOf("(",n);if(i===-1)return!0;let o=e.slice(i+1,e.indexOf(")",i)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{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:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,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:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{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:(e)=>/setTimeout\s*\(/.test(e)},{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"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let i=1;for(let o=0;o<n;o++)if(e[o]===`
3
3
  `)i++;return i}function b(e,n){let i=e.lastIndexOf(`
4
4
  `,n)+1,o=e.indexOf(`
5
5
  `,n);return e.slice(i,o===-1?e.length:o).trim().slice(0,120)}function S(e,n){let i=e.slice(0,n),o=i.lastIndexOf("function"),l=i.lastIndexOf("=>"),s=Math.max(o,l);if(s===-1)return!1;let t=e.slice(Math.max(0,s-120),s);return/\basync\b[^;{}]*$/.test(t)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,n,i){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),s="",t=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(i.push({file:n,line:u,rule:"confirm",applied:p,snippet:d,reason:p?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."}),p)s+=e.slice(t,c)+"await stxConfirm(",t=c+(a[0].length-a[1].length)}return s+e.slice(t)}function E(e,n,i){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),s="",t=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> 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(u)||p.trim()===""){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}i.push({file:n,line:h,rule:"tooltip",applied:!0,snippet:f}),s+=e.slice(t,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,t=a.index+c.length}return s+e.slice(t)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(n)=>n.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function F(e){let n=(i)=>i.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,n).replace(/\/\/[^\n]*/g,n)}function m(e,n=!1){let i=R(e);return(n?F(i):r(i)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,s)=>/\bclient\b/i.test(s)?l:l.replace(/[^\n]/g," "))}function O(e,n,i,o){let l=m(e),s=m(e,!0);for(let t of v){if(!i.includes(t.rule))continue;if(t.requires&&!t.requires(e))continue;t.pattern.lastIndex=0;let a,c=/['"]/.test(t.pattern.source)?s:l;t.pattern.lastIndex=0;while((a=t.pattern.exec(c))!==null){if(t.reject?.(e,a.index))continue;o.push({file:n,line:g(e,a.index),rule:t.rule,applied:!1,snippet:b(e,a.index),reason:`${t.primitive} \u2014 ${t.why}`})}}}function q(e,n={}){let i=n.rules??C,o=n.file??"<source>",l=[];O(e,o,i,l);let s=e;if(i.includes("confirm"))s=A(s,o,l);if(i.includes("tooltip"))s=E(s,o,l);l.sort((c,u)=>c.line-u.line);let t=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(t.has(u))return!1;return t.add(u),!0});return{code:s,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,n){if(e.length===0)return"No hand-rolled equivalents found.";let i=e.filter((t)=>t.applied),o=e.filter((t)=>!t.applied&&x.has(t.rule)),l=e.filter((t)=>!t.applied&&!x.has(t.rule)),s=[];if(i.length>0){s.push(n?`Rewrote ${i.length} site(s):`:`Would rewrite ${i.length} site(s) (pass --fix):`);for(let t of i)s.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}`)}if(o.length>0){s.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let t of o)s.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{mt,ht,yt}from"./chunk-pbakxcv8.js";export{mt as createContext,ht as updateContextStoryFiles,yt as updateContextTree};
@@ -298,5 +298,5 @@ catch (error) {
298
298
  init();
299
299
  }
300
300
  })();
301
- </script>`}var Fg={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},zg={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Hg={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Vg={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},oo=[Fg,zg,Hg,Vg];function Ty(t){return[...t,...oo]}
302
- export{Fg,zg,Hg,Vg,oo,Ty};
301
+ </script>`}var Ug={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Wg={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},qg={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Kg={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},co=[Ug,Wg,qg,Kg];function Py(t){return[...t,...co]}
302
+ export{Ug,Wg,qg,Kg,co,Py};
@@ -0,0 +1,42 @@
1
+ // @bun
2
+ import{Tl,$l}from"./chunk-qjey0jk6.js";import{m,O,ut,p}from"./chunk-qa5y30sy.js";import{K,_r,Fs,zs,fi,mi,Hs,Lt,Be,ye,Q,Tr,$r,de,ee,L,ct,Rr,wi,Ir,We,s,g,G,En}from"./chunk-2kfayg4t.js";import{n}from"./chunk-24hq8mka.js";import{le}from"./chunk-xymr4ys9.js";import{pr}from"./chunk-01c16zw4.js";import{r}from"./chunk-x7redxyd.js";import{b}from"./chunk-94mpe1ny.js";import{createHash as kt}from"crypto";import Y from"fs";import Z from"path";import Le from"fs";function Ae(e,i,t){let o=Buffer.alloc(t),a=Le.readSync(e,o,0,t,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let t=i(12,16);if(t==="VP8X")return(e[20]&16)!==0;if(t==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let t=Ae(i,0,33);if(t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255)return"none";if(t.length>=26&&t[0]===137&&t.toString("latin1",1,4)==="PNG"){let o=t[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(t.length>=25&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){if(ze(t))return"possible";let o=t.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as yt}from"url";var _e=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,xt=[];async function on(){if(Pe<sn()){Pe++;return}await new Promise((e)=>xt.push(e)),Pe++}function an(){Pe--,xt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let t=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(t.protocol==="file:"&&rn.existsSync(yt(t)))return yt(t)}catch{}return pr(cn,e)}var bt=!1;function fe(e){if(!bt)bt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return _e}function Ie(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let t;try{t=(await import("worker_threads")).Worker}catch(a){return fe(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof t!=="function")return fe("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return fe("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new t(o)}catch(h){a(fe(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,x=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){x(()=>a(h.value));return}let d=Error(h.error?.message??"image worker failed");if(h.error?.name)d.name=h.error.name;if(h.error?.stack)d.stack=h.error.stack;x(()=>c(d))}),l.on("error",(h)=>{x(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(fe(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{x(()=>u?c(Error("image worker exited before it finished")):a(fe(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],ve="/_stx/images",dn=`stx:${ve}:alpha-1`,gn=`stx:${ve}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function mn(e,i){let t=Z.dirname(Bun.resolveSync(e,i));while(t!==Z.dirname(t)){let o=Z.join(t,"package.json");if(Y.existsSync(o)){let a=JSON.parse(Y.readFileSync(o,"utf8"));if(a.name===e)return a.version}t=Z.dirname(t)}return}function vt(){if(Ee!==void 0)return Ee;let e;try{e=Z.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=pn.map((i)=>{let t;try{t=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${t??"unknown"}`}).join("+"),Ee}var wt=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[wt]??={catalog:new Map,transparent:new Set},e[wt]}var $t=new Set;function hn(e){return`/${e.split(Z.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=Z.extname(e),t=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=kt("sha256").update(e).digest("hex").slice(0,8);return`${t||"image"}-${o}`}function St(e,i=`stx:${ve}`){let t=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=Z.join(e,o);try{let c=await Y.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:t(o)}:null}catch{return null}},async write(o,a){let c=Z.join(e,o);await Y.promises.mkdir(Z.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Y.promises.writeFile(l,a),await Y.promises.rename(l,c),{bytes:a.byteLength,path:c,url:t(o)}},url:t}}async function At(e,i=e){let t=await Y.promises.readdir(i,{withFileTypes:!0});t.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of t){let c=Z.join(i,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!un.has(Z.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Z.relative(e,c)})}return o}function Ct(e,i){return e.map((t)=>({key:hn(t.relativePath),input:t.absolutePath,name:yn(t.relativePath),...bn(t.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),t=new Set,o=8;if(i.length===0)return t;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((x)=>x.format==="png").sort((x,h)=>x.width-h.width)[0];try{let x=await a(new Uint8Array(await Y.promises.readFile(f?.path??u.fallback.path)));if(xn(x.data))t.add(l)}catch{t.add(l)}}));return t}function wn(e,i){let t=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=Y.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)Y.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,t.push(o),!$t.has(o))$t.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return t}async function $n(e){let i=[],t=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return Z.join(e,"undecodable.json")}function Sn(e){try{let i=Y.readFileSync(qe(e),"utf-8"),t=JSON.parse(i);return t&&typeof t==="object"?t:{}}catch{return{}}}function Cn(e,i){try{Y.mkdirSync(Z.dirname(qe(e)),{recursive:!0}),Y.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function Rt(e){try{let i=Y.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Uo(e){let i=It(e);return i?we().catalog.get(i):void 0}function Wo(e){let i=It(e);return i?we().transparent.has(i):!1}function qo(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),t=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<t).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Gh(e){let i=Uo(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:qo(i).map(({format:t,srcset:o})=>({type:`image/${t}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:Wo(e)?void 0:i.placeholder?.dataUrl}}function ys(){let e=we();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function Xh(e,i,t={}){if(!e||!Y.existsSync(e))return ys(),{count:0,fingerprint:""};if(t.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==_e)return Rn(y.state),y.result}let o=await At(e);if(o.length===0)return ys(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((y)=>{let w=a[y.relativePath];if(!w)return!0;let A=Rt(y.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return ys(),{count:0,fingerprint:""};let l=St(Z.join(i,"_stx","images"),`${dn}:${vt()}`),u={outDir:Z.join(i,"_stx","images"),storage:St(Z.join(i,"_stx","images"),`${gn}:${vt()}`),baseUrl:ve,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),x=c,h;try{h=await f({...u,entries:Ct(c,l)})}catch(y){if(x=await $n(c),x.length===c.length)throw y;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=Rt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return ys(),{count:0,fingerprint:""};h=await f({...u,entries:Ct(x,l)})}let d=await vn(h.entries),C=wn(h.entries,d),v=we();v.catalog=new Map(Object.entries(h.entries)),v.transparent=d;let S=d.size===0&&C.length===0?h.fingerprint:kt("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:x.length,fingerprint:S}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,t,o){let a=fi(e,o);if(a!==void 0)return a;for(let c of mi(e,i,t,o))if(await s(c))return c;return null}}var ge=new Pt;var se="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function ie(e,i){let t=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)t.push(g(c));continue}if(a===se){t.push(g(c));continue}t.push(`${g(c)}="${En(c,Xe(String(a)))}"`)}return t}function oe(e,i){let t=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){t.push(g(c));continue}if(typeof a==="object")continue;t.push(`${g(c)}="${En(c,Xe(String(a)))}"`)}return t}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,t){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${n(o.value)}"`);else f.push(`href="${n(Tr(o.value,"navigable"))}"`);if(a)f.push(`class="${n(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${n(c)}"`),f.push(`data-stx-exact-active-class="${n(l)}"`),u)f.push("data-stx-prefetch");let x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)f.push(`data-stx-active-match="${n(x)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...ie(e,h)),f.push(...oe(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Ne(e,i,t=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return t}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),t=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)t.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))t.push(`(max-width: ${u}px) ${c}`)}}else t.push(o);return t.join(", ")}function Ye(e,i,t,o){return i.map((a)=>`${$e(e,a,void 0,t,o)} ${a}w`).join(", ")}function _n(e,i,t,o,a){return i.map((c)=>{let l=t?t*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,t,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(t)c.push(`h_${t}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(t)c.set("h",String(t));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(t)c.set("height",String(t));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,t="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${t}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Qe={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,t){let o=H(e,"src")||"",a=Uo(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),x=H(e,"srcset"),h=H(e,"densities"),d=H(e,"format"),C=Wo(o)||Ge(o)?.transparent===!0,v=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=H(e,"placeholderColor")||"#e5e7eb",y=H(e,"provider"),w=H(e,"class")||H(e,"className")||"",A=H(e,"style")||"",k=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),J=Ne(e,"lazy",!0),M=Ne(e,"preload",!1),U=Ne(e,"priority",!1),z=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!d,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=x||"",F="";if(a)T=a.sources[a.fallback.format]||"",F=f?Je(f):"100vw";else if(!T&&f&&y&&y!=="local"&&y!=="static")T=Ye(o,Ke,y,d),F=Je(f);else if(!T&&h){let V=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=_n(o,V,I,y,d)}else if(f)F=Je(f);let D=[];if(A)D.push(A);if(k)D.push(`object-fit:${k}`);if(R)D.push(`object-position:${R}`);if(I&&_)D.push(`aspect-ratio:${I}/${_}`);let re=[],ae=v==="blur"||v==="color"||v==="thumbhash";if(ae&&!C){let V=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(V&&v==="color")D.push(`background-color:${V.color}`),re.push("backgroundColor");else if(V)D.push(`background-color:${V.color}`),D.push(`background-image:url(${V.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundColor","backgroundImage");else{let P=On(I||16,_||9,S);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage")}}else if(!ae&&v&&v!=="empty"&&v!=="none")D.push(`background-image:url(${n(v)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage");let j=a?.fallback.url||$e(o,I,_,y,d),X=[];if(X.push(`src="${n(Tr(j,"fetched"))}"`),X.push(`alt="${n(c)}"`),l)X.push(`width="${n(l)}"`);if(u)X.push(`height="${n(u)}"`);let Re=z||(U||M?"eager":J?"lazy":"");if(Re)X.push(`loading="${n(Re)}"`);if(U)X.push('fetchpriority="high"');if(X.push(`decoding="${n(N)}"`),w)X.push(`class="${n(w)}"`);if(D.length>0)X.push(`style="${n(D.join(";"))}"`);if(T)X.push(`srcset="${n(Tr(T,"fetched"))}"`);if(F)X.push(`sizes="${n(F)}"`);let xe=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(re.length>0){let V=typeof e.static.onload==="string"?e.static.onload:"",P=Nn(re)+(V?`;${V}`:"");X.push(`onload="${n(P)}"`),xe.add("onload")}X.push(...ie(e,xe)),X.push(...oe(e,xe));let ue=`<img ${X.join(" ")} />`,te="";if(M){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";te=`<link rel="preload" as="image" href="${n(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${n(T)}"`:""}${F?` imagesizes="${n(F)}"`:""} />
3
+ `}if(q){let V=[];if(a)for(let P of qo(a))V.push(`<source type="image/${P.format}" srcset="${n(P.srcset)}"${F?` sizes="${n(F)}"`:""} />`);if(!a&&(d==="avif"||d==="auto")){let P=$e(o,I,_,y,"avif"),B=T?Ye(o,Ke,y,"avif"):`${P}`;V.push(`<source type="image/avif" srcset="${n(B)}"${F?` sizes="${n(F)}"`:""} />`)}if(!a&&(d==="webp"||d==="auto")){let P=$e(o,I,_,y,"webp"),B=T?Ye(o,Ke,y,"webp"):`${P}`;V.push(`<source type="image/webp" srcset="${n(B)}"${F?` sizes="${n(F)}"`:""} />`)}return`${te}<picture>
4
+ ${V.join(`
5
+ `)}
6
+ ${ue}
7
+ </picture>`}return`${te}${ue}`}};var _t="/images/safe-image-default.svg";function pe(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}var Bn=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${_t}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,et={name:"SafeImage",aliases:["safe-image","safe-img"],render(e,i,t){let o=pe(e,"src")||"",a=pe(e,"alt")||"",c=pe(e,"fallback")||_t,l=pe(e,"class")||pe(e,"className")||"",u=pe(e,"fallbackClassName")||"",f=[];if(f.push(`src="${n(o)}"`),f.push(`alt="${n(a)}"`),l)f.push(`class="${n(l)}"`);if(f.push(`data-fallback="${n(c)}"`),u)f.push(`data-fallback-class="${n(u)}"`);f.push('onerror="window.__stxSafeImageHandler(this)"');let x=new Set(["src","alt","fallback","class","className","fallbackClassName"]);f.push(...ie(e,x)),f.push(...oe(e,x));let h=`<img ${f.join(" ")} />`,d=t.context;if(!d.__safeImageHandlerEmitted)return d.__safeImageHandlerEmitted=!0,`${Bn}${h}`;return h}};function tt(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Se(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Oe(e,i,t){let o=Se(e,i);if(o!==void 0){let a=Number.parseInt(o,10);if(!Number.isNaN(a))return a}return t}var nt={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,i,t){let o=tt(Se(e,"color")||"#6366f1"),a=tt(Se(e,"initialColor")||Se(e,"initial-color")||""),c=tt(Se(e,"height")||"3px"),l=Oe(e,"duration",2000),u=Oe(e,"throttle",200),f=Oe(e,"zIndex",999999)||Oe(e,"z-index",999999),x=a?`linear-gradient(to right, ${a}, ${o})`:o;return`
8
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${c};background:${x};z-index:${f};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
9
+ <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
10
+ </div>
11
+ <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
12
+ <script>
13
+ (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${u})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
14
+ </script>`}};function Nt(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Tn(e,i,t){let o=Nt(e,i);if(o!==void 0){let a=Number.parseInt(o,10);if(!Number.isNaN(a))return a}return t}var Et={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},rt={name:"StxToast",aliases:["stx-toast"],render(e,i,t){let o=n(Nt(e,"position")||"top-right"),a=Tn(e,"max",5),c=Et[o]||Et["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${o}" data-stx-toast-max="${a}" style="position:fixed;${c};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
15
+ <style>
16
+ @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
17
+ @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
18
+ @keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
19
+ @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
20
+ @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
21
+ @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
22
+ </style>`}};function Te(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}var Ot={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},st={name:"StxModal",aliases:["stx-modal"],render(e,i,t){let o=Te(e,"id");if(!o)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let a=n(o),c=Te(e,"size")||"md",l=Te(e,"closeOnBackdrop")!=="false",u=Te(e,"closeOnEscape")!=="false",f=Ot[c]||Ot.md;return`<div id="stx-modal-${a}" class="stx-modal-backdrop" data-stx-modal="${a}" data-close-backdrop="${l}" data-close-escape="${u}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
23
+ <div class="stx-modal-panel" style="${f};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
24
+ <div style="padding:1.5rem">${i}</div>
25
+ </div>
26
+ </div>
27
+ <style>
28
+ @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
29
+ .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
30
+ .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
31
+ </style>`}};function me(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}var Bt={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},it={name:"StxDrawer",aliases:["stx-drawer"],render(e,i,t){let o=me(e,"id");if(!o)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let a=n(o),c=me(e,"side")||"right",l=me(e,"size")||"md",u=me(e,"closeOnBackdrop")!=="false",f=me(e,"closeOnEscape")!=="false",x=me(e,"overlay")!=="false",h=Bt[l]||Bt.md,d=c==="left",C=d?"left:0":"right:0",v=d?"translateX(-100%)":"translateX(100%)",S=d?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${a}" class="stx-drawer-backdrop" data-stx-drawer="${a}" data-close-backdrop="${u}" data-close-escape="${f}" style="display:none;position:fixed;inset:0;z-index:99999;${x?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
32
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${C};width:${h};max-width:100vw;transform:${v};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
33
+ <div style="padding:1.5rem">${i}</div>
34
+ </div>
35
+ </div>
36
+ <style>
37
+ @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
38
+ .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
39
+ .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
40
+ </style>`}};import{existsSync as Dn,readFileSync as jn}from"fs";var De=new Map,Tt=new Set;function Mn(e){if(Tt.has(e))return;Tt.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function Ln(e){let i=process.cwd();for(let t of[`${i}/node_modules/@iconify-json/${e}/icons.json`,`${i}/pantry/@iconify-json/${e}/icons.json`,`${i}/node_modules/@iconify/json/json/${e}.json`,`${i}/pantry/@iconify/json/json/${e}.json`])if(Dn(t))return t;for(let t of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return b.resolve(t)}catch{}return null}function zn(e){if(De.has(e))return De.get(e);let i=Ln(e);if(!i)return Mn(e),null;try{let t=JSON.parse(jn(i,"utf8"));return De.set(e,t),t}catch{return null}}function Un(e,i,t,o){let a=[];if(i.rotate)a.push(`rotate(${i.rotate*90} ${t/2} ${o/2})`);if(i.hFlip)a.push(`translate(${t} 0) scale(-1 1)`);if(i.vFlip)a.push(`translate(0 ${o}) scale(1 -1)`);return a.length?`<g transform="${a.join(" ")}">${e}</g>`:e}function Fn(e,i){let t=i,o=e.icons[t],a={hFlip:!1,vFlip:!1,rotate:0};for(let u=0;!o&&u<8;u++){let f=e.aliases?.[t];if(!f)return null;if(f.hFlip)a.hFlip=!a.hFlip;if(f.vFlip)a.vFlip=!a.vFlip;if(f.rotate)a.rotate=((a.rotate+f.rotate)%4+4)%4;t=f.parent,o=e.icons[t]}if(!o)return null;let c=o.width??e.width??24,l=o.height??e.height??24;return{body:Un(o.body,a,c,l),width:c,height:l}}function he(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);if(e.static[i]!==void 0)return String(e.static[i]);if(e.clientReactive[i]!==void 0)return e.clientReactive[i];return}var ot={name:"Icon",aliases:["icon","stx-icon"],render(e,i,t){let o=he(e,"name")??he(e,"icon");if(!o)return"<!-- Icon: missing name/icon prop -->";let a="lucide",c=o;if(o.includes(":")){let w=o.split(":");a=w[0],c=w[1]}let l=n(he(e,"size")||"24"),u=n(he(e,"color")||"currentColor"),f=n(he(e,"class")||""),x=n(he(e,"style")||""),h=De.get(a)??zn(a);if(!h)return`<!-- Icon: collection "${a}" not loaded -->`;let d=Fn(h,c);if(!d)return`<!-- Icon: "${c}" not found in ${a} -->`;let C=`0 0 ${d.width} ${d.height}`,v=d.body;if(u!=="currentColor")v=v.replace(/currentColor/g,u);let S=f?` class="${f}"`:"",y=x?` style="${x}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${C}" fill="none"${S}${y}>${v}</svg>`}};function Dt(e,...i){for(let t of i){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let o=e.static[t];if(typeof o==="string")return o}return}function jt(e,i){let t=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${i}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),o=e.match(t);if(!o)return{region:null,rest:e};return{region:o[2],rest:e.replace(o[0],"")}}var at={name:"Suspense",aliases:["suspense"],render(e,i,t){let o=jt(i,"fallback"),a=o.rest,c=jt(a,"error"),l=c.rest,u=o.region??Dt(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',f=c.region??Dt(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${u}</div><div data-stx-suspense-error hidden>${f}</div><div data-stx-suspense-content hidden>${l}</div></div>`}};function je(e,...i){for(let t of i){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let o=e.static[t];if(typeof o==="string")return o}return}var lt={name:"TransitionGroup",aliases:["transition-group"],render(e,i,t){let o=(je(e,"name")||"v").replace(/["'<>]/g,""),a=(je(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=je(e,"class"),l=je(e,"id"),u=[`data-stx-transition-group="${o}"`,c?`class="${c}"`:"",l?`id="${l}"`:""].filter(Boolean).join(" ");return`<${a} ${u}>${i}</${a}>`}};function Mt(e=ge){e.registerBuiltin(Ze),e.registerBuiltin(Qe),e.registerBuiltin(et),e.registerBuiltin(nt),e.registerBuiltin(rt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot),e.registerBuiltin(at),e.registerBuiltin(lt)}var zt=new Map;function Wn(e){let i=zt.get(e.source);if(!i)i=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),zt.set(e.source,i);return i}var Ut=new WeakMap;function Ft(e){let i=Ut.get(e);if(!i)i=new Set([...e].map((o)=>o.toLowerCase())),Ut.set(e,i);let t=i;return(o)=>!/[a-z]/.test(o)&&t.has(o.toLowerCase())}function Hn(e,i){let t="";for(let o=i;o<e.length;o++){let a=e[o];if(t){if(a==="\\")o++;else if(a===t)t=""}else if(a==='"'||a==="'")t=a;else if(a===">")return o}return e.length}function Wt(e,i,t){let o=[],a=0,c=typeof t==="function"?t:t?(l)=>t.has(l.toLowerCase()):void 0;while(a<e.length){let l=e.indexOf("<",a);if(l===-1)break;let u=Wn(i);u.lastIndex=l+1;let f=u.exec(e);if(!f){a=l+1;continue}let x=f[1];if(c&&c(x)){let w=l+1+x.length;while(w<e.length&&e[w]!==">")w++;a=w+1;continue}let h=l+1+x.length,d=null,C=h,v=-1,S=!1;while(h<e.length){let w=e[h];if(d){if(w==="\\"&&h+1<e.length){h+=2;continue}if(w===d)d=null;h++;continue}if(w==='"'||w==="'"){d=w,h++;continue}if(w==="/"&&h+1<e.length&&e[h+1]===">"){v=h+2,S=!0;break}if(w===">"){v=h+1;break}h++}if(v===-1){a=l+1;continue}let y=e.slice(C,S?v-2:v-1).trim();if(S)o.push({fullMatch:e.slice(l,v),tagName:x,attributes:y,content:"",startIndex:l,endIndex:v,isSelfClosing:!0}),a=v;else{let w=`<${x}`,A=`</${x}>`,k=1,R=v,E=-1;while(k>0&&R<e.length){let U=e.indexOf(w,R),z=e.indexOf(A,R);if(z===-1)break;if(U!==-1&&U<z){let N=e[U+w.length];if(N===" "||N===">"||N==="/"||N===`
41
+ `||N==="\t"){let q=Hn(e,U+w.length);if(e[q-1]!=="/")k++;R=q+1}else R=U+w.length}else{if(k--,k===0){E=z;break}R=z+A.length}}if(E===-1){a=v;continue}let J=e.slice(v,E),M=E+A.length;o.push({fullMatch:e.slice(l,M),tagName:x,attributes:y,content:J,startIndex:l,endIndex:M,isSelfClosing:!1}),a=M}}return o}function ft(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Ht(e,i){try{let t=Buffer.from(e,"base64").toString("utf8");return JSON.parse(t)}catch{}try{let t=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(t)}catch(t){if(i?.debug)console.error("Error decoding __stx_ prop:",t);return e}}function Me(e,i){let t=0,o="",a=i;while(a<e.length){let c=e[a];if(o){if(c==="\\")a++;else if(c===o)o=""}else if(c==='"'||c==="'"||c==="`")o=c;else if(c==="{")t++;else if(c==="}"){if(t--,t===0)return e.slice(i,a+1)}a++}return e.slice(i)}function qt(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Me(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function Xt(e){let i=[],t=0,o=e.length;while(t<o){while(t<o&&/\s/.test(e[t]))t++;if(t>=o)break;let a="";while(t<o&&!/[\s=]/.test(e[t]))a+=e[t],t++;if(!a)break;while(t<o&&/\s/.test(e[t]))t++;if(t<o&&e[t]==="="){t++;while(t<o&&/\s/.test(e[t]))t++;let c="";if(t<o&&(e[t]==='"'||e[t]==="'")){let l=e[t];t++;while(t<o&&e[t]!==l){if(e[t]==="\\"&&t+1<o)t++,c+=e[t];else c+=e[t];t++}if(t<o)t++}else if(e[t]==="{")c=Me(e,t),t+=c.length;else while(t<o&&!/\s/.test(e[t]))c+=e[t],t++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}var qn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xn=new Set([":for","x-for","v-for","@for"]),Vt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Vn(e){return dt(e).map((i)=>[i.start,i.end])}function dt(e){let i=[],t=new Map;for(let o of Lt(e)){let a=o.name.toLowerCase();if(o.closing){let x=t.get(a)?.pop();if(x)x.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?Xt(o.attributes).find((x)=>Xn.has(x.name)):void 0,u=typeof l?.value==="string"?l.value:null,f=u!==null?{start:o.start,end:o.end,names:ee(u),tag:a}:null;if(f)i.push(f);if(!o.selfClosing&&!Vt.has(a)){let x=t.get(a);if(!x)x=[],t.set(a,x);x.push(f)}}return i}var Zn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Zt(e){let i=new Map,t=[];for(let o of Lt(e)){let a=o.name.toLowerCase();if(o.closing){for(let l=t.length-1;l>=0;l--)if(t[l].name===a){t.length=l;break}continue}let c=t.at(-1);if(c){if(c.utility&&c.children>0)i.set(o.start,c.utility);if(!/(?:^|\s)hidden(?=[\s=]|$)/.test(o.attributes))c.children++}if(!o.selfClosing&&!Vt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];t.push({name:a,utility:l?Zn.exec(l)?.[1]??null:null,children:0})}}return i}function Gt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Gt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function vc(e,i){if(!/:[\w-]+=/.test(e))return e;let t=e,o=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,a=[],c;while((c=o.exec(e))!==null)a.push([c.index,c.index+c[0].length]);a.push(...Vn(e));let l=new Set([...ct(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(d){return a.some(([C,v])=>d>=C&&d<v)}let f=[],x=new Map,h=256;for(let d of Lt(t)){if(d.closing||u(d.start))continue;let C=d.attributes.trimEnd();if(!C||!C.includes(":"))continue;let v=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),S=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,y,w=C,A=!1;while((y=S.exec(C))!==null){if($r(C,y.index,!0)?.kind==="attribute")continue;let k=y[1],R=y[2];if(Tl(k))continue;if(L(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let E=Object.keys(i),J=Object.values(i),M=R.match(/^([a-zA-Z_$][\w$]*)/);if(M&&!E.includes(M[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(M[1]))continue;let U=JSON.stringify([E,R]),z=x.get(U);if(!z){if(z=Function(...E,`return (${R})`),x.size>=h)x.clear();x.set(U,z)}let N=z(...J);if(k==="class"){let q=G(Gt(N));if(q){let I=w.match(/\sclass="([^"]*)"/);if(I)w=w.replace(I[0],()=>` class="${I[1]} ${q}"`);else w=w.replace(y[0],()=>` class="${q}"`)}else w=w.replace(y[0],"");A=!0;continue}if(qn.has(k)){if(N)w=w.replace(y[0],` ${k}`);else w=w.replace(y[0],"");A=!0;continue}if(N===null||N===void 0||N===!1)w=w.replace(y[0],"");else{let q=v&&typeof N==="object"?JSON.stringify(N):String(N),I=En(k,q);w=w.replace(y[0],()=>` ${k}="${I}"`)}A=!0}catch(E){if(E instanceof de)throw E;continue}}if(A){let k=d.selfClosing?" /":"",E=`<${d.name}${w}${k}>`;f.push({start:d.start,end:d.end,replacement:E})}}if(f.length>0){let d=Array(f.length*2+1),C=0;for(let v=0;v<f.length;v++){let{start:S,end:y,replacement:w}=f[v];d[v*2]=t.slice(C,S),d[v*2+1]=w,C=y}d[f.length*2]=t.slice(C),t=d.join("")}return t}import Kt from"fs";import Jt from"path";var Yt=!1;function Gn(e,i,t,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(i.__stx_client_signal_names)?i.__stx_client_signal_names:[]),u=(d)=>{if(l.size===0)return!1;let C=r(d),v=C.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(v&&l.has(v))return!0;for(let S of l){let y=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${y}\\s*\\(`).test(C))return!0}return!1},f=new Set($l),x=(d)=>{if(!d.includes("-")||d.startsWith("@")||d.startsWith(":")||d.startsWith("x-")||d.startsWith("__"))return d;if(d.startsWith("aria-")||d.startsWith("data-"))return d;return d.replace(/-([a-z0-9])/g,(C,v)=>v.toUpperCase())},h=(d,C)=>{let v=x(d);if(c.static[v]=C,v!==d)c.staticNames[v]=d};for(let[d,C]of Object.entries(e)){let v=d.startsWith("x-")&&!f.has(d)&&!d.startsWith("x-bind:")&&!d.startsWith("x-on:")?`:${d.slice(2)}`:d;if(v.startsWith("@")){c.events[v]=C;continue}if(v.startsWith("__stx_")){let S=x(v.slice(6));c.serverDynamic[S]=Ht(C,t);continue}if(v.startsWith(":")){let S=x(v.slice(1)),y=C===se?S:C;if(S==="if"||S==="for"||S==="show"){c.clientReactive[S]=y;continue}if(o){c.clientReactive[S]=y;continue}if(L(y,a)){c.clientReactive[S]=y;continue}if(u(y)){c.clientReactive[S]=y;continue}try{if(!m(y)){if(t.debug)console.error(`Unsafe expression in :${S} binding: ${y}`);c.clientReactive[S]=y;continue}let w=Object.keys(i),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),k=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if(ut(y).some((M)=>!A.has(M)&&!w.includes(M)&&(!(M in globalThis)||k.has(M)))){c.clientReactive[S]=y;continue}let J=p(y,w)(...Object.values(i));if(c.serverDynamic[S]=J,S!==v.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[S]=v.slice(1)}catch{c.clientReactive[S]=y}continue}if(typeof C==="string"&&C.includes("{{")&&C.includes("}}")){let S=Qn(C,a);if(S!==null){c.clientReactive[x(v)]=S;continue}let y=C.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(y)try{let w=y[1];if(m(w)){let k=p(w,Object.keys(i))(...Object.values(i));h(v,k!=null?String(k):"")}else{if(t.debug)console.error(`Unsafe expression in ${v}: ${w}`);h(v,C)}}catch(w){if(t.debug)console.error(`Error evaluating expression for ${v}:`,w);h(v,C)}else{let w=C,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,k;while((k=A.exec(C))!==null)try{let R=k[1];if(!m(R)){if(t.debug)console.error(`Unsafe expression in ${v}: ${R}`);continue}let J=p(R,Object.keys(i))(...Object.values(i));w=w.replace(k[0],String(J??""))}catch(R){if(t.debug)console.error(`Error evaluating expression in ${v}:`,R)}h(v,w)}continue}h(v,C===se?"true":ft(C))}return c}var gt=new Set;function Jh(){gt.clear()}function Kn(e){let i=/^\s*(?:<!--[\s\S]*?-->\s*)*<(?:div|span)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/.exec(e);return!!i&&/\sdata-stx-component-wrapper(?=[\s=]|$)/.test(i[1])&&!/\sstx-hydrate(?=[\s=]|$)/.test(i[1])}function Jn(e,i,t){let o=`${t}\x00${e}\x00${i}`;if(gt.has(o))return;gt.add(o);let a=/space-x-/.test(i)?"flex":"flex flex-col",c=i.replace(/space-[xy]-/,"gap-");console.warn(`[stx] <${e}> in ${t} is a later child of a "${i}" stack, so it gets no spacing: the utility puts its margin on the component's scope wrapper, which generates no box. Use "${a} ${c}" on the parent instead -- gap reaches through the wrapper.`)}var pt=new Set;function Yh(){pt.clear()}function Yn(e,i){let t=`${i}\x00${e}`;if(pt.has(t))return;pt.add(t),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function Qn(e,i){if(i.size===0)return null;let t=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(t)];if(!o.some((u)=>L(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(f)=>`\\${f}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var er=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function tr(e,i,t){if(!e.includes("@"))return e;if(!er.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return le(e,i,t)}catch{return e}}function be(e){let i={},t=0,o=e.length;while(t<o){while(t<o&&/\s/.test(e[t]))t++;if(t>=o)break;let a="";while(t<o&&!/[\s=]/.test(e[t]))a+=e[t],t++;if(!a)break;while(t<o&&/\s/.test(e[t]))t++;if(t<o&&e[t]==="="){t++;while(t<o&&/\s/.test(e[t]))t++;let c="";if(t<o&&(e[t]==='"'||e[t]==="'")){let l=e[t];t++;while(t<o){let u=e[t];if(u==="\\"&&t+1<o){t++,c+=e[t],t++;continue}if(u===l){t++;break}c+=u,t++}}else if(e[t]==="{"){c=Me(e,t),t+=c.length;let l=qt(c);if(l!==null){i[`:${a}`]=l;continue}}else while(t<o&&!/\s/.test(e[t]))c+=e[t],t++;i[a]=c}else i[a]=se}return i}function Qt(e){return Object.entries(e).map(([i,t])=>t===se?i:`${i}="${nr(t)}"`).join(" ")}function nr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rr(e){let i=new Set,t=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=t.exec(e))!==null){let a=o[1];if(ge.isBuiltin(a))i.add(a)}return[...i].sort()}async function Xf(e,i,t,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Jt.dirname(t),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let d of e.matchAll(f)){let[C,v,S]=d,y=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,w=S,A,k=[];while((A=y.exec(S))!==null){let[R,E,J,M]=A,U=null,z=null;if(M.startsWith(".")||M.startsWith("/")){let I=Jt.resolve(l,M);if(I.endsWith(".stx"))z=I;else{let _=`${I}.stx`;try{if(Kt.statSync(_).isFile())z=_}catch{try{if(Kt.statSync(I).isDirectory())U=I}catch{}}}}else U=Fs(M,l);if(!U&&!z)continue;let N=!1,q=(I,_)=>{c.set(I,_),c.set(I.toLowerCase(),_);let T=I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(T,_),a.add(_)};if(J&&z)q(J,z),N=!0;else if(E){let I=E.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let F=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(F)return{source:F[1],local:F[2]};return{source:T,local:T}}),_=U?_r(U):null;for(let{source:T,local:F}of I){let D=null;if(z)D=z;else if(_)D=_.get(T)??_.get(T.toLowerCase())??_.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)q(F,D),N=!0}}if(N)k.push({start:A.index,end:A.index+R.length})}if(k.length===0)continue;for(let R=k.length-1;R>=0;R--)w=w.slice(0,k[R].start)+w.slice(k[R].end);u.push({start:d.index,end:d.index+C.length,value:`<script${v}>${w}</script>`})}if(u.length===0)return e;let x=[],h=0;for(let d of u)x.push(e.slice(h,d.start),d.value),h=d.end;return x.push(e.slice(h)),x.join("")}async function sr(e,i,t,o,a){let c=e;if(!i.__importedComponents)i.__importedComponents=new Map;let l=i.__importedComponents,u=/@import\s*\(\s*([^)]+)\s*\)/g,f;while((f=u.exec(c))!==null){let[x,h]=f,d=h.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of d){let v=C.split("/"),y=v[v.length-1].replace(/\.stx$/,""),w=y.includes("-")?y.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):y.charAt(0).toUpperCase()+y.slice(1),A=null,k=zs(C,t,o);for(let R of k)try{if(await Bun.file(R).exists()){A=R;break}}catch{}if(A){l.set(w,A),l.set(y,A),l.set(y.toLowerCase(),A);let R=w.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,A),a.add(A),o.debug)console.log(`Imported component: ${w} -> ${A}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(x,""),u.lastIndex=0}return c}async function ir(e,i,t,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=/@component\s*\(/g,x;while((x=f.exec(c))!==null){let h=x.index,d=h+x[0].length-1,C=1,v=d+1;while(v<c.length&&C>0){if(c[v]==="(")C++;else if(c[v]===")"){if(C--,C===0)break}v++}if(C!==0)break;let S=c.substring(d+1,v),y=v+1,w=S.match(/^\s*['"]([^'"]+)['"]/);if(!w){f.lastIndex=y;continue}let A=w[1],k,R=S.slice(w[0].length),E=R.match(/^\s*,\s*/);if(E)k=R.slice(E[0].length).trim();let J={};if(k)try{J=O(k,i)}catch(I){let _=I instanceof Error?I.message:String(I);c=c.replace(c.substring(h,y),`[Error parsing component props: ${_}]`);continue}let M="",U=y,N=c.substring(y).match(/^([\s\S]*?)@endcomponent/);if(N)M=N[1].trim(),U=y+N[0].length;let q=await We(A,J,M,l,i,t,o,u,a);c=c.substring(0,h)+q+c.substring(U),f.lastIndex=0}return c}async function or(e,i,t,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=lr(c);if(f.size>0){let y=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...y,...f])]}let x=Q(c);c=x.output;let h=ct(i);return c=await S(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await S(c,/[A-Z][a-zA-Z0-9]*/,!0,Ft(Rr)),c=await S(c,/[a-z][a-z0-9]*/,!1,Rr),c=x.restore(c),c;async function S(y,w,A,k){if(!y)return y;let R=y,E=Wt(R,w,k),J=dt(R),M=!o._nativeHostAttrs&&/space-[xy]-/.test(R),U,z=new Map;for(let I=E.length-1;I>=0;I--){let _=E[I],T=A?K(_.tagName):_.tagName,F=be(tr(_.attributes,i,t)),D=J.filter(({start:B,end:W})=>_.startIndex>=B&&_.startIndex<W);if(D.some((B)=>B.tag==="template"))Yn(_.tagName,t);let re=D.length>0,ae=new Set(h);for(let B of D)for(let W of B.names)ae.add(W);let j=Gn(F,i,o,re,ae);if(typeof j.clientReactive.for==="string")for(let B of ee(j.clientReactive.for))ae.add(B);let X=ge.getBuiltin(_.tagName),Re=X?await Ir(_.tagName,l,i,t,o):!1,xe=_.tagName==="Image"&&Hs([...Object.keys(j.static),...Object.keys(j.serverDynamic),...Object.keys(j.clientReactive)],Object.keys(j.events),{...j.static,...j.serverDynamic})&&(o._pluginComponentDirs??[]).some((B)=>_r(B).has("Image"));if(X&&!Re&&!xe){let B={context:i,filePath:t,options:o,dependencies:a},W=X.render(j,_.content,B);if(Object.keys(j.events).length>0){let ce=Qt(j.events);W=W.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(j.clientReactive).length>0)W=en(W,j.clientReactive);z.set(I,W);continue}if(!A&&_.tagName.includes("-")&&!await Ir(T,l,i,t,o))continue;let ue={};for(let[B,W]of Object.entries(j.static))ue[B]=W;for(let[B,W]of Object.entries(j.serverDynamic))ue[B]=W;let te={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(j.clientReactive),events:Object.keys(j.events)},V=await We(T,ue,x.restore(_.content),l,i,t,o,u,a,[...ae],te,_.tagName);if(M&&Kn(V)){U??=Zt(R);let B=U.get(_.startIndex);if(B)Jn(_.tagName,B,t)}let P=V;if(P=ar(P,j,te.declaredProps,te.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let B=te.reactiveProps.filter((ne)=>!te.consumedProps.has(ne)&&!["if","for","show","key","ref"].includes(ne)).map(K),W=mt(P,!0);if(B.length&&W){if(!Object.hasOwn(be(P.slice(W.insertPos,W.tagEnd)),"data-stx-native-host-root"))P=P.slice(0,W.insertPos)+' data-stx-native-host-root="true"'+P.slice(W.insertPos);let ne=Ce(P);P=P.slice(0,ne.insertPos)+` data-stx-native-forward="${B.join(" ")}"`+P.slice(ne.insertPos)}let ce=mt(P,!0);if(ce){let ne=be(P.slice(ce.insertPos,ce.tagEnd)),ke=Ce(P),nn=be(P.slice(ke.insertPos,ke.tagEnd));if(Object.hasOwn(ne,"data-stx-native-host-root")&&!Object.hasOwn(nn,"data-stx-native-host-owner"))P=P.slice(0,ke.insertPos)+" data-stx-native-host-owner"+P.slice(ke.insertPos)}}if(Object.keys(j.events).length>0){let B=Ce(P);if(B){let W=Qt(j.events),ce=Object.keys(j.events).map((ne)=>ne.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,B.insertPos)+` data-stx-parent-events="${ce}" ${W}`+P.substring(B.insertPos)}}if(Object.keys(j.clientReactive).length>0)P=en(P,j.clientReactive);z.set(I,P)}if(z.size===0)return R;let N="",q=0;for(let I=0;I<E.length;I++){let _=z.get(I);if(_===void 0)continue;N+=R.slice(q,E[I].startIndex),N+=_,q=E[I].endIndex}return N+=R.slice(q),N}}function en(e,i){let t=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([h])=>!t.has(h)),c=a.filter(([h])=>!o.has(h)).map(([h])=>K(h)).join(" "),l=e,u=a.length>0?Ce(l):null;if(u){let h=a.map(([C,v])=>`:${K(C)}="${v.replace(/"/g,"&quot;")}"`).join(" "),d=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${d} ${h}`+l.substring(u.insertPos)}let f=i.if;if(f)l=`<template :if="${f.replace(/"/g,"&quot;")}">${l}</template>`;let x=i.for;if(x){let h=i.key,d=h?` :key="${h.replace(/"/g,"&quot;")}"`:"";l=`<template :for="${x.replace(/"/g,"&quot;")}"${d}>${l}</template>`}return l}function ar(e,i,t=new Set,o=new Set,a=!1){let c=mt(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),u=i.serverDynamic.class??i.static.class;if(a&&typeof u==="string"&&u&&!o.has("class")){let S=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,y=S.test(l)?l.replace(S,(w,A,k,R,E)=>`${A}class="${n(`${ft(k??R??E)} ${u}`)}"`):` class="${n(u)}"${l}`;e=e.slice(0,c.insertPos)+y+e.slice(c.tagEnd),c.tagEnd+=y.length-l.length,l=y}let f=a||/\bdata-native(?:\s|=)/i.test(l),x=f?o:t,h=new Set(Object.keys(be(l))),d=new Set(["class","className"]);for(let S of Object.keys(i.static)){let y=i.staticNames[S]??S;if(h.has(y)||x.has(S)||!f&&!Ve(y))d.add(S)}for(let S of Object.keys(i.serverDynamic)){let y=i.serverDynamicNames?.[S]??S;if(h.has(y)||x.has(S)||!f&&!Ve(y))d.add(S)}let C=[];if(f){for(let[S,y]of Object.entries(i.static)){if(d.has(S)||y!==!0&&y!==se)continue;d.add(S),C.push(`${n(i.staticNames?.[S]??S)}="true"`)}for(let[S,y]of Object.entries(i.serverDynamic)){if(d.has(S)||y!==!0)continue;d.add(S),C.push(`${n(i.serverDynamicNames?.[S]??S)}="true"`)}}let v=[...ie(i,d),...oe(i,d),...C];if(f){for(let[S,y]of Object.entries(i.serverDynamic)){if(d.has(S)||y!==!1)continue;let w=i.serverDynamicNames?.[S]??S;v.push(`${n(w)}="false"`)}for(let[S,y]of Object.entries(i.serverDynamic)){if(d.has(S)||y===null||typeof y!=="object")continue;let w=JSON.stringify(y);if(w!==void 0){let A=i.serverDynamicNames?.[S]??S;v.push(`${n(A)}="${n(w)}"`)}}}if(v.length===0)return e;return`${e.slice(0,c.insertPos)} ${v.join(" ")}${e.slice(c.insertPos)}`}function Ce(e){let i=tn(e,0);if(i)return i;let t=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(t)return{insertPos:t.index+1+t[1].length,tagEnd:ht(e,t.index+1+t[1].length)};return null}function mt(e,i=!1){let t=Ce(e);if(!t)return null;let o=e.slice(t.insertPos,t.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?tn(e,t.tagEnd+1):t;return a&&i?cr(e,a)??a:a}function cr(e,i){if(!e.includes("data-stx-native-host-root"))return null;let t=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",i.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let h=e.indexOf("-->",o+4);if(h<0)return null;o=e.indexOf("<",h+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let u=l[2].toLowerCase(),f=o+l[0].length,x=ht(e,f);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(u==="script"||u==="style"){let h=new RegExp(`</${u}\\s*>`,"gi");if(h.lastIndex=x+1,!h.exec(e))return null;o=e.indexOf("<",h.lastIndex);continue}else{let h=be(e.slice(f,x)),d=a>0&&(Object.hasOwn(h,"data-stx-component-wrapper")||Object.hasOwn(h,"data-stx-native-host-owner"));if(c===void 0&&!d&&Object.hasOwn(h,"data-stx-native-host-root"))return{insertPos:f,tagEnd:x};if(!t.has(u)&&e[x-1]!=="/"){if(a++,c===void 0&&d)c=a}else if(a===0)return null}o=e.indexOf("<",x+1)}return null}function tn(e,i){let t=i;while(t<e.length){let o=e.slice(t),a=o.match(/^\s+/);if(a){t+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",t+4);if(u===-1)return null;t=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,f=e.toLowerCase().indexOf(u,t+c[0].length);if(f===-1)return null;t=f+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:t+1+l[1].length,tagEnd:ht(e,t+1+l[1].length)}}return null}function ht(e,i){let t="";for(let o=i;o<e.length;o++){let a=e[o];if(t){if(a==="\\")o++;else if(a===t)t=""}else if(a==='"'||a==="'")t=a;else if(a===">")return o}return e.length}function lr(e){let i=new Set;for(let t of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=t[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of wi(t[2]))i.add(a);for(let a of t[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))i.add(l)}}}return i}async function bs(e,i,t,o,a){if(!Yt)Mt(ge),Yt=!0;let c=await Xf(e,i,t,o,a);c=await sr(c,i,t,o,a),c=await ir(c,i,t,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,x=ye(c,Be,(d,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...x.tokens);let h=c;if(c=await or(x.output,i,t,o,a),c===h)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,f)=>l[Number(f)]??"");if(o.debug){let u=rr(c);if(u.length>0)console.warn(`[stx] ${t}: unresolved component tag(s) after render passes: ${u.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
42
+ export{Uo,Wo,qo,Gh,ys,Xh,vc,Jh,Yh,Xf,bs};