import { __exports as toBePartiallyChecked$1 } from "../../../../_virtual/to-be-partially-checked.js";
import "./utils.js";
import { __exports as utils } from "../../../../_virtual/utils.js";
Object.defineProperty(toBePartiallyChecked$1, "__esModule", {
  value: true
});
toBePartiallyChecked$1.toBePartiallyChecked = toBePartiallyChecked;
var _utils = utils;
function toBePartiallyChecked(element) {
  (0, _utils.checkHtmlElement)(element, toBePartiallyChecked, this);
  const isValidInput = () => {
    return element.tagName.toLowerCase() === "input" && element.type === "checkbox";
  };
  const isValidAriaElement = () => {
    return element.getAttribute("role") === "checkbox";
  };
  if (!isValidInput() && !isValidAriaElement()) {
    return {
      pass: false,
      message: () => 'only inputs with type="checkbox" or elements with role="checkbox" and a valid aria-checked attribute can be used with .toBePartiallyChecked(). Use .toHaveValue() instead'
    };
  }
  const isPartiallyChecked = () => {
    const isAriaMixed = element.getAttribute("aria-checked") === "mixed";
    if (isValidInput()) {
      return element.indeterminate || isAriaMixed;
    }
    return isAriaMixed;
  };
  return {
    pass: isPartiallyChecked(),
    message: () => {
      const is = isPartiallyChecked() ? "is" : "is not";
      return [this.utils.matcherHint(`${this.isNot ? ".not" : ""}.toBePartiallyChecked`, "element", ""), "", `Received element ${is} partially checked:`, `  ${this.utils.printReceived(element.cloneNode(false))}`].join("\n");
    }
  };
}
export {
  toBePartiallyChecked$1 as default
};
//# sourceMappingURL=to-be-partially-checked.js.map
