"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_runtime_1 = require("react/jsx-runtime");
var link_1 = __importDefault(require("next/link"));
var path_1 = require("path");
var A_1 = __importDefault(require("components/misc/A"));
function getAnchorTagComponent(_a) {
    var id = _a.id, relativePath = _a.relativePath;
    return function AnchorTagComponent(_a) {
        var href = _a.href, title = _a.title, children = _a.children;
        if (href === null || href === void 0 ? void 0 : href.includes("://")) {
            return ((0, jsx_runtime_1.jsx)(A_1.default, __assign({ href: href, title: title }, { children: children })));
        }
        else {
            return ((0, jsx_runtime_1.jsx)(link_1.default, __assign({ href: "/share/public_paths/".concat(id, "/").concat(href ? encodeURIComponent((0, path_1.join)(relativePath, href)) : "") }, { children: (0, jsx_runtime_1.jsx)("a", __assign({ title: title }, { children: children })) })));
        }
    };
}
exports.default = getAnchorTagComponent;
//# sourceMappingURL=anchor-tag-component.js.map