"use strict";
exports.__esModule = true;
exports.Link = exports.cnLink = void 0;
var tslib_1 = require("tslib");
// @ts-nocheck
require("./Link.css");
var react_1 = (0, tslib_1.__importStar)(require("react"));
var react_merge_refs_1 = (0, tslib_1.__importDefault)(require("react-merge-refs"));
var bem_1 = require("../../utils/bem");
exports.cnLink = (0, bem_1.cn)('Link');
exports.Link = (0, react_1.forwardRef)(function (_a, ref) {
    var _b = _a.view, view = _b === void 0 ? 'primary' : _b, _c = _a.pseudo, pseudo = _c === void 0 ? false : _c, leftAddons = _a.leftAddons, rightAddons = _a.rightAddons, className = _a.className, dataTestId = _a.dataTestId, children = _a.children, _d = _a.colors, colors = _d === void 0 ? 'default' : _d, restProps = (0, tslib_1.__rest)(_a, ["view", "pseudo", "leftAddons", "rightAddons", "className", "dataTestId", "children", "colors"]);
    var linkRef = (0, react_1.useRef)(null);
    var componentProps = {
        className: (0, exports.cnLink)({ view: view }, [className]),
        rel: restProps.target === '_blank' ? 'noreferrer noopener' : undefined
    };
    return (react_1["default"].createElement("a", (0, tslib_1.__assign)({}, componentProps, restProps, { ref: (0, react_merge_refs_1["default"])([linkRef, ref]) }), leftAddons || rightAddons ? (react_1["default"].createElement(react_1["default"].Fragment, null,
        leftAddons && (react_1["default"].createElement("span", { className: (0, exports.cnLink)('LeftAddon') }, leftAddons)),
        children && (react_1["default"].createElement("span", null,
            react_1["default"].createElement("span", { className: (0, exports.cnLink)('Text') }, children))),
        rightAddons && (react_1["default"].createElement("span", { className: (0, exports.cnLink)('RightAddon') }, rightAddons)))) : (react_1["default"].createElement("span", { className: (0, exports.cnLink)('Text') }, children))));
});
