import { NavigationContext } from "@contember/ui";
import { useEnvironment } from "@contember/binding";
import { jsxDEV } from "react/jsx-dev-runtime";
import { useRoutingLinkFactory, isRoutingLinkTarget } from "../../routing/useRoutingLink.js";
import { PageNotFound } from "../../routing/urlMapper.js";
import { parseLinkTarget } from "../../routing/binding/LinkLanguage.js";
var _jsxFileName = "/__w/interface/interface/packages/admin/src/components/NavigationProvider/NavigationProvider.tsx";
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: _jsxFileName,
    lineNumber: 15,
    columnNumber: 3
  }, void 0);
};
export {
  NavigationProvider
};
//# sourceMappingURL=NavigationProvider.js.map
