import { jsxDEV } from "react/jsx-dev-runtime";
import { NavigationContext } from "@contember/ui";
import { useEnvironment } from "@contember/react-binding";
import { useRoutingLinkFactory, isRoutingLinkTarget, PageNotFound, parseLinkTarget } from "@contember/react-routing";
const NavigationProvider = (props) => {
  const env = useEnvironment();
  const linkFactory = useRoutingLinkFactory();
  return /* @__PURE__ */ jsxDEV(
    NavigationContext.Provider,
    {
      value: (val) => {
        if (!isRoutingLinkTarget(val)) {
          throw new PageNotFound("Invalid request");
        }
        return linkFactory(parseLinkTarget(val, env));
      },
      children: props.children
    },
    void 0,
    false,
    {
      fileName: "/__w/interface/interface/packages/admin/src/components/NavigationProvider/NavigationProvider.tsx",
      lineNumber: 15,
      columnNumber: 3
    },
    void 0
  );
};
export {
  NavigationProvider
};
//# sourceMappingURL=NavigationProvider.js.map
