import { __exports as a } from "./index-LexicalTabIndentationPlugin.dev2.js";
import { __require as C } from "./index-LexicalComposerContext2.js";
import { __require as x } from "./index-LexicalUtils.js";
import { __require as E } from "./index-Lexical.js";
import p from "react";
var _;
function v() {
  if (_) return a;
  _ = 1;
  var m = C(), s = x(), e = E(), T = p;
  function N(t) {
    const o = t.getNodes();
    if (s.$filter(o, (n) => e.$isBlockElementNode(n) && n.canIndent() ? n : null).length > 0)
      return !0;
    const i = t.anchor, u = t.focus, f = u.isBefore(i) ? u : i, g = f.getNode(), d = s.$getNearestBlockElementAncestorOrThrow(g);
    if (d.canIndent()) {
      const n = d.getKey();
      let r = e.$createRangeSelection();
      if (r.anchor.set(n, 0, "element"), r.focus.set(n, 0, "element"), r = e.$normalizeSelection__EXPERIMENTAL(r), r.anchor.is(f))
        return !0;
    }
    return !1;
  }
  function l(t) {
    return t.registerCommand(e.KEY_TAB_COMMAND, (o) => {
      const c = e.$getSelection();
      if (!e.$isRangeSelection(c))
        return !1;
      o.preventDefault();
      const i = N(c) ? o.shiftKey ? e.OUTDENT_CONTENT_COMMAND : e.INDENT_CONTENT_COMMAND : e.INSERT_TAB_COMMAND;
      return t.dispatchCommand(i, void 0);
    }, e.COMMAND_PRIORITY_EDITOR);
  }
  function I() {
    const [t] = m.useLexicalComposerContext();
    return T.useEffect(() => l(t)), null;
  }
  return a.TabIndentationPlugin = I, a.registerTabIndentation = l, a;
}
export {
  v as __require
};
