"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxDevRuntime = require("react/jsx-dev-runtime");
const ui = require("@contember/ui");
const reactBinding = require("@contember/react-binding");
const useRoutingLink = require("../../routing/useRoutingLink.cjs");
const urlMapper = require("../../routing/urlMapper.cjs");
const LinkLanguage = require("../../routing/binding/LinkLanguage.cjs");
const NavigationProvider = (props) => {
  const env = reactBinding.useEnvironment();
  const linkFactory = useRoutingLink.useRoutingLinkFactory();
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
    ui.NavigationContext.Provider,
    {
      value: (val) => {
        if (!useRoutingLink.isRoutingLinkTarget(val)) {
          throw new urlMapper.PageNotFound("Invalid request");
        }
        return linkFactory(LinkLanguage.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
  );
};
exports.NavigationProvider = NavigationProvider;
//# sourceMappingURL=NavigationProvider.cjs.map
