@stacksjs/stx 0.2.859 → 0.2.862

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/dist/analytics.js +3 -2
  2. package/dist/animation.js +3 -3
  3. package/dist/app-shell.js +4 -3
  4. package/dist/{chunk-14cvwsy1.js → chunk-01c16zw4.js} +2 -2
  5. package/dist/chunk-0bfgsv31.js +2 -0
  6. package/dist/chunk-0c9c9v03.js +14 -0
  7. package/dist/{chunk-wjamjgx6.js → chunk-0fh47gp0.js} +2 -2
  8. package/dist/chunk-0fpx3ctt.js +2 -0
  9. package/dist/chunk-0twkeh31.js +2 -0
  10. package/dist/chunk-0xtda6aw.js +2 -0
  11. package/dist/chunk-12sv6b9c.js +2 -0
  12. package/dist/chunk-194t5qat.js +2 -0
  13. package/dist/chunk-1crn4fv0.js +2 -0
  14. package/dist/chunk-1d3swbqw.js +2 -0
  15. package/dist/{chunk-4yfbd8ny.js → chunk-1mqcttg3.js} +6 -6
  16. package/dist/chunk-1qf07v41.js +2 -0
  17. package/dist/chunk-24hq8mka.js +3 -0
  18. package/dist/chunk-2asyyky3.js +2 -0
  19. package/dist/chunk-2dpessnc.js +54 -0
  20. package/dist/{chunk-ews9yzr7.js → chunk-2jgtfjyr.js} +5 -5
  21. package/dist/chunk-2kfayg4t.js +712 -0
  22. package/dist/chunk-2rff5mbj.js +4 -0
  23. package/dist/chunk-2s7rmn9r.js +3 -0
  24. package/dist/{chunk-v9h7s8ce.js → chunk-2srjavsn.js} +2 -2
  25. package/dist/chunk-2zqh7xct.js +2 -0
  26. package/dist/chunk-321fbxnm.js +1327 -0
  27. package/dist/chunk-3gk1e2b1.js +2 -0
  28. package/dist/chunk-3ryp43f3.js +2 -0
  29. package/dist/{chunk-12r22pf0.js → chunk-3z1mmar2.js} +2 -2
  30. package/dist/{chunk-zhxdpzga.js → chunk-46ddesnf.js} +3 -3
  31. package/dist/chunk-46pxmpeb.js +3 -0
  32. package/dist/chunk-4pr29yrx.js +2 -0
  33. package/dist/{chunk-wfd9e224.js → chunk-4xanjv22.js} +125 -126
  34. package/dist/chunk-4ykgjewy.js +16 -0
  35. package/dist/{chunk-ftwdjgzd.js → chunk-55zq2ha8.js} +5 -5
  36. package/dist/{chunk-9a3rv0rj.js → chunk-5a0d3048.js} +3 -3
  37. package/dist/chunk-5ertqfs3.js +2 -0
  38. package/dist/chunk-627hzzs3.js +2 -0
  39. package/dist/chunk-64ebysb4.js +2 -0
  40. package/dist/{chunk-k8pzk8v9.js → chunk-669b2bya.js} +4 -4
  41. package/dist/{chunk-ktnb1j54.js → chunk-67dgp45w.js} +2 -2
  42. package/dist/chunk-6fstz73t.js +2 -0
  43. package/dist/{chunk-gndxakrh.js → chunk-6ftee542.js} +2 -2
  44. package/dist/{chunk-5wr1qqz3.js → chunk-6k4ac74t.js} +2 -2
  45. package/dist/{chunk-astcp7bc.js → chunk-6m63rc7m.js} +8 -8
  46. package/dist/{chunk-q3cyycnh.js → chunk-6m6y9bbx.js} +1 -1
  47. package/dist/chunk-6pczzq5f.js +2 -0
  48. package/dist/{chunk-6t0xy3wk.js → chunk-7ayvybdy.js} +3 -3
  49. package/dist/chunk-7mjf144y.js +2 -0
  50. package/dist/{chunk-9qe4qsc7.js → chunk-7mpqfg98.js} +21 -21
  51. package/dist/chunk-7q5h2cve.js +2 -0
  52. package/dist/chunk-7wqevtks.js +2 -0
  53. package/dist/chunk-84ztb43k.js +2 -0
  54. package/dist/{chunk-6e44f8w8.js → chunk-8502xb4n.js} +39 -39
  55. package/dist/{chunk-ywk6t76q.js → chunk-85j9qh7v.js} +45 -46
  56. package/dist/{chunk-cxpq2zna.js → chunk-8arfg8kp.js} +3 -3
  57. package/dist/{chunk-33x46g87.js → chunk-8hhhmscy.js} +2 -2
  58. package/dist/{chunk-x9c4njvx.js → chunk-8me8hamk.js} +2 -2
  59. package/dist/{chunk-pb09xy77.js → chunk-8s6s6nd0.js} +2 -2
  60. package/dist/chunk-8v1zpdef.js +2 -0
  61. package/dist/chunk-94mpe1ny.js +3 -0
  62. package/dist/chunk-94wnfxnd.js +2 -0
  63. package/dist/chunk-9jxs8sw2.js +2 -0
  64. package/dist/{chunk-2w7csg0c.js → chunk-9y9jecky.js} +1 -1
  65. package/dist/{chunk-mzes9ds7.js → chunk-9zrvh3pz.js} +2 -2
  66. package/dist/{chunk-hf9pvmq2.js → chunk-adb045wf.js} +3 -3
  67. package/dist/{chunk-fpkp0bqf.js → chunk-adqh1gp1.js} +1 -1
  68. package/dist/chunk-az5xw3w8.js +2 -0
  69. package/dist/chunk-ba91r7q9.js +2 -0
  70. package/dist/{chunk-qkcn0exq.js → chunk-brzjass3.js} +6 -6
  71. package/dist/chunk-bv7g3b3b.js +2 -0
  72. package/dist/chunk-bwdbj60y.js +3 -0
  73. package/dist/chunk-bwz2ehq9.js +33 -0
  74. package/dist/{chunk-ts4t2n6b.js → chunk-bx5d87xx.js} +6 -7
  75. package/dist/chunk-bz6dg4k8.js +3 -0
  76. package/dist/chunk-c34qn4k8.js +16 -0
  77. package/dist/{chunk-0es47pwe.js → chunk-cqhwzd9y.js} +5 -5
  78. package/dist/chunk-cvgbtmxp.js +2 -0
  79. package/dist/chunk-czpn3n1p.js +2 -0
  80. package/dist/chunk-dhnw2qwq.js +25 -0
  81. package/dist/{chunk-3w3fxcyx.js → chunk-dpmayc2w.js} +2 -2
  82. package/dist/{chunk-6mza6zr3.js → chunk-dtarm8x9.js} +9 -9
  83. package/dist/chunk-dydy9zrq.js +3 -0
  84. package/dist/chunk-eafqxbr0.js +2 -0
  85. package/dist/{chunk-52b6czss.js → chunk-eeq8k81z.js} +155 -157
  86. package/dist/{chunk-26jt4jvh.js → chunk-ew5cey88.js} +1 -1
  87. package/dist/chunk-fa97kz5j.js +2 -0
  88. package/dist/{chunk-xppm4cs4.js → chunk-farh4p7f.js} +3 -3
  89. package/dist/{chunk-3248qphb.js → chunk-fnxg6134.js} +10 -10
  90. package/dist/chunk-g075cc67.js +2 -0
  91. package/dist/{chunk-618t6hxp.js → chunk-g5xth2yx.js} +6 -6
  92. package/dist/{chunk-xpg52hsz.js → chunk-gbtbfg7e.js} +3 -3
  93. package/dist/{chunk-xytq7q8j.js → chunk-gd56arnm.js} +2 -2
  94. package/dist/chunk-gmm3kffd.js +2 -0
  95. package/dist/{chunk-dbm963p9.js → chunk-gp8hgpt9.js} +4 -4
  96. package/dist/chunk-h2qgqjkn.js +2 -0
  97. package/dist/chunk-h65shwe9.js +2 -0
  98. package/dist/chunk-hdjn7nw9.js +20 -0
  99. package/dist/{chunk-yd6ej23e.js → chunk-hev4t4d5.js} +6 -6
  100. package/dist/chunk-hf5fj7pr.js +2 -0
  101. package/dist/{chunk-cj9rev2p.js → chunk-hmdkf6c6.js} +2 -2
  102. package/dist/chunk-hsp9h3jn.js +2 -0
  103. package/dist/{chunk-p9jfn4yh.js → chunk-j1efsjsb.js} +5 -5
  104. package/dist/chunk-j4zrq17p.js +2 -0
  105. package/dist/chunk-jx5mss16.js +2 -0
  106. package/dist/chunk-jz84z19v.js +2 -0
  107. package/dist/{chunk-5rxks14t.js → chunk-k32q90b2.js} +2 -2
  108. package/dist/{chunk-4a0x737h.js → chunk-kbdz4762.js} +8 -8
  109. package/dist/chunk-kw11yydy.js +2 -0
  110. package/dist/{chunk-v4rrgphj.js → chunk-kwk3kxrx.js} +3 -3
  111. package/dist/chunk-kyer53x3.js +2 -0
  112. package/dist/chunk-m9cperj4.js +2 -0
  113. package/dist/{chunk-fxxh149b.js → chunk-mcnwvh06.js} +6 -6
  114. package/dist/chunk-meqsd5bt.js +2 -0
  115. package/dist/{chunk-s4592dy0.js → chunk-mfa07erx.js} +16 -16
  116. package/dist/chunk-mj4wbrw7.js +2 -0
  117. package/dist/{chunk-0yw86e75.js → chunk-mjy98ppb.js} +9 -9
  118. package/dist/{chunk-jh2v1vvb.js → chunk-mrh08821.js} +3 -3
  119. package/dist/{chunk-gq9h36jf.js → chunk-n058hznh.js} +5 -5
  120. package/dist/{chunk-9n8t7v78.js → chunk-n3jw3xpj.js} +2 -2
  121. package/dist/chunk-nz9z3ct9.js +2 -0
  122. package/dist/chunk-p0tkhd12.js +2 -0
  123. package/dist/chunk-p2etn78y.js +2 -0
  124. package/dist/{chunk-1nankvf6.js → chunk-pbakxcv8.js} +2 -2
  125. package/dist/{chunk-t5q31st4.js → chunk-q1wxgw5s.js} +2 -2
  126. package/dist/chunk-qa5y30sy.js +72 -0
  127. package/dist/{chunk-m1qqqc2j.js → chunk-qbghf76y.js} +4 -4
  128. package/dist/{chunk-a9c3gndq.js → chunk-qcxrcypb.js} +2 -2
  129. package/dist/{chunk-fkh4xece.js → chunk-qjey0jk6.js} +2 -2
  130. package/dist/chunk-rqa92xm4.js +2 -0
  131. package/dist/chunk-rvhrtnv3.js +12 -0
  132. package/dist/{chunk-7m17m22p.js → chunk-s0sad753.js} +2 -2
  133. package/dist/chunk-s92j8k4z.js +2 -0
  134. package/dist/chunk-s9df8srx.js +6 -0
  135. package/dist/{chunk-rgjjt1mb.js → chunk-sb8n32rn.js} +1 -1
  136. package/dist/chunk-snz2cxqv.js +2 -0
  137. package/dist/{chunk-14h4n1sj.js → chunk-srgnevws.js} +2 -2
  138. package/dist/chunk-srgpz94e.js +42 -0
  139. package/dist/{chunk-2sq9pdg3.js → chunk-tnp2ta5q.js} +2 -2
  140. package/dist/{chunk-5t1k0dxm.js → chunk-v37zmez0.js} +2 -2
  141. package/dist/chunk-v408qsze.js +2 -0
  142. package/dist/{chunk-qgxwf9xr.js → chunk-v4xes880.js} +3 -3
  143. package/dist/chunk-vfx1p83g.js +33 -0
  144. package/dist/chunk-vk98r75z.js +2 -0
  145. package/dist/{chunk-ypgegzh2.js → chunk-vvzys1x7.js} +3 -3
  146. package/dist/{chunk-f1vvhbmw.js → chunk-w6pzkcjp.js} +2 -2
  147. package/dist/chunk-x0s68p47.js +2 -0
  148. package/dist/{chunk-g17q4y5k.js → chunk-x512h2gv.js} +4 -4
  149. package/dist/{chunk-shke1fcm.js → chunk-x7redxyd.js} +4 -4
  150. package/dist/chunk-xjxcwrqs.js +2 -0
  151. package/dist/chunk-xsq2jf96.js +2 -0
  152. package/dist/chunk-xymr4ys9.js +3 -0
  153. package/dist/{chunk-wdcz6d20.js → chunk-y3qg95wa.js} +8 -8
  154. package/dist/chunk-y7f2x57s.js +2 -0
  155. package/dist/chunk-ymdw4fhd.js +3 -0
  156. package/dist/chunk-ymjjn9pw.js +20 -0
  157. package/dist/chunk-ynkbv9jq.js +4 -0
  158. package/dist/{chunk-49j3cn9h.js → chunk-ysfeg3cn.js} +2 -2
  159. package/dist/chunk-ytzzth34.js +2 -0
  160. package/dist/chunk-yxpjj003.js +2 -0
  161. package/dist/chunk-z1rs6b4x.js +2 -0
  162. package/dist/{chunk-yehdcjn1.js → chunk-z512gt4v.js} +3 -3
  163. package/dist/chunk-z6ntmv5x.js +2 -0
  164. package/dist/{chunk-5n7m8vqx.js → chunk-zbvfjm4a.js} +2 -2
  165. package/dist/chunk-zsnmk5me.js +2 -0
  166. package/dist/cli.js +35 -35
  167. package/dist/craft-entry.js +2 -2
  168. package/dist/craft.js +2 -2
  169. package/dist/dev-server/serve-app.js +3 -2
  170. package/dist/dev-server/serve-multi.js +3 -4
  171. package/dist/dev-server/ts-css.js +4 -5
  172. package/dist/document-shell.js +4 -3
  173. package/dist/document-tags.d.ts +8 -0
  174. package/dist/document-tags.js +37 -0
  175. package/dist/events.js +2 -1
  176. package/dist/head-injection.js +2 -1
  177. package/dist/heatmap.js +2 -1
  178. package/dist/hot-reload.js +3 -1
  179. package/dist/index.d.ts +1 -0
  180. package/dist/index.js +1 -0
  181. package/dist/native-build.js +3 -3
  182. package/dist/process.js +5 -6
  183. package/dist/production-build.js +3 -3
  184. package/dist/pwa/inject.js +3 -3
  185. package/dist/pwa.js +3 -3
  186. package/dist/reactive-bindings.js +2 -1
  187. package/dist/reactive.js +2 -1
  188. package/dist/render.js +2 -6
  189. package/dist/runtime-injection.js +6 -6
  190. package/dist/serve.js +2 -6
  191. package/dist/site-builder/build.js +2 -2
  192. package/dist/site-builder/i18n.js +2 -2
  193. package/dist/site-builder/router.js +2 -5
  194. package/dist/site-builder/theme.js +2 -2
  195. package/dist/ssg.js +30 -31
  196. package/dist/template-hydrator.js +2 -1
  197. package/dist/web-components/css-scoping.js +3 -3
  198. package/dist/x-element.js +2 -1
  199. package/package.json +5 -5
  200. package/dist/chunk-13fe3avf.js +0 -2
  201. package/dist/chunk-1hebvmaj.js +0 -2
  202. package/dist/chunk-1p47cg0g.js +0 -2
  203. package/dist/chunk-1v95w26e.js +0 -20
  204. package/dist/chunk-1z46g29d.js +0 -2
  205. package/dist/chunk-228cbw2p.js +0 -2
  206. package/dist/chunk-2bggrzv0.js +0 -2
  207. package/dist/chunk-2dnd2s2a.js +0 -3
  208. package/dist/chunk-2kc0vsnb.js +0 -54
  209. package/dist/chunk-34rh88vd.js +0 -2
  210. package/dist/chunk-3cqp0m62.js +0 -2
  211. package/dist/chunk-3dtzcc9j.js +0 -2
  212. package/dist/chunk-3rgqrs3c.js +0 -2
  213. package/dist/chunk-403a4pqm.js +0 -25
  214. package/dist/chunk-51kb36f7.js +0 -2
  215. package/dist/chunk-53ezn1tw.js +0 -2
  216. package/dist/chunk-5va6c7jf.js +0 -14
  217. package/dist/chunk-636j1nmd.js +0 -2
  218. package/dist/chunk-6w5a5ns4.js +0 -18
  219. package/dist/chunk-756rpwn0.js +0 -2
  220. package/dist/chunk-7pq02v7n.js +0 -2
  221. package/dist/chunk-7sht1rkv.js +0 -2
  222. package/dist/chunk-7trdtz0c.js +0 -3
  223. package/dist/chunk-7ycmnsh5.js +0 -2
  224. package/dist/chunk-8mdhencj.js +0 -42
  225. package/dist/chunk-9nh48zvm.js +0 -72
  226. package/dist/chunk-9rgp005c.js +0 -2
  227. package/dist/chunk-9xr628ew.js +0 -3
  228. package/dist/chunk-aq8r4rbs.js +0 -3
  229. package/dist/chunk-azvx5gaa.js +0 -2
  230. package/dist/chunk-b1kc0ka1.js +0 -712
  231. package/dist/chunk-ebk1723c.js +0 -2
  232. package/dist/chunk-emc7zqry.js +0 -2
  233. package/dist/chunk-eppv6knk.js +0 -2
  234. package/dist/chunk-f18rxz70.js +0 -2
  235. package/dist/chunk-f935fec7.js +0 -2
  236. package/dist/chunk-g0v1shhr.js +0 -2
  237. package/dist/chunk-g5pg0pg1.js +0 -2
  238. package/dist/chunk-g8x32bq2.js +0 -2
  239. package/dist/chunk-g978f9qg.js +0 -18
  240. package/dist/chunk-hk7vjyqa.js +0 -2
  241. package/dist/chunk-jd4dr23j.js +0 -3
  242. package/dist/chunk-jhm1228j.js +0 -4
  243. package/dist/chunk-jmaw2cdt.js +0 -2
  244. package/dist/chunk-jw75rmpw.js +0 -2
  245. package/dist/chunk-kgrvvtcy.js +0 -3
  246. package/dist/chunk-kpsxhm4x.js +0 -33
  247. package/dist/chunk-kvc9cwvx.js +0 -12
  248. package/dist/chunk-m3fq72f8.js +0 -2
  249. package/dist/chunk-n54twtm7.js +0 -2
  250. package/dist/chunk-np6y9evb.js +0 -2
  251. package/dist/chunk-p95fsnbk.js +0 -2
  252. package/dist/chunk-pk0mxjxw.js +0 -2
  253. package/dist/chunk-q87hkwfg.js +0 -3
  254. package/dist/chunk-q9r13taa.js +0 -2
  255. package/dist/chunk-qd87dk1d.js +0 -1329
  256. package/dist/chunk-qe6631me.js +0 -2
  257. package/dist/chunk-qqjhq0hb.js +0 -2
  258. package/dist/chunk-qsjkewah.js +0 -2
  259. package/dist/chunk-qttq8cje.js +0 -2
  260. package/dist/chunk-qw80eta1.js +0 -2
  261. package/dist/chunk-r51bfc2y.js +0 -2
  262. package/dist/chunk-rbrvepr3.js +0 -2
  263. package/dist/chunk-rwxg4m3h.js +0 -3
  264. package/dist/chunk-se4ny3q0.js +0 -2
  265. package/dist/chunk-shy2hkvj.js +0 -2
  266. package/dist/chunk-sxvv9w8t.js +0 -2
  267. package/dist/chunk-sy703233.js +0 -2
  268. package/dist/chunk-syzn6mq5.js +0 -2
  269. package/dist/chunk-t2nhr2tc.js +0 -2
  270. package/dist/chunk-tc31my2p.js +0 -20
  271. package/dist/chunk-v3r1wwec.js +0 -2
  272. package/dist/chunk-vd5d1yb9.js +0 -2
  273. package/dist/chunk-vj1bwnvs.js +0 -4
  274. package/dist/chunk-vmdsj8r5.js +0 -2
  275. package/dist/chunk-vmg3f76h.js +0 -2
  276. package/dist/chunk-w1d8t47c.js +0 -33
  277. package/dist/chunk-w1stsxm3.js +0 -3
  278. package/dist/chunk-w63c96ce.js +0 -2
  279. package/dist/chunk-wcgca1q6.js +0 -2
  280. package/dist/chunk-wv8qmwqp.js +0 -2
  281. package/dist/chunk-x90f7h2g.js +0 -2
  282. package/dist/chunk-xhnpgey5.js +0 -2
  283. package/dist/chunk-y54pj23g.js +0 -2
  284. package/dist/chunk-yhrkqcqd.js +0 -2
  285. package/dist/chunk-ykxpzjgy.js +0 -2
  286. package/dist/chunk-zhyrhxdp.js +0 -2
  287. package/dist/chunk-zn5tewws.js +0 -2
  288. package/dist/chunk-zvra3bmk.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{rs,ss}from"./chunk-6e44f8w8.js";import{y}from"./chunk-b1kc0ka1.js";import{a}from"./chunk-wfd9e224.js";import{Xe,oe}from"./chunk-ypgegzh2.js";import{rc}from"./chunk-g978f9qg.js";import{B}from"./chunk-pb09xy77.js";import{h}from"./chunk-kgrvvtcy.js";import{existsSync as z,mkdirSync as S,copyFileSync as P,chmodSync as I,rmSync as ve}from"fs";import{join as c,basename as xe,resolve as X}from"path";import{spawn as _}from"child_process";import{platform as ye}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=y(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var ku=`
2
+ import{is,as}from"./chunk-8502xb4n.js";import{w}from"./chunk-2kfayg4t.js";import{a}from"./chunk-4xanjv22.js";import{Ze,ce}from"./chunk-vvzys1x7.js";import{ac}from"./chunk-c34qn4k8.js";import{H}from"./chunk-8s6s6nd0.js";import{b}from"./chunk-94mpe1ny.js";import{f}from"./chunk-s9df8srx.js";import{existsSync as z,mkdirSync as C,copyFileSync as I,chmodSync as B,rmSync as xe}from"fs";import{join as c,basename as ye,resolve as K}from"path";import{spawn as _}from"child_process";import{platform as Se}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=w(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var Tu=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -468,9 +468,9 @@ else if (data.type === 'event' && data.method) {
468
468
  }
469
469
  })();
470
470
  </script>
471
- `;function Ra(e={}){let{debug:r=!1,timeout:i=30000}=e;return ku.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function Ph(){return!1}function Ih(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return Ra(t)})}function Aa(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=Ra(r),n=O(e,"head",`${i}
472
- `);if(n!==null)return n;let s=B(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
473
- ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
471
+ `;function Oa(e={}){let{debug:r=!1,timeout:i=30000}=e;return Tu.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function Mh(){return!1}function Dh(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return Oa(t)})}function Na(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=Oa(r),n=O(e,"head",`${i}
472
+ `);if(n!==null)return n;let s=H(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
473
+ ${i}`+e.slice(t)}return i+e}var Ao={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
474
474
  <input type="checkbox" class="craft-checkbox" ${i} ${n}>
475
475
  <span class="craft-checkbox-label">${r||e.label||""}</span>
476
476
  </label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,r)=>{let i=e.min??0,n=e.max??100,s=e.step??1,t=e.value??50,o=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${i}" max="${n}" step="${s}" value="${t}" ${o}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,r)=>{let i=e.size||40,n=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(n)return`<img class="craft-avatar" src="${n}" alt="${s}" style="width:${i}px;height:${i}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${i}px;height:${i}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,r)=>{let i=Number(e.value)||0,n=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,i/n*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let i=e.size||24;return`<div class="craft-spinner" style="width:${i}px;height:${i}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,r)=>{let i=e.open?"open":"",n=e.title||"";return`<dialog class="craft-modal" ${i}>
@@ -484,7 +484,7 @@ ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTa
484
484
  </details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:(e,r)=>{let i=e.variant||"info",n=e.title||"";return`<div class="craft-alert craft-alert-${i}" role="alert">
485
485
  ${n?`<div class="craft-alert-title">${n}</div>`:""}
486
486
  <div class="craft-alert-content">${r}</div>
487
- </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let i=e.content||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${i}" data-position="${n}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:te},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:re},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:ae},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:ie},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let i=e.value||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${i}" min="${n}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},ns=`
487
+ </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let i=e.content||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${i}" data-position="${n}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:re},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:ae},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:ie},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:ne},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let i=e.value||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${i}" min="${n}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},os=`
488
488
  <style id="craft-component-styles">
489
489
  /* Craft Component Base Styles */
490
490
  .craft-button {
@@ -902,7 +902,7 @@ ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTa
902
902
  }
903
903
  }
904
904
  </style>
905
- `,Pa=`
905
+ `,Ma=`
906
906
  <script id="craft-component-runtime">
907
907
  (function() {
908
908
  if (window.__stxCraftComponentRuntime) return;
@@ -1006,54 +1006,53 @@ ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTa
1006
1006
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
1007
1007
  })();
1008
1008
  </script>
1009
- `;function Ia(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=O(e,"head",`${ns}
1010
- `)??ns+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${Pa}
1011
- `)??e+Pa;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>N("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>N("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>N(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>N(s,t,o.trim(),r,i)),e}function N(e,r,i,n,s){let t=n.components?.[e]||To[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=F(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let f=ue(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${f}>`;return`<${t.fallbackTag} ${f}>${i}</${t.fallbackTag}>`}function F(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,f=o??d;if(s.startsWith(":"))r[t]=f;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=f;else if(f===void 0)r[t]=!0;else r[t]=f}return r}function te(e,r){let i=R(String(e.id||`craft-sidebar-${fe(r||JSON.stringify(e))}`)),n=ce(e.spaces)||se(r),s=n.length?[]:le(e.sections)||j(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((v)=>v.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),f={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},p=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),u=e.native===!1||e.native==="false"?"false":"true",b=f.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${T(f.searchPlaceholder)}"></div>`:"",g;if(n.length)g=de(n,t,d);else if(s.length)g=s.map((v)=>L(v,d)).join("");else g=r;return`<aside class="${x(p)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${x(i)}" data-native="${u}" style="--craft-sidebar-width:${l}px">
1012
- ${b}
1013
- ${g}
1009
+ `;function Da(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=O(e,"head",`${os}
1010
+ `)??os+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${Ma}
1011
+ `)??e+Ma;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>N("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>N("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>N(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>N(s,t,o.trim(),r,i)),e}function N(e,r,i,n,s){let t=n.components?.[e]||Ao[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=F(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let p=be(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${p}>`;return`<${t.fallbackTag} ${p}>${i}</${t.fallbackTag}>`}function F(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,p=o??d;if(s.startsWith(":"))r[t]=p;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=p;else if(p===void 0)r[t]=!0;else r[t]=p}return r}function re(e,r){let i=R(String(e.id||`craft-sidebar-${pe(r||JSON.stringify(e))}`)),n=de(e.spaces)||oe(r),s=n.length?[]:fe(e.sections)||j(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((y)=>y.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),p={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),g=e.native===!1||e.native==="false"?"false":"true",m=p.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${P(p.searchPlaceholder)}"></div>`:"",h;if(n.length)h=le(n,t,d);else if(s.length)h=s.map((y)=>L(y,d)).join("");else h=r;return`<aside class="${S(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${S(i)}" data-native="${g}" style="--craft-sidebar-width:${l}px">
1012
+ ${m}
1013
+ ${h}
1014
1014
  </aside>
1015
- <script type="application/json" data-craft-sidebar-config="${x(i)}">${pe(f)}</script>`}function re(e,r){let i=R(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${x(i)}">
1016
- ${e.label?`<div class="craft-sidebar-space-title">${T(String(e.label))}</div>`:""}
1015
+ <script type="application/json" data-craft-sidebar-config="${S(i)}">${ue(p)}</script>`}function ae(e,r){let i=R(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${S(i)}">
1016
+ ${e.label?`<div class="craft-sidebar-space-title">${P(String(e.label))}</div>`:""}
1017
1017
  ${r}
1018
- </section>`}function ae(e,r){let i=String(e.header||e.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${x(String(e.id||"section"))}">
1019
- ${i?`<div class="craft-sidebar-section-title">${T(i)}</div>`:""}
1018
+ </section>`}function ie(e,r){let i=String(e.header||e.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${S(String(e.id||"section"))}">
1019
+ ${i?`<div class="craft-sidebar-section-title">${P(i)}</div>`:""}
1020
1020
  ${r}
1021
- </section>`}function ie(e,r){let i={id:String(e.id||R(String(e.label||r||"item"))),label:String(e.label||r||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return H(i,String(e.selected||"")==="true")}function j(e){let r=[],i=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,n;while((n=i.exec(e))!==null){let s=F(n[1]||""),t=n[2]||"",o=String(s.id||R(String(s.header||s.title||`section-${r.length+1}`))),d=String(s.header||s.title||o),f=ne(t);r.push({id:o,header:d,title:d,items:f})}return r}function ne(e){let r=[],i=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,n;while((n=i.exec(e))!==null){let s=F(n[1]||""),t=String(s.label||(n[2]||"").replace(/<[^>]*>/g,"").trim()),o=String(s.id||R(t||`item-${r.length+1}`));r.push({id:o,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return r}function se(e){let r=[],i=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,n;while((n=i.exec(e))!==null){let s=F(n[1]||""),t=n[2]||"",o=String(s.label||s.title||`Space ${r.length+1}`);r.push({id:String(s.id||R(o)),label:o,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:j(t)})}return r}function ce(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function de(e,r,i){let n=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${x(t.id)}" data-selected="${t.id===r?"true":"false"}" title="${x(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${x(t.icon)}"></span>`:T((t.label||t.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${e.map((t)=>`<section class="craft-sidebar-space" data-space-id="${x(t.id)}" data-selected="${t.id===r?"true":"false"}">
1022
- ${t.label?`<div class="craft-sidebar-space-title">${T(t.label)}</div>`:""}
1021
+ </section>`}function ne(e,r){let i={id:String(e.id||R(String(e.label||r||"item"))),label:String(e.label||r||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return V(i,String(e.selected||"")==="true")}function j(e){let r=[],i=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,n;while((n=i.exec(e))!==null){let s=F(n[1]||""),t=n[2]||"",o=String(s.id||R(String(s.header||s.title||`section-${r.length+1}`))),d=String(s.header||s.title||o),p=se(t);r.push({id:o,header:d,title:d,items:p})}return r}function se(e){let r=[],i=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,n;while((n=i.exec(e))!==null){let s=F(n[1]||""),t=String(s.label||(n[2]||"").replace(/<[^>]*>/g,"").trim()),o=String(s.id||R(t||`item-${r.length+1}`));r.push({id:o,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return r}function oe(e){let r=[],i=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,n;while((n=i.exec(e))!==null){let s=F(n[1]||""),t=n[2]||"",o=String(s.label||s.title||`Space ${r.length+1}`);r.push({id:String(s.id||R(o)),label:o,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:j(t)})}return r}function de(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function le(e,r,i){let n=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${S(t.id)}" data-selected="${t.id===r?"true":"false"}" title="${S(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${S(t.icon)}"></span>`:P((t.label||t.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${e.map((t)=>`<section class="craft-sidebar-space" data-space-id="${S(t.id)}" data-selected="${t.id===r?"true":"false"}">
1022
+ ${t.label?`<div class="craft-sidebar-space-title">${P(t.label)}</div>`:""}
1023
1023
  ${t.sections.map((o)=>L(o,i)).join("")}
1024
1024
  </section>`).join("")}</div>
1025
- <div class="craft-sidebar-space-switcher">${n}</div>`}function le(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function L(e,r){let i=e.header||e.title||e.id;return`<section class="craft-sidebar-section" data-section-id="${x(e.id)}">
1026
- <div class="craft-sidebar-section-title">${T(i)}</div>
1027
- ${e.items.map((n)=>H(n,n.id===r)).join("")}
1028
- </section>`}function H(e,r){let i=e.tintColor?` style="--craft-sidebar-icon-color:${x(e.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${x(e.id)}" data-selected="${r?"true":"false"}">
1029
- ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${x(e.icon)}"${i}></span>`:""}
1030
- <span class="craft-sidebar-item-label">${T(e.label)}</span>
1031
- ${e.badge?`<span class="craft-sidebar-item-badge">${T(e.badge)}</span>`:""}
1032
- </button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function fe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function x(e){return T(e).replace(/`/g,"&#96;")}function pe(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ue(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,"&quot;");n.push(`${s}="${o}"`)}return n.join(" ")}function Oh(e,r){To[e]=r}function Nh(){return{...To}}import{chmodSync as be,copyFileSync as ge,mkdtempSync as V,rmSync as me,writeFileSync as J}from"fs";import{tmpdir as W}from"os";import{join as D}from"path";function we(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function he(e,r){let i=D(r,"Contents","embedded.provisionprofile");ge(e,i),be(i,420)}async function Q(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let p=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(p.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=we(p.stdout),u={};if(i.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");u=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[b])u[b]=l[b];if(s=V(D(W(),"stx-entitlements-")),n=D(s,"entitlements.plist"),J(n,JSON.stringify(u)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");he(i.provisioningProfile,e)}let t;if(r.length){let p=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");p=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(D(W(),"stx-entitlements-")),t=D(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...p?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let p of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(p===e&&n)l.push("--entitlements",n);if(p!==e&&t)l.push("--entitlements",t);let u=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",u,...l,p],{stdout:"pipe",stderr:"pipe"}),[g,v]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(v!==0)throw Error(`Could not sign native bundle ${p}: ${g.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,f]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(f!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)me(s,{recursive:!0,force:!0})}}var Y=(e)=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function G(e){let r=new Set,i=(n,s,t)=>{if(typeof n==="string")return`${s}<string>${Y(n)}</string>`;if(typeof n==="boolean")return`${s}<${n}/>`;if(typeof n==="number"){if(!Number.isFinite(n))throw TypeError(`Non-finite Info.plist number at ${t}`);let o=Number.isSafeInteger(n)?"integer":"real";return`${s}<${o}>${n}</${o}>`}if(n!==null&&typeof n==="object"){let o=Array.isArray(n);if(!o&&Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Unsupported Info.plist value at ${t}`);if(r.has(n))throw TypeError(`Cyclic Info.plist value at ${t}`);r.add(n);try{let d=o?"array":"dict",f=`${s} `,p=o?Array.from(n,(l,u)=>i(l,f,`${t}[${u}]`)):Object.entries(n).map(([l,u])=>`${f}<key>${Y(l)}</key>
1033
- ${i(u,f,`${t}.${l}`)}`);return p.length?`${s}<${d}>
1034
- ${p.join(`
1025
+ <div class="craft-sidebar-space-switcher">${n}</div>`}function fe(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function L(e,r){let i=e.header||e.title||e.id;return`<section class="craft-sidebar-section" data-section-id="${S(e.id)}">
1026
+ <div class="craft-sidebar-section-title">${P(i)}</div>
1027
+ ${e.items.map((n)=>V(n,n.id===r)).join("")}
1028
+ </section>`}function V(e,r){let i=e.tintColor?` style="--craft-sidebar-icon-color:${S(e.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${S(e.id)}" data-selected="${r?"true":"false"}">
1029
+ ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${S(e.icon)}"${i}></span>`:""}
1030
+ <span class="craft-sidebar-item-label">${P(e.label)}</span>
1031
+ ${e.badge?`<span class="craft-sidebar-item-badge">${P(e.badge)}</span>`:""}
1032
+ </button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function pe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function P(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function S(e){return P(e).replace(/`/g,"&#96;")}function ue(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function be(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,"&quot;");n.push(`${s}="${o}"`)}return n.join(" ")}function Lh(e,r){Ao[e]=r}function jh(){return{...Ao}}import{chmodSync as ge,copyFileSync as me,mkdtempSync as J,rmSync as we,writeFileSync as W}from"fs";import{tmpdir as Q}from"os";import{join as D}from"path";function he(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function ve(e,r){let i=D(r,"Contents","embedded.provisionprofile");me(e,i),ge(i,420)}async function Y(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let u=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(u.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=he(u.stdout),g={};if(i.entitlements){let m=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(m.exitCode!==0)throw Error("Could not read the app entitlements plist.");g=JSON.parse(m.stdout.toString())}for(let m of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[m])g[m]=l[m];if(s=J(D(Q(),"stx-entitlements-")),n=D(s,"entitlements.plist"),W(n,JSON.stringify(g)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");ve(i.provisioningProfile,e)}let t;if(r.length){let u=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");u=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=J(D(Q(),"stx-entitlements-")),t=D(s,"helper.entitlements.plist"),W(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...u?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let u of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(u===e&&n)l.push("--entitlements",n);if(u!==e&&t)l.push("--entitlements",t);let g=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",m=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",g,...l,u],{stdout:"pipe",stderr:"pipe"}),[h,y]=await Promise.all([new Response(m.stderr).text(),m.exited]);if(y!==0)throw Error(`Could not sign native bundle ${u}: ${h.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,p]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(p!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)we(s,{recursive:!0,force:!0})}}var G=(e)=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function X(e){let r=new Set,i=(n,s,t)=>{if(typeof n==="string")return`${s}<string>${G(n)}</string>`;if(typeof n==="boolean")return`${s}<${n}/>`;if(typeof n==="number"){if(!Number.isFinite(n))throw TypeError(`Non-finite Info.plist number at ${t}`);let o=Number.isSafeInteger(n)?"integer":"real";return`${s}<${o}>${n}</${o}>`}if(n!==null&&typeof n==="object"){let o=Array.isArray(n);if(!o&&Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Unsupported Info.plist value at ${t}`);if(r.has(n))throw TypeError(`Cyclic Info.plist value at ${t}`);r.add(n);try{let d=o?"array":"dict",p=`${s} `,u=o?Array.from(n,(l,g)=>i(l,p,`${t}[${g}]`)):Object.entries(n).map(([l,g])=>`${p}<key>${G(l)}</key>
1033
+ ${i(g,p,`${t}.${l}`)}`);return u.length?`${s}<${d}>
1034
+ ${u.join(`
1035
1035
  `)}
1036
1036
  ${s}</${d}>`:`${s}<${d}/>`}finally{r.delete(n)}}throw TypeError(`Unsupported Info.plist value at ${t}`)};if(!e||Array.isArray(e)||typeof e!=="object")throw TypeError("Info.plist root must be a dictionary");return`<?xml version="1.0" encoding="UTF-8"?>
1037
1037
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
1038
1038
  <plist version="1.0">
1039
1039
  ${i(e,"","infoPlist")}
1040
1040
  </plist>
1041
- `}async function Oa(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||q(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||q(),n=e.format||Be(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!z(X(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!z(s))S(s,{recursive:!0});let t=await a(process.cwd()),o=await rc(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=Aa(o,{debug:e.verbose}),o=Ia(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${ns}
1042
- </head>`)}let d=e.name||xe(e.input,".stx"),f=e.version||"1.0.0",p=e.craftPath||Na(e.runtimeProfile);if(!p)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let u=Bun.spawnSync([p,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(u.exitCode!==0||u.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(p=rs(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${p}`);let l;switch(i){case"macos":l=await Se(o,d,f,s,n,e,p);break;case"windows":l=await $e(o,d,f,s,n,e,p);break;case"linux":l=await Te(o,d,f,s,n,e,p);break;case"ios":l=await Pe(o,d,f,s,e,p);break;case"android":l=await Ie(o,d,f,s,e,p);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||q(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Se(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,f=c(n,`${r}.app`),p=c(f,"Contents"),l=c(p,"MacOS"),u=c(p,"Resources");ve(f,{recursive:!0,force:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=c(u,"index.html");await Bun.write(b,e);let g="";if(t.sidebar?.enabled&&t.sidebar?.config)g=c(u,"sidebar-config.json"),await Bun.write(g,JSON.stringify(t.sidebar.config));let v=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",k=t.menubarOnly??t.systemTray,w=t.bundleStyle||(await ke(o)?"executable":"launcher");if(t.backend){if(!await Ce(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");P(o,c(l,r)),I(c(l,r),493);let C=Xe("native-backend");try{let m=c(C,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(m,`import { runNativeBackend } from ${JSON.stringify(M)}
1043
- import * as backend from ${JSON.stringify(X(t.backend.entry))}
1041
+ `}async function La(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||q(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||q(),n=e.format||Re(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!z(K(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!z(s))C(s,{recursive:!0});let t=await a(process.cwd()),o=await ac(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=Na(o,{debug:e.verbose}),o=Da(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=f(o,os)}let d=e.name||ye(e.input,".stx"),p=e.version||"1.0.0",u=e.craftPath||ja(e.runtimeProfile);if(!u)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let g=Bun.spawnSync([u,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(g.exitCode!==0||g.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(u=is(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${u}`);let l;switch(i){case"macos":l=await Ce(o,d,p,s,n,e,u);break;case"windows":l=await Te(o,d,p,s,n,e,u);break;case"linux":l=await Pe(o,d,p,s,n,e,u);break;case"ios":l=await Ie(o,d,p,s,e,u);break;case"android":l=await Be(o,d,p,s,e,u);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||q(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Ce(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,p=c(n,`${r}.app`),u=c(p,"Contents"),l=c(u,"MacOS"),g=c(u,"Resources");xe(p,{recursive:!0,force:!0}),C(l,{recursive:!0}),C(g,{recursive:!0});let m=c(g,"index.html");await Bun.write(m,e);let h="";if(t.sidebar?.enabled&&t.sidebar?.config)h=c(g,"sidebar-config.json"),await Bun.write(h,JSON.stringify(t.sidebar.config));let y=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",T=t.menubarOnly??t.systemTray,x=t.bundleStyle||(await $e(o)?"executable":"launcher");if(t.backend){if(!await ke(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");I(o,c(l,r)),B(c(l,r),493);let k=Ze("native-backend");try{let v=c(k,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(v,`import { runNativeBackend } from ${JSON.stringify(M)}
1042
+ import * as backend from ${JSON.stringify(K(t.backend.entry))}
1044
1043
  await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: backend.default, shutdown: Reflect.get(backend, "shutdown"),
1045
1044
  maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
1046
- `);let E=Bun.spawn([process.execPath,"build",m,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",c(l,"stx-backend")],{stdout:"pipe",stderr:"pipe"}),[A,Z,ee]=await Promise.all([new Response(E.stdout).text(),new Response(E.stderr).text(),E.exited]);if(ee!==0)throw Error(`Native backend compilation failed: ${A}
1047
- ${Z}`)}finally{oe(C)}await Bun.write(c(u,"craft.json"),`${JSON.stringify({backend:{executable:"stx-backend"},runtimeProfile:t.runtimeProfile||"full",title:t.window?.title||r,appName:r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools),frameless:Boolean(t.window?.frameless),transparent:Boolean(t.window?.transparent),cornerRadius:t.window?.cornerRadius??0,alwaysOnTop:Boolean(t.window?.alwaysOnTop),resizable:t.window?.resizable!==!1,hideDockIcon:Boolean(t.hideDockIcon),headless:Boolean(t.window?.startHidden),...t.trayPopover?{trayPopover:!0}:k?{menubarOnly:!0}:t.systemTray?{systemTray:!0}:{}},null,2)}
1048
- `)}else if(w==="executable"){let C=c(l,r);P(o,C),I(C,493);let m={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(t.trayPopover)m.trayPopover=!0;else if(k)m.menubarOnly=!0;else if(t.systemTray)m.systemTray=!0;if(t.window?.frameless)m.frameless=!0;if(t.window?.transparent)m.transparent=!0;if(t.window?.cornerRadius)m.cornerRadius=t.window.cornerRadius;if(t.window?.alwaysOnTop)m.alwaysOnTop=!0;if(t.window?.resizable===!1)m.resizable=!1;if(t.hideDockIcon)m.hideDockIcon=!0;if(t.window?.startHidden)m.headless=!0;await Bun.write(c(u,"craft.json"),`${JSON.stringify(m,null,2)}
1049
- `)}else{let C=c(l,"craft");P(o,C),I(C,493);let m=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",E=`#!/bin/bash
1045
+ `);let E=Bun.spawn([process.execPath,"build",v,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",c(l,"stx-backend")],{stdout:"pipe",stderr:"pipe"}),[A,ee,te]=await Promise.all([new Response(E.stdout).text(),new Response(E.stderr).text(),E.exited]);if(te!==0)throw Error(`Native backend compilation failed: ${A}
1046
+ ${ee}`)}finally{ce(k)}await Bun.write(c(g,"craft.json"),`${JSON.stringify({backend:{executable:"stx-backend"},runtimeProfile:t.runtimeProfile||"full",title:t.window?.title||r,appName:r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools),frameless:Boolean(t.window?.frameless),transparent:Boolean(t.window?.transparent),cornerRadius:t.window?.cornerRadius??0,alwaysOnTop:Boolean(t.window?.alwaysOnTop),resizable:t.window?.resizable!==!1,hideDockIcon:Boolean(t.hideDockIcon),headless:Boolean(t.window?.startHidden),...t.trayPopover?{trayPopover:!0}:T?{menubarOnly:!0}:t.systemTray?{systemTray:!0}:{}},null,2)}
1047
+ `)}else if(x==="executable"){let k=c(l,r);I(o,k),B(k,493);let v={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(t.trayPopover)v.trayPopover=!0;else if(T)v.menubarOnly=!0;else if(t.systemTray)v.systemTray=!0;if(t.window?.frameless)v.frameless=!0;if(t.window?.transparent)v.transparent=!0;if(t.window?.cornerRadius)v.cornerRadius=t.window.cornerRadius;if(t.window?.alwaysOnTop)v.alwaysOnTop=!0;if(t.window?.resizable===!1)v.resizable=!1;if(t.hideDockIcon)v.hideDockIcon=!0;if(t.window?.startHidden)v.headless=!0;await Bun.write(c(g,"craft.json"),`${JSON.stringify(v,null,2)}
1048
+ `)}else{let k=c(l,"craft");I(o,k),B(k,493);let v=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",E=`#!/bin/bash
1050
1049
  set -euo pipefail
1051
1050
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
1052
1051
  RESOURCES="$DIR/../Resources"
1053
1052
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
1054
- ${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":k?"--menubar-only":t.systemTray?"--system-tray":"",t.devTools?"":"--no-devtools",t.window?.frameless?"--frameless":"",t.window?.transparent?"--transparent":"",t.window?.cornerRadius?`--corner-radius ${t.window.cornerRadius}`:"",t.window?.alwaysOnTop?"--always-on-top":"",t.window?.resizable===!1?"--no-resize":"",t.hideDockIcon?"--hide-dock-icon":"",t.window?.startHidden?"--headless":"",m].filter(Boolean).join(" \\\n ")}
1055
- `,A=c(l,r);await Bun.write(A,E),I(A,493)}let U=Boolean(t.icon&&await Bun.file(t.icon).exists());if(U)P(t.icon,c(u,"AppIcon.icns"));let K={CFBundleInfoDictionaryVersion:"6.0",CFBundleExecutable:r,CFBundleIdentifier:d,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:i,CFBundleVersion:i,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.hideDockIcon||t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...U?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(c(p,"Info.plist"),G(K)),await Q(f,t.backend?[c(l,"stx-backend")]:w==="launcher"?[c(l,"craft")]:[],t.macosSigning),s==="dmg"){let C=c(n,`${r}-${i}.dmg`),m=await Re(f,C,r);if(!m.success)return{success:!1,target:"macos",format:"dmg",error:m.error};return{success:!0,target:"macos",format:"dmg",outputPath:C}}return{success:!0,target:"macos",format:"app",outputPath:f}}async function Ce(e){let r=Bun.spawn([e,"--capabilities"],{stdout:"pipe",stderr:"pipe"}),i=setTimeout(()=>r.kill(),5000);try{let[n,s,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text(),r.exited]);if(t!==0)return!1;return JSON.parse(`${n}${s}`.trim()).bundleBackend===!0}catch{return!1}finally{clearTimeout(i)}}async function ke(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[i,n]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${i}
1056
- ${n}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[o,d,f]=t.slice(1).map(Number);if(o>0||d>0)return!0;return f>=57}catch{return!1}}async function $e(e,r,i,n,s,t,o){let d=c(n,r);S(d,{recursive:!0});let f=c(d,"index.html");await Bun.write(f,e),P(o,c(d,"craft.exe"));let p=`@echo off
1053
+ ${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":T?"--menubar-only":t.systemTray?"--system-tray":"",t.devTools?"":"--no-devtools",t.window?.frameless?"--frameless":"",t.window?.transparent?"--transparent":"",t.window?.cornerRadius?`--corner-radius ${t.window.cornerRadius}`:"",t.window?.alwaysOnTop?"--always-on-top":"",t.window?.resizable===!1?"--no-resize":"",t.hideDockIcon?"--hide-dock-icon":"",t.window?.startHidden?"--headless":"",v].filter(Boolean).join(" \\\n ")}
1054
+ `,A=c(l,r);await Bun.write(A,E),B(A,493)}let U=Boolean(t.icon&&await Bun.file(t.icon).exists());if(U)I(t.icon,c(g,"AppIcon.icns"));let Z={CFBundleInfoDictionaryVersion:"6.0",CFBundleExecutable:r,CFBundleIdentifier:d,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:i,CFBundleVersion:i,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.hideDockIcon||t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...U?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(c(u,"Info.plist"),X(Z)),await Y(p,t.backend?[c(l,"stx-backend")]:x==="launcher"?[c(l,"craft")]:[],t.macosSigning),s==="dmg"){let k=c(n,`${r}-${i}.dmg`),v=await Ee(p,k,r);if(!v.success)return{success:!1,target:"macos",format:"dmg",error:v.error};return{success:!0,target:"macos",format:"dmg",outputPath:k}}return{success:!0,target:"macos",format:"app",outputPath:p}}async function ke(e){let r=Bun.spawn([e,"--capabilities"],{stdout:"pipe",stderr:"pipe"}),i=setTimeout(()=>r.kill(),5000);try{let[n,s,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text(),r.exited]);if(t!==0)return!1;return JSON.parse(`${n}${s}`.trim()).bundleBackend===!0}catch{return!1}finally{clearTimeout(i)}}async function $e(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[i,n]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${i}
1055
+ ${n}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[o,d,p]=t.slice(1).map(Number);if(o>0||d>0)return!0;return p>=57}catch{return!1}}async function Te(e,r,i,n,s,t,o){let d=c(n,r);C(d,{recursive:!0});let p=c(d,"index.html");await Bun.write(p,e),I(o,c(d,"craft.exe"));let u=`@echo off
1057
1056
  set DIR=%~dp0
1058
1057
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
1059
1058
  --title "${t.window?.title||r}" ^
@@ -1061,7 +1060,7 @@ set DIR=%~dp0
1061
1060
  --height ${t.window?.height||800} ^
1062
1061
  ${t.systemTray?"--system-tray":""} ^
1063
1062
  ${t.devTools?"":"--no-devtools"}
1064
- `;if(await Bun.write(c(d,`${r}.bat`),p),s==="zip"){let l=c(n,`${r}-${i}-windows.zip`),u=await Ee(d,l);if(!u.success)return{success:!1,target:"windows",format:"zip",error:u.error};return{success:!0,target:"windows",format:"zip",outputPath:l}}return{success:!0,target:"windows",format:"app",outputPath:d}}async function Te(e,r,i,n,s,t,o){let d=c(n,r);S(d,{recursive:!0});let f=c(d,"index.html");await Bun.write(f,e);let p=c(d,"craft");P(o,p),I(p,493);let l=`#!/bin/bash
1063
+ `;if(await Bun.write(c(d,`${r}.bat`),u),s==="zip"){let l=c(n,`${r}-${i}-windows.zip`),g=await Oe(d,l);if(!g.success)return{success:!1,target:"windows",format:"zip",error:g.error};return{success:!0,target:"windows",format:"zip",outputPath:l}}return{success:!0,target:"windows",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t,o){let d=c(n,r);C(d,{recursive:!0});let p=c(d,"index.html");await Bun.write(p,e);let u=c(d,"craft");I(o,u),B(u,493);let l=`#!/bin/bash
1065
1064
  set -euo pipefail
1066
1065
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
1067
1066
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -1070,14 +1069,14 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
1070
1069
  --height ${t.window?.height||800} \\
1071
1070
  ${t.systemTray?"--system-tray":""} \\
1072
1071
  ${t.devTools?"":"--no-devtools"}
1073
- `,u=c(d,r.toLowerCase());await Bun.write(u,l),I(u,493);let b=`[Desktop Entry]
1072
+ `,g=c(d,r.toLowerCase());await Bun.write(g,l),B(g,493);let m=`[Desktop Entry]
1074
1073
  Type=Application
1075
1074
  Name=${r}
1076
- Exec=${u}
1075
+ Exec=${g}
1077
1076
  Terminal=false
1078
1077
  Categories=Utility;
1079
- `;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let g=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,g,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:g}}if(s==="appimage"){let g=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,g,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:g}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Na(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!z(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function q(){switch(ye()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Be(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Re(e,r,i){return ss({appBundlePath:e,outputPath:r,volumeName:i})}async function Ee(e,r){return new Promise((i)=>{let n=_("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function Oe(e,r,i,n,s){return new Promise((t)=>{let o=Xe("deb");try{let d=c(o,"pkg"),f=c(d,"DEBIAN"),p=c(d,"usr","bin"),l=c(d,"usr","share","applications"),u=c(d,"usr","share",i.toLowerCase());S(f,{recursive:!0}),S(p,{recursive:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=h("fs").readdirSync(e);for(let w of b)P(c(e,w),c(u,w));let g=`#!/bin/bash
1080
- exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;h("fs").writeFileSync(c(p,i.toLowerCase()),g),I(c(p,i.toLowerCase()),493);let v=`Package: ${i.toLowerCase()}
1078
+ `;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),m),s==="deb"){let h=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),y=await De(d,h,r,i,t);if(!y.success)return{success:!1,target:"linux",format:"deb",error:y.error};return{success:!0,target:"linux",format:"deb",outputPath:h}}if(s==="appimage"){let h=c(n,`${r}-${i}-x86_64.AppImage`),y=await qe(d,h,r,t);if(!y.success)return{success:!1,target:"linux",format:"appimage",error:y.error};return{success:!0,target:"linux",format:"appimage",outputPath:h}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Be(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function ja(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!z(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function q(){switch(Se()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Re(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Ee(e,r,i){return as({appBundlePath:e,outputPath:r,volumeName:i})}async function Oe(e,r){return new Promise((i)=>{let n=_("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function De(e,r,i,n,s){return new Promise((t)=>{let o=Ze("deb");try{let d=c(o,"pkg"),p=c(d,"DEBIAN"),u=c(d,"usr","bin"),l=c(d,"usr","share","applications"),g=c(d,"usr","share",i.toLowerCase());C(p,{recursive:!0}),C(u,{recursive:!0}),C(l,{recursive:!0}),C(g,{recursive:!0});let m=b("fs").readdirSync(e);for(let x of m)I(c(e,x),c(g,x));let h=`#!/bin/bash
1079
+ exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;b("fs").writeFileSync(c(u,i.toLowerCase()),h),B(c(u,i.toLowerCase()),493);let y=`Package: ${i.toLowerCase()}
1081
1080
  Version: ${n}
1082
1081
  Section: utils
1083
1082
  Priority: optional
@@ -1085,17 +1084,17 @@ Architecture: amd64
1085
1084
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
1086
1085
  Maintainer: ${s.author||"Unknown"}
1087
1086
  Description: ${s.description||i}
1088
- `;h("fs").writeFileSync(c(f,"control"),v);let k=_("dpkg-deb",["--build",d,r]);k.on("close",(w)=>{if(oe(o),w===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${w}`})}),k.on("error",(w)=>{oe(o),t({success:!1,error:w.message})})}catch(d){oe(o),t({success:!1,error:d.message})}})}async function De(e,r,i,n){return new Promise((s)=>{let t=Xe("appimage");try{let o=c(t,`${i}.AppDir`),d=c(o,"usr"),f=c(d,"bin"),p=c(d,"share");S(f,{recursive:!0}),S(p,{recursive:!0});let l=c(p,i.toLowerCase());S(l,{recursive:!0});let u=h("fs").readdirSync(e);for(let w of u)P(c(e,w),c(l,w));let b=`#!/bin/bash
1087
+ `;b("fs").writeFileSync(c(p,"control"),y);let T=_("dpkg-deb",["--build",d,r]);T.on("close",(x)=>{if(ce(o),x===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${x}`})}),T.on("error",(x)=>{ce(o),t({success:!1,error:x.message})})}catch(d){ce(o),t({success:!1,error:d.message})}})}async function qe(e,r,i,n){return new Promise((s)=>{let t=Ze("appimage");try{let o=c(t,`${i}.AppDir`),d=c(o,"usr"),p=c(d,"bin"),u=c(d,"share");C(p,{recursive:!0}),C(u,{recursive:!0});let l=c(u,i.toLowerCase());C(l,{recursive:!0});let g=b("fs").readdirSync(e);for(let x of g)I(c(e,x),c(l,x));let m=`#!/bin/bash
1089
1088
  SELF=$(readlink -f "$0")
1090
1089
  HERE=\${SELF%/*}
1091
1090
  export PATH="\${HERE}/usr/bin:\${PATH}"
1092
1091
  exec "\${HERE}/usr/share/${i.toLowerCase()}/${i.toLowerCase()}" "$@"
1093
- `;h("fs").writeFileSync(c(o,"AppRun"),b),I(c(o,"AppRun"),493);let g=`[Desktop Entry]
1092
+ `;b("fs").writeFileSync(c(o,"AppRun"),m),B(c(o,"AppRun"),493);let h=`[Desktop Entry]
1094
1093
  Type=Application
1095
1094
  Name=${i}
1096
1095
  Exec=${i.toLowerCase()}
1097
1096
  Terminal=false
1098
1097
  Categories=Utility;
1099
1098
  Icon=${i.toLowerCase()}
1100
- `;h("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),g);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(h("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&z(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(w)=>{if(oe(t),w===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${w}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(w)=>{oe(t),s({success:!1,error:`appimagetool not found: ${w.message}`})})}catch(o){oe(t),s({success:!1,error:o.message})}})}function Ma(){return[q()]}function Da(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var qe={buildNative:Oa,getAvailableTargets:Ma,getAvailableFormats:Da,detectPlatform:q},Mh=qe;
1101
- export{ku,Ra,Ph,Ih,Aa,To,ns,Pa,Ia,Oh,Nh,Oa,Na,Ma,Da,Mh};
1099
+ `;b("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),h);let y=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(b("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),y),n.icon&&z(n.icon))I(n.icon,c(o,`${i.toLowerCase()}.png`));let T=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});T.on("close",(x)=>{if(ce(t),x===0)B(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${x}. Install from https://appimage.github.io/appimagetool/`})}),T.on("error",(x)=>{ce(t),s({success:!1,error:`appimagetool not found: ${x.message}`})})}catch(o){ce(t),s({success:!1,error:o.message})}})}function Ba(){return[q()]}function Fa(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var Ae={buildNative:La,getAvailableTargets:Ba,getAvailableFormats:Fa,detectPlatform:q},Bh=Ae;
1100
+ export{Tu,Oa,Mh,Dh,Na,Ao,os,Ma,Da,Lh,jh,La,ja,Ba,Fa,Bh};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{T}from"./chunk-9xr628ew.js";import{qe,Pn}from"./chunk-jh2v1vvb.js";function m(e){let t={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return t[e]||t["network-first"]}function g(e){return m(e).className}function d(e){let t=e.pwa;if(!t?.enabled)return"";let r=t.routes||[],n=t.cacheStorage,c=[];for(let a of r){let i=g(a.strategy),s=[];if(a.maxAgeSeconds||a.maxEntries||n?.maxEntries){let o=a.maxEntries||n?.maxEntries||100,u=a.maxAgeSeconds||(n?.maxAge?n.maxAge*24*60*60:void 0);s.push(`new ExpirationPlugin({
2
+ import{A}from"./chunk-bwdbj60y.js";import{Xe,Nn}from"./chunk-mrh08821.js";function m(e){let t={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return t[e]||t["network-first"]}function g(e){return m(e).className}function d(e){let t=e.pwa;if(!t?.enabled)return"";let r=t.routes||[],n=t.cacheStorage,c=[];for(let a of r){let i=g(a.strategy),s=[];if(a.maxAgeSeconds||a.maxEntries||n?.maxEntries){let o=a.maxEntries||n?.maxEntries||100,u=a.maxAgeSeconds||(n?.maxAge?n.maxAge*24*60*60:void 0);s.push(`new ExpirationPlugin({
3
3
  maxEntries: ${o},
4
4
  ${u?`maxAgeSeconds: ${u},`:""}
5
5
  purgeOnQuotaError: true,
@@ -17,7 +17,7 @@ registerRoute(
17
17
  ],`:""}
18
18
  })
19
19
  );`)}return c.join(`
20
- `)}function p(e){if(e.startsWith("*.")){let t=e.slice(2);return`({ request }) => request.destination === '${f(t)}'`}if(e.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${e.slice(0,-3)}')`;if(e.endsWith("/*")){let t=e.slice(0,-2);return`({ url }) => url.pathname.startsWith('${t}') && !url.pathname.slice(${t.length+1}).includes('/')`}if(e.includes("*")&&!e.startsWith("*")){let[t,r]=e.split("*");return`({ url }) => url.pathname.startsWith('${t}') && url.pathname.endsWith('${r}')`}if(e==="/"||!e.includes("*"))return`({ url }) => url.pathname === '${e}'`;return`new RegExp('${x(e).replace(/\\\*/g,".*")}')`}function f(e){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[e.toLowerCase()]||"empty"}function h(e){return"stx-"+e.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b(e,t){let r=e.pwa;if(!r?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let n=r.serviceWorker||{},c=r.routes||[],a=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],i=new Set;for(let o of c)i.add(g(o.strategy));if(i.size>0)a.push({name:"workbox-strategies",exports:Array.from(i)});if(c.some((o)=>o.maxAgeSeconds||o.maxEntries)||r.cacheStorage)a.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(c.some((o)=>o.strategy==="network-first"||o.strategy==="stale-while-revalidate"))a.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(r.backgroundSync?.enabled)a.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(n.navigationPreload)a.push({name:"workbox-navigation-preload",exports:["enable"]});let l=t?qe(t,e):void 0;return{mode:"generate",modules:a,precacheManifest:l?.entries,skipWaiting:n.skipWaiting??!0,clientsClaim:n.clientsClaim??!0,offlineFallback:r.offline?.enabled?"/offline.html":void 0,navigationPreload:n.navigationPreload??!1,cacheVersion:n.cacheVersion||"1.0.0"}}function W(e,t){let r=e.pwa;if(!r?.enabled)return"";let n=b(e,t),c=r.serviceWorker||{},{push:a,backgroundSync:i}=r,s=t?qe(t,e):null,l=s?Pn(s):"[]",o=k(n.modules),u=d(e);return`/**
20
+ `)}function p(e){if(e.startsWith("*.")){let t=e.slice(2);return`({ request }) => request.destination === '${f(t)}'`}if(e.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${e.slice(0,-3)}')`;if(e.endsWith("/*")){let t=e.slice(0,-2);return`({ url }) => url.pathname.startsWith('${t}') && !url.pathname.slice(${t.length+1}).includes('/')`}if(e.includes("*")&&!e.startsWith("*")){let[t,r]=e.split("*");return`({ url }) => url.pathname.startsWith('${t}') && url.pathname.endsWith('${r}')`}if(e==="/"||!e.includes("*"))return`({ url }) => url.pathname === '${e}'`;return`new RegExp('${x(e).replace(/\\\*/g,".*")}')`}function f(e){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[e.toLowerCase()]||"empty"}function h(e){return"stx-"+e.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b(e,t){let r=e.pwa;if(!r?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let n=r.serviceWorker||{},c=r.routes||[],a=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],i=new Set;for(let o of c)i.add(g(o.strategy));if(i.size>0)a.push({name:"workbox-strategies",exports:Array.from(i)});if(c.some((o)=>o.maxAgeSeconds||o.maxEntries)||r.cacheStorage)a.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(c.some((o)=>o.strategy==="network-first"||o.strategy==="stale-while-revalidate"))a.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(r.backgroundSync?.enabled)a.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(n.navigationPreload)a.push({name:"workbox-navigation-preload",exports:["enable"]});let l=t?Xe(t,e):void 0;return{mode:"generate",modules:a,precacheManifest:l?.entries,skipWaiting:n.skipWaiting??!0,clientsClaim:n.clientsClaim??!0,offlineFallback:r.offline?.enabled?"/offline.html":void 0,navigationPreload:n.navigationPreload??!1,cacheVersion:n.cacheVersion||"1.0.0"}}function W(e,t){let r=e.pwa;if(!r?.enabled)return"";let n=b(e,t),c=r.serviceWorker||{},{push:a,backgroundSync:i}=r,s=t?Xe(t,e):null,l=s?Nn(s):"[]",o=k(n.modules),u=d(e);return`/**
21
21
  * Service Worker - Generated by stx with Workbox
22
22
  * Cache Version: ${n.cacheVersion}
23
23
  *
@@ -41,7 +41,7 @@ importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox
41
41
  // build's transpiler folds that particular read to a constant, so every
42
42
  // published copy of stx emitted "debug: true" and no app could turn Workbox's
43
43
  // logging off in production however it set NODE_ENV (see ../env.ts).
44
- workbox.setConfig({ debug: ${!T()} });
44
+ workbox.setConfig({ debug: ${!A()} });
45
45
 
46
46
  // Extract modules from workbox global
47
47
  ${o}
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Vr}from"./chunk-6t0xy3wk.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 Vr(e))a.set(i,w)}return g.set(f,{signature:d,standIns:a}),a}export{j as loadWebModules};
2
+ import{qr}from"./chunk-7ayvybdy.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,3 +1,3 @@
1
1
  // @bun
2
- import{Xe,oe,sc}from"./chunk-ypgegzh2.js";import v from"fs";import g from"path";import V from"crypto";var te=[320,640,768,1024,1280,1536,1920],ne=["webp","jpeg"],re=80,T=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function jn(){return await d()!==null}async function ye(){return!0}async function Re(t,e={}){let{widths:a=te,formats:n=ne,quality:r=re,fit:m="cover",placeholder:l="none",outputDir:o=".stx/images",baseUrl:c="/images"}=e,i,h;if(typeof t==="string"){if(h=t,!await Bun.file(t).exists())throw new Zr(`Image not found: ${t}`,"NOT_FOUND");i=await Bun.file(t).arrayBuffer().then((s)=>Buffer.from(s))}else h="buffer-input",i=t;let b=V.createHash("sha256").update(i).digest("hex").slice(0,12),j=await Yr(i),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(o,{recursive:!0});let B=[],A=g.basename(h,g.extname(h)),f=a.filter((s)=>s<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((s,p)=>s-p);for(let s of f){let p=Math.round(s/F);for(let w of n){let S=`${A}-${s}w-${b}.${w}`,P=g.join(o,S),q=`${c}/${S}`,E=await eu(i,{width:s,height:p,format:w,quality:r,fit:m});await Bun.write(P,E),B.push({path:P,url:q,width:s,height:p,format:w,size:E.length})}}let y;if(l!=="none")y=await D(i,l);return{src:h,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function Yr(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let r=await a(e).metadata();return{width:r.width||0,height:r.height||0,format:r.format||"unknown",hasAlpha:r.hasAlpha}}return L(e)}function L(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let r=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:r,format:"jpeg",hasAlpha:!1}}let n=t.readUInt16BE(e+2);e+=2+n}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,n=t.readUInt16LE(28)&16383;return{width:a,height:n,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),n=(a&16383)+1,r=(a>>14&16383)+1;return{width:n,height:r,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new Zr("Unable to parse image dimensions","PARSE_ERROR")}async function eu(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}let{processImage:n}=await import("ts-images");return await sc("img",async(r)=>{let m=g.join(r,`out.${e.format}`);return await n({input:t,output:m,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(m).arrayBuffer())})}async function D(t,e){let a=await d();if(e==="blur"&&a){let c=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),i=await Yr(t);return`data:${U[i.format]||"image/jpeg"};base64,${c}`}if(e==="dominant-color"&&a){let{dominant:o}=await a(t).resize(1,1).toBuffer().then(async(c)=>{let i=await a(c).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${o.r}, ${o.g}, ${o.b})`}let{generatePlaceholder:n}=await import("ts-images"),r=await Yr(t),m=Xe("ph"),l=g.join(m,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(l,t);let o=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",i=await n(l,{strategy:o,width:o==="thumbhash"?void 0:32});if(e==="dominant-color"&&i.dominantColor)return i.dominantColor;if(i.dataURL)return i.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{oe(m)}}function yt(t,e){return(e?t.filter((n)=>n.format===e):t).sort((n,r)=>n.width-r.width).map((n)=>`${n.url} ${n.width}w`).join(", ")}function Zt(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,n)=>{let r=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(n[0].replace(/\D/g,""))||0)-r}).map(([a,n])=>`(max-width: ${a}) ${n}`).join(", ")+", 100vw"}function Bn(t){let e=t.filter((n)=>n.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((n,r)=>n.width-r.width);return a[Math.floor(a.length/2)]}function Fn(t){let e=new Map;for(let a of t){let n=e.get(a.format)||[];n.push(a),e.set(a.format,n)}return e}function zn(t){let e=g.extname(t).toLowerCase();return T.includes(e)}function se(t){return U[t]||"application/octet-stream"}function Hn(t){return t.reduce((e,a)=>e+a.size,0)}function Vn(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class Zr extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
3
- export{te,ne,re,jn,ye,Re,Yr,eu,yt,Zt,Bn,Fn,zn,se,Hn,Vn,Zr};
2
+ import{Ze,ce,cc}from"./chunk-vvzys1x7.js";import v from"fs";import g from"path";import V from"crypto";var se=[320,640,768,1024,1280,1536,1920],oe=["webp","jpeg"],ie=80,T=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function zn(){return await d()!==null}async function ve(){return!0}async function Ie(t,e={}){let{widths:a=se,formats:n=oe,quality:r=ie,fit:m="cover",placeholder:l="none",outputDir:o=".stx/images",baseUrl:c="/images"}=e,i,h;if(typeof t==="string"){if(h=t,!await Bun.file(t).exists())throw new ts(`Image not found: ${t}`,"NOT_FOUND");i=await Bun.file(t).arrayBuffer().then((s)=>Buffer.from(s))}else h="buffer-input",i=t;let b=V.createHash("sha256").update(i).digest("hex").slice(0,12),j=await es(i),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(o,{recursive:!0});let B=[],A=g.basename(h,g.extname(h)),f=a.filter((s)=>s<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((s,p)=>s-p);for(let s of f){let p=Math.round(s/F);for(let w of n){let S=`${A}-${s}w-${b}.${w}`,P=g.join(o,S),q=`${c}/${S}`,E=await su(i,{width:s,height:p,format:w,quality:r,fit:m});await Bun.write(P,E),B.push({path:P,url:q,width:s,height:p,format:w,size:E.length})}}let y;if(l!=="none")y=await D(i,l);return{src:h,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function es(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let r=await a(e).metadata();return{width:r.width||0,height:r.height||0,format:r.format||"unknown",hasAlpha:r.hasAlpha}}return L(e)}function L(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let r=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:r,format:"jpeg",hasAlpha:!1}}let n=t.readUInt16BE(e+2);e+=2+n}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,n=t.readUInt16LE(28)&16383;return{width:a,height:n,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),n=(a&16383)+1,r=(a>>14&16383)+1;return{width:n,height:r,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new ts("Unable to parse image dimensions","PARSE_ERROR")}async function su(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}let{processImage:n}=await import("ts-images");return await cc("img",async(r)=>{let m=g.join(r,`out.${e.format}`);return await n({input:t,output:m,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(m).arrayBuffer())})}async function D(t,e){let a=await d();if(e==="blur"&&a){let c=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),i=await es(t);return`data:${U[i.format]||"image/jpeg"};base64,${c}`}if(e==="dominant-color"&&a){let{dominant:o}=await a(t).resize(1,1).toBuffer().then(async(c)=>{let i=await a(c).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${o.r}, ${o.g}, ${o.b})`}let{generatePlaceholder:n}=await import("ts-images"),r=await es(t),m=Ze("ph"),l=g.join(m,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(l,t);let o=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",i=await n(l,{strategy:o,width:o==="thumbhash"?void 0:32});if(e==="dominant-color"&&i.dominantColor)return i.dominantColor;if(i.dataURL)return i.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{ce(m)}}function vt(t,e){return(e?t.filter((n)=>n.format===e):t).sort((n,r)=>n.width-r.width).map((n)=>`${n.url} ${n.width}w`).join(", ")}function tn(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,n)=>{let r=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(n[0].replace(/\D/g,""))||0)-r}).map(([a,n])=>`(max-width: ${a}) ${n}`).join(", ")+", 100vw"}function Hn(t){let e=t.filter((n)=>n.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((n,r)=>n.width-r.width);return a[Math.floor(a.length/2)]}function Vn(t){let e=new Map;for(let a of t){let n=e.get(a.format)||[];n.push(a),e.set(a.format,n)}return e}function Un(t){let e=g.extname(t).toLowerCase();return T.includes(e)}function ae(t){return U[t]||"application/octet-stream"}function Wn(t){return t.reduce((e,a)=>e+a.size,0)}function qn(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class ts extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
3
+ export{se,oe,ie,zn,ve,Ie,es,su,vt,tn,Hn,Vn,Un,ae,Wn,qn,ts};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var d=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],u=/<body\b([^>]*)>/gi;function B(n){let i=0,e,c=d.map(()=>{return});while(i<n.length){if(e===void 0||e!==null&&e.index<i)u.lastIndex=i,e=u.exec(n);if(!e)return null;let a=e.index,r=-1,o=null;for(let l=0;l<d.length;l++){let g=d[l],t=c[l];if(t===void 0||t!==null&&t.index<i)g.open.lastIndex=i,t=g.open.exec(n),c[l]=t;if(!t)continue;if(t.index<a&&(r===-1||t.index<r))r=t.index,o=g.close}if(r===-1||!o)return{index:a,tag:e[0],attrs:e[1]??""};o.lastIndex=r;let s=o.exec(n);if(!s)return null;i=s.index+s[0].length}return null}function Qe(n,i){let e=B(n);if(!e)return n;return n.slice(0,e.index)+i(e.tag,e.attrs)+n.slice(e.index+e.tag.length)}
3
- export{B,Qe};
2
+ var d=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],u=/<body\b([^>]*)>/gi;function H(n){let i=0,e,c=d.map(()=>{return});while(i<n.length){if(e===void 0||e!==null&&e.index<i)u.lastIndex=i,e=u.exec(n);if(!e)return null;let a=e.index,r=-1,o=null;for(let l=0;l<d.length;l++){let g=d[l],t=c[l];if(t===void 0||t!==null&&t.index<i)g.open.lastIndex=i,t=g.open.exec(n),c[l]=t;if(!t)continue;if(t.index<a&&(r===-1||t.index<r))r=t.index,o=g.close}if(r===-1||!o)return{index:a,tag:e[0],attrs:e[1]??""};o.lastIndex=r;let s=o.exec(n);if(!s)return null;i=s.index+s[0].length}return null}function nt(n,i){let e=H(n);if(!e)return n;return n.slice(0,e.index)+i(e.tag,e.attrs)+n.slice(e.index+e.tag.length)}
3
+ export{H,nt};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$u,Po,er,Ru,Au,Pu,Iu,Ou,Nu,Mu,Du,Lu,ju,Bu,Fu,zu,Hu,Vu,Uu,Wu,qu,Ku,Gu,Xu,Ju,Yu,Zu,Qu,ed,td,nd,rd,sd,od,id,ad,cd,ld,ud,dd,pd,fd,gd,md,hd,yd,bd,wd,rn,za,vd,xd,Sd,Ha,kd,_d,Cd,Ed,Td,$d,Va,Rd,Ad,Pd,Id,Od,Nd,Md,Dd,Ld,tr,jd,Bd,Fd,zd,Hd,Vd,Ud,Wd,qd,Kd,Gd,Xd,Io,Jd,Yd,Zd,Qd,ep,is,as,tp,np,rp,sp,op,Ua,ip,ap,cp,Wa,Oo,lp,up,qa,Ka,cs,Ga,dp,sn,pp,Xa,Ja,No,fp,Mo,gp,mp,hp,yp,bp,wp,vp,Ya,xp,Sp,Za,kp,_p,Cp,Ep,Tp,$p,Rp,Ap,Pp,Ip,Op,Np,Mp,Dp,Lp,jp,Bp,Fp,zp,Hp,Vp,Up,Wp,qp,Qa,Kp,Gp,Xp,Jp,Yp,Zp,Qp,ef,tf,nf,rf,nr,ec,tc,sf,rr,of,af,cf,nc,rc,ls,us,lf,Do,uf,df,pf,ff,gf,mf,hf,yf,bf,wf,vf,xf,Sf,kf,_f,Cf,Ef,Tf,$f,Rf,sc,Af,Pf,oc,ic,If,Of}from"./chunk-8502xb4n.js";export{bd as AVAILABLE_COMPONENTS,Ua as AutoUpdater,wd as COMPONENT_STYLES,ls as DEFAULT_WATCH_INTERVAL_MS,rc as MAX_WATCH_INTERVAL_MS,nc as MIN_WATCH_INTERVAL_MS,$d as MODAL_STYLES,Lu as TOAST_STYLES,Md as TRAY_MENU_STYLES,qa as UPDATE_MANIFEST_ASSET,_d as alert,Vp as appInfo,mf as appleScript,Of as applicationDataDirectory,gf as audio,Pf as backgroundDelay,Bp as battery,ff as biometric,nf as bluetooth,vf as bonjour,sn as bundlePathForExecutable,fp as caffeinate,ip as canReplaceBundle,ap as clearQuarantine,Ap as clipboard,Td as closeAllModals,Xd as closeAllWindows,kd as confirm,qp as contextMenu,Ef as continuityCamera,Cf as coreml,sp as craftBinaryNotFoundMessage,Io as craftWindowArguments,nr as crashReporter,id as createAccordion,Qu as createAutocomplete,Uu as createAvatar,Vu as createBadge,ju as createButton,Wu as createCard,fd as createChart,Fu as createCheckbox,nd as createChip,gd as createCodeEditor,Ju as createColorPicker,pd as createDataGrid,Yu as createDatePicker,as as createDiskImage,Ku as createDropdown,hd as createFileExplorer,dp as createGitHubUpdateManifest,Ga as createGitHubUpdater,td as createImageView,Ep as createInterval,ed as createLabel,ld as createListView,md as createMediaPlayer,Rd as createMenubar,cd as createModalComponent,If as createNativeUpdateApi,ic as createPantrySelfUpdater,bp as createPreferences,Hu as createProgressBar,Xu as createRadioButton,Gu as createRating,sd as createScrollView,No as createSelfUpdater,zu as createSlider,od as createSplitView,ad as createStepper,Va as createSystemTray,ud as createTable,qu as createTabs,Bu as createTextInput,Zu as createTimePicker,Cp as createTimer,rd as createTooltip,dd as createTreeView,yd as createWebView,Jd as createWindow,Zd as createWindowWithHTML,Mo as decaffeinate,jp as deepLinks,Tp as delay,Nu as dismissAlertById,Mu as dismissAllAlerts,Dp as dragOut,cp as extractBundle,hf as fileAssociations,Do as focus,df as focusShortcutsReady,Rp as formatCompact,yp as formatDuration,hp as formatRemainingTime,xp as formatShortcut,$p as formatTime,Ip as fs,Wa as generateUpdateManifest,Du as getActiveAlertCount,Ed as getActiveModalCount,Ad as getActiveTrayInstances,Kd as getActiveWindowIds,mp as getCaffeinateStatus,Rf as getCapabilities,sc as getCapability,Wd as getDesktopConfig,Vd as getDialogBridgeScript,_p as getRegisteredHotkeys,Od as getSimulatedTrayHTML,Nd as getTrayBridgeScript,Pd as getTrayInstance,Gd as getWindow,ep as getWindowBridgeScript,Ka as githubLatestAssetUrl,cs as githubReleaseAssetUrl,Np as globalShortcuts,rr as handoff,uf as hasFocusShortcuts,sf as iap,vp as isAutoLaunchEnabled,Af as isAvailable,gp as isCaffeinated,Lp as isDragOutAvailable,Qd as isWebviewAvailable,Xp as keychain,of as liveActivities,pf as localServer,af as location,wf as log,tp as macOSRuntimeExecutablePath,Wp as menu,_f as midi,Zp as nativeAutoLaunch,Qp as nativeTray,ef as nativeWindow,Fp as network,Pp as notifications,Ou as notify,Yd as openDevWindow,np as pack,rp as packageApp,oc as parsePantryUpdateManifest,Ya as parseShortcut,bf as pdf,Jp as permissions,Yp as printing,Cd as prompt,Xa as quitLauncher,Oo as readBundleIdentity,ec as redactPII,Sp as registerHotkey,Ja as relaunchBundle,$u as requestNotificationPermission,qd as resetDesktopConfig,op as resolveCraftBinary,is as resolveCraftExecutablePath,pp as runningBundleTeamId,Gp as screen,cf as screenCapture,us as screenSharing,$f as serial,Tf as serviceMenu,wp as setAutoLaunch,Ud as setDesktopConfig,Op as shell,Po as showAlert,Bd as showAlertDialog,jd as showColorPicker,Fd as showConfirmDialog,zd as showErrorDialog,xd as showErrorModal,Iu as showErrorToast,za as showInfoModal,Ru as showInfoToast,tr as showMessageBox,rn as showModal,Dd as showOpenDialog,Ha as showQuestionModal,Ld as showSaveDialog,Sd as showSuccessModal,Au as showSuccessToast,er as showToast,Hd as showWarningDialog,vd as showWarningModal,Pu as showWarningToast,Qa as sidebar,tc as signPayload,rf as speech,Sf as speechRecognition,xf as spotlight,Up as standardMenus,lp as swapBundle,Kp as system,yf as tags,Mp as theme,tf as touchbar,Id as triggerTrayAction,kp as unregisterAllHotkeys,Za as unregisterHotkey,zp as updater,up as verifyBundleTrust,kf as vision,lf as watchScreenSharing,Hp as windowEvents};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ var b=import.meta.require;
3
+ export{b};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{wm}from"./chunk-2rff5mbj.js";import"./chunk-vfx1p83g.js";import"./chunk-7mpqfg98.js";import"./chunk-2srjavsn.js";import"./chunk-n058hznh.js";import"./chunk-321fbxnm.js";import"./chunk-4ykgjewy.js";import"./chunk-2dpessnc.js";import"./chunk-q1wxgw5s.js";import"./chunk-srgpz94e.js";import"./chunk-24hq8mka.js";import"./chunk-dhnw2qwq.js";import"./chunk-xymr4ys9.js";import"./chunk-fnxg6134.js";import"./chunk-0c9c9v03.js";import"./chunk-zsnmk5me.js";import"./chunk-2s7rmn9r.js";import"./chunk-4xanjv22.js";import"./chunk-adb045wf.js";import"./chunk-tnp2ta5q.js";import"./chunk-669b2bya.js";import"./chunk-mfa07erx.js";import"./chunk-x512h2gv.js";import"./chunk-2kfayg4t.js";import"./chunk-0fh47gp0.js";import"./chunk-k32q90b2.js";import"./chunk-qa5y30sy.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{wm as buildForProduction};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Fl,zl}from"./chunk-eeq8k81z.js";import"./chunk-v37zmez0.js";import"./chunk-2jgtfjyr.js";import"./chunk-s0sad753.js";import"./chunk-dydy9zrq.js";import"./chunk-dtarm8x9.js";import"./chunk-mcnwvh06.js";import"./chunk-ymjjn9pw.js";import"./chunk-2rff5mbj.js";import"./chunk-vfx1p83g.js";import"./chunk-6ftee542.js";import"./chunk-gd56arnm.js";import"./chunk-ew5cey88.js";import"./chunk-bz6dg4k8.js";import"./chunk-8me8hamk.js";import"./chunk-ysfeg3cn.js";import"./chunk-gp8hgpt9.js";import"./chunk-55zq2ha8.js";import"./chunk-hev4t4d5.js";import"./chunk-1mqcttg3.js";import"./chunk-kwk3kxrx.js";import"./chunk-mjy98ppb.js";import"./chunk-qcxrcypb.js";import"./chunk-gbtbfg7e.js";import"./chunk-cqhwzd9y.js";import"./chunk-j1efsjsb.js";import"./chunk-6m63rc7m.js";import"./chunk-bwz2ehq9.js";import"./chunk-7mpqfg98.js";import"./chunk-c34qn4k8.js";import"./chunk-vvzys1x7.js";import"./chunk-v4xes880.js";import{an}from"./chunk-2srjavsn.js";import{Ff}from"./chunk-hdjn7nw9.js";import"./chunk-n058hznh.js";import"./chunk-9zrvh3pz.js";import{Ne,i}from"./chunk-321fbxnm.js";import"./chunk-4ykgjewy.js";import"./chunk-2dpessnc.js";import"./chunk-q1wxgw5s.js";import"./chunk-srgpz94e.js";import"./chunk-24hq8mka.js";import"./chunk-dhnw2qwq.js";import"./chunk-xymr4ys9.js";import"./chunk-fnxg6134.js";import{_e}from"./chunk-0c9c9v03.js";import"./chunk-zsnmk5me.js";import{hr,yr}from"./chunk-2s7rmn9r.js";import{$s,V,a}from"./chunk-4xanjv22.js";import"./chunk-adb045wf.js";import"./chunk-tnp2ta5q.js";import"./chunk-669b2bya.js";import"./chunk-mfa07erx.js";import"./chunk-x512h2gv.js";import{h,He}from"./chunk-2kfayg4t.js";import"./chunk-0fh47gp0.js";import"./chunk-k32q90b2.js";import"./chunk-qa5y30sy.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";import{Ui}from"./chunk-s9df8srx.js";import"./chunk-6m6y9bbx.js";import"./chunk-z512gt4v.js";export{$s as buildWebComponents,yr as cacheTemplate,hr as checkCache,an as classifyAllScripts,Fl as createMiddleware,zl as createRoute,V as defaultConfig,h as extractVariables,_e as injectRouterScript,Ui as insertBeforeBodyClose,a as loadStxConfig,He as processClientScript,i as processDirectives,Ne as readMarkdownFile,Ff as withinBundlerCallback};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-9nh48zvm.js";import"./chunk-fkh4xece.js";import"./chunk-xppm4cs4.js";import"./chunk-b1kc0ka1.js";import"./chunk-5rxks14t.js";import"./chunk-wjamjgx6.js";import"./chunk-2sq9pdg3.js";import"./chunk-hf9pvmq2.js";import{c}from"./chunk-7trdtz0c.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
2
+ import"./chunk-qa5y30sy.js";import"./chunk-qjey0jk6.js";import"./chunk-farh4p7f.js";import"./chunk-2kfayg4t.js";import"./chunk-k32q90b2.js";import"./chunk-0fh47gp0.js";import"./chunk-tnp2ta5q.js";import"./chunk-adb045wf.js";import{l}from"./chunk-46pxmpeb.js";import u from"fs";import m from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||l(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=m.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),c=JSON.parse(p);if(c.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(c.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
3
3
  `)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- function t(n){if(!n||typeof n!=="object")return!1;let i=n;return typeof i.message==="string"&&(i.name==="BuildMessage"||i.name==="ResolveMessage"||("position"in i))}function o(n){if(n&&typeof n==="object"&&Array.isArray(n.errors))return n.errors;return[n]}function sr(n,i){let e=[];for(let r of o(n)){if(t(r)){let s=r.position||void 0;e.push({file:i||s?.file,line:s?.line,column:s?.column,message:r.message??"",lineText:s?.lineText});continue}e.push({file:i,message:r instanceof Error?r.message:String(r)})}return e}function Ae(n,i){return sr(n,i).map((e)=>{let r=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",s=e.lineText?`
2
+ function t(n){if(!n||typeof n!=="object")return!1;let i=n;return typeof i.message==="string"&&(i.name==="BuildMessage"||i.name==="ResolveMessage"||("position"in i))}function o(n){if(n&&typeof n==="object"&&Array.isArray(n.errors))return n.errors;return[n]}function ar(n,i){let e=[];for(let r of o(n)){if(t(r)){let s=r.position||void 0;e.push({file:i||s?.file,line:s?.line,column:s?.column,message:r.message??"",lineText:s?.lineText});continue}e.push({file:i,message:r instanceof Error?r.message:String(r)})}return e}function Oe(n,i){return ar(n,i).map((e)=>{let r=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",s=e.lineText?`
3
3
  ${e.lineText.trim()}`:"";return r?`${r}: ${e.message}${s}`:`${e.message}${s}`}).join(`
4
- `)}export{sr,Ae};
4
+ `)}export{ar,Oe};