import { p as e, s as t } from "./rehype-raw-49057806.js";
const a = ["ariaDescribedBy", "ariaLabel", "ariaLabelledBy"], r = { ancestors: { tbody: ["table"], td: ["table"], th: ["table"], thead: ["table"], tfoot: ["table"], tr: ["table"] }, attributes: { a: [...a, "dataFootnoteBackref", "dataFootnoteRef", ["className", "data-footnote-backref"], "href"], blockquote: ["cite"], code: [["className", /^language-./]], del: ["cite"], div: ["itemScope", "itemType"], dl: [...a], h2: [["className", "sr-only"]], img: [...a, "longDesc", "src"], input: [["disabled", true], ["type", "checkbox"]], ins: ["cite"], li: [["className", "task-list-item"]], ol: [...a, ["className", "contains-task-list"]], q: ["cite"], section: ["dataFootnotes", ["className", "footnotes"]], source: ["srcSet"], summary: [...a], table: [...a], ul: [...a, ["className", "contains-task-list"]], "*": ["abbr", "accept", "acceptCharset", "accessKey", "action", "align", "alt", "axis", "border", "cellPadding", "cellSpacing", "char", "charOff", "charSet", "checked", "clear", "colSpan", "color", "cols", "compact", "coords", "dateTime", "dir", "encType", "frame", "hSpace", "headers", "height", "hrefLang", "htmlFor", "id", "isMap", "itemProp", "label", "lang", "maxLength", "media", "method", "multiple", "name", "noHref", "noShade", "noWrap", "open", "prompt", "readOnly", "rev", "rowSpan", "rows", "rules", "scope", "selected", "shape", "size", "span", "start", "summary", "tabIndex", "title", "useMap", "vAlign", "value", "width"] }, clobber: ["ariaDescribedBy", "ariaLabelledBy", "id", "name"], clobberPrefix: "user-content-", protocols: { cite: ["http", "https"], href: ["http", "https", "irc", "ircs", "mailto", "xmpp"], longDesc: ["http", "https"], src: ["http", "https"] }, required: { input: { disabled: true, type: "checkbox" } }, strip: ["script"], tagNames: ["a", "b", "blockquote", "br", "code", "dd", "del", "details", "div", "dl", "dt", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "i", "img", "input", "ins", "kbd", "li", "ol", "p", "picture", "pre", "q", "rp", "rt", "ruby", "s", "samp", "section", "source", "span", "strike", "strong", "sub", "summary", "sup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "tt", "ul", "var"] }, s = {}.hasOwnProperty;
function o(e2, t2) {
  if (t2 && "object" == typeof t2) {
    const a2 = t2;
    switch ("string" == typeof a2.type ? a2.type : "") {
      case "comment":
        return function(e3, t3) {
          if (e3.schema.allowComments) {
            const e4 = "string" == typeof t3.value ? t3.value : "", a3 = e4.indexOf("-->"), r2 = { type: "comment", value: a3 < 0 ? e4 : e4.slice(0, a3) };
            return l(r2, t3), r2;
          }
        }(e2, a2);
      case "doctype":
        return function(e3, t3) {
          if (e3.schema.allowDoctypes) {
            const e4 = { type: "doctype" };
            return l(e4, t3), e4;
          }
        }(e2, a2);
      case "element":
        return function(e3, t3) {
          const a3 = "string" == typeof t3.tagName ? t3.tagName : "";
          e3.stack.push(a3);
          const r2 = n(e3, t3.children), o2 = function(e4, t4) {
            const a4 = e4.stack[e4.stack.length - 1], r3 = e4.schema.attributes, o3 = e4.schema.required, n2 = r3 && s.call(r3, a4) ? r3[a4] : void 0, i3 = r3 && s.call(r3, "*") ? r3["*"] : void 0, l2 = t4 && "object" == typeof t4 ? t4 : {}, u3 = {};
            let h;
            for (h in l2)
              if (s.call(l2, h)) {
                const t5 = l2[h];
                let a5 = c(e4, p(n2, h), h, t5);
                null == a5 && (a5 = c(e4, p(i3, h), h, t5)), null != a5 && (u3[h] = a5);
              }
            if (o3 && s.call(o3, a4)) {
              const e5 = o3[a4];
              for (h in e5)
                s.call(e5, h) && !s.call(u3, h) && (u3[h] = e5[h]);
            }
            return u3;
          }(e3, t3.properties);
          e3.stack.pop();
          let i2 = false;
          if (a3 && "*" !== a3 && (!e3.schema.tagNames || e3.schema.tagNames.includes(a3)) && (i2 = true, e3.schema.ancestors && s.call(e3.schema.ancestors, a3))) {
            const t4 = e3.schema.ancestors[a3];
            let r3 = -1;
            for (i2 = false; ++r3 < t4.length; )
              e3.stack.includes(t4[r3]) && (i2 = true);
          }
          if (!i2)
            return e3.schema.strip && !e3.schema.strip.includes(a3) ? r2 : void 0;
          const u2 = { type: "element", tagName: a3, properties: o2, children: r2 };
          return l(u2, t3), u2;
        }(e2, a2);
      case "root":
        return function(e3, t3) {
          const a3 = n(e3, t3.children), r2 = { type: "root", children: a3 };
          return l(r2, t3), r2;
        }(e2, a2);
      case "text":
        return function(e3, t3) {
          const a3 = "string" == typeof t3.value ? t3.value : "", r2 = { type: "text", value: a3 };
          return l(r2, t3), r2;
        }(0, a2);
    }
  }
}
function n(e2, t2) {
  const a2 = [];
  if (Array.isArray(t2)) {
    const r2 = t2;
    let s2 = -1;
    for (; ++s2 < r2.length; ) {
      const t3 = o(e2, r2[s2]);
      t3 && (Array.isArray(t3) ? a2.push(...t3) : a2.push(t3));
    }
  }
  return a2;
}
function c(e2, t2, a2, r2) {
  return t2 ? Array.isArray(r2) ? function(e3, t3, a3, r3) {
    let s2 = -1;
    const o2 = [];
    for (; ++s2 < r3.length; ) {
      const n2 = i(e3, t3, a3, r3[s2]);
      "number" != typeof n2 && "string" != typeof n2 || o2.push(n2);
    }
    return o2;
  }(e2, t2, a2, r2) : i(e2, t2, a2, r2) : void 0;
}
function i(e2, t2, a2, r2) {
  if (("boolean" == typeof r2 || "number" == typeof r2 || "string" == typeof r2) && function(e3, t3, a3) {
    const r3 = e3.schema.protocols && s.call(e3.schema.protocols, t3) ? e3.schema.protocols[t3] : void 0;
    if (!r3 || 0 === r3.length)
      return true;
    const o2 = String(a3), n2 = o2.indexOf(":"), c2 = o2.indexOf("?"), i2 = o2.indexOf("#"), l2 = o2.indexOf("/");
    if (n2 < 0 || l2 > -1 && n2 > l2 || c2 > -1 && n2 > c2 || i2 > -1 && n2 > i2)
      return true;
    let p2 = -1;
    for (; ++p2 < r3.length; ) {
      const e4 = r3[p2];
      if (n2 === e4.length && o2.slice(0, e4.length) === e4)
        return true;
    }
    return false;
  }(e2, a2, r2)) {
    if ("object" == typeof t2 && t2.length > 1) {
      let e3 = false, a3 = 0;
      for (; ++a3 < t2.length; ) {
        const s2 = t2[a3];
        if (s2 && "object" == typeof s2 && "flags" in s2) {
          if (s2.test(String(r2))) {
            e3 = true;
            break;
          }
        } else if (s2 === r2) {
          e3 = true;
          break;
        }
      }
      if (!e3)
        return;
    }
    return e2.schema.clobber && e2.schema.clobberPrefix && e2.schema.clobber.includes(a2) ? e2.schema.clobberPrefix + r2 : r2;
  }
}
function l(a2, r2) {
  const s2 = e(r2);
  r2.data && (a2.data = t(r2.data)), s2 && (a2.position = s2);
}
function p(e2, t2) {
  let a2, r2 = -1;
  if (e2)
    for (; ++r2 < e2.length; ) {
      const s2 = e2[r2], o2 = "string" == typeof s2 ? s2 : s2[0];
      if (o2 === t2)
        return s2;
      "data*" === o2 && (a2 = s2);
    }
  if (t2.length > 4 && "data" === t2.slice(0, 4).toLowerCase())
    return a2;
}
function u(e2) {
  return function(t2) {
    const a2 = function(e3, t3) {
      let a3 = { type: "root", children: [] };
      const s2 = o({ schema: t3 ? { ...r, ...t3 } : r, stack: [] }, e3);
      return s2 && (Array.isArray(s2) ? 1 === s2.length ? a3 = s2[0] : a3.children = s2 : a3 = s2), a3;
    }(t2, e2);
    return a2;
  };
}
export {
  r as d,
  u as r
};
