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