@riverbankcms/sdk 0.180.0 → 0.182.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 (232) hide show
  1. package/dist/_dts/{BlocksIslandsHydrator-DC_AvZwy.d.ts → BlocksIslandsHydrator-Bvw2bUif.d.ts} +1 -1
  2. package/dist/_dts/{Page-DQOxVtp3.d.ts → Page-B2EAT-bE.d.ts} +7 -7
  3. package/dist/_dts/{SdkPreviewMode-DrLgY9_f.d.ts → SdkPreviewMode-D0vww6rh.d.ts} +2 -2
  4. package/dist/_dts/{client-BP7VBRvs.d.ts → client-D6T430bk.d.ts} +56 -70
  5. package/dist/_dts/{content-types-1-K2qi__.d.ts → content-types-wZVWccC6.d.ts} +2 -2
  6. package/dist/_dts/{contracts-Dfqz0Tcu.d.ts → contracts-B-vtOcr8.d.ts} +3 -3
  7. package/dist/_dts/{generatePageMetadata-CSfAqmry.d.ts → generatePageMetadata-CxfwHE6z.d.ts} +2 -2
  8. package/dist/_dts/{index-BeM5Ylwf.d.ts → index-CEyYMhLJ.d.ts} +1 -2
  9. package/dist/_dts/{index-DQr358-m.d.ts → index-CQrb3Ccc.d.ts} +8 -8
  10. package/dist/_dts/{index-DCcxLa8p.d.ts → index-CciRW_w1.d.ts} +2 -2
  11. package/dist/_dts/{index-Blrw2oVk.d.ts → index-Cqxis-nv.d.ts} +1 -1
  12. package/dist/_dts/{index-CB5Csefo.d.ts → index-DIU-wL1M.d.ts} +2 -2
  13. package/dist/_dts/{index-DQBGwBPx.d.ts → index-DqPKdeTk.d.ts} +1 -1
  14. package/dist/_dts/{loadContent-BG2tLGXj.d.ts → loadContent-D0wrxiSp.d.ts} +7 -7
  15. package/dist/_dts/{request-P08l6mkr.d.ts → request-DEwxUSw8.d.ts} +2375 -883
  16. package/dist/_dts/{resolveBlockData-BDHc8lFs.d.ts → resolveBlockData-VaG_MYbN.d.ts} +5 -5
  17. package/dist/_dts/{resolvePageContent-Y3IZBbtL.d.ts → resolvePageContent-DTwklC_v.d.ts} +1 -1
  18. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  19. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  20. package/dist/_dts/sdk/src/client.d.ts +7 -7
  21. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  22. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  23. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  24. package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
  25. package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
  26. package/dist/_dts/sdk/src/data/types.d.ts +2 -2
  27. package/dist/_dts/sdk/src/gifting/client.d.ts +1 -2
  28. package/dist/_dts/sdk/src/index.d.ts +104 -8
  29. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  30. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  31. package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
  32. package/dist/_dts/sdk/src/next/index.d.ts +83 -52
  33. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  34. package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
  35. package/dist/_dts/sdk/src/portal/client.d.ts +43 -56
  36. package/dist/_dts/sdk/src/portal/index.d.ts +3 -18
  37. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  38. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  39. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  40. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  41. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  42. package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
  43. package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
  44. package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
  45. package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
  46. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  47. package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
  48. package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
  49. package/dist/_dts/sdk/src/routing/index.d.ts +6 -6
  50. package/dist/_dts/sdk/src/server.d.ts +5 -5
  51. package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
  52. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  53. package/dist/_dts/{serviceBookingOutline-BvtNagjw.d.ts → serviceBookingOutline-DtQuFlID.d.ts} +6 -6
  54. package/dist/_dts/{types-DpEAnP4F.d.ts → types-B3RjeBLV.d.ts} +2 -2
  55. package/dist/_dts/{types-HAy1-Jjo.d.ts → types-BvUSGQrw.d.ts} +3 -3
  56. package/dist/_dts/{types-BrK6SS5c.d.ts → types-CkRFtBqd.d.ts} +7 -7
  57. package/dist/_dts/{validation-D6q3tOBA.d.ts → validation-BZA3DhcV.d.ts} +4 -4
  58. package/dist/client/{BlocksIslandsHydrator-DJSmdNUJ.mjs → BlocksIslandsHydrator-CQMf0HdN.mjs} +19 -19
  59. package/dist/client/{BookingMailingListNote-CGxg37zx.mjs → BookingMailingListNote-7kdvuPow.mjs} +93 -18
  60. package/dist/client/{BookingQuestionFields-DXegGSnS.mjs → BookingQuestionFields-BJI7mZuV.mjs} +7 -87
  61. package/dist/client/CalendarAction-D_Glwvz2.mjs +105 -0
  62. package/dist/client/{CalendarNavigationChevron-VfP50sYm.mjs → CalendarNavigationChevron-DPUD6wjy.mjs} +8 -8
  63. package/dist/client/{CheckboxChoice-BZPLCgTU.mjs → CheckboxChoice-C8i4NraK.mjs} +1 -1
  64. package/dist/client/{DemoBookingPortalAccess-0Ua44F1j.mjs → DemoBookingPortalAccess-8kwNF9HN.mjs} +9 -6
  65. package/dist/client/{EventCalendar.client-CrpiyDSP.mjs → EventCalendar.client-Dhb14bcC.mjs} +10 -10
  66. package/dist/client/{EventCombined.client-D0me9wnz.mjs → EventCombined.client-C1jEZBN9.mjs} +60 -10
  67. package/dist/client/{EventEmbeddedCheckoutStep-BDnicDM6.mjs → EventEmbeddedCheckoutStep-BGkbUhuw.mjs} +1 -1
  68. package/dist/client/{EventItem-CJITrGkF.mjs → EventItem-Bb0ppG2N.mjs} +9 -177
  69. package/dist/client/{EventListWeekNavigation-BlEm_xjq.mjs → EventListWeekNavigation-DMryCaNV.mjs} +1 -1
  70. package/dist/client/{EventListing.client-BNM_HuS0.mjs → EventListing.client-BuH5kKA3.mjs} +3 -3
  71. package/dist/client/{EventListing.view-CXfb7RRy.mjs → EventListing.view-DsqvuulZ.mjs} +8 -8
  72. package/dist/client/{EventRegistrationPayment-DiD9uYs6.mjs → EventRegistrationPayment-D4FvQSFF.mjs} +555 -502
  73. package/dist/client/{Page-bX7iy_MK.mjs → Page-sV6BJkXX.mjs} +550 -339
  74. package/dist/client/{ProtectedSubmitButton-De6AzhE6.mjs → ProtectedSubmitButton-BNnKuir8.mjs} +1 -1
  75. package/dist/client/{SiteTermsAgreementField-BAdW5DvE.mjs → SiteTermsAgreementField-VfSd6JU-.mjs} +7 -11
  76. package/dist/client/{StepIndicator-DCfdcb7s.mjs → StepIndicator-B6o5B7g3.mjs} +1 -1
  77. package/dist/client/{StepIndicator-DCqorVne.mjs → StepIndicator-BTqO7cJl.mjs} +235 -26
  78. package/dist/client/{ThemedButton-CnSa7o-I.mjs → ThemedButton-PFOhXktM.mjs} +1 -33
  79. package/dist/client/{accessibleSurfaces-Wl8-_OVJ.mjs → accessibleSurfaces-BogaGutk.mjs} +983 -634
  80. package/dist/client/{accordion-wofJY8xY.mjs → accordion-6cuswD_s.mjs} +1 -1
  81. package/dist/client/{booking-form.client-CYl9NrqS.mjs → booking-form.client-BOMe_SKi.mjs} +52 -29
  82. package/dist/client/bookingCalendar--aWnqFDn.mjs +180 -0
  83. package/dist/client/{bookingForm-kgVWtuMe.mjs → bookingForm-DSCH-VHo.mjs} +4 -4
  84. package/dist/client/bookings.mjs +17 -11
  85. package/dist/client/{boxStyleClassNames-CQHWz5gJ.mjs → boxStyleClassNames-BFuqZCfz.mjs} +2 -2
  86. package/dist/client/{carousel-BE1dEFsD.mjs → carousel-CGyQVV1M.mjs} +2 -2
  87. package/dist/client/{carousel.client-DMtGYTTM.mjs → carousel.client-BtLwHefX.mjs} +1 -1
  88. package/dist/client/{cart-BsjsdGZE.mjs → cart-BYOe7MCh.mjs} +3 -3
  89. package/dist/client/{cart.client-DylGUWXY.mjs → cart.client-BKFkaXdV.mjs} +1 -1
  90. package/dist/client/{checkout-B5KxEUDr.mjs → checkout-Dwd7Di77.mjs} +3 -3
  91. package/dist/client/{checkout.client-C98fhch3.mjs → checkout.client-C25hpi-z.mjs} +1 -1
  92. package/dist/client/{checkoutUrls-BMLYTf38.mjs → checkoutUrls-tG788sw0.mjs} +1 -1
  93. package/dist/client/client.mjs +106 -43
  94. package/dist/client/{constants-PfYJsEZF.mjs → constants-DdxFG3Ic.mjs} +1 -2
  95. package/dist/client/{context-DtKdUdkO.mjs → context-Hi1RuYEM.mjs} +753 -373
  96. package/dist/client/{dateFormatting-BaGPvQS3.mjs → dateFormatting-C8vBCHuo.mjs} +15 -25
  97. package/dist/client/{demoPortalMagicLink-B8eDjhuG.mjs → demoPortalMagicLink-BAL5UIDG.mjs} +2 -3
  98. package/dist/client/{enhanceHeaderSection-DvhD-8eE.mjs → enhanceHeaderSection-Dv1Lr9kJ.mjs} +4 -5
  99. package/dist/client/{event-registration.client-Du9a_xAN.mjs → event-registration.client-dB_Z7bb-.mjs} +191 -210
  100. package/dist/client/{eventCalendar-Di9wDfzl.mjs → eventCalendar-CQnRA4Ww.mjs} +4 -4
  101. package/dist/client/{eventCombined-CNW6nBsB.mjs → eventCombined-BDOG1hVp.mjs} +4 -4
  102. package/dist/client/{eventListing-CQMxQ8By.mjs → eventListing-DSVmhy9n.mjs} +4 -4
  103. package/dist/client/{eventRegistration-CprS9k1D.mjs → eventRegistration-CD5mRtEH.mjs} +4 -4
  104. package/dist/client/{form-Zl1_8RJ6.mjs → form-DWnlEVSK.mjs} +3 -3
  105. package/dist/client/{form.client-TaMUys6I.mjs → form.client-D7zmeqNI.mjs} +5 -5
  106. package/dist/client/{form.parts-CpNPbPPM.mjs → form.parts-C-G6N_MK.mjs} +3 -3
  107. package/dist/client/gifting/client.mjs +32 -29
  108. package/dist/client/{gifting-DNVa7-Wj.mjs → gifting-Cn0jidP5.mjs} +4 -4
  109. package/dist/client/{gifting.client-CFUq3GVx.mjs → gifting.client-DVo1YFLs.mjs} +5 -5
  110. package/dist/client/{gifting.parts-CDQvxA4A.mjs → gifting.parts-Bak93gD2.mjs} +2 -2
  111. package/dist/client/{headerSection-Cg6083rn.mjs → headerSection-DjQuj_6v.mjs} +2 -2
  112. package/dist/client/{mediaAssets-B99AP7ai.mjs → mediaAssets-COfQolI3.mjs} +1 -1
  113. package/dist/client/{mediaContext-Fusweriw.mjs → mediaContext-DzvnjYXm.mjs} +1 -1
  114. package/dist/client/{newsletter-form.client-VuL9I96G.mjs → newsletter-form.client-rIYPziZC.mjs} +7 -7
  115. package/dist/client/{newsletter-form.interactive-7Of3eYn0.mjs → newsletter-form.interactive-DVt3enLr.mjs} +181 -155
  116. package/dist/client/{newsletter-form.parts-OBqsfT24.mjs → newsletter-form.parts-CH6dGfdn.mjs} +2 -2
  117. package/dist/client/{newsletterForm-BkJe_RTv.mjs → newsletterForm-Cg8cBDHd.mjs} +3 -3
  118. package/dist/client/{lookSurfaces-gJ3OqPf9.mjs → noop-jesvJXEE.mjs} +403 -275
  119. package/dist/client/portal/client.mjs +12202 -7166
  120. package/dist/client/portalOrders-oEoTvzkW.mjs +596 -0
  121. package/dist/client/portalRoutes-ByyVZfVq.mjs +873 -0
  122. package/dist/client/{product-detail.client-B2hdxqJN.mjs → product-detail.client-5aHq-vuu.mjs} +1 -1
  123. package/dist/client/{product-list.client-CCEgu9rx.mjs → product-list.client-CyAk5rnC.mjs} +1 -1
  124. package/dist/client/{productDetail-CRX_ZRfS.mjs → productDetail-B8aZ2mqY.mjs} +3 -3
  125. package/dist/client/{productList-BAdJ6z5S.mjs → productList-BuLemmod.mjs} +3 -3
  126. package/dist/client/{propsDecoder-BLKAmX0S.mjs → propsDecoder-0Unsqn3R.mjs} +2 -2
  127. package/dist/client/{registry.server-Bj9cmHHF.mjs → registry.server-DzvtVVD0.mjs} +664 -434
  128. package/dist/client/{renderableMediaAssetAdmission-BlfqYLJW.mjs → renderableMediaAssetAdmission-BsOWd9lf.mjs} +1 -1
  129. package/dist/client/rendering/client.mjs +26 -26
  130. package/dist/client/rendering/islands.mjs +1 -1
  131. package/dist/client/rendering.mjs +16 -8
  132. package/dist/client/{richText-coerce-Z45OLLEX.mjs → richText-coerce-Bnng7JFA.mjs} +2 -1
  133. package/dist/client/{routeIslandApiConfig-DHpTTK77.mjs → routeIslandApiConfig-BGfcc9sk.mjs} +1 -1
  134. package/dist/client/{runtimeResponse-DtWSfWSZ.mjs → runtimeResponse-DAPVRToN.mjs} +1 -1
  135. package/dist/client/{runtimeResponse-D2j2-mOk.mjs → runtimeResponse-nXT8VAMl.mjs} +1 -1
  136. package/dist/client/{shop-BKsgxm_-.mjs → shop-GuMqnDL-.mjs} +3 -3
  137. package/dist/client/{shop-commerce-Cbtk_kUW.mjs → shop-commerce-D5bDY1o1.mjs} +53 -16
  138. package/dist/client/{shop-commerce-store-B-rv2p5h.mjs → shop-commerce-store-B7sHnLwI.mjs} +22 -5
  139. package/dist/client/{shop-discount-apply.state-CiCDLNh7.mjs → shop-discount-apply.state-Dos2zdC2.mjs} +2 -2
  140. package/dist/client/{shop.client-Rnqa74Tk.mjs → shop.client-uvj5GDZb.mjs} +17 -39
  141. package/dist/client/{shopShared-BaBfhjCq.mjs → shopShared-3giNWE3H.mjs} +2 -2
  142. package/dist/client/spam-protection.mjs +1 -1
  143. package/dist/client/src-Al4ooTl_.mjs +164 -0
  144. package/dist/client/{src-o7WEvbK1.mjs → src-CmXh3JWs.mjs} +233 -91
  145. package/dist/client/{timetableModel-BOff1Kk5.mjs → timetableModel-GA-hn1qM.mjs} +11 -87
  146. package/dist/client/{shop-add-feedback-DvC2kP1K.mjs → urlParams-C2QHo1Pa.mjs} +1 -42
  147. package/dist/client/{useAvailableSlots-DQJNh10g.mjs → useAvailableSlots-CBneCxbG.mjs} +2 -3
  148. package/dist/client/{useDiscountCodeUi-BcFQRI_7.mjs → useDiscountCodeUi-D0kGF0C7.mjs} +1 -1
  149. package/dist/client/{useEventPagination-BvdcexDC.mjs → useEventPagination-xX8n_Tuu.mjs} +8 -8
  150. package/dist/client/{view-CTBwSpKv.mjs → view-DOyZc-DF.mjs} +4 -4
  151. package/dist/client/{wizardSteps-CWIQyRIw.mjs → wizardSteps-B952ify5.mjs} +1241 -295
  152. package/dist/preview-next/client/{PageSectionToolbar-CG6KwITA.mjs → PageSectionToolbar-BI3UCdpu.mjs} +3 -3
  153. package/dist/preview-next/client/{PreviewEditorSidebar-BGBqrC9m.mjs → PreviewEditorSidebar-jkfLVOgY.mjs} +12 -9
  154. package/dist/preview-next/client/{PreviewEditorUI-Bwkyx28x.mjs → PreviewEditorUI-DwJQs4hM.mjs} +4 -4
  155. package/dist/preview-next/client/{PreviewShell-DB1l6JNU.mjs → PreviewShell-BAxAkuz8.mjs} +5 -5
  156. package/dist/preview-next/client/{SdkPreviewModeRuntime-Bs6Cwzr3.mjs → SdkPreviewModeRuntime-0UVB-39f.mjs} +68 -17
  157. package/dist/preview-next/client/{previewAssistantSlot-T-oDD_Dd.mjs → previewAssistantSlot-BgiYk3PB.mjs} +7347 -3516
  158. package/dist/preview-next/client/{previewChromeRoot-BeukcDRy.mjs → previewChromeRoot-tieNdF3E.mjs} +1 -1
  159. package/dist/preview-next/client/runtime.mjs +3 -3
  160. package/dist/preview-next/client/{sdk-runtime-ceDW_9q2.mjs → sdk-runtime-DXb_Evl0.mjs} +2 -2
  161. package/dist/preview-next/client/{siteStyleAccess-CCB9bScO.mjs → siteStyleAccess-BlN0jt2c.mjs} +3 -3
  162. package/dist/preview-next/client/{useAutosaveStatus-D4o0CKq7.mjs → useAutosaveStatus-BUEPA4oL.mjs} +1 -1
  163. package/dist/preview-next/client/{useOpenBlockForSetup-Seccrvwu.mjs → useOpenBlockForSetup-BVfr5P--.mjs} +1 -1
  164. package/dist/preview-next/container-responsive.css +203 -174
  165. package/dist/preview-next/keepAlive.mjs +1 -1
  166. package/dist/preview-next/middleware.mjs +1 -1
  167. package/dist/preview-next/{route-contract-FwFj8zGL.mjs → route-contract-BHTBA48n.mjs} +90 -37
  168. package/dist/server/{Block.shared-D6WrRCxX.mjs → Block.shared-hGoyEdjJ.mjs} +5 -5
  169. package/dist/server/{ThemeScopeCore-BQzjDQ2q.mjs → ThemeScopeCore-BfUCTOwj.mjs} +160 -142
  170. package/dist/server/{accessibleSurfaces-CM3QANtw.mjs → accessibleSurfaces-Dskni4Xj.mjs} +94 -330
  171. package/dist/server/accordions-By_0Ykks.mjs +111 -0
  172. package/dist/server/{bindings-CS6ih1Yc.mjs → bindings-DMJH4bvo.mjs} +7 -7
  173. package/dist/server/{client-m0ylCj_f.mjs → client-DrwlRNAH.mjs} +105 -42
  174. package/dist/server/config-validation.mjs +1 -1
  175. package/dist/server/config.mjs +2 -2
  176. package/dist/server/constants-CeMywaiD.mjs +1485 -0
  177. package/dist/server/{customCss-BZ8YSrQg.mjs → customCss-C9kgPHvr.mjs} +41 -5
  178. package/dist/server/data/resolveBlockData.mjs +1 -1
  179. package/dist/server/{resolveButtonColourStates--6yJp9Tq.mjs → expandPalette-ehuW8r2g.mjs} +745 -1229
  180. package/dist/server/index.mjs +3 -3
  181. package/dist/server/{loadContent-vgWMz1uD.mjs → loadContent-D0prFflT.mjs} +5 -4
  182. package/dist/server/{loadPage-CIOL3-9t.mjs → loadPage-CBLke9pJ.mjs} +3 -3
  183. package/dist/server/{lookMediaFrame-m-91jGGn.mjs → lookMediaFrame-H0fi4bJk.mjs} +38 -18
  184. package/dist/server/manifest.mjs +36 -25
  185. package/dist/server/{mapLocation-BM5WX7FY.mjs → mapLocation-MDDSubTp.mjs} +1 -1
  186. package/dist/server/media-BRmYrnzb.mjs +31 -0
  187. package/dist/server/{media-luf7RF22.mjs → media-gvfIw3z8.mjs} +2 -31
  188. package/dist/server/{navigation-BcNfYYuu.mjs → navigation-wrcuWmgp.mjs} +2 -2
  189. package/dist/server/navigation.mjs +1 -1
  190. package/dist/server/next.mjs +134 -81
  191. package/dist/server/{overrideResolution-BiHmsvTZ.mjs → overrideResolution-DUgCEH8z.mjs} +1 -1
  192. package/dist/server/page-converter.mjs +3 -3
  193. package/dist/server/{pageRenderPlan-DJo_obpi.mjs → pageRenderPlan-BHrmogsW.mjs} +165 -247
  194. package/dist/server/{pageRuntimeSupport-BnSuoHON.mjs → pageRuntimeSupport-D2-YMRei.mjs} +5 -5
  195. package/dist/server/{pageShared-BJuOzxzn.mjs → pageShared-CG8O31Eo.mjs} +3402 -3249
  196. package/dist/server/{parseThemeForPersistence-DOsfofCy.mjs → parseThemeForPersistence-CrPlbJEN.mjs} +3 -2
  197. package/dist/server/{portal-B4JVkdjc.mjs → portal-pG_uhsI2.mjs} +62 -46
  198. package/dist/server/portal.mjs +3 -3
  199. package/dist/server/portalQuestions-oUyohgL9.mjs +225 -0
  200. package/dist/server/{prebuild-Cr8p8T7V.mjs → prebuild-C8Amvzce.mjs} +1 -1
  201. package/dist/server/prebuild.mjs +1 -1
  202. package/dist/server/{prefetchBlockData-BZh57-ua.mjs → prefetchBlockData-BxUETRIZ.mjs} +4 -3
  203. package/dist/server/{registry-CvhFwbXJ.mjs → registry-Cc88-23f.mjs} +1514 -1190
  204. package/dist/server/rendering/components/pageShared.mjs +1 -1
  205. package/dist/server/rendering/helpers/loadPage.mjs +1 -1
  206. package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
  207. package/dist/server/rendering/server.mjs +4 -4
  208. package/dist/server/rendering.mjs +10 -9
  209. package/dist/server/{resolveBlockData-Cv_W1LVB.mjs → resolveBlockData-OG3KOkig.mjs} +2 -2
  210. package/dist/server/{responseMedia-KRKguBC5.mjs → responseMedia-IfH65QAH.mjs} +1 -1
  211. package/dist/server/{schema-BpsqaSSU.mjs → schema-CwfxQjc4.mjs} +10 -113
  212. package/dist/server/server.mjs +3 -3
  213. package/dist/server/{servicePageContent-CRKbTm_7.mjs → servicePageContent-BcFuhhD7.mjs} +22 -21
  214. package/dist/server/theme-bridge.mjs +34 -8
  215. package/dist/server/theme.mjs +2 -2
  216. package/dist/server/{three-pass-converter-39SXCCnh.mjs → three-pass-converter-DPaUPTfl.mjs} +34 -16
  217. package/dist/server/titleSourceSchema-NhK6azFS.mjs +2018 -0
  218. package/dist/server/typeGuards-CTW_9AXq.mjs +413 -0
  219. package/dist/server/types-BKaBZFjD.mjs +1085 -0
  220. package/dist/server/{validation-DCl-FCk_.mjs → validation-BovmbS8N.mjs} +70 -17
  221. package/dist/server/{version-DT_R5JAR.mjs → version-hws4hgyX.mjs} +1 -1
  222. package/dist/server/video-Cdr3wh-q.mjs +272 -0
  223. package/dist/styles/index.css +1098 -1885
  224. package/package.json +2 -1
  225. package/dist/_dts/index-B0_2-65A.d.ts +0 -101
  226. package/dist/client/TabBarFragment-DlKQRhP4.mjs +0 -56
  227. package/dist/client/checkoutRoute-DKlZRNZD.mjs +0 -22
  228. package/dist/client/creditProducts-BQ1t1erI.mjs +0 -266
  229. package/dist/client/formatDate-hhI1-tzt.mjs +0 -26
  230. package/dist/server/constants-Cj7hfbrA.mjs +0 -41
  231. package/dist/server/richTextSchema-QLaQrbII.mjs +0 -212
  232. package/dist/server/titleSourceSchema-Cu-3PRvv.mjs +0 -122
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { t as stableJsonStringify } from "./stable-json-D0XAEIXc.mjs";
3
- import { C as paletteModeSchema, O as VARIANT_ROLES, T as parseThemeColorToken, _ as hexColorSchema, c as buttonEffectApplicationSchema, h as PALETTE_TOKEN_NAMES, m as parseOpaqueButtonColourToken, n as STANDARD_BUTTON_SURFACE_POLICY, p as opaqueButtonColourTokenSchema, s as unsafeAsOpaqueButtonColourToken, u as buttonSystemSchema, w as parseColorTokenParts, x as paletteColorsFromEntries, y as normalizePaletteHex } from "./types-BEaKfam_.mjs";
3
+ import { C as paletteModeSchema, O as VARIANT_ROLES, T as parseThemeColorToken, _ as hexColorSchema, c as buttonEffectApplicationSchema, h as PALETTE_TOKEN_NAMES, m as parseOpaqueButtonColourToken, n as STANDARD_BUTTON_SURFACE_POLICY, p as opaqueButtonColourTokenSchema, s as unsafeAsOpaqueButtonColourToken, u as buttonSystemSchema, v as isThemeColorToken, w as parseColorTokenParts, x as paletteColorsFromEntries, y as normalizePaletteHex } from "./types-BEaKfam_.mjs";
4
4
  import { t as SURFACE_TRANSPORT_KEY } from "./surfaceTransportMarker-BuwkYxsI.mjs";
5
5
  import { z } from "zod";
6
6
  //#region ../theme-core/src/palette/utils/colorConversion.ts
@@ -231,6 +231,10 @@ function solidPaint(hex, index) {
231
231
  const y = hexLuminance(hex, index);
232
232
  return new Interval(y, y);
233
233
  }
234
+ /** The smallest paint covering every given paint: an ink that clears it clears each of them. */
235
+ function spanningPaint(first, ...rest) {
236
+ return rest.reduce((span, paint) => new Interval(paint.lo < span.lo ? paint.lo : span.lo, paint.hi > span.hi ? paint.hi : span.hi), first);
237
+ }
234
238
  function luminanceRatio(a, b) {
235
239
  return a >= b ? (a + .05) / (b + .05) : (b + .05) / (a + .05);
236
240
  }
@@ -246,8 +250,8 @@ function assertContrastRatio(ratio) {
246
250
  * The one black-or-white rule: literal black or white, whichever contrasts more
247
251
  * with the whole paint (black on a tie). It always returns, even when neither
248
252
  * reaches the ratio a caller wants; callers decide what a shortfall means.
249
- * A style's preferred neutral is a separate input (`neutralInk`) and never
250
- * part of this rule.
253
+ * A style's preferred neutral or the palette's own roles are separate inputs
254
+ * (`neutralInk`, `paletteInk`) that are tried before this rule, never part of it.
251
255
  */
252
256
  function maxContrastBlackOrWhite(paint) {
253
257
  const blackContrast = (paint.lo + .05) / .05;
@@ -260,6 +264,9 @@ function maxContrastBlackOrWhite(paint) {
260
264
  ratio: whiteContrast
261
265
  };
262
266
  }
267
+ function literalInkHex(ink) {
268
+ return ink === "black" ? "#000000" : "#FFFFFF";
269
+ }
263
270
  function contrastRatio(hex1, hex2, index) {
264
271
  const L1 = indexedLuminance(hex1, index);
265
272
  const L2 = indexedLuminance(hex2, index);
@@ -317,6 +324,314 @@ const paletteValueKeySchema = z.string().transform((value, ctx) => {
317
324
  return z.NEVER;
318
325
  });
319
326
  //#endregion
327
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/assertClassBrand.js
328
+ function _assertClassBrand(e, t, n) {
329
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
330
+ throw new TypeError("Private element is not present on this object");
331
+ }
332
+ //#endregion
333
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/classPrivateFieldSet2.js
334
+ function _classPrivateFieldSet2(s, a, r) {
335
+ return s.set(_assertClassBrand(s, a), r), r;
336
+ }
337
+ //#endregion
338
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/classPrivateFieldGet2.js
339
+ function _classPrivateFieldGet2(s, a) {
340
+ return s.get(_assertClassBrand(s, a));
341
+ }
342
+ //#endregion
343
+ //#region ../theme-core/src/palette/family.ts
344
+ var _members = /* @__PURE__ */ new WeakMap();
345
+ /**
346
+ * Only `colourFamily` makes one (the class is not exported), so a caller can't
347
+ * swap in its own members and still hand the solver a valid family. That
348
+ * matters because `unpaintable` relies on the members running from black to
349
+ * white.
350
+ */
351
+ var Family = class {
352
+ constructor(seed, members) {
353
+ this.seed = seed;
354
+ _classPrivateFieldInitSpec(this, _members, void 0);
355
+ _classPrivateFieldSet2(_members, this, Object.freeze(members));
356
+ }
357
+ /** Unique by hex, ascending luminance. Includes the exact seed, black and white. */
358
+ get members() {
359
+ return _classPrivateFieldGet2(_members, this);
360
+ }
361
+ };
362
+ const GAMUT_BISECTION_STEPS = 18;
363
+ /** The highest chroma at or below `c` that stays inside sRGB at this lightness and hue. */
364
+ function gamutChroma(l, c, h) {
365
+ if (inLinearSrgbGamut(oklchToLinearSrgb(l, c, h))) return c;
366
+ return Array.from({ length: GAMUT_BISECTION_STEPS }).reduce(({ lo, hi }) => {
367
+ const mid = (lo + hi) / 2;
368
+ return inLinearSrgbGamut(oklchToLinearSrgb(l, mid, h)) ? {
369
+ lo: mid,
370
+ hi
371
+ } : {
372
+ lo,
373
+ hi: mid
374
+ };
375
+ }, {
376
+ lo: 0,
377
+ hi: c
378
+ }).lo;
379
+ }
380
+ function oklabDistance(a, b) {
381
+ return Math.hypot(a.L - b.L, a.a - b.a, a.b - b.b);
382
+ }
383
+ /** OKLab distance between two rendered opaque hex colours. */
384
+ function hexOklabDistance(first, second) {
385
+ const lab = (hex) => {
386
+ const { r, g, b } = hexToRgb(hex);
387
+ return srgbToOklab(r, g, b);
388
+ };
389
+ return oklabDistance(lab(first), lab(second));
390
+ }
391
+ function colourFamily(seedHex) {
392
+ if (!/^#[0-9a-f]{6}$/i.test(seedHex)) throw new Error(`Expected an opaque #rrggbb colour: ${seedHex}`);
393
+ const features = featuresFromHex(seedHex.toLowerCase());
394
+ const seed = member(seedHex.toLowerCase(), {
395
+ l: features.okL,
396
+ c: features.okC,
397
+ h: features.okH
398
+ });
399
+ const seedTaper = Math.max(.001, Math.sin(Math.PI * seed.sample.l));
400
+ const samples = Array.from({ length: 513 }, (_, i) => {
401
+ const l = i / 512;
402
+ return sampleMember({
403
+ l,
404
+ c: gamutChroma(l, seed.sample.c * Math.min(1, Math.sin(Math.PI * l) / seedTaper), seed.sample.h),
405
+ h: seed.sample.h
406
+ });
407
+ });
408
+ return new Family(seed, [...new Map([seed, ...samples].map((candidate) => [candidate.hex, candidate]).reverse()).values()].sort((a, b) => a.y - b.y || (a.hex < b.hex ? -1 : a.hex > b.hex ? 1 : 0)));
409
+ }
410
+ function sampleMember(sample) {
411
+ const { r, g, b } = oklchToLinearSrgb(sample.l, sample.c, sample.h);
412
+ return member(rgbToHex(linearToSrgb(r), linearToSrgb(g), linearToSrgb(b)), sample);
413
+ }
414
+ function member(hex, sample) {
415
+ const { r, g, b } = hexToRgb(hex);
416
+ return {
417
+ hex,
418
+ y: hexLuminance(hex),
419
+ oklab: srgbToOklab(r, g, b),
420
+ sample
421
+ };
422
+ }
423
+ //#endregion
424
+ //#region ../theme-core/src/palette/utils/inkSolver.ts
425
+ /**
426
+ * How far (OKLab ΔE) a brand colour drawn as ink may be nudged along its own
427
+ * family before it stops reading as that colour. Past this the caller uses
428
+ * neutral or palette text instead (Will, 2026-10-14).
429
+ */
430
+ const BRAND_INK_MAX_DELTA_E = .08;
431
+ /**
432
+ * The seed itself when it clears `paint`, otherwise the family member nearest
433
+ * the seed (OKLab ΔE) that clears. On a light ground that is darker, on a dark
434
+ * one lighter. A passing member further than `maxDistance` from the seed is
435
+ * refused as `too-far`, which is distinct from `unpaintable`: the family runs
436
+ * from black to white, so if no member clears, neither does black or white.
437
+ */
438
+ function inkFrom(family, paint, ratio, maxDistance = BRAND_INK_MAX_DELTA_E) {
439
+ assertContrastRatio(ratio);
440
+ if (!Number.isFinite(maxDistance) || maxDistance < 0) throw new RangeError(`Maximum ink distance must be finite and not negative: ${maxDistance}`);
441
+ const seedRatio = worstContrast(family.seed.y, paint);
442
+ if (seedRatio >= ratio) return {
443
+ kind: "ink",
444
+ hex: family.seed.hex,
445
+ ratio: seedRatio,
446
+ source: "exact"
447
+ };
448
+ const nearest = family.members.reduce((best, member) => {
449
+ const achieved = worstContrast(member.y, paint);
450
+ if (achieved < ratio) return best;
451
+ const distance = oklabDistance(member.oklab, family.seed.oklab);
452
+ return best === null || distance < best.distance ? {
453
+ hex: member.hex,
454
+ distance,
455
+ ratio: achieved
456
+ } : best;
457
+ }, null);
458
+ if (nearest === null) return {
459
+ kind: "unpaintable",
460
+ interval: paint,
461
+ ratio
462
+ };
463
+ if (nearest.distance > maxDistance) return {
464
+ kind: "too-far",
465
+ nearest: {
466
+ hex: nearest.hex,
467
+ distance: nearest.distance
468
+ },
469
+ maxDistance
470
+ };
471
+ return {
472
+ kind: "ink",
473
+ hex: nearest.hex,
474
+ ratio: nearest.ratio,
475
+ source: "family"
476
+ };
477
+ }
478
+ /**
479
+ * The one "preferred ink, else black or white" comparison. Of the candidates,
480
+ * the one with the most contrast against the whole paint wins if it reaches
481
+ * `ratio` (the earlier one on a tie); otherwise literal black or white by
482
+ * `maxContrastBlackOrWhite`; otherwise `unpaintable`. It's direction-neutral:
483
+ * a candidate pair of one dark and one light ink needs no light/dark branch.
484
+ */
485
+ function preferredOrLiteralInk(paint, ratio, candidates) {
486
+ assertContrastRatio(ratio);
487
+ const best = candidates.map((candidate) => ({
488
+ ...candidate,
489
+ ratio: worstContrast(hexLuminance(candidate.hex), paint)
490
+ })).reduce((winner, candidate) => winner === null || candidate.ratio > winner.ratio ? candidate : winner, null);
491
+ if (best !== null && best.ratio >= ratio) return {
492
+ kind: "candidate",
493
+ value: best.value,
494
+ ratio: best.ratio
495
+ };
496
+ const literal = maxContrastBlackOrWhite(paint);
497
+ return literal.ratio >= ratio ? {
498
+ kind: "literal",
499
+ ink: literal.ink,
500
+ ratio: literal.ratio
501
+ } : {
502
+ kind: "unpaintable",
503
+ interval: paint,
504
+ ratio
505
+ };
506
+ }
507
+ /**
508
+ * Neutral text for a paint. The style's preferred neutral wins when one of its
509
+ * pair clears (the higher-contrast one, dark on a tie); otherwise literal black
510
+ * or white by `maxContrastBlackOrWhite`; otherwise `unpaintable`.
511
+ */
512
+ function neutralInk(paint, ratio, preferred) {
513
+ const picked = preferredOrLiteralInk(paint, ratio, preferred ? [{
514
+ value: preferred.dark,
515
+ hex: preferred.dark
516
+ }, {
517
+ value: preferred.light,
518
+ hex: preferred.light
519
+ }] : []);
520
+ switch (picked.kind) {
521
+ case "candidate": return {
522
+ kind: "ink",
523
+ hex: picked.value,
524
+ ratio: picked.ratio,
525
+ source: "neutral"
526
+ };
527
+ case "literal": return {
528
+ kind: "ink",
529
+ hex: picked.ink === "black" ? "#000000" : "#ffffff",
530
+ ratio: picked.ratio,
531
+ source: "neutral"
532
+ };
533
+ case "unpaintable": return picked;
534
+ }
535
+ }
536
+ /** The palette's `background` and `text` as an ink pair, or null when either is missing or not a hex colour. */
537
+ function paletteInkRoles(palette) {
538
+ const background = hexColorSchema.safeParse(palette.background?.toLowerCase());
539
+ const text = hexColorSchema.safeParse(palette.text?.toLowerCase());
540
+ return background.success && text.success ? {
541
+ background: background.data,
542
+ text: text.data
543
+ } : null;
544
+ }
545
+ /**
546
+ * Palette text for a paint: of the palette's background and text, the one with
547
+ * more contrast against the whole paint when it reaches `ratio`; otherwise
548
+ * literal black or white; otherwise `unpaintable`. On a dark palette the
549
+ * background is the dark one, so the same rule mirrors with no mode branch.
550
+ */
551
+ function paletteInk(paint, roles, ratio = ORDINARY_TEXT_MIN_CONTRAST_RATIO) {
552
+ const picked = preferredOrLiteralInk(paint, ratio, roles ? ["text", "background"].map((role) => ({
553
+ value: {
554
+ role,
555
+ hex: roles[role]
556
+ },
557
+ hex: roles[role]
558
+ })) : []);
559
+ switch (picked.kind) {
560
+ case "candidate": return {
561
+ kind: "role",
562
+ ...picked.value,
563
+ ratio: picked.ratio
564
+ };
565
+ case "literal": return {
566
+ kind: "literal",
567
+ hex: literalInkHex(picked.ink),
568
+ ratio: picked.ratio
569
+ };
570
+ case "unpaintable": return picked;
571
+ }
572
+ }
573
+ /** Ordinary-text palette ink on one solid ground. Total: black or white always reaches 4.58:1 on a solid. */
574
+ function paletteInkOnSolid(groundHex, roles) {
575
+ const paint = solidPaint(groundHex);
576
+ const ink = paletteInk(paint, roles);
577
+ if (ink.kind !== "unpaintable") return ink;
578
+ const literal = maxContrastBlackOrWhite(paint);
579
+ return {
580
+ kind: "literal",
581
+ hex: literalInkHex(literal.ink),
582
+ ratio: literal.ratio
583
+ };
584
+ }
585
+ /**
586
+ * The ink as token emitters write it: the role's theme token, so CSS follows
587
+ * the palette's variables, or the literal hex.
588
+ */
589
+ function paletteInkToken(ink) {
590
+ if (ink.kind === "literal") return ink.hex;
591
+ if (!isThemeColorToken(ink.role)) throw new Error(`Palette ink role is not a theme token: ${ink.role}`);
592
+ return ink.role;
593
+ }
594
+ /**
595
+ * Secondary text that has to read on several grounds (a surface and the tinted
596
+ * cards laid on it). The full-strength ink is `preferred` when it reaches 4.5:1
597
+ * on every ground, otherwise the palette's ink over the same paint; the muted
598
+ * ink is then the faintest blend from the first ground toward it that still
599
+ * reaches 4.5:1 everywhere. When no ink reaches 4.5:1 on every ground (a light
600
+ * ground and a dark one together), it's `unpaintable` and the caller decides
601
+ * which grounds to give up, rather than receiving a colour that only claims to read.
602
+ */
603
+ function paletteMutedInk(grounds, preferred, roles) {
604
+ const [first, ...rest] = grounds;
605
+ const paint = spanningPaint(solidPaint(first), ...rest.map((ground) => solidPaint(ground)));
606
+ const contrast = (hex) => worstContrast(hexLuminance(hex), paint);
607
+ const passes = (hex) => contrast(hex) >= ORDINARY_TEXT_MIN_CONTRAST_RATIO;
608
+ const endpoint = preferred !== null && passes(preferred) ? {
609
+ kind: "preferred",
610
+ hex: preferred
611
+ } : paletteInk(paint, roles);
612
+ if (endpoint.kind === "unpaintable") return endpoint;
613
+ const start = hexToRgb(first);
614
+ const end = hexToRgb(endpoint.hex);
615
+ const sample = (index) => rgbToHex(mix$1(start.r, end.r, index / 100), mix$1(start.g, end.g, index / 100), mix$1(start.b, end.b, index / 100));
616
+ const firstPassing = (low, high) => {
617
+ if (low >= high) return high;
618
+ const middle = Math.floor((low + high) / 2);
619
+ return passes(sample(middle)) ? firstPassing(low, middle) : firstPassing(middle + 1, high);
620
+ };
621
+ const hex = sample(firstPassing(0, 100));
622
+ return {
623
+ kind: "muted",
624
+ hex,
625
+ ratio: contrast(hex)
626
+ };
627
+ }
628
+ /** The muted ink on one solid ground. Total: black or white always reaches 4.58:1 on a solid. */
629
+ function paletteMutedInkOnSolid(ground, preferred, roles) {
630
+ const ink = paletteMutedInk([ground], preferred, roles);
631
+ if (ink.kind === "unpaintable") throw new Error(`No muted ink reads on the solid ground ${ground}`);
632
+ return ink.hex;
633
+ }
634
+ //#endregion
320
635
  //#region ../theme-core/src/palette/utils/opaqueSurfaceColor.ts
321
636
  /** Resolve an opaque colour, compositing alpha against an explicit underlay. */
322
637
  function resolveOpaqueSurfaceHex(reference, palette, underlayReference) {
@@ -595,121 +910,6 @@ const BUTTON_VISUAL_STATES = [
595
910
  "disabled"
596
911
  ];
597
912
  //#endregion
598
- //#region ../theme-core/src/palette/generateShades.ts
599
- function generateShades(hexColor, name) {
600
- const shadeSteps = [
601
- 50,
602
- 100,
603
- 200,
604
- 300,
605
- 400,
606
- 500,
607
- 600,
608
- 700,
609
- 800,
610
- 900,
611
- 950
612
- ];
613
- const base = featuresFromHex(hexColor);
614
- const hue = base.okH;
615
- const baseChroma = base.okC;
616
- const toneMap = {
617
- 50: .975,
618
- 100: .945,
619
- 200: .89,
620
- 300: .82,
621
- 400: .74,
622
- 500: .66,
623
- 600: .58,
624
- 700: .49,
625
- 800: .4,
626
- 900: .28,
627
- 950: .16
628
- };
629
- const shadeDefs = shadeSteps.map((step, idx) => {
630
- const t = idx / (shadeSteps.length - 1);
631
- const L = toneMap[step];
632
- const C = baseChroma * (.06 + .94 * Math.sin(Math.PI * t));
633
- return {
634
- name: `${name}-${step}`,
635
- hex: oklchToHexGamut(L, C, hue)
636
- };
637
- });
638
- shadeDefs.push({
639
- name,
640
- hex: hexColor
641
- });
642
- return shadeDefs;
643
- }
644
- //#endregion
645
- //#region ../theme-core/src/palette/neutralScale.ts
646
- /**
647
- * A neutral scale from near-white (`neutral-50`) to near-black (`neutral-950`)
648
- * on every palette, light or dark. Readers that want "the ground" or "the
649
- * text" ask the palette for those roles, not a fixed end of this scale.
650
- */
651
- function generateNeutralScale({ steps = 11, warm = false } = {}) {
652
- const shadeNames = [
653
- 50,
654
- 100,
655
- 200,
656
- 300,
657
- 400,
658
- 500,
659
- 600,
660
- 700,
661
- 800,
662
- 900,
663
- 950
664
- ];
665
- const count = Math.min(steps, shadeNames.length);
666
- return shadeNames.slice(0, count).map((shadeName, index) => ({
667
- name: `neutral-${shadeName}`,
668
- hex: oklchToHexGamut(mix(.98, .1, index / (count - 1)), .02, warm ? 85 : 250)
669
- }));
670
- }
671
- function mix(a, b, t) {
672
- return a + (b - a) * Math.max(0, Math.min(1, t));
673
- }
674
- //#endregion
675
- //#region ../theme-core/src/palette/utils/textColor.ts
676
- /**
677
- * Pick the better of black/white text for a given background using actual
678
- * contrast ratios, not a simple luminance cutoff. This is
679
- * `maxContrastBlackOrWhite` for a solid ground.
680
- *
681
- * @param background - Background color in hex or rgb/rgba format (e.g., '#FFFFFF' or 'rgb(255, 255, 255)')
682
- * @param _minContrast - Kept for callers. It cannot change the result: when
683
- * only one of black or white reaches it, that one is also the better of the two.
684
- * @returns '#000000' for light backgrounds, '#FFFFFF' for dark backgrounds
685
- */
686
- function pickBlackOrWhiteTextColor(background, _minContrast = 4.5) {
687
- const { r, g, b } = parseColorToRgb(background);
688
- return maxContrastBlackOrWhite(luminanceInterval(relativeLuminance(r, g, b))).ink === "black" ? "#000000" : "#FFFFFF";
689
- }
690
- /**
691
- * Backwards-compatible alias for callers that want the best black/white text
692
- * color for a background.
693
- */
694
- function getTextColorForBackground(background) {
695
- return pickBlackOrWhiteTextColor(background);
696
- }
697
- function parseColorToRgb(input) {
698
- const trimmed = input.trim();
699
- if (trimmed.startsWith("#")) return hexToRgb(trimmed);
700
- const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/i);
701
- if (rgbMatch?.[1] && rgbMatch[2] && rgbMatch[3]) return {
702
- r: clamp255(Number(rgbMatch[1])),
703
- g: clamp255(Number(rgbMatch[2])),
704
- b: clamp255(Number(rgbMatch[3]))
705
- };
706
- throw new Error("Unsupported color format");
707
- }
708
- function clamp255(value) {
709
- if (Number.isNaN(value)) return 0;
710
- return Math.max(0, Math.min(255, value));
711
- }
712
- //#endregion
713
913
  //#region ../theme-core/src/palette/utils/onColor.ts
714
914
  const BACKGROUND_ROLE_NAMES = /* @__PURE__ */ new Set([
715
915
  "primary",
@@ -733,122 +933,12 @@ function isOnColorBackgroundCandidateToken(token) {
733
933
  return BACKGROUND_ROLE_NAMES.has(role);
734
934
  }
735
935
  //#endregion
736
- //#region ../theme-core/src/palette/expandPalette.ts
737
- function colorsToMap(palette) {
738
- const map = {};
739
- for (const c of palette.colors) map[c.name] = c.hex;
740
- return map;
741
- }
742
- const nonShadeablePaletteRoleNames = /* @__PURE__ */ new Set([
743
- "success",
744
- "warning",
745
- "destructive"
746
- ]);
747
- /**
748
- * Status role aliases the persisted palette does not carry itself.
749
- *
750
- * Generators reference `--tb-error` (the site-style-owned input error border)
751
- * and `--tb-info` (`.alert-info`, `.status-info`, the field-note rule), but the
752
- * palette schema only defines `destructive` and has no `info` role at all.
753
- * Without these aliases those declarations name variables that are never
754
- * defined and browsers drop them. The SDK bridge resolves the same pair via
755
- * TOKEN_ALIASES, so both runtimes agree on what a status token means.
756
- *
757
- * Runs after the danger → destructive promotion above, so `destructive` is
758
- * already the single source of truth for the error colour.
759
- */
760
- function statusAliasTokens(expanded) {
761
- const aliases = {};
762
- if (expanded.destructive) aliases.error = expanded.destructive;
763
- if (expanded.accent) aliases.info = expanded.accent;
764
- return aliases;
765
- }
766
- function expandPalette(palette, options = {}) {
767
- return {
768
- ...expandBasePalette(palette),
769
- ...arrangementPaletteTokens(colorsToMap(palette), options)
770
- };
771
- }
772
- function expandBasePalette(palette) {
773
- const base = colorsToMap(palette);
774
- const expanded = { ...base };
775
- generateNeutralScale({
776
- steps: 11,
777
- warm: false
778
- }).forEach((n) => {
779
- expanded[n.name] = n.hex;
780
- });
781
- for (const [name, hex] of Object.entries(base)) {
782
- if (nonShadeablePaletteRoleNames.has(name)) continue;
783
- if (hex) generateShades(hex, name).forEach((shade) => {
784
- expanded[shade.name] = shade.hex;
785
- });
786
- }
787
- if (base.text) expanded.body = base.text;
788
- if (base.danger && !base.destructive) expanded.destructive = base.danger;
789
- Object.assign(expanded, statusAliasTokens(expanded));
790
- expanded.mutedText = readableMutedText(expanded["neutral-500"] ?? "#888", base);
791
- for (const [token, hex] of Object.entries({ ...expanded })) {
792
- if (!hex || !isOnColorBackgroundCandidateToken(token)) continue;
793
- const onToken = onColorTokenName(token);
794
- if (expanded[onToken]) continue;
795
- expanded[onToken] = getTextColorForBackground(hex);
796
- }
797
- return expanded;
798
- }
799
- /**
800
- * The neutral step stays when it reads on the ground. Otherwise (a dark palette
801
- * on a mid-tone ground, or a tinted light one) it's the ground-to-text blend
802
- * with a 4.5:1 floor, heading for black or white when the text can't reach it.
803
- */
804
- function readableMutedText(step, base) {
805
- const ground = base.background || base.surface;
806
- if (!ground || contrastRatio(step, ground) >= 4.5) return step;
807
- return deriveSurfaceMutedColor(ground, base.text && contrastRatio(base.text, ground) >= 4.5 ? base.text : getTextColorForBackground(ground));
808
- }
809
- /** Derived decoration colours never become editable palette swatches. */
810
- function deriveSurfaceDecorationColors(ground, text, accent) {
811
- const ink = getTextColorForBackground(ground);
812
- return {
813
- line: firstContrastBlend(ground, text, ground, 1.5),
814
- mark: firstContrastBlend(accent, ink, ground, 3)
815
- };
816
- }
817
- /** Secondary ink is blended toward its ground, with an ordinary-text contrast floor. */
818
- function deriveSurfaceMutedColor(ground, text) {
819
- const start = hexToRgb(ground);
820
- const end = hexToRgb(text);
821
- const sample = (index) => rgbToHex(mix$1(start.r, end.r, index / 100), mix$1(start.g, end.g, index / 100), mix$1(start.b, end.b, index / 100));
822
- return firstSafeMutedSample(sample, ground, 0, 100);
823
- }
824
- /** The blend moves monotonically from the ground toward its validated ink. */
825
- function firstSafeMutedSample(sample, ground, low, high) {
826
- if (low === high) return sample(high);
827
- const middle = Math.floor((low + high) / 2);
828
- return contrastRatio(sample(middle), ground) >= 4.5 ? firstSafeMutedSample(sample, ground, low, middle) : firstSafeMutedSample(sample, ground, middle + 1, high);
829
- }
830
- function firstContrastBlend(from, to, ground, threshold) {
831
- const start = hexToRgb(from);
832
- const end = hexToRgb(to);
833
- return Array.from({ length: 101 }, (_, index) => {
834
- const amount = index / 100;
835
- return rgbToHex(mix$1(start.r, end.r, amount), mix$1(start.g, end.g, amount), mix$1(start.b, end.b, amount));
836
- }).find((hex) => contrastRatio(hex, ground) >= threshold) ?? to;
837
- }
838
- /** `markSource` names the colour surface marks are derived from when a style marks in its brand rather than its accent. */
839
- function arrangementPaletteTokens(base, options) {
840
- if (options.arrangement !== true || !base.text) return {};
841
- return {
842
- onText: getTextColorForBackground(base.text),
843
- ...options.marksFrom === "primary" && base.primary ? { markSource: base.primary } : {}
844
- };
845
- }
846
- //#endregion
847
936
  //#region ../theme-core/src/surfaces/inkCertificate.ts
848
937
  /**
849
938
  * The ink certificate: every colour the site paints text or a mark on is held to
850
939
  * its threshold here, on every backdrop it shows. An ink that misses takes the
851
- * black/white ink that clears all of them; inks that pass are kept as they are,
940
+ * palette ink that clears all of them (the site's background or text colour,
941
+ * else black or white); inks that pass are kept as they are,
852
942
  * so a palette that already passes paints exactly what it declared. It never
853
943
  * throws, because owner palettes are arbitrary.
854
944
  *
@@ -887,10 +977,16 @@ function inkClearsBackdrops(ink, threshold, backdrops, measurement) {
887
977
  return hex !== null && contrastRatio(hex, backdrop, measurement.colourIndex) >= threshold;
888
978
  });
889
979
  }
890
- /** The black/white ink that clears every backdrop at ordinary-text contrast, preferring the best one for the painted end. */
980
+ /** The palette ink that clears every backdrop at ordinary-text contrast, or null when not even black or white does. */
891
981
  function fallbackInk(backdrops, measurement) {
892
- const [endpoint] = backdrops.slice(-1);
893
- return [...endpoint ? [pickBlackOrWhiteTextColor(endpoint)] : [], ...FALLBACK_INKS].find((candidate) => inkClearsBackdrops(candidate, contrastThresholdByPolicy["body-aa"], backdrops, measurement)) ?? null;
982
+ const ys = backdrops.map((backdrop) => hexLuminance(backdrop, measurement.colourIndex));
983
+ if (ys.length === 0) return null;
984
+ const ink = paletteInk(luminanceInterval(Math.min(...ys), Math.max(...ys)), paletteInkRoles(measurement.palette), contrastThresholdByPolicy["body-aa"]);
985
+ return ink.kind === "unpaintable" ? null : paletteInkToken(ink);
986
+ }
987
+ /** One solid backdrop: total, because black or white always clears it. */
988
+ function solidFallbackInk(backdrop, measurement) {
989
+ return paletteInkToken(paletteInkOnSolid(backdrop, paletteInkRoles(measurement.palette)));
894
990
  }
895
991
  function failingInks(inks, backdrops, measurement) {
896
992
  return {
@@ -930,9 +1026,9 @@ function certifySolidSurfaceInks(inks, backdrop, measurement) {
930
1026
  ...inks,
931
1027
  fallback: []
932
1028
  };
933
- return replaceFailing(inks, failing, pickBlackOrWhiteTextColor(backdrop));
1029
+ return replaceFailing(inks, failing, solidFallbackInk(backdrop, measurement));
934
1030
  }
935
- /** Kept when the ink clears the threshold, otherwise the black/white ink, which always clears a solid backdrop. */
1031
+ /** Kept when the ink clears the threshold, otherwise the palette ink, which always clears a solid backdrop. */
936
1032
  function certifyPaint(place, ink, threshold, backdrop, measurement) {
937
1033
  return inkClearsBackdrops(ink, threshold, [backdrop], measurement) ? {
938
1034
  place,
@@ -942,7 +1038,7 @@ function certifyPaint(place, ink, threshold, backdrop, measurement) {
942
1038
  fallback: false
943
1039
  } : {
944
1040
  place,
945
- ink: pickBlackOrWhiteTextColor(backdrop),
1041
+ ink: solidFallbackInk(backdrop, measurement),
946
1042
  backdrop,
947
1043
  threshold,
948
1044
  fallback: true,
@@ -950,161 +1046,42 @@ function certifyPaint(place, ink, threshold, backdrop, measurement) {
950
1046
  };
951
1047
  }
952
1048
  //#endregion
953
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/assertClassBrand.js
954
- function _assertClassBrand(e, t, n) {
955
- if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
956
- throw new TypeError("Private element is not present on this object");
957
- }
958
- //#endregion
959
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/classPrivateFieldSet2.js
960
- function _classPrivateFieldSet2(s, a, r) {
961
- return s.set(_assertClassBrand(s, a), r), r;
962
- }
963
- //#endregion
964
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/classPrivateFieldGet2.js
965
- function _classPrivateFieldGet2(s, a) {
966
- return s.get(_assertClassBrand(s, a));
967
- }
968
- //#endregion
969
- //#region ../theme-core/src/palette/family.ts
970
- var _members = /* @__PURE__ */ new WeakMap();
1049
+ //#region ../theme-core/src/palette/utils/textColor.ts
971
1050
  /**
972
- * Only `colourFamily` makes one (the class is not exported), so a caller can't
973
- * swap in its own members and still hand the solver a valid family. That
974
- * matters because `unpaintable` relies on the members running from black to
975
- * white.
1051
+ * Pick the better of black/white text for a given background using actual
1052
+ * contrast ratios, not a simple luminance cutoff. This is
1053
+ * `maxContrastBlackOrWhite` for a solid ground. It is the literal fallback
1054
+ * only: where a palette is in scope, `paletteInkOnSolid` tries the site's own
1055
+ * background and text colours first.
1056
+ *
1057
+ * @param background - Background color in hex or rgb/rgba format (e.g., '#FFFFFF' or 'rgb(255, 255, 255)')
1058
+ * @param _minContrast - Kept for callers. It cannot change the result: when
1059
+ * only one of black or white reaches it, that one is also the better of the two.
1060
+ * @returns '#000000' for light backgrounds, '#FFFFFF' for dark backgrounds
976
1061
  */
977
- var Family = class {
978
- constructor(seed, members) {
979
- this.seed = seed;
980
- _classPrivateFieldInitSpec(this, _members, void 0);
981
- _classPrivateFieldSet2(_members, this, Object.freeze(members));
982
- }
983
- /** Unique by hex, ascending luminance. Includes the exact seed, black and white. */
984
- get members() {
985
- return _classPrivateFieldGet2(_members, this);
986
- }
987
- };
988
- const GAMUT_BISECTION_STEPS = 18;
989
- /** The highest chroma at or below `c` that stays inside sRGB at this lightness and hue. */
990
- function gamutChroma(l, c, h) {
991
- if (inLinearSrgbGamut(oklchToLinearSrgb(l, c, h))) return c;
992
- return Array.from({ length: GAMUT_BISECTION_STEPS }).reduce(({ lo, hi }) => {
993
- const mid = (lo + hi) / 2;
994
- return inLinearSrgbGamut(oklchToLinearSrgb(l, mid, h)) ? {
995
- lo: mid,
996
- hi
997
- } : {
998
- lo,
999
- hi: mid
1000
- };
1001
- }, {
1002
- lo: 0,
1003
- hi: c
1004
- }).lo;
1005
- }
1006
- function oklabDistance(a, b) {
1007
- return Math.hypot(a.L - b.L, a.a - b.a, a.b - b.b);
1062
+ function pickBlackOrWhiteTextColor(background, _minContrast = 4.5) {
1063
+ const { r, g, b } = parseColorToRgb(background);
1064
+ return literalInkHex(maxContrastBlackOrWhite(luminanceInterval(relativeLuminance(r, g, b))).ink);
1008
1065
  }
1009
- /** OKLab distance between two rendered opaque hex colours. */
1010
- function hexOklabDistance(first, second) {
1011
- const lab = (hex) => {
1012
- const { r, g, b } = hexToRgb(hex);
1013
- return srgbToOklab(r, g, b);
1066
+ function parseColorToRgb(input) {
1067
+ const trimmed = input.trim();
1068
+ if (trimmed.startsWith("#")) return hexToRgb(trimmed);
1069
+ const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/i);
1070
+ if (rgbMatch?.[1] && rgbMatch[2] && rgbMatch[3]) return {
1071
+ r: clamp255(Number(rgbMatch[1])),
1072
+ g: clamp255(Number(rgbMatch[2])),
1073
+ b: clamp255(Number(rgbMatch[3]))
1014
1074
  };
1015
- return oklabDistance(lab(first), lab(second));
1016
- }
1017
- function colourFamily(seedHex) {
1018
- if (!/^#[0-9a-f]{6}$/i.test(seedHex)) throw new Error(`Expected an opaque #rrggbb colour: ${seedHex}`);
1019
- const features = featuresFromHex(seedHex.toLowerCase());
1020
- const seed = member(seedHex.toLowerCase(), {
1021
- l: features.okL,
1022
- c: features.okC,
1023
- h: features.okH
1024
- });
1025
- const seedTaper = Math.max(.001, Math.sin(Math.PI * seed.sample.l));
1026
- const samples = Array.from({ length: 513 }, (_, i) => {
1027
- const l = i / 512;
1028
- return sampleMember({
1029
- l,
1030
- c: gamutChroma(l, seed.sample.c * Math.min(1, Math.sin(Math.PI * l) / seedTaper), seed.sample.h),
1031
- h: seed.sample.h
1032
- });
1033
- });
1034
- return new Family(seed, [...new Map([seed, ...samples].map((candidate) => [candidate.hex, candidate]).reverse()).values()].sort((a, b) => a.y - b.y || (a.hex < b.hex ? -1 : a.hex > b.hex ? 1 : 0)));
1035
- }
1036
- function sampleMember(sample) {
1037
- const { r, g, b } = oklchToLinearSrgb(sample.l, sample.c, sample.h);
1038
- return member(rgbToHex(linearToSrgb(r), linearToSrgb(g), linearToSrgb(b)), sample);
1075
+ throw new Error("Unsupported color format");
1039
1076
  }
1040
- function member(hex, sample) {
1041
- const { r, g, b } = hexToRgb(hex);
1042
- return {
1043
- hex,
1044
- y: hexLuminance(hex),
1045
- oklab: srgbToOklab(r, g, b),
1046
- sample
1047
- };
1077
+ function clamp255(value) {
1078
+ if (Number.isNaN(value)) return 0;
1079
+ return Math.max(0, Math.min(255, value));
1048
1080
  }
1049
1081
  //#endregion
1050
- //#region ../theme-core/src/palette/utils/inkSolver.ts
1051
- /**
1052
- * How far (OKLab ΔE) a brand colour drawn as ink may be nudged along its own
1053
- * family before it stops reading as that colour. Past this the caller uses
1054
- * neutral or palette text instead (Will, 2026-10-14).
1055
- */
1056
- const BRAND_INK_MAX_DELTA_E = .08;
1057
- /**
1058
- * The seed itself when it clears `paint`, otherwise the family member nearest
1059
- * the seed (OKLab ΔE) that clears. On a light ground that is darker, on a dark
1060
- * one lighter. A passing member further than `maxDistance` from the seed is
1061
- * refused as `too-far`, which is distinct from `unpaintable`: the family runs
1062
- * from black to white, so if no member clears, neither does black or white.
1063
- */
1064
- function inkFrom(family, paint, ratio, maxDistance = BRAND_INK_MAX_DELTA_E) {
1065
- assertContrastRatio(ratio);
1066
- if (!Number.isFinite(maxDistance) || maxDistance < 0) throw new RangeError(`Maximum ink distance must be finite and not negative: ${maxDistance}`);
1067
- const seedRatio = worstContrast(family.seed.y, paint);
1068
- if (seedRatio >= ratio) return {
1069
- kind: "ink",
1070
- hex: family.seed.hex,
1071
- ratio: seedRatio,
1072
- source: "exact"
1073
- };
1074
- const nearest = family.members.reduce((best, member) => {
1075
- const achieved = worstContrast(member.y, paint);
1076
- if (achieved < ratio) return best;
1077
- const distance = oklabDistance(member.oklab, family.seed.oklab);
1078
- return best === null || distance < best.distance ? {
1079
- hex: member.hex,
1080
- distance,
1081
- ratio: achieved
1082
- } : best;
1083
- }, null);
1084
- if (nearest === null) return {
1085
- kind: "unpaintable",
1086
- interval: paint,
1087
- ratio
1088
- };
1089
- if (nearest.distance > maxDistance) return {
1090
- kind: "too-far",
1091
- nearest: {
1092
- hex: nearest.hex,
1093
- distance: nearest.distance
1094
- },
1095
- maxDistance
1096
- };
1097
- return {
1098
- kind: "ink",
1099
- hex: nearest.hex,
1100
- ratio: nearest.ratio,
1101
- source: "family"
1102
- };
1103
- }
1104
- //#endregion
1105
- //#region ../theme-core/src/surfaces/surfaceInks.ts
1106
- /** Lines and focus rings are graphics: WCAG non-text contrast. */
1107
- const GRAPHIC_MIN_CONTRAST_RATIO = 3;
1082
+ //#region ../theme-core/src/surfaces/surfaceInks.ts
1083
+ /** Lines and focus rings are graphics: WCAG non-text contrast. */
1084
+ const GRAPHIC_MIN_CONTRAST_RATIO = 3;
1108
1085
  /**
1109
1086
  * The palette token the control edge ink is solved from. Input styles whose
1110
1087
  * border uses another token keep their own colour, since this ink would carry
@@ -1138,7 +1115,7 @@ const INK_SEEDS = {
1138
1115
  */
1139
1116
  function solveSurfaceInks(backdropHex, textInk, palette, candidates = {}) {
1140
1117
  const paint = solidPaint(backdropHex);
1141
- const fallback = literalInk(resolveConcreteColorHex(textInk, palette) ?? pickBlackOrWhiteTextColor(backdropHex));
1118
+ const fallback = literalInk$1(resolveConcreteColorHex(textInk, palette) ?? pickBlackOrWhiteTextColor(backdropHex));
1142
1119
  return {
1143
1120
  brand: solveInk({
1144
1121
  ...INK_SEEDS.brand,
@@ -1164,12 +1141,12 @@ function solveInk(seed, paint, palette, fallback) {
1164
1141
  if (!token || !seedHex.success) return fallback;
1165
1142
  const solved = inkFrom(familyOf(seedHex.data), paint, seed.ratio, seed.maxDistance);
1166
1143
  switch (solved.kind) {
1167
- case "ink": return solved.source === "exact" ? token : literalInk(solved.hex);
1144
+ case "ink": return solved.source === "exact" ? token : literalInk$1(solved.hex);
1168
1145
  case "too-far":
1169
1146
  case "unpaintable": return fallback;
1170
1147
  }
1171
1148
  }
1172
- function literalInk(hex) {
1149
+ function literalInk$1(hex) {
1173
1150
  return hexColorSchema.parse(hex.toLowerCase());
1174
1151
  }
1175
1152
  const FAMILY_CACHE_LIMIT = 64;
@@ -1184,14 +1161,6 @@ function familyOf(seed) {
1184
1161
  }
1185
1162
  //#endregion
1186
1163
  //#region ../theme-core/src/surfaces/resolveSurfaceForeground.ts
1187
- const FALLBACK_TEXT_TOKENS = [
1188
- "text",
1189
- "primaryForeground",
1190
- "secondaryForeground",
1191
- "accentForeground",
1192
- "neutral-950",
1193
- "neutral-50"
1194
- ];
1195
1164
  const CANONICAL_EQUIVALENT_TOKEN_ORDER = [
1196
1165
  "text",
1197
1166
  "primaryForeground",
@@ -1242,11 +1211,7 @@ function resolveDeterministicForeground(backgroundReference, candidates, palette
1242
1211
  function resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette) {
1243
1212
  const backgroundToken = paletteToken(backgroundReference);
1244
1213
  const derivedOnToken = backgroundToken ? onColorTokenName(backgroundToken) : null;
1245
- const text = firstSafeToken([
1246
- candidates.text,
1247
- derivedOnToken,
1248
- ...FALLBACK_TEXT_TOKENS
1249
- ], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []) ?? pickBlackOrWhiteTextColor(backgroundHex);
1214
+ const text = firstSafeToken([candidates.text, derivedOnToken], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []) ?? paletteTextInk(backgroundHex, palette);
1250
1215
  return certifiedForeground(knownForeground({
1251
1216
  text,
1252
1217
  heading: safeTokenOr(candidates.heading, text, backgroundHex, palette),
@@ -1258,6 +1223,10 @@ function resolveMeasuredForeground(backgroundReference, backgroundHex, candidate
1258
1223
  inks: solveSurfaceInks(backgroundHex, text, palette)
1259
1224
  }, candidates.linkHover, palette), palette);
1260
1225
  }
1226
+ /** The automatic text when neither the authored ink nor the ground's on-colour reads: the palette's own pair, then black or white. */
1227
+ function paletteTextInk(backgroundHex, palette) {
1228
+ return paletteInkToken(paletteInkOnSolid(backgroundHex, paletteInkRoles(palette)));
1229
+ }
1261
1230
  /**
1262
1231
  * Every measured foreground goes through the ink certificate, whoever paints it
1263
1232
  * (sections, cards, header, footer, accordions). The candidates above are chosen
@@ -1265,111 +1234,570 @@ function resolveMeasuredForeground(backgroundReference, backgroundHex, candidate
1265
1234
  * as it was; an ink that misses takes black/white, and the solved inks follow
1266
1235
  * the certified text.
1267
1236
  */
1268
- function certifiedForeground(foreground, palette) {
1269
- const { backdropHex } = foreground.provenance;
1270
- const certified = certifySolidSurfaceInks({ foreground: foreground.roles }, backdropHex, { palette });
1271
- if (certified.fallback.length === 0) return foreground;
1272
- return {
1273
- ...foreground,
1274
- roles: certified.foreground,
1275
- provenance: {
1276
- ...foreground.provenance,
1277
- inks: solveSurfaceInks(backdropHex, certified.foreground.text, palette),
1278
- fallback: certified.fallback
1279
- }
1237
+ function certifiedForeground(foreground, palette) {
1238
+ const { backdropHex } = foreground.provenance;
1239
+ const certified = certifySolidSurfaceInks({ foreground: foreground.roles }, backdropHex, { palette });
1240
+ if (certified.fallback.length === 0) return foreground;
1241
+ return {
1242
+ ...foreground,
1243
+ roles: certified.foreground,
1244
+ provenance: {
1245
+ ...foreground.provenance,
1246
+ inks: solveSurfaceInks(backdropHex, certified.foreground.text, palette),
1247
+ fallback: certified.fallback
1248
+ }
1249
+ };
1250
+ }
1251
+ function resolveTrustedTreatmentForeground(candidates, palette) {
1252
+ const text = canonicalInk(candidates.text, palette);
1253
+ if (!text) return { kind: "unmeasured-paint" };
1254
+ return knownForeground({
1255
+ text,
1256
+ heading: canonicalInk(candidates.heading, palette) ?? text,
1257
+ link: canonicalInk(candidates.link, palette) ?? text,
1258
+ supporting: canonicalInk(candidates.supporting, palette) ?? text
1259
+ }, { kind: "trusted-treatment" }, candidates.linkHover, palette);
1260
+ }
1261
+ function knownForeground(roles, provenance, hoverCandidate, palette) {
1262
+ const hover = planForegroundHover({
1263
+ restingToken: roles.link,
1264
+ candidate: canonicalHoverToken(hoverCandidate, palette),
1265
+ palette,
1266
+ backdrops: provenance.kind === "measured" ? [provenance.backdropHex] : null
1267
+ });
1268
+ return {
1269
+ kind: "known",
1270
+ provenance,
1271
+ roles: {
1272
+ ...roles,
1273
+ linkHover: hover.token,
1274
+ muted: provenance.kind === "measured" ? paletteMutedInkOnSolid(provenance.backdropHex, resolveConcreteColorHex(roles.text, palette), paletteInkRoles(palette)) : roles.text
1275
+ },
1276
+ hoverDecoration: hover.decoration
1277
+ };
1278
+ }
1279
+ function canonicalHoverToken(reference, palette) {
1280
+ const token = parseThemeColorToken(reference);
1281
+ if (token) {
1282
+ const parts = parseColorTokenParts(token);
1283
+ if (parts.kind === "token" && resolveConcreteColorHex(parts.token, palette)) return token;
1284
+ }
1285
+ return canonicalToken(reference, palette);
1286
+ }
1287
+ /**
1288
+ * The one rule for what a resolved foreground publishes for the solved inks.
1289
+ * Only a measured paint under a publishing runtime publishes inks; any other
1290
+ * paint it owns resets them, and a paint it only inherits publishes nothing.
1291
+ */
1292
+ function surfaceInkPublication(foreground, policy) {
1293
+ switch (foreground.kind) {
1294
+ case "inherits": return { kind: "none" };
1295
+ case "unmeasured-paint": return { kind: "reset" };
1296
+ case "known": return foreground.provenance.kind === "measured" && policy === "publish" ? {
1297
+ kind: "solved",
1298
+ inks: foreground.provenance.inks
1299
+ } : { kind: "reset" };
1300
+ }
1301
+ }
1302
+ /** Keep a candidate only when it meets ordinary-text contrast on the ground. */
1303
+ function safeTokenOr(candidate, fallback, backgroundHex, palette) {
1304
+ return firstSafeToken([candidate], backgroundHex, palette) ?? fallback;
1305
+ }
1306
+ function firstSafeToken(candidates, backgroundHex, palette, preferredEquivalentTokens = []) {
1307
+ const seen = /* @__PURE__ */ new Set();
1308
+ for (const candidate of candidates) {
1309
+ const token = canonicalToken(candidate, palette, preferredEquivalentTokens);
1310
+ if (!token || seen.has(token)) continue;
1311
+ seen.add(token);
1312
+ const foregroundHex = resolveConcreteColorHex(token, palette);
1313
+ if (foregroundHex && contrastRatio(backgroundHex, foregroundHex) >= 4.5) return token;
1314
+ }
1315
+ return null;
1316
+ }
1317
+ /**
1318
+ * A media treatment's ink as the resolved contract spells it. Nothing measures
1319
+ * the paint, so literal black or white (the photo tint's fallback) stays that
1320
+ * literal colour rather than borrowing whichever palette token shares its value
1321
+ * today, or being dropped when none does. Any other reference is a palette token.
1322
+ * Measured solids keep `firstSafeToken`, whose equivalent on-colour carries the
1323
+ * ground's own hover softening.
1324
+ */
1325
+ function canonicalInk(reference, palette) {
1326
+ return literalInk(reference) ?? canonicalToken(reference, palette);
1327
+ }
1328
+ function literalInk(reference) {
1329
+ const normalized = normalizedReference(reference)?.toUpperCase();
1330
+ return normalized === "#000000" || normalized === "#FFFFFF" ? normalized : null;
1331
+ }
1332
+ function canonicalToken(reference, palette, preferredEquivalentTokens = []) {
1333
+ const normalized = normalizedReference(reference);
1334
+ if (!normalized || normalized === "transparent") return null;
1335
+ const direct = parseThemeColorToken(normalized);
1336
+ if (direct && resolveConcreteColorHex(direct, palette)) return direct;
1337
+ const referenceHex = resolveConcreteColorHex(normalized, palette);
1338
+ if (!referenceHex) return null;
1339
+ const equivalent = [
1340
+ ...preferredEquivalentTokens,
1341
+ ...CANONICAL_EQUIVALENT_TOKEN_ORDER,
1342
+ ...Object.keys(palette).sort()
1343
+ ].find((token) => {
1344
+ const parsed = parseThemeColorToken(token);
1345
+ return parsed !== null && resolveConcreteColorHex(parsed, palette)?.toLowerCase() === referenceHex.toLowerCase();
1346
+ });
1347
+ return equivalent ? parseThemeColorToken(equivalent) : null;
1348
+ }
1349
+ function paletteToken(reference) {
1350
+ const parts = parseColorTokenParts(reference);
1351
+ return parts.kind === "token" && parts.opacityPercent === null ? parts.token : null;
1352
+ }
1353
+ function normalizedReference(value) {
1354
+ if (typeof value !== "string") return null;
1355
+ const normalized = value.trim();
1356
+ return normalized.length > 0 ? normalized : null;
1357
+ }
1358
+ //#endregion
1359
+ //#region ../theme-core/src/palette/generateShades.ts
1360
+ function generateShades(hexColor, name) {
1361
+ const shadeSteps = [
1362
+ 50,
1363
+ 100,
1364
+ 200,
1365
+ 300,
1366
+ 400,
1367
+ 500,
1368
+ 600,
1369
+ 700,
1370
+ 800,
1371
+ 900,
1372
+ 950
1373
+ ];
1374
+ const base = featuresFromHex(hexColor);
1375
+ const hue = base.okH;
1376
+ const baseChroma = base.okC;
1377
+ const toneMap = {
1378
+ 50: .975,
1379
+ 100: .945,
1380
+ 200: .89,
1381
+ 300: .82,
1382
+ 400: .74,
1383
+ 500: .66,
1384
+ 600: .58,
1385
+ 700: .49,
1386
+ 800: .4,
1387
+ 900: .28,
1388
+ 950: .16
1389
+ };
1390
+ const shadeDefs = shadeSteps.map((step, idx) => {
1391
+ const t = idx / (shadeSteps.length - 1);
1392
+ const L = toneMap[step];
1393
+ const C = baseChroma * (.06 + .94 * Math.sin(Math.PI * t));
1394
+ return {
1395
+ name: `${name}-${step}`,
1396
+ hex: oklchToHexGamut(L, C, hue)
1397
+ };
1398
+ });
1399
+ shadeDefs.push({
1400
+ name,
1401
+ hex: hexColor
1402
+ });
1403
+ return shadeDefs;
1404
+ }
1405
+ //#endregion
1406
+ //#region ../theme-core/src/palette/neutralScale.ts
1407
+ /** The cool slate tint every scale had before #1863, kept for grounds with no hue to lend. */
1408
+ const SLATE_NEUTRAL_TINT = {
1409
+ hue: 250,
1410
+ chroma: .02
1411
+ };
1412
+ /** Below this OKLCH chroma a background reads as plain white, grey or black, so its hue is noise. */
1413
+ const ACHROMATIC_CHROMA = .005;
1414
+ /**
1415
+ * The tint a palette's greys take from its background: the background's own
1416
+ * hue at no more than the slate scale's chroma, so a cream site gets warm greys.
1417
+ * A background with no hue to lend (white, `#fafafa`, a missing or unreadable
1418
+ * value) keeps the slate tint, so those palettes keep their exact neutrals.
1419
+ */
1420
+ function neutralTint(background) {
1421
+ const parsed = hexColorSchema.safeParse(background?.toLowerCase());
1422
+ if (!parsed.success) return SLATE_NEUTRAL_TINT;
1423
+ const { r, g, b } = hexToRgb(parsed.data);
1424
+ const { L, a, b: ob } = srgbToOklab(r, g, b);
1425
+ const { C, h } = oklabToOklch(L, a, ob);
1426
+ return C < ACHROMATIC_CHROMA ? SLATE_NEUTRAL_TINT : {
1427
+ hue: h,
1428
+ chroma: Math.min(C, SLATE_NEUTRAL_TINT.chroma)
1429
+ };
1430
+ }
1431
+ /**
1432
+ * A neutral scale from near-white (`neutral-50`) to near-black (`neutral-950`)
1433
+ * on every palette, light or dark. Readers that want "the ground" or "the
1434
+ * text" ask the palette for those roles, not a fixed end of this scale.
1435
+ */
1436
+ function generateNeutralScale({ steps = 11, tint = SLATE_NEUTRAL_TINT } = {}) {
1437
+ const shadeNames = [
1438
+ 50,
1439
+ 100,
1440
+ 200,
1441
+ 300,
1442
+ 400,
1443
+ 500,
1444
+ 600,
1445
+ 700,
1446
+ 800,
1447
+ 900,
1448
+ 950
1449
+ ];
1450
+ const count = Math.min(steps, shadeNames.length);
1451
+ return shadeNames.slice(0, count).map((shadeName, index) => ({
1452
+ name: `neutral-${shadeName}`,
1453
+ hex: oklchToHexGamut(mix(.98, .1, index / (count - 1)), tint.chroma, tint.hue)
1454
+ }));
1455
+ }
1456
+ function mix(a, b, t) {
1457
+ return a + (b - a) * Math.max(0, Math.min(1, t));
1458
+ }
1459
+ //#endregion
1460
+ //#region ../theme-core/src/palette/utils/scrimContrast.ts
1461
+ const WHITE = "#ffffff";
1462
+ const BLACK = "#000000";
1463
+ /** `top` at `alpha` over opaque `bottom`, blended as CSS paints an overlay. */
1464
+ function compositeHex(topHex, alpha, bottomHex) {
1465
+ const top = hexToRgb(topHex);
1466
+ const bottom = hexToRgb(bottomHex);
1467
+ const mix = (a, b) => Math.round(alpha * a + (1 - alpha) * b);
1468
+ return rgbToHex(mix(top.r, bottom.r), mix(top.g, bottom.g), mix(top.b, bottom.b));
1469
+ }
1470
+ /**
1471
+ * The lowest contrast `foreground` can reach over `scrim` at `alpha` laid on
1472
+ * any pixel. A foreground whose luminance falls inside the range the
1473
+ * composites can take has a worst case of 1:1.
1474
+ */
1475
+ function worstCaseScrimContrast(input) {
1476
+ const overWhite = compositeHex(input.scrimHex, input.alpha, WHITE);
1477
+ const overBlack = compositeHex(input.scrimHex, input.alpha, BLACK);
1478
+ const luminance = (hex) => {
1479
+ const { r, g, b } = hexToRgb(hex);
1480
+ return relativeLuminance(r, g, b);
1481
+ };
1482
+ const foreground = luminance(input.foregroundHex);
1483
+ const low = luminance(overBlack);
1484
+ const high = luminance(overWhite);
1485
+ if (foreground >= low && foreground <= high) return 1;
1486
+ return Math.min(contrastRatio(input.foregroundHex, overWhite), contrastRatio(input.foregroundHex, overBlack));
1487
+ }
1488
+ /**
1489
+ * The smallest scrim opacity, in hundredths, at which every foreground keeps
1490
+ * `threshold` contrast over any pixel. `null` when even an opaque scrim fails,
1491
+ * which means the foreground was never legible on the scrim colour itself.
1492
+ */
1493
+ function minimumScrimOpacity(input) {
1494
+ const passes = (alpha) => input.foregroundHexes.every((foregroundHex) => worstCaseScrimContrast({
1495
+ foregroundHex,
1496
+ scrimHex: input.scrimHex,
1497
+ alpha
1498
+ }) >= input.threshold);
1499
+ return Array.from({ length: 101 }, (_, hundredths) => hundredths / 100).find(passes) ?? null;
1500
+ }
1501
+ /** Shared samples for literal RGB washes and palette-token gradient veils. */
1502
+ function gradientScrimSamples(gradient, alpha, palette) {
1503
+ const literal = [...gradient.matchAll(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/g)].map((stop) => ({
1504
+ hex: rgbToHex(Number(stop[1]), Number(stop[2]), Number(stop[3])),
1505
+ alpha: alpha * (stop[4] === void 0 ? 1 : Number(stop[4]))
1506
+ }));
1507
+ const tokens = [...gradient.matchAll(/var\(--tb-([\w-]+)\)/g)].flatMap((stop) => {
1508
+ const hex = stop[1] ? resolveConcreteColorHex(stop[1], palette) : null;
1509
+ return hex ? [{
1510
+ hex,
1511
+ alpha
1512
+ }] : [];
1513
+ });
1514
+ return [...literal, ...tokens];
1515
+ }
1516
+ /** The ink with the stronger worst-pixel guarantee identifies the veil tone.
1517
+ * No readable samples (or a tie) leaves classification to the foreground owner.
1518
+ */
1519
+ function scrimTone(samples) {
1520
+ if (samples.length === 0) return null;
1521
+ const worst = (foregroundHex) => Math.min(...samples.map((sample) => worstCaseScrimContrast({
1522
+ foregroundHex,
1523
+ scrimHex: sample.hex,
1524
+ alpha: sample.alpha
1525
+ })));
1526
+ const white = worst(WHITE);
1527
+ const black = worst(BLACK);
1528
+ return white === black ? null : white > black ? "dark" : "light";
1529
+ }
1530
+ //#endregion
1531
+ //#region ../theme-core/src/palette/expandPalette.ts
1532
+ function colorsToMap(palette) {
1533
+ const map = {};
1534
+ for (const c of palette.colors) map[c.name] = c.hex;
1535
+ return map;
1536
+ }
1537
+ const nonShadeablePaletteRoleNames = /* @__PURE__ */ new Set([
1538
+ "success",
1539
+ "warning",
1540
+ "destructive"
1541
+ ]);
1542
+ /**
1543
+ * Status role aliases the persisted palette does not carry itself.
1544
+ *
1545
+ * Generators reference `--tb-error` (the site-style-owned input error border)
1546
+ * and `--tb-info` (`.alert-info`, `.status-info`, the field-note rule), but the
1547
+ * palette schema only defines `destructive` and has no `info` role at all.
1548
+ * Without these aliases those declarations name variables that are never
1549
+ * defined and browsers drop them. The SDK bridge resolves the same pair via
1550
+ * TOKEN_ALIASES, so both runtimes agree on what a status token means.
1551
+ *
1552
+ * Runs after the danger → destructive promotion above, so `destructive` is
1553
+ * already the single source of truth for the error colour.
1554
+ */
1555
+ function statusAliasTokens(expanded) {
1556
+ const aliases = {};
1557
+ if (expanded.destructive) aliases.error = expanded.destructive;
1558
+ if (expanded.accent) aliases.info = expanded.accent;
1559
+ return aliases;
1560
+ }
1561
+ function expandPalette(palette, options = {}) {
1562
+ return {
1563
+ ...expandBasePalette(palette),
1564
+ ...arrangementPaletteTokens(colorsToMap(palette), options)
1565
+ };
1566
+ }
1567
+ function expandBasePalette(palette) {
1568
+ const base = colorsToMap(palette);
1569
+ const expanded = { ...base };
1570
+ const roles = paletteInkRoles(base);
1571
+ generateNeutralScale({
1572
+ steps: 11,
1573
+ tint: neutralTint(base.background)
1574
+ }).forEach((n) => {
1575
+ expanded[n.name] = n.hex;
1576
+ });
1577
+ for (const [name, hex] of Object.entries(base)) {
1578
+ if (nonShadeablePaletteRoleNames.has(name)) continue;
1579
+ if (hex) generateShades(hex, name).forEach((shade) => {
1580
+ expanded[shade.name] = shade.hex;
1581
+ });
1582
+ }
1583
+ if (base.text) expanded.body = base.text;
1584
+ if (base.danger && !base.destructive) expanded.destructive = base.danger;
1585
+ Object.assign(expanded, statusAliasTokens(expanded));
1586
+ expanded.mutedText = readableMutedText(expanded["neutral-500"] ?? "#888", base, roles);
1587
+ for (const [token, hex] of Object.entries({ ...expanded })) {
1588
+ if (!hex || !isOnColorBackgroundCandidateToken(token)) continue;
1589
+ const onToken = onColorTokenName(token);
1590
+ if (expanded[onToken]) continue;
1591
+ expanded[onToken] = paletteInkOnSolid(hex, roles).hex;
1592
+ }
1593
+ Object.assign(expanded, groundMutedInkTokens(expanded));
1594
+ return expanded;
1595
+ }
1596
+ /**
1597
+ * The strongest tints booking and registration screens lay over a ground
1598
+ * where secondary text sits: selected option cards, event tiles and summaries
1599
+ * tint `primary` at 5–10% (`blocks/vars/appointment-booking.ts`,
1600
+ * `blocks/vars/event-registration.ts`, `blocks-static/event-registration.css`),
1601
+ * the appointment summary and hover rows tint `text`/`onSurface` at 5%, and the
1602
+ * registration summary lays `muted` at 42%. A weaker tint of the same colour
1603
+ * sits between the ground and these, so solving against the strongest covers it.
1604
+ * A selected card lays its tint over its own ground, so the same list applies
1605
+ * over the surface and over the page background that event option cards paint.
1606
+ * A new tint under secondary text belongs here, and the CSS paints it with
1607
+ * the ground's faded tint token (`groundTintToken`) before the colour itself;
1608
+ * `secondaryTextTints.test.ts` fails if the CSS lays one that isn't covered or
1609
+ * doesn't read that token.
1610
+ */
1611
+ const SURFACE_SECONDARY_TEXT_TINTS = [
1612
+ {
1613
+ token: "primary",
1614
+ alpha: .1
1615
+ },
1616
+ {
1617
+ token: "text",
1618
+ alpha: .05
1619
+ },
1620
+ {
1621
+ token: "onSurface",
1622
+ alpha: .05
1623
+ },
1624
+ {
1625
+ token: "muted",
1626
+ alpha: .42
1627
+ }
1628
+ ];
1629
+ /** The strongest tint alpha per colour, for the CSS that paints those tints. */
1630
+ const SURFACE_SECONDARY_TEXT_TINT_ALPHA = Object.fromEntries(SURFACE_SECONDARY_TEXT_TINTS.map(({ token, alpha }) => [token, alpha]));
1631
+ /**
1632
+ * The grounds booking and registration secondary text sits on, with the token
1633
+ * its solved muted ink is published as: the surface (panels, details) and the
1634
+ * page background (event registration's option, ticket and payment cards).
1635
+ */
1636
+ const MUTED_INK_TOKENS = {
1637
+ surface: "onSurfaceMuted",
1638
+ background: "onBackgroundMuted"
1639
+ };
1640
+ /**
1641
+ * Secondary text on a ground, solved rather than faded from the ground's
1642
+ * on-colour in CSS, against the ground and every tint laid over it.
1643
+ *
1644
+ * Some palettes admit no single ink for all of them: a mid-tone surface with a
1645
+ * dark `primary` tint and a light `muted` one. The plain ground always has one
1646
+ * (black or white reads on any solid), so the ground is kept, each tint is kept
1647
+ * in list order while one ink still reads on everything kept so far, and the
1648
+ * tints that can't join are faded toward the ground until that ink reads on
1649
+ * them too. Fading the tint rather than giving it an ink of its own keeps every
1650
+ * line of text on it (titles and prices as well as secondary text) close to the
1651
+ * ground its colours were chosen for. Hosted palettes and the SDK bridge both
1652
+ * derive it here.
1653
+ */
1654
+ function groundMutedInk(palette, ground) {
1655
+ const groundHex = palette[ground];
1656
+ if (!groundHex) return null;
1657
+ const preferred = palette[onColorTokenName(ground)] ?? null;
1658
+ const roles = paletteInkRoles(palette);
1659
+ const initial = {
1660
+ grounds: [groundHex],
1661
+ hex: paletteMutedInkOnSolid(groundHex, preferred, roles),
1662
+ uncovered: []
1280
1663
  };
1281
- }
1282
- function resolveTrustedTreatmentForeground(candidates, palette) {
1283
- const text = canonicalToken(candidates.text, palette);
1284
- if (!text) return { kind: "unmeasured-paint" };
1285
- return knownForeground({
1286
- text,
1287
- heading: canonicalToken(candidates.heading, palette) ?? text,
1288
- link: canonicalToken(candidates.link, palette) ?? text,
1289
- supporting: canonicalToken(candidates.supporting, palette) ?? text
1290
- }, { kind: "trusted-treatment" }, candidates.linkHover, palette);
1291
- }
1292
- function knownForeground(roles, provenance, hoverCandidate, palette) {
1293
- const hover = planForegroundHover({
1294
- restingToken: roles.link,
1295
- candidate: canonicalHoverToken(hoverCandidate, palette),
1296
- palette,
1297
- backdrops: provenance.kind === "measured" ? [provenance.backdropHex] : null
1298
- });
1664
+ const solved = SURFACE_SECONDARY_TEXT_TINTS.reduce((kept, { token, alpha }) => {
1665
+ const tintHex = palette[token];
1666
+ if (!tintHex) return kept;
1667
+ const grounds = [...kept.grounds, compositeHex(tintHex, alpha, groundHex)];
1668
+ const ink = paletteMutedInk(grounds, preferred, roles);
1669
+ return ink.kind === "unpaintable" ? {
1670
+ ...kept,
1671
+ uncovered: [...kept.uncovered, {
1672
+ token,
1673
+ alpha,
1674
+ tintHex
1675
+ }]
1676
+ } : {
1677
+ ...kept,
1678
+ grounds,
1679
+ hex: ink.hex
1680
+ };
1681
+ }, initial);
1299
1682
  return {
1300
- kind: "known",
1301
- provenance,
1302
- roles: {
1303
- ...roles,
1304
- linkHover: hover.token,
1305
- muted: provenance.kind === "measured" ? deriveSurfaceMutedColor(provenance.backdropHex, resolveConcreteColorHex(roles.text, palette) ?? provenance.backdropHex) : roles.text
1306
- },
1307
- hoverDecoration: hover.decoration
1683
+ hex: solved.hex,
1684
+ fadedTints: solved.uncovered.map(({ token, alpha, tintHex }) => ({
1685
+ token,
1686
+ hex: tintFadedUntilInkReads(tintHex, alpha, groundHex, solved.hex)
1687
+ }))
1308
1688
  };
1309
1689
  }
1310
- function canonicalHoverToken(reference, palette) {
1311
- const token = parseThemeColorToken(reference);
1312
- if (token) {
1313
- const parts = parseColorTokenParts(token);
1314
- if (parts.kind === "token" && resolveConcreteColorHex(parts.token, palette)) return token;
1315
- }
1316
- return canonicalToken(reference, palette);
1690
+ /** The tint colour a ground publishes in place of a tint its muted ink can't read on, e.g. `surfaceTintMuted`. */
1691
+ function groundTintToken(ground, tint) {
1692
+ return `${ground}Tint${tint.charAt(0).toUpperCase()}${tint.slice(1)}`;
1317
1693
  }
1318
1694
  /**
1319
- * The one rule for what a resolved foreground publishes for the solved inks.
1320
- * Only a measured paint under a publishing runtime publishes inks; any other
1321
- * paint it owns resets them, and a paint it only inherits publishes nothing.
1695
+ * The tint blended toward the ground in 1% steps, stopping at the first that
1696
+ * the ink reads on when laid at `alpha`. The ground itself always reads, since
1697
+ * the ink was solved on it.
1322
1698
  */
1323
- function surfaceInkPublication(foreground, policy) {
1324
- switch (foreground.kind) {
1325
- case "inherits": return { kind: "none" };
1326
- case "unmeasured-paint": return { kind: "reset" };
1327
- case "known": return foreground.provenance.kind === "measured" && policy === "publish" ? {
1328
- kind: "solved",
1329
- inks: foreground.provenance.inks
1330
- } : { kind: "reset" };
1331
- }
1699
+ function tintFadedUntilInkReads(tintHex, alpha, groundHex, inkHex) {
1700
+ const tint = hexToRgb(tintHex);
1701
+ const ground = hexToRgb(groundHex);
1702
+ return Array.from({ length: 101 }, (_, index) => {
1703
+ const amount = index / 100;
1704
+ return rgbToHex(mix$1(tint.r, ground.r, amount), mix$1(tint.g, ground.g, amount), mix$1(tint.b, ground.b, amount));
1705
+ }).find((hex) => contrastRatio(inkHex, compositeHex(hex, alpha, groundHex)) >= 4.5) ?? groundHex;
1332
1706
  }
1333
- /** Keep a candidate only when it meets ordinary-text contrast on the ground. */
1334
- function safeTokenOr(candidate, fallback, backgroundHex, palette) {
1335
- return firstSafeToken([candidate], backgroundHex, palette) ?? fallback;
1707
+ /**
1708
+ * The muted ink tokens a palette doesn't store itself, and the faded tint
1709
+ * colours of each ground whose ink is solved here, as hex.
1710
+ */
1711
+ function groundMutedInkTokens(palette) {
1712
+ return Object.fromEntries(Object.entries(MUTED_INK_TOKENS).flatMap(([ground, token]) => {
1713
+ if (palette[token]) return [];
1714
+ const ink = groundMutedInk(palette, ground);
1715
+ if (!ink) return [];
1716
+ const faded = ink.fadedTints.map(({ token: tint, hex }) => [groundTintToken(ground, tint), hex]);
1717
+ return [[token, ink.hex], ...faded.filter(([name]) => !palette[name])];
1718
+ }));
1336
1719
  }
1337
- function firstSafeToken(candidates, backgroundHex, palette, preferredEquivalentTokens = []) {
1338
- const seen = /* @__PURE__ */ new Set();
1339
- for (const candidate of candidates) {
1340
- const token = canonicalToken(candidate, palette, preferredEquivalentTokens);
1341
- if (!token || seen.has(token)) continue;
1342
- seen.add(token);
1343
- const foregroundHex = resolveConcreteColorHex(token, palette);
1344
- if (foregroundHex && contrastRatio(backgroundHex, foregroundHex) >= 4.5) return token;
1345
- }
1346
- return null;
1720
+ /**
1721
+ * The neutral step stays when it reads on the ground. Otherwise (a dark palette
1722
+ * on a mid-tone ground, or a tinted light one) it's the ground-to-text blend
1723
+ * with a 4.5:1 floor, heading for the palette's own ink on that ground.
1724
+ */
1725
+ function readableMutedText(step, base, roles) {
1726
+ const ground = base.background || base.surface;
1727
+ if (!ground || contrastRatio(step, ground) >= 4.5) return step;
1728
+ return paletteMutedInkOnSolid(ground, null, roles);
1347
1729
  }
1348
- function canonicalToken(reference, palette, preferredEquivalentTokens = []) {
1349
- const normalized = normalizedReference(reference);
1350
- if (!normalized || normalized === "transparent") return null;
1351
- const direct = parseThemeColorToken(normalized);
1352
- if (direct && resolveConcreteColorHex(direct, palette)) return direct;
1353
- const referenceHex = resolveConcreteColorHex(normalized, palette);
1354
- if (!referenceHex) return null;
1355
- const equivalent = [
1356
- ...preferredEquivalentTokens,
1357
- ...CANONICAL_EQUIVALENT_TOKEN_ORDER,
1358
- ...Object.keys(palette).sort()
1359
- ].find((token) => {
1360
- const parsed = parseThemeColorToken(token);
1361
- return parsed !== null && resolveConcreteColorHex(parsed, palette)?.toLowerCase() === referenceHex.toLowerCase();
1362
- });
1363
- return equivalent ? parseThemeColorToken(equivalent) : null;
1730
+ /**
1731
+ * Derived decoration colours never become editable palette swatches. The mark
1732
+ * blends toward literal black or white: it's a graphic endpoint for a 3:1
1733
+ * search, not text, so it stays off the palette ink rule.
1734
+ */
1735
+ function deriveSurfaceDecorationColors(ground, text, accent) {
1736
+ const ink = pickBlackOrWhiteTextColor(ground);
1737
+ return {
1738
+ line: firstContrastBlend(ground, text, ground, 1.5),
1739
+ mark: firstContrastBlend(accent, ink, ground, 3)
1740
+ };
1364
1741
  }
1365
- function paletteToken(reference) {
1366
- const parts = parseColorTokenParts(reference);
1367
- return parts.kind === "token" && parts.opacityPercent === null ? parts.token : null;
1742
+ function firstContrastBlend(from, to, ground, threshold) {
1743
+ const start = hexToRgb(from);
1744
+ const end = hexToRgb(to);
1745
+ return Array.from({ length: 101 }, (_, index) => {
1746
+ const amount = index / 100;
1747
+ return rgbToHex(mix$1(start.r, end.r, amount), mix$1(start.g, end.g, amount), mix$1(start.b, end.b, amount));
1748
+ }).find((hex) => contrastRatio(hex, ground) >= threshold) ?? to;
1368
1749
  }
1369
- function normalizedReference(value) {
1370
- if (typeof value !== "string") return null;
1371
- const normalized = value.trim();
1372
- return normalized.length > 0 ? normalized : null;
1750
+ /** `markSource` names the colour surface marks are derived from when a style marks in its brand rather than its accent. */
1751
+ function arrangementPaletteTokens(base, options) {
1752
+ if (options.arrangement !== true || !base.text) return {};
1753
+ return {
1754
+ onText: base.onText ?? paletteInkOnSolid(base.text, paletteInkRoles(base)).hex,
1755
+ ...options.marksFrom === "primary" && base.primary ? { markSource: base.primary } : {}
1756
+ };
1757
+ }
1758
+ //#endregion
1759
+ //#region ../theme-core/src/utils/cssValueSafety.ts
1760
+ /**
1761
+ * Whether a value can be written into CSS where its author meant it to go
1762
+ * (issue 1185).
1763
+ *
1764
+ * Server rendering writes a `style` object as one attribute string, and
1765
+ * generated stylesheets interpolate tokens into declarations. Either way the
1766
+ * value is left as it is, so one holding a `;` or a brace adds declarations or
1767
+ * rules nobody wrote. This is the one rule for "a value stays inside its
1768
+ * declaration"; the inline style guard, the colour token helpers and the
1769
+ * custom-block layout gate all build on it.
1770
+ */
1771
+ /** A complete quoted string, inside which `;` is just text (a font name, a data URI). */
1772
+ const QUOTED_STRING = /"[^"\\\n]*"|'[^'\\\n]*'/g;
1773
+ /**
1774
+ * Outside quoted strings: the end of a declaration, a block, a CSS escape, or
1775
+ * a quote that never closes and would swallow what follows.
1776
+ */
1777
+ const DECLARATION_BREAK = /[;{}\\"']/;
1778
+ /**
1779
+ * Refused inside quoted strings too: values also go into `<style>` elements,
1780
+ * where `</style>` ends the stylesheet whether or not CSS reads it as a string.
1781
+ */
1782
+ const TAG_BRACKET = /[<>]/;
1783
+ /** The value with its complete quoted strings removed. */
1784
+ const outsideQuotedStrings = (value) => value.replace(QUOTED_STRING, "");
1785
+ /** True when `value` cannot end its declaration or open another construct. */
1786
+ function staysInsideDeclaration(value) {
1787
+ return !TAG_BRACKET.test(value) && !DECLARATION_BREAK.test(outsideQuotedStrings(value));
1788
+ }
1789
+ /** `url(` and `image-set(` (which `-webkit-image-set(` ends in), the two every browser fetches through. */
1790
+ const LOADING_FUNCTION_CALL = /(?:url|image-set)\(/i;
1791
+ /**
1792
+ * True when `value` calls `url()` or `image-set()`, in any letter case.
1793
+ *
1794
+ * Only meaningful for a value that `staysInsideDeclaration`: that rule refuses
1795
+ * backslashes, so the name cannot be spelled with CSS escapes. A name split
1796
+ * from its bracket by a space or a comment is not a function call to a browser
1797
+ * either, so it fetches nothing.
1798
+ */
1799
+ function callsCssLoadingFunction(value) {
1800
+ return LOADING_FUNCTION_CALL.test(outsideQuotedStrings(value));
1373
1801
  }
1374
1802
  //#endregion
1375
1803
  //#region ../theme-core/src/utils/colorStyles.ts
@@ -1407,6 +1835,7 @@ function surfaceRoleForTextToken(token) {
1407
1835
  * rgbColorValue('raw:transparent') // => 'transparent'
1408
1836
  */
1409
1837
  function rgbColorValue(token) {
1838
+ if (typeof token !== "string" || !staysInsideDeclaration(token)) return "transparent";
1410
1839
  const { token: baseToken, opacityPercent, raw } = parseToken(token);
1411
1840
  if (raw) return raw;
1412
1841
  const cssVar = `${COLOR_VAR_PREFIX}${baseToken}`;
@@ -1425,6 +1854,7 @@ function rgbColorValue(token) {
1425
1854
  * cssVarValue('surface/95') // => 'var(--tb-surface)' (opacity ignored)
1426
1855
  */
1427
1856
  function cssVarValue(token) {
1857
+ if (typeof token !== "string" || !staysInsideDeclaration(token)) return "transparent";
1428
1858
  const { token: baseToken } = parseToken(token);
1429
1859
  return `var(${COLOR_VAR_PREFIX}${baseToken})`;
1430
1860
  }
@@ -2664,13 +3094,13 @@ function resolveSolid(input, backgroundToken, preferredForeground) {
2664
3094
  function resolveSolidButtonColour(input, backgroundToken, preferredForeground) {
2665
3095
  return resolveSolid(input, backgroundToken, preferredForeground);
2666
3096
  }
2667
- /** Preserve checked on-colours (a requested label colour first); a solid state's last resort belongs to its actual fill. */
3097
+ /** Preserve checked on-colours (a requested label colour first); a solid state's last resort is the palette ink for its actual fill. */
2668
3098
  function resolveSolidInk(input, backgroundToken, backgroundHex, preferredForeground) {
2669
3099
  if (preferredForeground !== void 0) {
2670
3100
  const preferred = checkedSolidInk(input, backgroundToken, backgroundHex, preferredForeground);
2671
3101
  if (preferred) return preferred;
2672
3102
  }
2673
- return checkedSolidInk(input, backgroundToken, backgroundHex, unsafeAsOpaqueButtonColourToken(solidForegroundToken(backgroundToken))) ?? blackOrWhiteSolidInk(backgroundToken, backgroundHex);
3103
+ return checkedSolidInk(input, backgroundToken, backgroundHex, unsafeAsOpaqueButtonColourToken(solidForegroundToken(backgroundToken))) ?? paletteSolidInk(input, backgroundToken, backgroundHex);
2674
3104
  }
2675
3105
  function checkedSolidInk(input, backgroundToken, backgroundHex, foregroundToken) {
2676
3106
  const candidate = input.palette[foregroundToken];
@@ -2692,14 +3122,18 @@ function checkedSolidInk(input, backgroundToken, backgroundHex, foregroundToken)
2692
3122
  };
2693
3123
  return null;
2694
3124
  }
2695
- function blackOrWhiteSolidInk(backgroundToken, backgroundHex) {
2696
- const foregroundHex = pickBlackOrWhiteTextColor(backgroundHex);
3125
+ /** The palette's own background or text as the label where it reads (as a checked token), else literal black or white. */
3126
+ function paletteSolidInk(input, backgroundToken, backgroundHex) {
3127
+ const ink = paletteInkOnSolid(backgroundHex, paletteInkRoles(input.palette));
3128
+ const role = ink.kind === "role" ? checkedSolidInk(input, backgroundToken, backgroundHex, unsafeAsOpaqueButtonColourToken(ink.role)) : null;
3129
+ if (role) return role;
3130
+ const literal = pickBlackOrWhiteTextColor(backgroundHex);
2697
3131
  return {
2698
- foregroundHex,
3132
+ foregroundHex: literal,
2699
3133
  colour: {
2700
3134
  kind: "known-solid",
2701
3135
  backgroundCss: tokenCss(backgroundToken),
2702
- foregroundCss: foregroundHex
3136
+ foregroundCss: literal
2703
3137
  }
2704
3138
  };
2705
3139
  }
@@ -2778,7 +3212,7 @@ function interpolateHex(startHex, endHex, position) {
2778
3212
  }
2779
3213
  //#endregion
2780
3214
  //#region ../theme-core/src/buttons/buttonSurfaceContext.ts
2781
- /** The last resort, chosen by `maxContrastBlackOrWhite`. */
3215
+ /** The last resort, when neither palette role reads (`paletteInkOnSolid`). */
2782
3216
  const LITERAL_NEUTRALS = {
2783
3217
  black: {
2784
3218
  hex: "#000000",
@@ -2799,7 +3233,7 @@ function deriveButtonSurfaceContext(input, palette, fallbackToken, colourIndex)
2799
3233
  const background = deriveKnownBackground(input, palette, fallbackToken);
2800
3234
  if (background.kind === "unknown") return background;
2801
3235
  const explicitForeground = resolveKnownColour(input.kind === "solid" || input.kind === "inherit" ? input.foreground ?? "" : "", palette);
2802
- const foreground = explicitForeground && contrastRatio(background.colour.hex, explicitForeground.hex, colourIndex) >= 4.5 ? explicitForeground : LITERAL_NEUTRALS[maxContrastBlackOrWhite(solidPaint(background.colour.hex, colourIndex)).ink];
3236
+ const foreground = explicitForeground && contrastRatio(background.colour.hex, explicitForeground.hex, colourIndex) >= 4.5 ? explicitForeground : automaticForeground(background.colour.hex, palette);
2803
3237
  return {
2804
3238
  kind: "known-solid",
2805
3239
  source: background.source,
@@ -3104,6 +3538,16 @@ function boundaryForVariant(variant) {
3104
3538
  function findVariant(system, role) {
3105
3539
  return system.variants.find((variant) => variant.enabled && variant.id === role);
3106
3540
  }
3541
+ /** The surface's automatic text: the palette's own background or text where it reads, else black or white. */
3542
+ function automaticForeground(backgroundHex, palette) {
3543
+ const ink = paletteInkOnSolid(backgroundHex, paletteInkRoles(palette));
3544
+ if (ink.kind === "literal") return LITERAL_NEUTRALS[ink.hex === "#000000" ? "black" : "white"];
3545
+ return resolveKnownColour(ink.role, palette) ?? {
3546
+ hex: ink.hex,
3547
+ css: ink.hex,
3548
+ source: "literal-css"
3549
+ };
3550
+ }
3107
3551
  function resolveKnownColour(value, palette) {
3108
3552
  const reference = parseThemeColorReference(value, { palette });
3109
3553
  if (reference.kind !== "literal-css") {
@@ -3194,100 +3638,17 @@ function contextualBoundaryStyles(boundary) {
3194
3638
  };
3195
3639
  }
3196
3640
  //#endregion
3197
- //#region ../theme-core/src/palette/utils/scrimContrast.ts
3198
- const WHITE = "#ffffff";
3199
- const BLACK = "#000000";
3200
- /** `top` at `alpha` over opaque `bottom`, blended as CSS paints an overlay. */
3201
- function compositeHex(topHex, alpha, bottomHex) {
3202
- const top = hexToRgb(topHex);
3203
- const bottom = hexToRgb(bottomHex);
3204
- const mix = (a, b) => Math.round(alpha * a + (1 - alpha) * b);
3205
- return rgbToHex(mix(top.r, bottom.r), mix(top.g, bottom.g), mix(top.b, bottom.b));
3206
- }
3207
- /**
3208
- * The lowest contrast `foreground` can reach over `scrim` at `alpha` laid on
3209
- * any pixel. A foreground whose luminance falls inside the range the
3210
- * composites can take has a worst case of 1:1.
3211
- */
3212
- function worstCaseScrimContrast(input) {
3213
- const overWhite = compositeHex(input.scrimHex, input.alpha, WHITE);
3214
- const overBlack = compositeHex(input.scrimHex, input.alpha, BLACK);
3215
- const luminance = (hex) => {
3216
- const { r, g, b } = hexToRgb(hex);
3217
- return relativeLuminance(r, g, b);
3218
- };
3219
- const foreground = luminance(input.foregroundHex);
3220
- const low = luminance(overBlack);
3221
- const high = luminance(overWhite);
3222
- if (foreground >= low && foreground <= high) return 1;
3223
- return Math.min(contrastRatio(input.foregroundHex, overWhite), contrastRatio(input.foregroundHex, overBlack));
3224
- }
3225
- /**
3226
- * The smallest scrim opacity, in hundredths, at which every foreground keeps
3227
- * `threshold` contrast over any pixel. `null` when even an opaque scrim fails,
3228
- * which means the foreground was never legible on the scrim colour itself.
3229
- */
3230
- function minimumScrimOpacity(input) {
3231
- const passes = (alpha) => input.foregroundHexes.every((foregroundHex) => worstCaseScrimContrast({
3232
- foregroundHex,
3233
- scrimHex: input.scrimHex,
3234
- alpha
3235
- }) >= input.threshold);
3236
- return Array.from({ length: 101 }, (_, hundredths) => hundredths / 100).find(passes) ?? null;
3237
- }
3238
- /** Shared samples for literal RGB washes and palette-token gradient veils. */
3239
- function gradientScrimSamples(gradient, alpha, palette) {
3240
- const literal = [...gradient.matchAll(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/g)].map((stop) => ({
3241
- hex: rgbToHex(Number(stop[1]), Number(stop[2]), Number(stop[3])),
3242
- alpha: alpha * (stop[4] === void 0 ? 1 : Number(stop[4]))
3243
- }));
3244
- const tokens = [...gradient.matchAll(/var\(--tb-([\w-]+)\)/g)].flatMap((stop) => {
3245
- const hex = stop[1] ? resolveConcreteColorHex(stop[1], palette) : null;
3246
- return hex ? [{
3247
- hex,
3248
- alpha
3249
- }] : [];
3250
- });
3251
- return [...literal, ...tokens];
3252
- }
3253
- /** The ink with the stronger worst-pixel guarantee identifies the veil tone.
3254
- * No readable samples (or a tie) leaves classification to the foreground owner.
3255
- */
3256
- function scrimTone(samples) {
3257
- if (samples.length === 0) return null;
3258
- const worst = (foregroundHex) => Math.min(...samples.map((sample) => worstCaseScrimContrast({
3259
- foregroundHex,
3260
- scrimHex: sample.hex,
3261
- alpha: sample.alpha
3262
- })));
3263
- const white = worst(WHITE);
3264
- const black = worst(BLACK);
3265
- return white === black ? null : white > black ? "dark" : "light";
3266
- }
3267
- //#endregion
3268
3641
  //#region ../theme-core/src/site-styles/accessibleSurfaces.ts
3269
3642
  const ON_BACKGROUND = { kind: "on-background" };
3270
3643
  const surfaceRecipes = {
3271
3644
  base: {
3272
3645
  backgroundCandidates: ["background", "surface"],
3273
- headingCandidates: [
3274
- "text",
3275
- ON_BACKGROUND,
3276
- "neutral-950",
3277
- "neutral-50"
3278
- ],
3279
- textCandidates: [
3280
- "text",
3281
- ON_BACKGROUND,
3282
- "neutral-950",
3283
- "neutral-50"
3284
- ],
3646
+ headingCandidates: ["text", ON_BACKGROUND],
3647
+ textCandidates: ["text", ON_BACKGROUND],
3285
3648
  linkCandidates: [
3286
3649
  "primary",
3287
3650
  "text",
3288
- ON_BACKGROUND,
3289
- "neutral-950",
3290
- "neutral-50"
3651
+ ON_BACKGROUND
3291
3652
  ],
3292
3653
  supportingCandidates: ["mutedText"],
3293
3654
  inheritedBackground: true
@@ -3299,24 +3660,12 @@ const surfaceRecipes = {
3299
3660
  "surface",
3300
3661
  "background"
3301
3662
  ],
3302
- headingCandidates: [
3303
- ON_BACKGROUND,
3304
- "text",
3305
- "neutral-950",
3306
- "neutral-50"
3307
- ],
3308
- textCandidates: [
3309
- ON_BACKGROUND,
3310
- "text",
3311
- "neutral-950",
3312
- "neutral-50"
3313
- ],
3663
+ headingCandidates: [ON_BACKGROUND, "text"],
3664
+ textCandidates: [ON_BACKGROUND, "text"],
3314
3665
  linkCandidates: [
3315
3666
  "primary",
3316
3667
  ON_BACKGROUND,
3317
- "text",
3318
- "neutral-950",
3319
- "neutral-50"
3668
+ "text"
3320
3669
  ],
3321
3670
  supportingCandidates: [
3322
3671
  "mutedText",
@@ -3335,25 +3684,19 @@ const surfaceRecipes = {
3335
3684
  ON_BACKGROUND,
3336
3685
  "primaryForeground",
3337
3686
  "background",
3338
- "surface",
3339
- "neutral-50",
3340
- "neutral-950"
3687
+ "surface"
3341
3688
  ],
3342
3689
  textCandidates: [
3343
3690
  ON_BACKGROUND,
3344
3691
  "primaryForeground",
3345
3692
  "background",
3346
- "surface",
3347
- "neutral-50",
3348
- "neutral-950"
3693
+ "surface"
3349
3694
  ],
3350
3695
  linkCandidates: [
3351
3696
  ON_BACKGROUND,
3352
3697
  "primaryForeground",
3353
3698
  "background",
3354
- "surface",
3355
- "neutral-50",
3356
- "neutral-950"
3699
+ "surface"
3357
3700
  ],
3358
3701
  supportingCandidates: [
3359
3702
  ON_BACKGROUND,
@@ -3374,25 +3717,19 @@ const surfaceRecipes = {
3374
3717
  ON_BACKGROUND,
3375
3718
  "primaryForeground",
3376
3719
  "background",
3377
- "surface",
3378
- "neutral-50",
3379
- "neutral-950"
3720
+ "surface"
3380
3721
  ],
3381
3722
  textCandidates: [
3382
3723
  ON_BACKGROUND,
3383
3724
  "primaryForeground",
3384
3725
  "background",
3385
- "surface",
3386
- "neutral-50",
3387
- "neutral-950"
3726
+ "surface"
3388
3727
  ],
3389
3728
  linkCandidates: [
3390
3729
  ON_BACKGROUND,
3391
3730
  "primaryForeground",
3392
3731
  "background",
3393
- "surface",
3394
- "neutral-50",
3395
- "neutral-950"
3732
+ "surface"
3396
3733
  ],
3397
3734
  supportingCandidates: [
3398
3735
  ON_BACKGROUND,
@@ -3417,7 +3754,11 @@ function toAccessibleColorSurfaceIntent(surface) {
3417
3754
  default: return assertNeverSurface(surface);
3418
3755
  }
3419
3756
  }
3420
- /** Keep every successful legacy recipe; only exhausted candidates need neutral ink. */
3757
+ /**
3758
+ * Keep every successful recipe. When no ground has a passing ink, the first
3759
+ * ground present takes the palette's own ink there (the shared owner), which
3760
+ * always reaches ordinary-text contrast on a solid.
3761
+ */
3421
3762
  function resolveAccessibleSurfaceRecipe(input) {
3422
3763
  const result = tryAccessibleSurfaceRecipe(input);
3423
3764
  if (result.kind === "resolved-accessible-surface") return result;
@@ -3425,13 +3766,13 @@ function resolveAccessibleSurfaceRecipe(input) {
3425
3766
  const token = recipe.backgroundCandidates.find((candidate) => resolveConcreteColorHex(candidate, input.palette) !== null);
3426
3767
  const hex = token ? resolveConcreteColorHex(token, input.palette) : null;
3427
3768
  if (!token || !hex) return result;
3428
- const ink = pickBlackOrWhiteTextColor(hex);
3769
+ const ink = paletteInkOnSolid(hex, paletteInkRoles(input.palette));
3429
3770
  const foreground = (role) => ({
3430
3771
  kind: "safe-token",
3431
3772
  role,
3432
- token: asAccessibleSurfaceToken(ink),
3433
- hex: ink,
3434
- contrastRatio: contrastRatio(ink, hex)
3773
+ token: asAccessibleSurfaceToken(paletteInkToken(ink)),
3774
+ hex: ink.hex,
3775
+ contrastRatio: ink.ratio
3435
3776
  });
3436
3777
  return {
3437
3778
  kind: "resolved-accessible-surface",
@@ -3530,16 +3871,24 @@ function tryAccessibleSurfaceRecipe(input) {
3530
3871
  rejectedCandidates
3531
3872
  };
3532
3873
  }
3874
+ /**
3875
+ * The recipe's explicit candidates first; when none reads, the palette's own
3876
+ * ink on this ground at the recipe's threshold (the shared owner, which tries
3877
+ * the palette's text and background before black or white). Null only when
3878
+ * even black or white misses the threshold, so the recipe tries its next ground.
3879
+ */
3533
3880
  function resolveRequiredForeground(input) {
3534
- return resolveSafeToken({
3881
+ const explicit = resolveSafeToken(input);
3882
+ if (explicit) return explicit;
3883
+ const ink = paletteInk(solidPaint(input.backgroundHex), paletteInkRoles(input.palette), input.threshold);
3884
+ if (ink.kind === "unpaintable") return null;
3885
+ return {
3886
+ kind: "safe-token",
3535
3887
  role: input.role,
3536
- candidates: input.candidates,
3537
- backgroundToken: input.backgroundToken,
3538
- backgroundHex: input.backgroundHex,
3539
- palette: input.palette,
3540
- threshold: input.threshold,
3541
- rejectedCandidates: input.rejectedCandidates
3542
- });
3888
+ token: asAccessibleSurfaceToken(paletteInkToken(ink)),
3889
+ hex: ink.hex,
3890
+ contrastRatio: ink.ratio
3891
+ };
3543
3892
  }
3544
3893
  function resolveSupportingForeground(input) {
3545
3894
  const resolved = resolveSafeToken({
@@ -4397,4 +4746,4 @@ function mapSurfaceTreeChildren(value, map) {
4397
4746
  return isSurfaceTreeRecord(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, map(item)])) : value;
4398
4747
  }
4399
4748
  //#endregion
4400
- export { solveSurfaceInks as $, DEFAULT_BUTTON_SIZES as A, featuresFromHex as At, resolveThemeColorReferenceValue as B, buttonRadius as C, resolveOpaqueSurfaceHex as Ct, materializeRuntimeButtonAppearance as D, contrastRatio as Dt, buttonTypographyDeclarations as E, requirePaletteColorsFromEntries as Et, defineButtonStyleRecipe as F, rgbToHex as Ft, mergeStyles as G, backgroundColorStyle as H, mapButtonRoleAppearances as I, srgbToOklab as It, textColorValue as J, rgbColorValue as K, mapButtonVisualAppearances as L, FONT_SIZE_MAP as M, oklabToOklch as Mt, generateShadowValue as N, oklabToSrgb as Nt, paddingDeclarations as O, preparePaletteColourIndex as Ot, PUBLIC_BUTTON_ROLES as P, oklchToHexGamut as Pt, CONTROL_EDGE_SEED_TOKEN as Q, isCssColorLiteral as R, buttonBorder as S, resolveConcreteColorHex as St, buttonStateAppearanceDeclarations as T, paletteValueKeySchema as Tt, borderColorStyle as U, resolveTokenOrCssColorValue as V, cssVarValue as W, safeTokenOr as X, resolveSurfaceForeground as Y, surfaceInkPublication as Z, contextualButtonSurfaceResetStyles as _, surfaceInkDeclarations as _t, requireResolvedSurface as a, inkReference as at, BUTTON_CONTRAST_POLICY as b, freezeOwnedThemeValue as bt, surfaceButtonRequest as c, planForegroundHover as ct, toAccessibleColorSurfaceIntent as d, SURFACE_INK_CSS_VARS as dt, _classPrivateFieldGet2 as et, compositeHex as f, surfaceForegroundDeclarations as ft, actionVariableFallback as g, surfaceForegroundValueWithOpacity as gt, scrimTone as h, surfaceForegroundValue as ht, prepareThemeSurfaceRevision as i, contrastThresholdByPolicy as it, ELEVATION_OFFSET as j, hexToRgb as jt, BORDER_WIDTH_MAP as k, _classPrivateFieldInitSpec as kt, surfaceDecorationColors as l, DEFAULT_SURFACE_TEXT_COLOR as lt, minimumScrimOpacity as m, surfaceForegroundStyle as mt, parseSurfaceTree as n, HOVER_TEXT_THRESHOLD as nt, resolveSurface as o, expandPalette as ot, gradientScrimSamples as p, surfaceForegroundInputFromResolved as pt, textColorStyle as q, prepareSurfaceIndex as r, certifyPaint as rt, serializeSurfaceTree as s, getTextColorForBackground as st, parseResolvedSurface as t, _classPrivateFieldSet2 as tt, surfaceTransportContext as u, SURFACE_FOREGROUND_CSS_VARS as ut, compileButtonColourStates as v, surfaceInkStyle as vt, buttonShadow as w, paletteValueKey as wt, formatButtonColourContractError as x, ownedThemeSnapshot as xt, resolveSolidButtonColour as y, surfaceInkValue as yt, resolveOnColorForThemeToken as z };
4749
+ export { resolveSurfaceForeground as $, PUBLIC_BUTTON_ROLES as A, _classPrivateFieldSet2 as At, cssVarValue as B, _classPrivateFieldInitSpec as Bt, materializeRuntimeButtonAppearance as C, resolveConcreteColorHex as Ct, ELEVATION_OFFSET as D, paletteInkRoles as Dt, DEFAULT_BUTTON_SIZES as E, paletteInk as Et, resolveOnColorForThemeToken as F, contrastRatio as Ft, callsCssLoadingFunction as G, oklchToHexGamut as Gt, rgbColorValue as H, hexToRgb as Ht, resolveThemeColorReferenceValue as I, hexLuminance as It, expandPalette as J, staysInsideDeclaration as K, rgbToHex as Kt, resolveTokenOrCssColorValue as L, luminanceInterval as Lt, mapButtonRoleAppearances as M, paletteValueKeySchema as Mt, mapButtonVisualAppearances as N, requirePaletteColorsFromEntries as Nt, FONT_SIZE_MAP as O, paletteInkToken as Ot, isCssColorLiteral as P, ORDINARY_TEXT_MIN_CONTRAST_RATIO as Pt, scrimTone as Q, backgroundColorStyle as R, preparePaletteColourIndex as Rt, buttonTypographyDeclarations as S, ownedThemeSnapshot as St, BORDER_WIDTH_MAP as T, neutralInk as Tt, textColorStyle as U, oklabToOklch as Ut, mergeStyles as V, featuresFromHex as Vt, textColorValue as W, oklabToSrgb as Wt, gradientScrimSamples as X, compositeHex as Y, minimumScrimOpacity as Z, formatButtonColourContractError as _, surfaceForegroundValueWithOpacity as _t, requireResolvedSurface as a, HOVER_TEXT_THRESHOLD as at, buttonShadow as b, surfaceInkValue as bt, surfaceButtonRequest as c, inkReference as ct, toAccessibleColorSurfaceIntent as d, SURFACE_FOREGROUND_CSS_VARS as dt, safeTokenOr as et, actionVariableFallback as f, SURFACE_INK_CSS_VARS as ft, BUTTON_CONTRAST_POLICY as g, surfaceForegroundValue as gt, resolveSolidButtonColour as h, surfaceForegroundStyle as ht, prepareThemeSurfaceRevision as i, pickBlackOrWhiteTextColor as it, defineButtonStyleRecipe as j, paletteValueKey as jt, generateShadowValue as k, _classPrivateFieldGet2 as kt, surfaceDecorationColors as l, planForegroundHover as lt, compileButtonColourStates as m, surfaceForegroundInputFromResolved as mt, parseSurfaceTree as n, CONTROL_EDGE_SEED_TOKEN as nt, resolveSurface as o, certifyPaint as ot, contextualButtonSurfaceResetStyles as p, surfaceForegroundDeclarations as pt, SURFACE_SECONDARY_TEXT_TINT_ALPHA as q, srgbToOklab as qt, prepareSurfaceIndex as r, solveSurfaceInks as rt, serializeSurfaceTree as s, contrastThresholdByPolicy as st, parseResolvedSurface as t, surfaceInkPublication as tt, surfaceTransportContext as u, DEFAULT_SURFACE_TEXT_COLOR as ut, buttonBorder as v, surfaceInkDeclarations as vt, paddingDeclarations as w, resolveOpaqueSurfaceHex as wt, buttonStateAppearanceDeclarations as x, freezeOwnedThemeValue as xt, buttonRadius as y, surfaceInkStyle as yt, borderColorStyle as z, solidPaint as zt };