"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeEither = exports.mergeEither_ = exports.mergeTerminateRight = exports.mergeTerminateRight_ = exports.mergeTerminateLeft = exports.mergeTerminateLeft_ = exports.mergeTerminateEither = exports.mergeTerminateEither_ = exports.merge = exports.merge_ = void 0;
// ets_tracing: off
const E = __importStar(require("../../Either"));
const mergeWith_1 = require("./mergeWith");
/**
 * Merges this stream and the specified stream together.
 *
 * New produced stream will terminate when both specified stream terminate if no termination
 * strategy is specified.
 */
function merge_(self, that, strategy = "Both") {
    return (0, mergeWith_1.mergeWith_)(self, that, (a) => a, (b) => b, strategy);
}
exports.merge_ = merge_;
/**
 * Merges this stream and the specified stream together.
 *
 * New produced stream will terminate when both specified stream terminate if no termination
 * strategy is specified.
 *
 * @ets_data_first merge_
 */
function merge(that, strategy = "Both") {
    return (self) => merge_(self, that, strategy);
}
exports.merge = merge;
/**
 * Merges this stream and the specified stream together. New produced stream will
 * terminate when either stream terminates.
 */
function mergeTerminateEither_(self, that) {
    return merge_(self, that, "Either");
}
exports.mergeTerminateEither_ = mergeTerminateEither_;
/**
 * Merges this stream and the specified stream together. New produced stream will
 * terminate when either stream terminates.
 */
function mergeTerminateEither(that) {
    return (self) => merge_(self, that, "Either");
}
exports.mergeTerminateEither = mergeTerminateEither;
/**
 * Merges this stream and the specified stream together. New produced stream will
 * terminate when this stream terminates.
 */
function mergeTerminateLeft_(self, that) {
    return merge_(self, that, "Left");
}
exports.mergeTerminateLeft_ = mergeTerminateLeft_;
/**
 * Merges this stream and the specified stream together. New produced stream will
 * terminate when this stream terminates.
 */
function mergeTerminateLeft(that) {
    return (self) => merge_(self, that, "Left");
}
exports.mergeTerminateLeft = mergeTerminateLeft;
/**
 * Merges this stream and the specified stream together. New produced stream will
 * terminate when the specified stream terminates.
 */
function mergeTerminateRight_(self, that) {
    return merge_(self, that, "Right");
}
exports.mergeTerminateRight_ = mergeTerminateRight_;
/**
 * Merges this stream and the specified stream together. New produced stream will
 * terminate when the specified stream terminates.
 */
function mergeTerminateRight(that) {
    return (self) => merge_(self, that, "Right");
}
exports.mergeTerminateRight = mergeTerminateRight;
/**
 * Merges this stream and the specified stream together to produce a stream of
 * eithers.
 */
function mergeEither_(self, that, strategy = "Both") {
    return (0, mergeWith_1.mergeWith_)(self, that, (l) => E.left(l), E.right, strategy);
}
exports.mergeEither_ = mergeEither_;
/**
 * Merges this stream and the specified stream together to produce a stream of
 * eithers.
 *
 * @ets_data_first mergeEither_
 */
function mergeEither(that, strategy = "Both") {
    return (self) => mergeEither_(self, that, strategy);
}
exports.mergeEither = mergeEither;
//# sourceMappingURL=merge.js.map