import { jsx as _jsx } from "react/jsx-runtime";
import { COMMON_REFS, modelName } from '../utils.js';
import { X } from './_X.js';
import { useUid } from './_context.js';
export const RefLink = ({ $ref }) => {
    const uid = useUid();
    if (!$ref) {
        return null;
    }
    const ref = $ref.replace('/components/schemas/', '');
    const plainRef = ref.slice(1);
    const refName = modelName(plainRef);
    return (_jsx(X.a, { href: COMMON_REFS[plainRef] || (uid ? `#${uid}-${plainRef}` : ref), children: refName }));
};
