@stacksjs/stx 0.2.861 → 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 (290) 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-naj146zq.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-9syvkm5z.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-h4aqpf2r.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-avp271q4.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-6nb49h13.js → chunk-4xanjv22.js} +125 -126
  34. package/dist/chunk-4ykgjewy.js +16 -0
  35. package/dist/{chunk-tjz3r7rj.js → chunk-55zq2ha8.js} +5 -5
  36. package/dist/{chunk-gggadrs4.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-4rrxrxp6.js → chunk-669b2bya.js} +4 -4
  41. package/dist/{chunk-38qp2pg2.js → chunk-67dgp45w.js} +2 -2
  42. package/dist/chunk-6fstz73t.js +2 -0
  43. package/dist/{chunk-5xdkmn39.js → chunk-6ftee542.js} +2 -2
  44. package/dist/{chunk-5wr1qqz3.js → chunk-6k4ac74t.js} +2 -2
  45. package/dist/{chunk-121cgm3s.js → chunk-6m63rc7m.js} +8 -8
  46. package/dist/{chunk-c2w4wc9f.js → chunk-6m6y9bbx.js} +1 -1
  47. package/dist/chunk-6pczzq5f.js +2 -0
  48. package/dist/{chunk-6tp0w6hf.js → chunk-7ayvybdy.js} +3 -3
  49. package/dist/chunk-7mjf144y.js +2 -0
  50. package/dist/{chunk-5neezkj1.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-bag9q4m0.js → chunk-8502xb4n.js} +39 -39
  55. package/dist/{chunk-5ka3h8dy.js → chunk-85j9qh7v.js} +45 -46
  56. package/dist/{chunk-cxpq2zna.js → chunk-8arfg8kp.js} +3 -3
  57. package/dist/{chunk-xmy6g81m.js → chunk-8hhhmscy.js} +2 -2
  58. package/dist/{chunk-fyfvqd2s.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-eye156nv.js → chunk-9y9jecky.js} +1 -1
  65. package/dist/{chunk-mzes9ds7.js → chunk-9zrvh3pz.js} +2 -2
  66. package/dist/{chunk-68w65mhs.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-3wg9kr5z.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-37tefp7s.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-65cbfx5x.js → chunk-dpmayc2w.js} +2 -2
  82. package/dist/{chunk-d6216bcw.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-hyea17hp.js → chunk-eeq8k81z.js} +155 -157
  86. package/dist/{chunk-qjm23ma2.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-b1tctqn5.js → chunk-fnxg6134.js} +10 -10
  90. package/dist/chunk-g075cc67.js +2 -0
  91. package/dist/{chunk-zpkgs5d3.js → chunk-g5xth2yx.js} +6 -6
  92. package/dist/{chunk-q6w7a1vc.js → chunk-gbtbfg7e.js} +3 -3
  93. package/dist/{chunk-15jymk6t.js → chunk-gd56arnm.js} +2 -2
  94. package/dist/chunk-gmm3kffd.js +2 -0
  95. package/dist/{chunk-8hck9qqm.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-cq2hedwn.js → chunk-hev4t4d5.js} +6 -6
  100. package/dist/chunk-hf5fj7pr.js +2 -0
  101. package/dist/{chunk-7yhhwv07.js → chunk-hmdkf6c6.js} +2 -2
  102. package/dist/chunk-hsp9h3jn.js +2 -0
  103. package/dist/{chunk-vggtxttf.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-x69457q9.js → chunk-kbdz4762.js} +8 -8
  109. package/dist/chunk-kw11yydy.js +2 -0
  110. package/dist/{chunk-wrbhq1y2.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-zs4s9fcq.js → chunk-mcnwvh06.js} +6 -6
  114. package/dist/chunk-meqsd5bt.js +2 -0
  115. package/dist/{chunk-dba4bwkd.js → chunk-mfa07erx.js} +16 -16
  116. package/dist/chunk-mj4wbrw7.js +2 -0
  117. package/dist/{chunk-76360zky.js → chunk-mjy98ppb.js} +9 -9
  118. package/dist/{chunk-jh2v1vvb.js → chunk-mrh08821.js} +3 -3
  119. package/dist/{chunk-15rkvc0t.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-m3p4hksq.js → chunk-qbghf76y.js} +4 -4
  128. package/dist/{chunk-a6d92kv6.js → chunk-qcxrcypb.js} +2 -2
  129. package/dist/{chunk-1jwcp2k0.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-bg0ywp5w.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-dt73ww6m.js → chunk-sb8n32rn.js} +1 -1
  136. package/dist/chunk-snz2cxqv.js +2 -0
  137. package/dist/{chunk-36vksrry.js → chunk-srgnevws.js} +2 -2
  138. package/dist/chunk-srgpz94e.js +42 -0
  139. package/dist/{chunk-9pyvc0dc.js → chunk-tnp2ta5q.js} +2 -2
  140. package/dist/{chunk-gx96hctv.js → chunk-v37zmez0.js} +2 -2
  141. package/dist/chunk-v408qsze.js +2 -0
  142. package/dist/{chunk-thdnk1kd.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-yj9nyt93.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-3gfd9t8a.js → chunk-x512h2gv.js} +4 -4
  149. package/dist/{chunk-nwxjh1gv.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-7bajrfb1.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-e8nzbz66.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-tm201m9x.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 -1
  180. package/dist/index.js +1 -1
  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 +1 -1
  189. package/dist/runtime-injection.js +6 -6
  190. package/dist/serve.js +1 -1
  191. package/dist/site-builder/build.js +1 -1
  192. package/dist/site-builder/i18n.js +2 -2
  193. package/dist/site-builder/router.js +1 -1
  194. package/dist/site-builder/theme.js +1 -1
  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/body-close.d.ts +0 -13
  201. package/dist/body-close.js +0 -8
  202. package/dist/chunk-02css3vk.js +0 -14
  203. package/dist/chunk-0hqr6bff.js +0 -2
  204. package/dist/chunk-15sgdvyd.js +0 -2
  205. package/dist/chunk-261t62q4.js +0 -712
  206. package/dist/chunk-2b4a8tbd.js +0 -3
  207. package/dist/chunk-2fw36w1x.js +0 -2
  208. package/dist/chunk-2jcxsw75.js +0 -2
  209. package/dist/chunk-2pbhdaka.js +0 -2
  210. package/dist/chunk-2wba5ypm.js +0 -2
  211. package/dist/chunk-353gnvfe.js +0 -2
  212. package/dist/chunk-3cr5y8v1.js +0 -2
  213. package/dist/chunk-3y7yp0ka.js +0 -2
  214. package/dist/chunk-41wwqw0q.js +0 -2
  215. package/dist/chunk-4a1y51fs.js +0 -2
  216. package/dist/chunk-4a751brg.js +0 -2
  217. package/dist/chunk-4jgcd4d9.js +0 -33
  218. package/dist/chunk-5awhm4na.js +0 -2
  219. package/dist/chunk-5fhp9hxd.js +0 -2
  220. package/dist/chunk-5mg443dw.js +0 -2
  221. package/dist/chunk-5q4tncfw.js +0 -18
  222. package/dist/chunk-5x9ajbq0.js +0 -2
  223. package/dist/chunk-6g7tkmty.js +0 -2
  224. package/dist/chunk-72bj7ea4.js +0 -2
  225. package/dist/chunk-74g64pzt.js +0 -20
  226. package/dist/chunk-7de5y29a.js +0 -54
  227. package/dist/chunk-7ycmnsh5.js +0 -2
  228. package/dist/chunk-811hh6vp.js +0 -2
  229. package/dist/chunk-830ej8d2.js +0 -72
  230. package/dist/chunk-8fkmxrat.js +0 -2
  231. package/dist/chunk-8p9npc8y.js +0 -2
  232. package/dist/chunk-9fz3h6sx.js +0 -2
  233. package/dist/chunk-9jr30fns.js +0 -2
  234. package/dist/chunk-9xr628ew.js +0 -3
  235. package/dist/chunk-a9m6ajd7.js +0 -2
  236. package/dist/chunk-aj6vqdf7.js +0 -25
  237. package/dist/chunk-asr5v51s.js +0 -2
  238. package/dist/chunk-b7nmgkwa.js +0 -42
  239. package/dist/chunk-bv14vry8.js +0 -3
  240. package/dist/chunk-byx82s10.js +0 -2
  241. package/dist/chunk-c9y1g61m.js +0 -2
  242. package/dist/chunk-ck5nzbbv.js +0 -2
  243. package/dist/chunk-cvdm0hgq.js +0 -2
  244. package/dist/chunk-e0fxgbcc.js +0 -2
  245. package/dist/chunk-ed2m6pjf.js +0 -2
  246. package/dist/chunk-ednwdhv0.js +0 -2
  247. package/dist/chunk-egtphftq.js +0 -2
  248. package/dist/chunk-f18rxz70.js +0 -2
  249. package/dist/chunk-fahqq7c4.js +0 -2
  250. package/dist/chunk-fcbpzdyz.js +0 -2
  251. package/dist/chunk-gc79s0wh.js +0 -20
  252. package/dist/chunk-gjnrmz2q.js +0 -4
  253. package/dist/chunk-gp1dt8b8.js +0 -33
  254. package/dist/chunk-h0dsxxz4.js +0 -2
  255. package/dist/chunk-h2cvfp9y.js +0 -2
  256. package/dist/chunk-jhm1228j.js +0 -4
  257. package/dist/chunk-k3yym9zg.js +0 -2
  258. package/dist/chunk-k9fsd6t3.js +0 -2
  259. package/dist/chunk-kepxsjfx.js +0 -2
  260. package/dist/chunk-kgrvvtcy.js +0 -3
  261. package/dist/chunk-kh01rvag.js +0 -2
  262. package/dist/chunk-kv40xq53.js +0 -1329
  263. package/dist/chunk-mad172af.js +0 -2
  264. package/dist/chunk-mjkdskeg.js +0 -12
  265. package/dist/chunk-npt0mdzb.js +0 -2
  266. package/dist/chunk-p95fsnbk.js +0 -2
  267. package/dist/chunk-ptc3yqn3.js +0 -2
  268. package/dist/chunk-pybm7c9p.js +0 -2
  269. package/dist/chunk-q87hkwfg.js +0 -3
  270. package/dist/chunk-qe6631me.js +0 -2
  271. package/dist/chunk-qnx71b17.js +0 -2
  272. package/dist/chunk-qx8cav4w.js +0 -2
  273. package/dist/chunk-rb7cwck6.js +0 -2
  274. package/dist/chunk-s1e0t3hv.js +0 -2
  275. package/dist/chunk-s7vfmasx.js +0 -2
  276. package/dist/chunk-scwbttvt.js +0 -3
  277. package/dist/chunk-shy2hkvj.js +0 -2
  278. package/dist/chunk-sxtvy0sm.js +0 -3
  279. package/dist/chunk-t7z67vf6.js +0 -2
  280. package/dist/chunk-tarvase5.js +0 -2
  281. package/dist/chunk-tqs9pcga.js +0 -2
  282. package/dist/chunk-twjfrywv.js +0 -2
  283. package/dist/chunk-v0wdgxga.js +0 -3
  284. package/dist/chunk-vyna2rsq.js +0 -2
  285. package/dist/chunk-w4gjx2zs.js +0 -18
  286. package/dist/chunk-xhe7pw6e.js +0 -2
  287. package/dist/chunk-y86mpnrg.js +0 -2
  288. package/dist/chunk-z99bf0q0.js +0 -3
  289. package/dist/chunk-zm0g7ntw.js +0 -2
  290. package/dist/chunk-zrm2x65c.js +0 -2
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ import{S,_,Si,wn}from"./chunk-2kfayg4t.js";import{ni}from"./chunk-2s7rmn9r.js";import{l}from"./chunk-46pxmpeb.js";import{M,f}from"./chunk-s9df8srx.js";import F from"fs";import d from"path";import{hasLocalConfig as ye}from"bunfig";var _t={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Qe(n){return`--stx-${n}`}function G(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var $e=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function te(n,t){let s=t.trim();return G(n,s)??($e.test(s)?s:void 0)}function ne(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!_t[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!Se[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!Me[t]).map((t)=>`density.${t}`)]}function se(n){let t={};for(let[s,r]of Object.entries(_t)){let i=G(n,r.light);if(i===void 0)continue;t[s]=`var(${Qe(s)}, ${i})`}return t}function re(n,t={}){let s=[],r=[];for(let[i,a]of Object.entries(_t)){let c=t[i],g=typeof c==="string"?c:c?.light,o=typeof c==="string"?c:c?.dark,u=g&&te(n,g)||G(n,a.light),m=o&&te(n,o)||G(n,a.dark);if(u===void 0)continue;if(s.push(` ${Qe(i)}: ${u};`),m!==void 0)r.push(` ${Qe(i)}: ${m};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
3
+ `)}var Se={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function gn(n){return`--stx-radius-${n}`}function ie(){let n={};for(let[t,s]of Object.entries(Se))n[t]=`var(${gn(t)}, ${s.value})`;return n}function oe(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(Se).map(([t,s])=>` ${gn(t)}: ${n[t]??s.value};`),"}",""].join(`
4
+ `)}var Me={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},lr={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},ur={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function et(n){return`--stx-${n}`}function Q(n){let t=Me[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${et(n)}, ${t.value})`}function ce(){let n={};for(let[t,s]of Object.entries(lr))n[t]=Q(s);return n}function ae(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(ur))n[t]=[Q(s),{lineHeight:Q(r)}];return n}function le(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Me).map(([t,s])=>` ${et(t)}: ${n[t]??s.value};`),"}",""].join(`
5
+ `)}function de(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function Y(n,t){let s={...n};for(let[r,i]of Object.entries(t))s[r]=de(i)&&de(s[r])?Y(s[r],i):i;return s}function ge(n,t){if(!t.fonts)return"";let s=new n({...t.config,fonts:t.fonts,cssVariables:!1}).toCSS(!1,t.minify);return s&&!t.minify?`${s}
6
+ `:s}function fe(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...a}=r,{extend:c,...g}=s,o=g.colors||{};g.colors={...o,...se(o)};let u=g.borderRadius||{};g.borderRadius={...u,...ie()};let m=g.spacing||{};g.spacing={...m,...ce()};let V=g.fontSize||{};g.fontSize={...V,...ae()};let R=Y(g,a),y=Y(c||{},i||{});if(Object.keys(y).length>0)R.extend=y;let P=[...n.safelist||[],...t.safelist||[]],z={...n.shortcuts||{},...t.shortcuts||{}},D=[...n.preflights||[],...t.preflights||[]],{fonts:W,...O}=n,{fonts:I,roles:T,shapes:N,density:k,...b}=t,p={roles:T,shapes:N,density:k},j=I??W;return{config:{...O,...b,theme:R,safelist:P,shortcuts:z,...D.length>0?{preflights:D}:{},content:[],output:""},safelist:P,shortcuts:z,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:re({...o,...R.colors},T)+oe(N)+le(k),unknownRoles:ne(p),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import B from"fs";import Re from"path";var Te=256,C=new Map,ue=(n)=>Bun.hash(n).toString(16).padStart(16,"0").slice(0,16),pe=(n)=>l(process.cwd(),"css-assets",`${n}.css`);function L(n,t){if(C.delete(n),C.set(n,t),C.size>Te)C.delete(C.keys().next().value)}function he(n){let t=ue(n),s=pe(t);if(C.has(s))return L(s,n),t;let r;try{let i;try{i=B.readFileSync(s,"utf8")}catch{}if(i!==n)B.mkdirSync(Re.dirname(s),{recursive:!0}),r=`${s}.${process.pid}.${crypto.randomUUID()}.tmp`,B.writeFileSync(r,n,{flag:"wx"}),B.renameSync(r,s);return L(s,n),t}catch{return}finally{if(r)try{B.unlinkSync(r)}catch{}}}function Vf(n){if(!/^[a-f0-9]{16}$/.test(n))return;let t=pe(n),s=C.get(t);if(s!==void 0)return L(t,s),s;try{let r=B.readFileSync(t,"utf8");if(ue(r)!==n)return;return L(t,r),r}catch{return}}function me(){C.clear()}var h=null,H="";function xe(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;H=`${t}@${Math.trunc(F.statSync(t).mtimeMs)}`}catch{H=n}}var X=!1,v=null,A="",E=!1,je=256,w=new Map,K=null,be=null,U=new Map,ke=new Set;function q(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function J(n,t){if(w.has(n))w.delete(n);else if(w.size>=je)w.delete(w.keys().next().value);w.set(n,t)}async function Be(n,t=K){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${q(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Ee(n,t,s=K){if(!s)return;try{if(!F.existsSync(s))F.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${q(n)}.css`),t)}catch{}}async function Ce(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var Pe=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],De=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Oe(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of Pe)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Ie(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function yc(){if(X)return h;X=!0;try{let n=async(i)=>{for(let a of i){if(!await Bun.file(a).exists())continue;let c=await Ce(a);if(c){if(xe(a),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(a))}`);return c}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),a=await n([i]);if(!a)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return h=a,h}let t=await n(Oe());if(t)return h=t,h;let s=De;for(let i of s){let a=await Ce(i);if(a){h=a;try{xe(import.meta.resolve(i))}catch{H=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return h}}let r=await n(Ie());if(r)return h=r,h;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Vh(){Z.clear(),h=null,X=!1,v=null,A="",w.clear(),me(),be=null,U.clear()}var we=!1;async function bc(n){try{let t=ye({name:"css",cwd:n})?"css":ye({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!we)we=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function Uf(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-czpn3n1p.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let a=await import(i);t=a.default||a,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let a=await import(i);t={...a.default||a,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await bc(n)}function Wf(n){try{let t=new WeakSet;return q(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function mn(n){if(E)return A;E=!0;try{let t=await yc();if(!t||!t.build)return E=!1,"";if(!v)v=await bc(n);if(!v)return E=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},a=performance.now(),c=await t.build(i),g=performance.now()-a;if(A=c.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${c.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let o=d.isAbsolute(i.output)?i.output:d.join(n,i.output),u=d.dirname(o);if(!F.existsSync(u))F.mkdirSync(u,{recursive:!0});await Bun.write(o,c.css)}return E=!1,c.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),E=!1,A}}async function dr(n){v=null,await mn(n)}function Uh(){return A}function qf(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let c of r[1].split(/\s+/))if(c.trim())t.add(c.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,a=i.exec(n);while(a!==null){let c=a[1].match(/'([^']+)'/g);if(c){for(let g of c)for(let o of g.slice(1,-1).split(/\s+/))if(o.trim())t.add(o.trim())}a=i.exec(n)}return t}var Z=S(64);async function Kf(n,t){let s=()=>U.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=Z.get(_(n,t,s()));if(r!==void 0)return r;let i=await Ne(n,t);if(i)Z.set(_(n,t,s()),i);return i}function*ve(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=ni(r);if(i)yield i}}function Wh(n){return[...ve(n)].join(`
7
+ `)}async function Ne(n,t){try{let s=await yc();if(!s)return"";let r=new Set;for(let p of ve(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(p):qf(p);for(let ee of j)r.add(ee)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),a=l(i,"cache");if(!K)K=a;let c=U.get(i);if(!c){let p=await Uf(i);c={config:p,fingerprint:Wf(p)},U.set(i,c),be=c.fingerprint}let g=[...r].sort().join(" "),o=`${H}::${c.fingerprint||"default"}::${g}`,u=w.get(o);if(u!==void 0)return J(o,u),u;let m=await Be(o,a);if(m!==null)return J(o,m),m;let V=s.defaultConfig||s.config,R=c.config||{},y=fe(V,R),{safelist:P,includePreflight:z,minify:D,tokenCSS:W}=y;if(y.unknownRoles.length>0&&!ke.has(i))ke.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${y.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let O=y.config,I=new s.CSSGenerator(O),T=O.shortcuts||R.shortcuts||{},N=Object.keys(T).filter((p)=>r.has(p)||P.includes(p));for(let p of P)if(!T[p])I.generate(p);for(let p of r)if(!T[p])I.generate(p);let k="";if(N.length>0){let p=new s.CSSGenerator(O);for(let j of N)p.generate(j);if(k=p.toCSS(!1,D),k&&!k.endsWith(`
8
+ `))k+=`
9
+ `}let b=k+I.toCSS(z,D);return b=ge(s.CSSGenerator,y)+W+b,J(o,b),Ee(o,b,a),b}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function x(n,t,s=!1,r=!1){let i=await Kf(n,t);if(!i)return r?wn(n):n;let a=s?he(i):void 0,c=a?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${a}.css">`:`<style data-css="generated">
10
+ ${i}
11
+ </style>`;if(r)return Ae(n,c);let g=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(g.test(n)){let o=!1;return n.replace(g,()=>{if(o)return"";return o=!0,c})}if(n.includes("</head>"))return f(n,c);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
12
+ ${c}`);return c+n}function Ae(n,t){let s=Si(n).map((o)=>({...o,replacement:""})),r=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,i=r.exec(n);if(i!==null){let o=!0;while(i!==null)s.push({start:i.index,end:i.index+i[0].length,replacement:o?t:""}),o=!1,i=r.exec(n)}else{let o=M(n);if(o!==-1)s.push({start:o,end:o,replacement:`${t}
13
+ `});else{let u=n.match(/<body([^>]*)>/);if(u?.index!==void 0)s.push({start:u.index,end:u.index+u[0].length,replacement:`${u[0]}
14
+ ${t}`});else s.push({start:0,end:0,replacement:t})}}s.sort((o,u)=>o.start-u.start||o.end-u.end);for(let o=1;o<s.length;o++)if(s[o].start<s[o-1].end)return Fe(wn(n),t);let a=Array(s.length*2+1),c=0,g=0;for(let o of s)a[g++]=n.slice(c,o.start),a[g++]=o.replacement,c=o.end;return a[g]=n.slice(c),a.join("")}function Fe(n,t){let s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(s.test(n)){let r=!1;return n.replace(s,()=>{if(r)return"";return r=!0,t})}if(n.includes("</head>"))return f(n,t);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
15
+ ${t}`);return t+n}
16
+ export{_t,Qe,Se,gn,Me,lr,ur,et,e,Vf,yc,Vh,bc,Uf,Wf,mn,dr,Uh,qf,Kf,Wh,x};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function Lm(e,t={},n){let i=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(i,(a,c,o)=>{let s=l(),r=u(c||"");return p(s,o.trim(),r)})}function u(e){let t={max:10},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,i;while((i=n.exec(e))!==null){let a=i[1],c=i[2]||i[3],o=i[4];switch(a){case"max":t.max=o?parseInt(o,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,n){let{max:i,include:a,exclude:c}=n,o=n.id||e;return`
2
+ var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function Fm(e,t={},n){let i=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(i,(a,c,o)=>{let s=l(),r=u(c||"");return p(s,o.trim(),r)})}function u(e){let t={max:10},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,i;while((i=n.exec(e))!==null){let a=i[1],c=i[2]||i[3],o=i[4];switch(a){case"max":t.max=o?parseInt(o,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,n){let{max:i,include:a,exclude:c}=n,o=n.id||e;return`
3
3
  <div class="stx-keep-alive" data-keep-alive-id="${e}" data-custom-id="${o}">
4
4
  <div class="stx-keep-alive-content" data-keep-alive-content="${e}">
5
5
  ${t}
@@ -286,7 +286,7 @@ else {
286
286
  });
287
287
  })();
288
288
  </script>
289
- `}function jm(e={}){return{id:e.id||l(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((n)=>n.trim()):null,exclude:e.exclude?e.exclude.split(",").map((n)=>n.trim()):null}}function Bm(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function Fm(){return`
289
+ `}function zm(e={}){return{id:e.id||l(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((n)=>n.trim()):null,exclude:e.exclude?e.exclude.split(",").map((n)=>n.trim()):null}}function Hm(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function Vm(){return`
290
290
  /* STX Keep-Alive Styles */
291
291
  .stx-keep-alive {
292
292
  position: relative;
@@ -311,7 +311,7 @@ else {
311
311
  .stx-keep-alive-content > [data-activated] {
312
312
  opacity: 1;
313
313
  }
314
- `}function zm(){return`
314
+ `}function Um(){return`
315
315
  // STX Keep-Alive Runtime
316
316
  (function() {
317
317
  if (typeof window === 'undefined') return;
@@ -347,5 +347,5 @@ else {
347
347
 
348
348
  console.log('[stx] Keep-alive runtime initialized');
349
349
  })();
350
- `}function Hm(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function Vm(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
351
- export{Lm,jm,Bm,Fm,zm,Hm,Vm};
350
+ `}function Wm(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function qm(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
351
+ export{Fm,zm,Hm,Vm,Um,Wm,qm};
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- var Eo=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function Ta(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||Eo},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
2
+ var Ro=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function Pa(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||Ro},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
3
3
  `)}function N(e,t,r){let n=" ".repeat(r);if(r===0)t.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let i=`node_${r}`;t.push(`${n} var ${i} = try ${e.zigType}.init(allocator);`);for(let[o,s]of Object.entries(e.props))if(s.type==="literal"){let a=typeof s.value==="string"?`"${s.value}"`:String(s.value);t.push(`${n} ${i}.set${J(o)}(${a});`)}for(let o=0;o<e.children.length;o++){let s=e.children[o];if(s.type==="text"){let a=s.props.text?.type==="literal"?String(s.props.text.value):"";t.push(`${n} try ${i}.addChild(try craft.Text.init(allocator, "${a}"));`)}else N(s,t,r+1),t.push(`${n} try ${i}.addChild(node_${r+1});`)}if(r===0)t.push(` return ${i}.element();`),t.push("}")}function E(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('import { Craft } from "@stacksjs/craft";'),r.push(""),r.push("export function render(): Craft.Element {"),r.push(" return "+v(e,1)+";"),r.push("}"),r.join(`
4
4
  `)}function v(e,t){let r=" ".repeat(t),n=[];for(let[a,l]of Object.entries(e.props))if(l.type==="literal"){let p=typeof l.value==="string"?`"${l.value}"`:String(l.value);n.push(`${a}: ${p}`)}let i=n.length>0?`{ ${n.join(", ")} }`:"{}",o=e.children.map((a)=>a.type==="text"?`"${a.props.text?.type==="literal"?a.props.text.value:""}"`:v(a,t+1)),s=o.length>0?`,
5
5
  ${r} [${o.join(`,
6
6
  ${r} `)}]`:"";return`Craft.create("${e.zigType}", ${i}${s})`}function H(e,t,r){if(t.target==="universal"){let n=[];n.push("// Universal entry point"),n.push("");for(let[i,o]of r)n.push(`// --- ${i.toUpperCase()} ---`),n.push(`#if ${i.toUpperCase()}`),n.push(o),n.push("#endif"),n.push("");return n.join(`
7
- `)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function $a(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:Ta,createHotReloadServer:$a,NATIVE_COMPONENTS:Eo},Ph=K;
8
- export{Eo,Ta,$a,Ph};
7
+ `)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function Ia(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:Pa,createHotReloadServer:Ia,NATIVE_COMPONENTS:Ro},Nh=K;
8
+ export{Ro,Pa,Ia,Nh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{La,ja,Ba,Fa,Bh}from"./chunk-85j9qh7v.js";import"./chunk-8502xb4n.js";import"./chunk-c34qn4k8.js";import"./chunk-vvzys1x7.js";import"./chunk-321fbxnm.js";import"./chunk-4ykgjewy.js";import"./chunk-2dpessnc.js";import"./chunk-q1wxgw5s.js";import"./chunk-srgpz94e.js";import"./chunk-24hq8mka.js";import"./chunk-dhnw2qwq.js";import"./chunk-xymr4ys9.js";import"./chunk-fnxg6134.js";import"./chunk-0c9c9v03.js";import"./chunk-zsnmk5me.js";import"./chunk-2s7rmn9r.js";import"./chunk-4xanjv22.js";import"./chunk-adb045wf.js";import"./chunk-tnp2ta5q.js";import"./chunk-669b2bya.js";import"./chunk-mfa07erx.js";import"./chunk-x512h2gv.js";import"./chunk-2kfayg4t.js";import"./chunk-0fh47gp0.js";import"./chunk-k32q90b2.js";import"./chunk-qa5y30sy.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{La as buildNative,Bh as default,ja as findCraftBinary,Fa as getAvailableFormats,Ba as getAvailableTargets};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Sn,mg,hg,yg,bg,wg,h,vg,_i,xg,ol,il}from"./chunk-2kfayg4t.js";import"./chunk-0fh47gp0.js";import"./chunk-k32q90b2.js";import"./chunk-qa5y30sy.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Sn as STX_ENGINE_BINDING_NAMES,_i as convertToCommonJS,ol as extractScriptFromTemplate,h as extractVariables,il as hasVariables,vg as isCompleteImport,wg as isMissingBindingFailure,yg as isModuleResolutionFailure,bg as isSyntaxFailure,xg as splitDeclaration,mg as stripTypeScript,hg as withoutStxReferrer};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Gi,Xi,Ji,Qg,Yi,Zi,em,Qi,ea,jl,tm}from"./chunk-z512gt4v.js";export{Gi as VideoProcessorCache,jl as analyzeVideo,Qg as clearVideoCache,ea as generateDASHManifest,Qi as generateHLSManifest,Yi as generatePoster,em as generateSpriteSheet,Zi as generateThumbnails,Xi as getCachedVideoResult,tm as processVideo,Ji as setCachedVideoResult};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function Pc(e){try{return w.has(c.realpathSync(e))}catch{return w.has(i.resolve(e))}}var _=new Set(["extends","root",...j.map((e)=>`${e}Dir`),"publicDir","stateDir","cachePath"]),x=(e)=>e!==null&&typeof e==="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null);function b(e,n,r=""){if(Array.isArray(n))return["middleware","plugins"].includes(r)?[...Array.isArray(e)?e:[],...n]:[...n];if(!x(n))return n;let o={...x(e)?e:{}};for(let[s,a]of Object.entries(n)){if(["__proto__","constructor","prototype"].includes(s))throw Error(`Invalid layer config key: ${s}`);o[s]=b(o[s],a,s)}return o}function v(e){for(let n of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let r=i.join(e,n);if(c.existsSync(r))return c.realpathSync(r)}throw Error(`Application layer has no stx.config.ts: ${e}`)}function E(e,n,r){if(typeof e!=="string"||!e||/^(?:https?:|git[+:])/.test(e))throw Error(`Invalid application layer ${JSON.stringify(e)} in ${n}; use a local path or installed package`);if(e.startsWith(".")||i.isAbsolute(e)){let s=i.resolve(n,e);return c.statSync(s).isDirectory()?v(s):c.realpathSync(s)}let o=n;while(!0){let s=i.join(o,"node_modules",e),a=i.join(s,"package.json");if(c.existsSync(a)){r.add(c.realpathSync(a));let g=JSON.parse(c.readFileSync(a,"utf8"));return g.stx?.layer?c.realpathSync(i.resolve(s,g.stx.layer)):v(s)}let p=i.dirname(o);if(p===o)break;o=p}throw Error(`Cannot resolve application layer ${JSON.stringify(e)} from ${n}`)}async function C(e,n){let r=await Bun.build({entrypoints:[e],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(a){a.onResolve({filter:/^[^./]/},(p)=>{if(p.path.startsWith("node:"))return{path:p.path,external:!0};return{path:Bun.resolveSync(p.path,p.resolveDir),external:!0}}),a.onLoad({filter:/./},(p)=>{let g=c.realpathSync(p.path);n.add(g),w.add(g);return})}}]});if(!r.success)throw Error(`Cannot load layer ${e}: ${r.logs.join(`
3
- `)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function Ic(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await ni(m,e),{config:f,graph:m}}async function ni(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function Es(e){return O(A(e))}function Ts(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
4
- `)}function Oc(e){return e.layers.map((n)=>({config:i.relative(n.root,n.configFile),files:A({layers:[n],configDependencies:e.configDependencies.filter((r)=>r.startsWith(`${n.root}${i.sep}`))}).filter((r)=>c.statSync(r).isFile()).map((r)=>({path:i.relative(n.root,r).replaceAll(i.sep,"/"),sha256:k("sha256").update(c.readFileSync(r)).digest("hex")}))}))}
5
- export{Pc,Ic,ni,Es,Ts,Oc};
2
+ import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function Nc(e){try{return w.has(c.realpathSync(e))}catch{return w.has(i.resolve(e))}}var _=new Set(["extends","root",...j.map((e)=>`${e}Dir`),"publicDir","stateDir","cachePath"]),x=(e)=>e!==null&&typeof e==="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null);function b(e,n,r=""){if(Array.isArray(n))return["middleware","plugins"].includes(r)?[...Array.isArray(e)?e:[],...n]:[...n];if(!x(n))return n;let o={...x(e)?e:{}};for(let[s,a]of Object.entries(n)){if(["__proto__","constructor","prototype"].includes(s))throw Error(`Invalid layer config key: ${s}`);o[s]=b(o[s],a,s)}return o}function v(e){for(let n of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let r=i.join(e,n);if(c.existsSync(r))return c.realpathSync(r)}throw Error(`Application layer has no stx.config.ts: ${e}`)}function E(e,n,r){if(typeof e!=="string"||!e||/^(?:https?:|git[+:])/.test(e))throw Error(`Invalid application layer ${JSON.stringify(e)} in ${n}; use a local path or installed package`);if(e.startsWith(".")||i.isAbsolute(e)){let s=i.resolve(n,e);return c.statSync(s).isDirectory()?v(s):c.realpathSync(s)}let o=n;while(!0){let s=i.join(o,"node_modules",e),a=i.join(s,"package.json");if(c.existsSync(a)){r.add(c.realpathSync(a));let g=JSON.parse(c.readFileSync(a,"utf8"));return g.stx?.layer?c.realpathSync(i.resolve(s,g.stx.layer)):v(s)}let p=i.dirname(o);if(p===o)break;o=p}throw Error(`Cannot resolve application layer ${JSON.stringify(e)} from ${n}`)}async function C(e,n){let r=await Bun.build({entrypoints:[e],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(a){a.onResolve({filter:/^[^./]/},(p)=>{if(p.path.startsWith("node:"))return{path:p.path,external:!0};return{path:Bun.resolveSync(p.path,p.resolveDir),external:!0}}),a.onLoad({filter:/./},(p)=>{let g=c.realpathSync(p.path);n.add(g),w.add(g);return})}}]});if(!r.success)throw Error(`Cannot load layer ${e}: ${r.logs.join(`
3
+ `)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function Mc(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await oi(m,e),{config:f,graph:m}}async function oi(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function Rs(e){return O(A(e))}function As(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
4
+ `)}function Dc(e){return e.layers.map((n)=>({config:i.relative(n.root,n.configFile),files:A({layers:[n],configDependencies:e.configDependencies.filter((r)=>r.startsWith(`${n.root}${i.sep}`))}).filter((r)=>c.statSync(r).isFile()).map((r)=>({path:i.relative(n.root,r).replaceAll(i.sep,"/"),sha256:k("sha256").update(c.readFileSync(r)).digest("hex")}))}))}
5
+ export{Nc,Mc,oi,Rs,As,Dc};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function de(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function Kn(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function Eh(e,n=Object.is){return Kn(e,{equals:n})}function Gn(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function _o(e){C(e)}function Qr(e){k.push(e)}function es(e){T.push(e)}function Th(){O(k,"onMount",T)}function $h(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Rh(){return{mount:k.length,destroy:T.length}}function Xn(e){return typeof e==="function"&&e._isSignal===!0}function Jn(e){return typeof e==="function"&&e._isDerived===!0}function Co(e){if(Xn(e)||Jn(e))return m(()=>e());return e}function ts(e){return m(e)}function Ah(e,n){let r=typeof e==="function"?e:()=>e,i=de([]),o=Kn(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return Gn(()=>{if(r(),!t){t=!0;return}if(ts(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
3
- export{de,Kn,Eh,Gn,_o,Qr,es,Th,$h,Rh,Xn,Jn,Co,ts,Ah};
2
+ var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function ge(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function Jn(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function Rh(e,n=Object.is){return Jn(e,{equals:n})}function Yn(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function To(e){C(e)}function ns(e){k.push(e)}function rs(e){T.push(e)}function Ah(){O(k,"onMount",T)}function Ph(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Ih(){return{mount:k.length,destroy:T.length}}function Zn(e){return typeof e==="function"&&e._isSignal===!0}function Qn(e){return typeof e==="function"&&e._isDerived===!0}function $o(e){if(Zn(e)||Qn(e))return m(()=>e());return e}function ss(e){return m(e)}function Oh(e,n){let r=typeof e==="function"?e:()=>e,i=ge([]),o=Jn(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return Yn(()=>{if(r(),!t){t=!0;return}if(ss(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
3
+ export{ge,Jn,Rh,Yn,To,ns,rs,Ah,Ph,Ih,Zn,Qn,$o,ss,Oh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{cr,i}from"./chunk-321fbxnm.js";import"./chunk-4ykgjewy.js";import"./chunk-2dpessnc.js";import"./chunk-q1wxgw5s.js";import"./chunk-srgpz94e.js";import"./chunk-24hq8mka.js";import"./chunk-dhnw2qwq.js";import"./chunk-xymr4ys9.js";import"./chunk-fnxg6134.js";import{_e}from"./chunk-0c9c9v03.js";import"./chunk-zsnmk5me.js";import"./chunk-2s7rmn9r.js";import"./chunk-4xanjv22.js";import"./chunk-adb045wf.js";import"./chunk-tnp2ta5q.js";import"./chunk-669b2bya.js";import"./chunk-mfa07erx.js";import"./chunk-x512h2gv.js";import{je,Gs,Xs}from"./chunk-2kfayg4t.js";import"./chunk-0fh47gp0.js";import"./chunk-k32q90b2.js";import"./chunk-qa5y30sy.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{cr as buildModulesTag,_e as injectRouterScript,i as processDirectives,Gs as processJsonDirective,Xs as processOnceDirective,je as validateClientScript};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as Cm}from"ts-broadcasting";import{Broadcast as Em,BroadcastServer as Tm}from"ts-broadcasting";var e=null,u=[];function ym(){return e}async function bm(n){if(e)return e;let t=n.driver??"bun",r=n.host??"0.0.0.0",c=n.port??6001,l=n.scheme??"ws",a={verbose:n.verbose??!1,driver:t,default:t,connections:{[t]:{driver:t,host:r,port:c,scheme:l}}};return e=new h(a),s.setServer(e),await e.start(),e}async function wm(){for(let n of u)clearInterval(n);if(u.length=0,!e)return;await e.stop(),e=null}async function vm(n){let t=await import(n),r=t.default??t;if(typeof r!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof r}`);let c=0;return r({channel(a,o){if(c++,o.authorize&&e)e.channels.channel(a,o.authorize);if(o.interval&&o.data){let d=o.event??`${a}.updated`,p=o.data,v=setInterval(async()=>{try{let g=await p();Jl(a,d,g)}catch{}},o.interval);u.push(v)}}}),c}var f=!1;function i(){if(e)return!0;if(!f)f=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function Jl(n,t,r){if(!i())return;s.send(n,t,r)}function xm(n,t,r){if(!i())return;s.toUser(n,t,r)}function Sm(n,t,r){if(!i())return;s.toUsers(n,t,r)}function km(n,t,r){if(!i())return;s.send(`private-${n}`,t,r)}function _m(n,t,r){if(!i())return;s.presence(n,t,r)}
3
- export{ym,bm,wm,vm,Jl,xm,Sm,km,_m,Cm,Em,Tm};
2
+ import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as $m}from"ts-broadcasting";import{Broadcast as Rm,BroadcastServer as Am}from"ts-broadcasting";var e=null,u=[];function vm(){return e}async function xm(n){if(e)return e;let t=n.driver??"bun",r=n.host??"0.0.0.0",c=n.port??6001,l=n.scheme??"ws",a={verbose:n.verbose??!1,driver:t,default:t,connections:{[t]:{driver:t,host:r,port:c,scheme:l}}};return e=new h(a),s.setServer(e),await e.start(),e}async function Sm(){for(let n of u)clearInterval(n);if(u.length=0,!e)return;await e.stop(),e=null}async function km(n){let t=await import(n),r=t.default??t;if(typeof r!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof r}`);let c=0;return r({channel(a,o){if(c++,o.authorize&&e)e.channels.channel(a,o.authorize);if(o.interval&&o.data){let d=o.event??`${a}.updated`,p=o.data,v=setInterval(async()=>{try{let g=await p();Ql(a,d,g)}catch{}},o.interval);u.push(v)}}}),c}var f=!1;function i(){if(e)return!0;if(!f)f=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function Ql(n,t,r){if(!i())return;s.send(n,t,r)}function _m(n,t,r){if(!i())return;s.toUser(n,t,r)}function Cm(n,t,r){if(!i())return;s.toUsers(n,t,r)}function Em(n,t,r){if(!i())return;s.send(`private-${n}`,t,r)}function Tm(n,t,r){if(!i())return;s.presence(n,t,r)}
3
+ export{vm,xm,Sm,km,Ql,_m,Cm,Em,Tm,$m,Rm,Am};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{createHash as g}from"crypto";import{readFile as b,stat as y}from"fs/promises";async function H(e){try{let t=await b(e);return g("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function l(e){return g("sha256").update(e).digest("hex").slice(0,16)}function m(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${l(e)}-${l(r)}`}async function h(e){try{return(await y(e)).mtimeMs}catch{return 0}}async function L(e){try{return await y(e),!0}catch{return!1}}import{mkdir as v,readFile as A,writeFile as P,readdir as z,rm as k,stat as B}from"fs/promises";import{join as w,dirname as D}from"path";var c=new Map,d={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function E(e){try{await v(e,{recursive:!0})}catch{}}function p(e,t,r){return w(e,r,`${t}.json`)}async function C(e,t,r){if((Date.now()-e.createdAt)/86400000>r)return!1;if(await h(t)!==e.srcMtime)return!1;return!0}async function jr(e,t,r,a=d){if(!a.enabled)return null;let n=m(e,t),i=c.get(n);if(i){if(await C(i,e,a.maxAge))return i.lastAccessedAt=Date.now(),i.data;c.delete(n)}let o=p(a.directory,n,r);if(await L(o))try{let u=await A(o,"utf-8"),s=JSON.parse(u);if(await C(s,e,a.maxAge))return s.lastAccessedAt=Date.now(),c.set(n,s),s.data}catch{}return null}async function Br(e,t,r,a,n=d){if(!n.enabled)return;let i=m(e,t),o=await H(e),u=await h(e),s={key:i,src:e,srcHash:o,srcMtime:u,optionsHash:m("",t),data:r,createdAt:Date.now(),lastAccessedAt:Date.now()};c.set(i,s);let f=p(n.directory,i,a);try{await E(D(f)),await P(f,JSON.stringify(s,null,2))}catch(x){console.warn(`[stx-media] Failed to write cache: ${x}`)}}async function Fr(e,t=d){if(e==="all")c.clear();else c.clear();let r=e==="all"?["image","video"]:[e];for(let a of r){let n=w(t.directory,a);try{await k(n,{recursive:!0,force:!0})}catch{}}}
3
- export{H,L,jr,Br,Fr};
2
+ import{createHash as g}from"crypto";import{readFile as b,stat as y}from"fs/promises";async function W(e){try{let t=await b(e);return g("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function l(e){return g("sha256").update(e).digest("hex").slice(0,16)}function m(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${l(e)}-${l(r)}`}async function h(e){try{return(await y(e)).mtimeMs}catch{return 0}}async function F(e){try{return await y(e),!0}catch{return!1}}import{mkdir as v,readFile as A,writeFile as P,readdir as B,rm as k,stat as H}from"fs/promises";import{join as w,dirname as D}from"path";var c=new Map,d={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function E(e){try{await v(e,{recursive:!0})}catch{}}function p(e,t,r){return w(e,r,`${t}.json`)}async function C(e,t,r){if((Date.now()-e.createdAt)/86400000>r)return!1;if(await h(t)!==e.srcMtime)return!1;return!0}async function zr(e,t,r,a=d){if(!a.enabled)return null;let n=m(e,t),i=c.get(n);if(i){if(await C(i,e,a.maxAge))return i.lastAccessedAt=Date.now(),i.data;c.delete(n)}let o=p(a.directory,n,r);if(await F(o))try{let u=await A(o,"utf-8"),s=JSON.parse(u);if(await C(s,e,a.maxAge))return s.lastAccessedAt=Date.now(),c.set(n,s),s.data}catch{}return null}async function Hr(e,t,r,a,n=d){if(!n.enabled)return;let i=m(e,t),o=await W(e),u=await h(e),s={key:i,src:e,srcHash:o,srcMtime:u,optionsHash:m("",t),data:r,createdAt:Date.now(),lastAccessedAt:Date.now()};c.set(i,s);let f=p(n.directory,i,a);try{await E(D(f)),await P(f,JSON.stringify(s,null,2))}catch(x){console.warn(`[stx-media] Failed to write cache: ${x}`)}}async function Vr(e,t=d){if(e==="all")c.clear();else c.clear();let r=e==="all"?["image","video"]:[e];for(let a of r){let n=w(t.directory,a);try{await k(n,{recursive:!0,force:!0})}catch{}}}
3
+ export{W,F,zr,Hr,Vr};
@@ -1,18 +1,18 @@
1
1
  // @bun
2
- import{Ne,C,Z}from"./chunk-261t62q4.js";import{k}from"./chunk-1jwcp2k0.js";import{I,An}from"./chunk-xppm4cs4.js";import{a}from"./chunk-6nb49h13.js";import{be,an,cn,ln}from"./chunk-74g64pzt.js";import{St}from"./chunk-b1tctqn5.js";import{bt,Wn,Qt,ue}from"./chunk-jhm1228j.js";import{T,Rn}from"./chunk-9xr628ew.js";import A from"fs";import b from"path";import x from"process";function U(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function O(s,o=T()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${cn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return ue(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>be(l))])],f=bt(i()),u=Qt(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return ue(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=Z({loader:"ts",target:"browser",define:C()});for(let l of p)try{let c=await Bun.file(l).text(),_=b.basename(l,".ts"),y=new Set;U(c,y);let v=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((N)=>N[2]),E=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(an(c))c=await ln(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=St(c),c=I(c),c=An(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:_,ids:v.length===E?v:[],declared:y,code:`// Store: ${_}
3
- ${c.trim()}`})}catch(c){console.warn(`[stx] Failed to load store ${l}:`,c)}if(g.length===0)return ue(h,t,f,{chunks:[]}),null;f=bt(i());let S={chunks:g};return ue(h,t,f,S),S}function R(s){let o=new Set;for(let r of s)for(let i of r.declared)o.add(i);let e=s.map((r)=>r.code).join(`
2
+ import{Le,T,te}from"./chunk-2kfayg4t.js";import{C}from"./chunk-qjey0jk6.js";import{N,On}from"./chunk-farh4p7f.js";import{a}from"./chunk-4xanjv22.js";import{xe,un,dn,pn}from"./chunk-hdjn7nw9.js";import{Ct}from"./chunk-fnxg6134.js";import{xt,Gn,nn,fe}from"./chunk-ynkbv9jq.js";import{A,In}from"./chunk-bwdbj60y.js";import v from"fs";import b from"path";import x from"process";function U(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function O(s,o=A()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${dn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return fe(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>xe(l))])],f=xt(i()),u=nn(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return fe(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=te({loader:"ts",target:"browser",define:T()});for(let l of p)try{let c=await Bun.file(l).text(),k=b.basename(l,".ts"),_=new Set;U(c,_);let y=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((I)=>I[2]),E=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(un(c))c=await pn(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=Ct(c),c=N(c),c=On(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:k,ids:y.length===E?y:[],declared:_,code:`// Store: ${k}
3
+ ${c.trim()}`})}catch(c){console.warn(`[stx] Failed to load store ${l}:`,c)}if(g.length===0)return fe(h,t,f,{chunks:[]}),null;f=xt(i());let S={chunks:g};return fe(h,t,f,S),S}function R(s){let o=new Set;for(let r of s)for(let i of r.declared)o.add(i);let e=s.map((r)=>r.code).join(`
4
4
 
5
5
  `),n=`;(function(){
6
6
  var __stx = window.stx || {};
7
- ${k.filter((r)=>!o.has(r)&&new RegExp(`\\b${r}\\b`).test(e)).map((r)=>`var ${r} = __stx[${JSON.stringify(r)}];`).join(`
7
+ ${C.filter((r)=>!o.has(r)&&new RegExp(`\\b${r}\\b`).test(e)).map((r)=>`var ${r} = __stx[${JSON.stringify(r)}];`).join(`
8
8
  `)}
9
9
  ${e}
10
- })();`;return T()?Rn(n):n}function B(s){let o=new Set;for(let e of s.matchAll(/^(?:export\s+)?(?:async\s+)?(?:const|let|var|function\*?|class)\s+([A-Z_a-z$][\w$]*)/gm))o.add(e[1]);for(let e of s.matchAll(/^(?:const|let|var)\s*[{[]([^=]*)[}\]]\s*=/gm))for(let t of(e[1]??"").split(",")){let n=(t.includes(":")?t.split(":").pop():t).replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}return o}function j(s){let o=s.map((e)=>B(e.code));for(let[e,t]of s.entries()){let n=new Set;for(let[i,f]of o.entries()){if(i===e)continue;for(let u of f)if(!o[e].has(u)&&!t.declared.has(u))n.add(u)}if(n.size===0)continue;let r;try{r=Ne(t.code,n)}catch{r=new Set([...n].filter((i)=>new RegExp(`(?<![\\w$.])${i.replace(/\$/g,"\\$")}(?![\\w$])`).test(t.code)))}if(r.size>0)return null}return s.map((e,t)=>{let n=new Set([...e.declared,...o[t]]);return`function() {
10
+ })();`;return A()?In(n):n}function B(s){let o=new Set;for(let e of s.matchAll(/^(?:export\s+)?(?:async\s+)?(?:const|let|var|function\*?|class)\s+([A-Z_a-z$][\w$]*)/gm))o.add(e[1]);for(let e of s.matchAll(/^(?:const|let|var)\s*[{[]([^=]*)[}\]]\s*=/gm))for(let t of(e[1]??"").split(",")){let n=(t.includes(":")?t.split(":").pop():t).replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}return o}function j(s){let o=s.map((e)=>B(e.code));for(let[e,t]of s.entries()){let n=new Set;for(let[i,f]of o.entries()){if(i===e)continue;for(let u of f)if(!o[e].has(u)&&!t.declared.has(u))n.add(u)}if(n.size===0)continue;let r;try{r=Le(t.code,n)}catch{r=new Set([...n].filter((i)=>new RegExp(`(?<![\\w$.])${i.replace(/\$/g,"\\$")}(?![\\w$])`).test(t.code)))}if(r.size>0)return null}return s.map((e,t)=>{let n=new Set([...e.declared,...o[t]]);return`function() {
11
11
  var __stx = window.stx || {};
12
- ${k.filter((i)=>!n.has(i)&&new RegExp(`\\b${i}\\b`).test(e.code)).map((i)=>`var ${i} = __stx[${JSON.stringify(i)}];`).join(`
12
+ ${C.filter((i)=>!n.has(i)&&new RegExp(`\\b${i}\\b`).test(e.code)).map((i)=>`var ${i} = __stx[${JSON.stringify(i)}];`).join(`
13
13
  `)}
14
14
  ${e.code}
15
- }`})}var M=new WeakMap;async function bh(s){let o=await O(s);if(!o)return null;let e=M.get(o);if(e===void 0)e=R(o.chunks),M.set(o,e);return e}function W(s){if(!/\buseStore\b/.test(s))return!1;if(/\buseStore\s+as\s+[A-Za-z_$]/.test(s))return!0;if(/\{[^{}]*\buseStore\s*:\s*[A-Za-z_$[{][^{}]*\}\s*=(?!=)/.test(s))return!0;if(/\[\s*(['"`])useStore\1\s*\]/.test(s.replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ")))return!0;let o=s.replace(/\/\*[\s\S]*?\*\//g," ").replace(/(^|[^:\\'"`])\/\/[^\n]*/g,"$1 ").replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ").replace(/\b(?:const|let|var)\s*\{[^{}]*\}\s*=/g," ").replace(/\bimport\s*(?:type\s+)?\{[^{}]*\}\s*from\b/g," ").replace(/\bexport\s*(?:type\s+)?\{[^{}]*\}/g," ").replace(/\btypeof\s+useStore\b/g," ").replace(/(['"`])useStore\1/g," ");for(let e of o.matchAll(/\buseStore\b/g)){let t=o.slice(Math.max(0,e.index-9),e.index);if(/\bfunction\s*$/.test(t))continue;let n=o.slice(e.index+8).trimStart();if(n.startsWith("(")||n.startsWith("<")||n.startsWith("?.("))continue;if(/^=(?![=>])/.test(n))continue;return!0}return!1}function So(...s){let o=new Set,e=!1;for(let t of s){if(!t)continue;if(/__STX_STORES__|\b_stores\b/.test(t))e=!0;if(W(t))e=!0;let n=t.match(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(/g)?.length??0;if(n===0)continue;let r=0;for(let i of t.matchAll(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(\s*(['"`])([^'"`$\\]+)\1\s*[,)]/g))o.add(i[2]),r++;if(r!==n)e=!0}return{names:o,all:e}}var z=new Map;function wh(s){let o=new Set,e=!1;for(let t of s){if(/\.(?:css|json|svg|wasm|png|jpe?g|gif|webp|avif|woff2?|ttf|txt|md)$/i.test(t))continue;let n;try{let r=A.statSync(t),i=z.get(t);if(i&&i.mtimeMs===r.mtimeMs&&i.size===r.size)n=i.read;else n=So(A.readFileSync(t,"utf8")),z.set(t,{mtimeMs:r.mtimeMs,size:r.size,read:n})}catch{n={names:new Set,all:!0}}if(n.all)e=!0;for(let r of n.names)o.add(r)}return{names:o,all:e}}function vh(s=x.env){return s.STX_PAGE_STORES==="all"}async function xh(s,o,e={}){let t=await O(s,e.sharedModules);if(!t)return null;let{chunks:n}=t,r=So(...o);if(e.reads){if(e.reads.all)r.all=!0;for(let u of e.reads.names)r.names.add(u)}let i=e.runOnce?P(t):void 0,f;if(e.all||r.all||n.some((u)=>u.ids.length===0)||i===null)f=n;else{let u=new Map;for(let d of n)for(let S of d.ids)u.set(S,d);let m=new Set,p=[...r.names],g=!1;while(p.length>0&&!g){let d=u.get(p.pop());if(!d||m.has(d))continue;m.add(d);let S=So(d.code);if(S.all)g=!0;else p.push(...S.names)}f=g?n:n.filter((d)=>m.has(d))}if(f.length===0)return null;if(i){let u=f.map((d)=>i.get(d)),m=f.map((d)=>d.name),p=F.get(t);if(!p)F.set(t,p=new Map);let g=p.get(m.join("\x00"));if(g===void 0)p.set(m.join("\x00"),g=D(m,u));return{code:g,stores:m,functions:u}}return{code:R(f),stores:f.map((u)=>u.name),functions:j(f)}}var F=new WeakMap,w=new WeakMap;function P(s){if(w.has(s))return w.get(s);let o=j(s.chunks),e=o?new Map(s.chunks.map((t,n)=>[t,o[n]])):null;return w.set(s,e),e}function D(s,o){let t=`;(function(){
15
+ }`})}var M=new WeakMap;async function xh(s){let o=await O(s);if(!o)return null;let e=M.get(o);if(e===void 0)e=R(o.chunks),M.set(o,e);return e}function W(s){if(!/\buseStore\b/.test(s))return!1;if(/\buseStore\s+as\s+[A-Za-z_$]/.test(s))return!0;if(/\{[^{}]*\buseStore\s*:\s*[A-Za-z_$[{][^{}]*\}\s*=(?!=)/.test(s))return!0;if(/\[\s*(['"`])useStore\1\s*\]/.test(s.replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ")))return!0;let o=s.replace(/\/\*[\s\S]*?\*\//g," ").replace(/(^|[^:\\'"`])\/\/[^\n]*/g,"$1 ").replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ").replace(/\b(?:const|let|var)\s*\{[^{}]*\}\s*=/g," ").replace(/\bimport\s*(?:type\s+)?\{[^{}]*\}\s*from\b/g," ").replace(/\bexport\s*(?:type\s+)?\{[^{}]*\}/g," ").replace(/\btypeof\s+useStore\b/g," ").replace(/(['"`])useStore\1/g," ");for(let e of o.matchAll(/\buseStore\b/g)){let t=o.slice(Math.max(0,e.index-9),e.index);if(/\bfunction\s*$/.test(t))continue;let n=o.slice(e.index+8).trimStart();if(n.startsWith("(")||n.startsWith("<")||n.startsWith("?.("))continue;if(/^=(?![=>])/.test(n))continue;return!0}return!1}function Co(...s){let o=new Set,e=!1;for(let t of s){if(!t)continue;if(/__STX_STORES__|\b_stores\b/.test(t))e=!0;if(W(t))e=!0;let n=t.match(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(/g)?.length??0;if(n===0)continue;let r=0;for(let i of t.matchAll(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(\s*(['"`])([^'"`$\\]+)\1\s*[,)]/g))o.add(i[2]),r++;if(r!==n)e=!0}return{names:o,all:e}}var z=new Map;function Sh(s){let o=new Set,e=!1;for(let t of s){if(/\.(?:css|json|svg|wasm|png|jpe?g|gif|webp|avif|woff2?|ttf|txt|md)$/i.test(t))continue;let n;try{let r=v.statSync(t),i=z.get(t);if(i&&i.mtimeMs===r.mtimeMs&&i.size===r.size)n=i.read;else n=Co(v.readFileSync(t,"utf8")),z.set(t,{mtimeMs:r.mtimeMs,size:r.size,read:n})}catch{n={names:new Set,all:!0}}if(n.all)e=!0;for(let r of n.names)o.add(r)}return{names:o,all:e}}function kh(s=x.env){return s.STX_PAGE_STORES==="all"}async function _h(s,o,e={}){let t=await O(s,e.sharedModules);if(!t)return null;let{chunks:n}=t,r=Co(...o);if(e.reads){if(e.reads.all)r.all=!0;for(let u of e.reads.names)r.names.add(u)}let i=e.runOnce?Z(t):void 0,f;if(e.all||r.all||n.some((u)=>u.ids.length===0)||i===null)f=n;else{let u=new Map;for(let d of n)for(let S of d.ids)u.set(S,d);let m=new Set,p=[...r.names],g=!1;while(p.length>0&&!g){let d=u.get(p.pop());if(!d||m.has(d))continue;m.add(d);let S=Co(d.code);if(S.all)g=!0;else p.push(...S.names)}f=g?n:n.filter((d)=>m.has(d))}if(f.length===0)return null;if(i){let u=f.map((d)=>i.get(d)),m=f.map((d)=>d.name),p=F.get(t);if(!p)F.set(t,p=new Map);let g=p.get(m.join("\x00"));if(g===void 0)p.set(m.join("\x00"),g=P(m,u));return{code:g,stores:m,functions:u}}return{code:R(f),stores:f.map((u)=>u.name),functions:j(f)}}var F=new WeakMap,w=new WeakMap;function Z(s){if(w.has(s))return w.get(s);let o=j(s.chunks),e=o?new Map(s.chunks.map((t,n)=>[t,o[n]])):null;return w.set(s,e),e}function P(s,o){let t=`;(function(){
16
16
  var ran = window.__stxStoreFiles || (window.__stxStoreFiles = {});
17
17
  function run(name, define) {
18
18
  if (ran[name]) return;
@@ -22,5 +22,5 @@ function run(name, define) {
22
22
  }
23
23
  ${s.map((n,r)=>`run(${JSON.stringify(n)}, ${o[r]})`).join(`;
24
24
  `)};
25
- })();`;return T()?Rn(t):t}function Sh(){h.clear(),Wn()}
26
- export{bh,So,wh,vh,xh,Sh};
25
+ })();`;return A()?In(t):t}function Ch(){h.clear(),Gn()}
26
+ export{xh,Co,Sh,kh,_h,Ch};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{H,L,jr,Br,Fr}from"./chunk-5wr1qqz3.js";import{resolve as S,basename as z,extname as j,join as T}from"path";import{mkdir as q}from"fs/promises";var F={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class zi{config;constructor(e={}){this.config={...F,...e}}async get(e,s){return jr(e,s,"image",this.config)}async set(e,s,r){return Br(e,s,r,"image",this.config)}async clear(){return Fr("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new zi(e);else if(e)w.updateConfig(e);return w}async function Hi(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function Vi(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function Wg(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function R(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function k(e,s){let r=s?R(s):R("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function qg(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await Hi(e,s,r);if(a)return a;try{let c=S(e);if(!await L(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=k(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await q(p,{recursive:!0});let d=await H(c),P=z(e,j(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await Nl(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=T(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await Vi(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function Kg(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function Nl(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as E,basename as D,extname as Q,join as U}from"path";import{mkdir as V}from"fs/promises";async function O(){try{return await import("ts-images")}catch{return null}}var A=[320,480,640,768,1024,1280,1536,1920];async function Gg(e,s,r){let t=await O();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=E(e);if(!await L(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||A,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await V(p,{recursive:!0});let d=await H(a),P=D(e,Q(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=U(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await L(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||B(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function B(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Xg(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{zi,Hi,Vi,Wg,qg,Kg,Nl,Gg,Xg};
2
+ import{W,F,zr,Hr,Vr}from"./chunk-6k4ac74t.js";import{resolve as z,basename as j,extname as T,join as q}from"path";import{mkdir as k}from"fs/promises";var S={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class Wi{config;constructor(e={}){this.config={...S,...e}}async get(e,s){return zr(e,s,"image",this.config)}async set(e,s,r){return Hr(e,s,r,"image",this.config)}async clear(){return Vr("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new Wi(e);else if(e)w.updateConfig(e);return w}async function qi(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function Ki(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function Gg(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function R(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function E(e,s){let r=s?R(s):R("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function Xg(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await qi(e,s,r);if(a)return a;try{let c=z(e);if(!await F(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=E(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await k(p,{recursive:!0});let d=await W(c),P=j(e,T(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await Ll(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=q(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await Ki(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function Jg(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function Ll(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as D,basename as Q,extname as U,join as V}from"path";import{mkdir as L}from"fs/promises";async function H(){try{return await import("ts-images")}catch{return null}}var O=[320,480,640,768,1024,1280,1536,1920];async function Yg(e,s,r){let t=await H();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=D(e);if(!await F(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||O,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await L(p,{recursive:!0});let d=await W(a),P=Q(e,U(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=V(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await F(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||A(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function A(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Zg(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{Wi,qi,Ki,Gg,Xg,Jg,Ll,Yg,Zg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ah}from"./chunk-qcxrcypb.js";export{ah as processDeferDirectives};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{existsSync as x,realpathSync as b,statSync as y}from"fs";import f from"path";import k from"process";var E=/^[\w-]+(?:\/[\w-]+)*$/,j=/^[\w-]+$/;async function Hr(s,e){let n=f.resolve(s,e.dir);if(!e.languages?.length)throw Error("messages.languages must name at least one language");let a=new Map,r=new Map;for(let t of e.languages){if(!j.test(t))throw Error(`messages: "${t}" is not a language directory name`);let g=f.join(n,t);if(!x(g))throw Error(`messages: ${f.relative(s,g)} does not exist`);let o=new Map;for(let i of[...new Bun.Glob("**/*.{ts,js,mjs,json}").scanSync({cwd:g})].sort()){if(/\.(?:test|spec|d)\.[^.]+$/.test(i))continue;let l=i.replace(/\.[^./]+$/,"").split(f.sep).join("/");if(!E.test(l))throw Error(`messages: ${t}/${i} is not an area name`);if(o.has(l))throw Error(`messages: ${t}/${l} is defined twice`);let c=f.join(g,i),p=await import(c),m=Object.keys(p).filter((S)=>S!=="default");if(m.length)throw Error(`messages: ${t}/${i} exports ${m.join(", ")}; a message module exports its messages as default, and nothing else`);let u=p.default,d=u!==null&&typeof u==="object"&&!Array.isArray(u)?JSON.stringify(u):void 0;if(d===void 0||!Bun.deepEquals(JSON.parse(d),u,!0))throw Error(`messages: ${t}/${i} must export plain data (an object JSON can hold) as default`);o.set(l,d),a.set(c,{language:t,area:l})}r.set(t,o)}return{files:a,data:r}}function h(s,e){return`stx-messages:${s}:${e}`}function _(s,e){let n=JSON.stringify(h(s,e));return`var kept = globalThis.__stxMessages || (globalThis.__stxMessages = {});
3
- export default kept[${n}] || (kept[${n}] = {});`}var M=new Map;function Vr(s){let e=[s];try{e.push(b(s))}catch{}for(let n of[...e])if(n.startsWith("/private/"))e.push(n.slice(8));return[...new Set(e)]}function em(s,e=k.env){if(!s.messages||e.STX_PAGE_MESSAGES==="0")return!1;return e.STX_PAGE_MESSAGES==="1"||e.NODE_ENV==="production"}async function tm(s,e){let n=f.resolve(s,e.dir),a=e.languages.map((c)=>{try{return`${c}:${y(f.join(n,c)).mtimeMs}`}catch{return`${c}:-`}}).join("|"),r=`${n}\x00${e.languages.join(",")}\x00${e.fallback??""}`,t=M.get(r);if(t&&t.signature===a)return t.messages;let g=await Hr(s,e),o=new Map;for(let[c,{language:p,area:m}]of g.files){let u=_(p,m);for(let d of Vr(c))o.set(d,u)}let i=e.fallback??e.languages[0];if(!e.languages.includes(i))throw Error(`messages.fallback "${i}" is not one of messages.languages`);let l={...g,stubs:o,languages:[...e.languages],fallback:i};return M.set(r,{signature:a,messages:l}),l}function nm(...s){let e=new Set;for(let n of s){if(!n||!n.includes("stx-messages:"))continue;for(let a of n.matchAll(/stx-messages:[\w-]+:([\w/-]+)/g))e.add(a[1])}return e}function rm(s,e){let n=/<html\b[^>]*>/i.exec(s)?.[0]??"",a=/\slang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(n),r=(a?a[1]??a[2]??a[3]??"":"").trim().toLowerCase(),t=new Map(e.languages.map((o)=>[o.toLowerCase(),o])),g=t.get(r)??t.get(r.split(/[-_]/)[0]??"");if(!g)return[...e.languages];return[...new Set([g,e.fallback])]}var w=new WeakMap;function sm(s,e,n){let a=[...n].sort(),r=w.get(s);if(!r)w.set(s,r=new Map);let t=`${e.join(",")}\x00${a.join(",")}`;if(r.has(t))return r.get(t);let g=P(s,e,a);return r.set(t,g),g}function P(s,e,n){let a=[];for(let r of e){let t=s.data.get(r);if(!t)continue;for(let g of n){let o=t.get(g);if(o!==void 0)a.push(`put(${JSON.stringify(h(r,g))},${JSON.stringify(o)})`)}}if(a.length===0)return null;return`;(function(){var kept=globalThis.__stxMessages||(globalThis.__stxMessages={}),filled=globalThis.__stxMessagesFilled||(globalThis.__stxMessagesFilled={});function put(key,json){if(filled[key])return;filled[key]=1;var into=kept[key]||(kept[key]={}),data=JSON.parse(json);for(var name in data)into[name]=data[name]}
2
+ import{existsSync as x,realpathSync as b,statSync as y}from"fs";import f from"path";import k from"process";var E=/^[\w-]+(?:\/[\w-]+)*$/,j=/^[\w-]+$/;async function Wr(s,e){let n=f.resolve(s,e.dir);if(!e.languages?.length)throw Error("messages.languages must name at least one language");let a=new Map,r=new Map;for(let t of e.languages){if(!j.test(t))throw Error(`messages: "${t}" is not a language directory name`);let g=f.join(n,t);if(!x(g))throw Error(`messages: ${f.relative(s,g)} does not exist`);let o=new Map;for(let i of[...new Bun.Glob("**/*.{ts,js,mjs,json}").scanSync({cwd:g})].sort()){if(/\.(?:test|spec|d)\.[^.]+$/.test(i))continue;let l=i.replace(/\.[^./]+$/,"").split(f.sep).join("/");if(!E.test(l))throw Error(`messages: ${t}/${i} is not an area name`);if(o.has(l))throw Error(`messages: ${t}/${l} is defined twice`);let c=f.join(g,i),p=await import(c),m=Object.keys(p).filter((S)=>S!=="default");if(m.length)throw Error(`messages: ${t}/${i} exports ${m.join(", ")}; a message module exports its messages as default, and nothing else`);let u=p.default,d=u!==null&&typeof u==="object"&&!Array.isArray(u)?JSON.stringify(u):void 0;if(d===void 0||!Bun.deepEquals(JSON.parse(d),u,!0))throw Error(`messages: ${t}/${i} must export plain data (an object JSON can hold) as default`);o.set(l,d),a.set(c,{language:t,area:l})}r.set(t,o)}return{files:a,data:r}}function h(s,e){return`stx-messages:${s}:${e}`}function _(s,e){let n=JSON.stringify(h(s,e));return`var kept = globalThis.__stxMessages || (globalThis.__stxMessages = {});
3
+ export default kept[${n}] || (kept[${n}] = {});`}var M=new Map;function qr(s){let e=[s];try{e.push(b(s))}catch{}for(let n of[...e])if(n.startsWith("/private/"))e.push(n.slice(8));return[...new Set(e)]}function rm(s,e=k.env){if(!s.messages||e.STX_PAGE_MESSAGES==="0")return!1;return e.STX_PAGE_MESSAGES==="1"||e.NODE_ENV==="production"}async function sm(s,e){let n=f.resolve(s,e.dir),a=e.languages.map((c)=>{try{return`${c}:${y(f.join(n,c)).mtimeMs}`}catch{return`${c}:-`}}).join("|"),r=`${n}\x00${e.languages.join(",")}\x00${e.fallback??""}`,t=M.get(r);if(t&&t.signature===a)return t.messages;let g=await Wr(s,e),o=new Map;for(let[c,{language:p,area:m}]of g.files){let u=_(p,m);for(let d of qr(c))o.set(d,u)}let i=e.fallback??e.languages[0];if(!e.languages.includes(i))throw Error(`messages.fallback "${i}" is not one of messages.languages`);let l={...g,stubs:o,languages:[...e.languages],fallback:i};return M.set(r,{signature:a,messages:l}),l}function om(...s){let e=new Set;for(let n of s){if(!n||!n.includes("stx-messages:"))continue;for(let a of n.matchAll(/stx-messages:[\w-]+:([\w/-]+)/g))e.add(a[1])}return e}function im(s,e){let n=/<html\b[^>]*>/i.exec(s)?.[0]??"",a=/\slang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(n),r=(a?a[1]??a[2]??a[3]??"":"").trim().toLowerCase(),t=new Map(e.languages.map((o)=>[o.toLowerCase(),o])),g=t.get(r)??t.get(r.split(/[-_]/)[0]??"");if(!g)return[...e.languages];return[...new Set([g,e.fallback])]}var w=new WeakMap;function am(s,e,n){let a=[...n].sort(),r=w.get(s);if(!r)w.set(s,r=new Map);let t=`${e.join(",")}\x00${a.join(",")}`;if(r.has(t))return r.get(t);let g=P(s,e,a);return r.set(t,g),g}function P(s,e,n){let a=[];for(let r of e){let t=s.data.get(r);if(!t)continue;for(let g of n){let o=t.get(g);if(o!==void 0)a.push(`put(${JSON.stringify(h(r,g))},${JSON.stringify(o)})`)}}if(a.length===0)return null;return`;(function(){var kept=globalThis.__stxMessages||(globalThis.__stxMessages={}),filled=globalThis.__stxMessagesFilled||(globalThis.__stxMessagesFilled={});function put(key,json){if(filled[key])return;filled[key]=1;var into=kept[key]||(kept[key]={}),data=JSON.parse(json);for(var name in data)into[name]=data[name]}
4
4
  ${a.join(`;
5
5
  `)};
6
6
  })();`}
7
- export{Hr,Vr,em,tm,nm,rm,sm};
7
+ export{Wr,qr,rm,sm,om,im,am};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ao,Gt,Dl,Vg}from"./chunk-qbghf76y.js";export{ao as generateServiceWorker,Vg as generateServiceWorkerAuto,Gt as getServiceWorkerFileName,Dl as isWorkboxEnabled};