import * as n from "react";
import u from "../../../classnames/index.mjs";
import { devUseWarning as d } from "../_util/warning.mjs";
import "../config-provider/index.mjs";
import "../../../@ant-design/cssinjs/es/extractStyle.mjs";
import "../../../@ant-design/cssinjs/es/hooks/useCacheToken.mjs";
import "../../../@ant-design/cssinjs/es/StyleContext.mjs";
import "../../../@ant-design/cssinjs/es/theme/createTheme.mjs";
import "../../../rc-util/es/warning.mjs";
import "../../../@ant-design/cssinjs/es/theme/ThemeCache.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 "../../../@ant-design/cssinjs/es/transformers/legacyLogicalProperties.mjs";
import g from "../theme/useToken.mjs";
import { ConfigContext as b } from "../config-provider/context.mjs";
var v = globalThis && globalThis.__rest || function(r, s) {
  var o = {};
  for (var e in r)
    Object.prototype.hasOwnProperty.call(r, e) && s.indexOf(e) < 0 && (o[e] = r[e]);
  if (r != null && typeof Object.getOwnPropertySymbols == "function")
    for (var t = 0, e = Object.getOwnPropertySymbols(r); t < e.length; t++)
      s.indexOf(e[t]) < 0 && Object.prototype.propertyIsEnumerable.call(r, e[t]) && (o[e[t]] = r[e[t]]);
  return o;
};
const x = /* @__PURE__ */ n.createContext(void 0), O = (r) => {
  const {
    getPrefixCls: s,
    direction: o
  } = n.useContext(b), {
    prefixCls: e,
    size: t,
    className: a
  } = r, c = v(r, ["prefixCls", "size", "className"]), l = s("btn-group", e), [, , p] = g();
  let i = "";
  switch (t) {
    case "large":
      i = "lg";
      break;
    case "small":
      i = "sm";
      break;
  }
  if (process.env.NODE_ENV !== "production") {
    const f = d("Button.Group");
    process.env.NODE_ENV !== "production" && f(!t || ["large", "small", "middle"].includes(t), "usage", "Invalid prop `size`.");
  }
  const m = u(l, {
    [`${l}-${i}`]: i,
    [`${l}-rtl`]: o === "rtl"
  }, a, p);
  return /* @__PURE__ */ n.createElement(x.Provider, {
    value: t
  }, /* @__PURE__ */ n.createElement("div", Object.assign({}, c, {
    className: m
  })));
}, $ = O;
export {
  x as GroupSizeContext,
  $ as default
};
