import { createElement, Fragment } from "react";
import { Component, useEntity } from "@contember/binding";
import { LayoutPage, Message } from "@contember/ui";
const NotFoundWrapper = Component(({ children, title }) => {
  const accessor = useEntity();
  const node = accessor.environment.getSubTree();
  if (node.expectedCardinality === "one" && !accessor.existsOnServer) {
    return /* @__PURE__ */ createElement(LayoutPage, {
      title
    }, /* @__PURE__ */ createElement(Message, {
      intent: "danger"
    }, "Requested entity of type ", accessor.name, " was not found"));
  }
  return /* @__PURE__ */ createElement(Fragment, null, children);
}, ({ children }) => /* @__PURE__ */ createElement(Fragment, null, children));
export { NotFoundWrapper };
//# sourceMappingURL=NotFoundWrapper.js.map
