import "../../../../@ant-design/cssinjs/es/extractStyle.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCacheToken.mjs";
import "react";
import "../../../../@ant-design/cssinjs/es/StyleContext.mjs";
import { unit as u } from "../../../../@ant-design/cssinjs/es/util/index.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCompatibleInsertionEffect.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useEffectCleanupRegister.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useHMR.mjs";
import "../../../../rc-util/es/warning.mjs";
import "../../../../@ant-design/cssinjs/es/theme/createTheme.mjs";
import "../../../../@ant-design/cssinjs/es/theme/ThemeCache.mjs";
import "../../../../@ant-design/cssinjs/es/transformers/legacyLogicalProperties.mjs";
import { resetComponent as C } from "../../style/index.mjs";
import { genStyleHooks as y } from "../../theme/util/genComponentStyleHook.mjs";
import { merge as L } from "../../theme/util/statistic.mjs";
const O = (e) => {
  const {
    antCls: t,
    componentCls: o,
    iconCls: r,
    avatarBg: i,
    avatarColor: n,
    containerSize: a,
    containerSizeLG: l,
    containerSizeSM: c,
    textFontSize: p,
    textFontSizeLG: s,
    textFontSizeSM: b,
    borderRadius: h,
    borderRadiusLG: v,
    borderRadiusSM: z,
    lineWidth: S,
    lineType: f,
    calc: d
  } = e, g = (m, $, x) => ({
    width: m,
    height: m,
    lineHeight: u(d(m).sub(d(S).mul(2)).equal()),
    borderRadius: "50%",
    [`&${o}-square`]: {
      borderRadius: x
    },
    [`${o}-string`]: {
      position: "absolute",
      left: {
        _skip_check_: !0,
        value: "50%"
      },
      transformOrigin: "0 center"
    },
    [`&${o}-icon`]: {
      fontSize: $,
      [`> ${r}`]: {
        margin: 0
      }
    }
  });
  return {
    [o]: Object.assign(Object.assign(Object.assign(Object.assign({}, C(e)), {
      position: "relative",
      display: "inline-block",
      overflow: "hidden",
      color: n,
      whiteSpace: "nowrap",
      textAlign: "center",
      verticalAlign: "middle",
      background: i,
      border: `${u(S)} ${f} transparent`,
      "&-image": {
        background: "transparent"
      },
      [`${t}-image-img`]: {
        display: "block"
      }
    }), g(a, p, h)), {
      "&-lg": Object.assign({}, g(l, s, v)),
      "&-sm": Object.assign({}, g(c, b, z)),
      "> img": {
        display: "block",
        width: "100%",
        height: "100%",
        objectFit: "cover"
      }
    })
  };
}, k = (e) => {
  const {
    componentCls: t,
    groupBorderColor: o,
    groupOverlapping: r,
    groupSpace: i
  } = e;
  return {
    [`${t}-group`]: {
      display: "inline-flex",
      [`${t}`]: {
        borderColor: o
      },
      "> *:not(:first-child)": {
        marginInlineStart: r
      }
    },
    [`${t}-group-popover`]: {
      [`${t} + ${t}`]: {
        marginInlineStart: i
      }
    }
  };
}, G = (e) => {
  const {
    controlHeight: t,
    controlHeightLG: o,
    controlHeightSM: r,
    fontSize: i,
    fontSizeLG: n,
    fontSizeXL: a,
    fontSizeHeading3: l,
    marginXS: c,
    marginXXS: p,
    colorBorderBg: s
  } = e;
  return {
    containerSize: t,
    containerSizeLG: o,
    containerSizeSM: r,
    textFontSize: Math.round((n + a) / 2),
    textFontSizeLG: l,
    textFontSizeSM: i,
    groupSpace: p,
    groupOverlapping: -c,
    groupBorderColor: s
  };
}, D = y("Avatar", (e) => {
  const {
    colorTextLightSolid: t,
    colorTextPlaceholder: o
  } = e, r = L(e, {
    avatarBg: o,
    avatarColor: t
  });
  return [O(r), k(r)];
}, G);
export {
  D as default,
  G as prepareComponentToken
};
