import { genRoundedArrow as i } from "./roundedArrow.mjs";
const m = 8;
function w(r) {
  const {
    contentRadius: e,
    limitVerticalRadius: s
  } = r, t = e > 12 ? e + 2 : 12;
  return {
    arrowOffsetHorizontal: t,
    arrowOffsetVertical: s ? m : t
  };
}
function c(r, e) {
  return r ? e : {};
}
function u(r, e, s) {
  const {
    componentCls: t,
    boxShadowPopoverArrow: p,
    arrowOffsetVertical: o,
    arrowOffsetHorizontal: a
  } = r, {
    arrowDistance: n = 0,
    arrowPlacement: l = {
      left: !0,
      right: !0,
      top: !0,
      bottom: !0
    }
  } = s || {};
  return {
    [t]: Object.assign(Object.assign(Object.assign(Object.assign({
      // ============================ Basic ============================
      [`${t}-arrow`]: [Object.assign(Object.assign({
        position: "absolute",
        zIndex: 1,
        display: "block"
      }, i(r, e, p)), {
        "&:before": {
          background: e
        }
      })]
    }, c(!!l.top, {
      [[`&-placement-top ${t}-arrow`, `&-placement-topLeft ${t}-arrow`, `&-placement-topRight ${t}-arrow`].join(",")]: {
        bottom: n,
        transform: "translateY(100%) rotate(180deg)"
      },
      [`&-placement-top ${t}-arrow`]: {
        left: {
          _skip_check_: !0,
          value: "50%"
        },
        transform: "translateX(-50%) translateY(100%) rotate(180deg)"
      },
      [`&-placement-topLeft ${t}-arrow`]: {
        left: {
          _skip_check_: !0,
          value: a
        }
      },
      [`&-placement-topRight ${t}-arrow`]: {
        right: {
          _skip_check_: !0,
          value: a
        }
      }
    })), c(!!l.bottom, {
      [[`&-placement-bottom ${t}-arrow`, `&-placement-bottomLeft ${t}-arrow`, `&-placement-bottomRight ${t}-arrow`].join(",")]: {
        top: n,
        transform: "translateY(-100%)"
      },
      [`&-placement-bottom ${t}-arrow`]: {
        left: {
          _skip_check_: !0,
          value: "50%"
        },
        transform: "translateX(-50%) translateY(-100%)"
      },
      [`&-placement-bottomLeft ${t}-arrow`]: {
        left: {
          _skip_check_: !0,
          value: a
        }
      },
      [`&-placement-bottomRight ${t}-arrow`]: {
        right: {
          _skip_check_: !0,
          value: a
        }
      }
    })), c(!!l.left, {
      [[`&-placement-left ${t}-arrow`, `&-placement-leftTop ${t}-arrow`, `&-placement-leftBottom ${t}-arrow`].join(",")]: {
        right: {
          _skip_check_: !0,
          value: n
        },
        transform: "translateX(100%) rotate(90deg)"
      },
      [`&-placement-left ${t}-arrow`]: {
        top: {
          _skip_check_: !0,
          value: "50%"
        },
        transform: "translateY(-50%) translateX(100%) rotate(90deg)"
      },
      [`&-placement-leftTop ${t}-arrow`]: {
        top: o
      },
      [`&-placement-leftBottom ${t}-arrow`]: {
        bottom: o
      }
    })), c(!!l.right, {
      [[`&-placement-right ${t}-arrow`, `&-placement-rightTop ${t}-arrow`, `&-placement-rightBottom ${t}-arrow`].join(",")]: {
        left: {
          _skip_check_: !0,
          value: n
        },
        transform: "translateX(-100%) rotate(-90deg)"
      },
      [`&-placement-right ${t}-arrow`]: {
        top: {
          _skip_check_: !0,
          value: "50%"
        },
        transform: "translateY(-50%) translateX(-100%) rotate(-90deg)"
      },
      [`&-placement-rightTop ${t}-arrow`]: {
        top: o
      },
      [`&-placement-rightBottom ${t}-arrow`]: {
        bottom: o
      }
    }))
  };
}
export {
  m as MAX_VERTICAL_CONTENT_RADIUS,
  u as default,
  w as getArrowOffsetToken
};
