import { __exports as t } from "./index-LexicalOnChangePlugin.prod2.js";
import { __require as c } from "./index-LexicalComposerContext2.js";
import m from "react";
var u;
function x() {
  if (u) return t;
  u = 1;
  var s = c(), n = m, d = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? n.useLayoutEffect : n.useEffect;
  return t.OnChangePlugin = function({ ignoreHistoryMergeTagChange: i = !0, ignoreSelectionChange: o = !1, onChange: e }) {
    let [r] = s.useLexicalComposerContext();
    return d(() => {
      if (e) return r.registerUpdateListener(({ editorState: g, dirtyElements: f, dirtyLeaves: l, prevEditorState: p, tags: a }) => {
        o && f.size === 0 && l.size === 0 || i && a.has("history-merge") || p.isEmpty() || e(g, r, a);
      });
    }, [r, i, o, e]), null;
  }, t;
}
export {
  x as __require
};
