import $ from "../../@babel/runtime/helpers/esm/extends.mjs";
import p from "../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import h from "../../@babel/runtime/helpers/esm/defineProperty.mjs";
import w from "../../@babel/runtime/helpers/esm/slicedToArray.mjs";
import D from "../../@babel/runtime/helpers/esm/objectWithoutProperties.mjs";
import M from "../../classnames/index.mjs";
import j from "../../rc-util/es/hooks/useMergedState.mjs";
import * as o from "react";
import { forwardRef as V, useRef as A, useImperativeHandle as H } from "react";
var I = ["prefixCls", "className", "style", "checked", "disabled", "defaultChecked", "type", "title", "onChange"], K = /* @__PURE__ */ V(function(t, g) {
  var r, l = t.prefixCls, a = l === void 0 ? "rc-checkbox" : l, k = t.className, C = t.style, _ = t.checked, c = t.disabled, d = t.defaultChecked, b = d === void 0 ? !1 : d, u = t.type, s = u === void 0 ? "checkbox" : u, y = t.title, i = t.onChange, x = D(t, I), n = A(null), N = j(b, {
    value: _
  }), f = w(N, 2), m = f[0], R = f[1];
  H(g, function() {
    return {
      focus: function() {
        var e;
        (e = n.current) === null || e === void 0 || e.focus();
      },
      blur: function() {
        var e;
        (e = n.current) === null || e === void 0 || e.blur();
      },
      input: n.current
    };
  });
  var P = M(a, k, (r = {}, h(r, "".concat(a, "-checked"), m), h(r, "".concat(a, "-disabled"), c), r)), E = function(e) {
    c || ("checked" in t || R(e.target.checked), i == null || i({
      target: p(p({}, t), {}, {
        type: s,
        checked: e.target.checked
      }),
      stopPropagation: function() {
        e.stopPropagation();
      },
      preventDefault: function() {
        e.preventDefault();
      },
      nativeEvent: e.nativeEvent
    }));
  };
  return /* @__PURE__ */ o.createElement("span", {
    className: P,
    title: y,
    style: C
  }, /* @__PURE__ */ o.createElement("input", $({}, x, {
    className: "".concat(a, "-input"),
    ref: n,
    onChange: E,
    disabled: c,
    checked: !!m,
    type: s
  })), /* @__PURE__ */ o.createElement("span", {
    className: "".concat(a, "-inner")
  }));
});
export {
  K as Checkbox,
  K as default
};
