"use strict";

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

var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/stream/Channel/operations/interruptWhen"));

var _StreamInternal = /*#__PURE__*/require("@effect/core/stream/Stream/operations/_internal/StreamInternal");

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; }

/**
 * Interrupts the evaluation of this stream when the provided effect completes.
 * The given effect will be forked as part of this stream, and its success will
 * be discarded. This combinator will also interrupt any in-progress element
 * being pulled from upstream.
 *
 * If the effect completes with a failure before the stream completes, the
 * returned stream will emit that failure.
 *
 * @tsplus fluent ets/Stream interruptWhen
 */
function interruptWhen_(self, effect, __tsplusTrace) {
  void 0;
  return new _StreamInternal.StreamInternal(tsplus_module_1.interruptWhen_(self.channel, effect));
}
/**
 * Interrupts the evaluation of this stream when the provided effect completes.
 * The given effect will be forked as part of this stream, and its success will
 * be discarded. This combinator will also interrupt any in-progress element
 * being pulled from upstream.
 *
 * If the effect completes with a failure before the stream completes, the
 * returned stream will emit that failure.
 *
 * @tsplus static ets/Stream/Aspects interruptWhen
 */


const interruptWhen = (effect, __tsplusTrace) => self => interruptWhen_(self, effect, __tsplusTrace);

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