@wix/form-elements 0.0.0-stage → 1.54.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 (237) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +118 -2
  3. package/dist/component/appointment-rac-DlOqbFoi.js +1005 -0
  4. package/dist/component/bookings-address-rac-CvK-P3df.js +6 -0
  5. package/dist/component/bookings-email-rac-9BEPTuox.js +6 -0
  6. package/dist/component/bookings-first-name-rac-BrU-BtPp.js +6 -0
  7. package/dist/component/bookings-header-rac-8NCL7fxp.js +8 -0
  8. package/dist/component/bookings-last-name-rac-DgLqZ1nS.js +6 -0
  9. package/dist/component/bookings-login-bar-rac-C2pzRMyt.js +74 -0
  10. package/dist/component/bookings-phone-rac-BrPBAo8B.js +6 -0
  11. package/dist/component/bookings-rich-text-rac-qpPsyIuc.js +8 -0
  12. package/dist/component/calling-country-codes-PyWuOTmF.js +243 -0
  13. package/dist/component/checkbox-field-rac-CaloY2Hs.js +625 -0
  14. package/dist/component/checkbox-group-field-headless-4HlJmarB.js +204 -0
  15. package/dist/component/checkbox-group-field-rac-B1tFZT3o.js +33 -0
  16. package/dist/component/checkbox-group-rac-C0SzN2Bx.js +6 -0
  17. package/dist/component/checkbox-rac-ssJIVvZI.js +6 -0
  18. package/dist/component/chevron-down-icon-CcpVm6B-.js +15 -0
  19. package/dist/component/contacts-address-rac-Dwf4yrGq.js +6 -0
  20. package/dist/component/contacts-birthdate-rac-C195rG5w.js +6 -0
  21. package/dist/component/contacts-company-rac-BHX6xZU8.js +6 -0
  22. package/dist/component/contacts-email-rac-CFY-m-r2.js +6 -0
  23. package/dist/component/contacts-first-name-rac-D23QFUGK.js +6 -0
  24. package/dist/component/contacts-last-name-rac-COuQB15p.js +6 -0
  25. package/dist/component/contacts-phone-rac-BfhY_I7p.js +6 -0
  26. package/dist/component/contacts-position-rac-D80_knc8.js +6 -0
  27. package/dist/component/contacts-subscribe-rac--NuPoBFm.js +13 -0
  28. package/dist/component/contacts-tax-id-rac-BURE313k.js +6 -0
  29. package/dist/component/custom-focus-class-_483Pkwp.js +4 -0
  30. package/dist/component/data-hooks-Dkw1pbRj.js +6 -0
  31. package/dist/component/date-availability-BQyNH-7j.js +49 -0
  32. package/dist/component/date-input-field-rac-BnFvhqe1.js +286 -0
  33. package/dist/component/date-input-rac-TLkITFRh.js +6 -0
  34. package/dist/component/date-picker-field-rac-BAFKYE1B.js +304 -0
  35. package/dist/component/date-picker-rac-uBJQkALE.js +6 -0
  36. package/dist/component/date-time-input-field-rac-DnOkBj7w.js +421 -0
  37. package/dist/component/date-time-input-rac-BxbWyK23.js +6 -0
  38. package/dist/component/default-limits-D7qVv_Hv.js +6 -0
  39. package/dist/component/dext-checkbox-group-rac-DnifcsEZ.js +18 -0
  40. package/dist/component/dext-checkbox-rac-D45Ok0J4.js +6 -0
  41. package/dist/component/dext-date-picker-rac-Cs47jywn.js +6 -0
  42. package/dist/component/dext-date-time-input-rac-UPwXpk2g.js +6 -0
  43. package/dist/component/dext-dropdown-rac-D18mhUDU.js +6 -0
  44. package/dist/component/dext-email-rac-B4frwTvA.js +6 -0
  45. package/dist/component/dext-number-input-rac-CoS-Fk59.js +6 -0
  46. package/dist/component/dext-phone-rac-DwR0JLia.js +6 -0
  47. package/dist/component/dext-radio-group-rac-DogWvoUg.js +18 -0
  48. package/dist/component/dext-rating-input-rac-C4NxeIto.js +6 -0
  49. package/dist/component/dext-tags-rac-DsEenrft.js +18 -0
  50. package/dist/component/dext-text-area-rac-Du-FqTqW.js +6 -0
  51. package/dist/component/dext-text-input-rac-DUE8JE9b.js +6 -0
  52. package/dist/component/dext-url-input-rac-Cn55pV9m.js +6 -0
  53. package/dist/component/donation-rac-Cjk_hFm1.js +305 -0
  54. package/dist/component/dropdown-field-headless-Dcy46MWj.js +84 -0
  55. package/dist/component/dropdown-field-rac-rMMPzKxL.js +32 -0
  56. package/dist/component/dropdown-rac-C6B8C8Yc.js +6 -0
  57. package/dist/component/ecom-address-rac-1wNixzip.js +6 -0
  58. package/dist/component/ecom-subscription-checkbox-rac-C5z68KHa.js +49 -0
  59. package/dist/component/email-input-field-rac-C7Wn2XVU.js +507 -0
  60. package/dist/component/error-icon-hZxQ6DEy.js +15 -0
  61. package/dist/component/events-repeater-rac-DTv4JD79.js +247 -0
  62. package/dist/component/events-rsvp-rac-cS7Mb04F.js +38 -0
  63. package/dist/component/field-error-headless-Dm5UCOBb.js +34 -0
  64. package/dist/component/field-label-headless-C7mDzdLq.js +52 -0
  65. package/dist/component/field-rac.module-DAPTqFDM.js +21 -0
  66. package/dist/component/fieldset-headless-CD3fds9J.js +54 -0
  67. package/dist/component/file-upload-rac-DeZvh7dy.js +484 -0
  68. package/dist/component/find-child-C60k4CxG.js +11 -0
  69. package/dist/component/fixed-payment-rac-D7t5DjVp.js +62 -0
  70. package/dist/component/form-DaOKiR16.js +8890 -0
  71. package/dist/component/form-element-classes-Bi-nNM8q.js +55 -0
  72. package/dist/component/form.css +1 -0
  73. package/dist/component/form.js +9 -0
  74. package/dist/component/format-currency-BwShJ9vM.js +44 -0
  75. package/dist/component/get-first-day-of-the-week-DvnsxYhQ.js +118 -0
  76. package/dist/component/header-field-rac-hJSXllPm.js +25 -0
  77. package/dist/component/header-rac-G_lsddOd.js +6 -0
  78. package/dist/component/headless-styles-CmcyA_pi.js +20 -0
  79. package/dist/component/helpers-HmkkXrh2.js +12 -0
  80. package/dist/component/image-choice-rac-BHyAKRDt.js +141 -0
  81. package/dist/component/index-CFW1VXFU.js +64 -0
  82. package/dist/component/index-CkCSQD3_.js +2290 -0
  83. package/dist/component/isObject-BAwJJxQ3.js +34 -0
  84. package/dist/component/messages_ar-BZXnU2Gj.js +3517 -0
  85. package/dist/component/messages_ar-L1BYLZbF.js +20 -0
  86. package/dist/component/messages_ar-PAHg01OB.js +299 -0
  87. package/dist/component/messages_bg-CO56qlOt.js +299 -0
  88. package/dist/component/messages_bg-CQcGl0Yi.js +20 -0
  89. package/dist/component/messages_bg-DgbMwIbv.js +3515 -0
  90. package/dist/component/messages_ca-BAHE5nuo.js +3515 -0
  91. package/dist/component/messages_ca-BRoHmzRw.js +20 -0
  92. package/dist/component/messages_ca-Bl6rZi_O.js +299 -0
  93. package/dist/component/messages_cs-BADd3t_h.js +3515 -0
  94. package/dist/component/messages_cs-CDyWDExk.js +298 -0
  95. package/dist/component/messages_cs-wn5UmrBw.js +20 -0
  96. package/dist/component/messages_da-BPnmb9Qb.js +20 -0
  97. package/dist/component/messages_da-BvVUWnBz.js +3515 -0
  98. package/dist/component/messages_da-DHlpaT4q.js +298 -0
  99. package/dist/component/messages_de-2czOmM8X.js +3515 -0
  100. package/dist/component/messages_de-BKgzIF1d.js +298 -0
  101. package/dist/component/messages_de-Bwx84N0O.js +20 -0
  102. package/dist/component/messages_el-BnuYMjcf.js +299 -0
  103. package/dist/component/messages_el-_D2RUBSU.js +20 -0
  104. package/dist/component/messages_el-qCyH12Uq.js +3515 -0
  105. package/dist/component/messages_en-BWaixPd6.js +3518 -0
  106. package/dist/component/messages_en-CBBcgtxs.js +296 -0
  107. package/dist/component/messages_en-DvSLxqKp.js +20 -0
  108. package/dist/component/messages_es-Cq6i2xci.js +3515 -0
  109. package/dist/component/messages_es-DlGCLaYi.js +298 -0
  110. package/dist/component/messages_es-rCKXnGf0.js +20 -0
  111. package/dist/component/messages_fi-B-ciZGqD.js +3515 -0
  112. package/dist/component/messages_fi-DzKva_Wq.js +299 -0
  113. package/dist/component/messages_fi-PCCXPo0O.js +20 -0
  114. package/dist/component/messages_fr-2im0dcYp.js +3515 -0
  115. package/dist/component/messages_fr-DMFilq1G.js +298 -0
  116. package/dist/component/messages_fr-DQa1dT9u.js +20 -0
  117. package/dist/component/messages_he-Bb1qTc2Y.js +299 -0
  118. package/dist/component/messages_he-BfIkDo1h.js +3515 -0
  119. package/dist/component/messages_he-DwIysfDp.js +20 -0
  120. package/dist/component/messages_hi-Bty6ytCh.js +3515 -0
  121. package/dist/component/messages_hi-C-6UHGbM.js +298 -0
  122. package/dist/component/messages_hi-DF1w6b6B.js +20 -0
  123. package/dist/component/messages_hr-BXzIzU3d.js +20 -0
  124. package/dist/component/messages_hr-CiU1ZVrx.js +3515 -0
  125. package/dist/component/messages_hr-tRSM9lmc.js +299 -0
  126. package/dist/component/messages_hu-ChzHFUtB.js +3515 -0
  127. package/dist/component/messages_hu-D86Taf9R.js +299 -0
  128. package/dist/component/messages_hu-Z9XpByCO.js +20 -0
  129. package/dist/component/messages_id-3952ilBE.js +20 -0
  130. package/dist/component/messages_id-CPuhTUYV.js +298 -0
  131. package/dist/component/messages_id-Ddr3ijST.js +3515 -0
  132. package/dist/component/messages_it-B-A1X4BZ.js +298 -0
  133. package/dist/component/messages_it-DnUTUabT.js +20 -0
  134. package/dist/component/messages_it-eY6GnuZC.js +3515 -0
  135. package/dist/component/messages_ja-B3PxHv2c.js +3515 -0
  136. package/dist/component/messages_ja-Ced6ZBxD.js +298 -0
  137. package/dist/component/messages_ja-Cg7CqBUL.js +20 -0
  138. package/dist/component/messages_ko-DBCjHG4c.js +3515 -0
  139. package/dist/component/messages_ko-PKIrqwPk.js +298 -0
  140. package/dist/component/messages_ko-zvhtZMGA.js +20 -0
  141. package/dist/component/messages_lt-DV3hdFsp.js +3515 -0
  142. package/dist/component/messages_lt-DywusvNm.js +20 -0
  143. package/dist/component/messages_lt-zxcCPHno.js +299 -0
  144. package/dist/component/messages_lv-BEowUv-S.js +299 -0
  145. package/dist/component/messages_lv-DggJE2f9.js +20 -0
  146. package/dist/component/messages_lv-hIonzpTs.js +3515 -0
  147. package/dist/component/messages_ms-Ca0m7bf7.js +20 -0
  148. package/dist/component/messages_ms-Cvypo0vi.js +299 -0
  149. package/dist/component/messages_ms-DoMzA8a3.js +3515 -0
  150. package/dist/component/messages_nl-CEmANR_r.js +3515 -0
  151. package/dist/component/messages_nl-CZR4TvNo.js +298 -0
  152. package/dist/component/messages_nl-DgVYmdO9.js +20 -0
  153. package/dist/component/messages_no-B2BBaGBH.js +298 -0
  154. package/dist/component/messages_no-DJfJSlDm.js +3515 -0
  155. package/dist/component/messages_no-hPkfRJQ9.js +20 -0
  156. package/dist/component/messages_pl-Bzph-WyD.js +20 -0
  157. package/dist/component/messages_pl-ChJVH7RO.js +3515 -0
  158. package/dist/component/messages_pl-rCMsbMbN.js +298 -0
  159. package/dist/component/messages_pt-Bv63V1uB.js +3515 -0
  160. package/dist/component/messages_pt-CBgCNF3T.js +20 -0
  161. package/dist/component/messages_pt-Cx0FF6uF.js +298 -0
  162. package/dist/component/messages_ro-BvLoD_wE.js +299 -0
  163. package/dist/component/messages_ro-CMzcu-9b.js +20 -0
  164. package/dist/component/messages_ro-PVRK7Gx4.js +3515 -0
  165. package/dist/component/messages_ru-8BI6MYA0.js +3515 -0
  166. package/dist/component/messages_ru-BhRKVmVC.js +298 -0
  167. package/dist/component/messages_ru-C_BaQo57.js +20 -0
  168. package/dist/component/messages_sk-Bgi_3583.js +3515 -0
  169. package/dist/component/messages_sk-CrsC7rOj.js +20 -0
  170. package/dist/component/messages_sk-CtF-ei23.js +299 -0
  171. package/dist/component/messages_sl-B5t-KKi8.js +299 -0
  172. package/dist/component/messages_sl-BFdYWVHd.js +3515 -0
  173. package/dist/component/messages_sl-NqfmyUP1.js +20 -0
  174. package/dist/component/messages_sv-Bd1CcY6G.js +3515 -0
  175. package/dist/component/messages_sv-DPRT-DpN.js +20 -0
  176. package/dist/component/messages_sv-bQwbNmjr.js +298 -0
  177. package/dist/component/messages_th-BauH9qdo.js +20 -0
  178. package/dist/component/messages_th-C_dL_PCq.js +298 -0
  179. package/dist/component/messages_th-DEWm01uD.js +3515 -0
  180. package/dist/component/messages_tl-CouXLNcW.js +299 -0
  181. package/dist/component/messages_tl-D2t9Y_ZC.js +3515 -0
  182. package/dist/component/messages_tl-UDZY8Wuk.js +20 -0
  183. package/dist/component/messages_tr-2-OHesob.js +3515 -0
  184. package/dist/component/messages_tr-CpsxYTDb.js +20 -0
  185. package/dist/component/messages_tr-DHXnlj_j.js +298 -0
  186. package/dist/component/messages_uk-CPK4y5lH.js +298 -0
  187. package/dist/component/messages_uk-DIuQ2HoD.js +3515 -0
  188. package/dist/component/messages_uk-gPkmA_ar.js +20 -0
  189. package/dist/component/messages_vi-CgxB4Ey0.js +20 -0
  190. package/dist/component/messages_vi-DZeFWgwp.js +3515 -0
  191. package/dist/component/messages_vi-Det8i7_V.js +298 -0
  192. package/dist/component/messages_zh-D53_A4N9.js +298 -0
  193. package/dist/component/messages_zh-O552w5dp.js +20 -0
  194. package/dist/component/messages_zh-nG7LNxIt.js +3515 -0
  195. package/dist/component/multiline-address-field-rac-CwLOzNF6.js +1574 -0
  196. package/dist/component/multiline-address-rac-C4JXBlFC.js +6 -0
  197. package/dist/component/non-modal-popover-DtIMXHbe.js +63 -0
  198. package/dist/component/number-input-field-rac-BOeiugCV.js +89 -0
  199. package/dist/component/number-input-rac-NqbFwW0d.js +6 -0
  200. package/dist/component/numeric-input-utils-CuBMi4-a.js +45 -0
  201. package/dist/component/options-layout-constants-DEfIEJWD.js +6 -0
  202. package/dist/component/options-rac.module-KM-VT_KY.js +7 -0
  203. package/dist/component/password-rac-DxCYgvu_.js +142 -0
  204. package/dist/component/payment-field-utils-DobiK5Xh.js +12 -0
  205. package/dist/component/payment-input-rac-C2aof0p0.js +137 -0
  206. package/dist/component/phone-input-field-rac-Cd7RFaoD.js +473 -0
  207. package/dist/component/phone-rac-4MQREqBG.js +6 -0
  208. package/dist/component/product-list-rac-CjoepDQ_.js +263 -0
  209. package/dist/component/quiz-radio-group-rac-CIwk7N3X.js +13 -0
  210. package/dist/component/radio-group-field-rac-DE2mnUHD.js +40 -0
  211. package/dist/component/radio-group-field-rac.module-DEP9BCiX.js +124 -0
  212. package/dist/component/radio-group-rac-XE6CeGnp.js +6 -0
  213. package/dist/component/rating-input-field-rac-BzAAMipp.js +130 -0
  214. package/dist/component/rating-input-rac-oIvpEVjK.js +6 -0
  215. package/dist/component/rich-content-rac.module-cis7mx3M.js +49 -0
  216. package/dist/component/rich-text-field-rac-CqkM22CI.js +22 -0
  217. package/dist/component/rich-text-rac-BKbz3TcX.js +6 -0
  218. package/dist/component/ricos-viewer-chunk-B4rfbgjA.js +5 -0
  219. package/dist/component/service-dropdown-rac-CfCMbT9d.js +142 -0
  220. package/dist/component/services-multi-choice-rac-F2h5gUOr.js +76 -0
  221. package/dist/component/signature-rac-CIRsmZhS.js +795 -0
  222. package/dist/component/submit-button-rac-BELGrClx.js +115 -0
  223. package/dist/component/tags-field-rac-B6Hg2XOI.js +201 -0
  224. package/dist/component/tags-rac-Dfv8VP7J.js +6 -0
  225. package/dist/component/text-area-field-rac-Bsd1V2Q3.js +69 -0
  226. package/dist/component/text-area-rac-BNVdI-Gq.js +6 -0
  227. package/dist/component/text-input-field-rac-DF9dD_KW.js +24 -0
  228. package/dist/component/text-input-headless-Dlao2R8f.js +44 -0
  229. package/dist/component/text-input-rac-C2p7E01b.js +6 -0
  230. package/dist/component/time-input-rac-90mLBZsX.js +152 -0
  231. package/dist/component/url-input-field-rac-bCEOlctr.js +71 -0
  232. package/dist/component/url-input-rac-D5o8b9gx.js +6 -0
  233. package/dist/component/use-invoke-callback-UH73A_J3.js +15 -0
  234. package/dist/component/use-service-options-base-DO5hy6mn.js +48 -0
  235. package/dist/component/use-synced-display-value-DcAxdn3M.js +19 -0
  236. package/dist/form.d.ts +6930 -0
  237. package/package.json +164 -3
@@ -0,0 +1,1005 @@
1
+ import o, { useRef as J, useState as j, useEffect as Y, createContext as Ge, useContext as Ze, useMemo as P, useCallback as ie } from "react";
2
+ import { RicosViewer as lt } from "@wix/ricos/viewer";
3
+ import T from "classnames";
4
+ import { aa as ce, a9 as ct, ac as ke, ab as mt, c as ut, aq as dt, ap as ft, ag as me, ad as Se, ai as Dt, af as Et, F as St } from "./form-DaOKiR16.js";
5
+ import { C as Be } from "./chevron-down-icon-CcpVm6B-.js";
6
+ import { E as pt } from "./error-icon-hZxQ6DEy.js";
7
+ import { s as fe } from "./field-rac.module-DAPTqFDM.js";
8
+ import { r as De, H as yt, s as Ie, g as Lt, h as Oe, f as _t, t as Nt, l as At } from "./form-element-classes-Bi-nNM8q.js";
9
+ import { ListBox as bt, Button as Re, ListBoxItem as gt, RadioGroup as It, RadioField as Ot, RadioButton as Tt } from "react-aria-components";
10
+ import { f as w, a as le } from "./find-child-C60k4CxG.js";
11
+ import { D as wt, E as vt } from "./field-error-headless-Dm5UCOBb.js";
12
+ import { L as kt } from "./field-label-headless-C7mDzdLq.js";
13
+ import { F as Rt } from "./fieldset-headless-CD3fds9J.js";
14
+ import { g as ht } from "./get-first-day-of-the-week-DvnsxYhQ.js";
15
+ import "date-fns";
16
+ import { V as Ve } from "./headless-styles-CmcyA_pi.js";
17
+ function Ft(e) {
18
+ return { evid: 40, src: 16, endpoint: "", params: e };
19
+ }
20
+ var Te = /* @__PURE__ */ (function(e) {
21
+ return e.BOOKING_NOT_INSTALL = "BOOKING_NOT_INSTALL", e.NO_AVAILABILITY_DATES_FOUND = "NO_AVAILABILITY_DATES_FOUND", e.GENERAL = "GENERAL", e;
22
+ })({}), z = /* @__PURE__ */ (function(e) {
23
+ return e.LOADING = "LOADING", e.DONE = "DONE", e.ERROR = "ERROR", e;
24
+ })({});
25
+ const V = 4;
26
+ var Q = /* @__PURE__ */ (function(e) {
27
+ return e.FORM = "form", e.NO_AVAILABILITY_FOR_DATE = "no availability for date empty state", e.NO_AVAILABILITY_AT_ALL = "no availability at all empty state", e.SLOT = "slot", e.DATE = "date", e.PAGINATION = "pagination", e.SHOW_MORE = "show more", e;
28
+ })({}), te = /* @__PURE__ */ (function(e) {
29
+ return e.LOAD = "load", e.CLICK = "click", e;
30
+ })({});
31
+ const Mt = (e) => {
32
+ var t;
33
+ return {
34
+ bookingsServiceId: e == null ? void 0 : e.id,
35
+ formGuid: (t = e == null ? void 0 : e.form) == null ? void 0 : t.id,
36
+ serviceProperties: Ct(e)
37
+ };
38
+ }, Ct = (e) => {
39
+ var t;
40
+ return JSON.stringify({
41
+ serviceId: e == null ? void 0 : e.id,
42
+ serviceType: e == null ? void 0 : e.type,
43
+ locationIds: (t = e == null ? void 0 : e.locations) == null ? void 0 : t.map((n) => n.id).filter((n) => n),
44
+ staffMemberIds: e == null ? void 0 : e.staffMemberIds,
45
+ isOfferedAsPricingPlan: !1
46
+ });
47
+ }, qe = (e) => {
48
+ var u;
49
+ const { appointmentFieldProps: t } = he(), { isEditor: n, isComposer: a } = ce(), s = ct(), r = e || ((u = t == null ? void 0 : t.initialData) == null ? void 0 : u.service);
50
+ if (!(n || a))
51
+ return {
52
+ ...s,
53
+ report: (i) => s == null ? void 0 : s.report(Ft({
54
+ ...Mt(r),
55
+ ...i
56
+ }))
57
+ };
58
+ };
59
+ var we;
60
+ (function(e) {
61
+ e.UNDEFINED = "UNDEFINED", e.OWNER_BUSINESS = "OWNER_BUSINESS", e.OWNER_CUSTOM = "OWNER_CUSTOM", e.CUSTOM = "CUSTOM";
62
+ })(we || (we = {}));
63
+ var Ue;
64
+ (function(e) {
65
+ e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
66
+ })(Ue || (Ue = {}));
67
+ var xe;
68
+ (function(e) {
69
+ e.UNKNOWN_LOCATION_TYPE = "UNKNOWN_LOCATION_TYPE", e.BUSINESS = "BUSINESS", e.CUSTOM = "CUSTOM", e.CUSTOMER = "CUSTOMER";
70
+ })(xe || (xe = {}));
71
+ var Pe;
72
+ (function(e) {
73
+ e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
74
+ })(Pe || (Pe = {}));
75
+ var ze;
76
+ (function(e) {
77
+ e.ASC = "ASC", e.DESC = "DESC";
78
+ })(ze || (ze = {}));
79
+ const Wt = (e) => {
80
+ const { service: t } = e || {};
81
+ return (t == null ? void 0 : t.id) ? null : {
82
+ type: Te.GENERAL,
83
+ message: "Service ID is missing"
84
+ };
85
+ }, Bt = ({ appointmentFieldProps: e, isEditor: t, isComposer: n }) => {
86
+ const { initialData: a } = e, s = Pt();
87
+ if (t || n)
88
+ return {
89
+ ...s,
90
+ timezone: je(),
91
+ dataStatus: z.DONE
92
+ };
93
+ {
94
+ const r = Wt(a);
95
+ if (r)
96
+ return {
97
+ dataStatus: z.ERROR,
98
+ error: r
99
+ };
100
+ }
101
+ return {
102
+ ...s,
103
+ dataStatus: z.LOADING
104
+ };
105
+ }, Ut = (e, t) => {
106
+ const n = /* @__PURE__ */ new Date(), a = new Date(n);
107
+ a.setMonth(a.getMonth() + e);
108
+ const s = new Date(n.toLocaleString("en-US", {
109
+ timeZone: t
110
+ })), r = new Date(a.toLocaleString("en-US", {
111
+ timeZone: t
112
+ }));
113
+ return {
114
+ startDate: s,
115
+ endDate: r
116
+ };
117
+ }, je = () => Intl.DateTimeFormat().resolvedOptions().timeZone, xt = (e) => {
118
+ var t, n, a;
119
+ if ((n = (t = e == null ? void 0 : e[0]) == null ? void 0 : t.slot) != null && n.startDate)
120
+ return new Date((a = e[0].slot) == null ? void 0 : a.startDate);
121
+ }, Pt = ({ duration: e = 60, timezone: t = "UTC" } = {}) => {
122
+ var E, f;
123
+ const n = "267d1c11-8019-4e3d-b9c6-cd2b859c69e2", a = /* @__PURE__ */ new Date(), s = [], r = [], u = a.toISOString().split("T")[0], i = 10, l = 18;
124
+ let c = /* @__PURE__ */ new Date(`${u}T${i}:00:00`), d = new Date(c);
125
+ d.setMinutes(d.getMinutes() + e);
126
+ let S = !1;
127
+ for (; d.getHours() < l || d.getHours() === l && d.getMinutes() === 0; ) {
128
+ const O = {
129
+ slot: {
130
+ serviceId: n,
131
+ startDate: c.toISOString(),
132
+ endDate: d.toISOString(),
133
+ location: {
134
+ locationType: we.CUSTOM
135
+ }
136
+ },
137
+ bookable: !0,
138
+ totalSpots: 1,
139
+ openSpots: 1,
140
+ bookingPolicyViolations: {
141
+ tooEarlyToBook: !1,
142
+ tooLateToBook: !1,
143
+ bookOnlineDisabled: !1
144
+ },
145
+ nestedSlots: []
146
+ };
147
+ r.push(O), S || (s.push(O), S = !0), c = new Date(d), d = new Date(c), d.setMinutes(d.getMinutes() + e);
148
+ }
149
+ return {
150
+ availabilitySlots: r,
151
+ availabilityDates: s,
152
+ timezone: t,
153
+ currentSlotBulkSize: V,
154
+ selectedDate: s.length > 0 && ((f = (E = s[0]) == null ? void 0 : E.slot) != null && f.startDate) ? new Date(s[0].slot.startDate) : void 0
155
+ };
156
+ };
157
+ function zt(e) {
158
+ var f;
159
+ const { initialData: t, onChange: n, value: a } = e, { isEditor: s, isComposer: r } = ce(), u = (f = t == null ? void 0 : t.service) == null ? void 0 : f.id, { actions: i } = ke(), l = J(i);
160
+ l.current = i;
161
+ const c = !!(i != null && i.getAvailabilityDates && (i != null && i.getAvailabilitySlots)), [d, S] = j(null), E = qe(t == null ? void 0 : t.service);
162
+ return Y(() => {
163
+ u && !s && !r && c && (async () => {
164
+ var W, N, A, K, B;
165
+ const v = je(), I = {
166
+ currentSlotBulkSize: V,
167
+ timezone: v,
168
+ dataStatus: z.LOADING
169
+ };
170
+ try {
171
+ const U = async (oe) => {
172
+ var k, p;
173
+ const { startDate: se, endDate: $ } = Ut(oe, v);
174
+ return (p = (k = l.current) == null ? void 0 : k.getAvailabilityDates) == null ? void 0 : p.call(k, {
175
+ serviceId: u,
176
+ fromDate: se,
177
+ toDate: $,
178
+ timeZone: v
179
+ });
180
+ };
181
+ if (I.availabilityDates = await U(2), (W = I.availabilityDates) != null && W.length || (I.availabilityDates = await U(6)), !((N = I.availabilityDates) != null && N.length)) {
182
+ E == null || E.report({
183
+ action: te.LOAD,
184
+ component: Q.NO_AVAILABILITY_AT_ALL
185
+ }), S({
186
+ dataStatus: z.ERROR,
187
+ error: {
188
+ type: Te.NO_AVAILABILITY_DATES_FOUND,
189
+ message: "No availability dates found"
190
+ }
191
+ });
192
+ return;
193
+ }
194
+ I.selectedDate = xt(I.availabilityDates), I.selectedDate && (I.availabilitySlots = await ((K = (A = l.current) == null ? void 0 : A.getAvailabilitySlots) == null ? void 0 : K.call(A, {
195
+ serviceId: u,
196
+ timeZone: v,
197
+ selectedDate: I.selectedDate
198
+ }))), E == null || E.report({
199
+ action: te.LOAD,
200
+ component: (B = I.availabilityDates) != null && B.length ? Q.FORM : Q.NO_AVAILABILITY_FOR_DATE
201
+ }), a != null && a.startDate || n(void 0), S({
202
+ ...I,
203
+ dataStatus: z.DONE
204
+ });
205
+ } catch (U) {
206
+ console.error(U), S({
207
+ dataStatus: z.ERROR,
208
+ error: {
209
+ type: Te.GENERAL,
210
+ message: "An error occurred in initialAppointmentState"
211
+ }
212
+ });
213
+ }
214
+ })();
215
+ }, [
216
+ s,
217
+ r,
218
+ u,
219
+ c
220
+ ]), d;
221
+ }
222
+ const Qe = /* @__PURE__ */ Ge({
223
+ appointmentState: {},
224
+ setAppointmentState: () => {
225
+ }
226
+ }), Yt = ({ appointmentFieldProps: e, children: t }) => {
227
+ const { isEditor: n, isComposer: a } = ce(), [s, r] = j(() => Bt({
228
+ appointmentFieldProps: e,
229
+ isEditor: n,
230
+ isComposer: a
231
+ })), u = zt(e);
232
+ return Y(() => {
233
+ u && r({
234
+ ...s,
235
+ ...u
236
+ });
237
+ }, [
238
+ u
239
+ ]), /* @__PURE__ */ o.createElement(Qe.Provider, {
240
+ value: {
241
+ appointmentFieldProps: e,
242
+ appointmentState: s,
243
+ setAppointmentState: (i) => r({
244
+ ...s,
245
+ ...i
246
+ })
247
+ }
248
+ }, t);
249
+ }, he = () => Ze(Qe), Kt = (e, t) => {
250
+ if (e.startOfWeek.getMonth() === e.endOfWeek.getMonth())
251
+ return new Intl.DateTimeFormat(t, {
252
+ month: "long",
253
+ year: "numeric"
254
+ }).format(e.endOfWeek);
255
+ const n = new Intl.DateTimeFormat(t, {
256
+ month: "short"
257
+ }).format(e.startOfWeek), a = new Intl.DateTimeFormat(t, {
258
+ month: "short",
259
+ year: "numeric"
260
+ }).format(e.endOfWeek);
261
+ return `${n} - ${a}`;
262
+ }, Ht = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) || !(e != null && e.timeZone) ? null : {
263
+ startDate: e == null ? void 0 : e.startDate,
264
+ endDate: e == null ? void 0 : e.endDate,
265
+ timeZone: e == null ? void 0 : e.timeZone
266
+ }, Ye = ({ timezone: e, language: t, formatType: n }) => {
267
+ var s;
268
+ return (s = new Intl.DateTimeFormat(t, {
269
+ timeZone: e,
270
+ timeZoneName: n === "name" ? "long" : "short"
271
+ }).formatToParts(/* @__PURE__ */ new Date()).find(({ type: r }) => r === "timeZoneName")) == null ? void 0 : s.value;
272
+ }, $t = ({ timezone: e, language: t }) => {
273
+ const n = Ye({
274
+ timezone: e,
275
+ language: t,
276
+ formatType: "name"
277
+ }), a = Ye({
278
+ timezone: e,
279
+ language: t,
280
+ formatType: "offset"
281
+ });
282
+ return `${n} (${a})`;
283
+ }, ne = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), Gt = (e, t) => {
284
+ const n = new Date(e);
285
+ n.setDate(e.getDate() - t);
286
+ const a = new Date(e);
287
+ return a.setDate(e.getDate() + t), {
288
+ fromDate: n,
289
+ toDate: a
290
+ };
291
+ }, Zt = ({ setIsReloadingSlots: e }) => {
292
+ const { appointmentFieldProps: t, appointmentState: n, setAppointmentState: a } = he(), { value: s } = t, { actions: r } = ke();
293
+ Y(() => {
294
+ (async () => {
295
+ var i, l;
296
+ if (s != null && s.startDate && (n != null && n.selectedDate) && (n == null ? void 0 : n.dataStatus) === z.DONE && !ne(new Date(s.startDate), n == null ? void 0 : n.selectedDate)) {
297
+ e(!0);
298
+ const d = new Date(s.startDate), { fromDate: S, toDate: E } = Gt(d, 8), [f, O] = await Promise.all([
299
+ (i = r == null ? void 0 : r.getAvailabilityDates) == null ? void 0 : i.call(r, {
300
+ serviceId: t == null ? void 0 : t.initialData.service.id,
301
+ timeZone: (n == null ? void 0 : n.timezone) || "",
302
+ fromDate: S,
303
+ toDate: E
304
+ }),
305
+ (l = r == null ? void 0 : r.getAvailabilitySlots) == null ? void 0 : l.call(r, {
306
+ serviceId: t == null ? void 0 : t.initialData.service.id,
307
+ timeZone: (n == null ? void 0 : n.timezone) || "",
308
+ selectedDate: d
309
+ })
310
+ ]);
311
+ a({
312
+ availabilityDates: f,
313
+ selectedDate: d,
314
+ availabilitySlots: O
315
+ }), e(!1);
316
+ }
317
+ })();
318
+ }, [
319
+ s,
320
+ n == null ? void 0 : n.dataStatus
321
+ ]);
322
+ }, Vt = (e, t) => !e || !t.length ? e : e.filter((n) => {
323
+ var a;
324
+ return !t.includes(((a = n == null ? void 0 : n.slot) == null ? void 0 : a.startDate) ?? "");
325
+ }), Ee = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) ? "" : `${e == null ? void 0 : e.startDate}_${e == null ? void 0 : e.endDate}`, qt = ({ locale: e, endDate: t, startDate: n, timezone: a }) => {
326
+ const s = {
327
+ hour: "numeric",
328
+ minute: "numeric",
329
+ timeZone: a
330
+ }, r = new Intl.DateTimeFormat(e, s).format(new Date(n)), u = new Intl.DateTimeFormat(e, s).format(new Date(t));
331
+ return `${r} - ${u}`;
332
+ }, jt = ({ selectedDate: e, locale: t, timezone: n }) => e ? new Intl.DateTimeFormat(t, {
333
+ weekday: "long",
334
+ month: "short",
335
+ day: "numeric",
336
+ timeZone: n
337
+ }).format(e) : "", Qt = (e, t) => {
338
+ let n;
339
+ return t.forEach((a, s) => {
340
+ var r, u;
341
+ Ee({
342
+ startDate: (r = a == null ? void 0 : a.slot) == null ? void 0 : r.startDate,
343
+ endDate: (u = a == null ? void 0 : a.slot) == null ? void 0 : u.endDate
344
+ }) === e && (n = s);
345
+ }), n;
346
+ };
347
+ var Jt = /* @__PURE__ */ (function(e) {
348
+ return e.OS_LOCATION = "OS_LOCATION", e.CUSTOM_LOCATION = "CUSTOM_LOCATION", e;
349
+ })({});
350
+ const Xt = "SLOT_UNAVAILABLE", Ke = [], en = (e) => {
351
+ var t;
352
+ return ((t = e == null ? void 0 : e.params) == null ? void 0 : t.reason) === Xt;
353
+ }, tn = ({ error: e, selectedSlot: t }) => {
354
+ const { isExperimentEnabled: n } = mt(), a = n(ut.BIF_SLOT_HOLD), [s, r] = j(Ke), u = a && en(e), i = t == null ? void 0 : t.startDate, l = J(!1);
355
+ return Y(() => {
356
+ if (!u) {
357
+ l.current = !1;
358
+ return;
359
+ }
360
+ l.current || (l.current = !0, i && r((c) => c.includes(i) ? c : [
361
+ ...c,
362
+ i
363
+ ]));
364
+ }, [
365
+ u,
366
+ i
367
+ ]), a ? s : Ke;
368
+ }, q = 7, ve = (e) => {
369
+ const t = new Date(e);
370
+ return t.setHours(0, 0, 0, 0), t;
371
+ }, nn = (e) => {
372
+ const t = new Date(e);
373
+ return t.setHours(23, 59, 59, 999), t;
374
+ }, ee = (e, t) => {
375
+ const n = new Date(e);
376
+ return n.setDate(n.getDate() + t), n;
377
+ }, He = (e, t) => {
378
+ const n = ve(e), a = (n.getDay() - t + q) % q;
379
+ return ee(n, -a);
380
+ }, an = (e) => `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`, on = (e, t, n) => {
381
+ const a = new Intl.DateTimeFormat(n, {
382
+ month: "short",
383
+ day: "numeric"
384
+ });
385
+ return typeof a.formatRange == "function" ? a.formatRange(e, t) : `${a.format(e)} - ${a.format(t)}`;
386
+ }, sn = (e, t = []) => t.some((n) => {
387
+ var a;
388
+ return !!((a = n.slot) != null && a.startDate) && ne(new Date(n.slot.startDate), e);
389
+ }), rn = () => {
390
+ var We;
391
+ const { appointmentFieldProps: e, appointmentState: t, setAppointmentState: n } = he(), { language: a, isEditor: s, isComposer: r, isMobile: u } = ce(), { t: i } = dt(), { actions: l } = ke(), c = qe(), [d, S] = j(!1), [E, f] = j(!1), [O, v] = j(), [I, W] = j();
392
+ Zt({
393
+ setIsReloadingSlots: S
394
+ });
395
+ const { onChange: N, value: A, target: K, initialData: B, formatDescription: U, locationType: oe, error: se } = e, { availabilityDates: $, availabilitySlots: k, timezone: p = "", selectedDate: L, currentSlotBulkSize: R, dataStatus: G, error: ue } = t, H = (We = B == null ? void 0 : B.service) == null ? void 0 : We.id, Z = G === z.LOADING, X = d || E, pe = !!ue, Me = tn({
396
+ error: se,
397
+ selectedSlot: A
398
+ }), _ = P(() => Vt(k, Me), [
399
+ k,
400
+ Me
401
+ ]);
402
+ Y(() => {
403
+ N == null || N(Ht(A));
404
+ }, [
405
+ A == null ? void 0 : A.startDate,
406
+ A == null ? void 0 : A.endDate,
407
+ p
408
+ ]), ft((D) => {
409
+ const b = D == null ? void 0 : D[K];
410
+ k != null && k.length && n({
411
+ availabilitySlots: k.filter((g) => {
412
+ var h;
413
+ return ((h = g == null ? void 0 : g.slot) == null ? void 0 : h.startDate) !== (b == null ? void 0 : b.startDate);
414
+ })
415
+ });
416
+ }), Y(() => {
417
+ if (_ != null && _.length && R) {
418
+ const D = Qt(Ee(A ?? void 0), _);
419
+ D && D + 1 > R && n({
420
+ currentSlotBulkSize: D + 1
421
+ });
422
+ } else !(_ != null && _.length) && A && (N == null || N(void 0));
423
+ }, [
424
+ A,
425
+ _,
426
+ $
427
+ ]);
428
+ const ye = P(() => ht(a), [
429
+ a
430
+ ]), Ce = J(L);
431
+ Y(() => {
432
+ const D = Ce.current;
433
+ Ce.current = L, !!L && (!D || !ne(D, L)) && v(void 0);
434
+ }, [
435
+ L
436
+ ]);
437
+ const M = P(() => O ?? He(L ?? /* @__PURE__ */ new Date(), ye), [
438
+ O,
439
+ L,
440
+ ye
441
+ ]), et = P(() => {
442
+ const D = ve(/* @__PURE__ */ new Date()), b = new Intl.DateTimeFormat(a, {
443
+ weekday: u ? "narrow" : "short"
444
+ }), g = new Intl.DateTimeFormat(a, {
445
+ day: "numeric"
446
+ }), h = new Intl.DateTimeFormat(a, {
447
+ weekday: "long",
448
+ month: "long",
449
+ day: "numeric"
450
+ });
451
+ return Array.from({
452
+ length: q
453
+ }, (re, be) => {
454
+ const x = ee(M, be), ge = !!L && ne(x, L), it = ve(x) < D;
455
+ return {
456
+ key: an(x),
457
+ date: x,
458
+ isSelected: ge,
459
+ isAvailable: !Z && !X && !ge && sn(x, $),
460
+ isDisabled: it || X && !ge,
461
+ isToday: ne(x, D),
462
+ dayOfMonthLabel: g.format(x),
463
+ weekdayLabel: b.format(x),
464
+ label: h.format(x),
465
+ availabilityLabel: i("form.appointment.accessibility.calendar.has-availability.aria-label")
466
+ };
467
+ });
468
+ }, [
469
+ M,
470
+ L,
471
+ $,
472
+ Z,
473
+ X,
474
+ a,
475
+ u,
476
+ i
477
+ ]), Le = Ee(A ?? void 0) || void 0, _e = P(() => Z || d ? [] : (_ ?? []).slice(0, R).flatMap((D) => {
478
+ const { startDate: b, endDate: g } = D.slot ?? {};
479
+ if (!b || !g)
480
+ return [];
481
+ const h = Ee({
482
+ startDate: b,
483
+ endDate: g
484
+ });
485
+ return [
486
+ {
487
+ key: h,
488
+ startDate: b,
489
+ endDate: g,
490
+ timeRange: qt({
491
+ startDate: b,
492
+ endDate: g,
493
+ locale: a,
494
+ timezone: p
495
+ }),
496
+ isSelected: h === Le
497
+ }
498
+ ];
499
+ }), [
500
+ _,
501
+ R,
502
+ Z,
503
+ d,
504
+ a,
505
+ p,
506
+ Le
507
+ ]), Ne = !d && !!(_ != null && _.length) && (R || V) < _.length, Ae = M > He(/* @__PURE__ */ new Date(), ye), tt = ie(
508
+ async (D) => {
509
+ var b;
510
+ if (!(X || L && ne(D, L))) {
511
+ S(!0), N == null || N(void 0), n({
512
+ currentSlotBulkSize: V,
513
+ selectedDate: D,
514
+ availabilitySlots: void 0
515
+ }), c == null || c.report({
516
+ action: te.CLICK,
517
+ component: Q.DATE
518
+ });
519
+ try {
520
+ const g = await ((b = l == null ? void 0 : l.getAvailabilitySlots) == null ? void 0 : b.call(l, {
521
+ serviceId: H,
522
+ timeZone: p,
523
+ selectedDate: D
524
+ }));
525
+ n({
526
+ currentSlotBulkSize: V,
527
+ selectedDate: D,
528
+ availabilitySlots: g
529
+ });
530
+ } catch {
531
+ } finally {
532
+ S(!1);
533
+ }
534
+ }
535
+ },
536
+ // eslint-disable-next-line react-hooks/exhaustive-deps
537
+ [
538
+ X,
539
+ L,
540
+ H,
541
+ p,
542
+ l,
543
+ N,
544
+ c
545
+ ]
546
+ ), de = J(0), nt = ie(
547
+ async (D) => {
548
+ var re;
549
+ if (D < 0 && !Ae)
550
+ return;
551
+ const b = M, g = ee(M, D * q);
552
+ if (v(g), s || r)
553
+ return;
554
+ const h = ++de.current;
555
+ f(!0), c == null || c.report({
556
+ action: te.CLICK,
557
+ component: Q.PAGINATION
558
+ });
559
+ try {
560
+ const be = await ((re = l == null ? void 0 : l.getAvailabilityDates) == null ? void 0 : re.call(l, {
561
+ serviceId: H,
562
+ timeZone: p,
563
+ fromDate: g,
564
+ toDate: nn(ee(g, q - 1))
565
+ }));
566
+ h === de.current && n({
567
+ availabilityDates: be
568
+ });
569
+ } catch {
570
+ h === de.current && v(b);
571
+ } finally {
572
+ h === de.current && f(!1);
573
+ }
574
+ },
575
+ // eslint-disable-next-line react-hooks/exhaustive-deps
576
+ [
577
+ Ae,
578
+ M,
579
+ s,
580
+ r,
581
+ H,
582
+ p,
583
+ l,
584
+ c
585
+ ]
586
+ ), at = ie(
587
+ (D) => {
588
+ const b = _e.find((re) => re.key === D);
589
+ if (!b)
590
+ return;
591
+ const { startDate: g, endDate: h } = b;
592
+ c == null || c.report({
593
+ action: te.CLICK,
594
+ component: Q.SLOT,
595
+ startTime: new Date(g).valueOf(),
596
+ endTime: new Date(h).valueOf()
597
+ }), N == null || N({
598
+ startDate: g,
599
+ endDate: h,
600
+ timeZone: p
601
+ });
602
+ },
603
+ // eslint-disable-next-line react-hooks/exhaustive-deps
604
+ [
605
+ _e,
606
+ p,
607
+ N,
608
+ c
609
+ ]
610
+ ), ot = ie(() => {
611
+ if (!Ne)
612
+ return;
613
+ const D = R || V;
614
+ c == null || c.report({
615
+ action: te.CLICK,
616
+ component: Q.SHOW_MORE
617
+ }), W(D), n({
618
+ currentSlotBulkSize: D + V
619
+ });
620
+ }, [
621
+ Ne,
622
+ R,
623
+ c
624
+ ]), st = ie(() => W(void 0), []), rt = P(() => {
625
+ if (pe)
626
+ return i("form.appointment.empty-state.notification.text");
627
+ if (!Z && !d && !(_ != null && _.length))
628
+ return i("form.appointment.slots-not-found.text");
629
+ }, [
630
+ pe,
631
+ Z,
632
+ d,
633
+ _ == null ? void 0 : _.length,
634
+ i
635
+ ]);
636
+ return {
637
+ days: et,
638
+ slots: _e,
639
+ selectedSlotKey: Le,
640
+ selectDate: tt,
641
+ selectSlot: at,
642
+ changeWeek: nt,
643
+ showMoreSlots: ot,
644
+ canGoToPreviousWeek: Ae,
645
+ hasMoreSlots: Ne,
646
+ hasError: pe,
647
+ isLoading: Z,
648
+ isRefetching: X,
649
+ isReloadingSlots: d,
650
+ weekRangeLabel: on(M, ee(M, q - 1), a),
651
+ weekCaptionLabel: Kt({
652
+ startOfWeek: M,
653
+ endOfWeek: ee(M, q - 1)
654
+ }, a),
655
+ selectedDateLabel: jt({
656
+ selectedDate: L,
657
+ locale: a,
658
+ timezone: p
659
+ }),
660
+ timezoneLabel: p ? `${i("form.appointment.timezone.label")}: ${$t({
661
+ timezone: p,
662
+ language: a
663
+ })}` : "",
664
+ formatLabel: oe === Jt.OS_LOCATION ? i("form.appointment.meeting-format.in-person-location-method-os-location") : U,
665
+ notificationMessage: rt,
666
+ showMoreSlotsLabel: i("form.appointment.show-more-slots.text"),
667
+ previousWeekLabel: i("form.appointment.accessibility.calendar.previous-week.aria-label"),
668
+ nextWeekLabel: i("form.appointment.accessibility.calendar.next-week.aria-label"),
669
+ pendingFocusIndex: I,
670
+ consumePendingFocusIndex: st
671
+ };
672
+ }, Je = Ge(void 0), Xe = (e) => `${e}-timezone-note`, F = () => {
673
+ const e = Ze(Je);
674
+ if (typeof e > "u")
675
+ throw new Error("Appointment parts must be used inside an <Appointment> component");
676
+ return e;
677
+ }, Fe = () => {
678
+ const { disabled: e, readOnly: t } = me();
679
+ return !!e || !!t;
680
+ }, C = ({ children: e, className: t }) => {
681
+ const { days: n, selectDate: a, weekRangeLabel: s } = F(), r = w(e, C.PreviousWeek), u = w(e, C.Heading), i = w(e, C.NextWeek), l = w(e, C.Day) ?? /* @__PURE__ */ o.createElement(C.Day, null), c = P(() => n.filter((f) => f.isSelected).map((f) => f.key), [
682
+ n
683
+ ]), d = Fe(), S = P(() => n.filter((f) => d || f.isDisabled).map((f) => f.key), [
684
+ n,
685
+ d
686
+ ]), E = (f) => {
687
+ if (f === "all")
688
+ return;
689
+ const [O] = [
690
+ ...f
691
+ ], v = n.find(({ key: I }) => I === O);
692
+ v && a(v.date);
693
+ };
694
+ return /* @__PURE__ */ o.createElement("div", {
695
+ className: t
696
+ }, r, u, i, /* @__PURE__ */ o.createElement(bt, {
697
+ "aria-label": s,
698
+ orientation: "horizontal",
699
+ selectionMode: "single",
700
+ selectedKeys: c,
701
+ disabledKeys: S,
702
+ onSelectionChange: E
703
+ }, n.map((f) => le(l, {
704
+ key: f.key,
705
+ day: f
706
+ }))));
707
+ }, ln = ({ children: e, className: t }) => {
708
+ const { changeWeek: n, canGoToPreviousWeek: a, previousWeekLabel: s, nextWeekLabel: r } = F(), u = Fe(), i = J(null), l = J(!1);
709
+ return Y(() => {
710
+ var S, E, f;
711
+ if (a || !l.current)
712
+ return;
713
+ l.current = !1;
714
+ const c = document.activeElement;
715
+ if (c !== document.body && c !== i.current)
716
+ return;
717
+ const d = ((E = (S = i.current) == null ? void 0 : S.closest("fieldset")) == null ? void 0 : E.querySelectorAll("button")) ?? [];
718
+ (f = Array.from(d).find((O) => O.getAttribute("aria-label") === r)) == null || f.focus();
719
+ }, [
720
+ a,
721
+ r
722
+ ]), /* @__PURE__ */ o.createElement(Re, {
723
+ ref: i,
724
+ className: t,
725
+ "aria-label": s,
726
+ isDisabled: !a || u,
727
+ onPress: () => {
728
+ l.current = !0, n(-1);
729
+ }
730
+ }, e ?? "‹");
731
+ }, cn = ({ children: e, className: t }) => {
732
+ const { changeWeek: n, nextWeekLabel: a } = F(), s = Fe();
733
+ return /* @__PURE__ */ o.createElement(Re, {
734
+ className: t,
735
+ "aria-label": a,
736
+ isDisabled: s,
737
+ onPress: () => n(1)
738
+ }, e ?? "›");
739
+ }, mn = ({ children: e, className: t }) => {
740
+ const { weekCaptionLabel: n, weekRangeLabel: a } = F();
741
+ return /* @__PURE__ */ o.createElement("span", {
742
+ className: t,
743
+ "aria-live": "polite"
744
+ }, e ? e({
745
+ label: n,
746
+ weekRange: a
747
+ }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
748
+ "aria-hidden": "true"
749
+ }, n), /* @__PURE__ */ o.createElement("span", {
750
+ style: Ve
751
+ }, a)));
752
+ }, un = ({ children: e, className: t, ...n }) => {
753
+ const { day: a } = n;
754
+ return /* @__PURE__ */ o.createElement(gt, {
755
+ id: a.key,
756
+ className: t,
757
+ textValue: a.label,
758
+ "aria-label": a.isAvailable ? `${a.label}, ${a.availabilityLabel}` : a.label,
759
+ "data-available": a.isAvailable || void 0,
760
+ "data-today": a.isToday || void 0
761
+ }, e ? e({
762
+ ...a,
763
+ date: new Date(a.date)
764
+ }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", null, a.weekdayLabel), /* @__PURE__ */ o.createElement("span", null, a.dayOfMonthLabel)));
765
+ };
766
+ C.PreviousWeek = ln;
767
+ C.Heading = mn;
768
+ C.NextWeek = cn;
769
+ C.Day = un;
770
+ const $e = 'input[type="radio"]', ae = ({ children: e, className: t, ...n }) => {
771
+ const { hasTimezoneNote: a } = n, { slots: s, selectedSlotKey: r, selectSlot: u, selectedDateLabel: i, isReloadingSlots: l, timezoneLabel: c, pendingFocusIndex: d, consumePendingFocusIndex: S } = F(), { id: E, disabled: f, readOnly: O, required: v, hasError: I } = me(), { inputId: W, labelId: N, ariaDescribedBy: A } = Se(), K = J(null), B = `${W}-slots-label`, U = w(e, ae.Label), oe = w(e, ae.Slot) ?? /* @__PURE__ */ o.createElement(ae.Slot, null), se = !!U && !!i, $ = [
772
+ A,
773
+ a && c ? Xe(W) : void 0
774
+ ].filter(Boolean).join(" ") || void 0, k = (p) => {
775
+ var L, R, G;
776
+ (G = (R = (L = K.current) == null ? void 0 : L.querySelectorAll($e)) == null ? void 0 : R[p]) == null || G.focus();
777
+ };
778
+ return Dt(() => {
779
+ var G, ue;
780
+ if (!!((G = K.current) != null && G.querySelector($e))) {
781
+ k(0);
782
+ return;
783
+ }
784
+ const L = Array.from(((ue = document.getElementById(W)) == null ? void 0 : ue.querySelectorAll('[role="option"]')) ?? []), R = L.find((H) => H.getAttribute("aria-selected") === "true") ?? L.find((H) => H.getAttribute("aria-disabled") !== "true");
785
+ R == null || R.focus();
786
+ }, E), Y(() => {
787
+ d !== void 0 && (k(d), S());
788
+ }, [
789
+ d,
790
+ s.length
791
+ ]), /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
792
+ role: "status",
793
+ style: Ve
794
+ }, s.length > 0 ? i : void 0), /* @__PURE__ */ o.createElement(It, {
795
+ ref: K,
796
+ className: t,
797
+ value: r ?? null,
798
+ onChange: u,
799
+ isDisabled: f,
800
+ isReadOnly: O,
801
+ isRequired: v,
802
+ isInvalid: I,
803
+ "aria-labelledby": se ? B : N,
804
+ "aria-describedby": $,
805
+ "data-refetch": l || void 0
806
+ }, le(U, {
807
+ labelId: B
808
+ }), s.map((p) => le(oe, {
809
+ key: p.key,
810
+ slot: p
811
+ }))));
812
+ }, dn = ({ children: e, className: t, ...n }) => {
813
+ const { selectedDateLabel: a } = F(), { labelId: s } = n;
814
+ return a ? /* @__PURE__ */ o.createElement("div", {
815
+ id: s,
816
+ className: t
817
+ }, e ? e({
818
+ label: a
819
+ }) : a) : null;
820
+ }, fn = ({ children: e, className: t, ...n }) => {
821
+ const { slot: a } = n;
822
+ return /* @__PURE__ */ o.createElement(Ot, {
823
+ value: a.key,
824
+ "aria-label": a.timeRange
825
+ }, /* @__PURE__ */ o.createElement(Tt, {
826
+ className: t
827
+ }, e ? e(a) : a.timeRange));
828
+ };
829
+ ae.Label = dn;
830
+ ae.Slot = fn;
831
+ const m = ({ children: e, className: t }) => {
832
+ const n = me(), { id: a, FieldLayout: s } = n, { labelId: r, inputId: u, ariaDescribedBy: i } = Se(), l = Et(St.APPOINTMENT), c = P(() => ({
833
+ ...n,
834
+ initialData: l,
835
+ inputId: u,
836
+ ariaLabelledBy: r,
837
+ ariaDescribedBy: i,
838
+ fieldId: a
839
+ }), [
840
+ n,
841
+ l,
842
+ u,
843
+ r,
844
+ i,
845
+ a
846
+ ]), d = w(e, m.Label), S = w(e, m.Description), E = w(e, m.Error);
847
+ return /* @__PURE__ */ o.createElement(s, {
848
+ fieldId: a,
849
+ renderLabel: () => le(d, {
850
+ as: "div"
851
+ }),
852
+ renderInput: () => /* @__PURE__ */ o.createElement(Yt, {
853
+ appointmentFieldProps: c
854
+ }, /* @__PURE__ */ o.createElement(En, {
855
+ className: t
856
+ }, e)),
857
+ renderDescription: () => /* @__PURE__ */ o.createElement(o.Fragment, null, E, S)
858
+ });
859
+ }, Dn = {
860
+ visibility: "hidden"
861
+ }, En = ({ children: e, className: t }) => {
862
+ const { required: n, onFocus: a, onBlur: s } = me(), { inputId: r, labelId: u, ariaDescribedBy: i } = Se(), l = rn(), c = w(e, m.Loader), d = w(e, m.Notification), S = w(e, m.Dates), E = w(e, m.Timezone), f = w(e, m.Format), O = w(e, m.Slots), v = w(e, m.ShowMoreSlots);
863
+ return /* @__PURE__ */ o.createElement(Je.Provider, {
864
+ value: l
865
+ }, /* @__PURE__ */ o.createElement(Rt, {
866
+ id: r,
867
+ className: t,
868
+ ariaLabelledBy: u,
869
+ ariaDescribedBy: i,
870
+ required: n,
871
+ onFocus: a,
872
+ onBlur: s
873
+ }, c, l.hasError ? d : /* @__PURE__ */ o.createElement("div", {
874
+ style: l.isLoading ? Dn : void 0
875
+ }, S, E, f, le(O, {
876
+ hasTimezoneNote: !!E
877
+ }), d, v)));
878
+ }, Sn = ({ children: e, className: t }) => {
879
+ const { isLoading: n, isRefetching: a } = F();
880
+ return !n && !a ? null : /* @__PURE__ */ o.createElement("div", {
881
+ className: t,
882
+ role: "status",
883
+ "aria-live": "polite",
884
+ "data-initial": n || void 0,
885
+ "data-refetch": !n && a || void 0
886
+ }, e);
887
+ }, pn = ({ children: e, className: t }) => {
888
+ const { notificationMessage: n } = F();
889
+ return n ? /* @__PURE__ */ o.createElement("div", {
890
+ className: t,
891
+ role: "status"
892
+ }, e ? e({
893
+ message: n
894
+ }) : n) : null;
895
+ }, yn = ({ children: e, className: t }) => {
896
+ const { timezoneLabel: n } = F(), { inputId: a } = Se();
897
+ return n ? /* @__PURE__ */ o.createElement("span", {
898
+ id: Xe(a),
899
+ className: t
900
+ }, e ? e({
901
+ label: n
902
+ }) : n) : null;
903
+ }, Ln = ({ children: e, className: t }) => {
904
+ const { formatLabel: n } = F();
905
+ return n ? /* @__PURE__ */ o.createElement("span", {
906
+ className: t
907
+ }, e ? e({
908
+ label: n
909
+ }) : n) : null;
910
+ }, _n = ({ children: e, className: t }) => {
911
+ const { hasMoreSlots: n, showMoreSlots: a, showMoreSlotsLabel: s } = F(), { disabled: r, readOnly: u } = me();
912
+ return n ? /* @__PURE__ */ o.createElement(Re, {
913
+ className: t,
914
+ isDisabled: !!r || !!u,
915
+ onPress: a
916
+ }, e ? e({
917
+ label: s
918
+ }) : s) : null;
919
+ };
920
+ m.Label = kt;
921
+ m.Loader = Sn;
922
+ m.Notification = pn;
923
+ m.Dates = C;
924
+ m.Timezone = yn;
925
+ m.Format = Ln;
926
+ m.Slots = ae;
927
+ m.ShowMoreSlots = _n;
928
+ m.Description = wt;
929
+ m.Error = vt;
930
+ const Nn = "_appointment_1v1wg_1", An = "_dates_1v1wg_5", bn = "_weekHeading_1v1wg_23", gn = "_weekButton_1v1wg_32", In = "_previousWeek_1v1wg_64", On = "_nextWeek_1v1wg_68", Tn = "_day_1v1wg_80", wn = "_weekdayLabel_1v1wg_95", vn = "_dayNumber_1v1wg_107", kn = "_indicator_1v1wg_167", Rn = "_hint_1v1wg_186", hn = "_slots_1v1wg_199", Fn = "_slotsMobile_1v1wg_208", Mn = "_slotsLabel_1v1wg_212", Cn = "_slot_1v1wg_199", Wn = "_slotLabel_1v1wg_247", Bn = "_showMoreSlots_1v1wg_314", Un = "_loader_1v1wg_345", xn = "_notification_1v1wg_381", y = {
931
+ appointment: Nn,
932
+ dates: An,
933
+ weekHeading: bn,
934
+ weekButton: gn,
935
+ previousWeek: In,
936
+ nextWeek: On,
937
+ day: Tn,
938
+ weekdayLabel: wn,
939
+ dayNumber: vn,
940
+ indicator: kn,
941
+ hint: Rn,
942
+ slots: hn,
943
+ slotsMobile: Fn,
944
+ slotsLabel: Mn,
945
+ slot: Cn,
946
+ slotLabel: Wn,
947
+ showMoreSlots: Bn,
948
+ loader: Un,
949
+ notification: xn
950
+ }, Pn = ({ content: e, locale: t }) => /* @__PURE__ */ o.createElement(lt, {
951
+ content: e,
952
+ locale: t
953
+ }), zn = () => {
954
+ const { isMobile: e } = ce();
955
+ return /* @__PURE__ */ o.createElement(m, {
956
+ className: y.appointment
957
+ }, /* @__PURE__ */ o.createElement(m.Label, {
958
+ className: T(De, fe.label)
959
+ }, /* @__PURE__ */ o.createElement(m.Label.Required, {
960
+ className: T(yt, fe.requiredMark)
961
+ })), /* @__PURE__ */ o.createElement(m.Loader, {
962
+ className: y.loader
963
+ }), /* @__PURE__ */ o.createElement(m.Dates, {
964
+ className: y.dates
965
+ }, /* @__PURE__ */ o.createElement(m.Dates.PreviousWeek, {
966
+ className: T(Ie, y.weekButton, y.previousWeek)
967
+ }, /* @__PURE__ */ o.createElement(Be, null)), /* @__PURE__ */ o.createElement(m.Dates.Heading, {
968
+ className: T(De, y.weekHeading)
969
+ }), /* @__PURE__ */ o.createElement(m.Dates.NextWeek, {
970
+ className: T(Ie, y.weekButton, y.nextWeek)
971
+ }, /* @__PURE__ */ o.createElement(Be, null)), /* @__PURE__ */ o.createElement(m.Dates.Day, {
972
+ className: y.day
973
+ }, (t) => /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
974
+ className: T(De, y.weekdayLabel)
975
+ }, t.weekdayLabel), /* @__PURE__ */ o.createElement("span", {
976
+ className: T(Lt, y.dayNumber)
977
+ }, t.dayOfMonthLabel, /* @__PURE__ */ o.createElement("span", {
978
+ className: y.indicator
979
+ }))))), /* @__PURE__ */ o.createElement(m.Timezone, {
980
+ className: T(Oe, y.hint)
981
+ }), /* @__PURE__ */ o.createElement(m.Format, {
982
+ className: T(Oe, y.hint)
983
+ }), /* @__PURE__ */ o.createElement(m.Slots, {
984
+ className: T(y.slots, {
985
+ [y.slotsMobile]: e
986
+ })
987
+ }, /* @__PURE__ */ o.createElement(m.Slots.Label, {
988
+ className: T(De, y.slotsLabel)
989
+ }), /* @__PURE__ */ o.createElement(m.Slots.Slot, {
990
+ className: T(_t, y.slot)
991
+ }, (t) => /* @__PURE__ */ o.createElement("span", {
992
+ className: T(Nt, y.slotLabel)
993
+ }, t.timeRange))), /* @__PURE__ */ o.createElement(m.Notification, {
994
+ className: y.notification
995
+ }), /* @__PURE__ */ o.createElement(m.ShowMoreSlots, {
996
+ className: T(Ie, y.showMoreSlots)
997
+ }), /* @__PURE__ */ o.createElement(m.Error, {
998
+ className: T(At, fe.error)
999
+ }, /* @__PURE__ */ o.createElement(pt, null), /* @__PURE__ */ o.createElement(m.Error.Text, null)), /* @__PURE__ */ o.createElement(m.Description, {
1000
+ className: T(Oe, fe.description)
1001
+ }, Pn));
1002
+ }, oa = () => /* @__PURE__ */ o.createElement(zn, null);
1003
+ export {
1004
+ oa as AppointmentRAC
1005
+ };