import { jsx } from "react/jsx-runtime";
import { Component, EntitySubTree } from "@contember/binding";
import { AutoFields } from "./AutoFields.js";
import { NotFoundWrapper } from "../pageRouting/pageComponents/NotFoundWrapper.js";
const AutoForm = Component(
  ({ entity, id, onCreateSuccess, createEditLink }) => {
    if (id === void 0) {
      return /* @__PURE__ */ jsx(EntitySubTree, { entity, isCreating: true, onPersistSuccess: onCreateSuccess, children: /* @__PURE__ */ jsx(AutoFields, { createEditLink }) });
    } else {
      return /* @__PURE__ */ jsx(EntitySubTree, { entity: { entityName: entity, where: { id } }, children: /* @__PURE__ */ jsx(NotFoundWrapper, { children: /* @__PURE__ */ jsx(AutoFields, { createEditLink }) }) });
    }
  }
);
export {
  AutoForm
};
//# sourceMappingURL=AutoForm.js.map
