import { HTTP, HTTPS, QUIC, QUIC_V1, TCP, WebRTC, WebRTCDirect, WebSockets, WebSocketsSecure, WebTransport } from '@multiformats/multiaddr-matcher';
const ABBREVIATIONS = {
    // operations
    'ipfs.resolve': 'i',
    'dnsLink.resolve': 'd',
    'ipns.resolve': 'n',
    'found-provider': 'p',
    'find-providers': 'f',
    connect: 'c',
    block: 'b',
    // routers
    'http-gateway-router': 'h',
    'libp2p-router': 'l',
    // block brokers
    'trustless-gateway': 't',
    bitswap: 'b'
};
export function abbreviate(str) {
    return ABBREVIATIONS[str] ?? str;
}
export function abbreviateAddress(ma) {
    if (TCP.exactMatch(ma)) {
        return 't';
    }
    if (HTTP.exactMatch(ma) || HTTPS.exactMatch(ma)) {
        return 'h';
    }
    if (WebSockets.exactMatch(ma) || WebSocketsSecure.exactMatch(ma)) {
        return 'w';
    }
    if (WebRTC.exactMatch(ma)) {
        return 'r';
    }
    if (WebRTCDirect.exactMatch(ma)) {
        return 'd';
    }
    if (QUIC.exactMatch(ma) || QUIC_V1.exactMatch(ma)) {
        return 'q';
    }
    if (WebTransport.exactMatch(ma)) {
        return 'b';
    }
    return 'u';
}
//# sourceMappingURL=abbreviate.js.map