import { memo, createElement } from "react";
import { DataBindingProvider, EntitySubTree } from "@contember/binding";
import { useOnPersistSuccess } from "../useOnPersistSuccess.js";
import { getPageName } from "./getPageName.js";
import { FeedbackRenderer } from "../../bindingFacade/renderers/FeedbackRenderer.js";
import { LayoutRenderer } from "../../bindingFacade/renderers/LayoutRenderer.js";
import { PersistButton } from "../../bindingFacade/buttons/PersistButton.js";
const CreatePage = memo(({ pageName, children, rendererProps, redirectOnSuccess, onPersistSuccess, ...entityProps }) => {
  return /* @__PURE__ */ createElement(DataBindingProvider, {
    stateComponent: FeedbackRenderer
  }, /* @__PURE__ */ createElement(EntitySubTree, {
    ...entityProps,
    onPersistSuccess: useOnPersistSuccess({ redirectOnSuccess, onPersistSuccess }),
    isCreating: true
  }, /* @__PURE__ */ createElement(LayoutRenderer, {
    ...rendererProps,
    actions: rendererProps?.actions ?? /* @__PURE__ */ createElement(PersistButton, null)
  }, children)));
});
CreatePage.displayName = "CreatePage";
CreatePage.getPageName = getPageName;
export { CreatePage };
//# sourceMappingURL=CreatePage.js.map
