import { jsx as r, jsxs as n } from "react/jsx-runtime";
import { ml1 as j, alignItemsCenter as h, dFlex as p, gap1 as D } from "./index-general.module.js";
import { classNames as o } from "./index-classNames.js";
import { Avatar as v } from "./index-Avatar.js";
import { Icon as b, IconSize as g } from "./index-Icon.js";
import { IconNames as u } from "./index-IconNames.js";
import { Render as x } from "./index-Render.js";
import { Text as c, FontWeights as I } from "./index-Text.js";
import "react";
import t from "./index-Tab.module.scss.js";
import F from "./index-Tab2.js";
const O = (N) => {
  const {
    hasError: s = !1,
    tabIcons: l,
    hasBorderBottom: H,
    showBackgroundColor: L = !0,
    simple: R = !1,
    testId: m,
    disabled: S = !1,
    tabConfig: y,
    ...d
  } = N, {
    selected: a,
    label: e,
    value: W
  } = d, {
    theme: C = "highlight",
    iconSize: i = "default",
    tabTextTransform: T = "none"
  } = y || {}, z = () => {
    if (!l)
      return typeof e == "string" ? r(c, {
        testId: m,
        className: o(t.tabLabel),
        color: a ? "var(--fn-bg-cta)" : "var(--n700)",
        fontWeight: a ? I.bold : I.regular,
        children: e
      }) : e;
    if (l.length > 1)
      return n("div", {
        "data-testid": m,
        className: o(p, h, t.tabsDirectoryIcons),
        children: [l.map((f, B) => r("div", {
          className: o(t.tabsDirectoryIcon),
          children: r(v, {
            noHover: !0,
            size: i === "small" ? "xs" : "small",
            icon: f,
            name: f
          })
        }, B)), typeof e == "string" ? n("div", {
          children: [r(c, {
            className: o(j),
            color: a ? "var(--p500)" : "var(--n700)",
            children: e
          }), r(x, {
            if: s,
            children: r(b, {
              fillColor: "var(--e100)",
              hasCircle: !0,
              color: "var(--e500)",
              type: i === "small" ? g.small : g.large,
              children: u.exclamation
            })
          })]
        }) : e]
      });
    if (l.length === 1)
      return n("div", {
        className: o(o(p, h, D)),
        children: [r(v, {
          noHover: !0,
          size: i === "small" ? "xs" : "small",
          icon: l[0]
        }), typeof e == "string" ? r(c, {
          color: a ? "var(--p500)" : "var(--n700)",
          children: e
        }) : e, r(x, {
          if: s,
          children: r(b, {
            fillColor: "var(--e100)",
            hasCircle: !0,
            color: "var(--e500)",
            children: u.exclamation
          })
        })]
      });
  };
  return r(F, {
    ...d,
    sx: {
      ...a && {
        ...s && {
          border: "1px solid var(--e500)",
          borderRadius: "8px",
          color: "var(--e500)"
        }
      },
      textTransform: T
    },
    className: o(t.tab, t[C], a ? t.selected : ""),
    label: z()
  });
};
export {
  O as Tab
};
