"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const Slate = require("slate");
const UnorderedListElement = require("./UnorderedListElement.cjs");
const OrderedListElement = require("./OrderedListElement.cjs");
const index = require("../../../ContemberEditor/index.cjs");
const ListItemElement = require("./ListItemElement.cjs");
const isListElement = (element, suchThat) => OrderedListElement.isOrderedListElement(element, suchThat) || UnorderedListElement.isUnorderedListElement(element, suchThat);
const getParentListElement = (editor) => {
  const closestNonDefaultEntry = index.ContemberEditor.closest(editor, {
    match: (node) => Slate.Editor.isBlock(editor, node) && !editor.isDefaultElement(node)
  });
  if (!closestNonDefaultEntry) {
    return void 0;
  }
  const [closestNonDefaultElement, closestNonDefaultPath] = closestNonDefaultEntry;
  if (ListItemElement.isListItemElement(closestNonDefaultElement)) {
    return Slate.Editor.node(editor, Slate.Path.parent(closestNonDefaultPath))[0];
  } else if (isListElement(closestNonDefaultElement)) {
    return closestNonDefaultElement;
  }
  return void 0;
};
exports.getParentListElement = getParentListElement;
exports.isListElement = isListElement;
//# sourceMappingURL=ListElement.cjs.map
