"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GoToRef = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const Provider_1 = require("../../containers/Provider");
const useComponents_1 = require("../../hooks/useComponents");
exports.GoToRef = ({ uri, className, children }) => {
    const components = useComponents_1.useComponents();
    const info = React.useContext(Provider_1.ActiveInfoContext);
    if (components.link) {
        const Link = components.link;
        return (React.createElement(Link, { index: 0, parent: null, path: [''], node: Object.assign(Object.assign({}, info), { node: uri, url: uri, className, type: 'link', children: [] }) }, children));
    }
    let query;
    if (info.branch) {
        query = `?branch=${info.branch}`;
    }
    return (React.createElement("a", { className: className, href: `${info.host}/api/v1/projects/${info.workspace}/${info.project}/nodes/${uri}${query}`, target: "_blank", rel: "noopener noreferrer" }, children));
};
//# sourceMappingURL=GoToRef.js.map