'use client';
import { jsx as t, jsxs as a, Fragment as A } from "react/jsx-runtime";
import G from "react";
import { Card as I, CardHeader as K, Divider as B, CardBody as P, CardFooter as Q } from "@heroui/react";
import { motion as T } from "framer-motion";
import { SignUpForm as X } from "./sign-up-form.js";
import { useConfig as Z } from "../../../hooks/use-config.js";
import { useTheme as _ } from "../../../hooks/use-theme.js";
function st({
  variant: R = "shadow",
  className: c = "",
  padding: s = "lg",
  radius: m = "lg",
  shadow: u = "md",
  isBlurred: d = !1,
  methods: p = ["password", "oauth", "magic-link"],
  email: f,
  organizationId: g,
  invitationToken: n,
  redirectUrl: x,
  onSuccess: y,
  onError: h,
  title: C,
  subtitle: N,
  size: b = "md",
  showBranding: v = !0,
  disabled: S = !1,
  requireTerms: $ = !0,
  termsUrl: w = "/terms",
  privacyUrl: j = "/privacy",
  footer: l,
  header: D,
  maxWidth: i = 450,
  centered: r = !1
}) {
  const { components: V, organizationSettings: z } = Z(), { getColorValue: q } = _(), U = V.SignUpCard;
  if (U)
    return /* @__PURE__ */ t(U, { variant: R, className: c, padding: s, radius: m, shadow: u, isBlurred: d, methods: p, email: f, organizationId: g, invitationToken: n, redirectUrl: x, onSuccess: y, onError: h, title: C, subtitle: N, size: b, showBranding: v, disabled: S, requireTerms: $, termsUrl: w, privacyUrl: j, footer: l, header: D, maxWidth: i, centered: r });
  const H = {
    hidden: {
      opacity: 0,
      y: 20,
      scale: 0.95
    },
    visible: {
      opacity: 1,
      y: 0,
      scale: 1,
      transition: {
        duration: 0.3,
        ease: "easeOut"
      }
    }
  }, M = {
    maxWidth: typeof i == "number" ? `${i}px` : i
  }, o = v && z?.branding, e = G.useMemo(() => {
    if (!n) return null;
    try {
      const E = atob(n);
      return JSON.parse(E);
    } catch {
      return null;
    }
  }, [n]), F = e ? {
    title: `Join ${e.orgName || "Organization"}`,
    subtitle: e.inviterName ? `${e.inviterName} has invited you to join` : "You've been invited to join"
  } : o?.customSignUpText ? {
    title: o.customSignUpText.title || "Create your account",
    subtitle: o.customSignUpText.subtitle || "Join us today"
  } : {
    title: "Create your account",
    subtitle: "Join us today"
  }, J = C || F.title, O = N || F.subtitle, Y = [
    r ? "flex items-center justify-center min-h-screen p-4" : ""
  ].filter(Boolean).join(" "), k = /* @__PURE__ */ a(
    I,
    {
      className: `${c} ${r ? "w-full" : ""}`,
      style: M,
      shadow: u,
      radius: m,
      isBlurred: d,
      children: [
        /* @__PURE__ */ t(K, { className: `flex flex-col items-center text-center gap-3 p-${s}`, children: D || /* @__PURE__ */ a(A, { children: [
          o?.logoUrl && /* @__PURE__ */ t(
            "img",
            {
              src: o.logoUrl,
              alt: "Organization Logo",
              className: "h-12 w-auto mb-2"
            }
          ),
          J && /* @__PURE__ */ t("h1", { className: "text-2xl font-bold text-foreground", children: J }),
          O && /* @__PURE__ */ t("p", { className: "text-default-500 text-sm max-w-sm", children: O }),
          e && /* @__PURE__ */ a("div", { className: "bg-primary-50 dark:bg-primary-900/20 rounded-lg px-3 py-2 text-sm", children: [
            /* @__PURE__ */ a("p", { className: "text-primary-600 dark:text-primary-400", children: [
              /* @__PURE__ */ t("span", { className: "font-medium", children: "Role:" }),
              " ",
              e.role
            ] }),
            e.expiresAt && /* @__PURE__ */ a("p", { className: "text-primary-500 text-xs mt-1", children: [
              "Expires: ",
              new Date(e.expiresAt).toLocaleDateString()
            ] })
          ] })
        ] }) }),
        /* @__PURE__ */ t(B, {}),
        /* @__PURE__ */ t(P, { className: `p-${s}`, children: /* @__PURE__ */ t(
          X,
          {
            methods: p,
            email: f,
            organizationId: g,
            invitationToken: n,
            redirectUrl: x,
            onSuccess: y,
            onError: h,
            title: void 0,
            subtitle: void 0,
            size: b,
            showBranding: !1,
            disabled: S,
            requireTerms: $,
            termsUrl: w,
            privacyUrl: j,
            variant: "minimal",
            className: "space-y-4",
            showSignInLink: !0,
            autoFocus: !0
          }
        ) }),
        l && /* @__PURE__ */ a(A, { children: [
          /* @__PURE__ */ t(B, {}),
          /* @__PURE__ */ t(Q, { className: `p-${s} text-center`, children: l })
        ] })
      ]
    }
  ), L = /* @__PURE__ */ t(
    T.div,
    {
      initial: "hidden",
      animate: "visible",
      variants: H,
      style: { maxWidth: i },
      className: r ? "w-full" : "",
      children: k
    }
  );
  return r ? /* @__PURE__ */ t("div", { className: Y, children: L }) : L;
}
export {
  st as SignUpCard
};
//# sourceMappingURL=sign-up-card.js.map
