@wix/form-elements 1.217.0 → 1.219.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 (107) hide show
  1. package/dist/component/{appointment-rac-BwV-BiuM.js → appointment-rac-BHOy_R7-.js} +4 -4
  2. package/dist/component/{bookings-address-rac-60s8mINA.js → bookings-address-rac-BCrQv66p.js} +1 -1
  3. package/dist/component/{bookings-email-rac-CD180ofz.js → bookings-email-rac-DmRfdxfb.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-DPj9TLDZ.js → bookings-first-name-rac-BXO3f2gd.js} +1 -1
  5. package/dist/component/{bookings-header-rac-DWAqHAC3.js → bookings-header-rac-CO6AOevd.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-C-0GchtO.js → bookings-last-name-rac-BJBEASFi.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-DpVUsgYV.js → bookings-login-bar-rac-BIAIfq4E.js} +5 -5
  8. package/dist/component/{bookings-phone-rac-DSw3Wpi6.js → bookings-phone-rac-Ccj4N7sU.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-BcfuuhqF.js → bookings-rich-text-rac-B3HZ904h.js} +1 -1
  10. package/dist/component/{checkbox-field-rac-CxN4DXcm.js → checkbox-field-rac-CMLQboNZ.js} +43 -43
  11. package/dist/component/{checkbox-group-field-headless-Cxytn3cY.js → checkbox-group-field-headless-BoPu_anP.js} +41 -41
  12. package/dist/component/{checkbox-group-field-rac-COySLANT.js → checkbox-group-field-rac-DDkB4mAS.js} +4 -4
  13. package/dist/component/{checkbox-group-rac-C36q50g-.js → checkbox-group-rac-CYRjp2pd.js} +1 -1
  14. package/dist/component/{checkbox-rac-CPRna7wo.js → checkbox-rac-CZtOcpN3.js} +1 -1
  15. package/dist/component/{contacts-address-rac-C9WfyF_C.js → contacts-address-rac-CTcU_s2X.js} +1 -1
  16. package/dist/component/{contacts-birthdate-rac-DI_n6KW2.js → contacts-birthdate-rac-CfoYd88-.js} +1 -1
  17. package/dist/component/{contacts-company-rac-C2L3jLDV.js → contacts-company-rac-BFa1_U3K.js} +1 -1
  18. package/dist/component/{contacts-email-rac-BXxC1EQz.js → contacts-email-rac-DnAo-YRv.js} +1 -1
  19. package/dist/component/{contacts-first-name-rac-DDNYc6DW.js → contacts-first-name-rac-CXaZzVt1.js} +1 -1
  20. package/dist/component/{contacts-last-name-rac-C8kg5uC1.js → contacts-last-name-rac-DfpXadTk.js} +1 -1
  21. package/dist/component/{contacts-phone-rac-GBwlIMQi.js → contacts-phone-rac-CCwC37Ud.js} +1 -1
  22. package/dist/component/{contacts-position-rac-sI-eyBLH.js → contacts-position-rac-CvMNYTKL.js} +1 -1
  23. package/dist/component/{contacts-subscribe-rac-DI3nlzX4.js → contacts-subscribe-rac-vL2jR6hR.js} +1 -1
  24. package/dist/component/{contacts-tax-id-rac-CRq4rhb6.js → contacts-tax-id-rac-CrFhrlkk.js} +1 -1
  25. package/dist/component/{date-availability-17HTB6Bn.js → date-availability-5zvsa_GI.js} +1 -1
  26. package/dist/component/{date-input-field-rac-BLO1qQSi.js → date-input-field-rac-BQuCwFBz.js} +43 -43
  27. package/dist/component/{date-input-rac-Zryc6o9F.js → date-input-rac-DKzwySbG.js} +1 -1
  28. package/dist/component/{date-picker-field-rac-COGESH_j.js → date-picker-field-rac-D-B3bNeU.js} +35 -35
  29. package/dist/component/{date-picker-rac-BR5X3Gg4.js → date-picker-rac-DjYsBhgo.js} +1 -1
  30. package/dist/component/{date-time-input-field-rac-CKbGhDKq.js → date-time-input-field-rac-BECpkgB2.js} +30 -30
  31. package/dist/component/{date-time-input-rac-DnP-sVbv.js → date-time-input-rac-FbqGdzfB.js} +1 -1
  32. package/dist/component/{dext-checkbox-group-rac-O9bQHdjz.js → dext-checkbox-group-rac-BtSRkEFa.js} +2 -2
  33. package/dist/component/{dext-checkbox-rac-3Eqa1NNz.js → dext-checkbox-rac-BnC_NNyy.js} +1 -1
  34. package/dist/component/{dext-date-picker-rac-BYjvDil-.js → dext-date-picker-rac-okrwxNz9.js} +1 -1
  35. package/dist/component/{dext-date-time-input-rac-BLX3xG9x.js → dext-date-time-input-rac-DHKRYBUe.js} +1 -1
  36. package/dist/component/{dext-dropdown-rac-BwpbF2-Z.js → dext-dropdown-rac-1T_Ufw_J.js} +1 -1
  37. package/dist/component/{dext-email-rac-DUNmxVKy.js → dext-email-rac-BY3bKE0q.js} +1 -1
  38. package/dist/component/{dext-number-input-rac-D2rZrzXe.js → dext-number-input-rac-CFnKXD1l.js} +1 -1
  39. package/dist/component/{dext-phone-rac-C9dvhFCl.js → dext-phone-rac-LT9InJXw.js} +1 -1
  40. package/dist/component/{dext-radio-group-rac-D8mUfv1Y.js → dext-radio-group-rac-BUebk1mz.js} +2 -2
  41. package/dist/component/{dext-rating-input-rac-BY8MRBDl.js → dext-rating-input-rac-Drk4nKuW.js} +1 -1
  42. package/dist/component/{dext-tags-rac-DBKnRkUI.js → dext-tags-rac-BcW2-hht.js} +2 -2
  43. package/dist/component/{dext-text-area-rac-BYVMZ7HH.js → dext-text-area-rac-ew2HEDVz.js} +1 -1
  44. package/dist/component/{dext-text-input-rac-B6Ga232R.js → dext-text-input-rac-BhhGEp-y.js} +1 -1
  45. package/dist/component/{dext-url-input-rac-Cgu1URth.js → dext-url-input-rac-DKPl-POV.js} +1 -1
  46. package/dist/component/{donation-rac-DL1TnDAO.js → donation-rac-B9w7zHLs.js} +50 -50
  47. package/dist/component/{dropdown-field-rac-KYozl4DF.js → dropdown-field-rac-CyIgQ8Wg.js} +3 -3
  48. package/dist/component/{dropdown-rac-DiqI7QHS.js → dropdown-rac-D4zhCab8.js} +1 -1
  49. package/dist/component/{ecom-address-rac-Cmb0daDG.js → ecom-address-rac-Cgc5vi9N.js} +1 -1
  50. package/dist/component/{ecom-subscription-checkbox-rac-B7AuYQA2.js → ecom-subscription-checkbox-rac-Ci19HUzq.js} +2 -2
  51. package/dist/component/{email-input-field-rac-DocV1aB9.js → email-input-field-rac-DX-z3AgN.js} +29 -29
  52. package/dist/component/{events-repeater-rac-B0Qqfo8D.js → events-repeater-rac-XGxIXTW0.js} +29 -29
  53. package/dist/component/{events-rsvp-rac-fv3hIzAL.js → events-rsvp-rac-CMEcer8W.js} +3 -3
  54. package/dist/component/{field-error-headless-Dfvu9FuO.js → field-error-headless-fX6PeZaI.js} +1 -1
  55. package/dist/component/{field-label-headless-Cxyl3wGC.js → field-label-headless-CoLjciGG.js} +5 -5
  56. package/dist/component/{file-upload-rac-Je_--JfX.js → file-upload-rac-N6_i0ky0.js} +88 -88
  57. package/dist/component/{fixed-payment-rac-BnXYEIDe.js → fixed-payment-rac-DB6BtjkX.js} +7 -7
  58. package/dist/component/{form-a7SUDn8q.js → form-cgY_BDTU.js} +1444 -1426
  59. package/dist/component/form.js +1 -1
  60. package/dist/component/{header-field-rac-D6gL7ZE_.js → header-field-rac-CwNoeHks.js} +2 -2
  61. package/dist/component/{header-rac-DEkEGPwy.js → header-rac-DefKb4Vd.js} +1 -1
  62. package/dist/component/{image-choice-rac-Br7ZpUIc.js → image-choice-rac-CZFYVSzP.js} +25 -25
  63. package/dist/component/{index-nfuicG4V.js → index-D1ybDmS5.js} +2 -2
  64. package/dist/component/{index-CCtGcc8K.js → index-DUVXPUGc.js} +4 -4
  65. package/dist/component/{isObjectLike-zLoHjg3a.js → isObjectLike-93vxyYs1.js} +1 -1
  66. package/dist/component/multiline-address-field-rac-BN_Tnrno.js +1738 -0
  67. package/dist/component/{multiline-address-rac-CyM0O2ZV.js → multiline-address-rac-CoF0BwJI.js} +1 -1
  68. package/dist/component/{number-input-field-rac-orHx_sCp.js → number-input-field-rac-BVdfzTwW.js} +21 -21
  69. package/dist/component/{number-input-rac-CF5v19rL.js → number-input-rac-D-A2ybtN.js} +1 -1
  70. package/dist/component/{password-rac-BSWihZvF.js → password-rac-CbUBNreW.js} +26 -26
  71. package/dist/component/{payment-input-rac-CeAz10YA.js → payment-input-rac-BXdDXgXp.js} +46 -46
  72. package/dist/component/{phone-input-field-rac-BefHQnSh.js → phone-input-field-rac-CjmpG7p9.js} +57 -57
  73. package/dist/component/{phone-rac-C5jSEw_g.js → phone-rac-D3g5Pi2p.js} +1 -1
  74. package/dist/component/{product-list-rac-C0UIu3qw.js → product-list-rac-gJvJaUnQ.js} +35 -35
  75. package/dist/component/{quiz-radio-group-rac-Bya6uEoi.js → quiz-radio-group-rac-YCKwAv5G.js} +1 -1
  76. package/dist/component/{radio-button-module-classes-YEfiQQtW.js → radio-button-module-classes-2nfcqSJp.js} +15 -15
  77. package/dist/component/{radio-group-field-rac-DZWxn-QY.js → radio-group-field-rac-BBYaCpeZ.js} +4 -4
  78. package/dist/component/{radio-group-rac-DsL2Ttyk.js → radio-group-rac-fYuYtO48.js} +1 -1
  79. package/dist/component/{rating-input-field-rac-BioYAy-_.js → rating-input-field-rac-sPYk1nWc.js} +20 -20
  80. package/dist/component/{rating-input-rac-DahZMbKa.js → rating-input-rac-CiWqxkPO.js} +1 -1
  81. package/dist/component/{rich-content-rac.module-pvsjrr7Y.js → rich-content-rac.module-BjcbV5CK.js} +5 -5
  82. package/dist/component/{rich-text-field-rac-H-mxitKA.js → rich-text-field-rac-DY0vRG7M.js} +4 -4
  83. package/dist/component/{rich-text-rac-CPfXGilA.js → rich-text-rac-BngE_MAC.js} +1 -1
  84. package/dist/component/{service-dropdown-rac-C2qfLOFr.js → service-dropdown-rac-Db53P8Fm.js} +13 -13
  85. package/dist/component/{services-multi-choice-rac-D7-sJi_t.js → services-multi-choice-rac-Cr791rTd.js} +9 -9
  86. package/dist/component/{signature-rac-DuQuR2U3.js → signature-rac-BCNYIwad.js} +41 -41
  87. package/dist/component/{submit-button-rac-DrUDtzCX.js → submit-button-rac-CyyEQGsz.js} +10 -10
  88. package/dist/component/{tags-field-rac-D8gyv5Kk.js → tags-field-rac-k3HHiR5C.js} +24 -24
  89. package/dist/component/{tags-rac-Be588VqA.js → tags-rac-nOXYrsHv.js} +1 -1
  90. package/dist/component/{text-area-field-rac-hezqhMgQ.js → text-area-field-rac-CwpxShM0.js} +22 -22
  91. package/dist/component/{text-area-rac-B_KUlOes.js → text-area-rac-CkKcWyW5.js} +1 -1
  92. package/dist/component/{text-input-field-rac-BWRz4111.js → text-input-field-rac-DvIwNwn3.js} +3 -3
  93. package/dist/component/{text-input-headless-BUNQFfZw.js → text-input-headless-vfGxjFpa.js} +9 -9
  94. package/dist/component/{text-input-rac-DdfHXZ8B.js → text-input-rac-DoVI2HNp.js} +1 -1
  95. package/dist/component/{time-input-rac-CUTavG2g.js → time-input-rac-DPbbdnl3.js} +16 -16
  96. package/dist/component/{url-input-field-rac-CG5yrtux.js → url-input-field-rac-CiZi4oVe.js} +20 -20
  97. package/dist/component/{url-input-rac-DMw4tPKk.js → url-input-rac-C-IvLpA8.js} +1 -1
  98. package/dist/component/{use-dropdown-option-class-name-CHW3T4PQ.js → use-dropdown-option-class-name-CMgoymWE.js} +2 -2
  99. package/dist/component/{use-dropdown-trigger-class-name-6UsjW0rS.js → use-dropdown-trigger-class-name-BH0PyTH_.js} +24 -24
  100. package/dist/component/{use-element-state-class-name-YRDhi6Zr.js → use-element-state-class-name-DiZjY9WE.js} +1 -1
  101. package/dist/component/{use-hoverable-input-class-name-arCOozPK.js → use-hoverable-input-class-name-QpNEvrdn.js} +2 -2
  102. package/dist/component/{use-is-forced-open-dropdown-NJIAuz_W.js → use-is-forced-open-dropdown-CHh9nGJz.js} +4 -4
  103. package/dist/component/{use-service-options-base-nhf-7Ope.js → use-service-options-base-BGB82e2d.js} +4 -4
  104. package/dist/component/use-text-input-class-name-_CjB7lhB.js +6 -0
  105. package/package.json +2 -2
  106. package/dist/component/multiline-address-field-rac-Bgfked1m.js +0 -1664
  107. package/dist/component/use-text-input-class-name-C9496S5f.js +0 -6
@@ -0,0 +1,1738 @@
1
+ import { RicosViewer as z } from "@wix/ricos/viewer";
2
+ import L from "classnames";
3
+ import n, { useMemo as x, createContext as We, useContext as Ie, useState as be, useRef as q, useCallback as A, useEffect as Pe } from "react";
4
+ import { bI as Ke, d as Ye, bD as qt, bF as vt, bf as xt, bg as kt, b8 as Ut, be as Y, F as H, bY as Te, bv as ut, bN as P, bK as M, bP as le, bW as fe, bJ as St, bk as Vt, C as ve, bt as $t, bx as Wt, bU as Kt, bO as Yt, bT as Ht, bB as jt, bA as Jt, bp as Xt, bz as Qt, bQ as zt, aP as Gt, Y as Zt, _ as G, am as Z, $ as Oe, M as ee, I as te, Z as en, a0 as tn, a1 as nn } from "./form-cgY_BDTU.js";
5
+ import { UNSAFE_PortalProvider as rn } from "react-aria";
6
+ import { f as b, a as S } from "./find-child-C60k4CxG.js";
7
+ import { F as sn, V as on } from "./headless-styles-CmcyA_pi.js";
8
+ import { c as an } from "./use-is-forced-open-dropdown-CHh9nGJz.js";
9
+ import { TextField as ye, Input as ie, ComboBoxStateContext as He, ComboBox as Fe, Popover as he, ListBox as Me, ListBoxItem as De, Group as gt, Button as Ft } from "react-aria-components";
10
+ import { D as ce, E as de } from "./field-error-headless-fX6PeZaI.js";
11
+ import { L as ue } from "./field-label-headless-CoLjciGG.js";
12
+ import { e as ln, c as cn, a as dn, r as ht } from "./isObjectLike-93vxyYs1.js";
13
+ import { V as un, a as mn } from "./use-dropdown-option-class-name-CMgoymWE.js";
14
+ import { u as pn } from "./use-invoke-callback-UH73A_J3.js";
15
+ import { C as mt } from "./chevron-down-icon-CcpVm6B-.js";
16
+ import { E as ne } from "./error-icon-hZxQ6DEy.js";
17
+ import { H as we } from "./custom-focus-class-_483Pkwp.js";
18
+ import { s as I } from "./field-rac.module-DcyJyi2B.js";
19
+ import { u as pt } from "./use-hoverable-input-class-name-QpNEvrdn.js";
20
+ const En = (e, t, s) => {
21
+ var o, l, i, a;
22
+ const r = (o = e.steps) == null ? void 0 : o.map((d) => {
23
+ var m, u, y, C, p, E;
24
+ return {
25
+ ...d,
26
+ layout: {
27
+ ...d.layout,
28
+ large: {
29
+ ...(m = d.layout) == null ? void 0 : m.large,
30
+ items: ((C = (y = (u = d.layout) == null ? void 0 : u.large) == null ? void 0 : y.items) == null ? void 0 : C.map((f) => ({
31
+ ...f,
32
+ row: s.row <= f.row ? (f.row || 0) + 1 : f.row
33
+ }))) || ((E = (p = d.layout) == null ? void 0 : p.large) == null ? void 0 : E.items)
34
+ }
35
+ }
36
+ };
37
+ });
38
+ return (a = (i = (l = r == null ? void 0 : r[0].layout) == null ? void 0 : l.large) == null ? void 0 : i.items) == null || a.unshift(s), {
39
+ ...e,
40
+ fields: [
41
+ t,
42
+ ...e.fields || []
43
+ ],
44
+ steps: r || e.steps
45
+ };
46
+ };
47
+ var Ce = /* @__PURE__ */ (function(e) {
48
+ return e.COUNTRY = "country", e.SUBDIVISION = "subdivision", e.CITY = "city", e.ADDRESS_LINE = "addressLine", e.ADDRESS_LINE_2 = "addressLine2", e.POSTAL_CODE = "postalCode", e.STREET_NAME = "streetName", e.STREET_NUMBER = "streetNumber", e.APARTMENT = "apartment", e;
49
+ })({});
50
+ function bn(e, t, s = !1) {
51
+ const { country: r, subdivision: o, city: l, addressLine: i, streetAddress: a, addressLine2: d, postalCode: m } = e, u = {};
52
+ return t ? (r && (u.country = r), o && (u.subdivision = o), l && (u.city = l), i ? u.addressLine = i : a != null && a.formattedAddressLine && (u.addressLine = a == null ? void 0 : a.formattedAddressLine), d && (u.addressLine = d), m && (u.postalCode = m), a != null && a.apt && (u.apartment = a == null ? void 0 : a.apt), a != null && a.name ? u.streetName = a == null ? void 0 : a.name : s && (a != null && a.formattedAddressLine) && (u.streetName = a == null ? void 0 : a.formattedAddressLine), a != null && a.number && (u.streetNumber = a.number)) : (r && (u.country = r), o && (u.subdivision = o), l && (u.city = l), i ? u.address_line = i : a != null && a.formattedAddressLine && (u.address_line = a == null ? void 0 : a.formattedAddressLine), d && (u.address_line = d), m && (u.postal_code = m), a != null && a.apt && (u.apartment = a == null ? void 0 : a.apt), a != null && a.name ? u.street_name = a == null ? void 0 : a.name : s && (a != null && a.formattedAddressLine) && (u.street_name = a == null ? void 0 : a.formattedAddressLine), a != null && a.number && (u.street_number = a.number)), u;
53
+ }
54
+ const Dt = /* @__PURE__ */ We({
55
+ onAddressSelect: () => {
56
+ }
57
+ }), fn = ({ children: e, onAddressSelect: t, autocompleteEnabled: s }) => {
58
+ const r = x(() => ({
59
+ onAddressSelect: t,
60
+ autocompleteEnabled: s
61
+ }), [
62
+ t,
63
+ s
64
+ ]);
65
+ return /* @__PURE__ */ n.createElement(Dt.Provider, {
66
+ value: r
67
+ }, e);
68
+ };
69
+ function Le() {
70
+ return Ie(Dt);
71
+ }
72
+ const At = /* @__PURE__ */ We(void 0), yn = ({ children: e, countryCode: t }) => {
73
+ const s = x(() => ({
74
+ countryCode: t
75
+ }), [
76
+ t
77
+ ]);
78
+ return /* @__PURE__ */ n.createElement(At.Provider, {
79
+ value: s
80
+ }, e);
81
+ };
82
+ function Ne() {
83
+ const e = Ie(At);
84
+ return e == null ? void 0 : e.countryCode;
85
+ }
86
+ function Be(e) {
87
+ return e != null;
88
+ }
89
+ function Cn(e, t, s) {
90
+ return !t || !s ? e : {
91
+ ...e,
92
+ fields: (e.fields ?? []).map((r) => {
93
+ const { show: o, ...l } = t[r.target] || {}, { required: i } = s[r.target] || {};
94
+ return {
95
+ ...r,
96
+ view: {
97
+ ...r.view,
98
+ ...l
99
+ },
100
+ ...Be(o) && {
101
+ hidden: !o
102
+ },
103
+ ...Be(i) && Be(r.validation) && {
104
+ validation: {
105
+ ...r.validation,
106
+ required: i
107
+ }
108
+ }
109
+ };
110
+ })
111
+ };
112
+ }
113
+ const In = (e, t) => e.map((s) => ({
114
+ ...s,
115
+ id: ("target" in s ? t[s.target] : void 0) ?? s.id
116
+ })), _t = 12, Ln = (e) => {
117
+ const t = e.filter((r) => !r.properties.hidden), s = e.filter((r) => r.properties.hidden);
118
+ return {
119
+ visibleFields: t,
120
+ hiddenFields: s
121
+ };
122
+ }, Nn = (e) => {
123
+ const t = {};
124
+ return e.forEach((s) => {
125
+ const r = s.layout.row;
126
+ t[r] || (t[r] = []), t[r].push(s);
127
+ }), t;
128
+ }, On = (e) => {
129
+ const t = {};
130
+ return Object.keys(e).forEach((s) => {
131
+ const r = parseInt(s, 10), o = e[r];
132
+ o.reduce((i, a) => i + a.layout.width, 0) !== _t && (t[r] = o);
133
+ }), t;
134
+ }, vn = (e, t) => e.map((s) => {
135
+ const r = s.layout.row;
136
+ if (t[r] && !s.properties.hidden) {
137
+ const o = t[r], l = o.length, i = _t / l, a = o.findIndex((m) => m.id === s.id), d = i * a;
138
+ return {
139
+ ...s,
140
+ layout: {
141
+ ...s.layout,
142
+ width: i,
143
+ column: d
144
+ }
145
+ };
146
+ }
147
+ return s;
148
+ }), Sn = (e, t, s) => {
149
+ const r = Math.max(...t.map((o) => o.layout.row), -1);
150
+ return e.map((o) => {
151
+ if (o.properties.hidden) {
152
+ const l = s.findIndex((i) => i.id === o.id);
153
+ return {
154
+ ...o,
155
+ layout: {
156
+ ...o.layout,
157
+ row: r + 1 + l
158
+ }
159
+ };
160
+ }
161
+ return o;
162
+ });
163
+ }, gn = (e) => {
164
+ const { visibleFields: t, hiddenFields: s } = Ln(e.fields), r = Nn(t), o = On(r), l = vn(e.fields, o), i = Sn(l, t, s);
165
+ return {
166
+ ...e,
167
+ fields: i
168
+ };
169
+ }, Fn = () => ({
170
+ country: Y(),
171
+ subdivision: Y(),
172
+ city: Y(),
173
+ address_line: Y(),
174
+ address_line_2: Y(),
175
+ postal_code: Y(),
176
+ street_name: Y(),
177
+ street_number: Y(),
178
+ apartment: Y()
179
+ }), hn = ({ id: e, target: t, fieldType: s, form: r, country: o, fieldSettings: l, validation: i, required: a }) => {
180
+ const [d] = be(Fn), { isExperimentEnabled: m } = Ke(), u = m(Ye.USE_FIELDS_V2), { getCountryAddressForm: y } = qt(), { isMobile: C, breakpoint: p } = vt(), E = y(o), f = s === H.MULTILINE_ADDRESS || s === H.BOOKINGS_ADDRESS, N = x(() => {
181
+ var v;
182
+ return xt(a, (v = i == null ? void 0 : i.predefined) == null ? void 0 : v.multilineAddressOptions);
183
+ }, [
184
+ i,
185
+ a
186
+ ]), F = x(() => kt(), []);
187
+ return {
188
+ form: x(() => {
189
+ var T, O;
190
+ if (!f || !E)
191
+ return r && {
192
+ ...r,
193
+ fields: In(r.fields, d)
194
+ };
195
+ const v = Ut({
196
+ useFieldsV2: u,
197
+ path: t,
198
+ parentId: e,
199
+ includeHiddenFields: !0,
200
+ isMobile: C,
201
+ breakpoint: p,
202
+ form: Cn(En(E, N, F), l, (O = (T = i == null ? void 0 : i.predefined) == null ? void 0 : T.multilineAddressOptions) == null ? void 0 : O.fields)
203
+ });
204
+ if (!v.fields.some((D) => D.properties.hidden))
205
+ return v;
206
+ const w = gn(v);
207
+ return {
208
+ ...w,
209
+ fields: w.fields.filter((D) => !D.properties.hidden)
210
+ };
211
+ }, [
212
+ E,
213
+ r,
214
+ d,
215
+ l,
216
+ i,
217
+ t,
218
+ N,
219
+ F,
220
+ f,
221
+ u,
222
+ e,
223
+ C,
224
+ p
225
+ ]),
226
+ isMultilineAddressField: f
227
+ };
228
+ }, Rt = /* @__PURE__ */ We(void 0), Dn = ({ children: e, fields: t }) => {
229
+ const s = x(() => ({
230
+ fields: t
231
+ }), [
232
+ t
233
+ ]);
234
+ return /* @__PURE__ */ n.createElement(Rt.Provider, {
235
+ value: s
236
+ }, e);
237
+ };
238
+ function me(e) {
239
+ const t = Ie(Rt);
240
+ if (!t)
241
+ throw new Error("useAddressFields must be used within AddressFieldsProvider");
242
+ return t.fields[e];
243
+ }
244
+ function pe(e) {
245
+ const { t } = Te(), s = Ne(), r = s && ut.getCountryByShortKey(s), l = (r ? r.addressPartDisplayNames : ut.getDefaultAddressDisplayNames())[e];
246
+ return l ? t(l) : "";
247
+ }
248
+ const re = ({ children: e }) => {
249
+ const { id: t, value: s, onChange: r, disabled: o, readOnly: l, required: i, hasError: a, onBlur: d, onFocus: m, FieldLayout: u } = P(), { labelId: y } = M(), C = pe("addressLine2"), p = b(e, re.Label), E = b(e, re.Input), f = b(e, re.Description), N = b(e, re.Error);
250
+ return /* @__PURE__ */ n.createElement(u, {
251
+ fieldId: t,
252
+ renderLabel: () => S(p, {
253
+ label: C
254
+ }),
255
+ renderInput: () => /* @__PURE__ */ n.createElement(ye, {
256
+ "aria-labelledby": y,
257
+ value: s ?? "",
258
+ onChange: r,
259
+ isDisabled: o,
260
+ isReadOnly: l,
261
+ isRequired: i,
262
+ isInvalid: a,
263
+ onBlur: d,
264
+ onFocus: m
265
+ }, E),
266
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, N, f)
267
+ });
268
+ }, An = ({ className: e }) => {
269
+ const { id: t, placeholder: s } = P(), { inputId: r, ariaDescribedBy: o } = M(), l = q(null);
270
+ return le(() => {
271
+ var i;
272
+ (i = l.current) == null || i.focus({
273
+ preventScroll: !0
274
+ });
275
+ }, t), fe(l), /* @__PURE__ */ n.createElement(ie, {
276
+ ref: l,
277
+ id: r,
278
+ autoComplete: "address-line2",
279
+ "aria-describedby": o,
280
+ className: e,
281
+ placeholder: s
282
+ });
283
+ };
284
+ re.Label = ue;
285
+ re.Input = An;
286
+ re.Description = ce;
287
+ re.Error = de;
288
+ const _n = "route", Rn = (e) => {
289
+ var t;
290
+ return ((t = e.types) == null ? void 0 : t.includes(_n)) ?? !1;
291
+ }, Pn = /[\s,]+/, Et = (e) => e ? e.toLowerCase().split(Pn) : [], Pt = (e, t, s) => {
292
+ if (!e || !t)
293
+ return !1;
294
+ const r = Et(s);
295
+ return Et(e).filter((o) => !r.includes(o)).includes(t.toLowerCase());
296
+ }, bt = (e) => e.split("-")[0], Tn = (e, t) => !e.postalCode || !t.postalCode || bt(e.postalCode) === bt(t.postalCode), Mn = (e, t) => {
297
+ var s, r, o, l, i;
298
+ return !!((s = e.streetAddress) != null && s.name) && ((o = (r = e.streetAddress) == null ? void 0 : r.name) == null ? void 0 : o.toLowerCase()) === ((i = (l = t.streetAddress) == null ? void 0 : l.name) == null ? void 0 : i.toLowerCase());
299
+ }, wn = (e, t) => t.country === e.country && t.subdivision === e.subdivision && Tn(e, t) && Mn(e, t), Bn = async (e, t, s) => {
300
+ var r, o;
301
+ try {
302
+ const l = await s({
303
+ query: e,
304
+ countryCode: t.country ?? void 0
305
+ });
306
+ return (o = (r = l == null ? void 0 : l.find((i) => {
307
+ var a, d;
308
+ return wn(t, i) && Pt(e, (a = i.streetAddress) == null ? void 0 : a.number, (d = t.streetAddress) == null ? void 0 : d.name);
309
+ })) == null ? void 0 : r.streetAddress) == null ? void 0 : o.number;
310
+ } catch {
311
+ return;
312
+ }
313
+ }, qn = (e, t, s) => {
314
+ const r = {
315
+ ...e.streetAddress,
316
+ number: t
317
+ };
318
+ return Pt(s, t) ? {
319
+ ...e,
320
+ ...e.addressLine ? {
321
+ addressLine: s
322
+ } : {},
323
+ streetAddress: {
324
+ ...r,
325
+ formattedAddressLine: s
326
+ }
327
+ } : {
328
+ ...e,
329
+ streetAddress: r
330
+ };
331
+ }, xn = async ({ searchId: e, prediction: t, getPlace: s, searchByQuery: r }) => {
332
+ var i, a;
333
+ const o = await s({
334
+ searchId: e
335
+ });
336
+ if (!o || (i = o.streetAddress) != null && i.number || !(t != null && t.description) || !Rn(t) || !r)
337
+ return o;
338
+ const l = await Bn(t.description, o, r);
339
+ return l ? qn(o, l, (a = t.textStructure) == null ? void 0 : a.mainText) : o;
340
+ }, je = ({ enabled: e }) => {
341
+ const { actions: t } = St(), { isExperimentEnabled: s } = Ke(), r = s(Ye.ADDRESS_HOUSE_NUMBER_FALLBACK), [o, l] = be(Y()), i = A(() => l(Y()), []), a = q(0);
342
+ return x(() => {
343
+ const { predict: d, getPlace: m, searchByPostalCode: u, searchByQuery: y } = t ?? {};
344
+ if (!e || !d || !m || !u)
345
+ return;
346
+ const C = (p) => m({
347
+ ...p,
348
+ sessionToken: o,
349
+ refreshSessionToken: i
350
+ });
351
+ return {
352
+ predict: (p) => d({
353
+ ...p,
354
+ sessionToken: o
355
+ }),
356
+ getPlace: C,
357
+ searchByPostalCode: (p) => u({
358
+ ...p,
359
+ sessionToken: o
360
+ }),
361
+ resolvePlace: async (p) => {
362
+ const E = ++a.current, f = await xn({
363
+ ...p,
364
+ getPlace: C,
365
+ searchByQuery: r ? y : void 0
366
+ });
367
+ return E === a.current ? f : void 0;
368
+ }
369
+ };
370
+ }, [
371
+ e,
372
+ t,
373
+ o,
374
+ i,
375
+ r
376
+ ]);
377
+ };
378
+ var qe, ft;
379
+ function kn() {
380
+ if (ft) return qe;
381
+ ft = 1;
382
+ var e = ln(), t = function() {
383
+ return e.Date.now();
384
+ };
385
+ return qe = t, qe;
386
+ }
387
+ var xe, yt;
388
+ function Un() {
389
+ if (yt) return xe;
390
+ yt = 1;
391
+ var e = /\s/;
392
+ function t(s) {
393
+ for (var r = s.length; r-- && e.test(s.charAt(r)); )
394
+ ;
395
+ return r;
396
+ }
397
+ return xe = t, xe;
398
+ }
399
+ var ke, Ct;
400
+ function Vn() {
401
+ if (Ct) return ke;
402
+ Ct = 1;
403
+ var e = Un(), t = /^\s+/;
404
+ function s(r) {
405
+ return r && r.slice(0, e(r) + 1).replace(t, "");
406
+ }
407
+ return ke = s, ke;
408
+ }
409
+ var Ue, It;
410
+ function $n() {
411
+ if (It) return Ue;
412
+ It = 1;
413
+ var e = cn(), t = dn(), s = "[object Symbol]";
414
+ function r(o) {
415
+ return typeof o == "symbol" || t(o) && e(o) == s;
416
+ }
417
+ return Ue = r, Ue;
418
+ }
419
+ var Ve, Lt;
420
+ function Wn() {
421
+ if (Lt) return Ve;
422
+ Lt = 1;
423
+ var e = Vn(), t = ht(), s = $n(), r = NaN, o = /^[-+]0x[0-9a-f]+$/i, l = /^0b[01]+$/i, i = /^0o[0-7]+$/i, a = parseInt;
424
+ function d(m) {
425
+ if (typeof m == "number")
426
+ return m;
427
+ if (s(m))
428
+ return r;
429
+ if (t(m)) {
430
+ var u = typeof m.valueOf == "function" ? m.valueOf() : m;
431
+ m = t(u) ? u + "" : u;
432
+ }
433
+ if (typeof m != "string")
434
+ return m === 0 ? m : +m;
435
+ m = e(m);
436
+ var y = l.test(m);
437
+ return y || i.test(m) ? a(m.slice(2), y ? 2 : 8) : o.test(m) ? r : +m;
438
+ }
439
+ return Ve = d, Ve;
440
+ }
441
+ var $e, Nt;
442
+ function Kn() {
443
+ if (Nt) return $e;
444
+ Nt = 1;
445
+ var e = ht(), t = kn(), s = Wn(), r = "Expected a function", o = Math.max, l = Math.min;
446
+ function i(a, d, m) {
447
+ var u, y, C, p, E, f, N = 0, F = !1, h = !1, v = !0;
448
+ if (typeof a != "function")
449
+ throw new TypeError(r);
450
+ d = s(d) || 0, e(m) && (F = !!m.leading, h = "maxWait" in m, C = h ? o(s(m.maxWait) || 0, d) : C, v = "trailing" in m ? !!m.trailing : v);
451
+ function _(g) {
452
+ var Q = u, Ee = y;
453
+ return u = y = void 0, N = g, p = a.apply(Ee, Q), p;
454
+ }
455
+ function w(g) {
456
+ return N = g, E = setTimeout(D, d), F ? _(g) : p;
457
+ }
458
+ function T(g) {
459
+ var Q = g - f, Ee = g - N, Ae = d - Q;
460
+ return h ? l(Ae, C - Ee) : Ae;
461
+ }
462
+ function O(g) {
463
+ var Q = g - f, Ee = g - N;
464
+ return f === void 0 || Q >= d || Q < 0 || h && Ee >= C;
465
+ }
466
+ function D() {
467
+ var g = t();
468
+ if (O(g))
469
+ return B(g);
470
+ E = setTimeout(D, T(g));
471
+ }
472
+ function B(g) {
473
+ return E = void 0, v && u ? _(g) : (u = y = void 0, p);
474
+ }
475
+ function X() {
476
+ E !== void 0 && clearTimeout(E), N = 0, u = f = y = E = void 0;
477
+ }
478
+ function K() {
479
+ return E === void 0 ? p : B(t());
480
+ }
481
+ function R() {
482
+ var g = t(), Q = O(g);
483
+ if (u = arguments, y = this, f = g, Q) {
484
+ if (E === void 0)
485
+ return w(f);
486
+ if (h)
487
+ return clearTimeout(E), E = setTimeout(D, d), _(f);
488
+ }
489
+ return E === void 0 && (E = setTimeout(D, d)), p;
490
+ }
491
+ return R.cancel = X, R.flush = K, R;
492
+ }
493
+ return $e = i, $e;
494
+ }
495
+ var Yn = Kn();
496
+ const Hn = /* @__PURE__ */ Vt(Yn), jn = (e, t, s = 200) => {
497
+ const r = q(e), o = A(Hn((...l) => {
498
+ r.current(...l);
499
+ }, s), [
500
+ s
501
+ ]);
502
+ return Pe(() => {
503
+ r.current = e;
504
+ }, [
505
+ e,
506
+ t
507
+ ]), o;
508
+ }, Jn = () => {
509
+ const e = q(!0);
510
+ return Pe(() => () => {
511
+ e.current = !1;
512
+ }, []), () => e.current;
513
+ }, Ot = {
514
+ loading: !1,
515
+ predictions: []
516
+ }, Tt = ({ atlas: e, onError: t }) => {
517
+ const [{ loading: r, predictions: o }, l] = be(Ot), i = q(0), a = Jn(), d = A(() => {
518
+ i.current++, l(Ot);
519
+ }, []), m = jn(async ({ input: u, countryCodes: y }) => {
520
+ if (!e || !a())
521
+ return;
522
+ if (!u) {
523
+ d();
524
+ return;
525
+ }
526
+ const C = ++i.current;
527
+ l((E) => ({
528
+ ...E,
529
+ loading: !0
530
+ }));
531
+ let p;
532
+ try {
533
+ p = await e.predict({
534
+ input: u,
535
+ countryCodes: y
536
+ });
537
+ } catch (E) {
538
+ t ? t(E) : console.error(E);
539
+ } finally {
540
+ const E = C === i.current;
541
+ a() && E && l((f) => ({
542
+ loading: !1,
543
+ // set new predictions if fetched properly, else keep current predictions
544
+ predictions: p || f.predictions
545
+ }));
546
+ }
547
+ }, [
548
+ e,
549
+ t
550
+ ], 200);
551
+ return {
552
+ predictions: o,
553
+ loading: r,
554
+ updatePredictions: m,
555
+ clearPredictions: d
556
+ };
557
+ }, Je = ({ optionCount: e }) => {
558
+ const t = Ie(He), s = q(t);
559
+ s.current = t;
560
+ const r = q(e);
561
+ return Pe(() => {
562
+ const o = e > 0 && r.current === 0;
563
+ r.current = e;
564
+ const l = s.current;
565
+ o && (l != null && l.isFocused) && !l.isOpen && l.open(null, "manual");
566
+ }, [
567
+ e
568
+ ]), null;
569
+ }, V = ({ children: e }) => {
570
+ const { id: t, value: s, onChange: r, disabled: o, readOnly: l, required: i, hasError: a, onBlur: d, onFocus: m, FieldLayout: u, autocomplete: y } = P(), { labelId: C } = M(), { autocompleteEnabled: p } = Le(), E = y || p, f = pe("addressLine1"), N = b(e, V.Label), F = b(e, V.Input), h = b(e, V.Options), v = b(e, V.Description), _ = b(e, V.Error);
571
+ return E ? /* @__PURE__ */ n.createElement(u, {
572
+ fieldId: t,
573
+ renderLabel: () => S(N, {
574
+ label: f
575
+ }),
576
+ renderInput: () => /* @__PURE__ */ n.createElement(Xn, {
577
+ value: s,
578
+ onChange: r,
579
+ disabled: o,
580
+ readOnly: l,
581
+ required: i,
582
+ hasError: a,
583
+ onBlur: d,
584
+ onFocus: m
585
+ }, F, h),
586
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, _, v)
587
+ }) : /* @__PURE__ */ n.createElement(u, {
588
+ fieldId: t,
589
+ renderLabel: () => S(N, {
590
+ label: f
591
+ }),
592
+ renderInput: () => /* @__PURE__ */ n.createElement(ye, {
593
+ "aria-labelledby": C,
594
+ value: s ?? "",
595
+ onChange: r,
596
+ isDisabled: o,
597
+ isReadOnly: l,
598
+ isRequired: i,
599
+ isInvalid: a,
600
+ onBlur: d,
601
+ onFocus: m
602
+ }, F),
603
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, _, v)
604
+ });
605
+ }, Xn = ({ children: e, value: t, onChange: s, disabled: r, readOnly: o, required: l, hasError: i, onBlur: a, onFocus: d }) => {
606
+ const { labelId: m } = M(), { onAddressSelect: u } = Le(), y = Ne(), C = je({
607
+ enabled: !0
608
+ }), { predictions: p, updatePredictions: E, clearPredictions: f } = Tt({
609
+ atlas: C
610
+ }), N = x(() => p.map((O) => ({
611
+ id: O.searchId || "",
612
+ label: O.description || ""
613
+ })), [
614
+ p
615
+ ]), F = A((O) => {
616
+ E({
617
+ input: O,
618
+ countryCodes: y ? [
619
+ y
620
+ ] : void 0
621
+ }), s(O);
622
+ }, [
623
+ s,
624
+ E,
625
+ y
626
+ ]), h = A(async (O) => {
627
+ if (!O)
628
+ return;
629
+ f();
630
+ const D = String(O), B = await (C == null ? void 0 : C.resolvePlace({
631
+ searchId: D,
632
+ prediction: p.find((X) => X.searchId === D)
633
+ }));
634
+ B && u && u(B);
635
+ }, [
636
+ u,
637
+ f,
638
+ C,
639
+ p
640
+ ]), v = A(() => {
641
+ f(), a == null || a();
642
+ }, [
643
+ a,
644
+ f
645
+ ]), _ = A(() => {
646
+ d == null || d();
647
+ }, [
648
+ d
649
+ ]), w = b(e, V.Input), T = b(e, V.Options);
650
+ return /* @__PURE__ */ n.createElement(Fe, {
651
+ "aria-labelledby": m,
652
+ inputValue: t ?? "",
653
+ onInputChange: F,
654
+ value: null,
655
+ onChange: h,
656
+ isDisabled: r,
657
+ isReadOnly: o,
658
+ isRequired: l,
659
+ isInvalid: i,
660
+ onBlur: v,
661
+ onFocus: _,
662
+ allowsCustomValue: !0,
663
+ menuTrigger: "input",
664
+ items: N
665
+ }, S(w, {
666
+ onFocus: _
667
+ }), S(T, {
668
+ options: N
669
+ }), /* @__PURE__ */ n.createElement(Je, {
670
+ optionCount: N.length
671
+ }));
672
+ }, Qn = ({ className: e, ...t }) => {
673
+ const { id: s, placeholder: r } = P(), { inputId: o, ariaDescribedBy: l } = M(), { onFocus: i } = t, a = q(null);
674
+ return le(() => {
675
+ var d;
676
+ (d = a.current) == null || d.focus({
677
+ preventScroll: !0
678
+ });
679
+ }, s), fe(a), /* @__PURE__ */ n.createElement(ie, {
680
+ ref: a,
681
+ id: o,
682
+ autoComplete: "address-line1",
683
+ "aria-describedby": l,
684
+ className: e,
685
+ placeholder: r,
686
+ onFocus: i
687
+ });
688
+ }, Xe = ({ children: e, className: t }) => {
689
+ const s = b(e, Xe.Option);
690
+ return /* @__PURE__ */ n.createElement(he, {
691
+ className: t,
692
+ containerPadding: 0,
693
+ offset: 0
694
+ }, /* @__PURE__ */ n.createElement(Me, {
695
+ renderEmptyState: () => null
696
+ }, (r) => S(s, {
697
+ id: r.id,
698
+ label: r.label
699
+ })));
700
+ }, zn = ({ className: e, ...t }) => {
701
+ const { id: s, label: r } = t;
702
+ return /* @__PURE__ */ n.createElement(De, {
703
+ className: e,
704
+ id: s,
705
+ textValue: r
706
+ }, r);
707
+ };
708
+ Xe.Option = zn;
709
+ V.Label = ue;
710
+ V.Input = Qn;
711
+ V.Options = Xe;
712
+ V.Description = ce;
713
+ V.Error = de;
714
+ const se = ({ children: e }) => {
715
+ const { id: t, value: s, onChange: r, disabled: o, readOnly: l, required: i, hasError: a, onBlur: d, onFocus: m, FieldLayout: u } = P(), { labelId: y } = M(), { t: C } = Te(), p = C("field.mla-apartment.label"), E = b(e, se.Label), f = b(e, se.Input), N = b(e, se.Description), F = b(e, se.Error);
716
+ return /* @__PURE__ */ n.createElement(u, {
717
+ fieldId: t,
718
+ renderLabel: () => S(E, {
719
+ label: p
720
+ }),
721
+ renderInput: () => /* @__PURE__ */ n.createElement(ye, {
722
+ "aria-labelledby": y,
723
+ value: s ?? "",
724
+ onChange: r,
725
+ isDisabled: o,
726
+ isReadOnly: l,
727
+ isRequired: i,
728
+ isInvalid: a,
729
+ onBlur: d,
730
+ onFocus: m
731
+ }, f),
732
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, F, N)
733
+ });
734
+ }, Gn = ({ className: e }) => {
735
+ const { id: t, placeholder: s } = P(), { inputId: r, ariaDescribedBy: o } = M(), l = q(null);
736
+ return le(() => {
737
+ var i;
738
+ (i = l.current) == null || i.focus({
739
+ preventScroll: !0
740
+ });
741
+ }, t), fe(l), /* @__PURE__ */ n.createElement(ie, {
742
+ ref: l,
743
+ id: r,
744
+ autoComplete: "address-line2",
745
+ "aria-describedby": o,
746
+ className: e,
747
+ placeholder: s
748
+ });
749
+ };
750
+ se.Label = ue;
751
+ se.Input = Gn;
752
+ se.Description = ce;
753
+ se.Error = de;
754
+ const oe = ({ children: e }) => {
755
+ const { id: t, value: s, onChange: r, disabled: o, readOnly: l, required: i, hasError: a, onBlur: d, onFocus: m, FieldLayout: u } = P(), { labelId: y } = M(), C = pe("city"), p = b(e, oe.Label), E = b(e, oe.Input), f = b(e, oe.Description), N = b(e, oe.Error);
756
+ return /* @__PURE__ */ n.createElement(u, {
757
+ fieldId: t,
758
+ renderLabel: () => S(p, {
759
+ label: C
760
+ }),
761
+ renderInput: () => /* @__PURE__ */ n.createElement(ye, {
762
+ "aria-labelledby": y,
763
+ value: s ?? "",
764
+ onChange: r,
765
+ isDisabled: o,
766
+ isReadOnly: l,
767
+ isRequired: i,
768
+ isInvalid: a,
769
+ onBlur: d,
770
+ onFocus: m
771
+ }, E),
772
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, N, f)
773
+ });
774
+ }, Zn = ({ className: e }) => {
775
+ const { id: t, placeholder: s } = P(), { inputId: r, ariaDescribedBy: o } = M(), l = q(null);
776
+ return le(() => {
777
+ var i;
778
+ (i = l.current) == null || i.focus({
779
+ preventScroll: !0
780
+ });
781
+ }, t), fe(l), /* @__PURE__ */ n.createElement(ie, {
782
+ ref: l,
783
+ id: r,
784
+ autoComplete: "address-level2",
785
+ "aria-describedby": o,
786
+ className: e,
787
+ placeholder: s
788
+ });
789
+ };
790
+ oe.Label = ue;
791
+ oe.Input = Zn;
792
+ oe.Description = ce;
793
+ oe.Error = de;
794
+ const er = ({ isOpen: e }) => {
795
+ const t = Ie(He), s = q(!1);
796
+ return Pe(() => {
797
+ e && t && !t.isOpen && t.open(null, "manual"), e && (t == null ? void 0 : t.selectionManager.focusedKey) != null && t.selectionManager.setFocusedKey(null), !e && s.current && (t == null || t.close()), s.current = e;
798
+ }, [
799
+ e,
800
+ t
801
+ ]), null;
802
+ }, Mt = ({ readOnly: e, disabled: t } = {}) => {
803
+ const s = Ie(He);
804
+ return A(() => {
805
+ !s || s.isOpen || e || t || s.open(null, "manual");
806
+ }, [
807
+ s,
808
+ e,
809
+ t
810
+ ]);
811
+ }, tr = (e, t) => e.find((s) => s.label.toLocaleLowerCase() === t.toLocaleLowerCase().trim()), wt = ({ options: e, value: t, commit: s, clear: r, onBlur: o }) => {
812
+ const [l, i] = be(null), a = pn(o), d = x(() => {
813
+ var p;
814
+ return t ? ((p = e.find((E) => E.value === t)) == null ? void 0 : p.label) ?? "" : "";
815
+ }, [
816
+ t,
817
+ e
818
+ ]), m = A((p) => {
819
+ typeof p != "string" || p === "" || p === t || (i(null), s(p));
820
+ }, [
821
+ s,
822
+ t
823
+ ]), u = A((p) => {
824
+ if (i(p), p === "")
825
+ return;
826
+ const E = tr(e, p);
827
+ E && E.value !== t && s(E.value);
828
+ }, [
829
+ s,
830
+ e,
831
+ t
832
+ ]), y = A((p) => {
833
+ p.key !== "Enter" && p.key !== "Escape" || (i(null), p.key === "Enter" && l === "" && t && r());
834
+ }, [
835
+ l,
836
+ t,
837
+ r
838
+ ]), C = A(() => {
839
+ l === "" && t && r(), i(null), a();
840
+ }, [
841
+ l,
842
+ t,
843
+ r,
844
+ a
845
+ ]);
846
+ return {
847
+ value: t ?? null,
848
+ inputValue: l ?? d,
849
+ onChange: m,
850
+ onInputChange: u,
851
+ onBlur: C,
852
+ onInputKeyDown: y
853
+ };
854
+ }, j = ({ children: e, ...t }) => {
855
+ const { isForcedOpen: s = !1 } = t, { id: r, value: o, onChange: l, disabled: i, readOnly: a, required: d, hasError: m, onBlur: u, onFocus: y, FieldLayout: C, options: p } = P(), { labelId: E } = M(), { t: f } = Te(), { language: N } = vt(), F = x(() => (p || []).reduce((R, g) => (g.value && ve.hasOwnProperty(g.value) && R.push({
856
+ value: g.value,
857
+ label: f(`locale-dataset.countries.${ve[g.value].toUpperCase()}`)
858
+ }), R), []).sort((R, g) => R.label.localeCompare(g.label, N)), [
859
+ p,
860
+ f,
861
+ N
862
+ ]), h = A((R) => l(R), [
863
+ l
864
+ ]), v = A(() => h(""), [
865
+ h
866
+ ]), { onInputKeyDown: _, ...w } = wt({
867
+ options: F,
868
+ value: o,
869
+ commit: h,
870
+ clear: v,
871
+ onBlur: u
872
+ }), T = pe("country"), O = b(e, j.Label), D = b(e, j.Control), B = b(e, j.Options), X = b(e, j.Description), K = b(e, j.Error);
873
+ return /* @__PURE__ */ n.createElement(C, {
874
+ fieldId: r,
875
+ renderLabel: () => S(O, {
876
+ label: T
877
+ }),
878
+ renderInput: () => /* @__PURE__ */ n.createElement(Fe, {
879
+ "aria-labelledby": E,
880
+ ...w,
881
+ isDisabled: i,
882
+ isReadOnly: a,
883
+ isRequired: d,
884
+ isInvalid: m,
885
+ onFocus: y,
886
+ menuTrigger: "input"
887
+ }, S(D, {
888
+ onKeyDown: _
889
+ }), S(B, {
890
+ options: F,
891
+ isForcedOpen: s
892
+ }), /* @__PURE__ */ n.createElement(er, {
893
+ isOpen: s
894
+ })),
895
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, K, X)
896
+ });
897
+ }, Se = ({ children: e, className: t, ...s }) => {
898
+ const { disabled: r, hasError: o } = P(), { onKeyDown: l } = s, i = b(e, Se.Input), a = b(e, Se.Trigger);
899
+ return /* @__PURE__ */ n.createElement(gt, {
900
+ className: t,
901
+ isDisabled: r,
902
+ isInvalid: o
903
+ }, S(i, {
904
+ onKeyDown: l
905
+ }), a);
906
+ }, nr = ({ className: e, ...t }) => {
907
+ const { id: s, placeholder: r, readOnly: o, disabled: l } = P(), { inputId: i, ariaDescribedBy: a } = M(), { onKeyDown: d } = t, m = q(null), u = Mt({
908
+ readOnly: o,
909
+ disabled: l
910
+ });
911
+ return le(() => {
912
+ var y;
913
+ (y = m.current) == null || y.focus({
914
+ preventScroll: !0
915
+ });
916
+ }, s), /* @__PURE__ */ n.createElement(ie, {
917
+ ref: m,
918
+ id: i,
919
+ autoComplete: "country-name",
920
+ "aria-describedby": a,
921
+ className: e,
922
+ placeholder: r,
923
+ onClick: u,
924
+ onKeyDown: d
925
+ });
926
+ }, rr = ({ children: e, className: t }) => /* @__PURE__ */ n.createElement(Ft, {
927
+ className: t
928
+ }, e);
929
+ Se.Input = nr;
930
+ Se.Trigger = rr;
931
+ const Qe = ({ children: e, className: t, ...s }) => {
932
+ const { options: r, isForcedOpen: o } = s, l = b(e, Qe.Option);
933
+ return /* @__PURE__ */ n.createElement(he, {
934
+ className: t,
935
+ containerPadding: 0,
936
+ offset: 0
937
+ }, /* @__PURE__ */ n.createElement(un, {
938
+ isForcedOpen: o
939
+ }, r.map((i) => S(l, {
940
+ key: i.value,
941
+ value: i.value,
942
+ label: i.label
943
+ }))));
944
+ }, sr = ({ className: e, ...t }) => {
945
+ const { value: s, label: r } = t;
946
+ return /* @__PURE__ */ n.createElement(De, {
947
+ className: e,
948
+ id: s,
949
+ textValue: r
950
+ }, r);
951
+ };
952
+ Qe.Option = sr;
953
+ j.Label = ue;
954
+ j.Control = Se;
955
+ j.Options = Qe;
956
+ j.Description = ce;
957
+ j.Error = de;
958
+ const or = /(\d{7})|(\d{3}-\d{4})/;
959
+ function ar(e) {
960
+ var t;
961
+ return (t = e.match(or)) == null ? void 0 : t[0];
962
+ }
963
+ function lr({ isAutocompleteEnabled: e }) {
964
+ const t = q({
965
+ hasAddress: !1
966
+ }), s = je({
967
+ enabled: e
968
+ });
969
+ return {
970
+ searchByPostalCode: A(async (o) => {
971
+ const l = ar(o);
972
+ if (l) {
973
+ if (t.current.postalCode === l && t.current.hasAddress)
974
+ return t.current.address;
975
+ t.current = {
976
+ postalCode: l,
977
+ address: void 0,
978
+ hasAddress: !1
979
+ };
980
+ try {
981
+ const i = await (s == null ? void 0 : s.searchByPostalCode({
982
+ countryCode: "JP",
983
+ postalCode: l
984
+ }));
985
+ return t.current.hasAddress = !0, t.current.address = void 0, i != null && i.formattedAddress ? (t.current.address = i, i) : void 0;
986
+ } catch (i) {
987
+ console.error(i);
988
+ }
989
+ }
990
+ }, [
991
+ s
992
+ ])
993
+ };
994
+ }
995
+ const $ = ({ children: e }) => {
996
+ const { id: t, value: s, onChange: r, disabled: o, readOnly: l, required: i, hasError: a, onBlur: d, onFocus: m, FieldLayout: u, autocomplete: y } = P(), { labelId: C } = M(), p = Ne(), { autocompleteEnabled: E } = Le(), f = !!(p && ve[p] === ve.JP), N = (y || E) && f, F = pe("zipCode"), h = b(e, $.Label), v = b(e, $.Control), _ = b(e, $.Options), w = b(e, $.Description), T = b(e, $.Error);
997
+ return N ? /* @__PURE__ */ n.createElement(u, {
998
+ fieldId: t,
999
+ renderLabel: () => S(h, {
1000
+ label: F
1001
+ }),
1002
+ renderInput: () => /* @__PURE__ */ n.createElement(ir, {
1003
+ value: s,
1004
+ onChange: r,
1005
+ disabled: o,
1006
+ readOnly: l,
1007
+ required: i,
1008
+ hasError: a,
1009
+ onBlur: d,
1010
+ onFocus: m
1011
+ }, v, _),
1012
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, T, w)
1013
+ }) : /* @__PURE__ */ n.createElement(u, {
1014
+ fieldId: t,
1015
+ renderLabel: () => S(h, {
1016
+ label: F
1017
+ }),
1018
+ renderInput: () => /* @__PURE__ */ n.createElement(ye, {
1019
+ "aria-labelledby": C,
1020
+ value: s ?? "",
1021
+ onChange: r,
1022
+ isDisabled: o,
1023
+ isReadOnly: l,
1024
+ isRequired: i,
1025
+ isInvalid: a,
1026
+ onBlur: d,
1027
+ onFocus: m
1028
+ }, v),
1029
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, T, w)
1030
+ });
1031
+ }, ir = ({ children: e, value: t, onChange: s, disabled: r, readOnly: o, required: l, hasError: i, onBlur: a, onFocus: d }) => {
1032
+ const { labelId: m } = M(), { onAddressSelect: u } = Le(), [y, C] = be(!1), { searchByPostalCode: p } = lr({
1033
+ isAutocompleteEnabled: y
1034
+ }), [E, f] = be(), N = x(() => E ? [
1035
+ {
1036
+ id: Y(),
1037
+ label: E.formattedAddress || ""
1038
+ }
1039
+ ] : [], [
1040
+ E
1041
+ ]), F = A(async (O) => {
1042
+ s(O);
1043
+ const D = await p(O ?? "");
1044
+ f(D);
1045
+ }, [
1046
+ s,
1047
+ p
1048
+ ]), h = A(async (O) => {
1049
+ O && (f(void 0), E && u && u(E));
1050
+ }, [
1051
+ u,
1052
+ E
1053
+ ]), v = A(() => {
1054
+ f(void 0), a == null || a();
1055
+ }, [
1056
+ a
1057
+ ]), _ = A(() => {
1058
+ C(!0), d == null || d();
1059
+ }, [
1060
+ d
1061
+ ]), w = b(e, $.Control), T = b(e, $.Options);
1062
+ return /* @__PURE__ */ n.createElement(Fe, {
1063
+ "aria-labelledby": m,
1064
+ inputValue: t ?? "",
1065
+ onInputChange: F,
1066
+ value: null,
1067
+ onChange: h,
1068
+ isDisabled: r,
1069
+ isReadOnly: o,
1070
+ isRequired: l,
1071
+ isInvalid: i,
1072
+ onBlur: v,
1073
+ onFocus: _,
1074
+ allowsCustomValue: !0,
1075
+ menuTrigger: "input",
1076
+ items: N
1077
+ }, S(w, {
1078
+ onFocus: _
1079
+ }), S(T, {
1080
+ options: N
1081
+ }), /* @__PURE__ */ n.createElement(Je, {
1082
+ optionCount: N.length
1083
+ }));
1084
+ }, ze = ({ children: e, className: t, ...s }) => {
1085
+ const { disabled: r, hasError: o } = P(), { onFocus: l } = s, i = Ne(), a = b(e, ze.Input);
1086
+ return /* @__PURE__ */ n.createElement("div", {
1087
+ className: t,
1088
+ "data-country": i || void 0,
1089
+ "data-disabled": r || void 0,
1090
+ "data-invalid": o || void 0
1091
+ }, S(a, {
1092
+ onFocus: l
1093
+ }));
1094
+ }, cr = ({ className: e, ...t }) => {
1095
+ const { id: s, placeholder: r } = P(), { inputId: o, ariaDescribedBy: l } = M(), { onFocus: i } = t, a = q(null);
1096
+ return le(() => {
1097
+ var d;
1098
+ (d = a.current) == null || d.focus({
1099
+ preventScroll: !0
1100
+ });
1101
+ }, s), fe(a), /* @__PURE__ */ n.createElement(ie, {
1102
+ ref: a,
1103
+ id: o,
1104
+ autoComplete: "postal-code",
1105
+ "aria-describedby": l,
1106
+ className: e,
1107
+ placeholder: r,
1108
+ onFocus: i
1109
+ });
1110
+ }, Ge = ({ children: e, className: t }) => {
1111
+ const s = b(e, Ge.Option);
1112
+ return /* @__PURE__ */ n.createElement(he, {
1113
+ className: t,
1114
+ containerPadding: 0,
1115
+ offset: 0
1116
+ }, /* @__PURE__ */ n.createElement(Me, {
1117
+ renderEmptyState: () => null
1118
+ }, (r) => S(s, {
1119
+ id: r.id,
1120
+ label: r.label
1121
+ })));
1122
+ }, dr = ({ className: e, ...t }) => {
1123
+ const { id: s, label: r } = t;
1124
+ return /* @__PURE__ */ n.createElement(De, {
1125
+ className: e,
1126
+ id: s,
1127
+ textValue: r
1128
+ }, r);
1129
+ };
1130
+ Ge.Option = dr;
1131
+ ze.Input = cr;
1132
+ $.Label = ue;
1133
+ $.Control = ze;
1134
+ $.Options = Ge;
1135
+ $.Description = ce;
1136
+ $.Error = de;
1137
+ const W = ({ children: e }) => {
1138
+ const { id: t, value: s, onChange: r, disabled: o, readOnly: l, required: i, hasError: a, onBlur: d, onFocus: m, FieldLayout: u, autocomplete: y } = P(), { labelId: C } = M(), { autocompleteEnabled: p } = Le(), E = y || p, f = pe("streetName"), N = b(e, W.Label), F = b(e, W.Input), h = b(e, W.Options), v = b(e, W.Description), _ = b(e, W.Error);
1139
+ return E ? /* @__PURE__ */ n.createElement(u, {
1140
+ fieldId: t,
1141
+ renderLabel: () => S(N, {
1142
+ label: f
1143
+ }),
1144
+ renderInput: () => /* @__PURE__ */ n.createElement(ur, {
1145
+ value: s,
1146
+ onChange: r,
1147
+ disabled: o,
1148
+ readOnly: l,
1149
+ required: i,
1150
+ hasError: a,
1151
+ onBlur: d,
1152
+ onFocus: m
1153
+ }, F, h),
1154
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, _, v)
1155
+ }) : /* @__PURE__ */ n.createElement(u, {
1156
+ fieldId: t,
1157
+ renderLabel: () => S(N, {
1158
+ label: f
1159
+ }),
1160
+ renderInput: () => /* @__PURE__ */ n.createElement(ye, {
1161
+ "aria-labelledby": C,
1162
+ value: s ?? "",
1163
+ onChange: r,
1164
+ isDisabled: o,
1165
+ isReadOnly: l,
1166
+ isRequired: i,
1167
+ isInvalid: a,
1168
+ onBlur: d,
1169
+ onFocus: m
1170
+ }, F),
1171
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, _, v)
1172
+ });
1173
+ }, ur = ({ children: e, value: t, onChange: s, disabled: r, readOnly: o, required: l, hasError: i, onBlur: a, onFocus: d }) => {
1174
+ const { labelId: m } = M(), { onAddressSelect: u } = Le(), y = Ne(), C = je({
1175
+ enabled: !0
1176
+ }), { predictions: p, updatePredictions: E, clearPredictions: f } = Tt({
1177
+ atlas: C
1178
+ }), N = b(e, W.Input), F = b(e, W.Options), h = x(() => p.reduce((O, D) => (D.searchId && D.description && O.push({
1179
+ id: D.searchId,
1180
+ label: D.description
1181
+ }), O), []), [
1182
+ p
1183
+ ]), v = A((O) => {
1184
+ E({
1185
+ input: O,
1186
+ countryCodes: y ? [
1187
+ y
1188
+ ] : void 0
1189
+ }), s(O);
1190
+ }, [
1191
+ s,
1192
+ E,
1193
+ y
1194
+ ]), _ = A(async (O) => {
1195
+ if (f(), !O)
1196
+ return;
1197
+ const D = String(O), B = await (C == null ? void 0 : C.resolvePlace({
1198
+ searchId: D,
1199
+ prediction: p.find((X) => X.searchId === D)
1200
+ }));
1201
+ B && u && u(B);
1202
+ }, [
1203
+ u,
1204
+ f,
1205
+ C,
1206
+ p
1207
+ ]), w = A(() => {
1208
+ f(), a == null || a();
1209
+ }, [
1210
+ a,
1211
+ f
1212
+ ]), T = A(() => {
1213
+ d == null || d();
1214
+ }, [
1215
+ d
1216
+ ]);
1217
+ return /* @__PURE__ */ n.createElement(Fe, {
1218
+ "aria-labelledby": m,
1219
+ inputValue: t ?? "",
1220
+ onInputChange: v,
1221
+ value: null,
1222
+ onChange: _,
1223
+ isDisabled: r,
1224
+ isReadOnly: o,
1225
+ isRequired: l,
1226
+ isInvalid: i,
1227
+ onBlur: w,
1228
+ onFocus: T,
1229
+ allowsCustomValue: !0,
1230
+ menuTrigger: "input",
1231
+ items: h
1232
+ }, S(N, {
1233
+ onFocus: T
1234
+ }), S(F, {
1235
+ options: h
1236
+ }), /* @__PURE__ */ n.createElement(Je, {
1237
+ optionCount: h.length
1238
+ }));
1239
+ }, mr = ({ className: e, ...t }) => {
1240
+ const { id: s, placeholder: r } = P(), { inputId: o, ariaDescribedBy: l } = M(), { onFocus: i } = t, a = q(null);
1241
+ return le(() => {
1242
+ var d;
1243
+ (d = a.current) == null || d.focus({
1244
+ preventScroll: !0
1245
+ });
1246
+ }, s), fe(a), /* @__PURE__ */ n.createElement(ie, {
1247
+ ref: a,
1248
+ id: o,
1249
+ autoComplete: "address-line1",
1250
+ "aria-describedby": l,
1251
+ className: e,
1252
+ placeholder: r,
1253
+ onFocus: i
1254
+ });
1255
+ }, Ze = ({ children: e, className: t }) => {
1256
+ const s = b(e, Ze.Option);
1257
+ return /* @__PURE__ */ n.createElement(he, {
1258
+ className: t,
1259
+ containerPadding: 0,
1260
+ offset: 0
1261
+ }, /* @__PURE__ */ n.createElement(Me, {
1262
+ renderEmptyState: () => null
1263
+ }, (r) => S(s, {
1264
+ id: r.id,
1265
+ label: r.label
1266
+ })));
1267
+ }, pr = ({ className: e, ...t }) => {
1268
+ const { id: s, label: r } = t;
1269
+ return /* @__PURE__ */ n.createElement(De, {
1270
+ className: e,
1271
+ id: s,
1272
+ textValue: r
1273
+ }, r);
1274
+ };
1275
+ Ze.Option = pr;
1276
+ W.Label = ue;
1277
+ W.Input = mr;
1278
+ W.Options = Ze;
1279
+ W.Description = ce;
1280
+ W.Error = de;
1281
+ const ae = ({ children: e }) => {
1282
+ const { id: t, value: s, onChange: r, disabled: o, readOnly: l, required: i, hasError: a, onBlur: d, onFocus: m, FieldLayout: u } = P(), { labelId: y } = M(), C = pe("streetNumber"), p = b(e, ae.Label), E = b(e, ae.Input), f = b(e, ae.Description), N = b(e, ae.Error);
1283
+ return /* @__PURE__ */ n.createElement(u, {
1284
+ fieldId: t,
1285
+ renderLabel: () => S(p, {
1286
+ label: C
1287
+ }),
1288
+ renderInput: () => /* @__PURE__ */ n.createElement(ye, {
1289
+ "aria-labelledby": y,
1290
+ value: s ?? "",
1291
+ onChange: r,
1292
+ isDisabled: o,
1293
+ isReadOnly: l,
1294
+ isRequired: i,
1295
+ isInvalid: a,
1296
+ onBlur: d,
1297
+ onFocus: m
1298
+ }, E),
1299
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, N, f)
1300
+ });
1301
+ }, Er = ({ className: e }) => {
1302
+ const { id: t, placeholder: s } = P(), { inputId: r, ariaDescribedBy: o } = M(), l = q(null);
1303
+ return le(() => {
1304
+ var i;
1305
+ (i = l.current) == null || i.focus({
1306
+ preventScroll: !0
1307
+ });
1308
+ }, t), fe(l), /* @__PURE__ */ n.createElement(ie, {
1309
+ ref: l,
1310
+ id: r,
1311
+ "aria-describedby": o,
1312
+ className: e,
1313
+ placeholder: s
1314
+ });
1315
+ };
1316
+ ae.Label = ue;
1317
+ ae.Input = Er;
1318
+ ae.Description = ce;
1319
+ ae.Error = de;
1320
+ const J = ({ children: e }) => {
1321
+ const { id: t, value: s, onChange: r, disabled: o, readOnly: l, required: i, hasError: a, onBlur: d, onFocus: m, FieldLayout: u } = P(), { labelId: y } = M(), { t: C } = Te(), p = Ne(), E = p ? ve[p] : void 0, f = p && $t.getCountryByShortKey(p), N = x(() => {
1322
+ var K;
1323
+ return (Wt(((K = f == null ? void 0 : f.subdivisions) == null ? void 0 : K.list) || [], E) || []).map((R) => ({
1324
+ value: R.key,
1325
+ label: C(R.displayName)
1326
+ })).sort((R, g) => R.label.localeCompare(g.label));
1327
+ }, [
1328
+ E,
1329
+ C,
1330
+ f
1331
+ ]), F = A(() => r(""), [
1332
+ r
1333
+ ]), { onInputKeyDown: h, ...v } = wt({
1334
+ options: N,
1335
+ value: s,
1336
+ commit: r,
1337
+ clear: F,
1338
+ onBlur: d
1339
+ }), _ = pe("subdivision"), w = b(e, J.Label), T = b(e, J.Control), O = b(e, J.Options), D = b(e, J.Description), B = b(e, J.Error);
1340
+ return /* @__PURE__ */ n.createElement(u, {
1341
+ fieldId: t,
1342
+ renderLabel: () => S(w, {
1343
+ label: _
1344
+ }),
1345
+ renderInput: () => /* @__PURE__ */ n.createElement(Fe, {
1346
+ "aria-labelledby": y,
1347
+ ...v,
1348
+ isDisabled: o,
1349
+ isReadOnly: l,
1350
+ isRequired: i,
1351
+ isInvalid: a,
1352
+ onFocus: m,
1353
+ menuTrigger: "input"
1354
+ }, S(T, {
1355
+ onKeyDown: h
1356
+ }), S(O, {
1357
+ options: N
1358
+ })),
1359
+ renderDescription: () => /* @__PURE__ */ n.createElement(n.Fragment, null, B, D)
1360
+ });
1361
+ }, ge = ({ children: e, className: t, ...s }) => {
1362
+ const { disabled: r, hasError: o } = P(), { onKeyDown: l } = s, i = b(e, ge.Input), a = b(e, ge.Trigger);
1363
+ return /* @__PURE__ */ n.createElement(gt, {
1364
+ className: t,
1365
+ isDisabled: r,
1366
+ isInvalid: o
1367
+ }, S(i, {
1368
+ onKeyDown: l
1369
+ }), a);
1370
+ }, br = ({ className: e, ...t }) => {
1371
+ const { id: s, placeholder: r, readOnly: o, disabled: l } = P(), { inputId: i, ariaDescribedBy: a } = M(), { onKeyDown: d } = t, m = q(null), u = Mt({
1372
+ readOnly: o,
1373
+ disabled: l
1374
+ });
1375
+ return le(() => {
1376
+ var y;
1377
+ (y = m.current) == null || y.focus({
1378
+ preventScroll: !0
1379
+ });
1380
+ }, s), /* @__PURE__ */ n.createElement(ie, {
1381
+ ref: m,
1382
+ id: i,
1383
+ autoComplete: "address-level1",
1384
+ "aria-describedby": a,
1385
+ className: e,
1386
+ placeholder: r,
1387
+ onClick: u,
1388
+ onKeyDown: d
1389
+ });
1390
+ }, fr = ({ children: e, className: t }) => /* @__PURE__ */ n.createElement(Ft, {
1391
+ className: t
1392
+ }, e);
1393
+ ge.Input = br;
1394
+ ge.Trigger = fr;
1395
+ const et = ({ children: e, className: t, ...s }) => {
1396
+ const { options: r } = s, o = b(e, et.Option);
1397
+ return /* @__PURE__ */ n.createElement(he, {
1398
+ className: t,
1399
+ containerPadding: 0,
1400
+ offset: 0
1401
+ }, /* @__PURE__ */ n.createElement(Me, null, r.map((l) => S(o, {
1402
+ key: l.value,
1403
+ value: l.value,
1404
+ label: l.label
1405
+ }))));
1406
+ }, yr = ({ className: e, ...t }) => {
1407
+ const { value: s, label: r } = t;
1408
+ return /* @__PURE__ */ n.createElement(De, {
1409
+ className: e,
1410
+ id: s,
1411
+ textValue: r
1412
+ }, r);
1413
+ };
1414
+ et.Option = yr;
1415
+ J.Label = ue;
1416
+ J.Control = ge;
1417
+ J.Options = et;
1418
+ J.Description = ce;
1419
+ J.Error = de;
1420
+ const Cr = () => me("country"), Ir = () => me("subdivision"), Lr = () => me("city"), Nr = () => me("addressLine"), Or = () => me("addressLine2"), vr = () => me("postalCode"), Sr = () => me("streetName"), gr = () => me("streetNumber"), Fr = () => me("apartment"), hr = {
1421
+ [H.MLA_COUNTRY]: Cr,
1422
+ [H.MLA_SUBDIVISION]: Ir,
1423
+ [H.MLA_CITY]: Lr,
1424
+ [H.MLA_ADDRESS_LINE]: Nr,
1425
+ [H.MLA_ADDRESS_LINE_2]: Or,
1426
+ [H.MLA_POSTAL_CODE]: vr,
1427
+ [H.MLA_STREET_NAME]: Sr,
1428
+ [H.MLA_STREET_NUMBER]: gr,
1429
+ [H.MLA_APARTMENT]: Fr
1430
+ }, Dr = {}, Ar = [], c = ({ children: e, className: t }) => {
1431
+ const { id: s, form: r, value: o, onChange: l, onFieldBlur: i, onFieldFocus: a, errors: d, FieldLayout: m, fieldSettings: u, label: y, validation: C, target: p, autocompleteEnabled: E, required: f, fieldType: N } = P(), [F, h] = be(null), v = Kt(), _ = x(() => ({
1432
+ ...v,
1433
+ ...hr
1434
+ }), [
1435
+ v
1436
+ ]), { isExperimentEnabled: w } = Ke(), T = w(Ye.STREETLESS_LOCALITY_FALLBACK), { validateFields: O } = Yt(), D = Ht(), B = St(), X = x(() => {
1437
+ var U;
1438
+ const k = !!((U = B.actions) != null && U.getPlace);
1439
+ return {
1440
+ ...B,
1441
+ actions: {
1442
+ predict: Qt,
1443
+ getPlace: Xt,
1444
+ searchByPostalCode: Jt,
1445
+ ...k ? {} : {
1446
+ searchByQuery: jt
1447
+ },
1448
+ ...B.actions
1449
+ }
1450
+ };
1451
+ }, [
1452
+ B
1453
+ ]), { form: K, isMultilineAddressField: R } = hn({
1454
+ id: s,
1455
+ target: p,
1456
+ fieldType: N,
1457
+ form: r,
1458
+ country: o == null ? void 0 : o.country,
1459
+ fieldSettings: u,
1460
+ validation: C,
1461
+ required: f
1462
+ }), g = A((k) => {
1463
+ if (!o)
1464
+ return;
1465
+ const U = bn(k, R, T), _e = {
1466
+ ...U,
1467
+ [Ce.COUNTRY]: U[Ce.COUNTRY] ?? o[Ce.COUNTRY]
1468
+ };
1469
+ l == null || l(_e);
1470
+ }, [
1471
+ l,
1472
+ o,
1473
+ R,
1474
+ T
1475
+ ]), Q = A((k, U) => {
1476
+ if (R && k === Ce.COUNTRY && (o == null ? void 0 : o[k]) !== U) {
1477
+ l == null || l({
1478
+ [Ce.COUNTRY]: U
1479
+ });
1480
+ return;
1481
+ }
1482
+ l == null || l({
1483
+ ...o,
1484
+ [k]: U
1485
+ });
1486
+ }, [
1487
+ l,
1488
+ o,
1489
+ R
1490
+ ]), Ee = A(async (k) => O(R ? [
1491
+ ...k,
1492
+ {
1493
+ path: `${p}/${Ce.COUNTRY}`,
1494
+ value: o == null ? void 0 : o.country
1495
+ }
1496
+ ] : k), [
1497
+ o,
1498
+ p,
1499
+ O,
1500
+ R
1501
+ ]);
1502
+ zt(s, () => {
1503
+ var _e;
1504
+ const k = d == null ? void 0 : d[0], U = (_e = K == null ? void 0 : K.fields) == null ? void 0 : _e.find((dt) => "target" in dt && dt.target === (k == null ? void 0 : k.errorPath));
1505
+ return U == null ? void 0 : U.id;
1506
+ });
1507
+ const Ae = an(s), tt = S(b(e, c.Country), {
1508
+ isForcedOpen: Ae
1509
+ }), nt = b(e, c.Subdivision), rt = b(e, c.City), st = b(e, c.AddressLine), ot = b(e, c.AddressLine2), at = b(e, c.PostalCode), lt = b(e, c.StreetName), it = b(e, c.StreetNumber), ct = b(e, c.Apartment), Bt = x(() => ({
1510
+ country: tt,
1511
+ subdivision: nt,
1512
+ city: rt,
1513
+ addressLine: st,
1514
+ addressLine2: ot,
1515
+ postalCode: at,
1516
+ streetName: lt,
1517
+ streetNumber: it,
1518
+ apartment: ct
1519
+ }), [
1520
+ tt,
1521
+ nt,
1522
+ rt,
1523
+ st,
1524
+ ot,
1525
+ at,
1526
+ lt,
1527
+ it,
1528
+ ct
1529
+ ]);
1530
+ return K ? /* @__PURE__ */ n.createElement(m, {
1531
+ fieldId: s
1532
+ }, /* @__PURE__ */ n.createElement(yn, {
1533
+ countryCode: o == null ? void 0 : o.country
1534
+ }, /* @__PURE__ */ n.createElement(fn, {
1535
+ autocompleteEnabled: E,
1536
+ onAddressSelect: g
1537
+ }, /* @__PURE__ */ n.createElement(Dn, {
1538
+ fields: Bt
1539
+ }, /* @__PURE__ */ n.createElement("div", {
1540
+ ref: h,
1541
+ style: {
1542
+ display: "contents"
1543
+ }
1544
+ }), /* @__PURE__ */ n.createElement(rn, {
1545
+ getContainer: () => F
1546
+ }, /* @__PURE__ */ n.createElement("fieldset", {
1547
+ className: t,
1548
+ style: sn
1549
+ }, /* @__PURE__ */ n.createElement("legend", {
1550
+ style: on
1551
+ }, y), /* @__PURE__ */ n.createElement(Gt, {
1552
+ formSchema: D,
1553
+ form: K,
1554
+ values: o ?? Dr,
1555
+ onFieldChange: Q,
1556
+ onBlur: i,
1557
+ onFocus: a,
1558
+ errors: d ?? Ar,
1559
+ validateFields: Ee,
1560
+ fields: _,
1561
+ fieldActions: X
1562
+ }))))))) : null;
1563
+ };
1564
+ c.Country = j;
1565
+ c.Subdivision = J;
1566
+ c.City = oe;
1567
+ c.AddressLine = V;
1568
+ c.AddressLine2 = re;
1569
+ c.PostalCode = $;
1570
+ c.StreetName = W;
1571
+ c.StreetNumber = ae;
1572
+ c.Apartment = se;
1573
+ const _r = "_postalCodeControl_1tire_1", Rr = "_comboControl_1tire_5", Pr = "_comboTrigger_1tire_19", Re = {
1574
+ postalCodeControl: _r,
1575
+ comboControl: Rr,
1576
+ comboTrigger: Pr
1577
+ }, Gr = () => {
1578
+ const e = pt(en, [
1579
+ Re.comboControl
1580
+ ]), t = pt(nn, []), s = mn(tn, we);
1581
+ return /* @__PURE__ */ n.createElement(c, {
1582
+ className: Zt
1583
+ }, /* @__PURE__ */ n.createElement(c.Country, null, /* @__PURE__ */ n.createElement(c.Country.Label, {
1584
+ className: L(G, I.label)
1585
+ }, /* @__PURE__ */ n.createElement(c.Country.Label.Required, {
1586
+ className: L(Z, I.requiredMark)
1587
+ })), /* @__PURE__ */ n.createElement(c.Country.Control, {
1588
+ className: e
1589
+ }, /* @__PURE__ */ n.createElement(c.Country.Control.Input, {
1590
+ className: L(I.innerInput, we)
1591
+ }), /* @__PURE__ */ n.createElement(c.Country.Control.Trigger, {
1592
+ className: Re.comboTrigger
1593
+ }, /* @__PURE__ */ n.createElement(mt, {
1594
+ className: I.dropdownIcon
1595
+ }))), /* @__PURE__ */ n.createElement(c.Country.Options, {
1596
+ className: L(Oe, I.selectPopover, I.dropdownPopover)
1597
+ }, /* @__PURE__ */ n.createElement(c.Country.Options.Option, {
1598
+ className: s
1599
+ })), /* @__PURE__ */ n.createElement(c.Country.Error, {
1600
+ className: L(ee, I.error)
1601
+ }, /* @__PURE__ */ n.createElement(ne, null), /* @__PURE__ */ n.createElement(c.Country.Error.Text, null)), /* @__PURE__ */ n.createElement(c.Country.Description, {
1602
+ className: L(te, I.description)
1603
+ }, ({ content: r, locale: o }) => /* @__PURE__ */ n.createElement(z, {
1604
+ content: r,
1605
+ locale: o
1606
+ }))), /* @__PURE__ */ n.createElement(c.AddressLine, null, /* @__PURE__ */ n.createElement(c.AddressLine.Label, {
1607
+ className: L(G, I.label)
1608
+ }, /* @__PURE__ */ n.createElement(c.AddressLine.Label.Required, {
1609
+ className: L(Z, I.requiredMark)
1610
+ })), /* @__PURE__ */ n.createElement(c.AddressLine.Input, {
1611
+ className: t
1612
+ }), /* @__PURE__ */ n.createElement(c.AddressLine.Options, {
1613
+ className: L(Oe, I.selectPopover, I.dropdownPopover)
1614
+ }, /* @__PURE__ */ n.createElement(c.AddressLine.Options.Option, {
1615
+ className: s
1616
+ })), /* @__PURE__ */ n.createElement(c.AddressLine.Error, {
1617
+ className: L(ee, I.error)
1618
+ }, /* @__PURE__ */ n.createElement(ne, null), /* @__PURE__ */ n.createElement(c.AddressLine.Error.Text, null)), /* @__PURE__ */ n.createElement(c.AddressLine.Description, {
1619
+ className: L(te, I.description)
1620
+ }, ({ content: r, locale: o }) => /* @__PURE__ */ n.createElement(z, {
1621
+ content: r,
1622
+ locale: o
1623
+ }))), /* @__PURE__ */ n.createElement(c.AddressLine2, null, /* @__PURE__ */ n.createElement(c.AddressLine2.Label, {
1624
+ className: L(G, I.label)
1625
+ }, /* @__PURE__ */ n.createElement(c.AddressLine2.Label.Required, {
1626
+ className: L(Z, I.requiredMark)
1627
+ })), /* @__PURE__ */ n.createElement(c.AddressLine2.Input, {
1628
+ className: t
1629
+ }), /* @__PURE__ */ n.createElement(c.AddressLine2.Error, {
1630
+ className: L(ee, I.error)
1631
+ }, /* @__PURE__ */ n.createElement(ne, null), /* @__PURE__ */ n.createElement(c.AddressLine2.Error.Text, null)), /* @__PURE__ */ n.createElement(c.AddressLine2.Description, {
1632
+ className: L(te, I.description)
1633
+ }, ({ content: r, locale: o }) => /* @__PURE__ */ n.createElement(z, {
1634
+ content: r,
1635
+ locale: o
1636
+ }))), /* @__PURE__ */ n.createElement(c.City, null, /* @__PURE__ */ n.createElement(c.City.Label, {
1637
+ className: L(G, I.label)
1638
+ }, /* @__PURE__ */ n.createElement(c.City.Label.Required, {
1639
+ className: L(Z, I.requiredMark)
1640
+ })), /* @__PURE__ */ n.createElement(c.City.Input, {
1641
+ className: t
1642
+ }), /* @__PURE__ */ n.createElement(c.City.Error, {
1643
+ className: L(ee, I.error)
1644
+ }, /* @__PURE__ */ n.createElement(ne, null), /* @__PURE__ */ n.createElement(c.City.Error.Text, null)), /* @__PURE__ */ n.createElement(c.City.Description, {
1645
+ className: L(te, I.description)
1646
+ }, ({ content: r, locale: o }) => /* @__PURE__ */ n.createElement(z, {
1647
+ content: r,
1648
+ locale: o
1649
+ }))), /* @__PURE__ */ n.createElement(c.PostalCode, null, /* @__PURE__ */ n.createElement(c.PostalCode.Label, {
1650
+ className: L(G, I.label)
1651
+ }, /* @__PURE__ */ n.createElement(c.PostalCode.Label.Required, {
1652
+ className: L(Z, I.requiredMark)
1653
+ })), /* @__PURE__ */ n.createElement(c.PostalCode.Control, {
1654
+ className: Re.postalCodeControl
1655
+ }, /* @__PURE__ */ n.createElement(c.PostalCode.Control.Input, {
1656
+ className: t
1657
+ })), /* @__PURE__ */ n.createElement(c.PostalCode.Options, {
1658
+ className: L(Oe, I.selectPopover, I.dropdownPopover)
1659
+ }, /* @__PURE__ */ n.createElement(c.PostalCode.Options.Option, {
1660
+ className: s
1661
+ })), /* @__PURE__ */ n.createElement(c.PostalCode.Error, {
1662
+ className: L(ee, I.error)
1663
+ }, /* @__PURE__ */ n.createElement(ne, null), /* @__PURE__ */ n.createElement(c.PostalCode.Error.Text, null)), /* @__PURE__ */ n.createElement(c.PostalCode.Description, {
1664
+ className: L(te, I.description)
1665
+ }, ({ content: r, locale: o }) => /* @__PURE__ */ n.createElement(z, {
1666
+ content: r,
1667
+ locale: o
1668
+ }))), /* @__PURE__ */ n.createElement(c.Subdivision, null, /* @__PURE__ */ n.createElement(c.Subdivision.Label, {
1669
+ className: L(G, I.label)
1670
+ }, /* @__PURE__ */ n.createElement(c.Subdivision.Label.Required, {
1671
+ className: L(Z, I.requiredMark)
1672
+ })), /* @__PURE__ */ n.createElement(c.Subdivision.Control, {
1673
+ className: e
1674
+ }, /* @__PURE__ */ n.createElement(c.Subdivision.Control.Input, {
1675
+ className: L(I.innerInput, we)
1676
+ }), /* @__PURE__ */ n.createElement(c.Subdivision.Control.Trigger, {
1677
+ className: Re.comboTrigger
1678
+ }, /* @__PURE__ */ n.createElement(mt, {
1679
+ className: I.dropdownIcon
1680
+ }))), /* @__PURE__ */ n.createElement(c.Subdivision.Options, {
1681
+ className: L(Oe, I.selectPopover, I.dropdownPopover)
1682
+ }, /* @__PURE__ */ n.createElement(c.Subdivision.Options.Option, {
1683
+ className: s
1684
+ })), /* @__PURE__ */ n.createElement(c.Subdivision.Error, {
1685
+ className: L(ee, I.error)
1686
+ }, /* @__PURE__ */ n.createElement(ne, null), /* @__PURE__ */ n.createElement(c.Subdivision.Error.Text, null)), /* @__PURE__ */ n.createElement(c.Subdivision.Description, {
1687
+ className: L(te, I.description)
1688
+ }, ({ content: r, locale: o }) => /* @__PURE__ */ n.createElement(z, {
1689
+ content: r,
1690
+ locale: o
1691
+ }))), /* @__PURE__ */ n.createElement(c.StreetName, null, /* @__PURE__ */ n.createElement(c.StreetName.Label, {
1692
+ className: L(G, I.label)
1693
+ }, /* @__PURE__ */ n.createElement(c.StreetName.Label.Required, {
1694
+ className: L(Z, I.requiredMark)
1695
+ })), /* @__PURE__ */ n.createElement(c.StreetName.Input, {
1696
+ className: t
1697
+ }), /* @__PURE__ */ n.createElement(c.StreetName.Options, {
1698
+ className: L(Oe, I.selectPopover, I.dropdownPopover)
1699
+ }, /* @__PURE__ */ n.createElement(c.StreetName.Options.Option, {
1700
+ className: s
1701
+ })), /* @__PURE__ */ n.createElement(c.StreetName.Error, {
1702
+ className: L(ee, I.error)
1703
+ }, /* @__PURE__ */ n.createElement(ne, null), /* @__PURE__ */ n.createElement(c.StreetName.Error.Text, null)), /* @__PURE__ */ n.createElement(c.StreetName.Description, {
1704
+ className: L(te, I.description)
1705
+ }, ({ content: r, locale: o }) => /* @__PURE__ */ n.createElement(z, {
1706
+ content: r,
1707
+ locale: o
1708
+ }))), /* @__PURE__ */ n.createElement(c.StreetNumber, null, /* @__PURE__ */ n.createElement(c.StreetNumber.Label, {
1709
+ className: L(G, I.label)
1710
+ }, /* @__PURE__ */ n.createElement(c.StreetNumber.Label.Required, {
1711
+ className: L(Z, I.requiredMark)
1712
+ })), /* @__PURE__ */ n.createElement(c.StreetNumber.Input, {
1713
+ className: t
1714
+ }), /* @__PURE__ */ n.createElement(c.StreetNumber.Error, {
1715
+ className: L(ee, I.error)
1716
+ }, /* @__PURE__ */ n.createElement(ne, null), /* @__PURE__ */ n.createElement(c.StreetNumber.Error.Text, null)), /* @__PURE__ */ n.createElement(c.StreetNumber.Description, {
1717
+ className: L(te, I.description)
1718
+ }, ({ content: r, locale: o }) => /* @__PURE__ */ n.createElement(z, {
1719
+ content: r,
1720
+ locale: o
1721
+ }))), /* @__PURE__ */ n.createElement(c.Apartment, null, /* @__PURE__ */ n.createElement(c.Apartment.Label, {
1722
+ className: L(G, I.label)
1723
+ }, /* @__PURE__ */ n.createElement(c.Apartment.Label.Required, {
1724
+ className: L(Z, I.requiredMark)
1725
+ })), /* @__PURE__ */ n.createElement(c.Apartment.Input, {
1726
+ className: t
1727
+ }), /* @__PURE__ */ n.createElement(c.Apartment.Error, {
1728
+ className: L(ee, I.error)
1729
+ }, /* @__PURE__ */ n.createElement(ne, null), /* @__PURE__ */ n.createElement(c.Apartment.Error.Text, null)), /* @__PURE__ */ n.createElement(c.Apartment.Description, {
1730
+ className: L(te, I.description)
1731
+ }, ({ content: r, locale: o }) => /* @__PURE__ */ n.createElement(z, {
1732
+ content: r,
1733
+ locale: o
1734
+ }))));
1735
+ };
1736
+ export {
1737
+ Gr as M
1738
+ };