@lmvz-ds/components 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/cjs/assets-CJzJZPzV.js +26 -0
  2. package/dist/cjs/{assets-CB5ikzmP.js → icons-FIfJEo6G.js} +1251 -773
  3. package/dist/cjs/index.cjs.js +3 -3
  4. package/dist/cjs/lmvz-card.cjs.entry.js +3 -3
  5. package/dist/cjs/lmvz-icon.cjs.entry.js +3 -3
  6. package/dist/collection/components/lmvz-card/lmvz-card.js +3 -4
  7. package/dist/collection/components/lmvz-icon/icons.js +2 -2
  8. package/dist/collection/utils/assets.js +9 -6
  9. package/dist/collection/utils/http.js +2 -2
  10. package/dist/collection/utils/http.unit.js +1 -1
  11. package/dist/collection/utils/validation/svg.js +1 -1
  12. package/dist/components/index.js +1 -1
  13. package/dist/components/lmvz-card.js +1 -1
  14. package/dist/components/lmvz-header.js +1 -1
  15. package/dist/components/lmvz-icon.js +1 -1
  16. package/dist/components/p-BsS3QvWn.js +1 -0
  17. package/dist/components/p-CdYWDK7m.js +1 -0
  18. package/dist/esm/assets-BelZNJ1W.js +23 -0
  19. package/dist/esm/{assets-ozES4zSA.js → icons-CM7lsnuO.js} +1249 -708
  20. package/dist/esm/index.js +3 -2
  21. package/dist/esm/lmvz-card.entry.js +3 -3
  22. package/dist/esm/lmvz-icon.entry.js +2 -2
  23. package/dist/lmvz-components/index.esm.js +1 -1
  24. package/dist/lmvz-components/lmvz-components.esm.js +1 -1
  25. package/dist/lmvz-components/p-6e3314ab.entry.js +1 -0
  26. package/dist/lmvz-components/p-BoR31cjC.js +1 -0
  27. package/dist/lmvz-components/p-CVf2C8dL.js +1 -0
  28. package/dist/lmvz-components/p-d9dc29a1.entry.js +1 -0
  29. package/dist/manifest.json +1 -1
  30. package/dist/types/utils/assets.d.ts +1 -8
  31. package/dist/types/utils/http.d.ts +3 -3
  32. package/dist/types/utils/validation/svg.d.ts +2 -2
  33. package/hydrate/index.js +2131 -12411
  34. package/hydrate/index.mjs +2131 -12411
  35. package/package.json +4 -4
  36. package/dist/cjs/icons-DM_TTn48.js +0 -857
  37. package/dist/components/p-BBDH9X49.js +0 -1
  38. package/dist/components/p-Bs6_m7Uw.js +0 -1
  39. package/dist/esm/icons-kpJZ1u9g.js +0 -853
  40. package/dist/lmvz-components/p-4ad8c332.entry.js +0 -1
  41. package/dist/lmvz-components/p-5eee0752.entry.js +0 -1
  42. package/dist/lmvz-components/p-D9lc4ayG.js +0 -1
  43. package/dist/lmvz-components/p-iviTjlUy.js +0 -1
@@ -1,8 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-D3BMpL5w.js');
3
+ var assets = require('./assets-CJzJZPzV.js');
4
4
 
5
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
6
5
  /**
7
6
  * Tests if a value is a `function`.
8
7
  *
@@ -278,19 +277,19 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
278
277
  * @category constructors
279
278
  * @since 2.0.0
280
279
  */
281
- const make$n = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
280
+ const make$q = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
282
281
  /**
283
282
  * @category mapping
284
283
  * @since 2.0.0
285
284
  */
286
- const mapInput$1 = /*#__PURE__*/dual(2, (self, f) => make$n((x, y) => self(f(x), f(y))));
285
+ const mapInput$1 = /*#__PURE__*/dual(2, (self, f) => make$q((x, y) => self(f(x), f(y))));
287
286
  /**
288
287
  * Creates a new `Equivalence` for an array of values based on a given `Equivalence` for the elements of the array.
289
288
  *
290
289
  * @category combinators
291
290
  * @since 2.0.0
292
291
  */
293
- const array$1 = item => make$n((self, that) => {
292
+ const array$1 = item => make$q((self, that) => {
294
293
  if (self.length !== that.length) {
295
294
  return false;
296
295
  }
@@ -1328,10 +1327,10 @@ const Base$1 = /*#__PURE__*/function () {
1328
1327
  /**
1329
1328
  * @since 2.0.0
1330
1329
  */
1331
- const TypeId$9 = /*#__PURE__*/Symbol.for("effect/Option");
1330
+ const TypeId$b = /*#__PURE__*/Symbol.for("effect/Option");
1332
1331
  const CommonProto$1 = {
1333
1332
  ...EffectPrototype$1,
1334
- [TypeId$9]: {
1333
+ [TypeId$b]: {
1335
1334
  _A: _ => _
1336
1335
  },
1337
1336
  [NodeInspectSymbol]() {
@@ -1376,7 +1375,7 @@ const NoneProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonPr
1376
1375
  }
1377
1376
  });
1378
1377
  /** @internal */
1379
- const isOption = input => hasProperty(input, TypeId$9);
1378
+ const isOption = input => hasProperty(input, TypeId$b);
1380
1379
  /** @internal */
1381
1380
  const isNone$1 = fa => fa._tag === "None";
1382
1381
  /** @internal */
@@ -1396,10 +1395,10 @@ const some$1 = value => {
1396
1395
  /**
1397
1396
  * @internal
1398
1397
  */
1399
- const TypeId$8 = /*#__PURE__*/Symbol.for("effect/Either");
1398
+ const TypeId$a = /*#__PURE__*/Symbol.for("effect/Either");
1400
1399
  const CommonProto = {
1401
1400
  ...EffectPrototype$1,
1402
- [TypeId$8]: {
1401
+ [TypeId$a]: {
1403
1402
  _R: _ => _
1404
1403
  },
1405
1404
  [NodeInspectSymbol]() {
@@ -1444,7 +1443,7 @@ const LeftProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonPr
1444
1443
  }
1445
1444
  });
1446
1445
  /** @internal */
1447
- const isEither = input => hasProperty(input, TypeId$8);
1446
+ const isEither = input => hasProperty(input, TypeId$a);
1448
1447
  /** @internal */
1449
1448
  const isLeft$1 = ma => ma._tag === "Left";
1450
1449
  /** @internal */
@@ -1570,7 +1569,7 @@ const merge$3 = /*#__PURE__*/match$4({
1570
1569
  * @category getters
1571
1570
  * @since 2.0.0
1572
1571
  */
1573
- const getOrThrowWith$1 = /*#__PURE__*/dual(2, (self, onLeft) => {
1572
+ const getOrThrowWith = /*#__PURE__*/dual(2, (self, onLeft) => {
1574
1573
  if (isRight(self)) {
1575
1574
  return self.right;
1576
1575
  }
@@ -1605,17 +1604,17 @@ const isNonEmptyArray$1 = self => self.length > 0;
1605
1604
  * @category constructors
1606
1605
  * @since 2.0.0
1607
1606
  */
1608
- const make$m = compare => (self, that) => self === that ? 0 : compare(self, that);
1607
+ const make$p = compare => (self, that) => self === that ? 0 : compare(self, that);
1609
1608
  /**
1610
1609
  * @category instances
1611
1610
  * @since 2.0.0
1612
1611
  */
1613
- const number = /*#__PURE__*/make$m((self, that) => self < that ? -1 : 1);
1612
+ const number = /*#__PURE__*/make$p((self, that) => self < that ? -1 : 1);
1614
1613
  /**
1615
1614
  * @category mapping
1616
1615
  * @since 2.0.0
1617
1616
  */
1618
- const mapInput = /*#__PURE__*/dual(2, (self, f) => make$m((b1, b2) => self(f(b1), f(b2))));
1617
+ const mapInput = /*#__PURE__*/dual(2, (self, f) => make$p((b1, b2) => self(f(b1), f(b2))));
1619
1618
  /**
1620
1619
  * Test whether one value is _strictly greater than_ another.
1621
1620
  *
@@ -1907,67 +1906,6 @@ const fromNullable = nullableValue => nullableValue == null ? none$4() : some(nu
1907
1906
  * @since 2.0.0
1908
1907
  */
1909
1908
  const getOrUndefined = /*#__PURE__*/getOrElse(constUndefined);
1910
- /**
1911
- * Extracts the value of an `Option` or throws an error if the `Option` is
1912
- * `None`, using a custom error factory.
1913
- *
1914
- * **Details**
1915
- *
1916
- * This function allows you to extract the value of an `Option` when it is
1917
- * `Some`. If the `Option` is `None`, it throws an error generated by the
1918
- * provided `onNone` function. This utility is particularly useful when you need
1919
- * a fail-fast behavior for empty `Option` values and want to provide a custom
1920
- * error message or object.
1921
- *
1922
- * @example
1923
- * ```ts
1924
- * import * as assert from "node:assert"
1925
- * import { Option } from "effect"
1926
- *
1927
- * assert.deepStrictEqual(
1928
- * Option.getOrThrowWith(Option.some(1), () => new Error('Unexpected None')),
1929
- * 1
1930
- * )
1931
- * assert.throws(() => Option.getOrThrowWith(Option.none(), () => new Error('Unexpected None')))
1932
- * ```
1933
- *
1934
- * @see {@link getOrThrow} for a version that throws a default error.
1935
- *
1936
- * @category Conversions
1937
- * @since 2.0.0
1938
- */
1939
- const getOrThrowWith = /*#__PURE__*/dual(2, (self, onNone) => {
1940
- if (isSome(self)) {
1941
- return self.value;
1942
- }
1943
- throw onNone();
1944
- });
1945
- /**
1946
- * Extracts the value of an `Option` or throws a default error if the `Option`
1947
- * is `None`.
1948
- *
1949
- * **Details**
1950
- *
1951
- * This function extracts the value from an `Option` if it is `Some`. If the
1952
- * `Option` is `None`, it throws a default error. It is useful for fail-fast
1953
- * scenarios where the absence of a value is treated as an exceptional case and
1954
- * a default error is sufficient.
1955
- *
1956
- * @example
1957
- * ```ts
1958
- * import * as assert from "node:assert"
1959
- * import { Option } from "effect"
1960
- *
1961
- * assert.deepStrictEqual(Option.getOrThrow(Option.some(1)), 1)
1962
- * assert.throws(() => Option.getOrThrow(Option.none()))
1963
- * ```
1964
- *
1965
- * @see {@link getOrThrowWith} for a version that allows you to provide a custom error.
1966
- *
1967
- * @category Conversions
1968
- * @since 2.0.0
1969
- */
1970
- const getOrThrow = /*#__PURE__*/getOrThrowWith(() => new Error("getOrThrow called on a None"));
1971
1909
  /**
1972
1910
  * Transforms the value inside a `Some` to a new value using the provided
1973
1911
  * function, while leaving `None` unchanged.
@@ -2124,20 +2062,6 @@ const _equivalence$3 = /*#__PURE__*/equivalence();
2124
2062
  * @since 2.0.0
2125
2063
  */
2126
2064
  const contains = /*#__PURE__*/containsWith(_equivalence$3);
2127
- /**
2128
- * Merges two optional values, applying a function if both exist.
2129
- * Unlike {@link zipWith}, this function returns `None` only if both inputs are `None`.
2130
- *
2131
- * @internal
2132
- */
2133
- const mergeWith = f => (o1, o2) => {
2134
- if (isNone(o1)) {
2135
- return o2;
2136
- } else if (isNone(o2)) {
2137
- return o1;
2138
- }
2139
- return some(f(o1.value, o2.value));
2140
- };
2141
2065
 
2142
2066
  /**
2143
2067
  * This module provides utility functions for working with tuples in TypeScript.
@@ -2158,7 +2082,7 @@ const mergeWith = f => (o1, o2) => {
2158
2082
  * @category constructors
2159
2083
  * @since 2.0.0
2160
2084
  */
2161
- const make$l = (...elements) => elements;
2085
+ const make$o = (...elements) => elements;
2162
2086
 
2163
2087
  /**
2164
2088
  * This module provides utility functions for working with arrays in TypeScript.
@@ -2272,7 +2196,7 @@ const prepend$2 = /*#__PURE__*/dual(2, (self, head) => [head, ...self]);
2272
2196
  * @category concatenating
2273
2197
  * @since 2.0.0
2274
2198
  */
2275
- const append$1 = /*#__PURE__*/dual(2, (self, last) => [...self, last]);
2199
+ const append$2 = /*#__PURE__*/dual(2, (self, last) => [...self, last]);
2276
2200
  /**
2277
2201
  * Concatenates two arrays (or iterables), combining their elements.
2278
2202
  * If either array is non-empty, the result is also a non-empty array.
@@ -2522,7 +2446,7 @@ const sort = /*#__PURE__*/dual(2, (self, O) => {
2522
2446
  * @category zipping
2523
2447
  * @since 2.0.0
2524
2448
  */
2525
- const zip$1 = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, make$l));
2449
+ const zip$1 = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, make$o));
2526
2450
  /**
2527
2451
  * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
2528
2452
  * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
@@ -2660,7 +2584,7 @@ const union$2 = /*#__PURE__*/dual(2, (self, that) => unionWith(self, that, _equi
2660
2584
  * @category constructors
2661
2585
  * @since 2.0.0
2662
2586
  */
2663
- const empty$j = () => [];
2587
+ const empty$k = () => [];
2664
2588
  /**
2665
2589
  * Constructs a new `NonEmptyArray<A>` from the specified value.
2666
2590
  *
@@ -2934,6 +2858,54 @@ const Order$1 = number;
2934
2858
  */
2935
2859
  const escape = string => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
2936
2860
 
2861
+ /**
2862
+ * This module provides types and utility functions to create and work with branded types,
2863
+ * which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context.
2864
+ *
2865
+ * The `refined` and `nominal` functions are both used to create branded types in TypeScript.
2866
+ * The main difference between them is that `refined` allows for validation of the data, while `nominal` does not.
2867
+ *
2868
+ * The `nominal` function is used to create a new branded type that has the same underlying type as the input, but with a different name.
2869
+ * This is useful when you want to distinguish between two values of the same type that have different meanings.
2870
+ * The `nominal` function does not perform any validation of the input data.
2871
+ *
2872
+ * On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input,
2873
+ * but with a different name, and it also allows for validation of the input data.
2874
+ * The `refined` function takes a predicate that is used to validate the input data.
2875
+ * If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure.
2876
+ *
2877
+ * @since 2.0.0
2878
+ */
2879
+ /**
2880
+ * @since 2.0.0
2881
+ * @category symbols
2882
+ */
2883
+ const RefinedConstructorsTypeId = /*#__PURE__*/Symbol.for("effect/Brand/Refined");
2884
+ /**
2885
+ * Returns a `BrandErrors` that contains a single `RefinementError`.
2886
+ *
2887
+ * @since 2.0.0
2888
+ * @category constructors
2889
+ */
2890
+ const error = (message, meta) => [{
2891
+ message,
2892
+ meta
2893
+ }];
2894
+ function refined(...args) {
2895
+ const either = args.length === 2 ? unbranded => args[0](unbranded) ? right(unbranded) : left(args[1](unbranded)) : unbranded => {
2896
+ return match$3(args[0](unbranded), {
2897
+ onNone: () => right(unbranded),
2898
+ onSome: left
2899
+ });
2900
+ };
2901
+ return Object.assign(unbranded => getOrThrowWith(either(unbranded), identity), {
2902
+ [RefinedConstructorsTypeId]: RefinedConstructorsTypeId,
2903
+ option: args => getRight(either(args)),
2904
+ either,
2905
+ is: args => isRight(either(args))
2906
+ });
2907
+ }
2908
+
2937
2909
  /** @internal */
2938
2910
  const TagTypeId = /*#__PURE__*/Symbol.for("effect/Context/Tag");
2939
2911
  /** @internal */
@@ -2968,7 +2940,7 @@ const TagProto = {
2968
2940
  return self;
2969
2941
  },
2970
2942
  context(self) {
2971
- return make$k(this, self);
2943
+ return make$n(this, self);
2972
2944
  }
2973
2945
  };
2974
2946
  const ReferenceProto = {
@@ -3008,10 +2980,10 @@ const Reference$1 = () => (id, options) => {
3008
2980
  return ReferenceClass;
3009
2981
  };
3010
2982
  /** @internal */
3011
- const TypeId$7 = /*#__PURE__*/Symbol.for("effect/Context");
2983
+ const TypeId$9 = /*#__PURE__*/Symbol.for("effect/Context");
3012
2984
  /** @internal */
3013
2985
  const ContextProto = {
3014
- [TypeId$7]: {
2986
+ [TypeId$9]: {
3015
2987
  _Services: _ => _
3016
2988
  },
3017
2989
  [symbol](that) {
@@ -3071,14 +3043,14 @@ const serviceNotFoundError = tag => {
3071
3043
  return error;
3072
3044
  };
3073
3045
  /** @internal */
3074
- const isContext = u => hasProperty(u, TypeId$7);
3046
+ const isContext = u => hasProperty(u, TypeId$9);
3075
3047
  /** @internal */
3076
3048
  const isReference = u => hasProperty(u, ReferenceTypeId);
3077
3049
  const _empty$6 = /*#__PURE__*/makeContext(/*#__PURE__*/new Map());
3078
3050
  /** @internal */
3079
- const empty$i = () => _empty$6;
3051
+ const empty$j = () => _empty$6;
3080
3052
  /** @internal */
3081
- const make$k = (tag, service) => makeContext(new Map([[tag.key, service]]));
3053
+ const make$n = (tag, service) => makeContext(new Map([[tag.key, service]]));
3082
3054
  /** @internal */
3083
3055
  const add$3 = /*#__PURE__*/dual(3, (self, tag, service) => {
3084
3056
  const map = new Map(self.unsafeMap);
@@ -3153,7 +3125,7 @@ const GenericTag = makeGenericTag;
3153
3125
  * @since 2.0.0
3154
3126
  * @category constructors
3155
3127
  */
3156
- const empty$h = empty$i;
3128
+ const empty$i = empty$j;
3157
3129
  /**
3158
3130
  * Creates a new `Context` with a single service associated to the tag.
3159
3131
  *
@@ -3172,7 +3144,7 @@ const empty$h = empty$i;
3172
3144
  * @since 2.0.0
3173
3145
  * @category constructors
3174
3146
  */
3175
- const make$j = make$k;
3147
+ const make$m = make$n;
3176
3148
  /**
3177
3149
  * Adds a service to a given `Context`.
3178
3150
  *
@@ -3351,7 +3323,7 @@ const Reference = Reference$1;
3351
3323
  /**
3352
3324
  * @since 2.0.0
3353
3325
  */
3354
- const TypeId$6 = /*#__PURE__*/Symbol.for("effect/Chunk");
3326
+ const TypeId$8 = /*#__PURE__*/Symbol.for("effect/Chunk");
3355
3327
  function copy(src, srcPos, dest, destPos, len) {
3356
3328
  for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
3357
3329
  dest[destPos + i - srcPos] = src[i];
@@ -3365,10 +3337,10 @@ const emptyArray = [];
3365
3337
  * @category equivalence
3366
3338
  * @since 2.0.0
3367
3339
  */
3368
- const getEquivalence$1 = isEquivalent => make$n((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
3340
+ const getEquivalence$1 = isEquivalent => make$q((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
3369
3341
  const _equivalence$1 = /*#__PURE__*/getEquivalence$1(equals$1);
3370
3342
  const ChunkProto = {
3371
- [TypeId$6]: {
3343
+ [TypeId$8]: {
3372
3344
  _A: _ => _
3373
3345
  },
3374
3346
  toString() {
@@ -3462,7 +3434,7 @@ const makeChunk = backing => {
3462
3434
  * @category constructors
3463
3435
  * @since 2.0.0
3464
3436
  */
3465
- const isChunk = u => hasProperty(u, TypeId$6);
3437
+ const isChunk = u => hasProperty(u, TypeId$8);
3466
3438
  const _empty$5 = /*#__PURE__*/makeChunk({
3467
3439
  _tag: "IEmpty"
3468
3440
  });
@@ -3470,14 +3442,14 @@ const _empty$5 = /*#__PURE__*/makeChunk({
3470
3442
  * @category constructors
3471
3443
  * @since 2.0.0
3472
3444
  */
3473
- const empty$g = () => _empty$5;
3445
+ const empty$h = () => _empty$5;
3474
3446
  /**
3475
3447
  * Builds a `NonEmptyChunk` from an non-empty collection of elements.
3476
3448
  *
3477
3449
  * @category constructors
3478
3450
  * @since 2.0.0
3479
3451
  */
3480
- const make$i = (...as) => unsafeFromNonEmptyArray(as);
3452
+ const make$l = (...as) => unsafeFromNonEmptyArray(as);
3481
3453
  /**
3482
3454
  * Builds a `NonEmptyChunk` from a single element.
3483
3455
  *
@@ -3610,7 +3582,7 @@ const reverse$1 = reverseChunk;
3610
3582
  * @since 2.0.0
3611
3583
  * @category unsafe
3612
3584
  */
3613
- const unsafeFromArray = self => self.length === 0 ? empty$g() : self.length === 1 ? of$1(self[0]) : makeChunk({
3585
+ const unsafeFromArray = self => self.length === 0 ? empty$h() : self.length === 1 ? of$1(self[0]) : makeChunk({
3614
3586
  _tag: "IArray",
3615
3587
  array: self
3616
3588
  });
@@ -3663,7 +3635,7 @@ const unsafeGet = /*#__PURE__*/dual(2, (self, index) => {
3663
3635
  * @category concatenating
3664
3636
  * @since 2.0.0
3665
3637
  */
3666
- const append = /*#__PURE__*/dual(2, (self, a) => appendAll$1(self, of$1(a)));
3638
+ const append$1 = /*#__PURE__*/dual(2, (self, a) => appendAll$1(self, of$1(a)));
3667
3639
  /**
3668
3640
  * Prepend an element to the front of a `Chunk`, creating a new `NonEmptyChunk`.
3669
3641
  *
@@ -3823,7 +3795,7 @@ const appendAll$1 = /*#__PURE__*/dual(2, (self, that) => {
3823
3795
  * @since 2.0.0
3824
3796
  * @category elements
3825
3797
  */
3826
- const isEmpty$3 = self => self.length === 0;
3798
+ const isEmpty$4 = self => self.length === 0;
3827
3799
  /**
3828
3800
  * Determines if the chunk is not empty.
3829
3801
  *
@@ -3858,7 +3830,7 @@ const tailNonEmpty = self => drop(self, 1);
3858
3830
  /**
3859
3831
  * @since 2.0.0
3860
3832
  */
3861
- const TypeId$5 = /*#__PURE__*/Symbol.for("effect/Duration");
3833
+ const TypeId$7 = /*#__PURE__*/Symbol.for("effect/Duration");
3862
3834
  const bigint0$1 = /*#__PURE__*/BigInt(0);
3863
3835
  const bigint24 = /*#__PURE__*/BigInt(24);
3864
3836
  const bigint60 = /*#__PURE__*/BigInt(60);
@@ -3927,7 +3899,7 @@ const infinityValue = {
3927
3899
  _tag: "Infinity"
3928
3900
  };
3929
3901
  const DurationProto = {
3930
- [TypeId$5]: TypeId$5,
3902
+ [TypeId$7]: TypeId$7,
3931
3903
  [symbol$1]() {
3932
3904
  return cached(this, structure(this.value));
3933
3905
  },
@@ -3965,7 +3937,7 @@ const DurationProto = {
3965
3937
  return pipeArguments(this, arguments);
3966
3938
  }
3967
3939
  };
3968
- const make$h = input => {
3940
+ const make$k = input => {
3969
3941
  const duration = Object.create(DurationProto);
3970
3942
  if (isNumber(input)) {
3971
3943
  if (isNaN(input) || input <= 0) {
@@ -3997,7 +3969,7 @@ const make$h = input => {
3997
3969
  * @since 2.0.0
3998
3970
  * @category guards
3999
3971
  */
4000
- const isDuration = u => hasProperty(u, TypeId$5);
3972
+ const isDuration = u => hasProperty(u, TypeId$7);
4001
3973
  /**
4002
3974
  * @since 3.5.0
4003
3975
  * @category guards
@@ -4022,52 +3994,52 @@ const isZero = self => {
4022
3994
  * @since 2.0.0
4023
3995
  * @category constructors
4024
3996
  */
4025
- const zero = /*#__PURE__*/make$h(0);
3997
+ const zero = /*#__PURE__*/make$k(0);
4026
3998
  /**
4027
3999
  * @since 2.0.0
4028
4000
  * @category constructors
4029
4001
  */
4030
- const infinity = /*#__PURE__*/make$h(Infinity);
4002
+ const infinity = /*#__PURE__*/make$k(Infinity);
4031
4003
  /**
4032
4004
  * @since 2.0.0
4033
4005
  * @category constructors
4034
4006
  */
4035
- const nanos = nanos => make$h(nanos);
4007
+ const nanos = nanos => make$k(nanos);
4036
4008
  /**
4037
4009
  * @since 2.0.0
4038
4010
  * @category constructors
4039
4011
  */
4040
- const micros = micros => make$h(micros * bigint1e3);
4012
+ const micros = micros => make$k(micros * bigint1e3);
4041
4013
  /**
4042
4014
  * @since 2.0.0
4043
4015
  * @category constructors
4044
4016
  */
4045
- const millis = millis => make$h(millis);
4017
+ const millis = millis => make$k(millis);
4046
4018
  /**
4047
4019
  * @since 2.0.0
4048
4020
  * @category constructors
4049
4021
  */
4050
- const seconds = seconds => make$h(seconds * 1000);
4022
+ const seconds = seconds => make$k(seconds * 1000);
4051
4023
  /**
4052
4024
  * @since 2.0.0
4053
4025
  * @category constructors
4054
4026
  */
4055
- const minutes = minutes => make$h(minutes * 60_000);
4027
+ const minutes = minutes => make$k(minutes * 60_000);
4056
4028
  /**
4057
4029
  * @since 2.0.0
4058
4030
  * @category constructors
4059
4031
  */
4060
- const hours = hours => make$h(hours * 3_600_000);
4032
+ const hours = hours => make$k(hours * 3_600_000);
4061
4033
  /**
4062
4034
  * @since 2.0.0
4063
4035
  * @category constructors
4064
4036
  */
4065
- const days = days => make$h(days * 86_400_000);
4037
+ const days = days => make$k(days * 86_400_000);
4066
4038
  /**
4067
4039
  * @since 2.0.0
4068
4040
  * @category constructors
4069
4041
  */
4070
- const weeks = weeks => make$h(weeks * 604_800_000);
4042
+ const weeks = weeks => make$k(weeks * 604_800_000);
4071
4043
  /**
4072
4044
  * @since 2.0.0
4073
4045
  * @category getters
@@ -4286,7 +4258,7 @@ function fromBitmap(bitmap, bit) {
4286
4258
  return popcount(bitmap & bit - 1);
4287
4259
  }
4288
4260
 
4289
- const make$g = (value, previous) => ({
4261
+ const make$j = (value, previous) => ({
4290
4262
  value,
4291
4263
  previous
4292
4264
  });
@@ -4572,7 +4544,7 @@ function mergeLeaves(edit, shift, h1, n1, h2, n2) {
4572
4544
  while (true) {
4573
4545
  const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
4574
4546
  if (typeof res === "function") {
4575
- stack = make$g(res, stack);
4547
+ stack = make$j(res, stack);
4576
4548
  currentShift = currentShift + SIZE;
4577
4549
  } else {
4578
4550
  let final = res;
@@ -4707,10 +4679,10 @@ const visitLazyChildren = (len, children, i, f, cont) => {
4707
4679
  };
4708
4680
  const _empty$4 = /*#__PURE__*/makeImpl$1(false, 0, /*#__PURE__*/new EmptyNode(), 0);
4709
4681
  /** @internal */
4710
- const empty$f = () => _empty$4;
4682
+ const empty$g = () => _empty$4;
4711
4683
  /** @internal */
4712
4684
  const fromIterable$4 = entries => {
4713
- const map = beginMutation$1(empty$f());
4685
+ const map = beginMutation$1(empty$g());
4714
4686
  for (const entry of entries) {
4715
4687
  set$3(map, entry[0], entry[1]);
4716
4688
  }
@@ -4719,7 +4691,7 @@ const fromIterable$4 = entries => {
4719
4691
  /** @internal */
4720
4692
  const isHashMap = u => hasProperty(u, HashMapTypeId);
4721
4693
  /** @internal */
4722
- const isEmpty$2 = self => self && isEmptyNode(self._root);
4694
+ const isEmpty$3 = self => self && isEmptyNode(self._root);
4723
4695
  /** @internal */
4724
4696
  const get$4 = /*#__PURE__*/dual(2, (self, key) => getHash(self, key, hash(key)));
4725
4697
  /** @internal */
@@ -4805,14 +4777,14 @@ const modifyHash = /*#__PURE__*/dual(4, (self, key, hash, f) => {
4805
4777
  return pipe(self, setTree(newRoot, size.value));
4806
4778
  });
4807
4779
  /** @internal */
4808
- const remove$3 = /*#__PURE__*/dual(2, (self, key) => modifyAt$1(self, key, none$4));
4780
+ const remove$4 = /*#__PURE__*/dual(2, (self, key) => modifyAt$1(self, key, none$4));
4809
4781
  /**
4810
4782
  * Maps over the entries of the `HashMap` using the specified function.
4811
4783
  *
4812
4784
  * @since 2.0.0
4813
4785
  * @category mapping
4814
4786
  */
4815
- const map$2 = /*#__PURE__*/dual(2, (self, f) => reduce$5(self, empty$f(), (map, value, key) => set$3(map, key, f(value, key))));
4787
+ const map$2 = /*#__PURE__*/dual(2, (self, f) => reduce$5(self, empty$g(), (map, value, key) => set$3(map, key, f(value, key))));
4816
4788
  /** @internal */
4817
4789
  const forEach$2 = /*#__PURE__*/dual(2, (self, f) => reduce$5(self, void 0, (_, value, key) => f(value, key)));
4818
4790
  /** @internal */
@@ -4884,20 +4856,20 @@ const makeImpl = keyMap => {
4884
4856
  };
4885
4857
  /** @internal */
4886
4858
  const isHashSet = u => hasProperty(u, HashSetTypeId);
4887
- const _empty$3 = /*#__PURE__*/makeImpl(/*#__PURE__*/empty$f());
4859
+ const _empty$3 = /*#__PURE__*/makeImpl(/*#__PURE__*/empty$g());
4888
4860
  /** @internal */
4889
- const empty$e = () => _empty$3;
4861
+ const empty$f = () => _empty$3;
4890
4862
  /** @internal */
4891
4863
  const fromIterable$3 = elements => {
4892
- const set = beginMutation(empty$e());
4864
+ const set = beginMutation(empty$f());
4893
4865
  for (const value of elements) {
4894
4866
  add$1(set, value);
4895
4867
  }
4896
4868
  return endMutation(set);
4897
4869
  };
4898
4870
  /** @internal */
4899
- const make$f = (...elements) => {
4900
- const set = beginMutation(empty$e());
4871
+ const make$i = (...elements) => {
4872
+ const set = beginMutation(empty$f());
4901
4873
  for (const value of elements) {
4902
4874
  add$1(set, value);
4903
4875
  }
@@ -4923,15 +4895,15 @@ const mutate = /*#__PURE__*/dual(2, (self, f) => {
4923
4895
  /** @internal */
4924
4896
  const add$1 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (set$3(value, true)(self._keyMap), self) : makeImpl(set$3(value, true)(self._keyMap)));
4925
4897
  /** @internal */
4926
- const remove$2 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (remove$3(value)(self._keyMap), self) : makeImpl(remove$3(value)(self._keyMap)));
4898
+ const remove$3 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (remove$4(value)(self._keyMap), self) : makeImpl(remove$4(value)(self._keyMap)));
4927
4899
  /** @internal */
4928
4900
  const difference$1 = /*#__PURE__*/dual(2, (self, that) => mutate(self, set => {
4929
4901
  for (const value of that) {
4930
- remove$2(set, value);
4902
+ remove$3(set, value);
4931
4903
  }
4932
4904
  }));
4933
4905
  /** @internal */
4934
- const union$1 = /*#__PURE__*/dual(2, (self, that) => mutate(empty$e(), set => {
4906
+ const union$1 = /*#__PURE__*/dual(2, (self, that) => mutate(empty$f(), set => {
4935
4907
  forEach$1(self, value => add$1(set, value));
4936
4908
  for (const value of that) {
4937
4909
  add$1(set, value);
@@ -5222,7 +5194,7 @@ const reduce$4 = /*#__PURE__*/dual(3, (self, zero, f) => reduce$5(self._keyMap,
5222
5194
  *
5223
5195
  * @see Other `HashSet` constructors are {@link module:HashSet.make} {@link module:HashSet.fromIterable}
5224
5196
  */
5225
- const empty$d = empty$e;
5197
+ const empty$e = empty$f;
5226
5198
  /**
5227
5199
  * Creates a new `HashSet` from an iterable collection of values.
5228
5200
  *
@@ -5404,7 +5376,7 @@ const fromIterable$2 = fromIterable$3;
5404
5376
  *
5405
5377
  * @see Other `HashSet` constructors are {@link module:HashSet.fromIterable} {@link module:HashSet.empty}
5406
5378
  */
5407
- const make$e = make$f;
5379
+ const make$h = make$i;
5408
5380
  /**
5409
5381
  * Checks if the specified value exists in the `HashSet`.
5410
5382
  *
@@ -5516,7 +5488,7 @@ const add = add$1;
5516
5488
  *
5517
5489
  * @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
5518
5490
  */
5519
- const remove$1 = remove$2;
5491
+ const remove$2 = remove$3;
5520
5492
  /**
5521
5493
  * Computes the set difference `(A - B)` between this `HashSet` and the
5522
5494
  * specified `Iterable<A>`.
@@ -5610,9 +5582,9 @@ const reduce$3 = reduce$4;
5610
5582
  /**
5611
5583
  * @since 2.0.0
5612
5584
  */
5613
- const TypeId$4 = /*#__PURE__*/Symbol.for("effect/MutableRef");
5585
+ const TypeId$6 = /*#__PURE__*/Symbol.for("effect/MutableRef");
5614
5586
  const MutableRefProto = {
5615
- [TypeId$4]: TypeId$4,
5587
+ [TypeId$6]: TypeId$6,
5616
5588
  toString() {
5617
5589
  return format$2(this.toJSON());
5618
5590
  },
@@ -5633,7 +5605,7 @@ const MutableRefProto = {
5633
5605
  * @since 2.0.0
5634
5606
  * @category constructors
5635
5607
  */
5636
- const make$d = value => {
5608
+ const make$g = value => {
5637
5609
  const ref = Object.create(MutableRefProto);
5638
5610
  ref.current = value;
5639
5611
  return ref;
@@ -5739,11 +5711,11 @@ const ids = self => {
5739
5711
  switch (self._tag) {
5740
5712
  case OP_NONE:
5741
5713
  {
5742
- return empty$d();
5714
+ return empty$e();
5743
5715
  }
5744
5716
  case OP_RUNTIME:
5745
5717
  {
5746
- return make$e(self.id);
5718
+ return make$h(self.id);
5747
5719
  }
5748
5720
  case OP_COMPOSITE:
5749
5721
  {
@@ -5751,14 +5723,14 @@ const ids = self => {
5751
5723
  }
5752
5724
  }
5753
5725
  };
5754
- const _fiberCounter = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$d(0));
5726
+ const _fiberCounter = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$g(0));
5755
5727
  /** @internal */
5756
5728
  const threadName$1 = self => {
5757
5729
  const identifiers = Array.from(ids(self)).map(n => `#${n}`).join(",");
5758
5730
  return identifiers;
5759
5731
  };
5760
5732
  /** @internal */
5761
- const unsafeMake$4 = () => {
5733
+ const unsafeMake$5 = () => {
5762
5734
  const id = get$3(_fiberCounter);
5763
5735
  pipe(_fiberCounter, set$2(id + 1));
5764
5736
  return new Runtime(id, Date.now());
@@ -5783,7 +5755,7 @@ const threadName = threadName$1;
5783
5755
  * @since 2.0.0
5784
5756
  * @category unsafe
5785
5757
  */
5786
- const unsafeMake$3 = unsafeMake$4;
5758
+ const unsafeMake$4 = unsafeMake$5;
5787
5759
 
5788
5760
  /**
5789
5761
  * @since 2.0.0
@@ -5794,7 +5766,7 @@ const unsafeMake$3 = unsafeMake$4;
5794
5766
  * @since 2.0.0
5795
5767
  * @category constructors
5796
5768
  */
5797
- const empty$c = empty$f;
5769
+ const empty$d = empty$g;
5798
5770
  /**
5799
5771
  * Creates a new `HashMap` from an iterable collection of key/value pairs.
5800
5772
  *
@@ -5808,7 +5780,7 @@ const fromIterable$1 = fromIterable$4;
5808
5780
  * @since 2.0.0
5809
5781
  * @category elements
5810
5782
  */
5811
- const isEmpty$1 = isEmpty$2;
5783
+ const isEmpty$2 = isEmpty$3;
5812
5784
  /**
5813
5785
  * Safely lookup the value for the specified key in the `HashMap` using the
5814
5786
  * internal hashing function.
@@ -5883,7 +5855,7 @@ const reduce$2 = reduce$5;
5883
5855
  * @since 2.0.0
5884
5856
  * @category symbol
5885
5857
  */
5886
- const TypeId$3 = /*#__PURE__*/Symbol.for("effect/List");
5858
+ const TypeId$5 = /*#__PURE__*/Symbol.for("effect/List");
5887
5859
  /**
5888
5860
  * Converts the specified `List` to an `Array`.
5889
5861
  *
@@ -5898,7 +5870,7 @@ const toArray = self => fromIterable$6(self);
5898
5870
  const getEquivalence = isEquivalent => mapInput$1(getEquivalence$2(isEquivalent), toArray);
5899
5871
  const _equivalence = /*#__PURE__*/getEquivalence(equals$1);
5900
5872
  const ConsProto = {
5901
- [TypeId$3]: TypeId$3,
5873
+ [TypeId$5]: TypeId$5,
5902
5874
  _tag: "Cons",
5903
5875
  toString() {
5904
5876
  return format$2(this.toJSON());
@@ -5962,7 +5934,7 @@ const makeCons = (head, tail) => {
5962
5934
  };
5963
5935
  const NilHash = /*#__PURE__*/string("Nil");
5964
5936
  const NilProto = {
5965
- [TypeId$3]: TypeId$3,
5937
+ [TypeId$5]: TypeId$5,
5966
5938
  _tag: "Nil",
5967
5939
  toString() {
5968
5940
  return format$2(this.toJSON());
@@ -6003,7 +5975,7 @@ const _Nil = /*#__PURE__*/Object.create(NilProto);
6003
5975
  * @since 2.0.0
6004
5976
  * @category refinements
6005
5977
  */
6006
- const isList = u => hasProperty(u, TypeId$3);
5978
+ const isList = u => hasProperty(u, TypeId$5);
6007
5979
  /**
6008
5980
  * Returns `true` if the specified value is a `List.Nil<A>`, `false` otherwise.
6009
5981
  *
@@ -6040,7 +6012,7 @@ const cons = (head, tail) => makeCons(head, tail);
6040
6012
  * @since 2.0.0
6041
6013
  * @category constructors
6042
6014
  */
6043
- const empty$b = nil;
6015
+ const empty$c = nil;
6044
6016
  /**
6045
6017
  * Constructs a new `List<A>` from the specified value.
6046
6018
  *
@@ -6133,7 +6105,7 @@ const reduce$1 = /*#__PURE__*/dual(3, (self, zero, f) => {
6133
6105
  * @category elements
6134
6106
  */
6135
6107
  const reverse = self => {
6136
- let result = empty$b();
6108
+ let result = empty$c();
6137
6109
  let these = self;
6138
6110
  while (!isNil(these)) {
6139
6111
  result = prepend(result, these.head);
@@ -6175,7 +6147,7 @@ const _empty$2 = /*#__PURE__*/Object.create(EmptyProto$2);
6175
6147
  /**
6176
6148
  * @internal
6177
6149
  */
6178
- const empty$a = () => _empty$2;
6150
+ const empty$b = () => _empty$2;
6179
6151
  const AndThenProto$2 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
6180
6152
  _tag: "AndThen"
6181
6153
  });
@@ -6214,7 +6186,7 @@ const makeUpdateService = (key, update) => {
6214
6186
  /** @internal */
6215
6187
  const diff$6 = (oldValue, newValue) => {
6216
6188
  const missingServices = new Map(oldValue.unsafeMap);
6217
- let patch = empty$a();
6189
+ let patch = empty$b();
6218
6190
  for (const [tag, newService] of newValue.unsafeMap.entries()) {
6219
6191
  if (missingServices.has(tag)) {
6220
6192
  const old = missingServices.get(tag);
@@ -6312,7 +6284,7 @@ const EmptyProto$1 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(Patch
6312
6284
  });
6313
6285
  const _empty$1 = /*#__PURE__*/Object.create(EmptyProto$1);
6314
6286
  /** @internal */
6315
- const empty$9 = () => _empty$1;
6287
+ const empty$a = () => _empty$1;
6316
6288
  const AndThenProto$1 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$1), {
6317
6289
  _tag: "AndThen"
6318
6290
  });
@@ -6343,9 +6315,9 @@ const makeRemove = value => {
6343
6315
  };
6344
6316
  /** @internal */
6345
6317
  const diff$5 = (oldValue, newValue) => {
6346
- const [removed, patch] = reduce$3([oldValue, empty$9()], ([set, patch], value) => {
6318
+ const [removed, patch] = reduce$3([oldValue, empty$a()], ([set, patch], value) => {
6347
6319
  if (has$1(value)(set)) {
6348
- return [remove$1(value)(set), patch];
6320
+ return [remove$2(value)(set), patch];
6349
6321
  }
6350
6322
  return [set, combine$3(makeAdd(value))(patch)];
6351
6323
  })(newValue);
@@ -6382,7 +6354,7 @@ const patch$6 = /*#__PURE__*/dual(2, (self, oldValue) => {
6382
6354
  }
6383
6355
  case "Remove":
6384
6356
  {
6385
- set = remove$1(head.value)(set);
6357
+ set = remove$2(head.value)(set);
6386
6358
  patches = tail;
6387
6359
  }
6388
6360
  }
@@ -6409,7 +6381,7 @@ const _empty = /*#__PURE__*/Object.create(EmptyProto);
6409
6381
  /**
6410
6382
  * @internal
6411
6383
  */
6412
- const empty$8 = () => _empty;
6384
+ const empty$9 = () => _empty;
6413
6385
  const AndThenProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
6414
6386
  _tag: "AndThen"
6415
6387
  });
@@ -6448,7 +6420,7 @@ const makeUpdate = (index, patch) => {
6448
6420
  /** @internal */
6449
6421
  const diff$4 = options => {
6450
6422
  let i = 0;
6451
- let patch = empty$8();
6423
+ let patch = empty$9();
6452
6424
  while (i < options.oldValue.length && i < options.newValue.length) {
6453
6425
  const oldElement = options.oldValue[i];
6454
6426
  const newElement = options.newValue[i];
@@ -6528,7 +6500,7 @@ const DifferProto = {
6528
6500
  }
6529
6501
  };
6530
6502
  /** @internal */
6531
- const make$c = params => {
6503
+ const make$f = params => {
6532
6504
  const differ = Object.create(DifferProto);
6533
6505
  differ.empty = params.empty;
6534
6506
  differ.diff = params.diff;
@@ -6537,22 +6509,22 @@ const make$c = params => {
6537
6509
  return differ;
6538
6510
  };
6539
6511
  /** @internal */
6540
- const environment = () => make$c({
6541
- empty: empty$a(),
6512
+ const environment = () => make$f({
6513
+ empty: empty$b(),
6542
6514
  combine: (first, second) => combine$4(second)(first),
6543
6515
  diff: (oldValue, newValue) => diff$6(oldValue, newValue),
6544
6516
  patch: (patch, oldValue) => patch$7(oldValue)(patch)
6545
6517
  });
6546
6518
  /** @internal */
6547
- const hashSet = () => make$c({
6548
- empty: empty$9(),
6519
+ const hashSet = () => make$f({
6520
+ empty: empty$a(),
6549
6521
  combine: (first, second) => combine$3(second)(first),
6550
6522
  diff: (oldValue, newValue) => diff$5(oldValue, newValue),
6551
6523
  patch: (patch, oldValue) => patch$6(oldValue)(patch)
6552
6524
  });
6553
6525
  /** @internal */
6554
- const readonlyArray = differ => make$c({
6555
- empty: empty$8(),
6526
+ const readonlyArray = differ => make$f({
6527
+ empty: empty$9(),
6556
6528
  combine: (first, second) => combine$2(first, second),
6557
6529
  diff: (oldValue, newValue) => diff$4({
6558
6530
  oldValue,
@@ -6564,7 +6536,7 @@ const readonlyArray = differ => make$c({
6564
6536
  /** @internal */
6565
6537
  const update$1 = () => updateWith((_, a) => a);
6566
6538
  /** @internal */
6567
- const updateWith = f => make$c({
6539
+ const updateWith = f => make$f({
6568
6540
  empty: identity,
6569
6541
  combine: (first, second) => {
6570
6542
  if (first === identity) {
@@ -6593,15 +6565,15 @@ const active = patch => patch & BIT_MASK;
6593
6565
  /** @internal */
6594
6566
  const enabled = patch => patch >> BIT_SHIFT & BIT_MASK;
6595
6567
  /** @internal */
6596
- const make$b = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
6568
+ const make$e = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
6597
6569
  /** @internal */
6598
- const empty$7 = /*#__PURE__*/make$b(0, 0);
6570
+ const empty$8 = /*#__PURE__*/make$e(0, 0);
6599
6571
  /** @internal */
6600
- const enable$2 = flag => make$b(flag, flag);
6572
+ const enable$2 = flag => make$e(flag, flag);
6601
6573
  /** @internal */
6602
- const disable$1 = flag => make$b(flag, 0);
6574
+ const disable$1 = flag => make$e(flag, 0);
6603
6575
  /** @internal */
6604
- const exclude$1 = /*#__PURE__*/dual(2, (self, flag) => make$b(active(self) & ~flag, enabled(self)));
6576
+ const exclude$1 = /*#__PURE__*/dual(2, (self, flag) => make$e(active(self) & ~flag, enabled(self)));
6605
6577
  /** @internal */
6606
6578
  const andThen = /*#__PURE__*/dual(2, (self, that) => self | that);
6607
6579
  /** @internal */
@@ -6630,19 +6602,19 @@ const interruption = self => isEnabled(self, Interruption);
6630
6602
  /** @internal */
6631
6603
  const isEnabled = /*#__PURE__*/dual(2, (self, flag) => (self & flag) !== 0);
6632
6604
  /** @internal */
6633
- const make$a = (...flags) => flags.reduce((a, b) => a | b, 0);
6605
+ const make$d = (...flags) => flags.reduce((a, b) => a | b, 0);
6634
6606
  /** @internal */
6635
- const none$1 = /*#__PURE__*/make$a(None$1);
6607
+ const none$1 = /*#__PURE__*/make$d(None$1);
6636
6608
  /** @internal */
6637
6609
  const runtimeMetrics = self => isEnabled(self, RuntimeMetrics);
6638
6610
  const windDown = self => isEnabled(self, WindDown);
6639
6611
  /** @internal */
6640
- const diff$3 = /*#__PURE__*/dual(2, (self, that) => make$b(self ^ that, that));
6612
+ const diff$3 = /*#__PURE__*/dual(2, (self, that) => make$e(self ^ that, that));
6641
6613
  /** @internal */
6642
6614
  const patch$4 = /*#__PURE__*/dual(2, (self, patch) => self & (invert(active(patch)) | enabled(patch)) | active(patch) & enabled(patch));
6643
6615
  /** @internal */
6644
- const differ$1 = /*#__PURE__*/make$c({
6645
- empty: empty$7,
6616
+ const differ$1 = /*#__PURE__*/make$f({
6617
+ empty: empty$8,
6646
6618
  diff: (oldValue, newValue) => diff$3(oldValue, newValue),
6647
6619
  combine: (first, second) => andThen(second)(first),
6648
6620
  patch: (_patch, oldValue) => patch$4(oldValue, _patch)
@@ -6704,10 +6676,10 @@ const seq = (self, that) => ({
6704
6676
  */
6705
6677
  const flatten$1 = self => {
6706
6678
  let current = of(self);
6707
- let updated = empty$b();
6679
+ let updated = empty$c();
6708
6680
  // eslint-disable-next-line no-constant-condition
6709
6681
  while (1) {
6710
- const [parallel, sequential] = reduce$1(current, [parallelCollectionEmpty(), empty$b()], ([parallel, sequential], blockedRequest) => {
6682
+ const [parallel, sequential] = reduce$1(current, [parallelCollectionEmpty(), empty$c()], ([parallel, sequential], blockedRequest) => {
6711
6683
  const [par, seq] = step$1(blockedRequest);
6712
6684
  return [parallelCollectionCombine(parallel, par), appendAll(sequential, seq)];
6713
6685
  });
@@ -6728,8 +6700,8 @@ const flatten$1 = self => {
6728
6700
  const step$1 = requests => {
6729
6701
  let current = requests;
6730
6702
  let parallel = parallelCollectionEmpty();
6731
- let stack = empty$b();
6732
- let sequential = empty$b();
6703
+ let stack = empty$c();
6704
+ let sequential = empty$c();
6733
6705
  // eslint-disable-next-line no-constant-condition
6734
6706
  while (1) {
6735
6707
  switch (current._tag) {
@@ -6829,16 +6801,16 @@ class ParallelImpl {
6829
6801
  }
6830
6802
  }
6831
6803
  /** @internal */
6832
- const parallelCollectionEmpty = () => new ParallelImpl(empty$c());
6804
+ const parallelCollectionEmpty = () => new ParallelImpl(empty$d());
6833
6805
  /** @internal */
6834
- const parallelCollectionAdd = (self, blockedRequest) => new ParallelImpl(modifyAt(self.map, blockedRequest.dataSource, _ => orElseSome(map$4(_, append(blockedRequest.blockedRequest)), () => of$1(blockedRequest.blockedRequest))));
6806
+ const parallelCollectionAdd = (self, blockedRequest) => new ParallelImpl(modifyAt(self.map, blockedRequest.dataSource, _ => orElseSome(map$4(_, append$1(blockedRequest.blockedRequest)), () => of$1(blockedRequest.blockedRequest))));
6835
6807
  /** @internal */
6836
6808
  const parallelCollectionCombine = (self, that) => new ParallelImpl(reduce$2(self.map, that.map, (map, value, key) => set$1(map, key, match$3(get$2(map, key), {
6837
6809
  onNone: () => value,
6838
6810
  onSome: other => appendAll$1(value, other)
6839
6811
  }))));
6840
6812
  /** @internal */
6841
- const parallelCollectionIsEmpty = self => isEmpty$1(self.map);
6813
+ const parallelCollectionIsEmpty = self => isEmpty$2(self.map);
6842
6814
  /** @internal */
6843
6815
  const parallelCollectionKeys = self => Array.from(keys(self.map));
6844
6816
  /** @internal */
@@ -6865,7 +6837,7 @@ class SequentialImpl {
6865
6837
  const sequentialCollectionMake = map => new SequentialImpl(map);
6866
6838
  /** @internal */
6867
6839
  const sequentialCollectionCombine = (self, that) => new SequentialImpl(reduce$2(that.map, self.map, (map, value, key) => set$1(map, key, match$3(get$2(map, key), {
6868
- onNone: () => empty$g(),
6840
+ onNone: () => empty$h(),
6869
6841
  onSome: a => appendAll$1(a, value)
6870
6842
  }))));
6871
6843
  /** @internal */
@@ -6955,13 +6927,13 @@ const proto$1 = {
6955
6927
  // Constructors
6956
6928
  // -----------------------------------------------------------------------------
6957
6929
  /** @internal */
6958
- const empty$6 = /*#__PURE__*/(() => {
6930
+ const empty$7 = /*#__PURE__*/(() => {
6959
6931
  const o = /*#__PURE__*/Object.create(proto$1);
6960
6932
  o._tag = OP_EMPTY$2;
6961
6933
  return o;
6962
6934
  })();
6963
6935
  /** @internal */
6964
- const fail$1 = error => {
6936
+ const fail$2 = error => {
6965
6937
  const o = Object.create(proto$1);
6966
6938
  o._tag = OP_FAIL$1;
6967
6939
  o.error = error;
@@ -6975,7 +6947,7 @@ const die$1 = defect => {
6975
6947
  return o;
6976
6948
  };
6977
6949
  /** @internal */
6978
- const interrupt = fiberId => {
6950
+ const interrupt$1 = fiberId => {
6979
6951
  const o = Object.create(proto$1);
6980
6952
  o._tag = OP_INTERRUPT;
6981
6953
  o.fiberId = fiberId;
@@ -7005,7 +6977,7 @@ const isCause = u => hasProperty(u, CauseTypeId);
7005
6977
  /** @internal */
7006
6978
  const isEmptyType = self => self._tag === OP_EMPTY$2;
7007
6979
  /** @internal */
7008
- const isEmpty = self => {
6980
+ const isEmpty$1 = self => {
7009
6981
  if (self._tag === OP_EMPTY$2) {
7010
6982
  return true;
7011
6983
  }
@@ -7033,11 +7005,11 @@ const isInterrupted = self => isSome(interruptOption(self));
7033
7005
  /** @internal */
7034
7006
  const isInterruptedOnly = self => reduceWithContext(undefined, IsInterruptedOnlyCauseReducer)(self);
7035
7007
  /** @internal */
7036
- const failures = self => reverse$1(reduce(self, empty$g(), (list, cause) => cause._tag === OP_FAIL$1 ? some(pipe(list, prepend$1(cause.error))) : none$4()));
7008
+ const failures = self => reverse$1(reduce(self, empty$h(), (list, cause) => cause._tag === OP_FAIL$1 ? some(pipe(list, prepend$1(cause.error))) : none$4()));
7037
7009
  /** @internal */
7038
- const defects = self => reverse$1(reduce(self, empty$g(), (list, cause) => cause._tag === OP_DIE ? some(pipe(list, prepend$1(cause.defect))) : none$4()));
7010
+ const defects = self => reverse$1(reduce(self, empty$h(), (list, cause) => cause._tag === OP_DIE ? some(pipe(list, prepend$1(cause.defect))) : none$4()));
7039
7011
  /** @internal */
7040
- const interruptors = self => reduce(self, empty$d(), (set, cause) => cause._tag === OP_INTERRUPT ? some(pipe(set, add(cause.fiberId))) : none$4());
7012
+ const interruptors = self => reduce(self, empty$e(), (set, cause) => cause._tag === OP_INTERRUPT ? some(pipe(set, add(cause.fiberId))) : none$4());
7041
7013
  /** @internal */
7042
7014
  const failureOption = self => find(self, cause => cause._tag === OP_FAIL$1 ? some(cause.error) : none$4());
7043
7015
  /** @internal */
@@ -7058,29 +7030,20 @@ const failureOrCause = self => {
7058
7030
  /** @internal */
7059
7031
  const interruptOption = self => find(self, cause => cause._tag === OP_INTERRUPT ? some(cause.fiberId) : none$4());
7060
7032
  /** @internal */
7061
- const keepDefectsAndElectFailures = self => match$1(self, {
7062
- onEmpty: none$4(),
7063
- onFail: failure => some(die$1(failure)),
7064
- onDie: defect => some(die$1(defect)),
7065
- onInterrupt: () => none$4(),
7066
- onSequential: mergeWith(sequential$2),
7067
- onParallel: mergeWith(parallel$2)
7068
- });
7069
- /** @internal */
7070
7033
  const stripFailures = self => match$1(self, {
7071
- onEmpty: empty$6,
7072
- onFail: () => empty$6,
7034
+ onEmpty: empty$7,
7035
+ onFail: () => empty$7,
7073
7036
  onDie: die$1,
7074
- onInterrupt: interrupt,
7037
+ onInterrupt: interrupt$1,
7075
7038
  onSequential: sequential$2,
7076
7039
  onParallel: parallel$2
7077
7040
  });
7078
7041
  /** @internal */
7079
7042
  const electFailures = self => match$1(self, {
7080
- onEmpty: empty$6,
7043
+ onEmpty: empty$7,
7081
7044
  onFail: die$1,
7082
7045
  onDie: die$1,
7083
- onInterrupt: interrupt,
7046
+ onInterrupt: interrupt$1,
7084
7047
  onSequential: sequential$2,
7085
7048
  onParallel: parallel$2
7086
7049
  });
@@ -7089,11 +7052,11 @@ const causeEquals = (left, right) => {
7089
7052
  let leftStack = of$1(left);
7090
7053
  let rightStack = of$1(right);
7091
7054
  while (isNonEmpty(leftStack) && isNonEmpty(rightStack)) {
7092
- const [leftParallel, leftSequential] = pipe(headNonEmpty(leftStack), reduce([empty$d(), empty$g()], ([parallel, sequential], cause) => {
7055
+ const [leftParallel, leftSequential] = pipe(headNonEmpty(leftStack), reduce([empty$e(), empty$h()], ([parallel, sequential], cause) => {
7093
7056
  const [par, seq] = evaluateCause(cause);
7094
7057
  return some([pipe(parallel, union(par)), pipe(sequential, appendAll$1(seq))]);
7095
7058
  }));
7096
- const [rightParallel, rightSequential] = pipe(headNonEmpty(rightStack), reduce([empty$d(), empty$g()], ([parallel, sequential], cause) => {
7059
+ const [rightParallel, rightSequential] = pipe(headNonEmpty(rightStack), reduce([empty$e(), empty$h()], ([parallel, sequential], cause) => {
7097
7060
  const [par, seq] = evaluateCause(cause);
7098
7061
  return some([pipe(parallel, union(par)), pipe(sequential, appendAll$1(seq))]);
7099
7062
  }));
@@ -7116,18 +7079,18 @@ const causeEquals = (left, right) => {
7116
7079
  * @internal
7117
7080
  */
7118
7081
  const flattenCause = cause => {
7119
- return flattenCauseLoop(of$1(cause), empty$g());
7082
+ return flattenCauseLoop(of$1(cause), empty$h());
7120
7083
  };
7121
7084
  /** @internal */
7122
7085
  const flattenCauseLoop = (causes, flattened) => {
7123
7086
  // eslint-disable-next-line no-constant-condition
7124
7087
  while (1) {
7125
- const [parallel, sequential] = pipe(causes, reduce$6([empty$d(), empty$g()], ([parallel, sequential], cause) => {
7088
+ const [parallel, sequential] = pipe(causes, reduce$6([empty$e(), empty$h()], ([parallel, sequential], cause) => {
7126
7089
  const [par, seq] = evaluateCause(cause);
7127
7090
  return [pipe(parallel, union(par)), pipe(sequential, appendAll$1(seq))];
7128
7091
  }));
7129
7092
  const updated = size$1(parallel) > 0 ? pipe(flattened, prepend$1(parallel)) : flattened;
7130
- if (isEmpty$3(sequential)) {
7093
+ if (isEmpty$4(sequential)) {
7131
7094
  return reverse$1(updated);
7132
7095
  }
7133
7096
  causes = sequential;
@@ -7178,8 +7141,8 @@ const find = /*#__PURE__*/dual(2, (self, pf) => {
7178
7141
  const evaluateCause = self => {
7179
7142
  let cause = self;
7180
7143
  const stack = [];
7181
- let _parallel = empty$d();
7182
- let _sequential = empty$g();
7144
+ let _parallel = empty$e();
7145
+ let _sequential = empty$h();
7183
7146
  while (cause !== undefined) {
7184
7147
  switch (cause._tag) {
7185
7148
  case OP_EMPTY$2:
@@ -7192,7 +7155,7 @@ const evaluateCause = self => {
7192
7155
  }
7193
7156
  case OP_FAIL$1:
7194
7157
  {
7195
- _parallel = add(_parallel, make$i(cause._tag, cause.error));
7158
+ _parallel = add(_parallel, make$l(cause._tag, cause.error));
7196
7159
  if (stack.length === 0) {
7197
7160
  return [_parallel, _sequential];
7198
7161
  }
@@ -7201,7 +7164,7 @@ const evaluateCause = self => {
7201
7164
  }
7202
7165
  case OP_DIE:
7203
7166
  {
7204
- _parallel = add(_parallel, make$i(cause._tag, cause.defect));
7167
+ _parallel = add(_parallel, make$l(cause._tag, cause.defect));
7205
7168
  if (stack.length === 0) {
7206
7169
  return [_parallel, _sequential];
7207
7170
  }
@@ -7210,7 +7173,7 @@ const evaluateCause = self => {
7210
7173
  }
7211
7174
  case OP_INTERRUPT:
7212
7175
  {
7213
- _parallel = add(_parallel, make$i(cause._tag, cause.fiberId));
7176
+ _parallel = add(_parallel, make$l(cause._tag, cause.fiberId));
7214
7177
  if (stack.length === 0) {
7215
7178
  return [_parallel, _sequential];
7216
7179
  }
@@ -7570,14 +7533,14 @@ const deferredVariance = {
7570
7533
  _A: _ => _
7571
7534
  };
7572
7535
  /** @internal */
7573
- const pending = joiners => {
7536
+ const pending$1 = joiners => {
7574
7537
  return {
7575
7538
  _tag: OP_STATE_PENDING,
7576
7539
  joiners
7577
7540
  };
7578
7541
  };
7579
7542
  /** @internal */
7580
- const done$2 = effect => {
7543
+ const done$3 = effect => {
7581
7544
  return {
7582
7545
  _tag: OP_STATE_DONE,
7583
7546
  effect
@@ -7789,8 +7752,8 @@ const withFiberRuntime = withRuntime => {
7789
7752
  return effect;
7790
7753
  };
7791
7754
  /* @internal */
7792
- const acquireUseRelease = /*#__PURE__*/dual(3, (acquire, use, release) => uninterruptibleMask$1(restore => flatMap$1(acquire, a => flatMap$1(exit(suspend(() => restore(use(a)))), exit => {
7793
- return suspend(() => release(a, exit)).pipe(matchCauseEffect$1({
7755
+ const acquireUseRelease = /*#__PURE__*/dual(3, (acquire, use, release) => uninterruptibleMask$1(restore => flatMap$1(acquire, a => flatMap$1(exit(suspend$1(() => restore(use(a)))), exit => {
7756
+ return suspend$1(() => release(a, exit)).pipe(matchCauseEffect$1({
7794
7757
  onFailure: cause => {
7795
7758
  switch (exit._tag) {
7796
7759
  case OP_FAILURE:
@@ -7803,7 +7766,7 @@ const acquireUseRelease = /*#__PURE__*/dual(3, (acquire, use, release) => uninte
7803
7766
  }));
7804
7767
  }))));
7805
7768
  /* @internal */
7806
- const as = /*#__PURE__*/dual(2, (self, value) => flatMap$1(self, () => succeed$2(value)));
7769
+ const as = /*#__PURE__*/dual(2, (self, value) => flatMap$1(self, () => succeed$3(value)));
7807
7770
  /* @internal */
7808
7771
  const asVoid = self => as(self, void 0);
7809
7772
  /* @internal */
@@ -7849,7 +7812,7 @@ const unsafeAsync = (register, blockingOn = none$2) => {
7849
7812
  return onInterrupt(effect, _ => isEffect(cancelerRef) ? cancelerRef : void_$1);
7850
7813
  };
7851
7814
  /* @internal */
7852
- const asyncInterrupt = (register, blockingOn = none$2) => suspend(() => unsafeAsync(register, blockingOn));
7815
+ const asyncInterrupt = (register, blockingOn = none$2) => suspend$1(() => unsafeAsync(register, blockingOn));
7853
7816
  const async_ = (resume, blockingOn = none$2) => {
7854
7817
  return custom(resume, function () {
7855
7818
  let backingResume = undefined;
@@ -7888,7 +7851,7 @@ const async_ = (resume, blockingOn = none$2) => {
7888
7851
  /* @internal */
7889
7852
  const catchAll$1 = /*#__PURE__*/dual(2, (self, f) => matchEffect(self, {
7890
7853
  onFailure: f,
7891
- onSuccess: succeed$2
7854
+ onSuccess: succeed$3
7892
7855
  }));
7893
7856
  const originalSymbol = /*#__PURE__*/Symbol.for("effect/OriginalAnnotation");
7894
7857
  /* @internal */
@@ -7918,8 +7881,8 @@ const die = defect => isObject(defect) && !(spanSymbol in defect) ? withFiberRun
7918
7881
  const dieMessage = message => failCauseSync(() => die$1(new RuntimeException(message)));
7919
7882
  /* @internal */
7920
7883
  const either = self => matchEffect(self, {
7921
- onFailure: e => succeed$2(left(e)),
7922
- onSuccess: a => succeed$2(right(a))
7884
+ onFailure: e => succeed$3(left(e)),
7885
+ onSuccess: a => succeed$3(right(a))
7923
7886
  });
7924
7887
  /* @internal */
7925
7888
  const exit = self => matchCause(self, {
@@ -7927,9 +7890,9 @@ const exit = self => matchCause(self, {
7927
7890
  onSuccess: exitSucceed$1
7928
7891
  });
7929
7892
  /* @internal */
7930
- const fail = error => isObject(error) && !(spanSymbol in error) ? withFiberRuntime(fiber => failCause$1(fail$1(capture(error, currentSpanFromFiber(fiber))))) : failCause$1(fail$1(error));
7893
+ const fail$1 = error => isObject(error) && !(spanSymbol in error) ? withFiberRuntime(fiber => failCause$1(fail$2(capture(error, currentSpanFromFiber(fiber))))) : failCause$1(fail$2(error));
7931
7894
  /* @internal */
7932
- const failSync = evaluate => flatMap$1(sync(evaluate), fail);
7895
+ const failSync = evaluate => flatMap$1(sync(evaluate), fail$1);
7933
7896
  /* @internal */
7934
7897
  const failCause$1 = cause => {
7935
7898
  const effect = new EffectPrimitiveFailure(OP_FAILURE);
@@ -7939,7 +7902,7 @@ const failCause$1 = cause => {
7939
7902
  /* @internal */
7940
7903
  const failCauseSync = evaluate => flatMap$1(sync(evaluate), failCause$1);
7941
7904
  /* @internal */
7942
- const fiberId = /*#__PURE__*/withFiberRuntime(state => succeed$2(state.id()));
7905
+ const fiberId = /*#__PURE__*/withFiberRuntime(state => succeed$3(state.id()));
7943
7906
  /* @internal */
7944
7907
  const fiberIdWith = f => withFiberRuntime(state => f(state.id()));
7945
7908
  /* @internal */
@@ -7959,8 +7922,8 @@ const step = self => {
7959
7922
  const flatten = self => flatMap$1(self, identity);
7960
7923
  /* @internal */
7961
7924
  const matchCause = /*#__PURE__*/dual(2, (self, options) => matchCauseEffect$1(self, {
7962
- onFailure: cause => succeed$2(options.onFailure(cause)),
7963
- onSuccess: a => succeed$2(options.onSuccess(a))
7925
+ onFailure: cause => succeed$3(options.onFailure(cause)),
7926
+ onSuccess: a => succeed$3(options.onSuccess(a))
7964
7927
  }));
7965
7928
  /* @internal */
7966
7929
  const matchCauseEffect$1 = /*#__PURE__*/dual(2, (self, options) => {
@@ -7986,7 +7949,7 @@ const matchEffect = /*#__PURE__*/dual(2, (self, options) => matchCauseEffect$1(s
7986
7949
  onSuccess: options.onSuccess
7987
7950
  }));
7988
7951
  /* @internal */
7989
- const forEachSequential = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
7952
+ const forEachSequential = /*#__PURE__*/dual(2, (self, f) => suspend$1(() => {
7990
7953
  const arr = fromIterable$6(self);
7991
7954
  const ret = allocate(arr.length);
7992
7955
  let i = 0;
@@ -7999,7 +7962,7 @@ const forEachSequential = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
7999
7962
  }), ret);
8000
7963
  }));
8001
7964
  /* @internal */
8002
- const forEachSequentialDiscard = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
7965
+ const forEachSequentialDiscard = /*#__PURE__*/dual(2, (self, f) => suspend$1(() => {
8003
7966
  const arr = fromIterable$6(self);
8004
7967
  let i = 0;
8005
7968
  return whileLoop({
@@ -8011,7 +7974,7 @@ const forEachSequentialDiscard = /*#__PURE__*/dual(2, (self, f) => suspend(() =>
8011
7974
  });
8012
7975
  }));
8013
7976
  /* @internal */
8014
- const interruptWith = fiberId => failCause$1(interrupt(fiberId));
7977
+ const interruptWith = fiberId => failCause$1(interrupt$1(fiberId));
8015
7978
  /* @internal */
8016
7979
  const interruptible$1 = self => {
8017
7980
  const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
@@ -8041,7 +8004,7 @@ const mapError = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self, {
8041
8004
  }
8042
8005
  }
8043
8006
  },
8044
- onSuccess: succeed$2
8007
+ onSuccess: succeed$3
8045
8008
  }));
8046
8009
  /* @internal */
8047
8010
  const onExit$1 = /*#__PURE__*/dual(2, (self, cleanup) => uninterruptibleMask$1(restore => matchCauseEffect$1(restore(self), {
@@ -8063,15 +8026,13 @@ const onInterrupt = /*#__PURE__*/dual(2, (self, cleanup) => onExit$1(self, exitM
8063
8026
  onSuccess: () => void_$1
8064
8027
  })));
8065
8028
  /* @internal */
8066
- const orElse = /*#__PURE__*/dual(2, (self, that) => attemptOrElse(self, that, succeed$2));
8067
- /* @internal */
8068
- const succeed$2 = value => {
8029
+ const succeed$3 = value => {
8069
8030
  const effect = new EffectPrimitiveSuccess(OP_SUCCESS);
8070
8031
  effect.effect_instruction_i0 = value;
8071
8032
  return effect;
8072
8033
  };
8073
8034
  /* @internal */
8074
- const suspend = evaluate => {
8035
+ const suspend$1 = evaluate => {
8075
8036
  const effect = new EffectPrimitive(OP_COMMIT);
8076
8037
  effect.commit = evaluate;
8077
8038
  return effect;
@@ -8089,10 +8050,10 @@ const tap = /*#__PURE__*/dual(args => args.length === 3 || args.length === 2 &&
8089
8050
  return as(b, a);
8090
8051
  } else if (isPromiseLike(b)) {
8091
8052
  return unsafeAsync(resume => {
8092
- b.then(_ => resume(succeed$2(a)), e => resume(fail(new UnknownException(e, "An unknown error occurred in Effect.tap"))));
8053
+ b.then(_ => resume(succeed$3(a)), e => resume(fail$1(new UnknownException(e, "An unknown error occurred in Effect.tap"))));
8093
8054
  });
8094
8055
  }
8095
- return succeed$2(a);
8056
+ return succeed$3(a);
8096
8057
  }));
8097
8058
  /* @internal */
8098
8059
  const transplant = f => withFiberRuntime(state => {
@@ -8101,17 +8062,6 @@ const transplant = f => withFiberRuntime(state => {
8101
8062
  return f(fiberRefLocally(currentForkScopeOverride, some(scope)));
8102
8063
  });
8103
8064
  /* @internal */
8104
- const attemptOrElse = /*#__PURE__*/dual(3, (self, that, onSuccess) => matchCauseEffect$1(self, {
8105
- onFailure: cause => {
8106
- const defects$1 = defects(cause);
8107
- if (defects$1.length > 0) {
8108
- return failCause$1(getOrThrow(keepDefectsAndElectFailures(cause)));
8109
- }
8110
- return that();
8111
- },
8112
- onSuccess
8113
- }));
8114
- /* @internal */
8115
8065
  const uninterruptible = self => {
8116
8066
  const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
8117
8067
  effect.effect_instruction_i0 = disable(Interruption);
@@ -8125,7 +8075,7 @@ const uninterruptibleMask$1 = f => custom(f, function () {
8125
8075
  effect.effect_instruction_i1 = oldFlags => interruption(oldFlags) ? internalCall(() => this.effect_instruction_i0(interruptible$1)) : internalCall(() => this.effect_instruction_i0(uninterruptible));
8126
8076
  return effect;
8127
8077
  });
8128
- const void_$1 = /*#__PURE__*/succeed$2(void 0);
8078
+ const void_$1 = /*#__PURE__*/succeed$3(void 0);
8129
8079
  /* @internal */
8130
8080
  const updateRuntimeFlags = patch => {
8131
8081
  const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
@@ -8142,15 +8092,15 @@ const whileLoop = options => {
8142
8092
  return effect;
8143
8093
  };
8144
8094
  /* @internal */
8145
- const fromIterator = iterator => suspend(() => {
8095
+ const fromIterator$1 = iterator => suspend$1(() => {
8146
8096
  const effect = new EffectPrimitive(OP_ITERATOR);
8147
8097
  effect.effect_instruction_i0 = iterator();
8148
8098
  return effect;
8149
8099
  });
8150
8100
  /* @internal */
8151
- const gen$1 = function () {
8101
+ const gen$2 = function () {
8152
8102
  const f = arguments.length === 1 ? arguments[0] : arguments[1].bind(arguments[0]);
8153
- return fromIterator(() => f(pipe));
8103
+ return fromIterator$1(() => f(pipe));
8154
8104
  };
8155
8105
  /* @internal */
8156
8106
  const yieldNow$2 = options => {
@@ -8274,7 +8224,7 @@ const fiberRefSet = /*#__PURE__*/dual(2, (self, value) => fiberRefModify(self, (
8274
8224
  const fiberRefModify = /*#__PURE__*/dual(2, (self, f) => withFiberRuntime(state => {
8275
8225
  const [b, a] = f(state.getFiberRef(self));
8276
8226
  state.setFiberRef(self, a);
8277
- return succeed$2(b);
8227
+ return succeed$3(b);
8278
8228
  }));
8279
8229
  /* @internal */
8280
8230
  const fiberRefLocally = /*#__PURE__*/dual(3, (use, self, value) => acquireUseRelease(zipLeft(fiberRefGet(self), fiberRefSet(self, value)), () => use, oldValue => fiberRefSet(self, oldValue)));
@@ -8331,17 +8281,17 @@ const fiberRefUnsafeMakeRuntimeFlags = initial => fiberRefUnsafeMakePatch(initia
8331
8281
  fork: differ$1.empty
8332
8282
  });
8333
8283
  /** @internal */
8334
- const currentContext = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentContext"), () => fiberRefUnsafeMakeContext(empty$h()));
8284
+ const currentContext = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentContext"), () => fiberRefUnsafeMakeContext(empty$i()));
8335
8285
  /** @internal */
8336
8286
  const currentSchedulingPriority = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentSchedulingPriority"), () => fiberRefUnsafeMake(0));
8337
8287
  /** @internal */
8338
8288
  const currentMaxOpsBeforeYield = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"), () => fiberRefUnsafeMake(2048));
8339
8289
  /** @internal */
8340
- const currentLogAnnotations = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogAnnotation"), () => fiberRefUnsafeMake(empty$c()));
8290
+ const currentLogAnnotations = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogAnnotation"), () => fiberRefUnsafeMake(empty$d()));
8341
8291
  /** @internal */
8342
8292
  const currentLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogLevel"), () => fiberRefUnsafeMake(logLevelInfo));
8343
8293
  /** @internal */
8344
- const currentLogSpan = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogSpan"), () => fiberRefUnsafeMake(empty$b()));
8294
+ const currentLogSpan = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogSpan"), () => fiberRefUnsafeMake(empty$c()));
8345
8295
  /** @internal */
8346
8296
  const withSchedulingPriority = /*#__PURE__*/dual(2, (self, scheduler) => fiberRefLocally(self, currentSchedulingPriority, scheduler));
8347
8297
  /** @internal */
@@ -8355,15 +8305,15 @@ const currentUnhandledErrorLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symb
8355
8305
  /** @internal */
8356
8306
  const currentVersionMismatchErrorLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"), () => fiberRefUnsafeMake(some(logLevelWarning)));
8357
8307
  /** @internal */
8358
- const currentMetricLabels = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentMetricLabels"), () => fiberRefUnsafeMakeReadonlyArray(empty$j()));
8308
+ const currentMetricLabels = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentMetricLabels"), () => fiberRefUnsafeMakeReadonlyArray(empty$k()));
8359
8309
  /** @internal */
8360
8310
  const currentForkScopeOverride = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentForkScopeOverride"), () => fiberRefUnsafeMake(none$4(), {
8361
8311
  fork: () => none$4(),
8362
8312
  join: (parent, _) => parent
8363
8313
  }));
8364
8314
  /** @internal */
8365
- const currentInterruptedCause = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentInterruptedCause"), () => fiberRefUnsafeMake(empty$6, {
8366
- fork: () => empty$6,
8315
+ const currentInterruptedCause = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentInterruptedCause"), () => fiberRefUnsafeMake(empty$7, {
8316
+ fork: () => empty$7,
8367
8317
  join: (parent, _) => parent
8368
8318
  }));
8369
8319
  /* @internal */
@@ -8379,7 +8329,7 @@ const scopeFork = (self, strategy) => self.fork(strategy);
8379
8329
  const YieldableError = /*#__PURE__*/function () {
8380
8330
  class YieldableError extends globalThis.Error {
8381
8331
  commit() {
8382
- return fail(this);
8332
+ return fail$1(this);
8383
8333
  }
8384
8334
  toJSON() {
8385
8335
  const obj = {
@@ -8393,7 +8343,7 @@ const YieldableError = /*#__PURE__*/function () {
8393
8343
  if (this.toString !== globalThis.Error.prototype.toString) {
8394
8344
  return this.stack ? `${this.toString()}\n${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
8395
8345
  } else if ("Bun" in globalThis) {
8396
- return pretty(fail$1(this), {
8346
+ return pretty(fail$2(this), {
8397
8347
  renderErrorCause: true
8398
8348
  });
8399
8349
  }
@@ -8456,9 +8406,7 @@ const exitIsExit = u => isEffect(u) && "_tag" in u && (u._tag === "Success" || u
8456
8406
  /** @internal */
8457
8407
  const exitCollectAll = (exits, options) => exitCollectAllInternal(exits, options?.parallel ? parallel$2 : sequential$2);
8458
8408
  /** @internal */
8459
- const exitDie$1 = defect => exitFailCause$1(die$1(defect));
8460
- /** @internal */
8461
- const exitFail = error => exitFailCause$1(fail$1(error));
8409
+ const exitFail = error => exitFailCause$1(fail$2(error));
8462
8410
  /** @internal */
8463
8411
  const exitFailCause$1 = cause => {
8464
8412
  const effect = new EffectPrimitiveFailure(OP_FAILURE);
@@ -8466,7 +8414,7 @@ const exitFailCause$1 = cause => {
8466
8414
  return effect;
8467
8415
  };
8468
8416
  /** @internal */
8469
- const exitInterrupt$1 = fiberId => exitFailCause$1(interrupt(fiberId));
8417
+ const exitInterrupt$1 = fiberId => exitFailCause$1(interrupt$1(fiberId));
8470
8418
  /** @internal */
8471
8419
  const exitMap = /*#__PURE__*/dual(2, (self, f) => {
8472
8420
  switch (self._tag) {
@@ -8542,7 +8490,7 @@ const deferredUnsafeMake = fiberId => {
8542
8490
  const _deferred = {
8543
8491
  ...CommitPrototype,
8544
8492
  [DeferredTypeId]: deferredVariance,
8545
- state: make$d(pending([])),
8493
+ state: make$g(pending$1([])),
8546
8494
  commit() {
8547
8495
  return deferredAwait(this);
8548
8496
  },
@@ -8576,7 +8524,7 @@ const deferredCompleteWith = /*#__PURE__*/dual(2, (self, effect) => sync(() => {
8576
8524
  }
8577
8525
  case OP_STATE_PENDING:
8578
8526
  {
8579
- set$2(self.state, done$2(effect));
8527
+ set$2(self.state, done$3(effect));
8580
8528
  for (let i = 0, len = state.joiners.length; i < len; i++) {
8581
8529
  state.joiners[i](effect);
8582
8530
  }
@@ -8592,7 +8540,7 @@ const deferredInterrupt = self => flatMap$1(fiberId, fiberId => deferredComplete
8592
8540
  const deferredUnsafeDone = (self, effect) => {
8593
8541
  const state = get$3(self.state);
8594
8542
  if (state._tag === OP_STATE_PENDING) {
8595
- set$2(self.state, done$2(effect));
8543
+ set$2(self.state, done$3(effect));
8596
8544
  for (let i = 0, len = state.joiners.length; i < len; i++) {
8597
8545
  state.joiners[i](effect);
8598
8546
  }
@@ -8629,9 +8577,43 @@ const currentSpanFromFiber = fiber => {
8629
8577
  return span !== undefined && span._tag === "Span" ? some(span) : none$4();
8630
8578
  };
8631
8579
 
8632
- const TypeId$2 = /*#__PURE__*/Symbol.for("effect/MutableHashMap");
8580
+ const _await = deferredAwait;
8581
+ /**
8582
+ * Exits the `Deferred` with the specified `Exit` value, which will be
8583
+ * propagated to all fibers waiting on the value of the `Deferred`.
8584
+ *
8585
+ * @since 2.0.0
8586
+ * @category utils
8587
+ */
8588
+ const done$2 = deferredDone;
8589
+ /**
8590
+ * Completes the `Deferred` with interruption. This will interrupt all fibers
8591
+ * waiting on the value of the `Deferred` with the `FiberId` of the fiber
8592
+ * calling this method.
8593
+ *
8594
+ * @since 2.0.0
8595
+ * @category utils
8596
+ */
8597
+ const interrupt = deferredInterrupt;
8598
+ /**
8599
+ * Unsafely creates a new `Deferred` from the specified `FiberId`.
8600
+ *
8601
+ * @since 2.0.0
8602
+ * @category unsafe
8603
+ */
8604
+ const unsafeMake$3 = deferredUnsafeMake;
8605
+
8606
+ /**
8607
+ * Constructs a new `Exit.Success` containing the specified value of type `A`.
8608
+ *
8609
+ * @since 2.0.0
8610
+ * @category constructors
8611
+ */
8612
+ const succeed$2 = exitSucceed$1;
8613
+
8614
+ const TypeId$4 = /*#__PURE__*/Symbol.for("effect/MutableHashMap");
8633
8615
  const MutableHashMapProto = {
8634
- [TypeId$2]: TypeId$2,
8616
+ [TypeId$4]: TypeId$4,
8635
8617
  [Symbol.iterator]() {
8636
8618
  return new MutableHashMapIterator(this);
8637
8619
  },
@@ -8700,7 +8682,7 @@ class BucketIterator {
8700
8682
  * @since 2.0.0
8701
8683
  * @category constructors
8702
8684
  */
8703
- const empty$5 = () => {
8685
+ const empty$6 = () => {
8704
8686
  const self = Object.create(MutableHashMapProto);
8705
8687
  self.referential = new Map();
8706
8688
  self.buckets = new Map();
@@ -8772,7 +8754,7 @@ const removeFromBucket = (self, bucket, key) => {
8772
8754
  /**
8773
8755
  * @since 2.0.0
8774
8756
  */
8775
- const remove = /*#__PURE__*/dual(2, (self, key) => {
8757
+ const remove$1 = /*#__PURE__*/dual(2, (self, key) => {
8776
8758
  if (isEqual(key) === false) {
8777
8759
  self.referential.delete(key);
8778
8760
  return self;
@@ -8796,6 +8778,224 @@ const size = self => {
8796
8778
  return self.referential.size + self.bucketsSize;
8797
8779
  };
8798
8780
 
8781
+ /**
8782
+ * @since 2.0.0
8783
+ */
8784
+ const TypeId$3 = /*#__PURE__*/Symbol.for("effect/MutableList");
8785
+ const MutableListProto = {
8786
+ [TypeId$3]: TypeId$3,
8787
+ [Symbol.iterator]() {
8788
+ let done = false;
8789
+ let head = this.head;
8790
+ return {
8791
+ next() {
8792
+ if (done) {
8793
+ return this.return();
8794
+ }
8795
+ if (head == null) {
8796
+ done = true;
8797
+ return this.return();
8798
+ }
8799
+ const value = head.value;
8800
+ head = head.next;
8801
+ return {
8802
+ done,
8803
+ value
8804
+ };
8805
+ },
8806
+ return(value) {
8807
+ if (!done) {
8808
+ done = true;
8809
+ }
8810
+ return {
8811
+ done: true,
8812
+ value
8813
+ };
8814
+ }
8815
+ };
8816
+ },
8817
+ toString() {
8818
+ return format$2(this.toJSON());
8819
+ },
8820
+ toJSON() {
8821
+ return {
8822
+ _id: "MutableList",
8823
+ values: Array.from(this).map(toJSON)
8824
+ };
8825
+ },
8826
+ [NodeInspectSymbol]() {
8827
+ return this.toJSON();
8828
+ },
8829
+ pipe() {
8830
+ return pipeArguments(this, arguments);
8831
+ }
8832
+ };
8833
+ /** @internal */
8834
+ const makeNode = value => ({
8835
+ value,
8836
+ removed: false,
8837
+ prev: undefined,
8838
+ next: undefined
8839
+ });
8840
+ /**
8841
+ * Creates an empty `MutableList`.
8842
+ *
8843
+ * @since 2.0.0
8844
+ * @category constructors
8845
+ */
8846
+ const empty$5 = () => {
8847
+ const list = Object.create(MutableListProto);
8848
+ list.head = undefined;
8849
+ list.tail = undefined;
8850
+ list._length = 0;
8851
+ return list;
8852
+ };
8853
+ /**
8854
+ * Returns `true` if the list contains zero elements, `false`, otherwise.
8855
+ *
8856
+ * @since 2.0.0
8857
+ * @category getters
8858
+ */
8859
+ const isEmpty = self => length(self) === 0;
8860
+ /**
8861
+ * Returns the length of the list.
8862
+ *
8863
+ * @since 2.0.0
8864
+ * @category getters
8865
+ */
8866
+ const length = self => self._length;
8867
+ /**
8868
+ * Appends the specified element to the end of the `MutableList`.
8869
+ *
8870
+ * @category concatenating
8871
+ * @since 2.0.0
8872
+ */
8873
+ const append = /*#__PURE__*/dual(2, (self, value) => {
8874
+ const node = makeNode(value);
8875
+ if (self.head === undefined) {
8876
+ self.head = node;
8877
+ }
8878
+ if (self.tail === undefined) {
8879
+ self.tail = node;
8880
+ } else {
8881
+ self.tail.next = node;
8882
+ node.prev = self.tail;
8883
+ self.tail = node;
8884
+ }
8885
+ self._length += 1;
8886
+ return self;
8887
+ });
8888
+ /**
8889
+ * Removes the first value from the list and returns it, if it exists.
8890
+ *
8891
+ * @since 0.0.1
8892
+ */
8893
+ const shift = self => {
8894
+ const head = self.head;
8895
+ if (head !== undefined) {
8896
+ remove(self, head);
8897
+ return head.value;
8898
+ }
8899
+ return undefined;
8900
+ };
8901
+ const remove = (self, node) => {
8902
+ if (node.removed) {
8903
+ return;
8904
+ }
8905
+ node.removed = true;
8906
+ if (node.prev !== undefined && node.next !== undefined) {
8907
+ node.prev.next = node.next;
8908
+ node.next.prev = node.prev;
8909
+ } else if (node.prev !== undefined) {
8910
+ self.tail = node.prev;
8911
+ node.prev.next = undefined;
8912
+ } else if (node.next !== undefined) {
8913
+ self.head = node.next;
8914
+ node.next.prev = undefined;
8915
+ } else {
8916
+ self.tail = undefined;
8917
+ self.head = undefined;
8918
+ }
8919
+ if (self._length > 0) {
8920
+ self._length -= 1;
8921
+ }
8922
+ };
8923
+
8924
+ /**
8925
+ * @since 2.0.0
8926
+ */
8927
+ const TypeId$2 = /*#__PURE__*/Symbol.for("effect/MutableQueue");
8928
+ /**
8929
+ * @since 2.0.0
8930
+ * @category symbol
8931
+ */
8932
+ const EmptyMutableQueue = /*#__PURE__*/Symbol.for("effect/mutable/MutableQueue/Empty");
8933
+ const MutableQueueProto = {
8934
+ [TypeId$2]: TypeId$2,
8935
+ [Symbol.iterator]() {
8936
+ return Array.from(this.queue)[Symbol.iterator]();
8937
+ },
8938
+ toString() {
8939
+ return format$2(this.toJSON());
8940
+ },
8941
+ toJSON() {
8942
+ return {
8943
+ _id: "MutableQueue",
8944
+ values: Array.from(this).map(toJSON)
8945
+ };
8946
+ },
8947
+ [NodeInspectSymbol]() {
8948
+ return this.toJSON();
8949
+ },
8950
+ pipe() {
8951
+ return pipeArguments(this, arguments);
8952
+ }
8953
+ };
8954
+ const make$c = capacity => {
8955
+ const queue = Object.create(MutableQueueProto);
8956
+ queue.queue = empty$5();
8957
+ queue.capacity = capacity;
8958
+ return queue;
8959
+ };
8960
+ /**
8961
+ * Creates a new unbounded `MutableQueue`.
8962
+ *
8963
+ * @since 2.0.0
8964
+ * @category constructors
8965
+ */
8966
+ const unbounded = () => make$c(undefined);
8967
+ /**
8968
+ * Offers an element to the queue.
8969
+ *
8970
+ * Returns whether the enqueue was successful or not.
8971
+ *
8972
+ * @since 2.0.0
8973
+ */
8974
+ const offer = /*#__PURE__*/dual(2, (self, value) => {
8975
+ const queueLength = length(self.queue);
8976
+ if (self.capacity !== undefined && queueLength === self.capacity) {
8977
+ return false;
8978
+ }
8979
+ append(value)(self.queue);
8980
+ return true;
8981
+ });
8982
+ /**
8983
+ * Dequeues an element from the queue.
8984
+ *
8985
+ * Returns either an element from the queue, or the `def` param.
8986
+ *
8987
+ * **Note**: if there is no meaningful default for your type, you can always
8988
+ * use `poll(MutableQueue.EmptyMutableQueue)`.
8989
+ *
8990
+ * @since 2.0.0
8991
+ */
8992
+ const poll = /*#__PURE__*/dual(2, (self, def) => {
8993
+ if (isEmpty(self.queue)) {
8994
+ return def;
8995
+ }
8996
+ return shift(self.queue);
8997
+ });
8998
+
8799
8999
  /** @internal */
8800
9000
  const ClockSymbolKey = "effect/Clock";
8801
9001
  /** @internal */
@@ -8857,7 +9057,7 @@ class ClockImpl {
8857
9057
  currentTimeMillis = /*#__PURE__*/sync(() => this.unsafeCurrentTimeMillis());
8858
9058
  currentTimeNanos = /*#__PURE__*/sync(() => this.unsafeCurrentTimeNanos());
8859
9059
  scheduler() {
8860
- return succeed$2(globalClockScheduler);
9060
+ return succeed$3(globalClockScheduler);
8861
9061
  }
8862
9062
  sleep(duration) {
8863
9063
  return async_(resume => {
@@ -8867,7 +9067,7 @@ class ClockImpl {
8867
9067
  }
8868
9068
  }
8869
9069
  /** @internal */
8870
- const make$9 = () => new ClockImpl();
9070
+ const make$b = () => new ClockImpl();
8871
9071
 
8872
9072
  /** @internal */
8873
9073
  const OP_AND = "And";
@@ -9114,7 +9314,7 @@ const FlatConfigProviderSymbolKey = "effect/ConfigProviderFlat";
9114
9314
  /** @internal */
9115
9315
  const FlatConfigProviderTypeId = /*#__PURE__*/Symbol.for(FlatConfigProviderSymbolKey);
9116
9316
  /** @internal */
9117
- const make$8 = options => ({
9317
+ const make$a = options => ({
9118
9318
  [ConfigProviderTypeId]: ConfigProviderTypeId,
9119
9319
  pipe() {
9120
9320
  return pipeArguments(this, arguments);
@@ -9129,10 +9329,10 @@ const makeFlat = options => ({
9129
9329
  enumerateChildren: options.enumerateChildren
9130
9330
  });
9131
9331
  /** @internal */
9132
- const fromFlat = flat => make$8({
9133
- load: config => flatMap$1(fromFlatLoop(flat, empty$j(), config, false), chunk => match$3(head(chunk), {
9134
- onNone: () => fail(MissingData(empty$j(), `Expected a single value having structure: ${config}`)),
9135
- onSome: succeed$2
9332
+ const fromFlat = flat => make$a({
9333
+ load: config => flatMap$1(fromFlatLoop(flat, empty$k(), config, false), chunk => match$3(head(chunk), {
9334
+ onNone: () => fail$1(MissingData(empty$k(), `Expected a single value having structure: ${config}`)),
9335
+ onSome: succeed$3
9136
9336
  })),
9137
9337
  flattened: flat
9138
9338
  });
@@ -9200,57 +9400,57 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9200
9400
  switch (op._tag) {
9201
9401
  case OP_CONSTANT:
9202
9402
  {
9203
- return succeed$2(of$2(op.value));
9403
+ return succeed$3(of$2(op.value));
9204
9404
  }
9205
9405
  case OP_DESCRIBED:
9206
9406
  {
9207
- return suspend(() => fromFlatLoop(flat, prefix, op.config, split));
9407
+ return suspend$1(() => fromFlatLoop(flat, prefix, op.config, split));
9208
9408
  }
9209
9409
  case OP_FAIL:
9210
9410
  {
9211
- return fail(MissingData(prefix, op.message));
9411
+ return fail$1(MissingData(prefix, op.message));
9212
9412
  }
9213
9413
  case OP_FALLBACK:
9214
9414
  {
9215
- return pipe(suspend(() => fromFlatLoop(flat, prefix, op.first, split)), catchAll$1(error1 => {
9415
+ return pipe(suspend$1(() => fromFlatLoop(flat, prefix, op.first, split)), catchAll$1(error1 => {
9216
9416
  if (op.condition(error1)) {
9217
- return pipe(fromFlatLoop(flat, prefix, op.second, split), catchAll$1(error2 => fail(Or(error1, error2))));
9417
+ return pipe(fromFlatLoop(flat, prefix, op.second, split), catchAll$1(error2 => fail$1(Or(error1, error2))));
9218
9418
  }
9219
- return fail(error1);
9419
+ return fail$1(error1);
9220
9420
  }));
9221
9421
  }
9222
9422
  case OP_LAZY:
9223
9423
  {
9224
- return suspend(() => fromFlatLoop(flat, prefix, op.config(), split));
9424
+ return suspend$1(() => fromFlatLoop(flat, prefix, op.config(), split));
9225
9425
  }
9226
9426
  case OP_MAP_OR_FAIL:
9227
9427
  {
9228
- return suspend(() => pipe(fromFlatLoop(flat, prefix, op.original, split), flatMap$1(forEachSequential(a => pipe(op.mapOrFail(a), mapError(prefixed(appendConfigPath(prefix, op.original))))))));
9428
+ return suspend$1(() => pipe(fromFlatLoop(flat, prefix, op.original, split), flatMap$1(forEachSequential(a => pipe(op.mapOrFail(a), mapError(prefixed(appendConfigPath(prefix, op.original))))))));
9229
9429
  }
9230
9430
  case OP_NESTED:
9231
9431
  {
9232
- return suspend(() => fromFlatLoop(flat, concat(prefix, of$2(op.name)), op.config, split));
9432
+ return suspend$1(() => fromFlatLoop(flat, concat(prefix, of$2(op.name)), op.config, split));
9233
9433
  }
9234
9434
  case OP_PRIMITIVE:
9235
9435
  {
9236
9436
  return pipe(patch$3(prefix, flat.patch), flatMap$1(prefix => pipe(flat.load(prefix, op, split), flatMap$1(values => {
9237
9437
  if (values.length === 0) {
9238
9438
  const name = pipe(last(prefix), getOrElse(() => "<n/a>"));
9239
- return fail(MissingData([], `Expected ${op.description} with name ${name}`));
9439
+ return fail$1(MissingData([], `Expected ${op.description} with name ${name}`));
9240
9440
  }
9241
- return succeed$2(values);
9441
+ return succeed$3(values);
9242
9442
  }))));
9243
9443
  }
9244
9444
  case OP_SEQUENCE:
9245
9445
  {
9246
9446
  return pipe(patch$3(prefix, flat.patch), flatMap$1(patchedPrefix => pipe(flat.enumerateChildren(patchedPrefix), flatMap$1(indicesFrom), flatMap$1(indices => {
9247
9447
  if (indices.length === 0) {
9248
- return suspend(() => map(fromFlatLoop(flat, prefix, op.config, true), of$2));
9448
+ return suspend$1(() => map(fromFlatLoop(flat, prefix, op.config, true), of$2));
9249
9449
  }
9250
- return pipe(forEachSequential(indices, index => fromFlatLoop(flat, append$1(prefix, `[${index}]`), op.config, true)), map(chunkChunk => {
9450
+ return pipe(forEachSequential(indices, index => fromFlatLoop(flat, append$2(prefix, `[${index}]`), op.config, true)), map(chunkChunk => {
9251
9451
  const flattened = flatten$2(chunkChunk);
9252
9452
  if (flattened.length === 0) {
9253
- return of$2(empty$j());
9453
+ return of$2(empty$k());
9254
9454
  }
9255
9455
  return of$2(flattened);
9256
9456
  }));
@@ -9258,10 +9458,10 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9258
9458
  }
9259
9459
  case OP_HASHMAP:
9260
9460
  {
9261
- return suspend(() => pipe(patch$3(prefix, flat.patch), flatMap$1(prefix => pipe(flat.enumerateChildren(prefix), flatMap$1(keys => {
9461
+ return suspend$1(() => pipe(patch$3(prefix, flat.patch), flatMap$1(prefix => pipe(flat.enumerateChildren(prefix), flatMap$1(keys => {
9262
9462
  return pipe(keys, forEachSequential(key => fromFlatLoop(flat, concat(prefix, of$2(key)), op.valueConfig, split)), map(matrix => {
9263
9463
  if (matrix.length === 0) {
9264
- return of$2(empty$c());
9464
+ return of$2(empty$d());
9265
9465
  }
9266
9466
  return pipe(transpose(matrix), map$3(values => fromIterable$1(zip$1(fromIterable$6(keys), values))));
9267
9467
  }));
@@ -9269,15 +9469,15 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9269
9469
  }
9270
9470
  case OP_ZIP_WITH:
9271
9471
  {
9272
- return suspend(() => pipe(fromFlatLoop(flat, prefix, op.left, split), either, flatMap$1(left => pipe(fromFlatLoop(flat, prefix, op.right, split), either, flatMap$1(right$1 => {
9472
+ return suspend$1(() => pipe(fromFlatLoop(flat, prefix, op.left, split), either, flatMap$1(left => pipe(fromFlatLoop(flat, prefix, op.right, split), either, flatMap$1(right$1 => {
9273
9473
  if (isLeft(left) && isLeft(right$1)) {
9274
- return fail(And(left.left, right$1.left));
9474
+ return fail$1(And(left.left, right$1.left));
9275
9475
  }
9276
9476
  if (isLeft(left) && isRight(right$1)) {
9277
- return fail(left.left);
9477
+ return fail$1(left.left);
9278
9478
  }
9279
9479
  if (isRight(left) && isLeft(right$1)) {
9280
- return fail(right$1.left);
9480
+ return fail$1(right$1.left);
9281
9481
  }
9282
9482
  if (isRight(left) && isRight(right$1)) {
9283
9483
  const path = pipe(prefix, join$1("."));
@@ -9308,7 +9508,7 @@ const transpose = array => {
9308
9508
  return Object.keys(array[0]).map(column => array.map(row => row[column]));
9309
9509
  };
9310
9510
  const indicesFrom = quotedIndices => pipe(forEachSequential(quotedIndices, parseQuotedIndex), mapBoth({
9311
- onFailure: () => empty$j(),
9511
+ onFailure: () => empty$k(),
9312
9512
  onSuccess: sort(Order$1)
9313
9513
  }), either, map(merge$3));
9314
9514
  const QUOTED_INDEX_REGEX = /^(\[(\d+)\])$/;
@@ -9450,7 +9650,7 @@ class RandomImpl {
9450
9650
  }
9451
9651
  }
9452
9652
  const shuffleWith = (elements, nextIntBounded) => {
9453
- return suspend(() => pipe(sync(() => Array.from(elements)), flatMap$1(buffer => {
9653
+ return suspend$1(() => pipe(sync(() => Array.from(elements)), flatMap$1(buffer => {
9454
9654
  const numbers = [];
9455
9655
  for (let i = buffer.length; i >= 2; i = i - 1) {
9456
9656
  numbers.push(i);
@@ -9464,7 +9664,7 @@ const swap = (buffer, index1, index2) => {
9464
9664
  buffer[index2] = tmp;
9465
9665
  return buffer;
9466
9666
  };
9467
- const make$7 = seed => new RandomImpl(hash(seed));
9667
+ const make$9 = seed => new RandomImpl(hash(seed));
9468
9668
 
9469
9669
  /**
9470
9670
  * @since 2.0.0
@@ -9472,7 +9672,7 @@ const make$7 = seed => new RandomImpl(hash(seed));
9472
9672
  /** @internal */
9473
9673
  const TracerTypeId = /*#__PURE__*/Symbol.for("effect/Tracer");
9474
9674
  /** @internal */
9475
- const make$6 = options => ({
9675
+ const make$8 = options => ({
9476
9676
  [TracerTypeId]: TracerTypeId,
9477
9677
  ...options
9478
9678
  });
@@ -9541,13 +9741,13 @@ class NativeSpan {
9541
9741
  }
9542
9742
  }
9543
9743
  /** @internal */
9544
- const nativeTracer = /*#__PURE__*/make$6({
9744
+ const nativeTracer = /*#__PURE__*/make$8({
9545
9745
  span: (name, parent, context, links, startTime, kind) => new NativeSpan(name, parent, context, links, startTime, kind),
9546
9746
  context: f => f()
9547
9747
  });
9548
9748
 
9549
9749
  /** @internal */
9550
- const liveServices = /*#__PURE__*/pipe(/*#__PURE__*/empty$h(), /*#__PURE__*/add$2(clockTag, /*#__PURE__*/make$9()), /*#__PURE__*/add$2(consoleTag, defaultConsole), /*#__PURE__*/add$2(randomTag, /*#__PURE__*/make$7(/*#__PURE__*/Math.random())), /*#__PURE__*/add$2(configProviderTag, /*#__PURE__*/fromEnv()), /*#__PURE__*/add$2(tracerTag, nativeTracer));
9750
+ const liveServices = /*#__PURE__*/pipe(/*#__PURE__*/empty$i(), /*#__PURE__*/add$2(clockTag, /*#__PURE__*/make$b()), /*#__PURE__*/add$2(consoleTag, defaultConsole), /*#__PURE__*/add$2(randomTag, /*#__PURE__*/make$9(/*#__PURE__*/Math.random())), /*#__PURE__*/add$2(configProviderTag, /*#__PURE__*/fromEnv()), /*#__PURE__*/add$2(tracerTag, nativeTracer));
9551
9751
  /**
9552
9752
  * The `FiberRef` holding the default `Effect` services.
9553
9753
  *
@@ -9996,30 +10196,12 @@ class MetricLabelImpl {
9996
10196
  }
9997
10197
  }
9998
10198
  /** @internal */
9999
- const make$5 = (key, value) => {
10199
+ const make$7 = (key, value) => {
10000
10200
  return new MetricLabelImpl(key, value);
10001
10201
  };
10002
10202
  /** @internal */
10003
10203
  const isMetricLabel = u => hasProperty(u, MetricLabelTypeId);
10004
10204
 
10005
- /* @internal */
10006
- const try_$1 = arg => {
10007
- let evaluate;
10008
- let onFailure = undefined;
10009
- if (typeof arg === "function") {
10010
- evaluate = arg;
10011
- } else {
10012
- evaluate = arg.try;
10013
- onFailure = arg.catch;
10014
- }
10015
- return suspend(() => {
10016
- try {
10017
- return succeed$2(internalCall(evaluate));
10018
- } catch (error) {
10019
- return fail(onFailure ? internalCall(() => onFailure(error)) : new UnknownException(error, "An unknown error occurred in Effect.try"));
10020
- }
10021
- });
10022
- };
10023
10205
  /* @internal */
10024
10206
  const clockWith = clockWith$1;
10025
10207
  /** @internal */
@@ -10039,7 +10221,7 @@ const logWithLevel = level => (...message) => {
10039
10221
  }
10040
10222
  }
10041
10223
  if (cause === undefined) {
10042
- cause = empty$6;
10224
+ cause = empty$7;
10043
10225
  }
10044
10226
  return withFiberRuntime(fiberState => {
10045
10227
  fiberState.log(message, cause, levelOption);
@@ -10051,8 +10233,6 @@ const logWarning$1 = /*#__PURE__*/logWithLevel(Warning);
10051
10233
  /** @internal */
10052
10234
  const logError$1 = /*#__PURE__*/logWithLevel(Error$2);
10053
10235
  /* @internal */
10054
- const orElseSucceed$1 = /*#__PURE__*/dual(2, (self, evaluate) => orElse(self, () => sync(evaluate)));
10055
- /* @internal */
10056
10236
  const tapError$1 = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self, {
10057
10237
  onFailure: cause => {
10058
10238
  const either = failureOrCause(cause);
@@ -10063,38 +10243,10 @@ const tapError$1 = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self, {
10063
10243
  return failCause$1(cause);
10064
10244
  }
10065
10245
  },
10066
- onSuccess: succeed$2
10246
+ onSuccess: succeed$3
10067
10247
  }));
10068
10248
  /* @internal */
10069
- const tryPromise$1 = arg => {
10070
- let evaluate;
10071
- let catcher = undefined;
10072
- if (typeof arg === "function") {
10073
- evaluate = arg;
10074
- } else {
10075
- evaluate = arg.try;
10076
- catcher = arg.catch;
10077
- }
10078
- const fail$1 = e => catcher ? failSync(() => catcher(e)) : fail(new UnknownException(e, "An unknown error occurred in Effect.tryPromise"));
10079
- if (evaluate.length >= 1) {
10080
- return async_((resolve, signal) => {
10081
- try {
10082
- evaluate(signal).then(a => resolve(succeed$2(a)), e => resolve(fail$1(e)));
10083
- } catch (e) {
10084
- resolve(fail$1(e));
10085
- }
10086
- });
10087
- }
10088
- return async_(resolve => {
10089
- try {
10090
- evaluate().then(a => resolve(succeed$2(a)), e => resolve(fail$1(e)));
10091
- } catch (e) {
10092
- resolve(fail$1(e));
10093
- }
10094
- });
10095
- };
10096
- /* @internal */
10097
- const when = /*#__PURE__*/dual(2, (self, condition) => suspend(() => condition() ? map(self, some) : succeed$2(none$4())));
10249
+ const when = /*#__PURE__*/dual(2, (self, condition) => suspend$1(() => condition() ? map(self, some) : succeed$3(none$4())));
10098
10250
 
10099
10251
  /** @internal */
10100
10252
  const OP_SEQUENTIAL = "Sequential";
@@ -10311,6 +10463,19 @@ class MicroCauseImpl extends globalThis.Error {
10311
10463
  return this.stack;
10312
10464
  }
10313
10465
  }
10466
+ class Fail extends MicroCauseImpl {
10467
+ error;
10468
+ constructor(error, traces = []) {
10469
+ super("Fail", error, traces);
10470
+ this.error = error;
10471
+ }
10472
+ }
10473
+ /**
10474
+ * @since 3.4.6
10475
+ * @experimental
10476
+ * @category MicroCause
10477
+ */
10478
+ const causeFail = (error, traces = []) => new Fail(error, traces);
10314
10479
  class Die extends MicroCauseImpl {
10315
10480
  defect;
10316
10481
  constructor(defect, traces = []) {
@@ -10595,6 +10760,30 @@ const failCause = /*#__PURE__*/makeExit({
10595
10760
  return cont ? cont[failureCont](this[args], fiber) : fiber.yieldWith(this);
10596
10761
  }
10597
10762
  });
10763
+ /**
10764
+ * Creates a `Micro` effect that fails with the given error.
10765
+ *
10766
+ * This results in a `Fail` variant of the `MicroCause` type, where the error is
10767
+ * tracked at the type level.
10768
+ *
10769
+ * @since 3.4.0
10770
+ * @experimental
10771
+ * @category constructors
10772
+ */
10773
+ const fail = error => failCause(causeFail(error));
10774
+ /**
10775
+ * Lazily creates a `Micro` effect from the given side-effect.
10776
+ *
10777
+ * @since 3.4.0
10778
+ * @experimental
10779
+ * @category constructors
10780
+ */
10781
+ const suspend = /*#__PURE__*/makePrimitive({
10782
+ op: "Suspend",
10783
+ eval(_fiber) {
10784
+ return this[args]();
10785
+ }
10786
+ });
10598
10787
  /**
10599
10788
  * Pause the execution of the current `Micro` effect, and resume it on the next
10600
10789
  * scheduler tick.
@@ -10626,6 +10815,38 @@ const yieldNowWith = /*#__PURE__*/makePrimitive({
10626
10815
  */
10627
10816
  const yieldNow$1 = /*#__PURE__*/yieldNowWith(0);
10628
10817
  const void_ = /*#__PURE__*/succeed$1(void 0);
10818
+ const try_ = options => suspend(() => {
10819
+ try {
10820
+ return succeed$1(options.try());
10821
+ } catch (err) {
10822
+ return fail(options.catch(err));
10823
+ }
10824
+ });
10825
+ /**
10826
+ * Wrap a `Promise` into a `Micro` effect. Any errors will be caught and
10827
+ * converted into a specific error type.
10828
+ *
10829
+ * @example
10830
+ * ```ts
10831
+ * import { Micro } from "effect"
10832
+ *
10833
+ * Micro.tryPromise({
10834
+ * try: () => Promise.resolve("success"),
10835
+ * catch: (cause) => new Error("caught", { cause })
10836
+ * })
10837
+ * ```
10838
+ *
10839
+ * @since 3.4.0
10840
+ * @experimental
10841
+ * @category constructors
10842
+ */
10843
+ const tryPromise = options => asyncOptions(function (resume, signal) {
10844
+ try {
10845
+ options.try(signal).then(a => resume(succeed$1(a)), e => resume(fail(options.catch(e))));
10846
+ } catch (err) {
10847
+ resume(fail(options.catch(err)));
10848
+ }
10849
+ }, options.try.length !== 0);
10629
10850
  /**
10630
10851
  * Create a `Micro` effect using the current `MicroFiber`.
10631
10852
  *
@@ -10639,6 +10860,69 @@ const withMicroFiber = /*#__PURE__*/makePrimitive({
10639
10860
  return this[args](fiber);
10640
10861
  }
10641
10862
  });
10863
+ const asyncOptions = /*#__PURE__*/makePrimitive({
10864
+ op: "Async",
10865
+ single: false,
10866
+ eval(fiber) {
10867
+ const register = this[args][0];
10868
+ let resumed = false;
10869
+ let yielded = false;
10870
+ const controller = this[args][1] ? new AbortController() : undefined;
10871
+ const onCancel = register(effect => {
10872
+ if (resumed) return;
10873
+ resumed = true;
10874
+ if (yielded) {
10875
+ fiber.evaluate(effect);
10876
+ } else {
10877
+ yielded = effect;
10878
+ }
10879
+ }, controller?.signal);
10880
+ if (yielded !== false) return yielded;
10881
+ yielded = true;
10882
+ fiber._yielded = () => {
10883
+ resumed = true;
10884
+ };
10885
+ if (controller === undefined && onCancel === undefined) {
10886
+ return Yield;
10887
+ }
10888
+ fiber._stack.push(asyncFinalizer(() => {
10889
+ resumed = true;
10890
+ controller?.abort();
10891
+ return onCancel ?? exitVoid;
10892
+ }));
10893
+ return Yield;
10894
+ }
10895
+ });
10896
+ const asyncFinalizer = /*#__PURE__*/makePrimitive({
10897
+ op: "AsyncFinalizer",
10898
+ ensure(fiber) {
10899
+ if (fiber.interruptible) {
10900
+ fiber.interruptible = false;
10901
+ fiber._stack.push(setInterruptible(true));
10902
+ }
10903
+ },
10904
+ contE(cause, _fiber) {
10905
+ return causeIsInterrupt(cause) ? flatMap(this[args](), () => failCause(cause)) : failCause(cause);
10906
+ }
10907
+ });
10908
+ /**
10909
+ * @since 3.4.0
10910
+ * @experimental
10911
+ * @category constructors
10912
+ */
10913
+ const gen$1 = (...args) => suspend(() => fromIterator(args.length === 1 ? args[0]() : args[1].call(args[0])));
10914
+ const fromIterator = /*#__PURE__*/makePrimitive({
10915
+ op: "Iterator",
10916
+ contA(value, fiber) {
10917
+ const state = this[args].next(value);
10918
+ if (state.done) return succeed$1(state.value);
10919
+ fiber._stack.push(this);
10920
+ return yieldWrapGet(state.value);
10921
+ },
10922
+ eval(fiber) {
10923
+ return this[successCont](undefined, fiber);
10924
+ }
10925
+ });
10642
10926
  /**
10643
10927
  * Map the success value of this `Micro` effect to another `Micro` effect, then
10644
10928
  * flatten the result.
@@ -11014,51 +11298,6 @@ class MixedScheduler {
11014
11298
  * @category schedulers
11015
11299
  */
11016
11300
  const defaultScheduler = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Scheduler/defaultScheduler"), () => new MixedScheduler(2048));
11017
- /**
11018
- * @since 2.0.0
11019
- * @category constructors
11020
- */
11021
- class SyncScheduler {
11022
- /**
11023
- * @since 2.0.0
11024
- */
11025
- tasks = /*#__PURE__*/new PriorityBuckets();
11026
- /**
11027
- * @since 2.0.0
11028
- */
11029
- deferred = false;
11030
- /**
11031
- * @since 2.0.0
11032
- */
11033
- scheduleTask(task, priority) {
11034
- if (this.deferred) {
11035
- defaultScheduler.scheduleTask(task, priority);
11036
- } else {
11037
- this.tasks.scheduleTask(task, priority);
11038
- }
11039
- }
11040
- /**
11041
- * @since 2.0.0
11042
- */
11043
- shouldYield(fiber) {
11044
- return fiber.currentOpCount > fiber.getFiberRef(currentMaxOpsBeforeYield) ? fiber.getFiberRef(currentSchedulingPriority) : false;
11045
- }
11046
- /**
11047
- * @since 2.0.0
11048
- */
11049
- flush() {
11050
- while (this.tasks.buckets.length > 0) {
11051
- const tasks = this.tasks.buckets;
11052
- this.tasks.buckets = [];
11053
- for (const [_, toRun] of tasks) {
11054
- for (let i = 0; i < toRun.length; i++) {
11055
- toRun[i]();
11056
- }
11057
- }
11058
- }
11059
- this.deferred = true;
11060
- }
11061
- }
11062
11301
  /** @internal */
11063
11302
  const currentScheduler = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentScheduler"), () => fiberRefUnsafeMake(defaultScheduler));
11064
11303
 
@@ -11587,7 +11826,7 @@ const metricHookVariance = {
11587
11826
  _Out: _ => _
11588
11827
  };
11589
11828
  /** @internal */
11590
- const make$4 = options => ({
11829
+ const make$6 = options => ({
11591
11830
  [MetricHookTypeId]: metricHookVariance,
11592
11831
  pipe() {
11593
11832
  return pipeArguments(this, arguments);
@@ -11604,7 +11843,7 @@ const counter$1 = key => {
11604
11843
  sum = sum + value;
11605
11844
  }
11606
11845
  };
11607
- return make$4({
11846
+ return make$6({
11608
11847
  get: () => counter$2(sum),
11609
11848
  update,
11610
11849
  modify: update
@@ -11620,7 +11859,7 @@ const frequency = key => {
11620
11859
  const slotCount = values.get(word) ?? 0;
11621
11860
  values.set(word, slotCount + 1);
11622
11861
  };
11623
- return make$4({
11862
+ return make$6({
11624
11863
  get: () => frequency$1(values),
11625
11864
  update,
11626
11865
  modify: update
@@ -11629,7 +11868,7 @@ const frequency = key => {
11629
11868
  /** @internal */
11630
11869
  const gauge = (_key, startAt) => {
11631
11870
  let value = startAt;
11632
- return make$4({
11871
+ return make$6({
11633
11872
  get: () => gauge$1(value),
11634
11873
  update: v => {
11635
11874
  value = v;
@@ -11699,7 +11938,7 @@ const histogram$1 = key => {
11699
11938
  }
11700
11939
  return builder;
11701
11940
  };
11702
- return make$4({
11941
+ return make$6({
11703
11942
  get: () => histogram$2({
11704
11943
  buckets: getBuckets(),
11705
11944
  count,
@@ -11766,7 +12005,7 @@ const summary = key => {
11766
12005
  count = count + 1;
11767
12006
  sum = sum + value;
11768
12007
  };
11769
- return make$4({
12008
+ return make$6({
11770
12009
  get: () => summary$1({
11771
12010
  error,
11772
12011
  quantiles: snapshot(Date.now()),
@@ -11784,7 +12023,7 @@ const calculateQuantiles = (error, sortedQuantiles, sortedSamples) => {
11784
12023
  // The number of samples examined
11785
12024
  const sampleCount = sortedSamples.length;
11786
12025
  if (!isNonEmptyReadonlyArray(sortedQuantiles)) {
11787
- return empty$j();
12026
+ return empty$k();
11788
12027
  }
11789
12028
  const head = sortedQuantiles[0];
11790
12029
  const tail = sortedQuantiles.slice(1);
@@ -11945,7 +12184,7 @@ const MetricRegistryTypeId = /*#__PURE__*/Symbol.for(MetricRegistrySymbolKey);
11945
12184
  /** @internal */
11946
12185
  class MetricRegistryImpl {
11947
12186
  [MetricRegistryTypeId] = MetricRegistryTypeId;
11948
- map = /*#__PURE__*/empty$5();
12187
+ map = /*#__PURE__*/empty$6();
11949
12188
  snapshot() {
11950
12189
  const result = [];
11951
12190
  for (const [key, hook] of this.map) {
@@ -12033,7 +12272,7 @@ class MetricRegistryImpl {
12033
12272
  }
12034
12273
  }
12035
12274
  /** @internal */
12036
- const make$3 = () => {
12275
+ const make$5 = () => {
12037
12276
  return new MetricRegistryImpl();
12038
12277
  };
12039
12278
 
@@ -12050,9 +12289,9 @@ const metricVariance = {
12050
12289
  _Out: _ => _
12051
12290
  };
12052
12291
  /** @internal */
12053
- const globalMetricRegistry = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Metric/globalMetricRegistry"), () => make$3());
12292
+ const globalMetricRegistry = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Metric/globalMetricRegistry"), () => make$5());
12054
12293
  /** @internal */
12055
- const make$2 = function (keyType, unsafeUpdate, unsafeValue, unsafeModify) {
12294
+ const make$4 = function (keyType, unsafeUpdate, unsafeValue, unsafeModify) {
12056
12295
  const metric = Object.assign(effect => tap(effect, a => update(metric, a)), {
12057
12296
  [MetricTypeId]: metricVariance,
12058
12297
  keyType,
@@ -12091,21 +12330,21 @@ const fromMetricKey = key => {
12091
12330
  hookCache.set(extraTags, hook);
12092
12331
  return hook;
12093
12332
  };
12094
- return make$2(key.keyType, (input, extraTags) => hook(extraTags).update(input), extraTags => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
12333
+ return make$4(key.keyType, (input, extraTags) => hook(extraTags).update(input), extraTags => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
12095
12334
  };
12096
12335
  /** @internal */
12097
12336
  const histogram = (name, boundaries, description) => fromMetricKey(histogram$3(name, boundaries, description));
12098
12337
  /** @internal */
12099
- const tagged = /*#__PURE__*/dual(3, (self, key, value) => taggedWithLabels(self, [make$5(key, value)]));
12338
+ const tagged = /*#__PURE__*/dual(3, (self, key, value) => taggedWithLabels(self, [make$7(key, value)]));
12100
12339
  /** @internal */
12101
12340
  const taggedWithLabels = /*#__PURE__*/dual(2, (self, extraTags) => {
12102
- return make$2(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, union$2(extraTags, extraTags1)), extraTags1 => self.unsafeValue(union$2(extraTags, extraTags1)), (input, extraTags1) => self.unsafeModify(input, union$2(extraTags, extraTags1)));
12341
+ return make$4(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, union$2(extraTags, extraTags1)), extraTags1 => self.unsafeValue(union$2(extraTags, extraTags1)), (input, extraTags1) => self.unsafeModify(input, union$2(extraTags, extraTags1)));
12103
12342
  });
12104
12343
  /* @internal */
12105
12344
  const update = /*#__PURE__*/dual(2, (self, input) => fiberRefGetWith(currentMetricLabels, tags => sync(() => self.unsafeUpdate(input, tags))));
12106
12345
 
12107
12346
  /** @internal */
12108
- const complete = /*#__PURE__*/dual(2, (self, result) => fiberRefGetWith(currentRequestMap, map => sync(() => {
12347
+ const complete$1 = /*#__PURE__*/dual(2, (self, result) => fiberRefGetWith(currentRequestMap, map => sync(() => {
12109
12348
  if (map.has(self)) {
12110
12349
  const entry = map.get(self);
12111
12350
  if (!entry.state.completed) {
@@ -12248,7 +12487,7 @@ const none = /*#__PURE__*/globalValue("effect/Supervisor/none", () => fromEffect
12248
12487
  * @since 2.0.0
12249
12488
  * @category constructors
12250
12489
  */
12251
- const make$1 = make$c;
12490
+ const make$3 = make$f;
12252
12491
 
12253
12492
  /** @internal */
12254
12493
  const OP_EMPTY = "Empty";
@@ -12335,12 +12574,12 @@ const removeSupervisor = (self, that) => {
12335
12574
  /** @internal */
12336
12575
  const toSet = self => {
12337
12576
  if (equals$1(self, none)) {
12338
- return empty$d();
12577
+ return empty$e();
12339
12578
  } else {
12340
12579
  if (isZip(self)) {
12341
12580
  return pipe(toSet(self.left), union(toSet(self.right)));
12342
12581
  } else {
12343
- return make$e(self);
12582
+ return make$h(self);
12344
12583
  }
12345
12584
  }
12346
12585
  };
@@ -12362,7 +12601,7 @@ const diff = (oldValue, newValue) => {
12362
12601
  return combine(added, removed);
12363
12602
  };
12364
12603
  /** @internal */
12365
- const differ = /*#__PURE__*/make$1({
12604
+ const differ = /*#__PURE__*/make$3({
12366
12605
  empty,
12367
12606
  patch,
12368
12607
  combine,
@@ -12602,7 +12841,7 @@ class FiberRuntime extends Class {
12602
12841
  * without locks or immutable data.
12603
12842
  */
12604
12843
  ask(f) {
12605
- return suspend(() => {
12844
+ return suspend$1(() => {
12606
12845
  const deferred = deferredUnsafeMake(this._fiberId);
12607
12846
  this.tell(stateful((fiber, status) => {
12608
12847
  deferredUnsafeDone(deferred, sync(() => f(fiber, status)));
@@ -12622,7 +12861,7 @@ class FiberRuntime extends Class {
12622
12861
  }
12623
12862
  get await() {
12624
12863
  return async_(resume => {
12625
- const cb = exit => resume(succeed$2(exit));
12864
+ const cb = exit => resume(succeed$3(exit));
12626
12865
  this.tell(stateful((fiber, _) => {
12627
12866
  if (fiber._exitValue !== null) {
12628
12867
  cb(this._exitValue);
@@ -12668,13 +12907,13 @@ class FiberRuntime extends Class {
12668
12907
  * In the background, interrupts the fiber as if interrupted from the specified fiber.
12669
12908
  */
12670
12909
  interruptAsFork(fiberId) {
12671
- return sync(() => this.tell(interruptSignal(interrupt(fiberId))));
12910
+ return sync(() => this.tell(interruptSignal(interrupt$1(fiberId))));
12672
12911
  }
12673
12912
  /**
12674
12913
  * In the background, interrupts the fiber as if interrupted from the specified fiber.
12675
12914
  */
12676
12915
  unsafeInterruptAsFork(fiberId) {
12677
- this.tell(interruptSignal(interrupt(fiberId)));
12916
+ this.tell(interruptSignal(interrupt$1(fiberId)));
12678
12917
  }
12679
12918
  /**
12680
12919
  * Adds an observer to the list of observers.
@@ -12868,7 +13107,7 @@ class FiberRuntime extends Class {
12868
13107
  * log annotations and log level) may not be up-to-date.
12869
13108
  */
12870
13109
  isInterrupted() {
12871
- return !isEmpty(this.getFiberRef(currentInterruptedCause));
13110
+ return !isEmpty$1(this.getFiberRef(currentInterruptedCause));
12872
13111
  }
12873
13112
  /**
12874
13113
  * Adds an interruptor to the set of interruptors that are interrupting this
@@ -12902,7 +13141,7 @@ class FiberRuntime extends Class {
12902
13141
  }
12903
13142
  let told = false;
12904
13143
  for (const child of this._children) {
12905
- child.tell(interruptSignal(interrupt(this.id())));
13144
+ child.tell(interruptSignal(interrupt$1(this.id())));
12906
13145
  told = true;
12907
13146
  }
12908
13147
  return told;
@@ -13213,10 +13452,10 @@ class FiberRuntime extends Class {
13213
13452
  return sync(() => unsafeGet$1(this.currentContext, op));
13214
13453
  }
13215
13454
  ["Left"](op) {
13216
- return fail(op.left);
13455
+ return fail$1(op.left);
13217
13456
  }
13218
13457
  ["None"](_) {
13219
- return fail(new NoSuchElementException());
13458
+ return fail$1(new NoSuchElementException());
13220
13459
  }
13221
13460
  ["Right"](op) {
13222
13461
  return exitSucceed$1(op.right);
@@ -13235,11 +13474,11 @@ class FiberRuntime extends Class {
13235
13474
  switch (exit.cause._tag) {
13236
13475
  case "Interrupt":
13237
13476
  {
13238
- return resume(exitFailCause$1(interrupt(none$2)));
13477
+ return resume(exitFailCause$1(interrupt$1(none$2)));
13239
13478
  }
13240
13479
  case "Fail":
13241
13480
  {
13242
- return resume(fail(exit.cause.error));
13481
+ return resume(fail$1(exit.cause.error));
13243
13482
  }
13244
13483
  case "Die":
13245
13484
  {
@@ -13458,7 +13697,7 @@ class FiberRuntime extends Class {
13458
13697
  const level = this.getFiberRef(currentVersionMismatchErrorLogLevel);
13459
13698
  if (level._tag === "Some") {
13460
13699
  const effectVersion = cur[EffectTypeId]._V;
13461
- this.log(`Executing an Effect versioned ${effectVersion} with a Runtime of version ${getCurrentVersion()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`, empty$6, level);
13700
+ this.log(`Executing an Effect versioned ${effectVersion} with a Runtime of version ${getCurrentVersion()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`, empty$7, level);
13462
13701
  }
13463
13702
  }
13464
13703
  // @ts-expect-error
@@ -13476,7 +13715,7 @@ class FiberRuntime extends Class {
13476
13715
  if (cur !== YieldedOp && !hasProperty(cur, "_op") || !(cur._op in this)) {
13477
13716
  cur = dieMessage(`Not a valid effect: ${toStringUnknown(cur)}`);
13478
13717
  } else if (isInterruptedException(e)) {
13479
- cur = exitFailCause$1(sequential$2(die$1(e), interrupt(none$2)));
13718
+ cur = exitFailCause$1(sequential$2(die$1(e), interrupt$1(none$2)));
13480
13719
  } else {
13481
13720
  cur = die(e);
13482
13721
  }
@@ -13525,7 +13764,7 @@ const tracerLogger = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Lo
13525
13764
  span.value.event(toStringUnknown(Array.isArray(message) && message.length === 1 ? message[0] : message), clockService.unsafeCurrentTimeNanos(), attributes);
13526
13765
  }));
13527
13766
  /** @internal */
13528
- const currentLoggers = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$e(defaultLogger, tracerLogger)));
13767
+ const currentLoggers = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$h(defaultLogger, tracerLogger)));
13529
13768
  // === all
13530
13769
  const allResolveInput = input => {
13531
13770
  if (Array.isArray(input) || isIterable(input)) {
@@ -13567,11 +13806,11 @@ const allValidate = (effects, reconcile, options) => {
13567
13806
  }
13568
13807
  }
13569
13808
  if (errored) {
13570
- return reconcile._tag === "Some" ? fail(reconcile.value(errors)) : fail(errors);
13809
+ return reconcile._tag === "Some" ? fail$1(reconcile.value(errors)) : fail$1(errors);
13571
13810
  } else if (options?.discard) {
13572
13811
  return void_$1;
13573
13812
  }
13574
- return reconcile._tag === "Some" ? succeed$2(reconcile.value(successes)) : succeed$2(successes);
13813
+ return reconcile._tag === "Some" ? succeed$3(reconcile.value(successes)) : succeed$3(successes);
13575
13814
  });
13576
13815
  };
13577
13816
  const allEither = (effects, reconcile, options) => {
@@ -13612,11 +13851,11 @@ const forEach = /*#__PURE__*/dual(args => isIterable(args[0]), (self, f, options
13612
13851
  return match(options?.concurrency, () => finalizersMaskInternal(sequential, options?.concurrentFinalizers)(restore => isRequestBatchingEnabled ? forEachParN(self, 1, (a, i) => restore(f(a, i)), true) : forEachSequential(self, (a, i) => restore(f(a, i)))), () => finalizersMaskInternal(parallel, options?.concurrentFinalizers)(restore => forEachParUnbounded(self, (a, i) => restore(f(a, i)), isRequestBatchingEnabled)), n => finalizersMaskInternal(parallelN(n), options?.concurrentFinalizers)(restore => forEachParN(self, n, (a, i) => restore(f(a, i)), isRequestBatchingEnabled)));
13613
13852
  }));
13614
13853
  /* @internal */
13615
- const forEachParUnbounded = (self, f, batching) => suspend(() => {
13854
+ const forEachParUnbounded = (self, f, batching) => suspend$1(() => {
13616
13855
  const as = fromIterable$6(self);
13617
13856
  const array = new Array(as.length);
13618
13857
  const fn = (a, i) => flatMap$1(f(a, i), b => sync(() => array[i] = b));
13619
- return zipRight(forEachConcurrentDiscard(as, fn, batching, false), succeed$2(array));
13858
+ return zipRight(forEachConcurrentDiscard(as, fn, batching, false), succeed$3(array));
13620
13859
  });
13621
13860
  /** @internal */
13622
13861
  const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterruptibleMask$1(restore => transplant(graft => withFiberRuntime(parent => {
@@ -13699,7 +13938,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
13699
13938
  return returnNextElement();
13700
13939
  }
13701
13940
  }
13702
- return succeed$2(res);
13941
+ return succeed$3(res);
13703
13942
  };
13704
13943
  const todo = flatMap$1(stepOrExit(restore(f(a, index))), onRes);
13705
13944
  const fiber = runFiber(todo);
@@ -13721,13 +13960,13 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
13721
13960
  fibers.delete(fiber);
13722
13961
  pushResult(exit, index);
13723
13962
  if (results.length === target) {
13724
- resume(succeed$2(getOrElse(exitCollectAll(collectExits(), {
13963
+ resume(succeed$3(getOrElse(exitCollectAll(collectExits(), {
13725
13964
  parallel: true
13726
13965
  }), () => exitVoid$1)));
13727
13966
  } else if (residual.length + results.length === target) {
13728
13967
  const exits = collectExits();
13729
13968
  const requests = residual.map(blocked => blocked.effect_instruction_i0).reduce(par);
13730
- resume(succeed$2(blocked(requests, forEachConcurrentDiscard([getOrElse(exitCollectAll(exits, {
13969
+ resume(succeed$3(blocked(requests, forEachConcurrentDiscard([getOrElse(exitCollectAll(exits, {
13731
13970
  parallel: true
13732
13971
  }), () => exitVoid$1), ...residual.map(blocked => blocked.effect_instruction_i1)], i => i, batching, true, n))));
13733
13972
  } else {
@@ -13773,11 +14012,11 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
13773
14012
  })));
13774
14013
  })));
13775
14014
  /* @internal */
13776
- const forEachParN = (self, n, f, batching) => suspend(() => {
14015
+ const forEachParN = (self, n, f, batching) => suspend$1(() => {
13777
14016
  const as = fromIterable$6(self);
13778
14017
  const array = new Array(as.length);
13779
14018
  const fn = (a, i) => map(f(a, i), b => array[i] = b);
13780
- return zipRight(forEachConcurrentDiscard(as, fn, batching, false, n), succeed$2(array));
14019
+ return zipRight(forEachConcurrentDiscard(as, fn, batching, false, n), succeed$3(array));
13781
14020
  });
13782
14021
  /* @internal */
13783
14022
  const forkDaemon = self => forkWithScopeOverride(self, globalScope);
@@ -13794,7 +14033,7 @@ const unsafeForkUnstarted = (effect, parentFiber, parentRuntimeFlags, overrideSc
13794
14033
  };
13795
14034
  /** @internal */
13796
14035
  const unsafeMakeChildFiber = (effect, parentFiber, parentRuntimeFlags, overrideScope = null) => {
13797
- const childId = unsafeMake$3();
14036
+ const childId = unsafeMake$4();
13798
14037
  const parentFiberRefs = parentFiber.getFiberRefs();
13799
14038
  const childFiberRefs = forkAs(parentFiberRefs, childId);
13800
14039
  const childFiber = new FiberRuntime(childId, childFiberRefs, parentRuntimeFlags);
@@ -13807,7 +14046,7 @@ const unsafeMakeChildFiber = (effect, parentFiber, parentRuntimeFlags, overrideS
13807
14046
  return childFiber;
13808
14047
  };
13809
14048
  /* @internal */
13810
- const forkWithScopeOverride = (self, scopeOverride) => withFiberRuntime((parentFiber, parentStatus) => succeed$2(unsafeFork$1(self, parentFiber, parentStatus.runtimeFlags, scopeOverride)));
14049
+ const forkWithScopeOverride = (self, scopeOverride) => withFiberRuntime((parentFiber, parentStatus) => succeed$3(unsafeFork$1(self, parentFiber, parentStatus.runtimeFlags, scopeOverride)));
13811
14050
  /* @internal */
13812
14051
  const parallelFinalizers = self => contextWithEffect(context => match$3(getOption(context, scopeTag), {
13813
14052
  onNone: () => self,
@@ -13869,7 +14108,7 @@ const scopeTag = /*#__PURE__*/GenericTag("effect/Scope");
13869
14108
  /* @internal */
13870
14109
  const scopeExtend = /*#__PURE__*/dual(2, (effect, scope) => mapInputContext(effect,
13871
14110
  // @ts-expect-error
13872
- merge$1(make$j(scopeTag, scope))));
14111
+ merge$1(make$m(scopeTag, scope))));
13873
14112
  // circular with Supervisor
13874
14113
  /** @internal */
13875
14114
  const fiberRefUnsafeMakeSupervisor = initial => fiberRefUnsafeMakePatch(initial, {
@@ -13916,16 +14155,485 @@ const invokeWithInterrupt = (self, entries, onInterrupt) => fiberIdWith(id => fl
13916
14155
  return sync(() => {
13917
14156
  cleanup.forEach(f => f());
13918
14157
  });
13919
- })), () => suspend(() => {
14158
+ })), () => suspend$1(() => {
13920
14159
  const residual = entries.flatMap(entry => {
13921
14160
  if (!entry.state.completed) {
13922
14161
  return [entry];
13923
14162
  }
13924
14163
  return [];
13925
14164
  });
13926
- return forEachSequentialDiscard(residual, entry => complete(entry.request, exitInterrupt$1(id)));
14165
+ return forEachSequentialDiscard(residual, entry => complete$1(entry.request, exitInterrupt$1(id)));
13927
14166
  })));
13928
14167
 
14168
+ /** @internal */
14169
+ const complete = (key, exit, entryStats, timeToLiveMillis) => struct({
14170
+ _tag: "Complete",
14171
+ key,
14172
+ exit,
14173
+ entryStats,
14174
+ timeToLiveMillis
14175
+ });
14176
+ /** @internal */
14177
+ const pending = (key, deferred) => struct({
14178
+ _tag: "Pending",
14179
+ key,
14180
+ deferred
14181
+ });
14182
+ /** @internal */
14183
+ const refreshing = (deferred, complete) => struct({
14184
+ _tag: "Refreshing",
14185
+ deferred,
14186
+ complete
14187
+ });
14188
+ /** @internal */
14189
+ const MapKeyTypeId = /*#__PURE__*/Symbol.for("effect/Cache/MapKey");
14190
+ class MapKeyImpl {
14191
+ current;
14192
+ [MapKeyTypeId] = MapKeyTypeId;
14193
+ previous = undefined;
14194
+ next = undefined;
14195
+ constructor(current) {
14196
+ this.current = current;
14197
+ }
14198
+ [symbol$1]() {
14199
+ return pipe(hash(this.current), combine$5(hash(this.previous)), combine$5(hash(this.next)), cached(this));
14200
+ }
14201
+ [symbol](that) {
14202
+ if (this === that) {
14203
+ return true;
14204
+ }
14205
+ return isMapKey(that) && equals$1(this.current, that.current) && equals$1(this.previous, that.previous) && equals$1(this.next, that.next);
14206
+ }
14207
+ }
14208
+ /** @internal */
14209
+ const makeMapKey = current => new MapKeyImpl(current);
14210
+ /** @internal */
14211
+ const isMapKey = u => hasProperty(u, MapKeyTypeId);
14212
+ class KeySetImpl {
14213
+ head = undefined;
14214
+ tail = undefined;
14215
+ add(key) {
14216
+ if (key !== this.tail) {
14217
+ if (this.tail === undefined) {
14218
+ this.head = key;
14219
+ this.tail = key;
14220
+ } else {
14221
+ const previous = key.previous;
14222
+ const next = key.next;
14223
+ if (next !== undefined) {
14224
+ key.next = undefined;
14225
+ if (previous !== undefined) {
14226
+ previous.next = next;
14227
+ next.previous = previous;
14228
+ } else {
14229
+ this.head = next;
14230
+ this.head.previous = undefined;
14231
+ }
14232
+ }
14233
+ this.tail.next = key;
14234
+ key.previous = this.tail;
14235
+ this.tail = key;
14236
+ }
14237
+ }
14238
+ }
14239
+ remove() {
14240
+ const key = this.head;
14241
+ if (key !== undefined) {
14242
+ const next = key.next;
14243
+ if (next !== undefined) {
14244
+ key.next = undefined;
14245
+ this.head = next;
14246
+ this.head.previous = undefined;
14247
+ } else {
14248
+ this.head = undefined;
14249
+ this.tail = undefined;
14250
+ }
14251
+ }
14252
+ return key;
14253
+ }
14254
+ }
14255
+ /** @internal */
14256
+ const makeKeySet = () => new KeySetImpl();
14257
+ /**
14258
+ * Constructs a new `CacheState` from the specified values.
14259
+ *
14260
+ * @internal
14261
+ */
14262
+ const makeCacheState = (map, keys, accesses, updating, hits, misses) => ({
14263
+ map,
14264
+ keys,
14265
+ accesses,
14266
+ updating,
14267
+ hits,
14268
+ misses
14269
+ });
14270
+ /**
14271
+ * Constructs an initial cache state.
14272
+ *
14273
+ * @internal
14274
+ */
14275
+ const initialCacheState = () => makeCacheState(empty$6(), makeKeySet(), unbounded(), make$g(false), 0, 0);
14276
+ /** @internal */
14277
+ const CacheSymbolKey = "effect/Cache";
14278
+ /** @internal */
14279
+ const CacheTypeId = /*#__PURE__*/Symbol.for(CacheSymbolKey);
14280
+ const cacheVariance = {
14281
+ /* c8 ignore next */
14282
+ _Key: _ => _,
14283
+ /* c8 ignore next */
14284
+ _Error: _ => _,
14285
+ /* c8 ignore next */
14286
+ _Value: _ => _
14287
+ };
14288
+ /** @internal */
14289
+ const ConsumerCacheSymbolKey = "effect/ConsumerCache";
14290
+ /** @internal */
14291
+ const ConsumerCacheTypeId = /*#__PURE__*/Symbol.for(ConsumerCacheSymbolKey);
14292
+ const consumerCacheVariance = {
14293
+ /* c8 ignore next */
14294
+ _Key: _ => _,
14295
+ /* c8 ignore next */
14296
+ _Error: _ => _,
14297
+ /* c8 ignore next */
14298
+ _Value: _ => _
14299
+ };
14300
+ /** @internal */
14301
+ const makeCacheStats = options => options;
14302
+ /** @internal */
14303
+ const makeEntryStats = loadedMillis => ({
14304
+ loadedMillis
14305
+ });
14306
+ class CacheImpl {
14307
+ capacity;
14308
+ context;
14309
+ fiberId;
14310
+ lookup;
14311
+ timeToLive;
14312
+ [CacheTypeId] = cacheVariance;
14313
+ [ConsumerCacheTypeId] = consumerCacheVariance;
14314
+ cacheState;
14315
+ constructor(capacity, context, fiberId, lookup, timeToLive) {
14316
+ this.capacity = capacity;
14317
+ this.context = context;
14318
+ this.fiberId = fiberId;
14319
+ this.lookup = lookup;
14320
+ this.timeToLive = timeToLive;
14321
+ this.cacheState = initialCacheState();
14322
+ }
14323
+ get(key) {
14324
+ return map(this.getEither(key), merge$3);
14325
+ }
14326
+ get cacheStats() {
14327
+ return sync(() => makeCacheStats({
14328
+ hits: this.cacheState.hits,
14329
+ misses: this.cacheState.misses,
14330
+ size: size(this.cacheState.map)
14331
+ }));
14332
+ }
14333
+ getOption(key) {
14334
+ return suspend$1(() => match$3(get$1(this.cacheState.map, key), {
14335
+ onNone: () => {
14336
+ const mapKey = makeMapKey(key);
14337
+ this.trackAccess(mapKey);
14338
+ this.trackMiss();
14339
+ return succeed$3(none$4());
14340
+ },
14341
+ onSome: value => this.resolveMapValue(value)
14342
+ }));
14343
+ }
14344
+ getOptionComplete(key) {
14345
+ return suspend$1(() => match$3(get$1(this.cacheState.map, key), {
14346
+ onNone: () => {
14347
+ const mapKey = makeMapKey(key);
14348
+ this.trackAccess(mapKey);
14349
+ this.trackMiss();
14350
+ return succeed$3(none$4());
14351
+ },
14352
+ onSome: value => this.resolveMapValue(value, true)
14353
+ }));
14354
+ }
14355
+ contains(key) {
14356
+ return sync(() => has(this.cacheState.map, key));
14357
+ }
14358
+ entryStats(key) {
14359
+ return sync(() => {
14360
+ const option = get$1(this.cacheState.map, key);
14361
+ if (isSome(option)) {
14362
+ switch (option.value._tag) {
14363
+ case "Complete":
14364
+ {
14365
+ const loaded = option.value.entryStats.loadedMillis;
14366
+ return some(makeEntryStats(loaded));
14367
+ }
14368
+ case "Pending":
14369
+ {
14370
+ return none$4();
14371
+ }
14372
+ case "Refreshing":
14373
+ {
14374
+ const loaded = option.value.complete.entryStats.loadedMillis;
14375
+ return some(makeEntryStats(loaded));
14376
+ }
14377
+ }
14378
+ }
14379
+ return none$4();
14380
+ });
14381
+ }
14382
+ getEither(key) {
14383
+ return suspend$1(() => {
14384
+ const k = key;
14385
+ let mapKey = undefined;
14386
+ let deferred = undefined;
14387
+ let value = getOrUndefined(get$1(this.cacheState.map, k));
14388
+ if (value === undefined) {
14389
+ deferred = unsafeMake$3(this.fiberId);
14390
+ mapKey = makeMapKey(k);
14391
+ if (has(this.cacheState.map, k)) {
14392
+ value = getOrUndefined(get$1(this.cacheState.map, k));
14393
+ } else {
14394
+ set(this.cacheState.map, k, pending(mapKey, deferred));
14395
+ }
14396
+ }
14397
+ if (value === undefined) {
14398
+ this.trackAccess(mapKey);
14399
+ this.trackMiss();
14400
+ return map(this.lookupValueOf(key, deferred), right);
14401
+ } else {
14402
+ return flatMap$1(this.resolveMapValue(value), match$3({
14403
+ onNone: () => this.getEither(key),
14404
+ onSome: value => succeed$3(left(value))
14405
+ }));
14406
+ }
14407
+ });
14408
+ }
14409
+ invalidate(key) {
14410
+ return sync(() => {
14411
+ remove$1(this.cacheState.map, key);
14412
+ });
14413
+ }
14414
+ invalidateWhen(key, when) {
14415
+ return sync(() => {
14416
+ const value = get$1(this.cacheState.map, key);
14417
+ if (isSome(value) && value.value._tag === "Complete") {
14418
+ if (value.value.exit._tag === "Success") {
14419
+ if (when(value.value.exit.value)) {
14420
+ remove$1(this.cacheState.map, key);
14421
+ }
14422
+ }
14423
+ }
14424
+ });
14425
+ }
14426
+ get invalidateAll() {
14427
+ return sync(() => {
14428
+ this.cacheState.map = empty$6();
14429
+ });
14430
+ }
14431
+ refresh(key) {
14432
+ return clockWith(clock => suspend$1(() => {
14433
+ const k = key;
14434
+ const deferred = unsafeMake$3(this.fiberId);
14435
+ let value = getOrUndefined(get$1(this.cacheState.map, k));
14436
+ if (value === undefined) {
14437
+ if (has(this.cacheState.map, k)) {
14438
+ value = getOrUndefined(get$1(this.cacheState.map, k));
14439
+ } else {
14440
+ set(this.cacheState.map, k, pending(makeMapKey(k), deferred));
14441
+ }
14442
+ }
14443
+ if (value === undefined) {
14444
+ return asVoid(this.lookupValueOf(key, deferred));
14445
+ } else {
14446
+ switch (value._tag) {
14447
+ case "Complete":
14448
+ {
14449
+ if (this.hasExpired(clock, value.timeToLiveMillis)) {
14450
+ const found = getOrUndefined(get$1(this.cacheState.map, k));
14451
+ if (equals$1(found, value)) {
14452
+ remove$1(this.cacheState.map, k);
14453
+ }
14454
+ return asVoid(this.get(key));
14455
+ }
14456
+ // Only trigger the lookup if we're still the current value, `completedResult`
14457
+ return pipe(this.lookupValueOf(key, deferred), when(() => {
14458
+ const current = getOrUndefined(get$1(this.cacheState.map, k));
14459
+ if (equals$1(current, value)) {
14460
+ const mapValue = refreshing(deferred, value);
14461
+ set(this.cacheState.map, k, mapValue);
14462
+ return true;
14463
+ }
14464
+ return false;
14465
+ }), asVoid);
14466
+ }
14467
+ case "Pending":
14468
+ {
14469
+ return _await(value.deferred);
14470
+ }
14471
+ case "Refreshing":
14472
+ {
14473
+ return _await(value.deferred);
14474
+ }
14475
+ }
14476
+ }
14477
+ }));
14478
+ }
14479
+ set(key, value) {
14480
+ return clockWith(clock => sync(() => {
14481
+ const now = clock.unsafeCurrentTimeMillis();
14482
+ const k = key;
14483
+ const lookupResult = succeed$2(value);
14484
+ const mapValue = complete(makeMapKey(k), lookupResult, makeEntryStats(now), now + toMillis(decode(this.timeToLive(lookupResult))));
14485
+ set(this.cacheState.map, k, mapValue);
14486
+ }));
14487
+ }
14488
+ get size() {
14489
+ return sync(() => {
14490
+ return size(this.cacheState.map);
14491
+ });
14492
+ }
14493
+ get values() {
14494
+ return sync(() => {
14495
+ const values = [];
14496
+ for (const entry of this.cacheState.map) {
14497
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
14498
+ values.push(entry[1].exit.value);
14499
+ }
14500
+ }
14501
+ return values;
14502
+ });
14503
+ }
14504
+ get entries() {
14505
+ return sync(() => {
14506
+ const values = [];
14507
+ for (const entry of this.cacheState.map) {
14508
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
14509
+ values.push([entry[0], entry[1].exit.value]);
14510
+ }
14511
+ }
14512
+ return values;
14513
+ });
14514
+ }
14515
+ get keys() {
14516
+ return sync(() => {
14517
+ const keys = [];
14518
+ for (const entry of this.cacheState.map) {
14519
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
14520
+ keys.push(entry[0]);
14521
+ }
14522
+ }
14523
+ return keys;
14524
+ });
14525
+ }
14526
+ resolveMapValue(value, ignorePending = false) {
14527
+ return clockWith(clock => {
14528
+ switch (value._tag) {
14529
+ case "Complete":
14530
+ {
14531
+ this.trackAccess(value.key);
14532
+ if (this.hasExpired(clock, value.timeToLiveMillis)) {
14533
+ remove$1(this.cacheState.map, value.key.current);
14534
+ return succeed$3(none$4());
14535
+ }
14536
+ this.trackHit();
14537
+ return map(value.exit, some);
14538
+ }
14539
+ case "Pending":
14540
+ {
14541
+ this.trackAccess(value.key);
14542
+ this.trackHit();
14543
+ if (ignorePending) {
14544
+ return succeed$3(none$4());
14545
+ }
14546
+ return map(_await(value.deferred), some);
14547
+ }
14548
+ case "Refreshing":
14549
+ {
14550
+ this.trackAccess(value.complete.key);
14551
+ this.trackHit();
14552
+ if (this.hasExpired(clock, value.complete.timeToLiveMillis)) {
14553
+ if (ignorePending) {
14554
+ return succeed$3(none$4());
14555
+ }
14556
+ return map(_await(value.deferred), some);
14557
+ }
14558
+ return map(value.complete.exit, some);
14559
+ }
14560
+ }
14561
+ });
14562
+ }
14563
+ trackHit() {
14564
+ this.cacheState.hits = this.cacheState.hits + 1;
14565
+ }
14566
+ trackMiss() {
14567
+ this.cacheState.misses = this.cacheState.misses + 1;
14568
+ }
14569
+ trackAccess(key) {
14570
+ offer(this.cacheState.accesses, key);
14571
+ if (compareAndSet(this.cacheState.updating, false, true)) {
14572
+ let loop = true;
14573
+ while (loop) {
14574
+ const key = poll(this.cacheState.accesses, EmptyMutableQueue);
14575
+ if (key === EmptyMutableQueue) {
14576
+ loop = false;
14577
+ } else {
14578
+ this.cacheState.keys.add(key);
14579
+ }
14580
+ }
14581
+ let size$1 = size(this.cacheState.map);
14582
+ loop = size$1 > this.capacity;
14583
+ while (loop) {
14584
+ const key = this.cacheState.keys.remove();
14585
+ if (key !== undefined) {
14586
+ if (has(this.cacheState.map, key.current)) {
14587
+ remove$1(this.cacheState.map, key.current);
14588
+ size$1 = size$1 - 1;
14589
+ loop = size$1 > this.capacity;
14590
+ }
14591
+ } else {
14592
+ loop = false;
14593
+ }
14594
+ }
14595
+ set$2(this.cacheState.updating, false);
14596
+ }
14597
+ }
14598
+ hasExpired(clock, timeToLiveMillis) {
14599
+ return clock.unsafeCurrentTimeMillis() > timeToLiveMillis;
14600
+ }
14601
+ lookupValueOf(input, deferred) {
14602
+ return clockWith(clock => suspend$1(() => {
14603
+ const key = input;
14604
+ return pipe(this.lookup(input), provideContext$1(this.context), exit, flatMap$1(exit => {
14605
+ const now = clock.unsafeCurrentTimeMillis();
14606
+ const stats = makeEntryStats(now);
14607
+ const value = complete(makeMapKey(key), exit, stats, now + toMillis(decode(this.timeToLive(exit))));
14608
+ set(this.cacheState.map, key, value);
14609
+ return zipRight(done$2(deferred, exit), exit);
14610
+ }), onInterrupt(() => zipRight(interrupt(deferred), sync(() => {
14611
+ remove$1(this.cacheState.map, key);
14612
+ }))));
14613
+ }));
14614
+ }
14615
+ }
14616
+ /** @internal */
14617
+ const make$2 = options => {
14618
+ const timeToLive = decode(options.timeToLive);
14619
+ return makeWith({
14620
+ capacity: options.capacity,
14621
+ lookup: options.lookup,
14622
+ timeToLive: () => timeToLive
14623
+ });
14624
+ };
14625
+ /** @internal */
14626
+ const makeWith = options => map(all([context(), fiberId]), ([context, fiberId]) => new CacheImpl(options.capacity, context, fiberId, options.lookup, exit => decode(options.timeToLive(exit))));
14627
+
14628
+ /**
14629
+ * Constructs a new cache with the specified capacity, time to live, and
14630
+ * lookup function.
14631
+ *
14632
+ * @since 2.0.0
14633
+ * @category constructors
14634
+ */
14635
+ const make$1 = make$2;
14636
+
13929
14637
  /**
13930
14638
  * @since 2.0.0
13931
14639
  */
@@ -13955,7 +14663,7 @@ const makeDual = f => function () {
13955
14663
  };
13956
14664
  /** @internal */
13957
14665
  const unsafeFork = /*#__PURE__*/makeDual((runtime, self, options) => {
13958
- const fiberId = unsafeMake$3();
14666
+ const fiberId = unsafeMake$4();
13959
14667
  const fiberRefUpdates = [[currentContext, [[fiberId, runtime.context]]]];
13960
14668
  if (options?.scheduler) {
13961
14669
  fiberRefUpdates.push([currentScheduler, [[fiberId, options.scheduler]]]);
@@ -13988,31 +14696,6 @@ const unsafeFork = /*#__PURE__*/makeDual((runtime, self, options) => {
13988
14696
  return fiberRuntime;
13989
14697
  });
13990
14698
  /** @internal */
13991
- const unsafeRunSync = /*#__PURE__*/makeDual((runtime, effect) => {
13992
- const result = unsafeRunSyncExit(runtime)(effect);
13993
- if (result._tag === "Failure") {
13994
- throw fiberFailure(result.effect_instruction_i0);
13995
- }
13996
- return result.effect_instruction_i0;
13997
- });
13998
- class AsyncFiberExceptionImpl extends Error {
13999
- fiber;
14000
- _tag = "AsyncFiberException";
14001
- constructor(fiber) {
14002
- super(`Fiber #${fiber.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`);
14003
- this.fiber = fiber;
14004
- this.name = this._tag;
14005
- this.stack = this.message;
14006
- }
14007
- }
14008
- const asyncFiberException = fiber => {
14009
- const limit = Error.stackTraceLimit;
14010
- Error.stackTraceLimit = 0;
14011
- const error = new AsyncFiberExceptionImpl(fiber);
14012
- Error.stackTraceLimit = limit;
14013
- return error;
14014
- };
14015
- /** @internal */
14016
14699
  const FiberFailureId = /*#__PURE__*/Symbol.for("effect/Runtime/FiberFailure");
14017
14700
  /** @internal */
14018
14701
  const FiberFailureCauseId = /*#__PURE__*/Symbol.for("effect/Runtime/FiberFailure/Cause");
@@ -14081,23 +14764,6 @@ const fastPath = effect => {
14081
14764
  }
14082
14765
  };
14083
14766
  /** @internal */
14084
- const unsafeRunSyncExit = /*#__PURE__*/makeDual((runtime, effect) => {
14085
- const op = fastPath(effect);
14086
- if (op) {
14087
- return op;
14088
- }
14089
- const scheduler = new SyncScheduler();
14090
- const fiberRuntime = unsafeFork(runtime)(effect, {
14091
- scheduler
14092
- });
14093
- scheduler.flush();
14094
- const result = fiberRuntime.unsafePoll();
14095
- if (result) {
14096
- return result;
14097
- }
14098
- return exitDie$1(capture(asyncFiberException(fiberRuntime), currentSpanFromFiber(fiberRuntime)));
14099
- });
14100
- /** @internal */
14101
14767
  const unsafeRunPromise = /*#__PURE__*/makeDual((runtime, effect, options) => unsafeRunPromiseExit(runtime, effect, options).then(result => {
14102
14768
  switch (result._tag) {
14103
14769
  case OP_SUCCESS:
@@ -14149,17 +14815,15 @@ class RuntimeImpl {
14149
14815
  /** @internal */
14150
14816
  const make = options => new RuntimeImpl(options.context, options.runtimeFlags, options.fiberRefs);
14151
14817
  /** @internal */
14152
- const defaultRuntimeFlags = /*#__PURE__*/make$a(Interruption, CooperativeYielding, RuntimeMetrics);
14818
+ const defaultRuntimeFlags = /*#__PURE__*/make$d(Interruption, CooperativeYielding, RuntimeMetrics);
14153
14819
  /** @internal */
14154
14820
  const defaultRuntime = /*#__PURE__*/make({
14155
- context: /*#__PURE__*/empty$h(),
14821
+ context: /*#__PURE__*/empty$i(),
14156
14822
  runtimeFlags: defaultRuntimeFlags,
14157
14823
  fiberRefs: /*#__PURE__*/empty$2()
14158
14824
  });
14159
14825
  /** @internal */
14160
14826
  const unsafeRunPromiseEffect = /*#__PURE__*/unsafeRunPromise(defaultRuntime);
14161
- /** @internal */
14162
- const unsafeRunSyncEffect = /*#__PURE__*/unsafeRunSync(defaultRuntime);
14163
14827
 
14164
14828
  /**
14165
14829
  * Provides a constructor for a Case Class.
@@ -14257,7 +14921,7 @@ const TaggedError = tag => {
14257
14921
  * @since 2.0.0
14258
14922
  * @category Creating Effects
14259
14923
  */
14260
- const gen = gen$1;
14924
+ const gen = gen$2;
14261
14925
  /**
14262
14926
  * Creates an `Effect` that always succeeds with a given value.
14263
14927
  *
@@ -14283,7 +14947,7 @@ const gen = gen$1;
14283
14947
  * @since 2.0.0
14284
14948
  * @category Creating Effects
14285
14949
  */
14286
- const succeed = succeed$2;
14950
+ const succeed = succeed$3;
14287
14951
  /**
14288
14952
  * Handles all errors in an effect by providing a fallback effect.
14289
14953
  *
@@ -14340,72 +15004,6 @@ const succeed = succeed$2;
14340
15004
  * @category Error handling
14341
15005
  */
14342
15006
  const catchAll = catchAll$1;
14343
- const try_ = try_$1;
14344
- /**
14345
- * Creates an `Effect` that represents an asynchronous computation that might
14346
- * fail.
14347
- *
14348
- * **When to Use**
14349
- *
14350
- * In situations where you need to perform asynchronous operations that might
14351
- * fail, such as fetching data from an API, you can use the `tryPromise`
14352
- * constructor. This constructor is designed to handle operations that could
14353
- * throw exceptions by capturing those exceptions and transforming them into
14354
- * manageable errors.
14355
- *
14356
- * **Error Handling**
14357
- *
14358
- * There are two ways to handle errors with `tryPromise`:
14359
- *
14360
- * 1. If you don't provide a `catch` function, the error is caught and the
14361
- * effect fails with an `UnknownException`.
14362
- * 2. If you provide a `catch` function, the error is caught and the `catch`
14363
- * function maps it to an error of type `E`.
14364
- *
14365
- * **Interruptions**
14366
- *
14367
- * An optional `AbortSignal` can be provided to allow for interruption of the
14368
- * wrapped `Promise` API.
14369
- *
14370
- * **Example** (Fetching a TODO Item)
14371
- *
14372
- * ```ts
14373
- * import { Effect } from "effect"
14374
- *
14375
- * const getTodo = (id: number) =>
14376
- * // Will catch any errors and propagate them as UnknownException
14377
- * Effect.tryPromise(() =>
14378
- * fetch(`https://jsonplaceholder.typicode.com/todos/${id}`)
14379
- * )
14380
- *
14381
- * // ┌─── Effect<Response, UnknownException, never>
14382
- * // ▼
14383
- * const program = getTodo(1)
14384
- * ```
14385
- *
14386
- * **Example** (Custom Error Handling)
14387
- *
14388
- * ```ts
14389
- * import { Effect } from "effect"
14390
- *
14391
- * const getTodo = (id: number) =>
14392
- * Effect.tryPromise({
14393
- * try: () => fetch(`https://jsonplaceholder.typicode.com/todos/${id}`),
14394
- * // remap the error
14395
- * catch: (unknown) => new Error(`something went wrong ${unknown}`)
14396
- * })
14397
- *
14398
- * // ┌─── Effect<Response, Error, never>
14399
- * // ▼
14400
- * const program = getTodo(1)
14401
- * ```
14402
- *
14403
- * @see {@link promise} if the effectful computation is asynchronous and does not throw errors.
14404
- *
14405
- * @since 2.0.0
14406
- * @category Creating Effects
14407
- */
14408
- const tryPromise = tryPromise$1;
14409
15007
  /**
14410
15008
  * Execute a side effect on failure without modifying the original effect.
14411
15009
  *
@@ -14470,51 +15068,6 @@ const logWarning = logWarning$1;
14470
15068
  * @category Logging
14471
15069
  */
14472
15070
  const logError = logError$1;
14473
- /**
14474
- * Ensures the effect always succeeds by replacing failures with a default
14475
- * success value.
14476
- *
14477
- * **Details**
14478
- *
14479
- * This function transforms an effect that may fail into one that cannot fail by
14480
- * replacing any failure with a provided success value. If the original effect
14481
- * fails, the failure is "swallowed," and the specified success value is
14482
- * returned instead. If the original effect succeeds, its value remains
14483
- * unchanged.
14484
- *
14485
- * **When to Use**
14486
- *
14487
- * This is especially useful for providing default values in case of failure,
14488
- * ensuring that an effect always completes successfully. By using this
14489
- * function, you can avoid the need for complex error handling and guarantee a
14490
- * fallback result.
14491
- *
14492
- * **Example**
14493
- *
14494
- * ```ts
14495
- * import { Effect } from "effect"
14496
- *
14497
- * const validate = (age: number): Effect.Effect<number, string> => {
14498
- * if (age < 0) {
14499
- * return Effect.fail("NegativeAgeError")
14500
- * } else if (age < 18) {
14501
- * return Effect.fail("IllegalAgeError")
14502
- * } else {
14503
- * return Effect.succeed(age)
14504
- * }
14505
- * }
14506
- *
14507
- * const program = Effect.orElseSucceed(validate(-1), () => 18)
14508
- *
14509
- * console.log(Effect.runSyncExit(program))
14510
- * // Output:
14511
- * // { _id: 'Exit', _tag: 'Success', value: 18 }
14512
- * ```
14513
- *
14514
- * @since 2.0.0
14515
- * @category Fallback
14516
- */
14517
- const orElseSucceed = orElseSucceed$1;
14518
15071
  /**
14519
15072
  * Executes an effect and returns the result as a `Promise`.
14520
15073
  *
@@ -14560,168 +15113,93 @@ const orElseSucceed = orElseSucceed$1;
14560
15113
  * @category Running Effects
14561
15114
  */
14562
15115
  const runPromise = unsafeRunPromiseEffect;
14563
- /**
14564
- * Executes an effect synchronously, running it immediately and returning the
14565
- * result.
14566
- *
14567
- * **Details**
14568
- *
14569
- * This function evaluates the provided effect synchronously, returning its
14570
- * result directly. It is ideal for effects that do not fail or include
14571
- * asynchronous operations. If the effect does fail or involves async tasks, it
14572
- * will throw an error. Execution stops at the point of failure or asynchronous
14573
- * operation, making it unsuitable for effects that require asynchronous
14574
- * handling.
14575
- *
14576
- * **Important**: Attempting to run effects that involve asynchronous operations
14577
- * or failures will result in exceptions being thrown, so use this function with
14578
- * care for purely synchronous and error-free effects.
14579
- *
14580
- * **When to Use**
14581
- *
14582
- * Use this function when:
14583
- * - You are sure that the effect will not fail or involve asynchronous
14584
- * operations.
14585
- * - You need a direct, synchronous result from the effect.
14586
- * - You are working within a context where asynchronous effects are not
14587
- * allowed.
14588
- *
14589
- * Avoid using this function for effects that can fail or require asynchronous
14590
- * handling. For such cases, consider using {@link runPromise} or
14591
- * {@link runSyncExit}.
14592
- *
14593
- * **Example** (Synchronous Logging)
14594
- *
14595
- * ```ts
14596
- * import { Effect } from "effect"
14597
- *
14598
- * const program = Effect.sync(() => {
14599
- * console.log("Hello, World!")
14600
- * return 1
14601
- * })
14602
- *
14603
- * const result = Effect.runSync(program)
14604
- * // Output: Hello, World!
14605
- *
14606
- * console.log(result)
14607
- * // Output: 1
14608
- * ```
14609
- *
14610
- * **Example** (Incorrect Usage with Failing or Async Effects)
14611
- *
14612
- * ```ts
14613
- * import { Effect } from "effect"
14614
- *
14615
- * try {
14616
- * // Attempt to run an effect that fails
14617
- * Effect.runSync(Effect.fail("my error"))
14618
- * } catch (e) {
14619
- * console.error(e)
14620
- * }
14621
- * // Output:
14622
- * // (FiberFailure) Error: my error
14623
- *
14624
- * try {
14625
- * // Attempt to run an effect that involves async work
14626
- * Effect.runSync(Effect.promise(() => Promise.resolve(1)))
14627
- * } catch (e) {
14628
- * console.error(e)
14629
- * }
14630
- * // Output:
14631
- * // (FiberFailure) AsyncFiberException: Fiber #0 cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work
14632
- * ```
14633
- *
14634
- * @see {@link runSyncExit} for a version that returns an `Exit` type instead of
14635
- * throwing an error.
14636
- *
14637
- * @since 2.0.0
14638
- * @category Running Effects
14639
- */
14640
- const runSync = unsafeRunSyncEffect;
14641
15116
 
14642
- function getLocationBase() {
14643
- return (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('assets-CB5ikzmP.js', document.baseURI).href)) ?? window?.location?.origin ?? '';
15117
+ class FetchError extends TaggedError('FetchError') {
15118
+ }
15119
+ class NotFoundError extends TaggedError('NotFoundError') {
15120
+ }
15121
+ const httpClient = (input, init) => gen$1(function* () {
15122
+ const response = yield* tryPromise({
15123
+ try: () => fetch(input, init),
15124
+ catch: error => new FetchError({ cause: error }),
15125
+ });
15126
+ if (response.status === 404) {
15127
+ return yield* fail(new NotFoundError({ url: response.url }));
15128
+ }
15129
+ return response;
15130
+ });
15131
+ class ResponseTextError extends TaggedError('ResponseTextError') {
15132
+ constructor(error) {
15133
+ super(new Error(`Failed to read response text`, { cause: error }));
15134
+ }
14644
15135
  }
15136
+ const responseAsText = (res) => tryPromise({
15137
+ try: () => res.text(),
15138
+ catch: error => new ResponseTextError(error),
15139
+ });
14645
15140
 
14646
- class URLCreationError extends TaggedError('URLCreationError') {
15141
+ const SVGString = refined(isValidSVG, () => error('SVG data is malformed'));
15142
+ class BrandValidationError extends TaggedError('BrandValidationError') {
15143
+ constructor(error, type) {
15144
+ super(new Error(`Brand validation failed for type ${type}.`, { cause: error }));
15145
+ }
14647
15146
  }
14648
- const relativeAssetsPath = '../../assets';
14649
- const syncCreateAssetUrlSafely = (file, pathFromAssetRoot) => {
14650
- const relativeAssetPath = joinPath(relativeAssetsPath, pathFromAssetRoot, file);
14651
- return try_(() => index.getAssetPath(relativeAssetPath)).pipe(tapError(() => logWarning(`Failed to create URL for asset "${file}" in path "${pathFromAssetRoot}".
14652
- Please provide an absolute URL in your app's 'setAssetPath(...)' configuration! Falling back to a relative URL, which may work in some environments but is not guaranteed to be correct.`)), orElseSucceed(() => new URL(relativeAssetPath, getLocationBase())));
14653
- };
14654
- function joinPath(...parts) {
14655
- return parts.filter(Boolean).join('/').replace('//', '/').replace('/./', '/');
15147
+ const createValidSVGString = (svg) => try_({
15148
+ try: () => SVGString(svg),
15149
+ catch: error => new BrandValidationError(error, 'SVGString'),
15150
+ });
15151
+ function isValidSVG(svg) {
15152
+ if (typeof svg !== 'string') {
15153
+ return false;
15154
+ }
15155
+ try {
15156
+ const parser = new DOMParser();
15157
+ const doc = parser.parseFromString(svg, 'image/svg+xml');
15158
+ return doc.documentElement.nodeName === 'svg';
15159
+ }
15160
+ catch {
15161
+ return false;
15162
+ }
15163
+ }
15164
+
15165
+ const emptyDefaultSvg = () => SVGString(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>`);
15166
+ const createIconCache = () => make$1({
15167
+ capacity: 200,
15168
+ timeToLive: infinity,
15169
+ lookup: (key) => gen(function* () {
15170
+ const name = key;
15171
+ const assetPath = assets.createAssetUrlSafely(`${name}.svg`, 'icons');
15172
+ const res = yield* httpClient(assetPath);
15173
+ const responseString = yield* responseAsText(res);
15174
+ return yield* createValidSVGString(responseString);
15175
+ }),
15176
+ });
15177
+ let cacheInstance = null;
15178
+ function fetchIconSvg(name) {
15179
+ const key = name;
15180
+ return gen(function* () {
15181
+ if (!cacheInstance) {
15182
+ cacheInstance = yield* createIconCache();
15183
+ }
15184
+ return yield* cacheInstance.get(key);
15185
+ });
15186
+ }
15187
+ function clearIconCache() {
15188
+ return gen(function* () {
15189
+ if (cacheInstance) {
15190
+ yield* cacheInstance.invalidateAll;
15191
+ }
15192
+ else {
15193
+ logWarning('Attempted to clear icon cache before it was initialized');
15194
+ }
15195
+ });
14656
15196
  }
14657
15197
 
14658
- exports.NodeInspectSymbol = NodeInspectSymbol;
14659
- exports.TaggedError = TaggedError;
14660
- exports.all = all;
14661
- exports.asVoid = asVoid;
14662
- exports.cached = cached;
14663
15198
  exports.catchAll = catchAll;
14664
- exports.clockWith = clockWith;
14665
- exports.combine = combine$5;
14666
- exports.compareAndSet = compareAndSet;
14667
- exports.context = context;
14668
- exports.decode = decode;
14669
- exports.deferredAwait = deferredAwait;
14670
- exports.deferredDone = deferredDone;
14671
- exports.deferredInterrupt = deferredInterrupt;
14672
- exports.deferredUnsafeMake = deferredUnsafeMake;
14673
- exports.dual = dual;
14674
- exports.empty = empty$5;
14675
- exports.equals = equals$1;
14676
- exports.exit = exit;
14677
- exports.exitSucceed = exitSucceed$1;
14678
- exports.fiberId = fiberId;
14679
- exports.flatMap = flatMap$1;
14680
- exports.format = format$2;
14681
- exports.gen = gen;
14682
- exports.get = get$1;
14683
- exports.getOrThrowWith = getOrThrowWith$1;
14684
- exports.getOrUndefined = getOrUndefined;
14685
- exports.getRight = getRight;
14686
- exports.has = has;
14687
- exports.hasProperty = hasProperty;
14688
- exports.hash = hash;
14689
- exports.identity = identity;
14690
- exports.infinity = infinity;
14691
- exports.isRight = isRight;
14692
- exports.isSome = isSome;
14693
- exports.left = left;
15199
+ exports.clearIconCache = clearIconCache;
15200
+ exports.emptyDefaultSvg = emptyDefaultSvg;
15201
+ exports.fetchIconSvg = fetchIconSvg;
14694
15202
  exports.logError = logError;
14695
- exports.logWarning = logWarning;
14696
- exports.make = make$d;
14697
- exports.map = map;
14698
- exports.match = match$3;
14699
- exports.merge = merge$3;
14700
- exports.none = none$4;
14701
- exports.onInterrupt = onInterrupt;
14702
- exports.pipe = pipe;
14703
- exports.pipeArguments = pipeArguments;
14704
- exports.provideContext = provideContext$1;
14705
- exports.remove = remove;
14706
- exports.right = right;
14707
15203
  exports.runPromise = runPromise;
14708
- exports.runSync = runSync;
14709
- exports.set = set;
14710
- exports.set$1 = set$2;
14711
- exports.size = size;
14712
- exports.some = some;
14713
- exports.struct = struct;
14714
15204
  exports.succeed = succeed;
14715
- exports.succeed$1 = succeed$2;
14716
- exports.suspend = suspend;
14717
- exports.symbol = symbol$1;
14718
- exports.symbol$1 = symbol;
14719
- exports.sync = sync;
14720
- exports.syncCreateAssetUrlSafely = syncCreateAssetUrlSafely;
14721
15205
  exports.tapError = tapError;
14722
- exports.toJSON = toJSON;
14723
- exports.toMillis = toMillis;
14724
- exports.tryPromise = tryPromise;
14725
- exports.try_ = try_;
14726
- exports.when = when;
14727
- exports.zipRight = zipRight;