@daveyplate/better-auth-ui
Version:
Plug & play shadcn/ui components for better-auth
1,505 lines (1,480 loc) • 406 kB
JavaScript
"use client"
import {
EmailTemplate
} from "./chunk-QLUF2NOV.js";
import {
AuthUIContext,
AuthUIProvider,
authLocalization,
useAuthData,
useIsHydrated,
useLang,
useTheme
} from "./chunk-55N7AJAE.js";
import {
authViewPaths,
cn,
getAuthViewByPath,
getLocalizedError,
getPasswordSchema,
getSearchParam,
isValidEmail
} from "./chunk-X44IQ7M2.js";
// src/components/auth/auth-callback.tsx
import { Loader2 } from "lucide-react";
import { useContext as useContext2, useEffect as useEffect2, useRef } from "react";
// src/hooks/use-success-transition.ts
import {
useCallback,
useContext,
useEffect,
useState,
useTransition
} from "react";
function useOnSuccessTransition({
redirectTo: redirectToProp
}) {
const { redirectTo: contextRedirectTo } = useContext(AuthUIContext);
const getRedirectTo = useCallback(
() => redirectToProp || getSearchParam("redirectTo") || contextRedirectTo,
[redirectToProp, contextRedirectTo]
);
const [isPending, startTransition] = useTransition();
const [success, setSuccess] = useState(false);
const {
navigate,
hooks: { useSession },
onSessionChange
} = useContext(AuthUIContext);
const { refetch: refetchSession } = useSession();
useEffect(() => {
if (!success || isPending) return;
startTransition(() => {
navigate(getRedirectTo());
});
}, [success, isPending, navigate, getRedirectTo]);
const onSuccess = useCallback(async () => {
await (refetchSession == null ? void 0 : refetchSession());
setSuccess(true);
if (onSessionChange) startTransition(onSessionChange);
}, [refetchSession, onSessionChange]);
return { onSuccess, isPending };
}
// src/components/auth/auth-callback.tsx
import { jsx } from "react/jsx-runtime";
function AuthCallback({ redirectTo }) {
const {
hooks: { useIsRestoring },
persistClient
} = useContext2(AuthUIContext);
const isRestoring = useIsRestoring == null ? void 0 : useIsRestoring();
const isRedirecting = useRef(false);
const { onSuccess } = useOnSuccessTransition({ redirectTo });
useEffect2(() => {
if (isRedirecting.current) return;
if (!persistClient) {
isRedirecting.current = true;
onSuccess();
return;
}
if (isRestoring) return;
isRedirecting.current = true;
onSuccess();
}, [isRestoring, persistClient, onSuccess]);
return /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" });
}
// src/components/auth/auth-card.tsx
import { ArrowLeftIcon, Loader2 as Loader229 } from "lucide-react";
import { useContext as useContext75, useEffect as useEffect19, useState as useState33 } from "react";
// src/components/provider-icons.tsx
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
var AppleIcon = ({ className }) => /* @__PURE__ */ jsx2(
"svg",
{
className,
viewBox: "0 0 32 32",
xmlns: "http://www.w3.org/2000/svg",
children: /* @__PURE__ */ jsx2(
"path",
{
d: "M9.438 31.401a7 7 0 0 1-1.656-1.536a20 20 0 0 1-1.422-1.938a18.9 18.9 0 0 1-2.375-4.849c-.667-2-.99-3.917-.99-5.792c0-2.094.453-3.922 1.339-5.458a7.7 7.7 0 0 1 2.797-2.906a7.45 7.45 0 0 1 3.786-1.12q.705.002 1.51.198c.385.109.854.281 1.427.495c.729.281 1.13.453 1.266.495c.427.156.786.224 1.068.224c.214 0 .516-.068.859-.172c.193-.068.557-.188 1.078-.411c.516-.188.922-.349 1.245-.469c.495-.146.974-.281 1.401-.349a6.7 6.7 0 0 1 1.531-.063a9 9 0 0 1 2.589.557c1.359.547 2.458 1.401 3.276 2.615a6.4 6.4 0 0 0-.969.734a8.2 8.2 0 0 0-1.641 2.005a6.8 6.8 0 0 0-.859 3.359c.021 1.443.391 2.714 1.12 3.813a7.2 7.2 0 0 0 2.047 2.047c.417.281.776.474 1.12.604c-.161.5-.333.984-.536 1.464a19 19 0 0 1-1.667 3.083c-.578.839-1.031 1.464-1.375 1.88c-.536.635-1.052 1.12-1.573 1.458c-.573.38-1.25.583-1.938.583a4.4 4.4 0 0 1-1.38-.167c-.385-.13-.766-.271-1.141-.432a9 9 0 0 0-1.203-.453a6.3 6.3 0 0 0-3.099-.005c-.417.12-.818.26-1.214.432c-.557.234-.927.391-1.141.458c-.427.125-.87.203-1.318.229c-.693 0-1.339-.198-1.979-.599zm9.14-24.615c-.906.453-1.771.646-2.63.583c-.135-.865 0-1.75.359-2.719a7.3 7.3 0 0 1 1.333-2.24A7.1 7.1 0 0 1 19.812.733q1.319-.68 2.521-.734c.104.906 0 1.797-.333 2.76a8 8 0 0 1-1.333 2.344a6.8 6.8 0 0 1-2.115 1.682z",
fill: "currentColor"
}
)
}
);
var DiscordIcon = ({ className }) => /* @__PURE__ */ jsx2(
"svg",
{
className,
viewBox: "0 0 256 199",
xmlns: "http://www.w3.org/2000/svg",
children: /* @__PURE__ */ jsx2(
"path",
{
d: "M216.856 16.597A208.5 208.5 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046q-29.538-4.442-58.533 0c-1.832-4.4-4.55-9.933-6.846-14.046a207.8 207.8 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161 161 0 0 0 79.735 175.3a136.4 136.4 0 0 1-21.846-10.632a109 109 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a132 132 0 0 0 5.355 4.237a136 136 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848c21.142-6.58 42.646-16.637 64.815-33.213c5.316-56.288-9.08-105.09-38.056-148.36M85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2s23.236 11.804 23.015 26.2c.02 14.375-10.148 26.18-23.015 26.18m85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2c0 14.375-10.148 26.18-23.015 26.18",
fill: "#5865f2"
}
)
}
);
var DropboxIcon = ({ className }) => /* @__PURE__ */ jsx2(
"svg",
{
className,
viewBox: "0 0 256 218",
xmlns: "http://www.w3.org/2000/svg",
children: /* @__PURE__ */ jsx2(
"path",
{
d: "M63.995 0L0 40.771l63.995 40.772L128 40.771zM192 0l-64 40.775l64 40.775l64.001-40.775zM0 122.321l63.995 40.772L128 122.321L63.995 81.55zM192 81.55l-64 40.775l64 40.774l64-40.774zM64 176.771l64.005 40.772L192 176.771L128.005 136z",
fill: "#0061ff"
}
)
}
);
var FacebookIcon = ({ className }) => /* @__PURE__ */ jsxs(
"svg",
{
className,
viewBox: "0 0 256 256",
xmlns: "http://www.w3.org/2000/svg",
children: [
/* @__PURE__ */ jsx2(
"path",
{
d: "M256 128C256 57.308 198.692 0 128 0S0 57.308 0 128c0 63.888 46.808 116.843 108 126.445V165H75.5v-37H108V99.8c0-32.08 19.11-49.8 48.348-49.8C170.352 50 185 52.5 185 52.5V84h-16.14C152.959 84 148 93.867 148 103.99V128h35.5l-5.675 37H148v89.445c61.192-9.602 108-62.556 108-126.445",
fill: "#1877f2"
}
),
/* @__PURE__ */ jsx2(
"path",
{
d: "m177.825 165l5.675-37H148v-24.01C148 93.866 152.959 84 168.86 84H185V52.5S170.352 50 156.347 50C127.11 50 108 67.72 108 99.8V128H75.5v37H108v89.445A129 129 0 0 0 128 256a129 129 0 0 0 20-1.555V165z",
fill: "#fff"
}
)
]
}
);
var GitHubIcon = ({ className }) => /* @__PURE__ */ jsx2(
"svg",
{
className,
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
children: /* @__PURE__ */ jsx2(
"path",
{
d: "M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12",
fill: "currentColor"
}
)
}
);
var GitLabIcon = ({ className }) => /* @__PURE__ */ jsxs(
"svg",
{
className,
viewBox: "0 0 256 236",
xmlns: "http://www.w3.org/2000/svg",
children: [
/* @__PURE__ */ jsx2("path", { d: "m128.075 236.075l47.104-144.97H80.97z", fill: "#e24329" }),
/* @__PURE__ */ jsx2("path", { d: "M128.075 236.074L80.97 91.104H14.956z", fill: "#fc6d26" }),
/* @__PURE__ */ jsx2(
"path",
{
d: "M14.956 91.104L.642 135.16a9.75 9.75 0 0 0 3.542 10.903l123.891 90.012z",
fill: "#fca326"
}
),
/* @__PURE__ */ jsx2(
"path",
{
d: "M14.956 91.105H80.97L52.601 3.79c-1.46-4.493-7.816-4.492-9.275 0z",
fill: "#e24329"
}
),
/* @__PURE__ */ jsx2("path", { d: "m128.075 236.074l47.104-144.97h66.015z", fill: "#fc6d26" }),
/* @__PURE__ */ jsx2(
"path",
{
d: "m241.194 91.104l14.314 44.056a9.75 9.75 0 0 1-3.543 10.903l-123.89 90.012z",
fill: "#fca326"
}
),
/* @__PURE__ */ jsx2(
"path",
{
d: "M241.194 91.105h-66.015l28.37-87.315c1.46-4.493 7.816-4.492 9.275 0z",
fill: "#e24329"
}
)
]
}
);
var GoogleIcon = ({ className }) => /* @__PURE__ */ jsxs(
"svg",
{
className,
viewBox: "0 0 256 262",
xmlns: "http://www.w3.org/2000/svg",
children: [
/* @__PURE__ */ jsx2(
"path",
{
d: "M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027",
fill: "#4285f4"
}
),
/* @__PURE__ */ jsx2(
"path",
{
d: "M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1",
fill: "#34a853"
}
),
/* @__PURE__ */ jsx2(
"path",
{
d: "M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z",
fill: "#fbbc05"
}
),
/* @__PURE__ */ jsx2(
"path",
{
d: "M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251",
fill: "#eb4335"
}
)
]
}
);
var KickIcon = ({ className }) => /* @__PURE__ */ jsx2(
"svg",
{
className,
xmlns: "http://www.w3.org/2000/svg",
width: 24,
height: 24,
viewBox: "0 0 24 24",
children: /* @__PURE__ */ jsx2(
"path",
{
fill: "currentColor",
d: "M1.333 0h8v5.333H12V2.667h2.667V0h8v8H20v2.667h-2.667v2.666H20V16h2.667v8h-8v-2.667H12v-2.666H9.333V24h-8Z"
}
)
}
);
var LinkedInIcon = ({ className }) => /* @__PURE__ */ jsxs(
"svg",
{
className,
viewBox: "0 0 128 128",
xmlns: "http://www.w3.org/2000/svg",
children: [
/* @__PURE__ */ jsx2(
"path",
{
d: "M116 3H12a8.91 8.91 0 0 0-9 8.8v104.42a8.91 8.91 0 0 0 9 8.78h104a8.93 8.93 0 0 0 9-8.81V11.77A8.93 8.93 0 0 0 116 3",
fill: "#0076b2"
}
),
/* @__PURE__ */ jsx2(
"path",
{
d: "M21.06 48.73h18.11V107H21.06zm9.06-29a10.5 10.5 0 1 1-10.5 10.49a10.5 10.5 0 0 1 10.5-10.49m20.41 29h17.36v8h.24c2.42-4.58 8.32-9.41 17.13-9.41C103.6 47.28 107 59.35 107 75v32H88.89V78.65c0-6.75-.12-15.44-9.41-15.44s-10.87 7.36-10.87 15V107H50.53z",
fill: "#fff"
}
)
]
}
);
var MicrosoftIcon = ({ className }) => /* @__PURE__ */ jsxs(
"svg",
{
className,
viewBox: "0 0 256 256",
xmlns: "http://www.w3.org/2000/svg",
children: [
/* @__PURE__ */ jsx2("path", { d: "M121.666 121.666H0V0h121.666z", fill: "#f1511b" }),
/* @__PURE__ */ jsx2("path", { d: "M256 121.666H134.335V0H256z", fill: "#80cc28" }),
/* @__PURE__ */ jsx2("path", { d: "M121.663 256.002H0V134.336h121.663z", fill: "#00adef" }),
/* @__PURE__ */ jsx2("path", { d: "M256 256.002H134.335V134.336H256z", fill: "#fbbc09" })
]
}
);
var RedditIcon = ({ className }) => /* @__PURE__ */ jsxs(
"svg",
{
className,
viewBox: "0 0 256 256",
xmlns: "http://www.w3.org/2000/svg",
children: [
/* @__PURE__ */ jsx2("circle", { cx: "128", cy: "128", fill: "#ff4500", r: "128" }),
/* @__PURE__ */ jsx2(
"path",
{
d: "M213.15 129.22c0-10.376-8.391-18.617-18.617-18.617a18.74 18.74 0 0 0-12.97 5.189c-12.818-9.157-30.368-15.107-49.9-15.87l8.544-39.981l27.773 5.95c.307 7.02 6.104 12.667 13.278 12.667c7.324 0 13.275-5.95 13.275-13.278c0-7.324-5.95-13.275-13.275-13.275c-5.188 0-9.768 3.052-11.904 7.478l-30.976-6.562c-.916-.154-1.832 0-2.443.458c-.763.458-1.22 1.22-1.371 2.136l-9.464 44.558c-19.837.612-37.692 6.562-50.662 15.872a18.74 18.74 0 0 0-12.971-5.188c-10.377 0-18.617 8.391-18.617 18.617c0 7.629 4.577 14.037 10.988 16.939a33.6 33.6 0 0 0-.458 5.646c0 28.686 33.42 52.036 74.621 52.036c41.202 0 74.622-23.196 74.622-52.036a35 35 0 0 0-.458-5.646c6.408-2.902 10.985-9.464 10.985-17.093M85.272 142.495c0-7.324 5.95-13.275 13.278-13.275c7.324 0 13.275 5.95 13.275 13.275s-5.95 13.278-13.275 13.278c-7.327.15-13.278-5.953-13.278-13.278m74.317 35.251c-9.156 9.157-26.553 9.768-31.588 9.768c-5.188 0-22.584-.765-31.59-9.768c-1.371-1.373-1.371-3.51 0-4.883c1.374-1.371 3.51-1.371 4.884 0c5.8 5.8 18.008 7.782 26.706 7.782s21.058-1.983 26.704-7.782c1.374-1.371 3.51-1.371 4.884 0c1.22 1.373 1.22 3.51 0 4.883m-2.443-21.822c-7.325 0-13.275-5.95-13.275-13.275s5.95-13.275 13.275-13.275c7.327 0 13.277 5.95 13.277 13.275c0 7.17-5.95 13.275-13.277 13.275",
fill: "#fff"
}
)
]
}
);
var RobloxIcon = ({ className }) => /* @__PURE__ */ jsx2(
"svg",
{
className,
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
children: /* @__PURE__ */ jsx2(
"path",
{
d: "M18.926 23.998L0 18.892L5.075.002L24 5.108ZM15.348 10.09l-5.282-1.453l-1.414 5.273l5.282 1.453z",
fill: "currentColor"
}
)
}
);
var SpotifyIcon = ({ className }) => /* @__PURE__ */ jsx2(
"svg",
{
className,
viewBox: "0 0 256 256",
xmlns: "http://www.w3.org/2000/svg",
children: /* @__PURE__ */ jsx2(
"path",
{
d: "M128 0C57.308 0 0 57.309 0 128c0 70.696 57.309 128 128 128c70.697 0 128-57.304 128-128C256 57.314 198.697.007 127.998.007zm58.699 184.614c-2.293 3.76-7.215 4.952-10.975 2.644c-30.053-18.357-67.885-22.515-112.44-12.335a7.98 7.98 0 0 1-9.552-6.007a7.97 7.97 0 0 1 6-9.553c48.76-11.14 90.583-6.344 124.323 14.276c3.76 2.308 4.952 7.215 2.644 10.975m15.667-34.853c-2.89 4.695-9.034 6.178-13.726 3.289c-34.406-21.148-86.853-27.273-127.548-14.92c-5.278 1.594-10.852-1.38-12.454-6.649c-1.59-5.278 1.386-10.842 6.655-12.446c46.485-14.106 104.275-7.273 143.787 17.007c4.692 2.89 6.175 9.034 3.286 13.72zm1.345-36.293C162.457 88.964 94.394 86.71 55.007 98.666c-6.325 1.918-13.014-1.653-14.93-7.978c-1.917-6.328 1.65-13.012 7.98-14.935C93.27 62.027 168.434 64.68 215.929 92.876c5.702 3.376 7.566 10.724 4.188 16.405c-3.362 5.69-10.73 7.565-16.4 4.187z",
fill: "#1ed760"
}
)
}
);
var TikTokIcon = ({ className }) => /* @__PURE__ */ jsxs(
"svg",
{
className,
viewBox: "0 0 256 290",
xmlns: "http://www.w3.org/2000/svg",
children: [
/* @__PURE__ */ jsx2(
"path",
{
d: "M189.72 104.421c18.678 13.345 41.56 21.197 66.273 21.197v-47.53a67 67 0 0 1-13.918-1.456v37.413c-24.711 0-47.59-7.851-66.272-21.195v96.996c0 48.523-39.356 87.855-87.9 87.855c-18.113 0-34.949-5.473-48.934-14.86c15.962 16.313 38.222 26.432 62.848 26.432c48.548 0 87.905-39.332 87.905-87.857v-96.995zm17.17-47.952c-9.546-10.423-15.814-23.893-17.17-38.785v-6.113h-13.189c3.32 18.927 14.644 35.097 30.358 44.898M69.673 225.607a40 40 0 0 1-8.203-24.33c0-22.192 18.001-40.186 40.21-40.186a40.3 40.3 0 0 1 12.197 1.883v-48.593c-4.61-.631-9.262-.9-13.912-.801v37.822a40.3 40.3 0 0 0-12.203-1.882c-22.208 0-40.208 17.992-40.208 40.187c0 15.694 8.997 29.281 22.119 35.9",
fill: "#ff004f"
}
),
/* @__PURE__ */ jsx2("path", { d: "M175.803 92.849c18.683 13.344 41.56 21.195 66.272 21.195V76.631c-13.794-2.937-26.005-10.141-35.186-20.162c-15.715-9.802-27.038-25.972-30.358-44.898h-34.643v189.843c-.079 22.132-18.049 40.052-40.21 40.052c-13.058 0-24.66-6.221-32.007-15.86c-13.12-6.618-22.118-20.206-22.118-35.898c0-22.193 18-40.187 40.208-40.187c4.255 0 8.356.662 12.203 1.882v-37.822c-47.692.985-86.047 39.933-86.047 87.834c0 23.912 9.551 45.589 25.053 61.428c13.985 9.385 30.82 14.86 48.934 14.86c48.545 0 87.9-39.335 87.9-87.857z" }),
/* @__PURE__ */ jsx2(
"path",
{
d: "M242.075 76.63V66.516a66.3 66.3 0 0 1-35.186-10.047a66.47 66.47 0 0 0 35.186 20.163M176.53 11.57a68 68 0 0 1-.728-5.457V0h-47.834v189.845c-.076 22.13-18.046 40.05-40.208 40.05a40.06 40.06 0 0 1-18.09-4.287c7.347 9.637 18.949 15.857 32.007 15.857c22.16 0 40.132-17.918 40.21-40.05V11.571zM99.966 113.58v-10.769a89 89 0 0 0-12.061-.818C39.355 101.993 0 141.327 0 189.845c0 30.419 15.467 57.227 38.971 72.996c-15.502-15.838-25.053-37.516-25.053-61.427c0-47.9 38.354-86.848 86.048-87.833",
fill: "#00f2ea"
}
)
]
}
);
var TwitchIcon = ({ className }) => /* @__PURE__ */ jsxs(
"svg",
{
className,
id: "Layer_1",
version: "1.1",
viewBox: "0 0 2400 2800",
x: "0px",
xmlSpace: "preserve",
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink",
y: "0px",
children: [
/* @__PURE__ */ jsx2("style", { type: "text/css", children: `
.st0{fill:#FFFFFF}
.st1{fill:#9146FF}
` }),
/* @__PURE__ */ jsx2("title", { children: "Asset 2" }),
/* @__PURE__ */ jsxs("g", { children: [
/* @__PURE__ */ jsx2(
"polygon",
{
className: "st0",
points: "2200,1300 1800,1700 1400,1700 1050,2050 1050,1700 600,1700 600,200 2200,200"
}
),
/* @__PURE__ */ jsx2("g", { children: /* @__PURE__ */ jsxs("g", { id: "Layer_1-2", children: [
/* @__PURE__ */ jsx2(
"path",
{
className: "st1",
d: "M500,0L0,500v1800h600v500l500-500h400l900-900V0H500z M2200,1300l-400,400h-400l-350,350v-350H600V200h1600V1300z"
}
),
/* @__PURE__ */ jsx2(
"rect",
{
className: "st1",
height: "600",
width: "200",
x: "1700",
y: "550"
}
),
/* @__PURE__ */ jsx2(
"rect",
{
className: "st1",
height: "600",
width: "200",
x: "1150",
y: "550"
}
)
] }) })
] })
]
}
);
var VKIcon = ({ className }) => /* @__PURE__ */ jsx2(
"svg",
{
className,
viewBox: "0 0 576 512",
xmlns: "http://www.w3.org/2000/svg",
children: /* @__PURE__ */ jsx2(
"path",
{
d: "M545 117.7c3.7-12.5 0-21.7-17.8-21.7h-58.9c-15 0-21.9 7.9-25.6 16.7c0 0-30 73.1-72.4 120.5c-13.7 13.7-20 18.1-27.5 18.1c-3.7 0-9.4-4.4-9.4-16.9V117.7c0-15-4.2-21.7-16.6-21.7h-92.6c-9.4 0-15 7-15 13.5c0 14.2 21.2 17.5 23.4 57.5v86.8c0 19-3.4 22.5-10.9 22.5c-20 0-68.6-73.4-97.4-157.4c-5.8-16.3-11.5-22.9-26.6-22.9H38.8c-16.8 0-20.2 7.9-20.2 16.7c0 15.6 20 93.1 93.1 195.5C160.4 378.1 229 416 291.4 416c37.5 0 42.1-8.4 42.1-22.9c0-66.8-3.4-73.1 15.4-73.1c8.7 0 23.7 4.4 58.7 38.1c40 40 46.6 57.9 69 57.9h58.9c16.8 0 25.3-8.4 20.4-25c-11.2-34.9-86.9-106.7-90.3-111.5c-8.7-11.2-6.2-16.2 0-26.2c.1-.1 72-101.3 79.4-135.6",
fill: "currentColor"
}
)
}
);
var XIcon = ({ className }) => /* @__PURE__ */ jsx2(
"svg",
{
className,
viewBox: "0 0 512 512",
xmlns: "http://www.w3.org/2000/svg",
children: /* @__PURE__ */ jsx2(
"path",
{
d: "M389.2 48h70.6L305.6 224.2L487 464H345L233.7 318.6L106.5 464H35.8l164.9-188.5L26.8 48h145.6l100.5 132.9zm-24.8 373.8h39.1L151.1 88h-42z",
fill: "currentColor"
}
)
}
);
var ZoomIcon = ({ className }) => /* @__PURE__ */ jsx2(
"svg",
{
className,
xmlns: "http://www.w3.org/2000/svg",
width: 512,
height: 117,
viewBox: "0 0 512 117",
children: /* @__PURE__ */ jsx2(
"path",
{
fill: "#0b5cff",
d: "M107.472 114.706H16.348c-5.968 0-11.791-3.203-14.557-8.589C-1.41 99.858-.247 92.434 4.702 87.63L68.17 24.164H22.607C10.088 24.164.044 13.974.044 1.6h83.992c5.968 0 11.79 3.203 14.556 8.589c3.203 6.259 2.038 13.683-2.911 18.486L32.214 92.143h52.55c12.518 0 22.708 10.19 22.708 22.563M468.183 0c-13.1 0-24.746 5.677-32.898 14.702C427.134 5.677 415.488 0 402.388 0c-24.164 0-43.961 20.67-43.961 44.834v69.872c12.518 0 22.562-10.19 22.562-22.563V44.689c0-11.646 9.025-21.544 20.67-21.98c12.228-.437 22.272 9.315 22.272 21.397v48.037c0 12.519 10.19 22.563 22.563 22.563V44.543c0-11.645 9.025-21.544 20.67-21.98c12.228-.437 22.272 9.316 22.272 21.398v48.036c0 12.52 10.19 22.563 22.563 22.563V44.69C512.144 20.67 492.347 0 468.183 0M221.595 58.226c0 32.17-26.056 58.226-58.226 58.226s-58.226-26.056-58.226-58.226S131.199 0 163.369 0s58.226 26.056 58.226 58.226m-22.563 0c0-19.651-16.012-35.663-35.663-35.663s-35.664 16.012-35.664 35.663c0 19.652 16.013 35.664 35.664 35.664s35.663-16.012 35.663-35.664m148.04 0c0 32.17-26.056 58.226-58.226 58.226S230.62 90.396 230.62 58.226S256.676 0 288.846 0s58.227 26.056 58.227 58.226m-22.562 0c0-19.651-16.012-35.663-35.664-35.663c-19.65 0-35.663 16.012-35.663 35.663c0 19.652 16.012 35.664 35.663 35.664c19.652 0 35.664-16.012 35.664-35.664"
}
)
}
);
// src/lib/social-providers.ts
var socialProviders = [
{
provider: "apple",
name: "Apple",
icon: AppleIcon
},
{
provider: "discord",
name: "Discord",
icon: DiscordIcon
},
{
provider: "dropbox",
name: "Dropbox",
icon: DropboxIcon
},
{
provider: "facebook",
name: "Facebook",
icon: FacebookIcon
},
{
provider: "github",
name: "GitHub",
icon: GitHubIcon
},
{
provider: "gitlab",
name: "GitLab",
icon: GitLabIcon
},
{
provider: "google",
name: "Google",
icon: GoogleIcon
},
{
provider: "kick",
name: "Kick",
icon: KickIcon
},
{
provider: "linkedin",
name: "LinkedIn",
icon: LinkedInIcon
},
{
provider: "microsoft",
name: "Microsoft",
icon: MicrosoftIcon
},
{
provider: "reddit",
name: "Reddit",
icon: RedditIcon
},
{
provider: "roblox",
name: "Roblox",
icon: RobloxIcon
},
{
provider: "spotify",
name: "Spotify",
icon: SpotifyIcon
},
{
provider: "tiktok",
name: "TikTok",
icon: TikTokIcon
},
{
provider: "twitch",
name: "Twitch",
icon: TwitchIcon
},
{
provider: "vk",
name: "VK",
icon: VKIcon
},
{
provider: "twitter",
name: "X",
icon: XIcon
},
{
provider: "zoom",
name: "Zoom",
icon: ZoomIcon
}
];
// src/components/organization/accept-invitation-card.tsx
import { CheckIcon, Loader2 as Loader22, XIcon as XIcon2 } from "lucide-react";
import { useContext as useContext6, useEffect as useEffect4, useMemo, useState as useState2 } from "react";
// src/hooks/use-authenticate.ts
import { useContext as useContext3, useEffect as useEffect3 } from "react";
function useAuthenticate(options) {
const { authView = "SIGN_IN", enabled = true } = options ?? {};
const {
hooks: { useSession },
basePath,
viewPaths,
replace
} = useContext3(AuthUIContext);
const { data, isPending, error, refetch } = useSession();
const sessionData = data;
useEffect3(() => {
if (!enabled || isPending || sessionData) return;
replace(
`${basePath}/${viewPaths[authView]}?redirectTo=${window.location.href.replace(window.location.origin, "")}`
);
}, [
isPending,
sessionData,
basePath,
viewPaths,
replace,
authView,
enabled
]);
return {
data: sessionData,
user: sessionData == null ? void 0 : sessionData.user,
isPending,
error,
refetch
};
}
// src/components/ui/button.tsx
import { Slot } from "@radix-ui/react-slot";
import { cva } from "class-variance-authority";
import { jsx as jsx3 } from "react/jsx-runtime";
var buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
link: "text-primary underline-offset-4 hover:underline"
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
icon: "size-9"
}
},
defaultVariants: {
variant: "default",
size: "default"
}
}
);
function Button({
className,
variant,
size,
asChild = false,
...props
}) {
const Comp = asChild ? Slot : "button";
return /* @__PURE__ */ jsx3(
Comp,
{
"data-slot": "button",
className: cn(buttonVariants({ variant, size, className })),
...props
}
);
}
// src/components/ui/card.tsx
import { jsx as jsx4 } from "react/jsx-runtime";
function Card({ className, ...props }) {
return /* @__PURE__ */ jsx4(
"div",
{
"data-slot": "card",
className: cn(
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
className
),
...props
}
);
}
function CardHeader({ className, ...props }) {
return /* @__PURE__ */ jsx4(
"div",
{
"data-slot": "card-header",
className: cn(
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
className
),
...props
}
);
}
function CardTitle({ className, ...props }) {
return /* @__PURE__ */ jsx4(
"div",
{
"data-slot": "card-title",
className: cn("leading-none font-semibold", className),
...props
}
);
}
function CardDescription({ className, ...props }) {
return /* @__PURE__ */ jsx4(
"div",
{
"data-slot": "card-description",
className: cn("text-muted-foreground text-sm", className),
...props
}
);
}
function CardContent({ className, ...props }) {
return /* @__PURE__ */ jsx4(
"div",
{
"data-slot": "card-content",
className: cn("px-6", className),
...props
}
);
}
function CardFooter({ className, ...props }) {
return /* @__PURE__ */ jsx4(
"div",
{
"data-slot": "card-footer",
className: cn("flex items-center px-6 [.border-t]:pt-6", className),
...props
}
);
}
// src/components/ui/skeleton.tsx
import { jsx as jsx5 } from "react/jsx-runtime";
function Skeleton({ className, ...props }) {
return /* @__PURE__ */ jsx5(
"div",
{
"data-slot": "skeleton",
className: cn("bg-accent animate-pulse rounded-md", className),
...props
}
);
}
// src/components/organization/organization-view.tsx
import { useContext as useContext5 } from "react";
// src/components/organization/organization-logo.tsx
import { BuildingIcon } from "lucide-react";
import { useContext as useContext4 } from "react";
// src/components/ui/avatar.tsx
import * as AvatarPrimitive from "@radix-ui/react-avatar";
import { jsx as jsx6 } from "react/jsx-runtime";
function Avatar({
className,
...props
}) {
return /* @__PURE__ */ jsx6(
AvatarPrimitive.Root,
{
"data-slot": "avatar",
className: cn(
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
className
),
...props
}
);
}
function AvatarImage({
className,
...props
}) {
return /* @__PURE__ */ jsx6(
AvatarPrimitive.Image,
{
"data-slot": "avatar-image",
className: cn("aspect-square size-full", className),
...props
}
);
}
function AvatarFallback({
className,
...props
}) {
return /* @__PURE__ */ jsx6(
AvatarPrimitive.Fallback,
{
"data-slot": "avatar-fallback",
className: cn(
"bg-muted flex size-full items-center justify-center rounded-full",
className
),
...props
}
);
}
// src/components/organization/organization-logo.tsx
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
function OrganizationLogo({
className,
classNames,
isPending,
size,
organization,
localization: propLocalization,
...props
}) {
const { localization: contextLocalization } = useContext4(AuthUIContext);
const localization = { ...contextLocalization, ...propLocalization };
const name = organization == null ? void 0 : organization.name;
const src = organization == null ? void 0 : organization.logo;
if (isPending) {
return /* @__PURE__ */ jsx7(
Skeleton,
{
className: cn(
"shrink-0 rounded-full",
size === "sm" ? "size-6" : size === "lg" ? "size-10" : size === "xl" ? "size-12" : "size-8",
className,
classNames == null ? void 0 : classNames.base,
classNames == null ? void 0 : classNames.skeleton
)
}
);
}
return /* @__PURE__ */ jsxs2(
Avatar,
{
className: cn(
"bg-muted",
size === "sm" ? "size-6" : size === "lg" ? "size-10" : size === "xl" ? "size-12" : "size-8",
className,
classNames == null ? void 0 : classNames.base
),
...props,
children: [
/* @__PURE__ */ jsx7(
AvatarImage,
{
alt: name || (localization == null ? void 0 : localization.ORGANIZATION),
className: classNames == null ? void 0 : classNames.image,
src: src || void 0
}
),
/* @__PURE__ */ jsx7(
AvatarFallback,
{
className: cn("text-foreground", classNames == null ? void 0 : classNames.fallback),
delayMs: src ? 600 : void 0,
children: /* @__PURE__ */ jsx7(
BuildingIcon,
{
className: cn("size-[50%]", classNames == null ? void 0 : classNames.fallbackIcon)
}
)
}
)
]
}
);
}
// src/components/organization/organization-view.tsx
import { Fragment, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
function OrganizationView({
className,
classNames,
isPending,
size,
organization,
localization: propLocalization
}) {
const { localization: contextLocalization } = useContext5(AuthUIContext);
const localization = { ...contextLocalization, ...propLocalization };
return /* @__PURE__ */ jsxs3(
"div",
{
className: cn(
"flex items-center gap-2 truncate",
className,
classNames == null ? void 0 : classNames.base
),
children: [
/* @__PURE__ */ jsx8(
OrganizationLogo,
{
className: cn(size !== "sm" && "my-0.5"),
classNames: classNames == null ? void 0 : classNames.avatar,
isPending,
localization,
organization,
size
}
),
/* @__PURE__ */ jsx8(
"div",
{
className: cn(
"flex flex-col truncate text-left leading-tight",
classNames == null ? void 0 : classNames.content
),
children: isPending ? /* @__PURE__ */ jsxs3(Fragment, { children: [
/* @__PURE__ */ jsx8(
Skeleton,
{
className: cn(
"max-w-full",
size === "lg" ? "h-4.5 w-32" : "h-3.5 w-24",
classNames == null ? void 0 : classNames.title,
classNames == null ? void 0 : classNames.skeleton
)
}
),
size !== "sm" && /* @__PURE__ */ jsx8(
Skeleton,
{
className: cn(
"mt-1.5 max-w-full",
size === "lg" ? "h-3.5 w-24" : "h-3 w-16",
classNames == null ? void 0 : classNames.subtitle,
classNames == null ? void 0 : classNames.skeleton
)
}
)
] }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
/* @__PURE__ */ jsx8(
"span",
{
className: cn(
"truncate font-semibold",
size === "lg" ? "text-base" : "text-sm",
classNames == null ? void 0 : classNames.title
),
children: (organization == null ? void 0 : organization.name) || (localization == null ? void 0 : localization.ORGANIZATION)
}
),
size !== "sm" && (organization == null ? void 0 : organization.slug) && /* @__PURE__ */ jsx8(
"span",
{
className: cn(
"truncate opacity-70",
size === "lg" ? "text-sm" : "text-xs",
classNames == null ? void 0 : classNames.subtitle
),
children: organization.slug
}
)
] })
}
)
]
}
);
}
// src/components/organization/accept-invitation-card.tsx
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
function AcceptInvitationCard({
className,
classNames,
localization: localizationProp
}) {
const {
hooks: { useSession },
localization: contextLocalization,
toast,
redirectTo,
replace
} = useContext6(AuthUIContext);
const localization = useMemo(
() => ({ ...contextLocalization, ...localizationProp }),
[contextLocalization, localizationProp]
);
const { data: sessionData } = useSession();
const [invitationId, setInvitationId] = useState2(null);
useEffect4(() => {
const invitationIdParam = getSearchParam("invitationId");
if (!invitationIdParam) {
toast({
variant: "error",
message: localization.INVITATION_NOT_FOUND
});
replace(redirectTo);
return;
}
setInvitationId(invitationIdParam);
}, [localization.INVITATION_NOT_FOUND, toast, replace, redirectTo]);
useAuthenticate();
if (!sessionData || !invitationId) {
return /* @__PURE__ */ jsx9(
AcceptInvitationSkeleton,
{
className,
classNames
}
);
}
return /* @__PURE__ */ jsx9(
AcceptInvitationContent,
{
className,
classNames,
localization,
invitationId
}
);
}
function AcceptInvitationContent({
className,
classNames,
localization: localizationProp,
invitationId
}) {
var _a;
const {
authClient,
localization: contextLocalization,
toast,
redirectTo,
replace,
organization,
hooks: { useInvitation }
} = useContext6(AuthUIContext);
const localization = useMemo(
() => ({ ...contextLocalization, ...localizationProp }),
[contextLocalization, localizationProp]
);
const [isRejecting, setIsRejecting] = useState2(false);
const [isAccepting, setIsAccepting] = useState2(false);
const isProcessing = isRejecting || isAccepting;
const { data: invitation, isPending } = useInvitation({
query: {
id: invitationId
}
});
useEffect4(() => {
if (isPending || !invitationId) return;
if (!invitation) {
toast({
variant: "error",
message: localization.INVITATION_NOT_FOUND
});
replace(redirectTo);
return;
}
if (invitation.status !== "pending" || new Date(invitation.expiresAt) < /* @__PURE__ */ new Date()) {
toast({
variant: "error",
message: new Date(invitation.expiresAt) < /* @__PURE__ */ new Date() ? localization.INVITATION_EXPIRED : localization.INVITATION_NOT_FOUND
});
replace(redirectTo);
}
}, [
invitation,
isPending,
invitationId,
localization,
toast,
replace,
redirectTo
]);
const acceptInvitation = async () => {
if (!invitationId) return;
setIsAccepting(true);
try {
await authClient.organization.acceptInvitation({
invitationId,
fetchOptions: { throw: true }
});
toast({
variant: "success",
message: localization.INVITATION_ACCEPTED || "Invitation accepted"
});
replace(redirectTo);
} catch (error) {
toast({
variant: "error",
message: getLocalizedError({ error, localization })
});
setIsAccepting(false);
}
};
const rejectInvitation = async () => {
if (!invitationId) return;
setIsRejecting(true);
try {
await authClient.organization.rejectInvitation({
invitationId,
fetchOptions: { throw: true }
});
toast({
variant: "success",
message: localization.INVITATION_REJECTED
});
replace(redirectTo);
} catch (error) {
toast({
variant: "error",
message: getLocalizedError({ error, localization })
});
setIsRejecting(false);
}
};
const builtInRoles = [
{ role: "owner", label: localization.OWNER },
{ role: "admin", label: localization.ADMIN },
{ role: "member", label: localization.MEMBER }
];
const roles = [...builtInRoles, ...(organization == null ? void 0 : organization.customRoles) || []];
const roleLabel = ((_a = roles.find((r) => r.role === (invitation == null ? void 0 : invitation.role))) == null ? void 0 : _a.label) || (invitation == null ? void 0 : invitation.role);
if (isPending)
return /* @__PURE__ */ jsx9(
AcceptInvitationSkeleton,
{
className,
classNames
}
);
return /* @__PURE__ */ jsxs4(Card, { className: cn("w-full max-w-sm", className, classNames == null ? void 0 : classNames.base), children: [
/* @__PURE__ */ jsxs4(
CardHeader,
{
className: cn(
"justify-items-center text-center",
classNames == null ? void 0 : classNames.header
),
children: [
/* @__PURE__ */ jsx9(
CardTitle,
{
className: cn("text-lg md:text-xl", classNames == null ? void 0 : classNames.title),
children: localization.ACCEPT_INVITATION
}
),
/* @__PURE__ */ jsx9(
CardDescription,
{
className: cn(
"text-xs md:text-sm",
classNames == null ? void 0 : classNames.description
),
children: localization.ACCEPT_INVITATION_DESCRIPTION
}
)
]
}
),
/* @__PURE__ */ jsxs4(
CardContent,
{
className: cn(
"flex flex-col gap-6 truncate",
classNames == null ? void 0 : classNames.content
),
children: [
/* @__PURE__ */ jsxs4(Card, { className: cn("flex-row items-center p-4"), children: [
/* @__PURE__ */ jsx9(
OrganizationView,
{
organization: invitation ? {
id: invitation.organizationId,
name: invitation.organizationName,
slug: invitation.organizationSlug,
logo: invitation.organizationLogo,
createdAt: /* @__PURE__ */ new Date()
} : null,
localization
}
),
/* @__PURE__ */ jsx9("p", { className: "ml-auto text-muted-foreground text-sm", children: roleLabel })
] }),
/* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-2 gap-3", children: [
/* @__PURE__ */ jsxs4(
Button,
{
variant: "outline",
className: cn(
classNames == null ? void 0 : classNames.button,
classNames == null ? void 0 : classNames.outlineButton
),
onClick: rejectInvitation,
disabled: isProcessing,
children: [
isRejecting ? /* @__PURE__ */ jsx9(Loader22, { className: "animate-spin" }) : /* @__PURE__ */ jsx9(XIcon2, {}),
localization.REJECT
]
}
),
/* @__PURE__ */ jsxs4(
Button,
{
className: cn(
classNames == null ? void 0 : classNames.button,
classNames == null ? void 0 : classNames.primaryButton
),
onClick: acceptInvitation,
disabled: isProcessing,
children: [
isAccepting ? /* @__PURE__ */ jsx9(Loader22, { className: "animate-spin" }) : /* @__PURE__ */ jsx9(CheckIcon, {}),
localization.ACCEPT
]
}
)
] })
]
}
)
] });
}
var AcceptInvitationSkeleton = ({
className,
classNames,
localization
}) => {
return /* @__PURE__ */ jsxs4(Card, { className: cn("w-full max-w-sm", className, classNames == null ? void 0 : classNames.base), children: [
/* @__PURE__ */ jsxs4(
CardHeader,
{
className: cn("justify-items-center", classNames == null ? void 0 : classNames.header),
children: [
/* @__PURE__ */ jsx9(
Skeleton,
{
className: cn(
"my-1 h-5 w-full max-w-32 md:h-5.5 md:w-40",
classNames == null ? void 0 : classNames.skeleton
)
}
),
/* @__PURE__ */ jsx9(
Skeleton,
{
className: cn(
"my-0.5 h-3 w-full max-w-56 md:h-3.5 md:w-64",
classNames == null ? void 0 : classNames.skeleton
)
}
)
]
}
),
/* @__PURE__ */ jsxs4(
CardContent,
{
className: cn(
"flex flex-col gap-6 truncate",
classNames == null ? void 0 : classNames.content
),
children: [
/* @__PURE__ */ jsxs4(Card, { className: cn("flex-row items-center p-4"), children: [
/* @__PURE__ */ jsx9(OrganizationView, { isPending: true, localization }),
/* @__PURE__ */ jsx9(Skeleton, { className: "mt-0.5 ml-auto h-4 w-full max-w-14 shrink-2" })
] }),
/* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-2 gap-3", children: [
/* @__PURE__ */ jsx9(Skeleton, { className: "h-9 w-full" }),
/* @__PURE__ */ jsx9(Skeleton, { className: "h-9 w-full" })
] })
]
}
)
] });
};
// src/components/settings/settings-cards.tsx
import { MenuIcon } from "lucide-react";
import { useContext as useContext54 } from "react";
// src/components/organization/organization-invitations-card.tsx
import { useContext as useContext9 } from "react";
// src/components/settings/shared/settings-action-button.tsx
import { Loader2 as Loader23 } from "lucide-react";
import { useFormState } from "react-hook-form";
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
function SettingsActionButton({
classNames,
actionLabel,
disabled,
isSubmitting,
variant,
onClick,
...props
}) {
if (!onClick) {
const formState = useFormState();
isSubmitting = formState.isSubmitting;
}
return /* @__PURE__ */ jsxs5(
Button,
{
className: cn(
"md:ms-auto",
classNames == null ? void 0 : classNames.button,
variant === "default" && (classNames == null ? void 0 : classNames.primaryButton),
variant === "destructive" && (classNames == null ? void 0 : classNames.destructiveButton)
),
disabled: isSubmitting || disabled,
size: "sm",
type: onClick ? "button" : "submit",
variant,
onClick,
...props,
children: [
isSubmitting && /* @__PURE__ */ jsx10(Loader23, { className: "animate-spin" }),
actionLabel
]
}
);
}
// src/components/settings/shared/settings-card-footer.tsx
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
function SettingsCardFooter({
className,
classNames,
actionLabel,
disabled,
instructions,
isPending,
isSubmitting,
variant,
action
}) {
return /* @__PURE__ */ jsx11(
CardFooter,
{
className: cn(
"flex flex-col justify-between gap-4 rounded-b-xl md:flex-row",
(actionLabel || instructions) && "!py-4 border-t",
variant === "destructive" ? "border-destructive/30 bg-destructive/15" : "bg-sidebar",
className,
classNames == null ? void 0 : classNames.footer
),
children: isPending ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
instructions && /* @__PURE__ */ jsx11(
Skeleton,
{
className: cn(
"my-0.5 h-3 w-48 max-w-full md:h-4 md:w-56",
classNames == null ? void 0 : classNames.skeleton
)
}
),
actionLabel && /* @__PURE__ */ jsx11(
Skeleton,
{
className: cn(
"h-8 w-14 md:ms-auto",
classNames == null ? void 0 : classNames.skeleton
)
}
)
] }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
instructions && /* @__PURE__ */ jsx11(
CardDescription,
{
className: cn(
"text-center text-muted-foreground text-xs md:text-start md:text-sm",
classNames == null ? void 0 : classNames.instructions
),
children: instructions
}
),
actionLabel && /* @__PURE__ */ jsx11(
SettingsActionButton,
{
classNames,
actionLabel,
disabled,
isSubmitting,
variant,
onClick: action
}
)
] })
}
);
}
// src/components/settings/shared/settings-card-header.tsx
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
function SettingsCardHeader({
className,
classNames,
description,
isPending,
title
}) {
return /* @__PURE__ */ jsx12(CardHeader, { className: cn(classNames == null ? void 0 : classNames.header, className), children: isPending ? /* @__PURE__ */ jsxs7(Fragment3, { children: [
/* @__PURE__ */ jsx12(
Skeleton,
{
className: cn(
"my-0.5 h-5 w-1/3 md:h-5.5",
classNames == null ? void 0 : classNames.skeleton
)
}
),
description && /* @__PURE__ */ jsx12(
Skeleton,
{
className: cn(
"mt-1.5 mb-0.5 h-3 w-2/3 md:h-3.5",
classNames == null ? void 0 : classNames.skeleton
)
}
)
] }) : /* @__PURE__ */ jsxs7(Fragment3, { children: [
/* @__PURE__ */ jsx12(
CardTitle,
{
className: cn("text-lg md:text-xl", classNames == null ? void 0 : classNames.title),
children: title
}
),
description && /* @__PURE__ */ jsx12(
CardDescription,
{
className: cn(
"text-xs md:text-sm",
classNames == null ? void 0 : classNames.description
),
children: description
}
)
] }) });
}
// src/components/settings/shared/settings-card.tsx
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
function SettingsCard({
children,
className,
classNames,
title,
description,
instructions,
actionLabel,
disabled,
isPending,
isSubmitting,
optimistic,
variant,
action,
...props
}) {
return /* @__PURE__ */ jsxs8(
Card,
{
className: cn(
"w-full pb-0 text-start",
variant === "destructive" && "border-destructive/40",
className,
classNames == null ? void 0 : classNames.base
),
...props,
children: [
/* @__PURE__ */ jsx13(
SettingsCardHeader,
{
classNames,
description,
isPending,
title
}
),
children,
/* @__PURE__ */ jsx13(
SettingsCardFooter,
{
classNames,
actionLabel,
disabled,
isPending,
isSubmitting,
instructions,
optimistic,
variant,
action
}
)
]
}
);
}
// src/components/organization/invitation-cell.tsx
import { EllipsisIcon, Loader2 as Loader24, XIcon as XIcon3 } from "lucide-react";
import { useContext as useC