"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", { value: true });
exports.MultiModeTunnelClient = void 0;
const dev_tunnels_contracts_1 = require("@microsoft/dev-tunnels-contracts");
const tunnelConnectionBase_1 = require("./tunnelConnectionBase");
/**
 * Tunnel client implementation that selects one of multiple available connection modes.
 */
class MultiModeTunnelClient extends tunnelConnectionBase_1.TunnelConnectionBase {
    constructor() {
        super(dev_tunnels_contracts_1.TunnelAccessScopes.Connect);
        this.clients = [];
        this.connectionModes = this.clients
            ? [...new Set(...this.clients.map((c) => c.connectionModes))]
            : [];
    }
    /**
     * A value indicating whether local connections for forwarded ports are accepted.
     * Local connections are not accepted if the host process is not NodeJS (e.g. browser).
     */
    get acceptLocalConnectionsForForwardedPorts() {
        return !!this.clients.find((c) => c.acceptLocalConnectionsForForwardedPorts);
    }
    set acceptLocalConnectionsForForwardedPorts(value) {
        this.clients.forEach((c) => (c.acceptLocalConnectionsForForwardedPorts = value));
    }
    get localForwardingHostAddress() {
        var _a;
        return (_a = this.clients[0]) === null || _a === void 0 ? void 0 : _a.localForwardingHostAddress;
    }
    set localForwardingHostAddress(value) {
        this.clients.forEach((c) => (c.localForwardingHostAddress = value));
    }
    connect(tunnel, options, cancellation) {
        if (!tunnel) {
            throw new Error('Tunnel cannot be null');
        }
        return new Promise((resolve) => { });
    }
    get portForwarding() {
        throw new Error('Not supported.');
    }
    connectToForwardedPort(fowardedPort, cancellation) {
        throw new Error('Method not implemented.');
    }
    waitForForwardedPort(forwardedPort, cancellation) {
        throw new Error('Method not implemented.');
    }
    async refreshPorts() {
        throw new Error('Method not implemented.');
    }
    async dispose() {
        await super.dispose();
        await Promise.all(this.clients.map((client) => client.dispose()));
    }
}
exports.MultiModeTunnelClient = MultiModeTunnelClient;
//# sourceMappingURL=https://github.com/VSCodium/sourcemaps/releases/download/stable-4c0b0c6cc561d2d3636d1ec250935431876ce4dc/node_modules-@microsoft-dev-tunnels-connections-multiModeTunnelClient.js.map