import { convert as t } from "../../../../unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.es.js";
const f = (
  // Note: overloads like this are needed to support optional generics.
  /**
   * @type {(
   *   (<Kind extends UnistParent, Check extends Test>(parent: Kind, index: Child<Kind> | number, test: Check) => Matches<Child<Kind>, Check> | undefined) &
   *   (<Kind extends UnistParent>(parent: Kind, index: Child<Kind> | number, test?: null | undefined) => Child<Kind> | undefined)
   * )}
   */
  /**
   * @param {UnistParent} parent
   * @param {UnistNode | number} index
   * @param {Test} [test]
   * @returns {UnistNode | undefined}
   */
  (function(e, r, o) {
    const i = t(o);
    if (!e || !e.type || !e.children)
      throw new Error("Expected parent node");
    if (typeof r == "number") {
      if (r < 0 || r === Number.POSITIVE_INFINITY)
        throw new Error("Expected positive finite number as index");
    } else if (r = e.children.indexOf(r), r < 0)
      throw new Error("Expected child node or index");
    for (; ++r < e.children.length; )
      if (i(e.children[r], r, e))
        return e.children[r];
  })
);
export {
  f as findAfter
};
//# sourceMappingURL=index.es.js.map
