"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const lodash_1 = tslib_1.__importDefault(require("lodash"));
exports.NEVER = new Promise(() => { });
function groupWorkspaceProjectConfigs({ projects, }) {
    let configs = lodash_1.default.union(...projects.map(project => (project.ssh && project.ssh.configs) || []));
    let nonForwardingConfigs = [];
    let forwards = [];
    for (let config of configs) {
        let groups = /^(LocalForward|RemoteForward)\s+((?:[^:]+:)?\d+)\s+([^:]+:\d+)\s*(?:$|#)/.exec(config);
        if (groups) {
            let [, type, source, target] = groups;
            forwards.push({
                type: type,
                source,
                target,
                flag: type[0],
                value: `${source}:${target}`,
            });
        }
        else {
            nonForwardingConfigs.push(config);
        }
    }
    return {
        configs: nonForwardingConfigs,
        forwards,
    };
}
exports.groupWorkspaceProjectConfigs = groupWorkspaceProjectConfigs;
//# sourceMappingURL=utils.js.map