//
// Copyright 2024 DXOS.org
//
import React from 'react';
import { ConnectionState } from '@dxos/network-manager';
import { Panel } from '../Panel';
export const NetworkPanel = ({ network, ...props }) => {
    const swarmCount = network?.connectionInfo?.length ?? 0;
    const connectionCount = network?.connectionInfo?.reduce((acc, info) => acc + (info.connections?.filter((conn) => conn.state === ConnectionState.CONNECTED).length ?? 0), 0) ?? 0;
    return (React.createElement(Panel, { ...props, icon: 'ph--wifi-high--regular', title: 'Network', info: React.createElement("div", { className: 'flex items-center gap-2' },
            React.createElement("span", { title: 'Active Connection(s)' },
                connectionCount,
                " Connection(s)"),
            React.createElement("span", { title: 'Active Swarm(s)' },
                swarmCount,
                " Swarm(s)")) }));
};
//# sourceMappingURL=NetworkPanel.js.map