@stacksjs/stx 0.2.858 → 0.2.861

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 (218) hide show
  1. package/dist/body-close.d.ts +13 -0
  2. package/dist/body-close.js +8 -0
  3. package/dist/{chunk-s322kcw7.js → chunk-02css3vk.js} +5 -5
  4. package/dist/chunk-0hqr6bff.js +2 -0
  5. package/dist/{chunk-wskdnfh9.js → chunk-121cgm3s.js} +4 -4
  6. package/dist/{chunk-eazccp6e.js → chunk-15jymk6t.js} +2 -2
  7. package/dist/{chunk-qvwzaxdd.js → chunk-15rkvc0t.js} +4 -4
  8. package/dist/chunk-15sgdvyd.js +2 -0
  9. package/dist/{chunk-7fgfzaah.js → chunk-1jwcp2k0.js} +2 -2
  10. package/dist/{chunk-jdqmk5sv.js → chunk-261t62q4.js} +63 -63
  11. package/dist/chunk-2b4a8tbd.js +3 -0
  12. package/dist/chunk-2fw36w1x.js +2 -0
  13. package/dist/chunk-2jcxsw75.js +2 -0
  14. package/dist/{chunk-6d74qdc6.js → chunk-2pbhdaka.js} +1 -1
  15. package/dist/chunk-2wba5ypm.js +2 -0
  16. package/dist/chunk-353gnvfe.js +2 -0
  17. package/dist/{chunk-ff3j7jnf.js → chunk-36vksrry.js} +2 -2
  18. package/dist/{chunk-m2rm2gxv.js → chunk-37tefp7s.js} +5 -5
  19. package/dist/{chunk-1z2am28h.js → chunk-38qp2pg2.js} +2 -2
  20. package/dist/chunk-3cr5y8v1.js +2 -0
  21. package/dist/{chunk-jwwsxym6.js → chunk-3gfd9t8a.js} +2 -2
  22. package/dist/{chunk-zn9dp7yn.js → chunk-3wg9kr5z.js} +5 -5
  23. package/dist/chunk-3y7yp0ka.js +2 -0
  24. package/dist/chunk-41wwqw0q.js +2 -0
  25. package/dist/chunk-4a1y51fs.js +2 -0
  26. package/dist/chunk-4a751brg.js +2 -0
  27. package/dist/{chunk-cqkr291c.js → chunk-4jgcd4d9.js} +5 -5
  28. package/dist/{chunk-kedgfk9z.js → chunk-4rrxrxp6.js} +4 -4
  29. package/dist/chunk-5awhm4na.js +2 -0
  30. package/dist/chunk-5fhp9hxd.js +2 -0
  31. package/dist/{chunk-q93jcdgj.js → chunk-5ka3h8dy.js} +12 -12
  32. package/dist/chunk-5mg443dw.js +2 -0
  33. package/dist/{chunk-e8we717q.js → chunk-5n7m8vqx.js} +2 -2
  34. package/dist/{chunk-kq3h2rjq.js → chunk-5neezkj1.js} +4 -4
  35. package/dist/{chunk-6qbha6fb.js → chunk-5q4tncfw.js} +6 -6
  36. package/dist/{chunk-sny8rqe8.js → chunk-5rxks14t.js} +2 -2
  37. package/dist/chunk-5x9ajbq0.js +2 -0
  38. package/dist/{chunk-az9b4bj4.js → chunk-5xdkmn39.js} +2 -2
  39. package/dist/{chunk-fw50vydb.js → chunk-65cbfx5x.js} +2 -2
  40. package/dist/{chunk-tk67pqaf.js → chunk-68w65mhs.js} +3 -3
  41. package/dist/chunk-6g7tkmty.js +2 -0
  42. package/dist/{chunk-1347hwt5.js → chunk-6nb49h13.js} +40 -40
  43. package/dist/{chunk-e7thwrt5.js → chunk-6tp0w6hf.js} +2 -2
  44. package/dist/chunk-72bj7ea4.js +2 -0
  45. package/dist/{chunk-jwtp4csj.js → chunk-74g64pzt.js} +4 -4
  46. package/dist/{chunk-78amng8s.js → chunk-76360zky.js} +6 -6
  47. package/dist/{chunk-gz0j98dy.js → chunk-7bajrfb1.js} +4 -4
  48. package/dist/{chunk-rq9pqd4s.js → chunk-7de5y29a.js} +5 -5
  49. package/dist/{chunk-jafn7f7f.js → chunk-7yhhwv07.js} +2 -2
  50. package/dist/chunk-811hh6vp.js +2 -0
  51. package/dist/{chunk-0z2gqttt.js → chunk-830ej8d2.js} +12 -12
  52. package/dist/chunk-8fkmxrat.js +2 -0
  53. package/dist/{chunk-gjbnzn7k.js → chunk-8hck9qqm.js} +4 -4
  54. package/dist/chunk-8p9npc8y.js +2 -0
  55. package/dist/chunk-9fz3h6sx.js +2 -0
  56. package/dist/chunk-9jr30fns.js +2 -0
  57. package/dist/{chunk-e763qsg0.js → chunk-9pyvc0dc.js} +2 -2
  58. package/dist/{chunk-3b7q7d7j.js → chunk-9syvkm5z.js} +6 -6
  59. package/dist/{chunk-ym5qgw03.js → chunk-9xr628ew.js} +2 -2
  60. package/dist/{chunk-k19ba3jz.js → chunk-a6d92kv6.js} +2 -2
  61. package/dist/chunk-a9m6ajd7.js +2 -0
  62. package/dist/{chunk-mxazxwc4.js → chunk-aj6vqdf7.js} +3 -3
  63. package/dist/chunk-asr5v51s.js +2 -0
  64. package/dist/{chunk-252enthj.js → chunk-avp271q4.js} +1 -1
  65. package/dist/{chunk-8623gte8.js → chunk-b1tctqn5.js} +6 -6
  66. package/dist/{chunk-71s4hpkj.js → chunk-b7nmgkwa.js} +3 -3
  67. package/dist/{chunk-fxk1psd8.js → chunk-bag9q4m0.js} +30 -30
  68. package/dist/{chunk-0vptj943.js → chunk-bg0ywp5w.js} +2 -2
  69. package/dist/{chunk-g8d24rfk.js → chunk-bv14vry8.js} +2 -2
  70. package/dist/chunk-byx82s10.js +2 -0
  71. package/dist/{chunk-smve11g0.js → chunk-c2w4wc9f.js} +1 -1
  72. package/dist/chunk-c9y1g61m.js +2 -0
  73. package/dist/chunk-ck5nzbbv.js +2 -0
  74. package/dist/{chunk-mh45hcsa.js → chunk-cq2hedwn.js} +6 -6
  75. package/dist/chunk-cvdm0hgq.js +2 -0
  76. package/dist/{chunk-27zp4q77.js → chunk-cxpq2zna.js} +1 -1
  77. package/dist/{chunk-y67r0d0c.js → chunk-d6216bcw.js} +4 -4
  78. package/dist/{chunk-pa8xkctc.js → chunk-dba4bwkd.js} +6 -6
  79. package/dist/{chunk-3evwxrpx.js → chunk-dt73ww6m.js} +1 -1
  80. package/dist/chunk-e0fxgbcc.js +2 -0
  81. package/dist/{chunk-z703xzhy.js → chunk-e8nzbz66.js} +2 -2
  82. package/dist/chunk-ed2m6pjf.js +2 -0
  83. package/dist/chunk-ednwdhv0.js +2 -0
  84. package/dist/chunk-egtphftq.js +2 -0
  85. package/dist/{chunk-bhzh7mj1.js → chunk-eye156nv.js} +1 -1
  86. package/dist/chunk-fahqq7c4.js +2 -0
  87. package/dist/chunk-fcbpzdyz.js +2 -0
  88. package/dist/{chunk-4h9kkkh7.js → chunk-fpkp0bqf.js} +1 -1
  89. package/dist/{chunk-tpw435g0.js → chunk-fyfvqd2s.js} +2 -2
  90. package/dist/{chunk-xz1csyq9.js → chunk-gc79s0wh.js} +10 -10
  91. package/dist/{chunk-hjh5wt5f.js → chunk-gggadrs4.js} +3 -3
  92. package/dist/{chunk-nv5xhfwz.js → chunk-gjnrmz2q.js} +2 -2
  93. package/dist/{chunk-fbnykfnv.js → chunk-gp1dt8b8.js} +3 -3
  94. package/dist/{chunk-jgvwzt1t.js → chunk-gx96hctv.js} +2 -2
  95. package/dist/chunk-h0dsxxz4.js +2 -0
  96. package/dist/{chunk-wd4z5w4d.js → chunk-h2cvfp9y.js} +1 -1
  97. package/dist/{chunk-egwtv5hp.js → chunk-h4aqpf2r.js} +3 -3
  98. package/dist/{chunk-4ezfen91.js → chunk-hyea17hp.js} +69 -69
  99. package/dist/{chunk-admnvsmx.js → chunk-jh2v1vvb.js} +2 -2
  100. package/dist/chunk-k3yym9zg.js +2 -0
  101. package/dist/chunk-k9fsd6t3.js +2 -0
  102. package/dist/chunk-kepxsjfx.js +2 -0
  103. package/dist/chunk-kh01rvag.js +2 -0
  104. package/dist/{chunk-mzg1wq86.js → chunk-kv40xq53.js} +15 -15
  105. package/dist/{chunk-tjer45j7.js → chunk-m3p4hksq.js} +4 -4
  106. package/dist/chunk-mad172af.js +2 -0
  107. package/dist/{chunk-c7eew8qs.js → chunk-mjkdskeg.js} +1 -1
  108. package/dist/{chunk-qv52et0d.js → chunk-naj146zq.js} +2 -2
  109. package/dist/chunk-npt0mdzb.js +2 -0
  110. package/dist/{chunk-snmq7yn4.js → chunk-nwxjh1gv.js} +3 -3
  111. package/dist/chunk-p95fsnbk.js +2 -0
  112. package/dist/chunk-ptc3yqn3.js +2 -0
  113. package/dist/chunk-pybm7c9p.js +2 -0
  114. package/dist/{chunk-69zj9q02.js → chunk-q6w7a1vc.js} +3 -3
  115. package/dist/{chunk-w7s3afam.js → chunk-qjm23ma2.js} +1 -1
  116. package/dist/chunk-qnx71b17.js +2 -0
  117. package/dist/chunk-qx8cav4w.js +2 -0
  118. package/dist/chunk-rb7cwck6.js +2 -0
  119. package/dist/chunk-s1e0t3hv.js +2 -0
  120. package/dist/chunk-s7vfmasx.js +2 -0
  121. package/dist/{chunk-bxn4b0wm.js → chunk-scwbttvt.js} +2 -2
  122. package/dist/{chunk-ksxbfyef.js → chunk-sxtvy0sm.js} +2 -2
  123. package/dist/chunk-t7z67vf6.js +2 -0
  124. package/dist/chunk-tarvase5.js +2 -0
  125. package/dist/{chunk-qa4vs1qg.js → chunk-thdnk1kd.js} +3 -3
  126. package/dist/{chunk-8cpqcn19.js → chunk-tjz3r7rj.js} +5 -5
  127. package/dist/{chunk-xhvw0t0f.js → chunk-tm201m9x.js} +3 -3
  128. package/dist/chunk-tqs9pcga.js +2 -0
  129. package/dist/chunk-twjfrywv.js +2 -0
  130. package/dist/{chunk-me16tftr.js → chunk-v0wdgxga.js} +1 -1
  131. package/dist/{chunk-bef0wr53.js → chunk-vggtxttf.js} +5 -5
  132. package/dist/chunk-vyna2rsq.js +2 -0
  133. package/dist/chunk-w4gjx2zs.js +18 -0
  134. package/dist/{chunk-fd7e162p.js → chunk-wrbhq1y2.js} +3 -3
  135. package/dist/{chunk-2bks42z4.js → chunk-x69457q9.js} +5 -5
  136. package/dist/chunk-xhe7pw6e.js +2 -0
  137. package/dist/{chunk-d6am6en8.js → chunk-xmy6g81m.js} +1 -1
  138. package/dist/chunk-y86mpnrg.js +2 -0
  139. package/dist/{chunk-3zjyhhg4.js → chunk-yj9nyt93.js} +2 -2
  140. package/dist/{chunk-jtag68hg.js → chunk-z99bf0q0.js} +2 -2
  141. package/dist/chunk-zm0g7ntw.js +2 -0
  142. package/dist/{chunk-5xy1z71a.js → chunk-zpkgs5d3.js} +4 -4
  143. package/dist/chunk-zrm2x65c.js +2 -0
  144. package/dist/{chunk-va1hj69e.js → chunk-zs4s9fcq.js} +4 -4
  145. package/dist/cli.js +19 -19
  146. package/dist/config.js +11 -1
  147. package/dist/craft-entry.js +2 -2
  148. package/dist/craft.js +2 -2
  149. package/dist/index.d.ts +1 -0
  150. package/dist/index.js +1 -0
  151. package/dist/pwa.js +3 -3
  152. package/dist/render.js +2 -6
  153. package/dist/serve.js +2 -6
  154. package/dist/site-builder/build.js +2 -2
  155. package/dist/site-builder/router.js +2 -5
  156. package/dist/site-builder/theme.js +2 -2
  157. package/dist/ssg.js +4 -4
  158. package/package.json +5 -5
  159. package/dist/chunk-0ts3p84y.js +0 -2
  160. package/dist/chunk-139mxsyc.js +0 -2
  161. package/dist/chunk-1barsha6.js +0 -2
  162. package/dist/chunk-1fnx7ze9.js +0 -2
  163. package/dist/chunk-1g06wfs9.js +0 -2
  164. package/dist/chunk-1nasq00e.js +0 -2
  165. package/dist/chunk-2102tvxh.js +0 -2
  166. package/dist/chunk-39cwa35j.js +0 -2
  167. package/dist/chunk-3rcegvgg.js +0 -2
  168. package/dist/chunk-3wvq28hz.js +0 -2
  169. package/dist/chunk-6m4v1tsq.js +0 -2
  170. package/dist/chunk-75e4wzzs.js +0 -3
  171. package/dist/chunk-7ambc4f7.js +0 -2
  172. package/dist/chunk-8nmc3rh7.js +0 -2
  173. package/dist/chunk-8pn7ah12.js +0 -2
  174. package/dist/chunk-8zwwmnpb.js +0 -2
  175. package/dist/chunk-98bgx3ws.js +0 -2
  176. package/dist/chunk-a4v8z93r.js +0 -2
  177. package/dist/chunk-a58w524e.js +0 -2
  178. package/dist/chunk-a6v6x2pg.js +0 -2
  179. package/dist/chunk-afrqm7w5.js +0 -18
  180. package/dist/chunk-b62mr2kz.js +0 -2
  181. package/dist/chunk-b7vxb2y6.js +0 -2
  182. package/dist/chunk-bb20hnqd.js +0 -2
  183. package/dist/chunk-bc3sknxf.js +0 -2
  184. package/dist/chunk-cbrbrkp1.js +0 -2
  185. package/dist/chunk-d8djpp7f.js +0 -2
  186. package/dist/chunk-dk6t4h48.js +0 -2
  187. package/dist/chunk-dkbm7117.js +0 -2
  188. package/dist/chunk-e44bse67.js +0 -2
  189. package/dist/chunk-ewnfgczq.js +0 -2
  190. package/dist/chunk-f1v5hvbt.js +0 -2
  191. package/dist/chunk-g6epqcb3.js +0 -2
  192. package/dist/chunk-gmvypdm8.js +0 -2
  193. package/dist/chunk-hmgry6dn.js +0 -2
  194. package/dist/chunk-jbv1srnh.js +0 -2
  195. package/dist/chunk-jzynkjfc.js +0 -2
  196. package/dist/chunk-k1qajhpx.js +0 -2
  197. package/dist/chunk-m28j4ym7.js +0 -2
  198. package/dist/chunk-mzembfxk.js +0 -2
  199. package/dist/chunk-ngzjwp2e.js +0 -2
  200. package/dist/chunk-nj9n0en9.js +0 -2
  201. package/dist/chunk-nyasqjnt.js +0 -2
  202. package/dist/chunk-pn0rmd8d.js +0 -2
  203. package/dist/chunk-pvx1hrqq.js +0 -2
  204. package/dist/chunk-q78dsejp.js +0 -2
  205. package/dist/chunk-qw1f97s7.js +0 -2
  206. package/dist/chunk-rcn0yyh2.js +0 -2
  207. package/dist/chunk-t9h3e3bp.js +0 -2
  208. package/dist/chunk-ts9bvjzh.js +0 -2
  209. package/dist/chunk-tzvgjrp4.js +0 -2
  210. package/dist/chunk-v8b1wz1b.js +0 -2
  211. package/dist/chunk-w9aa8xte.js +0 -2
  212. package/dist/chunk-wegkgjmf.js +0 -2
  213. package/dist/chunk-wn065q3f.js +0 -2
  214. package/dist/chunk-y2dtqrrz.js +0 -2
  215. package/dist/chunk-yss7n9db.js +0 -2
  216. package/dist/chunk-z6p0yxwd.js +0 -2
  217. package/dist/chunk-zcpwc47w.js +0 -2
  218. package/dist/chunk-zsmrq1w3.js +0 -2
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{sr,Ae}from"./chunk-mzes9ds7.js";import{V,w,Sr,Fs,C}from"./chunk-jdqmk5sv.js";import{a,O}from"./chunk-1347hwt5.js";import{Lo}from"./chunk-qvwzaxdd.js";import{st}from"./chunk-9n8t7v78.js";import{c}from"./chunk-ksxbfyef.js";import{r,he}from"./chunk-snmq7yn4.js";import d from"path";import j from"fs";import{AsyncLocalStorage as at}from"async_hooks";import{randomUUID as bt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Lo(t,e,n)}var lt=2;function Rf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=j.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,p)=>p.length-l.length),rt.set(e,n)}return n}function St(t,e){try{let n=j.statSync(t),i=d.resolve(e),l=t.startsWith(`${i}${d.sep}`);return{path:l?d.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(j.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function vt(t,e){for(let n of t){let i=ct(n,e);try{let l=j.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(j.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var ut=new Map,Bt=100;function Af(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<Bt){H.set(t,e+1);return}H.set(t,1);try{let n=(await j.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=Af();if(n.length<=i)return;let p=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await j.promises.stat(d.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,b)=>b.at-o.at);for(let o of p.slice(i)){let b=o.name.slice(0,-3);await j.promises.rm(d.join(t,`${b}.js`),{force:!0}),await j.promises.rm(d.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function be(t){return ut.get(t)??[]}function Z(t,e){if(t)ut.set(t,e)}function Pf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(Pf())console.log("[stx:bundler]",...t)}var K=[];function ac(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function sn(){return K.slice()}function on(){K.length=0}var Q;function Mh(t){Q=t}function cc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function an(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var rr="stx-module:",Et=/\.(?:[cm]?[jt]sx?|json)$/i;function If(t,e){return d.relative(t,e).split(d.sep).join("/")}function Of(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,p)=>{let o=e.get(p);return o&&!p.startsWith(rr)?`${i}${l}${o}${l}`:n})}function Nf(t,e){let n=0,i=(p)=>{let o=`__stxMod${n++}`,b=JSON.stringify(p);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(p,o)=>{for(let b of p.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,b)=>{let I=b.slice(rr.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(rr.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(j.existsSync(n)&&j.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new at;function cs(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([p],[o])=>p<o?-1:p>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}var dt=new at;function Mf(t){return dt.run(!0,t)}function Df(){return dt.getStore()===!0}function lc(t){if(!Df())return;throw Error(`The client script of ${t} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function cn(){return G.getStore()?.key??""}function pt(t,e,n,i,l,p,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(B)=>B!==void 0&&S.has(B),v=(B,s,u)=>{if(X(s,t,b))return null;if(!p||!f(B)||!Et.test(s))return null;try{if(!j.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${rr}${If(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(B,s)=>{let u=f(B)?e:d.dirname(B),E=d.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),B.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(s)=>{let u=d.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let h of E)if(j.existsSync(h)&&j.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(s.importer,h,s.path);if(D)return D;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${rr}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(X(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=d.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=I?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:j.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,z=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function Lf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function ln(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,p=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||Rf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${st()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${p?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=d.join(I,`${f}.js`),y=z.get(v);if(y){if(Fs(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}z.delete(v),A("memo invalidated by dep change:",f)}let B=d.join(I,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(B),D=!1,N=null;if(await h.exists())try{let k=JSON.parse(await h.text());if(k.metadataVersion===lt&&Array.isArray(k.files)&&vt(k.files,i))N=Sr(k.files.map((g)=>ct(g,i))),D=N.length===k.files.length&&!N.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),N)Z(e,N.map((U)=>U.path)),n.collectInputs?.push(...N.map((U)=>U.path));let k=await s.text(),g=new Date;if(j.promises.utimes(v,g,g).catch(()=>{}),N)z.set(v,{code:k,files:N});return k}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(z.get(v)?.files??[]).map((D)=>D.path));return h}lc(e);let E=Lf(()=>_t(t,e,{projectRoot:i,minify:p,cacheDir:I,hash:f,cachePath:v,depsPath:B,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function uc(t){return`${t}-${process.pid}-${bt()}`}async function Dh(t,e){let{projectRoot:n}=e,i=uc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=d.join(c(n,"bundle-tmp"),"out",i);j.mkdirSync(l,{recursive:!0});let p=new Map,o=new Map,b=0;for(let[f,v]of t){let y=d.join(n,`.stx-split-${i}-${b++}.ts`);p.set(y,v),o.set(d.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...p][0],S=new Set;lc(e.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[pt(n,d.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let B=d.basename(y.path);if(y.kind==="entry-point"){let s=o.get(B.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{j.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function _t(t,e,n){let{projectRoot:i,minify:l,cacheDir:p,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=uc(o),v=d.join(i,`.stx-client-${f}.ts`),y=d.join(S,"out",f);j.mkdirSync(y,{recursive:!0});let B=d.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:D,balanced:N}=he(h),k=(R)=>!N||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!k(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=Mt(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!k(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!k(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let ft=s.size>0?`
3
- export { ${[...s].join(", ")} }`:"";A("bundling:",o,"from:",d.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[pt(i,B,v,t+ft,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${d.basename(e)}`,P=sr(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),ac(e||"",F,P),n.throwOnFailure||cc()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let P=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(P){_.push([P[2],P[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let L=[];m=Nf(Of(m,et),L);let mt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),l&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let W=`__stxBundle_${o}`,gt=new Set(V(t,!0).split(",").map((x)=>x.trim())),ht=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${gt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),xt=_.map(([x])=>`var ${x} = undefined;`).join(`
2
+ import{sr,Ae}from"./chunk-mzes9ds7.js";import{V,w,Sr,Fs,C}from"./chunk-261t62q4.js";import{a,O}from"./chunk-6nb49h13.js";import{Lo}from"./chunk-15rkvc0t.js";import{st}from"./chunk-9n8t7v78.js";import{c}from"./chunk-sxtvy0sm.js";import{r,he}from"./chunk-nwxjh1gv.js";import d from"path";import j from"fs";import{AsyncLocalStorage as at}from"async_hooks";import{randomUUID as bt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Lo(t,e,n)}var lt=2;function Pf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=j.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,p)=>p.length-l.length),rt.set(e,n)}return n}function St(t,e){try{let n=j.statSync(t),i=d.resolve(e),l=t.startsWith(`${i}${d.sep}`);return{path:l?d.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(j.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function vt(t,e){for(let n of t){let i=ct(n,e);try{let l=j.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(j.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var ut=new Map,Bt=100;function If(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<Bt){H.set(t,e+1);return}H.set(t,1);try{let n=(await j.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=If();if(n.length<=i)return;let p=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await j.promises.stat(d.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,b)=>b.at-o.at);for(let o of p.slice(i)){let b=o.name.slice(0,-3);await j.promises.rm(d.join(t,`${b}.js`),{force:!0}),await j.promises.rm(d.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function be(t){return ut.get(t)??[]}function Z(t,e){if(t)ut.set(t,e)}function Of(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(Of())console.log("[stx:bundler]",...t)}var K=[];function lc(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function sn(){return K.slice()}function on(){K.length=0}var Q;function Lh(t){Q=t}function uc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function an(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var rr="stx-module:",Et=/\.(?:[cm]?[jt]sx?|json)$/i;function Nf(t,e){return d.relative(t,e).split(d.sep).join("/")}function Mf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,p)=>{let o=e.get(p);return o&&!p.startsWith(rr)?`${i}${l}${o}${l}`:n})}function Df(t,e){let n=0,i=(p)=>{let o=`__stxMod${n++}`,b=JSON.stringify(p);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(p,o)=>{for(let b of p.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,b)=>{let I=b.slice(rr.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(rr.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(j.existsSync(n)&&j.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new at;function cs(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([p],[o])=>p<o?-1:p>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}var dt=new at;function Lf(t){return dt.run(!0,t)}function jf(){return dt.getStore()===!0}function dc(t){if(!jf())return;throw Error(`The client script of ${t} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function cn(){return G.getStore()?.key??""}function pt(t,e,n,i,l,p,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(B)=>B!==void 0&&S.has(B),v=(B,s,u)=>{if(X(s,t,b))return null;if(!p||!f(B)||!Et.test(s))return null;try{if(!j.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${rr}${Nf(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(B,s)=>{let u=f(B)?e:d.dirname(B),E=d.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),B.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(s)=>{let u=d.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let h of E)if(j.existsSync(h)&&j.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(s.importer,h,s.path);if(D)return D;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${rr}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(X(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=d.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=I?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:j.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,z=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function Bf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function ln(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,p=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||Pf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${st()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${p?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=d.join(I,`${f}.js`),y=z.get(v);if(y){if(Fs(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}z.delete(v),A("memo invalidated by dep change:",f)}let B=d.join(I,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(B),D=!1,N=null;if(await h.exists())try{let k=JSON.parse(await h.text());if(k.metadataVersion===lt&&Array.isArray(k.files)&&vt(k.files,i))N=Sr(k.files.map((g)=>ct(g,i))),D=N.length===k.files.length&&!N.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),N)Z(e,N.map((U)=>U.path)),n.collectInputs?.push(...N.map((U)=>U.path));let k=await s.text(),g=new Date;if(j.promises.utimes(v,g,g).catch(()=>{}),N)z.set(v,{code:k,files:N});return k}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(z.get(v)?.files??[]).map((D)=>D.path));return h}dc(e);let E=Bf(()=>_t(t,e,{projectRoot:i,minify:p,cacheDir:I,hash:f,cachePath:v,depsPath:B,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function pc(t){return`${t}-${process.pid}-${bt()}`}async function jh(t,e){let{projectRoot:n}=e,i=pc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=d.join(c(n,"bundle-tmp"),"out",i);j.mkdirSync(l,{recursive:!0});let p=new Map,o=new Map,b=0;for(let[f,v]of t){let y=d.join(n,`.stx-split-${i}-${b++}.ts`);p.set(y,v),o.set(d.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...p][0],S=new Set;dc(e.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[pt(n,d.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let B=d.basename(y.path);if(y.kind==="entry-point"){let s=o.get(B.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{j.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function _t(t,e,n){let{projectRoot:i,minify:l,cacheDir:p,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=pc(o),v=d.join(i,`.stx-client-${f}.ts`),y=d.join(S,"out",f);j.mkdirSync(y,{recursive:!0});let B=d.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:D,balanced:N}=he(h),k=(R)=>!N||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!k(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=Mt(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!k(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!k(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let ft=s.size>0?`
3
+ export { ${[...s].join(", ")} }`:"";A("bundling:",o,"from:",d.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[pt(i,B,v,t+ft,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${d.basename(e)}`,P=sr(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),lc(e||"",F,P),n.throwOnFailure||uc()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let P=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(P){_.push([P[2],P[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let L=[];m=Df(Mf(m,et),L);let mt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),l&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let W=`__stxBundle_${o}`,gt=new Set(V(t,!0).split(",").map((x)=>x.trim())),ht=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${gt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),xt=_.map(([x])=>`var ${x} = undefined;`).join(`
4
4
  `),yt=_.map(([x])=>`${x} = ${W}[${JSON.stringify(x)}];`).join(`
5
5
  `);if(m=`${mt.join(`
6
6
  `)}
@@ -16,5 +16,5 @@ var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiv
16
16
  Object.keys(${W}).forEach(function(name) {
17
17
  if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
18
18
  Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${W}, name));
19
- });`.trim(),A("bundled:",o,"output:",m.length,"bytes"),s.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${o}); serving the unbundled source and not caching this result`),t;j.mkdirSync(p,{recursive:!0}),await Bun.write(b,m);let J=Sr(tt);return await Bun.write(I,JSON.stringify({metadataVersion:lt,files:J.map((x)=>St(x.path,i)).filter((x)=>x!==null)})),Z(e,J.map((x)=>x.path)),n.collectInputs?.push(...J.map((x)=>x.path)),z.set(b,{code:m,files:J}),await jt(p),m}catch(R){let m=sr(R,e||void 0),_=Ae(R,e||void 0);if(console.warn(`[stx:bundler] error: ${_}`),ac(e||"",_,m),n.throwOnFailure||cc()==="error")throw R;return t}finally{try{j.rmSync(y,{recursive:!0,force:!0})}catch{}}}function Mt(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let i=e.indexOf(":");if(i!==-1)e=e.slice(i+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
20
- export{Rf,Af,be,Pf,ac,sn,on,Mh,cc,an,rr,If,Of,Nf,cs,Mf,Df,lc,cn,Lf,ln,uc,Dh};
19
+ });`.trim(),A("bundled:",o,"output:",m.length,"bytes"),s.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${o}); serving the unbundled source and not caching this result`),t;j.mkdirSync(p,{recursive:!0}),await Bun.write(b,m);let J=Sr(tt);return await Bun.write(I,JSON.stringify({metadataVersion:lt,files:J.map((x)=>St(x.path,i)).filter((x)=>x!==null)})),Z(e,J.map((x)=>x.path)),n.collectInputs?.push(...J.map((x)=>x.path)),z.set(b,{code:m,files:J}),await jt(p),m}catch(R){let m=sr(R,e||void 0),_=Ae(R,e||void 0);if(console.warn(`[stx:bundler] error: ${_}`),lc(e||"",_,m),n.throwOnFailure||uc()==="error")throw R;return t}finally{try{j.rmSync(y,{recursive:!0,force:!0})}catch{}}}function Mt(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let i=e.indexOf(":");if(i!==-1)e=e.slice(i+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
20
+ export{Pf,If,be,Of,lc,sn,on,Lh,uc,an,rr,Nf,Mf,Df,cs,Lf,jf,dc,cn,Bf,ln,pc,jh};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{g,m,p}from"./chunk-jdqmk5sv.js";import{F}from"./chunk-1347hwt5.js";import{i}from"./chunk-mzg1wq86.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function qm(e,t={},o={}){let n={...F,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,h,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((y)=>setTimeout(y,0))}else{let u=[],b=new RegExp(T.source,"g"),y;while((y=b.exec(c))!==null)u.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,h,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,h,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,h,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,h,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
2
+ import{g,m,p}from"./chunk-261t62q4.js";import{F}from"./chunk-6nb49h13.js";import{i}from"./chunk-kv40xq53.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Gm(e,t={},o={}){let n={...F,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,h,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((y)=>setTimeout(y,0))}else{let u=[],b=new RegExp(T.source,"g"),y;while((y=b.exec(c))!==null)u.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,h,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,h,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,h,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,h,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),w.set(d.name,i(d.content,h,e,n,l))}r.enqueue(`
5
5
  <script>
@@ -17,13 +17,13 @@ import{g,m,p}from"./chunk-jdqmk5sv.js";import{F}from"./chunk-1347hwt5.js";import
17
17
  }
18
18
  };
19
19
  })();
20
- </script>`);let x=Array.from(w.entries()).map(async([d,u])=>{r.enqueue(await Ca(d,u))});await Promise.all(x)}r.close()}catch(a){r.error(a)}}})}async function Ca(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
20
+ </script>`);let x=Array.from(w.entries()).map(async([d,u])=>{r.enqueue(await Ea(d,u))});await Promise.all(x)}r.close()}catch(a){r.error(a)}}})}async function Ea(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
21
21
  <script>
22
22
  window.__stxSuspense.resolve('${e}', \`${n}\`);
23
23
  </script>`}catch(o){let n=o instanceof Error?o.message:String(o);return`
24
24
  <script>
25
25
  window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${p(n)}</div>');
26
- </script>`}}var wu=`
26
+ </script>`}}var xu=`
27
27
  <script>
28
28
  (function(){
29
29
  window.__stxSuspense = window.__stxSuspense || {
@@ -43,12 +43,12 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
43
43
  }
44
44
  };
45
45
  })();
46
- </script>`;function z(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function Km(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(wu),await Promise.all(t.map(async(r)=>{let a=z(r.render(),n,r.id);s.enqueue(await Ca(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var A=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function Gm(e,t){return e.replace(A,(o,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),S=a[0].trim(),f=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=S,`<div data-suspense="${r}">${f}</div>`})}function Xm(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,s])=>({id:n,render:s})):void 0}async function Jm(e,t={},o={}){let n={...F,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,e);let E=new Set,l=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(l!=="manual"&&R.test(c))){let x=await i(c,h,e,n,E);for(let d=0;d<x.length;d+=s)r.enqueue(x.slice(d,d+s))}else{let x=[],d=new RegExp(T.source,"g"),u;while((u=d.exec(c))!==null)x.push({name:u[1],content:u[2],start:u.index,end:u.index+u[0].length});let b=0;for(let y of x){if(y.start>b){let _=c.slice(b,y.start);if(_.trim()){let C=await i(_,h,e,n,E);r.enqueue(C)}}let v=await i(y.content,h,e,n,E);r.enqueue(v),b=y.end}if(b<c.length){let y=c.slice(b);if(y.trim()){let v=await i(y,h,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function Ym(e,t={}){let o={...F,...t,streaming:{...q,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S=a,f={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let l=c[1],R=c[2];f[l]=R}let h=a.replace(T,"");return{renderShell:async(l={})=>{let R={...l,__filename:e,__dirname:k.dirname(e)};return await g(r,R,e),i(h,R,e,o,new Set)},renderSection:async(l,R={})=>{try{if(!f[l])return`<div class="error-message">Section "${p(l)}" not found in template "${p(e)}"</div>`;let w={...R,__filename:e,__dirname:k.dirname(e)};await g(r,w,e);let x=new Set;return await i(f[l],w,e,o,x)}catch(w){let x=w instanceof Error?w.message:String(w);return m("Expression",x,e,f[l]||"",0,f[l]||"")}},getSections:()=>Object.keys(f),getTemplate:()=>S}}var vu={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},xu={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,S=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),f=S?S[1].trim():"",c=S?e.replace(S[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
46
+ </script>`;function z(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function Xm(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(xu),await Promise.all(t.map(async(r)=>{let a=z(r.render(),n,r.id);s.enqueue(await Ea(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var A=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function Jm(e,t){return e.replace(A,(o,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),S=a[0].trim(),f=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=S,`<div data-suspense="${r}">${f}</div>`})}function Ym(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,s])=>({id:n,render:s})):void 0}async function Zm(e,t={},o={}){let n={...F,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,e);let E=new Set,l=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(l!=="manual"&&R.test(c))){let x=await i(c,h,e,n,E);for(let d=0;d<x.length;d+=s)r.enqueue(x.slice(d,d+s))}else{let x=[],d=new RegExp(T.source,"g"),u;while((u=d.exec(c))!==null)x.push({name:u[1],content:u[2],start:u.index,end:u.index+u[0].length});let b=0;for(let y of x){if(y.start>b){let _=c.slice(b,y.start);if(_.trim()){let C=await i(_,h,e,n,E);r.enqueue(C)}}let v=await i(y.content,h,e,n,E);r.enqueue(v),b=y.end}if(b<c.length){let y=c.slice(b);if(y.trim()){let v=await i(y,h,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function Qm(e,t={}){let o={...F,...t,streaming:{...q,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S=a,f={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let l=c[1],R=c[2];f[l]=R}let h=a.replace(T,"");return{renderShell:async(l={})=>{let R={...l,__filename:e,__dirname:k.dirname(e)};return await g(r,R,e),i(h,R,e,o,new Set)},renderSection:async(l,R={})=>{try{if(!f[l])return`<div class="error-message">Section "${p(l)}" not found in template "${p(e)}"</div>`;let w={...R,__filename:e,__dirname:k.dirname(e)};await g(r,w,e);let x=new Set;return await i(f[l],w,e,o,x)}catch(w){let x=w instanceof Error?w.message:String(w);return m("Expression",x,e,f[l]||"",0,f[l]||"")}},getSections:()=>Object.keys(f),getTemplate:()=>S}}var Su={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},ku={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,S=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),f=S?S[1].trim():"",c=S?e.replace(S[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
47
47
  ${c}
48
48
  <script type="application/json" data-island-props="${a}">
49
49
  ${f?`{${f}}`:"{}"}
50
50
  </script>
51
- </div>`}};function Zm(e={}){let t=[];if(e.streaming?.enabled)t.push(vu);if(e.hydration?.enabled)t.push(xu);return t}async function Qm(e,t,o,n={}){return e}function eh(e,t={}){let o=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(o.encode(r))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function th(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:n=!0}=e,s=Object.entries(o).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
51
+ </div>`}};function eh(e={}){let t=[];if(e.streaming?.enabled)t.push(Su);if(e.hydration?.enabled)t.push(ku);return t}async function th(e,t,o,n={}){return e}function nh(e,t={}){let o=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(o.encode(r))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function rh(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:n=!0}=e,s=Object.entries(o).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
52
52
  `);if(t==="loader")return`
53
53
  (function() {
54
54
  window.__stx = window.__stx || {};
@@ -191,4 +191,4 @@ else {
191
191
  stx.hydrate();
192
192
  }
193
193
  })();`}
194
- export{qm,Ca,wu,Km,Gm,Xm,Jm,Ym,vu,xu,Zm,Qm,eh,th};
194
+ export{Gm,Ea,xu,Xm,Jm,Ym,Zm,Qm,Su,ku,eh,th,nh,rh};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{pt,ft,gt}from"./chunk-1nankvf6.js";import"./chunk-7fgfzaah.js";import"./chunk-xppm4cs4.js";import"./chunk-0z2gqttt.js";import{g}from"./chunk-jdqmk5sv.js";import"./chunk-sny8rqe8.js";import"./chunk-qv52et0d.js";import{qt,io,Kt,Ji,dt,Yi,ao,Gt,Qi,Xt}from"./chunk-e8we717q.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{Yi("Config file changed, restarting...");try{await e.onChange()}catch(p){dt(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",ct=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:ct,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:lt(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function lt(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
2
+ import{pt,ft,gt}from"./chunk-1nankvf6.js";import"./chunk-1jwcp2k0.js";import"./chunk-xppm4cs4.js";import"./chunk-830ej8d2.js";import{g}from"./chunk-261t62q4.js";import"./chunk-5rxks14t.js";import"./chunk-naj146zq.js";import{qt,io,Kt,Yi,dt,Zi,ao,Gt,ea,Xt}from"./chunk-5n7m8vqx.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{Zi("Config file changed, restarting...");try{await e.onChange()}catch(p){dt(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",ct=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:ct,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:lt(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function lt(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
3
3
  <script>
4
4
  (function() {
5
5
  const ws = new WebSocket('${t}');
@@ -556,9 +556,9 @@ window.__stxPerformance = {
556
556
 
557
557
  window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
558
558
  </script>
559
- `}import T from"fs";import K from"path";var ut=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ut),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-pvx1hrqq.js"),p={},u=h(n);if(u)try{await g(u,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await g(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-pvx1hrqq.js"),c={...r},n=h(e);if(n)try{await g(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
559
+ `}import T from"fs";import K from"path";var ut=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ut),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-0hqr6bff.js"),p={},u=h(n);if(u)try{await g(u,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await g(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-0hqr6bff.js"),c={...r},n=h(e);if(n)try{await g(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
560
560
  `)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
561
- `)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function rt(t,e){let r=await Gt(t);ft(t,r);let s=Xt(t.config,r);gt(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),u=`http://${o}:${e.port}`,y=Qi(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let m=await Gt(t);ft(t,m);let f=Xt(t.config,m);if(gt(t,f),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=u;try{let{exec:l}=await import("child_process"),m=process.platform;l(`${m==="darwin"?"open":m==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:u,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],u=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((m)=>m.id===p);if(!l)return new Response("Story not found",{status:404});try{let m=await Y(t,l,u,y);return Response.json({html:m.html,css:m.css,js:m.js,errors:m.errors,duration:m.duration})}catch(m){return Response.json({html:"",css:"",js:"",errors:[m instanceof Error?m.message:String(m)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((u)=>u.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
561
+ `)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function rt(t,e){let r=await Gt(t);ft(t,r);let s=Xt(t.config,r);gt(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),u=`http://${o}:${e.port}`,y=ea(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let m=await Gt(t);ft(t,m);let f=Xt(t.config,m);if(gt(t,f),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=u;try{let{exec:l}=await import("child_process"),m=process.platform;l(`${m==="darwin"?"open":m==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:u,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],u=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((m)=>m.id===p);if(!l)return new Response("Story not found",{status:404});try{let m=await Y(t,l,u,y);return Response.json({html:m.html,css:m.css,js:m.js,errors:m.errors,duration:m.duration})}catch(m){return Response.json({html:"",css:"",js:"",errors:[m instanceof Error?m.message:String(m)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((u)=>u.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
562
562
  <html lang="en" class="${r.darkClass||"dark"}">
563
563
  <head>
564
564
  <meta charset="UTF-8">
@@ -1277,4 +1277,4 @@ else {
1277
1277
  ${D()}
1278
1278
  </body>
1279
1279
  </html>`}import St from"fs";import Pt from"path";var Ct=new Map,Tt=[],Rt=[],It=new Map;async function ot(t){let e=t.config.setupFile;if(!e)return;let r=Pt.resolve(t.root,e);try{await St.promises.access(r)}catch{return}let s={storyContext:t,registerComponent:(o,a)=>{Ct.set(o,a)},addCSS:(o)=>{Tt.push(o)},addScript:(o)=>{Rt.push(o)},setState:(o,a)=>{It.set(o,a)}};try{let o=await import(r);if(typeof o.default==="function")await o.default(s);else if(typeof o.setupStory==="function")await o.setupStory(s)}catch(o){console.warn(`Warning: Failed to load setup file: ${o}`)}}async function we(t={}){qt();let e=await pt({mode:"dev"});if(!e.config.enabled){dt("Story feature is disabled in config.");return}await ot(e);let r=t.port??e.config.port,s,o=async()=>{s=await rt(e,{port:r,open:t.open,host:t.host}),Kt(e.storyFiles.length),io(s.url),ao()};await o();let a=E(e,{onChange:async()=>{await s.close();let n=await pt({mode:"dev"});Object.assign(e,n),await o()}}),c=async()=>{console.log(`
1280
- `),a.stop(),await s.close(),process.exit(0)};if(process.on("SIGINT",c),process.on("SIGTERM",c),process.stdin.isTTY)process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("data",async(n)=>{switch(n.toString()){case"h":ao();break;case"o":try{let{exec:p}=await import("child_process"),u=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";p(`${u} ${s.url}`)}catch{Ji("Failed to open browser")}break;case"r":await s.close(),await o();break;case"c":console.clear(),qt(),Kt(e.storyFiles.length),io(s.url);break;case"q":case"\x03":await c();break}});await new Promise(()=>{})}export{we as devCommand};
1280
+ `),a.stop(),await s.close(),process.exit(0)};if(process.on("SIGINT",c),process.on("SIGTERM",c),process.stdin.isTTY)process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("data",async(n)=>{switch(n.toString()){case"h":ao();break;case"o":try{let{exec:p}=await import("child_process"),u=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";p(`${u} ${s.url}`)}catch{Yi("Failed to open browser")}break;case"r":await s.close(),await o();break;case"c":console.clear(),qt(),Kt(e.storyFiles.length),io(s.url);break;case"q":case"\x03":await c();break}});await new Promise(()=>{})}export{we as devCommand};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{R,u,f,P,d,K}from"./chunk-0z2gqttt.js";import{V,Ms,Me,fe,Ot,Tr,Fe,ze,s,m,_e,E}from"./chunk-jdqmk5sv.js";import{ut}from"./chunk-7fgfzaah.js";import{I}from"./chunk-xppm4cs4.js";import{ie}from"./chunk-me16tftr.js";import{B,Qe}from"./chunk-pb09xy77.js";import{T,$n}from"./chunk-ym5qgw03.js";import C from"path";import{existsSync as $e}from"fs";function ae(c,e){let a=0;for(let r=e;r<c.length;r++){let S=c[r];if(S==="("||S==="["||S==="{")a++;else if(S===")"||S==="]"||S==="}")a--;else if(S===","&&a===0)return r}return-1}function Ee(c,e,a){let r=c,S=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=S.exec(r);while(n){let g=n.index,t=g+n[0].length-1,D=1,W=t+1;while(W<r.length&&D>0){if(r[W]==="(")D++;else if(r[W]===")")D--;W++}if(D!==0)break;let re=r.substring(t+1,W-1),N=`${a}(${re})`;r=r.substring(0,g)+N+r.substring(W),S.lastIndex=g+N.length,n=S.exec(r)}return r}function ve(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],r=new Set,S=0,n=0,g=e.length,t=(N)=>{n++;while(n<g){if(e[n]==="\\"){n+=2;continue}if(e[n]===N){n++;return}n++}},D=()=>{n++;while(n<g){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;return}if(e[n]==="$"&&e[n+1]==="{"){n+=2;let N=1;while(n<g&&N>0)if(e[n]==="{")N++,n++;else if(e[n]==="}")N--,n++;else if(e[n]==="'"||e[n]==='"')t(e[n]);else if(e[n]==="`")D();else n++;continue}n++}},W=()=>{if(e[n]==="/"&&e[n+1]==="/"){while(n<g&&e[n]!==`
2
+ import{R,u,f,P,d,K}from"./chunk-830ej8d2.js";import{V,Ms,Me,fe,Ot,Tr,Fe,ze,s,m,_e,E}from"./chunk-261t62q4.js";import{ut}from"./chunk-1jwcp2k0.js";import{I}from"./chunk-xppm4cs4.js";import{ie}from"./chunk-v0wdgxga.js";import{B,Qe}from"./chunk-pb09xy77.js";import{T,$n}from"./chunk-9xr628ew.js";import C from"path";import{existsSync as $e}from"fs";function ae(c,e){let a=0;for(let r=e;r<c.length;r++){let S=c[r];if(S==="("||S==="["||S==="{")a++;else if(S===")"||S==="]"||S==="}")a--;else if(S===","&&a===0)return r}return-1}function Ee(c,e,a){let r=c,S=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=S.exec(r);while(n){let g=n.index,t=g+n[0].length-1,D=1,W=t+1;while(W<r.length&&D>0){if(r[W]==="(")D++;else if(r[W]===")")D--;W++}if(D!==0)break;let re=r.substring(t+1,W-1),N=`${a}(${re})`;r=r.substring(0,g)+N+r.substring(W),S.lastIndex=g+N.length,n=S.exec(r)}return r}function ve(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],r=new Set,S=0,n=0,g=e.length,t=(N)=>{n++;while(n<g){if(e[n]==="\\"){n+=2;continue}if(e[n]===N){n++;return}n++}},D=()=>{n++;while(n<g){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;return}if(e[n]==="$"&&e[n+1]==="{"){n+=2;let N=1;while(n<g&&N>0)if(e[n]==="{")N++,n++;else if(e[n]==="}")N--,n++;else if(e[n]==="'"||e[n]==='"')t(e[n]);else if(e[n]==="`")D();else n++;continue}n++}},W=()=>{if(e[n]==="/"&&e[n+1]==="/"){while(n<g&&e[n]!==`
3
3
  `)n++;return!0}if(e[n]==="/"&&e[n+1]==="*"){n+=2;while(n<g-1&&!(e[n]==="*"&&e[n+1]==="/"))n++;return n+=2,!0}return!1},re=()=>{if(S!==0)return;let N=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let Z=N[2];if(!r.has(Z))a.push(Z),r.add(Z);return}let te=e.slice(n).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(te){let Z=te[1];if(!r.has(Z))a.push(Z),r.add(Z);return}let Y=e.slice(n).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Z=Y[1];if(!r.has(Z))a.push(Z),r.add(Z)}};while(n<g){if(W())continue;if(e[n]==="'"||e[n]==='"'){t(e[n]);continue}if(e[n]==="`"){D();continue}if(e[n]==="{"){S++,n++;continue}if(e[n]==="}"){S--,n++;continue}if(S===0&&/[a-z]/i.test(e[n])&&(n===0||/\s|[;{}()]/.test(e[n-1])))re();n++}return a.join(", ")}function Re(c,e=""){let a=he(c).split(",").map((r)=>r.trim()).filter(Boolean);return`
4
4
  (function() {
5
5
  ${ut("var",a)}
@@ -44,11 +44,11 @@ ${n}
44
44
  }
45
45
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
46
46
  }
47
- })();`;return a+c+r}function Ae(c,e){if(B(c)){let n=B(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[1],stamped:!0,root:"body"};return{html:Qe(c,(g,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Ot(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let S=r[1]+r[2],n=r[1].slice(1),g=S.match(/data-stx-scope="([^"]*)"/);if(g)return{html:c,mergedIntoExisting:g[1],stamped:!0,root:n};let t=c.slice(0,a),D=r[1],W=r[2];return{html:`${t}${D} data-stx-scope="${e}"${W}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Ce=0;function ue(c,e){let a=C.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Ce}`}var le=new Set,pe=new Set;function zh(){le.clear(),pe.clear()}var De=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Vf(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),r=[],S=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=n.exec(a))!==null){let t=g[1]==="/",D=g[2],W=g[3]==="/"||De.has(D.toLowerCase());if(t){S=Math.max(0,S-1);continue}if(S===0)r.push(D);if(!W)S++}return r}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var Ze=new R(500),gc=new Set;function Hh(){gc.clear()}function Oe(c){if(c.__onceStore instanceof Set)return c.__onceStore;return gc}async function us(c,e,a,r,S,n=new Set){let g=r.partialsDir||C.join(C.dirname(a),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let t=Ee(c,"@partial","@include"),D=Oe(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(h,k,x)=>{let p=k.trim(),i=`${a}:${p}`;if(D.has(i))return"";return D.add(i),k});{let h=/@includeIf\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")")i--;_++}if(i!==0)break;let l=t.substring(p+1,_-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){h.lastIndex=_;continue}let O=o[1],z=W(O,g,a),v="";if(z&&await Bun.file(z).exists())S.add(z),v=`@include(${l})`;t=t.substring(0,x)+v+t.substring(_),h.lastIndex=0}}for(let[h,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(t))!==null){let i=p.index,_=i+p[0].length-1,l=1,o=_+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let O=t.substring(_+1,o-1),z=ae(O,0);if(z===-1){x.lastIndex=o;continue}let v=O.substring(0,z).trim(),H=O.substring(z+1).trim(),F=H.match(/^\s*['"]([^'"]+)['"]/);if(!F){x.lastIndex=o;continue}let w=F[1],J=H.substring(F[0].length),j,M=ae(J,0);if(M!==-1)j=J.substring(M+1).trim();try{let A=`Boolean(${v})`,L;if(f(A)){let oe=d(A,Object.keys(e));L=Boolean(oe(...Object.values(e)))}else L=Boolean(u(A,e));let ee=k?!L:L,ne="";if(ee){let oe=W(w,g,a);if(oe&&await Bun.file(oe).exists())S.add(oe);ne=`@include('${w}'${j?`, ${j}`:""})`}t=t.substring(0,i)+ne+t.substring(o),x.lastIndex=0}catch(A){let L=A instanceof Error?A.message:String(A),ee=m("Include",`Error evaluating ${h} condition: ${L}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),x.lastIndex=0}}}{let h=/@each\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")"){if(i--,i===0)break}_++}if(i!==0)break;let l=t.substring(p+1,_),o=t.substring(x,_+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){h.lastIndex=0,t=t.replace(o,"");continue}let[,z,v,H,F]=O;try{let w,J=v.trim();if(f(J))w=d(J,Object.keys(e))(...Object.values(e));else w=u(J,e);let j="";if(Array.isArray(w)&&w.length>0)for(let M of w){let A={...e,[H]:M},L=await te(z,A,c,x);j+=L}else if(F)j=await te(F,{},c,x);t=t.substring(0,x)+j+t.substring(_+1),h.lastIndex=0}catch(w){let J=w instanceof Error?w.message:String(w);t=t.substring(0,x)+m("Each",`Error in @each: ${J}`,a,c,x)+t.substring(_+1),h.lastIndex=0}}}{let h=/@includeFirst\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")"){if(i--,i===0)break}_++}if(i!==0)break;let l=t.substring(p+1,_),o=t.substring(x,_+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){h.lastIndex=0,t=t.replace(o,"");continue}let z=O[1],v=l.slice(O[0].length),H,F=v.match(/^\s*,\s*\{/);if(F){v=v.slice(F[0].length-1);let j=1,M=1;while(M<v.length&&j>0){if(v[M]==="{")j++;else if(v[M]==="}"){if(j--,j===0)break}M++}H=v.substring(0,M+1),v=v.slice(M+1)}let w,J=v.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)w=J[1];try{let j=JSON.parse(z.replace(/'/g,'"')),M={};if(H)try{M=P(H,e)}catch(L){let ee=L instanceof Error?L.message:String(L);if(r.debug){let ne=m("Include",`Error parsing includeFirst variables: ${ee}`,a,c,x,o);t=t.replace(o,()=>ne)}else t=t.replace(o,()=>w||"");continue}let A=!1;for(let L of j){let ee=W(L,g,a);if(!ee)continue;if(await s(ee)){let ne=await te(L,M,c,x);t=t.replace(o,()=>ne),A=!0;break}}if(!A)if(w!==void 0)t=t.replace(o,()=>w);else if(r.debug){let L=m("Include",`None of the includeFirst paths exist: ${z}`,a,c,x,o);t=t.replace(o,()=>L)}else t=t.replace(o,"")}catch(j){let M=j instanceof Error?j.message:String(j),A=m("Include",`Error processing @includeFirst: ${M}`,a,c,x,o);t=t.replace(o,()=>A)}h.lastIndex=0}}function W(h,k,x){try{let p=h;if(!h.endsWith(".stx"))p=`${h}.stx`;let i=C.resolve(k),_=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let F of r._layerPartialDirs??[]){let w=C.resolve(F,p);if(w.startsWith(`${C.resolve(F)}${C.sep}`)&&$e(w))return w}l=C.resolve(k,p)}else l=C.resolve(_,p);let o=C.normalize(l),O=o.startsWith(i+C.sep)||o===i,z=o.startsWith(_+C.sep)||o===_,v=!1,H=C.dirname(_);if(o.startsWith(H+C.sep)){if(!C.relative(H,o).split(C.sep).some((j)=>j.startsWith(".")&&j!=="."&&j!==".."))v=!0}if(!O&&!z&&!v)return console.error(`Security: Path traversal attempt blocked for include path: ${h}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${_}`),null;return o}catch(p){return console.error(`Error resolving path ${h}: ${p}`),null}}let re=C.resolve(a);n.add(re);function N(h,k,x,p){return r.onIncludeError?.({includePath:h,templatePath:a,message:k,partialsDir:g}),m("Include",k,a,x,p)}async function te(h,k={},x,p){let i=W(h,g,a);if(!i)return N(h,`Could not resolve path for include: ${h}`,x,p);let _=C.resolve(i);if(n.has(_)){let l=[...n,_].map((o)=>C.basename(o)).join(" -> ");return N(h,`Circular include detected: ${l}`,x,p)}try{S.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(y){let q=y instanceof Error?y.message:String(y);return N(h,`Error loading include file ${h}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-98bgx3ws.js");l=y(l,e)}if(l&&(r.debug||!T()&&!$n()))try{let{warnUnbalancedTags:y}=await import("./chunk-7ycmnsh5.js");y(l,i)}catch{}try{let{processESImports:y}=await import("./chunk-zsmrq1w3.js");l=await y(l,e,i,r,S)}catch(y){if(r.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,y instanceof Error?y.message:y)}let o=l,O=fe(o);if(O)o=O.content.trim();let v=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),H="";if(v)H=`<style${v[1]}>${v[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,q,b)=>{if(!me(q))return"";return F.push({attrs:q,body:b}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let w={...e};w.__stx_signals_gate=_e(l,i);for(let[y,q]of Object.entries(k))w[y]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,j=[...l.matchAll(J)].sort((y,q)=>{let b=(y[1]||"").includes("server"),X=(q[1]||"").includes("server");return Number(X)-Number(b)}),M="",A=null,L=!1,ee=!1;for(let y of j){let q=y[1]||"",b=y[2]||"";if(me(q))continue;let X=q.includes("server"),Se=Fe(q);if(!X&&!/\bsrc\s*=/i.test(q))Me(b,i,r.strict);if(!X&&b.trim()){let{interpolateScriptExpressions:U}=await import("./chunk-rcn0yyh2.js");b=U(b,w,h)}let ce="";try{let{extractAndStripCssImports:U,renderVendorStyleTags:Q}=await import("./chunk-2102tvxh.js"),se=U(b,{filePath:i,projectRoot:process.cwd()});b=se.code,ce=Q(se.styles)}catch(U){if(r.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,U instanceof Error?U.message:U)}if(Se&&b.trim())b=ze(b);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-2102tvxh.js");b=Q(b).code;let{hasUserImports:se,bundleClientScript:ye}=await import("./chunk-mzembfxk.js");if(se(b))b=await ye(b,i,{projectRoot:process.cwd()})}catch(Q){if(r.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:U}=await import("./chunk-nj9n0en9.js");b=U(b)}let de=ve(b);if(!X){let{extractBridgeData:U,generateServerDataBridge:Q}=await import("./chunk-2102tvxh.js"),se=Q(b,U(w));if(se)b=`${se}
47
+ })();`;return a+c+r}function Ae(c,e){if(B(c)){let n=B(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[1],stamped:!0,root:"body"};return{html:Qe(c,(g,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Ot(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let S=r[1]+r[2],n=r[1].slice(1),g=S.match(/data-stx-scope="([^"]*)"/);if(g)return{html:c,mergedIntoExisting:g[1],stamped:!0,root:n};let t=c.slice(0,a),D=r[1],W=r[2];return{html:`${t}${D} data-stx-scope="${e}"${W}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Ce=0;function ue(c,e){let a=C.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Ce}`}var le=new Set,pe=new Set;function Vh(){le.clear(),pe.clear()}var De=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Wf(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),r=[],S=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=n.exec(a))!==null){let t=g[1]==="/",D=g[2],W=g[3]==="/"||De.has(D.toLowerCase());if(t){S=Math.max(0,S-1);continue}if(S===0)r.push(D);if(!W)S++}return r}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var Ze=new R(500),hc=new Set;function Uh(){hc.clear()}function Oe(c){if(c.__onceStore instanceof Set)return c.__onceStore;return hc}async function us(c,e,a,r,S,n=new Set){let g=r.partialsDir||C.join(C.dirname(a),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let t=Ee(c,"@partial","@include"),D=Oe(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(h,k,x)=>{let p=k.trim(),i=`${a}:${p}`;if(D.has(i))return"";return D.add(i),k});{let h=/@includeIf\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")")i--;_++}if(i!==0)break;let l=t.substring(p+1,_-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){h.lastIndex=_;continue}let O=o[1],z=W(O,g,a),v="";if(z&&await Bun.file(z).exists())S.add(z),v=`@include(${l})`;t=t.substring(0,x)+v+t.substring(_),h.lastIndex=0}}for(let[h,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(t))!==null){let i=p.index,_=i+p[0].length-1,l=1,o=_+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let O=t.substring(_+1,o-1),z=ae(O,0);if(z===-1){x.lastIndex=o;continue}let v=O.substring(0,z).trim(),H=O.substring(z+1).trim(),F=H.match(/^\s*['"]([^'"]+)['"]/);if(!F){x.lastIndex=o;continue}let w=F[1],J=H.substring(F[0].length),j,M=ae(J,0);if(M!==-1)j=J.substring(M+1).trim();try{let A=`Boolean(${v})`,L;if(f(A)){let oe=d(A,Object.keys(e));L=Boolean(oe(...Object.values(e)))}else L=Boolean(u(A,e));let ee=k?!L:L,ne="";if(ee){let oe=W(w,g,a);if(oe&&await Bun.file(oe).exists())S.add(oe);ne=`@include('${w}'${j?`, ${j}`:""})`}t=t.substring(0,i)+ne+t.substring(o),x.lastIndex=0}catch(A){let L=A instanceof Error?A.message:String(A),ee=m("Include",`Error evaluating ${h} condition: ${L}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),x.lastIndex=0}}}{let h=/@each\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")"){if(i--,i===0)break}_++}if(i!==0)break;let l=t.substring(p+1,_),o=t.substring(x,_+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){h.lastIndex=0,t=t.replace(o,"");continue}let[,z,v,H,F]=O;try{let w,J=v.trim();if(f(J))w=d(J,Object.keys(e))(...Object.values(e));else w=u(J,e);let j="";if(Array.isArray(w)&&w.length>0)for(let M of w){let A={...e,[H]:M},L=await te(z,A,c,x);j+=L}else if(F)j=await te(F,{},c,x);t=t.substring(0,x)+j+t.substring(_+1),h.lastIndex=0}catch(w){let J=w instanceof Error?w.message:String(w);t=t.substring(0,x)+m("Each",`Error in @each: ${J}`,a,c,x)+t.substring(_+1),h.lastIndex=0}}}{let h=/@includeFirst\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")"){if(i--,i===0)break}_++}if(i!==0)break;let l=t.substring(p+1,_),o=t.substring(x,_+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){h.lastIndex=0,t=t.replace(o,"");continue}let z=O[1],v=l.slice(O[0].length),H,F=v.match(/^\s*,\s*\{/);if(F){v=v.slice(F[0].length-1);let j=1,M=1;while(M<v.length&&j>0){if(v[M]==="{")j++;else if(v[M]==="}"){if(j--,j===0)break}M++}H=v.substring(0,M+1),v=v.slice(M+1)}let w,J=v.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)w=J[1];try{let j=JSON.parse(z.replace(/'/g,'"')),M={};if(H)try{M=P(H,e)}catch(L){let ee=L instanceof Error?L.message:String(L);if(r.debug){let ne=m("Include",`Error parsing includeFirst variables: ${ee}`,a,c,x,o);t=t.replace(o,()=>ne)}else t=t.replace(o,()=>w||"");continue}let A=!1;for(let L of j){let ee=W(L,g,a);if(!ee)continue;if(await s(ee)){let ne=await te(L,M,c,x);t=t.replace(o,()=>ne),A=!0;break}}if(!A)if(w!==void 0)t=t.replace(o,()=>w);else if(r.debug){let L=m("Include",`None of the includeFirst paths exist: ${z}`,a,c,x,o);t=t.replace(o,()=>L)}else t=t.replace(o,"")}catch(j){let M=j instanceof Error?j.message:String(j),A=m("Include",`Error processing @includeFirst: ${M}`,a,c,x,o);t=t.replace(o,()=>A)}h.lastIndex=0}}function W(h,k,x){try{let p=h;if(!h.endsWith(".stx"))p=`${h}.stx`;let i=C.resolve(k),_=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let F of r._layerPartialDirs??[]){let w=C.resolve(F,p);if(w.startsWith(`${C.resolve(F)}${C.sep}`)&&$e(w))return w}l=C.resolve(k,p)}else l=C.resolve(_,p);let o=C.normalize(l),O=o.startsWith(i+C.sep)||o===i,z=o.startsWith(_+C.sep)||o===_,v=!1,H=C.dirname(_);if(o.startsWith(H+C.sep)){if(!C.relative(H,o).split(C.sep).some((j)=>j.startsWith(".")&&j!=="."&&j!==".."))v=!0}if(!O&&!z&&!v)return console.error(`Security: Path traversal attempt blocked for include path: ${h}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${_}`),null;return o}catch(p){return console.error(`Error resolving path ${h}: ${p}`),null}}let re=C.resolve(a);n.add(re);function N(h,k,x,p){return r.onIncludeError?.({includePath:h,templatePath:a,message:k,partialsDir:g}),m("Include",k,a,x,p)}async function te(h,k={},x,p){let i=W(h,g,a);if(!i)return N(h,`Could not resolve path for include: ${h}`,x,p);let _=C.resolve(i);if(n.has(_)){let l=[...n,_].map((o)=>C.basename(o)).join(" -> ");return N(h,`Circular include detected: ${l}`,x,p)}try{S.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(y){let q=y instanceof Error?y.message:String(y);return N(h,`Error loading include file ${h}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-ck5nzbbv.js");l=y(l,e)}if(l&&(r.debug||!T()&&!$n()))try{let{warnUnbalancedTags:y}=await import("./chunk-7ycmnsh5.js");y(l,i)}catch{}try{let{processESImports:y}=await import("./chunk-353gnvfe.js");l=await y(l,e,i,r,S)}catch(y){if(r.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,y instanceof Error?y.message:y)}let o=l,O=fe(o);if(O)o=O.content.trim();let v=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),H="";if(v)H=`<style${v[1]}>${v[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,q,b)=>{if(!me(q))return"";return F.push({attrs:q,body:b}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let w={...e};w.__stx_signals_gate=_e(l,i);for(let[y,q]of Object.entries(k))w[y]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,j=[...l.matchAll(J)].sort((y,q)=>{let b=(y[1]||"").includes("server"),X=(q[1]||"").includes("server");return Number(X)-Number(b)}),M="",A=null,L=!1,ee=!1;for(let y of j){let q=y[1]||"",b=y[2]||"";if(me(q))continue;let X=q.includes("server"),Se=Fe(q);if(!X&&!/\bsrc\s*=/i.test(q))Me(b,i,r.strict);if(!X&&b.trim()){let{interpolateScriptExpressions:U}=await import("./chunk-zrm2x65c.js");b=U(b,w,h)}let ce="";try{let{extractAndStripCssImports:U,renderVendorStyleTags:Q}=await import("./chunk-tqs9pcga.js"),se=U(b,{filePath:i,projectRoot:process.cwd()});b=se.code,ce=Q(se.styles)}catch(U){if(r.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,U instanceof Error?U.message:U)}if(Se&&b.trim())b=ze(b);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-tqs9pcga.js");b=Q(b).code;let{hasUserImports:se,bundleClientScript:ye}=await import("./chunk-mad172af.js");if(se(b))b=await ye(b,i,{projectRoot:process.cwd()})}catch(Q){if(r.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:U}=await import("./chunk-pybm7c9p.js");b=U(b)}let de=ve(b);if(!X){let{extractBridgeData:U,generateServerDataBridge:Q}=await import("./chunk-tqs9pcga.js"),se=Q(b,U(w));if(se)b=`${se}
48
48
  ${b}`}if(de&&!X){L=!0,A=ue(i,e);let U=I(b),Q=ge(U,A);M+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${A}">${Q}</script>
49
- `;continue}if(X)try{let{extractVariables:U}=await import("./chunk-39cwa35j.js");await U(b,w,i)}catch(U){if(r.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,U)}if(!X&&!de){let U=q.replace(/\bclient\b/i,"").trim();A=ue(i,e);let Q=I(b),se=ge(Q,A);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(se))ee=!0;M+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${A}"${U?` ${U}`:""}>${se}</script>
50
- `}}if(F.length>0){let{interpolateScriptExpressions:y}=await import("./chunk-rcn0yyh2.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,b)=>{let X=F[Number(b)];return`<script${X.attrs}>${y(X.body,w,h)}</script>`})}if(A){let y=Ae(o,A);if(o=y.html,y.mergedIntoExisting){let b=A,X=y.mergedIntoExisting;M=M.split(`'${b}'`).join(`'${X}'`).split(`"${b}"`).join(`"${X}"`),A=X}else if(!y.stamped&&L&&!le.has(i))le.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(y.stamped&&y.root!=="body"&&(L||ee)&&!pe.has(i)){let b=Vf(o);if(b.length>1)pe.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares ${L?"signals":"bindings"} and has ${b.length} top-level elements (${b.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let q=y.stamped&&y.root!==null&&Tr(y.root);M=Ie(M,q?A:null)}if(o.includes("@include")||o.includes("@partial"))o=await us(o,w,i,r,S,n);let{processLoops:ne,reportDeferredLoopWarnings:oe}=await import("./chunk-ewnfgczq.js"),G=ne(o,w,i,void 0,!0);G=ie(G,w,i),G=oe(G);let{processMetaDirectives:xe,processSeoDirective:we,processStructuredData:be}=await import("./chunk-g6epqcb3.js");if(G=xe(G,w,i,r),G=be(G,w,i),G=we(G,w,i,r),G=E(G,w,i),H)G+=`
49
+ `;continue}if(X)try{let{extractVariables:U}=await import("./chunk-2wba5ypm.js");await U(b,w,i)}catch(U){if(r.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,U)}if(!X&&!de){let U=q.replace(/\bclient\b/i,"").trim();A=ue(i,e);let Q=I(b),se=ge(Q,A);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(se))ee=!0;M+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${A}"${U?` ${U}`:""}>${se}</script>
50
+ `}}if(F.length>0){let{interpolateScriptExpressions:y}=await import("./chunk-zrm2x65c.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,b)=>{let X=F[Number(b)];return`<script${X.attrs}>${y(X.body,w,h)}</script>`})}if(A){let y=Ae(o,A);if(o=y.html,y.mergedIntoExisting){let b=A,X=y.mergedIntoExisting;M=M.split(`'${b}'`).join(`'${X}'`).split(`"${b}"`).join(`"${X}"`),A=X}else if(!y.stamped&&L&&!le.has(i))le.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(y.stamped&&y.root!=="body"&&(L||ee)&&!pe.has(i)){let b=Wf(o);if(b.length>1)pe.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares ${L?"signals":"bindings"} and has ${b.length} top-level elements (${b.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let q=y.stamped&&y.root!==null&&Tr(y.root);M=Ie(M,q?A:null)}if(o.includes("@include")||o.includes("@partial"))o=await us(o,w,i,r,S,n);let{processLoops:ne,reportDeferredLoopWarnings:oe}=await import("./chunk-qnx71b17.js"),G=ne(o,w,i,void 0,!0);G=ie(G,w,i),G=oe(G);let{processMetaDirectives:xe,processSeoDirective:we,processStructuredData:be}=await import("./chunk-4a751brg.js");if(G=xe(G,w,i,r),G=be(G,w,i),G=we(G,w,i,r),G=E(G,w,i),H)G+=`
51
51
  `+H;if(M)G+=`
52
52
  `+M;return G}catch(l){if(l instanceof K)throw l;let o=l instanceof Error?l.message:String(l);return N(h,`Error processing include ${h}: ${o}`,x,p)}}let Y=/@include\s*\(/g,Z;while((Z=Y.exec(t))!==null){let h=Z.index,k=h+Z[0].length-1,x=1,p=k+1;while(p<t.length&&x>0){if(t[p]==="(")x++;else if(t[p]===")")x--;p++}if(x!==0)break;let i=t.substring(h,p),_=t.substring(k+1,p-1),l=_.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,z=_.substring(l[0].length),v=ae(z,0);if(v!==-1)O=z.substring(v+1).trim();let H={};if(O)try{H=P(O,e)}catch(w){let J=w instanceof Error?w.message:String(w);t=t.replace(i,m("Include",`Error parsing include variables for ${o}: ${J}`,a,c,h)),Y.lastIndex=0;continue}let F=await te(o,H,c,h);t=t.substring(0,h)+F+t.substring(p),Y.lastIndex=0}return t}function ds(c,e){let a=c;function r(S,n,g,t){let D=S,W=!0;while(W){W=!1;let re=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),N=D.match(re);if(!N||N.index===void 0)break;let te=N.index,Y=N[1],Z=te+N[0].length,h=new RegExp(`@${n}\\(`),k=new RegExp(`@${g}(?![a-z])`),x=1,p=Z,i=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(h),O=l.match(k),z=o?p+o.index:1/0,v=O?p+O.index:1/0;if(z<v)x++,p=z+(o[0].length||1);else if(v<1/0){if(x--,x===0){i=v;break}p=v+g.length+1}else break}if(i===-1)break;let _=D.slice(Z,i);if(!e[Y])e[Y]=[];if(t)e[Y].unshift(_);else e[Y].push(_);D=D.substring(0,te)+D.substring(i+`@${g}`.length),W=!0}return D}return a=r(a,"push","endpush",!1),a=r(a,"prepend","endprepend",!0),a}function ps(c,e){return c.replace(/@stack\(['"]([^'"]+)['"]\)/g,(a,r)=>{if(!e[r]||e[r].length===0)return"";return e[r].join(`
53
53
  `)})}
54
- export{zh,Vf,Ze,gc,Hh,us,ds,ps};
54
+ export{Vh,Wf,Ze,hc,Uh,us,ds,ps};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function wc(){return`
2
+ function xc(){return`
3
3
  (function(){
4
4
  var tip=null,hideTimer=null,currentEl=null;
5
5
 
@@ -103,4 +103,4 @@ document.addEventListener("focusout",function(e){
103
103
  });
104
104
  })();
105
105
  `}
106
- export{wc};
106
+ export{xc};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Cu,$o,Yn,Eu,Tu,$u,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,en,La,yd,bd,wd,ja,vd,xd,Sd,kd,_d,Cd,Ba,Ed,Td,$d,Rd,Ad,Pd,Id,Od,Nd,Zn,Md,Dd,Ld,jd,Bd,Fd,zd,Hd,Vd,Ud,Wd,qd,Ro,Kd,Gd,Xd,Jd,Yd,rs,ss,Zd,Qd,ep,tp,np,Fa,rp,sp,op,za,Ao,ip,ap,Ha,Va,os,Ua,cp,tn,lp,Wa,qa,Po,up,Io,dp,pp,fp,gp,mp,hp,yp,Ka,bp,wp,Ga,vp,xp,Sp,kp,_p,Cp,Ep,Tp,$p,Rp,Ap,Pp,Ip,Op,Np,Mp,Dp,Lp,jp,Bp,Fp,zp,Hp,Vp,Xa,Up,Wp,qp,Kp,Gp,Xp,Jp,Yp,Zp,Qp,ef,Qn,Ja,Ya,tf,er,nf,rf,sf,Za,Qa,is,as,of,Oo,af,cf,lf,uf,df,pf,ff,gf,mf,hf,yf,bf,wf,vf,xf,Sf,kf,_f,Cf,Ef,ec,Tf,$f,tc,nc,Rf,Af}from"./chunk-bag9q4m0.js";export{md as AVAILABLE_COMPONENTS,Fa as AutoUpdater,hd as COMPONENT_STYLES,is as DEFAULT_WATCH_INTERVAL_MS,Qa as MAX_WATCH_INTERVAL_MS,Za as MIN_WATCH_INTERVAL_MS,Cd as MODAL_STYLES,Nu as TOAST_STYLES,Id as TRAY_MENU_STYLES,Ha as UPDATE_MANIFEST_ASSET,xd as alert,Fp as appInfo,pf as appleScript,Af as applicationDataDirectory,df as audio,$f as backgroundDelay,Dp as battery,uf as biometric,Qp as bluetooth,yf as bonjour,tn as bundlePathForExecutable,up as caffeinate,rp as canReplaceBundle,sp as clearQuarantine,Tp as clipboard,_d as closeAllModals,qd as closeAllWindows,vd as confirm,Vp as contextMenu,kf as continuityCamera,Sf as coreml,tp as craftBinaryNotFoundMessage,Ro as craftWindowArguments,Qn as crashReporter,rd as createAccordion,Ju as createAutocomplete,zu as createAvatar,Fu as createBadge,Mu as createButton,Hu as createCard,ud as createChart,Lu as createCheckbox,Qu as createChip,dd as createCodeEditor,Ku as createColorPicker,ld as createDataGrid,Gu as createDatePicker,ss as createDiskImage,Uu as createDropdown,fd as createFileExplorer,cp as createGitHubUpdateManifest,Ua as createGitHubUpdater,Zu as createImageView,kp as createInterval,Yu as createLabel,id as createListView,pd as createMediaPlayer,Ed as createMenubar,od as createModalComponent,Rf as createNativeUpdateApi,nc as createPantrySelfUpdater,mp as createPreferences,Bu as createProgressBar,qu as createRadioButton,Wu as createRating,td as createScrollView,Po as createSelfUpdater,ju as createSlider,nd as createSplitView,sd as createStepper,Ba as createSystemTray,ad as createTable,Vu as createTabs,Du as createTextInput,Xu as createTimePicker,Sp as createTimer,ed as createTooltip,cd as createTreeView,gd as createWebView,Kd as createWindow,Xd as createWindowWithHTML,Io as decaffeinate,Mp as deepLinks,_p as delay,Pu as dismissAlertById,Iu as dismissAllAlerts,Op as dragOut,op as extractBundle,ff as fileAssociations,Oo as focus,cf as focusShortcutsReady,Ep as formatCompact,gp as formatDuration,fp as formatRemainingTime,bp as formatShortcut,Cp as formatTime,Rp as fs,za as generateUpdateManifest,Ou as getActiveAlertCount,kd as getActiveModalCount,Td as getActiveTrayInstances,Ud as getActiveWindowIds,pp as getCaffeinateStatus,Ef as getCapabilities,ec as getCapability,Hd as getDesktopConfig,Fd as getDialogBridgeScript,xp as getRegisteredHotkeys,Ad as getSimulatedTrayHTML,Pd as getTrayBridgeScript,$d as getTrayInstance,Wd as getWindow,Yd as getWindowBridgeScript,Va as githubLatestAssetUrl,os as githubReleaseAssetUrl,Pp as globalShortcuts,er as handoff,af as hasFocusShortcuts,tf as iap,yp as isAutoLaunchEnabled,Tf as isAvailable,dp as isCaffeinated,Np as isDragOutAvailable,Jd as isWebviewAvailable,qp as keychain,nf as liveActivities,lf as localServer,rf as location,hf as log,Zd as macOSRuntimeExecutablePath,Hp as menu,xf as midi,Xp as nativeAutoLaunch,Jp as nativeTray,Yp as nativeWindow,Lp as network,$p as notifications,Au as notify,Gd as openDevWindow,Qd as pack,ep as packageApp,tc as parsePantryUpdateManifest,Ka as parseShortcut,mf as pdf,Kp as permissions,Gp as printing,Sd as prompt,Wa as quitLauncher,Ao as readBundleIdentity,Ja as redactPII,wp as registerHotkey,qa as relaunchBundle,Cu as requestNotificationPermission,Vd as resetDesktopConfig,np as resolveCraftBinary,rs as resolveCraftExecutablePath,lp as runningBundleTeamId,Wp as screen,sf as screenCapture,as as screenSharing,Cf as serial,_f as serviceMenu,hp as setAutoLaunch,zd as setDesktopConfig,Ap as shell,$o as showAlert,Dd as showAlertDialog,Md as showColorPicker,Ld as showConfirmDialog,jd as showErrorDialog,bd as showErrorModal,Ru as showErrorToast,La as showInfoModal,Eu as showInfoToast,Zn as showMessageBox,en as showModal,Od as showOpenDialog,ja as showQuestionModal,Nd as showSaveDialog,wd as showSuccessModal,Tu as showSuccessToast,Yn as showToast,Bd as showWarningDialog,yd as showWarningModal,$u as showWarningToast,Xa as sidebar,Ya as signPayload,ef as speech,wf as speechRecognition,bf as spotlight,zp as standardMenus,ip as swapBundle,Up as system,gf as tags,Ip as theme,Zp as touchbar,Rd as triggerTrayAction,vp as unregisterAllHotkeys,Ga as unregisterHotkey,jp as updater,ap as verifyBundleTrust,vf as vision,of as watchScreenSharing,Bp as windowEvents};