import { HTML_TAG_RE as s } from "../common/html_re.js";
function l(n) {
  return /^<a[>\s]/i.test(n);
}
function f(n) {
  return /^<\/a\s*>/i.test(n);
}
function u(n) {
  const i = n | 32;
  return i >= 97 && i <= 122;
}
function x(n, i) {
  if (!n.md.options.html)
    return !1;
  const c = n.posMax, e = n.pos;
  if (n.src.charCodeAt(e) !== 60 || e + 2 >= c)
    return !1;
  const o = n.src.charCodeAt(e + 1);
  if (o !== 33 && o !== 63 && o !== 47 && !u(o))
    return !1;
  const r = n.src.slice(e).match(s);
  if (!r)
    return !1;
  if (!i) {
    const t = n.push("html_inline", "", 0);
    t.content = r[0], l(t.content) && n.linkLevel++, f(t.content) && n.linkLevel--;
  }
  return n.pos += r[0].length, !0;
}
export {
  x as default
};
