"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.tagged = exports.succeed = exports.of = exports.makeEntry = exports.makeCache = exports.isRequest = exports.isEntry = exports.interruptWhenPossible = exports.fail = exports.completeEffect = exports.complete = exports.RequestTypeId = exports.EntryTypeId = void 0;
var _RequestBlock = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/blockedRequests"));
var cache = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/cache"));
var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/core"));
var fiberRuntime = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/fiberRuntime"));
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/internal_effect_untraced/request"));
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; }
/**
 * @since 1.0.0
 * @category symbols
 */
const RequestTypeId = internal.RequestTypeId;
/**
 * Returns `true` if the specified value is a `Request`, `false` otherwise.
 *
 * @since 1.0.0
 * @category refinements
 */
exports.RequestTypeId = RequestTypeId;
const isRequest = internal.isRequest;
/**
 * Constructs a new `Request`.
 *
 * @since 1.0.0
 * @category constructors
 */
exports.isRequest = isRequest;
const of = internal.of;
/**
 * Constructs a new `Request`.
 *
 * @since 1.0.0
 * @category constructors
 */
exports.of = of;
const tagged = internal.tagged;
/**
 * Complete a `Request` with the specified result.
 *
 * @since 1.0.0
 * @category request completion
 */
exports.tagged = tagged;
const complete = internal.complete;
/**
 * Interrupts the child effect when requests are no longer needed
 *
 * @since 1.0.0
 * @category request completion
 */
exports.complete = complete;
const interruptWhenPossible = fiberRuntime.interruptWhenPossible;
/**
 * Complete a `Request` with the specified effectful computation, failing the
 * request with the error from the effect workflow if it fails, and completing
 * the request with the value of the effect workflow if it succeeds.
 *
 * @since 1.0.0
 * @category request completion
 */
exports.interruptWhenPossible = interruptWhenPossible;
const completeEffect = internal.completeEffect;
/**
 * Complete a `Request` with the specified error.
 *
 * @since 1.0.0
 * @category request completion
 */
exports.completeEffect = completeEffect;
const fail = internal.fail;
/**
 * Complete a `Request` with the specified value.
 *
 * @since 1.0.0
 * @category request completion
 */
exports.fail = fail;
const succeed = internal.succeed;
/**
 * @since 1.0.0
 * @category models
 */
exports.succeed = succeed;
const makeCache = (capacity, timeToLive) => cache.make(capacity, timeToLive, () => core.map(core.deferredMake(), handle => ({
  listeners: new internal.Listeners(),
  handle
})));
/**
 * @since 1.0.0
 * @category symbols
 */
exports.makeCache = makeCache;
const EntryTypeId = /*#__PURE__*/Symbol.for("@effect/io/RequestBlock.Entry");
/**
 * @since 1.0.0
 * @category guards
 */
exports.EntryTypeId = EntryTypeId;
const isEntry = _RequestBlock.isEntry;
/**
 * @since 1.0.0
 * @category constructors
 */
exports.isEntry = isEntry;
const makeEntry = _RequestBlock.makeEntry;
exports.makeEntry = makeEntry;
//# sourceMappingURL=Request.js.map