import { g as oo, m as eo, d as I, r as j, b9 as K, ah as to, E as L, F as ro, I as A, u as H, o as no, c as U, _ as D, bz as ao, a3 as z, P as V, a4 as E, a2 as _, j as io } from "./index2.js";
import { provide as N, inject as X, defineComponent as W, computed as O, ref as F, createVNode as T, watch as lo, nextTick as so } from "vue";
const q = Symbol("radioGroupContextKey"), co = (o) => {
  N(q, o);
}, uo = () => X(q, void 0), J = Symbol("radioOptionTypeContextKey"), po = (o) => {
  N(J, o);
}, bo = () => X(J, void 0), go = new to("antRadioEffect", {
  "0%": {
    transform: "scale(1)",
    opacity: 0.5
  },
  "100%": {
    transform: "scale(1.6)",
    opacity: 0
  }
}), ho = (o) => {
  const {
    componentCls: r,
    antCls: n
  } = o, t = `${r}-group`;
  return {
    [t]: I(I({}, j(o)), {
      display: "inline-block",
      fontSize: 0,
      // RTL
      [`&${t}-rtl`]: {
        direction: "rtl"
      },
      [`${n}-badge ${n}-badge-count`]: {
        zIndex: 1
      },
      [`> ${n}-badge:not(:first-child) > ${n}-button-wrapper`]: {
        borderInlineStart: "none"
      }
    })
  };
}, Co = (o) => {
  const {
    componentCls: r,
    radioWrapperMarginRight: n,
    radioCheckedColor: t,
    radioSize: e,
    motionDurationSlow: d,
    motionDurationMid: s,
    motionEaseInOut: w,
    motionEaseInOutCirc: C,
    radioButtonBg: b,
    colorBorder: B,
    lineWidth: g,
    radioDotSize: f,
    colorBgContainerDisabled: x,
    colorTextDisabled: c,
    paddingXS: h,
    radioDotDisabledColor: a,
    lineType: m,
    radioDotDisabledSize: u,
    wireframe: p,
    colorWhite: y
  } = o, i = `${r}-inner`;
  return {
    [`${r}-wrapper`]: I(I({}, j(o)), {
      position: "relative",
      display: "inline-flex",
      alignItems: "baseline",
      marginInlineStart: 0,
      marginInlineEnd: n,
      cursor: "pointer",
      // RTL
      [`&${r}-wrapper-rtl`]: {
        direction: "rtl"
      },
      "&-disabled": {
        cursor: "not-allowed",
        color: o.colorTextDisabled
      },
      "&::after": {
        display: "inline-block",
        width: 0,
        overflow: "hidden",
        content: '"\\a0"'
      },
      // hashId 在 wrapper 上，只能铺平
      [`${r}-checked::after`]: {
        position: "absolute",
        insetBlockStart: 0,
        insetInlineStart: 0,
        width: "100%",
        height: "100%",
        border: `${g}px ${m} ${t}`,
        borderRadius: "50%",
        visibility: "hidden",
        animationName: go,
        animationDuration: d,
        animationTimingFunction: w,
        animationFillMode: "both",
        content: '""'
      },
      [r]: I(I({}, j(o)), {
        position: "relative",
        display: "inline-block",
        outline: "none",
        cursor: "pointer",
        alignSelf: "center"
      }),
      [`${r}-wrapper:hover &,
        &:hover ${i}`]: {
        borderColor: t
      },
      [`${r}-input:focus-visible + ${i}`]: I({}, K(o)),
      [`${r}:hover::after, ${r}-wrapper:hover &::after`]: {
        visibility: "visible"
      },
      [`${r}-inner`]: {
        "&::after": {
          boxSizing: "border-box",
          position: "absolute",
          insetBlockStart: "50%",
          insetInlineStart: "50%",
          display: "block",
          width: e,
          height: e,
          marginBlockStart: e / -2,
          marginInlineStart: e / -2,
          backgroundColor: p ? t : y,
          borderBlockStart: 0,
          borderInlineStart: 0,
          borderRadius: e,
          transform: "scale(0)",
          opacity: 0,
          transition: `all ${d} ${C}`,
          content: '""'
        },
        boxSizing: "border-box",
        position: "relative",
        insetBlockStart: 0,
        insetInlineStart: 0,
        display: "block",
        width: e,
        height: e,
        backgroundColor: b,
        borderColor: B,
        borderStyle: "solid",
        borderWidth: g,
        borderRadius: "50%",
        transition: `all ${s}`
      },
      [`${r}-input`]: {
        position: "absolute",
        insetBlockStart: 0,
        insetInlineEnd: 0,
        insetBlockEnd: 0,
        insetInlineStart: 0,
        zIndex: 1,
        cursor: "pointer",
        opacity: 0
      },
      // 选中状态
      [`${r}-checked`]: {
        [i]: {
          borderColor: t,
          backgroundColor: p ? b : t,
          "&::after": {
            transform: `scale(${f / e})`,
            opacity: 1,
            transition: `all ${d} ${C}`
          }
        }
      },
      [`${r}-disabled`]: {
        cursor: "not-allowed",
        [i]: {
          backgroundColor: x,
          borderColor: B,
          cursor: "not-allowed",
          "&::after": {
            backgroundColor: a
          }
        },
        [`${r}-input`]: {
          cursor: "not-allowed"
        },
        [`${r}-disabled + span`]: {
          color: c,
          cursor: "not-allowed"
        },
        [`&${r}-checked`]: {
          [i]: {
            "&::after": {
              transform: `scale(${u / e})`
            }
          }
        }
      },
      [`span${r} + *`]: {
        paddingInlineStart: h,
        paddingInlineEnd: h
      }
    })
  };
}, fo = (o) => {
  const {
    radioButtonColor: r,
    controlHeight: n,
    componentCls: t,
    lineWidth: e,
    lineType: d,
    colorBorder: s,
    motionDurationSlow: w,
    motionDurationMid: C,
    radioButtonPaddingHorizontal: b,
    fontSize: B,
    radioButtonBg: g,
    fontSizeLG: f,
    controlHeightLG: x,
    controlHeightSM: c,
    paddingXS: h,
    borderRadius: a,
    borderRadiusSM: m,
    borderRadiusLG: u,
    radioCheckedColor: p,
    radioButtonCheckedBg: y,
    radioButtonHoverColor: i,
    radioButtonActiveColor: v,
    radioSolidCheckedColor: R,
    colorTextDisabled: l,
    colorBgContainerDisabled: S,
    radioDisabledButtonCheckedColor: P,
    radioDisabledButtonCheckedBg: G
  } = o;
  return {
    [`${t}-button-wrapper`]: {
      position: "relative",
      display: "inline-block",
      height: n,
      margin: 0,
      paddingInline: b,
      paddingBlock: 0,
      color: r,
      fontSize: B,
      lineHeight: `${n - e * 2}px`,
      background: g,
      border: `${e}px ${d} ${s}`,
      // strange align fix for chrome but works
      // https://gw.alipayobjects.com/zos/rmsportal/VFTfKXJuogBAXcvfAUWJ.gif
      borderBlockStartWidth: e + 0.02,
      borderInlineStartWidth: 0,
      borderInlineEndWidth: e,
      cursor: "pointer",
      transition: [`color ${C}`, `background ${C}`, `border-color ${C}`, `box-shadow ${C}`].join(","),
      a: {
        color: r
      },
      [`> ${t}-button`]: {
        position: "absolute",
        insetBlockStart: 0,
        insetInlineStart: 0,
        zIndex: -1,
        width: "100%",
        height: "100%"
      },
      "&:not(:first-child)": {
        "&::before": {
          position: "absolute",
          insetBlockStart: -e,
          insetInlineStart: -e,
          display: "block",
          boxSizing: "content-box",
          width: 1,
          height: "100%",
          paddingBlock: e,
          paddingInline: 0,
          backgroundColor: s,
          transition: `background-color ${w}`,
          content: '""'
        }
      },
      "&:first-child": {
        borderInlineStart: `${e}px ${d} ${s}`,
        borderStartStartRadius: a,
        borderEndStartRadius: a
      },
      "&:last-child": {
        borderStartEndRadius: a,
        borderEndEndRadius: a
      },
      "&:first-child:last-child": {
        borderRadius: a
      },
      [`${t}-group-large &`]: {
        height: x,
        fontSize: f,
        lineHeight: `${x - e * 2}px`,
        "&:first-child": {
          borderStartStartRadius: u,
          borderEndStartRadius: u
        },
        "&:last-child": {
          borderStartEndRadius: u,
          borderEndEndRadius: u
        }
      },
      [`${t}-group-small &`]: {
        height: c,
        paddingInline: h - e,
        paddingBlock: 0,
        lineHeight: `${c - e * 2}px`,
        "&:first-child": {
          borderStartStartRadius: m,
          borderEndStartRadius: m
        },
        "&:last-child": {
          borderStartEndRadius: m,
          borderEndEndRadius: m
        }
      },
      "&:hover": {
        position: "relative",
        color: p
      },
      "&:has(:focus-visible)": I({}, K(o)),
      [`${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: p,
        background: y,
        borderColor: p,
        "&::before": {
          backgroundColor: p
        },
        "&:first-child": {
          borderColor: p
        },
        "&:hover": {
          color: i,
          borderColor: i,
          "&::before": {
            backgroundColor: i
          }
        },
        "&:active": {
          color: v,
          borderColor: v,
          "&::before": {
            backgroundColor: v
          }
        }
      },
      [`${t}-group-solid &-checked:not(${t}-button-wrapper-disabled)`]: {
        color: R,
        background: p,
        borderColor: p,
        "&:hover": {
          color: R,
          background: i,
          borderColor: i
        },
        "&:active": {
          color: R,
          background: v,
          borderColor: v
        }
      },
      "&-disabled": {
        color: l,
        backgroundColor: S,
        borderColor: s,
        cursor: "not-allowed",
        "&:first-child, &:hover": {
          color: l,
          backgroundColor: S,
          borderColor: s
        }
      },
      [`&-disabled${t}-button-wrapper-checked`]: {
        color: P,
        backgroundColor: G,
        borderColor: s,
        boxShadow: "none"
      }
    }
  };
}, Q = oo("Radio", (o) => {
  const {
    padding: r,
    lineWidth: n,
    controlItemBgActiveDisabled: t,
    colorTextDisabled: e,
    colorBgContainer: d,
    fontSizeLG: s,
    controlOutline: w,
    colorPrimaryHover: C,
    colorPrimaryActive: b,
    colorText: B,
    colorPrimary: g,
    marginXS: f,
    controlOutlineWidth: x,
    colorTextLightSolid: c,
    wireframe: h
  } = o, a = `0 0 0 ${x}px ${w}`, m = a, u = s, p = 4, y = u - p * 2, i = h ? y : u - (p + n) * 2, v = g, R = B, l = C, S = b, P = r - n, $ = eo(o, {
    radioFocusShadow: a,
    radioButtonFocusShadow: m,
    radioSize: u,
    radioDotSize: i,
    radioDotDisabledSize: y,
    radioCheckedColor: v,
    radioDotDisabledColor: e,
    radioSolidCheckedColor: c,
    radioButtonBg: d,
    radioButtonCheckedBg: d,
    radioButtonColor: R,
    radioButtonHoverColor: l,
    radioButtonActiveColor: S,
    radioButtonPaddingHorizontal: P,
    radioDisabledButtonCheckedBg: t,
    radioDisabledButtonCheckedColor: e,
    radioWrapperMarginRight: f
  });
  return [ho($), Co($), fo($)];
});
var vo = function(o, r) {
  var n = {};
  for (var t in o) Object.prototype.hasOwnProperty.call(o, t) && r.indexOf(t) < 0 && (n[t] = o[t]);
  if (o != null && typeof Object.getOwnPropertySymbols == "function") for (var e = 0, t = Object.getOwnPropertySymbols(o); e < t.length; e++)
    r.indexOf(t[e]) < 0 && Object.prototype.propertyIsEnumerable.call(o, t[e]) && (n[t[e]] = o[t[e]]);
  return n;
};
const Y = () => ({
  prefixCls: String,
  checked: z(),
  disabled: z(),
  isGroup: z(),
  value: V.any,
  name: String,
  id: String,
  autofocus: z(),
  onChange: E(),
  onFocus: E(),
  onBlur: E(),
  onClick: E(),
  "onUpdate:checked": E(),
  "onUpdate:value": E()
}), k = W({
  compatConfig: {
    MODE: 3
  },
  name: "ARadio",
  inheritAttrs: !1,
  props: Y(),
  setup(o, r) {
    let {
      emit: n,
      expose: t,
      slots: e,
      attrs: d
    } = r;
    const s = L(), w = ro.useInject(), C = bo(), b = uo(), B = A(), g = O(() => {
      var l;
      return (l = h.value) !== null && l !== void 0 ? l : B.value;
    }), f = F(), {
      prefixCls: x,
      direction: c,
      disabled: h
    } = H("radio", o), a = O(() => (b == null ? void 0 : b.optionType.value) === "button" || C === "button" ? `${x.value}-button` : x.value), m = A(), [u, p] = Q(x);
    t({
      focus: () => {
        f.value.focus();
      },
      blur: () => {
        f.value.blur();
      }
    });
    const v = (l) => {
      const S = l.target.checked;
      n("update:checked", S), n("update:value", S), n("change", l), s.onFieldChange();
    }, R = (l) => {
      n("change", l), b && b.onChange && b.onChange(l);
    };
    return () => {
      var l;
      const S = b, {
        prefixCls: P,
        id: G = s.id.value
      } = o, M = vo(o, ["prefixCls", "id"]), $ = I(I({
        prefixCls: a.value,
        id: G
      }, no(M, ["onUpdate:checked", "onUpdate:value"])), {
        disabled: (l = h.value) !== null && l !== void 0 ? l : m.value
      });
      S ? ($.name = S.name.value, $.onChange = R, $.checked = o.value === S.value.value, $.disabled = g.value || S.disabled.value) : $.onChange = v;
      const Z = U({
        [`${a.value}-wrapper`]: !0,
        [`${a.value}-wrapper-checked`]: $.checked,
        [`${a.value}-wrapper-disabled`]: $.disabled,
        [`${a.value}-wrapper-rtl`]: c.value === "rtl",
        [`${a.value}-wrapper-in-form-item`]: w.isFormItemInput
      }, d.class, p.value);
      return u(T("label", D(D({}, d), {}, {
        class: Z
      }), [T(ao, D(D({}, $), {}, {
        type: "radio",
        ref: f
      }), null), e.default && T("span", null, [e.default()])]));
    };
  }
}), mo = () => ({
  prefixCls: String,
  value: V.any,
  size: _(),
  options: io(),
  disabled: z(),
  name: String,
  buttonStyle: _("outline"),
  id: String,
  optionType: _("default"),
  onChange: E(),
  "onUpdate:value": E()
}), So = W({
  compatConfig: {
    MODE: 3
  },
  name: "ARadioGroup",
  inheritAttrs: !1,
  props: mo(),
  // emits: ['update:value', 'change'],
  setup(o, r) {
    let {
      slots: n,
      emit: t,
      attrs: e
    } = r;
    const d = L(), {
      prefixCls: s,
      direction: w,
      size: C
    } = H("radio", o), [b, B] = Q(s), g = F(o.value), f = F(!1);
    return lo(() => o.value, (c) => {
      g.value = c, f.value = !1;
    }), co({
      onChange: (c) => {
        const h = g.value, {
          value: a
        } = c.target;
        "value" in o || (g.value = a), !f.value && a !== h && (f.value = !0, t("update:value", a), t("change", c), d.onFieldChange()), so(() => {
          f.value = !1;
        });
      },
      value: g,
      disabled: O(() => o.disabled),
      name: O(() => o.name),
      optionType: O(() => o.optionType)
    }), () => {
      var c;
      const {
        options: h,
        buttonStyle: a,
        id: m = d.id.value
      } = o, u = `${s.value}-group`, p = U(u, `${u}-${a}`, {
        [`${u}-${C.value}`]: C.value,
        [`${u}-rtl`]: w.value === "rtl"
      }, e.class, B.value);
      let y = null;
      return h && h.length > 0 ? y = h.map((i) => {
        if (typeof i == "string" || typeof i == "number")
          return T(k, {
            key: i,
            prefixCls: s.value,
            disabled: o.disabled,
            value: i,
            checked: g.value === i
          }, {
            default: () => [i]
          });
        const {
          value: v,
          disabled: R,
          label: l
        } = i;
        return T(k, {
          key: `radio-group-value-options-${v}`,
          prefixCls: s.value,
          disabled: R || o.disabled,
          value: v,
          checked: g.value === v
        }, {
          default: () => [l]
        });
      }) : y = (c = n.default) === null || c === void 0 ? void 0 : c.call(n), b(T("div", D(D({}, e), {}, {
        class: p,
        id: m
      }), [y]));
    };
  }
}), $o = W({
  compatConfig: {
    MODE: 3
  },
  name: "ARadioButton",
  inheritAttrs: !1,
  props: Y(),
  setup(o, r) {
    let {
      slots: n,
      attrs: t
    } = r;
    const {
      prefixCls: e
    } = H("radio", o);
    return po("button"), () => {
      var d;
      return T(k, D(D(D({}, t), o), {}, {
        prefixCls: e.value
      }), {
        default: () => [(d = n.default) === null || d === void 0 ? void 0 : d.call(n)]
      });
    };
  }
});
k.Group = So;
k.Button = $o;
k.install = function(o) {
  return o.component(k.name, k), o.component(k.Group.name, k.Group), o.component(k.Button.name, k.Button), o;
};
export {
  k as R,
  So as _
};
