doct-ui-auth-kit 1.0.0 → 1.0.1

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.
@@ -0,0 +1,797 @@
1
+ import { jsx as f, jsxs as w } from "react/jsx-runtime";
2
+ import { DoctTypography as P, DoctButton as N, DoctLabeledInput as se, DoctPhoneInput as ce, DoctOtpInput as ue } from "docthub-core-components";
3
+ import { useFormContext as H, Controller as V, useForm as q, FormProvider as W } from "react-hook-form";
4
+ import { z as _ } from "zod";
5
+ import R, { useRef as j, useCallback as me, useEffect as U, useState as de } from "react";
6
+ var I = { exports: {} }, A = {};
7
+ var Y;
8
+ function fe() {
9
+ if (Y) return A;
10
+ Y = 1;
11
+ var t = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
12
+ return A.c = function(e) {
13
+ return t.H.useMemoCache(e);
14
+ }, A;
15
+ }
16
+ var B = {};
17
+ var K;
18
+ function he() {
19
+ return K || (K = 1, process.env.NODE_ENV !== "production" && (function() {
20
+ var t = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
21
+ B.c = function(e) {
22
+ var n = t.H;
23
+ return n === null && console.error(
24
+ `Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
25
+ 1. You might have mismatching versions of React and the renderer (such as React DOM)
26
+ 2. You might be breaking the Rules of Hooks
27
+ 3. You might have more than one copy of React in the same app
28
+ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`
29
+ ), n.useMemoCache(e);
30
+ };
31
+ })()), B;
32
+ }
33
+ var J;
34
+ function pe() {
35
+ return J || (J = 1, process.env.NODE_ENV === "production" ? I.exports = fe() : I.exports = he()), I.exports;
36
+ }
37
+ var x = pe();
38
+ const Q = "https://accounts.google.com/gsi/client";
39
+ function te() {
40
+ return typeof window > "u" ? Promise.reject(new Error("GSI requires browser")) : window.google?.accounts?.id ? Promise.resolve(window.google) : new Promise((t, e) => {
41
+ if (document.querySelector(`script[src="${Q}"]`)) {
42
+ const o = () => window.google?.accounts?.id ? t(window.google) : setTimeout(o, 50);
43
+ o();
44
+ return;
45
+ }
46
+ const l = document.createElement("script");
47
+ l.src = Q, l.async = !0, l.onload = () => {
48
+ window.google?.accounts?.id ? t(window.google) : e(new Error("Google Identity Services failed to load"));
49
+ }, l.onerror = () => e(new Error("Failed to load Google Identity Services script")), document.head.appendChild(l);
50
+ });
51
+ }
52
+ function Ye({
53
+ clientId: t,
54
+ onCredential: e,
55
+ enabled: n = !0
56
+ }) {
57
+ const l = j(e);
58
+ l.current = e;
59
+ const o = j(!1), r = me(() => {
60
+ te().then((c) => {
61
+ c?.accounts?.id && (o.current || (c.accounts.id.initialize({
62
+ client_id: t,
63
+ callback: (a) => {
64
+ l.current(a.credential);
65
+ }
66
+ }), o.current = !0), c.accounts.id.prompt());
67
+ }).catch(() => {
68
+ });
69
+ }, [t]);
70
+ return U(() => {
71
+ !n || !t || r();
72
+ }, [n, t, r]), {
73
+ triggerOneTap: r
74
+ };
75
+ }
76
+ function ge({
77
+ clientId: t,
78
+ onCredential: e,
79
+ containerRef: n
80
+ }) {
81
+ const l = j(e);
82
+ l.current = e, U(() => {
83
+ if (!n?.current || !t) return;
84
+ const o = n.current;
85
+ te().then((r) => {
86
+ r?.accounts?.id && (r.accounts.id.initialize({
87
+ client_id: t,
88
+ callback: (c) => {
89
+ l.current(c.credential);
90
+ }
91
+ }), r.accounts.id.renderButton(o, {
92
+ theme: "outline",
93
+ size: "large",
94
+ type: "standard"
95
+ }));
96
+ }).catch(() => {
97
+ });
98
+ }, [t, n]);
99
+ }
100
+ function be(t) {
101
+ const e = x.c(4), {
102
+ clientId: n,
103
+ onCredential: l
104
+ } = t, o = j(null);
105
+ let r;
106
+ e[0] !== n || e[1] !== l ? (r = {
107
+ clientId: n,
108
+ onCredential: l,
109
+ containerRef: o
110
+ }, e[0] = n, e[1] = l, e[2] = r) : r = e[2], ge(r);
111
+ let c;
112
+ return e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ f("div", { ref: o }), e[3] = c) : c = e[3], c;
113
+ }
114
+ function Ke(t) {
115
+ const e = x.c(11), {
116
+ error: n,
117
+ onGoBack: l
118
+ } = t, o = n?.message ?? "This account is already linked to another identifier. Please use that method to sign in or try a different one.", r = n?.linkedIdentifier;
119
+ let c;
120
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ f(P, { variant: "h5", weight: "extraBold", align: "left", className: "mb-2 text-black", children: "Account already exists" }), e[0] = c) : c = e[0];
121
+ let a;
122
+ e[1] !== o ? (a = /* @__PURE__ */ f(P, { variant: "body2", align: "left", className: "mb-4 text-black/80", children: o }), e[1] = o, e[2] = a) : a = e[2];
123
+ let i;
124
+ e[3] !== r ? (i = r ? /* @__PURE__ */ w(P, { variant: "title2", align: "left", className: "mb-4 text-black/70", children: [
125
+ "Linked to: ",
126
+ r
127
+ ] }) : null, e[3] = r, e[4] = i) : i = e[4];
128
+ let u;
129
+ e[5] !== l ? (u = /* @__PURE__ */ f(N, { variant: "primary", size: "large", fullWidth: !0, onClick: l, children: "Go back" }), e[5] = l, e[6] = u) : u = e[6];
130
+ let m;
131
+ return e[7] !== a || e[8] !== i || e[9] !== u ? (m = /* @__PURE__ */ w("div", { className: "w-full flex flex-col gap-[12px]", children: [
132
+ c,
133
+ a,
134
+ i,
135
+ u
136
+ ] }), e[7] = a, e[8] = i, e[9] = u, e[10] = m) : m = e[10], m;
137
+ }
138
+ function k(t) {
139
+ const e = x.c(14), {
140
+ name: n,
141
+ label: l,
142
+ placeholder: o,
143
+ className: r,
144
+ control: c,
145
+ required: a,
146
+ type: i,
147
+ disabled: u,
148
+ onKeyDown: m,
149
+ maxLength: s,
150
+ numericOnly: d
151
+ } = t, g = H(), p = c || g.control;
152
+ let h;
153
+ e[0] !== r || e[1] !== u || e[2] !== l || e[3] !== s || e[4] !== d || e[5] !== m || e[6] !== o || e[7] !== a || e[8] !== i ? (h = (v) => {
154
+ const {
155
+ field: y,
156
+ fieldState: E
157
+ } = v;
158
+ return /* @__PURE__ */ f(se, { ...y, value: y.value ?? "", ...l !== void 0 && {
159
+ label: l
160
+ }, ...o !== void 0 && {
161
+ placeholder: o
162
+ }, ...E.error?.message !== void 0 && {
163
+ error: E.error?.message
164
+ }, ...r !== void 0 && {
165
+ className: r
166
+ }, ...a !== void 0 && {
167
+ required: a
168
+ }, type: i, ...u !== void 0 && {
169
+ disabled: u
170
+ }, onKeyDown: d ? (S) => {
171
+ !/[0-9]/.test(S.key) && !["Backspace", "Tab", "Delete", "ArrowLeft", "ArrowRight", "Home", "End"].includes(S.key) && S.preventDefault(), m?.(S);
172
+ } : m, ...s !== void 0 && {
173
+ maxLength: s
174
+ }, onChange: (S) => {
175
+ const C = S.target?.value;
176
+ if (typeof C == "string") {
177
+ y.onChange(C.replace(/^\s+/, ""));
178
+ let O = C.replace(/^\s+/, "");
179
+ d && (O = O.replace(/\D/g, "")), y.onChange(O);
180
+ } else
181
+ y.onChange(C);
182
+ }, onBlur: () => {
183
+ const S = y.value;
184
+ if (typeof S == "string") {
185
+ const C = S.trim();
186
+ C !== S && y.onChange(C);
187
+ }
188
+ y.onBlur();
189
+ } });
190
+ }, e[0] = r, e[1] = u, e[2] = l, e[3] = s, e[4] = d, e[5] = m, e[6] = o, e[7] = a, e[8] = i, e[9] = h) : h = e[9];
191
+ let b;
192
+ return e[10] !== n || e[11] !== p || e[12] !== h ? (b = /* @__PURE__ */ f(V, { name: n, control: p, render: h }), e[10] = n, e[11] = p, e[12] = h, e[13] = b) : b = e[13], b;
193
+ }
194
+ const ve = _.object({
195
+ fullName: _.string().min(1, "Full name is required"),
196
+ email: _.string().min(1, "Email is required").email("Enter a valid email address")
197
+ });
198
+ function Je(t) {
199
+ const e = x.c(17), {
200
+ maskedPhone: n,
201
+ onSubmit: l
202
+ } = t;
203
+ let o;
204
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = {
205
+ defaultValues: {
206
+ fullName: "",
207
+ email: ""
208
+ },
209
+ mode: "onSubmit"
210
+ }, e[0] = o) : o = e[0];
211
+ const r = q(o);
212
+ let c;
213
+ e[1] !== r || e[2] !== l ? (c = (p) => {
214
+ const h = ve.safeParse(p);
215
+ if (!h.success) {
216
+ for (const b of h.error.issues) {
217
+ const v = b.path[0];
218
+ typeof v == "string" && r.setError(v, {
219
+ message: b.message
220
+ });
221
+ }
222
+ return;
223
+ }
224
+ l?.({
225
+ fullName: h.data.fullName.trim(),
226
+ email: h.data.email.trim().toLowerCase()
227
+ });
228
+ }, e[1] = r, e[2] = l, e[3] = c) : c = e[3];
229
+ const a = c;
230
+ let i;
231
+ e[4] !== a || e[5] !== r ? (i = r.handleSubmit(a), e[4] = a, e[5] = r, e[6] = i) : i = e[6];
232
+ let u;
233
+ e[7] !== n ? (u = n ? /* @__PURE__ */ w(P, { variant: "body2", className: "mb-4 text-black/70", children: [
234
+ "We'll send the verification code to your email instead of",
235
+ " ",
236
+ n,
237
+ "."
238
+ ] }) : null, e[7] = n, e[8] = u) : u = e[8];
239
+ let m, s;
240
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ w("div", { className: "mb-6 flex w-full flex-col gap-[12px]", children: [
241
+ /* @__PURE__ */ f(k, { name: "fullName", placeholder: "Full name*", required: !0, type: "text", className: "w-full" }),
242
+ /* @__PURE__ */ f(k, { name: "email", placeholder: "Email address*", type: "email", required: !0, className: "w-full" })
243
+ ] }), s = /* @__PURE__ */ f(N, { type: "submit", variant: "primary", size: "large", fullWidth: !0, children: "Continue" }), e[9] = m, e[10] = s) : (m = e[9], s = e[10]);
244
+ let d;
245
+ e[11] !== i || e[12] !== u ? (d = /* @__PURE__ */ w("form", { onSubmit: i, className: "w-full flex flex-col", children: [
246
+ u,
247
+ m,
248
+ s
249
+ ] }), e[11] = i, e[12] = u, e[13] = d) : d = e[13];
250
+ let g;
251
+ return e[14] !== r || e[15] !== d ? (g = /* @__PURE__ */ f(W, { ...r, children: d }), e[14] = r, e[15] = d, e[16] = g) : g = e[16], g;
252
+ }
253
+ function ne(t) {
254
+ const e = x.c(13), {
255
+ name: n,
256
+ label: l,
257
+ placeholder: o,
258
+ helperText: r,
259
+ defaultCountry: c,
260
+ variant: a,
261
+ required: i,
262
+ disabled: u,
263
+ control: m,
264
+ error: s
265
+ } = t, d = o === void 0 ? "Enter phone number" : o, g = c === void 0 ? "IN" : c, p = a === void 0 ? "default" : a, h = H(), b = m ?? h.control;
266
+ let v;
267
+ e[0] !== g || e[1] !== u || e[2] !== s || e[3] !== r || e[4] !== l || e[5] !== d || e[6] !== i || e[7] !== p ? (v = (E) => {
268
+ const {
269
+ field: S,
270
+ fieldState: C
271
+ } = E, O = s ?? C.error?.message;
272
+ return /* @__PURE__ */ f(ce, { placeholder: d, value: S.value ?? "", onValueChange: (T) => S.onChange(T ?? ""), defaultCountry: g, variant: p ?? "default", required: i ?? !1, disabled: u ?? !1, ...l != null && {
273
+ label: l
274
+ }, ...r != null && {
275
+ helperText: r
276
+ }, ...O !== void 0 && {
277
+ error: O
278
+ } });
279
+ }, e[0] = g, e[1] = u, e[2] = s, e[3] = r, e[4] = l, e[5] = d, e[6] = i, e[7] = p, e[8] = v) : v = e[8];
280
+ let y;
281
+ return e[9] !== n || e[10] !== b || e[11] !== v ? (y = /* @__PURE__ */ f(V, { name: n, control: b, render: v }), e[9] = n, e[10] = b, e[11] = v, e[12] = y) : y = e[12], y;
282
+ }
283
+ const ye = _.object({
284
+ phone: _.string().min(1, "Phone number is required")
285
+ }), Se = _.object({
286
+ email: _.string().min(1, "Email is required").email("Enter a valid email address")
287
+ }), Ce = {
288
+ phone: ye,
289
+ email: Se
290
+ };
291
+ function _e(t) {
292
+ const e = x.c(12), {
293
+ mode: n,
294
+ onSubmit: l
295
+ } = t, o = n === "phone";
296
+ let r;
297
+ e[0] !== o ? (r = o ? {
298
+ phone: ""
299
+ } : {
300
+ email: ""
301
+ }, e[0] = o, e[1] = r) : r = e[1];
302
+ const c = r;
303
+ let a;
304
+ e[2] !== c ? (a = {
305
+ defaultValues: c,
306
+ mode: "onSubmit"
307
+ }, e[2] = c, e[3] = a) : a = e[3];
308
+ const i = q(a);
309
+ let u;
310
+ e[4] !== i || e[5] !== n || e[6] !== l ? (u = (d) => {
311
+ const p = Ce[n].safeParse(d);
312
+ if (!p.success) {
313
+ for (const h of p.error.issues) {
314
+ const b = h.path[0];
315
+ typeof b == "string" && i.setError(b, {
316
+ message: h.message
317
+ });
318
+ }
319
+ return;
320
+ }
321
+ l?.(p.data);
322
+ }, e[4] = i, e[5] = n, e[6] = l, e[7] = u) : u = e[7];
323
+ const m = u;
324
+ let s;
325
+ return e[8] !== m || e[9] !== o || e[10] !== i ? (s = {
326
+ methods: i,
327
+ handleSubmit: m,
328
+ isPhone: o
329
+ }, e[8] = m, e[9] = o, e[10] = i, e[11] = s) : s = e[11], s;
330
+ }
331
+ function Qe(t) {
332
+ const e = x.c(15), {
333
+ mode: n,
334
+ onSubmit: l
335
+ } = t;
336
+ let o;
337
+ e[0] !== n || e[1] !== l ? (o = {
338
+ mode: n,
339
+ onSubmit: l
340
+ }, e[0] = n, e[1] = l, e[2] = o) : o = e[2];
341
+ const {
342
+ methods: r,
343
+ handleSubmit: c,
344
+ isPhone: a
345
+ } = _e(o);
346
+ let i;
347
+ e[3] !== c || e[4] !== r ? (i = r.handleSubmit(c), e[3] = c, e[4] = r, e[5] = i) : i = e[5];
348
+ let u;
349
+ e[6] !== a ? (u = /* @__PURE__ */ f("div", { className: "mb-6 flex w-full flex-col gap-[12px]", children: a ? /* @__PURE__ */ f(ne, { name: "phone", placeholder: "Phone number", required: !0, defaultCountry: "IN" }) : /* @__PURE__ */ f(k, { name: "email", placeholder: "Enter email address", type: "email", required: !0 }) }), e[6] = a, e[7] = u) : u = e[7];
350
+ let m;
351
+ e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ f(N, { type: "submit", variant: "primary", size: "large", fullWidth: !0, children: "Continue" }), e[8] = m) : m = e[8];
352
+ let s;
353
+ e[9] !== i || e[10] !== u ? (s = /* @__PURE__ */ w("form", { onSubmit: i, className: "w-full flex flex-col", children: [
354
+ u,
355
+ m
356
+ ] }), e[9] = i, e[10] = u, e[11] = s) : s = e[11];
357
+ let d;
358
+ return e[12] !== r || e[13] !== s ? (d = /* @__PURE__ */ f(W, { ...r, children: s }), e[12] = r, e[13] = s, e[14] = d) : d = e[14], d;
359
+ }
360
+ var le = {
361
+ color: void 0,
362
+ size: void 0,
363
+ className: void 0,
364
+ style: void 0,
365
+ attr: void 0
366
+ }, X = R.createContext && /* @__PURE__ */ R.createContext(le), xe = ["attr", "size", "title"];
367
+ function Ne(t, e) {
368
+ if (t == null) return {};
369
+ var n = we(t, e), l, o;
370
+ if (Object.getOwnPropertySymbols) {
371
+ var r = Object.getOwnPropertySymbols(t);
372
+ for (o = 0; o < r.length; o++)
373
+ l = r[o], !(e.indexOf(l) >= 0) && Object.prototype.propertyIsEnumerable.call(t, l) && (n[l] = t[l]);
374
+ }
375
+ return n;
376
+ }
377
+ function we(t, e) {
378
+ if (t == null) return {};
379
+ var n = {};
380
+ for (var l in t)
381
+ if (Object.prototype.hasOwnProperty.call(t, l)) {
382
+ if (e.indexOf(l) >= 0) continue;
383
+ n[l] = t[l];
384
+ }
385
+ return n;
386
+ }
387
+ function D() {
388
+ return D = Object.assign ? Object.assign.bind() : function(t) {
389
+ for (var e = 1; e < arguments.length; e++) {
390
+ var n = arguments[e];
391
+ for (var l in n)
392
+ Object.prototype.hasOwnProperty.call(n, l) && (t[l] = n[l]);
393
+ }
394
+ return t;
395
+ }, D.apply(this, arguments);
396
+ }
397
+ function Z(t, e) {
398
+ var n = Object.keys(t);
399
+ if (Object.getOwnPropertySymbols) {
400
+ var l = Object.getOwnPropertySymbols(t);
401
+ e && (l = l.filter(function(o) {
402
+ return Object.getOwnPropertyDescriptor(t, o).enumerable;
403
+ })), n.push.apply(n, l);
404
+ }
405
+ return n;
406
+ }
407
+ function z(t) {
408
+ for (var e = 1; e < arguments.length; e++) {
409
+ var n = arguments[e] != null ? arguments[e] : {};
410
+ e % 2 ? Z(Object(n), !0).forEach(function(l) {
411
+ Ee(t, l, n[l]);
412
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Z(Object(n)).forEach(function(l) {
413
+ Object.defineProperty(t, l, Object.getOwnPropertyDescriptor(n, l));
414
+ });
415
+ }
416
+ return t;
417
+ }
418
+ function Ee(t, e, n) {
419
+ return e = Oe(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
420
+ }
421
+ function Oe(t) {
422
+ var e = Pe(t, "string");
423
+ return typeof e == "symbol" ? e : e + "";
424
+ }
425
+ function Pe(t, e) {
426
+ if (typeof t != "object" || !t) return t;
427
+ var n = t[Symbol.toPrimitive];
428
+ if (n !== void 0) {
429
+ var l = n.call(t, e);
430
+ if (typeof l != "object") return l;
431
+ throw new TypeError("@@toPrimitive must return a primitive value.");
432
+ }
433
+ return (e === "string" ? String : Number)(t);
434
+ }
435
+ function re(t) {
436
+ return t && t.map((e, n) => /* @__PURE__ */ R.createElement(e.tag, z({
437
+ key: n
438
+ }, e.attr), re(e.child)));
439
+ }
440
+ function ie(t) {
441
+ return (e) => /* @__PURE__ */ R.createElement(Re, D({
442
+ attr: z({}, t.attr)
443
+ }, e), re(t.child));
444
+ }
445
+ function Re(t) {
446
+ var e = (n) => {
447
+ var {
448
+ attr: l,
449
+ size: o,
450
+ title: r
451
+ } = t, c = Ne(t, xe), a = o || n.size || "1em", i;
452
+ return n.className && (i = n.className), t.className && (i = (i ? i + " " : "") + t.className), /* @__PURE__ */ R.createElement("svg", D({
453
+ stroke: "currentColor",
454
+ fill: "currentColor",
455
+ strokeWidth: "0"
456
+ }, n.attr, l, c, {
457
+ className: i,
458
+ style: z(z({
459
+ color: t.color || n.color
460
+ }, n.style), t.style),
461
+ height: a,
462
+ width: a,
463
+ xmlns: "http://www.w3.org/2000/svg"
464
+ }), r && /* @__PURE__ */ R.createElement("title", null, r), t.children);
465
+ };
466
+ return X !== void 0 ? /* @__PURE__ */ R.createElement(X.Consumer, null, (n) => e(n)) : e(le);
467
+ }
468
+ function Te(t) {
469
+ return ie({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z" }, child: [] }] })(t);
470
+ }
471
+ function ke(t) {
472
+ return ie({ attr: { version: "1.1", x: "0px", y: "0px", viewBox: "0 0 48 48", enableBackground: "new 0 0 48 48" }, child: [{ tag: "path", attr: { fill: "#FFC107", d: `M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12\r
473
+ c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24\r
474
+ c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z` }, child: [] }, { tag: "path", attr: { fill: "#FF3D00", d: `M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657\r
475
+ C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z` }, child: [] }, { tag: "path", attr: { fill: "#4CAF50", d: `M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36\r
476
+ c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z` }, child: [] }, { tag: "path", attr: { fill: "#1976D2", d: `M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571\r
477
+ c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z` }, child: [] }] })(t);
478
+ }
479
+ function Xe(t) {
480
+ const e = x.c(20), {
481
+ onContinueWithMobile: n,
482
+ onContinueWithEmail: l,
483
+ onContinueWithGoogle: o,
484
+ onContinueWithApple: r,
485
+ googleClientId: c,
486
+ onGoogleCredential: a
487
+ } = t, i = Fe, u = !!c && typeof a == "function";
488
+ let m;
489
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = i("Continue with Mobile"), e[0] = m) : m = e[0];
490
+ let s;
491
+ e[1] !== n ? (s = /* @__PURE__ */ f(N, { variant: "outline", size: "large", fullWidth: !0, onClick: n, children: m }), e[1] = n, e[2] = s) : s = e[2];
492
+ let d;
493
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = i("Continue with Email"), e[3] = d) : d = e[3];
494
+ let g;
495
+ e[4] !== l ? (g = /* @__PURE__ */ f(N, { variant: "outline", size: "large", fullWidth: !0, onClick: l, children: d }), e[4] = l, e[5] = g) : g = e[5];
496
+ let p;
497
+ e[6] !== c || e[7] !== o || e[8] !== a || e[9] !== u ? (p = u ? /* @__PURE__ */ f(be, { clientId: c, onCredential: a }) : /* @__PURE__ */ f(N, { variant: "outline", size: "large", fullWidth: !0, icon: /* @__PURE__ */ f(ke, { "aria-hidden": "true" }), iconPosition: "left", onClick: o, children: i("Continue with Google") }), e[6] = c, e[7] = o, e[8] = a, e[9] = u, e[10] = p) : p = e[10];
498
+ let h;
499
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ f(Te, { "aria-hidden": "true" }), e[11] = h) : h = e[11];
500
+ let b;
501
+ e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = i("Continue with Apple"), e[12] = b) : b = e[12];
502
+ let v;
503
+ e[13] !== r ? (v = /* @__PURE__ */ f(N, { variant: "outline", size: "large", fullWidth: !0, icon: h, iconPosition: "left", onClick: r, children: b }), e[13] = r, e[14] = v) : v = e[14];
504
+ let y;
505
+ return e[15] !== s || e[16] !== g || e[17] !== p || e[18] !== v ? (y = /* @__PURE__ */ w("div", { className: "w-full flex flex-col gap-[12px]", children: [
506
+ s,
507
+ g,
508
+ p,
509
+ v
510
+ ] }), e[15] = s, e[16] = g, e[17] = p, e[18] = v, e[19] = y) : y = e[19], y;
511
+ }
512
+ function Fe(t) {
513
+ return /* @__PURE__ */ f(P, { variant: "textLabel1", weight: "semiBold", align: "center", className: "opacity-80", children: t });
514
+ }
515
+ function Ie(t) {
516
+ const e = x.c(9), {
517
+ name: n,
518
+ label: l,
519
+ className: o,
520
+ control: r,
521
+ length: c,
522
+ inputClassName: a
523
+ } = t, i = c === void 0 ? 6 : c, u = H(), m = r || u.control;
524
+ let s;
525
+ e[0] !== o || e[1] !== a || e[2] !== l || e[3] !== i ? (s = (g) => {
526
+ const {
527
+ field: p,
528
+ fieldState: h
529
+ } = g;
530
+ return /* @__PURE__ */ w("div", { children: [
531
+ l && /* @__PURE__ */ f("label", { className: "block mb-1", children: l }),
532
+ /* @__PURE__ */ f(ue, { length: i, value: p.value || [], onChange: p.onChange, ...o && {
533
+ className: o
534
+ }, ...a && {
535
+ inputClassName: a
536
+ }, ...h.error?.message !== void 0 && h.error?.message !== "" && {
537
+ error: h.error.message
538
+ } })
539
+ ] });
540
+ }, e[0] = o, e[1] = a, e[2] = l, e[3] = i, e[4] = s) : s = e[4];
541
+ let d;
542
+ return e[5] !== n || e[6] !== m || e[7] !== s ? (d = /* @__PURE__ */ f(V, { name: n, control: m, render: s }), e[5] = n, e[6] = m, e[7] = s, e[8] = d) : d = e[8], d;
543
+ }
544
+ const L = 6, ee = 120, je = _.object({
545
+ otp: _.array(_.string()).length(L, "Enter all 6 digits").refine((t) => t.every((e) => /^\d$/.test(e)) && t.join("").length === L, "Invalid OTP! Please use correct code and submit again.")
546
+ }), De = {
547
+ phone: "6 digit OTP has been sent to your Mobile",
548
+ email: "6 digit OTP has been sent to your Email"
549
+ };
550
+ function ze(t) {
551
+ const e = x.c(24);
552
+ let n;
553
+ e[0] !== t ? (n = t === void 0 ? {} : t, e[0] = t, e[1] = n) : n = e[1];
554
+ const {
555
+ onSubmit: l,
556
+ onResendCode: o
557
+ } = n, [r, c] = de(ee), a = r <= 0;
558
+ let i;
559
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = Array.from({
560
+ length: L
561
+ }, qe), e[2] = i) : i = e[2];
562
+ const u = i;
563
+ let m;
564
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = {
565
+ defaultValues: {
566
+ otp: u
567
+ },
568
+ mode: "onSubmit"
569
+ }, e[3] = m) : m = e[3];
570
+ const s = q(m);
571
+ let d, g;
572
+ e[4] !== r ? (d = () => {
573
+ if (r <= 0)
574
+ return;
575
+ const $ = setInterval(() => {
576
+ c(Le);
577
+ }, 1e3);
578
+ return () => clearInterval($);
579
+ }, g = [r], e[4] = r, e[5] = d, e[6] = g) : (d = e[5], g = e[6]), U(d, g);
580
+ let p;
581
+ e[7] !== s || e[8] !== l ? (p = ($) => {
582
+ const G = je.safeParse($);
583
+ if (!G.success) {
584
+ const ae = G.error.issues[0]?.message ?? "Invalid OTP";
585
+ s.setError("otp", {
586
+ message: ae
587
+ });
588
+ return;
589
+ }
590
+ const oe = G.data.otp.join("");
591
+ l?.(oe);
592
+ }, e[7] = s, e[8] = l, e[9] = p) : p = e[9];
593
+ const h = p;
594
+ let b;
595
+ e[10] !== a || e[11] !== o ? (b = () => {
596
+ a && (o?.(), c(ee));
597
+ }, e[10] = a, e[11] = o, e[12] = b) : b = e[12];
598
+ const v = b, y = Math.floor(r / 60), E = r % 60, S = String(y);
599
+ let C;
600
+ e[13] !== S ? (C = S.padStart(2, "0"), e[13] = S, e[14] = C) : C = e[14];
601
+ const O = String(E);
602
+ let T;
603
+ e[15] !== O ? (T = O.padStart(2, "0"), e[15] = O, e[16] = T) : T = e[16];
604
+ const M = `Resend code in: ${C}:${T}`;
605
+ let F;
606
+ return e[17] !== a || e[18] !== v || e[19] !== h || e[20] !== s || e[21] !== r || e[22] !== M ? (F = {
607
+ methods: s,
608
+ handleSubmit: h,
609
+ handleResend: v,
610
+ resendSecondsLeft: r,
611
+ canResend: a,
612
+ timerText: M
613
+ }, e[17] = a, e[18] = v, e[19] = h, e[20] = s, e[21] = r, e[22] = M, e[23] = F) : F = e[23], F;
614
+ }
615
+ function Le(t) {
616
+ return t <= 1 ? 0 : t - 1;
617
+ }
618
+ function qe() {
619
+ return "";
620
+ }
621
+ function Ze(t) {
622
+ const e = x.c(24), {
623
+ mode: n,
624
+ title: l,
625
+ recipientDisplay: o,
626
+ onSubmit: r,
627
+ onResendCode: c
628
+ } = t;
629
+ let a;
630
+ e[0] !== c || e[1] !== r ? (a = {
631
+ onSubmit: r,
632
+ onResendCode: c
633
+ }, e[0] = c, e[1] = r, e[2] = a) : a = e[2];
634
+ const {
635
+ methods: i,
636
+ handleSubmit: u,
637
+ handleResend: m,
638
+ canResend: s,
639
+ timerText: d
640
+ } = ze(a), g = l ?? De[n];
641
+ let p;
642
+ e[3] !== u || e[4] !== i ? (p = i.handleSubmit(u), e[3] = u, e[4] = i, e[5] = p) : p = e[5];
643
+ let h;
644
+ e[6] !== g ? (h = /* @__PURE__ */ f(P, { variant: "h5", weight: "extraBold", align: "left", className: "mb-2 text-black", children: g }), e[6] = g, e[7] = h) : h = e[7];
645
+ let b;
646
+ e[8] !== o ? (b = /* @__PURE__ */ f(P, { variant: "title2", align: "left", className: "mb-6 text-black/80", children: o }), e[8] = o, e[9] = b) : b = e[9];
647
+ let v;
648
+ e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ f("div", { className: "mb-4 flex w-full flex-col gap-[12px]", children: /* @__PURE__ */ f(Ie, { name: "otp", length: L }) }), e[10] = v) : v = e[10];
649
+ let y;
650
+ e[11] !== s || e[12] !== m || e[13] !== d ? (y = /* @__PURE__ */ f("div", { className: "mb-6 flex items-center gap-2", children: s ? /* @__PURE__ */ f(N, { type: "button", variant: "outline", size: "medium", onClick: m, children: "Resend Code" }) : /* @__PURE__ */ f(P, { variant: "body2", align: "left", className: "text-black/80", children: d }) }), e[11] = s, e[12] = m, e[13] = d, e[14] = y) : y = e[14];
651
+ let E;
652
+ e[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ f(N, { type: "submit", variant: "primary", size: "large", fullWidth: !0, children: "Submit" }), e[15] = E) : E = e[15];
653
+ let S;
654
+ e[16] !== p || e[17] !== h || e[18] !== b || e[19] !== y ? (S = /* @__PURE__ */ w("form", { onSubmit: p, className: "flex w-full flex-col", children: [
655
+ h,
656
+ b,
657
+ v,
658
+ y,
659
+ E
660
+ ] }), e[16] = p, e[17] = h, e[18] = b, e[19] = y, e[20] = S) : S = e[20];
661
+ let C;
662
+ return e[21] !== i || e[22] !== S ? (C = /* @__PURE__ */ f(W, { ...i, children: S }), e[21] = i, e[22] = S, e[23] = C) : C = e[23], C;
663
+ }
664
+ function et(t) {
665
+ const e = x.c(11), {
666
+ lastUsedMethod: n,
667
+ onContinueWithLastMethod: l,
668
+ onUseAnotherMethod: o
669
+ } = t, c = `Continue with ${n === void 0 ? "Mobile" : n}`;
670
+ let a;
671
+ e[0] !== c ? (a = /* @__PURE__ */ f(P, { variant: "textLabel1", weight: "semiBold", align: "center", className: "text-white", children: c }), e[0] = c, e[1] = a) : a = e[1];
672
+ let i;
673
+ e[2] !== l || e[3] !== a ? (i = /* @__PURE__ */ f(N, { variant: "primary", size: "large", fullWidth: !0, onClick: l, children: a }), e[2] = l, e[3] = a, e[4] = i) : i = e[4];
674
+ let u;
675
+ e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ f(P, { variant: "textLabel1", weight: "semiBold", align: "center", className: "opacity-80", children: "Use another method" }), e[5] = u) : u = e[5];
676
+ let m;
677
+ e[6] !== o ? (m = /* @__PURE__ */ f(N, { variant: "outline", size: "large", fullWidth: !0, onClick: o, children: u }), e[6] = o, e[7] = m) : m = e[7];
678
+ let s;
679
+ return e[8] !== i || e[9] !== m ? (s = /* @__PURE__ */ w("div", { className: "w-full flex flex-col gap-[12px]", children: [
680
+ i,
681
+ m
682
+ ] }), e[8] = i, e[9] = m, e[10] = s) : s = e[10], s;
683
+ }
684
+ const We = _.object({
685
+ fullName: _.string().min(1, "Full name is required"),
686
+ phone: _.string().min(1, "Phone number is required")
687
+ }), Me = _.object({
688
+ fullName: _.string().min(1, "Full name is required"),
689
+ email: _.string().min(1, "Email is required").email("Enter a valid email address")
690
+ }), $e = {
691
+ phone: We,
692
+ email: Me
693
+ };
694
+ function Ge(t) {
695
+ const e = x.c(12), {
696
+ mode: n,
697
+ onSubmit: l
698
+ } = t, o = n === "phone";
699
+ let r;
700
+ e[0] !== o ? (r = o ? {
701
+ fullName: "",
702
+ phone: ""
703
+ } : {
704
+ fullName: "",
705
+ email: ""
706
+ }, e[0] = o, e[1] = r) : r = e[1];
707
+ const c = r;
708
+ let a;
709
+ e[2] !== c ? (a = {
710
+ defaultValues: c,
711
+ mode: "onSubmit"
712
+ }, e[2] = c, e[3] = a) : a = e[3];
713
+ const i = q(a);
714
+ let u;
715
+ e[4] !== i || e[5] !== n || e[6] !== l ? (u = (d) => {
716
+ const p = $e[n].safeParse(d);
717
+ if (!p.success) {
718
+ for (const b of p.error.issues) {
719
+ const v = b.path[0];
720
+ typeof v == "string" && i.setError(v, {
721
+ message: b.message
722
+ });
723
+ }
724
+ return;
725
+ }
726
+ const h = p.data;
727
+ l?.({
728
+ fullName: h.fullName,
729
+ ..."phone" in h && {
730
+ phone: h.phone
731
+ },
732
+ ..."email" in h && {
733
+ email: h.email
734
+ }
735
+ });
736
+ }, e[4] = i, e[5] = n, e[6] = l, e[7] = u) : u = e[7];
737
+ const m = u;
738
+ let s;
739
+ return e[8] !== m || e[9] !== o || e[10] !== i ? (s = {
740
+ methods: i,
741
+ handleSubmit: m,
742
+ isPhone: o
743
+ }, e[8] = m, e[9] = o, e[10] = i, e[11] = s) : s = e[11], s;
744
+ }
745
+ function tt(t) {
746
+ const e = x.c(16), {
747
+ mode: n,
748
+ onSubmit: l
749
+ } = t;
750
+ let o;
751
+ e[0] !== n || e[1] !== l ? (o = {
752
+ mode: n,
753
+ onSubmit: l
754
+ }, e[0] = n, e[1] = l, e[2] = o) : o = e[2];
755
+ const {
756
+ methods: r,
757
+ handleSubmit: c,
758
+ isPhone: a
759
+ } = Ge(o);
760
+ let i;
761
+ e[3] !== c || e[4] !== r ? (i = r.handleSubmit(c), e[3] = c, e[4] = r, e[5] = i) : i = e[5];
762
+ let u;
763
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ f(k, { name: "fullName", placeholder: "Full name*", required: !0, type: "text", className: "w-full" }), e[6] = u) : u = e[6];
764
+ let m;
765
+ e[7] !== a ? (m = /* @__PURE__ */ w("div", { className: "mb-6 flex w-full flex-col gap-[12px]", children: [
766
+ u,
767
+ a ? /* @__PURE__ */ f(ne, { name: "phone", placeholder: "Phone number", required: !0, defaultCountry: "IN" }) : /* @__PURE__ */ f(k, { name: "email", placeholder: "Email address", type: "email", className: "w-full" })
768
+ ] }), e[7] = a, e[8] = m) : m = e[8];
769
+ let s;
770
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ f(N, { type: "submit", variant: "primary", size: "large", fullWidth: !0, children: "Continue" }), e[9] = s) : s = e[9];
771
+ let d;
772
+ e[10] !== i || e[11] !== m ? (d = /* @__PURE__ */ w("form", { onSubmit: i, className: "w-full flex flex-col items-center", children: [
773
+ m,
774
+ s
775
+ ] }), e[10] = i, e[11] = m, e[12] = d) : d = e[12];
776
+ let g;
777
+ return e[13] !== r || e[14] !== d ? (g = /* @__PURE__ */ f(W, { ...r, children: d }), e[13] = r, e[14] = d, e[15] = g) : g = e[15], g;
778
+ }
779
+ export {
780
+ Ke as C,
781
+ De as D,
782
+ Je as F,
783
+ be as G,
784
+ Qe as L,
785
+ Xe as M,
786
+ Ze as O,
787
+ et as R,
788
+ tt as S,
789
+ L as a,
790
+ ee as b,
791
+ x as c,
792
+ ge as d,
793
+ _e as e,
794
+ ze as f,
795
+ Ge as g,
796
+ Ye as u
797
+ };