"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const ui = require("@contember/ui");
const reactBinding = require("@contember/react-binding");
const reactRouting = require("@contember/react-routing");
const NavigationProvider = (props) => {
  const env = reactBinding.useEnvironment();
  const linkFactory = reactRouting.useRoutingLinkFactory();
  return /* @__PURE__ */ jsxRuntime.jsx(
    ui.NavigationContext.Provider,
    {
      value: (val) => {
        if (!reactRouting.isRoutingLinkTarget(val)) {
          throw new reactRouting.PageNotFound("Invalid request");
        }
        return linkFactory(reactRouting.parseLinkTarget(val, env));
      },
      children: props.children
    }
  );
};
exports.NavigationProvider = NavigationProvider;
//# sourceMappingURL=NavigationProvider.cjs.map
