import { b as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-cvK1vxO7.js";
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-D2C6R0DK.js";
import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-yV9VVy9R.js";
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "./usePress-CBQIDzpQ.js";
import { $ as $f645667febf57a63$export$4c014de7c8940b4c } from "./useHover-LmGemtHE.js";
function $d2c8e2b0480f3f34$export$cbe85ee05b554577(props, state, ref) {
  let { isDisabled = false, isReadOnly = false, value, name, form, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, validationState = "valid", isInvalid, onPressStart, onPressEnd, onPressChange, onPress, onPressUp, onClick } = props;
  let onChange = (e) => {
    e.stopPropagation();
    state.setSelected(e.target.checked);
  };
  let hasChildren = children != null;
  let hasAriaLabel = ariaLabel != null || ariaLabelledby != null;
  if (!hasChildren && !hasAriaLabel && process.env.NODE_ENV !== "production") console.warn("If you do not provide children, you must specify an aria-label for accessibility");
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21({
    onPressStart,
    onPressEnd,
    onPressChange,
    onPress,
    onPressUp,
    onClick,
    isDisabled
  });
  let { pressProps: labelProps, isPressed: isLabelPressed } = $f6c31cce2adf654f$export$45712eceda6fad21({
    onPressStart,
    onPressEnd,
    onPressChange,
    onPressUp,
    onClick,
    onPress(e) {
      var _ref_current;
      onPress === null || onPress === void 0 ? void 0 : onPress(e);
      state.toggle();
      (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
    },
    isDisabled: isDisabled || isReadOnly
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c(props, ref);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928(pressProps, focusableProps);
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
    labelable: true
  });
  $99facab73266f662$export$5add1d006293d136(ref, state.defaultSelected, state.setSelected);
  return {
    labelProps: $3ef42575df84b30b$export$9d1611c77c2fe928(labelProps, {
      onClick: (e) => e.preventDefault()
    }),
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, {
      "aria-invalid": isInvalid || validationState === "invalid" || void 0,
      "aria-errormessage": props["aria-errormessage"],
      "aria-controls": props["aria-controls"],
      "aria-readonly": isReadOnly || void 0,
      onChange,
      disabled: isDisabled,
      ...value == null ? {} : {
        value
      },
      name,
      form,
      type: "checkbox",
      ...interactions
    }),
    isSelected: state.isSelected,
    isPressed: isPressed || isLabelPressed,
    isDisabled,
    isReadOnly,
    isInvalid: isInvalid || validationState === "invalid"
  };
}
export {
  $d2c8e2b0480f3f34$export$cbe85ee05b554577 as $
};
