@krizaka/ui 3.64.0 → 3.64.1

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 (371) hide show
  1. package/dist/app-header.d.ts +3 -3
  2. package/dist/blocks.css +41 -0
  3. package/dist/chunk-5D7NMUF6.js +35 -0
  4. package/dist/chunk-5D7NMUF6.js.map +1 -0
  5. package/dist/chunk-A7MQPIEG.js +31 -0
  6. package/dist/chunk-A7MQPIEG.js.map +1 -0
  7. package/dist/chunk-B47WSPMP.js +60 -0
  8. package/dist/chunk-B47WSPMP.js.map +1 -0
  9. package/dist/chunk-HKEAYSFS.js +19 -0
  10. package/dist/chunk-HKEAYSFS.js.map +1 -0
  11. package/dist/chunk-ZYHWJ7U5.js +20 -0
  12. package/dist/chunk-ZYHWJ7U5.js.map +1 -0
  13. package/dist/cover-hero.d.ts +4 -0
  14. package/dist/cover-hero.js +5 -2
  15. package/dist/cover-hero.js.map +1 -1
  16. package/dist/file-upload.d.ts +2 -2
  17. package/dist/frame-D6Xv83t8.d.ts +52 -0
  18. package/dist/language-switch.d.ts +9 -9
  19. package/dist/service-card.d.ts +25 -1
  20. package/dist/service-card.js +7 -3
  21. package/dist/service-card.js.map +1 -1
  22. package/dist/shop/booking.d.ts +36 -0
  23. package/dist/shop/booking.js +37 -0
  24. package/dist/shop/booking.js.map +1 -0
  25. package/dist/shop/bulletin.d.ts +28 -0
  26. package/dist/shop/bulletin.js +29 -0
  27. package/dist/shop/bulletin.js.map +1 -0
  28. package/dist/shop/demo.d.ts +135 -0
  29. package/dist/shop/demo.js +141 -0
  30. package/dist/shop/demo.js.map +1 -0
  31. package/dist/shop/faq.d.ts +20 -0
  32. package/dist/shop/faq.js +33 -0
  33. package/dist/shop/faq.js.map +1 -0
  34. package/dist/shop/gallery.d.ts +46 -0
  35. package/dist/shop/gallery.js +76 -0
  36. package/dist/shop/gallery.js.map +1 -0
  37. package/dist/shop/hero.d.ts +36 -0
  38. package/dist/shop/hero.js +70 -0
  39. package/dist/shop/hero.js.map +1 -0
  40. package/dist/shop/map-gate.d.ts +22 -0
  41. package/dist/shop/map-gate.js +34 -0
  42. package/dist/shop/map-gate.js.map +1 -0
  43. package/dist/shop/policies.d.ts +18 -0
  44. package/dist/shop/policies.js +16 -0
  45. package/dist/shop/policies.js.map +1 -0
  46. package/dist/shop/reviews.d.ts +25 -0
  47. package/dist/shop/reviews.js +47 -0
  48. package/dist/shop/reviews.js.map +1 -0
  49. package/dist/shop/services.d.ts +57 -0
  50. package/dist/shop/services.js +118 -0
  51. package/dist/shop/services.js.map +1 -0
  52. package/dist/shop/social.d.ts +27 -0
  53. package/dist/shop/social.js +27 -0
  54. package/dist/shop/social.js.map +1 -0
  55. package/dist/shop/story.d.ts +24 -0
  56. package/dist/shop/story.js +26 -0
  57. package/dist/shop/story.js.map +1 -0
  58. package/dist/shop/team.d.ts +24 -0
  59. package/dist/shop/team.js +26 -0
  60. package/dist/shop/team.js.map +1 -0
  61. package/dist/shop/video.d.ts +40 -0
  62. package/dist/shop/video.js +33 -0
  63. package/dist/shop/video.js.map +1 -0
  64. package/dist/shop/visit.d.ts +29 -0
  65. package/dist/shop/visit.js +38 -0
  66. package/dist/shop/visit.js.map +1 -0
  67. package/dist/shop-composer.d.ts +490 -0
  68. package/dist/shop-composer.js +2061 -0
  69. package/dist/shop-composer.js.map +1 -0
  70. package/dist/shop.d.ts +316 -0
  71. package/dist/shop.js +389 -0
  72. package/dist/shop.js.map +1 -0
  73. package/package.json +261 -3
  74. package/registry/account-menu.json +1 -1
  75. package/registry/account-settings.json +1 -1
  76. package/registry/achievement.json +1 -1
  77. package/registry/action-bar.json +1 -1
  78. package/registry/activity-feed.json +1 -1
  79. package/registry/agenda.json +1 -1
  80. package/registry/alert.json +1 -1
  81. package/registry/analysis-report.json +1 -1
  82. package/registry/anatomy-plate.json +1 -1
  83. package/registry/app-header.json +1 -1
  84. package/registry/app-shell.json +1 -1
  85. package/registry/argument-card.json +1 -1
  86. package/registry/audio-player.json +1 -1
  87. package/registry/auth-layout.json +1 -1
  88. package/registry/avatar.json +1 -1
  89. package/registry/badge.json +1 -1
  90. package/registry/bird-plate.json +1 -1
  91. package/registry/button.json +1 -1
  92. package/registry/captcha.json +1 -1
  93. package/registry/card-grid.json +1 -1
  94. package/registry/card.json +1 -1
  95. package/registry/catalogue-page.json +1 -1
  96. package/registry/changelog-page.json +1 -1
  97. package/registry/chapter.json +1 -1
  98. package/registry/chat.json +1 -1
  99. package/registry/checkbox.json +1 -1
  100. package/registry/chip-link.json +1 -1
  101. package/registry/chip-row.json +1 -1
  102. package/registry/chip.json +1 -1
  103. package/registry/choice-grid.json +1 -1
  104. package/registry/code-block.json +1 -1
  105. package/registry/combobox.json +1 -1
  106. package/registry/command.json +1 -1
  107. package/registry/comparison-table.json +1 -1
  108. package/registry/component-page.json +1 -1
  109. package/registry/confirm-button.json +1 -1
  110. package/registry/contact-page.json +1 -1
  111. package/registry/continue-prompt.json +1 -1
  112. package/registry/countdown.json +1 -1
  113. package/registry/cover-hero.json +2 -2
  114. package/registry/cta-panel.json +1 -1
  115. package/registry/dashboard-layout.json +1 -1
  116. package/registry/data-table.json +1 -1
  117. package/registry/date-picker.json +1 -1
  118. package/registry/decision-list.json +1 -1
  119. package/registry/description-list.json +1 -1
  120. package/registry/detail-layout.json +1 -1
  121. package/registry/dialog.json +1 -1
  122. package/registry/docs-article-page.json +1 -1
  123. package/registry/docs-hub-page.json +1 -1
  124. package/registry/docs-layout.json +1 -1
  125. package/registry/docs-nav.json +1 -1
  126. package/registry/document-viewer.json +1 -1
  127. package/registry/doodle.json +1 -1
  128. package/registry/drop-overlay.json +1 -1
  129. package/registry/dropdown-menu.json +1 -1
  130. package/registry/elephant.json +2 -2
  131. package/registry/embed-facade.json +1 -1
  132. package/registry/empty-state.json +1 -1
  133. package/registry/engine-flow.json +1 -1
  134. package/registry/environment-notice.json +1 -1
  135. package/registry/error-page.json +1 -1
  136. package/registry/examples/shop/booking-panel.d.ts +4 -0
  137. package/registry/examples/shop/booking-panel.js +12 -0
  138. package/registry/examples/shop/booking-panel.tsx +11 -0
  139. package/registry/examples/shop/booking-sticky.d.ts +4 -0
  140. package/registry/examples/shop/booking-sticky.js +15 -0
  141. package/registry/examples/shop/booking-sticky.tsx +12 -0
  142. package/registry/examples/shop/booking-strip.d.ts +4 -0
  143. package/registry/examples/shop/booking-strip.js +13 -0
  144. package/registry/examples/shop/booking-strip.tsx +12 -0
  145. package/registry/examples/shop/bulletin-banner.d.ts +4 -0
  146. package/registry/examples/shop/bulletin-banner.js +13 -0
  147. package/registry/examples/shop/bulletin-banner.tsx +12 -0
  148. package/registry/examples/shop/bulletin-board.d.ts +4 -0
  149. package/registry/examples/shop/bulletin-board.js +13 -0
  150. package/registry/examples/shop/bulletin-board.tsx +12 -0
  151. package/registry/examples/shop/cards.d.ts +4 -0
  152. package/registry/examples/shop/cards.js +13 -0
  153. package/registry/examples/shop/cards.tsx +12 -0
  154. package/registry/examples/shop/carousel.d.ts +4 -0
  155. package/registry/examples/shop/carousel.js +13 -0
  156. package/registry/examples/shop/carousel.tsx +12 -0
  157. package/registry/examples/shop/document.d.ts +4 -0
  158. package/registry/examples/shop/document.js +20 -0
  159. package/registry/examples/shop/document.tsx +13 -0
  160. package/registry/examples/shop/faq.d.ts +4 -0
  161. package/registry/examples/shop/faq.js +13 -0
  162. package/registry/examples/shop/faq.tsx +12 -0
  163. package/registry/examples/shop/gallery-filmstrip.d.ts +4 -0
  164. package/registry/examples/shop/gallery-filmstrip.js +13 -0
  165. package/registry/examples/shop/gallery-filmstrip.tsx +12 -0
  166. package/registry/examples/shop/gallery-grid.d.ts +4 -0
  167. package/registry/examples/shop/gallery-grid.js +13 -0
  168. package/registry/examples/shop/gallery-grid.tsx +12 -0
  169. package/registry/examples/shop/gallery-mosaic.d.ts +4 -0
  170. package/registry/examples/shop/gallery-mosaic.js +13 -0
  171. package/registry/examples/shop/gallery-mosaic.tsx +12 -0
  172. package/registry/examples/shop/gallery-wall.d.ts +4 -0
  173. package/registry/examples/shop/gallery-wall.js +13 -0
  174. package/registry/examples/shop/gallery-wall.tsx +12 -0
  175. package/registry/examples/shop/hero-banner.d.ts +4 -0
  176. package/registry/examples/shop/hero-banner.js +15 -0
  177. package/registry/examples/shop/hero-banner.tsx +14 -0
  178. package/registry/examples/shop/hero-poster.d.ts +4 -0
  179. package/registry/examples/shop/hero-poster.js +15 -0
  180. package/registry/examples/shop/hero-poster.tsx +14 -0
  181. package/registry/examples/shop/hero-split.d.ts +4 -0
  182. package/registry/examples/shop/hero-split.js +15 -0
  183. package/registry/examples/shop/hero-split.tsx +14 -0
  184. package/registry/examples/shop/hero-tv.d.ts +4 -0
  185. package/registry/examples/shop/hero-tv.js +15 -0
  186. package/registry/examples/shop/hero-tv.tsx +14 -0
  187. package/registry/examples/shop/index.d.ts +4 -0
  188. package/registry/examples/shop/index.js +13 -0
  189. package/registry/examples/shop/index.tsx +12 -0
  190. package/registry/examples/shop/menu-columns.d.ts +4 -0
  191. package/registry/examples/shop/menu-columns.js +13 -0
  192. package/registry/examples/shop/menu-columns.tsx +12 -0
  193. package/registry/examples/shop/menu.d.ts +4 -0
  194. package/registry/examples/shop/menu.js +25 -0
  195. package/registry/examples/shop/menu.tsx +21 -0
  196. package/registry/examples/shop/page.d.ts +4 -0
  197. package/registry/examples/shop/page.js +32 -0
  198. package/registry/examples/shop/page.tsx +27 -0
  199. package/registry/examples/shop/policies.d.ts +4 -0
  200. package/registry/examples/shop/policies.js +13 -0
  201. package/registry/examples/shop/policies.tsx +12 -0
  202. package/registry/examples/shop/reviews-quote.d.ts +4 -0
  203. package/registry/examples/shop/reviews-quote.js +13 -0
  204. package/registry/examples/shop/reviews-quote.tsx +12 -0
  205. package/registry/examples/shop/reviews-strip.d.ts +4 -0
  206. package/registry/examples/shop/reviews-strip.js +13 -0
  207. package/registry/examples/shop/reviews-strip.tsx +12 -0
  208. package/registry/examples/shop/reviews-summary-cards.d.ts +4 -0
  209. package/registry/examples/shop/reviews-summary-cards.js +13 -0
  210. package/registry/examples/shop/reviews-summary-cards.tsx +12 -0
  211. package/registry/examples/shop/social-facade.d.ts +4 -0
  212. package/registry/examples/shop/social-facade.js +13 -0
  213. package/registry/examples/shop/social-facade.tsx +12 -0
  214. package/registry/examples/shop/social-links.d.ts +4 -0
  215. package/registry/examples/shop/social-links.js +12 -0
  216. package/registry/examples/shop/social-links.tsx +11 -0
  217. package/registry/examples/shop/story-owner.d.ts +4 -0
  218. package/registry/examples/shop/story-owner.js +13 -0
  219. package/registry/examples/shop/story-owner.tsx +12 -0
  220. package/registry/examples/shop/story-quote.d.ts +4 -0
  221. package/registry/examples/shop/story-quote.js +13 -0
  222. package/registry/examples/shop/story-quote.tsx +12 -0
  223. package/registry/examples/shop/team-cards.d.ts +4 -0
  224. package/registry/examples/shop/team-cards.js +13 -0
  225. package/registry/examples/shop/team-cards.tsx +12 -0
  226. package/registry/examples/shop/team-row.d.ts +4 -0
  227. package/registry/examples/shop/team-row.js +13 -0
  228. package/registry/examples/shop/team-row.tsx +12 -0
  229. package/registry/examples/shop/video-shorts.d.ts +4 -0
  230. package/registry/examples/shop/video-shorts.js +14 -0
  231. package/registry/examples/shop/video-shorts.tsx +13 -0
  232. package/registry/examples/shop/video-tv.d.ts +4 -0
  233. package/registry/examples/shop/video-tv.js +13 -0
  234. package/registry/examples/shop/video-tv.tsx +12 -0
  235. package/registry/examples/shop/visit-card.d.ts +4 -0
  236. package/registry/examples/shop/visit-card.js +13 -0
  237. package/registry/examples/shop/visit-card.tsx +12 -0
  238. package/registry/examples/shop/visit-map.d.ts +4 -0
  239. package/registry/examples/shop/visit-map.js +13 -0
  240. package/registry/examples/shop/visit-map.tsx +12 -0
  241. package/registry/examples/shop/visit-split.d.ts +4 -0
  242. package/registry/examples/shop/visit-split.js +13 -0
  243. package/registry/examples/shop/visit-split.tsx +12 -0
  244. package/registry/examples/shop-composer/composer.d.ts +4 -0
  245. package/registry/examples/shop-composer/composer.js +17 -0
  246. package/registry/examples/shop-composer/composer.tsx +21 -0
  247. package/registry/field.json +1 -1
  248. package/registry/file-upload.json +1 -1
  249. package/registry/filter-bar.json +1 -1
  250. package/registry/flock.json +1 -1
  251. package/registry/footnote.json +1 -1
  252. package/registry/force-update-screen.json +1 -1
  253. package/registry/form.json +1 -1
  254. package/registry/gallery-page.json +1 -1
  255. package/registry/genui.json +1 -1
  256. package/registry/glossary-term.json +1 -1
  257. package/registry/glossary.json +1 -1
  258. package/registry/glow-card.json +1 -1
  259. package/registry/goal-gauge.json +1 -1
  260. package/registry/grade-stamp.json +1 -1
  261. package/registry/how-it-works-page.json +1 -1
  262. package/registry/image-cropper.json +1 -1
  263. package/registry/index.json +96 -6
  264. package/registry/iso.json +1 -1
  265. package/registry/kanban.json +1 -1
  266. package/registry/kbd.json +1 -1
  267. package/registry/kind-config-editor.json +1 -1
  268. package/registry/kpi-explained.json +1 -1
  269. package/registry/landing-page.json +1 -1
  270. package/registry/landscape.json +1 -1
  271. package/registry/language-switch.json +1 -1
  272. package/registry/legal-page.json +1 -1
  273. package/registry/link-card.json +1 -1
  274. package/registry/list.json +1 -1
  275. package/registry/loader.json +1 -1
  276. package/registry/longform-page.json +1 -1
  277. package/registry/maintenance-screen.json +1 -1
  278. package/registry/map.json +2 -2
  279. package/registry/margin-layout.json +1 -1
  280. package/registry/markdown.json +1 -1
  281. package/registry/marketing-layout.json +1 -1
  282. package/registry/marquee.json +1 -1
  283. package/registry/mascot-quote.json +1 -1
  284. package/registry/mascot-state.json +1 -1
  285. package/registry/mascots.json +1 -1
  286. package/registry/match-dialog.json +1 -1
  287. package/registry/media-capture.json +1 -1
  288. package/registry/media-gallery.json +1 -1
  289. package/registry/media-grid.json +1 -1
  290. package/registry/meta-row.json +1 -1
  291. package/registry/meter.json +1 -1
  292. package/registry/nav-bar.json +2 -2
  293. package/registry/next-actions.json +1 -1
  294. package/registry/notification-preferences.json +1 -1
  295. package/registry/number-ticker.json +1 -1
  296. package/registry/opening-hours.json +1 -1
  297. package/registry/page-header.json +1 -1
  298. package/registry/page-hero.json +1 -1
  299. package/registry/page-index.json +1 -1
  300. package/registry/page.json +1 -1
  301. package/registry/pagination.json +1 -1
  302. package/registry/photo-grid.json +1 -1
  303. package/registry/pointer-light.json +1 -1
  304. package/registry/popover.json +1 -1
  305. package/registry/pricing-page.json +1 -1
  306. package/registry/product-page.json +1 -1
  307. package/registry/profile-card.json +1 -1
  308. package/registry/progress.json +1 -1
  309. package/registry/promise-card.json +1 -1
  310. package/registry/quota-meter.json +1 -1
  311. package/registry/radio-group.json +1 -1
  312. package/registry/rail-nav.json +2 -2
  313. package/registry/recipes.json +1 -1
  314. package/registry/retro-tv.json +1 -1
  315. package/registry/reviews.json +1 -1
  316. package/registry/router.json +1 -1
  317. package/registry/scroll-stage.json +1 -1
  318. package/registry/search-field.json +1 -1
  319. package/registry/section-backdrop.json +1 -1
  320. package/registry/separator.json +1 -1
  321. package/registry/service-card.json +24 -6
  322. package/registry/settings-layout.json +1 -1
  323. package/registry/shop-composer.json +424 -0
  324. package/registry/shop.json +776 -0
  325. package/registry/showcase.json +1 -1
  326. package/registry/signature.json +1 -1
  327. package/registry/site-cahier.json +1 -1
  328. package/registry/site-footer.json +2 -2
  329. package/registry/sites.json +1 -1
  330. package/registry/skeleton.json +1 -1
  331. package/registry/skip-link.json +1 -1
  332. package/registry/slider.json +1 -1
  333. package/registry/slot-picker.json +1 -1
  334. package/registry/slot.json +1 -1
  335. package/registry/specimen-tag.json +1 -1
  336. package/registry/speed-lines.json +1 -1
  337. package/registry/spinner.json +1 -1
  338. package/registry/split-view.json +1 -1
  339. package/registry/stage-banner.json +1 -1
  340. package/registry/stat.json +1 -1
  341. package/registry/status-chip.json +1 -1
  342. package/registry/status-page.json +1 -1
  343. package/registry/step-progress.json +1 -1
  344. package/registry/step-showcase.json +1 -1
  345. package/registry/stepper.json +1 -1
  346. package/registry/sticky-action.json +1 -1
  347. package/registry/stuck.json +1 -1
  348. package/registry/swipe-deck.json +1 -1
  349. package/registry/switch.json +1 -1
  350. package/registry/tabs.json +1 -1
  351. package/registry/tag-input.json +1 -1
  352. package/registry/tag-selector.json +1 -1
  353. package/registry/taped-photo.json +1 -1
  354. package/registry/terminal-replay.json +1 -1
  355. package/registry/text-style.json +1 -1
  356. package/registry/theme.json +1 -1
  357. package/registry/toast.json +1 -1
  358. package/registry/toc.json +1 -1
  359. package/registry/tooltip.json +1 -1
  360. package/registry/tree-view.json +1 -1
  361. package/registry/update-prompt.json +1 -1
  362. package/registry/upload-queue.json +1 -1
  363. package/registry/usage.json +1 -1
  364. package/registry/verified-badge.json +1 -1
  365. package/registry/versus-card.json +1 -1
  366. package/registry/vertical-video.json +1 -1
  367. package/registry/video-player.json +1 -1
  368. package/registry/video-trimmer.json +1 -1
  369. package/registry/virtual.json +1 -1
  370. package/registry/wall.json +3 -3
  371. package/registry/waveform.json +1 -1
@@ -0,0 +1,2061 @@
1
+ "use client";
2
+
3
+ // src/shop/catalogue.ts
4
+ import * as z3 from "zod/mini";
5
+
6
+ // src/shop/define.ts
7
+ import * as z2 from "zod/mini";
8
+
9
+ // src/shop/limits.ts
10
+ var SHOP_LIMITS = {
11
+ /** Sections on a page, the hero included. */
12
+ sections: 16,
13
+ /** Blocks in one section. */
14
+ blocks: 24,
15
+ /** Photos in a gallery. */
16
+ photos: 12,
17
+ /** Cards in `services · cards`. */
18
+ cards: 6,
19
+ /** Flyers on a bulletin board. */
20
+ flyers: 3,
21
+ /** Reels in `video · shorts`. */
22
+ reels: 6
23
+ };
24
+
25
+ // src/shop/text.ts
26
+ import * as z from "zod/mini";
27
+ var localizedText = z.object({
28
+ fr: z.optional(z.string().check(z.maxLength(600))),
29
+ en: z.optional(z.string().check(z.maxLength(600)))
30
+ });
31
+
32
+ // src/shop/define.ts
33
+ var key = z2.string().check(z2.minLength(1), z2.maxLength(40), z2.regex(/^[A-Za-z0-9_-]+$/, "a key (letters, digits, - and _)"));
34
+ function defineSection(spec) {
35
+ const blockUnion = spec.blocks && Object.keys(spec.blocks).length > 0 ? z2.discriminatedUnion(
36
+ "type",
37
+ Object.entries(spec.blocks).map(
38
+ ([type, settings]) => z2.object({ key, type: z2.literal(type), settings, text: z2.optional(z2.record(z2.string(), localizedText)) })
39
+ )
40
+ ) : void 0;
41
+ const blocks = blockUnion ? z2.optional(z2.array(blockUnion).check(z2.maxLength(SHOP_LIMITS.blocks))) : z2.optional(z2.array(z2.never()).check(z2.maxLength(0)));
42
+ const base = z2.object({
43
+ key,
44
+ type: z2.literal(spec.type),
45
+ variant: z2.enum(spec.variants),
46
+ disabled: z2.optional(z2.boolean()),
47
+ settings: spec.settings,
48
+ text: z2.optional(z2.object({ title: z2.optional(localizedText), lead: z2.optional(localizedText) })),
49
+ blocks
50
+ });
51
+ const schema = base.check(
52
+ z2.superRefine((value, ctx) => {
53
+ spec.refine?.(value, (path, message) => ctx.issues.push({ code: "custom", message, path, input: value }));
54
+ })
55
+ );
56
+ return Object.freeze({
57
+ ...spec,
58
+ defaultVariant: spec.variants[0],
59
+ blockTypes: Object.keys(spec.blocks ?? {}),
60
+ schema
61
+ });
62
+ }
63
+
64
+ // src/shop/catalogue.ts
65
+ var ref = z3.string().check(z3.minLength(1), z3.maxLength(80));
66
+ var short = z3.string().check(z3.minLength(1), z3.maxLength(140));
67
+ var url = z3.string().check(z3.maxLength(300), z3.regex(/^https:\/\//, "an https address"));
68
+ var isoDay = z3.string().check(z3.regex(/^\d{4}-\d{2}-\d{2}$/, "a day (YYYY-MM-DD)"));
69
+ var source = z3.enum(["all", "pick"]);
70
+ var oneOf = (...n) => z3.union(n.map((v) => z3.literal(v)));
71
+ var platforms = ["tiktok", "youtube-shorts", "instagram"];
72
+ var heroSection = defineSection({
73
+ type: "hero",
74
+ variants: ["poster", "split", "banner", "tv"],
75
+ settings: z3.object({
76
+ /** The cover: a media id. Absent, the product's default for the trade. */
77
+ media: z3.optional(ref),
78
+ /** Where the photo is cropped to when the box is not its ratio. */
79
+ focus: z3.enum(["center", "top", "bottom"])
80
+ }),
81
+ settingsDefault: { focus: "center" },
82
+ blocks: { fact: z3.object({ kind: z3.enum(["open-now", "area", "score"]) }) }
83
+ });
84
+ var servicesSection = defineSection({
85
+ type: "services",
86
+ variants: ["menu", "cards", "index", "carousel"],
87
+ settings: z3.object({
88
+ /** `all` the shop's services, or `pick` the ones the `service` blocks name, in their order. */
89
+ source,
90
+ groupBy: z3.enum(["category", "none"]),
91
+ /** `menu` only: two columns when nothing sits beside it. */
92
+ columns: oneOf(1, 2),
93
+ /** `menu` only: the shop's hours, team and address beside the list (the host draws them from its own data). */
94
+ aside: z3.enum(["hours", "none"])
95
+ }),
96
+ settingsDefault: { source: "all", groupBy: "category", columns: 1, aside: "hours" },
97
+ blocks: { service: z3.object({ serviceId: ref }) },
98
+ refine: (section, issue) => {
99
+ if (section.settings.source === "pick" && (section.blocks ?? []).length === 0) issue(["blocks"], "pick at least one service");
100
+ if (section.variant === "cards" && (section.blocks ?? []).length > SHOP_LIMITS.cards) issue(["blocks"], `at most ${SHOP_LIMITS.cards} cards`);
101
+ }
102
+ });
103
+ var bookingSection = defineSection({
104
+ type: "booking",
105
+ variants: ["strip", "panel", "sticky"],
106
+ settings: z3.object({
107
+ /** A service the times are for; absent, the next free times of any service. */
108
+ serviceId: z3.optional(ref),
109
+ /** `strip`: how many times it shows. */
110
+ count: oneOf(3, 4, 6)
111
+ }),
112
+ settingsDefault: { count: 4 }
113
+ });
114
+ var gallerySection = defineSection({
115
+ type: "gallery",
116
+ variants: ["mosaic", "filmstrip", "wall", "grid"],
117
+ settings: z3.object({
118
+ source,
119
+ /** `wall` only. */
120
+ texture: z3.enum(["plaster", "brick", "ridge", "zellige"])
121
+ }),
122
+ settingsDefault: { source: "all", texture: "plaster" },
123
+ blocks: {
124
+ photo: z3.object({ mediaId: ref, caption: z3.optional(short) }),
125
+ note: z3.object({ text: short, signature: z3.optional(z3.string().check(z3.maxLength(40))) }),
126
+ sign: z3.object({})
127
+ },
128
+ refine: (section, issue) => {
129
+ const photos = (section.blocks ?? []).filter((b) => b.type === "photo").length;
130
+ if (photos > SHOP_LIMITS.photos) issue(["blocks"], `at most ${SHOP_LIMITS.photos} photos`);
131
+ }
132
+ });
133
+ var videoSection = defineSection({
134
+ type: "video",
135
+ variants: ["tv", "shorts"],
136
+ settings: z3.object({ cabinet: z3.enum(["cabinet", "portable"]), channel: z3.optional(z3.string().check(z3.maxLength(32))) }),
137
+ settingsDefault: { cabinet: "cabinet" },
138
+ blocks: { reel: z3.object({ platform: z3.enum(platforms), url }) }
139
+ });
140
+ var reviewsSection = defineSection({
141
+ type: "reviews",
142
+ variants: ["summary-cards", "quote", "strip"],
143
+ settings: z3.object({ rule: z3.enum(["best", "latest"]), count: oneOf(1, 2, 3) }),
144
+ settingsDefault: { rule: "best", count: 2 }
145
+ });
146
+ var bulletinSection = defineSection({
147
+ type: "bulletin",
148
+ variants: ["board", "banner"],
149
+ settings: z3.object({}),
150
+ settingsDefault: {},
151
+ blocks: { flyer: z3.object({ text: short, signature: z3.optional(z3.string().check(z3.maxLength(40))), until: z3.optional(isoDay) }) },
152
+ refine: (section, issue) => {
153
+ if ((section.blocks ?? []).length > SHOP_LIMITS.flyers) issue(["blocks"], `at most ${SHOP_LIMITS.flyers} flyers`);
154
+ }
155
+ });
156
+ var teamSection = defineSection({
157
+ type: "team",
158
+ variants: ["row", "cards"],
159
+ settings: z3.object({ source }),
160
+ settingsDefault: { source: "all" },
161
+ blocks: { member: z3.object({ memberId: ref }) }
162
+ });
163
+ var visitSection = defineSection({
164
+ type: "visit",
165
+ variants: ["card", "map", "split"],
166
+ settings: z3.object({ showPhone: z3.boolean() }),
167
+ settingsDefault: { showPhone: true }
168
+ });
169
+ var storySection = defineSection({
170
+ type: "story",
171
+ variants: ["quote", "owner"],
172
+ settings: z3.object({ body: localizedText }),
173
+ settingsDefault: { body: {} }
174
+ });
175
+ var socialSection = defineSection({
176
+ type: "social",
177
+ variants: ["links", "facade"],
178
+ settings: z3.object({}),
179
+ settingsDefault: {},
180
+ blocks: { link: z3.object({ platform: z3.enum(platforms), url }) }
181
+ });
182
+ var faqSection = defineSection({
183
+ type: "faq",
184
+ variants: ["list"],
185
+ settings: z3.object({}),
186
+ settingsDefault: {},
187
+ blocks: { question: z3.object({ question: localizedText, answer: localizedText }) }
188
+ });
189
+ var policiesSection = defineSection({
190
+ type: "policies",
191
+ variants: ["inline"],
192
+ settings: z3.object({ show: z3.array(z3.enum(["cancellation", "prices", "booking-window"])).check(z3.maxLength(3)) }),
193
+ settingsDefault: { show: ["cancellation", "prices", "booking-window"] }
194
+ });
195
+ var SECTION_DEFINITIONS = [
196
+ heroSection,
197
+ servicesSection,
198
+ bookingSection,
199
+ gallerySection,
200
+ videoSection,
201
+ reviewsSection,
202
+ bulletinSection,
203
+ teamSection,
204
+ visitSection,
205
+ storySection,
206
+ socialSection,
207
+ faqSection,
208
+ policiesSection
209
+ ];
210
+ var SECTION_TYPES = SECTION_DEFINITIONS.map((d) => d.type);
211
+ function sectionDefinition(type) {
212
+ return SECTION_DEFINITIONS.find((d) => d.type === type);
213
+ }
214
+
215
+ // src/shop-composer/commands.ts
216
+ var clamp = (n, lo, hi) => Math.min(Math.max(n, lo), hi);
217
+ var indexOfKey = (page, key2) => page.sections.findIndex((s) => s.key === key2);
218
+ function moved(list, from, to) {
219
+ const next = [...list];
220
+ const [item] = next.splice(from, 1);
221
+ next.splice(clamp(to, 0, next.length), 0, item);
222
+ return next;
223
+ }
224
+ function withSection(page, key2, change) {
225
+ const i = indexOfKey(page, key2);
226
+ if (i < 0) return page;
227
+ const next = change(page.sections[i]);
228
+ if (next === page.sections[i]) return page;
229
+ const sections = [...page.sections];
230
+ sections[i] = next;
231
+ return { ...page, sections };
232
+ }
233
+ var addSection = (page, cmd) => {
234
+ const def = SECTION_DEFINITIONS.find((d) => d.type === cmd.sectionType);
235
+ if (!def || page.sections.length >= SHOP_LIMITS.sections || page.sections.some((s) => s.key === cmd.key)) return page;
236
+ const variant = cmd.variant ?? def.defaultVariant;
237
+ if (!def.variants.includes(variant)) return page;
238
+ const isHero = def.type === "hero";
239
+ if (isHero && page.sections.some((s) => s.type === "hero")) return page;
240
+ const heroFirst = page.sections[0]?.type === "hero";
241
+ const at = isHero ? 0 : clamp(cmd.at ?? page.sections.length, heroFirst ? 1 : 0, page.sections.length);
242
+ const section = { key: cmd.key, type: def.type, variant, settings: { ...def.settingsDefault, ...cmd.settings } };
243
+ const sections = [...page.sections];
244
+ sections.splice(at, 0, section);
245
+ return { ...page, sections };
246
+ };
247
+ var removeSection = (page, cmd) => {
248
+ if (indexOfKey(page, cmd.key) < 0 || page.sections.length <= 1) return page;
249
+ return { ...page, sections: page.sections.filter((s) => s.key !== cmd.key) };
250
+ };
251
+ var moveSection = (page, cmd) => {
252
+ const from = indexOfKey(page, cmd.key);
253
+ if (from < 0 || page.sections[from].type === "hero") return page;
254
+ const lo = page.sections[0]?.type === "hero" ? 1 : 0;
255
+ const to = clamp(cmd.to, lo, page.sections.length - 1);
256
+ return to === from ? page : { ...page, sections: moved(page.sections, from, to) };
257
+ };
258
+ var setVariant = (page, cmd) => withSection(page, cmd.key, (s) => {
259
+ const def = sectionDefinition(s.type);
260
+ if (s.variant === cmd.variant || !def.variants.includes(cmd.variant)) return s;
261
+ return { ...s, variant: cmd.variant };
262
+ });
263
+ var saysNothingNew = (current, patch) => Object.entries(patch).every(([k, v]) => JSON.stringify(current[k]) === JSON.stringify(v));
264
+ var patchSettings = (page, cmd) => withSection(page, cmd.key, (s) => {
265
+ const current = s.settings;
266
+ return saysNothingNew(current, cmd.patch) ? s : { ...s, settings: { ...current, ...cmd.patch } };
267
+ });
268
+ var setText = (page, cmd) => withSection(page, cmd.key, (s) => {
269
+ const text = { ...s.text ?? {} };
270
+ if (cmd.value === void 0) delete text[cmd.field];
271
+ else text[cmd.field] = cmd.value;
272
+ const next = { ...s };
273
+ if (Object.keys(text).length === 0) delete next.text;
274
+ else next.text = text;
275
+ return next;
276
+ });
277
+ var toggleDisabled = (page, cmd) => withSection(page, cmd.key, (s) => ({ ...s, disabled: s.disabled ? void 0 : true }));
278
+ var setPreset = (page, cmd) => {
279
+ if (page.preset.id === cmd.preset.id && page.preset.version === cmd.preset.version && cmd.density === void 0) return page;
280
+ let density = {};
281
+ if (cmd.density === null) density = { density: void 0 };
282
+ else if (cmd.density) density = { density: cmd.density };
283
+ return { ...page, preset: { ...cmd.preset }, ...density };
284
+ };
285
+ var setDensity = (page, cmd) => page.density === cmd.density ? page : { ...page, density: cmd.density };
286
+ var addBlock = (page, cmd) => withSection(page, cmd.key, (s) => {
287
+ const def = sectionDefinition(s.type);
288
+ const blocks = s.blocks ?? [];
289
+ if (!def.blockTypes.includes(cmd.blockType) || blocks.length >= SHOP_LIMITS.blocks || blocks.some((b) => b.key === cmd.blockKey)) return s;
290
+ const next = [...blocks];
291
+ next.splice(clamp(cmd.at ?? blocks.length, 0, blocks.length), 0, { key: cmd.blockKey, type: cmd.blockType, settings: { ...cmd.settings } });
292
+ return { ...s, blocks: next };
293
+ });
294
+ var removeBlock = (page, cmd) => withSection(page, cmd.key, (s) => {
295
+ const blocks = s.blocks ?? [];
296
+ if (!blocks.some((b) => b.key === cmd.blockKey)) return s;
297
+ const next = blocks.filter((b) => b.key !== cmd.blockKey);
298
+ return { ...s, blocks: next.length > 0 ? next : void 0 };
299
+ });
300
+ var moveBlock = (page, cmd) => withSection(page, cmd.key, (s) => {
301
+ const blocks = s.blocks ?? [];
302
+ const from = blocks.findIndex((b) => b.key === cmd.blockKey);
303
+ const to = clamp(cmd.to, 0, blocks.length - 1);
304
+ return from < 0 || from === to ? s : { ...s, blocks: moved(blocks, from, to) };
305
+ });
306
+ var patchBlock = (page, cmd) => withSection(page, cmd.key, (s) => {
307
+ const blocks = s.blocks ?? [];
308
+ const block = blocks.find((b) => b.key === cmd.blockKey);
309
+ if (!block || saysNothingNew(block.settings ?? {}, cmd.patch)) return s;
310
+ return { ...s, blocks: blocks.map((b) => b === block ? { ...b, settings: { ...b.settings, ...cmd.patch } } : b) };
311
+ });
312
+ var handlers = {
313
+ addSection,
314
+ removeSection,
315
+ moveSection,
316
+ setVariant,
317
+ patchSettings,
318
+ setText,
319
+ toggleDisabled,
320
+ setPreset,
321
+ setDensity,
322
+ addBlock,
323
+ removeBlock,
324
+ moveBlock,
325
+ patchBlock
326
+ };
327
+ function applyCommand(page, cmd) {
328
+ return handlers[cmd.type](page, cmd);
329
+ }
330
+
331
+ // src/shop-composer/composer.tsx
332
+ import { Button as Button4 } from "@krizaka/ui/button";
333
+ import { Dialog } from "@krizaka/ui/dialog";
334
+ import { RadioGroup as RadioGroup3 } from "@krizaka/ui/radio-group";
335
+ import * as React7 from "react";
336
+
337
+ // src/cn.ts
338
+ import { clsx } from "clsx";
339
+ import { cnMerge } from "tailwind-variants";
340
+ var twMergeConfig = {
341
+ extend: {
342
+ classGroups: {
343
+ "bg-image": ["bg-sheen", "bg-fill-shade", "bg-halo"],
344
+ shadow: ["shadow-raised", "shadow-floating", "shadow-overlay", "shadow-glow", "shadow-glow-lg"],
345
+ "inset-shadow": ["inset-shadow-edge", "inset-shadow-edge-fill", "inset-shadow-well"]
346
+ }
347
+ }
348
+ };
349
+ var mergeConfig = { twMergeConfig };
350
+ function cn(...inputs) {
351
+ return cnMerge(clsx(inputs))(mergeConfig) ?? "";
352
+ }
353
+
354
+ // src/shop/preview.ts
355
+ function postToPreview(target, origin, message) {
356
+ target?.postMessage(message, origin);
357
+ }
358
+
359
+ // src/shop/schema.ts
360
+ import * as z4 from "zod/mini";
361
+ var SHOP_SCHEMA_VERSION = 1;
362
+ var presetRef = z4.object({
363
+ id: z4.string().check(z4.regex(/^[a-z]+-[a-z]+$/, "a preset id (trade-name)")),
364
+ version: z4.int().check(z4.minimum(1))
365
+ });
366
+ var sectionUnion = z4.discriminatedUnion(
367
+ "type",
368
+ SECTION_DEFINITIONS.map((d) => d.schema)
369
+ );
370
+ var shopPageSchema = z4.object({
371
+ schema: z4.literal(SHOP_SCHEMA_VERSION),
372
+ preset: presetRef,
373
+ /** Overrides the preset's density. */
374
+ density: z4.optional(z4.enum(["compact", "airy"])),
375
+ sections: z4.array(sectionUnion).check(z4.minLength(1), z4.maxLength(SHOP_LIMITS.sections))
376
+ }).check(
377
+ z4.superRefine((page, ctx) => {
378
+ const add = (path, message) => ctx.issues.push({ code: "custom", message, path, input: page });
379
+ const seen = /* @__PURE__ */ new Set();
380
+ page.sections.forEach((section, i) => {
381
+ const s = section;
382
+ if (seen.has(s.key)) add(["sections", i, "key"], `the key "${s.key}" is used twice`);
383
+ seen.add(s.key);
384
+ if (s.type === "hero" && i !== 0) add(["sections", i, "type"], "the hero is the first section, and there is only one");
385
+ });
386
+ })
387
+ );
388
+ function parseShopPage(input) {
389
+ const result = shopPageSchema.safeParse(input);
390
+ if (result.success) return { ok: true, page: result.data };
391
+ return { ok: false, issues: result.error.issues.map((i) => ({ path: i.path.join("."), message: i.message })) };
392
+ }
393
+
394
+ // src/shop-composer/diff.ts
395
+ var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
396
+ function diffPages(before, after) {
397
+ const out = [];
398
+ const was = new Map(before.sections.map((s, i) => [s.key, { s, i }]));
399
+ const is = new Set(after.sections.map((s) => s.key));
400
+ const kept = before.sections.filter((s) => is.has(s.key)).map((s) => s.key);
401
+ const order = after.sections.filter((s) => was.has(s.key)).map((s) => s.key);
402
+ after.sections.forEach((s, i) => {
403
+ const old = was.get(s.key);
404
+ if (!old) {
405
+ out.push({ kind: "added", key: s.key, type: s.type, position: i });
406
+ return;
407
+ }
408
+ if (kept.indexOf(s.key) !== order.indexOf(s.key)) out.push({ kind: "moved", key: s.key, type: s.type, from: old.i, to: i });
409
+ if (old.s.variant !== s.variant) out.push({ kind: "variant", key: s.key, type: s.type, from: old.s.variant, to: s.variant });
410
+ if (!same(old.s.settings, s.settings)) out.push({ kind: "settings", key: s.key, type: s.type });
411
+ if (!same(old.s.blocks, s.blocks)) out.push({ kind: "blocks", key: s.key, type: s.type });
412
+ if (!same(old.s.text, s.text)) out.push({ kind: "text", key: s.key, type: s.type });
413
+ if (Boolean(old.s.disabled) !== Boolean(s.disabled)) out.push({ kind: s.disabled ? "disabled" : "enabled", key: s.key, type: s.type });
414
+ });
415
+ for (const [key2, { s, i }] of was) if (!is.has(key2)) out.push({ kind: "removed", key: key2, type: s.type, position: i });
416
+ if (before.preset.id !== after.preset.id || before.preset.version !== after.preset.version) out.push({ kind: "preset", from: before.preset.id, to: after.preset.id });
417
+ if (before.density !== after.density) out.push({ kind: "density", from: before.density, to: after.density });
418
+ return out;
419
+ }
420
+
421
+ // src/shop-composer/history.ts
422
+ var HISTORY_LIMIT = 100;
423
+ var createHistory = (page) => ({ past: [], present: page, future: [] });
424
+ function run(history, cmd, merge) {
425
+ const next = applyCommand(history.present, cmd);
426
+ if (next === history.present) return history;
427
+ if (merge && history.merge === merge && history.past.length > 0) return { ...history, present: next, future: [] };
428
+ return { past: [...history.past, history.present].slice(-HISTORY_LIMIT), present: next, future: [], merge };
429
+ }
430
+ var canUndo = (h) => h.past.length > 0;
431
+ var canRedo = (h) => h.future.length > 0;
432
+ function undo(h) {
433
+ const previous = h.past.at(-1);
434
+ if (!previous) return h;
435
+ return { past: h.past.slice(0, -1), present: previous, future: [h.present, ...h.future] };
436
+ }
437
+ function redo(h) {
438
+ const [next, ...rest] = h.future;
439
+ if (!next) return h;
440
+ return { past: [...h.past, h.present], present: next, future: rest };
441
+ }
442
+
443
+ // src/shop-composer/inspector.tsx
444
+ import { Button as Button2 } from "@krizaka/ui/button";
445
+ import { RadioGroup as RadioGroup2 } from "@krizaka/ui/radio-group";
446
+ import * as React5 from "react";
447
+
448
+ // src/shop-composer/keys.ts
449
+ var alphabet = "0123456789abcdef";
450
+ function newKey(prefix, random = Math.random) {
451
+ let out = "";
452
+ for (let i = 0; i < 6; i++) out += alphabet[Math.floor(random() * 16)];
453
+ return `${prefix}_${out}`;
454
+ }
455
+
456
+ // src/shop-composer/messages.ts
457
+ var fill = (message, vars) => message.replace(/\{(\w+)\}/g, (_, k) => String(vars[k] ?? `{${k}}`));
458
+ var sectionNames = {
459
+ hero: "Hero",
460
+ services: "Services",
461
+ booking: "Booking",
462
+ gallery: "Photos",
463
+ video: "Video",
464
+ reviews: "Reviews",
465
+ bulletin: "News",
466
+ team: "Team",
467
+ visit: "Visit",
468
+ story: "Story",
469
+ social: "Social",
470
+ faq: "Questions",
471
+ policies: "Policies"
472
+ };
473
+ var variantNames = {
474
+ "hero.poster": "Poster",
475
+ "hero.split": "Split",
476
+ "hero.banner": "Banner",
477
+ "hero.tv": "Television",
478
+ "services.menu": "Menu",
479
+ "services.cards": "Cards",
480
+ "services.index": "Index cards",
481
+ "services.carousel": "Carousel",
482
+ "booking.strip": "Next times",
483
+ "booking.panel": "Closing call",
484
+ "booking.sticky": "Phone bar",
485
+ "gallery.mosaic": "Mosaic",
486
+ "gallery.filmstrip": "Filmstrip",
487
+ "gallery.wall": "Wall",
488
+ "gallery.grid": "Grid",
489
+ "video.tv": "Television",
490
+ "video.shorts": "Reels",
491
+ "reviews.summary-cards": "Score and reviews",
492
+ "reviews.quote": "One quote",
493
+ "reviews.strip": "Score line",
494
+ "bulletin.board": "Board",
495
+ "bulletin.banner": "Banner line",
496
+ "team.row": "Row",
497
+ "team.cards": "Cards",
498
+ "visit.card": "Card",
499
+ "visit.map": "Map",
500
+ "visit.split": "Hours and map",
501
+ "story.quote": "Quote",
502
+ "story.owner": "Owner",
503
+ "social.links": "Links",
504
+ "social.facade": "Latest reel",
505
+ "faq.list": "List",
506
+ "policies.inline": "Inline"
507
+ };
508
+ var defaultShopComposerMessages = {
509
+ title: "Shop page",
510
+ sections: "Sections",
511
+ addSection: "Add a section",
512
+ addSectionHint: "Choose what to add to your page.",
513
+ toggleVisible: "Show {name}",
514
+ sectionMenu: "Actions for {name}",
515
+ moveUp: "Move up",
516
+ moveDown: "Move down",
517
+ moveTop: "Move to top",
518
+ remove: "Remove",
519
+ announceMoved: "{name} moved to position {n} of {total}",
520
+ announceCannotMove: "{name} cannot move further",
521
+ announceAdded: "{name} added at position {n}",
522
+ announceRemoved: "{name} removed",
523
+ announceShown: "{name} is shown",
524
+ announceHidden: "{name} is hidden",
525
+ announceUndone: "Undone",
526
+ announceRedone: "Redone",
527
+ hiddenNote: "hidden",
528
+ inspector: "Section",
529
+ noSelection: "Choose a section to change how it is drawn.",
530
+ backToSections: "Back to sections",
531
+ variant: "How it is drawn",
532
+ settings: "Settings",
533
+ words: "Your words",
534
+ titleField: "Title",
535
+ leadField: "Line under the title",
536
+ french: "French",
537
+ english: "English",
538
+ blocks: "Items",
539
+ addBlock: "Add",
540
+ removeBlock: "Remove {name}",
541
+ look: "Look",
542
+ preset: "Style",
543
+ density: "Spacing",
544
+ densityCompact: "Compact",
545
+ densityAiry: "Airy",
546
+ undo: "Undo",
547
+ redo: "Redo",
548
+ saved: "Saved",
549
+ saving: "Saving\u2026",
550
+ saveFailed: "Not saved",
551
+ publish: "Publish",
552
+ discard: "Discard the draft",
553
+ preview: "Preview",
554
+ previewTitle: "Live preview of your page",
555
+ phone: "Phone",
556
+ desktop: "Desktop",
557
+ viewPreview: "View",
558
+ closePreview: "Close",
559
+ publishTitle: "Publish this page",
560
+ publishWhat: "What changes",
561
+ publishNothing: "Nothing has changed since the last publication.",
562
+ publishConfirm: "Publish",
563
+ cancel: "Cancel",
564
+ problemsTitle: "Fix {n} problem before publishing",
565
+ problemIn: "{name}",
566
+ sectionNames,
567
+ variantNames,
568
+ blockNames: { fact: "Fact", service: "Service", photo: "Photo", note: "Note", sign: "Sign", reel: "Reel", flyer: "Flyer", member: "Member", link: "Link", question: "Question" },
569
+ settingNames: { media: "Photo", focus: "Crop", source: "Source", groupBy: "Group by", columns: "Columns", aside: "Beside the list", serviceId: "Service", count: "How many", texture: "Wall", cabinet: "Cabinet", channel: "Channel", rule: "Which reviews", showPhone: "Show the phone number", body: "Text", show: "Show" },
570
+ optionNames: { center: "Centre", top: "Top", bottom: "Bottom", all: "All", pick: "Pick", category: "Category", none: "None", hours: "Hours", plaster: "Plaster", brick: "Brick", ridge: "Ridge", zellige: "Zellige", cabinet: "Cabinet", portable: "Portable", best: "Best", latest: "Latest", cancellation: "Cancellation", prices: "Prices", "booking-window": "Booking window" },
571
+ diff: {
572
+ added: "{name} added",
573
+ removed: "{name} removed",
574
+ moved: "{name} moved from {from} to {to}",
575
+ variant: "{name} drawn as {to} (was {from})",
576
+ settings: "{name}: settings changed",
577
+ blocks: "{name}: items changed",
578
+ text: "{name}: words changed",
579
+ disabled: "{name} hidden",
580
+ enabled: "{name} shown",
581
+ preset: "Style changed to {to} (was {from})",
582
+ density: "Spacing changed to {to} (was {from})"
583
+ }
584
+ };
585
+
586
+ // src/shop-composer/settings-form.tsx
587
+ import { createKrizakaForm, FormField, Switch, TextArea, TextField, useFormContext } from "@krizaka/ui/form";
588
+ import { RadioGroup } from "@krizaka/ui/radio-group";
589
+ import * as React from "react";
590
+
591
+ // src/shop-composer/fields.ts
592
+ var defOf = (s) => s._zod.def;
593
+ function specOf(name, schema, optional5 = false) {
594
+ const def = defOf(schema);
595
+ switch (def.type) {
596
+ case "optional":
597
+ return specOf(name, def.innerType, true);
598
+ case "enum":
599
+ return { name, kind: "choice", options: Object.values(def.entries), optional: optional5 };
600
+ case "boolean":
601
+ return { name, kind: "toggle", optional: optional5 };
602
+ case "string":
603
+ return { name, kind: "text", optional: optional5 };
604
+ case "union": {
605
+ const options = def.options.flatMap((o) => defOf(o).type === "literal" ? defOf(o).values : []);
606
+ return options.length === def.options.length ? { name, kind: "choice", options, optional: optional5 } : void 0;
607
+ }
608
+ case "object": {
609
+ const keys = Object.keys(def.shape);
610
+ return keys.every((k) => k === "fr" || k === "en") ? { name, kind: "localized", optional: optional5 } : void 0;
611
+ }
612
+ case "array": {
613
+ const inner = specOf(name, def.element);
614
+ return inner && "options" in inner ? { name, kind: "multi", options: inner.options.map(String), optional: optional5 } : void 0;
615
+ }
616
+ default:
617
+ return void 0;
618
+ }
619
+ }
620
+ function describeSettings(schema) {
621
+ const shape = defOf(schema).shape ?? {};
622
+ return Object.entries(shape).flatMap(([name, s]) => {
623
+ const spec = specOf(name, s);
624
+ return spec ? [spec] : [];
625
+ });
626
+ }
627
+
628
+ // src/shop-composer/settings-form.tsx
629
+ import { jsx, jsxs } from "react/jsx-runtime";
630
+ var factories = /* @__PURE__ */ new Map();
631
+ function factoryFor(def) {
632
+ let f = factories.get(def.type);
633
+ if (!f) {
634
+ f = createKrizakaForm({ schema: def.settings, defaultValues: def.settingsDefault });
635
+ factories.set(def.type, f);
636
+ }
637
+ return f;
638
+ }
639
+ var nameOf = (m, key2) => m.settingNames[key2] ?? key2;
640
+ var optionName = (m, o) => m.optionNames[String(o)] ?? String(o);
641
+ function Choice({ spec, m }) {
642
+ return /* @__PURE__ */ jsx(FormField, { name: spec.name, children: (f) => /* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", children: [
643
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "text-xs font-semibold text-fg-secondary", children: nameOf(m, spec.name) }),
644
+ /* @__PURE__ */ jsx(RadioGroup.Root, { label: nameOf(m, spec.name), variant: "segmented", value: String(f.value), onValueChange: (v) => f.setValue(spec.options.find((o) => String(o) === v)), onBlur: f.onBlur, children: spec.options.map((o) => /* @__PURE__ */ jsx(RadioGroup.Segment, { value: String(o), children: optionName(m, o) }, String(o))) })
645
+ ] }) });
646
+ }
647
+ function Multi({ spec, m }) {
648
+ return /* @__PURE__ */ jsx(FormField, { name: spec.name, children: (f) => {
649
+ const value = f.value ?? [];
650
+ return /* @__PURE__ */ jsxs("fieldset", { className: "m-0 flex flex-col gap-1.5 border-0 p-0", children: [
651
+ /* @__PURE__ */ jsx("legend", { className: "mb-1 text-xs font-semibold text-fg-secondary", children: nameOf(m, spec.name) }),
652
+ spec.options.map((o) => /* @__PURE__ */ jsxs("label", { className: "flex min-h-9 items-center gap-2 text-sm text-fg", children: [
653
+ /* @__PURE__ */ jsx(
654
+ "input",
655
+ {
656
+ type: "checkbox",
657
+ className: "h-4 w-4 accent-accent",
658
+ checked: value.includes(o),
659
+ onChange: (e) => f.setValue(e.target.checked ? [...value, o] : value.filter((x) => x !== o))
660
+ }
661
+ ),
662
+ optionName(m, o)
663
+ ] }, o))
664
+ ] });
665
+ } });
666
+ }
667
+ function Field({ spec, m }) {
668
+ switch (spec.kind) {
669
+ case "choice":
670
+ return /* @__PURE__ */ jsx(Choice, { spec, m });
671
+ case "multi":
672
+ return /* @__PURE__ */ jsx(Multi, { spec, m });
673
+ case "toggle":
674
+ return /* @__PURE__ */ jsx(Switch, { name: spec.name, label: nameOf(m, spec.name) });
675
+ case "text":
676
+ return /* @__PURE__ */ jsx(TextField, { name: spec.name, label: nameOf(m, spec.name) });
677
+ case "localized":
678
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
679
+ /* @__PURE__ */ jsx(TextArea, { name: `${spec.name}.fr`, label: `${nameOf(m, spec.name)} \u2014 ${m.french}`, rows: 3, maxLength: 600 }),
680
+ /* @__PURE__ */ jsx(TextArea, { name: `${spec.name}.en`, label: `${nameOf(m, spec.name)} \u2014 ${m.english}`, rows: 3, maxLength: 600 })
681
+ ] });
682
+ }
683
+ }
684
+ function normalise(values) {
685
+ if (Array.isArray(values)) return values;
686
+ if (typeof values !== "object" || values === null) return values;
687
+ const out = {};
688
+ for (const [k, v] of Object.entries(values)) {
689
+ if (v === "") continue;
690
+ const inner = typeof v === "object" && v !== null && !Array.isArray(v) ? normalise(v) : v;
691
+ out[k] = inner;
692
+ }
693
+ return out;
694
+ }
695
+ function Commit({ def, onValid, onInvalid }) {
696
+ const { api } = useFormContext();
697
+ const latest = React.useRef({ onValid, onInvalid });
698
+ React.useEffect(() => {
699
+ latest.current = { onValid, onInvalid };
700
+ });
701
+ React.useEffect(() => {
702
+ const sub = api.store.subscribe(() => {
703
+ const result = def.settings.safeParse(normalise(api.state.values));
704
+ latest.current.onInvalid(!result.success);
705
+ if (result.success) latest.current.onValid(result.data);
706
+ });
707
+ return () => {
708
+ const s = sub;
709
+ if (typeof s === "function") s();
710
+ else s?.unsubscribe?.();
711
+ };
712
+ }, [api, def]);
713
+ return null;
714
+ }
715
+ function SettingsForm({ section, messages: m, onValid, onInvalid }) {
716
+ const def = sectionDefinition(section.type);
717
+ const factory = factoryFor(def);
718
+ const form = factory.useForm({ defaultValues: section.settings });
719
+ const specs = describeSettings(def.settings);
720
+ if (specs.length === 0) return null;
721
+ return /* @__PURE__ */ jsxs(form.Form, { "aria-label": m.settings, className: "flex flex-col gap-4", children: [
722
+ specs.map((spec) => /* @__PURE__ */ jsx(Field, { spec, m }, spec.name)),
723
+ /* @__PURE__ */ jsx(Commit, { def, onValid, onInvalid })
724
+ ] });
725
+ }
726
+
727
+ // src/button/button.tsx
728
+ import { Slot } from "radix-ui";
729
+ import { tv } from "tailwind-variants";
730
+
731
+ // src/spinner/glyph.tsx
732
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
733
+ var HEX = "M12 3 19.79 7.5 19.79 16.5 12 21 4.21 16.5 4.21 7.5Z";
734
+ function LoaderGlyph({ state = "loading", value, ...props }) {
735
+ const known = typeof value === "number" && Number.isFinite(value);
736
+ const fill2 = state !== "loading" ? 100 : known ? Math.round(Math.min(1, Math.max(0, value)) * 100) : null;
737
+ return /* @__PURE__ */ jsxs2("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, "data-state": state, "data-progress": fill2 === null ? void 0 : fill2, ...props, children: [
738
+ /* @__PURE__ */ jsx2("path", { d: HEX, stroke: "currentColor", strokeOpacity: "0.22", strokeWidth: "2.2", strokeLinejoin: "round" }),
739
+ /* @__PURE__ */ jsx2(
740
+ "path",
741
+ {
742
+ d: HEX,
743
+ pathLength: 100,
744
+ stroke: "currentColor",
745
+ strokeWidth: "2.2",
746
+ strokeLinejoin: "round",
747
+ strokeLinecap: "round",
748
+ className: "kz-loader-trace",
749
+ strokeDasharray: fill2 === null ? void 0 : `${fill2} ${100 - fill2}`
750
+ }
751
+ ),
752
+ state === "loading" && /* @__PURE__ */ jsx2("circle", { cx: "12", cy: "12", r: "2.6", fill: "currentColor", className: "kz-loader-node" }),
753
+ state === "success" && /* @__PURE__ */ jsx2("path", { d: "M8.3 12.3l2.6 2.6 4.9-5.3", pathLength: 20, stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", className: "kz-loader-mark" }),
754
+ state === "error" && /* @__PURE__ */ jsx2("path", { d: "M9.4 9.4l5.2 5.2M14.6 9.4l-5.2 5.2", pathLength: 20, stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", className: "kz-loader-mark" })
755
+ ] });
756
+ }
757
+
758
+ // src/recipes/define.ts
759
+ function defineRecipe(config) {
760
+ return config;
761
+ }
762
+
763
+ // src/button/recipe.ts
764
+ var buttonRecipe = defineRecipe({
765
+ base: "inline-flex max-w-full shrink-0 select-none items-center justify-center gap-2 whitespace-normal text-center font-semibold transition duration-150 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0 disabled:pointer-events-none disabled:opacity-40 data-loading:cursor-progress active:scale-[0.98] [&[data-loading]]:opacity-100",
766
+ variants: {
767
+ variant: {
768
+ primary: "bg-accent text-on-accent shadow-sm hover:bg-accent-hover",
769
+ // The brand's signature: accent → accent-2 (on-accent reads on both stops, tested in @krizaka/tokens).
770
+ gradient: "bg-linear-to-r from-accent to-accent-2 text-on-accent shadow-sm hover:brightness-110",
771
+ secondary: "border border-border-default bg-surface-2 text-fg hover:border-border-strong hover:bg-surface-3",
772
+ outline: "border border-border-default bg-transparent text-fg hover:border-accent hover:text-fg-accent",
773
+ ghost: "text-fg-secondary hover:bg-surface-2 hover:text-fg",
774
+ // The border and the tint carry the danger; the label stays the primary text role, legible on the tint at rest
775
+ // and hovered over every surface (`text-fg-danger` is for text set directly on a surface).
776
+ danger: "border border-danger/50 bg-danger/10 text-fg hover:border-danger hover:bg-danger/20"
777
+ },
778
+ size: { sm: "h-8 px-3 text-xs", md: "h-10 px-4 text-sm", lg: "h-12 px-6 text-sm", icon: "h-10 w-10" },
779
+ // One clean shape (krizaka-ui#393): an 8 px radius (`--kz-radius-sm`, the radius of a field — a button beside an
780
+ // input lines up with it), the pill on demand. `cut` (the retired chamfer) is a deprecated alias of `rounded`.
781
+ shape: { rounded: "rounded-sm", pill: "rounded-full", cut: "rounded-sm" }
782
+ },
783
+ defaultVariants: { variant: "secondary", size: "md", shape: "rounded" }
784
+ });
785
+
786
+ // src/button/button.tsx
787
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
788
+ var buttonVariants = tv(buttonRecipe);
789
+ var STATUS_TEXT = { success: "text-fg-success", error: "text-fg-danger" };
790
+ var warnedCut = false;
791
+ function warnCut() {
792
+ if (warnedCut || typeof process === "undefined" || process.env.NODE_ENV === "production") return;
793
+ warnedCut = true;
794
+ console.warn('@krizaka/ui/button: shape="cut" is deprecated (krizaka-ui#393) and now draws the default rounded shape. Remove the prop.');
795
+ }
796
+ function Button({
797
+ asChild,
798
+ loading,
799
+ progress,
800
+ status,
801
+ announce,
802
+ indicator = true,
803
+ shimmer: _shimmer,
804
+ magnetic: _magnetic,
805
+ variant,
806
+ size,
807
+ shape,
808
+ className,
809
+ disabled,
810
+ children,
811
+ ...props
812
+ }) {
813
+ const Comp = asChild ? Slot.Root : "button";
814
+ if (shape === "cut") warnCut();
815
+ const known = loading && typeof progress === "number" && Number.isFinite(progress);
816
+ const ratio = known ? Math.min(1, Math.max(0, progress)) : 0;
817
+ const glyph = indicator && !asChild && (loading || status) ? status ?? "loading" : null;
818
+ const filled = variant === "primary" || variant === "gradient";
819
+ const button = /* @__PURE__ */ jsx3(
820
+ Comp,
821
+ {
822
+ type: asChild ? void 0 : "button",
823
+ "aria-busy": loading || void 0,
824
+ "data-loading": loading ? "" : void 0,
825
+ "data-variant": variant ?? "secondary",
826
+ "data-kz-status": status ?? void 0,
827
+ disabled: asChild ? void 0 : disabled || loading,
828
+ "aria-disabled": asChild && (disabled || loading) ? true : void 0,
829
+ className: buttonVariants({
830
+ variant,
831
+ size,
832
+ shape,
833
+ className: cn(known && "relative isolate overflow-hidden", className)
834
+ }),
835
+ ...props,
836
+ children: asChild ? children : /* @__PURE__ */ jsxs3(Fragment, { children: [
837
+ known && /* @__PURE__ */ jsx3("span", { "aria-hidden": true, className: "absolute inset-y-0 left-0 -z-10 bg-current opacity-15 transition-[width] duration-500", style: { width: `${ratio * 100}%` } }),
838
+ glyph && /* @__PURE__ */ jsx3(
839
+ "span",
840
+ {
841
+ "aria-hidden": true,
842
+ "data-slot": "indicator",
843
+ className: "-my-1 grid grid-cols-[1fr] transition-[grid-template-columns,margin,opacity] duration-300 starting:-mr-2 starting:grid-cols-[0fr] starting:opacity-0",
844
+ children: /* @__PURE__ */ jsx3("span", { className: "overflow-hidden", children: /* @__PURE__ */ jsx3(LoaderGlyph, { state: glyph, value: known ? ratio : null, className: cn("h-4 w-4", glyph !== "loading" && !filled && STATUS_TEXT[glyph]) }) })
845
+ }
846
+ ),
847
+ children
848
+ ] })
849
+ }
850
+ );
851
+ if (announce === void 0 || asChild) return button;
852
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
853
+ button,
854
+ /* @__PURE__ */ jsx3("span", { role: "status", className: "sr-only", children: announce })
855
+ ] });
856
+ }
857
+
858
+ // src/shop/booking/booking.tsx
859
+ import { buttonVariants as buttonVariants2 } from "@krizaka/ui/button";
860
+ import { CtaPanel } from "@krizaka/ui/cta-panel";
861
+ import { StickyAction } from "@krizaka/ui/sticky-action";
862
+
863
+ // src/block-link.tsx
864
+ import { jsx as jsx4 } from "react/jsx-runtime";
865
+ var isExternal = (href) => /^[a-z][a-z0-9+.-]*:/i.test(href);
866
+ function BlockLink({
867
+ href,
868
+ linkAs: Link = "a",
869
+ external = isExternal(href),
870
+ rel,
871
+ ...props
872
+ }) {
873
+ if (external) return /* @__PURE__ */ jsx4("a", { href, target: "_blank", rel: rel ?? "noopener noreferrer", ...props });
874
+ const Comp = Link;
875
+ return /* @__PURE__ */ jsx4(Comp, { href, rel, ...props });
876
+ }
877
+
878
+ // src/shop/frame.tsx
879
+ import * as React3 from "react";
880
+
881
+ // src/page/page.tsx
882
+ import * as React2 from "react";
883
+ import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
884
+ function Page({ size = "default", as: Tag = "div", paper, margin, className, ...props }) {
885
+ return /* @__PURE__ */ jsx5(
886
+ Tag,
887
+ {
888
+ "data-size": size === "default" ? void 0 : size,
889
+ "data-paper": paper,
890
+ "data-margin": margin ? "" : void 0,
891
+ className: cn("kz-frame", className),
892
+ ...props
893
+ }
894
+ );
895
+ }
896
+ function SectionHeading({ id, eyebrow, number, title, lead: lead2, actions, level = 2, size = "md", align = "start", reveal, className, ...props }) {
897
+ const H = level === 2 ? "h2" : "h3";
898
+ return /* @__PURE__ */ jsxs4(
899
+ "div",
900
+ {
901
+ className: cn("kz-heading", className),
902
+ "data-size": size === "md" ? void 0 : size,
903
+ "data-align": align === "start" ? void 0 : align,
904
+ "data-actions": actions ? "" : void 0,
905
+ "data-reveal": reveal ? "" : void 0,
906
+ ...props,
907
+ children: [
908
+ number && /* @__PURE__ */ jsx5("span", { className: "kz-heading-number", children: number }),
909
+ eyebrow && /* @__PURE__ */ jsx5("p", { className: "kz-eyebrow", children: eyebrow }),
910
+ /* @__PURE__ */ jsx5(H, { id, className: "kz-heading-title", children: title }),
911
+ lead2 && /* @__PURE__ */ jsx5("p", { className: "kz-heading-lead", children: lead2 }),
912
+ actions && /* @__PURE__ */ jsx5("div", { className: "kz-heading-actions", children: actions })
913
+ ]
914
+ }
915
+ );
916
+ }
917
+
918
+ // src/shop/frame.tsx
919
+ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
920
+ var PAPERS = { plain: void 0, seyes: "ruled", kraft: "kraft", washi: "washi" };
921
+ function ShopFrame({ preset, density = "compact", accent, paper = "plain", className, ...props }) {
922
+ return /* @__PURE__ */ jsx6("div", { "data-shop-preset": preset, "data-shop-accent": accent, "data-paper": PAPERS[paper], "data-density": density, className: cn("kz-shop", className), ...props });
923
+ }
924
+ function ShopSection({ id, title, eyebrow, lead: lead2, actions, bleed, first, className, children, ...props }) {
925
+ const auto = React3.useId();
926
+ const headingId = title ? `${id ?? auto}-title` : void 0;
927
+ const heading = title ? /* @__PURE__ */ jsx6(SectionHeading, { id: headingId, size: "sm", eyebrow, title, lead: lead2, actions }) : null;
928
+ return /* @__PURE__ */ jsx6("section", { id, "aria-labelledby": headingId, "data-first": first ? "" : void 0, "data-bleed": bleed ? "" : void 0, className: cn("kz-shop-section", className), ...props, children: bleed ? /* @__PURE__ */ jsxs5(Fragment4, { children: [
929
+ heading && /* @__PURE__ */ jsx6(Page, { children: heading }),
930
+ children
931
+ ] }) : /* @__PURE__ */ jsxs5(Page, { children: [
932
+ heading,
933
+ children
934
+ ] }) });
935
+ }
936
+
937
+ // src/shop/booking/booking.tsx
938
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
939
+ function BookingSection({ variant = "strip", times = [], label, emptyLabel, href, actionLabel, title, body, linkAs, hideWhileVisible, className, ...props }) {
940
+ const action = (size) => /* @__PURE__ */ jsx7(BlockLink, { href, linkAs, className: cn(buttonVariants2({ variant: "primary", size }), "no-underline"), children: actionLabel });
941
+ if (variant === "sticky") {
942
+ return /* @__PURE__ */ jsx7(StickyAction, { hideWhileVisible, "data-variant": "sticky", className, ...props, children: /* @__PURE__ */ jsx7(BlockLink, { href, linkAs, className: cn(buttonVariants2({ variant: "primary", size: "lg" }), "w-full justify-center no-underline"), children: actionLabel }) });
943
+ }
944
+ if (variant === "panel") {
945
+ return /* @__PURE__ */ jsx7(ShopSection, { "aria-label": typeof title === "string" ? title : label, "data-variant": "panel", className, ...props, children: /* @__PURE__ */ jsx7(CtaPanel, { title: title ?? label, body, children: action("lg") }) });
946
+ }
947
+ return /* @__PURE__ */ jsx7(ShopSection, { "aria-label": label, "data-variant": "strip", className, ...props, children: /* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-border-default bg-surface-1 p-3 sm:px-4", children: [
948
+ /* @__PURE__ */ jsx7("p", { className: "m-0 order-1 text-sm font-semibold text-fg", children: label }),
949
+ times.length > 0 ? /* @__PURE__ */ jsx7("ul", { className: "m-0 order-3 grid w-full list-none grid-cols-2 gap-2 p-0 sm:order-2 sm:flex sm:w-auto sm:min-w-0 sm:flex-1 sm:flex-wrap", children: times.map((t) => /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsx7(BlockLink, { href: t.href, linkAs, className: "inline-flex min-h-11 items-center rounded-md border border-border-control bg-surface-2 px-3 text-[13px] font-semibold tabular-nums text-fg no-underline hover:border-accent hover:bg-accent-soft focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", children: t.label }) }, t.id)) }) : /* @__PURE__ */ jsx7("p", { className: "m-0 order-3 w-full text-sm text-fg-secondary sm:order-2 sm:w-auto sm:flex-1", children: emptyLabel }),
950
+ /* @__PURE__ */ jsxs6(BlockLink, { href, linkAs, className: "order-2 ml-auto inline-flex min-h-11 items-center gap-1 text-[13px] sm:order-3 font-semibold text-fg-accent no-underline hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", children: [
951
+ actionLabel,
952
+ " ",
953
+ /* @__PURE__ */ jsx7("span", { "aria-hidden": true, children: "\u2192" })
954
+ ] })
955
+ ] }) });
956
+ }
957
+
958
+ // src/shop/bulletin/bulletin.tsx
959
+ import { PinnedNote } from "@krizaka/ui/wall";
960
+ import { jsx as jsx8 } from "react/jsx-runtime";
961
+ function liveFlyers(flyers, today) {
962
+ return flyers.filter((f) => !f.until || f.until >= today).slice(0, SHOP_LIMITS.flyers);
963
+ }
964
+ function BulletinSection({ variant = "board", flyers, today, title, className, ...props }) {
965
+ const live = liveFlyers(flyers, today);
966
+ if (live.length === 0) return null;
967
+ if (variant === "banner") {
968
+ return /* @__PURE__ */ jsx8("aside", { "aria-label": title, "data-variant": "banner", className: cn("border-b border-border-subtle bg-accent-soft", className), children: /* @__PURE__ */ jsx8("p", { className: "m-0 mx-auto max-w-6xl px-4 py-2 text-center text-[13px] font-medium text-fg", children: live[0].text }) });
969
+ }
970
+ return /* @__PURE__ */ jsx8(ShopSection, { title, className, "data-variant": "board", ...props, children: /* @__PURE__ */ jsx8("ul", { className: "m-0 grid list-none gap-4 p-0 sm:grid-cols-2 lg:grid-cols-3", children: live.map((f, i) => /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsx8(PinnedNote, { text: f.text, signature: f.signature, rotation: [-1.2, 1, -0.6][i % 3], hold: i % 2 === 0 ? "tape" : "pin", lines: 3 }) }, f.id)) }) });
971
+ }
972
+
973
+ // src/shop/demo/media.ts
974
+ var DEMO_PHOTOS = {
975
+ "pets-ball": "https://krizaka-assets.b-cdn.net/ui/shop/demo/pets-ball.e03f1ae74d.webp",
976
+ "pets-canal": "https://krizaka-assets.b-cdn.net/ui/shop/demo/pets-canal.4ea735fad7.webp",
977
+ "pets-cover": "https://krizaka-assets.b-cdn.net/ui/shop/demo/pets-cover.9f06b05e7d.webp",
978
+ "pets-door": "https://krizaka-assets.b-cdn.net/ui/shop/demo/pets-door.099a4143b4.webp",
979
+ "pets-leash": "https://krizaka-assets.b-cdn.net/ui/shop/demo/pets-leash.fbdb08ddad.webp",
980
+ "pets-leaves": "https://krizaka-assets.b-cdn.net/ui/shop/demo/pets-leaves.e7ce7dd035.webp",
981
+ "pets-snow": "https://krizaka-assets.b-cdn.net/ui/shop/demo/pets-snow.894afd7929.webp",
982
+ "pets-stairs": "https://krizaka-assets.b-cdn.net/ui/shop/demo/pets-stairs.c218522480.webp",
983
+ "salon-basin": "https://krizaka-assets.b-cdn.net/ui/shop/demo/salon-basin.64dd59cac7.webp",
984
+ "salon-brushes": "https://krizaka-assets.b-cdn.net/ui/shop/demo/salon-brushes.235eebb9a1.webp",
985
+ "salon-chair": "https://krizaka-assets.b-cdn.net/ui/shop/demo/salon-chair.4cdd76afdf.webp",
986
+ "salon-colour": "https://krizaka-assets.b-cdn.net/ui/shop/demo/salon-colour.00c62a6aac.webp",
987
+ "salon-cover": "https://krizaka-assets.b-cdn.net/ui/shop/demo/salon-cover.218332751d.webp",
988
+ "salon-mirror": "https://krizaka-assets.b-cdn.net/ui/shop/demo/salon-mirror.9c2858ccd2.webp",
989
+ "salon-shelf": "https://krizaka-assets.b-cdn.net/ui/shop/demo/salon-shelf.d215d866d2.webp",
990
+ "salon-station": "https://krizaka-assets.b-cdn.net/ui/shop/demo/salon-station.91abe38059.webp",
991
+ "salon-tools": "https://krizaka-assets.b-cdn.net/ui/shop/demo/salon-tools.8ff845df44.webp",
992
+ "salon-towels": "https://krizaka-assets.b-cdn.net/ui/shop/demo/salon-towels.8a49746a6b.webp"
993
+ };
994
+
995
+ // src/shop/demo/index.ts
996
+ var demoPhoto = (name, alt) => ({ src: DEMO_PHOTOS[name], alt });
997
+ var week = (hours, closed = "Closed") => ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"].map((label, i) => ({ id: String(i + 1), label, hours: i === 6 ? closed : hours }));
998
+ var demoSalon = {
999
+ id: "salon",
1000
+ name: "Salon C\xE8dre & Ciseaux",
1001
+ eyebrow: "Saint-Henri \xB7 Montr\xE9al",
1002
+ promise: "A neighbourhood salon on Notre-Dame West: cuts, colour and beard care, with the person of your choice.",
1003
+ preset: "salon-vitrine",
1004
+ cover: demoPhoto("salon-cover", "The salon's window on a winter evening, warm light on the brick street"),
1005
+ services: [
1006
+ { id: "short", name: "Short cut", price: "$45", duration: "30 min", description: "Scissor or clipper, razor finish", category: "cuts", href: "#book-short" },
1007
+ { id: "blow", name: "Cut and blow-dry", price: "$75", duration: "1 h", description: "A tailored cut, a blow-dry that lasts", category: "cuts", popular: true, photo: demoPhoto("salon-chair", "The leather chair by the window"), href: "#book-blow" },
1008
+ { id: "beard", name: "Beard trim", price: "$25", duration: "20 min", description: "Edges and a hot towel", category: "beard", photo: demoPhoto("salon-towels", "Rolled warm towels on a shelf"), href: "#book-beard" },
1009
+ { id: "colour", name: "Full colour", price: "$160", priceFrom: "from", duration: "2 h 30", description: "Price confirmed at the consultation", category: "colour", photo: demoPhoto("salon-colour", "Two copper bowls of colour on marble"), href: "#book-colour" },
1010
+ { id: "balayage", name: "Balayage", price: "$220", priceFrom: "from", duration: "3 h", description: "Gradual lightening, natural result", category: "colour", photo: demoPhoto("salon-shelf", "Amber bottles on the window shelf"), href: "#book-balayage" }
1011
+ ],
1012
+ photos: [
1013
+ { id: "mirror", photo: demoPhoto("salon-mirror", "A round mirror with fairy lights on a brick wall") },
1014
+ { id: "basin", photo: demoPhoto("salon-basin", "A basin under a pendant lamp") },
1015
+ { id: "brushes", photo: demoPhoto("salon-brushes", "Brushes and a dryer on a wooden counter") },
1016
+ { id: "station", photo: demoPhoto("salon-station", "A styling station facing the rainy street") },
1017
+ { id: "tools", photo: demoPhoto("salon-tools", "Scissors and a comb under a brass lamp") }
1018
+ ],
1019
+ times: [
1020
+ { id: "t1", label: "Today 4:30 pm", href: "#t1" },
1021
+ { id: "t2", label: "Today 6:00 pm", href: "#t2" },
1022
+ { id: "t3", label: "Tue 9:00 am", href: "#t3" },
1023
+ { id: "t4", label: "Tue 10:30 am", href: "#t4" }
1024
+ ],
1025
+ hours: week("9 am \u2013 8 pm"),
1026
+ status: { open: true, label: "Open now", detail: "until 8 pm" },
1027
+ team: [{ id: "e", name: "\xC9ric" }, { id: "k", name: "Karim" }, { id: "j", name: "Jade" }, { id: "c", name: "Camille" }],
1028
+ address: "2400 Notre-Dame St W",
1029
+ phone: "514-555-0110"
1030
+ };
1031
+ var demoPets = {
1032
+ id: "pets",
1033
+ name: "Pattes de Saint-Henri",
1034
+ eyebrow: "Saint-Henri \xB7 Montr\xE9al",
1035
+ promise: "Neighbourhood dog walks along the canal, with a photo and a note after each one.",
1036
+ preset: "pets-canal",
1037
+ cover: demoPhoto("pets-cover", "A golden dog facing the Lachine canal at sunset"),
1038
+ services: [
1039
+ { id: "walk30", name: "Quick walk", price: "$22", duration: "30 min", capacity: "1 dog", description: "A loop of the block and a drink of water", category: "walks", href: "#book-walk30" },
1040
+ { id: "walk60", name: "Canal walk", price: "$35", duration: "1 h", capacity: "Up to 2 dogs", description: "The canal path, a photo and a note", category: "walks", popular: true, photo: demoPhoto("pets-leash", "Leashes hanging by a red-brick doorway"), href: "#book-walk60" },
1041
+ { id: "pack", name: "Pack adventure", price: "$48", duration: "2 h", capacity: "Up to 5 dogs", description: "The Mont-Royal trails, small friendly group", category: "walks", href: "#book-pack" },
1042
+ { id: "visit", name: "Home visit", price: "$18", duration: "20 min", capacity: "1 pet", description: "Food, water, a cuddle and a report", category: "care", photo: demoPhoto("pets-door", "A terrier waiting at a red door"), href: "#book-visit" }
1043
+ ],
1044
+ photos: [
1045
+ { id: "ball", photo: demoPhoto("pets-ball", "A dog leaping for a ball in the autumn park") },
1046
+ { id: "canal", photo: demoPhoto("pets-canal", "Two dogs resting on the grass by the canal") },
1047
+ { id: "leaves", photo: demoPhoto("pets-leaves", "A small dog running through fallen leaves") },
1048
+ { id: "snow", photo: demoPhoto("pets-snow", "A dog in a red coat on a snowy street at night") },
1049
+ { id: "stairs", photo: demoPhoto("pets-stairs", "A dog sitting on an outdoor staircase") }
1050
+ ],
1051
+ times: [
1052
+ { id: "t1", label: "Today 5:00 pm", href: "#t1" },
1053
+ { id: "t2", label: "Tomorrow 8:00 am", href: "#t2" },
1054
+ { id: "t3", label: "Tomorrow 12:30 pm", href: "#t3" }
1055
+ ],
1056
+ hours: week("7 am \u2013 7 pm", "By request"),
1057
+ status: { open: true, label: "Open now", detail: "until 7 pm" },
1058
+ team: [{ id: "m", name: "Maude" }, { id: "s", name: "Samuel" }],
1059
+ address: "Saint-Henri, Montr\xE9al",
1060
+ phone: "514-555-0142"
1061
+ };
1062
+
1063
+ // src/shop/faq/faq.tsx
1064
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1065
+ function faqJsonLd(questions) {
1066
+ const data = {
1067
+ "@context": "https://schema.org",
1068
+ "@type": "FAQPage",
1069
+ mainEntity: questions.map((q) => ({ "@type": "Question", name: q.question, acceptedAnswer: { "@type": "Answer", text: q.answer } }))
1070
+ };
1071
+ return JSON.stringify(data).replace(/</g, "\\u003c");
1072
+ }
1073
+ function FaqSection({ title, questions, className, ...props }) {
1074
+ if (questions.length === 0) return null;
1075
+ return /* @__PURE__ */ jsxs7(ShopSection, { title, className, "data-variant": "list", ...props, children: [
1076
+ /* @__PURE__ */ jsx9("div", { className: "max-w-3xl divide-y divide-border-subtle border-y border-border-subtle", children: questions.map((q) => /* @__PURE__ */ jsxs7("details", { className: "group py-3", children: [
1077
+ /* @__PURE__ */ jsxs7("summary", { className: "flex min-h-11 cursor-pointer list-none items-center justify-between gap-4 font-semibold text-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring [&::-webkit-details-marker]:hidden", children: [
1078
+ q.question,
1079
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": true, className: "shrink-0 text-fg-secondary transition-transform group-open:rotate-45 motion-reduce:transition-none", children: "+" })
1080
+ ] }),
1081
+ /* @__PURE__ */ jsx9("p", { className: "m-0 mt-2 text-[15px] leading-relaxed text-fg-secondary", children: q.answer })
1082
+ ] }, q.id)) }),
1083
+ /* @__PURE__ */ jsx9("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: faqJsonLd(questions) } })
1084
+ ] });
1085
+ }
1086
+
1087
+ // src/shop/gallery/gallery.tsx
1088
+ import { MediaGallery } from "@krizaka/ui/media-gallery";
1089
+ import { Wall } from "@krizaka/ui/wall";
1090
+
1091
+ // src/shop/photo.tsx
1092
+ import { jsx as jsx10 } from "react/jsx-runtime";
1093
+ var RATIOS = {
1094
+ "1/1": "aspect-square",
1095
+ "4/5": "aspect-[4/5]",
1096
+ "3/4": "aspect-[3/4]",
1097
+ "4/3": "aspect-[4/3]",
1098
+ "3/2": "aspect-[3/2]",
1099
+ "16/9": "aspect-video",
1100
+ "21/9": "aspect-[21/9]"
1101
+ };
1102
+ function Photo({ photo, ratio, sizes, priority, className, ...props }) {
1103
+ return /* @__PURE__ */ jsx10("div", { "data-shop-photo": "", "data-ratio": ratio, className: cn("relative w-full overflow-hidden bg-media", RATIOS[ratio], className), ...props, children: /* @__PURE__ */ jsx10(
1104
+ "img",
1105
+ {
1106
+ src: photo.src,
1107
+ srcSet: photo.srcSet,
1108
+ sizes: photo.srcSet ? sizes : void 0,
1109
+ alt: photo.alt,
1110
+ loading: priority ? void 0 : "lazy",
1111
+ fetchPriority: priority ? "high" : void 0,
1112
+ decoding: "async",
1113
+ className: "absolute inset-0 h-full w-full object-cover"
1114
+ }
1115
+ ) });
1116
+ }
1117
+
1118
+ // src/shop/gallery/gallery.tsx
1119
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1120
+ function wallLayout(count) {
1121
+ const perRow = Math.min(5, Math.max(1, Math.ceil(count / 2)));
1122
+ return Array.from({ length: count }, (_, i) => {
1123
+ const row = Math.floor(i / perRow);
1124
+ const col = i % perRow;
1125
+ const inRow = Math.min(perRow, count - row * perRow);
1126
+ const x = inRow === 1 ? 50 : col / (inRow - 1) * 100;
1127
+ const y = row === 0 ? count <= perRow ? 50 : 8 + col % 2 * 6 : 92 - col % 2 * 6;
1128
+ return { x, y, rotation: [-2.2, 1.6, -1.2, 2.4, -1.8][(i * 3 + 1) % 5] };
1129
+ });
1130
+ }
1131
+ function Mosaic({ photos }) {
1132
+ const [lead2, ...rest] = photos;
1133
+ if (!lead2) return null;
1134
+ return /* @__PURE__ */ jsxs8("ul", { className: "m-0 grid list-none grid-cols-2 gap-2 p-0 sm:grid-cols-[1.6fr_1fr_1fr] sm:gap-3", children: [
1135
+ /* @__PURE__ */ jsx11("li", { className: "col-span-2 aspect-[16/11] sm:col-span-1 sm:row-span-2 sm:aspect-auto", children: /* @__PURE__ */ jsx11(Photo, { photo: lead2.photo, ratio: "4/5", sizes: "(min-width: 40rem) 36rem, 100vw", className: "h-full min-h-0 sm:aspect-auto" }) }),
1136
+ rest.slice(0, 4).map((p) => /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(Photo, { photo: p.photo, ratio: "1/1", sizes: "(min-width: 40rem) 18rem, 50vw" }) }, p.id))
1137
+ ] });
1138
+ }
1139
+ function Filmstrip({ photos, label }) {
1140
+ return /* @__PURE__ */ jsx11("div", { role: "group", "aria-label": label, tabIndex: 0, className: "-mx-4 overflow-x-auto px-4 pb-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring sm:mx-0 sm:px-0", children: /* @__PURE__ */ jsx11("ul", { className: "m-0 flex w-max snap-x snap-mandatory list-none gap-3 p-0", children: photos.map((p) => /* @__PURE__ */ jsx11("li", { className: "w-[42vw] max-w-64 shrink-0 snap-start sm:w-64", children: /* @__PURE__ */ jsx11(Photo, { photo: p.photo, ratio: "3/4", sizes: "(min-width: 40rem) 16rem, 42vw" }) }, p.id)) }) });
1141
+ }
1142
+ function ShopWall({ photos, notes, sign, texture, label }) {
1143
+ const pieces = [
1144
+ ...sign ? [{ id: "sign", kind: "sign", children: sign, variant: "neon" }] : [],
1145
+ ...photos.slice(0, SHOP_LIMITS.photos).map((p) => ({
1146
+ id: p.id,
1147
+ kind: "polaroid",
1148
+ img: /* @__PURE__ */ jsx11("img", { src: p.photo.src, srcSet: p.photo.srcSet, sizes: "220px", alt: p.photo.alt, loading: "lazy", decoding: "async", className: "absolute inset-0 h-full w-full object-cover" }),
1149
+ caption: p.caption
1150
+ })),
1151
+ ...notes.map((n) => ({ id: n.id, kind: "note", text: n.text, signature: n.signature }))
1152
+ ];
1153
+ const layout = wallLayout(pieces.length);
1154
+ const items = pieces.map((piece, i) => ({ ...piece, ...layout[i], z: i }));
1155
+ return /* @__PURE__ */ jsx11(Wall, { "aria-label": label, items, texture, itemWidth: 220, max: SHOP_LIMITS.photos + 2 });
1156
+ }
1157
+ function GallerySection({ variant = "mosaic", photos, title, lead: lead2, label, notes = [], sign, texture = "plaster", className, ...props }) {
1158
+ const shown = photos.slice(0, SHOP_LIMITS.photos);
1159
+ const bodies = {
1160
+ mosaic: () => /* @__PURE__ */ jsx11(Mosaic, { photos: shown }),
1161
+ filmstrip: () => /* @__PURE__ */ jsx11(Filmstrip, { photos: shown, label }),
1162
+ wall: () => /* @__PURE__ */ jsx11(ShopWall, { photos: shown, notes, sign, texture, label }),
1163
+ grid: () => /* @__PURE__ */ jsx11(
1164
+ MediaGallery,
1165
+ {
1166
+ label,
1167
+ items: shown.map((p) => ({ id: p.id, src: p.photo.src, alt: p.photo.alt, caption: p.caption, video: p.video, shape: "wide" }))
1168
+ }
1169
+ )
1170
+ };
1171
+ const body = bodies[variant]();
1172
+ return /* @__PURE__ */ jsx11(ShopSection, { title, lead: lead2, className: cn(className), "data-variant": variant, ...props, children: body });
1173
+ }
1174
+
1175
+ // src/shop/hero/hero.tsx
1176
+ import { CoverHero } from "@krizaka/ui/cover-hero";
1177
+ import { RetroTv } from "@krizaka/ui/retro-tv";
1178
+ import { ShopSign } from "@krizaka/ui/wall";
1179
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
1180
+ var lead = "m-0 max-w-xl text-base leading-relaxed text-fg-secondary sm:text-lg";
1181
+ var eyebrowClass = "m-0 font-mono text-[13px] text-fg-accent";
1182
+ var titleClass = "kz-shop-title m-0 font-display text-4xl leading-[1.05] tracking-tight text-fg sm:text-5xl";
1183
+ function Text({ title, eyebrow, lead: leadText, facts, actions }) {
1184
+ return /* @__PURE__ */ jsxs9("div", { className: "flex min-w-0 flex-col items-start gap-3", children: [
1185
+ eyebrow && /* @__PURE__ */ jsx12("p", { className: eyebrowClass, children: eyebrow }),
1186
+ /* @__PURE__ */ jsx12("h1", { className: titleClass, children: title }),
1187
+ leadText && /* @__PURE__ */ jsx12("p", { className: lead, children: leadText }),
1188
+ facts && /* @__PURE__ */ jsx12("div", { className: "flex flex-wrap items-center gap-2", children: facts }),
1189
+ actions && /* @__PURE__ */ jsx12("div", { className: "flex flex-wrap items-center gap-3 pt-1", children: actions })
1190
+ ] });
1191
+ }
1192
+ function HeroSection({ variant = "poster", title, eyebrow, lead: leadText, facts, actions, cover, focus = "center", tv: tv2, className, ...props }) {
1193
+ if (variant === "poster") {
1194
+ return /* @__PURE__ */ jsx12(
1195
+ CoverHero,
1196
+ {
1197
+ "data-first": "",
1198
+ "data-variant": "poster",
1199
+ className: cn("kz-shop-section min-h-[24rem] sm:min-h-[28rem] lg:min-h-[31rem]", className),
1200
+ cover: cover && { src: cover.src, alt: cover.alt, video: cover.video, phone: cover.phone, focus },
1201
+ eyebrow,
1202
+ title,
1203
+ lead: leadText,
1204
+ facts,
1205
+ actions,
1206
+ ...props
1207
+ }
1208
+ );
1209
+ }
1210
+ const text = /* @__PURE__ */ jsx12(Text, { title, eyebrow, lead: leadText, facts, actions });
1211
+ if (variant === "split") {
1212
+ return /* @__PURE__ */ jsx12("header", { "data-first": "", "data-variant": "split", className: cn("kz-shop-section", className), ...props, children: /* @__PURE__ */ jsx12(Page, { children: /* @__PURE__ */ jsxs9("div", { className: "grid items-center gap-6 py-6 md:grid-cols-[minmax(0,1fr)_minmax(0,32rem)] md:gap-12 md:py-8", children: [
1213
+ /* @__PURE__ */ jsx12("div", { className: "order-2 md:order-1", children: text }),
1214
+ cover && /* @__PURE__ */ jsx12(Photo, { photo: cover, ratio: "4/5", priority: true, sizes: "(min-width: 48rem) 32rem, 100vw", className: "order-1 max-h-[26rem] md:order-2 md:max-h-none" })
1215
+ ] }) }) });
1216
+ }
1217
+ if (variant === "banner") {
1218
+ return /* @__PURE__ */ jsxs9("header", { "data-first": "", "data-variant": "banner", className: cn("kz-shop-section", className), ...props, children: [
1219
+ cover && /* @__PURE__ */ jsx12("div", { className: "mx-auto w-full max-w-[90rem]", children: /* @__PURE__ */ jsx12(Photo, { photo: cover, ratio: "21/9", priority: true, sizes: "100vw", className: "rounded-none aspect-[3/2] sm:aspect-[21/9]" }) }),
1220
+ /* @__PURE__ */ jsx12(Page, { children: /* @__PURE__ */ jsx12("div", { className: "py-6", children: text }) })
1221
+ ] });
1222
+ }
1223
+ return /* @__PURE__ */ jsx12("header", { "data-first": "", "data-variant": "tv", className: cn("kz-shop-section", className), ...props, children: /* @__PURE__ */ jsx12(Page, { children: /* @__PURE__ */ jsxs9("div", { className: "grid items-center gap-6 py-6 md:grid-cols-[minmax(0,1fr)_17rem] md:gap-12 md:py-8", children: [
1224
+ /* @__PURE__ */ jsxs9("div", { className: "flex min-w-0 flex-col items-start gap-4", children: [
1225
+ /* @__PURE__ */ jsx12(ShopSign, { as: "h1", variant: "neon", children: title }),
1226
+ leadText && /* @__PURE__ */ jsx12("p", { className: lead, children: leadText }),
1227
+ facts && /* @__PURE__ */ jsx12("div", { className: "flex flex-wrap items-center gap-2", children: facts }),
1228
+ actions && /* @__PURE__ */ jsx12("div", { className: "flex flex-wrap items-center gap-3 pt-1", children: actions })
1229
+ ] }),
1230
+ tv2 && /* @__PURE__ */ jsx12(RetroTv, { ...tv2, className: cn("mx-auto w-56 md:w-full", tv2.className) })
1231
+ ] }) }) });
1232
+ }
1233
+
1234
+ // src/shop/policies/policies.tsx
1235
+ import { DescriptionList } from "@krizaka/ui/description-list";
1236
+ import { jsx as jsx13 } from "react/jsx-runtime";
1237
+ function PoliciesSection({ title, items, className, ...props }) {
1238
+ if (items.length === 0) return null;
1239
+ return /* @__PURE__ */ jsx13(ShopSection, { title, className, "data-variant": "inline", ...props, children: /* @__PURE__ */ jsx13(DescriptionList, { layout: "inline", className: "max-w-3xl", items: items.map((p) => ({ id: p.id, term: p.term, details: p.details })) }) });
1240
+ }
1241
+
1242
+ // src/shop/reviews/reviews.tsx
1243
+ import { ReviewCard, ReviewSummary } from "@krizaka/ui/reviews";
1244
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
1245
+ function ReviewsSection({ variant = "summary-cards", title, summary: summary2, reviews, count = 2, minCount = 5, className, ...props }) {
1246
+ if (summary2.count < Math.max(1, minCount) || reviews.length === 0) return null;
1247
+ const shown = reviews.slice(0, count);
1248
+ if (variant === "strip") {
1249
+ return /* @__PURE__ */ jsx14(ShopSection, { "aria-label": typeof title === "string" ? title : summary2.summaryText, "data-variant": "strip", className, ...props, children: /* @__PURE__ */ jsxs10("p", { className: "m-0 flex flex-wrap items-baseline gap-x-3 gap-y-1 text-sm text-fg-secondary", children: [
1250
+ /* @__PURE__ */ jsx14("span", { className: "rounded-sm border-2 border-border-strong px-2 py-0.5 font-mono text-base font-bold text-fg tabular-nums", children: summary2.scoreText }),
1251
+ /* @__PURE__ */ jsx14("span", { children: summary2.countText }),
1252
+ /* @__PURE__ */ jsx14("span", { className: "sr-only", children: summary2.summaryText })
1253
+ ] }) });
1254
+ }
1255
+ if (variant === "quote") {
1256
+ const r = shown[0];
1257
+ const { text, author, date, dateTime, service, ratingText } = r;
1258
+ return /* @__PURE__ */ jsx14(ShopSection, { title, className, "data-variant": "quote", ...props, children: /* @__PURE__ */ jsxs10("figure", { className: "m-0 max-w-3xl", children: [
1259
+ /* @__PURE__ */ jsxs10("blockquote", { className: "m-0 font-display text-2xl leading-snug text-fg sm:text-3xl", children: [
1260
+ "\u201C",
1261
+ text,
1262
+ "\u201D"
1263
+ ] }),
1264
+ /* @__PURE__ */ jsxs10("figcaption", { className: "mt-3 flex flex-wrap items-baseline gap-x-2 text-sm text-fg-secondary", children: [
1265
+ /* @__PURE__ */ jsx14("span", { className: "font-semibold text-fg", children: author }),
1266
+ /* @__PURE__ */ jsx14("time", { dateTime, children: date }),
1267
+ service && /* @__PURE__ */ jsxs10("span", { children: [
1268
+ "\xB7 ",
1269
+ service
1270
+ ] }),
1271
+ /* @__PURE__ */ jsx14("span", { className: "sr-only", children: ratingText })
1272
+ ] })
1273
+ ] }) });
1274
+ }
1275
+ return /* @__PURE__ */ jsx14(ShopSection, { title, className, "data-variant": "summary-cards", ...props, children: /* @__PURE__ */ jsxs10("div", { className: "grid items-start gap-4 lg:grid-cols-[18rem_minmax(0,1fr)] lg:gap-8", children: [
1276
+ /* @__PURE__ */ jsx14(ReviewSummary, { ...summary2, minCount }),
1277
+ /* @__PURE__ */ jsx14("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-[repeat(auto-fit,minmax(14rem,1fr))]", children: shown.map(({ id, ...review2 }) => /* @__PURE__ */ jsx14(ReviewCard, { ...review2 }, id)) })
1278
+ ] }) });
1279
+ }
1280
+
1281
+ // src/shop/services/services.tsx
1282
+ import { Badge } from "@krizaka/ui/badge";
1283
+ import { buttonVariants as buttonVariants3 } from "@krizaka/ui/button";
1284
+ import { ServiceCard } from "@krizaka/ui/service-card";
1285
+ import * as React4 from "react";
1286
+ import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
1287
+ var GROUP_NOTE = "m-0 font-mono text-[13px] lowercase text-fg-secondary";
1288
+ function groupsOf(services, by) {
1289
+ if (by === "none") return [{ name: void 0, items: services }];
1290
+ const groups = [];
1291
+ for (const s of services) {
1292
+ const name = s.category;
1293
+ const group = groups.find((g) => g.name === name);
1294
+ if (group) group.items.push(s);
1295
+ else groups.push({ name, items: [s] });
1296
+ }
1297
+ return groups;
1298
+ }
1299
+ function MenuRow({ service, chooseLabel, popularLabel, linkAs }) {
1300
+ const facts = [service.duration, service.capacity].filter(Boolean).join(" \xB7 ");
1301
+ return /* @__PURE__ */ jsxs11("li", { className: "flex items-center gap-3 border-b border-border-subtle py-2.5 last:border-b-0", "data-service": service.id, children: [
1302
+ service.photo && /* @__PURE__ */ jsx15(Photo, { photo: service.photo, ratio: "1/1", sizes: "56px", className: "h-12 w-12 shrink-0 rounded-md sm:h-14 sm:w-14" }),
1303
+ /* @__PURE__ */ jsxs11("div", { className: "min-w-0 flex-1", children: [
1304
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-baseline gap-2", children: [
1305
+ /* @__PURE__ */ jsx15("h3", { className: "m-0 shrink truncate text-[15px] font-semibold leading-tight text-fg", children: service.name }),
1306
+ service.popular && /* @__PURE__ */ jsx15(Badge, { tone: "accent", size: "sm", className: "hidden shrink-0 self-center sm:inline-flex", children: popularLabel }),
1307
+ /* @__PURE__ */ jsx15("span", { "aria-hidden": true, className: "min-w-4 flex-1 -translate-y-0.5 border-b border-dotted border-border-control" }),
1308
+ /* @__PURE__ */ jsxs11("span", { className: "shrink-0 whitespace-nowrap text-[15px] font-bold tabular-nums text-fg", children: [
1309
+ service.priceFrom && /* @__PURE__ */ jsx15("span", { className: "mr-1 text-xs font-medium text-fg-secondary", children: service.priceFrom }),
1310
+ service.price
1311
+ ] })
1312
+ ] }),
1313
+ /* @__PURE__ */ jsxs11("p", { className: "m-0 mt-0.5 truncate text-[13px] leading-snug text-fg-secondary", children: [
1314
+ service.popular && /* @__PURE__ */ jsx15(Badge, { tone: "accent", size: "sm", className: "mr-1.5 sm:hidden", children: popularLabel }),
1315
+ /* @__PURE__ */ jsx15("span", { className: "font-mono tabular-nums", children: facts }),
1316
+ facts && service.description && /* @__PURE__ */ jsx15("span", { "aria-hidden": true, children: " \xB7 " }),
1317
+ service.description
1318
+ ] })
1319
+ ] }),
1320
+ service.href && /* @__PURE__ */ jsx15(
1321
+ BlockLink,
1322
+ {
1323
+ href: service.href,
1324
+ linkAs,
1325
+ "aria-label": `${chooseLabel} ${service.name}`,
1326
+ className: cn(buttonVariants3({ variant: "secondary", size: "md" }), "min-h-11 shrink-0 no-underline"),
1327
+ children: chooseLabel
1328
+ }
1329
+ )
1330
+ ] });
1331
+ }
1332
+ function Menu({ services, groupBy, columns, aside, chooseLabel, popularLabel, listLabel, linkAs }) {
1333
+ const groups = groupsOf(services, groupBy);
1334
+ const uid = React4.useId();
1335
+ const list = /* @__PURE__ */ jsx15("div", { className: cn("grid gap-x-12", !aside && columns === 2 && "lg:grid-cols-2"), children: groups.map((g, i) => /* @__PURE__ */ jsxs11("div", { className: "mb-3 min-w-0 last:mb-0", children: [
1336
+ g.name && /* @__PURE__ */ jsx15("p", { className: GROUP_NOTE, id: `${uid}-grp-${i}`, children: g.name }),
1337
+ /* @__PURE__ */ jsx15("ul", { "aria-label": g.name ? void 0 : listLabel, "aria-labelledby": g.name ? `${uid}-grp-${i}` : void 0, className: "m-0 list-none p-0", children: g.items.map((s) => /* @__PURE__ */ jsx15(MenuRow, { service: s, chooseLabel, popularLabel, linkAs }, s.id)) })
1338
+ ] }, g.name ?? i)) });
1339
+ if (!aside) return list;
1340
+ return /* @__PURE__ */ jsxs11("div", { className: "grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_20rem] lg:gap-12", children: [
1341
+ list,
1342
+ /* @__PURE__ */ jsx15("aside", { className: "kz-shop-aside flex flex-col gap-4", children: aside })
1343
+ ] });
1344
+ }
1345
+ function ServicesSection({ variant = "menu", services, title, lead: lead2, groupBy = "category", columns = 1, aside, chooseLabel, popularLabel, listLabel, linkAs, className, ...props }) {
1346
+ const card = (s, i, extra) => /* @__PURE__ */ jsx15(
1347
+ ServiceCard,
1348
+ {
1349
+ name: s.name,
1350
+ price: s.price,
1351
+ priceFrom: s.priceFrom,
1352
+ duration: s.duration,
1353
+ capacity: s.capacity,
1354
+ description: s.description,
1355
+ included: s.included,
1356
+ tag: s.popular ? popularLabel : void 0,
1357
+ media: s.photo ? /* @__PURE__ */ jsx15("img", { src: s.photo.src, srcSet: s.photo.srcSet, sizes: "(min-width: 64rem) 18rem, 90vw", alt: s.photo.alt, loading: "lazy", decoding: "async" }) : void 0,
1358
+ mediaRatio: "photo",
1359
+ variant: variant === "index" ? "index" : "default",
1360
+ actionLabel: chooseLabel,
1361
+ href: s.href,
1362
+ linkAs,
1363
+ className: extra,
1364
+ "data-index": i
1365
+ },
1366
+ s.id
1367
+ );
1368
+ let body;
1369
+ if (variant === "menu") {
1370
+ body = /* @__PURE__ */ jsx15(Menu, { services, groupBy, columns, aside, chooseLabel, popularLabel, listLabel, linkAs });
1371
+ } else if (variant === "carousel") {
1372
+ body = /* @__PURE__ */ jsx15("div", { role: "group", "aria-label": listLabel ?? (typeof title === "string" ? title : void 0), tabIndex: 0, className: "-mx-4 flex snap-x snap-mandatory gap-3 overflow-x-auto px-4 pb-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring sm:mx-0 sm:px-0", children: services.map((s, i) => card(s, i, "w-[78vw] max-w-72 shrink-0 snap-start sm:w-72")) });
1373
+ } else {
1374
+ const shown = variant === "cards" ? services.slice(0, SHOP_LIMITS.cards) : services;
1375
+ body = /* @__PURE__ */ jsx15("div", { className: "grid items-start gap-4 sm:grid-cols-2 lg:grid-cols-3", children: shown.map((s, i) => card(s, i, "h-auto")) });
1376
+ }
1377
+ return /* @__PURE__ */ jsx15(ShopSection, { title, lead: lead2, className, "data-variant": variant, ...props, children: body });
1378
+ }
1379
+
1380
+ // src/shop/social/social.tsx
1381
+ import { EMBED_PLATFORMS, EmbedFacade } from "@krizaka/ui/embed-facade";
1382
+ import { jsx as jsx16 } from "react/jsx-runtime";
1383
+ function SocialSection({ variant = "links", title, links, labels = {}, playLabels, reelTitle, poster, notice, className, ...props }) {
1384
+ if (links.length === 0) return null;
1385
+ const first = links[0];
1386
+ return /* @__PURE__ */ jsx16(ShopSection, { title, className, "data-variant": variant, ...props, children: variant === "facade" && playLabels ? /* @__PURE__ */ jsx16("div", { className: "w-44 sm:w-52", children: /* @__PURE__ */ jsx16(EmbedFacade, { platform: first.platform, url: first.url, title: reelTitle ?? labels[first.platform] ?? EMBED_PLATFORMS[first.platform], playLabel: playLabels[first.platform], poster, notice }) }) : /* @__PURE__ */ jsx16("ul", { className: "m-0 flex list-none flex-wrap gap-2 p-0", children: links.map((l) => /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsx16(
1387
+ "a",
1388
+ {
1389
+ href: l.url,
1390
+ target: "_blank",
1391
+ rel: "noopener noreferrer nofollow",
1392
+ referrerPolicy: "no-referrer",
1393
+ className: "inline-flex min-h-11 items-center rounded-md border border-border-control bg-surface-1 px-4 text-sm font-semibold text-fg no-underline hover:border-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
1394
+ children: labels[l.platform] ?? EMBED_PLATFORMS[l.platform]
1395
+ }
1396
+ ) }, l.id)) }) });
1397
+ }
1398
+
1399
+ // src/shop/story/story.tsx
1400
+ import { Avatar } from "@krizaka/ui/avatar";
1401
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
1402
+ function StorySection({ variant = "quote", title, quote, body, owner, actions, className, ...props }) {
1403
+ if (!body && !quote) return null;
1404
+ return /* @__PURE__ */ jsx17(ShopSection, { title, className, "data-variant": variant, ...props, children: variant === "owner" ? /* @__PURE__ */ jsxs12("div", { className: "flex max-w-3xl items-start gap-4", children: [
1405
+ owner && /* @__PURE__ */ jsx17(Avatar, { src: owner.photo, alt: "", fallback: owner.name.slice(0, 1), size: "xl" }),
1406
+ /* @__PURE__ */ jsxs12("div", { className: "min-w-0", children: [
1407
+ owner && /* @__PURE__ */ jsx17("p", { className: "m-0 font-semibold text-fg", children: owner.name }),
1408
+ /* @__PURE__ */ jsx17("p", { className: "m-0 mt-1 text-base leading-relaxed text-fg-secondary", children: body }),
1409
+ actions && /* @__PURE__ */ jsx17("div", { className: "mt-3 flex flex-wrap gap-2", children: actions })
1410
+ ] })
1411
+ ] }) : /* @__PURE__ */ jsxs12("div", { className: "grid max-w-4xl gap-4 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:gap-10", children: [
1412
+ quote && /* @__PURE__ */ jsx17("blockquote", { className: "m-0 border-s-2 border-accent ps-4 font-display text-2xl leading-snug text-fg", children: quote }),
1413
+ /* @__PURE__ */ jsx17("p", { className: "m-0 text-base leading-relaxed text-fg-secondary", children: body })
1414
+ ] }) });
1415
+ }
1416
+
1417
+ // src/shop/team/team.tsx
1418
+ import { Avatar as Avatar2 } from "@krizaka/ui/avatar";
1419
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
1420
+ function TeamSection({ variant = "row", members, title, lead: lead2, className, ...props }) {
1421
+ if (members.length === 0) return null;
1422
+ const list = variant === "cards" ? /* @__PURE__ */ jsx18("ul", { className: "m-0 grid list-none gap-3 p-0 sm:grid-cols-2 lg:grid-cols-4", children: members.map((m) => /* @__PURE__ */ jsxs13("li", { className: "flex items-center gap-3 rounded-xl border border-border-default bg-surface-1 p-3", children: [
1423
+ /* @__PURE__ */ jsx18(Avatar2, { src: m.photo, fallback: m.name.slice(0, 1), size: "lg" }),
1424
+ /* @__PURE__ */ jsxs13("div", { className: "min-w-0", children: [
1425
+ /* @__PURE__ */ jsx18("p", { className: "m-0 truncate font-semibold text-fg", children: m.name }),
1426
+ m.role && /* @__PURE__ */ jsx18("p", { className: "m-0 truncate text-[13px] text-fg-secondary", children: m.role })
1427
+ ] })
1428
+ ] }, m.id)) }) : /* @__PURE__ */ jsx18("ul", { className: "m-0 flex list-none flex-wrap gap-x-6 gap-y-3 p-0", children: members.map((m) => /* @__PURE__ */ jsxs13("li", { className: "flex items-center gap-2.5", children: [
1429
+ /* @__PURE__ */ jsx18(Avatar2, { src: m.photo, fallback: m.name.slice(0, 1), size: "md" }),
1430
+ /* @__PURE__ */ jsx18("span", { className: "font-semibold text-fg", children: m.name })
1431
+ ] }, m.id)) });
1432
+ return /* @__PURE__ */ jsx18(ShopSection, { title, lead: lead2, className, "data-variant": variant, ...props, children: list });
1433
+ }
1434
+
1435
+ // src/shop/video/video.tsx
1436
+ import { EmbedFacade as EmbedFacade2 } from "@krizaka/ui/embed-facade";
1437
+ import { RetroTv as RetroTv2 } from "@krizaka/ui/retro-tv";
1438
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
1439
+ function VideoSection({ variant = "tv", title, lead: lead2, reels = [], clip, playLabels, notice, cabinet = "cabinet", channel, aside, className, ...props }) {
1440
+ const facade = (r, className2) => /* @__PURE__ */ jsx19(EmbedFacade2, { platform: r.platform, url: r.url, title: r.title, playLabel: playLabels[r.platform], poster: r.poster, notice, className: className2 }, r.id);
1441
+ let body;
1442
+ if (variant === "shorts") {
1443
+ body = /* @__PURE__ */ jsx19("ul", { className: "m-0 flex list-none snap-x snap-mandatory gap-3 overflow-x-auto p-0 pb-2", children: reels.slice(0, SHOP_LIMITS.reels).map((r) => /* @__PURE__ */ jsx19("li", { className: "w-44 shrink-0 snap-start sm:w-52", children: facade(r) }, r.id)) });
1444
+ } else {
1445
+ const first = reels[0];
1446
+ let tv2 = null;
1447
+ if (clip) tv2 = /* @__PURE__ */ jsx19(RetroTv2, { ...clip, variant: cabinet, channel });
1448
+ else if (first) tv2 = /* @__PURE__ */ jsx19(RetroTv2, { title: first.title, variant: cabinet, channel, children: facade(first) });
1449
+ body = /* @__PURE__ */ jsxs14("div", { className: "grid items-center gap-6 md:grid-cols-[minmax(0,1fr)_17rem] md:gap-12", children: [
1450
+ /* @__PURE__ */ jsx19("div", { className: "order-2 md:order-1", children: aside }),
1451
+ /* @__PURE__ */ jsx19("div", { className: "order-1 mx-auto w-56 md:order-2 md:w-full", children: tv2 })
1452
+ ] });
1453
+ }
1454
+ return /* @__PURE__ */ jsx19(ShopSection, { title, lead: lead2, className, "data-variant": variant, ...props, children: body });
1455
+ }
1456
+
1457
+ // src/shop/visit/visit.tsx
1458
+ import { OpeningHours } from "@krizaka/ui/opening-hours";
1459
+ import { MapGate } from "@krizaka/ui/shop/map-gate";
1460
+ import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
1461
+ function VisitSection({ variant = "card", title, hours, today, status, hoursLabel, address, phone, map, className, ...props }) {
1462
+ const details = /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2 text-sm text-fg-secondary", children: [
1463
+ address && /* @__PURE__ */ jsx20("p", { className: "m-0", children: address }),
1464
+ phone && /* @__PURE__ */ jsx20("p", { className: "m-0", children: /* @__PURE__ */ jsx20("a", { href: phone.href, className: "font-semibold text-fg-accent underline", children: phone.label }) })
1465
+ ] });
1466
+ const opening = /* @__PURE__ */ jsx20(OpeningHours, { label: hoursLabel, days: hours, today, status });
1467
+ const drawn = map ? variant : "card";
1468
+ return /* @__PURE__ */ jsxs15(ShopSection, { title, className, "data-variant": drawn, ...props, children: [
1469
+ drawn === "card" && /* @__PURE__ */ jsxs15("div", { className: "grid max-w-xl gap-3", children: [
1470
+ opening,
1471
+ details
1472
+ ] }),
1473
+ drawn === "map" && /* @__PURE__ */ jsxs15("div", { className: "grid gap-3", children: [
1474
+ /* @__PURE__ */ jsx20(MapGate, { ...map }),
1475
+ details
1476
+ ] }),
1477
+ drawn === "split" && /* @__PURE__ */ jsxs15("div", { className: "grid items-start gap-4 md:grid-cols-[minmax(0,22rem)_minmax(0,1fr)] md:gap-8", children: [
1478
+ /* @__PURE__ */ jsxs15("div", { className: "grid gap-3", children: [
1479
+ opening,
1480
+ details
1481
+ ] }),
1482
+ /* @__PURE__ */ jsx20(MapGate, { ...map })
1483
+ ] })
1484
+ ] });
1485
+ }
1486
+
1487
+ // src/shop-composer/thumbnails.tsx
1488
+ import { jsx as jsx21 } from "react/jsx-runtime";
1489
+ var shop = demoSalon;
1490
+ var play = { tiktok: "Play", "youtube-shorts": "Play", instagram: "Play" };
1491
+ var reel = { id: "r", platform: "tiktok", url: "https://www.tiktok.com/@salon/video/7000000000000000000", title: "Reel" };
1492
+ var summary = {
1493
+ score: 4.7,
1494
+ count: 38,
1495
+ distribution: [0, 1, 2, 7, 28],
1496
+ scoreText: "4.7 / 5",
1497
+ countText: "38 reviews",
1498
+ summaryText: "4.7 out of 5, 38 reviews",
1499
+ starText: (s, n) => `${s} stars: ${n}`
1500
+ };
1501
+ var review = { id: "a", author: "Nadia F.", date: "October 2026", dateTime: "2026-10", service: "Cut and blow-dry", rating: 5, ratingText: "5 out of 5", text: "The best blow-dry in the neighbourhood, simply." };
1502
+ function Demo({ type, variant }) {
1503
+ const v = variant;
1504
+ switch (type) {
1505
+ case "hero":
1506
+ return /* @__PURE__ */ jsx21(HeroSection, { variant: v, title: shop.name, eyebrow: shop.eyebrow, lead: shop.promise, cover: shop.cover, actions: /* @__PURE__ */ jsx21(Button, { variant: "primary", children: "Book" }), tv: { src: "/demo.mp4", poster: shop.cover.src, title: "Latest video" } });
1507
+ case "services":
1508
+ return /* @__PURE__ */ jsx21(ServicesSection, { variant: v, title: "Services", services: shop.services, chooseLabel: "Choose", popularLabel: "Popular" });
1509
+ case "booking":
1510
+ return variant === "sticky" ? /* @__PURE__ */ jsx21("div", { className: "flex items-center justify-center border-t border-border-default bg-surface-1 p-4", children: /* @__PURE__ */ jsx21(Button, { variant: "primary", size: "lg", children: "Book" }) }) : /* @__PURE__ */ jsx21(BookingSection, { variant: v, label: "Next free times", times: shop.times, href: "#", actionLabel: "Book", title: "Ready when you are", body: "A few taps." });
1511
+ case "gallery":
1512
+ return /* @__PURE__ */ jsx21(GallerySection, { variant: v, title: "Photos", label: "Photos", photos: shop.photos, sign: shop.name });
1513
+ case "video":
1514
+ return /* @__PURE__ */ jsx21(VideoSection, { variant: v, title: "Latest", reels: [reel, { ...reel, id: "r2" }], playLabels: play });
1515
+ case "reviews":
1516
+ return /* @__PURE__ */ jsx21(ReviewsSection, { variant: v, title: "Reviews", summary, reviews: [review, { ...review, id: "b", author: "L\xE9o P." }] });
1517
+ case "bulletin":
1518
+ return /* @__PURE__ */ jsx21(BulletinSection, { variant: v, title: "News", today: "2026-10-27", flyers: [{ id: "f", text: "Closed on Monday the 3rd: see you on Tuesday!", signature: "Jade" }] });
1519
+ case "team":
1520
+ return /* @__PURE__ */ jsx21(TeamSection, { variant: v, title: "Team", members: shop.team.map((t) => ({ id: t.id, name: t.name, role: "Stylist" })) });
1521
+ case "visit":
1522
+ return /* @__PURE__ */ jsx21(VisitSection, { variant: v, title: "Visit", hours: shop.hours, status: shop.status, hoursLabel: "Hours", address: shop.address, phone: { href: "tel:5145550110", label: shop.phone }, map: { label: "Map", center: [-73.58, 45.48], showLabel: "Show the map" } });
1523
+ case "story":
1524
+ return /* @__PURE__ */ jsx21(StorySection, { variant: v, title: "Our story", quote: "Cuts that last, advice that is honest.", body: "Three friends opened the salon in 2019, on the corner where the old bakery stood.", owner: { name: "Jade" } });
1525
+ case "social":
1526
+ return /* @__PURE__ */ jsx21(SocialSection, { variant: v, title: "Follow us", links: [{ id: "a", platform: "instagram", url: "https://instagram.com/salon" }, { id: "b", platform: "tiktok", url: "https://tiktok.com/@salon" }], playLabels: play });
1527
+ case "faq":
1528
+ return /* @__PURE__ */ jsx21(FaqSection, { title: "Questions", questions: [{ id: "q", question: "Do I need to book?", answer: "Yes, pick a time online." }, { id: "q2", question: "Can I cancel?", answer: "Up to 24 hours before." }] });
1529
+ case "policies":
1530
+ return /* @__PURE__ */ jsx21(PoliciesSection, { title: "Policies", items: [{ id: "p", term: "Cancellation", details: "Free up to 24 h before" }, { id: "p2", term: "Prices", details: "Before taxes" }] });
1531
+ }
1532
+ }
1533
+ function SectionThumbnail({ type, variant, preset, density }) {
1534
+ return /* @__PURE__ */ jsx21("div", { "aria-hidden": true, inert: true, className: "kz-shop-thumb", "data-thumb": `${type}.${variant}`, children: /* @__PURE__ */ jsx21("div", { className: "kz-shop-thumb-inner", children: /* @__PURE__ */ jsx21(ShopFrame, { preset, density: density ?? "compact", children: /* @__PURE__ */ jsx21(Demo, { type, variant }) }) }) });
1535
+ }
1536
+
1537
+ // src/shop-composer/inspector.tsx
1538
+ import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
1539
+ function Words({ section, m, run: run2 }) {
1540
+ const id = React5.useId();
1541
+ const text = section.text ?? {};
1542
+ const field = (name, label) => /* @__PURE__ */ jsxs16("fieldset", { className: "m-0 grid gap-1.5 border-0 p-0", children: [
1543
+ /* @__PURE__ */ jsx22("legend", { className: "mb-1 text-xs font-semibold text-fg-secondary", children: label }),
1544
+ ["fr", "en"].map((lang) => /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
1545
+ /* @__PURE__ */ jsx22("label", { htmlFor: `${id}-${name}-${lang}`, className: "text-xs text-fg-secondary", children: lang === "fr" ? m.french : m.english }),
1546
+ /* @__PURE__ */ jsx22(
1547
+ "input",
1548
+ {
1549
+ id: `${id}-${name}-${lang}`,
1550
+ className: "min-h-10 rounded-md border border-border-control bg-surface-1 px-3 text-sm text-fg focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring",
1551
+ maxLength: 600,
1552
+ value: text[name]?.[lang] ?? "",
1553
+ onChange: (e) => {
1554
+ const next = { ...text[name] ?? {}, [lang]: e.target.value || void 0 };
1555
+ const empty = !next.fr && !next.en;
1556
+ run2({ type: "setText", key: section.key, field: name, value: empty ? void 0 : next }, `text:${section.key}:${name}:${lang}`);
1557
+ }
1558
+ }
1559
+ )
1560
+ ] }, lang))
1561
+ ] });
1562
+ return /* @__PURE__ */ jsxs16("section", { "aria-label": m.words, className: "grid gap-3", children: [
1563
+ /* @__PURE__ */ jsx22("h3", { className: "m-0 text-sm font-semibold text-fg", children: m.words }),
1564
+ field("title", m.titleField),
1565
+ field("lead", m.leadField)
1566
+ ] });
1567
+ }
1568
+ function Blocks({ section, m, run: run2, announce }) {
1569
+ const def = sectionDefinition(section.type);
1570
+ const blocks = section.blocks ?? [];
1571
+ if (def.blockTypes.length === 0) return null;
1572
+ const label = (b, i) => `${m.blockNames[b.type] ?? b.type} ${i + 1}`;
1573
+ const move = (i, to) => {
1574
+ const b = blocks[i];
1575
+ if (to < 0 || to >= blocks.length) return;
1576
+ run2({ type: "moveBlock", key: section.key, blockKey: b.key, to });
1577
+ announce(fill(m.announceMoved, { name: label(b, i), n: to + 1, total: blocks.length }));
1578
+ };
1579
+ return /* @__PURE__ */ jsxs16("section", { "aria-label": m.blocks, className: "grid gap-2", children: [
1580
+ /* @__PURE__ */ jsx22("h3", { className: "m-0 text-sm font-semibold text-fg", children: m.blocks }),
1581
+ blocks.length > 0 && /* @__PURE__ */ jsx22("ol", { className: "m-0 grid list-none gap-1 p-0", children: blocks.map((b, i) => /* @__PURE__ */ jsxs16("li", { className: "flex items-center gap-1 rounded-md border border-border-default bg-surface-1 ps-3", children: [
1582
+ /* @__PURE__ */ jsx22("span", { className: "min-w-0 flex-1 truncate text-sm text-fg", children: label(b, i) }),
1583
+ /* @__PURE__ */ jsx22(Button2, { size: "sm", variant: "ghost", disabled: i === 0, "aria-label": `${m.moveUp}: ${label(b, i)}`, onClick: () => move(i, i - 1), children: "\u2191" }),
1584
+ /* @__PURE__ */ jsx22(Button2, { size: "sm", variant: "ghost", disabled: i === blocks.length - 1, "aria-label": `${m.moveDown}: ${label(b, i)}`, onClick: () => move(i, i + 1), children: "\u2193" }),
1585
+ /* @__PURE__ */ jsx22(Button2, { size: "sm", variant: "ghost", "aria-label": fill(m.removeBlock, { name: label(b, i) }), onClick: () => run2({ type: "removeBlock", key: section.key, blockKey: b.key }), children: "\xD7" })
1586
+ ] }, b.key)) }),
1587
+ /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-2", children: def.blockTypes.map((type) => /* @__PURE__ */ jsxs16(Button2, { size: "sm", variant: "outline", onClick: () => run2({ type: "addBlock", key: section.key, blockKey: newKey("b"), blockType: type, settings: defaultBlockSettings(type) }), children: [
1588
+ m.addBlock,
1589
+ " \xB7 ",
1590
+ m.blockNames[type] ?? type
1591
+ ] }, type)) })
1592
+ ] });
1593
+ }
1594
+ function defaultBlockSettings(type) {
1595
+ switch (type) {
1596
+ case "fact":
1597
+ return { kind: "open-now" };
1598
+ case "note":
1599
+ return { text: "\u2026" };
1600
+ case "flyer":
1601
+ return { text: "\u2026" };
1602
+ case "photo":
1603
+ return { mediaId: "" };
1604
+ case "service":
1605
+ return { serviceId: "" };
1606
+ case "member":
1607
+ return { memberId: "" };
1608
+ case "reel":
1609
+ return { platform: "tiktok", url: "https://" };
1610
+ case "link":
1611
+ return { platform: "instagram", url: "https://" };
1612
+ case "question":
1613
+ return { question: {}, answer: {} };
1614
+ default:
1615
+ return {};
1616
+ }
1617
+ }
1618
+ function Inspector({ section, name, messages: m, run: run2, epoch, announce, onInvalid, preset, density }) {
1619
+ const def = sectionDefinition(section.type);
1620
+ const label = React5.useId();
1621
+ return /* @__PURE__ */ jsxs16("div", { className: "flex min-w-0 flex-col gap-6", children: [
1622
+ /* @__PURE__ */ jsxs16("section", { "aria-labelledby": label, className: "grid gap-2", children: [
1623
+ /* @__PURE__ */ jsx22("h3", { id: label, className: "m-0 text-sm font-semibold text-fg", children: m.variant }),
1624
+ /* @__PURE__ */ jsx22(RadioGroup2.Root, { label: `${name}: ${m.variant}`, value: section.variant, onValueChange: (variant) => run2({ type: "setVariant", key: section.key, variant }), className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: def.variants.map((variant) => /* @__PURE__ */ jsxs16(
1625
+ "div",
1626
+ {
1627
+ role: "presentation",
1628
+ "data-checked": section.variant === variant ? "" : void 0,
1629
+ onClick: () => run2({ type: "setVariant", key: section.key, variant }),
1630
+ className: "grid cursor-pointer gap-2 rounded-lg border border-border-default bg-surface-1 p-2 data-[checked]:border-accent data-[checked]:bg-accent-soft",
1631
+ children: [
1632
+ /* @__PURE__ */ jsx22(SectionThumbnail, { type: section.type, variant, preset, density }),
1633
+ /* @__PURE__ */ jsx22(RadioGroup2.Item, { value: variant, children: m.variantNames[`${section.type}.${variant}`] ?? variant })
1634
+ ]
1635
+ },
1636
+ variant
1637
+ )) })
1638
+ ] }),
1639
+ /* @__PURE__ */ jsx22(
1640
+ SettingsForm,
1641
+ {
1642
+ section,
1643
+ messages: m,
1644
+ onValid: (settings) => run2({ type: "patchSettings", key: section.key, patch: settings }, `settings:${section.key}`),
1645
+ onInvalid: (invalid) => onInvalid(section.key, invalid)
1646
+ },
1647
+ `${section.key}:${epoch}`
1648
+ ),
1649
+ /* @__PURE__ */ jsx22(Blocks, { section, m, run: run2, announce }),
1650
+ /* @__PURE__ */ jsx22(Words, { section, m, run: run2 })
1651
+ ] });
1652
+ }
1653
+
1654
+ // src/shop-composer/outline.tsx
1655
+ import { Button as Button3 } from "@krizaka/ui/button";
1656
+ import { DropdownMenu } from "@krizaka/ui/dropdown-menu";
1657
+ import { Switch as Switch2 } from "@krizaka/ui/switch";
1658
+ import * as React6 from "react";
1659
+ import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
1660
+ function sectionLabel(sections, index, messages) {
1661
+ const s = sections[index];
1662
+ const same2 = sections.filter((x) => x.type === s.type);
1663
+ const base = messages.sectionNames[s.type];
1664
+ return same2.length > 1 ? `${base} ${same2.indexOf(s) + 1}` : base;
1665
+ }
1666
+ var ICON = "h-4 w-4";
1667
+ function Outline({ sections, selected, onSelect, run: run2, messages: m, announce, onAdd, focusRequest }) {
1668
+ const rows = React6.useRef(/* @__PURE__ */ new Map());
1669
+ const wanted = React6.useRef(null);
1670
+ const [tick, setTick] = React6.useState(0);
1671
+ const want = (key2) => {
1672
+ wanted.current = key2;
1673
+ setTick((t) => t + 1);
1674
+ };
1675
+ React6.useLayoutEffect(() => {
1676
+ if (focusRequest) wanted.current = focusRequest.key;
1677
+ }, [focusRequest]);
1678
+ React6.useLayoutEffect(() => {
1679
+ const key2 = wanted.current;
1680
+ wanted.current = null;
1681
+ if (key2) rows.current.get(key2)?.focus();
1682
+ }, [tick, focusRequest]);
1683
+ const move = (index, to) => {
1684
+ const s = sections[index];
1685
+ const name = sectionLabel(sections, index, m);
1686
+ const lo = sections[0]?.type === "hero" ? 1 : 0;
1687
+ const clamped = Math.min(Math.max(to, lo), sections.length - 1);
1688
+ if (s.type === "hero" || clamped === index) {
1689
+ announce(fill(m.announceCannotMove, { name }));
1690
+ return;
1691
+ }
1692
+ run2({ type: "moveSection", key: s.key, to: clamped });
1693
+ want(s.key);
1694
+ announce(fill(m.announceMoved, { name, n: clamped + 1, total: sections.length }));
1695
+ };
1696
+ const onKeyDown = (e, index) => {
1697
+ if (e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
1698
+ e.preventDefault();
1699
+ move(index, index + (e.key === "ArrowUp" ? -1 : 1));
1700
+ } else if (!e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
1701
+ const next = sections[index + (e.key === "ArrowUp" ? -1 : 1)];
1702
+ if (next) {
1703
+ e.preventDefault();
1704
+ rows.current.get(next.key)?.focus();
1705
+ }
1706
+ }
1707
+ };
1708
+ return /* @__PURE__ */ jsxs17("nav", { "aria-label": m.sections, className: "flex min-h-0 flex-col gap-3", children: [
1709
+ /* @__PURE__ */ jsx23("ol", { className: "m-0 flex list-none flex-col gap-1 p-0", children: sections.map((s, i) => {
1710
+ const name = sectionLabel(sections, i, m);
1711
+ const isHero = s.type === "hero";
1712
+ const lo = sections[0]?.type === "hero" ? 1 : 0;
1713
+ return /* @__PURE__ */ jsxs17("li", { "data-selected": selected === s.key ? "" : void 0, "data-disabled": s.disabled ? "" : void 0, className: "flex items-center gap-1 rounded-lg border border-transparent data-[selected]:border-accent data-[selected]:bg-accent-soft", children: [
1714
+ /* @__PURE__ */ jsxs17(
1715
+ "button",
1716
+ {
1717
+ type: "button",
1718
+ ref: (el) => {
1719
+ if (el) rows.current.set(s.key, el);
1720
+ else rows.current.delete(s.key);
1721
+ },
1722
+ "aria-current": selected === s.key ? "true" : void 0,
1723
+ "aria-keyshortcuts": "Alt+ArrowUp Alt+ArrowDown",
1724
+ onClick: () => onSelect(s.key),
1725
+ onKeyDown: (e) => onKeyDown(e, i),
1726
+ className: "flex min-h-11 min-w-0 flex-1 flex-col items-start justify-center rounded-lg px-3 py-1.5 text-start focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring",
1727
+ children: [
1728
+ /* @__PURE__ */ jsxs17("span", { className: "flex w-full items-baseline gap-2", children: [
1729
+ /* @__PURE__ */ jsx23("span", { className: s.disabled ? "truncate text-sm font-semibold text-fg-secondary line-through decoration-1" : "truncate text-sm font-semibold text-fg", children: name }),
1730
+ s.disabled && /* @__PURE__ */ jsx23("span", { className: "font-mono text-[11px] text-fg-secondary", children: m.hiddenNote })
1731
+ ] }),
1732
+ /* @__PURE__ */ jsx23("span", { className: "font-mono text-xs text-fg-secondary", children: m.variantNames[`${s.type}.${s.variant}`] ?? s.variant })
1733
+ ]
1734
+ }
1735
+ ),
1736
+ /* @__PURE__ */ jsx23(
1737
+ Switch2,
1738
+ {
1739
+ size: "sm",
1740
+ label: fill(m.toggleVisible, { name }),
1741
+ checked: !s.disabled,
1742
+ onCheckedChange: (on) => {
1743
+ run2({ type: "toggleDisabled", key: s.key });
1744
+ announce(fill(on ? m.announceShown : m.announceHidden, { name }));
1745
+ }
1746
+ }
1747
+ ),
1748
+ /* @__PURE__ */ jsxs17(DropdownMenu.Root, { children: [
1749
+ /* @__PURE__ */ jsx23(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx23(Button3, { variant: "ghost", size: "icon", "aria-label": fill(m.sectionMenu, { name }), children: /* @__PURE__ */ jsxs17("svg", { viewBox: "0 0 16 16", className: ICON, fill: "currentColor", "aria-hidden": true, children: [
1750
+ /* @__PURE__ */ jsx23("circle", { cx: "8", cy: "3", r: "1.4" }),
1751
+ /* @__PURE__ */ jsx23("circle", { cx: "8", cy: "8", r: "1.4" }),
1752
+ /* @__PURE__ */ jsx23("circle", { cx: "8", cy: "13", r: "1.4" })
1753
+ ] }) }) }),
1754
+ /* @__PURE__ */ jsxs17(
1755
+ DropdownMenu.Content,
1756
+ {
1757
+ onCloseAutoFocus: (e) => {
1758
+ e.preventDefault();
1759
+ rows.current.get(s.key)?.focus();
1760
+ },
1761
+ children: [
1762
+ /* @__PURE__ */ jsx23(DropdownMenu.Item, { disabled: isHero || i <= lo, onSelect: () => move(i, i - 1), children: m.moveUp }),
1763
+ /* @__PURE__ */ jsx23(DropdownMenu.Item, { disabled: isHero || i >= sections.length - 1, onSelect: () => move(i, i + 1), children: m.moveDown }),
1764
+ /* @__PURE__ */ jsx23(DropdownMenu.Item, { disabled: isHero || i <= lo, onSelect: () => move(i, lo), children: m.moveTop }),
1765
+ /* @__PURE__ */ jsx23(DropdownMenu.Separator, {}),
1766
+ /* @__PURE__ */ jsx23(
1767
+ DropdownMenu.Item,
1768
+ {
1769
+ tone: "danger",
1770
+ disabled: sections.length <= 1,
1771
+ onSelect: () => {
1772
+ run2({ type: "removeSection", key: s.key });
1773
+ announce(fill(m.announceRemoved, { name }));
1774
+ const next = sections[i + 1] ?? sections[i - 1];
1775
+ if (next) want(next.key);
1776
+ },
1777
+ children: m.remove
1778
+ }
1779
+ )
1780
+ ]
1781
+ }
1782
+ )
1783
+ ] })
1784
+ ] }, s.key);
1785
+ }) }),
1786
+ /* @__PURE__ */ jsx23(Button3, { variant: "outline", onClick: onAdd, children: m.addSection })
1787
+ ] });
1788
+ }
1789
+
1790
+ // src/shop-composer/composer.tsx
1791
+ import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
1792
+ var AUTOSAVE_MS = 800;
1793
+ function reducer(state, a) {
1794
+ switch (a.type) {
1795
+ case "run": {
1796
+ const history = run(state.history, a.cmd, a.merge);
1797
+ return history === state.history ? state : { ...state, history };
1798
+ }
1799
+ case "undo": {
1800
+ const history = undo(state.history);
1801
+ return history === state.history ? state : { history, epoch: state.epoch + 1 };
1802
+ }
1803
+ case "redo": {
1804
+ const history = redo(state.history);
1805
+ return history === state.history ? state : { history, epoch: state.epoch + 1 };
1806
+ }
1807
+ case "reset":
1808
+ return { history: createHistory(a.page), epoch: state.epoch + 1 };
1809
+ }
1810
+ }
1811
+ function PreviewFrame({ src, title, phone, frame }) {
1812
+ return /* @__PURE__ */ jsx24("div", { className: "flex h-full min-h-0 justify-center overflow-auto bg-surface-2 p-3", children: /* @__PURE__ */ jsx24("iframe", { ref: frame, src: src || void 0, title, "data-device": phone ? "phone" : "desktop", className: phone ? "h-full min-h-[34rem] w-[390px] max-w-full rounded-xl border border-border-default bg-surface-0" : "h-full min-h-[34rem] w-full rounded-xl border border-border-default bg-surface-0" }) });
1813
+ }
1814
+ function ShopComposer({ value, resetKey, onChange, onPublish, onDiscard, published, previewUrl, presets, foldedTypes = [], messages = defaultShopComposerMessages, className }) {
1815
+ const m = messages;
1816
+ const [{ history, epoch }, dispatch] = React7.useReducer(reducer, value, (v) => ({ history: createHistory(v), epoch: 0 }));
1817
+ const page = history.present;
1818
+ const [baseline, setBaseline] = React7.useState(published ?? value);
1819
+ const [selected, setSelected] = React7.useState(page.sections[0]?.key ?? null);
1820
+ const [step, setStep] = React7.useState("list");
1821
+ const [live, setLive] = React7.useState("");
1822
+ const [status, setStatus] = React7.useState("idle");
1823
+ const [adding, setAdding] = React7.useState(false);
1824
+ const [publishing, setPublishing] = React7.useState(false);
1825
+ const [device, setDevice] = React7.useState("desktop");
1826
+ const [previewOpen, setPreviewOpen] = React7.useState(false);
1827
+ const [invalid, setInvalid] = React7.useState(/* @__PURE__ */ new Set());
1828
+ const [focusRequest, setFocusRequest] = React7.useState(null);
1829
+ const frame = React7.useRef(null);
1830
+ const origin = React7.useMemo(() => {
1831
+ try {
1832
+ return new URL(previewUrl, typeof location === "undefined" ? void 0 : location.href).origin;
1833
+ } catch {
1834
+ return "";
1835
+ }
1836
+ }, [previewUrl]);
1837
+ const hasOrigin = origin !== "" && origin !== "null";
1838
+ const first = React7.useRef(true);
1839
+ const saved = React7.useRef(page);
1840
+ React7.useEffect(() => {
1841
+ if (first.current) {
1842
+ first.current = false;
1843
+ return;
1844
+ }
1845
+ saved.current = value;
1846
+ dispatch({ type: "reset", page: value });
1847
+ setInvalid(/* @__PURE__ */ new Set());
1848
+ setBaseline(published ?? value);
1849
+ setSelected(value.sections[0]?.key ?? null);
1850
+ }, [resetKey]);
1851
+ const parsed = React7.useMemo(() => parseShopPage(page), [page]);
1852
+ const announce = React7.useCallback((message) => setLive((prev) => prev === message ? message + String.fromCodePoint(8203) : message), []);
1853
+ const exec = React7.useCallback((cmd, merge) => dispatch({ type: "run", cmd, merge }), []);
1854
+ const selectedSection = page.sections.find((s) => s.key === selected) ?? null;
1855
+ const selectedIndex = selectedSection ? page.sections.indexOf(selectedSection) : -1;
1856
+ React7.useEffect(() => {
1857
+ if (page === saved.current || !parsed.ok || !onChange) return;
1858
+ const timer = setTimeout(async () => {
1859
+ setStatus("saving");
1860
+ try {
1861
+ await onChange(page);
1862
+ saved.current = page;
1863
+ setStatus("saved");
1864
+ if (hasOrigin) postToPreview(frame.current?.contentWindow, origin, { source: "krizaka-shop-composer", type: "refresh" });
1865
+ } catch {
1866
+ setStatus("error");
1867
+ }
1868
+ }, AUTOSAVE_MS);
1869
+ return () => clearTimeout(timer);
1870
+ }, [page, parsed.ok, onChange, origin, hasOrigin]);
1871
+ React7.useEffect(() => {
1872
+ if (selected && hasOrigin) postToPreview(frame.current?.contentWindow, origin, { source: "krizaka-shop-composer", type: "scroll", key: selected });
1873
+ }, [selected, origin, hasOrigin]);
1874
+ const select = (key2) => {
1875
+ setSelected(key2);
1876
+ setStep("section");
1877
+ };
1878
+ const addSection2 = (type) => {
1879
+ const def = SECTION_DEFINITIONS.find((d) => d.type === type);
1880
+ const preferred = presets.find((p) => p.id === page.preset.id)?.variants[type];
1881
+ const variant = preferred && def.variants.includes(preferred) ? preferred : void 0;
1882
+ const key2 = newKey("s");
1883
+ const at = type === "hero" ? 0 : page.sections.length;
1884
+ exec({ type: "addSection", sectionType: type, key: key2, variant, at });
1885
+ setAdding(false);
1886
+ setSelected(key2);
1887
+ setFocusRequest({ key: key2 });
1888
+ announce(fill(m.announceAdded, { name: m.sectionNames[type], n: at + 1 }));
1889
+ };
1890
+ const step_ = (direction) => {
1891
+ dispatch({ type: direction });
1892
+ setInvalid(/* @__PURE__ */ new Set());
1893
+ announce(direction === "undo" ? m.announceUndone : m.announceRedone);
1894
+ };
1895
+ const onKeyDown = (e) => {
1896
+ if (!(e.metaKey || e.ctrlKey) || e.key.toLowerCase() !== "z") return;
1897
+ const el = e.target;
1898
+ if (el.closest("input, textarea, select, [contenteditable=true]")) return;
1899
+ e.preventDefault();
1900
+ step_(e.shiftKey ? "redo" : "undo");
1901
+ };
1902
+ const changes = publishing ? diffPages(baseline, page) : [];
1903
+ const nameOfKey = (key2) => {
1904
+ const i = page.sections.findIndex((s) => s.key === key2);
1905
+ if (i >= 0) return sectionLabel(page.sections, i, m);
1906
+ const was = baseline.sections.findIndex((s) => s.key === key2);
1907
+ return was >= 0 ? sectionLabel(baseline.sections, was, m) : key2;
1908
+ };
1909
+ const problems = [
1910
+ ...[...invalid].filter((key2) => page.sections.some((s) => s.key === key2)).map((key2) => ({ key: key2, text: fill(m.problemIn, { name: nameOfKey(key2) }) })),
1911
+ ...!parsed.ok ? parsed.issues.map((i) => ({ key: i.path, text: `${i.path}: ${i.message}` })) : []
1912
+ ];
1913
+ const describe = (d) => {
1914
+ const name = "key" in d ? nameOfKey(d.key) : "";
1915
+ const t = m.diff[d.kind];
1916
+ switch (d.kind) {
1917
+ case "moved":
1918
+ return fill(t, { name, from: d.from + 1, to: d.to + 1 });
1919
+ case "variant":
1920
+ return fill(t, { name, from: m.variantNames[`${d.type}.${d.from}`] ?? d.from, to: m.variantNames[`${d.type}.${d.to}`] ?? d.to });
1921
+ case "preset":
1922
+ return fill(t, { from: presets.find((p) => p.id === d.from)?.name ?? d.from, to: presets.find((p) => p.id === d.to)?.name ?? d.to });
1923
+ case "density":
1924
+ return fill(t, { from: d.from ?? "\u2014", to: d.to ?? "\u2014" });
1925
+ default:
1926
+ return fill(t, { name });
1927
+ }
1928
+ };
1929
+ const status_ = status === "saving" ? m.saving : status === "saved" ? m.saved : status === "error" ? m.saveFailed : "";
1930
+ return /* @__PURE__ */ jsxs18("div", { className: cn("kz-composer flex min-h-0 flex-col gap-3", className), onKeyDown, "data-step": step, children: [
1931
+ /* @__PURE__ */ jsxs18("header", { className: "flex flex-wrap items-center gap-2 border-b border-border-subtle pb-2", children: [
1932
+ /* @__PURE__ */ jsx24("h2", { className: "m-0 me-auto text-base font-semibold text-fg", children: m.title }),
1933
+ /* @__PURE__ */ jsx24("span", { role: "status", "aria-live": "polite", className: "text-xs text-fg-secondary", children: status_ }),
1934
+ /* @__PURE__ */ jsx24(Button4, { variant: "ghost", size: "sm", disabled: !canUndo(history), onClick: () => step_("undo"), "aria-keyshortcuts": "Control+Z Meta+Z", children: m.undo }),
1935
+ /* @__PURE__ */ jsx24(Button4, { variant: "ghost", size: "sm", disabled: !canRedo(history), onClick: () => step_("redo"), "aria-keyshortcuts": "Control+Shift+Z Meta+Shift+Z", children: m.redo }),
1936
+ onDiscard && /* @__PURE__ */ jsx24(Button4, { variant: "ghost", size: "sm", onClick: onDiscard, children: m.discard }),
1937
+ /* @__PURE__ */ jsx24(Button4, { variant: "secondary", size: "sm", className: "lg:hidden", onClick: () => setPreviewOpen(true), children: m.viewPreview }),
1938
+ /* @__PURE__ */ jsx24(Button4, { variant: "primary", size: "sm", onClick: () => setPublishing(true), children: m.publish })
1939
+ ] }),
1940
+ /* @__PURE__ */ jsx24("p", { role: "status", "aria-live": "polite", className: "sr-only", children: live }),
1941
+ /* @__PURE__ */ jsxs18("div", { className: "grid min-h-0 flex-1 gap-4 lg:grid-cols-[18rem_minmax(0,1fr)_24rem]", children: [
1942
+ /* @__PURE__ */ jsxs18("aside", { "aria-label": m.sections, className: cn("flex min-h-0 flex-col gap-4 overflow-y-auto", step === "section" && "hidden lg:flex"), children: [
1943
+ /* @__PURE__ */ jsx24(Outline, { sections: page.sections, selected, onSelect: select, run: exec, messages: m, announce, onAdd: () => setAdding(true), focusRequest }),
1944
+ /* @__PURE__ */ jsxs18("details", { className: "rounded-lg border border-border-default p-3", open: true, children: [
1945
+ /* @__PURE__ */ jsx24("summary", { className: "min-h-9 cursor-pointer text-sm font-semibold text-fg", children: m.look }),
1946
+ /* @__PURE__ */ jsxs18("div", { className: "mt-2 grid gap-3", children: [
1947
+ /* @__PURE__ */ jsxs18("label", { className: "grid gap-1 text-xs font-semibold text-fg-secondary", children: [
1948
+ m.preset,
1949
+ /* @__PURE__ */ jsx24(
1950
+ "select",
1951
+ {
1952
+ className: "min-h-10 rounded-md border border-border-control bg-surface-1 px-2 text-sm font-normal text-fg",
1953
+ value: page.preset.id,
1954
+ onChange: (e) => {
1955
+ const p = presets.find((x) => x.id === e.target.value);
1956
+ if (p) exec({ type: "setPreset", preset: { id: p.id, version: p.version }, density: null });
1957
+ },
1958
+ children: presets.map((p) => /* @__PURE__ */ jsx24("option", { value: p.id, children: p.name }, p.id))
1959
+ }
1960
+ )
1961
+ ] }),
1962
+ /* @__PURE__ */ jsxs18(RadioGroup3.Root, { label: m.density, variant: "segmented", value: page.density ?? presets.find((p) => p.id === page.preset.id)?.density ?? "compact", onValueChange: (d) => exec({ type: "setDensity", density: d }), children: [
1963
+ /* @__PURE__ */ jsx24(RadioGroup3.Segment, { value: "compact", children: m.densityCompact }),
1964
+ /* @__PURE__ */ jsx24(RadioGroup3.Segment, { value: "airy", children: m.densityAiry })
1965
+ ] })
1966
+ ] })
1967
+ ] })
1968
+ ] }),
1969
+ /* @__PURE__ */ jsxs18("section", { "aria-label": m.preview, className: "hidden min-h-0 flex-col gap-2 lg:flex", children: [
1970
+ /* @__PURE__ */ jsxs18(RadioGroup3.Root, { label: m.preview, variant: "segmented", value: device, onValueChange: (d) => setDevice(d), className: "self-start", children: [
1971
+ /* @__PURE__ */ jsx24(RadioGroup3.Segment, { value: "desktop", children: m.desktop }),
1972
+ /* @__PURE__ */ jsx24(RadioGroup3.Segment, { value: "phone", children: m.phone })
1973
+ ] }),
1974
+ /* @__PURE__ */ jsx24(PreviewFrame, { src: previewUrl, title: m.previewTitle, phone: device === "phone", frame })
1975
+ ] }),
1976
+ /* @__PURE__ */ jsxs18("aside", { "aria-label": m.inspector, className: cn("flex min-h-0 flex-col gap-4 overflow-y-auto", step === "list" && "hidden lg:flex"), children: [
1977
+ /* @__PURE__ */ jsxs18(Button4, { variant: "ghost", size: "sm", className: "self-start lg:hidden", onClick: () => setStep("list"), children: [
1978
+ "\u2190 ",
1979
+ m.backToSections
1980
+ ] }),
1981
+ selectedSection ? /* @__PURE__ */ jsx24(
1982
+ Inspector,
1983
+ {
1984
+ section: selectedSection,
1985
+ name: sectionLabel(page.sections, selectedIndex, m),
1986
+ messages: m,
1987
+ run: exec,
1988
+ epoch,
1989
+ announce,
1990
+ onInvalid: (key2, bad) => setInvalid((prev) => {
1991
+ const next = new Set(prev);
1992
+ if (bad) next.add(key2);
1993
+ else next.delete(key2);
1994
+ return next.size === prev.size && next.has(key2) === prev.has(key2) ? prev : next;
1995
+ }),
1996
+ preset: page.preset.id,
1997
+ density: page.density
1998
+ }
1999
+ ) : /* @__PURE__ */ jsx24("p", { className: "m-0 text-sm text-fg-secondary", children: m.noSelection })
2000
+ ] })
2001
+ ] }),
2002
+ /* @__PURE__ */ jsx24(Dialog.Root, { open: adding, onOpenChange: setAdding, children: /* @__PURE__ */ jsxs18(Dialog.Content, { closeLabel: m.cancel, children: [
2003
+ /* @__PURE__ */ jsxs18(Dialog.Header, { children: [
2004
+ /* @__PURE__ */ jsx24(Dialog.Title, { children: m.addSection }),
2005
+ /* @__PURE__ */ jsx24(Dialog.Description, { children: m.addSectionHint })
2006
+ ] }),
2007
+ /* @__PURE__ */ jsx24(Dialog.Body, { children: [SECTION_DEFINITIONS.filter((d) => !foldedTypes.includes(d.type)), SECTION_DEFINITIONS.filter((d) => foldedTypes.includes(d.type))].map((group, g) => {
2008
+ const list = /* @__PURE__ */ jsx24("ul", { className: "m-0 grid list-none gap-1 p-0", children: group.map((d) => /* @__PURE__ */ jsx24("li", { children: /* @__PURE__ */ jsx24(Button4, { variant: "ghost", className: "w-full justify-start", disabled: d.type === "hero" && page.sections.some((s) => s.type === "hero"), onClick: () => addSection2(d.type), children: m.sectionNames[d.type] }) }, d.type)) });
2009
+ return group.length === 0 ? null : g === 0 ? /* @__PURE__ */ jsx24(React7.Fragment, { children: list }, g) : /* @__PURE__ */ jsxs18("details", { className: "mt-3", children: [
2010
+ /* @__PURE__ */ jsx24("summary", { className: "min-h-9 cursor-pointer text-sm text-fg-secondary", children: "\u2026" }),
2011
+ list
2012
+ ] }, g);
2013
+ }) })
2014
+ ] }) }),
2015
+ /* @__PURE__ */ jsx24(Dialog.Root, { open: publishing, onOpenChange: setPublishing, children: /* @__PURE__ */ jsxs18(Dialog.Content, { closeLabel: m.cancel, children: [
2016
+ /* @__PURE__ */ jsxs18(Dialog.Header, { children: [
2017
+ /* @__PURE__ */ jsx24(Dialog.Title, { children: m.publishTitle }),
2018
+ /* @__PURE__ */ jsx24(Dialog.Description, { children: m.publishWhat })
2019
+ ] }),
2020
+ /* @__PURE__ */ jsxs18(Dialog.Body, { children: [
2021
+ problems.length > 0 && /* @__PURE__ */ jsxs18("div", { role: "alert", className: "mb-3 rounded-md border border-border-control bg-surface-2 p-3", children: [
2022
+ /* @__PURE__ */ jsx24("p", { className: "m-0 text-sm font-semibold text-fg", children: fill(m.problemsTitle, { n: problems.length }) }),
2023
+ /* @__PURE__ */ jsx24("ul", { className: "m-0 mt-1 list-disc ps-5 text-sm text-fg-secondary", children: problems.map((p) => /* @__PURE__ */ jsx24("li", { children: p.text }, p.key)) })
2024
+ ] }),
2025
+ changes.length === 0 ? /* @__PURE__ */ jsx24("p", { className: "m-0 text-sm text-fg-secondary", children: m.publishNothing }) : /* @__PURE__ */ jsx24("ul", { className: "m-0 list-disc ps-5 text-sm text-fg", children: changes.map((d, i) => /* @__PURE__ */ jsx24("li", { children: describe(d) }, i)) })
2026
+ ] }),
2027
+ /* @__PURE__ */ jsxs18(Dialog.Footer, { children: [
2028
+ /* @__PURE__ */ jsx24(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx24(Button4, { variant: "ghost", children: m.cancel }) }),
2029
+ /* @__PURE__ */ jsx24(Button4, { variant: "primary", disabled: problems.length > 0 || !parsed.ok, onClick: async () => {
2030
+ await onPublish(page);
2031
+ setBaseline(page);
2032
+ setPublishing(false);
2033
+ }, children: m.publishConfirm })
2034
+ ] })
2035
+ ] }) }),
2036
+ /* @__PURE__ */ jsx24(Dialog.Root, { open: previewOpen, onOpenChange: setPreviewOpen, children: /* @__PURE__ */ jsxs18(Dialog.Content, { closeLabel: m.closePreview, size: "lg", children: [
2037
+ /* @__PURE__ */ jsx24(Dialog.Header, { children: /* @__PURE__ */ jsx24(Dialog.Title, { children: m.preview }) }),
2038
+ /* @__PURE__ */ jsx24(Dialog.Body, { className: "p-0", children: previewOpen && /* @__PURE__ */ jsx24(PreviewFrame, { src: previewUrl, title: m.previewTitle, phone: true, frame }) })
2039
+ ] }) })
2040
+ ] });
2041
+ }
2042
+ export {
2043
+ AUTOSAVE_MS,
2044
+ HISTORY_LIMIT,
2045
+ SectionThumbnail,
2046
+ ShopComposer,
2047
+ applyCommand,
2048
+ canRedo,
2049
+ canUndo,
2050
+ createHistory,
2051
+ defaultShopComposerMessages,
2052
+ describeSettings,
2053
+ diffPages,
2054
+ fill,
2055
+ moved,
2056
+ newKey,
2057
+ redo,
2058
+ run,
2059
+ undo
2060
+ };
2061
+ //# sourceMappingURL=shop-composer.js.map