"use strict";
const toHaveAccessibleName$1 = require("../../../../_virtual/to-have-accessible-name.cjs");
const index = require("../../../../_virtual/index4.cjs");
require("./utils.cjs");
const utils = require("../../../../_virtual/utils.cjs");
Object.defineProperty(toHaveAccessibleName$1.__exports, "__esModule", {
  value: true
});
toHaveAccessibleName$1.__exports.toHaveAccessibleName = toHaveAccessibleName;
var _domAccessibilityApi = index;
var _utils = utils.__exports;
function toHaveAccessibleName(htmlElement, expectedAccessibleName) {
  (0, _utils.checkHtmlElement)(htmlElement, toHaveAccessibleName, this);
  const actualAccessibleName = (0, _domAccessibilityApi.computeAccessibleName)(htmlElement);
  const missingExpectedValue = arguments.length === 1;
  let pass = false;
  if (missingExpectedValue) {
    pass = actualAccessibleName !== "";
  } else {
    pass = expectedAccessibleName instanceof RegExp ? expectedAccessibleName.test(actualAccessibleName) : this.equals(actualAccessibleName, expectedAccessibleName);
  }
  return {
    pass,
    message: () => {
      const to = this.isNot ? "not to" : "to";
      return (0, _utils.getMessage)(this, this.utils.matcherHint(`${this.isNot ? ".not" : ""}.${toHaveAccessibleName.name}`, "element", ""), `Expected element ${to} have accessible name`, expectedAccessibleName, "Received", actualAccessibleName);
    }
  };
}
module.exports = toHaveAccessibleName$1.__exports;
//# sourceMappingURL=to-have-accessible-name.cjs.map
