import { createElement } from "react";
import { AccessorProvider } from "@contember/binding";
import { useReferencedEntity } from "./useReferencedEntity.js";
import { useSlateStatic, ReactEditor } from "slate-react";
const ReferenceElementWrapper = ({ children, element }) => {
  const editor = useSlateStatic();
  const path = ReactEditor.findPath(editor, element);
  const ref = useReferencedEntity(path, element.referenceId);
  return /* @__PURE__ */ createElement(AccessorProvider, {
    accessor: ref
  }, children);
};
export { ReferenceElementWrapper };
//# sourceMappingURL=ReferenceElementWrapper.js.map
