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 C } 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 R, genFocusOutline as P } from "../../style/index.mjs";
import { genStyleHooks as H } from "../../theme/util/genComponentStyleHook.mjs";
import { merge as T } from "../../theme/util/statistic.mjs";
const j = (e) => {
  const {
    componentCls: o,
    antCls: i
  } = e, t = `${o}-group`;
  return {
    [t]: Object.assign(Object.assign({}, R(e)), {
      display: "inline-block",
      fontSize: 0,
      // RTL
      [`&${t}-rtl`]: {
        direction: "rtl"
      },
      [`${i}-badge ${i}-badge-count`]: {
        zIndex: 1
      },
      [`> ${i}-badge:not(:first-child) > ${i}-button-wrapper`]: {
        borderInlineStart: "none"
      }
    })
  };
}, W = (e) => {
  const {
    componentCls: o,
    wrapperMarginInlineEnd: i,
    colorPrimary: t,
    radioSize: r,
    motionDurationSlow: n,
    motionDurationMid: a,
    motionEaseInOutCirc: s,
    colorBgContainer: b,
    colorBorder: m,
    lineWidth: $,
    colorBgContainerDisabled: p,
    colorTextDisabled: B,
    paddingXS: h,
    dotColorDisabled: k,
    lineType: f,
    radioColor: d,
    radioBgColor: u,
    calc: l
  } = e, S = `${o}-inner`, v = 4, y = l(r).sub(l(v).mul(2)), g = l(1).mul(r).equal();
  return {
    [`${o}-wrapper`]: Object.assign(Object.assign({}, R(e)), {
      display: "inline-flex",
      alignItems: "baseline",
      marginInlineStart: 0,
      marginInlineEnd: i,
      cursor: "pointer",
      // RTL
      [`&${o}-wrapper-rtl`]: {
        direction: "rtl"
      },
      "&-disabled": {
        cursor: "not-allowed",
        color: e.colorTextDisabled
      },
      "&::after": {
        display: "inline-block",
        width: 0,
        overflow: "hidden",
        content: '"\\a0"'
      },
      // hashId 在 wrapper 上，只能铺平
      [`${o}-checked::after`]: {
        position: "absolute",
        insetBlockStart: 0,
        insetInlineStart: 0,
        width: "100%",
        height: "100%",
        border: `${C($)} ${f} ${t}`,
        borderRadius: "50%",
        visibility: "hidden",
        content: '""'
      },
      [o]: Object.assign(Object.assign({}, R(e)), {
        position: "relative",
        display: "inline-block",
        outline: "none",
        cursor: "pointer",
        alignSelf: "center",
        borderRadius: "50%"
      }),
      [`${o}-wrapper:hover &,
        &:hover ${S}`]: {
        borderColor: t
      },
      [`${o}-input:focus-visible + ${S}`]: Object.assign({}, P(e)),
      [`${o}:hover::after, ${o}-wrapper:hover &::after`]: {
        visibility: "visible"
      },
      [`${o}-inner`]: {
        "&::after": {
          boxSizing: "border-box",
          position: "absolute",
          insetBlockStart: "50%",
          insetInlineStart: "50%",
          display: "block",
          width: g,
          height: g,
          marginBlockStart: l(1).mul(r).div(-2).equal(),
          marginInlineStart: l(1).mul(r).div(-2).equal(),
          backgroundColor: d,
          borderBlockStart: 0,
          borderInlineStart: 0,
          borderRadius: g,
          transform: "scale(0)",
          opacity: 0,
          transition: `all ${n} ${s}`,
          content: '""'
        },
        boxSizing: "border-box",
        position: "relative",
        insetBlockStart: 0,
        insetInlineStart: 0,
        display: "block",
        width: g,
        height: g,
        backgroundColor: b,
        borderColor: m,
        borderStyle: "solid",
        borderWidth: $,
        borderRadius: "50%",
        transition: `all ${a}`
      },
      [`${o}-input`]: {
        position: "absolute",
        inset: 0,
        zIndex: 1,
        cursor: "pointer",
        opacity: 0
      },
      // 选中状态
      [`${o}-checked`]: {
        [S]: {
          borderColor: t,
          backgroundColor: u,
          "&::after": {
            transform: `scale(${e.calc(e.dotSize).div(r).equal()})`,
            opacity: 1,
            transition: `all ${n} ${s}`
          }
        }
      },
      [`${o}-disabled`]: {
        cursor: "not-allowed",
        [S]: {
          backgroundColor: p,
          borderColor: m,
          cursor: "not-allowed",
          "&::after": {
            backgroundColor: k
          }
        },
        [`${o}-input`]: {
          cursor: "not-allowed"
        },
        [`${o}-disabled + span`]: {
          color: B,
          cursor: "not-allowed"
        },
        [`&${o}-checked`]: {
          [S]: {
            "&::after": {
              transform: `scale(${l(y).div(r).equal({
                unit: !1
              })})`
            }
          }
        }
      },
      [`span${o} + *`]: {
        paddingInlineStart: h,
        paddingInlineEnd: h
      }
    })
  };
}, M = (e) => {
  const {
    buttonColor: o,
    controlHeight: i,
    componentCls: t,
    lineWidth: r,
    lineType: n,
    colorBorder: a,
    motionDurationSlow: s,
    motionDurationMid: b,
    buttonPaddingInline: m,
    fontSize: $,
    buttonBg: p,
    fontSizeLG: B,
    controlHeightLG: h,
    controlHeightSM: k,
    paddingXS: f,
    borderRadius: d,
    borderRadiusSM: u,
    borderRadiusLG: l,
    buttonCheckedBg: S,
    buttonSolidCheckedColor: v,
    colorTextDisabled: y,
    colorBgContainerDisabled: g,
    buttonCheckedBgDisabled: q,
    buttonCheckedColorDisabled: O,
    colorPrimary: w,
    colorPrimaryHover: I,
    colorPrimaryActive: x,
    buttonSolidCheckedBg: z,
    buttonSolidCheckedHoverBg: D,
    buttonSolidCheckedActiveBg: E,
    calc: c
  } = e;
  return {
    [`${t}-button-wrapper`]: {
      position: "relative",
      display: "inline-block",
      height: i,
      margin: 0,
      paddingInline: m,
      paddingBlock: 0,
      color: o,
      fontSize: $,
      lineHeight: C(c(i).sub(c(r).mul(2)).equal()),
      background: p,
      border: `${C(r)} ${n} ${a}`,
      // strange align fix for chrome but works
      // https://gw.alipayobjects.com/zos/rmsportal/VFTfKXJuogBAXcvfAUWJ.gif
      borderBlockStartWidth: c(r).add(0.02).equal(),
      borderInlineStartWidth: 0,
      borderInlineEndWidth: r,
      cursor: "pointer",
      transition: [`color ${b}`, `background ${b}`, `box-shadow ${b}`].join(","),
      a: {
        color: o
      },
      [`> ${t}-button`]: {
        position: "absolute",
        insetBlockStart: 0,
        insetInlineStart: 0,
        zIndex: -1,
        width: "100%",
        height: "100%"
      },
      "&:not(:first-child)": {
        "&::before": {
          position: "absolute",
          insetBlockStart: c(r).mul(-1).equal(),
          insetInlineStart: c(r).mul(-1).equal(),
          display: "block",
          boxSizing: "content-box",
          width: 1,
          height: "100%",
          paddingBlock: r,
          paddingInline: 0,
          backgroundColor: a,
          transition: `background-color ${s}`,
          content: '""'
        }
      },
      "&:first-child": {
        borderInlineStart: `${C(r)} ${n} ${a}`,
        borderStartStartRadius: d,
        borderEndStartRadius: d
      },
      "&:last-child": {
        borderStartEndRadius: d,
        borderEndEndRadius: d
      },
      "&:first-child:last-child": {
        borderRadius: d
      },
      [`${t}-group-large &`]: {
        height: h,
        fontSize: B,
        lineHeight: C(c(h).sub(c(r).mul(2)).equal()),
        "&:first-child": {
          borderStartStartRadius: l,
          borderEndStartRadius: l
        },
        "&:last-child": {
          borderStartEndRadius: l,
          borderEndEndRadius: l
        }
      },
      [`${t}-group-small &`]: {
        height: k,
        paddingInline: c(f).sub(r).equal(),
        paddingBlock: 0,
        lineHeight: C(c(k).sub(c(r).mul(2)).equal()),
        "&:first-child": {
          borderStartStartRadius: u,
          borderEndStartRadius: u
        },
        "&:last-child": {
          borderStartEndRadius: u,
          borderEndEndRadius: u
        }
      },
      "&:hover": {
        position: "relative",
        color: w
      },
      "&:has(:focus-visible)": Object.assign({}, P(e)),
      [`${t}-inner, input[type='checkbox'], input[type='radio']`]: {
        width: 0,
        height: 0,
        opacity: 0,
        pointerEvents: "none"
      },
      [`&-checked:not(${t}-button-wrapper-disabled)`]: {
        zIndex: 1,
        color: w,
        background: S,
        borderColor: w,
        "&::before": {
          backgroundColor: w
        },
        "&:first-child": {
          borderColor: w
        },
        "&:hover": {
          color: I,
          borderColor: I,
          "&::before": {
            backgroundColor: I
          }
        },
        "&:active": {
          color: x,
          borderColor: x,
          "&::before": {
            backgroundColor: x
          }
        }
      },
      [`${t}-group-solid &-checked:not(${t}-button-wrapper-disabled)`]: {
        color: v,
        background: z,
        borderColor: z,
        "&:hover": {
          color: v,
          background: D,
          borderColor: D
        },
        "&:active": {
          color: v,
          background: E,
          borderColor: E
        }
      },
      "&-disabled": {
        color: y,
        backgroundColor: g,
        borderColor: a,
        cursor: "not-allowed",
        "&:first-child, &:hover": {
          color: y,
          backgroundColor: g,
          borderColor: a
        }
      },
      [`&-disabled${t}-button-wrapper-checked`]: {
        color: O,
        backgroundColor: q,
        borderColor: a,
        boxShadow: "none"
      }
    }
  };
}, A = (e) => {
  const {
    wireframe: o,
    padding: i,
    marginXS: t,
    lineWidth: r,
    fontSizeLG: n,
    colorText: a,
    colorBgContainer: s,
    colorTextDisabled: b,
    controlItemBgActiveDisabled: m,
    colorTextLightSolid: $,
    colorPrimary: p,
    colorPrimaryHover: B,
    colorPrimaryActive: h,
    colorWhite: k
  } = e, f = 4, d = n, u = o ? d - f * 2 : d - (f + r) * 2;
  return {
    // Radio
    radioSize: d,
    dotSize: u,
    dotColorDisabled: b,
    // Radio buttons
    buttonSolidCheckedColor: $,
    buttonSolidCheckedBg: p,
    buttonSolidCheckedHoverBg: B,
    buttonSolidCheckedActiveBg: h,
    buttonBg: s,
    buttonCheckedBg: s,
    buttonColor: a,
    buttonCheckedBgDisabled: m,
    buttonCheckedColorDisabled: b,
    buttonPaddingInline: i - r,
    wrapperMarginInlineEnd: t,
    // internal
    radioColor: o ? p : k,
    radioBgColor: o ? s : p
  };
}, to = H("Radio", (e) => {
  const {
    controlOutline: o,
    controlOutlineWidth: i
  } = e, t = `0 0 0 ${C(i)} ${o}`, n = T(e, {
    radioFocusShadow: t,
    radioButtonFocusShadow: t
  });
  return [j(n), W(n), M(n)];
}, A, {
  unitless: {
    radioSize: !0,
    dotSize: !0
  }
});
export {
  to as default,
  A as prepareComponentToken
};
