@stacksjs/stx 0.2.847 → 0.2.850

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 (231) hide show
  1. package/dist/{chunk-rqjskxpw.js → chunk-0dnetjh8.js} +31 -31
  2. package/dist/{chunk-09412heg.js → chunk-0rszcb0m.js} +13 -13
  3. package/dist/chunk-1qdhwjs4.js +2 -0
  4. package/dist/{chunk-z57xq46m.js → chunk-2d7e5g92.js} +4 -4
  5. package/dist/{chunk-wp14sf2j.js → chunk-2j2qzv8g.js} +1 -1
  6. package/dist/{chunk-nws4zm4k.js → chunk-2rg9pqmh.js} +4 -4
  7. package/dist/chunk-3gyq9rjx.js +2 -0
  8. package/dist/chunk-3w9xhs7k.js +2 -0
  9. package/dist/chunk-3wt0nh3p.js +2 -0
  10. package/dist/{chunk-jh36gqcq.js → chunk-422r7zkx.js} +2 -2
  11. package/dist/chunk-4e6wkjtx.js +2 -0
  12. package/dist/chunk-4pbrszgz.js +2 -0
  13. package/dist/chunk-5be6p256.js +2 -0
  14. package/dist/{chunk-6peq9s4s.js → chunk-5jqz5qff.js} +7 -7
  15. package/dist/chunk-5m4txcry.js +2 -0
  16. package/dist/chunk-5p6vpvmz.js +2 -0
  17. package/dist/chunk-5wk40kjd.js +2 -0
  18. package/dist/{chunk-q61r0m6r.js → chunk-62k66qj9.js} +1 -1
  19. package/dist/chunk-660g9vjn.js +2 -0
  20. package/dist/chunk-67bn31a3.js +2 -0
  21. package/dist/{chunk-y1cneng3.js → chunk-6p62jjzm.js} +2 -2
  22. package/dist/{chunk-cv0rmntr.js → chunk-6q6atv4g.js} +5 -5
  23. package/dist/chunk-6rd4phe3.js +2 -0
  24. package/dist/chunk-7hnt9a2e.js +2 -0
  25. package/dist/{chunk-ysqzz2h3.js → chunk-7zxce1yw.js} +3 -3
  26. package/dist/chunk-80bb89fh.js +2 -0
  27. package/dist/{chunk-he9dzchk.js → chunk-833y1ndd.js} +1 -1
  28. package/dist/{chunk-93c08def.js → chunk-88392kaj.js} +5 -5
  29. package/dist/{chunk-t4dkcf28.js → chunk-8cvgm13s.js} +2 -2
  30. package/dist/{chunk-jj5fz0fq.js → chunk-8hkgycpm.js} +1 -1
  31. package/dist/chunk-8k6cd1e0.js +2 -0
  32. package/dist/{chunk-2ts9pb6s.js → chunk-8vjr3atq.js} +2 -2
  33. package/dist/{chunk-rsa9ssz7.js → chunk-918ws1g7.js} +6 -6
  34. package/dist/{chunk-h9778nxm.js → chunk-98qgcmxr.js} +2 -2
  35. package/dist/chunk-9bkgbyrs.js +2 -0
  36. package/dist/{chunk-5njk2ba0.js → chunk-9mryv01z.js} +52 -52
  37. package/dist/{chunk-8586a2hh.js → chunk-9yp0t7zc.js} +2 -2
  38. package/dist/{chunk-yrmppd8r.js → chunk-a2fngjfx.js} +1 -1
  39. package/dist/chunk-a2shk93y.js +3 -0
  40. package/dist/chunk-a7v1j7td.js +2 -0
  41. package/dist/{chunk-zfb2wnha.js → chunk-aas25pac.js} +3 -3
  42. package/dist/{chunk-eqbx4yj1.js → chunk-ab1vk7jv.js} +4 -4
  43. package/dist/chunk-acbx3jn5.js +2 -0
  44. package/dist/{chunk-0wms5teg.js → chunk-agbkv9ab.js} +2 -2
  45. package/dist/{chunk-wdwx2aa6.js → chunk-amerebya.js} +2 -2
  46. package/dist/{chunk-b1q40vq4.js → chunk-anva219c.js} +2 -2
  47. package/dist/chunk-apq33h4w.js +2 -0
  48. package/dist/{chunk-fxk08je0.js → chunk-ar1prdev.js} +7 -7
  49. package/dist/{chunk-trgbdydw.js → chunk-axga9ebe.js} +2 -2
  50. package/dist/{chunk-5aqvfnvy.js → chunk-brheng7x.js} +8 -8
  51. package/dist/{chunk-fhyvdxhw.js → chunk-btkazgdb.js} +3 -3
  52. package/dist/chunk-c90qz5w0.js +2 -0
  53. package/dist/{chunk-4fc8zs15.js → chunk-caehra7e.js} +5 -5
  54. package/dist/chunk-cwt26rvt.js +3 -0
  55. package/dist/chunk-d4kystzh.js +2 -0
  56. package/dist/chunk-dx31vsyf.js +2 -0
  57. package/dist/{chunk-jaf44web.js → chunk-e105xsee.js} +1 -1
  58. package/dist/{chunk-xn0ebqgw.js → chunk-e46n406k.js} +13 -13
  59. package/dist/{chunk-2j3gttzf.js → chunk-e85wsz8y.js} +1 -1
  60. package/dist/{chunk-5x8q6e1q.js → chunk-eh8g8kr1.js} +5 -5
  61. package/dist/chunk-f4x21pqx.js +2 -0
  62. package/dist/{chunk-6xcmeev9.js → chunk-f5n871gp.js} +5 -5
  63. package/dist/{chunk-81ysx0tc.js → chunk-fffjjgnt.js} +2 -2
  64. package/dist/{chunk-wzyc9da7.js → chunk-frhdk0p9.js} +2 -2
  65. package/dist/chunk-frhh6jd3.js +2 -0
  66. package/dist/{chunk-b3n1m4m5.js → chunk-g046t3hb.js} +1 -1
  67. package/dist/chunk-g1gqysb4.js +2 -0
  68. package/dist/{chunk-110s34yg.js → chunk-gr8q8xqz.js} +3 -3
  69. package/dist/{chunk-emf6ee94.js → chunk-gsrdjmw9.js} +2 -2
  70. package/dist/{chunk-r96ahk8s.js → chunk-gwdffrz6.js} +9 -9
  71. package/dist/chunk-h7rcb74n.js +2 -0
  72. package/dist/{chunk-jcwtw3hd.js → chunk-h9gjt73q.js} +2 -2
  73. package/dist/chunk-hg9354gt.js +2 -0
  74. package/dist/{chunk-s6td2c1k.js → chunk-hhk46fzp.js} +2 -2
  75. package/dist/chunk-j3x3e353.js +2 -0
  76. package/dist/chunk-j6r964wk.js +2 -0
  77. package/dist/chunk-je8ma636.js +2 -0
  78. package/dist/chunk-jpyk0gtr.js +3 -0
  79. package/dist/{chunk-v5tzcd49.js → chunk-jqjw00qm.js} +12 -12
  80. package/dist/{chunk-vm68yvgf.js → chunk-jqsn4sgv.js} +6 -6
  81. package/dist/{chunk-5m0nyt8d.js → chunk-jt5cqq09.js} +3 -3
  82. package/dist/chunk-k0pm7p0f.js +2 -0
  83. package/dist/chunk-k1pyzf9e.js +2 -0
  84. package/dist/{chunk-eg2p1cyw.js → chunk-k47addf7.js} +29 -29
  85. package/dist/{chunk-qpz9jrvw.js → chunk-k7dvn2r8.js} +2 -2
  86. package/dist/{chunk-fa3ygt8c.js → chunk-kd06c90f.js} +4 -4
  87. package/dist/{chunk-9sjtph54.js → chunk-krtkxnz6.js} +2 -2
  88. package/dist/chunk-kybes29w.js +2 -0
  89. package/dist/{chunk-25m74mh1.js → chunk-m05pqmcj.js} +5 -5
  90. package/dist/chunk-m276y4f3.js +2 -0
  91. package/dist/{chunk-907zya76.js → chunk-m6nhh5xf.js} +9 -9
  92. package/dist/{chunk-cww1zk8y.js → chunk-m710wkr4.js} +1 -1
  93. package/dist/chunk-nnbr1q94.js +2 -0
  94. package/dist/chunk-nq2z2yrz.js +2 -0
  95. package/dist/chunk-p2chmq36.js +2 -0
  96. package/dist/chunk-p9sbpbhg.js +2 -0
  97. package/dist/{chunk-3qyz80d6.js → chunk-pkq96sqk.js} +6 -6
  98. package/dist/chunk-q2d8x7p1.js +2 -0
  99. package/dist/{chunk-cz2s176s.js → chunk-qa1pcm7n.js} +5 -5
  100. package/dist/{chunk-tm5t3hh3.js → chunk-qa4vs1qg.js} +3 -3
  101. package/dist/{chunk-5ghw26vq.js → chunk-qahz3n8z.js} +2 -2
  102. package/dist/{chunk-jm0qsr3s.js → chunk-qev14f76.js} +6 -6
  103. package/dist/{chunk-tb5h85ag.js → chunk-qjc3qjyf.js} +2 -2
  104. package/dist/chunk-r0btg48x.js +2 -0
  105. package/dist/{chunk-qay7pgnq.js → chunk-r0k5jbvk.js} +1 -1
  106. package/dist/{chunk-ks0dwtp0.js → chunk-r2p2nyyq.js} +3 -3
  107. package/dist/chunk-ryb4jesm.js +2 -0
  108. package/dist/{chunk-bttvkzxh.js → chunk-s0pnyd2f.js} +6 -6
  109. package/dist/{chunk-dv9q56r7.js → chunk-s37af6rd.js} +2 -2
  110. package/dist/chunk-sa18tper.js +20 -0
  111. package/dist/{chunk-2xf323h9.js → chunk-scaawv2r.js} +3 -3
  112. package/dist/chunk-sjpya8wm.js +2 -0
  113. package/dist/chunk-sy0jtgmv.js +42 -0
  114. package/dist/chunk-sznk5c66.js +2 -0
  115. package/dist/{chunk-c541s99z.js → chunk-t23jn83r.js} +4 -4
  116. package/dist/{chunk-fez9828r.js → chunk-t74qb5ej.js} +3 -3
  117. package/dist/chunk-t7ws9sth.js +2 -0
  118. package/dist/{chunk-fr658fhd.js → chunk-tbs24vx1.js} +2 -2
  119. package/dist/{chunk-acwdf0cf.js → chunk-td6b41vj.js} +4 -4
  120. package/dist/chunk-tdtwqydq.js +2 -0
  121. package/dist/{chunk-ga650crj.js → chunk-tm1ec751.js} +9 -9
  122. package/dist/{chunk-prnebmz1.js → chunk-tmftv8na.js} +102 -102
  123. package/dist/chunk-tpax2gpz.js +2 -0
  124. package/dist/chunk-ts6sm467.js +2 -0
  125. package/dist/{chunk-46t924aw.js → chunk-v4bqmzj9.js} +2 -2
  126. package/dist/chunk-w005b56n.js +2 -0
  127. package/dist/{chunk-ema1c29k.js → chunk-w032x0zm.js} +2 -2
  128. package/dist/chunk-w8aj3f9v.js +2 -0
  129. package/dist/{chunk-ma9yq04p.js → chunk-wzv7k91a.js} +2 -2
  130. package/dist/chunk-x4077p94.js +2 -0
  131. package/dist/{chunk-3c2hgvag.js → chunk-x80b12gr.js} +3 -3
  132. package/dist/{chunk-sz2nax5v.js → chunk-xa1f13nk.js} +56 -56
  133. package/dist/{chunk-ybgzr6wn.js → chunk-xe8m66a3.js} +104 -102
  134. package/dist/{chunk-9qxx2teq.js → chunk-xndr2dx9.js} +6 -6
  135. package/dist/chunk-xrdh4at4.js +2 -0
  136. package/dist/chunk-y8qdpb0p.js +2 -0
  137. package/dist/chunk-ydjy26ch.js +2 -0
  138. package/dist/{chunk-k44qj40k.js → chunk-ym5qgw03.js} +2 -2
  139. package/dist/chunk-yx37mvy7.js +2 -0
  140. package/dist/{chunk-na1x46xm.js → chunk-z0qfspzg.js} +3 -3
  141. package/dist/chunk-z278w3cb.js +2 -0
  142. package/dist/chunk-z33esms3.js +3 -0
  143. package/dist/{chunk-hpaj7zjv.js → chunk-z46mk8ym.js} +4 -4
  144. package/dist/chunk-znfzh6fm.js +2 -0
  145. package/dist/chunk-zteccxj9.js +2 -0
  146. package/dist/cli.js +20 -20
  147. package/dist/component-renderer.d.ts +1 -0
  148. package/dist/component-renderer.js +28 -4
  149. package/dist/craft-entry.js +2 -2
  150. package/dist/craft.js +2 -2
  151. package/dist/native/floating-actions.d.ts +43 -0
  152. package/dist/native/floating-actions.js +50 -0
  153. package/dist/native/index.d.ts +1 -0
  154. package/dist/native/index.js +1 -0
  155. package/dist/native/primitives/FloatingActions.stx +42 -0
  156. package/dist/native/runtime/browser-screen.js +3 -8
  157. package/dist/pwa.js +3 -3
  158. package/dist/safe-evaluator.d.ts +10 -0
  159. package/dist/safe-evaluator.js +24 -5
  160. package/dist/server-bindings.d.ts +11 -0
  161. package/dist/server-bindings.js +27 -0
  162. package/dist/ssg.js +15 -15
  163. package/dist/stx-virtual-ts.d.ts +31 -0
  164. package/dist/stx-virtual-ts.js +49 -2
  165. package/dist/typecheck.d.ts +1 -1
  166. package/dist/typecheck.js +5 -4
  167. package/package.json +5 -5
  168. package/dist/chunk-0d4zhbjz.js +0 -2
  169. package/dist/chunk-0vbt87cv.js +0 -2
  170. package/dist/chunk-11snc6n0.js +0 -2
  171. package/dist/chunk-1menbxwb.js +0 -2
  172. package/dist/chunk-1na30z8t.js +0 -2
  173. package/dist/chunk-1pf4y2yr.js +0 -2
  174. package/dist/chunk-1rban2td.js +0 -2
  175. package/dist/chunk-31rtwv90.js +0 -2
  176. package/dist/chunk-341c732h.js +0 -2
  177. package/dist/chunk-343hxxq1.js +0 -2
  178. package/dist/chunk-37bzsnr7.js +0 -2
  179. package/dist/chunk-3m6n90sk.js +0 -2
  180. package/dist/chunk-5bm8hmwd.js +0 -2
  181. package/dist/chunk-6bemqsdj.js +0 -2
  182. package/dist/chunk-6hd83cj4.js +0 -2
  183. package/dist/chunk-77fs8281.js +0 -2
  184. package/dist/chunk-79pgjds2.js +0 -2
  185. package/dist/chunk-86z8zrn9.js +0 -3
  186. package/dist/chunk-8xb9ecb9.js +0 -2
  187. package/dist/chunk-9c6yvh3p.js +0 -2
  188. package/dist/chunk-9fxeqf0e.js +0 -2
  189. package/dist/chunk-9m96yv69.js +0 -2
  190. package/dist/chunk-atsjexk0.js +0 -2
  191. package/dist/chunk-bcefawtc.js +0 -2
  192. package/dist/chunk-byjjz7h8.js +0 -2
  193. package/dist/chunk-c0azgkss.js +0 -2
  194. package/dist/chunk-cbz7jtzf.js +0 -2
  195. package/dist/chunk-cq06hsm4.js +0 -2
  196. package/dist/chunk-dsh91n7n.js +0 -2
  197. package/dist/chunk-evdskc25.js +0 -2
  198. package/dist/chunk-f8akfzzn.js +0 -2
  199. package/dist/chunk-f8wmxwa3.js +0 -2
  200. package/dist/chunk-fseqwysr.js +0 -2
  201. package/dist/chunk-g891ftgz.js +0 -2
  202. package/dist/chunk-gc7gh0g0.js +0 -2
  203. package/dist/chunk-gg48cgx3.js +0 -2
  204. package/dist/chunk-gzx1f8ay.js +0 -2
  205. package/dist/chunk-h526qmg2.js +0 -2
  206. package/dist/chunk-hazd1sh8.js +0 -2
  207. package/dist/chunk-j08r18x1.js +0 -2
  208. package/dist/chunk-j1sm889p.js +0 -2
  209. package/dist/chunk-j539dz72.js +0 -2
  210. package/dist/chunk-jmqwpnpd.js +0 -2
  211. package/dist/chunk-jqngvqby.js +0 -2
  212. package/dist/chunk-k33kgf8a.js +0 -2
  213. package/dist/chunk-ke8rxpp9.js +0 -2
  214. package/dist/chunk-kvttzk86.js +0 -2
  215. package/dist/chunk-mbcqpcyt.js +0 -20
  216. package/dist/chunk-mfbqjkgp.js +0 -3
  217. package/dist/chunk-my8257pf.js +0 -2
  218. package/dist/chunk-nm04926f.js +0 -2
  219. package/dist/chunk-nnnf8cjv.js +0 -2
  220. package/dist/chunk-p2fkggw4.js +0 -3
  221. package/dist/chunk-q18508s2.js +0 -2
  222. package/dist/chunk-r6085mp4.js +0 -2
  223. package/dist/chunk-rke4q3jk.js +0 -2
  224. package/dist/chunk-s4wcksaw.js +0 -3
  225. package/dist/chunk-se79v0pe.js +0 -2
  226. package/dist/chunk-twfx2scr.js +0 -2
  227. package/dist/chunk-txs1vxas.js +0 -42
  228. package/dist/chunk-v7d7m4k1.js +0 -2
  229. package/dist/chunk-vdb3p2v3.js +0 -2
  230. package/dist/chunk-vm2y05sr.js +0 -2
  231. package/dist/chunk-xc1k2zza.js +0 -2
@@ -0,0 +1,43 @@
1
+ import type { NativeAccessoryMenuItem, NativeTabAccessory } from './runtime/craft';
2
+ /**
3
+ * The floating actions of a screen, or of the whole app, in the order they
4
+ * read: top to bottom in a vertical group, leading to trailing otherwise.
5
+ *
6
+ * It answers with the `tabAccessory` a host draws them from, for
7
+ * `craft.navigation.setChrome` (every screen) and `setOptions` (one screen);
8
+ * no actions answers `null`, which takes the group away.
9
+ *
10
+ * ```ts
11
+ * craft.navigation.setChrome({
12
+ * tabAccessory: floatingActions([
13
+ * { path: '/add', label: 'Add', symbol: 'plus', menu: [{ path: '/workouts/new', title: 'Workout', symbol: 'dumbbell' }] },
14
+ * { path: '/messages', label: 'Messages', symbol: 'message.fill', badge: unread },
15
+ * ]),
16
+ * })
17
+ * ```
18
+ *
19
+ * The host's group has one primary action, the last: it alone shows a badge,
20
+ * and it always opens its path. A badge or a menu anywhere else is a mistake
21
+ * in the list rather than something to draw differently, so it is refused.
22
+ */
23
+ export declare function floatingActions(actions: ReadonlyArray<NativeFloatingAction | null | undefined | false>, layout?: NativeFloatingActionsLayout): NativeTabAccessory | null;
24
+ /** The most actions one group holds. */
25
+ export declare const MAX_FLOATING_ACTIONS: 3;
26
+ /**
27
+ * One floating action: a round control over the screen that opens a path of
28
+ * the app, or a short menu of them. Named for what it does (`label`), drawn
29
+ * as a symbol.
30
+ */
31
+ export declare interface NativeFloatingAction {
32
+ path: string
33
+ label: string
34
+ symbol: string
35
+ accessibilityLabel?: string
36
+ badge?: string | number | null
37
+ menu?: NativeAccessoryMenuItem[]
38
+ }
39
+ /**
40
+ * `vertical` and `horizontal` join the actions in one capsule of glass, as the
41
+ * map controls in Maps are joined; `separate` keeps a round control each.
42
+ */
43
+ export type NativeFloatingActionsLayout = 'vertical' | 'horizontal' | 'separate';
@@ -0,0 +1,50 @@
1
+ export const MAX_FLOATING_ACTIONS = 3;
2
+ function badgeText(badge) {
3
+ if (typeof badge === "number")
4
+ return badge > 99 ? "99+" : badge > 0 ? String(Math.floor(badge)) : null;
5
+ return badge ? String(badge).slice(0, 8) : null;
6
+ }
7
+ export function floatingActions(actions, layout = "vertical") {
8
+ if (!Array.isArray(actions))
9
+ throw TypeError("floatingActions needs a list of actions");
10
+ if (layout !== "vertical" && layout !== "horizontal" && layout !== "separate")
11
+ throw TypeError(`floatingActions: unknown layout "${String(layout)}"`);
12
+ const list = actions.filter(Boolean);
13
+ if (!list.length)
14
+ return null;
15
+ if (list.length > MAX_FLOATING_ACTIONS)
16
+ throw TypeError(`floatingActions holds at most ${MAX_FLOATING_ACTIONS} actions, got ${list.length}`);
17
+ const seen = new Set;
18
+ for (const action of list) {
19
+ if (typeof action.path !== "string" || !action.path.startsWith("/") || action.path.startsWith("//"))
20
+ throw TypeError(`floatingActions: "${String(action.path)}" is not a path of the app`);
21
+ if (!action.label || !action.symbol)
22
+ throw TypeError(`floatingActions: ${action.path} needs a label and a symbol`);
23
+ if (seen.has(action.path))
24
+ throw TypeError(`floatingActions: ${action.path} is listed twice`);
25
+ seen.add(action.path);
26
+ }
27
+ const primary = list[list.length - 1];
28
+ if (primary.menu?.length)
29
+ throw TypeError(`floatingActions: the last action (${primary.path}) opens its path; put the menu on an earlier one`);
30
+ const companions = list.slice(0, -1).map((action) => {
31
+ if (badgeText(action.badge))
32
+ throw TypeError(`floatingActions: only the last action shows a badge, not ${action.path}`);
33
+ return {
34
+ path: action.path,
35
+ title: action.label,
36
+ symbol: action.symbol,
37
+ ...action.accessibilityLabel ? { accessibilityLabel: action.accessibilityLabel } : {},
38
+ ...action.menu?.length ? { menu: action.menu.map((choice) => ({ ...choice })) } : {}
39
+ };
40
+ });
41
+ return {
42
+ path: primary.path,
43
+ title: primary.label,
44
+ symbol: primary.symbol,
45
+ ...primary.accessibilityLabel ? { accessibilityLabel: primary.accessibilityLabel } : {},
46
+ badge: badgeText(primary.badge),
47
+ ...layout === "separate" ? { iconOnly: !0 } : { layout },
48
+ companions
49
+ };
50
+ }
@@ -70,6 +70,7 @@ export * from './compiler/icons';
70
70
  export * from './cli';
71
71
  export * from './runtime/shared-screen';
72
72
  export * from './live-activity';
73
+ export * from './floating-actions';
73
74
  // Bridge exports
74
75
  export * from './bridge/protocol';
75
76
  // Component exports
@@ -9,6 +9,7 @@ export * from "./compiler/icons.js";
9
9
  export * from "./cli.js";
10
10
  export * from "./runtime/shared-screen.js";
11
11
  export * from "./live-activity.js";
12
+ export * from "./floating-actions.js";
12
13
  export * from "./bridge/protocol.js";
13
14
  export * from "./components/primitives.js";
14
15
  export {
@@ -0,0 +1,42 @@
1
+ {{--
2
+ FloatingActions: the round controls that float over a screen, above the
3
+ trailing end of the tab bar, joined in one capsule of glass as the map
4
+ controls in Maps are.
5
+
6
+ <FloatingActions :actions="[
7
+ { path: '/add', label: 'Add', symbol: 'plus', menu: addChoices },
8
+ { path: '/messages', label: 'Messages', symbol: 'message.fill', badge: unread },
9
+ ]" />
10
+
11
+ `layout` is `vertical` (the default), `horizontal`, or `separate` for a
12
+ round control each. The host draws them (Liquid Glass on iOS 26), so this
13
+ takes no room in the screen's own layout; they follow `actions` as it
14
+ changes and leave with the screen. For actions every screen shares, pass
15
+ `floatingActions()` from `@stacksjs/stx/native` to `craft.navigation.setChrome`.
16
+ --}}
17
+ <script client>
18
+ import { floatingActions } from '../floating-actions'
19
+
20
+ const floatingList = useReactiveProp('actions', [])
21
+ const floatingLayout = useReactiveProp('layout', 'vertical')
22
+ // A page drawn by a browser has no host chrome to put them in.
23
+ const floatingHost = typeof craft !== 'undefined' && craft && craft.navigation ? craft.navigation : null
24
+ let floatingSent = ''
25
+
26
+ effect(() => {
27
+ if (!floatingHost) return
28
+ const list = floatingList()
29
+ const accessory = floatingActions(Array.isArray(list) ? list : [], String(floatingLayout() || 'vertical'))
30
+ // The same actions again (a parent re-rendered) are not a change to draw.
31
+ const next = JSON.stringify(accessory)
32
+ // Nor is having none before any were shown: there is nothing to take away.
33
+ if (next === floatingSent || (accessory === null && !floatingSent)) return
34
+ floatingSent = next
35
+ floatingHost.setOptions({ tabAccessory: accessory })
36
+ })
37
+
38
+ onDestroy(() => {
39
+ if (floatingHost && floatingSent && floatingSent !== 'null') floatingHost.setOptions({ tabAccessory: null })
40
+ })
41
+ </script>
42
+ <div data-native="View" class="hidden" aria-hidden="true" data-floating-actions></div>
@@ -138,7 +138,7 @@ export function createBrowserScreenBridge(platform, options) {
138
138
  actionContainer.setAttribute("data-tab-accessory-group", primary.layout);
139
139
  actionContainer.setAttribute("role", "group");
140
140
  actionContainer.setAttribute("aria-label", primary.accessibilityLabel || primary.title);
141
- actionContainer.style.cssText = `position:absolute;z-index:2;inset-inline-end:20px;bottom:calc(100% + 8px);display:flex;flex-direction:${primary.layout === "vertical" ? "column" : "row"};padding:2px;border-radius:26px;background:color-mix(in srgb,currentColor 8%,transparent);backdrop-filter:blur(20px);box-shadow:0 4px 16px #0002`;
141
+ actionContainer.style.cssText = `position:absolute;z-index:2;inset-inline-end:22px;bottom:calc(100% + 10px);display:flex;flex-direction:${primary.layout === "vertical" ? "column" : "row"};border-radius:24px;background:color-mix(in srgb,currentColor 8%,transparent);backdrop-filter:blur(20px) saturate(180%);-webkit-backdrop-filter:blur(20px) saturate(180%);box-shadow:inset 0 0 0 .5px color-mix(in srgb,currentColor 18%,transparent),0 4px 16px #0002`;
142
142
  tabs.append(actionContainer);
143
143
  }
144
144
  const actions = primary ? [...(primary.companions || []).slice(0, 2), primary] : [];
@@ -151,13 +151,8 @@ export function createBrowserScreenBridge(platform, options) {
151
151
  button.setAttribute("aria-label", `${item.accessibilityLabel || item.title}${item.badge ? `, ${item.badge}` : ""}`);
152
152
  button.style.cssText = "position:relative;display:flex;align-items:center;justify-content:center;width:56px;height:56px;flex-shrink:0;border:0;border-radius:50%;background:#8882;color:inherit";
153
153
  if (grouped) {
154
- button.style.cssText = "position:relative;display:flex;align-items:center;justify-content:center;width:48px;height:48px;flex-shrink:0;border:0;border-radius:24px;background:transparent;color:inherit;cursor:pointer";
155
- if (actionContainer.children.length) {
156
- const separator = document.createElement("span");
157
- separator.setAttribute("aria-hidden", "true");
158
- separator.style.cssText = primary?.layout === "vertical" ? "height:1px;margin:0 12px;background:#8885" : "width:1px;margin:12px 0;background:#8885";
159
- actionContainer.append(separator);
160
- }
154
+ const vertical = primary?.layout === "vertical";
155
+ button.style.cssText = `position:relative;display:flex;align-items:center;justify-content:center;width:${vertical ? 48 : 52}px;height:${vertical ? 52 : 48}px;flex-shrink:0;border:0;border-radius:24px;background:transparent;color:inherit;cursor:pointer`;
161
156
  }
162
157
  const holder = document.createElement("span");
163
158
  button.append(holder);
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{so,Vt,$l,Og}from"./chunk-c541s99z.js";import{ro,Li,Ag,Pg,Ig}from"./chunk-bttvkzxh.js";import{Cl,El,Tl,$g,Rg}from"./chunk-wzyc9da7.js";import{We,Pn,ji}from"./chunk-9sjtph54.js";import{Ng,Dg,Mg,Lg,oo,vy}from"./chunk-wdwx2aa6.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
- Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-jmqwpnpd.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
2
+ import{so,Ut,Rl,Ng}from"./chunk-t23jn83r.js";import{ro,ji,Pg,Ig,Og}from"./chunk-s0pnyd2f.js";import{El,Tl,$l,Rg,Ag}from"./chunk-frhdk0p9.js";import{We,Pn,Bi}from"./chunk-krtkxnz6.js";import{Mg,Dg,Lg,jg,oo,Sy}from"./chunk-amerebya.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
+ Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-w005b56n.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
233
233
  }, 5000);
234
234
  </script>
235
235
  </body>
236
- </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=We(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=so(n,t);if(a){let s=Vt(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Li(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,El as auditBuildOutput,Cl as auditConfig,re as buildPwaAssets,Tl as calculateAuditResult,Rg as formatAuditResult,ji as formatSize,j as generateManifest,_ as generateManifestJson,Pg as generateManifestLink,F as generateOfflinePage,We as generatePrecacheManifest,Pn as generatePrecacheManifestJs,M as generatePwaIcons,ro as generatePwaTags,so as generateServiceWorker,Og as generateServiceWorkerAuto,Ag as generateSwRegistrationScript,Ig as generateThemeColorMeta,N as getExpectedIconPaths,Vt as getServiceWorkerFileName,Li as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,$l as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,oo as pwaDirectives,Ng as pwaInstallDirective,Mg as pwaOfflineDirective,Lg as pwaPushDirective,Dg as pwaUpdateDirective,vy as registerPwaDirectives,$g as runPwaAudit,D as validateManifest};
236
+ </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=We(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=so(n,t);if(a){let s=Ut(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return ji(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,Tl as auditBuildOutput,El as auditConfig,re as buildPwaAssets,$l as calculateAuditResult,Ag as formatAuditResult,Bi as formatSize,j as generateManifest,_ as generateManifestJson,Ig as generateManifestLink,F as generateOfflinePage,We as generatePrecacheManifest,Pn as generatePrecacheManifestJs,M as generatePwaIcons,ro as generatePwaTags,so as generateServiceWorker,Ng as generateServiceWorkerAuto,Pg as generateSwRegistrationScript,Og as generateThemeColorMeta,N as getExpectedIconPaths,Ut as getServiceWorkerFileName,ji as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Rl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,oo as pwaDirectives,Mg as pwaInstallDirective,Lg as pwaOfflineDirective,jg as pwaPushDirective,Dg as pwaUpdateDirective,Sy as registerPwaDirectives,Rg as runPwaAudit,D as validateManifest};
@@ -139,6 +139,16 @@ export declare function safeEvaluateArray(expression: string, context: Record<st
139
139
  * @returns Object result, defaults to empty object on error
140
140
  */
141
141
  export declare function safeEvaluateObject(expression: string, context: Record<string, unknown>): Record<string, unknown>;
142
+ /**
143
+ * How many compiles were asked for, and how many came back as someone else's
144
+ * code and had to be retried. Zero mismatches on a correct runtime; a non-zero
145
+ * count is the runtime bug above happening, and being caught.
146
+ */
147
+ export declare function compileVerificationStats(): {
148
+ compiles: number;
149
+ mismatches: number;
150
+ };
151
+ export declare function compileVerified(params: readonly string[], body: string): (...args: unknown[]) => unknown;
142
152
  /**
143
153
  * The variables an expression actually reads from its surrounding scope.
144
154
  *
@@ -467,12 +467,31 @@ const RESERVED_PARAM_NAMES = new Set([
467
467
  "arguments",
468
468
  "eval",
469
469
  "await"
470
- ]), COMPILED_EXPRESSION_LIMIT = 2000, compiledExpressions = new Map;
470
+ ]), COMPILE_PROBE_SECRET = `stx-compile-probe:${globalThis.crypto.randomUUID()}`;
471
+ let compileSequence = 0, compileMismatches = 0;
472
+ export function compileVerificationStats() {
473
+ return { compiles: compileSequence, mismatches: compileMismatches };
474
+ }
475
+ export function compileVerified(params, body) {
476
+ let probeParam = "__stx_compile_probe";
477
+ while (params.includes(probeParam))
478
+ probeParam += "_";
479
+ const probeArgs = Array.from({ length: params.length + 1 });
480
+ probeArgs[params.length] = COMPILE_PROBE_SECRET;
481
+ for (let attempt = 0;attempt < 16; attempt++) {
482
+ const token = `c${++compileSequence}`, guard = `'use strict';if(${probeParam}===${JSON.stringify(COMPILE_PROBE_SECRET)})return ${JSON.stringify(token)};`, compiled = Function(...params, probeParam, guard + body);
483
+ if (compiled(...probeArgs) === token)
484
+ return compiled;
485
+ compileMismatches++;
486
+ }
487
+ throw Error("[stx] the JavaScript runtime repeatedly returned code compiled from a different source; refusing to evaluate with it.");
488
+ }
489
+ const COMPILED_EXPRESSION_LIMIT = 2000, compiledExpressions = new Map;
471
490
  function compileFunctionBody(params, body) {
472
491
  const key = `${params.join(",")}\x00${body}`, cached = compiledExpressions.get(key);
473
492
  if (cached)
474
493
  return cached;
475
- const compiled = Function(...params, body);
494
+ const compiled = compileVerified(params, body);
476
495
  if (compiledExpressions.size >= COMPILED_EXPRESSION_LIMIT)
477
496
  compiledExpressions.clear();
478
497
  compiledExpressions.set(key, compiled);
@@ -606,7 +625,7 @@ export function safeEvaluateCode(code, context) {
606
625
  if (pattern.test(stripped))
607
626
  throw Error("Potentially unsafe code detected");
608
627
  const safeContext = createSafeContext(context), keys = Object.keys(safeContext).filter((key) => key !== "Object" && isUsableParamName(key) && !DANGEROUS_IDENTIFIERS.has(key)), values = keys.map((key) => safeContext[key]);
609
- return Function("Object", ...SHADOWED_GLOBAL_NAMES, ...keys, `
628
+ return compileVerified(["Object", ...SHADOWED_GLOBAL_NAMES, ...keys], `
610
629
  'use strict';
611
630
  ${code}
612
631
  `)(SAFE_OBJECT, ...SHADOWED_GLOBAL_VALUES, ...values);
@@ -656,7 +675,7 @@ export function createSafeLoopFunction(loopType, expression, body, contextKeys,
656
675
  return (...args) => String(guarded(...args) ?? "");
657
676
  };
658
677
  if (loopType === "for") {
659
- const compiled = Function(SAFE_CTOR_PARAM, "Object", ...SHADOWED_GLOBAL_NAMES, "__stx_warn", ...filteredKeys, `
678
+ const compiled = compileVerified([SAFE_CTOR_PARAM, "Object", ...SHADOWED_GLOBAL_NAMES, "__stx_warn", ...filteredKeys], `
660
679
  'use strict';
661
680
  let result = '';
662
681
  for (${expression}) {
@@ -667,7 +686,7 @@ export function createSafeLoopFunction(loopType, expression, body, contextKeys,
667
686
  `);
668
687
  return projectAndBind(compiled);
669
688
  } else {
670
- const compiled = Function(SAFE_CTOR_PARAM, "Object", ...SHADOWED_GLOBAL_NAMES, "__stx_warn", ...filteredKeys, `
689
+ const compiled = compileVerified([SAFE_CTOR_PARAM, "Object", ...SHADOWED_GLOBAL_NAMES, "__stx_warn", ...filteredKeys], `
671
690
  'use strict';
672
691
  let result = '';
673
692
  let __safeCounter = 0;
@@ -16,6 +16,17 @@ export declare function reactiveLoopRanges(template: string): Array<[number, num
16
16
  * which needs the names to keep treating them as the loop's.
17
17
  */
18
18
  export declare function reactiveLoopScopes(template: string): Array<{ start: number, end: number, names: string[], tag: string }>;
19
+ /**
20
+ * Element start offsets that are a LATER child of a sibling-margin stack, with
21
+ * the utility that makes the parent one.
22
+ *
23
+ * `space-y-*` and `space-x-*` put their margin on the parent's direct children
24
+ * after the first. That is the one place a component's scope wrapper is
25
+ * visible: it generates no box, so a margin that lands on it is dropped and the
26
+ * component renders flush against the sibling before it (stacksjs/stx#2178).
27
+ * Only the first child is exempt, because it never receives the margin.
28
+ */
29
+ export declare function siblingMarginChildren(template: string): Map<number, string>;
19
30
  /**
20
31
  * Process server-side `:attr="expr"` bindings in a template.
21
32
  *
@@ -69,6 +69,33 @@ export function reactiveLoopScopes(template) {
69
69
  }
70
70
  return ranges;
71
71
  }
72
+ const SIBLING_MARGIN_UTILITY = /(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;
73
+ export function siblingMarginChildren(template) {
74
+ const later = new Map, stack = [];
75
+ for (const tag of scanHtmlTags(template)) {
76
+ const tagName = tag.name.toLowerCase();
77
+ if (tag.closing) {
78
+ for (let i = stack.length - 1;i >= 0; i--)
79
+ if (stack[i].name === tagName) {
80
+ stack.length = i;
81
+ break;
82
+ }
83
+ continue;
84
+ }
85
+ const parent = stack.at(-1);
86
+ if (parent) {
87
+ if (parent.utility && parent.children > 0)
88
+ later.set(tag.start, parent.utility);
89
+ if (!/(?:^|\s)hidden(?=[\s=]|$)/.test(tag.attributes))
90
+ parent.children++;
91
+ }
92
+ if (!tag.selfClosing && !VOID_TAGS.has(tagName)) {
93
+ const classes = /(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(tag.attributes)?.[2];
94
+ stack.push({ name: tagName, utility: classes ? SIBLING_MARGIN_UTILITY.exec(classes)?.[1] ?? null : null, children: 0 });
95
+ }
96
+ }
97
+ return later;
98
+ }
72
99
  function resolveClassBinding(value) {
73
100
  if (typeof value === "string")
74
101
  return value;
package/dist/ssg.js CHANGED
@@ -1,22 +1,22 @@
1
1
  // @bun
2
- import"./chunk-hpwtjb4a.js";import{x,ll}from"./chunk-eg2p1cyw.js";import"./chunk-0wms5teg.js";import"./chunk-xppm4cs4.js";import{At,y}from"./chunk-ybgzr6wn.js";import"./chunk-46t924aw.js";import"./chunk-5ghw26vq.js";import"./chunk-jtccqpwa.js";import{_t,Ct,Et,Tt,$t,Rt}from"./chunk-t4dkcf28.js";import{a}from"./chunk-5njk2ba0.js";import{As}from"./chunk-09412heg.js";import"./chunk-nws4zm4k.js";import"./chunk-cz2s176s.js";import{ye,nn,rn}from"./chunk-hpaj7zjv.js";import"./chunk-s4wcksaw.js";import{b}from"./chunk-fxk08je0.js";import{bt,i}from"./chunk-sz2nax5v.js";import"./chunk-txs1vxas.js";import"./chunk-v5tzcd49.js";import{ys}from"./chunk-907zya76.js";import"./chunk-ysqzz2h3.js";import"./chunk-t5q31st4.js";import{rc,sc,oc}from"./chunk-tm5t3hh3.js";import{en,tr,nr}from"./chunk-86z8zrn9.js";import{tn}from"./chunk-fr658fhd.js";import"./chunk-mfbqjkgp.js";import"./chunk-cww1zk8y.js";import{G,ve}from"./chunk-5x8q6e1q.js";import"./chunk-he9dzchk.js";import"./chunk-ks0dwtp0.js";import{c}from"./chunk-p2fkggw4.js";import{s,me}from"./chunk-jm0qsr3s.js";import D from"fs";import f from"path";import{createHash as vt}from"crypto";function Pt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var kt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Dt(t){return Bun.hash(t).toString(16)}function ot(t,r={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let n=new Map,o=t.replace(kt,(e,u,g,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(g))return e;if(r.minify)w=Pt(w);let p=Dt(w);if(!n.has(p))n.set(p,w);let P=r.integrity?` data-stx-integrity="sha384-${vt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),l=Array.from(n,([e,u])=>({hash:e,code:u}));return{html:o,chunks:l}}var It=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let r=new Map,n=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=n.exec(t))!==null)r.set(o[1],o[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(r.get(u[1])||""))l.add(u[2]);let g=/<\/head\s*>/iy,v=y(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(l.size===0||v===-1)return t;let w=Array.from(l).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!w)return t;return t.slice(0,v)+w+t.slice(v)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let r=t.trim();if(!r)return null;let n=/^https?:\/\//i.test(r)?r:`https://${r}`;try{return new URL(n).origin+new URL(n).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let r of Bt){let n=t[r];if(!n)continue;let o=X(n);if(o)return{url:o,source:"env",via:r}}return null}function lt(t){if(!t||typeof t!=="object")return null;let r=t,n=r.site?.url??r.url??r.app?.url;return typeof n==="string"?X(n):null}async function Ft(t){let{existsSync:r}=await import("fs"),n=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=n.resolve(t,o);if(!r(l))continue;try{let e=await import(l),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let r=t.cwd??process.cwd(),n=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let l=await Ft(r);if(l)return{url:l,source:"site.config",via:"url"};let e=jt(n);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
- `)}function J(t){return async()=>({paths:await t(),fallback:!1})}var Ot;function Lt(t){let r=s(t),{depths:n}=me(r),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(r))!==null){if(n[l.index]!==0)continue;let u=x(r,"(",")",o.lastIndex-1),g=r.indexOf("{",u+1),v=x(r,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(l.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(r))!==null){if(n[l.index]!==0)continue;let u=ll(r,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let r="read";try{let n=await Bun.file(t).text();r="parse";let o=tn(n),l=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(s(e.attrs))).sort((e,u)=>n.indexOf(e.fullTag)-n.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(s(e.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(s(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(s(g))&&At(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");r="execute";let v=Function("defineStaticPaths",`return (${g})`)(J);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();r="result";let p=Array.isArray(w)?{paths:w}:w;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(n){return{kind:"error",phase:r,error:n instanceof Error?n:Error(String(n))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,r=""){this.cacheDir=t,this.salt=r}async load(){if(this.loaded)return;let t=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let r=JSON.parse(await Bun.file(t).text());for(let[n,o]of Object.entries(r))this.cache.set(n,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),r={};for(let[n,o]of this.cache)r[n]=o;await Bun.write(t,JSON.stringify(r))}getHash(t,r){let n=D.statSync(t),o=`${this.salt}|${t}:${n.mtimeMs}`;for(let e of r)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,r){let n=this.cache.get(t);if(!n)return null;let o=ft(r).some((u)=>D.existsSync(u)),l=[r,...n.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&ys(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||l)return this.cache.delete(t),null;let e=this.getHash(r,n.dependencies??[]);if(n.hash!==e)return this.cache.delete(t),null;return n.html}set(t,r,n,o){let l=this.getHash(r,n);this.cache.set(t,{hash:l,html:o,generatedAt:Date.now(),dependencies:n})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let r=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.join(this.cacheDir,"isr",r)}async get(t){let r=this.getFilePath(t);if(!await Bun.file(r).exists())return null;try{return JSON.parse(await Bun.file(r).text())}catch{return null}}async set(t,r){let n=this.getFilePath(t);await D.promises.mkdir(f.dirname(n),{recursive:!0}),await Bun.write(n,JSON.stringify(r))}async invalidate(t){let r=this.getFilePath(t);if(await Bun.file(r).exists())await D.promises.unlink(r)}async invalidatePattern(t){let r=f.join(this.cacheDir,"isr");if(!D.existsSync(r))return;let n=await D.promises.readdir(r);for(let o of n){let l=o.replace(/_/g,"/").replace(".json","");if(t.test(l))await D.promises.unlink(f.join(r,o))}}async needsRevalidation(t){let r=await this.get(t);if(!r)return!0;return Date.now()>r.revalidateAfter}}async function Ut(t){let r=[];if(!t.isDynamic)r.push({url:t.pattern,params:{}});else{let n=await gt(t.filePath);if(n.kind==="error")throw Error(`getStaticPaths ${n.phase} failed for ${t.pattern} (${t.filePath}): ${n.error.message}`,{cause:n.error});if(n.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),r;let o=n.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),r;for(let l of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(l.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);r.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return r}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let r of ft(t))if(await Bun.file(r).exists())try{let n=await import(r);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:o,...l}=n;return l}}catch(n){console.error(`Error loading data file ${r}:`,n)}return null}async function Gt(t,r,n){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let l=o[1];if(!l.includes("getStaticProps"))return null;try{let e=l.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
2
+ import"./chunk-hpwtjb4a.js";import{x,ul}from"./chunk-k47addf7.js";import"./chunk-agbkv9ab.js";import"./chunk-xppm4cs4.js";import{Pt,y}from"./chunk-xe8m66a3.js";import"./chunk-v4bqmzj9.js";import"./chunk-qahz3n8z.js";import"./chunk-jtccqpwa.js";import{Ct,Et,Tt,$t,Rt,At}from"./chunk-8cvgm13s.js";import{a}from"./chunk-9mryv01z.js";import{As}from"./chunk-0rszcb0m.js";import"./chunk-2rg9pqmh.js";import"./chunk-qa1pcm7n.js";import{ye,rn,sn}from"./chunk-z46mk8ym.js";import"./chunk-jpyk0gtr.js";import{b}from"./chunk-ar1prdev.js";import{wt,i}from"./chunk-xa1f13nk.js";import"./chunk-sy0jtgmv.js";import"./chunk-jqjw00qm.js";import{ys}from"./chunk-m6nhh5xf.js";import"./chunk-7zxce1yw.js";import"./chunk-t5q31st4.js";import{sc,oc,ic}from"./chunk-qa4vs1qg.js";import{tn,tr,nr}from"./chunk-cwt26rvt.js";import{nn}from"./chunk-tbs24vx1.js";import"./chunk-a2shk93y.js";import"./chunk-m710wkr4.js";import{X,ve}from"./chunk-eh8g8kr1.js";import"./chunk-833y1ndd.js";import"./chunk-r2p2nyyq.js";import{c}from"./chunk-z33esms3.js";import{r,me}from"./chunk-qev14f76.js";import D from"fs";import f from"path";import{createHash as vt}from"crypto";function kt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function It(t){return Bun.hash(t).toString(16)}function ot(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,o=t.replace(Dt,(e,u,g,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(g))return e;if(n.minify)w=kt(w);let p=It(w);if(!s.has(p))s.set(p,w);let P=n.integrity?` data-stx-integrity="sha384-${vt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),l=Array.from(s,([e,u])=>({hash:e,code:u}));return{html:o,chunks:l}}var Bt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(t))!==null)n.set(o[1],o[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(Bt.has(n.get(u[1])||""))l.add(u[2]);let g=/<\/head\s*>/iy,v=y(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(l.size===0||v===-1)return t;let w=Array.from(l).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!w)return t;return t.slice(0,v)+w+t.slice(v)}var jt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function K(t){let n=t.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Ft(t){for(let n of jt){let s=t[n];if(!s)continue;let o=K(s);if(o)return{url:o,source:"env",via:n}}return null}function lt(t){if(!t||typeof t!=="object")return null;let n=t,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?K(s):null}async function Ot(t){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=s.resolve(t,o);if(!n(l))continue;try{let e=await import(l),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let n=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let u=K(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let l=await Ot(n);if(l)return{url:l,source:"site.config",via:"url"};let e=Ft(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
+ `)}function q(t){return async()=>({paths:await t(),fallback:!1})}var Lt;function Ut(t){let n=r(t),{depths:s}=me(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(n))!==null){if(s[l.index]!==0)continue;let u=x(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=x(n,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(l.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(n))!==null){if(s[l.index]!==0)continue;let u=ul(n,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let n="read";try{let s=await Bun.file(t).text();n="parse";let o=nn(s),l=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>s.indexOf(e.fullTag)-s.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Lt??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let g=Ut(u);if(/\bdefineStaticPaths\b/.test(r(g))&&Pt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(q);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();n="result";let p=Array.isArray(w)?{paths:w}:w;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let s=D.statSync(t),o=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of n)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,n){let s=this.cache.get(t);if(!s)return null;let o=ft(n).some((u)=>D.existsSync(u)),l=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&ys(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||l)return this.cache.delete(t),null;let e=this.getHash(n,s.dependencies??[]);if(s.hash!==e)return this.cache.delete(t),null;return s.html}set(t,n,s,o){let l=this.getHash(n,s);this.cache.set(t,{hash:l,html:o,generatedAt:Date.now(),dependencies:s})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let s=this.getFilePath(t);await D.promises.mkdir(f.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await D.promises.unlink(n)}async invalidatePattern(t){let n=f.join(this.cacheDir,"isr");if(!D.existsSync(n))return;let s=await D.promises.readdir(n);for(let o of s){let l=o.replace(/_/g,"/").replace(".json","");if(t.test(l))await D.promises.unlink(f.join(n,o))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function _t(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let s=await gt(t.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${t.pattern} (${t.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let l of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(l.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return n}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let n of ft(t))if(await Bun.file(n).exists())try{let s=await import(n);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...l}=s;return l}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Gt(t,n,s){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let l=o[1];if(!l.includes("getStaticProps"))return null;try{let e=l.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
4
4
  return (async function getStaticProps() {
5
5
  ${e[1]}
6
6
  })()
7
- `)(r)}catch(e){return console.error(`Error executing getStaticProps in ${n}:`,e),null}}function Nt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function mt(t,r,n={},o,l){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,r,t.filePath),v={...u||{},...g||{},...n,params:r,$route:{path:t.pattern,params:r}},w=new Set,p=[],P=[],E={...l,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{p.push(`${f.relative(process.cwd(),R.templatePath)}: ${R.message}
8
- resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let S=await i(e,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let A of ye(R))w.add(A);if(Object.keys(r).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(r)};else window.__stx_rp=${JSON.stringify(r)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${R}
7
+ `)(n)}catch(e){return console.error(`Error executing getStaticProps in ${s}:`,e),null}}function Nt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function mt(t,n,s={},o,l){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,n,t.filePath),v={...u||{},...g||{},...s,params:n,$route:{path:t.pattern,params:n}},w=new Set,p=[],P=[],E={...l,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{p.push(`${f.relative(process.cwd(),R.templatePath)}: ${R.message}
8
+ resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let S=await i(e,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let A of ye(R))w.add(A);if(Object.keys(n).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${R}
9
9
  </head>`);else S=`${R}
10
- ${S}`}if(S=await ve(S,{router:o.router}),S=await b(S),o.minify!==!1)return{html:Ht(S),dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P};return{html:S,dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P}}function Ht(t){let r=[],n=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,l;while((l=o.exec(t))!==null){let u=t.slice(n,l.index);r.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=l[1],v=l[2],w=l[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),r.push(g+v+w),n=l.index+l[0].length}let e=t.slice(n);return r.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),r.join("").trim()}function zt(t){let r=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);r=(r<<5)-r+o,r=r&r}return`"${Math.abs(r).toString(36)}"`}function Wt(t,r,n,o){if(n?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(r))return!0;return o.some((l)=>{if(l instanceof RegExp)return l.test(t);return l.endsWith("/")?t===l.slice(0,-1)||t.startsWith(l):t===l})}function qt(t,r){return`<?xml version="1.0" encoding="UTF-8"?>
10
+ ${S}`}if(S=await ve(S,{router:o.router}),S=await b(S),o.minify!==!1)return{html:Ht(S),dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P};return{html:S,dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P}}function Ht(t){let n=[],s=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,l;while((l=o.exec(t))!==null){let u=t.slice(s,l.index);n.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=l[1],v=l[2],w=l[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),n.push(g+v+w),s=l.index+l[0].length}let e=t.slice(s);return n.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function zt(t){let n=0;for(let s=0;s<t.length;s++){let o=t.charCodeAt(s);n=(n<<5)-n+o,n=n&n}return`"${Math.abs(n).toString(36)}"`}function Wt(t,n,s,o){if(s?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return o.some((l)=>{if(l instanceof RegExp)return l.test(t);return l.endsWith("/")?t===l.slice(0,-1)||t.startsWith(l):t===l})}function qt(t,n){return`<?xml version="1.0" encoding="UTF-8"?>
11
11
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
12
- ${t.map((o)=>{let l=new URL(o.loc,r).href,e=` <url>
12
+ ${t.map((o)=>{let l=new URL(o.loc,n).href,e=` <url>
13
13
  <loc>${F(l)}</loc>`;if(o.lastmod)e+=`
14
14
  <lastmod>${o.lastmod}</lastmod>`;if(o.changefreq)e+=`
15
15
  <changefreq>${o.changefreq}</changefreq>`;if(o.priority!==void 0)e+=`
16
16
  <priority>${o.priority}</priority>`;return e+=`
17
17
  </url>`,e}).join(`
18
18
  `)}
19
- </urlset>`}function F(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Jt(t,r){let n=r.map((o)=>{let l=" <item>";if(l+=`
19
+ </urlset>`}function F(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Jt(t,n){let s=n.map((o)=>{let l=" <item>";if(l+=`
20
20
  <title>${F(o.title)}</title>`,l+=`
21
21
  <link>${F(o.link)}</link>`,o.description)l+=`
22
22
  <description>${F(o.description)}</description>`;if(o.pubDate)l+=`
@@ -34,18 +34,18 @@ ${t.map((o)=>{let l=new URL(o.loc,r).href,e=` <url>
34
34
  ${t.copyright?`<copyright>${F(t.copyright)}</copyright>`:""}
35
35
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
36
36
  <atom:link href="${t.link}/rss.xml" rel="self" type="application/rss+xml"/>
37
- ${n.join(`
37
+ ${s.join(`
38
38
  `)}
39
39
  </channel>
40
- </rss>`}async function Vt(t={}){let r=Date.now();rn();let n=await a(process.cwd()),o=n.build||{},l=await ut({explicit:t.domain||o.domain,stxConfig:n});if(l.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??n?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:l.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||n?.partialsDir||"",componentsDir:t.componentsDir||n?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,w={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-1na30z8t.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-my8257pf.js"),R=await S(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let A=new pt(e.cacheDir,E);if(e.cache)await A.load();try{let{generateCss:d}=await import("./chunk-1na30z8t.js");await d('<div class="bg-black"></div>')}catch{}_t();let wt=n?.routeMiddleware?.dir||"middleware";await Et(process.cwd(),wt);let V=Ct();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let yt=n?.routeMiddleware?.global||[];oc(n?.layoutsDir,c(process.cwd()));let Z=G(".",{pagesDir:e.pagesDir,pagesDirs:n?._layerPageDirs});console.log(`Found ${Z.length} routes`);let L=[];for(let d of Z)try{let m=await Ut(d);for(let k of m)L.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=L.length+u.failedCount,console.log(`Generating ${L.length} pages...`);let U=[],Q=[];for(let d=0;d<L.length;d+=e.concurrency)Q.push(L.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:h,params:_,props:St,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let M=await Bun.file(k.filePath).text(),T=Yt(M),xt=T?.middleware?Array.isArray(T.middleware)?T.middleware:[T.middleware]:[],nt=[...yt,...xt];if(nt.length>0){let B=Tt(h,_,T||{}),H=$t(B,null,void 0,{isServer:!0}),j=await Rt(nt,H);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,z=Zt(String(C),h),O=Qt(h,e);await D.promises.mkdir(f.dirname(O),{recursive:!0}),await Bun.write(O,z),u.successCount++,u.pages.push({route:h,outputPath:O,size:Buffer.byteLength(z),cached:!1}),U.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=T?.validate;if(typeof it==="function")try{if(!await it({params:_})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=A.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,_,St,e,n);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
40
+ </rss>`}async function Vt(t={}){let n=Date.now();sn();let s=await a(process.cwd()),o=s.build||{},l=await ut({explicit:t.domain||o.domain,stxConfig:s});if(l.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:l.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,w={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-k0pm7p0f.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-j6r964wk.js"),R=await S(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let A=new pt(e.cacheDir,E);if(e.cache)await A.load();try{let{generateCss:d}=await import("./chunk-k0pm7p0f.js");await d('<div class="bg-black"></div>')}catch{}Ct();let yt=s?.routeMiddleware?.dir||"middleware";await Tt(process.cwd(),yt);let J=Et();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let St=s?.routeMiddleware?.global||[];ic(s?.layoutsDir,c(process.cwd()));let Z=X(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Z.length} routes`);let L=[];for(let d of Z)try{let m=await _t(d);for(let k of m)L.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=L.length+u.failedCount,console.log(`Generating ${L.length} pages...`);let U=[],Q=[];for(let d=0;d<L.length;d+=e.concurrency)Q.push(L.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:h,params:_,props:xt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let M=await Bun.file(k.filePath).text(),T=Yt(M),bt=T?.middleware?Array.isArray(T.middleware)?T.middleware:[T.middleware]:[],nt=[...St,...bt];if(nt.length>0){let B=$t(h,_,T||{}),N=Rt(B,null,void 0,{isServer:!0}),j=await At(nt,N);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,H=Zt(String(C),h),O=Qt(h,e);await D.promises.mkdir(f.dirname(O),{recursive:!0}),await Bun.write(O,H),u.successCount++,u.pages.push({route:h,outputPath:O,size:Buffer.byteLength(H),cached:!1}),U.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=T?.validate;if(typeof it==="function")try{if(!await it({params:_})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=A.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,_,xt,e,s);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
41
41
  ${B.includeFailures.join(`
42
42
  `)}
43
43
  Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&B.serverScriptFailures.length>0)throw Error(`${B.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
44
44
  ${B.serverScriptFailures.join(`
45
45
  `)}
46
- Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)A.set(h,k.filePath,B.dependencies,I)}let N;if(e.trailingSlash)N=f.join(e.outputDir,h,"index.html");else N=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:H}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(H.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of H){let z=f.join(j,`${C.hash}.js`);if(!await Bun.file(z).exists())await Bun.write(z,C.code);if(!g.has(C.hash)){g.add(C.hash);let O=Buffer.byteLength(C.code,"utf8");v+=O,w[C.hash]={bytes:O,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=H.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(N),{recursive:!0}),await Bun.write(N,I),!Wt(h,I,T,e.sitemapExclude))U.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,outputPath:N,size:Buffer.byteLength(I,"utf8"),cached:st};if(rt!==!1)at.revalidateAt=Date.now()+rt*1000;u.pages.push(at),u.successCount++,await e.hooks.onPageEnd?.(h,I)}catch(M){u.failedCount++,u.errors.push({route:h,error:M}),await e.hooks.onError?.(M,h),console.error(`Error generating ${h}:`,M)}}));let tt=nn();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
46
+ Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)A.set(h,k.filePath,B.dependencies,I)}let G;if(e.trailingSlash)G=f.join(e.outputDir,h,"index.html");else G=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:N}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(N.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of N){let H=f.join(j,`${C.hash}.js`);if(!await Bun.file(H).exists())await Bun.write(H,C.code);if(!g.has(C.hash)){g.add(C.hash);let O=Buffer.byteLength(C.code,"utf8");v+=O,w[C.hash]={bytes:O,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=N.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(G),{recursive:!0}),await Bun.write(G,I),!Wt(h,I,T,e.sitemapExclude))U.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,outputPath:G,size:Buffer.byteLength(I,"utf8"),cached:st};if(rt!==!1)at.revalidateAt=Date.now()+rt*1000;u.pages.push(at),u.successCount++,await e.hooks.onPageEnd?.(h,I)}catch(M){u.failedCount++,u.errors.push({route:h,error:M}),await e.hooks.onError?.(M,h),console.error(`Error generating ${h}:`,M)}}));let tt=rn();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
47
47
  `);throw Error(`Client script bundling failed:
48
- ${d}`)}if(e.cache)await A.save();if(e.generate404){let d=f.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,k={...n,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,k,m);await Bun.write(f.join(e.outputDir,"404.html"),h)}else await Bun.write(f.join(e.outputDir,"404.html"),`<!DOCTYPE html>
48
+ ${d}`)}if(e.cache)await A.save();if(e.generate404){let d=f.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,k={...s,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,k,m);await Bun.write(f.join(e.outputDir,"404.html"),h)}else await Bun.write(f.join(e.outputDir,"404.html"),`<!DOCTYPE html>
49
49
  <html lang="en">
50
50
  <head>
51
51
  <meta charset="UTF-8">
@@ -66,7 +66,7 @@ ${d}`)}if(e.cache)await A.save();if(e.generate404){let d=f.join(e.pagesDir,"404.
66
66
  <a href="/">Go home</a>
67
67
  </div>
68
68
  </body>
69
- </html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...n,minifyClient:!0,debug:!1,cache:!1},_=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),_)}}let K=f.join(e.pagesDir,"error.stx");if(await Bun.file(K).exists()){let d=new Set,m={...n,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(K).text(),{},K,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&U.length>0){let d=qt(U,e.domain),m=f.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${U.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],k=As({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(f.join(e.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let W=rc(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let q=sc(e.outputDir);if(q.assets>0)console.log(`Externalized ${q.assets} repeated asset(s) from ${q.pages} page(s) (${(q.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=nr();if(et)await Y(et,f.join(e.outputDir,tr)),console.log(`Copied assets from ${en}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-r,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:w,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
69
+ </html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},_=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),_)}}let V=f.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,m={...s,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(V).text(),{},V,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&U.length>0){let d=qt(U,e.domain),m=f.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${U.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],k=As({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(f.join(e.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let z=sc(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let W=oc(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} repeated asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=nr();if(et)await Y(et,f.join(e.outputDir,tr)),console.log(`Copied assets from ${tn}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:w,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
70
70
  Island chunks: ${u.islandChunks.count} (${(u.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
71
71
  Build complete!
72
72
  Total: ${u.totalPages} pages
@@ -74,8 +74,8 @@ Build complete!
74
74
  Cached: ${u.cachedCount}
75
75
  Failed: ${u.failedCount}
76
76
  Time: ${u.buildTime}ms${P}
77
- `),u}async function Y(t,r){await D.promises.mkdir(r,{recursive:!0});let n=await D.promises.readdir(t,{withFileTypes:!0});for(let o of n){let l=f.join(t,o.name),e=f.join(r,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(l,e);else await D.promises.copyFile(l,e)}}function Kt(t={}){let r=t.cacheDir||c(process.cwd(),"ssg-cache"),n=new ht(r),o=t.revalidate||3600;return{async get(l){let e=await n.get(l);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(l).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=G(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>l.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let g=l.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let w=await a(),{html:p}=await mt(u,v,{},t,w);await n.set(l,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${l}`)},async invalidate(l){if(typeof l==="string")await n.invalidate(l);else await n.invalidatePattern(l)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let r=await Bun.file(t).text(),n=r.match(/^---\n([\s\S]*?)\n---/),o={},l=r;if(n){let w=n[1];l=r.slice(n[0].length).trim();for(let p of w.split(`
78
- `)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),S=p.slice(P+1).trim();if(S==="true")S=!0;else if(S==="false")S=!1;else if(/^\d+$/.test(S))S=parseInt(S,10);else if(/^\d+\.\d+$/.test(S))S=parseFloat(S);else if(S.startsWith("[")&&S.endsWith("]"))S=S.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=S}}}let e=l.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),u=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let w=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:w})}return{content:e,data:o,toc:u}}}}function Yt(t){return bt(t)}function Zt(t,r){return`<!DOCTYPE html>
77
+ `),u}async function Y(t,n){await D.promises.mkdir(n,{recursive:!0});let s=await D.promises.readdir(t,{withFileTypes:!0});for(let o of s){let l=f.join(t,o.name),e=f.join(n,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(l,e);else await D.promises.copyFile(l,e)}}function Kt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),s=new ht(n),o=t.revalidate||3600;return{async get(l){let e=await s.get(l);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(l).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=X(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>l.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let g=l.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let w=await a(),{html:p}=await mt(u,v,{},t,w);await s.set(l,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${l}`)},async invalidate(l){if(typeof l==="string")await s.invalidate(l);else await s.invalidatePattern(l)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},l=n;if(s){let w=s[1];l=n.slice(s[0].length).trim();for(let p of w.split(`
78
+ `)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),S=p.slice(P+1).trim();if(S==="true")S=!0;else if(S==="false")S=!1;else if(/^\d+$/.test(S))S=parseInt(S,10);else if(/^\d+\.\d+$/.test(S))S=parseFloat(S);else if(S.startsWith("[")&&S.endsWith("]"))S=S.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=S}}}let e=l.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),u=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let w=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:w})}return{content:e,data:o,toc:u}}}}function Yt(t){return wt(t)}function Zt(t,n){return`<!DOCTYPE html>
79
79
  <html>
80
80
  <head>
81
81
  <meta charset="utf-8">
@@ -87,4 +87,4 @@ Build complete!
87
87
  <p>Redirecting to <a href="${t}">${t}</a>...</p>
88
88
  <script>window.location.replace('${t}')</script>
89
89
  </body>
90
- </html>`}function Qt(t,r){if(t==="/"||t==="")return f.join(r.outputDir,"index.html");let n=t.replace(/^\/|\/$/g,"");if(r.trailingSlash)return f.join(r.outputDir,n,"index.html");return f.join(r.outputDir,`${n}.html`)}var je={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:J,createMarkdownLoader:Xt};export{Kt as createISRHandler,Xt as createMarkdownLoader,Nt as declaresPageAction,je as default,J as defineStaticPaths,Vt as generateStaticSite,Wt as isExcludedFromSitemap};
90
+ </html>`}function Qt(t,n){if(t==="/"||t==="")return f.join(n.outputDir,"index.html");let s=t.replace(/^\/|\/$/g,"");if(n.trailingSlash)return f.join(n.outputDir,s,"index.html");return f.join(n.outputDir,`${s}.html`)}var je={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:q,createMarkdownLoader:Xt};export{Kt as createISRHandler,Xt as createMarkdownLoader,Nt as declaresPageAction,je as default,q as defineStaticPaths,Vt as generateStaticSite,Wt as isExcludedFromSitemap};