import { P as e, f as r, T as t, z as n, a as o, t as s, g as i, w as a } from "./parse5-f837f753.js";
const c = "object" == typeof self ? self : globalThis, u = (e2) => ((e3, r2) => {
  const t2 = (r3, t3) => (e3.set(t3, r3), r3), n2 = (o2) => {
    if (e3.has(o2))
      return e3.get(o2);
    const [s2, i2] = r2[o2];
    switch (s2) {
      case 0:
      case -1:
        return t2(i2, o2);
      case 1: {
        const e4 = t2([], o2);
        for (const r3 of i2)
          e4.push(n2(r3));
        return e4;
      }
      case 2: {
        const e4 = t2({}, o2);
        for (const [r3, t3] of i2)
          e4[n2(r3)] = n2(t3);
        return e4;
      }
      case 3:
        return t2(new Date(i2), o2);
      case 4: {
        const { source: e4, flags: r3 } = i2;
        return t2(new RegExp(e4, r3), o2);
      }
      case 5: {
        const e4 = t2(/* @__PURE__ */ new Map(), o2);
        for (const [r3, t3] of i2)
          e4.set(n2(r3), n2(t3));
        return e4;
      }
      case 6: {
        const e4 = t2(/* @__PURE__ */ new Set(), o2);
        for (const r3 of i2)
          e4.add(n2(r3));
        return e4;
      }
      case 7: {
        const { name: e4, message: r3 } = i2;
        return t2(new c[e4](r3), o2);
      }
      case 8:
        return t2(BigInt(i2), o2);
      case "BigInt":
        return t2(Object(BigInt(i2)), o2);
    }
    return t2(new c[s2](i2), o2);
  };
  return n2;
})(/* @__PURE__ */ new Map(), e2)(0), p = "", { toString: f } = {}, { keys: l } = Object, d = (e2) => {
  const r2 = typeof e2;
  if ("object" !== r2 || !e2)
    return [0, r2];
  const t2 = f.call(e2).slice(8, -1);
  switch (t2) {
    case "Array":
      return [1, p];
    case "Object":
      return [2, p];
    case "Date":
      return [3, p];
    case "RegExp":
      return [4, p];
    case "Map":
      return [5, p];
    case "Set":
      return [6, p];
  }
  return t2.includes("Array") ? [1, t2] : t2.includes("Error") ? [7, t2] : [2, t2];
}, h = ([e2, r2]) => 0 === e2 && ("function" === r2 || "symbol" === r2), m = (e2, { json: r2, lossy: t2 } = {}) => {
  const n2 = [];
  return ((e3, r3, t3, n3) => {
    const o2 = (e4, r4) => {
      const o3 = n3.push(e4) - 1;
      return t3.set(r4, o3), o3;
    }, s2 = (n4) => {
      if (t3.has(n4))
        return t3.get(n4);
      let [i2, a2] = d(n4);
      switch (i2) {
        case 0: {
          let r4 = n4;
          switch (a2) {
            case "bigint":
              i2 = 8, r4 = n4.toString();
              break;
            case "function":
            case "symbol":
              if (e3)
                throw new TypeError("unable to serialize " + a2);
              r4 = null;
              break;
            case "undefined":
              return o2([-1], n4);
          }
          return o2([i2, r4], n4);
        }
        case 1: {
          if (a2)
            return o2([a2, [...n4]], n4);
          const e4 = [], r4 = o2([i2, e4], n4);
          for (const r5 of n4)
            e4.push(s2(r5));
          return r4;
        }
        case 2: {
          if (a2)
            switch (a2) {
              case "BigInt":
                return o2([a2, n4.toString()], n4);
              case "Boolean":
              case "Number":
              case "String":
                return o2([a2, n4.valueOf()], n4);
            }
          if (r3 && "toJSON" in n4)
            return s2(n4.toJSON());
          const t4 = [], c3 = o2([i2, t4], n4);
          for (const r4 of l(n4))
            !e3 && h(d(n4[r4])) || t4.push([s2(r4), s2(n4[r4])]);
          return c3;
        }
        case 3:
          return o2([i2, n4.toISOString()], n4);
        case 4: {
          const { source: e4, flags: r4 } = n4;
          return o2([i2, { source: e4, flags: r4 }], n4);
        }
        case 5: {
          const r4 = [], t4 = o2([i2, r4], n4);
          for (const [t5, o3] of n4)
            (e3 || !h(d(t5)) && !h(d(o3))) && r4.push([s2(t5), s2(o3)]);
          return t4;
        }
        case 6: {
          const r4 = [], t4 = o2([i2, r4], n4);
          for (const t5 of n4)
            !e3 && h(d(t5)) || r4.push(s2(t5));
          return t4;
        }
      }
      const { message: c2 } = n4;
      return o2([i2, { name: a2, message: c2 }], n4);
    };
    return s2;
  })(!(r2 || t2), !!r2, /* @__PURE__ */ new Map(), n2)(e2), n2;
}, k = "function" == typeof structuredClone ? (e2, r2) => r2 && ("json" in r2 || "lossy" in r2) ? u(m(e2, r2)) : structuredClone(e2) : (e2, r2) => u(m(e2, r2)), g = ["area", "base", "basefont", "bgsound", "br", "col", "command", "embed", "frame", "hr", "image", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"], y = z("end"), T = z("start");
function z(e2) {
  return function(r2) {
    const t2 = r2 && r2.position && r2.position[e2] || {};
    if ("number" == typeof t2.line && t2.line > 0 && "number" == typeof t2.column && t2.column > 0)
      return { line: t2.line, column: t2.column, offset: "number" == typeof t2.offset && t2.offset > -1 ? t2.offset : void 0 };
  };
}
function b(e2) {
  const r2 = T(e2), t2 = y(e2);
  if (r2 && t2)
    return { start: r2, end: t2 };
}
const w = function(e2) {
  if (null == e2)
    return C;
  if ("function" == typeof e2)
    return v(e2);
  if ("object" == typeof e2)
    return Array.isArray(e2) ? function(e3) {
      const r2 = [];
      let t2 = -1;
      for (; ++t2 < e3.length; )
        r2[t2] = w(e3[t2]);
      return v(n2);
      function n2(...e4) {
        let t3 = -1;
        for (; ++t3 < r2.length; )
          if (r2[t3].apply(this, e4))
            return true;
        return false;
      }
    }(e2) : function(e3) {
      const r2 = e3;
      return v(t2);
      function t2(t3) {
        const n2 = t3;
        let o2;
        for (o2 in e3)
          if (n2[o2] !== r2[o2])
            return false;
        return true;
      }
    }(e2);
  if ("string" == typeof e2)
    return function(e3) {
      return v(r2);
      function r2(r3) {
        return r3 && r3.type === e3;
      }
    }(e2);
  throw new Error("Expected function, string, or object as test");
};
function v(e2) {
  return function(r2, t2, n2) {
    return Boolean(function(e3) {
      return null !== e3 && "object" == typeof e3 && "type" in e3;
    }(r2) && e2.call(this, r2, "number" == typeof t2 ? t2 : void 0, n2 || void 0));
  };
}
function C() {
  return true;
}
const A = [], x = true, E = false, S = "skip";
function N(e2, r2, t2, n2) {
  let o2;
  "function" == typeof r2 && "function" != typeof t2 ? (n2 = t2, t2 = r2) : o2 = r2;
  const s2 = w(o2), i2 = n2 ? -1 : 1;
  !function e3(o3, a2, c2) {
    const u2 = o3 && "object" == typeof o3 ? o3 : {};
    if ("string" == typeof u2.type) {
      const e4 = "string" == typeof u2.tagName ? u2.tagName : "string" == typeof u2.name ? u2.name : void 0;
      Object.defineProperty(p2, "name", { value: "node (" + o3.type + (e4 ? "<" + e4 + ">" : "") + ")" });
    }
    return p2;
    function p2() {
      let u3, p3, f2, l2 = A;
      if ((!r2 || s2(o3, a2, c2[c2.length - 1] || void 0)) && (l2 = function(e4) {
        if (Array.isArray(e4))
          return e4;
        if ("number" == typeof e4)
          return [x, e4];
        return null == e4 ? A : [e4];
      }(t2(o3, c2)), l2[0] === E))
        return l2;
      if ("children" in o3 && o3.children) {
        const r3 = o3;
        if (r3.children && l2[0] !== S)
          for (p3 = (n2 ? r3.children.length : -1) + i2, f2 = c2.concat(r3); p3 > -1 && p3 < r3.children.length; ) {
            const t3 = r3.children[p3];
            if (u3 = e3(t3, p3, f2)(), u3[0] === E)
              return u3;
            p3 = "number" == typeof u3[1] ? u3[1] : p3 + i2;
          }
      }
      return l2;
    }
  }(e2, void 0, [])();
}
function I(e2, r2, t2, n2) {
  let o2, s2, i2;
  "function" == typeof r2 && "function" != typeof t2 ? (s2 = void 0, i2 = r2, o2 = t2) : (s2 = r2, i2 = t2, o2 = n2), N(e2, s2, function(e3, r3) {
    const t3 = r3[r3.length - 1], n3 = t3 ? t3.children.indexOf(e3) : void 0;
    return i2(e3, n3, t3);
  }, o2);
}
const O = /<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi, L = /* @__PURE__ */ new Set(["mdxFlowExpression", "mdxJsxFlowElement", "mdxJsxTextElement", "mdxTextExpression", "mdxjsEsm"]), j = { sourceCodeLocationInfo: true, scriptingEnabled: false };
function D(t2, o2) {
  const s2 = function(e2) {
    const r2 = "root" === e2.type ? e2.children[0] : e2;
    return Boolean(r2 && ("doctype" === r2.type || "element" === r2.type && "html" === r2.tagName.toLowerCase()));
  }(t2), i2 = n("type", { handlers: { root: R, element: P, text: B, comment: X, doctype: M, raw: J }, unknown: G }), a2 = { parser: s2 ? new e(j) : e.getFragmentParser(void 0, j), handle(e2) {
    i2(e2, a2);
  }, stitches: false, options: o2 || {} };
  i2(t2, a2), W(a2, T());
  const c2 = s2 ? a2.parser.document : a2.parser.getFragment(), u2 = r(c2, { file: a2.options.file });
  return a2.stitches && I(u2, "comment", function(e2, r2, t3) {
    const n2 = e2;
    if (n2.value.stitch && t3 && void 0 !== r2) {
      return t3.children[r2] = n2.value.stitch, r2;
    }
  }), "root" === u2.type && 1 === u2.children.length && u2.children[0].type === t2.type ? u2.children[0] : u2;
}
function _(e2, r2) {
  let t2 = -1;
  if (e2)
    for (; ++t2 < e2.length; )
      r2.handle(e2[t2]);
}
function R(e2, r2) {
  _(e2.children, r2);
}
function P(e2, r2) {
  !function(e3, r3) {
    const n2 = e3.tagName.toLowerCase();
    if (r3.parser.tokenizer.state === t.PLAINTEXT)
      return;
    W(r3, T(e3));
    const c2 = r3.parser.openElements.current;
    let u2 = "namespaceURI" in c2 ? c2.namespaceURI : a.html;
    u2 === a.html && "svg" === n2 && (u2 = a.svg);
    const p2 = s({ ...e3, children: [] }, { space: u2 === a.svg ? "svg" : "html" }), f2 = { type: o.START_TAG, tagName: n2, tagID: i(n2), selfClosing: false, ackSelfClosing: false, attrs: "attrs" in p2 ? p2.attrs : [], location: U(e3) };
    r3.parser.currentToken = f2, r3.parser._processToken(r3.parser.currentToken), r3.parser.tokenizer.lastStartTagName = n2;
  }(e2, r2), _(e2.children, r2), function(e3, r3) {
    const n2 = e3.tagName.toLowerCase();
    if (!r3.parser.tokenizer.inForeignNode && g.includes(n2))
      return;
    if (r3.parser.tokenizer.state === t.PLAINTEXT)
      return;
    W(r3, y(e3));
    const s2 = { type: o.END_TAG, tagName: n2, tagID: i(n2), selfClosing: false, ackSelfClosing: false, attrs: [], location: U(e3) };
    r3.parser.currentToken = s2, r3.parser._processToken(r3.parser.currentToken), n2 !== r3.parser.tokenizer.lastStartTagName || r3.parser.tokenizer.state !== t.RCDATA && r3.parser.tokenizer.state !== t.RAWTEXT && r3.parser.tokenizer.state !== t.SCRIPT_DATA || (r3.parser.tokenizer.state = t.DATA);
  }(e2, r2);
}
function B(e2, r2) {
  r2.parser.tokenizer.state > 4 && (r2.parser.tokenizer.state = 0);
  const t2 = { type: o.CHARACTER, chars: e2.value, location: U(e2) };
  W(r2, T(e2)), r2.parser.currentToken = t2, r2.parser._processToken(r2.parser.currentToken);
}
function M(e2, r2) {
  const t2 = { type: o.DOCTYPE, name: "html", forceQuirks: false, publicId: "", systemId: "", location: U(e2) };
  W(r2, T(e2)), r2.parser.currentToken = t2, r2.parser._processToken(r2.parser.currentToken);
}
function F(e2, r2) {
  r2.stitches = true;
  const t2 = function(e3) {
    return k("children" in e3 ? { ...e3, children: [] } : e3);
  }(e2);
  if ("children" in e2 && "children" in t2) {
    const n2 = D({ type: "root", children: e2.children }, r2.options);
    t2.children = n2.children;
  }
  X({ type: "comment", value: { stitch: t2 } }, r2);
}
function X(e2, r2) {
  const t2 = e2.value, n2 = { type: o.COMMENT, data: t2, location: U(e2) };
  W(r2, T(e2)), r2.parser.currentToken = n2, r2.parser._processToken(r2.parser.currentToken);
}
function J(e2, r2) {
  if (r2.parser.tokenizer.preprocessor.html = "", r2.parser.tokenizer.preprocessor.pos = -1, r2.parser.tokenizer.preprocessor.lastGapPos = -2, r2.parser.tokenizer.preprocessor.gapStack = [], r2.parser.tokenizer.preprocessor.skipNextNewLine = false, r2.parser.tokenizer.preprocessor.lastChunkWritten = false, r2.parser.tokenizer.preprocessor.endOfChunkHit = false, r2.parser.tokenizer.preprocessor.isEol = false, H(r2, T(e2)), r2.parser.tokenizer.write(r2.options.tagfilter ? e2.value.replace(O, "&lt;$1$2") : e2.value, false), r2.parser.tokenizer._runParsingLoop(), 72 === r2.parser.tokenizer.state || 78 === r2.parser.tokenizer.state) {
    r2.parser.tokenizer.preprocessor.lastChunkWritten = true;
    const e3 = r2.parser.tokenizer._consume();
    r2.parser.tokenizer._callState(e3);
  }
}
function G(e2, r2) {
  const t2 = e2;
  if (!r2.options.passThrough || !r2.options.passThrough.includes(t2.type)) {
    let e3 = "";
    throw L.has(t2.type) && (e3 = ". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"), new Error("Cannot compile `" + t2.type + "` node" + e3);
  }
  F(t2, r2);
}
function W(e2, r2) {
  H(e2, r2);
  const n2 = e2.parser.tokenizer.currentCharacterToken;
  n2 && n2.location && (n2.location.endLine = e2.parser.tokenizer.preprocessor.line, n2.location.endCol = e2.parser.tokenizer.preprocessor.col + 1, n2.location.endOffset = e2.parser.tokenizer.preprocessor.offset + 1, e2.parser.currentToken = n2, e2.parser._processToken(e2.parser.currentToken)), e2.parser.tokenizer.paused = false, e2.parser.tokenizer.inLoop = false, e2.parser.tokenizer.active = false, e2.parser.tokenizer.returnState = t.DATA, e2.parser.tokenizer.charRefCode = -1, e2.parser.tokenizer.consumedAfterSnapshot = -1, e2.parser.tokenizer.currentLocation = null, e2.parser.tokenizer.currentCharacterToken = null, e2.parser.tokenizer.currentToken = null, e2.parser.tokenizer.currentAttr = { name: "", value: "" };
}
function H(e2, r2) {
  if (r2 && void 0 !== r2.offset) {
    const t2 = { startLine: r2.line, startCol: r2.column, startOffset: r2.offset, endLine: -1, endCol: -1, endOffset: -1 };
    e2.parser.tokenizer.preprocessor.lineStartPos = 1 - r2.column, e2.parser.tokenizer.preprocessor.droppedBufferSize = r2.offset, e2.parser.tokenizer.preprocessor.line = r2.line, e2.parser.tokenizer.currentLocation = t2;
  }
}
function U(e2) {
  const r2 = T(e2) || { line: void 0, column: void 0, offset: void 0 }, t2 = y(e2) || { line: void 0, column: void 0, offset: void 0 };
  return { startLine: r2.line, startCol: r2.column, startOffset: r2.offset, endLine: t2.line, endCol: t2.column, endOffset: t2.offset };
}
function $(e2) {
  return function(r2, t2) {
    return D(r2, { ...e2, file: t2 });
  };
}
export {
  E,
  I as a,
  T as b,
  w as c,
  y as d,
  b as p,
  $ as r,
  k as s,
  N as v
};
