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 e from "../../../../@ant-design/cssinjs/es/Keyframes.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 x } from "../../style/index.mjs";
import { genStyleHooks as y } from "../../theme/util/genComponentStyleHook.mjs";
import z from "../../theme/util/genPresetColor.mjs";
import { merge as B } from "../../theme/util/statistic.mjs";
const v = new e("antStatusProcessing", {
  "0%": {
    transform: "scale(0.8)",
    opacity: 0.5
  },
  "100%": {
    transform: "scale(2.4)",
    opacity: 0
  }
}), T = new e("antZoomBadgeIn", {
  "0%": {
    transform: "scale(0) translate(50%, -50%)",
    opacity: 0
  },
  "100%": {
    transform: "scale(1) translate(50%, -50%)"
  }
}), O = new e("antZoomBadgeOut", {
  "0%": {
    transform: "scale(1) translate(50%, -50%)"
  },
  "100%": {
    transform: "scale(0) translate(50%, -50%)",
    opacity: 0
  }
}), W = new e("antNoWrapperZoomBadgeIn", {
  "0%": {
    transform: "scale(0)",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)"
  }
}), F = new e("antNoWrapperZoomBadgeOut", {
  "0%": {
    transform: "scale(1)"
  },
  "100%": {
    transform: "scale(0)",
    opacity: 0
  }
}), D = new e("antBadgeLoadingCircle", {
  "0%": {
    transformOrigin: "50%"
  },
  "100%": {
    transform: "translate(50%, -50%) rotate(360deg)",
    transformOrigin: "50%"
  }
}), H = (o) => {
  const {
    componentCls: t,
    iconCls: s,
    antCls: n,
    badgeShadowSize: a,
    motionDurationSlow: g,
    textFontSize: u,
    textFontSizeSM: b,
    statusSize: d,
    dotSize: l,
    textFontWeight: p,
    indicatorHeight: r,
    indicatorHeightSM: m,
    marginXS: S,
    calc: h
  } = o, i = `${n}-scroll-number`, f = z(o, (C, w) => {
    let {
      darkColor: $
    } = w;
    return {
      [`&${t} ${t}-color-${C}`]: {
        background: $,
        [`&:not(${t}-count)`]: {
          color: $
        }
      }
    };
  });
  return {
    [t]: Object.assign(Object.assign(Object.assign(Object.assign({}, x(o)), {
      position: "relative",
      display: "inline-block",
      width: "fit-content",
      lineHeight: 1,
      [`${t}-count`]: {
        zIndex: o.indicatorZIndex,
        minWidth: r,
        height: r,
        color: o.badgeTextColor,
        fontWeight: p,
        fontSize: u,
        lineHeight: c(r),
        whiteSpace: "nowrap",
        textAlign: "center",
        background: o.badgeColor,
        borderRadius: h(r).div(2).equal(),
        boxShadow: `0 0 0 ${c(a)} ${o.badgeShadowColor}`,
        transition: `background ${o.motionDurationMid}`,
        a: {
          color: o.badgeTextColor
        },
        "a:hover": {
          color: o.badgeTextColor
        },
        "a:hover &": {
          background: o.badgeColorHover
        }
      },
      [`${t}-count-sm`]: {
        minWidth: m,
        height: m,
        fontSize: b,
        lineHeight: c(m),
        borderRadius: h(m).div(2).equal()
      },
      [`${t}-multiple-words`]: {
        padding: `0 ${c(o.paddingXS)}`,
        bdi: {
          unicodeBidi: "plaintext"
        }
      },
      [`${t}-dot`]: {
        zIndex: o.indicatorZIndex,
        width: l,
        minWidth: l,
        height: l,
        background: o.badgeColor,
        borderRadius: "100%",
        boxShadow: `0 0 0 ${c(a)} ${o.badgeShadowColor}`
      },
      [`${t}-dot${i}`]: {
        transition: `background ${g}`
      },
      [`${t}-count, ${t}-dot, ${i}-custom-component`]: {
        position: "absolute",
        top: 0,
        insetInlineEnd: 0,
        transform: "translate(50%, -50%)",
        transformOrigin: "100% 0%",
        [`&${s}-spin`]: {
          animationName: D,
          animationDuration: "1s",
          animationIterationCount: "infinite",
          animationTimingFunction: "linear"
        }
      },
      [`&${t}-status`]: {
        lineHeight: "inherit",
        verticalAlign: "baseline",
        [`${t}-status-dot`]: {
          position: "relative",
          top: -1,
          // Magic number, but seems better experience
          display: "inline-block",
          width: d,
          height: d,
          verticalAlign: "middle",
          borderRadius: "50%"
        },
        [`${t}-status-success`]: {
          backgroundColor: o.colorSuccess
        },
        [`${t}-status-processing`]: {
          overflow: "visible",
          color: o.colorPrimary,
          backgroundColor: o.colorPrimary,
          "&::after": {
            position: "absolute",
            top: 0,
            insetInlineStart: 0,
            width: "100%",
            height: "100%",
            borderWidth: a,
            borderStyle: "solid",
            borderColor: "inherit",
            borderRadius: "50%",
            animationName: v,
            animationDuration: o.badgeProcessingDuration,
            animationIterationCount: "infinite",
            animationTimingFunction: "ease-in-out",
            content: '""'
          }
        },
        [`${t}-status-default`]: {
          backgroundColor: o.colorTextPlaceholder
        },
        [`${t}-status-error`]: {
          backgroundColor: o.colorError
        },
        [`${t}-status-warning`]: {
          backgroundColor: o.colorWarning
        },
        [`${t}-status-text`]: {
          marginInlineStart: S,
          color: o.colorText,
          fontSize: o.fontSize
        }
      }
    }), f), {
      [`${t}-zoom-appear, ${t}-zoom-enter`]: {
        animationName: T,
        animationDuration: o.motionDurationSlow,
        animationTimingFunction: o.motionEaseOutBack,
        animationFillMode: "both"
      },
      [`${t}-zoom-leave`]: {
        animationName: O,
        animationDuration: o.motionDurationSlow,
        animationTimingFunction: o.motionEaseOutBack,
        animationFillMode: "both"
      },
      [`&${t}-not-a-wrapper`]: {
        [`${t}-zoom-appear, ${t}-zoom-enter`]: {
          animationName: W,
          animationDuration: o.motionDurationSlow,
          animationTimingFunction: o.motionEaseOutBack
        },
        [`${t}-zoom-leave`]: {
          animationName: F,
          animationDuration: o.motionDurationSlow,
          animationTimingFunction: o.motionEaseOutBack
        },
        [`&:not(${t}-status)`]: {
          verticalAlign: "middle"
        },
        [`${i}-custom-component, ${t}-count`]: {
          transform: "none"
        },
        [`${i}-custom-component, ${i}`]: {
          position: "relative",
          top: "auto",
          display: "block",
          transformOrigin: "50% 50%"
        }
      },
      [`${i}`]: {
        overflow: "hidden",
        [`${i}-only`]: {
          position: "relative",
          display: "inline-block",
          height: r,
          transition: `all ${o.motionDurationSlow} ${o.motionEaseOutBack}`,
          WebkitTransformStyle: "preserve-3d",
          WebkitBackfaceVisibility: "hidden",
          [`> p${i}-only-unit`]: {
            height: r,
            margin: 0,
            WebkitTransformStyle: "preserve-3d",
            WebkitBackfaceVisibility: "hidden"
          }
        },
        [`${i}-symbol`]: {
          verticalAlign: "top"
        }
      },
      // ====================== RTL =======================
      "&-rtl": {
        direction: "rtl",
        [`${t}-count, ${t}-dot, ${i}-custom-component`]: {
          transform: "translate(-50%, -50%)"
        }
      }
    })
  };
}, I = (o) => {
  const {
    fontHeight: t,
    lineWidth: s,
    marginXS: n,
    colorBorderBg: a
  } = o, g = t, u = s, b = o.colorBgContainer, d = o.colorError, l = o.colorErrorHover;
  return B(o, {
    badgeFontHeight: g,
    badgeShadowSize: u,
    badgeTextColor: b,
    badgeColor: d,
    badgeColorHover: l,
    badgeShadowColor: a,
    badgeProcessingDuration: "1.2s",
    badgeRibbonOffset: n,
    // Follow token just by Design. Not related with token
    badgeRibbonCornerTransform: "scaleY(0.75)",
    badgeRibbonCornerFilter: "brightness(75%)"
  });
}, Z = (o) => {
  const {
    fontSize: t,
    lineHeight: s,
    fontSizeSM: n,
    lineWidth: a
  } = o;
  return {
    indicatorZIndex: "auto",
    indicatorHeight: Math.round(t * s) - 2 * a,
    indicatorHeightSM: t,
    dotSize: n / 2,
    textFontSize: n,
    textFontSizeSM: n,
    textFontWeight: "normal",
    statusSize: n / 2
  };
}, _ = y("Badge", (o) => {
  const t = I(o);
  return H(t);
}, Z);
export {
  _ as default,
  Z as prepareComponentToken,
  I as prepareToken
};
