"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const react = require("react");
const useBindingLinkParametersResolver = require("./useBindingLinkParametersResolver.cjs");
const useRoutingLink = require("../useRoutingLink.cjs");
const LinkLanguage = require("./LinkLanguage.cjs");
const reactBinding = require("@contember/react-binding");
const useRedirect = () => {
  const parametersResolver = useBindingLinkParametersResolver.useBindingLinkParametersResolver();
  const linkFactory = useRoutingLink.useRoutingLinkFactory();
  const env = reactBinding.useEnvironment();
  return react.useCallback(
    (target, parameters) => {
      const parsedTarget = LinkLanguage.parseLinkTarget(target, env);
      linkFactory(parsedTarget, parameters, parametersResolver).navigate();
    },
    [env, linkFactory, parametersResolver]
  );
};
exports.useRedirect = useRedirect;
//# sourceMappingURL=useRedirect.cjs.map
