import { a as IconSize, n as AnalyticsId } from "./constants2.js";
import { t as usePseudoClasses } from "./usePseudoClasses.js";
import { t as getColor } from "./color.js";
import { t as AsChildSlot_default } from "./AsChildSlot.js";
import { t as Icon_default } from "./Icon.js";
import { t as ArrowUpRight_default } from "./ArrowUpRight.js";
import classNames from "classnames";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import AnchorLinkStyles from "./components/AnchorLink/styles.module.scss";
var AnchorLink = (props) => {
	const { asChild, id, href, children, className, target = "_self", htmlMarkup = "a", onClick, testId, ref } = props;
	const external = target === "_blank";
	const { refObject, isHovered } = usePseudoClasses(ref);
	const anchorClasses = classNames(AnchorLinkStyles.anchorlink, className);
	const commonProps = {
		id,
		["data-testid"]: testId,
		["data-analyticsid"]: AnalyticsId.AnchorLink,
		onClick
	};
	const renderContent = () => /* @__PURE__ */ jsxs(Fragment, { children: [children, external && /* @__PURE__ */ jsx(Icon_default, {
		className: AnchorLinkStyles.anchorlink__icon,
		svgIcon: ArrowUpRight_default,
		color: getColor("blueberry", 600),
		hoverColor: getColor("blueberry", 700),
		size: IconSize.XSmall,
		isHovered
	})] });
	if (asChild) return /* @__PURE__ */ jsx(AsChildSlot_default, {
		content: /* @__PURE__ */ jsx("span", { className: anchorClasses }),
		className: AnchorLinkStyles["anchorlink-wrapper"],
		elementRef: refObject,
		children
	});
	if (htmlMarkup === "a") return /* @__PURE__ */ jsx("a", {
		href,
		target,
		className: anchorClasses,
		rel: external ? "noopener noreferrer" : void 0,
		ref: refObject,
		...commonProps,
		children: renderContent()
	});
	return /* @__PURE__ */ jsx("button", {
		type: "button",
		className: AnchorLinkStyles["anchorlink-wrapper"],
		ref: refObject,
		...commonProps,
		children: /* @__PURE__ */ jsx("span", {
			className: anchorClasses,
			children: renderContent()
		})
	});
};
var AnchorLink_default$1 = AnchorLink;
export { AnchorLink_default$1 as t };

//# sourceMappingURL=AnchorLink.js.map