import { __require as x } from "./index-LexicalComposerContext2.js";
import b from "react";
var a, s;
function w() {
  if (s) return a;
  s = 1;
  var l = x(), t = b, f = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? t.useLayoutEffect : t.useEffect;
  function d(e) {
    const [r] = l.useLexicalComposerContext(), u = t.useMemo(() => e(r), [r, e]), i = t.useRef(u.initialValueFn()), [L, o] = t.useState(i.current);
    return f(() => {
      const {
        initialValueFn: _,
        subscribe: p
      } = u, n = _();
      return i.current !== n && (i.current = n, o(n)), p((c) => {
        i.current = c, o(c);
      });
    }, [u, e]), L;
  }
  function E(e) {
    return {
      initialValueFn: () => e.isEditable(),
      subscribe: (r) => e.registerEditableListener(r)
    };
  }
  function m() {
    return d(E);
  }
  return a = m, a;
}
export {
  w as __require
};
