import { __exports as i } from "../../../../../../_virtual/legacy.js";
import { __require as m } from "../../../../domhandler@5.0.3/node_modules/domhandler/lib/index.js";
import { __require as E } from "./querying.js";
var g;
function h() {
  if (g) return i;
  g = 1, Object.defineProperty(i, "__esModule", { value: !0 }), i.testElement = p, i.getElements = _, i.getElementById = v, i.getElementsByTagName = d, i.getElementsByClassName = l, i.getElementsByTagType = T;
  var u = /* @__PURE__ */ m(), f = /* @__PURE__ */ E(), o = {
    tag_name: function(e) {
      return typeof e == "function" ? function(t) {
        return (0, u.isTag)(t) && e(t.name);
      } : e === "*" ? u.isTag : function(t) {
        return (0, u.isTag)(t) && t.name === e;
      };
    },
    tag_type: function(e) {
      return typeof e == "function" ? function(t) {
        return e(t.type);
      } : function(t) {
        return t.type === e;
      };
    },
    tag_contains: function(e) {
      return typeof e == "function" ? function(t) {
        return (0, u.isText)(t) && e(t.data);
      } : function(t) {
        return (0, u.isText)(t) && t.data === e;
      };
    }
  };
  function a(e, t) {
    return typeof t == "function" ? function(n) {
      return (0, u.isTag)(n) && t(n.attribs[e]);
    } : function(n) {
      return (0, u.isTag)(n) && n.attribs[e] === t;
    };
  }
  function y(e, t) {
    return function(n) {
      return e(n) || t(n);
    };
  }
  function c(e) {
    var t = Object.keys(e).map(function(n) {
      var r = e[n];
      return Object.prototype.hasOwnProperty.call(o, n) ? o[n](r) : a(n, r);
    });
    return t.length === 0 ? null : t.reduce(y);
  }
  function p(e, t) {
    var n = c(e);
    return n ? n(t) : !0;
  }
  function _(e, t, n, r) {
    r === void 0 && (r = 1 / 0);
    var s = c(e);
    return s ? (0, f.filter)(s, t, n, r) : [];
  }
  function v(e, t, n) {
    return n === void 0 && (n = !0), Array.isArray(t) || (t = [t]), (0, f.findOne)(a("id", e), t, n);
  }
  function d(e, t, n, r) {
    return n === void 0 && (n = !0), r === void 0 && (r = 1 / 0), (0, f.filter)(o.tag_name(e), t, n, r);
  }
  function l(e, t, n, r) {
    return n === void 0 && (n = !0), r === void 0 && (r = 1 / 0), (0, f.filter)(a("class", e), t, n, r);
  }
  function T(e, t, n, r) {
    return n === void 0 && (n = !0), r === void 0 && (r = 1 / 0), (0, f.filter)(o.tag_type(e), t, n, r);
  }
  return i;
}
export {
  h as __require
};
//# sourceMappingURL=legacy.js.map
