@opendoor/partner-sdk-client-vue 1.0.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.
package/dist/index.js ADDED
@@ -0,0 +1,1944 @@
1
+ import { defineComponent as A, computed as k, provide as ne, ref as I, watch as H, onUnmounted as Z, renderSlot as X, inject as F, openBlock as u, createElementBlock as y, normalizeClass as r, createElementVNode as l, onMounted as se, normalizeStyle as Q, createCommentVNode as w, Fragment as j, toDisplayString as m, renderList as z, withKeys as re, withModifiers as le, createBlock as N, unref as E, withDirectives as pe, vModelText as ye, createVNode as J, withCtx as ge } from "vue";
2
+ import { NOOP_TRACKING as te, TrackingClient as fe } from "@opendoor/partner-sdk-client-js-core/internal/tracking";
3
+ import { resolveAppearance as he } from "@opendoor/partner-sdk-client-js-core";
4
+ import { OpendoorClient as bo, THEMES as mo, resolveAppearance as $o } from "@opendoor/partner-sdk-client-js-core";
5
+ import { createDtcOnboardingFlow as ie } from "@opendoor/partner-sdk-client-js-core/internal/questionnaire";
6
+ const co = /* @__PURE__ */ A({
7
+ __name: "OpendoorProvider",
8
+ props: {
9
+ client: {}
10
+ },
11
+ setup(e) {
12
+ const t = e, s = k(() => t.client);
13
+ ne("opendoor-client", s);
14
+ const o = I(te);
15
+ return ne("opendoor-tracking", o), H(
16
+ () => t.client,
17
+ () => {
18
+ o.value !== te && o.value.destroy();
19
+ const a = new fe(t.client.environment);
20
+ o.value = a;
21
+ },
22
+ { immediate: !0 }
23
+ ), Z(() => {
24
+ o.value !== te && o.value.destroy();
25
+ }), (a, n) => X(a.$slots, "default");
26
+ }
27
+ });
28
+ function be() {
29
+ const e = F("opendoor-client");
30
+ if (!e)
31
+ throw new Error(
32
+ "useOpendoorClient must be used within an <OpendoorProvider>"
33
+ );
34
+ return e;
35
+ }
36
+ function ee(e) {
37
+ const t = he(e), s = {};
38
+ for (const [o, a] of Object.entries(t)) {
39
+ const n = o.replace(/([A-Z])/g, "-$1").toLowerCase();
40
+ s[`--od-${n}`] = a;
41
+ }
42
+ return s;
43
+ }
44
+ const me = /* @__PURE__ */ A({
45
+ __name: "PoweredByOpendoor",
46
+ setup(e) {
47
+ return (t, s) => (u(), y("div", {
48
+ class: r(t.$style.attribution),
49
+ "data-testid": "od-attribution"
50
+ }, [
51
+ l("span", {
52
+ class: r(t.$style.text)
53
+ }, "Powered by", 2),
54
+ s[0] || (s[0] = l("svg", {
55
+ width: "75",
56
+ height: "16",
57
+ viewBox: "0 0 112.574 24.0002",
58
+ fill: "none",
59
+ xmlns: "http://www.w3.org/2000/svg",
60
+ "aria-label": "Opendoor",
61
+ role: "img"
62
+ }, [
63
+ l("path", {
64
+ d: "M21.8975 5.53219C22.0296 5.51725 22.144 5.62372 22.1396 5.7568L22.0928 7.21773H22.2148C23.2408 6.33834 24.6088 5.53316 26.3184 5.53316C28.6383 5.53337 31.1045 7.07197 31.1045 11.542C31.1044 16.6229 28.1252 18.8456 24.0469 18.8457C23.5341 18.8457 22.7277 18.748 22.1904 18.6015C22.1904 18.6015 22.2148 19.2369 22.2148 20.0918V23.4072C22.2148 23.5083 22.1393 23.593 22.0391 23.6045L18.5527 23.999C18.4349 24.0122 18.332 23.9191 18.332 23.8007V6.11324C18.332 6.01204 18.4082 5.92743 18.5088 5.91597L21.8975 5.53219ZM8.35254 1.33101C12.5528 1.33111 16.5088 3.8474 16.5088 9.90523C16.5088 16.3784 12.0884 18.8457 8.15625 18.8457C3.95617 18.8455 0 16.1584 0 10.2959C9.43202e-05 3.87138 4.42045 1.33101 8.35254 1.33101ZM38.9141 5.53219C42.245 5.53219 44.3351 7.17875 44.4541 11.4853C44.4565 11.5689 44.3887 11.6395 44.3047 11.6396H36.5518C36.4679 11.6398 36.4004 11.7102 36.4023 11.7939C36.5116 15.6741 38.0191 16.7451 40.502 16.7451C41.7135 16.745 42.6903 16.4632 43.5078 16.1005C43.5679 16.0738 43.6377 16.0896 43.6807 16.1396L44.0059 16.5214C44.0548 16.579 44.0546 16.6649 44.0029 16.7197C43.1121 17.6594 41.298 18.8457 38.9141 18.8457C34.6647 18.8457 32.54 16.3051 32.54 12.1523C32.5401 7.90199 35.6904 5.53219 38.9141 5.53219ZM71.8682 0.000935719C72.0069 -0.0114562 72.1257 0.100879 72.1191 0.240194C72.0964 0.716622 72.0527 1.87639 72.0527 3.13863V18.2412C72.0527 18.3558 71.9689 18.4538 71.8555 18.4697L68.5049 18.8437C68.3628 18.8638 68.2375 18.75 68.2432 18.6064L68.292 17.2578H68.1943C67.1441 18.1614 65.7768 18.8456 64.0674 18.8457C61.6496 18.8457 59.2804 17.087 59.2803 12.6416C59.2803 7.56051 62.5533 5.53219 66.3633 5.53219C67.0224 5.5322 67.706 5.65511 68.2188 5.80172C68.2188 5.80172 68.1699 4.89765 68.1699 4.01851V0.598592C68.1699 0.495514 68.2491 0.40955 68.3516 0.40035L71.8682 0.000935719ZM80.29 5.53219C83.831 5.53235 86.9325 7.65789 86.9326 12.1035C86.9326 16.7934 83.66 18.8455 80.29 18.8457C76.7489 18.8457 73.6719 16.6956 73.6719 12.2255C73.672 7.53545 76.993 5.53219 80.29 5.53219ZM94.8555 5.53219C98.3966 5.53219 101.498 7.65772 101.498 12.1035C101.498 16.7936 98.2258 18.8457 94.8555 18.8457C91.3146 18.8456 88.2373 16.6956 88.2373 12.2255C88.2375 7.53549 91.5587 5.53222 94.8555 5.53219ZM49.54 5.52828C49.6571 5.51515 49.7585 5.60852 49.7549 5.72652L49.707 7.26656H49.8047C51.0989 6.33849 52.7115 5.53219 54.4941 5.53219C56.5697 5.53235 57.6932 6.6075 57.6934 8.80562V18.3593C57.6931 18.4662 57.6057 18.5527 57.499 18.5527H53.9795C53.8728 18.5527 53.7854 18.4662 53.7852 18.3593V9.75875C53.7852 8.26873 53.2482 7.80466 52.1006 7.80465C51.2456 7.80465 50.3663 7.9998 49.8291 8.12203V18.3593C49.8289 18.4661 49.7423 18.5526 49.6357 18.5527H46.1396C46.033 18.5527 45.9465 18.4662 45.9463 18.3593V6.11324C45.9463 6.01204 46.0226 5.92724 46.123 5.91597L49.54 5.52828ZM110.574 5.53219C111.746 5.53219 112.574 6.1674 112.574 7.36422C112.574 8.53675 111.722 9.29195 110.77 9.29195C109.721 9.29192 109.354 8.85463 108.89 8.09762C108.743 7.82894 108.596 7.78023 108.376 7.78023C107.937 7.78032 107.375 8.09738 107.033 8.415V18.3222C107.033 18.4491 106.93 18.5527 106.803 18.5527H103.38C103.253 18.5527 103.15 18.4491 103.15 18.3222V6.11324C103.15 6.01203 103.226 5.92743 103.326 5.91597L106.703 5.53707C106.842 5.52148 106.963 5.63273 106.959 5.77242L106.911 7.41305H107.009C107.766 6.60703 109.158 5.53219 110.574 5.53219ZM80.2158 6.48531C78.6774 6.48551 77.7744 7.60933 77.7744 11.8105C77.7744 16.818 78.5799 17.8924 80.3623 17.8925C81.8279 17.8925 82.8291 17.0378 82.8291 12.3476C82.8291 7.41346 81.8766 6.48531 80.2158 6.48531ZM94.7822 6.48531C93.2437 6.48537 92.3399 7.60905 92.3398 11.8105C92.3398 16.8181 93.1462 17.8924 94.9287 17.8925C96.3942 17.8925 97.3955 17.0378 97.3955 12.3476C97.3955 7.41346 96.443 6.48531 94.7822 6.48531ZM24.1934 7.65816C23.2165 7.65816 22.6057 7.95117 22.2148 8.09762V16.9892C22.6546 17.5022 23.3141 17.8691 24.1445 17.8691C26.0737 17.8691 27.0996 16.8424 27.0996 12.372C27.0996 8.8791 26.0493 7.65823 24.1934 7.65816ZM8.20605 2.35738C5.83698 2.35738 4.63965 4.01812 4.63965 9.78316C4.63965 15.4746 5.56842 17.8203 8.30371 17.8203C10.7211 17.8201 11.8691 16.1825 11.8691 10.4423C11.8691 4.72668 10.8919 2.35759 8.20605 2.35738ZM66.2656 6.50972C64.5074 6.50972 63.2861 7.80421 63.2861 11.8349C63.2861 15.67 64.2631 16.916 66.1191 16.916C67.1198 16.9159 67.7791 16.5256 68.1699 16.3789V7.53512C67.7548 7.02239 67.1689 6.50989 66.2656 6.50972ZM38.7188 6.4609C37.4732 6.46096 36.4961 7.63335 36.3984 10.7109L40.5752 10.4912C40.5752 7.53568 40.1842 6.4609 38.7188 6.4609Z",
65
+ fill: "currentColor"
66
+ })
67
+ ], -1))
68
+ ], 2));
69
+ }
70
+ }), $e = "_attribution_18rgp_8", ke = "_text_18rgp_17", _e = {
71
+ attribution: $e,
72
+ text: ke
73
+ }, D = (e, t) => {
74
+ const s = e.__vccOpts || e;
75
+ for (const [o, a] of t)
76
+ s[o] = a;
77
+ return s;
78
+ }, Ce = {
79
+ $style: _e
80
+ }, we = /* @__PURE__ */ D(me, [["__cssModules", Ce]]), Ie = ["value", "placeholder", "disabled", "aria-controls", "aria-expanded"], Le = ["disabled", "aria-label"], Ee = ["id", "role", "aria-live"], qe = ["onClick", "onKeydown"], Ae = ["for"], Me = ["id", "value", "disabled"], Se = ["for"], De = ["id", "value", "disabled"], Te = ["for"], xe = ["id", "value", "disabled"], Be = ["for"], Pe = ["id", "value", "disabled"], Fe = ["for"], je = ["id", "value", "disabled"], Ge = ["disabled"], Oe = /* @__PURE__ */ A({
81
+ __name: "AddressEntry",
82
+ props: {
83
+ enableAddressSuggestions: { type: Boolean, default: !0 },
84
+ debounceMs: { default: 300 },
85
+ showAttribution: { type: Boolean, default: !1 },
86
+ disabled: { type: Boolean, default: !1 },
87
+ placeholderText: { default: "Enter your home address" },
88
+ buttonText: { default: "Get cash offer" },
89
+ showButton: { type: Boolean, default: !0 },
90
+ manualEntryText: { default: "Enter address manually instead" },
91
+ appearance: {}
92
+ },
93
+ emits: ["address-select", "ready", "change", "validation-error", "address-suggestions-start", "address-suggestions-complete", "error"],
94
+ setup(e, { emit: t }) {
95
+ let s = 0;
96
+ const o = e, a = t, n = be(), i = `ae-${++s}`, c = I(""), d = I([]), v = I(!1), g = I(!1), p = I(null), h = I(!1), $ = I(!1), T = I(null), q = I(null), G = I(null), S = I({
97
+ street1: "",
98
+ street2: "",
99
+ city: "",
100
+ state: "",
101
+ postalCode: ""
102
+ }), V = k(() => ee(o.appearance)), U = k(
103
+ () => v.value && !g.value && c.value.trim().length >= 3 && d.value.length === 0 && !h.value
104
+ );
105
+ let L = null, b = 0;
106
+ H(c, (f) => {
107
+ if ($.value) return;
108
+ if (a("change", { street1: f }), L && clearTimeout(L), !o.enableAddressSuggestions || f.trim().length < 3) {
109
+ b += 1, d.value = [], v.value = !1, p.value = null, g.value = !1;
110
+ return;
111
+ }
112
+ g.value = !0, p.value = null;
113
+ const _ = f.trim(), C = ++b;
114
+ L = setTimeout(async () => {
115
+ a("address-suggestions-start", _);
116
+ try {
117
+ const R = await n.value.getAddressSuggestions(_);
118
+ if (C !== b) return;
119
+ d.value = R.addresses, v.value = !0, a("address-suggestions-complete", R.addresses);
120
+ } catch (R) {
121
+ if (C !== b) return;
122
+ const W = R instanceof Error ? R : new Error("Failed to fetch address suggestions");
123
+ p.value = W.message, d.value = [], v.value = !0, a("error", W);
124
+ } finally {
125
+ C === b && (g.value = !1);
126
+ }
127
+ }, o.debounceMs);
128
+ });
129
+ function x(f) {
130
+ const _ = [f.street1];
131
+ return f.street2 && (_[0] += ` ${f.street2}`), _.push(`${f.city}, ${f.state} ${f.postalCode}`), _.join(", ");
132
+ }
133
+ async function B(f) {
134
+ $.value = !0, c.value = x(f), d.value = [], v.value = !1, p.value = null, a("change", f);
135
+ try {
136
+ a("address-select", f);
137
+ } catch (_) {
138
+ const C = _ instanceof Error ? _ : new Error("Failed to process address");
139
+ p.value = C.message, a("error", C), c.value = "", $.value = !1;
140
+ }
141
+ }
142
+ function O() {
143
+ h.value = !0, v.value = !1;
144
+ }
145
+ function P(f, _) {
146
+ S.value[f] = _;
147
+ const C = S.value;
148
+ a("change", {
149
+ street1: C.street1,
150
+ ...C.street2 ? { street2: C.street2 } : {},
151
+ city: C.city,
152
+ state: C.state,
153
+ postalCode: C.postalCode
154
+ });
155
+ }
156
+ async function Y() {
157
+ const f = S.value.street1.trim(), _ = S.value.city.trim(), C = S.value.state.trim(), R = S.value.postalCode.trim(), W = S.value.street2.trim();
158
+ if (!f || !_ || !C || !R) {
159
+ const K = "Please fill in all required fields";
160
+ p.value = K, a("validation-error", K);
161
+ return;
162
+ }
163
+ g.value = !0, p.value = null;
164
+ try {
165
+ a("address-select", {
166
+ street1: f,
167
+ street2: W || void 0,
168
+ city: _,
169
+ state: C,
170
+ postalCode: R
171
+ });
172
+ } catch (K) {
173
+ const ae = K instanceof Error ? K : new Error("Failed to submit address");
174
+ p.value = ae.message, a("error", ae);
175
+ } finally {
176
+ g.value = !1;
177
+ }
178
+ }
179
+ function ce() {
180
+ d.value.length > 0 && B(d.value[0]);
181
+ }
182
+ function de() {
183
+ d.value.length > 0 && c.value.length > 0 && (v.value = !0);
184
+ }
185
+ function ve(f) {
186
+ const _ = f.target.value;
187
+ c.value = _, $.value = !1;
188
+ }
189
+ function oe(f) {
190
+ q.value && !q.value.contains(f.target) && G.value && !G.value.contains(f.target) && (v.value = !1);
191
+ }
192
+ return se(() => {
193
+ document.addEventListener("mousedown", oe), a("ready");
194
+ }), Z(() => {
195
+ document.removeEventListener("mousedown", oe), L && clearTimeout(L), b += 1;
196
+ }), (f, _) => (u(), y("div", {
197
+ ref_key: "containerRef",
198
+ ref: T,
199
+ class: r(f.$style.container),
200
+ style: Q(V.value)
201
+ }, [
202
+ h.value ? (u(), y("div", {
203
+ key: 1,
204
+ class: r(f.$style.manualForm)
205
+ }, [
206
+ l("div", {
207
+ class: r(f.$style.manualFormField)
208
+ }, [
209
+ l("label", {
210
+ class: r(f.$style.manualFormLabel),
211
+ for: `${i}-street1`
212
+ }, "Street Address *", 10, Ae),
213
+ l("input", {
214
+ id: `${i}-street1`,
215
+ class: r(f.$style.manualFormInput),
216
+ type: "text",
217
+ value: S.value.street1,
218
+ disabled: e.disabled,
219
+ placeholder: "123 Main St",
220
+ onInput: _[0] || (_[0] = (C) => P("street1", C.target.value))
221
+ }, null, 42, Me)
222
+ ], 2),
223
+ l("div", {
224
+ class: r(f.$style.manualFormField)
225
+ }, [
226
+ l("label", {
227
+ class: r(f.$style.manualFormLabel),
228
+ for: `${i}-street2`
229
+ }, "Unit / Apt (optional)", 10, Se),
230
+ l("input", {
231
+ id: `${i}-street2`,
232
+ class: r(f.$style.manualFormInput),
233
+ type: "text",
234
+ value: S.value.street2,
235
+ disabled: e.disabled,
236
+ placeholder: "Apt 4B",
237
+ onInput: _[1] || (_[1] = (C) => P("street2", C.target.value))
238
+ }, null, 42, De)
239
+ ], 2),
240
+ l("div", {
241
+ class: r(f.$style.manualFormField)
242
+ }, [
243
+ l("label", {
244
+ class: r(f.$style.manualFormLabel),
245
+ for: `${i}-city`
246
+ }, "City *", 10, Te),
247
+ l("input", {
248
+ id: `${i}-city`,
249
+ class: r(f.$style.manualFormInput),
250
+ type: "text",
251
+ value: S.value.city,
252
+ disabled: e.disabled,
253
+ placeholder: "Austin",
254
+ onInput: _[2] || (_[2] = (C) => P("city", C.target.value))
255
+ }, null, 42, xe)
256
+ ], 2),
257
+ l("div", {
258
+ class: r(f.$style.formRow)
259
+ }, [
260
+ l("div", {
261
+ class: r(f.$style.manualFormField)
262
+ }, [
263
+ l("label", {
264
+ class: r(f.$style.manualFormLabel),
265
+ for: `${i}-state`
266
+ }, "State *", 10, Be),
267
+ l("input", {
268
+ id: `${i}-state`,
269
+ class: r(f.$style.manualFormInput),
270
+ type: "text",
271
+ value: S.value.state,
272
+ disabled: e.disabled,
273
+ placeholder: "TX",
274
+ maxlength: "2",
275
+ onInput: _[3] || (_[3] = (C) => P("state", C.target.value))
276
+ }, null, 42, Pe)
277
+ ], 2),
278
+ l("div", {
279
+ class: r(f.$style.manualFormField)
280
+ }, [
281
+ l("label", {
282
+ class: r(f.$style.manualFormLabel),
283
+ for: `${i}-postalCode`
284
+ }, "ZIP Code *", 10, Fe),
285
+ l("input", {
286
+ id: `${i}-postalCode`,
287
+ class: r(f.$style.manualFormInput),
288
+ type: "text",
289
+ value: S.value.postalCode,
290
+ disabled: e.disabled,
291
+ placeholder: "78701",
292
+ maxlength: "5",
293
+ onInput: _[4] || (_[4] = (C) => P("postalCode", C.target.value))
294
+ }, null, 42, je)
295
+ ], 2)
296
+ ], 2),
297
+ p.value ? (u(), y("div", {
298
+ key: 0,
299
+ class: r(f.$style.error),
300
+ role: "alert"
301
+ }, m(p.value), 3)) : w("", !0),
302
+ l("button", {
303
+ class: r(f.$style.submitButton),
304
+ type: "button",
305
+ disabled: e.disabled,
306
+ onClick: Y
307
+ }, [
308
+ l("span", null, m(e.buttonText), 1),
309
+ X(f.$slots, "button-icon", {}, () => [
310
+ _[8] || (_[8] = l("svg", {
311
+ width: "20",
312
+ height: "20",
313
+ viewBox: "0 0 24 24",
314
+ fill: "none",
315
+ xmlns: "http://www.w3.org/2000/svg"
316
+ }, [
317
+ l("path", {
318
+ d: "M5 12h14m-7-7l7 7-7 7",
319
+ stroke: "currentColor",
320
+ "stroke-width": "2",
321
+ "stroke-linecap": "round",
322
+ "stroke-linejoin": "round"
323
+ })
324
+ ], -1))
325
+ ])
326
+ ], 10, Ge)
327
+ ], 2)) : (u(), y("div", {
328
+ key: 0,
329
+ class: r(f.$style.inputSection)
330
+ }, [
331
+ l("div", {
332
+ class: r([f.$style.inputWrapper, p.value ? f.$style.errorBorder : ""])
333
+ }, [
334
+ l("input", {
335
+ ref_key: "inputRef",
336
+ ref: G,
337
+ value: c.value,
338
+ class: r(f.$style.input),
339
+ placeholder: e.placeholderText,
340
+ disabled: e.disabled,
341
+ type: "text",
342
+ autocomplete: "off",
343
+ "aria-label": "Address input",
344
+ "aria-autocomplete": "list",
345
+ "aria-controls": `${i}-suggestions`,
346
+ "aria-expanded": v.value,
347
+ onInput: ve,
348
+ onFocus: de
349
+ }, null, 42, Ie),
350
+ f.$slots["input-icon"] ? (u(), y("div", {
351
+ key: 0,
352
+ class: r(f.$style.inputIcon)
353
+ }, [
354
+ X(f.$slots, "input-icon")
355
+ ], 2)) : w("", !0),
356
+ e.showButton ? (u(), y("button", {
357
+ key: 1,
358
+ class: r(f.$style.button),
359
+ disabled: e.disabled,
360
+ "aria-label": e.buttonText,
361
+ type: "button",
362
+ onClick: ce
363
+ }, [
364
+ g.value ? (u(), y(j, { key: 0 }, [
365
+ l("span", null, m(e.buttonText), 1),
366
+ (u(), y("svg", {
367
+ class: r(f.$style.spinner),
368
+ width: "20",
369
+ height: "20",
370
+ viewBox: "0 0 24 24",
371
+ fill: "none",
372
+ xmlns: "http://www.w3.org/2000/svg"
373
+ }, [..._[5] || (_[5] = [
374
+ l("circle", {
375
+ cx: "12",
376
+ cy: "12",
377
+ r: "10",
378
+ stroke: "currentColor",
379
+ "stroke-width": "4",
380
+ "stroke-opacity": "0.25"
381
+ }, null, -1),
382
+ l("path", {
383
+ d: "M12 2a10 10 0 0 1 10 10",
384
+ stroke: "currentColor",
385
+ "stroke-width": "4",
386
+ "stroke-linecap": "round"
387
+ }, null, -1)
388
+ ])], 2))
389
+ ], 64)) : (u(), y(j, { key: 1 }, [
390
+ l("span", null, m(e.buttonText), 1),
391
+ X(f.$slots, "button-icon", {}, () => [
392
+ _[6] || (_[6] = l("svg", {
393
+ width: "20",
394
+ height: "20",
395
+ viewBox: "0 0 24 24",
396
+ fill: "none",
397
+ xmlns: "http://www.w3.org/2000/svg"
398
+ }, [
399
+ l("path", {
400
+ d: "M5 12h14m-7-7l7 7-7 7",
401
+ stroke: "currentColor",
402
+ "stroke-width": "2",
403
+ "stroke-linecap": "round",
404
+ "stroke-linejoin": "round"
405
+ })
406
+ ], -1))
407
+ ])
408
+ ], 64))
409
+ ], 10, Le)) : w("", !0)
410
+ ], 2),
411
+ v.value || p.value ? (u(), y("div", {
412
+ key: 0,
413
+ ref_key: "suggestionsRef",
414
+ ref: q,
415
+ class: r([f.$style.suggestions, p.value ? f.$style.errorState : ""]),
416
+ id: `${i}-suggestions`,
417
+ role: p.value ? "alert" : "listbox",
418
+ "aria-live": p.value ? "polite" : void 0
419
+ }, [
420
+ p.value ? (u(), y(j, { key: 0 }, [
421
+ l("div", {
422
+ class: r(f.$style.error)
423
+ }, [
424
+ l("div", {
425
+ class: r(f.$style.errorIcon)
426
+ }, [..._[7] || (_[7] = [
427
+ l("svg", {
428
+ width: "20",
429
+ height: "20",
430
+ viewBox: "0 0 24 24",
431
+ fill: "none"
432
+ }, [
433
+ l("circle", {
434
+ cx: "12",
435
+ cy: "12",
436
+ r: "10",
437
+ stroke: "currentColor",
438
+ "stroke-width": "2"
439
+ }),
440
+ l("path", {
441
+ d: "M12 8v4M12 16h.01",
442
+ stroke: "currentColor",
443
+ "stroke-width": "2",
444
+ "stroke-linecap": "round"
445
+ })
446
+ ], -1)
447
+ ])], 2),
448
+ l("div", null, m(p.value), 1)
449
+ ], 2),
450
+ h.value ? w("", !0) : (u(), y("button", {
451
+ key: 0,
452
+ type: "button",
453
+ class: r(f.$style.manualLink),
454
+ onClick: O
455
+ }, m(e.manualEntryText), 3))
456
+ ], 64)) : d.value.length > 0 ? (u(!0), y(j, { key: 1 }, z(d.value, (C, R) => (u(), y("div", {
457
+ key: `${C.street1}-${C.city}-${C.postalCode}-${R}`,
458
+ class: r(f.$style.suggestion),
459
+ role: "option",
460
+ "aria-selected": !1,
461
+ tabindex: "0",
462
+ onClick: (W) => B(C),
463
+ onKeydown: [
464
+ re(le((W) => B(C), ["prevent"]), ["enter"]),
465
+ re(le((W) => B(C), ["prevent"]), ["space"])
466
+ ]
467
+ }, m(x(C)), 43, qe))), 128)) : U.value ? (u(), y("button", {
468
+ key: 2,
469
+ type: "button",
470
+ class: r(f.$style.manualLink),
471
+ onClick: O
472
+ }, m(e.manualEntryText), 3)) : w("", !0)
473
+ ], 10, Ee)) : w("", !0)
474
+ ], 2)),
475
+ e.showAttribution ? (u(), N(we, { key: 2 })) : w("", !0)
476
+ ], 6));
477
+ }
478
+ }), Re = "_container_1r0nf_9", Ne = "_inputSection_1r0nf_17", Ve = "_inputWrapper_1r0nf_23", Ue = "_input_1r0nf_17", He = "_inputIcon_1r0nf_64", We = "_button_1r0nf_81", Ze = "_spinner_1r0nf_122", ze = "_spin_1r0nf_122", Ke = "_suggestions_1r0nf_137", Je = "_errorState_1r0nf_151", Xe = "_suggestion_1r0nf_137", Qe = "_error_1r0nf_151", Ye = "_errorIcon_1r0nf_200", et = "_errorBorder_1r0nf_214", tt = "_manualLink_1r0nf_224", nt = "_manualForm_1r0nf_246", rt = "_slideIn_1r0nf_1", st = "_manualFormField_1r0nf_261", ot = "_manualFormLabel_1r0nf_265", at = "_manualFormInput_1r0nf_274", lt = "_formRow_1r0nf_295", it = "_submitButton_1r0nf_303", ut = {
479
+ container: Re,
480
+ inputSection: Ne,
481
+ inputWrapper: Ve,
482
+ input: Ue,
483
+ inputIcon: He,
484
+ button: We,
485
+ spinner: Ze,
486
+ spin: ze,
487
+ suggestions: Ke,
488
+ errorState: Je,
489
+ suggestion: Xe,
490
+ error: Qe,
491
+ errorIcon: Ye,
492
+ errorBorder: et,
493
+ manualLink: tt,
494
+ manualForm: nt,
495
+ slideIn: rt,
496
+ manualFormField: st,
497
+ manualFormLabel: ot,
498
+ manualFormInput: at,
499
+ formRow: lt,
500
+ submitButton: it
501
+ }, ct = {
502
+ $style: ut
503
+ }, vo = /* @__PURE__ */ D(Oe, [["__cssModules", ct]]), dt = "https://api.mapbox.com/geocoding/v5/mapbox.places", vt = "https://api.mapbox.com/styles/v1/mapbox/light-v11/static", pt = "pk.eyJ1Ijoib3BlbmRvb3IiLCJhIjoiWXJ2bTJiRSJ9.lsnjT9yTNyyVzKRIzqxnqg", yt = "https://imgdrop.imgix.net/2026-02-1771546296495-06570.png?w=300";
504
+ function gt(e, t, s) {
505
+ return e.startsWith("http://") || e.startsWith("https://") ? `url-${encodeURIComponent(e)}(${t},${s})` : `${e}(${t},${s})`;
506
+ }
507
+ function ft(e, t) {
508
+ const s = (t == null ? void 0 : t.mapboxAccessToken) ?? pt, o = (t == null ? void 0 : t.mapPinMarker) ?? yt, a = (t == null ? void 0 : t.width) ?? 640, n = (t == null ? void 0 : t.height) ?? 320, i = (t == null ? void 0 : t.zoom) ?? 14, c = I(void 0), d = I("loading");
509
+ let v = null;
510
+ return H(
511
+ () => [
512
+ e.value.street1,
513
+ e.value.city,
514
+ e.value.state,
515
+ e.value.postalCode
516
+ ],
517
+ async () => {
518
+ var $, T;
519
+ v && v.abort();
520
+ const g = new AbortController();
521
+ v = g, d.value = "loading";
522
+ const p = e.value, h = [
523
+ p.street1,
524
+ p.city,
525
+ p.state,
526
+ p.postalCode
527
+ ].join(" ");
528
+ try {
529
+ const q = `${dt}/${encodeURIComponent(h)}.json?access_token=${s}&limit=1`, G = await fetch(q, { signal: g.signal });
530
+ if (!G.ok) {
531
+ g.signal.aborted || (d.value = "error");
532
+ return;
533
+ }
534
+ const S = await G.json();
535
+ if (g.signal.aborted) return;
536
+ const V = (T = ($ = S.features) == null ? void 0 : $[0]) == null ? void 0 : T.center;
537
+ if (!V) {
538
+ d.value = "error";
539
+ return;
540
+ }
541
+ const [U, L] = V, b = gt(o, U, L);
542
+ c.value = `${vt}/${b}/${U},${L},${i}/${a}x${n}@2x?access_token=${s}&attribution=false&logo=false`, d.value = "loaded";
543
+ } catch (q) {
544
+ if (q instanceof DOMException && q.name === "AbortError") return;
545
+ g.signal.aborted || (d.value = "error");
546
+ }
547
+ },
548
+ { immediate: !0 }
549
+ ), Z(() => {
550
+ v && v.abort();
551
+ }), { url: c, status: d };
552
+ }
553
+ const ht = ["src"], bt = /* @__PURE__ */ A({
554
+ __name: "AddressMap",
555
+ props: {
556
+ address: {},
557
+ appearance: {},
558
+ mapboxAccessToken: {},
559
+ mapPinMarker: {},
560
+ width: { default: 640 },
561
+ height: { default: 320 },
562
+ zoom: { default: 14 },
563
+ borderRadius: {}
564
+ },
565
+ emits: ["load", "error"],
566
+ setup(e, { emit: t }) {
567
+ const s = e, o = t, a = k(() => {
568
+ const v = ee(s.appearance);
569
+ return s.borderRadius && (v["border-radius"] = s.borderRadius), v;
570
+ }), { url: n, status: i } = ft(
571
+ k(() => s.address),
572
+ {
573
+ mapboxAccessToken: s.mapboxAccessToken,
574
+ mapPinMarker: s.mapPinMarker,
575
+ width: s.width,
576
+ height: s.height,
577
+ zoom: s.zoom
578
+ }
579
+ ), c = I(!1);
580
+ H(i, (v) => {
581
+ v === "loading" && (c.value = !1), v === "error" && o("error", new Error("Failed to load map for address"));
582
+ });
583
+ function d() {
584
+ c.value = !0, o("load");
585
+ }
586
+ return (v, g) => (u(), y("div", {
587
+ class: r(v.$style.container),
588
+ style: Q(a.value)
589
+ }, [
590
+ E(n) ? (u(), y("img", {
591
+ key: 0,
592
+ src: E(n),
593
+ alt: "Map",
594
+ class: r([v.$style.mapImage, c.value ? v.$style.mapImageLoaded : ""]),
595
+ onLoad: d
596
+ }, null, 42, ht)) : w("", !0)
597
+ ], 6));
598
+ }
599
+ }), mt = "_container_iumdj_4", $t = "_mapImage_iumdj_14", kt = "_mapImageLoaded_iumdj_23", _t = {
600
+ container: mt,
601
+ mapImage: $t,
602
+ mapImageLoaded: kt
603
+ }, Ct = {
604
+ $style: _t
605
+ }, po = /* @__PURE__ */ D(bt, [["__cssModules", Ct]]), wt = ["disabled", "aria-invalid", "aria-describedby"], It = ["checked"], Lt = /* @__PURE__ */ A({
606
+ __name: "AddressUnitConfirmation",
607
+ props: {
608
+ address: {},
609
+ appearance: {}
610
+ },
611
+ emits: ["confirm", "edit", "ready", "error"],
612
+ setup(e, { emit: t }) {
613
+ const s = e, o = t, a = I(""), n = I(!1), i = I(null), c = k(() => ee(s.appearance)), d = k(() => {
614
+ const h = s.address;
615
+ return `${h.street1 + (h.street2 ? ` ${h.street2}` : "")}, ${h.city}, ${h.state} ${h.postalCode}`;
616
+ });
617
+ function v() {
618
+ if (!n.value && !a.value.trim()) {
619
+ const h = "Please enter a unit number or select 'No unit number'";
620
+ i.value = h, o("error", new Error(h));
621
+ return;
622
+ }
623
+ if (i.value = null, n.value) {
624
+ const { street2: h, ...$ } = s.address;
625
+ o("confirm", $);
626
+ } else
627
+ o("confirm", { ...s.address, street2: a.value.trim() });
628
+ }
629
+ function g() {
630
+ n.value = !n.value, n.value && (a.value = "", i.value = null);
631
+ }
632
+ function p() {
633
+ i.value && (i.value = null);
634
+ }
635
+ return se(() => {
636
+ o("ready");
637
+ }), (h, $) => (u(), y("div", {
638
+ class: r(h.$style.container),
639
+ style: Q(c.value)
640
+ }, [
641
+ l("h2", {
642
+ class: r(h.$style.title)
643
+ }, "Confirm your home address", 2),
644
+ l("div", {
645
+ class: r(h.$style.addressCard)
646
+ }, [
647
+ l("span", {
648
+ class: r(h.$style.addressText)
649
+ }, m(d.value), 3),
650
+ l("button", {
651
+ class: r(h.$style.editLink),
652
+ type: "button",
653
+ onClick: $[0] || ($[0] = (T) => o("edit"))
654
+ }, " Edit ", 2)
655
+ ], 2),
656
+ l("div", {
657
+ class: r(h.$style.fieldGroup)
658
+ }, [
659
+ l("label", {
660
+ class: r(h.$style.fieldLabel),
661
+ for: "od-unit-number"
662
+ }, " Unit number, apt, or floor* ", 2),
663
+ pe(l("input", {
664
+ id: "od-unit-number",
665
+ "onUpdate:modelValue": $[1] || ($[1] = (T) => a.value = T),
666
+ class: r(h.$style.input),
667
+ type: "text",
668
+ placeholder: "#1234",
669
+ disabled: n.value,
670
+ "aria-invalid": i.value ? !0 : void 0,
671
+ "aria-describedby": i.value ? "od-unit-error" : void 0,
672
+ onInput: p,
673
+ onKeydown: re(v, ["enter"])
674
+ }, null, 42, wt), [
675
+ [ye, a.value]
676
+ ])
677
+ ], 2),
678
+ l("label", {
679
+ class: r(h.$style.checkboxRow)
680
+ }, [
681
+ l("input", {
682
+ type: "checkbox",
683
+ class: r(h.$style.checkbox),
684
+ checked: n.value,
685
+ onChange: g
686
+ }, null, 42, It),
687
+ l("span", {
688
+ class: r(h.$style.checkboxLabel)
689
+ }, "No unit number", 2)
690
+ ], 2),
691
+ i.value ? (u(), y("p", {
692
+ key: 0,
693
+ id: "od-unit-error",
694
+ class: r(h.$style.error),
695
+ role: "alert"
696
+ }, m(i.value), 3)) : w("", !0),
697
+ l("div", {
698
+ class: r(h.$style.actions)
699
+ }, [
700
+ l("button", {
701
+ class: r(h.$style.confirmButton),
702
+ type: "button",
703
+ onClick: v
704
+ }, " Confirm address ", 2)
705
+ ], 2)
706
+ ], 6));
707
+ }
708
+ }), Et = "_container_1hik1_4", qt = "_title_1hik1_8", At = "_addressCard_1hik1_17", Mt = "_addressText_1hik1_27", St = "_editLink_1hik1_35", Dt = "_fieldGroup_1hik1_48", Tt = "_fieldLabel_1hik1_52", xt = "_input_1hik1_61", Bt = "_checkboxRow_1hik1_85", Pt = "_checkbox_1hik1_85", Ft = "_checkboxLabel_1hik1_102", jt = "_error_1hik1_109", Gt = "_actions_1hik1_116", Ot = "_confirmButton_1hik1_121", Rt = {
709
+ container: Et,
710
+ title: qt,
711
+ addressCard: At,
712
+ addressText: Mt,
713
+ editLink: St,
714
+ fieldGroup: Dt,
715
+ fieldLabel: Tt,
716
+ input: xt,
717
+ checkboxRow: Bt,
718
+ checkbox: Pt,
719
+ checkboxLabel: Ft,
720
+ error: jt,
721
+ actions: Gt,
722
+ confirmButton: Ot
723
+ }, Nt = {
724
+ $style: Rt
725
+ }, yo = /* @__PURE__ */ D(Lt, [["__cssModules", Nt]]);
726
+ function ue(e, t, s, o, a, n) {
727
+ const i = [
728
+ e.on("answerChange", (c) => {
729
+ var d;
730
+ t.value = e.answers, a.value = [...e.visiblePages], c.type === "answerChange" && ((d = n.onAnswerChange) == null || d.call(n, c.key, c.value));
731
+ }),
732
+ e.on("pageChange", (c) => {
733
+ var d;
734
+ c.type === "pageChange" && (s.value = c.pageId, a.value = [...e.visiblePages], o.value = {}, (d = n.onPageChange) == null || d.call(n, c.pageIndex, c.pageId));
735
+ }),
736
+ e.on("validationError", (c) => {
737
+ c.type === "validationError" && (o.value = c.errors);
738
+ }),
739
+ e.on("submit", (c) => {
740
+ c.type === "submit" && n.onSubmit(c.answers);
741
+ })
742
+ ];
743
+ return () => i.forEach((c) => c());
744
+ }
745
+ function Vt(e) {
746
+ var V, U;
747
+ let t = ie({
748
+ market: e.getMarket(),
749
+ initialAnswers: e.getInitialAnswers()
750
+ });
751
+ const s = I(t.answers), o = I(((V = t.currentPage) == null ? void 0 : V.id) ?? ""), a = I({}), n = I(t.visiblePages);
752
+ let i = ue(
753
+ t,
754
+ s,
755
+ o,
756
+ a,
757
+ n,
758
+ e
759
+ );
760
+ (U = e.onReady) == null || U.call(e), H(e.getMarket, (L) => {
761
+ var b;
762
+ i(), t.destroy(), t = ie({
763
+ market: L,
764
+ initialAnswers: e.getInitialAnswers()
765
+ }), s.value = t.answers, o.value = ((b = t.currentPage) == null ? void 0 : b.id) ?? "", a.value = {}, n.value = t.visiblePages, i = ue(
766
+ t,
767
+ s,
768
+ o,
769
+ a,
770
+ n,
771
+ e
772
+ );
773
+ });
774
+ let c = e.getInitialAnswers();
775
+ H(e.getInitialAnswers, (L) => {
776
+ L && L !== c && (c = L, t.setAnswers(L));
777
+ });
778
+ const d = k(() => {
779
+ const L = n.value.findIndex(
780
+ (b) => b.id === o.value
781
+ );
782
+ return L >= 0 ? L : 0;
783
+ }), v = k(
784
+ () => n.value[d.value]
785
+ ), g = k(() => o.value ? (s.value, t.getVisibleQuestionsForCurrentPage()) : []), p = k(() => n.value.length <= 1 ? 0 : Math.min(
786
+ 1,
787
+ Math.max(0, d.value / (n.value.length - 1))
788
+ )), h = k(() => d.value === 0), $ = k(
789
+ () => n.value.length > 0 && d.value === n.value.length - 1
790
+ );
791
+ function T(L, b) {
792
+ t.setAnswer(L, b);
793
+ }
794
+ function q(L) {
795
+ return s.value[L];
796
+ }
797
+ function G() {
798
+ var b;
799
+ const L = t.goToNext();
800
+ if (!L.valid)
801
+ try {
802
+ (b = e.onError) == null || b.call(
803
+ e,
804
+ new Error(
805
+ `Validation failed: ${Object.values(L.errors).join(", ")}`
806
+ )
807
+ );
808
+ } catch (x) {
809
+ console.error("[DtcOnboardingFlow] onError callback threw:", x);
810
+ }
811
+ }
812
+ function S() {
813
+ t.goToPrev();
814
+ }
815
+ return Z(() => {
816
+ i(), t.destroy();
817
+ }), {
818
+ engine: t,
819
+ currentPage: v,
820
+ currentPageIndex: d,
821
+ visiblePages: n,
822
+ visibleQuestions: g,
823
+ answers: s,
824
+ validationErrors: a,
825
+ progress: p,
826
+ isFirstPage: h,
827
+ isLastPage: $,
828
+ setAnswer: T,
829
+ getAnswer: q,
830
+ goToNext: G,
831
+ goToPrev: S
832
+ };
833
+ }
834
+ const Ut = /* @__PURE__ */ A({
835
+ __name: "DtcProvider",
836
+ props: {
837
+ market: {},
838
+ initialAnswers: {},
839
+ onSubmit: { type: Function },
840
+ onPageChange: { type: Function },
841
+ onAnswerChange: { type: Function },
842
+ onReady: { type: Function },
843
+ onError: { type: Function }
844
+ },
845
+ setup(e) {
846
+ const t = e, s = Vt({
847
+ getMarket: () => t.market,
848
+ getInitialAnswers: () => t.initialAnswers,
849
+ onSubmit: (o) => t.onSubmit(o),
850
+ onPageChange: (o, a) => {
851
+ var n;
852
+ return (n = t.onPageChange) == null ? void 0 : n.call(t, o, a);
853
+ },
854
+ onAnswerChange: (o, a) => {
855
+ var n;
856
+ return (n = t.onAnswerChange) == null ? void 0 : n.call(t, o, a);
857
+ },
858
+ onReady: () => {
859
+ var o;
860
+ return (o = t.onReady) == null ? void 0 : o.call(t);
861
+ },
862
+ onError: (o) => {
863
+ var a;
864
+ return (a = t.onError) == null ? void 0 : a.call(t, o);
865
+ }
866
+ });
867
+ return ne("dtc-onboarding", s), (o, a) => X(o.$slots, "default");
868
+ }
869
+ }), Ht = ["src"], Wt = /* @__PURE__ */ A({
870
+ __name: "DtcHeader",
871
+ props: {
872
+ partnerLogoUrl: {},
873
+ showCloseButton: { type: Boolean }
874
+ },
875
+ emits: ["close"],
876
+ setup(e, { emit: t }) {
877
+ const s = t;
878
+ return (o, a) => (u(), y("header", {
879
+ class: r(o.$style.header)
880
+ }, [
881
+ l("div", {
882
+ class: r(o.$style.headerLogos)
883
+ }, [
884
+ e.partnerLogoUrl ? (u(), y("img", {
885
+ key: 0,
886
+ src: e.partnerLogoUrl,
887
+ alt: "Partner",
888
+ class: r(o.$style.headerPartnerLogo)
889
+ }, null, 10, Ht)) : w("", !0),
890
+ l("span", {
891
+ class: r(o.$style.headerOpendoorText)
892
+ }, "Opendoor", 2)
893
+ ], 2),
894
+ e.showCloseButton ? (u(), y("button", {
895
+ key: 0,
896
+ type: "button",
897
+ class: r(o.$style.headerCloseButton),
898
+ "aria-label": "Close",
899
+ onClick: a[0] || (a[0] = (n) => s("close"))
900
+ }, [...a[1] || (a[1] = [
901
+ l("svg", {
902
+ width: "24",
903
+ height: "24",
904
+ viewBox: "0 0 24 24",
905
+ fill: "none",
906
+ stroke: "currentColor",
907
+ "stroke-width": "2",
908
+ "stroke-linecap": "round",
909
+ "stroke-linejoin": "round"
910
+ }, [
911
+ l("line", {
912
+ x1: "18",
913
+ y1: "6",
914
+ x2: "6",
915
+ y2: "18"
916
+ }),
917
+ l("line", {
918
+ x1: "6",
919
+ y1: "6",
920
+ x2: "18",
921
+ y2: "18"
922
+ })
923
+ ], -1)
924
+ ])], 2)) : w("", !0)
925
+ ], 2));
926
+ }
927
+ }), Zt = "_header_1ccx4_2", zt = "_headerLogos_1ccx4_12", Kt = "_headerPartnerLogo_1ccx4_18", Jt = "_headerOpendoorText_1ccx4_24", Xt = "_headerCloseButton_1ccx4_30", Qt = {
928
+ header: Zt,
929
+ headerLogos: zt,
930
+ headerPartnerLogo: Kt,
931
+ headerOpendoorText: Jt,
932
+ headerCloseButton: Xt
933
+ }, Yt = {
934
+ $style: Qt
935
+ }, en = /* @__PURE__ */ D(Wt, [["__cssModules", Yt]]), tn = ["aria-label"], nn = ["aria-checked", "tabindex", "onClick", "onKeydown"], rn = /* @__PURE__ */ A({
936
+ __name: "RadioCardInput",
937
+ props: {
938
+ question: {}
939
+ },
940
+ setup(e) {
941
+ const t = F("dtc-onboarding");
942
+ let s = null;
943
+ Z(() => {
944
+ s && clearTimeout(s);
945
+ });
946
+ function o(n, i) {
947
+ t.setAnswer(n.key, i), n.autoAdvance && (s && clearTimeout(s), s = setTimeout(() => t.goToNext(), 150));
948
+ }
949
+ function a(n, i, c) {
950
+ var g, p;
951
+ const d = c.options;
952
+ if (!d) return;
953
+ let v = null;
954
+ if (n.key === "ArrowDown" || n.key === "ArrowRight" ? (n.preventDefault(), v = (i + 1) % d.length) : (n.key === "ArrowUp" || n.key === "ArrowLeft") && (n.preventDefault(), v = (i - 1 + d.length) % d.length), v !== null) {
955
+ const h = (g = n.currentTarget.closest('[role="radiogroup"]')) == null ? void 0 : g.querySelectorAll('[role="radio"]');
956
+ (p = h == null ? void 0 : h[v]) == null || p.focus(), o(c, d[v].value);
957
+ }
958
+ }
959
+ return (n, i) => (u(), y("div", {
960
+ class: r(n.$style.radioCardGroup),
961
+ role: "radiogroup",
962
+ "aria-label": e.question.label
963
+ }, [
964
+ (u(!0), y(j, null, z(e.question.options, (c, d) => (u(), y("button", {
965
+ key: String(c.value),
966
+ type: "button",
967
+ role: "radio",
968
+ "aria-checked": E(t).getAnswer(e.question.key) === c.value,
969
+ tabindex: E(t).getAnswer(e.question.key) === c.value || d === 0 && E(t).getAnswer(e.question.key) === void 0 ? 0 : -1,
970
+ class: r([
971
+ n.$style.radioCard,
972
+ E(t).getAnswer(e.question.key) === c.value ? n.$style.radioCardSelected : ""
973
+ ]),
974
+ onClick: (v) => o(e.question, c.value),
975
+ onKeydown: (v) => a(v, d, e.question)
976
+ }, [
977
+ l("span", {
978
+ class: r(n.$style.radioCardLabel)
979
+ }, m(c.label), 3),
980
+ c.description ? (u(), y("span", {
981
+ key: 0,
982
+ class: r(n.$style.radioCardDescription)
983
+ }, m(c.description), 3)) : w("", !0)
984
+ ], 42, nn))), 128)),
985
+ E(t).validationErrors.value[e.question.key] ? (u(), y("p", {
986
+ key: 0,
987
+ class: r(n.$style.fieldError),
988
+ role: "alert"
989
+ }, m(E(t).validationErrors.value[e.question.key]), 3)) : w("", !0)
990
+ ], 10, tn));
991
+ }
992
+ }), sn = "_radioCardGroup_11rwj_2", on = "_radioCard_11rwj_2", an = "_radioCardSelected_11rwj_34", ln = "_radioCardLabel_11rwj_39", un = "_radioCardDescription_11rwj_45", cn = "_fieldError_11rwj_50", dn = {
993
+ radioCardGroup: sn,
994
+ radioCard: on,
995
+ radioCardSelected: an,
996
+ radioCardLabel: ln,
997
+ radioCardDescription: un,
998
+ fieldError: cn
999
+ }, vn = {
1000
+ $style: dn
1001
+ }, pn = /* @__PURE__ */ D(rn, [["__cssModules", vn]]), yn = "https://images.opendoor.com/source/s3/imgdrop-production", gn = "service=reception-fe&dpr=2&fit=scale-down";
1002
+ function M(e, t = "3:2-sm") {
1003
+ return `${yn}/${e}?${gn}&preset=${t}`;
1004
+ }
1005
+ const fn = {
1006
+ // Kitchen
1007
+ "kitchen-fixer_upper": M("2023-04-1681772974083-61414.png"),
1008
+ "kitchen-dated": M("2023-04-1681772974089-39460.png"),
1009
+ "kitchen-standard": M("2023-04-1681772974093-51260.png"),
1010
+ "kitchen-high_end": M("2023-04-1682444345875-57331.jpeg", "3:2-xl"),
1011
+ "kitchen-luxury": M("2023-04-1682444629335-69661.jpeg", "3:2-xl"),
1012
+ // Bathroom
1013
+ "bathroom-fixer_upper": M("2023-04-1682103091299-33543.jpeg"),
1014
+ "bathroom-dated": M("2023-04-1681773104207-98555.png"),
1015
+ "bathroom-standard": M("2023-04-1682103088251-79730.jpeg", "3:2-xl"),
1016
+ "bathroom-high_end": M("2023-04-1681773104214-77488.png"),
1017
+ "bathroom-luxury": M("2023-04-1681773104217-27390.png"),
1018
+ // Living Room
1019
+ "living-room-fixer_upper": M("2023-04-1681773170815-60328.png"),
1020
+ "living-room-dated": M("2023-04-1681773170823-03451.png"),
1021
+ "living-room-standard": M("2023-04-1681773170826-47471.png"),
1022
+ "living-room-high_end": M("2023-04-1681773170828-76415.png"),
1023
+ "living-room-luxury": M("2023-04-1681773170832-20699.png"),
1024
+ // Exterior
1025
+ "exterior-fixer_upper": M("2023-04-1681773220493-46489.png"),
1026
+ "exterior-dated": M("2023-04-1681773220495-22229.png"),
1027
+ "exterior-standard": M("2023-04-1681773220498-64940.png"),
1028
+ "exterior-high_end": M("2023-04-1682103085417-24272.jpeg", "3:2-md"),
1029
+ "exterior-luxury": M("2023-04-1681773220487-59852.png")
1030
+ }, hn = ["aria-label"], bn = ["aria-checked", "onClick"], mn = ["src", "alt"], $n = /* @__PURE__ */ A({
1031
+ __name: "ImageCardInput",
1032
+ props: {
1033
+ question: {}
1034
+ },
1035
+ setup(e) {
1036
+ const t = F("dtc-onboarding");
1037
+ let s = null;
1038
+ Z(() => {
1039
+ s && clearTimeout(s);
1040
+ });
1041
+ function o(n, i) {
1042
+ t.setAnswer(n.key, i), n.autoAdvance && (s && clearTimeout(s), s = setTimeout(() => t.goToNext(), 300));
1043
+ }
1044
+ function a(n) {
1045
+ return n ? fn[n] : void 0;
1046
+ }
1047
+ return (n, i) => (u(), y("div", {
1048
+ class: r(n.$style.imageCardGroup),
1049
+ role: "radiogroup",
1050
+ "aria-label": e.question.label
1051
+ }, [
1052
+ (u(!0), y(j, null, z(e.question.options, (c) => (u(), y("button", {
1053
+ key: String(c.value),
1054
+ type: "button",
1055
+ role: "radio",
1056
+ "aria-checked": E(t).getAnswer(e.question.key) === c.value,
1057
+ class: r([
1058
+ n.$style.imageCard,
1059
+ E(t).getAnswer(e.question.key) === c.value ? n.$style.imageCardSelected : ""
1060
+ ]),
1061
+ onClick: (d) => o(e.question, c.value)
1062
+ }, [
1063
+ a(c.imageId) ? (u(), y("img", {
1064
+ key: 0,
1065
+ src: a(c.imageId),
1066
+ alt: c.label,
1067
+ class: r(n.$style.imageCardPhoto),
1068
+ loading: "lazy"
1069
+ }, null, 10, mn)) : w("", !0),
1070
+ l("span", {
1071
+ class: r(n.$style.imageCardLabel)
1072
+ }, m(c.label), 3),
1073
+ c.description ? (u(), y("span", {
1074
+ key: 1,
1075
+ class: r(n.$style.imageCardDescription)
1076
+ }, m(c.description), 3)) : w("", !0)
1077
+ ], 10, bn))), 128)),
1078
+ E(t).validationErrors.value[e.question.key] ? (u(), y("p", {
1079
+ key: 0,
1080
+ class: r(n.$style.fieldError),
1081
+ role: "alert"
1082
+ }, m(E(t).validationErrors.value[e.question.key]), 3)) : w("", !0)
1083
+ ], 10, hn));
1084
+ }
1085
+ }), kn = "_imageCardGroup_1vc6c_2", _n = "_imageCard_1vc6c_2", Cn = "_imageCardSelected_1vc6c_34", wn = "_imageCardPhoto_1vc6c_39", In = "_imageCardLabel_1vc6c_46", Ln = "_imageCardDescription_1vc6c_53", En = "_fieldError_1vc6c_60", qn = {
1086
+ imageCardGroup: kn,
1087
+ imageCard: _n,
1088
+ imageCardSelected: Cn,
1089
+ imageCardPhoto: wn,
1090
+ imageCardLabel: In,
1091
+ imageCardDescription: Ln,
1092
+ fieldError: En
1093
+ }, An = {
1094
+ $style: qn
1095
+ }, Mn = /* @__PURE__ */ D($n, [["__cssModules", An]]), Sn = ["aria-label"], Dn = ["aria-checked", "onClick"], Tn = {
1096
+ key: 0,
1097
+ width: "12",
1098
+ height: "12",
1099
+ viewBox: "0 0 12 12",
1100
+ fill: "none"
1101
+ }, xn = /* @__PURE__ */ A({
1102
+ __name: "CheckboxCardInput",
1103
+ props: {
1104
+ question: {}
1105
+ },
1106
+ setup(e) {
1107
+ const t = e, s = F("dtc-onboarding"), o = k(
1108
+ () => s.getAnswer(t.question.key) ?? []
1109
+ ), a = k(
1110
+ () => s.validationErrors.value[t.question.key]
1111
+ );
1112
+ function n(i) {
1113
+ var v;
1114
+ const c = (v = t.question.options) == null ? void 0 : v.find((g) => g.value === i);
1115
+ if (c != null && c.exclusive) {
1116
+ s.setAnswer(t.question.key, [i]);
1117
+ return;
1118
+ }
1119
+ const d = o.value.filter(
1120
+ (g) => {
1121
+ var p, h;
1122
+ return !((h = (p = t.question.options) == null ? void 0 : p.find(($) => $.value === g)) != null && h.exclusive);
1123
+ }
1124
+ );
1125
+ if (d.includes(i)) {
1126
+ const g = d.filter((p) => p !== i);
1127
+ s.setAnswer(t.question.key, g.length > 0 ? g : void 0);
1128
+ } else
1129
+ s.setAnswer(t.question.key, [...d, i]);
1130
+ }
1131
+ return (i, c) => (u(), y("div", {
1132
+ class: r(i.$style.checkboxCardGroup),
1133
+ role: "group",
1134
+ "aria-label": e.question.label
1135
+ }, [
1136
+ (u(!0), y(j, null, z(e.question.options, (d) => (u(), y("button", {
1137
+ key: String(d.value),
1138
+ type: "button",
1139
+ role: "checkbox",
1140
+ "aria-checked": o.value.includes(String(d.value)),
1141
+ class: r([
1142
+ i.$style.checkboxCard,
1143
+ o.value.includes(String(d.value)) ? i.$style.checkboxCardSelected : ""
1144
+ ]),
1145
+ onClick: (v) => n(String(d.value))
1146
+ }, [
1147
+ l("span", {
1148
+ class: r(i.$style.checkboxCardContent)
1149
+ }, [
1150
+ l("span", {
1151
+ class: r(i.$style.checkboxCardLabel)
1152
+ }, m(d.label), 3),
1153
+ d.helperText ? (u(), y("span", {
1154
+ key: 0,
1155
+ class: r(i.$style.checkboxCardHelper)
1156
+ }, m(d.helperText), 3)) : w("", !0)
1157
+ ], 2),
1158
+ l("span", {
1159
+ class: r([
1160
+ i.$style.checkboxIndicator,
1161
+ o.value.includes(String(d.value)) ? i.$style.checkboxIndicatorChecked : ""
1162
+ ])
1163
+ }, [
1164
+ o.value.includes(String(d.value)) ? (u(), y("svg", Tn, [...c[0] || (c[0] = [
1165
+ l("path", {
1166
+ d: "M2 6l3 3 5-5",
1167
+ stroke: "currentColor",
1168
+ "stroke-width": "2",
1169
+ "stroke-linecap": "round",
1170
+ "stroke-linejoin": "round"
1171
+ }, null, -1)
1172
+ ])])) : w("", !0)
1173
+ ], 2)
1174
+ ], 10, Dn))), 128)),
1175
+ a.value ? (u(), y("p", {
1176
+ key: 0,
1177
+ class: r(i.$style.fieldError),
1178
+ role: "alert"
1179
+ }, m(a.value), 3)) : w("", !0)
1180
+ ], 10, Sn));
1181
+ }
1182
+ }), Bn = "_checkboxCardGroup_uqwpe_2", Pn = "_checkboxCard_uqwpe_2", Fn = "_checkboxCardSelected_uqwpe_34", jn = "_checkboxCardContent_uqwpe_39", Gn = "_checkboxCardLabel_uqwpe_46", On = "_checkboxCardHelper_uqwpe_52", Rn = "_checkboxIndicator_uqwpe_57", Nn = "_checkboxIndicatorChecked_uqwpe_69", Vn = "_fieldError_uqwpe_75", Un = {
1183
+ checkboxCardGroup: Bn,
1184
+ checkboxCard: Pn,
1185
+ checkboxCardSelected: Fn,
1186
+ checkboxCardContent: jn,
1187
+ checkboxCardLabel: Gn,
1188
+ checkboxCardHelper: On,
1189
+ checkboxIndicator: Rn,
1190
+ checkboxIndicatorChecked: Nn,
1191
+ fieldError: Vn
1192
+ }, Hn = {
1193
+ $style: Un
1194
+ }, Wn = /* @__PURE__ */ D(xn, [["__cssModules", Hn]]), Zn = ["for"], zn = ["id", "value", "aria-invalid", "aria-describedby"], Kn = { value: "" }, Jn = ["value"], Xn = ["id"], Qn = /* @__PURE__ */ A({
1195
+ __name: "DropdownInput",
1196
+ props: {
1197
+ question: {}
1198
+ },
1199
+ setup(e) {
1200
+ let t = 0;
1201
+ const s = e, o = F("dtc-onboarding"), a = `dd-${++t}`, n = k(() => o.getAnswer(s.question.key)), i = k(
1202
+ () => o.validationErrors.value[s.question.key]
1203
+ );
1204
+ function c(d) {
1205
+ const v = d.target.value;
1206
+ s.question.type === "number" && v !== "" ? o.setAnswer(s.question.key, Number(v)) : o.setAnswer(s.question.key, v || void 0);
1207
+ }
1208
+ return (d, v) => (u(), y("div", {
1209
+ class: r(d.$style.fieldGroup)
1210
+ }, [
1211
+ l("label", {
1212
+ class: r(d.$style.fieldLabel),
1213
+ for: `${a}-${e.question.key}`
1214
+ }, m(e.question.label), 11, Zn),
1215
+ e.question.description ? (u(), y("p", {
1216
+ key: 0,
1217
+ class: r(d.$style.fieldDescription)
1218
+ }, m(e.question.description), 3)) : w("", !0),
1219
+ l("select", {
1220
+ id: `${a}-${e.question.key}`,
1221
+ class: r([d.$style.fieldSelect, i.value ? d.$style.fieldSelectError : ""]),
1222
+ value: n.value !== void 0 ? String(n.value) : "",
1223
+ "aria-invalid": i.value ? "true" : void 0,
1224
+ "aria-describedby": i.value ? `${a}-${e.question.key}-error` : void 0,
1225
+ onChange: c
1226
+ }, [
1227
+ l("option", Kn, m(e.question.placeholder || "Select..."), 1),
1228
+ (u(!0), y(j, null, z(e.question.options, (g) => (u(), y("option", {
1229
+ key: String(g.value),
1230
+ value: String(g.value)
1231
+ }, m(g.label), 9, Jn))), 128))
1232
+ ], 42, zn),
1233
+ i.value ? (u(), y("p", {
1234
+ key: 1,
1235
+ id: `${a}-${e.question.key}-error`,
1236
+ class: r(d.$style.fieldError),
1237
+ role: "alert"
1238
+ }, m(i.value), 11, Xn)) : w("", !0)
1239
+ ], 2));
1240
+ }
1241
+ }), Yn = "_fieldGroup_qcbne_2", er = "_fieldLabel_qcbne_8", tr = "_fieldDescription_qcbne_15", nr = "_fieldSelect_qcbne_22", rr = "_fieldSelectError_qcbne_47", sr = "_fieldError_qcbne_51", or = {
1242
+ fieldGroup: Yn,
1243
+ fieldLabel: er,
1244
+ fieldDescription: tr,
1245
+ fieldSelect: nr,
1246
+ fieldSelectError: rr,
1247
+ fieldError: sr
1248
+ }, ar = {
1249
+ $style: or
1250
+ }, lr = /* @__PURE__ */ D(Qn, [["__cssModules", ar]]), ir = ["for"], ur = ["id", "type", "inputmode", "value", "placeholder", "aria-invalid", "aria-describedby"], cr = ["id"], dr = /* @__PURE__ */ A({
1251
+ __name: "TextInput",
1252
+ props: {
1253
+ question: {}
1254
+ },
1255
+ setup(e) {
1256
+ let t = 0;
1257
+ const s = e, o = F("dtc-onboarding"), a = `ti-${++t}`, n = k(() => o.getAnswer(s.question.key)), i = k(
1258
+ () => o.validationErrors.value[s.question.key]
1259
+ ), c = k(
1260
+ () => n.value !== void 0 && n.value !== null ? String(n.value) : ""
1261
+ ), d = k(() => s.question.type === "number" ? "text" : s.question.style === "email" ? "email" : "text"), v = k(
1262
+ () => s.question.type === "number" ? "numeric" : void 0
1263
+ );
1264
+ function g(p) {
1265
+ const h = p.target.value;
1266
+ if (s.question.type === "number") {
1267
+ const $ = h.replace(/[^0-9.]/g, ""), T = $ === "" ? void 0 : Number($), q = T !== void 0 && isNaN(T) ? void 0 : T;
1268
+ o.setAnswer(s.question.key, q);
1269
+ } else
1270
+ o.setAnswer(s.question.key, h || void 0);
1271
+ }
1272
+ return (p, h) => (u(), y("div", {
1273
+ class: r(p.$style.fieldGroup)
1274
+ }, [
1275
+ l("label", {
1276
+ class: r(p.$style.fieldLabel),
1277
+ for: `${a}-${e.question.key}`
1278
+ }, m(e.question.label), 11, ir),
1279
+ e.question.description ? (u(), y("p", {
1280
+ key: 0,
1281
+ class: r(p.$style.fieldDescription)
1282
+ }, m(e.question.description), 3)) : w("", !0),
1283
+ l("div", {
1284
+ class: r(p.$style.fieldInputWrapper)
1285
+ }, [
1286
+ l("input", {
1287
+ id: `${a}-${e.question.key}`,
1288
+ type: d.value,
1289
+ inputmode: v.value,
1290
+ class: r([p.$style.fieldInput, i.value ? p.$style.fieldInputError : ""]),
1291
+ value: c.value,
1292
+ placeholder: e.question.placeholder,
1293
+ "aria-invalid": i.value ? "true" : void 0,
1294
+ "aria-describedby": i.value ? `${a}-${e.question.key}-error` : void 0,
1295
+ onInput: g
1296
+ }, null, 42, ur),
1297
+ e.question.suffix ? (u(), y("span", {
1298
+ key: 0,
1299
+ class: r(p.$style.fieldSuffix)
1300
+ }, m(e.question.suffix), 3)) : w("", !0)
1301
+ ], 2),
1302
+ i.value ? (u(), y("p", {
1303
+ key: 1,
1304
+ id: `${a}-${e.question.key}-error`,
1305
+ class: r(p.$style.fieldError),
1306
+ role: "alert"
1307
+ }, m(i.value), 11, cr)) : w("", !0)
1308
+ ], 2));
1309
+ }
1310
+ }), vr = "_fieldGroup_1jlim_2", pr = "_fieldLabel_1jlim_8", yr = "_fieldDescription_1jlim_15", gr = "_fieldInputWrapper_1jlim_22", fr = "_fieldInput_1jlim_22", hr = "_fieldInputError_1jlim_60", br = "_fieldSuffix_1jlim_64", mr = "_fieldError_1jlim_73", $r = {
1311
+ fieldGroup: vr,
1312
+ fieldLabel: pr,
1313
+ fieldDescription: yr,
1314
+ fieldInputWrapper: gr,
1315
+ fieldInput: fr,
1316
+ fieldInputError: hr,
1317
+ fieldSuffix: br,
1318
+ fieldError: mr
1319
+ }, kr = {
1320
+ $style: $r
1321
+ }, _r = /* @__PURE__ */ D(dr, [["__cssModules", kr]]), Cr = ["for"], wr = ["id", "value", "placeholder", "aria-invalid", "aria-describedby"], Ir = ["id"], Lr = /* @__PURE__ */ A({
1322
+ __name: "CurrencyInput",
1323
+ props: {
1324
+ question: {}
1325
+ },
1326
+ setup(e) {
1327
+ let t = 0;
1328
+ const s = e, o = F("dtc-onboarding"), a = `ci-${++t}`, n = k(() => o.getAnswer(s.question.key)), i = k(
1329
+ () => o.validationErrors.value[s.question.key]
1330
+ ), c = k(
1331
+ () => n.value !== void 0 && n.value !== null ? String(n.value) : ""
1332
+ );
1333
+ function d(v) {
1334
+ const g = v.target.value.replace(/[^0-9]/g, ""), p = g === "" ? void 0 : Number(g);
1335
+ o.setAnswer(
1336
+ s.question.key,
1337
+ p !== void 0 && isNaN(p) ? void 0 : p
1338
+ );
1339
+ }
1340
+ return (v, g) => (u(), y("div", {
1341
+ class: r(v.$style.fieldGroup)
1342
+ }, [
1343
+ l("label", {
1344
+ class: r(v.$style.fieldLabel),
1345
+ for: `${a}-${e.question.key}`
1346
+ }, m(e.question.label), 11, Cr),
1347
+ l("div", {
1348
+ class: r(v.$style.currencyWrapper)
1349
+ }, [
1350
+ l("span", {
1351
+ class: r(v.$style.currencyPrefix)
1352
+ }, "$", 2),
1353
+ l("input", {
1354
+ id: `${a}-${e.question.key}`,
1355
+ type: "text",
1356
+ inputmode: "numeric",
1357
+ class: r([v.$style.currencyInput, i.value ? v.$style.fieldInputError : ""]),
1358
+ value: c.value,
1359
+ placeholder: e.question.placeholder,
1360
+ "aria-invalid": i.value ? "true" : void 0,
1361
+ "aria-describedby": i.value ? `${a}-${e.question.key}-error` : void 0,
1362
+ onInput: d
1363
+ }, null, 42, wr)
1364
+ ], 2),
1365
+ i.value ? (u(), y("p", {
1366
+ key: 0,
1367
+ id: `${a}-${e.question.key}-error`,
1368
+ class: r(v.$style.fieldError),
1369
+ role: "alert"
1370
+ }, m(i.value), 11, Ir)) : w("", !0)
1371
+ ], 2));
1372
+ }
1373
+ }), Er = "_fieldGroup_10ms9_2", qr = "_fieldLabel_10ms9_8", Ar = "_currencyWrapper_10ms9_15", Mr = "_currencyPrefix_10ms9_21", Sr = "_currencyInput_10ms9_30", Dr = "_fieldInputError_10ms9_48", Tr = "_fieldError_10ms9_52", xr = {
1374
+ fieldGroup: Er,
1375
+ fieldLabel: qr,
1376
+ currencyWrapper: Ar,
1377
+ currencyPrefix: Mr,
1378
+ currencyInput: Sr,
1379
+ fieldInputError: Dr,
1380
+ fieldError: Tr
1381
+ }, Br = {
1382
+ $style: xr
1383
+ }, Pr = /* @__PURE__ */ D(Lr, [["__cssModules", Br]]), Fr = ["for"], jr = ["id", "value", "placeholder", "aria-invalid", "aria-describedby"], Gr = ["id"], Or = /* @__PURE__ */ A({
1384
+ __name: "PhoneInput",
1385
+ props: {
1386
+ question: {}
1387
+ },
1388
+ setup(e) {
1389
+ let t = 0;
1390
+ const s = e, o = F("dtc-onboarding"), a = `pi-${++t}`, n = k(
1391
+ () => o.getAnswer(s.question.key) ?? ""
1392
+ ), i = k(
1393
+ () => o.validationErrors.value[s.question.key]
1394
+ );
1395
+ function c(v) {
1396
+ const g = v.replace(/\D/g, "").slice(0, 10);
1397
+ return g.length <= 3 ? g : g.length <= 6 ? `(${g.slice(0, 3)}) ${g.slice(3)}` : `(${g.slice(0, 3)}) ${g.slice(3, 6)}-${g.slice(6)}`;
1398
+ }
1399
+ function d(v) {
1400
+ const p = v.target.value.replace(/\D/g, "").slice(0, 10);
1401
+ o.setAnswer(s.question.key, p || void 0);
1402
+ }
1403
+ return (v, g) => (u(), y("div", {
1404
+ class: r(v.$style.fieldGroup)
1405
+ }, [
1406
+ l("label", {
1407
+ class: r(v.$style.fieldLabel),
1408
+ for: `${a}-${e.question.key}`
1409
+ }, m(e.question.label), 11, Fr),
1410
+ l("input", {
1411
+ id: `${a}-${e.question.key}`,
1412
+ type: "tel",
1413
+ class: r([v.$style.fieldInput, i.value ? v.$style.fieldInputError : ""]),
1414
+ value: c(n.value),
1415
+ placeholder: e.question.placeholder || "(555) 555-5555",
1416
+ "aria-invalid": i.value ? "true" : void 0,
1417
+ "aria-describedby": i.value ? `${a}-${e.question.key}-error` : void 0,
1418
+ onInput: d
1419
+ }, null, 42, jr),
1420
+ i.value ? (u(), y("p", {
1421
+ key: 0,
1422
+ id: `${a}-${e.question.key}-error`,
1423
+ class: r(v.$style.fieldError),
1424
+ role: "alert"
1425
+ }, m(i.value), 11, Gr)) : w("", !0)
1426
+ ], 2));
1427
+ }
1428
+ }), Rr = "_fieldGroup_p6z3v_2", Nr = "_fieldLabel_p6z3v_8", Vr = "_fieldInput_p6z3v_15", Ur = "_fieldInputError_p6z3v_37", Hr = "_fieldError_p6z3v_41", Wr = {
1429
+ fieldGroup: Rr,
1430
+ fieldLabel: Nr,
1431
+ fieldInput: Vr,
1432
+ fieldInputError: Ur,
1433
+ fieldError: Hr
1434
+ }, Zr = {
1435
+ $style: Wr
1436
+ }, zr = /* @__PURE__ */ D(Or, [["__cssModules", Zr]]), Kr = ["checked"], Jr = /* @__PURE__ */ A({
1437
+ __name: "ToggleInput",
1438
+ props: {
1439
+ question: {}
1440
+ },
1441
+ setup(e) {
1442
+ const t = e, s = F("dtc-onboarding"), o = k(
1443
+ () => s.getAnswer(t.question.key)
1444
+ );
1445
+ function a(n) {
1446
+ s.setAnswer(
1447
+ t.question.key,
1448
+ n.target.checked
1449
+ );
1450
+ }
1451
+ return (n, i) => (u(), y("div", {
1452
+ class: r(n.$style.toggleGroup)
1453
+ }, [
1454
+ l("label", {
1455
+ class: r(n.$style.toggleLabel)
1456
+ }, [
1457
+ l("input", {
1458
+ type: "checkbox",
1459
+ class: r(n.$style.toggleCheckbox),
1460
+ checked: o.value === !0,
1461
+ onChange: a
1462
+ }, null, 42, Kr),
1463
+ l("span", {
1464
+ class: r(n.$style.toggleText)
1465
+ }, m(e.question.label), 3)
1466
+ ], 2)
1467
+ ], 2));
1468
+ }
1469
+ }), Xr = "_toggleGroup_1wi5o_2", Qr = "_toggleLabel_1wi5o_6", Yr = "_toggleCheckbox_1wi5o_14", es = "_toggleText_1wi5o_23", ts = {
1470
+ toggleGroup: Xr,
1471
+ toggleLabel: Qr,
1472
+ toggleCheckbox: Yr,
1473
+ toggleText: es
1474
+ }, ns = {
1475
+ $style: ts
1476
+ }, rs = /* @__PURE__ */ D(Jr, [["__cssModules", ns]]), ss = ["value", "placeholder", "aria-label", "aria-expanded", "aria-invalid", "aria-describedby", "aria-controls", "aria-activedescendant"], os = ["id", "aria-selected", "onClick"], as = ["id"], ls = /* @__PURE__ */ A({
1477
+ __name: "SearchableDropdownInput",
1478
+ props: {
1479
+ question: {}
1480
+ },
1481
+ setup(e) {
1482
+ let t = 0;
1483
+ const s = e, o = F("dtc-onboarding"), a = F(
1484
+ "opendoor-client",
1485
+ void 0
1486
+ ), n = `sd-${++t}`, i = `${n}-${s.question.key}-listbox`, c = k(
1487
+ () => o.getAnswer(s.question.key)
1488
+ ), d = k(
1489
+ () => o.validationErrors.value[s.question.key]
1490
+ ), v = I(""), g = I(!1), p = I([]), h = I(!1), $ = I(-1), T = I(null);
1491
+ H(
1492
+ [() => s.question.dataSource, () => s.question.options, () => a == null ? void 0 : a.value],
1493
+ (b, x, B) => {
1494
+ let O = !1;
1495
+ B(() => {
1496
+ O = !0;
1497
+ }), s.question.dataSource === "homebuilders" && (a != null && a.value) ? (h.value = !0, a.value.getHomebuilders().then((P) => {
1498
+ O || (p.value = P.homebuilders.map((Y) => ({
1499
+ label: Y.displayName,
1500
+ value: Y.identifier
1501
+ })));
1502
+ }).catch(() => {
1503
+ O || (s.question.options ? p.value = s.question.options.map((P) => ({
1504
+ label: P.label,
1505
+ value: String(P.value)
1506
+ })) : p.value = []);
1507
+ }).finally(() => {
1508
+ O || (h.value = !1);
1509
+ })) : s.question.options ? p.value = s.question.options.map((P) => ({
1510
+ label: P.label,
1511
+ value: String(P.value)
1512
+ })) : p.value = [];
1513
+ },
1514
+ { immediate: !0 }
1515
+ );
1516
+ const q = k(
1517
+ () => v.value ? p.value.filter(
1518
+ (b) => b.label.toLowerCase().includes(v.value.toLowerCase())
1519
+ ) : p.value
1520
+ ), G = k(
1521
+ () => {
1522
+ var b;
1523
+ return (b = p.value.find((x) => x.value === c.value)) == null ? void 0 : b.label;
1524
+ }
1525
+ );
1526
+ function S(b) {
1527
+ o.setAnswer(s.question.key, b), g.value = !1, v.value = "", $.value = -1;
1528
+ }
1529
+ function V(b) {
1530
+ v.value = b.target.value, $.value = -1, g.value || (g.value = !0);
1531
+ }
1532
+ function U(b) {
1533
+ if (!g.value) {
1534
+ (b.key === "ArrowDown" || b.key === "Enter") && (b.preventDefault(), g.value = !0);
1535
+ return;
1536
+ }
1537
+ switch (b.key) {
1538
+ case "ArrowDown":
1539
+ b.preventDefault(), q.value.length > 0 && ($.value = $.value < q.value.length - 1 ? $.value + 1 : 0);
1540
+ break;
1541
+ case "ArrowUp":
1542
+ b.preventDefault(), q.value.length > 0 && ($.value = $.value > 0 ? $.value - 1 : q.value.length - 1);
1543
+ break;
1544
+ case "Enter":
1545
+ b.preventDefault(), $.value >= 0 && $.value < q.value.length && S(q.value[$.value].value);
1546
+ break;
1547
+ case "Escape":
1548
+ b.preventDefault(), g.value = !1, $.value = -1;
1549
+ break;
1550
+ }
1551
+ }
1552
+ function L(b) {
1553
+ T.value && !T.value.contains(b.target) && (g.value = !1);
1554
+ }
1555
+ return se(() => {
1556
+ document.addEventListener("mousedown", L);
1557
+ }), Z(() => {
1558
+ document.removeEventListener("mousedown", L);
1559
+ }), (b, x) => (u(), y("div", {
1560
+ ref_key: "containerRef",
1561
+ ref: T,
1562
+ class: r(b.$style.fieldGroup)
1563
+ }, [
1564
+ l("div", {
1565
+ class: r(b.$style.searchableDropdown)
1566
+ }, [
1567
+ l("input", {
1568
+ type: "text",
1569
+ class: r(b.$style.fieldInput),
1570
+ value: g.value ? v.value : G.value ?? "",
1571
+ placeholder: e.question.placeholder || "Select or search...",
1572
+ "aria-label": e.question.label,
1573
+ "aria-expanded": g.value,
1574
+ "aria-invalid": d.value ? "true" : void 0,
1575
+ "aria-describedby": d.value ? `${n}-${e.question.key}-error` : void 0,
1576
+ role: "combobox",
1577
+ "aria-haspopup": "listbox",
1578
+ "aria-controls": g.value ? i : void 0,
1579
+ "aria-activedescendant": g.value && $.value >= 0 ? `${i}-option-${$.value}` : void 0,
1580
+ onInput: V,
1581
+ onFocus: x[0] || (x[0] = (B) => g.value = !0),
1582
+ onKeydown: U
1583
+ }, null, 42, ss),
1584
+ l("button", {
1585
+ type: "button",
1586
+ class: r(b.$style.searchableDropdownToggle),
1587
+ "aria-label": "Toggle dropdown",
1588
+ tabindex: "-1",
1589
+ onClick: x[1] || (x[1] = (B) => g.value = !g.value)
1590
+ }, [...x[2] || (x[2] = [
1591
+ l("svg", {
1592
+ width: "12",
1593
+ height: "8",
1594
+ viewBox: "0 0 12 8",
1595
+ fill: "none"
1596
+ }, [
1597
+ l("path", {
1598
+ d: "M1 1l5 5 5-5",
1599
+ stroke: "currentColor",
1600
+ "stroke-width": "1.5",
1601
+ "stroke-linecap": "round",
1602
+ "stroke-linejoin": "round"
1603
+ })
1604
+ ], -1)
1605
+ ])], 2),
1606
+ g.value ? (u(), y("div", {
1607
+ key: 0,
1608
+ class: r(b.$style.searchableDropdownList),
1609
+ role: "listbox",
1610
+ id: i
1611
+ }, [
1612
+ h.value ? (u(), y("div", {
1613
+ key: 0,
1614
+ class: r(b.$style.searchableDropdownEmpty)
1615
+ }, " Loading... ", 2)) : q.value.length === 0 ? (u(), y("div", {
1616
+ key: 1,
1617
+ class: r(b.$style.searchableDropdownEmpty)
1618
+ }, " No results found ", 2)) : (u(!0), y(j, { key: 2 }, z(q.value, (B, O) => (u(), y("button", {
1619
+ key: B.value,
1620
+ id: `${i}-option-${O}`,
1621
+ type: "button",
1622
+ role: "option",
1623
+ "aria-selected": B.value === c.value,
1624
+ class: r([
1625
+ b.$style.searchableDropdownOption,
1626
+ B.value === c.value ? b.$style.searchableDropdownOptionSelected : "",
1627
+ O === $.value ? b.$style.searchableDropdownOptionHighlighted : ""
1628
+ ]),
1629
+ onClick: (P) => S(B.value)
1630
+ }, m(B.label), 11, os))), 128))
1631
+ ], 2)) : w("", !0)
1632
+ ], 2),
1633
+ d.value ? (u(), y("p", {
1634
+ key: 0,
1635
+ id: `${n}-${e.question.key}-error`,
1636
+ class: r(b.$style.fieldError),
1637
+ role: "alert"
1638
+ }, m(d.value), 11, as)) : w("", !0)
1639
+ ], 2));
1640
+ }
1641
+ }), is = "_fieldGroup_v7484_2", us = "_searchableDropdown_v7484_8", cs = "_fieldInput_v7484_14", ds = "_searchableDropdownToggle_v7484_40", vs = "_searchableDropdownList_v7484_53", ps = "_searchableDropdownOption_v7484_68", ys = "_searchableDropdownOptionSelected_v7484_86", gs = "_searchableDropdownOptionHighlighted_v7484_91", fs = "_searchableDropdownEmpty_v7484_95", hs = "_fieldError_v7484_101", bs = {
1642
+ fieldGroup: is,
1643
+ searchableDropdown: us,
1644
+ fieldInput: cs,
1645
+ searchableDropdownToggle: ds,
1646
+ searchableDropdownList: vs,
1647
+ searchableDropdownOption: ps,
1648
+ searchableDropdownOptionSelected: ys,
1649
+ searchableDropdownOptionHighlighted: gs,
1650
+ searchableDropdownEmpty: fs,
1651
+ fieldError: hs
1652
+ }, ms = {
1653
+ $style: bs
1654
+ }, $s = /* @__PURE__ */ D(ls, [["__cssModules", ms]]), ks = ["aria-label"], _s = /* @__PURE__ */ A({
1655
+ __name: "DtcPage",
1656
+ setup(e) {
1657
+ const t = F("dtc-onboarding"), s = I(null);
1658
+ return H(
1659
+ () => {
1660
+ var o;
1661
+ return (o = t.currentPage.value) == null ? void 0 : o.id;
1662
+ },
1663
+ () => {
1664
+ var o, a, n;
1665
+ (a = (o = s.value) == null ? void 0 : o.scrollTo) == null || a.call(o, { top: 0, behavior: "smooth" }), (n = s.value) == null || n.focus();
1666
+ }
1667
+ ), (o, a) => E(t).currentPage.value ? (u(), y("div", {
1668
+ key: 0,
1669
+ ref_key: "containerRef",
1670
+ ref: s,
1671
+ class: r(o.$style.pageContent),
1672
+ tabindex: "-1",
1673
+ role: "region",
1674
+ "aria-label": E(t).currentPage.value.title
1675
+ }, [
1676
+ (u(!0), y(j, null, z(E(t).visibleQuestions.value, (n) => (u(), y(j, {
1677
+ key: n.key
1678
+ }, [
1679
+ n.style === "radio-card" ? (u(), N(pn, {
1680
+ key: 0,
1681
+ question: n
1682
+ }, null, 8, ["question"])) : n.style === "image-card" ? (u(), N(Mn, {
1683
+ key: 1,
1684
+ question: n
1685
+ }, null, 8, ["question"])) : n.style === "checkbox-card" ? (u(), N(Wn, {
1686
+ key: 2,
1687
+ question: n
1688
+ }, null, 8, ["question"])) : n.style === "dropdown" ? (u(), N(lr, {
1689
+ key: 3,
1690
+ question: n
1691
+ }, null, 8, ["question"])) : n.style === "input" || n.style === "email" ? (u(), N(_r, {
1692
+ key: 4,
1693
+ question: n
1694
+ }, null, 8, ["question"])) : n.style === "currency" ? (u(), N(Pr, {
1695
+ key: 5,
1696
+ question: n
1697
+ }, null, 8, ["question"])) : n.style === "phone" ? (u(), N(zr, {
1698
+ key: 6,
1699
+ question: n
1700
+ }, null, 8, ["question"])) : n.style === "toggle" ? (u(), N(rs, {
1701
+ key: 7,
1702
+ question: n
1703
+ }, null, 8, ["question"])) : n.style === "searchable-dropdown" ? (u(), N($s, {
1704
+ key: 8,
1705
+ question: n
1706
+ }, null, 8, ["question"])) : w("", !0)
1707
+ ], 64))), 128))
1708
+ ], 10, ks)) : w("", !0);
1709
+ }
1710
+ }), Cs = "_pageContent_1198c_2", ws = {
1711
+ pageContent: Cs
1712
+ }, Is = {
1713
+ $style: ws
1714
+ }, Ls = /* @__PURE__ */ D(_s, [["__cssModules", Is]]), Es = ["aria-valuenow"], qs = /* @__PURE__ */ A({
1715
+ __name: "DtcProgressBar",
1716
+ props: {
1717
+ progress: {}
1718
+ },
1719
+ setup(e) {
1720
+ const t = e, s = k(
1721
+ () => Math.min(100, Math.max(0, t.progress * 100))
1722
+ );
1723
+ return (o, a) => (u(), y("div", {
1724
+ class: r(o.$style.progressBar),
1725
+ role: "progressbar",
1726
+ "aria-valuenow": s.value,
1727
+ "aria-valuemin": 0,
1728
+ "aria-valuemax": 100
1729
+ }, [
1730
+ l("div", {
1731
+ class: r(o.$style.progressBarFill),
1732
+ style: Q({ width: `${s.value}%` })
1733
+ }, null, 6)
1734
+ ], 10, Es));
1735
+ }
1736
+ }), As = "_progressBar_y1k9k_2", Ms = "_progressBarFill_y1k9k_9", Ss = {
1737
+ progressBar: As,
1738
+ progressBarFill: Ms
1739
+ }, Ds = {
1740
+ $style: Ss
1741
+ }, Ts = /* @__PURE__ */ D(qs, [["__cssModules", Ds]]), xs = { key: 1 }, Bs = /* @__PURE__ */ A({
1742
+ __name: "DtcNavigation",
1743
+ setup(e) {
1744
+ const t = F("dtc-onboarding"), s = k(
1745
+ () => {
1746
+ var o;
1747
+ return ((o = t.currentPage.value) == null ? void 0 : o.submitLabel) ?? "Next";
1748
+ }
1749
+ );
1750
+ return (o, a) => (u(), y("nav", {
1751
+ class: r(o.$style.navigation),
1752
+ "aria-label": "Page navigation"
1753
+ }, [
1754
+ J(Ts, {
1755
+ progress: E(t).progress.value
1756
+ }, null, 8, ["progress"]),
1757
+ l("div", {
1758
+ class: r(o.$style.navigationButtons)
1759
+ }, [
1760
+ E(t).isFirstPage.value ? (u(), y("div", xs)) : (u(), y("button", {
1761
+ key: 0,
1762
+ type: "button",
1763
+ class: r(o.$style.backButton),
1764
+ "aria-label": "Go back",
1765
+ onClick: a[0] || (a[0] = (n) => E(t).goToPrev())
1766
+ }, [...a[2] || (a[2] = [
1767
+ l("svg", {
1768
+ width: "24",
1769
+ height: "24",
1770
+ viewBox: "0 0 24 24",
1771
+ fill: "none",
1772
+ stroke: "currentColor",
1773
+ "stroke-width": "2",
1774
+ "stroke-linecap": "round",
1775
+ "stroke-linejoin": "round"
1776
+ }, [
1777
+ l("polyline", { points: "15 18 9 12 15 6" })
1778
+ ], -1)
1779
+ ])], 2)),
1780
+ l("button", {
1781
+ type: "button",
1782
+ class: r(o.$style.nextButton),
1783
+ onClick: a[1] || (a[1] = (n) => E(t).goToNext())
1784
+ }, m(s.value), 3)
1785
+ ], 2)
1786
+ ], 2));
1787
+ }
1788
+ }), Ps = "_navigation_1joq3_2", Fs = "_navigationButtons_1joq3_10", js = "_backButton_1joq3_16", Gs = "_nextButton_1joq3_39", Os = {
1789
+ navigation: Ps,
1790
+ navigationButtons: Fs,
1791
+ backButton: js,
1792
+ nextButton: Gs
1793
+ }, Rs = {
1794
+ $style: Os
1795
+ }, Ns = /* @__PURE__ */ D(Bs, [["__cssModules", Rs]]), Vs = /* @__PURE__ */ A({
1796
+ __name: "DtcLayout",
1797
+ props: {
1798
+ address: {}
1799
+ },
1800
+ setup(e) {
1801
+ const t = e, s = F("dtc-onboarding"), o = k(
1802
+ () => [
1803
+ t.address.street1,
1804
+ t.address.street2,
1805
+ t.address.city,
1806
+ t.address.state,
1807
+ t.address.postalCode
1808
+ ].filter(Boolean).join(", ")
1809
+ );
1810
+ return (a, n) => E(s).currentPage.value ? (u(), y("div", {
1811
+ key: 0,
1812
+ class: r(a.$style.layout)
1813
+ }, [
1814
+ l("div", {
1815
+ class: r(a.$style.addressBar)
1816
+ }, [
1817
+ (u(), y("svg", {
1818
+ width: "16",
1819
+ height: "16",
1820
+ viewBox: "0 0 24 24",
1821
+ fill: "none",
1822
+ stroke: "currentColor",
1823
+ "stroke-width": "2",
1824
+ class: r(a.$style.addressIcon)
1825
+ }, [...n[0] || (n[0] = [
1826
+ l("circle", {
1827
+ cx: "12",
1828
+ cy: "10",
1829
+ r: "3"
1830
+ }, null, -1),
1831
+ l("path", { d: "M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7z" }, null, -1)
1832
+ ])], 2)),
1833
+ l("span", {
1834
+ class: r(a.$style.addressText)
1835
+ }, m(o.value), 3)
1836
+ ], 2),
1837
+ l("div", {
1838
+ class: r(a.$style.contentSplit)
1839
+ }, [
1840
+ l("div", {
1841
+ class: r(a.$style.contentLeft)
1842
+ }, [
1843
+ l("h1", {
1844
+ class: r(a.$style.pageTitle)
1845
+ }, m(E(s).currentPage.value.title), 3),
1846
+ E(s).currentPage.value.subtitle ? (u(), y("p", {
1847
+ key: 0,
1848
+ class: r(a.$style.pageSubtitle)
1849
+ }, m(E(s).currentPage.value.subtitle), 3)) : w("", !0)
1850
+ ], 2),
1851
+ l("div", {
1852
+ class: r(a.$style.contentRight)
1853
+ }, [
1854
+ J(Ls)
1855
+ ], 2)
1856
+ ], 2),
1857
+ J(Ns)
1858
+ ], 2)) : w("", !0);
1859
+ }
1860
+ }), Us = "_layout_12o3j_2", Hs = "_addressBar_12o3j_10", Ws = "_addressIcon_12o3j_18", Zs = "_addressText_12o3j_22", zs = "_contentSplit_12o3j_28", Ks = "_contentLeft_12o3j_42", Js = "_contentRight_12o3j_48", Xs = "_pageTitle_12o3j_64", Qs = "_pageSubtitle_12o3j_72", Ys = {
1861
+ layout: Us,
1862
+ addressBar: Hs,
1863
+ addressIcon: Ws,
1864
+ addressText: Zs,
1865
+ contentSplit: zs,
1866
+ contentLeft: Ks,
1867
+ contentRight: Js,
1868
+ pageTitle: Xs,
1869
+ pageSubtitle: Qs
1870
+ }, eo = {
1871
+ $style: Ys
1872
+ }, to = /* @__PURE__ */ D(Vs, [["__cssModules", eo]]), no = /* @__PURE__ */ A({
1873
+ __name: "DtcOnboardingFlow",
1874
+ props: {
1875
+ address: {},
1876
+ partnerLogoUrl: {},
1877
+ appearance: { default: () => ({ theme: "minimal" }) },
1878
+ initialAnswers: {},
1879
+ market: {},
1880
+ onClose: {}
1881
+ },
1882
+ emits: ["submit", "page-change", "answer-change", "ready", "error"],
1883
+ setup(e, { emit: t }) {
1884
+ const s = e, o = t, a = k(() => ee(s.appearance));
1885
+ function n(p) {
1886
+ o("submit", p);
1887
+ }
1888
+ function i(p, h) {
1889
+ o("page-change", p, h);
1890
+ }
1891
+ function c(p, h) {
1892
+ o("answer-change", p, h);
1893
+ }
1894
+ function d() {
1895
+ o("ready");
1896
+ }
1897
+ function v(p) {
1898
+ o("error", p);
1899
+ }
1900
+ function g() {
1901
+ var p;
1902
+ (p = s.onClose) == null || p.call(s);
1903
+ }
1904
+ return (p, h) => (u(), y("div", {
1905
+ class: r(p.$style.container),
1906
+ style: Q(a.value)
1907
+ }, [
1908
+ J(Ut, {
1909
+ market: e.market,
1910
+ "initial-answers": e.initialAnswers,
1911
+ "on-submit": n,
1912
+ "on-page-change": i,
1913
+ "on-answer-change": c,
1914
+ "on-ready": d,
1915
+ "on-error": v
1916
+ }, {
1917
+ default: ge(() => [
1918
+ J(en, {
1919
+ "partner-logo-url": e.partnerLogoUrl,
1920
+ "show-close-button": !!e.onClose,
1921
+ onClose: g
1922
+ }, null, 8, ["partner-logo-url", "show-close-button"]),
1923
+ J(to, { address: e.address }, null, 8, ["address"])
1924
+ ]),
1925
+ _: 1
1926
+ }, 8, ["market", "initial-answers"])
1927
+ ], 6));
1928
+ }
1929
+ }), ro = "_container_gvkeo_2", so = {
1930
+ container: ro
1931
+ }, oo = {
1932
+ $style: so
1933
+ }, go = /* @__PURE__ */ D(no, [["__cssModules", oo]]);
1934
+ export {
1935
+ vo as AddressEntry,
1936
+ po as AddressMap,
1937
+ yo as AddressUnitConfirmation,
1938
+ go as DtcOnboardingFlow,
1939
+ bo as OpendoorClient,
1940
+ co as OpendoorProvider,
1941
+ mo as THEMES,
1942
+ $o as resolveAppearance,
1943
+ be as useOpendoorClient
1944
+ };