@better-auth-ui/heroui 1.6.8 → 1.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/dist/components/auth/api-key/api-key.d.ts +5 -1
  2. package/dist/components/auth/api-key/api-keys-empty.d.ts +3 -1
  3. package/dist/components/auth/api-key/api-keys.d.ts +9 -1
  4. package/dist/components/auth/api-key/create-api-key-dialog.d.ts +3 -1
  5. package/dist/components/auth/api-key/delete-api-key-dialog.d.ts +3 -1
  6. package/dist/components/auth/api-key/organization-api-keys.d.ts +14 -0
  7. package/dist/components/auth/delete-user/danger-zone.d.ts +1 -1
  8. package/dist/components/auth/delete-user/{delete-user.d.ts → delete-account.d.ts} +2 -2
  9. package/dist/components/auth/email/organization-invitation-email.d.ts +3 -0
  10. package/dist/components/auth/multi-session/switch-account-submenu-content.d.ts +3 -1
  11. package/dist/components/auth/multi-session/switch-account-submenu-item.d.ts +2 -1
  12. package/dist/components/auth/multi-session/switch-account-submenu.d.ts +2 -1
  13. package/dist/components/auth/organization/change-organization-logo.d.ts +4 -0
  14. package/dist/components/auth/organization/create-organization-dialog.d.ts +13 -0
  15. package/dist/components/auth/organization/delete-organization-dialog.d.ts +7 -0
  16. package/dist/components/auth/organization/delete-organization-skeleton.d.ts +4 -0
  17. package/dist/components/auth/organization/delete-organization.d.ts +5 -0
  18. package/dist/components/auth/organization/invite-member-dialog.d.ts +13 -0
  19. package/dist/components/auth/organization/leave-organization-dialog.d.ts +7 -0
  20. package/dist/components/auth/organization/leave-organization.d.ts +4 -0
  21. package/dist/components/auth/organization/organization-danger-zone.d.ts +16 -0
  22. package/dist/components/auth/organization/organization-invitation-row-skeleton.d.ts +5 -0
  23. package/dist/components/auth/organization/organization-invitation-row.d.ts +5 -0
  24. package/dist/components/auth/organization/organization-invitations-empty.d.ts +8 -0
  25. package/dist/components/auth/organization/organization-invitations.d.ts +9 -0
  26. package/dist/components/auth/organization/organization-logo.d.ts +15 -0
  27. package/dist/components/auth/organization/organization-member-row-skeleton.d.ts +4 -0
  28. package/dist/components/auth/organization/organization-member-row.d.ts +9 -0
  29. package/dist/components/auth/organization/organization-members.d.ts +9 -0
  30. package/dist/components/auth/organization/organization-people.d.ts +10 -0
  31. package/dist/components/auth/organization/organization-profile.d.ts +9 -0
  32. package/dist/components/auth/organization/organization-row.d.ts +8 -0
  33. package/dist/components/auth/organization/organization-settings.d.ts +12 -0
  34. package/dist/components/auth/organization/organization-switcher.d.ts +20 -0
  35. package/dist/components/auth/organization/organization-view-skeleton.d.ts +6 -0
  36. package/dist/components/auth/organization/organization-view.d.ts +15 -0
  37. package/dist/components/auth/organization/organization.d.ts +17 -0
  38. package/dist/components/auth/organization/organizations-empty.d.ts +4 -0
  39. package/dist/components/auth/organization/organizations-settings.d.ts +17 -0
  40. package/dist/components/auth/organization/organizations.d.ts +10 -0
  41. package/dist/components/auth/organization/remove-member-dialog.d.ts +9 -0
  42. package/dist/components/auth/organization/slug-field.d.ts +19 -0
  43. package/dist/components/auth/organization/user-invitation-row-skeleton.d.ts +4 -0
  44. package/dist/components/auth/organization/user-invitation-row.d.ts +10 -0
  45. package/dist/components/auth/organization/user-invitations-empty.d.ts +4 -0
  46. package/dist/components/auth/organization/user-invitations.d.ts +10 -0
  47. package/dist/components/auth/settings/settings.d.ts +1 -1
  48. package/dist/components/auth/user/user-avatar.d.ts +1 -1
  49. package/dist/components/auth/user/user-button.d.ts +4 -5
  50. package/dist/components/auth/user/user-view.d.ts +10 -4
  51. package/dist/email.d.ts +1 -0
  52. package/dist/email.js +211 -8
  53. package/dist/index.js +1682 -22
  54. package/dist/lib/auth/api-key-plugin.d.ts +5 -2
  55. package/dist/lib/auth/auth-plugin.d.ts +6 -2
  56. package/dist/lib/auth/delete-user-plugin.d.ts +4 -4
  57. package/dist/lib/auth/magic-link-plugin.d.ts +2 -2
  58. package/dist/lib/auth/multi-session-plugin.d.ts +2 -2
  59. package/dist/lib/auth/organization-plugin.d.ts +37 -0
  60. package/dist/lib/auth/passkey-plugin.d.ts +2 -2
  61. package/dist/lib/auth/theme-plugin.d.ts +3 -3
  62. package/dist/lib/auth/username-plugin.d.ts +8 -8
  63. package/dist/plugins.d.ts +25 -1
  64. package/dist/plugins.js +2824 -22
  65. package/dist/user-view--47tVtJ3.js +113 -0
  66. package/package.json +23 -18
  67. package/src/components/auth/api-key/api-key.tsx +25 -16
  68. package/src/components/auth/api-key/api-keys-empty.tsx +8 -4
  69. package/src/components/auth/api-key/api-keys.tsx +52 -14
  70. package/src/components/auth/api-key/create-api-key-dialog.tsx +15 -2
  71. package/src/components/auth/api-key/delete-api-key-dialog.tsx +10 -2
  72. package/src/components/auth/api-key/organization-api-keys.tsx +55 -0
  73. package/src/components/auth/delete-user/danger-zone.tsx +3 -3
  74. package/src/components/auth/delete-user/{delete-user.tsx → delete-account.tsx} +9 -9
  75. package/src/components/auth/email/organization-invitation-email.tsx +38 -0
  76. package/src/components/auth/error-toaster.tsx +28 -10
  77. package/src/components/auth/forgot-password.tsx +10 -2
  78. package/src/components/auth/multi-session/manage-accounts.tsx +1 -1
  79. package/src/components/auth/multi-session/switch-account-submenu-content.tsx +7 -2
  80. package/src/components/auth/multi-session/switch-account-submenu-item.tsx +4 -2
  81. package/src/components/auth/multi-session/switch-account-submenu.tsx +8 -4
  82. package/src/components/auth/organization/change-organization-logo.tsx +171 -0
  83. package/src/components/auth/organization/create-organization-dialog.tsx +133 -0
  84. package/src/components/auth/organization/delete-organization-dialog.tsx +97 -0
  85. package/src/components/auth/organization/delete-organization-skeleton.tsx +17 -0
  86. package/src/components/auth/organization/delete-organization.tsx +77 -0
  87. package/src/components/auth/organization/invite-member-dialog.tsx +177 -0
  88. package/src/components/auth/organization/leave-organization-dialog.tsx +95 -0
  89. package/src/components/auth/organization/leave-organization.tsx +59 -0
  90. package/src/components/auth/organization/organization-danger-zone.tsx +68 -0
  91. package/src/components/auth/organization/organization-invitation-row-skeleton.tsx +29 -0
  92. package/src/components/auth/organization/organization-invitation-row.tsx +97 -0
  93. package/src/components/auth/organization/organization-invitations-empty.tsx +39 -0
  94. package/src/components/auth/organization/organization-invitations.tsx +351 -0
  95. package/src/components/auth/organization/organization-logo.tsx +64 -0
  96. package/src/components/auth/organization/organization-member-row-skeleton.tsx +24 -0
  97. package/src/components/auth/organization/organization-member-row.tsx +157 -0
  98. package/src/components/auth/organization/organization-members.tsx +284 -0
  99. package/src/components/auth/organization/organization-people.tsx +26 -0
  100. package/src/components/auth/organization/organization-profile.tsx +141 -0
  101. package/src/components/auth/organization/organization-row.tsx +66 -0
  102. package/src/components/auth/organization/organization-settings.tsx +38 -0
  103. package/src/components/auth/organization/organization-switcher.tsx +233 -0
  104. package/src/components/auth/organization/organization-view-skeleton.tsx +36 -0
  105. package/src/components/auth/organization/organization-view.tsx +109 -0
  106. package/src/components/auth/organization/organization.tsx +162 -0
  107. package/src/components/auth/organization/organizations-empty.tsx +35 -0
  108. package/src/components/auth/organization/organizations-settings.tsx +36 -0
  109. package/src/components/auth/organization/organizations.tsx +80 -0
  110. package/src/components/auth/organization/remove-member-dialog.tsx +95 -0
  111. package/src/components/auth/organization/slug-field.tsx +111 -0
  112. package/src/components/auth/organization/user-invitation-row-skeleton.tsx +17 -0
  113. package/src/components/auth/organization/user-invitation-row.tsx +90 -0
  114. package/src/components/auth/organization/user-invitations-empty.tsx +30 -0
  115. package/src/components/auth/organization/user-invitations.tsx +59 -0
  116. package/src/components/auth/settings/account/change-email.tsx +1 -1
  117. package/src/components/auth/settings/account/user-profile.tsx +5 -5
  118. package/src/components/auth/settings/security/active-sessions.tsx +6 -4
  119. package/src/components/auth/settings/security/linked-accounts.tsx +2 -2
  120. package/src/components/auth/settings/settings.tsx +77 -14
  121. package/src/components/auth/user/user-avatar.tsx +4 -1
  122. package/src/components/auth/user/user-button.tsx +14 -11
  123. package/src/components/auth/user/user-view.tsx +32 -12
  124. package/src/email.ts +1 -0
  125. package/src/lib/auth/api-key-plugin.ts +10 -4
  126. package/src/lib/auth/auth-plugin.ts +6 -1
  127. package/src/lib/auth/organization-plugin.tsx +32 -0
  128. package/src/plugins.ts +25 -1
  129. package/dist/components/auth/additional-field.js +0 -270
  130. package/dist/components/auth/api-key/api-key-skeleton.js +0 -21
  131. package/dist/components/auth/api-key/api-key.js +0 -55
  132. package/dist/components/auth/api-key/api-keys-empty.js +0 -35
  133. package/dist/components/auth/api-key/api-keys.js +0 -41
  134. package/dist/components/auth/api-key/create-api-key-dialog.js +0 -74
  135. package/dist/components/auth/api-key/delete-api-key-dialog.js +0 -51
  136. package/dist/components/auth/api-key/new-api-key-dialog.js +0 -60
  137. package/dist/components/auth/auth-provider.js +0 -17
  138. package/dist/components/auth/auth.js +0 -63
  139. package/dist/components/auth/delete-user/danger-zone.js +0 -18
  140. package/dist/components/auth/delete-user/delete-user.js +0 -95
  141. package/dist/components/auth/email/email-changed-email.js +0 -30
  142. package/dist/components/auth/email/email-verification-email.js +0 -30
  143. package/dist/components/auth/email/magic-link-email.js +0 -30
  144. package/dist/components/auth/email/new-device-email.js +0 -30
  145. package/dist/components/auth/email/otp-email.js +0 -29
  146. package/dist/components/auth/email/password-changed-email.js +0 -30
  147. package/dist/components/auth/email/reset-password-email.js +0 -30
  148. package/dist/components/auth/error-toaster.js +0 -17
  149. package/dist/components/auth/field-separator.js +0 -18
  150. package/dist/components/auth/forgot-password.js +0 -89
  151. package/dist/components/auth/magic-link/magic-link-button.js +0 -20
  152. package/dist/components/auth/magic-link/magic-link.js +0 -87
  153. package/dist/components/auth/multi-session/manage-account.js +0 -49
  154. package/dist/components/auth/multi-session/manage-accounts.js +0 -34
  155. package/dist/components/auth/multi-session/switch-account-submenu-content.js +0 -28
  156. package/dist/components/auth/multi-session/switch-account-submenu-item.js +0 -20
  157. package/dist/components/auth/multi-session/switch-account-submenu.js +0 -24
  158. package/dist/components/auth/passkey/add-passkey-dialog.js +0 -65
  159. package/dist/components/auth/passkey/delete-passkey-dialog.js +0 -47
  160. package/dist/components/auth/passkey/passkey-button.js +0 -24
  161. package/dist/components/auth/passkey/passkey-skeleton.js +0 -17
  162. package/dist/components/auth/passkey/passkey.js +0 -48
  163. package/dist/components/auth/passkey/passkeys-empty.js +0 -35
  164. package/dist/components/auth/passkey/passkeys.js +0 -42
  165. package/dist/components/auth/provider-button.js +0 -25
  166. package/dist/components/auth/provider-buttons.js +0 -19
  167. package/dist/components/auth/reset-password.js +0 -147
  168. package/dist/components/auth/settings/account/account-settings.js +0 -20
  169. package/dist/components/auth/settings/account/change-avatar.js +0 -89
  170. package/dist/components/auth/settings/account/change-email.js +0 -54
  171. package/dist/components/auth/settings/account/user-profile.js +0 -86
  172. package/dist/components/auth/settings/security/active-session.js +0 -59
  173. package/dist/components/auth/settings/security/active-sessions.js +0 -34
  174. package/dist/components/auth/settings/security/change-password.js +0 -189
  175. package/dist/components/auth/settings/security/linked-account.js +0 -56
  176. package/dist/components/auth/settings/security/linked-accounts.js +0 -45
  177. package/dist/components/auth/settings/security/security-settings.js +0 -22
  178. package/dist/components/auth/settings/settings.js +0 -45
  179. package/dist/components/auth/sign-in.js +0 -133
  180. package/dist/components/auth/sign-out.js +0 -27
  181. package/dist/components/auth/sign-up.js +0 -212
  182. package/dist/components/auth/theme/appearance.js +0 -72
  183. package/dist/components/auth/theme/theme-toggle-item.js +0 -62
  184. package/dist/components/auth/user/user-avatar.js +0 -29
  185. package/dist/components/auth/user/user-button.js +0 -74
  186. package/dist/components/auth/user/user-view.js +0 -37
  187. package/dist/components/auth/username/sign-in-username.js +0 -148
  188. package/dist/components/auth/username/username-field.js +0 -53
  189. package/dist/lib/auth/api-key-plugin.js +0 -10
  190. package/dist/lib/auth/delete-user-plugin.js +0 -10
  191. package/dist/lib/auth/magic-link-plugin.js +0 -13
  192. package/dist/lib/auth/multi-session-plugin.js +0 -12
  193. package/dist/lib/auth/passkey-plugin.js +0 -12
  194. package/dist/lib/auth/theme-plugin.js +0 -23
  195. package/dist/lib/auth/username-plugin.js +0 -18
package/dist/index.js CHANGED
@@ -1,23 +1,1683 @@
1
1
  "use client";
2
- import { AdditionalField as e } from "./components/auth/additional-field.js";
3
- import { ForgotPassword as t } from "./components/auth/forgot-password.js";
4
- import { ResetPassword as n } from "./components/auth/reset-password.js";
5
- import { ProviderButton as r } from "./components/auth/provider-button.js";
6
- import { ProviderButtons as i } from "./components/auth/provider-buttons.js";
7
- import { SignIn as a } from "./components/auth/sign-in.js";
8
- import { SignOut as o } from "./components/auth/sign-out.js";
9
- import { SignUp as s } from "./components/auth/sign-up.js";
10
- import { Auth as c } from "./components/auth/auth.js";
11
- import { AuthProvider as l } from "./components/auth/auth-provider.js";
12
- import { ChangeEmail as u } from "./components/auth/settings/account/change-email.js";
13
- import { UserAvatar as d } from "./components/auth/user/user-avatar.js";
14
- import { UserProfile as f } from "./components/auth/settings/account/user-profile.js";
15
- import { AccountSettings as p } from "./components/auth/settings/account/account-settings.js";
16
- import { ActiveSessions as m } from "./components/auth/settings/security/active-sessions.js";
17
- import { ChangePassword as h } from "./components/auth/settings/security/change-password.js";
18
- import { LinkedAccounts as g } from "./components/auth/settings/security/linked-accounts.js";
19
- import { SecuritySettings as _ } from "./components/auth/settings/security/security-settings.js";
20
- import { Settings as v } from "./components/auth/settings/settings.js";
21
- import { UserView as y } from "./components/auth/user/user-view.js";
22
- import { UserButton as b } from "./components/auth/user/user-button.js";
23
- export { p as AccountSettings, m as ActiveSessions, e as AdditionalField, c as Auth, l as AuthProvider, u as ChangeEmail, h as ChangePassword, t as ForgotPassword, g as LinkedAccounts, r as ProviderButton, i as ProviderButtons, n as ResetPassword, _ as SecuritySettings, v as Settings, a as SignIn, o as SignOut, s as SignUp, d as UserAvatar, b as UserButton, f as UserProfile, y as UserView };
2
+ import { a as e, i as t, n, r, t as i } from "./user-view--47tVtJ3.js";
3
+ import { authMutationKeys as a, authQueryKeys as o, fileToBase64 as s, getProviderName as c, parseAdditionalFieldValue as l, resolveInputType as u } from "@better-auth-ui/core";
4
+ import { AuthProvider as d, providerIcons as f, useAccountInfo as p, useAuth as m, useAuthenticate as h, useChangeEmail as g, useChangePassword as _, useFetchOptions as v, useLinkSocial as y, useListAccounts as b, useListSessions as ee, useRequestPasswordReset as x, useResetPassword as S, useRevokeSession as te, useSendVerificationEmail as ne, useSession as C, useSignInEmail as re, useSignOut as ie, useSignUpEmail as ae, useUnlinkAccount as w, useUpdateUser as oe } from "@better-auth-ui/react";
5
+ import { ArrowRightFromSquare as T, ArrowRightToSquare as se, Check as E, ChevronsExpandVertical as ce, CloudArrowUpIn as le, Copy as ue, Display as de, Eye as D, EyeSlash as O, Gear as fe, Link as pe, LinkSlash as me, Person as he, PersonPlus as ge, PlugConnection as _e, Shield as ve, Smartphone as ye, TrashBin as be, Xmark as xe } from "@gravity-ui/icons";
6
+ import { Button as k, Calendar as A, Card as j, Checkbox as M, Chip as Se, ComboBox as Ce, DateField as we, DatePicker as Te, Description as Ee, Dropdown as N, FieldError as P, Fieldset as F, Form as I, Input as L, InputGroup as R, Label as z, Link as B, ListBox as V, NumberField as H, RouterProvider as De, Select as U, Skeleton as W, Slider as Oe, Spinner as G, Switch as ke, Tabs as K, TextArea as Ae, TextField as q, TimeField as je, cn as J, toast as Y } from "@heroui/react";
7
+ import { fromDate as Me, getLocalTimeZone as Ne, parseDate as Pe, parseDateTime as Fe, toCalendarDate as Ie, toCalendarDateTime as Le } from "@internationalized/date";
8
+ import { isValidElement as Re, useEffect as ze, useMemo as Be, useRef as Ve, useState as X } from "react";
9
+ import { Fragment as Z, jsx as Q, jsxs as $ } from "react/jsx-runtime";
10
+ import { matchMutation as He, matchQuery as Ue, useIsMutating as We, useQueryClient as Ge } from "@tanstack/react-query";
11
+ import Ke from "bowser";
12
+ //#region src/components/auth/additional-field.tsx
13
+ function qe(e) {
14
+ if (e instanceof Date) return Ie(Me(e, Ne()));
15
+ if (typeof e == "string") try {
16
+ return Pe(e.slice(0, 10));
17
+ } catch {
18
+ return;
19
+ }
20
+ }
21
+ function Je(e) {
22
+ if (e instanceof Date) return Le(Me(e, Ne()));
23
+ if (typeof e == "string") try {
24
+ return Fe(e.replace(/(Z|[+-]\d{2}:?\d{2})$/, ""));
25
+ } catch {
26
+ return;
27
+ }
28
+ }
29
+ function Ye({ getValue: e, isDisabled: t }) {
30
+ let { localization: n } = m(), [r, i] = X(!1);
31
+ async function a() {
32
+ let t = e();
33
+ if (t) try {
34
+ await navigator.clipboard.writeText(t), i(!0), setTimeout(() => i(!1), 1500);
35
+ } catch (e) {
36
+ Y.danger(e instanceof Error ? e.message : String(e));
37
+ }
38
+ }
39
+ return /* @__PURE__ */ Q(k, {
40
+ isIconOnly: !0,
41
+ "aria-label": n.settings.copyToClipboard,
42
+ size: "sm",
43
+ variant: "ghost",
44
+ isDisabled: t,
45
+ onPress: a,
46
+ children: Q(r ? E : ue, { className: "size-4" })
47
+ });
48
+ }
49
+ function Xe({ name: e, field: t, isPending: n, variant: r }) {
50
+ let { localization: i } = m(), a = u(t), o = r === "transparent" ? "primary" : "secondary", s = Ve(null);
51
+ if (t.render) return /* @__PURE__ */ Q(Z, { children: t.render({
52
+ name: e,
53
+ field: t,
54
+ isPending: n,
55
+ variant: r
56
+ }) });
57
+ if (a === "hidden") return /* @__PURE__ */ Q("input", {
58
+ type: "hidden",
59
+ name: e,
60
+ value: t.defaultValue == null ? "" : t.defaultValue instanceof Date ? t.defaultValue.toISOString() : String(t.defaultValue)
61
+ });
62
+ if (a === "textarea") return /* @__PURE__ */ $(q, {
63
+ name: e,
64
+ defaultValue: t.defaultValue == null ? void 0 : String(t.defaultValue),
65
+ isDisabled: n,
66
+ isReadOnly: t.readOnly,
67
+ children: [
68
+ /* @__PURE__ */ Q(z, { children: t.label }),
69
+ /* @__PURE__ */ Q(Ae, {
70
+ placeholder: t.placeholder,
71
+ required: t.required,
72
+ variant: o
73
+ }),
74
+ /* @__PURE__ */ Q(P, {})
75
+ ]
76
+ });
77
+ if (a === "number") {
78
+ let r = t.formatOptions?.maximumFractionDigits;
79
+ return /* @__PURE__ */ $(H, {
80
+ name: e,
81
+ defaultValue: typeof t.defaultValue == "number" ? t.defaultValue : t.defaultValue != null && t.defaultValue !== "" ? Number(t.defaultValue) : void 0,
82
+ minValue: t.min,
83
+ maxValue: t.max,
84
+ step: t.step ?? (r ? 1 / 10 ** r : 1),
85
+ formatOptions: t.formatOptions,
86
+ isDisabled: n,
87
+ isReadOnly: t.readOnly,
88
+ variant: o,
89
+ children: [
90
+ /* @__PURE__ */ Q(z, { children: t.label }),
91
+ /* @__PURE__ */ $(H.Group, { children: [
92
+ /* @__PURE__ */ Q(H.DecrementButton, {}),
93
+ /* @__PURE__ */ Q(H.Input, {
94
+ placeholder: t.placeholder,
95
+ required: t.required
96
+ }),
97
+ /* @__PURE__ */ Q(H.IncrementButton, {})
98
+ ] }),
99
+ /* @__PURE__ */ Q(P, {})
100
+ ]
101
+ });
102
+ }
103
+ if (a === "slider") {
104
+ let r = t.formatOptions?.maximumFractionDigits;
105
+ return /* @__PURE__ */ $(Oe, {
106
+ defaultValue: typeof t.defaultValue == "number" ? t.defaultValue : t.defaultValue == null ? void 0 : Number(t.defaultValue),
107
+ minValue: t.min ?? 0,
108
+ maxValue: t.max ?? 100,
109
+ step: t.step ?? (r ? 1 / 10 ** r : 1),
110
+ formatOptions: t.formatOptions,
111
+ isDisabled: n || t.readOnly,
112
+ className: "flex flex-col gap-2",
113
+ children: [/* @__PURE__ */ $("div", {
114
+ className: "flex items-center justify-between gap-2",
115
+ children: [/* @__PURE__ */ Q(z, { children: t.label }), /* @__PURE__ */ Q(Oe.Output, { className: "text-sm text-muted" })]
116
+ }), /* @__PURE__ */ $(Oe.Track, { children: [/* @__PURE__ */ Q(Oe.Fill, {}), /* @__PURE__ */ Q(Oe.Thumb, { name: e })] })]
117
+ });
118
+ }
119
+ if (a === "switch") return /* @__PURE__ */ $(ke, {
120
+ name: e,
121
+ defaultSelected: t.defaultValue === !0 || t.defaultValue === "true",
122
+ isDisabled: n,
123
+ isReadOnly: t.readOnly,
124
+ children: [/* @__PURE__ */ Q(ke.Control, { children: /* @__PURE__ */ Q(ke.Thumb, {}) }), /* @__PURE__ */ Q(z, { children: t.label })]
125
+ });
126
+ if (a === "checkbox") return /* @__PURE__ */ $(M, {
127
+ name: e,
128
+ defaultSelected: t.defaultValue === !0 || t.defaultValue === "true",
129
+ isDisabled: n,
130
+ isReadOnly: t.readOnly,
131
+ isRequired: t.required,
132
+ variant: o,
133
+ children: [/* @__PURE__ */ Q(M.Control, { children: /* @__PURE__ */ Q(M.Indicator, {}) }), /* @__PURE__ */ Q(M.Content, { children: /* @__PURE__ */ Q(z, { children: t.label }) })]
134
+ });
135
+ if (a === "select") return /* @__PURE__ */ $(U, {
136
+ className: "[&[data-required=true]>.label]:after:content-none",
137
+ name: e,
138
+ defaultValue: t.defaultValue == null ? void 0 : String(t.defaultValue),
139
+ placeholder: t.placeholder,
140
+ isDisabled: n || t.readOnly,
141
+ isRequired: t.required,
142
+ variant: o,
143
+ fullWidth: !0,
144
+ children: [
145
+ /* @__PURE__ */ Q(z, { children: t.label }),
146
+ /* @__PURE__ */ $(U.Trigger, { children: [/* @__PURE__ */ Q(U.Value, {}), /* @__PURE__ */ Q(U.Indicator, {})] }),
147
+ /* @__PURE__ */ Q(U.Popover, { children: /* @__PURE__ */ Q(V, { children: t.options?.map((e) => /* @__PURE__ */ $(V.Item, {
148
+ id: e.value,
149
+ textValue: typeof e.label == "string" ? e.label : e.value,
150
+ children: [e.label, /* @__PURE__ */ Q(V.ItemIndicator, {})]
151
+ }, e.value)) }) }),
152
+ /* @__PURE__ */ Q(P, {})
153
+ ]
154
+ });
155
+ if (a === "combobox") return /* @__PURE__ */ $(Ce, {
156
+ className: "[&[data-required=true]>.label]:after:content-none",
157
+ name: e,
158
+ defaultSelectedKey: t.defaultValue == null ? void 0 : String(t.defaultValue),
159
+ isDisabled: n,
160
+ isReadOnly: t.readOnly,
161
+ isRequired: t.required,
162
+ variant: o,
163
+ fullWidth: !0,
164
+ children: [
165
+ /* @__PURE__ */ Q(z, { children: t.label }),
166
+ /* @__PURE__ */ $(Ce.InputGroup, { children: [/* @__PURE__ */ Q(L, { placeholder: t.placeholder }), /* @__PURE__ */ Q(Ce.Trigger, {})] }),
167
+ /* @__PURE__ */ Q(Ce.Popover, { children: /* @__PURE__ */ Q(V, { children: t.options?.map((e) => /* @__PURE__ */ $(V.Item, {
168
+ id: e.value,
169
+ textValue: typeof e.label == "string" ? e.label : e.value,
170
+ children: [e.label, /* @__PURE__ */ Q(V.ItemIndicator, {})]
171
+ }, e.value)) }) }),
172
+ /* @__PURE__ */ Q(P, {})
173
+ ]
174
+ });
175
+ if (a === "date" || a === "datetime") {
176
+ let r = a === "datetime";
177
+ return /* @__PURE__ */ Q(Te, {
178
+ className: "w-full [&[data-required=true]>.label]:after:content-none",
179
+ name: e,
180
+ defaultValue: r ? Je(t.defaultValue) : qe(t.defaultValue),
181
+ granularity: r ? "minute" : "day",
182
+ isDisabled: n,
183
+ isReadOnly: t.readOnly,
184
+ isRequired: t.required,
185
+ children: ({ state: n }) => /* @__PURE__ */ $(Z, { children: [
186
+ /* @__PURE__ */ Q(z, { children: t.label }),
187
+ /* @__PURE__ */ $(we.Group, {
188
+ variant: o,
189
+ fullWidth: !0,
190
+ children: [/* @__PURE__ */ Q(we.Input, { children: (e) => /* @__PURE__ */ Q(we.Segment, { segment: e }) }), /* @__PURE__ */ Q(we.Suffix, { children: /* @__PURE__ */ Q(Te.Trigger, { children: /* @__PURE__ */ Q(Te.TriggerIndicator, {}) }) })]
191
+ }),
192
+ /* @__PURE__ */ Q(P, {}),
193
+ /* @__PURE__ */ $(Te.Popover, {
194
+ className: "flex flex-col gap-3",
195
+ children: [/* @__PURE__ */ $(A, {
196
+ "aria-label": typeof t.label == "string" ? t.label : e,
197
+ children: [
198
+ /* @__PURE__ */ $(A.Header, { children: [
199
+ /* @__PURE__ */ $(A.YearPickerTrigger, { children: [/* @__PURE__ */ Q(A.YearPickerTriggerHeading, {}), /* @__PURE__ */ Q(A.YearPickerTriggerIndicator, {})] }),
200
+ /* @__PURE__ */ Q(A.NavButton, { slot: "previous" }),
201
+ /* @__PURE__ */ Q(A.NavButton, { slot: "next" })
202
+ ] }),
203
+ /* @__PURE__ */ $(A.Grid, { children: [/* @__PURE__ */ Q(A.GridHeader, { children: (e) => /* @__PURE__ */ Q(A.HeaderCell, { children: e }) }), /* @__PURE__ */ Q(A.GridBody, { children: (e) => /* @__PURE__ */ Q(A.Cell, { date: e }) })] }),
204
+ /* @__PURE__ */ Q(A.YearPickerGrid, { children: /* @__PURE__ */ Q(A.YearPickerGridBody, { children: ({ year: e }) => /* @__PURE__ */ Q(A.YearPickerCell, { year: e }) }) })
205
+ ]
206
+ }), r && /* @__PURE__ */ $("div", {
207
+ className: "flex items-center justify-between",
208
+ children: [/* @__PURE__ */ Q(z, { children: i.settings.time }), /* @__PURE__ */ Q(je, {
209
+ "aria-label": i.settings.time,
210
+ granularity: "minute",
211
+ value: n.timeValue,
212
+ onChange: (e) => n.setTimeValue(e),
213
+ children: /* @__PURE__ */ Q(je.Group, {
214
+ variant: "secondary",
215
+ children: /* @__PURE__ */ Q(je.Input, { children: (e) => /* @__PURE__ */ Q(je.Segment, { segment: e }) })
216
+ })
217
+ })]
218
+ })]
219
+ })
220
+ ] })
221
+ });
222
+ }
223
+ let c = t.prefix != null, l = t.suffix != null || t.copyable, d = t.type === "number", f = t.formatOptions?.maximumFractionDigits, p = d ? "number" : void 0, h = d ? f ? "decimal" : "numeric" : void 0, g = f ? 1 / 10 ** f : void 0;
224
+ return c || l ? /* @__PURE__ */ $(q, {
225
+ name: e,
226
+ defaultValue: t.defaultValue == null ? void 0 : String(t.defaultValue),
227
+ isDisabled: n,
228
+ isReadOnly: t.readOnly,
229
+ children: [
230
+ /* @__PURE__ */ Q(z, { children: t.label }),
231
+ /* @__PURE__ */ $(R, {
232
+ variant: o,
233
+ children: [
234
+ c && /* @__PURE__ */ Q(R.Prefix, { children: t.prefix }),
235
+ /* @__PURE__ */ Q(R.Input, {
236
+ ref: s,
237
+ placeholder: t.placeholder,
238
+ required: t.required,
239
+ type: p,
240
+ inputMode: h,
241
+ step: g
242
+ }),
243
+ t.copyable ? /* @__PURE__ */ Q(R.Suffix, {
244
+ className: "px-0",
245
+ children: /* @__PURE__ */ Q(Ye, {
246
+ getValue: () => s.current?.value,
247
+ isDisabled: n
248
+ })
249
+ }) : t.suffix != null && /* @__PURE__ */ Q(R.Suffix, { children: t.suffix })
250
+ ]
251
+ }),
252
+ /* @__PURE__ */ Q(P, {})
253
+ ]
254
+ }) : /* @__PURE__ */ $(q, {
255
+ name: e,
256
+ defaultValue: t.defaultValue == null ? void 0 : String(t.defaultValue),
257
+ isDisabled: n,
258
+ isReadOnly: t.readOnly,
259
+ children: [
260
+ /* @__PURE__ */ Q(z, { children: t.label }),
261
+ /* @__PURE__ */ Q(L, {
262
+ placeholder: t.placeholder,
263
+ required: t.required,
264
+ variant: o,
265
+ type: p,
266
+ inputMode: h,
267
+ step: g
268
+ }),
269
+ /* @__PURE__ */ Q(P, {})
270
+ ]
271
+ });
272
+ }
273
+ //#endregion
274
+ //#region src/components/auth/forgot-password.tsx
275
+ function Ze({ className: e, variant: t, ...n }) {
276
+ let { authClient: r, baseURL: i, basePaths: a, localization: o, viewPaths: s, navigate: c, plugins: l } = m(), { fetchOptions: u, resetFetchOptions: d } = v(), { mutate: f, isPending: p } = x(r, {
277
+ onError: (e) => {
278
+ Y.danger(e.error?.message || e.message), d();
279
+ },
280
+ onSuccess: () => {
281
+ Y.success(o.auth.passwordResetEmailSent), c({ to: `${a.auth}/${s.auth.signIn}` });
282
+ }
283
+ });
284
+ function h(e) {
285
+ e.preventDefault(), f({
286
+ email: new FormData(e.currentTarget).get("email"),
287
+ redirectTo: `${i}${a.auth}/${s.auth.resetPassword}`,
288
+ fetchOptions: u
289
+ });
290
+ }
291
+ let g = l.find((e) => e.captchaComponent)?.captchaComponent;
292
+ return /* @__PURE__ */ $(j, {
293
+ className: J("w-full max-w-sm gap-4 md:p-6", e),
294
+ variant: t,
295
+ ...n,
296
+ children: [
297
+ /* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
298
+ className: "text-xl font-semibold mb-1",
299
+ children: o.auth.forgotPassword
300
+ }) }),
301
+ /* @__PURE__ */ Q(j.Content, {
302
+ className: "gap-4",
303
+ children: /* @__PURE__ */ $(I, {
304
+ onSubmit: h,
305
+ className: "flex flex-col gap-4",
306
+ children: [
307
+ /* @__PURE__ */ $(q, {
308
+ name: "email",
309
+ type: "email",
310
+ autoComplete: "email",
311
+ isDisabled: p,
312
+ children: [
313
+ /* @__PURE__ */ Q(z, { children: o.auth.email }),
314
+ /* @__PURE__ */ Q(L, {
315
+ placeholder: o.auth.emailPlaceholder,
316
+ required: !0,
317
+ variant: t === "transparent" ? "primary" : "secondary"
318
+ }),
319
+ /* @__PURE__ */ Q(P, {})
320
+ ]
321
+ }),
322
+ g && /* @__PURE__ */ Q("div", {
323
+ className: "flex justify-center",
324
+ children: g
325
+ }),
326
+ /* @__PURE__ */ Q("div", {
327
+ className: "flex flex-col gap-3",
328
+ children: /* @__PURE__ */ $(k, {
329
+ type: "submit",
330
+ className: "w-full",
331
+ isPending: p,
332
+ children: [p && /* @__PURE__ */ Q(G, {
333
+ color: "current",
334
+ size: "sm"
335
+ }), o.auth.sendResetLink]
336
+ })
337
+ })
338
+ ]
339
+ })
340
+ }),
341
+ /* @__PURE__ */ Q(j.Footer, {
342
+ className: "flex-col gap-3",
343
+ children: /* @__PURE__ */ $(Ee, {
344
+ className: "text-sm",
345
+ children: [
346
+ o.auth.rememberYourPassword,
347
+ " ",
348
+ /* @__PURE__ */ Q(B, {
349
+ href: `${a.auth}/${s.auth.signIn}`,
350
+ className: "text-accent no-underline hover:underline decoration-accent-hover",
351
+ children: o.auth.signIn
352
+ })
353
+ ]
354
+ })
355
+ })
356
+ ]
357
+ });
358
+ }
359
+ //#endregion
360
+ //#region src/components/auth/reset-password.tsx
361
+ function Qe({ className: e, variant: t, ...n }) {
362
+ let { authClient: r, basePaths: i, emailAndPassword: a, localization: o, viewPaths: s, navigate: c } = m(), { mutate: l, isPending: u } = S(r, { onSuccess: () => {
363
+ Y.success(o.auth.passwordResetSuccess), c({ to: `${i.auth}/${s.auth.signIn}` });
364
+ } }), [d, f] = X(!1), [p, h] = X(!1);
365
+ ze(() => {
366
+ new URLSearchParams(window.location.search).get("token") || (Y.danger(o.auth.invalidResetPasswordToken), c({ to: `${i.auth}/${s.auth.signIn}` }));
367
+ }, [
368
+ i.auth,
369
+ o.auth.invalidResetPasswordToken,
370
+ s.auth.signIn,
371
+ c
372
+ ]);
373
+ function g(e) {
374
+ e.preventDefault();
375
+ let t = new URLSearchParams(window.location.search).get("token");
376
+ if (!t) {
377
+ Y.danger(o.auth.invalidResetPasswordToken), c({ to: `${i.auth}/${s.auth.signIn}` });
378
+ return;
379
+ }
380
+ let n = new FormData(e.currentTarget), r = n.get("password"), u = n.get("confirmPassword");
381
+ if (a?.confirmPassword && r !== u) {
382
+ Y.danger(o.auth.passwordsDoNotMatch);
383
+ return;
384
+ }
385
+ l({
386
+ token: t,
387
+ newPassword: r
388
+ });
389
+ }
390
+ return /* @__PURE__ */ $(j, {
391
+ className: J("w-full max-w-sm gap-4 md:p-6", e),
392
+ variant: t,
393
+ ...n,
394
+ children: [
395
+ /* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
396
+ className: "text-xl font-semibold mb-1",
397
+ children: o.auth.resetPassword
398
+ }) }),
399
+ /* @__PURE__ */ Q(j.Content, {
400
+ className: "gap-4",
401
+ children: /* @__PURE__ */ $(I, {
402
+ onSubmit: g,
403
+ className: "flex flex-col gap-4",
404
+ children: [
405
+ /* @__PURE__ */ $(q, {
406
+ minLength: a?.minPasswordLength,
407
+ maxLength: a?.maxPasswordLength,
408
+ name: "password",
409
+ autoComplete: "new-password",
410
+ isDisabled: u,
411
+ children: [
412
+ /* @__PURE__ */ Q(z, { children: o.auth.password }),
413
+ /* @__PURE__ */ $(R, {
414
+ variant: t === "transparent" ? "primary" : "secondary",
415
+ children: [/* @__PURE__ */ Q(R.Input, {
416
+ name: "password",
417
+ placeholder: o.auth.newPasswordPlaceholder,
418
+ type: d ? "text" : "password",
419
+ required: !0
420
+ }), /* @__PURE__ */ Q(R.Suffix, {
421
+ className: "px-0",
422
+ children: /* @__PURE__ */ Q(k, {
423
+ isIconOnly: !0,
424
+ "aria-label": d ? o.auth.hidePassword : o.auth.showPassword,
425
+ size: "sm",
426
+ variant: "ghost",
427
+ onPress: () => f(!d),
428
+ isDisabled: u,
429
+ children: Q(d ? O : D, {})
430
+ })
431
+ })]
432
+ }),
433
+ /* @__PURE__ */ Q(P, {})
434
+ ]
435
+ }),
436
+ a?.confirmPassword && /* @__PURE__ */ $(q, {
437
+ minLength: a?.minPasswordLength,
438
+ maxLength: a?.maxPasswordLength,
439
+ name: "confirmPassword",
440
+ autoComplete: "new-password",
441
+ isDisabled: u,
442
+ children: [
443
+ /* @__PURE__ */ Q(z, { children: o.auth.confirmPassword }),
444
+ /* @__PURE__ */ $(R, {
445
+ variant: t === "transparent" ? "primary" : "secondary",
446
+ children: [/* @__PURE__ */ Q(R.Input, {
447
+ placeholder: o.auth.confirmPasswordPlaceholder,
448
+ type: p ? "text" : "password",
449
+ required: !0,
450
+ name: "confirmPassword"
451
+ }), /* @__PURE__ */ Q(R.Suffix, {
452
+ className: "px-0",
453
+ children: /* @__PURE__ */ Q(k, {
454
+ isIconOnly: !0,
455
+ "aria-label": p ? o.auth.hidePassword : o.auth.showPassword,
456
+ size: "sm",
457
+ variant: "ghost",
458
+ onPress: () => h(!p),
459
+ isDisabled: u,
460
+ children: Q(p ? O : D, {})
461
+ })
462
+ })]
463
+ }),
464
+ /* @__PURE__ */ Q(P, {})
465
+ ]
466
+ }),
467
+ /* @__PURE__ */ Q("div", {
468
+ className: "flex flex-col gap-3",
469
+ children: /* @__PURE__ */ $(k, {
470
+ type: "submit",
471
+ className: "w-full",
472
+ isPending: u,
473
+ children: [u && /* @__PURE__ */ Q(G, {
474
+ color: "current",
475
+ size: "sm"
476
+ }), o.auth.resetPassword]
477
+ })
478
+ })
479
+ ]
480
+ })
481
+ }),
482
+ /* @__PURE__ */ Q(j.Footer, {
483
+ className: "flex-col gap-3",
484
+ children: /* @__PURE__ */ $(Ee, {
485
+ className: "text-sm",
486
+ children: [
487
+ o.auth.rememberYourPassword,
488
+ " ",
489
+ /* @__PURE__ */ Q(B, {
490
+ href: `${i.auth}/${s.auth.signIn}`,
491
+ className: "text-accent no-underline hover:underline decoration-accent-hover",
492
+ children: o.auth.signIn
493
+ })
494
+ ]
495
+ })
496
+ })
497
+ ]
498
+ });
499
+ }
500
+ //#endregion
501
+ //#region src/components/auth/sign-in.tsx
502
+ function $e({ className: t, socialLayout: n, socialPosition: i = "bottom", variant: o, ...s }) {
503
+ let { authClient: c, basePaths: l, baseURL: u, emailAndPassword: d, localization: f, plugins: p, redirectTo: h, socialProviders: g, viewPaths: _, navigate: y } = m(), { fetchOptions: b, resetFetchOptions: ee } = v(), [x, S] = X(""), { mutate: te } = ne(c, { onSuccess: () => Y.success(f.auth.verificationEmailSent) }), { mutate: C, isPending: ie } = re(c, {
504
+ onError: (e, { email: t }) => {
505
+ S(""), e.error?.code === "EMAIL_NOT_VERIFIED" ? Y.danger(e.error?.message || e.message, { actionProps: {
506
+ children: f.auth.resend,
507
+ onClick: () => te({
508
+ email: t,
509
+ callbackURL: `${u}${h}`
510
+ })
511
+ } }) : Y.danger(e.error?.message || e.message), ee();
512
+ },
513
+ onSuccess: () => y({ to: h })
514
+ }), ae = (e) => {
515
+ e.preventDefault();
516
+ let t = new FormData(e.currentTarget), n = t.get("email"), r = t.get("rememberMe") === "on";
517
+ C({
518
+ email: n,
519
+ password: x,
520
+ ...d?.rememberMe ? { rememberMe: r } : {},
521
+ fetchOptions: b
522
+ });
523
+ }, w = We({ mutationKey: a.signIn.all }) + We({ mutationKey: a.signUp.all }) > 0, oe = p.find((e) => e.captchaComponent)?.captchaComponent, T = d?.enabled && !!g?.length;
524
+ return /* @__PURE__ */ $(j, {
525
+ className: J("w-full max-w-sm gap-4 md:p-6", t),
526
+ variant: o,
527
+ ...s,
528
+ children: [
529
+ /* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
530
+ className: "text-xl font-semibold mb-1",
531
+ children: f.auth.signIn
532
+ }) }),
533
+ /* @__PURE__ */ $(j.Content, {
534
+ className: "gap-4",
535
+ children: [
536
+ i === "top" && /* @__PURE__ */ $(Z, { children: [!!g?.length && /* @__PURE__ */ Q(r, { socialLayout: n }), T && /* @__PURE__ */ Q(e, { children: f.auth.or })] }),
537
+ d?.enabled && /* @__PURE__ */ $(I, {
538
+ onSubmit: ae,
539
+ className: "flex flex-col gap-4",
540
+ children: [
541
+ /* @__PURE__ */ $(q, {
542
+ name: "email",
543
+ type: "email",
544
+ autoComplete: "email",
545
+ isDisabled: w,
546
+ children: [
547
+ /* @__PURE__ */ Q(z, { children: f.auth.email }),
548
+ /* @__PURE__ */ Q(L, {
549
+ placeholder: f.auth.emailPlaceholder,
550
+ variant: o === "transparent" ? "primary" : "secondary",
551
+ required: !0
552
+ }),
553
+ /* @__PURE__ */ Q(P, {})
554
+ ]
555
+ }),
556
+ /* @__PURE__ */ $(q, {
557
+ minLength: d?.minPasswordLength,
558
+ maxLength: d?.maxPasswordLength,
559
+ name: "password",
560
+ type: "password",
561
+ autoComplete: "current-password",
562
+ isDisabled: w,
563
+ value: x,
564
+ onChange: S,
565
+ children: [
566
+ /* @__PURE__ */ Q(z, { children: f.auth.password }),
567
+ /* @__PURE__ */ Q(L, {
568
+ placeholder: f.auth.passwordPlaceholder,
569
+ variant: o === "transparent" ? "primary" : "secondary",
570
+ required: !0
571
+ }),
572
+ /* @__PURE__ */ Q(P, {})
573
+ ]
574
+ }),
575
+ d?.rememberMe && /* @__PURE__ */ $(M, {
576
+ name: "rememberMe",
577
+ isDisabled: w,
578
+ variant: o === "transparent" ? "primary" : "secondary",
579
+ children: [/* @__PURE__ */ Q(M.Control, { children: /* @__PURE__ */ Q(M.Indicator, {}) }), /* @__PURE__ */ Q(M.Content, { children: /* @__PURE__ */ Q(z, { children: f.auth.rememberMe }) })]
580
+ }),
581
+ oe && /* @__PURE__ */ Q("div", {
582
+ className: "flex justify-center",
583
+ children: oe
584
+ }),
585
+ /* @__PURE__ */ $("div", {
586
+ className: "flex flex-col gap-3",
587
+ children: [/* @__PURE__ */ $(k, {
588
+ type: "submit",
589
+ className: "w-full",
590
+ isPending: w,
591
+ children: [ie && /* @__PURE__ */ Q(G, {
592
+ color: "current",
593
+ size: "sm"
594
+ }), f.auth.signIn]
595
+ }), p.flatMap((e) => e.authButtons?.map((t, n) => /* @__PURE__ */ Q(t, { view: "signIn" }, `${e.id}-${n.toString()}`)))]
596
+ })
597
+ ]
598
+ }),
599
+ i === "bottom" && /* @__PURE__ */ $(Z, { children: [T && /* @__PURE__ */ Q(e, { children: f.auth.or }), !!g?.length && /* @__PURE__ */ Q(r, { socialLayout: n })] })
600
+ ]
601
+ }),
602
+ /* @__PURE__ */ $(j.Footer, {
603
+ className: "flex-col gap-3",
604
+ children: [d?.forgotPassword && /* @__PURE__ */ Q(B, {
605
+ href: `${l.auth}/${_.auth.forgotPassword}`,
606
+ className: "no-underline hover:underline",
607
+ children: f.auth.forgotPasswordLink
608
+ }), d?.enabled && /* @__PURE__ */ $(Ee, {
609
+ className: "text-sm",
610
+ children: [
611
+ f.auth.needToCreateAnAccount,
612
+ " ",
613
+ /* @__PURE__ */ Q(B, {
614
+ href: `${l.auth}/${_.auth.signUp}`,
615
+ className: "text-accent no-underline hover:underline decoration-accent-hover",
616
+ children: f.auth.signUp
617
+ })
618
+ ]
619
+ })]
620
+ })
621
+ ]
622
+ });
623
+ }
624
+ //#endregion
625
+ //#region src/components/auth/sign-out.tsx
626
+ function et({ className: e }) {
627
+ let { authClient: t, basePaths: n, navigate: r, viewPaths: i } = m(), { mutate: a } = ie(t, {
628
+ onError: (e) => {
629
+ Y.danger(e.error?.message || e.message), r({
630
+ to: `${n.auth}/${i.auth.signIn}`,
631
+ replace: !0
632
+ });
633
+ },
634
+ onSuccess: () => r({
635
+ to: `${n.auth}/${i.auth.signIn}`,
636
+ replace: !0
637
+ })
638
+ }), o = Ve(!1);
639
+ return ze(() => {
640
+ o.current || (o.current = !0, a());
641
+ }, [a]), /* @__PURE__ */ Q(G, {
642
+ className: J("mx-auto my-auto", e),
643
+ color: "current"
644
+ });
645
+ }
646
+ //#endregion
647
+ //#region src/components/auth/sign-up.tsx
648
+ function tt({ className: t, socialLayout: n, socialPosition: i = "bottom", variant: o, ...s }) {
649
+ let { additionalFields: c, authClient: u, basePaths: d, emailAndPassword: f, localization: p, plugins: h, redirectTo: g, socialProviders: _, viewPaths: y, navigate: b } = m(), { fetchOptions: ee, resetFetchOptions: x } = v(), [S, te] = X(""), [ne, C] = X(""), { mutate: re, isPending: ie } = ae(u, {
650
+ onError: (e) => {
651
+ te(""), C(""), Y.danger(e.error?.message || e.message), x();
652
+ },
653
+ onSuccess: () => {
654
+ f?.requireEmailVerification ? (Y.success(p.auth.verifyYourEmail), b({ to: `${d.auth}/${y.auth.signIn}` })) : b({ to: g });
655
+ }
656
+ }), [w, oe] = X(!1), [T, se] = X(!1), E = We({ mutationKey: a.signIn.all }) + We({ mutationKey: a.signUp.all }) > 0, ce = h.find((e) => e.captchaComponent)?.captchaComponent, le = async (e) => {
657
+ e.preventDefault();
658
+ let t = new FormData(e.currentTarget), n = t.get("name") ?? "", r = t.get("email");
659
+ if (f?.confirmPassword && S !== ne) {
660
+ Y.danger(p.auth.passwordsDoNotMatch), te(""), C("");
661
+ return;
662
+ }
663
+ let i = {};
664
+ for (let e of c ?? []) {
665
+ if (!e.signUp || e.readOnly) continue;
666
+ let n = l(e, t.get(e.name));
667
+ if (e.validate) try {
668
+ await e.validate(n);
669
+ } catch (e) {
670
+ Y.danger(e instanceof Error ? e.message : String(e));
671
+ return;
672
+ }
673
+ n !== void 0 && (i[e.name] = n);
674
+ }
675
+ re({
676
+ name: n,
677
+ email: r,
678
+ password: S,
679
+ ...i,
680
+ fetchOptions: ee
681
+ });
682
+ }, ue = f?.enabled && !!_?.length;
683
+ return /* @__PURE__ */ $(j, {
684
+ className: J("w-full max-w-sm gap-4 md:p-6", t),
685
+ variant: o,
686
+ ...s,
687
+ children: [
688
+ /* @__PURE__ */ Q(j.Header, { children: /* @__PURE__ */ Q(j.Title, {
689
+ className: "text-xl font-semibold mb-1",
690
+ children: p.auth.signUp
691
+ }) }),
692
+ /* @__PURE__ */ $(j.Content, {
693
+ className: "gap-4",
694
+ children: [
695
+ i === "top" && /* @__PURE__ */ $(Z, { children: [!!_?.length && /* @__PURE__ */ Q(r, { socialLayout: n }), ue && /* @__PURE__ */ Q(e, { children: p.auth.or })] }),
696
+ f?.enabled && /* @__PURE__ */ $(I, {
697
+ onSubmit: le,
698
+ className: "flex flex-col gap-4",
699
+ children: [
700
+ f.name !== !1 && /* @__PURE__ */ $(q, {
701
+ name: "name",
702
+ type: "text",
703
+ autoComplete: "name",
704
+ isDisabled: E,
705
+ children: [
706
+ /* @__PURE__ */ Q(z, { children: p.auth.name }),
707
+ /* @__PURE__ */ Q(L, {
708
+ placeholder: p.auth.namePlaceholder,
709
+ required: !0,
710
+ variant: o === "transparent" ? "primary" : "secondary"
711
+ }),
712
+ /* @__PURE__ */ Q(P, {})
713
+ ]
714
+ }),
715
+ /* @__PURE__ */ $(q, {
716
+ name: "email",
717
+ type: "email",
718
+ autoComplete: "email",
719
+ isDisabled: E,
720
+ children: [
721
+ /* @__PURE__ */ Q(z, { children: p.auth.email }),
722
+ /* @__PURE__ */ Q(L, {
723
+ placeholder: p.auth.emailPlaceholder,
724
+ required: !0,
725
+ variant: o === "transparent" ? "primary" : "secondary"
726
+ }),
727
+ /* @__PURE__ */ Q(P, {})
728
+ ]
729
+ }),
730
+ c?.map((e) => e.signUp === "above" && /* @__PURE__ */ Q(Xe, {
731
+ name: e.name,
732
+ field: e,
733
+ isPending: E,
734
+ variant: o
735
+ }, e.name)),
736
+ /* @__PURE__ */ $(q, {
737
+ minLength: f?.minPasswordLength,
738
+ maxLength: f?.maxPasswordLength,
739
+ name: "password",
740
+ autoComplete: "new-password",
741
+ isDisabled: E,
742
+ value: S,
743
+ onChange: te,
744
+ children: [
745
+ /* @__PURE__ */ Q(z, { children: p.auth.password }),
746
+ /* @__PURE__ */ $(R, {
747
+ variant: o === "transparent" ? "primary" : "secondary",
748
+ children: [/* @__PURE__ */ Q(R.Input, {
749
+ placeholder: p.auth.passwordPlaceholder,
750
+ type: w ? "text" : "password",
751
+ name: "password",
752
+ required: !0
753
+ }), /* @__PURE__ */ Q(R.Suffix, {
754
+ className: "px-0",
755
+ children: /* @__PURE__ */ Q(k, {
756
+ isIconOnly: !0,
757
+ "aria-label": w ? p.auth.hidePassword : p.auth.showPassword,
758
+ size: "sm",
759
+ variant: "ghost",
760
+ onPress: () => oe(!w),
761
+ isDisabled: E,
762
+ children: Q(w ? O : D, {})
763
+ })
764
+ })]
765
+ }),
766
+ /* @__PURE__ */ Q(P, {})
767
+ ]
768
+ }),
769
+ f?.confirmPassword && /* @__PURE__ */ $(q, {
770
+ minLength: f?.minPasswordLength,
771
+ maxLength: f?.maxPasswordLength,
772
+ name: "confirmPassword",
773
+ autoComplete: "new-password",
774
+ isDisabled: E,
775
+ value: ne,
776
+ onChange: C,
777
+ children: [
778
+ /* @__PURE__ */ Q(z, { children: p.auth.confirmPassword }),
779
+ /* @__PURE__ */ $(R, {
780
+ variant: o === "transparent" ? "primary" : "secondary",
781
+ children: [/* @__PURE__ */ Q(R.Input, {
782
+ name: "confirmPassword",
783
+ placeholder: p.auth.confirmPasswordPlaceholder,
784
+ type: T ? "text" : "password",
785
+ required: !0
786
+ }), /* @__PURE__ */ Q(R.Suffix, {
787
+ className: "px-0",
788
+ children: /* @__PURE__ */ Q(k, {
789
+ isIconOnly: !0,
790
+ "aria-label": T ? p.auth.hidePassword : p.auth.showPassword,
791
+ size: "sm",
792
+ variant: "ghost",
793
+ onPress: () => se(!T),
794
+ isDisabled: E,
795
+ children: Q(T ? O : D, {})
796
+ })
797
+ })]
798
+ }),
799
+ /* @__PURE__ */ Q(P, {})
800
+ ]
801
+ }),
802
+ c?.map((e) => e.signUp && e.signUp !== "above" && /* @__PURE__ */ Q(Xe, {
803
+ name: e.name,
804
+ field: e,
805
+ isPending: E,
806
+ variant: o
807
+ }, e.name)),
808
+ ce && /* @__PURE__ */ Q("div", {
809
+ className: "flex justify-center",
810
+ children: ce
811
+ }),
812
+ /* @__PURE__ */ $("div", {
813
+ className: "flex flex-col gap-3",
814
+ children: [/* @__PURE__ */ $(k, {
815
+ type: "submit",
816
+ className: "w-full",
817
+ isPending: E,
818
+ children: [ie && /* @__PURE__ */ Q(G, {
819
+ color: "current",
820
+ size: "sm"
821
+ }), p.auth.signUp]
822
+ }), h.flatMap((e) => e.authButtons?.map((t, n) => /* @__PURE__ */ Q(t, { view: "signUp" }, `${e.id}-${n.toString()}`)))]
823
+ })
824
+ ]
825
+ }),
826
+ i === "bottom" && /* @__PURE__ */ $(Z, { children: [ue && /* @__PURE__ */ Q(e, { children: p.auth.or }), !!_?.length && /* @__PURE__ */ Q(r, { socialLayout: n })] })
827
+ ]
828
+ }),
829
+ /* @__PURE__ */ Q(j.Footer, {
830
+ className: "flex-col gap-3",
831
+ children: /* @__PURE__ */ $(Ee, {
832
+ className: "text-sm",
833
+ children: [
834
+ p.auth.alreadyHaveAnAccount,
835
+ " ",
836
+ /* @__PURE__ */ Q(B, {
837
+ href: `${d.auth}/${y.auth.signIn}`,
838
+ className: "text-accent no-underline hover:underline decoration-accent-hover",
839
+ children: p.auth.signIn
840
+ })
841
+ ]
842
+ })
843
+ })
844
+ ]
845
+ });
846
+ }
847
+ //#endregion
848
+ //#region src/components/auth/auth.tsx
849
+ var nt = [
850
+ "signUp",
851
+ "forgotPassword",
852
+ "resetPassword"
853
+ ], rt = {
854
+ signIn: $e,
855
+ signOut: et,
856
+ signUp: tt,
857
+ forgotPassword: Ze,
858
+ resetPassword: Qe
859
+ };
860
+ function it({ path: e, socialLayout: t, socialPosition: n, view: r, ...i }) {
861
+ let { basePaths: a, emailAndPassword: o, plugins: s, viewPaths: c, navigate: l } = m();
862
+ if (!r && !e) throw Error("[Better Auth UI] Either `view` or `path` must be provided");
863
+ let u = r || Object.keys(c.auth).find((t) => c.auth[t] === e), d = !o?.enabled && u && nt.includes(u);
864
+ if (ze(() => {
865
+ d && l({
866
+ to: `${a.auth}/${c.auth.signIn}`,
867
+ replace: !0
868
+ });
869
+ }, [
870
+ d,
871
+ l,
872
+ a.auth,
873
+ c.auth.signIn
874
+ ]), d) return null;
875
+ for (let a of s) {
876
+ let o = a.viewPaths?.auth, s = r ?? u ?? (o && Object.keys(o).find((t) => o[t] === e));
877
+ if (!s) continue;
878
+ let c = a.views?.auth?.[s];
879
+ if (c) return /* @__PURE__ */ Q(c, {
880
+ socialLayout: t,
881
+ socialPosition: n,
882
+ ...i
883
+ });
884
+ }
885
+ if (u === "signIn" && !o?.enabled) {
886
+ let e = s.find((e) => e.fallbackViews?.auth?.signIn)?.fallbackViews?.auth?.signIn;
887
+ if (e) return /* @__PURE__ */ Q(e, {
888
+ socialLayout: t,
889
+ socialPosition: n,
890
+ ...i
891
+ });
892
+ }
893
+ let f = u ? rt[u] : void 0;
894
+ if (!f) throw Error(`[Better Auth UI] Unknown view "${u}". Valid views are: ${Object.keys(rt).join(", ")}`);
895
+ return /* @__PURE__ */ Q(f, {
896
+ socialLayout: t,
897
+ socialPosition: n,
898
+ ...i
899
+ });
900
+ }
901
+ //#endregion
902
+ //#region src/components/auth/error-toaster.tsx
903
+ function at() {
904
+ let e = Ge();
905
+ return ze(() => {
906
+ let t = e.getQueryCache().subscribe((e) => {
907
+ if (e.type !== "updated" || e.action.type !== "error" || !Ue({ queryKey: o.all }, e.query)) return;
908
+ let t = e.action.error;
909
+ t?.error && Y.danger(t.error.message);
910
+ }), n = e.getMutationCache().subscribe((e) => {
911
+ if (e.type !== "updated" || e.action.type !== "error" || !He({ mutationKey: a.all }, e.mutation)) return;
912
+ let t = e.action.error;
913
+ Y.danger(t.error?.message || t.message);
914
+ });
915
+ return () => {
916
+ t(), n();
917
+ };
918
+ }, [e]), null;
919
+ }
920
+ //#endregion
921
+ //#region src/components/auth/auth-provider.tsx
922
+ function ot({ children: e, navigate: t, ...n }) {
923
+ return /* @__PURE__ */ Q(d, {
924
+ navigate: t,
925
+ ...n,
926
+ children: /* @__PURE__ */ $(De, {
927
+ navigate: (e) => t({ to: e }),
928
+ children: [e, /* @__PURE__ */ Q(at, {})]
929
+ })
930
+ });
931
+ }
932
+ //#endregion
933
+ //#region src/components/auth/settings/account/change-email.tsx
934
+ function st({ className: e, variant: t, ...n }) {
935
+ let { authClient: r, localization: i, baseURL: a, viewPaths: o } = m(), { data: s } = C(r), { mutate: c, isPending: l } = g(r, { onSuccess: () => Y.success(i.settings.changeEmailSuccess) });
936
+ function u(e) {
937
+ e.preventDefault(), c({
938
+ newEmail: new FormData(e.currentTarget).get("email"),
939
+ callbackURL: `${a}/${o.settings.account}`
940
+ });
941
+ }
942
+ return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
943
+ className: J("text-sm font-semibold mb-3"),
944
+ children: i.settings.changeEmail
945
+ }), /* @__PURE__ */ Q(j, {
946
+ className: J("p-4 gap-4", e),
947
+ variant: t,
948
+ ...n,
949
+ children: /* @__PURE__ */ Q(j.Content, { children: /* @__PURE__ */ Q(I, {
950
+ onSubmit: u,
951
+ children: /* @__PURE__ */ $(F, {
952
+ className: "w-full gap-4",
953
+ children: [/* @__PURE__ */ Q(F.Group, { children: /* @__PURE__ */ $(q, {
954
+ name: "email",
955
+ type: "email",
956
+ defaultValue: s?.user.email,
957
+ isDisabled: l || !s,
958
+ children: [
959
+ /* @__PURE__ */ Q(z, { children: i.auth.email }),
960
+ s ? /* @__PURE__ */ Q(L, {
961
+ required: !0,
962
+ variant: t === "transparent" ? "primary" : "secondary",
963
+ autoComplete: "email",
964
+ placeholder: i.auth.emailPlaceholder
965
+ }) : /* @__PURE__ */ Q(W, { className: "h-10 md:h-9 w-full rounded-xl" }),
966
+ /* @__PURE__ */ Q(P, {})
967
+ ]
968
+ }, `${s?.user.id}-${s?.user.email}-email`) }), /* @__PURE__ */ Q(F.Actions, { children: /* @__PURE__ */ $(k, {
969
+ type: "submit",
970
+ isPending: l,
971
+ isDisabled: !s,
972
+ size: "sm",
973
+ children: [l && /* @__PURE__ */ Q(G, {
974
+ color: "current",
975
+ size: "sm"
976
+ }), i.settings.updateEmail]
977
+ }) })]
978
+ })
979
+ }) })
980
+ })] });
981
+ }
982
+ //#endregion
983
+ //#region src/components/auth/settings/account/change-avatar.tsx
984
+ function ct({ className: e }) {
985
+ let { authClient: t, localization: r, avatar: i } = m(), { data: a } = C(t), { mutate: o, isPending: c } = oe(t), l = Ve(null), [u, d] = X(!1), [f, p] = X(!1), h = c || u || f;
986
+ async function g(e) {
987
+ let t = e.target.files?.[0];
988
+ if (t) {
989
+ e.target.value = "", d(!0);
990
+ try {
991
+ let e = await i.resize?.(t, i.size, i.extension) || t;
992
+ o({ image: await i.upload?.(e) || await s(e) }, { onSuccess: () => Y.success(r.settings.avatarChangedSuccess) });
993
+ } catch (e) {
994
+ e instanceof Error && Y.danger(e.message);
995
+ }
996
+ d(!1);
997
+ }
998
+ }
999
+ async function _() {
1000
+ let e = a?.user.image;
1001
+ o({ image: null }, { onSuccess: async () => {
1002
+ if (e) {
1003
+ p(!0);
1004
+ try {
1005
+ await i.delete?.(e);
1006
+ } finally {
1007
+ p(!1);
1008
+ }
1009
+ }
1010
+ Y.success(r.settings.avatarDeletedSuccess);
1011
+ } });
1012
+ }
1013
+ return /* @__PURE__ */ $("div", {
1014
+ className: J("flex flex-col gap-1", e),
1015
+ children: [
1016
+ /* @__PURE__ */ Q(z, {
1017
+ isDisabled: !a,
1018
+ children: r.settings.avatar
1019
+ }),
1020
+ /* @__PURE__ */ Q("input", {
1021
+ ref: l,
1022
+ type: "file",
1023
+ accept: "image/*",
1024
+ className: "hidden",
1025
+ onChange: g
1026
+ }),
1027
+ /* @__PURE__ */ $("div", {
1028
+ className: "flex items-center gap-4",
1029
+ children: [/* @__PURE__ */ Q(k, {
1030
+ type: "button",
1031
+ isIconOnly: !0,
1032
+ variant: "ghost",
1033
+ className: "p-0 h-auto w-auto rounded-full",
1034
+ isDisabled: !a || h,
1035
+ onPress: () => l.current?.click(),
1036
+ children: /* @__PURE__ */ Q(n, {
1037
+ size: "lg",
1038
+ isPending: h
1039
+ })
1040
+ }), /* @__PURE__ */ $(N, { children: [/* @__PURE__ */ $(k, {
1041
+ isDisabled: !a || h,
1042
+ size: "sm",
1043
+ variant: "secondary",
1044
+ children: [h && /* @__PURE__ */ Q(G, { size: "sm" }), r.settings.changeAvatar]
1045
+ }), /* @__PURE__ */ Q(N.Popover, {
1046
+ className: "min-w-fit",
1047
+ children: /* @__PURE__ */ $(N.Menu, { children: [/* @__PURE__ */ $(N.Item, {
1048
+ textValue: r.settings.uploadAvatar,
1049
+ onAction: () => l.current?.click(),
1050
+ children: [/* @__PURE__ */ Q(le, { className: "text-muted" }), /* @__PURE__ */ Q(z, { children: r.settings.uploadAvatar })]
1051
+ }), /* @__PURE__ */ $(N.Item, {
1052
+ textValue: r.settings.deleteAvatar,
1053
+ isDisabled: !a?.user.image,
1054
+ onAction: _,
1055
+ variant: "danger",
1056
+ children: [/* @__PURE__ */ Q(be, { className: "text-danger" }), /* @__PURE__ */ Q(z, { children: r.settings.deleteAvatar })]
1057
+ })] })
1058
+ })] })]
1059
+ })
1060
+ ]
1061
+ });
1062
+ }
1063
+ //#endregion
1064
+ //#region src/components/auth/settings/account/user-profile.tsx
1065
+ function lt({ className: e, variant: t, ...n }) {
1066
+ let { additionalFields: r, authClient: i, localization: a } = m(), { data: o } = C(i), { mutate: s, isPending: c } = oe(i, { onSuccess: () => Y.success(a.settings.profileUpdatedSuccess) });
1067
+ async function u(e) {
1068
+ e.preventDefault();
1069
+ let t = new FormData(e.currentTarget), n = t.get("name"), i = {};
1070
+ for (let e of r ?? []) {
1071
+ if (e.profile === !1 || e.readOnly) continue;
1072
+ let n = l(e, t.get(e.name));
1073
+ if (e.validate) try {
1074
+ await e.validate(n);
1075
+ } catch (e) {
1076
+ Y.danger(e instanceof Error ? e.message : String(e));
1077
+ return;
1078
+ }
1079
+ n !== void 0 && (i[e.name] = n);
1080
+ }
1081
+ s({
1082
+ name: n,
1083
+ ...i
1084
+ });
1085
+ }
1086
+ return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
1087
+ className: J("text-sm font-semibold mb-3"),
1088
+ children: a.settings.userProfile
1089
+ }), /* @__PURE__ */ Q(j, {
1090
+ className: J("p-4 gap-4", e),
1091
+ variant: t,
1092
+ ...n,
1093
+ children: /* @__PURE__ */ Q(j.Content, { children: /* @__PURE__ */ $(I, {
1094
+ onSubmit: u,
1095
+ className: "flex flex-col gap-4",
1096
+ children: [
1097
+ /* @__PURE__ */ Q(ct, {}),
1098
+ /* @__PURE__ */ $(q, {
1099
+ name: "name",
1100
+ defaultValue: o?.user.name,
1101
+ isDisabled: c || !o,
1102
+ children: [
1103
+ /* @__PURE__ */ Q(z, { children: a.auth.name }),
1104
+ /* @__PURE__ */ Q(L, {
1105
+ className: J(!o && "hidden"),
1106
+ autoComplete: "name",
1107
+ placeholder: a.auth.name,
1108
+ variant: t === "transparent" ? "primary" : "secondary"
1109
+ }),
1110
+ !o && /* @__PURE__ */ Q(W, { className: "h-10 md:h-9 w-full rounded-xl" }),
1111
+ /* @__PURE__ */ Q(P, {})
1112
+ ]
1113
+ }, `${o?.user?.id}-${o?.user?.name}-name`),
1114
+ r?.filter((e) => e.profile !== !1).map((e) => {
1115
+ if (!o) return e.inputType === "hidden" ? null : /* @__PURE__ */ Q(W, { className: "h-10 md:h-9 w-full rounded-xl" }, e.name);
1116
+ let n = o.user[e.name], r = `${o.user.id}-${e.name}-${n instanceof Date ? n.toISOString() : String(n ?? "")}`;
1117
+ return /* @__PURE__ */ Q(Xe, {
1118
+ name: e.name,
1119
+ field: {
1120
+ ...e,
1121
+ defaultValue: n
1122
+ },
1123
+ isPending: c,
1124
+ variant: t
1125
+ }, r);
1126
+ }),
1127
+ /* @__PURE__ */ $(k, {
1128
+ type: "submit",
1129
+ isPending: c,
1130
+ isDisabled: !o,
1131
+ size: "sm",
1132
+ className: "self-start mt-1",
1133
+ children: [c && /* @__PURE__ */ Q(G, {
1134
+ color: "current",
1135
+ size: "sm"
1136
+ }), a.settings.saveChanges]
1137
+ })
1138
+ ]
1139
+ }) })
1140
+ })] });
1141
+ }
1142
+ //#endregion
1143
+ //#region src/components/auth/settings/account/account-settings.tsx
1144
+ function ut({ className: e, variant: t, ...n }) {
1145
+ let { emailAndPassword: r, plugins: i } = m(), a = i.some((e) => e.id === "magicLink");
1146
+ return /* @__PURE__ */ $("div", {
1147
+ className: J("flex w-full flex-col gap-4 md:gap-6", e),
1148
+ ...n,
1149
+ children: [
1150
+ /* @__PURE__ */ Q(lt, { variant: t }),
1151
+ (r?.enabled || a) && /* @__PURE__ */ Q(st, { variant: t }),
1152
+ i.flatMap((e) => e.accountCards?.map((n, r) => /* @__PURE__ */ Q(n, { variant: t }, `${e.id}-${r.toString()}`)))
1153
+ ]
1154
+ });
1155
+ }
1156
+ //#endregion
1157
+ //#region src/components/auth/settings/security/active-session.tsx
1158
+ function dt(e) {
1159
+ let t = Math.floor((Date.now() - e.getTime()) / 1e3), n = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
1160
+ for (let [e, r] of [
1161
+ ["year", 31536e3],
1162
+ ["month", 2592e3],
1163
+ ["week", 604800],
1164
+ ["day", 86400],
1165
+ ["hour", 3600],
1166
+ ["minute", 60],
1167
+ ["second", 1]
1168
+ ]) if (t >= r) return n.format(-Math.floor(t / r), e);
1169
+ return n.format(0, "second");
1170
+ }
1171
+ function ft({ activeSession: e }) {
1172
+ let { authClient: t, basePaths: n, localization: r, viewPaths: i, navigate: a } = m(), { data: o } = C(t, { refetchOnMount: !1 }), { mutate: s, isPending: c } = te(t, { onSuccess: () => Y.success(r.settings.revokeSessionSuccess) }), l = e.token === o?.session.token, u = Ke.parse(e.userAgent || "");
1173
+ return /* @__PURE__ */ $("div", {
1174
+ className: "flex items-center gap-3",
1175
+ children: [
1176
+ /* @__PURE__ */ Q("div", {
1177
+ className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
1178
+ children: u.platform.type === "mobile" || u.platform.type === "tablet" ? /* @__PURE__ */ Q(ye, { className: "size-4.5" }) : /* @__PURE__ */ Q(de, { className: "size-4.5" })
1179
+ }),
1180
+ /* @__PURE__ */ $("div", {
1181
+ className: "flex flex-col min-w-0",
1182
+ children: [/* @__PURE__ */ $("span", {
1183
+ className: "text-sm font-medium truncate",
1184
+ children: [u.browser.name || "Unknown Browser", u.os.name ? `, ${u.os.name}` : ""]
1185
+ }), l ? /* @__PURE__ */ Q(Se, {
1186
+ color: "accent",
1187
+ size: "sm",
1188
+ children: r.settings.currentSession
1189
+ }) : e.createdAt && /* @__PURE__ */ Q("span", {
1190
+ className: "text-xs text-muted capitalize",
1191
+ children: dt(e.createdAt)
1192
+ })]
1193
+ }),
1194
+ /* @__PURE__ */ $(k, {
1195
+ className: "ml-auto shrink-0",
1196
+ variant: "outline",
1197
+ size: "sm",
1198
+ onPress: () => l ? a({ to: `${n.auth}/${i.auth.signOut}` }) : s(e),
1199
+ isPending: c,
1200
+ "aria-label": l ? r.auth.signOut : r.settings.revokeSession,
1201
+ children: [c ? /* @__PURE__ */ Q(G, {
1202
+ color: "current",
1203
+ size: "sm"
1204
+ }) : Q(l ? T : xe, {}), l ? r.auth.signOut : r.settings.revoke]
1205
+ })
1206
+ ]
1207
+ });
1208
+ }
1209
+ //#endregion
1210
+ //#region src/components/auth/settings/security/active-sessions.tsx
1211
+ function pt({ className: e, variant: t, ...n }) {
1212
+ let { authClient: r, localization: i } = m(), { data: a } = C(r), { data: o, isPending: s } = ee(r), c = o && [...o].sort((e, t) => e.id === a?.session.id ? -1 : +(t.id === a?.session.id));
1213
+ return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
1214
+ className: J("text-sm font-semibold mb-3"),
1215
+ children: i.settings.activeSessions
1216
+ }), /* @__PURE__ */ Q(j, {
1217
+ className: J(e),
1218
+ variant: t,
1219
+ ...n,
1220
+ children: /* @__PURE__ */ Q(j.Content, {
1221
+ className: "gap-0",
1222
+ children: s ? /* @__PURE__ */ Q(mt, {}) : c?.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(ft, { activeSession: e })] }, e.id))
1223
+ })
1224
+ })] });
1225
+ }
1226
+ function mt() {
1227
+ return /* @__PURE__ */ Q("div", {
1228
+ className: "flex items-center justify-between",
1229
+ children: /* @__PURE__ */ $("div", {
1230
+ className: "flex items-center gap-3",
1231
+ children: [/* @__PURE__ */ Q(W, { className: "size-10 rounded-xl" }), /* @__PURE__ */ $("div", {
1232
+ className: "flex flex-col gap-1",
1233
+ children: [/* @__PURE__ */ Q(W, { className: "h-4 w-32 rounded-lg" }), /* @__PURE__ */ Q(W, { className: "h-3 w-24 rounded-lg" })]
1234
+ })]
1235
+ })
1236
+ });
1237
+ }
1238
+ //#endregion
1239
+ //#region src/components/auth/settings/security/change-password.tsx
1240
+ function ht({ className: e, variant: t, ...n }) {
1241
+ let { authClient: r, emailAndPassword: i, localization: a } = m(), { data: o } = C(r), { data: s, isPending: c } = b(r), l = s?.some((e) => e.providerId === "credential");
1242
+ return !c && !l ? /* @__PURE__ */ Q(gt, {
1243
+ className: e,
1244
+ variant: t,
1245
+ ...n
1246
+ }) : /* @__PURE__ */ Q(_t, {
1247
+ className: e,
1248
+ variant: t,
1249
+ emailAndPassword: i,
1250
+ localization: a,
1251
+ session: c ? void 0 : o,
1252
+ ...n
1253
+ });
1254
+ }
1255
+ function gt({ className: e, variant: t, ...n }) {
1256
+ let { authClient: r, localization: i } = m(), { data: a } = C(r), { mutate: o, isPending: s } = x(r, { onSuccess: () => Y.success(i.auth.passwordResetEmailSent) }), c = () => {
1257
+ a?.user.email && o({ email: a.user.email });
1258
+ };
1259
+ return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
1260
+ className: J("text-sm font-semibold mb-3"),
1261
+ children: i.settings.changePassword
1262
+ }), /* @__PURE__ */ Q(j, {
1263
+ className: J(e),
1264
+ variant: t,
1265
+ ...n,
1266
+ children: /* @__PURE__ */ $(j.Content, {
1267
+ className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
1268
+ children: [/* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("p", {
1269
+ className: "text-sm font-medium leading-tight",
1270
+ children: i.settings.setPassword
1271
+ }), /* @__PURE__ */ Q("p", {
1272
+ className: "text-muted text-xs mt-0.5",
1273
+ children: i.settings.setPasswordDescription
1274
+ })] }), /* @__PURE__ */ $(k, {
1275
+ size: "sm",
1276
+ isPending: s,
1277
+ isDisabled: !a,
1278
+ onPress: c,
1279
+ children: [s && /* @__PURE__ */ Q(G, {
1280
+ color: "current",
1281
+ size: "sm"
1282
+ }), i.auth.sendResetLink]
1283
+ })]
1284
+ })
1285
+ })] });
1286
+ }
1287
+ function _t({ className: e, variant: t, emailAndPassword: n, localization: r, session: i, ...a }) {
1288
+ let { authClient: o } = m(), [s, c] = X(""), [l, u] = X(""), [d, f] = X(""), { mutate: p, isPending: h } = _(o, {
1289
+ onError: (e) => {
1290
+ c(""), u(""), f(""), Y.danger(e.error?.message || e.message);
1291
+ },
1292
+ onSuccess: () => {
1293
+ c(""), u(""), f(""), Y.success(r.settings.changePasswordSuccess);
1294
+ }
1295
+ }), [g, v] = X(!1), [y, b] = X(!1), ee = (e) => {
1296
+ if (e.preventDefault(), n?.confirmPassword && l !== d) {
1297
+ c(""), u(""), f(""), Y.danger(r.auth.passwordsDoNotMatch);
1298
+ return;
1299
+ }
1300
+ p({
1301
+ currentPassword: s,
1302
+ newPassword: l,
1303
+ revokeOtherSessions: !0
1304
+ });
1305
+ };
1306
+ return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
1307
+ className: J("text-sm font-semibold mb-3"),
1308
+ children: r.settings.changePassword
1309
+ }), /* @__PURE__ */ Q(j, {
1310
+ className: J("p-4 gap-4", e),
1311
+ variant: t,
1312
+ ...a,
1313
+ children: /* @__PURE__ */ Q(j.Content, { children: /* @__PURE__ */ Q(I, {
1314
+ onSubmit: ee,
1315
+ children: /* @__PURE__ */ $(F, {
1316
+ className: "w-full gap-4",
1317
+ children: [/* @__PURE__ */ $(F.Group, { children: [
1318
+ /* @__PURE__ */ $(q, {
1319
+ name: "currentPassword",
1320
+ type: "password",
1321
+ isDisabled: h || !i,
1322
+ defaultValue: "",
1323
+ value: s,
1324
+ onChange: c,
1325
+ children: [
1326
+ /* @__PURE__ */ Q(z, { children: r.settings.currentPassword }),
1327
+ /* @__PURE__ */ Q(L, {
1328
+ className: J(!i && "hidden"),
1329
+ autoComplete: "current-password",
1330
+ placeholder: r.settings.currentPasswordPlaceholder,
1331
+ required: !0,
1332
+ variant: t === "transparent" ? "primary" : "secondary"
1333
+ }),
1334
+ !i && /* @__PURE__ */ Q(W, { className: "h-10 md:h-9 w-full rounded-xl" }),
1335
+ /* @__PURE__ */ Q(P, {})
1336
+ ]
1337
+ }),
1338
+ /* @__PURE__ */ $(q, {
1339
+ minLength: n?.minPasswordLength,
1340
+ maxLength: n?.maxPasswordLength,
1341
+ isDisabled: h || !i,
1342
+ value: l,
1343
+ onChange: u,
1344
+ children: [
1345
+ /* @__PURE__ */ Q(z, { children: r.auth.newPassword }),
1346
+ /* @__PURE__ */ $(R, {
1347
+ className: J(!i && "hidden"),
1348
+ variant: t === "transparent" ? "primary" : "secondary",
1349
+ children: [/* @__PURE__ */ Q(R.Input, {
1350
+ name: "newPassword",
1351
+ type: g ? "text" : "password",
1352
+ autoComplete: "new-password",
1353
+ placeholder: r.auth.newPasswordPlaceholder,
1354
+ required: !0
1355
+ }), /* @__PURE__ */ Q(R.Suffix, {
1356
+ className: "px-0",
1357
+ children: /* @__PURE__ */ Q(k, {
1358
+ isIconOnly: !0,
1359
+ "aria-label": g ? r.auth.hidePassword : r.auth.showPassword,
1360
+ size: "sm",
1361
+ variant: "ghost",
1362
+ onPress: () => v(!g),
1363
+ isDisabled: h,
1364
+ children: Q(g ? O : D, {})
1365
+ })
1366
+ })]
1367
+ }),
1368
+ !i && /* @__PURE__ */ Q(W, { className: "h-10 md:h-9 w-full rounded-xl" }),
1369
+ /* @__PURE__ */ Q(P, {})
1370
+ ]
1371
+ }),
1372
+ n?.confirmPassword && /* @__PURE__ */ $(q, {
1373
+ minLength: n?.minPasswordLength,
1374
+ maxLength: n?.maxPasswordLength,
1375
+ isDisabled: h || !i,
1376
+ isRequired: !0,
1377
+ value: d,
1378
+ onChange: f,
1379
+ children: [
1380
+ /* @__PURE__ */ Q(z, { children: r.auth.confirmPassword }),
1381
+ /* @__PURE__ */ $(R, {
1382
+ className: J(!i && "hidden"),
1383
+ variant: t === "transparent" ? "primary" : "secondary",
1384
+ children: [/* @__PURE__ */ Q(R.Input, {
1385
+ name: "confirmPassword",
1386
+ type: y ? "text" : "password",
1387
+ autoComplete: "new-password",
1388
+ placeholder: r.auth.confirmPasswordPlaceholder,
1389
+ required: !0
1390
+ }), /* @__PURE__ */ Q(R.Suffix, {
1391
+ className: "px-0",
1392
+ children: /* @__PURE__ */ Q(k, {
1393
+ isIconOnly: !0,
1394
+ "aria-label": y ? r.auth.hidePassword : r.auth.showPassword,
1395
+ size: "sm",
1396
+ variant: "ghost",
1397
+ onPress: () => b(!y),
1398
+ isDisabled: h,
1399
+ children: Q(y ? O : D, {})
1400
+ })
1401
+ })]
1402
+ }),
1403
+ !i && /* @__PURE__ */ Q(W, { className: "h-10 md:h-9 w-full rounded-xl" }),
1404
+ /* @__PURE__ */ Q(P, {})
1405
+ ]
1406
+ })
1407
+ ] }), /* @__PURE__ */ Q(F.Actions, { children: /* @__PURE__ */ $(k, {
1408
+ type: "submit",
1409
+ isPending: h,
1410
+ isDisabled: !i,
1411
+ size: "sm",
1412
+ children: [h && /* @__PURE__ */ Q(G, {
1413
+ color: "current",
1414
+ size: "sm"
1415
+ }), r.settings.updatePassword]
1416
+ }) })]
1417
+ })
1418
+ }) })
1419
+ })] });
1420
+ }
1421
+ //#endregion
1422
+ //#region src/components/auth/settings/security/linked-account.tsx
1423
+ function vt({ account: e, provider: t }) {
1424
+ let { authClient: n, baseURL: r, localization: i } = m(), { data: a, isPending: o } = p(n, { query: { accountId: e?.accountId } }), { mutate: s, isPending: l } = y(n), { mutate: u, isPending: d } = w(n, { onSuccess: () => Y.success(i.settings.accountUnlinked) }), h = f[t], g = c(t), _ = a?.data?.login || a?.data?.username || a?.user?.email || a?.user?.name || e?.accountId;
1425
+ return /* @__PURE__ */ $("div", {
1426
+ className: "flex items-center gap-3",
1427
+ children: [
1428
+ /* @__PURE__ */ Q("div", {
1429
+ className: J("flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary"),
1430
+ children: Q(h || _e, { className: "size-4.5" })
1431
+ }),
1432
+ /* @__PURE__ */ $("div", {
1433
+ className: "flex flex-col min-w-0",
1434
+ children: [/* @__PURE__ */ Q("span", {
1435
+ className: "text-sm font-medium leading-tight",
1436
+ children: g
1437
+ }), e && o ? /* @__PURE__ */ Q(W, { className: "h-3 w-24 my-0.5 rounded-lg" }) : /* @__PURE__ */ Q("span", {
1438
+ className: "text-xs text-muted truncate",
1439
+ children: e ? _ : i.settings.linkProvider.replace("{{provider}}", g)
1440
+ })]
1441
+ }),
1442
+ e ? /* @__PURE__ */ $(k, {
1443
+ className: "ml-auto shrink-0",
1444
+ variant: "outline",
1445
+ size: "sm",
1446
+ onPress: () => u({ providerId: e.providerId }),
1447
+ isPending: d,
1448
+ "aria-label": i.settings.unlinkProvider.replace("{{provider}}", g),
1449
+ children: [d ? /* @__PURE__ */ Q(G, {
1450
+ color: "current",
1451
+ size: "sm"
1452
+ }) : /* @__PURE__ */ Q(me, {}), i.settings.unlinkProvider.replace("{{provider}}", "").trim()]
1453
+ }) : /* @__PURE__ */ $(k, {
1454
+ className: "ml-auto shrink-0",
1455
+ variant: "outline",
1456
+ size: "sm",
1457
+ onPress: () => s({
1458
+ provider: t,
1459
+ callbackURL: `${r}${window.location.pathname}`
1460
+ }),
1461
+ isPending: l,
1462
+ "aria-label": i.settings.linkProvider.replace("{{provider}}", g),
1463
+ children: [l ? /* @__PURE__ */ Q(G, {
1464
+ color: "current",
1465
+ size: "sm"
1466
+ }) : /* @__PURE__ */ Q(pe, {}), i.settings.link]
1467
+ })
1468
+ ]
1469
+ });
1470
+ }
1471
+ //#endregion
1472
+ //#region src/components/auth/settings/security/linked-accounts.tsx
1473
+ function yt({ className: e, variant: t, ...n }) {
1474
+ let { authClient: r, localization: i, socialProviders: a } = m(), { data: o, isPending: s } = b(r), c = [...(o?.filter((e) => e.providerId !== "credential"))?.map((e) => ({
1475
+ key: e.id,
1476
+ account: e,
1477
+ provider: e.providerId
1478
+ })) ?? [], ...a?.map((e) => ({
1479
+ key: e,
1480
+ account: void 0,
1481
+ provider: e
1482
+ })) ?? []];
1483
+ return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
1484
+ className: J("text-sm font-semibold mb-3"),
1485
+ children: i.settings.linkedAccounts
1486
+ }), /* @__PURE__ */ Q(j, {
1487
+ className: J(e),
1488
+ variant: t,
1489
+ ...n,
1490
+ children: /* @__PURE__ */ Q(j.Content, {
1491
+ className: "gap-0",
1492
+ children: s ? a?.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(bt, {})] }, e)) : c.map((e, t) => /* @__PURE__ */ $("div", { children: [t > 0 && /* @__PURE__ */ Q("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ Q(vt, {
1493
+ account: e.account,
1494
+ provider: e.provider
1495
+ })] }, e.key))
1496
+ })
1497
+ })] });
1498
+ }
1499
+ function bt() {
1500
+ return /* @__PURE__ */ Q("div", {
1501
+ className: "flex items-center justify-between",
1502
+ children: /* @__PURE__ */ $("div", {
1503
+ className: "flex items-center gap-3",
1504
+ children: [/* @__PURE__ */ Q(W, { className: "size-10 rounded-xl" }), /* @__PURE__ */ $("div", {
1505
+ className: "flex flex-col gap-1",
1506
+ children: [/* @__PURE__ */ Q(W, { className: "h-4 w-20 rounded-lg" }), /* @__PURE__ */ Q(W, { className: "h-3 w-32 rounded-lg" })]
1507
+ })]
1508
+ })
1509
+ });
1510
+ }
1511
+ //#endregion
1512
+ //#region src/components/auth/settings/security/security-settings.tsx
1513
+ function xt({ className: e, variant: t, ...n }) {
1514
+ let { emailAndPassword: r, plugins: i, socialProviders: a } = m();
1515
+ return /* @__PURE__ */ $("div", {
1516
+ className: J("flex w-full flex-col gap-4 md:gap-6", e),
1517
+ ...n,
1518
+ children: [
1519
+ r?.enabled && /* @__PURE__ */ Q(ht, { variant: t }),
1520
+ !!a?.length && /* @__PURE__ */ Q(yt, { variant: t }),
1521
+ /* @__PURE__ */ Q(pt, { variant: t }),
1522
+ i.flatMap((e) => e.securityCards?.map((n, r) => /* @__PURE__ */ Q(n, { variant: t }, `${e.id}-${r.toString()}`)))
1523
+ ]
1524
+ });
1525
+ }
1526
+ //#endregion
1527
+ //#region src/components/auth/settings/settings.tsx
1528
+ function St({ className: e, hideNav: t, path: n, variant: r, view: i, ...a }) {
1529
+ if (!i && !n) throw Error("[Better Auth UI] Either `view` or `path` must be provided");
1530
+ let { authClient: o, basePaths: s, localization: c, viewPaths: l, plugins: u } = m();
1531
+ h(o);
1532
+ let d = Be(() => {
1533
+ if (i) return i;
1534
+ if (n) return [l.settings, ...u.map((e) => e.viewPaths?.settings)].flatMap((e) => Object.entries(e ?? {})).find(([, e]) => e === n)?.[0];
1535
+ }, [
1536
+ i,
1537
+ n,
1538
+ l.settings,
1539
+ u
1540
+ ]);
1541
+ if (!d) {
1542
+ let e = [l.settings, ...u.map((e) => e.viewPaths?.settings)].flatMap((e) => Object.values(e ?? {})).join(", ");
1543
+ throw Error(`[Better Auth UI] Unknown settings path "${n}". Valid paths are: ${e}`);
1544
+ }
1545
+ return /* @__PURE__ */ $(K, {
1546
+ className: J(e),
1547
+ orientation: "horizontal",
1548
+ selectedKey: d,
1549
+ ...a,
1550
+ children: [
1551
+ /* @__PURE__ */ Q(K.ListContainer, { children: /* @__PURE__ */ $(K.List, {
1552
+ "aria-label": c.settings.settings,
1553
+ className: "max-w-fit overflow-x-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
1554
+ children: [
1555
+ /* @__PURE__ */ $(K.Tab, {
1556
+ id: "account",
1557
+ href: `${s.settings}/${l.settings.account}`,
1558
+ className: "gap-2",
1559
+ onPress: (e) => e.target.scrollIntoView({
1560
+ behavior: "smooth",
1561
+ inline: "center"
1562
+ }),
1563
+ children: [
1564
+ /* @__PURE__ */ Q(he, { className: "text-muted" }),
1565
+ c.settings.account,
1566
+ /* @__PURE__ */ Q(K.Indicator, {})
1567
+ ]
1568
+ }),
1569
+ /* @__PURE__ */ $(K.Tab, {
1570
+ id: "security",
1571
+ href: `${s.settings}/${l.settings.security}`,
1572
+ className: "gap-2",
1573
+ onPress: (e) => e.target.scrollIntoView({
1574
+ behavior: "smooth",
1575
+ inline: "center"
1576
+ }),
1577
+ children: [
1578
+ /* @__PURE__ */ Q(ve, { className: "text-muted" }),
1579
+ c.settings.security,
1580
+ /* @__PURE__ */ Q(K.Indicator, {})
1581
+ ]
1582
+ }),
1583
+ u.flatMap((e) => e.settingsTabs?.map((t, n) => /* @__PURE__ */ $(K.Tab, {
1584
+ id: t.view,
1585
+ href: `${s.settings}/${e.viewPaths?.settings?.[t.view]}`,
1586
+ className: "gap-2",
1587
+ onPress: (e) => e.target.scrollIntoView({
1588
+ behavior: "smooth",
1589
+ inline: "center"
1590
+ }),
1591
+ children: [t.label, /* @__PURE__ */ Q(K.Indicator, {})]
1592
+ }, `${e.id}-${n.toString()}`)) ?? [])
1593
+ ]
1594
+ }) }),
1595
+ /* @__PURE__ */ Q(K.Panel, {
1596
+ id: "account",
1597
+ className: "px-0",
1598
+ children: /* @__PURE__ */ Q(ut, { variant: r })
1599
+ }),
1600
+ /* @__PURE__ */ Q(K.Panel, {
1601
+ id: "security",
1602
+ className: "px-0",
1603
+ children: /* @__PURE__ */ Q(xt, { variant: r })
1604
+ }),
1605
+ u.flatMap((e) => e.settingsTabs?.map((t, n) => /* @__PURE__ */ Q(K.Panel, {
1606
+ id: t.view,
1607
+ className: "px-0",
1608
+ children: /* @__PURE__ */ Q(t.component, { variant: r })
1609
+ }, `${e.id}-${n.toString()}`)))
1610
+ ]
1611
+ });
1612
+ }
1613
+ //#endregion
1614
+ //#region src/components/auth/user/user-button.tsx
1615
+ function Ct(e, t) {
1616
+ if (Re(e)) return e;
1617
+ let { label: n, href: r, icon: i, variant: a } = e;
1618
+ return /* @__PURE__ */ $(N.Item, {
1619
+ href: r,
1620
+ variant: a,
1621
+ textValue: typeof n == "string" ? n : void 0,
1622
+ children: [i, /* @__PURE__ */ Q(z, { children: n })]
1623
+ }, t);
1624
+ }
1625
+ function wt({ className: e, placement: t, size: r = "default", variant: a = "ghost", links: o, hideSettings: s, hideSubtitle: c }) {
1626
+ let { authClient: l, basePaths: u, viewPaths: d, localization: f, plugins: p } = m(), { data: h, isPending: g } = C(l), _ = p.flatMap((e) => e.userMenuItems?.map((t, n) => /* @__PURE__ */ Q(t, { hideSubtitle: c }, `${e.id}-${n.toString()}`)) ?? []), v = o?.flatMap((e, t) => {
1627
+ if (!Re(e)) {
1628
+ let t = e.visibility ?? "always";
1629
+ if (t === "authenticated" && !h || t === "unauthenticated" && h) return [];
1630
+ }
1631
+ return [Ct(e, `user-button-link-${t.toString()}`)];
1632
+ });
1633
+ return /* @__PURE__ */ $(N, { children: [r === "icon" ? /* @__PURE__ */ Q(N.Trigger, {
1634
+ className: J("rounded-full", e),
1635
+ children: /* @__PURE__ */ Q(n, {})
1636
+ }) : /* @__PURE__ */ $(k, {
1637
+ variant: a,
1638
+ className: J("h-auto font-normal justify-start px-2 py-2 text-left", e),
1639
+ children: [h || g ? /* @__PURE__ */ Q(i, {
1640
+ isPending: g,
1641
+ hideSubtitle: c
1642
+ }) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q(n, {}), /* @__PURE__ */ Q("p", {
1643
+ className: "text-sm font-medium",
1644
+ children: f.auth.account
1645
+ })] }), /* @__PURE__ */ Q(ce, { className: "ml-auto size-3 text-muted" })]
1646
+ }), /* @__PURE__ */ $(N.Popover, {
1647
+ placement: t,
1648
+ className: "min-w-40 md:min-w-56 max-w-[48svw]",
1649
+ children: [h && /* @__PURE__ */ Q("div", {
1650
+ className: "px-3 pt-3 pb-1",
1651
+ children: /* @__PURE__ */ Q(i, { hideSubtitle: c })
1652
+ }), /* @__PURE__ */ Q(N.Menu, { children: h ? /* @__PURE__ */ $(Z, { children: [
1653
+ v,
1654
+ !s && /* @__PURE__ */ $(N.Item, {
1655
+ textValue: f.settings.settings,
1656
+ href: `${u.settings}/${d.settings.account}`,
1657
+ children: [/* @__PURE__ */ Q(fe, { className: "text-muted" }), /* @__PURE__ */ Q(z, { children: f.settings.settings })]
1658
+ }),
1659
+ _,
1660
+ /* @__PURE__ */ $(N.Item, {
1661
+ textValue: f.auth.signOut,
1662
+ href: `${u.auth}/${d.auth.signOut}`,
1663
+ variant: "danger",
1664
+ children: [/* @__PURE__ */ Q(T, { className: "text-danger" }), /* @__PURE__ */ Q(z, { children: f.auth.signOut })]
1665
+ })
1666
+ ] }) : /* @__PURE__ */ $(Z, { children: [
1667
+ v,
1668
+ /* @__PURE__ */ $(N.Item, {
1669
+ textValue: f.auth.signIn,
1670
+ href: `${u.auth}/${d.auth.signIn}`,
1671
+ children: [/* @__PURE__ */ Q(se, { className: "text-muted" }), /* @__PURE__ */ Q(z, { children: f.auth.signIn })]
1672
+ }),
1673
+ /* @__PURE__ */ $(N.Item, {
1674
+ textValue: f.auth.signUp,
1675
+ href: `${u.auth}/${d.auth.signUp}`,
1676
+ children: [/* @__PURE__ */ Q(ge, { className: "text-muted" }), /* @__PURE__ */ Q(z, { children: f.auth.signUp })]
1677
+ }),
1678
+ _
1679
+ ] }) })]
1680
+ })] });
1681
+ }
1682
+ //#endregion
1683
+ export { ut as AccountSettings, pt as ActiveSessions, Xe as AdditionalField, it as Auth, ot as AuthProvider, st as ChangeEmail, ht as ChangePassword, Ze as ForgotPassword, yt as LinkedAccounts, t as ProviderButton, r as ProviderButtons, Qe as ResetPassword, xt as SecuritySettings, St as Settings, $e as SignIn, et as SignOut, tt as SignUp, n as UserAvatar, wt as UserButton, lt as UserProfile, i as UserView };