"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.defaultRuntimeConfig = exports.defaultRuntime = void 0;
exports.runtime = runtime;
exports.unsafeRunWith = exports.unsafeRunPromiseExit = exports.unsafeRunPromise = exports.unsafeRunAsyncWith = exports.unsafeRunAsync = void 0;

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

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

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

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

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/Supervisor/operations/track"));

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

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

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

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

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

var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@tsplus/stdlib/collections/HashSet/make"));

var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/RuntimeConfig/Flags/operations/empty"));

var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/RuntimeConfig/Flag"));

var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/RuntimeConfig/Flags/operations/add"));

var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/RuntimeConfig/operations/make"));

var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@tsplus/stdlib/service/Env"));

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

/**
 * Returns an effect that accesses the runtime, which can be used to
 * (unsafely) execute tasks. This is useful for integration with legacy code
 * that must call back into Effect code.
 *
 * @tsplus static ets/Effect/Ops runtime
 */
function runtime(__tsplusTrace) {
  return tsplus_module_5.flatMap_(tsplus_module_4.environment(__tsplusTrace), env => tsplus_module_3.map_(tsplus_module_2.runtimeConfig, config => new tsplus_module_1.Runtime(env, config), __tsplusTrace), __tsplusTrace);
}
/**
 * @tsplus static ets/Effect/Ops defaultRuntimeConfig
 */


const defaultRuntimeConfig_1 = /*#__PURE__*/tsplus_module_16.make({
  fatal: () => false,
  reportFatal: defect => {
    throw defect;
  },
  supervisor: /*#__PURE__*/tsplus_module_6.unsafeTrack(),
  loggers: /*#__PURE__*/tsplus_module_12.make( /*#__PURE__*/tsplus_module_11.filterLogLevel_( /*#__PURE__*/tsplus_module_10.map_(tsplus_module_9.defaultLogger, output => console.log(output)), level => tsplus_module_8.geq_(level, tsplus_module_7.Info))),
  flags: /*#__PURE__*/tsplus_module_15.add_(tsplus_module_13.empty, tsplus_module_14.enableFiberRoots),
  maxOp: 2048
});
const defaultRuntimeConfig = defaultRuntimeConfig_1;
exports.defaultRuntimeConfig = defaultRuntimeConfig;
const defaultRuntime = /*#__PURE__*/new tsplus_module_1.Runtime(tsplus_module_17.Env.empty, defaultRuntimeConfig_1);
/**
 * @tsplus fluent ets/Effect unsafeRunPromise
 * @tsplus static ets/Effect/Aspects unsafeRunPromise
 */

exports.defaultRuntime = defaultRuntime;
const unsafeRunPromise = defaultRuntime.unsafeRunPromise;
/**
 * @tsplus fluent ets/Effect unsafeRunAsync
 * @tsplus static ets/Effect/Aspects unsafeRunAsync
 */

exports.unsafeRunPromise = unsafeRunPromise;
const unsafeRunAsync = defaultRuntime.unsafeRunAsync;
/**
 * @tsplus fluent ets/Effect unsafeRunAsyncWith
 * @tsplus static ets/Effect/Aspects unsafeRunAsyncWith
 */

exports.unsafeRunAsync = unsafeRunAsync;
const unsafeRunAsyncWith = defaultRuntime.unsafeRunAsyncWith;
/**
 * @tsplus fluent ets/Effect unsafeRunPromiseExit
 * @tsplus static ets/Effect/Aspects unsafeRunPromiseExit
 */

exports.unsafeRunAsyncWith = unsafeRunAsyncWith;
const unsafeRunPromiseExit = defaultRuntime.unsafeRunPromiseExit;
/**
 * @tsplus fluent ets/Effect unsafeRunWith
 * @tsplus static ets/Effect/Aspects unsafeRunWith
 */

exports.unsafeRunPromiseExit = unsafeRunPromiseExit;
const unsafeRunWith = defaultRuntime.unsafeRunWith;
exports.unsafeRunWith = unsafeRunWith;
//# sourceMappingURL=runtime.js.map