"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var getSelectedListItems_exports = {};
__export(getSelectedListItems_exports, {
  getSelectedListItems: () => getSelectedListItems
});
module.exports = __toCommonJS(getSelectedListItems_exports);
var import_slate = require("slate");
var import_controls = require("@makeswift/controls");
var import_editor = require("../../utils/editor");
var import_location = require("./location");
function getSelectedListItems(editor) {
  if (!editor.selection)
    return [];
  const start = import_location.LocationUtils.getStartPath(editor.selection);
  const listItems = import_slate.Editor.nodes(editor, {
    at: editor.selection,
    match: import_controls.Slate.isListItem
  });
  const firstAncestorPath = import_editor.EditorUtils.getFirstAncestorListItem(editor, start)?.[1] ?? [];
  return Array.from(listItems).filter(
    (node) => import_slate.Path.isDescendant(start, node[1]) ? import_slate.Path.equals(node[1], firstAncestorPath) : !import_slate.Path.isAfter(start, node[1])
  );
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  getSelectedListItems
});
//# sourceMappingURL=getSelectedListItems.js.map