@stacksjs/stx 0.2.876 → 0.2.880

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 (276) hide show
  1. package/dist/{chunk-fdjx4vs3.js → chunk-00tq7ghn.js} +2 -2
  2. package/dist/{chunk-nv4c25zj.js → chunk-02qmvcmv.js} +3 -3
  3. package/dist/chunk-08cb7cyw.js +2 -0
  4. package/dist/chunk-0h1dyd38.js +2 -0
  5. package/dist/{chunk-2mt2zc5y.js → chunk-0m4c42qt.js} +10 -10
  6. package/dist/{chunk-x4jzhgdm.js → chunk-19k15mfc.js} +2 -2
  7. package/dist/chunk-1avy0p8v.js +2 -0
  8. package/dist/chunk-1jk46ve0.js +2 -0
  9. package/dist/chunk-1r612xxs.js +2 -0
  10. package/dist/chunk-1z6rrqvm.js +2 -0
  11. package/dist/chunk-2d68p12e.js +2 -0
  12. package/dist/chunk-2haf7t5h.js +2 -0
  13. package/dist/{chunk-1q5w3xav.js → chunk-2r0nrvqe.js} +2 -2
  14. package/dist/chunk-3jp5z1qj.js +2 -0
  15. package/dist/{chunk-dv56x3g8.js → chunk-3q0w0bzd.js} +10 -10
  16. package/dist/{chunk-eknm4jrm.js → chunk-3sema2js.js} +2 -2
  17. package/dist/{chunk-cj44e8mw.js → chunk-3wb82rxw.js} +5 -5
  18. package/dist/chunk-3zds0gmd.js +2 -0
  19. package/dist/{chunk-qnwd5bz4.js → chunk-463weehv.js} +1 -1
  20. package/dist/{chunk-wm029dh0.js → chunk-4fkcn6z5.js} +18 -12
  21. package/dist/{chunk-976kgb3r.js → chunk-4n45qa0b.js} +9 -9
  22. package/dist/chunk-4pjqj54a.js +2 -0
  23. package/dist/{chunk-j0rqa9bk.js → chunk-4r2rfdmr.js} +5 -5
  24. package/dist/{chunk-ft6em3wm.js → chunk-50cnypys.js} +6 -6
  25. package/dist/chunk-53cc06w7.js +2 -0
  26. package/dist/{chunk-y2e2zm6y.js → chunk-57q4nvs9.js} +3 -3
  27. package/dist/{chunk-3mz9bdf7.js → chunk-59er0fc7.js} +3 -3
  28. package/dist/{chunk-6kp4mg3h.js → chunk-5eftxrvv.js} +2 -2
  29. package/dist/chunk-5p3825qw.js +2 -0
  30. package/dist/chunk-5rd0an89.js +2 -0
  31. package/dist/{chunk-pk714ynv.js → chunk-69ezjc8k.js} +4 -4
  32. package/dist/{chunk-75v0yxeh.js → chunk-6c1vm6bs.js} +2 -2
  33. package/dist/{chunk-d3q0cg47.js → chunk-6df3j3qq.js} +3 -3
  34. package/dist/{chunk-kzc2tqzr.js → chunk-6t04tqvh.js} +2 -2
  35. package/dist/chunk-78zgmqhd.js +2 -0
  36. package/dist/chunk-7bsrnpmh.js +33 -0
  37. package/dist/chunk-7dq6ebvp.js +2 -0
  38. package/dist/chunk-7kqgp3p7.js +2 -0
  39. package/dist/{chunk-wzvdr4ta.js → chunk-7mcs59pr.js} +2 -2
  40. package/dist/chunk-83b9k17j.js +2 -0
  41. package/dist/chunk-86nsbxep.js +61 -0
  42. package/dist/{chunk-0g2mg8cw.js → chunk-8e1cv1hh.js} +3 -3
  43. package/dist/chunk-8h5nje66.js +2 -0
  44. package/dist/{chunk-ae8q4gze.js → chunk-8va3fs07.js} +5 -5
  45. package/dist/{chunk-fh72k2ks.js → chunk-93jhfbeg.js} +6 -6
  46. package/dist/{chunk-xmws1gaf.js → chunk-94ctmp0j.js} +2 -2
  47. package/dist/chunk-97kgrevs.js +4 -0
  48. package/dist/{chunk-nn6hvsxp.js → chunk-9cbf0seq.js} +2 -2
  49. package/dist/{chunk-mce3g2wb.js → chunk-9f31gs4m.js} +2 -2
  50. package/dist/chunk-9kza7gxd.js +2 -0
  51. package/dist/{chunk-b4d4tjvx.js → chunk-a0q0kb0s.js} +5 -5
  52. package/dist/chunk-a5gnxdfe.js +2 -0
  53. package/dist/chunk-a60ztvnp.js +3 -0
  54. package/dist/{chunk-s7fhpkvf.js → chunk-a7ryj8z8.js} +6 -6
  55. package/dist/{chunk-gqtb53s8.js → chunk-aaea157p.js} +2 -2
  56. package/dist/{chunk-wp0qpa50.js → chunk-agd2b928.js} +59 -27
  57. package/dist/chunk-aqxh80vh.js +2 -0
  58. package/dist/{chunk-2tcyfrvb.js → chunk-awp8a3t4.js} +2 -2
  59. package/dist/chunk-axra1yas.js +2 -0
  60. package/dist/chunk-az8b0726.js +21 -0
  61. package/dist/chunk-b7d3n4aw.js +2 -0
  62. package/dist/{chunk-r2bxjna3.js → chunk-c0g30cjs.js} +2 -2
  63. package/dist/{chunk-jt5tzddc.js → chunk-c73c0wf9.js} +2 -2
  64. package/dist/{chunk-3922g6sh.js → chunk-cad7e5q1.js} +9 -9
  65. package/dist/{chunk-bjjfr7qt.js → chunk-care745q.js} +2 -2
  66. package/dist/chunk-ce0zbpr5.js +2 -0
  67. package/dist/chunk-cjv89tnb.js +20 -0
  68. package/dist/chunk-cv1vm1w0.js +2 -0
  69. package/dist/{chunk-mw0rb1sf.js → chunk-czcx3nbx.js} +6 -6
  70. package/dist/chunk-d7b30bg6.js +2 -0
  71. package/dist/{chunk-stn7p7f1.js → chunk-dwyhpbpx.js} +2 -2
  72. package/dist/{chunk-y75bds1g.js → chunk-e362e615.js} +30 -30
  73. package/dist/{chunk-ydppkb8y.js → chunk-e41pgmgk.js} +2 -2
  74. package/dist/{chunk-ctjxcaxq.js → chunk-ec5q4nnw.js} +66 -66
  75. package/dist/{chunk-k0t9ye9j.js → chunk-egjmb32c.js} +126 -71
  76. package/dist/{chunk-g15reb1h.js → chunk-ew3vs3jq.js} +8 -8
  77. package/dist/{chunk-jqxerj6k.js → chunk-ezna4dhj.js} +2 -2
  78. package/dist/chunk-f3j1h3ch.js +2 -0
  79. package/dist/{chunk-mkwavsb3.js → chunk-f7znj9xg.js} +3 -3
  80. package/dist/chunk-fz4c5e9m.js +2 -0
  81. package/dist/{chunk-esjr9qhe.js → chunk-g2xy0z0e.js} +2 -2
  82. package/dist/{chunk-fwbccyhw.js → chunk-g83ph305.js} +2 -2
  83. package/dist/{chunk-kywe0f1v.js → chunk-gbncp2gp.js} +2 -2
  84. package/dist/chunk-gm67jt8p.js +2 -0
  85. package/dist/chunk-gmp10259.js +2 -0
  86. package/dist/{chunk-0sa9gqmc.js → chunk-h2tq6cbr.js} +11 -11
  87. package/dist/chunk-h3fv0q25.js +2 -0
  88. package/dist/{chunk-r09kz9bf.js → chunk-h63ma36g.js} +2 -2
  89. package/dist/chunk-hkx51atf.js +2 -0
  90. package/dist/{chunk-w8k9fz1w.js → chunk-hmntqqyd.js} +7 -7
  91. package/dist/{chunk-3w7gacva.js → chunk-hxhmhw23.js} +3 -3
  92. package/dist/chunk-jghpzx5m.js +2 -0
  93. package/dist/chunk-k206d3pn.js +2 -0
  94. package/dist/chunk-k40e0ete.js +4 -0
  95. package/dist/chunk-k6c5t9we.js +38 -0
  96. package/dist/{chunk-f4vgagjb.js → chunk-kee5a3ce.js} +3 -3
  97. package/dist/chunk-kn9tqjgv.js +25 -0
  98. package/dist/chunk-kna1bdm2.js +54 -0
  99. package/dist/{chunk-ttjscvre.js → chunk-mygsektn.js} +3 -3
  100. package/dist/chunk-nb6erf75.js +9 -0
  101. package/dist/chunk-ngzyzcrp.js +2 -0
  102. package/dist/{chunk-h17pfbng.js → chunk-nysbdr4r.js} +2 -2
  103. package/dist/chunk-p55a910x.js +1198 -0
  104. package/dist/chunk-p6hcrg3r.js +3 -0
  105. package/dist/chunk-p746twww.js +2 -0
  106. package/dist/chunk-pa2vt2ej.js +2 -0
  107. package/dist/chunk-pa6kgbmw.js +2 -0
  108. package/dist/{chunk-saqzk45g.js → chunk-pdprhg5k.js} +1 -1
  109. package/dist/chunk-pjjrx9pk.js +2 -0
  110. package/dist/{chunk-7rep2jqh.js → chunk-pm4rpc4a.js} +23 -23
  111. package/dist/chunk-pt3rp3zg.js +2 -0
  112. package/dist/{chunk-4517hny7.js → chunk-q1mb0fbt.js} +2 -2
  113. package/dist/{chunk-k1ew643q.js → chunk-q74affc4.js} +2 -2
  114. package/dist/chunk-qd9v1v8z.js +2 -0
  115. package/dist/chunk-qfwk93fk.js +2 -0
  116. package/dist/chunk-qg1kw5yf.js +2 -0
  117. package/dist/chunk-qn6y5ttj.js +2 -0
  118. package/dist/chunk-qxcc0aar.js +2 -0
  119. package/dist/{chunk-rzd9hyhv.js → chunk-ram5944w.js} +2 -2
  120. package/dist/{chunk-p5m1z6e1.js → chunk-rcxer2km.js} +4 -4
  121. package/dist/chunk-rdxph1tp.js +2 -0
  122. package/dist/chunk-rnrdngnn.js +2 -0
  123. package/dist/{chunk-x2ftkaz3.js → chunk-rsxxajv6.js} +2 -2
  124. package/dist/chunk-rw5sxr5a.js +2 -0
  125. package/dist/chunk-rzcdwybt.js +26 -0
  126. package/dist/chunk-s29hp1qw.js +14 -0
  127. package/dist/chunk-s7xywsqd.js +3 -0
  128. package/dist/{chunk-d6gqh2wv.js → chunk-satrf398.js} +1 -1
  129. package/dist/{chunk-zn6n075d.js → chunk-shcnt6aa.js} +3 -3
  130. package/dist/{chunk-ysfgabpf.js → chunk-sn4ndpd7.js} +3 -3
  131. package/dist/{chunk-zc8a2erc.js → chunk-ssg6ne5b.js} +4 -4
  132. package/dist/{chunk-afxfkb60.js → chunk-sv7fdqmc.js} +6 -6
  133. package/dist/chunk-swz0xprw.js +2 -0
  134. package/dist/chunk-t8r40wgf.js +2 -0
  135. package/dist/{chunk-dbvsa5ya.js → chunk-t94y8g35.js} +2 -2
  136. package/dist/{chunk-df6vjs3p.js → chunk-t9hxyvvc.js} +5 -5
  137. package/dist/{chunk-cvbwxskc.js → chunk-tgzs1kbj.js} +5 -5
  138. package/dist/chunk-tka73egx.js +2 -0
  139. package/dist/{chunk-xtaq95em.js → chunk-v1s838fe.js} +1 -1
  140. package/dist/chunk-v3747589.js +12 -0
  141. package/dist/chunk-v9h2bbhf.js +2 -0
  142. package/dist/chunk-v9mxhch2.js +2 -0
  143. package/dist/chunk-vm42j29z.js +2 -0
  144. package/dist/chunk-w2kdhm7k.js +2 -0
  145. package/dist/chunk-w5zzwe2f.js +2 -0
  146. package/dist/chunk-wbmx0rge.js +2 -0
  147. package/dist/chunk-wjafpvjv.js +2 -0
  148. package/dist/chunk-ws2h92mm.js +3 -0
  149. package/dist/chunk-ws9kr80x.js +2 -0
  150. package/dist/{chunk-zgds9nwv.js → chunk-xf0xacc9.js} +44 -44
  151. package/dist/chunk-xhr35ctb.js +2 -0
  152. package/dist/chunk-xmmr0916.js +2 -0
  153. package/dist/{chunk-yxdhz4ps.js → chunk-xpbakn6t.js} +2 -2
  154. package/dist/chunk-xz4v9tg1.js +3 -0
  155. package/dist/chunk-y7e61pz3.js +3 -0
  156. package/dist/{chunk-v0tdg16k.js → chunk-ybjgnnyf.js} +5 -5
  157. package/dist/chunk-yh2hnt3m.js +12 -0
  158. package/dist/{chunk-w6pzkcjp.js → chunk-ymqm898x.js} +2 -2
  159. package/dist/{chunk-2zaatnnh.js → chunk-yp4tn4zn.js} +4 -4
  160. package/dist/chunk-z7k1xn6k.js +2 -0
  161. package/dist/{chunk-vnkvnenn.js → chunk-z9ffr9gy.js} +7 -7
  162. package/dist/{chunk-nnp6rf4c.js → chunk-zch65qrd.js} +1 -1
  163. package/dist/{chunk-pbakxcv8.js → chunk-zek9t5za.js} +2 -2
  164. package/dist/cli.js +23 -23
  165. package/dist/client/signals-dom-ready-runtime.js +6 -0
  166. package/dist/client/signals-mount-runtime.js +1 -1
  167. package/dist/client-module-registry.js +10 -4
  168. package/dist/client-parameter-bindings.d.ts +5 -0
  169. package/dist/client-parameter-bindings.js +47 -6
  170. package/dist/client-script-bundler.js +4 -3
  171. package/dist/component-library.d.ts +1 -0
  172. package/dist/component-library.js +42 -14
  173. package/dist/composable-loader.js +19 -9
  174. package/dist/craft-entry.js +2 -2
  175. package/dist/craft.js +2 -2
  176. package/dist/html-masking.d.ts +2 -0
  177. package/dist/html-masking.js +10 -0
  178. package/dist/inherited-context.d.ts +1 -1
  179. package/dist/inherited-context.js +43 -14
  180. package/dist/module-syntax.d.ts +2 -0
  181. package/dist/module-syntax.js +21 -0
  182. package/dist/native-component-context.js +42 -16
  183. package/dist/page-module-order.d.ts +10 -0
  184. package/dist/page-module-order.js +139 -0
  185. package/dist/process.js +6 -4
  186. package/dist/pwa.js +3 -3
  187. package/dist/script-attributes.d.ts +4 -0
  188. package/dist/script-attributes.js +10 -0
  189. package/dist/ssg.js +39 -39
  190. package/dist/strip-literals.d.ts +2 -0
  191. package/dist/strip-literals.js +12 -6
  192. package/dist/stx-virtual-ts.d.ts +1 -0
  193. package/dist/stx-virtual-ts.js +21 -27
  194. package/dist/typecheck.js +8 -0
  195. package/package.json +5 -5
  196. package/dist/chunk-027meh1k.js +0 -2
  197. package/dist/chunk-0hs633pt.js +0 -2
  198. package/dist/chunk-0j8zre1m.js +0 -2
  199. package/dist/chunk-0v02qms8.js +0 -2
  200. package/dist/chunk-0z9gttw0.js +0 -2
  201. package/dist/chunk-11dwmcpy.js +0 -3
  202. package/dist/chunk-1a237qky.js +0 -33
  203. package/dist/chunk-1ehjzhnc.js +0 -25
  204. package/dist/chunk-1gfg6qmr.js +0 -2
  205. package/dist/chunk-1kgnk6ds.js +0 -2
  206. package/dist/chunk-1ztp5vkh.js +0 -3
  207. package/dist/chunk-32wvc376.js +0 -2
  208. package/dist/chunk-3k2d2jsn.js +0 -2
  209. package/dist/chunk-3te2y9qf.js +0 -2
  210. package/dist/chunk-40330tm5.js +0 -2
  211. package/dist/chunk-447jc6zc.js +0 -2
  212. package/dist/chunk-4dk6k0ad.js +0 -2
  213. package/dist/chunk-4e48zkq0.js +0 -2
  214. package/dist/chunk-5ep7p8te.js +0 -2
  215. package/dist/chunk-5gx403te.js +0 -1184
  216. package/dist/chunk-6q9a5bph.js +0 -2
  217. package/dist/chunk-7ds9mx4c.js +0 -2
  218. package/dist/chunk-7njy024g.js +0 -2
  219. package/dist/chunk-7tjewwmd.js +0 -2
  220. package/dist/chunk-85xabvtj.js +0 -2
  221. package/dist/chunk-880f8j99.js +0 -2
  222. package/dist/chunk-8f3dbthj.js +0 -2
  223. package/dist/chunk-99e3mxnn.js +0 -20
  224. package/dist/chunk-9gv847nn.js +0 -2
  225. package/dist/chunk-9mz2n39m.js +0 -2
  226. package/dist/chunk-akthsg33.js +0 -54
  227. package/dist/chunk-b1tcym2x.js +0 -2
  228. package/dist/chunk-bdh73gxd.js +0 -4
  229. package/dist/chunk-bspj1rf1.js +0 -2
  230. package/dist/chunk-bx3hpsxn.js +0 -2
  231. package/dist/chunk-byq488g4.js +0 -2
  232. package/dist/chunk-c4s25bm2.js +0 -2
  233. package/dist/chunk-csjqtzwc.js +0 -2
  234. package/dist/chunk-df78j74w.js +0 -4
  235. package/dist/chunk-dgs3d367.js +0 -2
  236. package/dist/chunk-dmf6zcf4.js +0 -2
  237. package/dist/chunk-e2b2f502.js +0 -2
  238. package/dist/chunk-ec6mrad6.js +0 -2
  239. package/dist/chunk-eecctzgp.js +0 -17
  240. package/dist/chunk-fa57bncd.js +0 -2
  241. package/dist/chunk-g4eheg0t.js +0 -24
  242. package/dist/chunk-gfe1jrw9.js +0 -2
  243. package/dist/chunk-gn16yq49.js +0 -2
  244. package/dist/chunk-gvs61tqn.js +0 -2
  245. package/dist/chunk-h2928108.js +0 -2
  246. package/dist/chunk-hat353vx.js +0 -2
  247. package/dist/chunk-jmjgj3nh.js +0 -2
  248. package/dist/chunk-jqtpzzz4.js +0 -12
  249. package/dist/chunk-jvy7z3hz.js +0 -3
  250. package/dist/chunk-k9dne5by.js +0 -12
  251. package/dist/chunk-kq8mffgf.js +0 -2
  252. package/dist/chunk-kx06jzdw.js +0 -2
  253. package/dist/chunk-n5pvdrkb.js +0 -2
  254. package/dist/chunk-ne8q191s.js +0 -2
  255. package/dist/chunk-np8wgbsa.js +0 -3
  256. package/dist/chunk-nthw4dca.js +0 -2
  257. package/dist/chunk-pp99rmjm.js +0 -72
  258. package/dist/chunk-pqmjeea6.js +0 -2
  259. package/dist/chunk-qggwr60r.js +0 -2
  260. package/dist/chunk-qm3v4qb7.js +0 -2
  261. package/dist/chunk-qty0t69x.js +0 -2
  262. package/dist/chunk-rjv6885r.js +0 -2
  263. package/dist/chunk-rm5gbthk.js +0 -2
  264. package/dist/chunk-sgengtap.js +0 -2
  265. package/dist/chunk-snz2cxqv.js +0 -2
  266. package/dist/chunk-szp7ajfm.js +0 -33
  267. package/dist/chunk-ts37jw3s.js +0 -2
  268. package/dist/chunk-v4emesnw.js +0 -2
  269. package/dist/chunk-vnrbjbrw.js +0 -3
  270. package/dist/chunk-vxra53wq.js +0 -2
  271. package/dist/chunk-x76qvq1n.js +0 -2
  272. package/dist/chunk-x85z6dmw.js +0 -2
  273. package/dist/chunk-xkfe03y9.js +0 -2
  274. package/dist/chunk-y4hn1qh0.js +0 -2
  275. package/dist/chunk-yc8ggeh2.js +0 -2
  276. package/dist/chunk-yfed67yc.js +0 -2
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function zr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(zr(i,n,r+1,o))return!0}return!1}var C=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Tl=["onMount","onDestroy"];function ft(e="const",t=[],r){let o=t.length?C.filter((s)=>!t.includes(s)):C;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=C.filter((e)=>!y.includes(e));function Wi(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function $l(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Wi(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(zr(r[1],t))return!0;return!1}function Rl(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Al(e){return R.includes(e.toLowerCase())}var co=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_=["x-init","x-transition","x-effect","x-on"],Pl=[...co,..._];function Il(){return`{${co.map((e)=>`'${e}':1`).join(",")}}`}var qi=["class","style","text","html","show","model","if","ref"];function Ol(){return`{${qi.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function Nl(){return`/^(${p.join("|")})(?:\\.|$)/`}function Dl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=w;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
- export{zr,C,Tl,ft,Wi,$l,Rl,Al,co,Pl,Il,qi,Ol,Nl,Dl};
2
+ import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Kr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Kr(i,n,r+1,o))return!0}return!1}var E=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Ll=["onMount","onDestroy"];function wt(e="const",t=[],r){let o=t.length?E.filter((s)=>!t.includes(s)):E;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=E.filter((e)=>!y.includes(e));function Qi(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],T=/\s@[a-z][\w.:-]*\s*=/i;function jl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Qi(e))return!0;return R(e,t)}function R(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Kr(r[1],t))return!0;return!1}function Bl(e,t){if(!e)return!1;let r=f(e);return T.test(r)||d(r,t)}var _=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Fl(e){return _.includes(e.toLowerCase())}var ho=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],w=["x-init","x-transition","x-effect","x-on"],zl=[...ho,...w];function Hl(){return`{${ho.map((e)=>`'${e}':1`).join(",")}}`}var ea=["class","style","text","html","show","model","if","ref"];function Vl(){return`{${ea.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function Ul(){return`/^(${p.join("|")})(?:\\.|$)/`}function Wl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var A=65536,N=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=A;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=N){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
+ export{Kr,E,Ll,wt,Qi,jl,Bl,Fl,ho,zl,Hl,ea,Vl,Ul,Wl};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import o from"fs";import u from"path";var h={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"};function p(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];r=(r<<5)-r+n,r=r&r}return Math.abs(r).toString(16).padStart(8,"0")}function x(e,r){let t=u.basename(e);for(let n of r)if(n.startsWith("*.")){let i=n.slice(1);if(t.endsWith(i))return!0}else if(n.includes("*")){let i=new RegExp(`^${n.replace(/\*/g,".*")}$`);if(i.test(t)||i.test(e))return!0}else if(t===n||e.includes(n))return!0;return!1}function S(e,r,t){let n=u.extname(e).toLowerCase(),i=h[n],c=(t.maxFileSizeKB||500)*1024;if(r>c)return!1;if(t.exclude&&x(e,t.exclude))return!1;if(t.include&&t.include.length>0){for(let s of t.include)if(s.startsWith("*.")){if(e.endsWith(s.slice(1)))return!0}else if(e.includes(s))return!0}if(i&&t[i]===!0)return!0;if(!i)return!1;return!1}function f(e,r,t,n){let i=o.readdirSync(e,{withFileTypes:!0});for(let c of i){let s=u.join(e,c.name);if(c.isDirectory()){if(["node_modules",".git",".stx"].includes(c.name))continue;f(s,r,t,n)}else if(c.isFile()){let a=o.statSync(s),l=u.relative(r,s);if(S(l,a.size,t)){let d=o.readFileSync(s),g=p(d),m=`/${l.replace(/\\/g,"/")}`;n.push({url:m,revision:g,size:a.size})}}}}function Je(e,r){let t=r.pwa?.precache,n=[];if(!t?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!o.existsSync(e))return{entries:[],totalSize:0,fileCount:0};f(e,e,t,n),n.sort((c,s)=>c.url.localeCompare(s.url));let i=n.reduce((c,s)=>c+s.size,0);return{entries:n,totalSize:i,fileCount:n.length}}function Dn(e){if(e.entries.length===0)return"[]";return`[
2
+ import o from"fs";import u from"path";var h={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"};function p(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];r=(r<<5)-r+n,r=r&r}return Math.abs(r).toString(16).padStart(8,"0")}function x(e,r){let t=u.basename(e);for(let n of r)if(n.startsWith("*.")){let i=n.slice(1);if(t.endsWith(i))return!0}else if(n.includes("*")){let i=new RegExp(`^${n.replace(/\*/g,".*")}$`);if(i.test(t)||i.test(e))return!0}else if(t===n||e.includes(n))return!0;return!1}function S(e,r,t){let n=u.extname(e).toLowerCase(),i=h[n],c=(t.maxFileSizeKB||500)*1024;if(r>c)return!1;if(t.exclude&&x(e,t.exclude))return!1;if(t.include&&t.include.length>0){for(let s of t.include)if(s.startsWith("*.")){if(e.endsWith(s.slice(1)))return!0}else if(e.includes(s))return!0}if(i&&t[i]===!0)return!0;if(!i)return!1;return!1}function f(e,r,t,n){let i=o.readdirSync(e,{withFileTypes:!0});for(let c of i){let s=u.join(e,c.name);if(c.isDirectory()){if(["node_modules",".git",".stx"].includes(c.name))continue;f(s,r,t,n)}else if(c.isFile()){let a=o.statSync(s),l=u.relative(r,s);if(S(l,a.size,t)){let d=o.readFileSync(s),g=p(d),m=`/${l.replace(/\\/g,"/")}`;n.push({url:m,revision:g,size:a.size})}}}}function tt(e,r){let t=r.pwa?.precache,n=[];if(!t?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!o.existsSync(e))return{entries:[],totalSize:0,fileCount:0};f(e,e,t,n),n.sort((c,s)=>c.url.localeCompare(s.url));let i=n.reduce((c,s)=>c+s.size,0);return{entries:n,totalSize:i,fileCount:n.length}}function Fn(e){if(e.entries.length===0)return"[]";return`[
3
3
  ${e.entries.map((t)=>` { url: '${t.url}', revision: '${t.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function Gi(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;return`${(e/1048576).toFixed(2)} MB`}
6
- export{Je,Dn,Gi};
5
+ ]`}function na(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;return`${(e/1048576).toFixed(2)} MB`}
6
+ export{tt,Fn,na};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ce,le,ue,Kn,_e,Be,as,yu,Et,cn,Gn,Xn,Jn,de,Yn,Zn,cs}from"./chunk-q74affc4.js";import"./chunk-kee5a3ce.js";export{le as DEFAULT_FORMATS,ue as DEFAULT_QUALITY,ce as DEFAULT_WIDTHS,cs as ImageProcessingError,Zn as formatSize,cn as generateSizes,Et as generateSrcSet,Gn as getFallbackVariant,as as getImageMetadata,de as getMimeType,Yn as getTotalSize,Xn as groupVariantsByFormat,_e as isImageBackendAvailable,Jn as isImageFile,Kn as isSharpAvailable,Be as processImage,yu as resizeAndConvert};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{aa,ca,la,dm,ua,da,pm,pa,fa,Yl,fm}from"./chunk-shcnt6aa.js";export{aa as VideoProcessorCache,Yl as analyzeVideo,dm as clearVideoCache,fa as generateDASHManifest,pa as generateHLSManifest,ua as generatePoster,pm as generateSpriteSheet,da as generateThumbnails,ca as getCachedVideoResult,fm as processVideo,la as setCachedVideoResult};
@@ -1,21 +1,21 @@
1
1
  // @bun
2
- import{ft,Rl}from"./chunk-fdjx4vs3.js";import{N}from"./chunk-3w7gacva.js";import{K,Fs,o,pe,J,w,Kc,zt,_n,Ue,We}from"./chunk-5gx403te.js";import{hr}from"./chunk-w8k9fz1w.js";import{V}from"./chunk-bjjfr7qt.js";import{hn}from"./chunk-xtaq95em.js";var G=`(?:"[^"]*"|'[^']*'|[^>"'])*`,X=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,H=65536,Q=4,O=new Map;function ty(){O.clear()}function q(e){let c=[];for(let t of w(e,J)){let n=t.token.match(/^<script\b([^>]*)>/i),s=t.token.match(/<\/script\s*>$/i);if(!n||!s)continue;let a=n[0].length,f=t.token.length-s[0].length;c.push(Object.freeze({fullMatch:t.token,attrs:n[1],body:t.token.slice(a,f),start:t.start,end:t.end}))}return c}function xs(e,c={}){let t=e.length>=H,n=t?O.get(e):void 0;if(n===void 0){if(n=q(e),t)Kc(O,Q),O.set(e,n)}let s=c.skipAttrs;if(!s)return n.slice();let a=[];for(let f of n)if(s.lastIndex=0,!s.test(f.attrs))a.push(f);return a}function ti(e){let c=e.trim(),t=c.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(t){let s=t[1].trim(),a=t[2].trim(),{itemVar:f,indexVar:i}=z(a);if(f)return{style:"as",iterable:s,itemVar:f,indexVar:i}}let n=c.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(n){let s=n[1].trim(),a=n[2].trim(),{itemVar:f,indexVar:i}=z(s);if(f)return{style:"in",iterable:a,itemVar:f,indexVar:i}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function z(e){let c=e.trim(),t=c.match(/^(\w+)\s*=>\s*(\w+)$/);if(t)return{itemVar:t[2],indexVar:t[1]};let n=c.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(n)return{itemVar:n[1],indexVar:n[2]||null};let s=c.match(/^(\w+)\s*,\s*(\w+)$/);if(s)return{itemVar:s[1],indexVar:s[2]};let a=c.match(/^(\w+)$/);if(a)return{itemVar:a[1],indexVar:null};return{itemVar:null,indexVar:null}}function Ss(e,c){return Rl(e,c)}function Y(e){let c=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,t=0,n;while((n=c.exec(e))!==null){let s=n[1];if(s.startsWith("if"))t++;else if(s==="endif")t--;else if(t===0)return!0}return!1}function gr(e){let c=new Set,t=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,n=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,s;while((s=t.exec(e))!==null){let a=s[1],f;while((f=n.exec(a))!==null)c.add(f[1])}return c}function ee(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let c=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${G})>`,"iy"),t=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,n=w(e,(a,f)=>{c.lastIndex=f;let i=c.exec(a);if(!i||i.index!==f||!t.test(i[2]))return-1;return c.lastIndex}),s=[];for(let a of n){c.lastIndex=0;let f=c.exec(a.token);if(!f)continue;let i=f[2].match(t),p=ti(i?.[1]??i?.[2]??""),m=[p.itemVar,p.indexVar].filter(Boolean);if(m.length===0)continue;let r=f[1],g=/\/\s*>$/.test(a.token)||P.has(r.toLowerCase())?a.end:D(e,a.start,r,a.end);if(g!==-1)s.push({start:a.start,end:g,vars:new Set(m)})}return s}var W=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function te(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function B(e,c,t,n){if(!e)return!1;let s=te(e),a=!1,f=!1,i=!1,p=/([a-zA-Z_$][\w$]*)/g,m;while((m=p.exec(s))!==null){let u=m[1];if(s.slice(0,m.index).trimEnd().endsWith("."))continue;if(W.has(u))continue;if(c.has(u)||n?.has(u))a=!0;else if(t&&u in t)f=!0}let r=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,l;while((l=r.exec(s))!==null){let u=l[1];if(s.slice(0,l.index).trimEnd().endsWith("."))continue;if(W.has(u)||t&&u in t)continue;i=!0}return(a||i)&&!f}function M(e,c,t){let n=t===void 0?` ${c}`:` ${c}="${t.replace(/"/g,"&quot;")}"`,s=e.trim(),a=s.match(X);if(a&&!ne(a[1])&&se(a[3],a[1])){let[,f,i,p]=a;return`<${f}${i}${n}>${p}</${f}>`}return`<template${n}>${s}</template>`}function ne(e){return/^[A-Z]/.test(e)}function se(e,c){let t=new RegExp(`<(/)?${c}(?=[\\s/>])`,"gi"),n=0,s;while((s=t.exec(e))!==null)if(s[1]){if(n--,n<0)return!1}else n++;return!0}function ni(e,c){let t=gr(e);function n(s){let a=s,f=ee(s),i=(l)=>{let g=new Set;for(let u of f)if(l>u.start&&l<u.end)for(let d of u.vars)g.add(d);return g},p=/@if\s*\(/g,m,r=[];while((m=p.exec(a))!==null){let l=m.index,g=l+m[0].length,u=1,d=g;while(d<a.length&&u>0){if(a[d]==="(")u++;else if(a[d]===")")u--;d++}if(u!==0)continue;let b=a.substring(g,d-1).trim(),S=d,E=1,y=S,x=/@(if\s*\(|endif)/g;x.lastIndex=S;let h;while((h=x.exec(a))!==null)if(h[1].startsWith("if"))E++;else if(h[1]==="endif"){if(E--,E===0){y=h.index+h[0].length;break}}if(E!==0)continue;let R=a.substring(S,y-6).trim(),A;if(Y(R)){let C=hn(a.substring(l,y));if(C.length===0)continue;let T=C[0].branches.filter((_)=>_.type!=="else"),k=i(l);if(!(T.length>0&&T.every((_)=>B(_.condition,t,c,k))))continue;A=C[0].branches.map((_)=>{let L=n(_.content);if(_.type==="elseif")return M(L,"@else-if",_.condition??"");if(_.type==="else")return M(L,"@else");return M(L,"@if",_.condition??"")}).join(`
3
- `)}else{if(!B(b,t,c,i(l)))continue;A=M(n(R),"@if",b)}r.push({start:l,end:y,replacement:A}),p.lastIndex=y}for(let l=r.length-1;l>=0;l--){let{start:g,end:u,replacement:d}=r[l];a=a.substring(0,g)+d+a.substring(u)}return a}return n(e)}function re(e){let c=e.trim();if(c==="")return;if(c==="true")return!0;if(c==="false")return!1;if(c==="null")return!1;if(c==="undefined")return!1;if(c==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(c)){let s=Number(c);return s!==0&&!Number.isNaN(s)}let t=c.match(/^'((?:\\.|[^'\\])*)'$/);if(t)return t[1].length>0;let n=c.match(/^"((?:\\.|[^"\\])*)"$/);if(n)return n[1].length>0;return}var P=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Z=/<(script|style)\b/iy,ie=/<\/script/gi,oe=/<\/style/gi;function D(e,c,t,n){if(P.has(t.toLowerCase()))return n;let s=t.toLowerCase(),a=e.length,f=1,i=n;while(i<a){let p=e.indexOf("<",i);if(p===-1)return-1;if(i=p,e.startsWith("<!--",i)){let g=e.indexOf("-->",i+4);if(g===-1)return-1;i=g+3;continue}Z.lastIndex=i;let m=Z.exec(e);if(m){let g=e.indexOf(">",i);if(g===-1)return-1;if(e[g-1]==="/"){i=g+1;continue}let u=m[1].toLowerCase()==="script"?ie:oe;u.lastIndex=i;let d=u.exec(e);if(d===null)return-1;let b=e.indexOf(">",d.index);if(b===-1)return-1;i=b+1;continue}if(e[i+1]==="/"){let g=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(i,i+64));if(!g){i++;continue}if(g[1].toLowerCase()===s){if(f--,i+=g[0].length,f===0)return i;continue}i+=g[0].length;continue}let r=/^<([a-z][\w-]*)\b/i.exec(e.slice(i,i+64));if(!r){i++;continue}let l=e.indexOf(">",i);if(l===-1)return-1;if(r[1].toLowerCase()===s){let g=e.slice(i,l+1);if(!(/\/\s*>$/.test(g)||P.has(s)))f++}i=l+1}return-1}var ce=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ae(e,c){let t=c,n=e.length;for(;;){while(t<n&&e[t]!=="<")t++;if(t>=n)return!1;if(e.startsWith("<!--",t)){let f=e.indexOf("-->",t+4);if(f===-1)return!1;t=f+3;continue}break}if(e[t+1]==="/")return!1;let s=e.indexOf(">",t);if(s===-1)return!1;let a=e.slice(t,s+1);return ce.test(a)}function ri(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let c=[],t=/<([a-zA-Z][\w-]*)/y,n=/\s/,s=new Set([":if",":show","x-if","x-show","@if","@show"]);w(e,(r,l)=>{t.lastIndex=l;let g=t.exec(r);if(!g||/^(?:script|style)$/i.test(g[1]))return-1;let u=t.lastIndex,d;while(u<r.length){let b=u;while(u<r.length&&n.test(r[u]))u++;let S=u;if(r[S]==="/"){S++;while(S<r.length&&n.test(r[S]))S++}if(r[S]===">"){if(d)c.push({start:l,end:S+1,tag:g[1],...d});return-1}if(u===b)return-1;let E=u;while(u<r.length&&!n.test(r[u])&&r[u]!=="="&&r[u]!==">")u++;if(u===E)return-1;let y=r.slice(E,u);if(y.startsWith("@")&&y.includes("("))return-1;let x=u,h=u;while(h<r.length&&n.test(r[h]))h++;if(r[h]!=="="){u=x;continue}h++;while(h<r.length&&n.test(r[h]))h++;let R=r[h];if(R==='"'||R==="'"){let A=r.indexOf(R,h+1);if(A===-1)return-1;if(!d&&R==='"'&&s.has(y))d={attrName:y,attrStart:b,attrEnd:A+1,value:r.slice(h+1,A)};u=A+1}else{u=h;while(u<r.length&&!n.test(r[u])&&r[u]!==">")u++}}return-1});let a=[],f=-1;for(let r of c){let{start:l,end:g,tag:u,attrName:d,value:b}=r;if(l<f)continue;let S=re(b);if(S===void 0)continue;let x=/\/\s*>$/.test(e.slice(l,g))||P.has(u.toLowerCase())?g:D(e,l,u,g);if(x===-1)continue;if((d===":if"||d==="x-if"||d==="@if")&&ae(e,x))continue;if(S===!0){let R=e.slice(l,r.attrStart)+e.slice(r.attrEnd,g);a.push({start:l,end:g,replacement:R});continue}a.push({start:l,end:x,replacement:""}),f=x}if(a.length===0)return e;a.sort((r,l)=>r.start-l.start);let i=[],p=-1;for(let r of a){if(r.start<p)continue;i.push(r),p=r.end}let m=e;for(let r=i.length-1;r>=0;r--){let{start:l,end:g,replacement:u}=i[r];m=m.substring(0,l)+u+m.substring(g)}return m}var F=[":for","@for","x-for"];function tg(e){let c=/(\s)((?::|@|x-|v-)[\w.:-]+)\s*=\s*"([^"]*\{\{[^"]*)"/g;return e.replace(c,(t,n,s,a)=>{let f=a.replace(/'((?:[^'\\]|\\.)*)'/g,(i,p)=>{if(!p.includes("{{"))return i;return`\`${p.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{\s*([^}]+?)\s*\}\}/g,(r,l)=>`\${${l}}`)}\``});return`${n}${s}="${f}"`})}function ks(e,c){if(!c||Object.keys(c).length===0)return e;if(!F.some((i)=>e.includes(`${i}=`)))return e;let t=gr(e);if(Array.isArray(c.__stx_client_signal_names)){for(let i of c.__stx_client_signal_names)if(typeof i==="string")t.add(i)}let n=e,s=[],a=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,f;while((f=a.exec(n))!==null){let[i,p,m]=f,r=f.index,l=r+i.length,g=F.map((A)=>({attr:A,m:new RegExp(`\\s${A}="([^"]*)"`).exec(m)})).find((A)=>A.m!==null);if(!g||!g.m)continue;let u=ti(g.m[1]);if(!u.iterable||!u.itemVar)continue;let d=u.iterable.trim().split(/[.[(]/)[0].trim();if(!d||t.has(d)||!(d in c))continue;let b=D(n,r,p,l);if(b===-1)continue;let S=m.replace(new RegExp(`\\s${g.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),E=n.slice(l,b-`</${p}>`.length),y={...c,[u.itemVar]:void 0};if(u.indexVar)y[u.indexVar]=void 0;let x=ks(E,y),h=u.indexVar?`${u.iterable} as ${u.indexVar} => ${u.itemVar}`:`${u.iterable} as ${u.itemVar}`,R=p.toLowerCase()==="template"?x:`<${p}${S}>${x}</${p}>`;s.push({start:r,end:b,replacement:`@foreach(${h})${R}@endforeach`}),a.lastIndex=b}for(let i=s.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=s[i];n=n.slice(0,p)+r+n.slice(m)}return n}function _s(e,c){let t=e,n=/@(for|foreach)\s*\(/g,s,a=[],f=[];while((s=n.exec(t))!==null){let i=s[1],p=s.index,m=p+s[0].length,r=1,l=m;while(l<t.length&&r>0){if(t[l]==="(")r++;else if(t[l]===")")r--;l++}if(r!==0)continue;let g=t.substring(m,l-1).trim(),u=l,d=ti(g),b=i==="for"?"@endfor":"@endforeach",S=1,E=u,y=i==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${i}\\s*\\(|end${i})`,"g");y.lastIndex=u;let x;while((x=y.exec(t))!==null)if(x[1].startsWith(i))S++;else if(S--,S===0){E=x.index+x[0].length;break}if(S!==0)continue;let h=()=>{let v=[d.itemVar,d.indexVar].filter(Boolean);if(v.length)f.push({start:p,end:E,vars:v})};if(d.iterable){let v=d.iterable.trim();if(v.startsWith("[")||v.startsWith("{")||v.startsWith("'")||v.startsWith('"')||v.startsWith("`")||/^-?\d/.test(v)){h();continue}let I=v.split(/[.[(]/)[0].trim(),_=c?I in c:!1,L=f.some((j)=>p>j.start&&p<j.end&&j.vars.includes(I));if(I&&(_||L)){h();continue}}if(d.style==="as")g=d.indexVar?`(${d.itemVar}, ${d.indexVar}) in ${d.iterable}`:`${d.itemVar} in ${d.iterable}`;let R=t.substring(u,E-b.length).trim(),A=c?{...c}:{};if(d.itemVar)delete A[d.itemVar];if(d.indexVar)delete A[d.indexVar];let C=tg(_s(R,A)),T=C.match(X),k;if(T){let[,v,I,_]=T;k=`<${v}${I} @for="${g}">${_}</${v}>`}else k=`<template @for="${g}">${C}</template>`;a.push({start:p,end:E,replacement:k}),n.lastIndex=E}for(let i=a.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=a[i];t=t.substring(0,p)+r+t.substring(m)}return t}function le(e){let c=new Set,t=[],n=0,s=0,a=e.length,f=(r)=>{let l=n+1;while(l<a){let g=e[l];if(g==="\\"){l+=2;continue}if(g===r)return l+1;l++}return a},i=()=>{let r=n+2;while(r<a&&e[r]!==`
2
+ import{wt,Bl}from"./chunk-00tq7ghn.js";import{M}from"./chunk-hxhmhw23.js";import{G,qs,o,ge,Q,w,tl,Kt,Rn,Ge,Xe}from"./chunk-p55a910x.js";import{xr}from"./chunk-hmntqqyd.js";import{U}from"./chunk-care745q.js";import{Sn}from"./chunk-v1s838fe.js";var X=`(?:"[^"]*"|'[^']*'|[^>"'])*`,H=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,q=65536,J=4,N=new Map;function uy(){N.clear()}function K(e){let c=[];for(let t of w(e,Q)){let n=t.token.match(/^<script\b([^>]*)>/i),s=t.token.match(/<\/script\s*>$/i);if(!n||!s)continue;let a=n[0].length,f=t.token.length-s[0].length;c.push(Object.freeze({fullMatch:t.token,attrs:n[1],body:t.token.slice(a,f),start:t.start,end:t.end}))}return c}function Ts(e,c={}){let t=e.length>=q,n=t?N.get(e):void 0;if(n===void 0){if(n=K(e),t)tl(N,J),N.set(e,n)}let s=c.skipAttrs;if(!s)return n.slice();let a=[];for(let f of n)if(s.lastIndex=0,!s.test(f.attrs))a.push(f);return a}function ci(e){let c=e.trim(),t=c.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(t){let s=t[1].trim(),a=t[2].trim(),{itemVar:f,indexVar:i}=D(a);if(f)return{style:"as",iterable:s,itemVar:f,indexVar:i}}let n=c.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(n){let s=n[1].trim(),a=n[2].trim(),{itemVar:f,indexVar:i}=D(s);if(f)return{style:"in",iterable:a,itemVar:f,indexVar:i}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function D(e){let c=e.trim(),t=c.match(/^(\w+)\s*=>\s*(\w+)$/);if(t)return{itemVar:t[2],indexVar:t[1]};let n=c.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(n)return{itemVar:n[1],indexVar:n[2]||null};let s=c.match(/^(\w+)\s*,\s*(\w+)$/);if(s)return{itemVar:s[1],indexVar:s[2]};let a=c.match(/^(\w+)$/);if(a)return{itemVar:a[1],indexVar:null};return{itemVar:null,indexVar:null}}function $s(e,c){return Bl(e,c)}function Y(e){let c=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,t=0,n;while((n=c.exec(e))!==null){let s=n[1];if(s.startsWith("if"))t++;else if(s==="endif")t--;else if(t===0)return!0}return!1}function wr(e){let c=new Set,t=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,n=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,s;while((s=t.exec(e))!==null){let a=s[1],f;while((f=n.exec(a))!==null)c.add(f[1])}return c}function ee(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let c=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${X})>`,"iy"),t=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,n=w(e,(a,f)=>{c.lastIndex=f;let i=c.exec(a);if(!i||i.index!==f||!t.test(i[2]))return-1;return c.lastIndex}),s=[];for(let a of n){c.lastIndex=0;let f=c.exec(a.token);if(!f)continue;let i=f[2].match(t),p=ci(i?.[1]??i?.[2]??""),m=[p.itemVar,p.indexVar].filter(Boolean);if(m.length===0)continue;let r=f[1],g=/\/\s*>$/.test(a.token)||O.has(r.toLowerCase())?a.end:j(e,a.start,r,a.end);if(g!==-1)s.push({start:a.start,end:g,vars:new Set(m)})}return s}var z=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function te(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function W(e,c,t,n){if(!e)return!1;let s=te(e),a=!1,f=!1,i=!1,p=/([a-zA-Z_$][\w$]*)/g,m;while((m=p.exec(s))!==null){let u=m[1];if(s.slice(0,m.index).trimEnd().endsWith("."))continue;if(z.has(u))continue;if(c.has(u)||n?.has(u))a=!0;else if(t&&u in t)f=!0}let r=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,l;while((l=r.exec(s))!==null){let u=l[1];if(s.slice(0,l.index).trimEnd().endsWith("."))continue;if(z.has(u)||t&&u in t)continue;i=!0}return(a||i)&&!f}function L(e,c,t){let n=t===void 0?` ${c}`:` ${c}="${t.replace(/"/g,"&quot;")}"`,s=e.trim(),a=s.match(H);if(a&&!ne(a[1])&&se(a[3],a[1])){let[,f,i,p]=a;return`<${f}${i}${n}>${p}</${f}>`}return`<template${n}>${s}</template>`}function ne(e){return/^[A-Z]/.test(e)}function se(e,c){let t=new RegExp(`<(/)?${c}(?=[\\s/>])`,"gi"),n=0,s;while((s=t.exec(e))!==null)if(s[1]){if(n--,n<0)return!1}else n++;return!0}function li(e,c){let t=wr(e);function n(s){let a=s,f=ee(s),i=(l)=>{let g=new Set;for(let u of f)if(l>u.start&&l<u.end)for(let d of u.vars)g.add(d);return g},p=/@if\s*\(/g,m,r=[];while((m=p.exec(a))!==null){let l=m.index,g=l+m[0].length,u=1,d=g;while(d<a.length&&u>0){if(a[d]==="(")u++;else if(a[d]===")")u--;d++}if(u!==0)continue;let b=a.substring(g,d-1).trim(),S=d,E=1,y=S,x=/@(if\s*\(|endif)/g;x.lastIndex=S;let h;while((h=x.exec(a))!==null)if(h[1].startsWith("if"))E++;else if(h[1]==="endif"){if(E--,E===0){y=h.index+h[0].length;break}}if(E!==0)continue;let R=a.substring(S,y-6).trim(),A;if(Y(R)){let C=Sn(a.substring(l,y));if(C.length===0)continue;let T=C[0].branches.filter((_)=>_.type!=="else"),k=i(l);if(!(T.length>0&&T.every((_)=>W(_.condition,t,c,k))))continue;A=C[0].branches.map((_)=>{let V=n(_.content);if(_.type==="elseif")return L(V,"@else-if",_.condition??"");if(_.type==="else")return L(V,"@else");return L(V,"@if",_.condition??"")}).join(`
3
+ `)}else{if(!W(b,t,c,i(l)))continue;A=L(n(R),"@if",b)}r.push({start:l,end:y,replacement:A}),p.lastIndex=y}for(let l=r.length-1;l>=0;l--){let{start:g,end:u,replacement:d}=r[l];a=a.substring(0,g)+d+a.substring(u)}return a}return n(e)}function re(e){let c=e.trim();if(c==="")return;if(c==="true")return!0;if(c==="false")return!1;if(c==="null")return!1;if(c==="undefined")return!1;if(c==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(c)){let s=Number(c);return s!==0&&!Number.isNaN(s)}let t=c.match(/^'((?:\\.|[^'\\])*)'$/);if(t)return t[1].length>0;let n=c.match(/^"((?:\\.|[^"\\])*)"$/);if(n)return n[1].length>0;return}var O=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),B=/<(script|style)\b/iy,ie=/<\/script/gi,oe=/<\/style/gi;function j(e,c,t,n){if(O.has(t.toLowerCase()))return n;let s=t.toLowerCase(),a=e.length,f=1,i=n;while(i<a){let p=e.indexOf("<",i);if(p===-1)return-1;if(i=p,e.startsWith("<!--",i)){let g=e.indexOf("-->",i+4);if(g===-1)return-1;i=g+3;continue}B.lastIndex=i;let m=B.exec(e);if(m){let g=e.indexOf(">",i);if(g===-1)return-1;if(e[g-1]==="/"){i=g+1;continue}let u=m[1].toLowerCase()==="script"?ie:oe;u.lastIndex=i;let d=u.exec(e);if(d===null)return-1;let b=e.indexOf(">",d.index);if(b===-1)return-1;i=b+1;continue}if(e[i+1]==="/"){let g=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(i,i+64));if(!g){i++;continue}if(g[1].toLowerCase()===s){if(f--,i+=g[0].length,f===0)return i;continue}i+=g[0].length;continue}let r=/^<([a-z][\w-]*)\b/i.exec(e.slice(i,i+64));if(!r){i++;continue}let l=e.indexOf(">",i);if(l===-1)return-1;if(r[1].toLowerCase()===s){let g=e.slice(i,l+1);if(!(/\/\s*>$/.test(g)||O.has(s)))f++}i=l+1}return-1}var ce=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ae(e,c){let t=c,n=e.length;for(;;){while(t<n&&e[t]!=="<")t++;if(t>=n)return!1;if(e.startsWith("<!--",t)){let f=e.indexOf("-->",t+4);if(f===-1)return!1;t=f+3;continue}break}if(e[t+1]==="/")return!1;let s=e.indexOf(">",t);if(s===-1)return!1;let a=e.slice(t,s+1);return ce.test(a)}function ui(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let c=[],t=/<([a-zA-Z][\w-]*)/y,n=/\s/,s=new Set([":if",":show","x-if","x-show","@if","@show"]);w(e,(r,l)=>{t.lastIndex=l;let g=t.exec(r);if(!g||/^(?:script|style)$/i.test(g[1]))return-1;let u=t.lastIndex,d;while(u<r.length){let b=u;while(u<r.length&&n.test(r[u]))u++;let S=u;if(r[S]==="/"){S++;while(S<r.length&&n.test(r[S]))S++}if(r[S]===">"){if(d)c.push({start:l,end:S+1,tag:g[1],...d});return-1}if(u===b)return-1;let E=u;while(u<r.length&&!n.test(r[u])&&r[u]!=="="&&r[u]!==">")u++;if(u===E)return-1;let y=r.slice(E,u);if(y.startsWith("@")&&y.includes("("))return-1;let x=u,h=u;while(h<r.length&&n.test(r[h]))h++;if(r[h]!=="="){u=x;continue}h++;while(h<r.length&&n.test(r[h]))h++;let R=r[h];if(R==='"'||R==="'"){let A=r.indexOf(R,h+1);if(A===-1)return-1;if(!d&&R==='"'&&s.has(y))d={attrName:y,attrStart:b,attrEnd:A+1,value:r.slice(h+1,A)};u=A+1}else{u=h;while(u<r.length&&!n.test(r[u])&&r[u]!==">")u++}}return-1});let a=[],f=-1;for(let r of c){let{start:l,end:g,tag:u,attrName:d,value:b}=r;if(l<f)continue;let S=re(b);if(S===void 0)continue;let x=/\/\s*>$/.test(e.slice(l,g))||O.has(u.toLowerCase())?g:j(e,l,u,g);if(x===-1)continue;if((d===":if"||d==="x-if"||d==="@if")&&ae(e,x))continue;if(S===!0){let R=e.slice(l,r.attrStart)+e.slice(r.attrEnd,g);a.push({start:l,end:g,replacement:R});continue}a.push({start:l,end:x,replacement:""}),f=x}if(a.length===0)return e;a.sort((r,l)=>r.start-l.start);let i=[],p=-1;for(let r of a){if(r.start<p)continue;i.push(r),p=r.end}let m=e;for(let r=i.length-1;r>=0;r--){let{start:l,end:g,replacement:u}=i[r];m=m.substring(0,l)+u+m.substring(g)}return m}var Z=[":for","@for","x-for"];function dg(e){let c=/(\s)((?::|@|x-|v-)[\w.:-]+)\s*=\s*"([^"]*\{\{[^"]*)"/g;return e.replace(c,(t,n,s,a)=>{let f=a.replace(/'((?:[^'\\]|\\.)*)'/g,(i,p)=>{if(!p.includes("{{"))return i;return`\`${p.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{\s*([^}]+?)\s*\}\}/g,(r,l)=>`\${${l}}`)}\``});return`${n}${s}="${f}"`})}function Rs(e,c){if(!c||Object.keys(c).length===0)return e;if(!Z.some((i)=>e.includes(`${i}=`)))return e;let t=wr(e);if(Array.isArray(c.__stx_client_signal_names)){for(let i of c.__stx_client_signal_names)if(typeof i==="string")t.add(i)}let n=e,s=[],a=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,f;while((f=a.exec(n))!==null){let[i,p,m]=f,r=f.index,l=r+i.length,g=Z.map((A)=>({attr:A,m:new RegExp(`\\s${A}="([^"]*)"`).exec(m)})).find((A)=>A.m!==null);if(!g||!g.m)continue;let u=ci(g.m[1]);if(!u.iterable||!u.itemVar)continue;let d=u.iterable.trim().split(/[.[(]/)[0].trim();if(!d||t.has(d)||!(d in c))continue;let b=j(n,r,p,l);if(b===-1)continue;let S=m.replace(new RegExp(`\\s${g.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),E=n.slice(l,b-`</${p}>`.length),y={...c,[u.itemVar]:void 0};if(u.indexVar)y[u.indexVar]=void 0;let x=Rs(E,y),h=u.indexVar?`${u.iterable} as ${u.indexVar} => ${u.itemVar}`:`${u.iterable} as ${u.itemVar}`,R=p.toLowerCase()==="template"?x:`<${p}${S}>${x}</${p}>`;s.push({start:r,end:b,replacement:`@foreach(${h})${R}@endforeach`}),a.lastIndex=b}for(let i=s.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=s[i];n=n.slice(0,p)+r+n.slice(m)}return n}function As(e,c){let t=e,n=/@(for|foreach)\s*\(/g,s,a=[],f=[];while((s=n.exec(t))!==null){let i=s[1],p=s.index,m=p+s[0].length,r=1,l=m;while(l<t.length&&r>0){if(t[l]==="(")r++;else if(t[l]===")")r--;l++}if(r!==0)continue;let g=t.substring(m,l-1).trim(),u=l,d=ci(g),b=i==="for"?"@endfor":"@endforeach",S=1,E=u,y=i==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${i}\\s*\\(|end${i})`,"g");y.lastIndex=u;let x;while((x=y.exec(t))!==null)if(x[1].startsWith(i))S++;else if(S--,S===0){E=x.index+x[0].length;break}if(S!==0)continue;let h=()=>{let v=[d.itemVar,d.indexVar].filter(Boolean);if(v.length)f.push({start:p,end:E,vars:v})};if(d.iterable){let v=d.iterable.trim();if(v.startsWith("[")||v.startsWith("{")||v.startsWith("'")||v.startsWith('"')||v.startsWith("`")||/^-?\d/.test(v)){h();continue}let I=v.split(/[.[(]/)[0].trim(),_=c?I in c:!1,V=f.some((P)=>p>P.start&&p<P.end&&P.vars.includes(I));if(I&&(_||V)){h();continue}}if(d.style==="as")g=d.indexVar?`(${d.itemVar}, ${d.indexVar}) in ${d.iterable}`:`${d.itemVar} in ${d.iterable}`;let R=t.substring(u,E-b.length).trim(),A=c?{...c}:{};if(d.itemVar)delete A[d.itemVar];if(d.indexVar)delete A[d.indexVar];let C=dg(As(R,A)),T=C.match(H),k;if(T){let[,v,I,_]=T;k=`<${v}${I} @for="${g}">${_}</${v}>`}else k=`<template @for="${g}">${C}</template>`;a.push({start:p,end:E,replacement:k}),n.lastIndex=E}for(let i=a.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=a[i];t=t.substring(0,p)+r+t.substring(m)}return t}function le(e){let c=new Set,t=[],n=0,s=0,a=e.length,f=(r)=>{let l=n+1;while(l<a){let g=e[l];if(g==="\\"){l+=2;continue}if(g===r)return l+1;l++}return a},i=()=>{let r=n+2;while(r<a&&e[r]!==`
4
4
  `)r++;return r},p=()=>{let r=n+2;while(r<a-1){if(e[r]==="*"&&e[r+1]==="/")return r+2;r++}return a},m=(r)=>{let l=r,g=0;while(l<a){let u=e[l];if(u==="/"&&e[l+1]==="/"){let d=l+2;while(d<a&&e[d]!==`
5
- `)d++;l=d;continue}if(u==="/"&&e[l+1]==="*"){let d=l+2;while(d<a-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;l=d+2;continue}if(u==='"'||u==="'"||u==="`"){let d=l+1;while(d<a){if(e[d]==="\\"){d+=2;continue}if(e[d]===u){d++;break}d++}l=d;continue}if(u==="("||u==="["||u==="{"){g++,l++;continue}if(u===")"||u==="]"||u==="}"){g--,l++;continue}if(u===";"&&g===0)return l+1;l++}return a};while(n<a){let r=e[n];if(r==="/"&&e[n+1]==="/"){let l=i();t.push(e.slice(n,l)),n=l;continue}if(r==="/"&&e[n+1]==="*"){let l=p();t.push(e.slice(n,l)),n=l;continue}if(r==='"'||r==="'"||r==="`"){let l=f(r);t.push(e.slice(n,l)),n=l;continue}if(r==="{"){s++,t.push(r),n++;continue}if(r==="}"){s--,t.push(r),n++;continue}if(s===0){let l=n>0?e[n-1]:"";if(l===""||/\s/.test(l)||l===";"||l==="}"||l==="{"){let u=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(u){let d=u[2],b=m(n+u[0].length);if(c.has(d)){t.push(`/* stx: deduped const ${d} */`),n=b;continue}c.add(d),t.push(e.slice(n,b)),n=b;continue}}}t.push(r),n++}return t.join("")}var ue=new Set(["script","style","html","head","meta","link","title","!doctype"]);function fe(e){let c=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${G})>`,"iy"),t=null,n=null;return w(e,(s,a)=>{c.lastIndex=a;let f=c.exec(s);if(!f)return-1;let i=f[1].toLowerCase();if(i==="script"||i==="style")return-1;let p=a+f[0].length-1;if(i==="body"&&n===null)n=p;if(t===null&&!ue.has(i))t=p;return a+f[0].length}),n??t}function de(e,c,t,n){let s=[],a=` data-stx="${n}"`,f=0,i=!1,p=(m)=>{if(t!==null&&!i&&t>=f&&t<=m)s.push(e.slice(f,t),a,e.slice(t,m)),i=!0;else s.push(e.slice(f,m))};for(let m of c){if(m.start<f)continue;p(m.start),f=m.end}return p(e.length),s.join("")}async function Cs(e,c,t,n={}){let s=xs(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),a=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:i,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-4e48zkq0.js"));for(let x of s){let h=x.body;if(Ue(x.attrs))h=We(h);if(n.forceClientSetup||a.test(h)){f.push({content:h,start:x.start,end:x.end});continue}if(!i(h))continue;try{let R=await p(zt(h).code,c||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(a.test(R))f.push({content:h,start:x.start,end:x.end})}catch{}}if(f.length===0)return{output:e,setupCode:null};let m=`${c??""}\x00${f.map((x)=>x.content).join("\x00")}`,r=`__stx_setup_${Bun.hash(m).toString(36).slice(0,10)}`,l=[];for(let x=0;x<f.length;x++){let h=f[x].bundled??zt(f[x].content).code;if(!f[x].bundled&&i(h))h=await p(h,c||"",{projectRoot:process.cwd()});h=Ct(h);let R=N(h);l.push(`// \u2500\u2500 merged signal script #${x+1} \u2500\u2500
5
+ `)d++;l=d;continue}if(u==="/"&&e[l+1]==="*"){let d=l+2;while(d<a-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;l=d+2;continue}if(u==='"'||u==="'"||u==="`"){let d=l+1;while(d<a){if(e[d]==="\\"){d+=2;continue}if(e[d]===u){d++;break}d++}l=d;continue}if(u==="("||u==="["||u==="{"){g++,l++;continue}if(u===")"||u==="]"||u==="}"){g--,l++;continue}if(u===";"&&g===0)return l+1;l++}return a};while(n<a){let r=e[n];if(r==="/"&&e[n+1]==="/"){let l=i();t.push(e.slice(n,l)),n=l;continue}if(r==="/"&&e[n+1]==="*"){let l=p();t.push(e.slice(n,l)),n=l;continue}if(r==='"'||r==="'"||r==="`"){let l=f(r);t.push(e.slice(n,l)),n=l;continue}if(r==="{"){s++,t.push(r),n++;continue}if(r==="}"){s--,t.push(r),n++;continue}if(s===0){let l=n>0?e[n-1]:"";if(l===""||/\s/.test(l)||l===";"||l==="}"||l==="{"){let u=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(u){let d=u[2],b=m(n+u[0].length);if(c.has(d)){t.push(`/* stx: deduped const ${d} */`),n=b;continue}c.add(d),t.push(e.slice(n,b)),n=b;continue}}}t.push(r),n++}return t.join("")}var ue=new Set(["script","style","html","head","meta","link","title","!doctype"]);function fe(e){let c=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${X})>`,"iy"),t=null,n=null;return w(e,(s,a)=>{c.lastIndex=a;let f=c.exec(s);if(!f)return-1;let i=f[1].toLowerCase();if(i==="script"||i==="style")return-1;let p=a+f[0].length-1;if(i==="body"&&n===null)n=p;if(t===null&&!ue.has(i))t=p;return a+f[0].length}),n??t}function de(e,c,t,n){let s=[],a=` data-stx="${n}"`,f=0,i=!1,p=(m)=>{if(t!==null&&!i&&t>=f&&t<=m)s.push(e.slice(f,t),a,e.slice(t,m)),i=!0;else s.push(e.slice(f,m))};for(let m of c){if(m.start<f)continue;p(m.start),f=m.end}return p(e.length),s.join("")}async function Ps(e,c,t,n={}){let s=Ts(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),a=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:i,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-3zds0gmd.js"));for(let x of s){let h=x.body;if(Ge(x.attrs))h=Xe(h);if(n.forceClientSetup||a.test(h)){f.push({content:h,start:x.start,end:x.end});continue}if(!i(h))continue;try{let R=await p(Kt(h).code,c||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(a.test(R))f.push({content:h,start:x.start,end:x.end})}catch{}}if(f.length===0)return{output:e,setupCode:null};let m=`${c??""}\x00${f.map((x)=>x.content).join("\x00")}`,r=`__stx_setup_${Bun.hash(m).toString(36).slice(0,10)}`,l=[];for(let x=0;x<f.length;x++){let h=f[x].bundled??Kt(f[x].content).code;if(!f[x].bundled&&i(h))h=await p(h,c||"",{projectRoot:process.cwd()});h=Pt(h);let R=M(h);l.push(`// \u2500\u2500 merged signal script #${x+1} \u2500\u2500
6
6
  ${R}`)}let g=l.join(`
7
7
 
8
- `);g=le(g);let d=K(g).split(",").map((x)=>x.trim()).filter(Boolean),b=_n(g,t),S=`
8
+ `);g=le(g);let d=G(g).split(",").map((x)=>x.trim()).filter(Boolean),b=Rn(g,t),S=`
9
9
  <script data-stx-scoped>
10
10
  function ${r}() {
11
- ${ft("const",d)}
12
- ${pe(`${b}${g}`)}
13
- return ${Fs(g,d)};
11
+ ${wt("const",d)}
12
+ ${ge(`${b}${g}`)}
13
+ return ${qs(g,d)};
14
14
  }
15
15
  window.__stx_latestSetup=${r};
16
16
  if(window.stx)window.stx._latestSetup=${r};
17
- </script>`,E=fe(e);return{output:de(e,f,E,r),setupCode:S}}async function si(e,c,t,n){if(!Ss(e,t))return e;let s=e;if(c.skipSignalsRuntime)return s;let{output:a,setupCode:f}=await Cs(s,t,n);if(s=a,!f){let i=V(s);if(i&&!/data-stx/.test(i.attrs)&&!/data-stx-auto/.test(i.attrs)){let p=i.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");s=s.slice(0,i.index)+p+s.slice(i.index+i.tag.length)}}if(s=await hr(s,c),f){let i=_c(s,/<\/head>/i),p=i===-1?_c(s,/<body[^>]*>/i):-1;if(i!==-1)s=`${s.slice(0,i)}${f}
17
+ </script>`,E=fe(e);return{output:de(e,f,E,r),setupCode:S}}async function di(e,c,t,n){if(!$s(e,t))return e;let s=e;if(c.skipSignalsRuntime)return s;let{output:a,setupCode:f}=await Ps(s,t,n);if(s=a,!f){let i=U(s);if(i&&!/data-stx/.test(i.attrs)&&!/data-stx-auto/.test(i.attrs)){let p=i.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");s=s.slice(0,i.index)+p+s.slice(i.index+i.tag.length)}}if(s=await xr(s,c),f){let i=Ic(s,/<\/head>/i),p=i===-1?Ic(s,/<body[^>]*>/i):-1;if(i!==-1)s=`${s.slice(0,i)}${f}
18
18
  ${s.slice(i)}`;else if(p!==-1){let m=/<body[^>]*>/i.exec(s.slice(p))[0],r=p+m.length;s=`${s.slice(0,r)}
19
19
  ${f}${s.slice(r)}`}else s=`${s}
20
- ${f}`}return s}function _c(e,c){let t=/<(script|style)\b[\s\S]*?<\/\1>/gi,n=[],s;while((s=t.exec(e))!==null)n.push([s.index,s.index+s[0].length]);let a=new RegExp(c.source,c.flags.replace(/[gy]/g,"")),f=0;while(f<e.length){let i=a.exec(e.slice(f));if(!i)return-1;let p=f+i.index;if(!n.some(([r,l])=>p>=r&&p<l))return p;f=p+Math.max(i[0].length,1)}return-1}var U="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function ng(e){let c=[];for(let t of e.split(",")){let n=t.trim();if(!n||n.startsWith("type "))continue;let s=n.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(s&&s[1]!==s[2])c.push(`${s[2]} = ${s[1]}`)}if(c.length===0)return U;return`var ${c.join(", ")}; ${U}`}var ge=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Ct(e){return e.replace(ge,(c,t)=>ng(t))}
21
- export{ty,xs,ti,Ss,gr,ni,ri,tg,ks,_s,Cs,si,_c,ng,Ct};
20
+ ${f}`}return s}function Ic(e,c){let t=/<(script|style)\b[\s\S]*?<\/\1>/gi,n=[],s;while((s=t.exec(e))!==null)n.push([s.index,s.index+s[0].length]);let a=new RegExp(c.source,c.flags.replace(/[gy]/g,"")),f=0;while(f<e.length){let i=a.exec(e.slice(f));if(!i)return-1;let p=f+i.index;if(!n.some(([r,l])=>p>=r&&p<l))return p;f=p+Math.max(i[0].length,1)}return-1}var F="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function pg(e){let c=[];for(let t of e.split(",")){let n=t.trim();if(!n||n.startsWith("type "))continue;let s=n.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(s&&s[1]!==s[2])c.push(`${s[2]} = ${s[1]}`)}if(c.length===0)return F;return`var ${c.join(", ")}; ${F}`}var pe=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Pt(e){return e.replace(pe,(c,t)=>pg(t))}
21
+ export{uy,Ts,ci,$s,wr,li,ui,dg,Rs,As,Ps,di,Ic,pg,Pt};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{Rn,B}from"./chunk-kzc2tqzr.js";import m from"fs";import e from"path";async function $n(r,o,i){if(r.__stx_runtime_config)return;let n=Rn();if(n||i){r.__stx_runtime_config=n??B(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-1kgnk6ds.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=B(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Mi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{Nn,F}from"./chunk-6t04tqvh.js";import m from"fs";import e from"path";async function On(r,o,i){if(r.__stx_runtime_config)return;let n=Nn();if(n||i){r.__stx_runtime_config=n??F(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-p746twww.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=F(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Vi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
4
4
  `),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
6
6
  `)}
7
- export{$n,Mi};
7
+ export{On,Vi};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Yr,So,gm,Zl,ko}from"./chunk-az8b0726.js";import"./chunk-nb6erf75.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";export{gm as buildModuleRegistryScript,ko as buildSharedModuleRegistries,Zl as exportsMutableBinding,Yr as registeredModuleIdsIn,So as registeredModuleNamesIn};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ji,Iy,Oy,Ol,Qe,Xg,go,Ny,My,Dy,Ly,jy,By,Fy,zy,Hy}from"./chunk-86nsbxep.js";import"./chunk-s29hp1qw.js";export{By as applyHead,Ny as definePageMeta,Ji as getHead,Iy as getPageMeta,Qe as mergeHeadConfigs,Fy as processHeadDirective,Hy as processMetaDirective,zy as processTitleDirective,jy as renderBodyAttrs,Dy as renderHead,Ly as renderHtmlAttrs,Oy as resetHead,go as seoMetaToHeadConfig,Ol as useHead,My as usePageTitle,Xg as useSeoMeta,My as useTitle};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{cy,ly,cg,Cs}from"./chunk-cad7e5q1.js";import"./chunk-xz4v9tg1.js";import"./chunk-t94y8g35.js";import"./chunk-v1s838fe.js";import{Dr}from"./chunk-p55a910x.js";import"./chunk-19k15mfc.js";import"./chunk-6t04tqvh.js";import{ht}from"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{ht as freeIdentifiers,Cs as processComponents,cg as processESImports,Dr as rendersAsElement,cy as resetMarginStackWarnings,ly as resetTemplateLoopWarnings};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{xi,Si,Nt,ve,Cr,zs,Er,Hs,Vs,bg,wg,vg,Tr,xg,Sg,kg,_g,Gc,Xc,Jc,ki,Yc,Cg,Mt,Dt,Lt,jt,Bt,Ft,pt,Eg}from"./chunk-agd2b928.js";export{Er as Router,kg as abortNavigation,zs as bracketPathToRegex,Mt as clearMiddleware,Xc as createClientCookieManager,Bt as createMiddlewareContext,jt as createRouteLocation,Gc as createServerCookieManager,Jc as createStorageManager,_g as defineMiddleware,wg as defineRoute,vg as defineRoutes,Hs as findErrorPage,Vs as formatRoutes,Si as generateRouteManifest,xi as generateRouteTypes,Yc as getMiddleware,Dt as getMiddlewareNames,pt as getRouterScript,Eg as getRouterScriptDev,Cg as hasMiddleware,Nt as isFileRequestPath,Lt as loadMiddlewareFromDirectory,Cr as matchRoute,Sg as navigateTo,ve as patternToRegex,ki as registerMiddleware,xg as resetRoutes,Tr as route,Ft as runMiddleware,bg as setAppUrl};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ae,Li,ji,Ng,Kt,bl,Mg,wl,Cy,qe,Rn,Ke}from"./chunk-p55a910x.js";import"./chunk-19k15mfc.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import{Dl,t}from"./chunk-yh2hnt3m.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Ae as BROWSER_CORE_IMPORTS,Ng as STX_AUTO_IMPORTS,Li as extractAndStripCssImports,qe as extractBridgeData,Dl as findInterpolationEnd,wl as generateAutoImportDestructuring,Cy as generateBrowserAutoImportDestructuring,Rn as generateServerDataBridge,Kt as injectBrowserCoreAutoImports,Ke as processClientScript,Mg as referencesName,ji as renderVendorStyleTags,t as stripCommentsAndLiterals,bl as transformAutoImports};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{sy,ag,at,Ac,oy,xs,Ss,ks}from"./chunk-kna1bdm2.js";import"./chunk-cad7e5q1.js";import"./chunk-xz4v9tg1.js";import"./chunk-t94y8g35.js";import"./chunk-v1s838fe.js";import"./chunk-p55a910x.js";import"./chunk-19k15mfc.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{oy as clearOnceStore,Ac as onceStore,at as partialsCache,xs as processIncludes,Ss as processStackPushDirectives,ks as processStackReplacements,sy as resetUnscopedSignalWarnings,ag as topLevelElements};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as Pm}from"ts-broadcasting";import{Broadcast as Im,BroadcastServer as Om}from"ts-broadcasting";var e=null,u=[];function km(){return e}async function _m(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 Cm(){for(let n of u)clearInterval(n);if(u.length=0,!e)return;await e.stop(),e=null}async function Em(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();nu(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 nu(n,t,r){if(!i())return;s.send(n,t,r)}function Tm(n,t,r){if(!i())return;s.toUser(n,t,r)}function $m(n,t,r){if(!i())return;s.toUsers(n,t,r)}function Rm(n,t,r){if(!i())return;s.send(`private-${n}`,t,r)}function Am(n,t,r){if(!i())return;s.presence(n,t,r)}
3
- export{km,_m,Cm,Em,nu,Tm,$m,Rm,Am,Pm,Im,Om};
2
+ import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as Fm}from"ts-broadcasting";import{Broadcast as zm,BroadcastServer as Hm}from"ts-broadcasting";var e=null,u=[];function Im(){return e}async function Om(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 Nm(){for(let n of u)clearInterval(n);if(u.length=0,!e)return;await e.stop(),e=null}async function Mm(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();pu(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 pu(n,t,r){if(!i())return;s.send(n,t,r)}function Dm(n,t,r){if(!i())return;s.toUser(n,t,r)}function Lm(n,t,r){if(!i())return;s.toUsers(n,t,r)}function jm(n,t,r){if(!i())return;s.send(`private-${n}`,t,r)}function Bm(n,t,r){if(!i())return;s.presence(n,t,r)}
3
+ export{Im,Om,Nm,Mm,pu,Dm,Lm,jm,Bm,Fm,zm,Hm};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{km}from"./chunk-nysbdr4r.js";import"./chunk-7bsrnpmh.js";import"./chunk-9cbf0seq.js";import"./chunk-tgzs1kbj.js";import"./chunk-xz4v9tg1.js";import"./chunk-hmntqqyd.js";import"./chunk-ec5q4nnw.js";import"./chunk-mygsektn.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-h2tq6cbr.js";import"./chunk-agd2b928.js";import"./chunk-p55a910x.js";import"./chunk-19k15mfc.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{km as startProductionServer};
@@ -1,16 +1,16 @@
1
1
  // @bun
2
- import{S,_,Ti,vn}from"./chunk-5gx403te.js";import{ii}from"./chunk-6kp4mg3h.js";import{l}from"./chunk-np8wgbsa.js";import{D,f}from"./chunk-yxdhz4ps.js";import M 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 et(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 ve=/^(?:#[\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)??(ve.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)=>!_e[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!Le[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(${et(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(` ${et(i)}: ${u};`),m!==void 0)r.push(` ${et(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 _e={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(_e))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(_e).map(([t,s])=>` ${gn(t)}: ${n[t]??s.value};`),"}",""].join(`
4
- `)}var Le={"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"}},ur={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},dr={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 tt(n){return`--stx-${n}`}function Q(n){let t=Le[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${tt(n)}, ${t.value})`}function ce(){let n={};for(let[t,s]of Object.entries(ur))n[t]=Q(s);return n}function ae(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(dr))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(Le).map(([t,s])=>` ${tt(t)}: ${n[t]??s.value};`),"}",""].join(`
2
+ import{S,_,Ni,En}from"./chunk-p55a910x.js";import{fi}from"./chunk-5eftxrvv.js";import{l}from"./chunk-s7xywsqd.js";import{D,f}from"./chunk-xpbakn6t.js";import M from"fs";import d from"path";import{hasLocalConfig as ye}from"bunfig";var At={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 ot(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 ve=/^(?:#[\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)??(ve.test(s)?s:void 0)}function ne(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!At[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!Ee[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!He[t]).map((t)=>`density.${t}`)]}function se(n){let t={};for(let[s,r]of Object.entries(At)){let i=G(n,r.light);if(i===void 0)continue;t[s]=`var(${ot(s)}, ${i})`}return t}function re(n,t={}){let s=[],r=[];for(let[i,a]of Object.entries(At)){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(` ${ot(i)}: ${u};`),m!==void 0)r.push(` ${ot(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 Ee={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 vn(n){return`--stx-radius-${n}`}function ie(){let n={};for(let[t,s]of Object.entries(Ee))n[t]=`var(${vn(t)}, ${s.value})`;return n}function oe(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(Ee).map(([t,s])=>` ${vn(t)}: ${n[t]??s.value};`),"}",""].join(`
4
+ `)}var He={"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"}},mr={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},hr={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 it(n){return`--stx-${n}`}function Q(n){let t=He[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${it(n)}, ${t.value})`}function ce(){let n={};for(let[t,s]of Object.entries(mr))n[t]=Q(s);return n}function ae(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(hr))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(He).map(([t,s])=>` ${it(t)}: ${n[t]??s.value};`),"}",""].join(`
5
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||{}},O=[...n.preflights||[],...t.preflights||[]],{fonts:W,...I}=n,{fonts:N,roles:T,shapes:A,density:k,...b}=t,p={roles:T,shapes:A,density:k},j=N??W;return{config:{...I,...b,theme:R,safelist:P,shortcuts:z,...O.length>0?{preflights:O}:{},content:[],output:""},safelist:P,shortcuts:z,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:re({...o,...R.colors},T)+oe(A)+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 $e from"path";var Re=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>Re)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($e.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 qf(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(M.statSync(t).mtimeMs)}`}catch{H=n}}var X=!1,v=null,F="",E=!1,Te=256,w=new Map,K=null,we=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>=Te)w.delete(w.keys().next().value);w.set(n,t)}async function je(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 Be(n,t,s=K){if(!s)return;try{if(!M.existsSync(s))M.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 Ee=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Pe=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function De(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of Ee)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Oe(){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 vc(){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(De());if(t)return h=t,h;let s=Pe;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(Oe());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 qh(){Z.clear(),h=null,X=!1,v=null,F="",w.clear(),me(),we=null,U.clear()}var Se=!1;async function xc(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&&!Se)Se=!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 Kf(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-1kgnk6ds.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 xc(n)}function Gf(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 F;E=!0;try{let t=await vc();if(!t||!t.build)return E=!1,"";if(!v)v=await xc(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(F=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(!M.existsSync(u))M.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,F}}async function pr(n){v=null,await mn(n)}function Kh(){return F}function Xf(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 Jf(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 Ie(n,t);if(i)Z.set(_(n,t,s()),i);return i}function*be(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=ii(r);if(i)yield i}}function Gh(n){return[...be(n)].join(`
7
- `)}async function Ie(n,t){try{let s=await vc();if(!s)return"";let r=new Set;for(let p of be(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(p):Xf(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 Kf(i);c={config:p,fingerprint:Gf(p)},U.set(i,c),we=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 je(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:O,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 I=y.config,N=new s.CSSGenerator(I),T=I.shortcuts||R.shortcuts||{},A=Object.keys(T).filter((p)=>r.has(p)||P.includes(p));for(let p of P)if(!T[p])N.generate(p);for(let p of r)if(!T[p])N.generate(p);let k="";if(A.length>0){let p=new s.CSSGenerator(I);for(let j of A)p.generate(j);if(k=p.toCSS(!1,O),k&&!k.endsWith(`
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||{}},O=[...n.preflights||[],...t.preflights||[]],{fonts:W,...I}=n,{fonts:N,roles:T,shapes:A,density:k,...b}=t,p={roles:T,shapes:A,density:k},j=N??W;return{config:{...I,...b,theme:R,safelist:P,shortcuts:z,...O.length>0?{preflights:O}:{},content:[],output:""},safelist:P,shortcuts:z,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:re({...o,...R.colors},T)+oe(A)+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 $e from"path";var Re=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>Re)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($e.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 ng(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(M.statSync(t).mtimeMs)}`}catch{H=n}}var X=!1,v=null,F="",E=!1,Te=256,w=new Map,K=null,we=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>=Te)w.delete(w.keys().next().value);w.set(n,t)}async function je(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 Be(n,t,s=K){if(!s)return;try{if(!M.existsSync(s))M.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 $c(){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 ty(){Z.clear(),h=null,X=!1,v=null,F="",w.clear(),me(),we=null,U.clear()}var Se=!1;async function Rc(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&&!Se)Se=!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 rg(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-p746twww.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 Rc(n)}function sg(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 xn(n){if(E)return F;E=!0;try{let t=await $c();if(!t||!t.build)return E=!1,"";if(!v)v=await Rc(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(F=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(!M.existsSync(u))M.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,F}}async function yr(n){v=null,await xn(n)}function ny(){return F}function og(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 ig(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*be(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=fi(r);if(i)yield i}}function ry(n){return[...be(n)].join(`
7
+ `)}async function Ne(n,t){try{let s=await $c();if(!s)return"";let r=new Set;for(let p of be(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(p):og(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 rg(i);c={config:p,fingerprint:sg(p)},U.set(i,c),we=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 je(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:O,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 I=y.config,N=new s.CSSGenerator(I),T=I.shortcuts||R.shortcuts||{},A=Object.keys(T).filter((p)=>r.has(p)||P.includes(p));for(let p of P)if(!T[p])N.generate(p);for(let p of r)if(!T[p])N.generate(p);let k="";if(A.length>0){let p=new s.CSSGenerator(I);for(let j of A)p.generate(j);if(k=p.toCSS(!1,O),k&&!k.endsWith(`
8
8
  `))k+=`
9
- `}let b=k+N.toCSS(z,O);return b=ge(s.CSSGenerator,y)+W+b,J(o,b),Be(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 Jf(n,t);if(!i)return r?vn(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">
9
+ `}let b=k+N.toCSS(z,O);return b=ge(s.CSSGenerator,y)+W+b,J(o,b),Be(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 ig(n,t);if(!i)return r?En(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
10
  ${i}
11
- </style>`;if(r)return Ne(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 Ne(n,t){let s=Ti(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=D(n);if(o!==-1)s.push({start:o,end:o,replacement:`${t}
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=Ni(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=D(n);if(o!==-1)s.push({start:o,end:o,replacement:`${t}
13
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 Ae(vn(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 Ae(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>
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(En(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
15
  ${t}`);return t+n}
16
- export{_t,et,_e,gn,Le,ur,dr,tt,e,qf,vc,qh,xc,Kf,Gf,mn,pr,Kh,Xf,Jf,Gh,x};
16
+ export{At,ot,Ee,vn,He,mr,hr,it,e,ng,$c,ty,Rc,rg,sg,xn,yr,ny,og,ig,ry,x};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Kr}from"./chunk-ysfgabpf.js";import{existsSync as m,statSync as x}from"fs";import s from"path";var g=new Map;function M(r){let n=s.extname(r);if(n===".tsx")return"tsx";if(n===".jsx")return"jsx";if(n===".ts"||n===".mts"||n===".cts")return"ts";return"js"}async function j(r,n){let l=Object.entries(n).map(([e,t])=>[s.resolve(r,e),s.resolve(r,t)]),d=l.map(([e,t])=>{try{return`${e}\x00${t}\x00${x(t).mtimeMs}`}catch{return`${e}\x00${t}\x00-`}}).join(`
3
- `),f=`${r}\x00${JSON.stringify(n)}`,o=g.get(f);if(o&&o.signature===d)return o.standIns;let a=new Map;for(let[e,t]of l){let c=s.relative(r,e);if(!m(e))throw Error(`webModules: ${c} does not exist`);if(!m(t))throw Error(`webModules: ${s.relative(r,t)}, the stand-in for ${c}, does not exist`);if(e===t)throw Error(`webModules: ${c} stands in for itself`);let p=await Bun.file(t).text(),u=new Bun.Transpiler({loader:M(t),target:"browser"});if(s.dirname(t)!==s.dirname(e)){let i=u.scanImports(p).find((h)=>/^\.\.?\//.test(h.path));if(i)throw Error(`webModules: ${s.relative(r,t)} imports ${i.path}, which would resolve from ${s.relative(r,s.dirname(e))||"."}; a stand-in imports relatively only from the directory of the module it replaces`)}let w=u.transformSync(p);for(let i of Kr(e))a.set(i,w)}return g.set(f,{signature:d,standIns:a}),a}export{j as loadWebModules};
2
+ import{Qr}from"./chunk-sn4ndpd7.js";import{existsSync as m,statSync as x}from"fs";import s from"path";var g=new Map;function M(r){let n=s.extname(r);if(n===".tsx")return"tsx";if(n===".jsx")return"jsx";if(n===".ts"||n===".mts"||n===".cts")return"ts";return"js"}async function j(r,n){let l=Object.entries(n).map(([e,t])=>[s.resolve(r,e),s.resolve(r,t)]),d=l.map(([e,t])=>{try{return`${e}\x00${t}\x00${x(t).mtimeMs}`}catch{return`${e}\x00${t}\x00-`}}).join(`
3
+ `),f=`${r}\x00${JSON.stringify(n)}`,o=g.get(f);if(o&&o.signature===d)return o.standIns;let a=new Map;for(let[e,t]of l){let c=s.relative(r,e);if(!m(e))throw Error(`webModules: ${c} does not exist`);if(!m(t))throw Error(`webModules: ${s.relative(r,t)}, the stand-in for ${c}, does not exist`);if(e===t)throw Error(`webModules: ${c} stands in for itself`);let p=await Bun.file(t).text(),u=new Bun.Transpiler({loader:M(t),target:"browser"});if(s.dirname(t)!==s.dirname(e)){let i=u.scanImports(p).find((h)=>/^\.\.?\//.test(h.path));if(i)throw Error(`webModules: ${s.relative(r,t)} imports ${i.path}, which would resolve from ${s.relative(r,s.dirname(e))||"."}; a stand-in imports relatively only from the directory of the module it replaces`)}let w=u.transformSync(p);for(let i of Qr(e))a.set(i,w)}return g.set(f,{signature:d,standIns:a}),a}export{j as loadWebModules};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{mt,ht,yt}from"./chunk-pbakxcv8.js";import"./chunk-fdjx4vs3.js";import"./chunk-3w7gacva.js";import"./chunk-pp99rmjm.js";import{h}from"./chunk-5gx403te.js";import"./chunk-kzc2tqzr.js";import"./chunk-x4jzhgdm.js";import{Xt,fo,Jt,ia,gt,aa,go,Yt,la,Zt}from"./chunk-esjr9qhe.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{aa("Config file changed, restarting...");try{await e.onChange()}catch(p){gt(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,f=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:f,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",ct=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:ct,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:dt(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function dt(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
2
+ import{xt,St,kt}from"./chunk-zek9t5za.js";import"./chunk-00tq7ghn.js";import"./chunk-hxhmhw23.js";import"./chunk-s29hp1qw.js";import"./chunk-a60ztvnp.js";import{h}from"./chunk-p55a910x.js";import"./chunk-86nsbxep.js";import"./chunk-6t04tqvh.js";import"./chunk-19k15mfc.js";import{tn,vo,nn,ga,vt,ma,xo,rn,ya,sn}from"./chunk-g2xy0z0e.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{ma("Config file changed, restarting...");try{await e.onChange()}catch(p){vt(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,f=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:f,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",ct=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:ct,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:dt(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function dt(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
3
3
  <script>
4
4
  (function() {
5
5
  const ws = new WebSocket('${t}');
@@ -556,9 +556,9 @@ window.__stxPerformance = {
556
556
 
557
557
  window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
558
558
  </script>
559
- `}import T from"fs";import K from"path";var lt=".stx/story/presets.json",R=1,ut=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,lt),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ft(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,ut),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ft(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-vxra53wq.js"),p={},u=y(n);if(u)try{await h(u,p,e)}catch(g){o.push(`Warning: Could not extract script variables: ${g instanceof Error?g.message:String(g)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=y(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=y(e);if(!r)return null;let s={};if(await h(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-vxra53wq.js"),c={...r},n=y(e);if(n)try{await h(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:y(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
559
+ `}import T from"fs";import K from"path";var lt=".stx/story/presets.json",R=1,mt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,lt),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ut(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,mt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-rnrdngnn.js"),p={},u=y(n);if(u)try{await h(u,p,e)}catch(g){o.push(`Warning: Could not extract script variables: ${g instanceof Error?g.message:String(g)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=y(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function gt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=y(e);if(!r)return null;let s={};if(await h(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await gt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return ft(t,a.source,c);return b(t,e.path,{props:c})}async function ft(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-rnrdngnn.js"),c={...r},n=y(e);if(n)try{await h(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:y(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
560
560
  `)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function y(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
561
- `)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function rt(t,e){let r=await Yt(t);ht(t,r);let s=Zt(t.config,r);yt(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let g=new URL(i.url).pathname;if(g==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(g.startsWith("/api/"))return xt(t,g,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,g,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),u=`http://${o}:${e.port}`,f=la(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let m=await Yt(t);ht(t,m);let g=Zt(t.config,m);if(yt(t,g),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=u;try{let{exec:l}=await import("child_process"),m=process.platform;l(`${m==="darwin"?"open":m==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:u,close:async()=>{f(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],u=d[1]||"default",f,i=n.searchParams.get("props");if(i)try{f=JSON.parse(i)}catch{}let l=t.storyFiles.find((m)=>m.id===p);if(!l)return new Response("Story not found",{status:404});try{let m=await Y(t,l,u,f);return Response.json({html:m.html,css:m.css,js:m.js,errors:m.errors,duration:m.duration})}catch(m){return Response.json({html:"",css:"",js:"",errors:[m instanceof Error?m.message:String(m)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((u)=>u.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
561
+ `)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function rt(t,e){let r=await rn(t);St(t,r);let s=sn(t.config,r);kt(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let g=new URL(i.url).pathname;if(g==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(g.startsWith("/api/"))return yt(t,g,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return ht(t,g,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),u=`http://${o}:${e.port}`,f=ya(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let m=await rn(t);St(t,m);let g=sn(t.config,m);if(kt(t,g),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=u;try{let{exec:l}=await import("child_process"),m=process.platform;l(`${m==="darwin"?"open":m==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:u,close:async()=>{f(),p.stop()}}}async function yt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],u=d[1]||"default",f,i=n.searchParams.get("props");if(i)try{f=JSON.parse(i)}catch{}let l=t.storyFiles.find((m)=>m.id===p);if(!l)return new Response("Story not found",{status:404});try{let m=await Y(t,l,u,f);return Response.json({html:m.html,css:m.css,js:m.js,errors:m.errors,duration:m.duration})}catch(m){return Response.json({html:"",css:"",js:"",errors:[m instanceof Error?m.message:String(m)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((u)=>u.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function ht(t,e,r){let s=bt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function bt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
562
562
  <html lang="en" class="${r.darkClass||"dark"}">
563
563
  <head>
564
564
  <meta charset="UTF-8">
@@ -1276,5 +1276,5 @@ else {
1276
1276
  <style>${W()}</style>
1277
1277
  ${D()}
1278
1278
  </body>
1279
- </html>`}import St from"fs";import Pt from"path";var Ct=new Map,Tt=[],Rt=[],It=new Map;async function ot(t){let e=t.config.setupFile;if(!e)return;let r=Pt.resolve(t.root,e);try{await St.promises.access(r)}catch{return}let s={storyContext:t,registerComponent:(o,a)=>{Ct.set(o,a)},addCSS:(o)=>{Tt.push(o)},addScript:(o)=>{Rt.push(o)},setState:(o,a)=>{It.set(o,a)}};try{let o=await import(r);if(typeof o.default==="function")await o.default(s);else if(typeof o.setupStory==="function")await o.setupStory(s)}catch(o){console.warn(`Warning: Failed to load setup file: ${o}`)}}async function we(t={}){Xt();let e=await mt({mode:"dev"});if(!e.config.enabled){gt("Story feature is disabled in config.");return}await ot(e);let r=t.port??e.config.port,s,o=async()=>{s=await rt(e,{port:r,open:t.open,host:t.host}),Jt(e.storyFiles.length),fo(s.url),go()};await o();let a=E(e,{onChange:async()=>{await s.close();let n=await mt({mode:"dev"});Object.assign(e,n),await o()}}),c=async()=>{console.log(`
1280
- `),a.stop(),await s.close(),process.exit(0)};if(process.on("SIGINT",c),process.on("SIGTERM",c),process.stdin.isTTY)process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("data",async(n)=>{switch(n.toString()){case"h":go();break;case"o":try{let{exec:p}=await import("child_process"),u=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";p(`${u} ${s.url}`)}catch{ia("Failed to open browser")}break;case"r":await s.close(),await o();break;case"c":console.clear(),Xt(),Jt(e.storyFiles.length),fo(s.url);break;case"q":case"\x03":await c();break}});await new Promise(()=>{})}export{we as devCommand};
1279
+ </html>`}import wt from"fs";import Pt from"path";var Ct=new Map,Tt=[],Rt=[],It=new Map;async function ot(t){let e=t.config.setupFile;if(!e)return;let r=Pt.resolve(t.root,e);try{await wt.promises.access(r)}catch{return}let s={storyContext:t,registerComponent:(o,a)=>{Ct.set(o,a)},addCSS:(o)=>{Tt.push(o)},addScript:(o)=>{Rt.push(o)},setState:(o,a)=>{It.set(o,a)}};try{let o=await import(r);if(typeof o.default==="function")await o.default(s);else if(typeof o.setupStory==="function")await o.setupStory(s)}catch(o){console.warn(`Warning: Failed to load setup file: ${o}`)}}async function he(t={}){tn();let e=await xt({mode:"dev"});if(!e.config.enabled){vt("Story feature is disabled in config.");return}await ot(e);let r=t.port??e.config.port,s,o=async()=>{s=await rt(e,{port:r,open:t.open,host:t.host}),nn(e.storyFiles.length),vo(s.url),xo()};await o();let a=E(e,{onChange:async()=>{await s.close();let n=await xt({mode:"dev"});Object.assign(e,n),await o()}}),c=async()=>{console.log(`
1280
+ `),a.stop(),await s.close(),process.exit(0)};if(process.on("SIGINT",c),process.on("SIGTERM",c),process.stdin.isTTY)process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("data",async(n)=>{switch(n.toString()){case"h":xo();break;case"o":try{let{exec:p}=await import("child_process"),u=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";p(`${u} ${s.url}`)}catch{ga("Failed to open browser")}break;case"r":await s.close(),await o();break;case"c":console.clear(),tn(),nn(e.storyFiles.length),vo(s.url);break;case"q":case"\x03":await c();break}});await new Promise(()=>{})}export{he as devCommand};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Kf,Gf,Ce,Xf,kc,gn,mn,Zh,_c,hn,pr,Jf,Yf,Zf,ws,Qf,eg,Cc,yn,tg,bn,Ec,Qh}from"./chunk-cjv89tnb.js";import"./chunk-tgzs1kbj.js";import"./chunk-9f31gs4m.js";import"./chunk-nb6erf75.js";import"./chunk-ec5q4nnw.js";import"./chunk-mygsektn.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-h2tq6cbr.js";import"./chunk-agd2b928.js";import"./chunk-p55a910x.js";import"./chunk-19k15mfc.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{pr as MODULE_SPECIFIER_PREFIX,Cc as assertBundleBuildCanSettle,Kf as bundleCacheDir,Gf as bundleCacheEntryLimit,Qh as bundleClientEntriesSplit,bn as bundleClientScript,mn as clearBundleFailures,Ce as clientBundleDependencies,gn as getBundleFailures,hn as hasUserImports,eg as isWithinBundlerCallback,yn as moduleSubstitutionKey,Yf as normalizeRegistrySpecifiers,tg as queueClientBundleBuild,kc as recordBundleFailure,Jf as registryIdForPath,_c as resolveBundlerFallback,Zf as rewriteRegistryImports,Zh as setBundlerFallbackMode,Xf as shouldLogBundlerDiagnostics,Ec as tempBuildName,ws as withModuleSubstitutes,Qf as withinBundlerCallback};