@riverbankcms/sdk 0.158.0 → 0.160.0

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 (196) hide show
  1. package/README.md +25 -6
  2. package/dist/_dts/{BlocksIslandsHydrator-BgNBtEai.d.ts → BlocksIslandsHydrator-CoqeotCL.d.ts} +1 -1
  3. package/dist/_dts/{Page-DpCo8zXD.d.ts → Page-C0ENVLCF.d.ts} +13 -6
  4. package/dist/_dts/{SdkPreviewMode-Bv2TMscG.d.ts → SdkPreviewMode-jZK0A49V.d.ts} +54 -126
  5. package/dist/_dts/{client-B960v2gW.d.ts → client-uMMuPq9V.d.ts} +23 -1
  6. package/dist/_dts/{content-types-CN0Wy8V6.d.ts → content-types-D6nXGqdQ.d.ts} +18 -18
  7. package/dist/_dts/{contracts-BFUrby76.d.ts → contracts-Bnmj1nxu.d.ts} +6 -5
  8. package/dist/_dts/{footerPageOutline-CmoqleLS.d.ts → footerPageOutline-CeLjFX8b.d.ts} +6 -6
  9. package/dist/_dts/{generatePageMetadata-Dkvivc3R.d.ts → generatePageMetadata-nyU8q02J.d.ts} +5 -2
  10. package/dist/_dts/{index-DPfI2t5A.d.ts → index-BaaGBY1v.d.ts} +2 -2
  11. package/dist/_dts/{index-DCNu_8it.d.ts → index-Bg64CkV-.d.ts} +4 -4
  12. package/dist/_dts/index-Blwl7yl6.d.ts +13 -0
  13. package/dist/_dts/{index-DaS_z6ir.d.ts → index-C5xslEBn.d.ts} +2 -2
  14. package/dist/_dts/{index-DpgkhY-a.d.ts → index-CEaKil7G.d.ts} +2 -2
  15. package/dist/_dts/{index-Ba6RmuxX.d.ts → index-DahMwisK.d.ts} +3 -3
  16. package/dist/_dts/index-lkpjIg5i.d.ts +66 -0
  17. package/dist/_dts/{index-DfkFWUxt.d.ts → index-nVoi_74l.d.ts} +2 -2
  18. package/dist/_dts/{loadContent-DvvKF4nB.d.ts → loadContent-CYLmzvLq.d.ts} +16 -7
  19. package/dist/_dts/{resolvePageContent-D0lGwVD6.d.ts → resolvePageContent-DqnxChOs.d.ts} +2 -2
  20. package/dist/_dts/{constants-DkcKHMX-.d.ts → runtime-BY8DQBbT.d.ts} +10 -16
  21. package/dist/_dts/{hosted-booking-appearance-BIbit60h.d.ts → schema-D0bNcPWK.d.ts} +6921 -6768
  22. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  23. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  24. package/dist/_dts/sdk/src/client.d.ts +12 -6
  25. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  26. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  27. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  28. package/dist/_dts/sdk/src/index.d.ts +8 -8
  29. package/dist/_dts/sdk/src/manifest/index.d.ts +6 -6
  30. package/dist/_dts/sdk/src/metadata/index.d.ts +8 -2
  31. package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
  32. package/dist/_dts/sdk/src/next/index.d.ts +7 -7
  33. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  34. package/dist/_dts/sdk/src/page-converter/index.d.ts +10 -28
  35. package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
  36. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  37. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  38. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  39. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  40. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  41. package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
  42. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  43. package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
  44. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  45. package/dist/_dts/sdk/src/server.d.ts +5 -5
  46. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  47. package/dist/_dts/{types-BJrRUaY7.d.ts → types-CFrYuXYP.d.ts} +2 -2
  48. package/dist/_dts/{navigation-n-eTVTIQ.d.ts → types-D8czmbQF.d.ts} +15430 -16836
  49. package/dist/_dts/{types-BY7PgnDi.d.ts → types-DSgmJ15W.d.ts} +7 -7
  50. package/dist/_dts/{types-maEnXL6Z.d.ts → types-Dm-KW7nj.d.ts} +10 -13
  51. package/dist/_dts/{validation-BjuVrMrs.d.ts → validation-Bmb4WnHg.d.ts} +4 -4
  52. package/dist/client/{BlocksIslandsHydrator-WRLS96Ev.mjs → BlocksIslandsHydrator-DZRKi6tT.mjs} +17 -17
  53. package/dist/client/{BookingMailingListNote-eovghMPa.mjs → BookingMailingListNote-C00sLLdL.mjs} +2 -2
  54. package/dist/client/{CalendarNavigationChevron-CIcMQRc1.mjs → CalendarNavigationChevron-CHSi9b3E.mjs} +6 -6
  55. package/dist/client/{CheckboxChoice-BF9eCNno.mjs → CheckboxChoice-Bhm6RAUL.mjs} +1 -1
  56. package/dist/client/{DemoBookingPortalAccess-CdnFgDyQ.mjs → DemoBookingPortalAccess-CaN-7ui7.mjs} +6 -6
  57. package/dist/client/{DemoPortalSignInLink-DHxYgkT6.mjs → DemoPortalSignInLink-ClxN5_xZ.mjs} +1 -1
  58. package/dist/client/{EventCalendar.client-Dc-ZLxKo.mjs → EventCalendar.client-BncvSa1n.mjs} +10 -9
  59. package/dist/client/{EventCombined.client-C93XqRIv.mjs → EventCombined.client-DluBxVVu.mjs} +8 -8
  60. package/dist/client/{EventEmbeddedCheckoutStep-B3XUyNY9.mjs → EventEmbeddedCheckoutStep-BiJrMtfp.mjs} +1 -1
  61. package/dist/client/{EventItem-DnCTygqk.mjs → EventItem-CXhnT9pF.mjs} +11 -6
  62. package/dist/client/{EventListWeekNavigation-9h97heuQ.mjs → EventListWeekNavigation-V-dtoDlD.mjs} +1 -1
  63. package/dist/client/{EventListing.client-DFKlQvvs.mjs → EventListing.client-DPO6SZbx.mjs} +3 -3
  64. package/dist/client/{EventListing.view-pAuTDyrP.mjs → EventListing.view-B-Yi5JZS.mjs} +7 -7
  65. package/dist/client/{EventRegistrationPayment-rgKlBvhP.mjs → EventRegistrationPayment-Dc3Fnlnw.mjs} +189 -176
  66. package/dist/client/{LeafletStaticMap-3XiWSgy0.mjs → LeafletStaticMap-ClZCCzAm.mjs} +1 -1
  67. package/dist/client/{Page-BmpeAwID.mjs → Page-7PkzO04N.mjs} +1949 -2074
  68. package/dist/client/{StepIndicator-qEq6X5zP.mjs → StepIndicator-DiD6euZ8.mjs} +3 -3
  69. package/dist/client/{TabBarFragment-DvzIV75f.mjs → TabBarFragment-BHd8GN8y.mjs} +1 -1
  70. package/dist/client/{ThemedButton-DVBC_pS9.mjs → ThemedButton-C22C9cCF.mjs} +174 -93
  71. package/dist/client/{accordion-DeObOasQ.mjs → accordion-2m27DsIk.mjs} +1 -1
  72. package/dist/client/{booking-form.client-DfWeF0lj.mjs → booking-form.client-BddWV5w1.mjs} +12 -12
  73. package/dist/client/{bookingForm-TnzIBHx2.mjs → bookingForm-bcdXQjmw.mjs} +4 -4
  74. package/dist/client/bookings.mjs +6 -6
  75. package/dist/client/{carousel-kkFnbr5Z.mjs → carousel-D7nj9I0y.mjs} +2 -2
  76. package/dist/client/{carousel.client-BJGoJVtg.mjs → carousel.client-AffDJo_s.mjs} +1 -1
  77. package/dist/client/{cart-BAXNbFux.mjs → cart-PN6yCw1H.mjs} +3 -3
  78. package/dist/client/{cart.client-BczxUF70.mjs → cart.client-D4t1f0cJ.mjs} +1 -1
  79. package/dist/client/{checkout-C5NRhPeP.mjs → checkout-CsTwXVSb.mjs} +3 -3
  80. package/dist/client/{checkout.client-BuDk3Td9.mjs → checkout.client-BhQE3zY7.mjs} +1 -1
  81. package/dist/client/client.mjs +25 -13
  82. package/dist/client/{context-CVsgML69.mjs → context-BLAvalAa.mjs} +1 -1
  83. package/dist/client/{cta-BWnUuJce.mjs → cta-CUXhX_D7.mjs} +2 -1
  84. package/dist/client/dateFormatting-BHIHxNuo.mjs +61 -0
  85. package/dist/client/{demoPortalMagicLink-CUlwvmxf.mjs → demoPortalMagicLink-R-awbk_0.mjs} +1 -1
  86. package/dist/client/{enhanceHeaderSection-Cw8nnFj-.mjs → enhanceHeaderSection-9Q93uvTo.mjs} +3 -3
  87. package/dist/client/{event-details.client-Bl0E_6Vi.mjs → event-details.client-BS1WtG-a.mjs} +2 -2
  88. package/dist/client/{event-registration.client-DmfLg_LC.mjs → event-registration.client-BXndwsET.mjs} +35 -21
  89. package/dist/client/{eventCalendar-D1Dwb9VA.mjs → eventCalendar-HyoOt1Qz.mjs} +4 -4
  90. package/dist/client/{eventCombined-DfsqY1qR.mjs → eventCombined-sdG5oEaH.mjs} +4 -4
  91. package/dist/client/{eventDetails-BmugDVoa.mjs → eventDetails-FFAknE4w.mjs} +2 -2
  92. package/dist/client/{eventListing-BPAGJi3C.mjs → eventListing-CGK6urk3.mjs} +4 -4
  93. package/dist/client/{eventRegistration-DBlz_x6u.mjs → eventRegistration-VhrvCs4l.mjs} +4 -4
  94. package/dist/client/{form-DVu3ZMjx.mjs → form-C-B5O_ko.mjs} +3 -3
  95. package/dist/client/{form.client-QZUyABIY.mjs → form.client-DoZVcl8d.mjs} +5 -5
  96. package/dist/client/{form.parts-Bs0F3v08.mjs → form.parts-mttKpgif.mjs} +3 -3
  97. package/dist/client/{formatDate-BD9D3dgo.mjs → formatDate-xUSCknEO.mjs} +1 -1
  98. package/dist/client/gifting/client.mjs +3 -3
  99. package/dist/client/{headerSection-BQwWW4Yy.mjs → headerSection-BHUEXsaI.mjs} +2 -2
  100. package/dist/client/{location-map.client-upKuwABk.mjs → location-map.client-Cylb_MHw.mjs} +2 -2
  101. package/dist/client/{location-map.view-RuBCD10O.mjs → location-map.view-Cx4Bl7ij.mjs} +69 -6
  102. package/dist/client/{locationMap-1sCbsk0V.mjs → locationMap-QnKJi-nZ.mjs} +2 -2
  103. package/dist/client/{newsletter-form.client-DBTU3oNv.mjs → newsletter-form.client-D_n0rftg.mjs} +8 -8
  104. package/dist/client/{newsletter-form.parts-C9I9JBhe.mjs → newsletter-form.parts-DKHye4IE.mjs} +2 -2
  105. package/dist/client/{newsletterForm-DTPtTxxG.mjs → newsletterForm-tEaYelzx.mjs} +3 -3
  106. package/dist/client/{noop-DMFt3KdC.mjs → noop-B610YKEx.mjs} +12 -5
  107. package/dist/client/portal/client.mjs +4562 -174
  108. package/dist/client/{product-detail.client-BX7M5o6p.mjs → product-detail.client-DUf5x5Jt.mjs} +1 -1
  109. package/dist/client/{product-list.client-i32QNY4c.mjs → product-list.client-Cqp1BPTV.mjs} +1 -1
  110. package/dist/client/{productDetail-DWjE9zm7.mjs → productDetail-B8bBiogP.mjs} +3 -3
  111. package/dist/client/{productList-DZH9_brv.mjs → productList-BKN4D-1z.mjs} +3 -3
  112. package/dist/client/{propsDecoder-CTzHkEkh.mjs → propsDecoder-2nNZh2Oe.mjs} +3 -3
  113. package/dist/client/{registry.server-vJ5FlscU.mjs → registry.server-BAm4RPNJ.mjs} +856 -872
  114. package/dist/client/rendering/client.mjs +27 -26
  115. package/dist/client/rendering/islands.mjs +1 -1
  116. package/dist/client/rendering.mjs +47 -28
  117. package/dist/client/{richText-coerce-DXAmC72p.mjs → richText-coerce-Cv-qomNB.mjs} +1 -1
  118. package/dist/client/{routeIslandApiConfig-CmC7ygin.mjs → routeIslandApiConfig-C5u8MbAA.mjs} +1 -1
  119. package/dist/client/{shop-C7eL3B37.mjs → shop-DZNC0VKk.mjs} +3 -3
  120. package/dist/client/{shop-commerce-D8oRN0QJ.mjs → shop-commerce-DdX4LSa3.mjs} +12 -12
  121. package/dist/client/{shop-commerce-store-CRnQ4M18.mjs → shop-commerce-store-BJtrZov9.mjs} +1 -1
  122. package/dist/client/{shop.client-X6d6KVmA.mjs → shop.client-DmDd-igg.mjs} +16 -15
  123. package/dist/client/{shop.interactive-DBMeM8VD.mjs → shop.interactive-5SnnDHz3.mjs} +402 -35
  124. package/dist/client/{shopShared-Y182kN_s.mjs → shopShared-CPqUlAh9.mjs} +2 -2
  125. package/dist/client/{src-7cXhT0G_.mjs → src-VIsPY-kw.mjs} +6 -1
  126. package/dist/client/timetableModel-C19rcHEw.mjs +960 -0
  127. package/dist/client/{useAvailableSlots-BDV6MHgJ.mjs → useAvailableSlots-BjbJXotk.mjs} +3 -3
  128. package/dist/client/{useBookingNowIso-DgJEv3ZY.mjs → useBookingNowIso-CMgfL7YJ.mjs} +1 -1
  129. package/dist/client/{useDiscountApply-BTu9EeT7.mjs → useDiscountApply-KG8jB7WC.mjs} +2 -2
  130. package/dist/client/{useDiscountCodeUi-BfZxdxI-.mjs → useDiscountCodeUi-DK2w_i0a.mjs} +1 -1
  131. package/dist/client/{useEventPagination-pnvdHGeQ.mjs → useEventPagination-DW6MCirb.mjs} +11 -10
  132. package/dist/client/uuid-BETKW8rS.mjs +12 -0
  133. package/dist/client/{view-hJr_L4QC2.mjs → view-CkUn3Y0Y.mjs} +4 -4
  134. package/dist/client/{view-BPEa6Okm.mjs → view-CseyBW07.mjs} +15 -70
  135. package/dist/client/{wizardSteps-HdyGoIG3.mjs → wizardSteps-zgq10lN1.mjs} +262 -65
  136. package/dist/preview-next/before-render.mjs +1 -1
  137. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-BFlBqSu4.mjs → EventEmbeddedCheckoutStep-lUHBrzHv.mjs} +1 -1
  138. package/dist/preview-next/client/{PreviewEditorSidebar-CXRUbqMp.mjs → PreviewEditorSidebar-DWyUGCAG.mjs} +1217 -107
  139. package/dist/preview-next/client/{PreviewEditorUI-CxjEV0Fm.mjs → PreviewEditorUI-Wq0b3Daw.mjs} +52 -79
  140. package/dist/preview-next/client/{SdkPreviewModeRuntime-XdQSGGj_.mjs → SdkPreviewModeRuntime-BtZPcwYV.mjs} +1 -1
  141. package/dist/preview-next/client/{SdkPreviewModeRuntime-BxI12BBS.mjs → SdkPreviewModeRuntime-wSI_R361.mjs} +720 -2035
  142. package/dist/preview-next/client/{SiteChromeCustomizeContext-CfRQRwpH.mjs → SiteChromeCustomizeContext-Hc4pYnNe.mjs} +14365 -8155
  143. package/dist/preview-next/client/{ThemedButton-BEOPss9H.mjs → ThemedButton-DzeycIlD.mjs} +204 -93
  144. package/dist/preview-next/client/{previewChromeSurface-CH7hd5n7.mjs → previewChromeSurface-Corq4AG7.mjs} +3 -8
  145. package/dist/preview-next/client/runtime.mjs +3 -3
  146. package/dist/preview-next/client/{sdk-runtime-C6xEU1LI.mjs → sdk-runtime-CWymRWhK.mjs} +1 -1
  147. package/dist/preview-next/client/siteStyleAccess-QZkJRHl5.mjs +1359 -0
  148. package/dist/preview-next/client/{spinner-BTf1CZmy.mjs → spinner-C4If5Y-O.mjs} +1 -1
  149. package/dist/preview-next/editor-base.css +62 -0
  150. package/dist/preview-next/editor-chrome.css +85 -0
  151. package/dist/preview-next/keepAlive.mjs +1 -1
  152. package/dist/preview-next/middleware.mjs +1 -1
  153. package/dist/preview-next/{route-contract-DM22uOXM.mjs → route-contract-8csADeIT.mjs} +149 -112
  154. package/dist/server/{Block.shared-DLoilC2J.mjs → Block.shared-D1_gonwM.mjs} +6 -6
  155. package/dist/server/{bindings-C7DKLVx_.mjs → bindings-CFmJg5lm.mjs} +2 -2
  156. package/dist/server/{client-CU4wlMLE.mjs → client-DPsi0Dai.mjs} +9 -7
  157. package/dist/server/config-template-validation.mjs +50 -10
  158. package/dist/server/config-validation.mjs +1 -1
  159. package/dist/server/config.mjs +2 -2
  160. package/dist/server/{generatePageMetadata-CPvssVOp.mjs → generatePageMetadata-DB_lbrZ7.mjs} +28 -2
  161. package/dist/server/index.mjs +2 -2
  162. package/dist/server/{loadContent-DmQ4BiiQ.mjs → loadContent-RMCcuVU_.mjs} +33 -20
  163. package/dist/server/loadPage-DUPP51C-.mjs +2 -0
  164. package/dist/server/{loadPage-BBkDQA57.mjs → loadPage-DhDGzj7t.mjs} +8 -5
  165. package/dist/server/manifest.mjs +1 -1
  166. package/dist/server/metadata.mjs +2 -2
  167. package/dist/server/next.mjs +13 -12
  168. package/dist/server/{overrideResolution-ByeAbLSO.mjs → overrideResolution-OxY5FMuy.mjs} +1 -1
  169. package/dist/server/{overrides-BcA6ZPWf.mjs → overrides-Bz_A6sB9.mjs} +586 -518
  170. package/dist/server/page-converter.mjs +8 -10
  171. package/dist/server/{prebuild-8T-m7XjB.mjs → prebuild-B_1vrSru.mjs} +1 -1
  172. package/dist/server/prebuild.mjs +1 -1
  173. package/dist/server/{prefetchBlockData-Bjya-X9t.mjs → prefetchBlockData-B7ukYXXR.mjs} +841 -887
  174. package/dist/server/{publicProducts-C3meXS2o.mjs → publicProducts-Djbpc81A.mjs} +166 -129
  175. package/dist/server/{blocks-jlIm0PWc.mjs → registry-eFjKtEhF.mjs} +2349 -1716
  176. package/dist/server/rendering/server.mjs +4 -4
  177. package/dist/server/rendering.mjs +7 -7
  178. package/dist/server/{resolveBlockData-D0ow8PRJ.mjs → resolveBlockData-DYvEa9c5.mjs} +6 -3
  179. package/dist/server/routing.mjs +1 -1
  180. package/dist/server/{schema-Bs735S27.mjs → schema-C3dJ5UkL.mjs} +148 -88
  181. package/dist/server/server.mjs +3 -3
  182. package/dist/server/{siteChromeOverlayClearance-BangtD8A.mjs → siteChromeOverlayClearance-DALIAMwo.mjs} +108 -11
  183. package/dist/server/{src-B935_bzN.mjs → src-C5Mu-z0F.mjs} +268 -189
  184. package/dist/server/theme-bridge.mjs +1 -1
  185. package/dist/server/theme.mjs +1 -1
  186. package/dist/server/{themeAdmission-D2-BnmDO.mjs → themeAdmission-ruoyXb_0.mjs} +9 -7
  187. package/dist/server/{three-pass-converter-CmmchOFC.mjs → three-pass-converter-Chnb1XD-.mjs} +2 -58
  188. package/dist/server/{validation-Cm41pDUB.mjs → validation-B-Xar8QS.mjs} +22 -63
  189. package/dist/server/{version-Bo9C3McI.mjs → version-Bg7VHK3i.mjs} +1 -1
  190. package/dist/styles/index.css +78 -0
  191. package/package.json +8 -3
  192. package/dist/_dts/index-CXsnaCGe.d.ts +0 -10
  193. package/dist/_dts/index-cnymEAZY.d.ts +0 -1
  194. package/dist/client/timetableModel-D7PwpaBY.mjs +0 -480
  195. package/dist/preview-next/client/siteStyleAccess-CRXaC2oL.mjs +0 -1326
  196. package/dist/server/loadPage-ZrcfjG3X.mjs +0 -2
@@ -0,0 +1,1359 @@
1
+ "use client";
2
+ import { Sr as asLayoutVariantKey, Tr as assertNever, lr as resolveManagedMediaReference, sr as renderableMediaAssetSchema, ur as mediaIdentifierSchema } from "./ThemedButton-DzeycIlD.mjs";
3
+ import { Bn as createManifestFormAdapter, Ci as SECTION_BACKGROUND_MIN_SOURCE_WIDTH, Er as planBackgroundOverride, Hn as manifestFieldSectionOptions, Kn as MediaEditor, Lr as getBlockDefinition, Or as rankBackgroundImagePoolItems, Si as resolveImageUrlWithContext, Sn as useEditorUiStoreInstance, Sr as defaultBackgroundOverrideForMode, Tr as parseBackgroundOverrideFromContent, Wn as derivePromotedFieldPlan, Wo as Upload, _ as usePreviewPageDesignEditorState, _a as getGradientPreset, as as Image, br as backgroundColorTokens, cn as blockLookOwnedFieldPaths, dn as getBlockManifestFromSdkConfig, er as useMediaEditorOptional, h as nextArrangementLookPin, ha as gradientToCss, hr as useSdkConfig, is as Info, kr as resolveBackgroundCapability, ks as unsafeAsEditorBlockId, ln as hideThemeV2RawStyleFields, ls as ChevronRight, m as arrangementBlockControlsFor, mt as useUISelector, na as resolveVisiblePromotedFieldPathsForEditorBlock, on as arrangementOwnedFieldIds, p as arrangementBackgroundControlFor, pr as createStoreBackend, sn as arrangementVisibilityValues, ua as getCuratedSiteStyle, un as prepareBlockEditorManifest, us as ChevronLeft, wr as imagePoolForOverride } from "./SiteChromeCustomizeContext-Hc4pYnNe.mjs";
4
+ import React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ //#region ../preview-next/src/client/preview/PreviewBlockCustomizeSelectionContext.tsx
7
+ const PreviewBlockCustomizeSelectionContext = createContext(null);
8
+ function PreviewBlockCustomizeSelectionProvider({ children }) {
9
+ const uiStore = useEditorUiStoreInstance();
10
+ const previewInspection = useUISelector(uiStore, (state) => state.previewInspection);
11
+ const selection = useMemo(() => previewInspection.kind === "block-customize" ? {
12
+ kind: "selected",
13
+ blockId: previewInspection.blockId,
14
+ requestId: previewInspection.requestId
15
+ } : { kind: "none" }, [previewInspection]);
16
+ const inspectBlock = useCallback((blockId) => {
17
+ uiStore.getState().inspectBlock(blockId);
18
+ }, [uiStore]);
19
+ const clearInspection = useCallback(() => {
20
+ uiStore.getState().clearPreviewInspection();
21
+ }, [uiStore]);
22
+ const [selectedBlockId, setSelectedBlockId] = useState(null);
23
+ useDashboardBlockSelection(uiStore, setSelectedBlockId);
24
+ const value = useMemo(() => ({
25
+ selection,
26
+ inspectBlock,
27
+ clearInspection,
28
+ selectedBlockId,
29
+ selectBlock: setSelectedBlockId
30
+ }), [
31
+ clearInspection,
32
+ inspectBlock,
33
+ selectedBlockId,
34
+ selection
35
+ ]);
36
+ return /* @__PURE__ */ jsx(PreviewBlockCustomizeSelectionContext.Provider, {
37
+ value,
38
+ children
39
+ });
40
+ }
41
+ function usePreviewBlockCustomizeSelectionOptional() {
42
+ return useContext(PreviewBlockCustomizeSelectionContext);
43
+ }
44
+ function useDashboardBlockSelection(uiStore, selectBlock) {
45
+ useEffect(() => {
46
+ const raw = new URLSearchParams(window.location.search).get("preview_block");
47
+ if (!raw) return;
48
+ const blockId = unsafeAsEditorBlockId(raw);
49
+ selectBlock(blockId);
50
+ uiStore.getState().inspectBlock(blockId);
51
+ uiStore.getState().setDrawerOpen(true);
52
+ const frames = {
53
+ initial: 0,
54
+ scroll: 0
55
+ };
56
+ const reveal = () => {
57
+ if (document.documentElement.getAttribute("data-rb-preview-mode") !== "edit") return;
58
+ if (!document.querySelector(`[data-block-id="${CSS.escape(raw)}"]`)) return;
59
+ uiStore.getState().setDrawerOpen(true);
60
+ observer.disconnect();
61
+ frames.scroll = requestAnimationFrame(() => {
62
+ document.querySelector(`[data-block-id="${CSS.escape(raw)}"]`)?.scrollIntoView({
63
+ block: "center",
64
+ behavior: "instant"
65
+ });
66
+ });
67
+ };
68
+ const observer = new MutationObserver(reveal);
69
+ observer.observe(document.documentElement, {
70
+ attributes: true,
71
+ childList: true,
72
+ subtree: true
73
+ });
74
+ frames.initial = requestAnimationFrame(reveal);
75
+ return () => {
76
+ cancelAnimationFrame(frames.initial);
77
+ cancelAnimationFrame(frames.scroll);
78
+ observer.disconnect();
79
+ };
80
+ }, [uiStore, selectBlock]);
81
+ }
82
+ //#endregion
83
+ //#region ../preview-next/src/client/preview/CustomizeColorTokenPicker.tsx
84
+ function CustomizeColorTokenPicker({ title, selectedToken, recommendedTokens, advancedTokens = [], disabled = false, columnsClassName = "grid-cols-2", showTitle = true, labelForToken, swatchColorForToken, onChooseToken }) {
85
+ if (recommendedTokens.length === 0 && advancedTokens.length === 0) return null;
86
+ const renderGrid = (tokens) => /* @__PURE__ */ jsx("div", {
87
+ className: `grid gap-1 ${columnsClassName}`,
88
+ children: tokens.map((token) => /* @__PURE__ */ jsx(ColorTokenButton, {
89
+ token,
90
+ label: labelForToken(token),
91
+ swatchColor: swatchColorForToken(token),
92
+ selected: selectedToken === token,
93
+ disabled,
94
+ onClick: (event) => onChooseToken(token, event)
95
+ }, token))
96
+ });
97
+ return /* @__PURE__ */ jsxs("div", { children: [
98
+ showTitle ? /* @__PURE__ */ jsx("div", {
99
+ className: "mb-1 text-xs font-medium text-muted-foreground",
100
+ children: title
101
+ }) : null,
102
+ renderGrid(recommendedTokens),
103
+ advancedTokens.length > 0 ? /* @__PURE__ */ jsxs("details", {
104
+ className: "mt-1",
105
+ children: [/* @__PURE__ */ jsx("summary", {
106
+ className: "cursor-pointer text-xs text-muted-foreground",
107
+ children: "More colors"
108
+ }), /* @__PURE__ */ jsx("div", {
109
+ className: "mt-1",
110
+ children: renderGrid(advancedTokens)
111
+ })]
112
+ }) : null
113
+ ] });
114
+ }
115
+ function CustomizeBackgroundColorPicker({ title = "Colors", selectedToken, recommendedTokens, advancedTokens = [], disabled = false, columnsClassName = "grid-cols-2", defaultSelected = false, defaultLabel = "Default", labelForToken, swatchColorForToken, onChooseDefault, onChooseToken }) {
116
+ const hasTokens = recommendedTokens.length > 0 || advancedTokens.length > 0;
117
+ if (!onChooseDefault && !hasTokens) return null;
118
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
119
+ className: "mb-2 flex items-center justify-between gap-2",
120
+ children: [/* @__PURE__ */ jsx("div", {
121
+ className: "text-xs font-medium text-muted-foreground",
122
+ children: title
123
+ }), onChooseDefault ? /* @__PURE__ */ jsx("button", {
124
+ type: "button",
125
+ className: `rounded-md border px-2 py-1 text-xs hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 ${defaultSelected ? "border-foreground" : "bg-background"}`,
126
+ disabled,
127
+ onClick: onChooseDefault,
128
+ children: defaultLabel
129
+ }) : null]
130
+ }), hasTokens ? /* @__PURE__ */ jsx(CustomizeColorTokenPicker, {
131
+ title,
132
+ selectedToken,
133
+ recommendedTokens,
134
+ advancedTokens,
135
+ disabled,
136
+ columnsClassName,
137
+ labelForToken,
138
+ swatchColorForToken,
139
+ onChooseToken,
140
+ showTitle: false
141
+ }) : null] });
142
+ }
143
+ function ColorTokenButton({ token, label, swatchColor, selected, disabled, onClick }) {
144
+ return /* @__PURE__ */ jsxs("button", {
145
+ type: "button",
146
+ className: `flex min-w-0 items-center gap-2 rounded-md border px-2 py-1 text-left text-xs hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 ${selected ? "border-foreground" : "bg-background"}`,
147
+ disabled,
148
+ "aria-label": `Choose ${label}`,
149
+ onClick,
150
+ "data-token": token,
151
+ children: [/* @__PURE__ */ jsx("span", {
152
+ className: "h-3 w-3 shrink-0 rounded-full border",
153
+ style: { backgroundColor: swatchColor }
154
+ }), /* @__PURE__ */ jsx("span", {
155
+ className: "truncate",
156
+ children: label
157
+ })]
158
+ });
159
+ }
160
+ //#endregion
161
+ //#region ../preview-next/src/client/blocks/previewCustomizeSelectedMedia.ts
162
+ function selectedImageFromMediaValue(value, index) {
163
+ if (value?.type !== "image") return null;
164
+ const resolved = resolveManagedMediaReference(value, index);
165
+ return resolved.kind === "resolved" ? {
166
+ reference: value,
167
+ imageAsset: resolved.asset
168
+ } : null;
169
+ }
170
+ function selectedImageFromRenderableAsset(source) {
171
+ const asset = renderableMediaAssetSchema.parse({
172
+ ...source,
173
+ width: source.width ?? null,
174
+ height: source.height ?? null
175
+ });
176
+ return {
177
+ reference: {
178
+ type: "image",
179
+ identifier: mediaIdentifierSchema.parse(asset.identifier)
180
+ },
181
+ imageAsset: asset
182
+ };
183
+ }
184
+ function imagePoolWithSelectedImage(input) {
185
+ const selection = input.selectedImage;
186
+ if (input.override.kind !== "image" || selection?.reference.identifier !== input.override.reference.identifier) return input.imagePool;
187
+ return [{
188
+ reference: input.override.reference,
189
+ source: "general-media",
190
+ mediaAsset: selection.imageAsset
191
+ }, ...input.imagePool.filter((item) => item.reference.identifier !== selection.reference.identifier)];
192
+ }
193
+ function selectedOrPooledImageAssetForReference(input) {
194
+ if (input.selectedImage?.reference.identifier === input.reference.identifier) return input.selectedImage.imageAsset;
195
+ return input.imagePool?.find((item) => item.reference.identifier === input.reference.identifier)?.mediaAsset;
196
+ }
197
+ //#endregion
198
+ //#region ../preview-next/src/client/blocks/BlockBackgroundChooser.tsx
199
+ function BackgroundChooser({ editingSlot, capability, current, imagePoolStatus, onChoose }) {
200
+ const chooseFromClick = (override) => (event) => {
201
+ event.preventDefault();
202
+ event.stopPropagation();
203
+ onChoose(override);
204
+ };
205
+ return /* @__PURE__ */ jsxs("div", {
206
+ className: "mt-2 max-h-80 overflow-y-auto rounded-md border bg-muted/20 p-2",
207
+ children: [
208
+ current.kind === "default" || current.kind === "color" ? /* @__PURE__ */ jsx(BackgroundColourOptions, {
209
+ capability,
210
+ current,
211
+ chooseFromClick
212
+ }) : null,
213
+ current.kind === "gradient" ? /* @__PURE__ */ jsx(BackgroundGradientOptions, {
214
+ capability,
215
+ current,
216
+ chooseFromClick
217
+ }) : null,
218
+ current.kind === "image" ? /* @__PURE__ */ jsx(BackgroundImageOptions, {
219
+ editingSlot,
220
+ capability,
221
+ current,
222
+ imagePoolStatus,
223
+ onChoose,
224
+ chooseFromClick
225
+ }) : null
226
+ ]
227
+ });
228
+ }
229
+ function BackgroundColourOptions({ capability, current, chooseFromClick }) {
230
+ return /* @__PURE__ */ jsx(CustomizeBackgroundColorPicker, {
231
+ title: "Colours",
232
+ selectedToken: current.kind === "color" ? current.token : null,
233
+ recommendedTokens: capability.recommendedColorTokens ?? capability.colorTokens ?? [],
234
+ advancedTokens: capability.advancedColorTokens ?? [],
235
+ defaultSelected: current.kind === "default",
236
+ onChooseDefault: capability.modes.includes("default") ? chooseFromClick(defaultBackgroundOverrideForMode("default", capability)) : void 0,
237
+ labelForToken: formatTokenLabel,
238
+ swatchColorForToken: tokenSwatchCss,
239
+ onChooseToken: (token, event) => {
240
+ chooseFromClick({
241
+ kind: "color",
242
+ token
243
+ })(event);
244
+ }
245
+ });
246
+ }
247
+ function BackgroundGradientOptions({ capability, current, chooseFromClick }) {
248
+ if (!capability.gradientIds?.length) return null;
249
+ return /* @__PURE__ */ jsxs("div", { children: [
250
+ /* @__PURE__ */ jsx("div", {
251
+ className: "mb-1 text-xs font-medium text-muted-foreground",
252
+ children: "Gradients"
253
+ }),
254
+ /* @__PURE__ */ jsx("p", {
255
+ className: "mb-2 text-[11px] leading-4 text-muted-foreground",
256
+ children: "Curated presets use this site's colours. The full section preview shows the final result."
257
+ }),
258
+ /* @__PURE__ */ jsx("div", {
259
+ className: "grid grid-cols-2 gap-2",
260
+ children: capability.gradientIds.map((gradientId) => /* @__PURE__ */ jsx(GradientPresetCard, {
261
+ gradientId,
262
+ selected: current.gradientId === gradientId,
263
+ onClick: chooseFromClick({
264
+ kind: "gradient",
265
+ gradientId
266
+ })
267
+ }, gradientId))
268
+ }),
269
+ /* @__PURE__ */ jsx(SelectedGradient, {
270
+ gradientId: current.gradientId,
271
+ onReset: capability.modes.includes("default") ? chooseFromClick(defaultBackgroundOverrideForMode("default", capability)) : null
272
+ })
273
+ ] });
274
+ }
275
+ function GradientPresetCard({ gradientId, selected, onClick }) {
276
+ const preset = getGradientPreset(gradientId);
277
+ const kindLabel = gradientKindLabel(preset);
278
+ return /* @__PURE__ */ jsxs("button", {
279
+ type: "button",
280
+ "aria-label": `Choose ${preset.name}, ${kindLabel}`,
281
+ "aria-pressed": selected,
282
+ className: `overflow-hidden rounded-md border text-left text-xs transition hover:border-muted-foreground ${selected ? "border-foreground ring-1 ring-foreground" : "bg-background"}`,
283
+ onClick,
284
+ children: [/* @__PURE__ */ jsx("span", {
285
+ "aria-hidden": "true",
286
+ className: "block h-14 w-full border-b",
287
+ style: { backgroundImage: gradientPreviewCss(gradientId) }
288
+ }), /* @__PURE__ */ jsxs("span", {
289
+ className: "relative block min-w-0 px-2 py-1.5",
290
+ children: [
291
+ /* @__PURE__ */ jsx("span", {
292
+ className: "block truncate font-medium",
293
+ children: preset.name
294
+ }),
295
+ /* @__PURE__ */ jsx("span", {
296
+ className: "block text-[10px] text-muted-foreground",
297
+ children: kindLabel
298
+ }),
299
+ selected ? /* @__PURE__ */ jsx("span", {
300
+ "aria-hidden": "true",
301
+ className: "absolute right-2 top-1.5 grid h-4 w-4 place-items-center rounded-full bg-foreground text-[10px] text-background",
302
+ children: "✓"
303
+ }) : null
304
+ ]
305
+ })]
306
+ });
307
+ }
308
+ function SelectedGradient({ gradientId, onReset }) {
309
+ return /* @__PURE__ */ jsxs("div", {
310
+ className: "mt-2 flex items-center justify-between gap-2 border-t pt-2",
311
+ children: [/* @__PURE__ */ jsxs("span", {
312
+ className: "flex min-w-0 items-center gap-2",
313
+ children: [/* @__PURE__ */ jsx("span", {
314
+ "aria-hidden": "true",
315
+ className: "h-7 w-10 shrink-0 rounded border",
316
+ style: { backgroundImage: gradientPreviewCss(gradientId) }
317
+ }), /* @__PURE__ */ jsxs("span", {
318
+ className: "min-w-0",
319
+ children: [/* @__PURE__ */ jsx("span", {
320
+ className: "block truncate text-xs font-medium",
321
+ children: gradientLabel(gradientId)
322
+ }), /* @__PURE__ */ jsx("span", {
323
+ className: "block text-[10px] text-muted-foreground",
324
+ children: "Selected for this section"
325
+ })]
326
+ })]
327
+ }), onReset ? /* @__PURE__ */ jsx("button", {
328
+ type: "button",
329
+ className: "shrink-0 rounded px-1.5 py-1 text-xs font-medium hover:bg-muted",
330
+ onClick: onReset,
331
+ children: "Use the style’s background"
332
+ }) : null]
333
+ });
334
+ }
335
+ function BackgroundImageOptions({ editingSlot, capability, current, imagePoolStatus, onChoose, chooseFromClick }) {
336
+ const mediaEditorContext = useMediaEditorOptional();
337
+ const [mediaPickerOpenKey, setMediaPickerOpenKey] = useState(0);
338
+ if (!capability.modes.includes("image")) return null;
339
+ const images = rankBackgroundImagePoolItems(capability.imagePool ?? []);
340
+ return /* @__PURE__ */ jsxs("div", { children: [
341
+ /* @__PURE__ */ jsx("div", {
342
+ className: "mb-1 text-xs font-medium text-muted-foreground",
343
+ children: "Images"
344
+ }),
345
+ mediaEditorContext ? /* @__PURE__ */ jsx(MediaLibraryButton, { onOpen: () => setMediaPickerOpenKey((key) => key + 1) }) : null,
346
+ images.length ? /* @__PURE__ */ jsx("div", {
347
+ className: "space-y-1",
348
+ children: images.map((item) => /* @__PURE__ */ jsx(ImagePoolButton, {
349
+ item,
350
+ selected: current.reference.identifier === item.reference.identifier,
351
+ thumbnailUrl: backgroundImagePreviewUrl(item, mediaEditorContext),
352
+ onClick: chooseFromClick({
353
+ kind: "image",
354
+ reference: item.reference
355
+ })
356
+ }, `${item.source}:${item.reference.identifier}`))
357
+ }) : /* @__PURE__ */ jsx("p", {
358
+ className: "text-xs text-muted-foreground",
359
+ children: imagePoolStatus === "loading" ? "Loading images..." : "No background-ready images yet."
360
+ }),
361
+ mediaPickerOpenKey > 0 && mediaEditorContext ? /* @__PURE__ */ jsx(BackgroundMediaPicker, {
362
+ editingSlot,
363
+ openKey: mediaPickerOpenKey,
364
+ onChoose,
365
+ onDone: () => setMediaPickerOpenKey(0)
366
+ }) : null
367
+ ] });
368
+ }
369
+ function MediaLibraryButton({ onOpen }) {
370
+ return /* @__PURE__ */ jsxs("button", {
371
+ type: "button",
372
+ className: "mb-2 inline-flex w-full items-center justify-center gap-2 rounded-md border bg-background px-2 py-1.5 text-xs font-medium hover:bg-muted",
373
+ onClick: (event) => {
374
+ event.preventDefault();
375
+ event.stopPropagation();
376
+ onOpen();
377
+ },
378
+ children: [/* @__PURE__ */ jsx(Upload, { size: 13 }), "Media library"]
379
+ });
380
+ }
381
+ function ImagePoolButton({ item, selected, thumbnailUrl, onClick }) {
382
+ return /* @__PURE__ */ jsx("button", {
383
+ type: "button",
384
+ className: `w-full rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${selected ? "border-foreground" : "bg-background"}`,
385
+ onClick,
386
+ children: /* @__PURE__ */ jsxs("span", {
387
+ className: "flex min-w-0 items-center gap-2",
388
+ children: [/* @__PURE__ */ jsx("span", {
389
+ className: "grid h-7 w-9 shrink-0 place-items-center overflow-hidden rounded border bg-muted",
390
+ children: thumbnailUrl ? /* @__PURE__ */ jsx("img", {
391
+ alt: "",
392
+ className: "h-full w-full object-cover",
393
+ src: thumbnailUrl
394
+ }) : /* @__PURE__ */ jsx(Image, { size: 14 })
395
+ }), /* @__PURE__ */ jsxs("span", {
396
+ className: "min-w-0",
397
+ children: [/* @__PURE__ */ jsx("span", {
398
+ className: "block truncate",
399
+ children: item.label ?? "Image"
400
+ }), /* @__PURE__ */ jsx("span", {
401
+ className: "text-[11px] text-muted-foreground",
402
+ children: imageSourceLabel(item.source)
403
+ })]
404
+ })]
405
+ })
406
+ });
407
+ }
408
+ function BackgroundMediaPicker({ editingSlot, openKey, onChoose, onDone }) {
409
+ const mediaEditorContext = useMediaEditorOptional();
410
+ const chooseMediaValue = (value) => {
411
+ const selectedImage = selectedImageFromMediaValue(value, mediaEditorContext?.imageResolveContext.mediaAssetIndex);
412
+ if (!selectedImage) return;
413
+ onChoose({
414
+ kind: "image",
415
+ reference: selectedImage.reference
416
+ }, { selectedImage });
417
+ onDone();
418
+ };
419
+ return /* @__PURE__ */ jsx("div", {
420
+ onClick: (event) => event.stopPropagation(),
421
+ children: /* @__PURE__ */ jsx(MediaEditor, {
422
+ editingSlot,
423
+ value: void 0,
424
+ onChange: chooseMediaValue,
425
+ allowedKinds: ["image"],
426
+ mediaPickerAutoOpen: true,
427
+ mediaPickerPolicy: { assetSelection: backgroundMediaPickerAssetSelection },
428
+ showPreview: false,
429
+ showAltInput: false,
430
+ uploadIntent: {
431
+ tag: "media-library",
432
+ allowedRenderUses: ["image"]
433
+ },
434
+ onUploadComplete: (asset) => {
435
+ if (backgroundMediaPickerAssetSelection(asset).tag === "disabled") return;
436
+ const selectedImage = selectedImageFromRenderableAsset(asset);
437
+ onChoose({
438
+ kind: "image",
439
+ reference: selectedImage.reference
440
+ }, { selectedImage });
441
+ onDone();
442
+ }
443
+ }, openKey)
444
+ });
445
+ }
446
+ function formatVariantLabel(variantKey) {
447
+ return variantKey.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (letter) => letter.toUpperCase());
448
+ }
449
+ function BackgroundPreviewSwatch({ override, imagePool }) {
450
+ const mediaEditorContext = useMediaEditorOptional();
451
+ const baseClassName = "grid h-6 w-9 shrink-0 place-items-center overflow-hidden rounded-md border";
452
+ switch (override.kind) {
453
+ case "default": return /* @__PURE__ */ jsx("span", {
454
+ className: `${baseClassName} bg-background`,
455
+ children: /* @__PURE__ */ jsx("span", { className: "h-3 w-3 rounded-full border bg-muted" })
456
+ });
457
+ case "color": return /* @__PURE__ */ jsx("span", {
458
+ className: baseClassName,
459
+ style: { backgroundColor: tokenSwatchCss(override.token) }
460
+ });
461
+ case "gradient": return /* @__PURE__ */ jsx("span", {
462
+ className: baseClassName,
463
+ style: { backgroundImage: gradientPreviewCss(override.gradientId) }
464
+ });
465
+ case "image":
466
+ const imageItem = imagePool.find((item) => item.reference.identifier === override.reference.identifier);
467
+ const thumbnailUrl = imageItem ? backgroundImagePreviewUrl(imageItem, mediaEditorContext) : void 0;
468
+ return /* @__PURE__ */ jsx("span", {
469
+ className: `${baseClassName} bg-muted`,
470
+ children: thumbnailUrl ? /* @__PURE__ */ jsx("img", {
471
+ alt: "",
472
+ className: "h-full w-full object-cover",
473
+ src: thumbnailUrl
474
+ }) : /* @__PURE__ */ jsx(Image, { size: 15 })
475
+ });
476
+ }
477
+ }
478
+ function backgroundImagePreviewUrl(item, mediaEditorContext) {
479
+ const asset = item.mediaAsset;
480
+ if (!asset) return void 0;
481
+ return resolveImageUrlWithContext({
482
+ type: "image",
483
+ asset
484
+ }, {
485
+ width: 72,
486
+ height: 48,
487
+ resize: "cover",
488
+ quality: 70
489
+ }, mediaEditorContext?.imageResolveContext ?? null);
490
+ }
491
+ function backgroundMediaPickerAssetSelection(asset) {
492
+ if (isMarkedBackgroundAsset(asset)) return { tag: "selectable" };
493
+ if (asset.width == null || asset.height == null) return {
494
+ tag: "disabled",
495
+ reason: "This image is missing dimensions, so it cannot be checked for background use."
496
+ };
497
+ if (asset.width < 1920 || asset.height < 900) return {
498
+ tag: "disabled",
499
+ reason: `Background images need to be at least ${SECTION_BACKGROUND_MIN_SOURCE_WIDTH}x900. This image is ${asset.width}x${asset.height}.`
500
+ };
501
+ return { tag: "selectable" };
502
+ }
503
+ function isMarkedBackgroundAsset(asset) {
504
+ return asset.fileUses?.some((fileUse) => fileUse.tag === "site-background-asset") ?? false;
505
+ }
506
+ function gradientLabel(gradientId) {
507
+ return getGradientPreset(gradientId).name;
508
+ }
509
+ function gradientKindLabel(preset) {
510
+ switch (preset.type) {
511
+ case "linear": return "Linear";
512
+ case "radial": return "Radial · top";
513
+ case "conic": return "Conic";
514
+ default: return assertNever(preset.type, "Unhandled gradient preset type");
515
+ }
516
+ }
517
+ function imageSourceLabel(source) {
518
+ switch (source) {
519
+ case "current": return "Current";
520
+ case "generated-ambient": return "Generated";
521
+ case "previous-background": return "Previous";
522
+ case "general-media": return "Media library";
523
+ }
524
+ }
525
+ function tokenSwatchCss(token) {
526
+ return `rgb(var(--tb-${token}))`;
527
+ }
528
+ function gradientPreviewCss(gradientId) {
529
+ const preset = getGradientPreset(gradientId);
530
+ return gradientToCss(preset, Object.fromEntries(preset.stops.map((stop) => [stop.color, tokenSwatchCss(stop.color)])));
531
+ }
532
+ /** Background colours by the part they play on the site, not their token names. */
533
+ const backgroundTokenLabels = {
534
+ background: "Page ground",
535
+ surface: "Card colour",
536
+ muted: "Quiet band",
537
+ primary: "Brand colour",
538
+ secondary: "Second brand colour",
539
+ accent: "Accent colour"
540
+ };
541
+ function formatTokenLabel(token) {
542
+ return backgroundTokenLabels[token] ?? formatVariantLabel(token.replace(/\//g, " "));
543
+ }
544
+ function readBackgroundColorPaletteSnapshot() {
545
+ if (typeof window === "undefined" || typeof document === "undefined") return null;
546
+ const rootStyle = window.getComputedStyle(document.documentElement);
547
+ const bodyStyle = document.body ? window.getComputedStyle(document.body) : null;
548
+ const entries = backgroundColorTokens.flatMap((token) => {
549
+ const value = rootStyle.getPropertyValue(`--tb-${token}`).trim() || bodyStyle?.getPropertyValue(`--tb-${token}`).trim() || "";
550
+ return value ? [[token, value]] : [];
551
+ });
552
+ return entries.length > 0 ? Object.fromEntries(entries) : null;
553
+ }
554
+ //#endregion
555
+ //#region ../preview-next/src/client/blocks/previewCustomizeActions.ts
556
+ /**
557
+ * The stops a block's Look steps through on a preset style: Default, then each
558
+ * Look it offers, as the sidebar's Look tiles list them. Null when there's no
559
+ * real alternative: no Looks, or a single Look that Default already shows.
560
+ */
561
+ function pageDesignLookStops(block) {
562
+ if (block.lookAvailability.kind !== "available") return null;
563
+ const lookIds = block.availableLooks.map((look) => look.id);
564
+ const [onlyLook, ...otherLooks] = lookIds;
565
+ if (onlyLook === void 0) return null;
566
+ const defaultLook = block.look.kind === "user-pinned" ? block.autoLookId : block.look.effectiveValue;
567
+ if (otherLooks.length === 0 && defaultLook === onlyLook) return null;
568
+ return [null, ...lookIds];
569
+ }
570
+ /**
571
+ * What the block's Look control shows on a preset style: the Look in use, its
572
+ * place among the stops, and whether the arrows can move. The canvas pill and
573
+ * the sidebar's Look card both read it, so they agree.
574
+ */
575
+ function pageDesignLookPosition(block) {
576
+ const shown = block.availableLooks.findIndex((look) => look.id === block.look.effectiveValue);
577
+ const stops = pageDesignLookStops(block);
578
+ return {
579
+ lookName: block.availableLooks[shown]?.label ?? "Default",
580
+ position: stops ? `${shown + 2} of ${stops.length}` : null,
581
+ canCycle: cyclePageDesignBlockLook(block, "next") !== null
582
+ };
583
+ }
584
+ function cyclePageDesignBlockLook(block, direction) {
585
+ const values = pageDesignLookStops(block);
586
+ if (values === null) return null;
587
+ const currentIndex = cycleChoiceIndex(block.look, values, direction);
588
+ if (currentIndex === -1) return null;
589
+ const appearancePresetId = values[direction === "next" ? (currentIndex + 1) % values.length : currentIndex === 0 ? values.length - 1 : currentIndex - 1];
590
+ if (appearancePresetId === void 0) return null;
591
+ return {
592
+ kind: "set-look",
593
+ blockId: block.blockId,
594
+ appearancePresetId
595
+ };
596
+ }
597
+ function setPageDesignBlockBackground(input) {
598
+ const current = input.currentContent ? parseBackgroundOverrideFromContent(input.currentContent) : {
599
+ kind: "supported",
600
+ override: input.fromOverride ?? { kind: "default" }
601
+ };
602
+ const imagePool = imagePoolWithSelectedImage({
603
+ imagePool: input.imagePool ?? imagePoolForOverride(input.override),
604
+ override: input.override,
605
+ selectedImage: input.selectedImage
606
+ });
607
+ const plan = planBackgroundOverride(current, resolveBackgroundCapability({
608
+ block: input.block,
609
+ imagePool
610
+ }), input.override);
611
+ if (plan.kind !== "apply") return null;
612
+ const imageAsset = plan.override.kind === "image" ? selectedOrPooledImageAssetForReference({
613
+ imagePool: input.imagePool,
614
+ reference: plan.override.reference,
615
+ selectedImage: input.selectedImage
616
+ }) : void 0;
617
+ return {
618
+ kind: "set-background",
619
+ blockId: input.block.blockId,
620
+ override: plan.override,
621
+ fromOverride: plan.fromOverride,
622
+ baseContentId: input.block.contentRevision?.contentId ?? null,
623
+ ...imageAsset ? { imageAsset } : {}
624
+ };
625
+ }
626
+ function cycleChoiceIndex(choice, values, direction) {
627
+ if (choice.kind === "user-pinned" && choice.status === "supported") return values.findIndex((value) => value === choice.effectiveValue);
628
+ if ((choice.kind === "auto" || choice.kind === "user-pinned" && choice.status === "unsupported") && choice.effectiveValue === values[1]) {
629
+ if (values.length <= 2) return -1;
630
+ return direction === "next" ? 1 : 0;
631
+ }
632
+ return 0;
633
+ }
634
+ //#endregion
635
+ //#region ../preview-next/src/client/preview/CustomizeBackgroundControlRows.tsx
636
+ function CustomizeBackgroundControlRows({ modeLabel, valueLabel, valueAriaLabel, swatch, chooserOpen, chooser, canCycleMode, canCycleValue, onCycleMode, onCycleValue, onToggleChooser }) {
637
+ return /* @__PURE__ */ jsxs("div", {
638
+ className: "space-y-2",
639
+ children: [
640
+ /* @__PURE__ */ jsxs("div", {
641
+ className: "flex items-stretch overflow-hidden rounded-full border bg-background",
642
+ children: [
643
+ /* @__PURE__ */ jsx("button", {
644
+ type: "button",
645
+ onClick: (event) => onCycleMode("prev", event),
646
+ className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
647
+ "aria-label": "Previous background mode",
648
+ disabled: !canCycleMode,
649
+ children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
650
+ }),
651
+ /* @__PURE__ */ jsxs("div", {
652
+ className: "min-w-0 flex-1 border-x px-2 py-1 text-center",
653
+ children: [/* @__PURE__ */ jsx("div", {
654
+ className: "text-xs font-medium leading-3 text-muted-foreground",
655
+ children: "Background:"
656
+ }), /* @__PURE__ */ jsx("div", {
657
+ className: "truncate text-xs font-semibold leading-4",
658
+ children: modeLabel
659
+ })]
660
+ }),
661
+ /* @__PURE__ */ jsx("button", {
662
+ type: "button",
663
+ onClick: (event) => onCycleMode("next", event),
664
+ className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
665
+ "aria-label": "Next background mode",
666
+ disabled: !canCycleMode,
667
+ children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
668
+ })
669
+ ]
670
+ }),
671
+ /* @__PURE__ */ jsxs("div", {
672
+ className: "flex items-stretch overflow-hidden rounded-full border bg-background",
673
+ children: [
674
+ /* @__PURE__ */ jsx("button", {
675
+ type: "button",
676
+ onClick: (event) => onCycleValue("prev", event),
677
+ className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
678
+ "aria-label": "Previous background value",
679
+ disabled: !canCycleValue,
680
+ children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
681
+ }),
682
+ /* @__PURE__ */ jsxs("button", {
683
+ type: "button",
684
+ className: "flex min-w-0 flex-1 items-center justify-center gap-2 border-x px-2 py-1 text-center hover:bg-muted",
685
+ "aria-expanded": chooserOpen,
686
+ "aria-label": valueAriaLabel,
687
+ onClick: onToggleChooser,
688
+ children: [swatch, /* @__PURE__ */ jsx("span", {
689
+ className: "truncate text-xs font-medium",
690
+ children: valueLabel
691
+ })]
692
+ }),
693
+ /* @__PURE__ */ jsx("button", {
694
+ type: "button",
695
+ onClick: (event) => onCycleValue("next", event),
696
+ className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
697
+ "aria-label": "Next background value",
698
+ disabled: !canCycleValue,
699
+ children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
700
+ })
701
+ ]
702
+ }),
703
+ chooserOpen ? chooser : null
704
+ ]
705
+ });
706
+ }
707
+ //#endregion
708
+ //#region ../preview-next/src/client/blocks/ArrangementBlockToolbar.tsx
709
+ /**
710
+ * The block toolbar's state and actions on a style built from arrangement
711
+ * Looks. Every change goes through the customise history the legacy controls
712
+ * use: Looks as set-look, modes as set-layout, knobs as set-block-facet and
713
+ * backgrounds as set-background. Null on a legacy style.
714
+ */
715
+ function useArrangementToolbar(input) {
716
+ const { designBlock, content } = input;
717
+ const controls = useMemo(() => designBlock ? arrangementBlockControlsFor({
718
+ block: designBlock,
719
+ content
720
+ }) : null, [content, designBlock]);
721
+ const background = useMemo(() => designBlock && controls ? arrangementBackgroundControlFor({
722
+ block: designBlock,
723
+ content
724
+ }) : null, [
725
+ content,
726
+ controls,
727
+ designBlock
728
+ ]);
729
+ const [modeNotice, setModeNotice] = useState(null);
730
+ if (!designBlock || !controls) return null;
731
+ const baseContentId = designBlock.contentRevision?.contentId ?? null;
732
+ return {
733
+ controls,
734
+ background,
735
+ styleName: styleNameFor(input.pageDesignState),
736
+ modeNotice: input.selected ? modeNotice : null,
737
+ cycleLook: (direction) => {
738
+ const appearancePresetId = nextArrangementLookPin(controls, designBlock, direction);
739
+ if (appearancePresetId === void 0) return;
740
+ setModeNotice(null);
741
+ input.save({
742
+ kind: "set-look",
743
+ blockId: designBlock.blockId,
744
+ appearancePresetId
745
+ });
746
+ },
747
+ chooseMode: (mode) => {
748
+ setModeNotice(mode);
749
+ input.save({
750
+ kind: "set-layout",
751
+ blockId: designBlock.blockId,
752
+ layoutVariantKey: asLayoutVariantKey(mode),
753
+ baseContentId
754
+ });
755
+ },
756
+ chooseKnob: (control, value) => {
757
+ input.save({
758
+ kind: "set-block-facet",
759
+ blockId: designBlock.blockId,
760
+ facetId: control.facetId,
761
+ value,
762
+ fromValue: control.stored,
763
+ baseContentId
764
+ });
765
+ },
766
+ chooseSurface: (surfaceName) => {
767
+ const option = background?.kind === "surfaces" ? background.options.find((candidate) => candidate.name === surfaceName) : void 0;
768
+ if (surfaceName === null) input.chooseBackground({ kind: "default" });
769
+ else if (option) input.chooseBackground({
770
+ kind: "color",
771
+ token: option.token
772
+ });
773
+ },
774
+ editHeadline: () => input.openField(headlineFieldPath(designBlock.blockKind))
775
+ };
776
+ }
777
+ function styleNameFor(state) {
778
+ return (state.kind === "loaded" ? getCuratedSiteStyle(state.editorModel.siteStyleId)?.name : null) ?? "This style";
779
+ }
780
+ function headlineFieldPath(blockKind) {
781
+ const source = getBlockDefinition(blockKind)?.manifest.titleSource;
782
+ return (typeof source === "string" ? source : source?.[0]) ?? "headline";
783
+ }
784
+ //#endregion
785
+ //#region ../preview-next/src/client/blocks/ArrangementLookControls.tsx
786
+ const darkPill = "flex items-center overflow-hidden rounded-full bg-black/80 text-xs text-white shadow";
787
+ const darkPillButton = "grid h-7 w-7 shrink-0 place-items-center hover:bg-black";
788
+ function ArrangementModeSwitchPill({ blockLabel, mode, onChoose }) {
789
+ return /* @__PURE__ */ jsxs("div", {
790
+ className: `${darkPill} gap-0.5 py-0.5 pl-2.5 pr-0.5`,
791
+ role: "group",
792
+ "aria-label": `What the ${blockLabel.toLowerCase()} shows`,
793
+ children: [/* @__PURE__ */ jsx("span", {
794
+ className: "pr-1 text-white/70",
795
+ children: "Shows"
796
+ }), mode.options.map((option) => /* @__PURE__ */ jsx("button", {
797
+ type: "button",
798
+ "aria-pressed": option.mode === mode.current,
799
+ className: `rounded-full px-2 py-1 ${option.mode === mode.current ? "bg-white text-black" : "hover:bg-black"}`,
800
+ onClick: (event) => {
801
+ event.preventDefault();
802
+ event.stopPropagation();
803
+ if (option.mode !== mode.current) onChoose(option.mode);
804
+ },
805
+ children: option.label
806
+ }, option.mode))]
807
+ });
808
+ }
809
+ function ArrangementLookPill({ look, onCycle }) {
810
+ return /* @__PURE__ */ jsx(LookCyclePill, {
811
+ lookName: look.lookName,
812
+ prefix: lookIsAutomatic(look) ? "Automatic ·" : null,
813
+ position: lookPosition(look),
814
+ onCycle
815
+ });
816
+ }
817
+ /**
818
+ * The canvas Look arrows: one dark pill with the Look's name between the
819
+ * arrows, so the name always sits on its own surface over any photo. Every
820
+ * kind of Look (arrangement, legacy preset, SDK lookField) renders through it.
821
+ */
822
+ function LookCyclePill({ lookName, prefix = null, position = null, onCycle }) {
823
+ const arrow = (direction) => /* @__PURE__ */ jsx("button", {
824
+ type: "button",
825
+ className: darkPillButton,
826
+ "aria-label": direction === "prev" ? "Previous Look" : "Next Look",
827
+ onClick: (event) => {
828
+ event.preventDefault();
829
+ event.stopPropagation();
830
+ onCycle(direction);
831
+ },
832
+ children: direction === "prev" ? /* @__PURE__ */ jsx(ChevronLeft, { size: 14 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
833
+ });
834
+ return /* @__PURE__ */ jsxs("div", {
835
+ className: `${darkPill} min-w-0 shrink`,
836
+ role: "group",
837
+ "aria-label": "Look",
838
+ children: [
839
+ arrow("prev"),
840
+ /* @__PURE__ */ jsxs("span", {
841
+ className: "flex min-w-0 max-w-[16rem] items-baseline gap-1.5 px-1 py-1",
842
+ "aria-live": "polite",
843
+ children: [
844
+ prefix ? /* @__PURE__ */ jsx("span", {
845
+ className: "shrink-0 text-white/70",
846
+ children: prefix
847
+ }) : null,
848
+ /* @__PURE__ */ jsx("span", {
849
+ className: "truncate font-medium",
850
+ children: lookName
851
+ }),
852
+ position ? /* @__PURE__ */ jsx("span", {
853
+ className: "shrink-0 text-white/70",
854
+ children: position
855
+ }) : null
856
+ ]
857
+ }),
858
+ arrow("next")
859
+ ]
860
+ });
861
+ }
862
+ /** Says why the block shows a different Look from the one the owner chose. */
863
+ function ArrangementLookNote({ look, styleName }) {
864
+ const message = look ? arrangementLookNote(look, styleName) : null;
865
+ if (!message) return null;
866
+ return /* @__PURE__ */ jsxs("p", {
867
+ className: "flex max-w-xs gap-1.5 rounded-lg border bg-background px-2.5 py-2 text-xs leading-4 text-foreground shadow",
868
+ children: [/* @__PURE__ */ jsx(Info, {
869
+ size: 13,
870
+ className: "mt-px shrink-0 text-muted-foreground",
871
+ "aria-hidden": "true"
872
+ }), /* @__PURE__ */ jsx("span", { children: message })]
873
+ });
874
+ }
875
+ function ArrangementOptionsBody({ controls, styleName, background, onChooseKnob, onChooseSurface, onEditHeadline }) {
876
+ const choices = controls.knobs.filter((control) => control.kind === "choice");
877
+ const flourishes = controls.knobs.filter((control) => control.kind === "text");
878
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
879
+ controls.headlineHint ? /* @__PURE__ */ jsx(HeadlineHint, {
880
+ length: controls.headlineHint.length,
881
+ onEdit: onEditHeadline
882
+ }) : null,
883
+ choices.length > 0 ? /* @__PURE__ */ jsx("div", {
884
+ className: "space-y-3",
885
+ children: choices.map((control) => /* @__PURE__ */ jsx(KnobChoice, {
886
+ control,
887
+ styleName,
888
+ onChoose: onChooseKnob
889
+ }, control.facetId))
890
+ }) : null,
891
+ flourishes.length > 0 ? /* @__PURE__ */ jsxs("div", {
892
+ className: "space-y-3",
893
+ children: [/* @__PURE__ */ jsx("p", {
894
+ className: "text-xs font-medium text-muted-foreground",
895
+ children: "Short text for this Look"
896
+ }), flourishes.map((control) => /* @__PURE__ */ jsx(KnobText, {
897
+ control,
898
+ onChange: onChooseKnob
899
+ }, control.facetId))]
900
+ }) : null,
901
+ controls.knobs.length === 0 ? /* @__PURE__ */ jsx("p", {
902
+ className: "text-xs text-muted-foreground",
903
+ children: "This Look has no options."
904
+ }) : null,
905
+ background ? /* @__PURE__ */ jsx(SectionBackgroundChoice, {
906
+ background,
907
+ onChoose: onChooseSurface
908
+ }) : null
909
+ ] });
910
+ }
911
+ function HeadlineHint({ length, onEdit }) {
912
+ return /* @__PURE__ */ jsxs("p", {
913
+ className: "flex gap-1.5 rounded-md bg-muted/60 p-2 text-xs leading-4",
914
+ children: [/* @__PURE__ */ jsx(Info, {
915
+ size: 13,
916
+ className: "mt-px shrink-0 text-muted-foreground",
917
+ "aria-hidden": "true"
918
+ }), /* @__PURE__ */ jsxs("span", { children: [
919
+ "This Look suits a shorter headline. Yours is ",
920
+ length,
921
+ ", so it’s set a size smaller.",
922
+ " ",
923
+ /* @__PURE__ */ jsx("button", {
924
+ type: "button",
925
+ className: "font-medium underline underline-offset-2",
926
+ onClick: onEdit,
927
+ children: "Edit the headline"
928
+ })
929
+ ] })]
930
+ });
931
+ }
932
+ function KnobChoice({ control, styleName, onChoose }) {
933
+ return /* @__PURE__ */ jsxs("div", { children: [
934
+ /* @__PURE__ */ jsx("div", {
935
+ className: lookControlLabelClass,
936
+ children: control.label
937
+ }),
938
+ /* @__PURE__ */ jsx("div", {
939
+ className: "flex flex-wrap gap-1 rounded-lg border border-slate-200 bg-slate-50 p-1",
940
+ role: "group",
941
+ "aria-label": control.label,
942
+ children: control.options.map((option) => /* @__PURE__ */ jsx("button", {
943
+ type: "button",
944
+ "aria-pressed": option.value === control.value,
945
+ className: segmentClassName(option.value === control.value),
946
+ onClick: (event) => {
947
+ event.preventDefault();
948
+ event.stopPropagation();
949
+ if (option.value !== control.value) onChoose(control, option.value);
950
+ },
951
+ children: option.label
952
+ }, option.value))
953
+ }),
954
+ control.description ? /* @__PURE__ */ jsx("p", {
955
+ className: "mt-1 text-xs text-muted-foreground",
956
+ children: control.description
957
+ }) : null,
958
+ control.cappedBy ? /* @__PURE__ */ jsxs("p", {
959
+ className: "mt-1 text-[11px] text-muted-foreground",
960
+ children: [
961
+ control.cappedBy === "style" ? styleName : "This Look",
962
+ " goes up to ",
963
+ control.options[control.options.length - 1]?.label,
964
+ ", so that’s what shows."
965
+ ]
966
+ }) : null
967
+ ] });
968
+ }
969
+ function KnobText({ control, onChange }) {
970
+ const inputId = React.useId();
971
+ const countId = `${inputId}-count`;
972
+ return /* @__PURE__ */ jsxs("div", { children: [
973
+ /* @__PURE__ */ jsx("label", {
974
+ htmlFor: inputId,
975
+ className: `block ${lookControlLabelClass}`,
976
+ children: control.label
977
+ }),
978
+ /* @__PURE__ */ jsxs("div", {
979
+ className: "flex items-center gap-2",
980
+ children: [/* @__PURE__ */ jsx("input", {
981
+ id: inputId,
982
+ type: "text",
983
+ value: control.value,
984
+ maxLength: control.maxLength,
985
+ "aria-describedby": countId,
986
+ className: "min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm",
987
+ onChange: (event) => onChange(control, event.currentTarget.value.slice(0, control.maxLength))
988
+ }), /* @__PURE__ */ jsxs("span", {
989
+ id: countId,
990
+ className: "shrink-0 text-xs tabular-nums text-muted-foreground",
991
+ children: [
992
+ control.value.length,
993
+ "/",
994
+ control.maxLength
995
+ ]
996
+ })]
997
+ }),
998
+ /* @__PURE__ */ jsx("p", {
999
+ className: "mt-1 text-[11px] text-muted-foreground",
1000
+ children: "Leave it empty and nothing shows."
1001
+ })
1002
+ ] });
1003
+ }
1004
+ function SectionBackgroundChoice({ background, onChoose }) {
1005
+ if (background.kind === "held-by-photo") return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
1006
+ className: lookControlLabelClass,
1007
+ children: "Section background"
1008
+ }), /* @__PURE__ */ jsx("p", {
1009
+ className: "text-xs text-muted-foreground",
1010
+ children: "This section’s background is its photo for now."
1011
+ })] });
1012
+ const swatch = (key, selected, label, color, value) => /* @__PURE__ */ jsxs("button", {
1013
+ type: "button",
1014
+ "aria-pressed": selected,
1015
+ className: `flex items-center gap-2 rounded-md border px-2 py-1.5 text-left text-xs ${value === null ? "col-span-2" : ""} ${selected ? "border-foreground ring-1 ring-foreground" : "bg-background hover:bg-muted"}`,
1016
+ onClick: (event) => {
1017
+ event.preventDefault();
1018
+ event.stopPropagation();
1019
+ if (!selected) onChoose(value);
1020
+ },
1021
+ children: [/* @__PURE__ */ jsx("span", {
1022
+ "aria-hidden": "true",
1023
+ className: "h-5 w-7 shrink-0 rounded border",
1024
+ style: color ? { backgroundColor: color } : { backgroundImage: "linear-gradient(135deg, rgb(var(--tb-background)) 50%, rgb(var(--tb-muted)) 50%)" }
1025
+ }), /* @__PURE__ */ jsx("span", {
1026
+ className: "min-w-0 truncate",
1027
+ children: label
1028
+ })]
1029
+ }, key);
1030
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
1031
+ className: lookControlLabelClass,
1032
+ children: "Section background"
1033
+ }), /* @__PURE__ */ jsxs("div", {
1034
+ className: "grid grid-cols-2 gap-1.5",
1035
+ role: "group",
1036
+ "aria-label": "Section background",
1037
+ children: [swatch("rhythm", background.selected === null, "Chosen by your site style", null, null), background.options.map((option) => swatch(option.name, background.selected === option.name, option.label, `rgb(var(--tb-${option.token}))`, option.name))]
1038
+ })] });
1039
+ }
1040
+ /** Matches the sidebar's field labels, so Look controls read as part of the form. */
1041
+ const lookControlLabelClass = "mb-1.5 text-sm font-semibold leading-5 text-foreground";
1042
+ function segmentClassName(active) {
1043
+ return ["min-h-8 flex-1 rounded-md px-2.5 text-xs font-medium transition focus:outline-none focus:ring-2 focus:ring-sky-400", active ? "bg-slate-950 text-white shadow-sm" : "bg-transparent text-slate-600 hover:bg-white hover:text-slate-950"].join(" ");
1044
+ }
1045
+ /** Unpinned blocks, and pins the current mode can't show, render the automatic Look. */
1046
+ function lookIsAutomatic(look) {
1047
+ return look.kind === "automatic" || look.kind === "mode-mismatch";
1048
+ }
1049
+ function lookPosition(look) {
1050
+ return look.kind === "pinned" || look.kind === "style-fallback" ? lookPositionLabel(look.position - 1, look.total) : null;
1051
+ }
1052
+ /** "2 of 5" beside a Look name, from a zero-based index; null when there's nothing to cycle or no match. */
1053
+ function lookPositionLabel(index, total) {
1054
+ return index >= 0 && total > 1 ? `${index + 1} of ${total}` : null;
1055
+ }
1056
+ function arrangementLookNote(look, styleName) {
1057
+ switch (look.kind) {
1058
+ case "automatic":
1059
+ case "pinned": return null;
1060
+ case "style-fallback": return `${styleName} doesn’t offer ${look.requestedName}, so this section shows ${look.lookName}. Your choice is kept and comes back if you switch style again.`;
1061
+ case "mode-mismatch": return `${look.requestedName} is for the ${look.requestedModeLabel.toLowerCase()} view, so this section shows ${look.lookName}. Switch back and your choice returns.`;
1062
+ }
1063
+ }
1064
+ //#endregion
1065
+ //#region ../preview-next/src/client/blocks/useBlockCustomizeControls.ts
1066
+ function useBlockCustomizeControls({ blockId, blockKind, content, uiStore, theme, sdkConfig }) {
1067
+ const { blockFieldOptions, blockFieldExtensions, sdkConfig: contextSdkConfig } = useSdkConfig();
1068
+ const effectiveSdkConfig = sdkConfig ?? contextSdkConfig;
1069
+ const manifest = useMemo(() => resolveBlockManifest(blockKind, effectiveSdkConfig ?? null), [blockKind, effectiveSdkConfig]);
1070
+ const { state: pageDesignState } = usePreviewPageDesignEditorState();
1071
+ const designBlock = useMemo(() => pageDesignState.kind === "loaded" ? pageDesignState.editorModel.blocks.find((block) => String(block.blockId) === String(blockId)) ?? null : null, [blockId, pageDesignState]);
1072
+ const preparedManifest = useMemo(() => {
1073
+ if (!manifest) return null;
1074
+ return prepareBlockEditorManifest({
1075
+ manifest,
1076
+ blockKind,
1077
+ theme,
1078
+ blockFieldOptions,
1079
+ blockFieldExtensions,
1080
+ visibilityPolicy: hideThemeV2RawStyleFields,
1081
+ allowedPromotedFieldPaths: designBlock ? resolveVisiblePromotedFieldPathsForEditorBlock({
1082
+ block: designBlock,
1083
+ promotedFieldPaths: manifest.promotedFields
1084
+ }) : void 0
1085
+ });
1086
+ }, [
1087
+ designBlock,
1088
+ blockFieldExtensions,
1089
+ blockFieldOptions,
1090
+ blockKind,
1091
+ manifest,
1092
+ theme
1093
+ ]);
1094
+ const ownedFieldIds = useMemo(() => arrangementOwnedFieldIds(designBlock), [designBlock]);
1095
+ const visibilityValues = useMemo(() => arrangementVisibilityValues(designBlock), [designBlock]);
1096
+ const fields = useMemo(() => {
1097
+ if (!preparedManifest) return [];
1098
+ return createManifestFormAdapter(preparedManifest.renderManifest).fields.filter((field) => !ownedFieldIds.includes(field.id));
1099
+ }, [ownedFieldIds, preparedManifest]);
1100
+ const backend = useMemo(() => {
1101
+ if (!preparedManifest) return null;
1102
+ return createStoreBackend({
1103
+ scope: "blocks",
1104
+ store: uiStore,
1105
+ blockId
1106
+ });
1107
+ }, [
1108
+ blockId,
1109
+ preparedManifest,
1110
+ uiStore
1111
+ ]);
1112
+ const getValue = (path) => visibilityValues && path === "blockLook" ? visibilityValues.lookId : visibilityValues && path === visibilityValues.arrangementField ? visibilityValues.arrangement : backend?.getValue(path) ?? content[path] ?? fields.find((field) => field.id === path)?.defaultValue;
1113
+ const sectionOptions = preparedManifest ? manifestFieldSectionOptions(preparedManifest.renderManifest, { lookOwnedPaths: blockLookOwnedFieldPaths(designBlock) }) : {};
1114
+ const sectionPlan = derivePromotedFieldPlan(fields, preparedManifest?.renderManifest.promotedFields, getValue, sectionOptions);
1115
+ const renderManifest = preparedManifest?.renderManifest ?? null;
1116
+ return {
1117
+ manifest: renderManifest,
1118
+ fields,
1119
+ sectionPlan,
1120
+ backend,
1121
+ designBlock,
1122
+ lookSource: resolveBlockLookSource(renderManifest, sectionPlan)
1123
+ };
1124
+ }
1125
+ function resolveBlockManifest(blockKind, sdkConfig) {
1126
+ return getBlockManifestFromSdkConfig(blockKind, sdkConfig) ?? getBlockDefinition(blockKind)?.manifest ?? null;
1127
+ }
1128
+ function resolveBlockLookSource(manifest, plan) {
1129
+ return manifest?.lookField ? {
1130
+ kind: "sdk",
1131
+ item: plan.sections.look.find((item) => item.path === manifest.lookField) ?? null
1132
+ } : { kind: "built-in" };
1133
+ }
1134
+ //#endregion
1135
+ //#region ../preview-next/src/client/preview/PreviewSiteFontStorageContext.tsx
1136
+ const PreviewSiteFontStorageContext = createContext(void 0);
1137
+ function PreviewSiteFontStorageProvider({ siteFontStorageUrl, children }) {
1138
+ return /* @__PURE__ */ jsx(PreviewSiteFontStorageContext.Provider, {
1139
+ value: siteFontStorageUrl,
1140
+ children
1141
+ });
1142
+ }
1143
+ function usePreviewSiteFontStorageUrl() {
1144
+ return useContext(PreviewSiteFontStorageContext);
1145
+ }
1146
+ //#endregion
1147
+ //#region ../preview-next/src/client/preview/previewChromeSurfacePolicy.ts
1148
+ const PREVIEW_CHROME_SURFACE_POLICIES = {
1149
+ core: {
1150
+ banner: {
1151
+ tone: "default",
1152
+ bannerClassName: "border border-emerald-200/70 bg-white/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-white/92",
1153
+ summaryClassName: "rounded-md border border-slate-200 bg-slate-50 px-3 py-2 text-xs text-slate-600",
1154
+ dialogItemClassName: "rounded-md border border-slate-200 bg-slate-50 px-3 py-2",
1155
+ titleClassName: "text-sm font-semibold tracking-tight text-foreground [font-family:var(--font-heading)]",
1156
+ descriptionClassName: "text-sm text-muted-foreground [font-family:var(--font-body)]",
1157
+ detailClassName: "text-xs text-muted-foreground [font-family:var(--font-body)]",
1158
+ summaryTitleClassName: "font-medium text-foreground [font-family:var(--font-body)]",
1159
+ summaryBodyClassName: "mt-1 text-muted-foreground [font-family:var(--font-body)]",
1160
+ secondaryButtonClassName: "",
1161
+ primaryButtonClassName: "",
1162
+ dialogBodyClassName: "space-y-3 text-sm text-muted-foreground [font-family:var(--font-body)]",
1163
+ dialogItemTitleClassName: "font-medium text-foreground [font-family:var(--font-heading)]",
1164
+ dialogItemMetaClassName: "ml-2 text-xs font-normal uppercase tracking-wide text-muted-foreground [font-family:var(--font-body)]",
1165
+ dialogItemDescriptionClassName: "mt-1 text-sm text-muted-foreground [font-family:var(--font-body)]",
1166
+ ctaLabel: "Complete setup in dashboard",
1167
+ copyByState: {
1168
+ awaiting_confirmation: {
1169
+ title: "Your draft preview is ready",
1170
+ description: "Explore your site here, then confirm your email to unlock the dashboard and finish launch setup.",
1171
+ detail: "Once your email is confirmed, Complete setup in dashboard will take you straight to the remaining checklist.",
1172
+ checklistNote: "Email confirmation is the only blocker before dashboard access. The rest of the launch checklist lives in the dashboard."
1173
+ },
1174
+ dashboard_ready: {
1175
+ title: "Your dashboard is unlocked",
1176
+ description: "Keep exploring here, then use Complete setup in dashboard to review your pages, add offerings, connect payments, and finish launch setup.",
1177
+ detail: "The dashboard is the place to complete the remaining checklist and get your site ready to launch.",
1178
+ checklistNote: "The remaining launch steps are tracked in the same checklist you will see in the dashboard."
1179
+ },
1180
+ dashboard_resume: {
1181
+ title: "Your draft site is ready",
1182
+ description: "Keep exploring here, then use Complete setup in dashboard to review your pages, add offerings, connect payments, and finish launch setup.",
1183
+ detail: "The dashboard is the normal place to finish setup for this site.",
1184
+ checklistNote: "The remaining launch steps are tracked in the same checklist you will see in the dashboard."
1185
+ }
1186
+ },
1187
+ dialog: {
1188
+ title: "What still happens in the dashboard",
1189
+ description: "Your preview is ready, but launch steps still happen in the dashboard so you can finish setup safely.",
1190
+ pendingIntro: "Your preview is live now, but the launch checklist stays in the dashboard so the final setup steps happen in the right place.",
1191
+ unlockedIntro: "Your preview is live now, and the same checklist will follow you into the dashboard when you are ready to finish setup.",
1192
+ outro: "You can keep exploring this preview now, then jump back into the dashboard when you're ready to finish setup."
1193
+ }
1194
+ },
1195
+ sidebar: {
1196
+ tone: "default",
1197
+ rootClassName: "bg-background",
1198
+ headerClassName: "border-b",
1199
+ guidance: {
1200
+ title: "Make quick edits in preview",
1201
+ description: "Use preview for copy and layout tweaks. Complete setup in dashboard to add offerings, connect payments, and finish the rest of your launch checklist.",
1202
+ ctaLabel: "Complete setup in dashboard",
1203
+ cardClassName: "rounded-lg border border-emerald-200/70 bg-emerald-50/70 px-3 py-3"
1204
+ }
1205
+ }
1206
+ },
1207
+ macadamia: {
1208
+ banner: {
1209
+ tone: "studio",
1210
+ bannerClassName: "border border-border bg-background shadow-xl",
1211
+ summaryClassName: "rounded-xl border border-border bg-surface px-3 py-2 text-xs text-foreground",
1212
+ dialogItemClassName: "rounded-xl border border-border bg-surface px-3 py-2",
1213
+ titleClassName: "text-sm font-semibold tracking-tight text-foreground [font-family:var(--font-heading)]",
1214
+ descriptionClassName: "text-sm text-muted-foreground [font-family:var(--font-body)]",
1215
+ detailClassName: "text-xs text-muted-foreground [font-family:var(--font-body)]",
1216
+ summaryTitleClassName: "font-medium text-foreground [font-family:var(--font-body)]",
1217
+ summaryBodyClassName: "mt-1 text-muted-foreground [font-family:var(--font-body)]",
1218
+ secondaryButtonClassName: "border border-border bg-surface text-foreground hover:bg-button-outline-hover",
1219
+ primaryButtonClassName: "border border-primary bg-primary text-primary-foreground hover:bg-primary-hover",
1220
+ dialogBodyClassName: "space-y-3 text-sm text-muted-foreground [font-family:var(--font-body)]",
1221
+ dialogItemTitleClassName: "font-medium text-foreground [font-family:var(--font-heading)]",
1222
+ dialogItemMetaClassName: "ml-2 text-xs font-normal uppercase tracking-wide text-muted-foreground [font-family:var(--font-body)]",
1223
+ dialogItemDescriptionClassName: "mt-1 text-sm text-muted-foreground [font-family:var(--font-body)]",
1224
+ ctaLabel: "Complete setup in Macadamia",
1225
+ copyByState: {
1226
+ awaiting_confirmation: {
1227
+ title: "Confirm your email to carry on",
1228
+ description: "We've created the bones of your site. To carry on finishing setup, and to edit your site, you need to confirm your email to activate your account.",
1229
+ detail: "",
1230
+ checklistNote: ""
1231
+ },
1232
+ dashboard_ready: {
1233
+ title: "Here's your site preview",
1234
+ description: "We've created the bones of your site. Have a look around. If you like, you can add your site content here, or you can go straight to your dashboard to complete your setup. You'll be able to edit your site at any time, so don't worry if it's not perfect right now.",
1235
+ detail: "",
1236
+ checklistNote: ""
1237
+ },
1238
+ dashboard_resume: {
1239
+ title: "Your studio site is ready",
1240
+ description: "Keep exploring here, then use Complete setup in Macadamia to review your pages, add offerings, connect payments, and finish launch setup.",
1241
+ detail: "Macadamia is the normal place to finish setup for this studio site.",
1242
+ checklistNote: "The remaining launch steps are tracked in the same checklist you will see in Macadamia."
1243
+ }
1244
+ },
1245
+ dialog: {
1246
+ title: "What still happens in Macadamia",
1247
+ description: "Your preview is ready, but launch steps still happen in Macadamia so you can finish setup safely.",
1248
+ pendingIntro: "Your studio preview is live now, but the launch checklist stays in Macadamia so the final setup steps happen in the right place.",
1249
+ unlockedIntro: "Your studio preview is live now, and the same checklist will follow you into Macadamia when you are ready to finish setup.",
1250
+ outro: "You can keep exploring this preview now, then jump back into Macadamia when you're ready to finish setup."
1251
+ }
1252
+ },
1253
+ sidebar: {
1254
+ tone: "studio",
1255
+ rootClassName: "bg-stone-50/80",
1256
+ headerClassName: "border-b border-amber-200/70 bg-amber-50/70",
1257
+ guidance: {
1258
+ title: "Polish your studio preview",
1259
+ description: "Use preview for copy and layout tweaks. Complete setup in Macadamia to add offerings, connect payments, and finish the rest of your launch checklist.",
1260
+ ctaLabel: "Complete setup in Macadamia",
1261
+ cardClassName: "rounded-2xl border border-amber-200/80 bg-gradient-to-br from-amber-50 via-white to-orange-50 px-4 py-4 shadow-sm"
1262
+ }
1263
+ }
1264
+ }
1265
+ };
1266
+ function getPreviewChromeSurfacePolicy(surfaceId) {
1267
+ return PREVIEW_CHROME_SURFACE_POLICIES[surfaceId];
1268
+ }
1269
+ function resolvePreviewSetupBannerModel(input) {
1270
+ if (!input.bannerState) return null;
1271
+ const policy = getPreviewChromeSurfacePolicy(input.surfaceId).banner;
1272
+ return {
1273
+ tone: policy.tone,
1274
+ bannerClassName: policy.bannerClassName,
1275
+ summaryClassName: policy.summaryClassName,
1276
+ dialogItemClassName: policy.dialogItemClassName,
1277
+ titleClassName: policy.titleClassName,
1278
+ descriptionClassName: policy.descriptionClassName,
1279
+ detailClassName: policy.detailClassName,
1280
+ summaryTitleClassName: policy.summaryTitleClassName,
1281
+ summaryBodyClassName: policy.summaryBodyClassName,
1282
+ secondaryButtonClassName: policy.secondaryButtonClassName,
1283
+ primaryButtonClassName: policy.primaryButtonClassName,
1284
+ dialogBodyClassName: policy.dialogBodyClassName,
1285
+ dialogItemTitleClassName: policy.dialogItemTitleClassName,
1286
+ dialogItemMetaClassName: policy.dialogItemMetaClassName,
1287
+ dialogItemDescriptionClassName: policy.dialogItemDescriptionClassName,
1288
+ ctaLabel: policy.ctaLabel,
1289
+ copy: policy.copyByState[input.bannerState],
1290
+ dialogTitle: policy.dialog.title,
1291
+ dialogDescription: policy.dialog.description,
1292
+ dialogIntro: input.dashboardUnlocked ? policy.dialog.unlockedIntro : policy.dialog.pendingIntro,
1293
+ dialogOutro: policy.dialog.outro
1294
+ };
1295
+ }
1296
+ function resolvePreviewSidebarChromeModel(surfaceId) {
1297
+ const policy = getPreviewChromeSurfacePolicy(surfaceId).sidebar;
1298
+ return {
1299
+ tone: policy.tone,
1300
+ rootClassName: policy.rootClassName,
1301
+ headerClassName: policy.headerClassName
1302
+ };
1303
+ }
1304
+ function resolvePreviewEditorGuidanceModel(input) {
1305
+ if (!input.canEdit || !input.hasDashboardSetupHandoff) return null;
1306
+ const policy = getPreviewChromeSurfacePolicy(input.surfaceId).sidebar;
1307
+ return {
1308
+ tone: policy.tone,
1309
+ title: policy.guidance.title,
1310
+ description: policy.guidance.description,
1311
+ ctaLabel: policy.guidance.ctaLabel,
1312
+ cardClassName: policy.guidance.cardClassName
1313
+ };
1314
+ }
1315
+ //#endregion
1316
+ //#region ../preview-next/src/client/preview/sanitizeDashboardPath.ts
1317
+ function sanitizeDashboardPath(value) {
1318
+ if (!value) return null;
1319
+ const trimmed = value.trim();
1320
+ if (!trimmed || /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed)) return null;
1321
+ const normalized = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
1322
+ try {
1323
+ const parsed = new URL(normalized, "https://preview.local");
1324
+ return `${parsed.pathname}${parsed.search}${parsed.hash}`;
1325
+ } catch {
1326
+ return null;
1327
+ }
1328
+ }
1329
+ //#endregion
1330
+ //#region ../preview-next/src/client/preview/previewDashboardHandoff.ts
1331
+ function resolvePreviewDashboardSetupHandoffFromSearch(search) {
1332
+ const params = new URLSearchParams(search);
1333
+ if (params.get("preview_handoff") !== "dashboard_setup") return null;
1334
+ const dashboardPath = sanitizeDashboardPath(params.get("preview_dashboard"));
1335
+ if (!dashboardPath) return null;
1336
+ return {
1337
+ kind: "dashboard_setup",
1338
+ dashboardPath
1339
+ };
1340
+ }
1341
+ function resolvePreviewDashboardSetupHandoff() {
1342
+ if (typeof window === "undefined") return null;
1343
+ return resolvePreviewDashboardSetupHandoffFromSearch(window.location.search);
1344
+ }
1345
+ function buildPreviewDashboardSetupUrl(dashboardBaseUrl, handoff) {
1346
+ if (!dashboardBaseUrl || !handoff) return null;
1347
+ return new URL(handoff.dashboardPath, dashboardBaseUrl).toString();
1348
+ }
1349
+ //#endregion
1350
+ //#region ../preview-next/src/client/preview/siteStyleAccess.ts
1351
+ function resolveSiteStyleAccess(session) {
1352
+ if (session?.kind === "userSession" && session.canEdit) return { kind: "apply-allowed" };
1353
+ return { kind: "hidden" };
1354
+ }
1355
+ function canInspectSiteStyle(access) {
1356
+ return access.kind === "apply-allowed";
1357
+ }
1358
+ //#endregion
1359
+ export { CustomizeBackgroundColorPicker as A, pageDesignLookPosition as C, formatTokenLabel as D, BackgroundPreviewSwatch as E, usePreviewBlockCustomizeSelectionOptional as M, gradientLabel as O, cyclePageDesignBlockLook as S, BackgroundChooser as T, lookIsAutomatic as _, sanitizeDashboardPath as a, useArrangementToolbar as b, resolvePreviewSidebarChromeModel as c, useBlockCustomizeControls as d, ArrangementLookNote as f, LookCyclePill as g, ArrangementOptionsBody as h, resolvePreviewDashboardSetupHandoff as i, PreviewBlockCustomizeSelectionProvider as j, readBackgroundColorPaletteSnapshot as k, PreviewSiteFontStorageProvider as l, ArrangementModeSwitchPill as m, resolveSiteStyleAccess as n, resolvePreviewEditorGuidanceModel as o, ArrangementLookPill as p, buildPreviewDashboardSetupUrl as r, resolvePreviewSetupBannerModel as s, canInspectSiteStyle as t, usePreviewSiteFontStorageUrl as u, lookPosition as v, setPageDesignBlockBackground as w, CustomizeBackgroundControlRows as x, lookPositionLabel as y };