import { jsxDEV } from "react/jsx-dev-runtime";
import { isSpecialLinkClick } from "@contember/ui";
import { memo, useCallback } from "react";
import { useRoutingLink } from "./useRoutingLink.js";
const defaultComponent = ({ active, ...props }) => (
  // TODO do something with isActive?
  /* @__PURE__ */ jsxDEV("a", { ...props }, void 0, false, {
    fileName: "/__w/interface/interface/packages/admin/src/routing/RoutingLink.tsx",
    lineNumber: 17,
    columnNumber: 2
  }, globalThis)
);
const RoutingLink = memo(({ onClick, to, parametersResolver, parameters, Component, componentProps, target, ...props }) => {
  const { navigate, isActive: active, href } = useRoutingLink(to, parametersResolver, parameters);
  const innerOnClick = useCallback((e) => {
    if (e) {
      if (onClick) {
        onClick(e);
      }
      if (e.isDefaultPrevented() || isSpecialLinkClick(e.nativeEvent) || target) {
        return;
      }
    }
    navigate(e);
  }, [navigate, onClick, target]);
  const InnerComponent = Component ?? defaultComponent;
  return /* @__PURE__ */ jsxDEV(InnerComponent, { active, href, target, ...componentProps, ...props, onClick: innerOnClick }, void 0, false, {
    fileName: "/__w/interface/interface/packages/admin/src/routing/RoutingLink.tsx",
    lineNumber: 41,
    columnNumber: 9
  }, globalThis);
});
RoutingLink.displayName = "RoutingLink";
export {
  RoutingLink
};
//# sourceMappingURL=RoutingLink.js.map
