import { useCallback } from "react";
import { useBindingLinkParametersResolver } from "./useBindingLinkParametersResolver.js";
import { useRoutingLinkFactory } from "../useRoutingLink.js";
import { parseLinkTarget } from "./LinkLanguage.js";
import { useEnvironment } from "@contember/binding";
const useRedirect = () => {
  const parametersResolver = useBindingLinkParametersResolver();
  const linkFactory = useRoutingLinkFactory();
  const env = useEnvironment();
  return useCallback((target, parameters) => {
    const parsedTarget = parseLinkTarget(target, env);
    linkFactory(parsedTarget, parameters, parametersResolver).navigate();
  }, [env, linkFactory, parametersResolver]);
};
export { useRedirect };
//# sourceMappingURL=useRedirect.js.map
