"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.zipWith = void 0;
exports.zipWith_ = zipWith_;

var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Fiber/operations/id"));

var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/FiberId/operations/getOrElse"));

var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/done"));

var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Fiber/operations/await"));

var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/flatMap"));

var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/zipWithPar"));

var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/exit"));

var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Fiber/operations/children"));

var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Fiber/operations/inheritRefs"));

var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/zipRight"));

var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Fiber/operations/interruptAs"));

var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Cause/definition"));

var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Exit/operations/zipWith"));

var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Effect/operations/zipWith"));

var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Fiber/operations/poll"));

var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@tsplus/stdlib/data/Maybe/map"));

var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@tsplus/stdlib/data/Maybe/flatMap"));

var _definition2 = /*#__PURE__*/require("@effect/core/io/Fiber/definition");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

const fileName_1 = "(@effect/core) _src/io/Fiber/operations/zipWith.ts";

/**
 * Zips this fiber with the specified fiber, combining their results using the
 * specified combiner function. Both joins and interruptions are performed in
 * sequential order from left to right.
 *
 * @tsplus fluent ets/Fiber zipWith
 * @tsplus fluent ets/RuntimeFiber zipWith
 */
function zipWith_(self, that, f) {
  return (0, _definition2.makeSynthetic)({
    id: tsplus_module_2.getOrElse_(tsplus_module_1.id(self), () => tsplus_module_1.id(that)),
    await: tsplus_module_7.exit(tsplus_module_6.zipWithPar_(tsplus_module_5.flatMap_(tsplus_module_4._await(self, fileName_1 + ":19:13"), exit => tsplus_module_3.done(() => exit, fileName_1 + ":20:37"), fileName_1 + ":20:15"), () => tsplus_module_5.flatMap_(tsplus_module_4._await(that, fileName_1 + ":22:19"), exit => tsplus_module_3.done(() => exit, fileName_1 + ":22:51"), fileName_1 + ":22:29"), f, fileName_1 + ":21:18"), fileName_1 + ":25:12"),
    children: tsplus_module_8.children(self, fileName_1 + ":26:28"),
    inheritRefs: tsplus_module_10.zipRight_(tsplus_module_9.inheritRefs(that, fileName_1 + ":27:34"), () => tsplus_module_9.inheritRefs(self, fileName_1 + ":27:55"), fileName_1 + ":27:38"),
    interruptAs: id => tsplus_module_14.zipWith_(tsplus_module_11.interruptAsNow_(self, id, fileName_1 + ":30:21"), () => tsplus_module_11.interruptAsNow_(that, id, fileName_1 + ":31:34"), (ea, eb) => tsplus_module_13.zipWith_(ea, eb, f, tsplus_module_12.combinePar), fileName_1 + ":31:17"),
    poll: tsplus_module_14.zipWith_(tsplus_module_15.poll(self, fileName_1 + ":33:12"), () => tsplus_module_15.poll(that, fileName_1 + ":34:25"), (oa, ob) => tsplus_module_17.flatMap_(oa, ea => tsplus_module_16.map_(ob, eb => tsplus_module_13.zipWith_(ea, eb, f, tsplus_module_12.combinePar))), fileName_1 + ":34:15")
  });
}
/**
 * Zips this fiber with the specified fiber, combining their results using the
 * specified combiner function. Both joins and interruptions are performed in
 * sequential order from left to right.
 *
 * @tsplus static ets/Fiber/Aspects zipWith
 */


const zipWith = (that, f) => self => zipWith_(self, that, f);

exports.zipWith = zipWith;
//# sourceMappingURL=zipWith.js.map