@foldkit/oxlint-plugin 0.15.1 → 0.15.2-canary.085b787da0a5

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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/effect-oxlint@0.3.4_effect@4.0.0-rc.117/node_modules/effect-oxlint/dist/rolldown-runtime.js
1
+ //#region ../../node_modules/.pnpm/effect-oxlint@0.3.4_effect@4.0.0/node_modules/effect-oxlint/dist/rolldown-runtime.js
2
2
  var __defProp = Object.defineProperty;
3
3
  var __exportAll = (all, no_symbols) => {
4
4
  let target = {};
@@ -10,7 +10,7 @@ var __exportAll = (all, no_symbols) => {
10
10
  return target;
11
11
  };
12
12
  //#endregion
13
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Pipeable.js
13
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Pipeable.js
14
14
  /**
15
15
  * The `Pipeable` module defines the shared interface and implementation helpers
16
16
  * for values that support Effect-style method chaining with `.pipe(...)`.
@@ -112,7 +112,7 @@ const Class$1 = /*#__PURE__*/ function() {
112
112
  return PipeableBase;
113
113
  }();
114
114
  //#endregion
115
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Function.js
115
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Function.js
116
116
  /**
117
117
  * Creates a function that can be called in data-first style or data-last
118
118
  * (`pipe`-friendly) style.
@@ -374,12 +374,12 @@ function memoizeIdempotent(f) {
374
374
  if (cached !== void 0) return cached;
375
375
  const result = f(a);
376
376
  cache.set(a, result);
377
- cache.set(result, result);
377
+ if (result !== a) cache.set(result, result);
378
378
  return result;
379
379
  };
380
380
  }
381
381
  //#endregion
382
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/equal.js
382
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/equal.js
383
383
  /** @internal */
384
384
  const getAllObjectKeys = (obj) => {
385
385
  const keys = new Set(Reflect.ownKeys(obj));
@@ -397,8 +397,22 @@ const getAllObjectKeys = (obj) => {
397
397
  };
398
398
  /** @internal */
399
399
  const byReferenceInstances = /*#__PURE__*/ new WeakSet();
400
+ /** @internal */
401
+ const viewBytes = (view) => new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
402
+ //#endregion
403
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/hash.js
404
+ /**
405
+ * Back-edge count used to avoid caching entry-point-dependent hashes.
406
+ *
407
+ * @internal
408
+ */
409
+ let backEdges = 0;
410
+ /** @internal */
411
+ const addBackEdge = () => {
412
+ backEdges++;
413
+ };
400
414
  //#endregion
401
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Predicate.js
415
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Predicate.js
402
416
  /**
403
417
  * Defines runtime checks for values.
404
418
  *
@@ -712,7 +726,7 @@ function isIterable(input) {
712
726
  return hasProperty(input, Symbol.iterator) || isString(input);
713
727
  }
714
728
  //#endregion
715
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Hash.js
729
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Hash.js
716
730
  /**
717
731
  * Computes Effect hash values and defines the interface for objects that want
718
732
  * to provide their own hash implementation. Hashes are small numeric
@@ -780,30 +794,39 @@ const hash = (self) => {
780
794
  case "number": return number$1(self);
781
795
  case "bigint": return string$1(self.toString(10));
782
796
  case "string": return string$1(self);
783
- case "undefined": return string$1("undefined");
784
797
  case "function":
785
- case "object": if (self === null) return string$1("null");
798
+ case "object": if (self === null) break;
786
799
  else if (self instanceof Date) {
787
800
  if (Number.isNaN(self.getTime())) return string$1("Invalid Date");
788
801
  return string$1(self.toISOString());
789
802
  } else if (self instanceof RegExp) return string$1(self.toString());
790
803
  else {
791
804
  if (byReferenceInstances.has(self)) return random(self);
792
- if (hashCache.has(self)) return hashCache.get(self);
793
- const h = withVisitedTracking$1(self, () => {
794
- if (isHash(self)) return self[symbol$1]();
795
- else if (typeof self === "function") return random(self);
796
- else if (self instanceof DataView) return array(new Uint8Array(self.buffer, self.byteOffset, self.byteLength));
797
- else if (Array.isArray(self) || ArrayBuffer.isView(self)) return array(self);
798
- else if (self instanceof Map) return hashMap(self);
799
- else if (self instanceof Set) return hashSet(self);
800
- return structure(self);
801
- });
802
- hashCache.set(self, h);
805
+ const cached = hashCache.get(self);
806
+ if (cached !== void 0) return cached;
807
+ if (visitedObjects.has(self)) {
808
+ addBackEdge();
809
+ return string$1("[Circular]");
810
+ }
811
+ visitedObjects.add(self);
812
+ const seen = backEdges;
813
+ let h;
814
+ try {
815
+ if ("~effect/Hash" in self) h = self[symbol$1]();
816
+ else if (typeof self === "function") h = random(self);
817
+ else if (self instanceof DataView) h = array(viewBytes(self));
818
+ else if (Array.isArray(self) || ArrayBuffer.isView(self)) h = array(self);
819
+ else if (self instanceof Map) h = hashMap(self);
820
+ else if (self instanceof Set) h = hashSet(self);
821
+ else h = structure(self);
822
+ } finally {
823
+ visitedObjects.delete(self);
824
+ }
825
+ if (seen === backEdges) hashCache.set(self, h);
803
826
  return h;
804
827
  }
805
- default: return string$1(String(self));
806
828
  }
829
+ return optimize(mix(string$1(String(self))));
807
830
  };
808
831
  /**
809
832
  * Generates a random hash value for an object and caches it.
@@ -835,9 +858,16 @@ const hash = (self) => {
835
858
  * @since 2.0.0
836
859
  */
837
860
  const random = (self) => {
838
- if (!randomHashCache.has(self)) randomHashCache.set(self, number$1(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)));
861
+ if (!randomHashCache.has(self)) randomHashCache.set(self, optimize(Math.random() * 4294967296 | 0));
839
862
  return randomHashCache.get(self);
840
863
  };
864
+ const mix = (h) => {
865
+ h ^= h >>> 16;
866
+ h = Math.imul(h, 2246822507);
867
+ h ^= h >>> 13;
868
+ h = Math.imul(h, 3266489909);
869
+ return h ^ h >>> 16;
870
+ };
841
871
  /**
842
872
  * Combines two hash values into a single hash value.
843
873
  *
@@ -848,8 +878,7 @@ const random = (self) => {
848
878
  *
849
879
  * **Details**
850
880
  *
851
- * Supports both direct and pipeable usage. The implementation combines two
852
- * hash values with `(self * 53) ^ b`.
881
+ * Supports direct and pipeable usage. Argument order affects the result.
853
882
  *
854
883
  * **Example** (Combining hash values)
855
884
  *
@@ -869,7 +898,7 @@ const random = (self) => {
869
898
  * @category hashing
870
899
  * @since 2.0.0
871
900
  */
872
- const combine = /*#__PURE__*/ dual(2, (self, b) => self * 53 ^ b);
901
+ const combine = /*#__PURE__*/ dual(2, (self, b) => mix(Math.imul(self, 2654435761) + Math.imul(b, 2246822507)));
873
902
  /**
874
903
  * Applies bit manipulation techniques to optimize a hash value.
875
904
  *
@@ -894,38 +923,7 @@ const combine = /*#__PURE__*/ dual(2, (self, b) => self * 53 ^ b);
894
923
  * @since 2.0.0
895
924
  */
896
925
  const optimize = (n) => n & 3221225471 | n >>> 1 & 1073741824;
897
- /**
898
- * Checks whether a value implements the Hash interface.
899
- *
900
- * **When to use**
901
- *
902
- * Use to detect whether an unknown value provides a custom hash implementation.
903
- *
904
- * **Details**
905
- *
906
- * This function determines whether a given value has the Hash symbol property,
907
- * indicating that it can provide its own hash value implementation.
908
- *
909
- * **Example** (Checking for Hash support)
910
- *
911
- * ```ts import.meta.vitest
912
- * import { Hash } from "effect"
913
- *
914
- * class MyHashable implements Hash.Hash {
915
- * [Hash.symbol]() {
916
- * return 42
917
- * }
918
- * }
919
- *
920
- * Hash.isHash(new MyHashable()) // => true
921
- * Hash.isHash({}) // => false
922
- * Hash.isHash("string") // => false
923
- * ```
924
- *
925
- * @category guards
926
- * @since 2.0.0
927
- */
928
- const isHash = (u) => hasProperty(u, symbol$1);
926
+ const float64 = /*#__PURE__*/ new DataView(/*#__PURE__*/ new ArrayBuffer(8));
929
927
  /**
930
928
  * Computes a hash value for a number.
931
929
  *
@@ -935,9 +933,8 @@ const isHash = (u) => hasProperty(u, symbol$1);
935
933
  *
936
934
  * **Details**
937
935
  *
938
- * This function creates a hash value for numeric inputs, handling special cases
939
- * like NaN, Infinity, and -Infinity with distinct hash values. It uses bitwise operations to ensure good distribution
940
- * of hash values across different numeric inputs.
936
+ * Int32 values hash to themselves. Other numbers hash from their IEEE-754 bits,
937
+ * with a canonical representation for `NaN`.
941
938
  *
942
939
  * **Example** (Hashing numbers)
943
940
  *
@@ -955,11 +952,10 @@ const isHash = (u) => hasProperty(u, symbol$1);
955
952
  * @since 2.0.0
956
953
  */
957
954
  const number$1 = (n) => {
958
- if (n !== n || n === Infinity || n === -Infinity) return string$1(String(n));
959
- let h = n | 0;
960
- if (h !== n) h ^= n * 4294967295;
961
- while (n > 4294967295) h ^= n /= 4294967295;
962
- return optimize(h);
955
+ const h = n | 0;
956
+ if (h === n) return optimize(h);
957
+ float64.setFloat64(0, n !== n ? NaN : n);
958
+ return optimize(combine(float64.getInt32(0), float64.getInt32(4)));
963
959
  };
964
960
  /**
965
961
  * Computes a hash value for a string using the djb2 algorithm.
@@ -1017,8 +1013,8 @@ const string$1 = (str) => {
1017
1013
  * const hash1 = Hash.structureKeys(person, ["name", "age"])
1018
1014
  * const hash2 = Hash.structureKeys(person, ["name", "city"])
1019
1015
  *
1020
- * hash1 // => -590673747
1021
- * hash2 // => 284850673
1016
+ * hash1 // => -731887653
1017
+ * hash2 // => 148523102
1022
1018
  *
1023
1019
  * const person2 = { name: "John", age: 30, city: "Boston" }
1024
1020
  * const hash3 = Hash.structureKeys(person2, ["name", "age"])
@@ -1054,9 +1050,9 @@ const structureKeys = (o, keys) => {
1054
1050
  * const obj2 = { name: "Jane", age: 25 }
1055
1051
  * const obj3 = { name: "John", age: 30 }
1056
1052
  *
1057
- * Hash.structure(obj1) // => -590673747
1058
- * Hash.structure(obj2) // => -590160631
1059
- * Hash.structure(obj3) // => -590673747
1053
+ * Hash.structure(obj1) // => -731887653
1054
+ * Hash.structure(obj2) // => -222100417
1055
+ * Hash.structure(obj3) // => -731887653
1060
1056
  * Hash.structure(obj1) === Hash.structure(obj3) // => true
1061
1057
  * ```
1062
1058
  *
@@ -1064,7 +1060,7 @@ const structureKeys = (o, keys) => {
1064
1060
  * @since 2.0.0
1065
1061
  */
1066
1062
  const structure = (o) => structureKeys(o, getAllObjectKeys(o));
1067
- const iterableWith = (seed, f) => (iter) => {
1063
+ const unordered = (seed, f) => (iter) => {
1068
1064
  let h = seed;
1069
1065
  for (const element of iter) h ^= f(element);
1070
1066
  return optimize(h);
@@ -1078,13 +1074,12 @@ const iterableWith = (seed, f) => (iter) => {
1078
1074
  *
1079
1075
  * **Details**
1080
1076
  *
1081
- * The implementation folds element hashes from the seed `6151` with XOR and
1082
- * then optimizes the final hash.
1077
+ * Folds element hashes with {@link combine}, so order and length affect the
1078
+ * result.
1083
1079
  *
1084
1080
  * **Gotchas**
1085
1081
  *
1086
- * A hash is not an equality proof. Because this implementation uses XOR,
1087
- * reordered inputs can produce the same hash.
1082
+ * A hash is not an equality proof. Distinct inputs can still share a hash.
1088
1083
  *
1089
1084
  * **Example** (Hashing arrays)
1090
1085
  *
@@ -1095,11 +1090,8 @@ const iterableWith = (seed, f) => (iter) => {
1095
1090
  * const arr2 = [1, 2, 3]
1096
1091
  * const arr3 = [3, 2, 1]
1097
1092
  *
1098
- * Hash.array(arr1) // => 6151
1099
- * Hash.array(arr2) // => 6151
1100
- * Hash.array(arr3) // => 6151
1101
1093
  * Hash.array(arr1) === Hash.array(arr2) // => true
1102
- * Hash.array(arr1) === Hash.array(arr3) // => true
1094
+ * Hash.array(arr1) === Hash.array(arr3) // => false
1103
1095
  * ```
1104
1096
  *
1105
1097
  * @see {@link hash} for the general-purpose hash dispatcher
@@ -1107,21 +1099,19 @@ const iterableWith = (seed, f) => (iter) => {
1107
1099
  * @category hashing
1108
1100
  * @since 2.0.0
1109
1101
  */
1110
- const array = /*#__PURE__*/ iterableWith(6151, hash);
1111
- const hashMap = /*#__PURE__*/ iterableWith(/*#__PURE__*/ string$1("Map"), ([k, v]) => combine(hash(k), hash(v)));
1112
- const hashSet = /*#__PURE__*/ iterableWith(/*#__PURE__*/ string$1("Set"), hash);
1102
+ const array = (arr) => {
1103
+ let h = 6151;
1104
+ for (const element of arr) h = combine(h, hash(element));
1105
+ return optimize(h);
1106
+ };
1107
+ const hashMap = /*#__PURE__*/ unordered(/*#__PURE__*/ string$1("Map"), ([k, v]) => combine(hash(k), hash(v)));
1108
+ const setSeed = /*#__PURE__*/ string$1("Set");
1109
+ const hashSet = /*#__PURE__*/ unordered(setSeed, (element) => combine(setSeed, hash(element)));
1113
1110
  const randomHashCache = /*#__PURE__*/ new WeakMap();
1114
1111
  const hashCache = /*#__PURE__*/ new WeakMap();
1115
1112
  const visitedObjects = /*#__PURE__*/ new WeakSet();
1116
- function withVisitedTracking$1(obj, fn) {
1117
- if (visitedObjects.has(obj)) return string$1("[Circular]");
1118
- visitedObjects.add(obj);
1119
- const result = fn();
1120
- visitedObjects.delete(obj);
1121
- return result;
1122
- }
1123
1113
  //#endregion
1124
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Equal.js
1114
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Equal.js
1125
1115
  /**
1126
1116
  * Defines the unique string identifier for the `Equal` interface.
1127
1117
  *
@@ -1161,7 +1151,7 @@ function withVisitedTracking$1(obj, fn) {
1161
1151
  * @since 2.0.0
1162
1152
  */
1163
1153
  const symbol = "~effect/Equal";
1164
- function equals$2() {
1154
+ function equals$1() {
1165
1155
  if (arguments.length === 1) return (self) => compareBoth(self, arguments[0]);
1166
1156
  return compareBoth(arguments[0], arguments[1]);
1167
1157
  }
@@ -1173,80 +1163,59 @@ function compareBoth(self, that) {
1173
1163
  if (selfType === "number" && self !== self && that !== that) return true;
1174
1164
  if (selfType !== "object" && selfType !== "function") return false;
1175
1165
  if (byReferenceInstances.has(self) || byReferenceInstances.has(that)) return false;
1176
- return withCache(self, that, compareObjects);
1166
+ return compareObjects(self, that);
1177
1167
  }
1178
- /** Helper to run comparison with proper visited tracking */
1179
- function withVisitedTracking(self, that, fn) {
1180
- const hasLeft = visitedLeft.has(self);
1181
- const hasRight = visitedRight.has(that);
1182
- if (hasLeft && hasRight) return true;
1183
- if (hasLeft || hasRight) return false;
1184
- visitedLeft.add(self);
1185
- visitedRight.add(that);
1186
- const result = fn();
1187
- visitedLeft.delete(self);
1188
- visitedRight.delete(that);
1168
+ function compareObjects(self, that) {
1169
+ const depth = pathLeft.length;
1170
+ for (let i = depth; i-- > 0;) if (pathLeft[i] === self && pathRight[i] === that) return true;
1171
+ if (depth) return compareOnPath(self, that);
1172
+ let known = results.get(self);
1173
+ if (!known) results.set(self, known = /* @__PURE__ */ new WeakMap());
1174
+ let result = known.get(that);
1175
+ if (result === void 0) known.set(that, result = compareOnPath(self, that));
1189
1176
  return result;
1190
1177
  }
1191
- const visitedLeft = /*#__PURE__*/ new WeakSet();
1192
- const visitedRight = /*#__PURE__*/ new WeakSet();
1193
- /** Helper to perform cached object comparison */
1194
- function compareObjects(self, that) {
1178
+ function compareOnPath(self, that) {
1179
+ pathLeft.push(self);
1180
+ pathRight.push(that);
1181
+ try {
1182
+ return compareStructure(self, that);
1183
+ } finally {
1184
+ pathLeft.pop();
1185
+ pathRight.pop();
1186
+ }
1187
+ }
1188
+ const pathLeft = [];
1189
+ const pathRight = [];
1190
+ const results = /*#__PURE__*/ new WeakMap();
1191
+ function compareStructure(self, that) {
1195
1192
  if (hash(self) !== hash(that)) return false;
1196
1193
  else if (self instanceof Date) {
1197
1194
  if (!(that instanceof Date)) return false;
1198
1195
  const selfTime = self.getTime();
1199
1196
  const thatTime = that.getTime();
1200
1197
  return selfTime === thatTime || Number.isNaN(selfTime) && Number.isNaN(thatTime);
1201
- } else if (self instanceof RegExp) {
1202
- if (!(that instanceof RegExp)) return false;
1203
- return self.toString() === that.toString();
1204
- }
1205
- const selfIsEqual = isEqual(self);
1206
- const thatIsEqual = isEqual(that);
1207
- if (selfIsEqual !== thatIsEqual) return false;
1208
- const bothEquals = selfIsEqual && thatIsEqual;
1209
- if (typeof self === "function" && !bothEquals) return false;
1210
- return withVisitedTracking(self, that, () => {
1211
- if (bothEquals) return self[symbol](that);
1212
- else if (Array.isArray(self)) {
1213
- if (!Array.isArray(that) || self.length !== that.length) return false;
1214
- return compareArrays(self, that);
1215
- } else if (ArrayBuffer.isView(self)) {
1216
- const selfIsDataView = self instanceof DataView;
1217
- if (!ArrayBuffer.isView(that) || self.byteLength !== that.byteLength || selfIsDataView !== that instanceof DataView) return false;
1218
- if (selfIsDataView) {
1219
- const thatDataView = that;
1220
- return compareTypedArrays(new Uint8Array(self.buffer, self.byteOffset, self.byteLength), new Uint8Array(thatDataView.buffer, thatDataView.byteOffset, thatDataView.byteLength));
1221
- }
1222
- return compareTypedArrays(self, that);
1223
- } else if (self instanceof Map) {
1224
- if (!(that instanceof Map) || self.size !== that.size) return false;
1225
- return compareMaps(self, that);
1226
- } else if (self instanceof Set) {
1227
- if (!(that instanceof Set) || self.size !== that.size) return false;
1228
- return compareSets(self, that);
1229
- }
1230
- return compareRecords(self, that);
1231
- });
1232
- }
1233
- function withCache(self, that, f) {
1234
- let selfMap = equalityCache.get(self);
1235
- if (!selfMap) {
1236
- selfMap = /* @__PURE__ */ new WeakMap();
1237
- equalityCache.set(self, selfMap);
1238
- } else if (selfMap.has(that)) return selfMap.get(that);
1239
- const result = f(self, that);
1240
- selfMap.set(that, result);
1241
- let thatMap = equalityCache.get(that);
1242
- if (!thatMap) {
1243
- thatMap = /* @__PURE__ */ new WeakMap();
1244
- equalityCache.set(that, thatMap);
1245
- }
1246
- thatMap.set(self, result);
1247
- return result;
1198
+ } else if (self instanceof RegExp) return that instanceof RegExp && self.toString() === that.toString();
1199
+ const bothEquals = isEqual(self);
1200
+ if (bothEquals !== isEqual(that) || typeof self === "function" && !bothEquals) return false;
1201
+ else if (bothEquals) return self[symbol](that);
1202
+ else if (Array.isArray(self)) {
1203
+ if (!Array.isArray(that) || self.length !== that.length) return false;
1204
+ return compareArrays(self, that);
1205
+ } else if (ArrayBuffer.isView(self)) {
1206
+ const selfIsDataView = self instanceof DataView;
1207
+ if (!ArrayBuffer.isView(that) || self.byteLength !== that.byteLength || selfIsDataView !== that instanceof DataView) return false;
1208
+ if (selfIsDataView) return compareTypedArrays(viewBytes(self), viewBytes(that));
1209
+ return compareTypedArrays(self, that);
1210
+ } else if (self instanceof Map) {
1211
+ if (!(that instanceof Map) || self.size !== that.size) return false;
1212
+ return compareHashed(self, that, entryHash, equalEntries);
1213
+ } else if (self instanceof Set) {
1214
+ if (!(that instanceof Set) || self.size !== that.size) return false;
1215
+ return compareHashed(self, that, hash, compareBoth);
1216
+ }
1217
+ return compareRecords(self, that);
1248
1218
  }
1249
- const equalityCache = /*#__PURE__*/ new WeakMap();
1250
1219
  function compareArrays(self, that) {
1251
1220
  for (let i = 0; i < self.length; i++) if (!compareBoth(self[i], that[i])) return false;
1252
1221
  return true;
@@ -1263,48 +1232,29 @@ function compareRecords(self, that) {
1263
1232
  for (const key of selfKeys) if (!thatKeys.has(key) || !compareBoth(self[key], that[key])) return false;
1264
1233
  return true;
1265
1234
  }
1266
- /** @internal */
1267
- function makeCompareMap(keyEquivalence, valueEquivalence) {
1268
- return function compareMaps(self, that) {
1269
- const thatEntries = Array.from(that);
1270
- for (const [selfKey, selfValue] of self) {
1271
- let found = false;
1272
- for (let i = 0; i < thatEntries.length; i++) {
1273
- const [thatKey, thatValue] = thatEntries[i];
1274
- if (keyEquivalence(selfKey, thatKey) && valueEquivalence(selfValue, thatValue)) {
1275
- thatEntries[i] = thatEntries[thatEntries.length - 1];
1276
- thatEntries.pop();
1277
- found = true;
1278
- break;
1279
- }
1235
+ function compareHashed(self, that, hashOf, equivalent) {
1236
+ const groups = /* @__PURE__ */ new Map();
1237
+ for (const item of that) {
1238
+ const h = hashOf(item);
1239
+ const group = groups.get(h);
1240
+ if (group) group.push(item);
1241
+ else groups.set(h, [item]);
1242
+ }
1243
+ outer: for (const item of self) {
1244
+ const group = groups.get(hashOf(item));
1245
+ if (group) {
1246
+ for (let i = 0; i < group.length; i++) if (equivalent(item, group[i])) {
1247
+ group[i] = group[group.length - 1];
1248
+ group.pop();
1249
+ continue outer;
1280
1250
  }
1281
- if (!found) return false;
1282
1251
  }
1283
- return true;
1284
- };
1285
- }
1286
- const compareMaps = /*#__PURE__*/ makeCompareMap(compareBoth, compareBoth);
1287
- /** @internal */
1288
- function makeCompareSet(equivalence) {
1289
- return function compareSets(self, that) {
1290
- const thatValues = Array.from(that);
1291
- for (const selfValue of self) {
1292
- let found = false;
1293
- for (let i = 0; i < thatValues.length; i++) {
1294
- const thatValue = thatValues[i];
1295
- if (equivalence(selfValue, thatValue)) {
1296
- thatValues[i] = thatValues[thatValues.length - 1];
1297
- thatValues.pop();
1298
- found = true;
1299
- break;
1300
- }
1301
- }
1302
- if (!found) return false;
1303
- }
1304
- return true;
1305
- };
1252
+ return false;
1253
+ }
1254
+ return true;
1306
1255
  }
1307
- const compareSets = /*#__PURE__*/ makeCompareSet(compareBoth);
1256
+ const entryHash = (entry) => hash(entry[0]);
1257
+ const equalEntries = (self, that) => compareBoth(self[0], that[0]) && compareBoth(self[1], that[1]);
1308
1258
  /**
1309
1259
  * Checks whether a value implements the {@link Equal} interface.
1310
1260
  *
@@ -1372,9 +1322,9 @@ const isEqual = (u) => hasProperty(u, symbol);
1372
1322
  * @category instances
1373
1323
  * @since 4.0.0
1374
1324
  */
1375
- const asEquivalence = () => equals$2;
1325
+ const asEquivalence = () => equals$1;
1376
1326
  //#endregion
1377
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Redactable.js
1327
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Redactable.js
1378
1328
  /**
1379
1329
  * Defines the symbol used to identify objects that implement the {@link Redactable}
1380
1330
  * protocol.
@@ -1493,7 +1443,7 @@ const emptyContext$1 = {
1493
1443
  }
1494
1444
  };
1495
1445
  //#endregion
1496
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Formatter.js
1446
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Formatter.js
1497
1447
  /**
1498
1448
  * Formats JavaScript values into readable strings.
1499
1449
  *
@@ -1668,7 +1618,7 @@ function safeGet(input, key) {
1668
1618
  }
1669
1619
  }
1670
1620
  //#endregion
1671
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Inspectable.js
1621
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Inspectable.js
1672
1622
  /**
1673
1623
  * Controls how values appear in logs and debugging output.
1674
1624
  *
@@ -1793,7 +1743,7 @@ const BaseProto = {
1793
1743
  }
1794
1744
  };
1795
1745
  //#endregion
1796
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/stackTraceLimit.js
1746
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/stackTraceLimit.js
1797
1747
  /**
1798
1748
  * Check if `Error.stackTraceLimit` is writable.
1799
1749
  * Returns `false` if the property is frozen, non-writable, or `Error` is non-extensible.
@@ -1825,9 +1775,10 @@ const setStackTraceLimit = (value) => {
1825
1775
  if (canWriteStackTraceLimit) Error.stackTraceLimit = value;
1826
1776
  };
1827
1777
  //#endregion
1828
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Utils.js
1778
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Utils.js
1829
1779
  /**
1830
- * Yields its wrapped value exactly once through an `IterableIterator`.
1780
+ * Yields its wrapped value exactly once, then completes with the value sent
1781
+ * back in.
1831
1782
  *
1832
1783
  * **When to use**
1833
1784
  *
@@ -1837,10 +1788,11 @@ const setStackTraceLimit = (value) => {
1837
1788
  *
1838
1789
  * **Details**
1839
1790
  *
1840
- * The first call to `next()` returns `{ value: self, done: false }`. Every
1841
- * subsequent call returns `{ value: a, done: true }` where `a` is the argument
1842
- * passed to `next()`. `[Symbol.iterator]()` returns a **new** `SingleShotGen`
1843
- * wrapping the same value, so the outer type can be iterated multiple times.
1791
+ * The first call to `next()` returns a fresh `{ value: self, done: false }`.
1792
+ * Every subsequent call returns `{ value: a, done: true }` where `a` is the
1793
+ * argument passed to `next()`. To keep `yield*` cheap, the completion result
1794
+ * is the iterator itself rather than a new object, so only the iterator and
1795
+ * the single yielded result are allocated per `yield*`.
1844
1796
  *
1845
1797
  * **Example** (Yielding a wrapped value in a generator)
1846
1798
  *
@@ -1849,20 +1801,19 @@ const setStackTraceLimit = (value) => {
1849
1801
  *
1850
1802
  * const gen = new Utils.SingleShotGen<string, number>("hello")
1851
1803
  *
1852
- * gen.next(0) // => { value: "hello", done: false }
1804
+ * gen.next(0).value // => "hello"
1853
1805
  *
1854
- * gen.next(42) // => { value: 42, done: true }
1806
+ * gen.next(42).value // => 42
1855
1807
  * ```
1856
1808
  *
1857
1809
  * @see {@link Gen} for the type-level signature that relies on `SingleShotGen`
1858
1810
  * @category constructors
1859
1811
  * @since 2.0.0
1860
1812
  */
1861
- var SingleShotGen = class SingleShotGen {
1862
- called = false;
1863
- self;
1813
+ var SingleShotGen = class {
1864
1814
  constructor(self) {
1865
- this.self = self;
1815
+ this.value = self;
1816
+ this.done = false;
1866
1817
  }
1867
1818
  /**
1868
1819
  * Yields the stored value once, then completes with the value sent back in.
@@ -1875,26 +1826,15 @@ var SingleShotGen = class SingleShotGen {
1875
1826
  * @since 2.0.0
1876
1827
  */
1877
1828
  next(a) {
1878
- return this.called ? {
1879
- value: a,
1880
- done: true
1881
- } : (this.called = true, {
1882
- value: this.self,
1829
+ if (this.done) {
1830
+ this.value = a;
1831
+ return this;
1832
+ }
1833
+ this.done = true;
1834
+ return {
1835
+ value: this.value,
1883
1836
  done: false
1884
- });
1885
- }
1886
- /**
1887
- * Creates a fresh single-shot iterator over the stored value.
1888
- *
1889
- * **When to use**
1890
- *
1891
- * Use to iterate the wrapped value again without reusing the consumed
1892
- * iterator state.
1893
- *
1894
- * @since 2.0.0
1895
- */
1896
- [Symbol.iterator]() {
1897
- return new SingleShotGen(this.self);
1837
+ };
1898
1838
  }
1899
1839
  };
1900
1840
  const pickInternalCall = () => {
@@ -1912,7 +1852,7 @@ const pickInternalCall = () => {
1912
1852
  /** @internal */
1913
1853
  const internalCall = /*#__PURE__*/ pickInternalCall();
1914
1854
  //#endregion
1915
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/record.js
1855
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/record.js
1916
1856
  /** @internal */
1917
1857
  function assignProperty(self, key, value) {
1918
1858
  if (key === "__proto__") Object.defineProperty(self, key, {
@@ -1928,7 +1868,7 @@ function assignProperties(self, source) {
1928
1868
  for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProperty(self, key, source[key]);
1929
1869
  }
1930
1870
  //#endregion
1931
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/core.js
1871
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/core.js
1932
1872
  /** @internal */
1933
1873
  const EffectTypeId = `~effect/Effect`;
1934
1874
  /** @internal */
@@ -2017,7 +1957,7 @@ var CauseImpl = class {
2017
1957
  return this.toJSON();
2018
1958
  }
2019
1959
  [symbol](that) {
2020
- return isCause(that) && this.reasons.length === that.reasons.length && this.reasons.every((e, i) => equals$2(e, that.reasons[i]));
1960
+ return isCause(that) && this.reasons.length === that.reasons.length && this.reasons.every((e, i) => equals$1(e, that.reasons[i]));
2021
1961
  }
2022
1962
  [symbol$1]() {
2023
1963
  return array(this.reasons);
@@ -2078,7 +2018,7 @@ var Fail = class extends ReasonBase {
2078
2018
  };
2079
2019
  }
2080
2020
  [symbol](that) {
2081
- return isFailReason$1(that) && equals$2(this.error, that.error) && equals$2(this.annotations, that.annotations);
2021
+ return isFailReason$1(that) && equals$1(this.error, that.error) && equals$1(this.annotations, that.annotations);
2082
2022
  }
2083
2023
  [symbol$1]() {
2084
2024
  return combine(string$1(this._tag))(combine(hash(this.error))(hash(this.annotations)));
@@ -2104,7 +2044,7 @@ var Die = class extends ReasonBase {
2104
2044
  };
2105
2045
  }
2106
2046
  [symbol](that) {
2107
- return isDieReason(that) && equals$2(this.defect, that.defect) && equals$2(this.annotations, that.annotations);
2047
+ return isDieReason(that) && equals$1(this.defect, that.defect) && equals$1(this.annotations, that.annotations);
2108
2048
  }
2109
2049
  [symbol$1]() {
2110
2050
  return combine(string$1(this._tag))(combine(hash(this.defect))(hash(this.annotations)));
@@ -2166,7 +2106,7 @@ const makeExit = (options) => {
2166
2106
  };
2167
2107
  },
2168
2108
  [symbol](that) {
2169
- return isExit(that) && that._tag === this._tag && equals$2(this[args], that[args]);
2109
+ return isExit(that) && that._tag === this._tag && equals$1(this[args], that[args]);
2170
2110
  },
2171
2111
  [symbol$1]() {
2172
2112
  return combine(string$1(options.op), hash(this[args]));
@@ -2264,7 +2204,7 @@ const TaggedError$1 = (tag) => {
2264
2204
  return Base;
2265
2205
  };
2266
2206
  //#endregion
2267
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Effectable.js
2207
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Effectable.js
2268
2208
  /**
2269
2209
  * Create a low-level `Effect` prototype.
2270
2210
  *
@@ -2289,58 +2229,7 @@ const Prototype = (options) => makePrimitiveProto({
2289
2229
  [evaluate]: options.evaluate
2290
2230
  });
2291
2231
  //#endregion
2292
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Equivalence.js
2293
- /**
2294
- * Creates a custom equivalence relation with an optimized reference equality check.
2295
- *
2296
- * **When to use**
2297
- *
2298
- * Use when you need an equality rule that the built-in instances and input
2299
- * mapping helpers cannot express, and you can provide a law-abiding comparison.
2300
- *
2301
- * **Details**
2302
- *
2303
- * The returned equivalence first checks reference equality (`===`) for
2304
- * performance. If the values are not the same reference, it falls back to the
2305
- * provided equivalence function, which must satisfy reflexive, symmetric, and
2306
- * transitive properties.
2307
- *
2308
- * **Example** (Case-insensitive string equivalence)
2309
- *
2310
- * ```ts import.meta.vitest
2311
- * import { Equivalence } from "effect"
2312
- *
2313
- * const caseInsensitive = Equivalence.make<string>((a, b) =>
2314
- * a.toLowerCase() === b.toLowerCase()
2315
- * )
2316
- *
2317
- * caseInsensitive("Hello", "HELLO") // => true
2318
- * caseInsensitive("foo", "bar") // => false
2319
- *
2320
- * // Same reference optimization
2321
- * const str = "test"
2322
- * caseInsensitive(str, str) // => true
2323
- * ```
2324
- *
2325
- * **Example** (Comparing numbers with tolerance)
2326
- *
2327
- * ```ts import.meta.vitest
2328
- * import { Equivalence } from "effect"
2329
- *
2330
- * const tolerance = Equivalence.make<number>((a, b) => Math.abs(a - b) < 0.0001)
2331
- *
2332
- * tolerance(1.0, 1.001) // => false
2333
- * tolerance(1.0, 1.00001) // => true
2334
- * ```
2335
- *
2336
- * @see {@link strictEqual}
2337
- * @see {@link mapInput}
2338
- * @category constructors
2339
- * @since 2.0.0
2340
- */
2341
- const make$14 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
2342
- //#endregion
2343
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/option.js
2232
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/option.js
2344
2233
  /**
2345
2234
  * @since 2.0.0
2346
2235
  */
@@ -2356,7 +2245,7 @@ const SomeProto = /*#__PURE__*/ Object.defineProperty(/*#__PURE__*/ Object.assig
2356
2245
  _tag: "Some",
2357
2246
  _op: "Some",
2358
2247
  [symbol](that) {
2359
- return isOption(that) && isSome$1(that) && equals$2(this.value, that.value);
2248
+ return isOption(that) && isSome$1(that) && equals$1(this.value, that.value);
2360
2249
  },
2361
2250
  [symbol$1]() {
2362
2251
  return combine(hash(this._tag))(hash(this.value));
@@ -2411,7 +2300,7 @@ SomeImpl.prototype = SomeProto;
2411
2300
  /** @internal */
2412
2301
  const some$2 = (value) => new SomeImpl(value);
2413
2302
  //#endregion
2414
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/result.js
2303
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/result.js
2415
2304
  const TypeId$11 = "~effect/Result";
2416
2305
  const CommonProto = {
2417
2306
  [TypeId$11]: {
@@ -2428,7 +2317,7 @@ const SuccessProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Com
2428
2317
  _tag: "Success",
2429
2318
  _op: "Success",
2430
2319
  [symbol](that) {
2431
- return isResult(that) && isSuccess$2(that) && equals$2(this.success, that.success);
2320
+ return isResult(that) && isSuccess$2(that) && equals$1(this.success, that.success);
2432
2321
  },
2433
2322
  [symbol$1]() {
2434
2323
  return combine(hash(this._tag))(hash(this.success));
@@ -2448,7 +2337,7 @@ const FailureProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Com
2448
2337
  _tag: "Failure",
2449
2338
  _op: "Failure",
2450
2339
  [symbol](that) {
2451
- return isResult(that) && isFailure$1(that) && equals$2(this.failure, that.failure);
2340
+ return isResult(that) && isFailure$1(that) && equals$1(this.failure, that.failure);
2452
2341
  },
2453
2342
  [symbol$1]() {
2454
2343
  return combine(hash(this._tag))(hash(this.failure));
@@ -2487,7 +2376,87 @@ const succeed$5 = (success) => new SuccessImpl(success);
2487
2376
  /** @internal */
2488
2377
  const fromOption$1 = /*#__PURE__*/ dual(2, (self, onNone) => isNone$1(self) ? fail$5(onNone()) : succeed$5(self.value));
2489
2378
  //#endregion
2490
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Option.js
2379
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Order.js
2380
+ /**
2381
+ * Defines comparison functions for ordered values.
2382
+ *
2383
+ * An `Order<A>` compares two `A` values and returns whether the first is less
2384
+ * than, equal to, or greater than the second. Orders are used for sorting,
2385
+ * choosing minimum or maximum values, checking ranges, and building ordered data
2386
+ * structures. This module includes built-in orders, constructors for custom
2387
+ * orders, tools for reversing and combining comparisons, tuple and struct
2388
+ * helpers, comparison predicates, clamping, and reducer support.
2389
+ *
2390
+ * @since 2.0.0
2391
+ */
2392
+ /**
2393
+ * Creates a new `Order` instance from a comparison function.
2394
+ *
2395
+ * **When to use**
2396
+ *
2397
+ * Use when you need a sorting rule not covered by the built-in orders or input
2398
+ * mapping helpers, and you can provide a total comparison.
2399
+ *
2400
+ * **Details**
2401
+ *
2402
+ * Uses reference equality (`===`) as a shortcut: if `self === that`, it returns
2403
+ * `0` without calling the comparison function. The comparison function should
2404
+ * return `-1`, `0`, or `1`, and the returned order satisfies total ordering
2405
+ * laws when the comparison function does.
2406
+ *
2407
+ * **Example** (Creating an Order)
2408
+ *
2409
+ * ```ts import.meta.vitest
2410
+ * import { Order } from "effect"
2411
+ *
2412
+ * const byAge = Order.make<{ name: string; age: number }>((self, that) => {
2413
+ * if (self.age < that.age) return -1
2414
+ * if (self.age > that.age) return 1
2415
+ * return 0
2416
+ * })
2417
+ *
2418
+ * byAge({ name: "Alice", age: 30 }, { name: "Bob", age: 25 }) // => 1
2419
+ * byAge({ name: "Alice", age: 25 }, { name: "Bob", age: 30 }) // => -1
2420
+ * ```
2421
+ *
2422
+ * @see {@link mapInput} to transform an order by mapping the input type
2423
+ * @see {@link combine} to combine multiple orders
2424
+ * @category constructors
2425
+ * @since 2.0.0
2426
+ */
2427
+ function make$13(compare) {
2428
+ return (self, that) => self === that ? 0 : compare(self, that);
2429
+ }
2430
+ /**
2431
+ * Order instance for strings that compares them lexicographically using JavaScript's `<` operator.
2432
+ *
2433
+ * **When to use**
2434
+ *
2435
+ * Use when you need lexicographic string ordering.
2436
+ *
2437
+ * **Details**
2438
+ *
2439
+ * Uses lexicographic dictionary ordering. The empty string is less than any
2440
+ * non-empty string, and comparisons are case-sensitive.
2441
+ *
2442
+ * **Example** (Ordering strings)
2443
+ *
2444
+ * ```ts import.meta.vitest
2445
+ * import { Order } from "effect"
2446
+ *
2447
+ * Order.String("apple", "banana") // => -1
2448
+ * Order.String("banana", "apple") // => 1
2449
+ * Order.String("apple", "apple") // => 0
2450
+ * ```
2451
+ *
2452
+ * @see {@link mapInput} to compare objects by a string property
2453
+ * @see {@link Struct} to combine with other orders for struct comparison
2454
+ * @category instances
2455
+ * @since 4.0.0
2456
+ */
2457
+ const String$4 = /*#__PURE__*/ make$13((self, that) => self < that ? -1 : 1);
2458
+ //#endregion
2459
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Option.js
2491
2460
  /**
2492
2461
  * Creates an `Option` representing the absence of a value.
2493
2462
  *
@@ -3057,7 +3026,7 @@ const gen$2 = (...args) => {
3057
3026
  return some$1(state.value);
3058
3027
  };
3059
3028
  //#endregion
3060
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Context.js
3029
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Context.js
3061
3030
  /**
3062
3031
  * Runtime type identifier attached to `Context` service keys and used by
3063
3032
  * `isKey` to recognize them.
@@ -3192,7 +3161,7 @@ const lookup = (self, key) => {
3192
3161
  for (let overlay = impl.overlay; overlay; overlay = overlay.parent) if (overlay.key === key) return overlay.value;
3193
3162
  const value = impl.base.get(key);
3194
3163
  if (value === void 0 && !impl.base.has(key)) return notFound;
3195
- if (impl.overlay && ++impl.baseHits >= FlattenAfterBaseHits) {
3164
+ if (impl.overlay && ++impl.baseHits >= impl.base.size && impl.baseHits >= FlattenAfterBaseHits) {
3196
3165
  impl.base = flatten(impl);
3197
3166
  impl.overlay = void 0;
3198
3167
  impl.depth = 0;
@@ -3251,7 +3220,7 @@ const Proto$3 = {
3251
3220
  const self = this.mapUnsafe;
3252
3221
  const other = that.mapUnsafe;
3253
3222
  if (self.size !== other.size) return false;
3254
- for (const [key, value] of self) if (!other.has(key) || !equals$2(value, other.get(key))) return false;
3223
+ for (const [key, value] of self) if (!other.has(key) || !equals$1(value, other.get(key))) return false;
3255
3224
  return true;
3256
3225
  },
3257
3226
  [symbol$1]() {
@@ -3508,7 +3477,7 @@ const serviceNotFoundError = (service) => {
3508
3477
  */
3509
3478
  const Reference = Service;
3510
3479
  //#endregion
3511
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Duration.js
3480
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Duration.js
3512
3481
  const TypeId$9 = "~effect/Duration";
3513
3482
  const bigint0$1 = /*#__PURE__*/ BigInt(0);
3514
3483
  const bigint1$1 = /*#__PURE__*/ BigInt(1);
@@ -3629,7 +3598,7 @@ const DurationProto = {
3629
3598
  }
3630
3599
  },
3631
3600
  [symbol](that) {
3632
- return isDuration(that) && equals$1(this, that);
3601
+ return isDuration(that) && equals(this, that);
3633
3602
  },
3634
3603
  toString() {
3635
3604
  switch (this.value._tag) {
@@ -3931,7 +3900,7 @@ const matchPair = /*#__PURE__*/ dual(3, (self, that, options) => {
3931
3900
  * @category instances
3932
3901
  * @since 2.0.0
3933
3902
  */
3934
- const Equivalence$2 = (self, that) => matchPair(self, that, {
3903
+ const Equivalence$1 = (self, that) => matchPair(self, that, {
3935
3904
  onMillis: (self, that) => self === that,
3936
3905
  onNanos: (self, that) => self === that,
3937
3906
  onInfinity: (self, that) => self.value._tag === that.value._tag
@@ -3950,16 +3919,16 @@ const Equivalence$2 = (self, that) => matchPair(self, that, {
3950
3919
  * @category predicates
3951
3920
  * @since 2.0.0
3952
3921
  */
3953
- const equals$1 = /*#__PURE__*/ dual(2, (self, that) => Equivalence$2(self, that));
3922
+ const equals = /*#__PURE__*/ dual(2, (self, that) => Equivalence$1(self, that));
3954
3923
  //#endregion
3955
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/array.js
3924
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/array.js
3956
3925
  /**
3957
3926
  * @since 2.0.0
3958
3927
  */
3959
3928
  /** @internal */
3960
3929
  const isArrayNonEmpty$1 = (self) => self.length > 0;
3961
3930
  //#endregion
3962
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/count.js
3931
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/count.js
3963
3932
  /**
3964
3933
  * Normalizes a collection count to a non-negative integer. `NaN` and
3965
3934
  * non-positive values become `0`; positive infinity is preserved.
@@ -3968,7 +3937,7 @@ const isArrayNonEmpty$1 = (self) => self.length > 0;
3968
3937
  */
3969
3938
  const normalize$1 = (n) => n > 0 ? Math.floor(n) : 0;
3970
3939
  //#endregion
3971
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Result.js
3940
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Result.js
3972
3941
  /**
3973
3942
  * Creates a `Result` holding a `Success` value.
3974
3943
  *
@@ -4110,7 +4079,7 @@ const fromOption = fromOption$1;
4110
4079
  */
4111
4080
  const isSuccess$1 = isSuccess$2;
4112
4081
  //#endregion
4113
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Tuple.js
4082
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Tuple.js
4114
4083
  /**
4115
4084
  * Creates a tuple from the provided arguments.
4116
4085
  *
@@ -4139,7 +4108,7 @@ const isSuccess$1 = isSuccess$2;
4139
4108
  */
4140
4109
  const make$10 = (...elements) => elements;
4141
4110
  //#endregion
4142
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Iterable.js
4111
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Iterable.js
4143
4112
  /**
4144
4113
  * Returns the first element that satisfies the specified
4145
4114
  * predicate, or `None` if no such element exists.
@@ -4192,7 +4161,7 @@ const findFirst$1 = /*#__PURE__*/ dual(2, (self, f) => {
4192
4161
  return none();
4193
4162
  });
4194
4163
  //#endregion
4195
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Record.js
4164
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Record.js
4196
4165
  /**
4197
4166
  * Creates a new, empty record.
4198
4167
  *
@@ -4330,7 +4299,7 @@ const union$1 = /*#__PURE__*/ dual(3, (self, that, combine) => {
4330
4299
  return out;
4331
4300
  });
4332
4301
  //#endregion
4333
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Array.js
4302
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Array.js
4334
4303
  /**
4335
4304
  * Works with JavaScript arrays, readonly arrays, and non-empty arrays.
4336
4305
  *
@@ -5139,7 +5108,7 @@ const flatMap$2 = /*#__PURE__*/ dual(2, (self, f) => {
5139
5108
  * ```
5140
5109
  *
5141
5110
  * @see {@link filter} — keep original elements matching a predicate
5142
- * @see {@link partition} for keeping both failures and successes
5111
+ * @see {@link partition} for keeping both successes and failures
5143
5112
  *
5144
5113
  * @category filtering
5145
5114
  * @since 2.0.0
@@ -5274,7 +5243,7 @@ const some = /*#__PURE__*/ dual(2, (self, predicate) => self.some(predicate));
5274
5243
  */
5275
5244
  const join = /*#__PURE__*/ dual(2, (self, sep) => fromIterable$1(self).join(sep));
5276
5245
  //#endregion
5277
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Scheduler.js
5246
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Scheduler.js
5278
5247
  /**
5279
5248
  * Controls how runnable Effect fiber tasks are dispatched.
5280
5249
  *
@@ -5543,7 +5512,7 @@ const PreventSchedulerYield = /*#__PURE__*/ Reference("effect/Scheduler/PreventS
5543
5512
  */
5544
5513
  const TaggedError = TaggedError$1;
5545
5514
  //#endregion
5546
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Tracer.js
5515
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Tracer.js
5547
5516
  /**
5548
5517
  * Defines the string key for the parent-span context service.
5549
5518
  *
@@ -5578,11 +5547,11 @@ const ParentSpanKey = "effect/Tracer/ParentSpan";
5578
5547
  */
5579
5548
  const TracerKey = "effect/Tracer";
5580
5549
  //#endregion
5581
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/metric.js
5550
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/metric.js
5582
5551
  /** @internal */
5583
5552
  const FiberRuntimeMetricsKey = "effect/Metric/FiberRuntimeMetrics";
5584
5553
  //#endregion
5585
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/references.js
5554
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/references.js
5586
5555
  /** @internal */
5587
5556
  const CurrentStackFrame = /*#__PURE__*/ Reference("effect/References/CurrentStackFrame", {
5588
5557
  fiberCached: true,
@@ -5604,7 +5573,7 @@ const MinimumLogLevel = /*#__PURE__*/ Reference("effect/References/MinimumLogLev
5604
5573
  defaultValue: () => "Info"
5605
5574
  });
5606
5575
  //#endregion
5607
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/effect.js
5576
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/effect.js
5608
5577
  /** @internal */
5609
5578
  var Interrupt = class extends ReasonBase {
5610
5579
  constructor(fiberId, annotations = constEmptyAnnotations) {
@@ -5638,7 +5607,7 @@ const dedupeReasons = (self, that) => {
5638
5607
  const hash$1 = hash(reason);
5639
5608
  const bucket = buckets.get(hash$1);
5640
5609
  if (bucket === void 0) buckets.set(hash$1, [reason]);
5641
- else if (bucket.some((previous) => equals$2(previous, reason))) continue;
5610
+ else if (bucket.some((previous) => equals$1(previous, reason))) continue;
5642
5611
  else bucket.push(reason);
5643
5612
  out.push(reason);
5644
5613
  }
@@ -5649,7 +5618,7 @@ const causeCombine = /*#__PURE__*/ dual(2, (self, that) => {
5649
5618
  if (self.reasons.length === 0) return that;
5650
5619
  else if (that.reasons.length === 0) return self;
5651
5620
  const newCause = new CauseImpl(dedupeReasons(self.reasons, that.reasons));
5652
- return equals$2(self, newCause) ? self : newCause;
5621
+ return equals$1(self, newCause) ? self : newCause;
5653
5622
  });
5654
5623
  /** @internal */
5655
5624
  const causeMap = /*#__PURE__*/ dual(2, (self, f) => {
@@ -5664,21 +5633,14 @@ const causeMap = /*#__PURE__*/ dual(2, (self, f) => {
5664
5633
  return hasFail ? causeFromReasons(failures) : self;
5665
5634
  });
5666
5635
  /** @internal */
5667
- const causePartition = (self) => {
5668
- const obj = {
5669
- Fail: [],
5670
- Die: [],
5671
- Interrupt: []
5672
- };
5673
- for (let i = 0; i < self.reasons.length; i++) obj[self.reasons[i]._tag].push(self.reasons[i]);
5674
- return obj;
5675
- };
5676
- /** @internal */
5677
5636
  const causeSquash = (self) => {
5678
- const partitioned = causePartition(self);
5679
- if (partitioned.Fail.length > 0) return partitioned.Fail[0].error;
5680
- else if (partitioned.Die.length > 0) return partitioned.Die[0].defect;
5681
- else if (partitioned.Interrupt.length > 0) return new globalThis.Error("All fibers interrupted without error");
5637
+ let die;
5638
+ for (const reason of self.reasons) {
5639
+ if (reason._tag === "Fail") return reason.error;
5640
+ if (reason._tag === "Die") die ??= reason;
5641
+ }
5642
+ if (die !== void 0) return die.defect;
5643
+ if (self.reasons.length > 0) return new globalThis.Error("All fibers interrupted without error");
5682
5644
  return new globalThis.Error("Empty cause");
5683
5645
  };
5684
5646
  /** @internal */
@@ -5693,7 +5655,6 @@ const getCurrentFiber = () => globalThis[currentFiberTypeId];
5693
5655
  /** @internal */
5694
5656
  var FiberImpl = class {
5695
5657
  constructor(context, interruptible = true) {
5696
- this[FiberTypeId] = fiberVariance;
5697
5658
  this.setContext(context);
5698
5659
  this.id = ++fiberIdStore.id;
5699
5660
  this.currentOpCount = 0;
@@ -5709,22 +5670,9 @@ var FiberImpl = class {
5709
5670
  this._parent = void 0;
5710
5671
  this.cache.runtimeMetrics?.recordFiberStart(this.context);
5711
5672
  }
5712
- [FiberTypeId];
5713
- id;
5714
- interruptible;
5715
- currentOpCount;
5716
- _stack;
5717
- _observers;
5718
- _exit;
5719
- _children;
5720
- _interruptedCause;
5721
- _yielded;
5722
- _running;
5723
- _deferredInterrupt;
5724
- _parent;
5725
- context;
5726
- cache;
5727
- _dispatcher = void 0;
5673
+ get [FiberTypeId]() {
5674
+ return fiberVariance;
5675
+ }
5728
5676
  get currentDispatcher() {
5729
5677
  return this._dispatcher ??= this.cache.scheduler.makeDispatcher();
5730
5678
  }
@@ -5738,11 +5686,12 @@ var FiberImpl = class {
5738
5686
  }
5739
5687
  if (this._observers === void 0) this._observers = [cb];
5740
5688
  else this._observers.push(cb);
5741
- return () => {
5742
- if (this._exit || this._observers === void 0) return;
5743
- const index = this._observers.indexOf(cb);
5744
- if (index >= 0) this._observers.splice(index, 1);
5745
- };
5689
+ return () => this.removeObserver(cb);
5690
+ }
5691
+ removeObserver(cb) {
5692
+ if (this._exit || this._observers === void 0) return;
5693
+ const index = this._observers.indexOf(cb);
5694
+ if (index >= 0) this._observers.splice(index, 1);
5746
5695
  }
5747
5696
  interruptUnsafe(fiberId, annotations) {
5748
5697
  if (this._exit) return;
@@ -5847,6 +5796,11 @@ var FiberImpl = class {
5847
5796
  if (op[symbol]) return op;
5848
5797
  }
5849
5798
  }
5799
+ succeedWith(value) {
5800
+ if ((++this.currentOpCount & maxInlineSteps - 1) === 0) return exitSucceed(value);
5801
+ const cont = this.getCont(contA);
5802
+ return cont ? cont[contA](value, this) : this.yieldWith(exitSucceed(value));
5803
+ }
5850
5804
  yieldWith(value) {
5851
5805
  this._yielded = value;
5852
5806
  return Yield;
@@ -5863,7 +5817,7 @@ var FiberImpl = class {
5863
5817
  if (previous !== void 0 && hasSameCache(previous, context)) return;
5864
5818
  const root = context.cacheRoot;
5865
5819
  const cache = root._fiberCache ??= makeFiberContextCache(context);
5866
- if (this.cache !== void 0 && this.cache.scheduler !== cache.scheduler) this._dispatcher = void 0;
5820
+ if (this.cache?.scheduler !== cache.scheduler) this._dispatcher = void 0;
5867
5821
  this.cache = cache;
5868
5822
  }
5869
5823
  get currentSpanLocal() {
@@ -5895,6 +5849,7 @@ const deferredInterruptCont = {
5895
5849
  return failCause$1(fiber._interruptedCause);
5896
5850
  }
5897
5851
  };
5852
+ const maxInlineSteps = 32;
5898
5853
  const fiberMiddleware = { interruptChildren: void 0 };
5899
5854
  const fiberStackAnnotations = (fiber) => {
5900
5855
  if (!fiber.cache.stackFrame) return void 0;
@@ -5952,7 +5907,7 @@ const sync$1 = /*#__PURE__*/ makePrimitive({
5952
5907
  }
5953
5908
  });
5954
5909
  /** @internal */
5955
- const suspend = /*#__PURE__*/ makePrimitive({
5910
+ const suspend$1 = /*#__PURE__*/ makePrimitive({
5956
5911
  op: "Suspend",
5957
5912
  [evaluate](_fiber) {
5958
5913
  return this[args]();
@@ -5973,7 +5928,7 @@ const yieldNow = /*#__PURE__*/ (/* @__PURE__ */ makePrimitive({
5973
5928
  }
5974
5929
  }))(0);
5975
5930
  /** @internal */
5976
- const failCauseSync$1 = (evaluate) => suspend(() => failCause$1(internalCall(evaluate)));
5931
+ const failCauseSync$1 = (evaluate) => suspend$1(() => failCause$1(evaluate()));
5977
5932
  /** @internal */
5978
5933
  const die$2 = (defect) => exitDie(defect);
5979
5934
  /** @internal */
@@ -5982,11 +5937,10 @@ const callbackOptions = /*#__PURE__*/ function() {
5982
5937
  const Proto = /*#__PURE__*/ makePrimitiveProto({
5983
5938
  op: "Async",
5984
5939
  [evaluate](fiber) {
5985
- const register = internalCall(() => this.register.bind(fiber.cache.scheduler));
5986
5940
  let resumed = false;
5987
5941
  let yielded = false;
5988
5942
  const controller = this.withSignal ? new AbortController() : void 0;
5989
- const onCancel = register((effect) => {
5943
+ const onCancel = this.register.call(fiber.cache.scheduler, (effect) => {
5990
5944
  if (resumed) return;
5991
5945
  resumed = true;
5992
5946
  if (yielded) fiber.evaluate(effect);
@@ -6024,7 +5978,7 @@ const asyncFinalizer = /*#__PURE__*/ makePrimitive({
6024
5978
  }
6025
5979
  },
6026
5980
  [contE](cause, _fiber) {
6027
- return hasInterrupts(cause) ? flatMap$1(this[args](), () => failCause$1(cause)) : failCause$1(cause);
5981
+ return hasInterrupts(cause) ? flatMap$1(combineFinalizerCause(exitFailCause(cause), this[args]()), () => failCause$1(cause)) : failCause$1(cause);
6028
5982
  }
6029
5983
  });
6030
5984
  /** @internal */
@@ -6033,10 +5987,10 @@ const callback = (register) => callbackOptions(register, register.length >= 2);
6033
5987
  const gen$1 = (...args) => {
6034
5988
  if (args.length === 1) {
6035
5989
  const body = args[0];
6036
- return suspend(() => fromIteratorUnsafe(body()));
5990
+ return suspend$1(() => fromIteratorUnsafe(body()));
6037
5991
  }
6038
5992
  const [options, body] = args;
6039
- return suspend(() => fromIteratorUnsafe(body.call(options.self)));
5993
+ return suspend$1(() => fromIteratorUnsafe(body.call(options.self)));
6040
5994
  };
6041
5995
  const defineFunctionLength = (length, fn) => Object.defineProperty(fn, "length", {
6042
5996
  value: length,
@@ -6064,11 +6018,11 @@ const fromIteratorEagerUnsafe = (evaluate) => {
6064
6018
  } else if (primitive && primitive._tag === "Failure") return state.value;
6065
6019
  else {
6066
6020
  let isFirstExecution = true;
6067
- return suspend(() => {
6021
+ return suspend$1(() => {
6068
6022
  if (isFirstExecution) {
6069
6023
  isFirstExecution = false;
6070
6024
  return flatMap$1(state.value, (value) => fromIteratorUnsafe(iterator, value));
6071
- } else return suspend(() => fromIteratorUnsafe(evaluate()));
6025
+ } else return suspend$1(() => fromIteratorUnsafe(evaluate()));
6072
6026
  });
6073
6027
  }
6074
6028
  }
@@ -6114,11 +6068,6 @@ const OnSuccessProto = /*#__PURE__*/ makePrimitiveProto({
6114
6068
  op: "OnSuccess",
6115
6069
  [evaluate]: evaluateCont
6116
6070
  });
6117
- const OnSuccessImpl = function(self, f) {
6118
- this[args] = self;
6119
- this[contA] = f;
6120
- };
6121
- OnSuccessImpl.prototype = OnSuccessProto;
6122
6071
  const ContImpl = function(self, cont, payload) {
6123
6072
  this[args] = self;
6124
6073
  this[contA] = cont;
@@ -6128,20 +6077,26 @@ ContImpl.prototype = OnSuccessProto;
6128
6077
  const returnPayload = function() {
6129
6078
  return this.payload;
6130
6079
  };
6131
- const mapCont = function(value) {
6080
+ const continuationMarksStack = /*#__PURE__*/ (() => {
6081
+ const marker = "~effect/Effect/stackProbe";
6082
+ return { [marker]: function stackProbe() {
6083
+ return (/* @__PURE__ */ new Error()).stack;
6084
+ } }[marker]()?.includes("[as " + marker + "]") === true;
6085
+ })();
6086
+ const mapCont = function(value, fiber) {
6132
6087
  const f = this.payload;
6133
- return succeed$3(internalCall(() => f(value)));
6088
+ return fiber.succeedWith(continuationMarksStack ? f(value) : internalCall(() => f(value)));
6134
6089
  };
6135
6090
  const andThenCont = function(value) {
6136
6091
  const f = this.payload;
6137
- return internalCall(() => f(value));
6092
+ return f(value);
6138
6093
  };
6139
6094
  /** @internal */
6140
6095
  const andThen$1 = /*#__PURE__*/ dual(2, (self, f) => new ContImpl(self, isEffect(f) ? returnPayload : andThenCont, f));
6141
6096
  /** @internal */
6142
6097
  const asVoid = (self) => new ContImpl(self, returnPayload, exitVoid);
6143
6098
  /** @internal */
6144
- const flatMap$1 = /*#__PURE__*/ dual(2, (self, f) => new OnSuccessImpl(self, f.length !== 1 ? (a) => f(a) : f));
6099
+ const flatMap$1 = /*#__PURE__*/ dual(2, (self, f) => new ContImpl(self, andThenCont, f));
6145
6100
  /** @internal */
6146
6101
  const effectIsExit = (effect) => effect[ExitTypeId] !== void 0;
6147
6102
  /** @internal */
@@ -6167,9 +6122,10 @@ const updateContext = /*#__PURE__*/ dual(2, (self, f) => withFiber((fiber) => {
6167
6122
  const nextContext = f(prevContext);
6168
6123
  if (prevContext === nextContext) return self;
6169
6124
  fiber.setContext(nextContext);
6170
- return onExitPrimitive(self, () => {
6125
+ onExitUnsafe(fiber, () => {
6171
6126
  fiber.setContext(prevContext);
6172
6127
  });
6128
+ return self;
6173
6129
  }));
6174
6130
  /** @internal */
6175
6131
  const provideService$1 = function() {
@@ -6206,16 +6162,15 @@ const exitPrimitive = /*#__PURE__*/ makePrimitive({
6206
6162
  fiber._stack.push(this);
6207
6163
  return this[args];
6208
6164
  },
6209
- [contA](value, _, exit) {
6210
- return succeed$3(exit ?? exitSucceed(value));
6165
+ [contA](value, fiber, exit) {
6166
+ return fiber.succeedWith(exit ?? exitSucceed(value));
6211
6167
  },
6212
- [contE](cause, _, exit) {
6213
- return succeed$3(exit ?? exitFailCause(cause));
6168
+ [contE](cause, fiber, exit) {
6169
+ return fiber.succeedWith(exit ?? exitFailCause(cause));
6214
6170
  }
6215
6171
  });
6216
6172
  const combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause$1(finalizer, (cause) => failCause$1(causeCombine(exit_.cause, cause)));
6217
- /** @internal */
6218
- const onExitPrimitive = /*#__PURE__*/ function() {
6173
+ const OnExitImpl = /*#__PURE__*/ function() {
6219
6174
  const Proto = /*#__PURE__*/ makePrimitiveProto({
6220
6175
  op: "OnExit",
6221
6176
  [evaluate](fiber) {
@@ -6230,12 +6185,22 @@ const onExitPrimitive = /*#__PURE__*/ function() {
6230
6185
  },
6231
6186
  [contA](value, _, exit) {
6232
6187
  exit ??= exitSucceed(value);
6233
- const eff = this.onExit(exit);
6188
+ let eff;
6189
+ try {
6190
+ eff = this.onExit(exit);
6191
+ } catch (defect) {
6192
+ eff = exitDie(defect);
6193
+ }
6234
6194
  return eff ? flatMap$1(eff, (_) => exit) : exit;
6235
6195
  },
6236
6196
  [contE](cause, _, exit) {
6237
6197
  exit ??= exitFailCause(cause);
6238
- const eff = this.onExit(exit);
6198
+ let eff;
6199
+ try {
6200
+ eff = this.onExit(exit);
6201
+ } catch (defect) {
6202
+ eff = exitDie(defect);
6203
+ }
6239
6204
  return eff ? flatMap$1(combineFinalizerCause(exit, eff), (_) => exit) : exit;
6240
6205
  }
6241
6206
  });
@@ -6245,10 +6210,15 @@ const onExitPrimitive = /*#__PURE__*/ function() {
6245
6210
  this.interruptible = interruptible;
6246
6211
  };
6247
6212
  OnExitImpl.prototype = Proto;
6248
- return function(effect, onExit, interruptible) {
6249
- return new OnExitImpl(effect, onExit, interruptible);
6250
- };
6213
+ return OnExitImpl;
6251
6214
  }();
6215
+ /**
6216
+ * Pushes an exit finalizer for the current `withFiber` evaluation. Only call inside `withFiber`.
6217
+ * @internal
6218
+ */
6219
+ const onExitUnsafe = (fiber, f) => {
6220
+ fiber._stack.push(new OnExitImpl(void 0, f, void 0));
6221
+ };
6252
6222
  /** @internal */
6253
6223
  const uninterruptible = (self) => withFiber((fiber) => {
6254
6224
  if (!fiber.interruptible) return self;
@@ -6283,7 +6253,7 @@ const whileLoop = /*#__PURE__*/ makePrimitive({
6283
6253
  }
6284
6254
  });
6285
6255
  /** @internal */
6286
- const forEach$1 = /*#__PURE__*/ dual((args) => typeof args[1] === "function", (iterable, f, options) => suspend(() => {
6256
+ const forEach$1 = /*#__PURE__*/ dual((args) => typeof args[1] === "function", (iterable, f, options) => suspend$1(() => {
6287
6257
  const concurrency = resolveConcurrency(options?.concurrency);
6288
6258
  if (concurrency === 1) return forEachSequential(iterable, f, options);
6289
6259
  const items = fromIterable$1(iterable);
@@ -6296,7 +6266,7 @@ const forEach$1 = /*#__PURE__*/ dual((args) => typeof args[1] === "function", (i
6296
6266
  }, items, { concurrency });
6297
6267
  return eff ? as(eff, out) : succeed$3(out);
6298
6268
  }));
6299
- const forEachSequential = (iterable, f, options) => suspend(() => {
6269
+ const forEachSequential = (iterable, f, options) => suspend$1(() => {
6300
6270
  const out = options?.discard ? void 0 : [];
6301
6271
  const iterator = iterable[Symbol.iterator]();
6302
6272
  let state = iterator.next();
@@ -6316,11 +6286,12 @@ const resolveConcurrency = (concurrency) => concurrency === "unbounded" ? Number
6316
6286
  const iterateEager = () => (options) => {
6317
6287
  const onItem = options.onItem;
6318
6288
  const step = options.step;
6289
+ const resumeSequential = (state, items, index, end, effect) => flatMap$1(exit$1(effect), (itemExit) => step(state, items[index], itemExit, index) ?? runSequential(state, items, index + 1, end) ?? void_$2);
6319
6290
  const runSequential = (state, items, index = 0, end = items.length) => {
6320
6291
  for (; index < end; index++) {
6321
6292
  const item = items[index];
6322
6293
  const effect = onItem(state, item, index);
6323
- if (!effectIsExit(effect)) return flatMap$1(exit$1(effect), (itemExit) => step(state, item, itemExit, index) ?? runSequential(state, items, index + 1, end) ?? void_$2);
6294
+ if (!effectIsExit(effect)) return resumeSequential(state, items, index, end, effect);
6324
6295
  const terminal = step(state, item, effect, index);
6325
6296
  if (terminal) return terminal._tag === "Failure" ? terminal : void 0;
6326
6297
  }
@@ -6338,15 +6309,13 @@ const iterateConcurrentImpl = (options) => {
6338
6309
  let parentFiber;
6339
6310
  let fibers;
6340
6311
  let resume;
6341
- let interrupted = false;
6342
6312
  let terminal;
6343
6313
  let effect;
6344
6314
  const failDefect = (error) => {
6345
6315
  const defect = exitDie(error);
6346
6316
  terminal = defect;
6347
6317
  done = true;
6348
- interrupted = true;
6349
- return fibers && fibers.size > 0 ? flatMap$1(uninterruptible(fiberInterruptAll(Array.from(fibers))), () => defect) : defect;
6318
+ return fibers && fibers.size > 0 ? flatMap$1(uninterruptible(fiberInterruptAll(Array.from(fibers))), () => terminal ?? defect) : defect;
6350
6319
  };
6351
6320
  const go = () => {
6352
6321
  let paused = false;
@@ -6368,10 +6337,9 @@ const iterateConcurrentImpl = (options) => {
6368
6337
  return cb(failDefect(error));
6369
6338
  }
6370
6339
  if (result) return cb(result);
6371
- return suspend(() => {
6372
- terminal = exitVoid;
6373
- interrupted = true;
6374
- return fibers ? fiberInterruptAll(fibers) : void_$2;
6340
+ return suspend$1(() => {
6341
+ terminal ??= exitVoid;
6342
+ return flatMap$1(fibers ? fiberInterruptAll(fibers) : void_$2, () => terminal?._tag === "Failure" ? terminal : void_$2);
6375
6343
  });
6376
6344
  });
6377
6345
  else {
@@ -6388,13 +6356,17 @@ const iterateConcurrentImpl = (options) => {
6388
6356
  fibers.delete(fiber);
6389
6357
  try {
6390
6358
  if (terminal) {
6391
- if (!interrupted && exit._tag === "Failure") for (const reason of exit.cause.reasons) if (reason._tag === "Interrupt") continue;
6392
- else if (terminal._tag === "Failure") terminal.cause.reasons.push(reason);
6393
- else terminal = exitFailCause(causeFromReasons([reason]));
6359
+ if (exit._tag === "Failure") {
6360
+ const reasons = exit.cause.reasons.filter((reason) => reason._tag !== "Interrupt");
6361
+ if (reasons.length > 0) {
6362
+ const cause = causeFromReasons(reasons);
6363
+ terminal = exitFailCause(terminal._tag === "Failure" ? causeCombine(terminal.cause, cause) : cause);
6364
+ }
6365
+ }
6394
6366
  } else {
6395
6367
  const result = step(state, item, exit, currentIndex);
6396
6368
  if (result) {
6397
- terminal = result._tag === "Failure" ? exitFailCause(causeFromReasons(result.cause.reasons.slice())) : result;
6369
+ terminal = result;
6398
6370
  go();
6399
6371
  }
6400
6372
  }
@@ -6518,7 +6490,7 @@ const colors = {
6518
6490
  };
6519
6491
  colors.gray, colors.blue, colors.green, colors.yellow, colors.red, colors.bgBrightRed, colors.black;
6520
6492
  //#endregion
6521
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Exit.js
6493
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Exit.js
6522
6494
  /**
6523
6495
  * Creates a successful Exit containing the given value.
6524
6496
  *
@@ -6633,7 +6605,7 @@ const void_$1 = exitVoid;
6633
6605
  */
6634
6606
  const isSuccess = exitIsSuccess;
6635
6607
  //#endregion
6636
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Cause.js
6608
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Cause.js
6637
6609
  /**
6638
6610
  * Narrows a `Reason` to `Fail`.
6639
6611
  *
@@ -6660,6 +6632,29 @@ const isSuccess = exitIsSuccess;
6660
6632
  */
6661
6633
  const isFailReason = isFailReason$1;
6662
6634
  /**
6635
+ * Creates a `Cause` containing a single `Die` reason with the
6636
+ * given defect.
6637
+ *
6638
+ * **When to use**
6639
+ *
6640
+ * Use to construct a cause from an untyped defect or unexpected thrown value.
6641
+ *
6642
+ * **Example** (Creating a die cause)
6643
+ *
6644
+ * ```ts import.meta.vitest
6645
+ * import { Cause } from "effect"
6646
+ *
6647
+ * Cause.die("Unexpected") // => Cause.fromReasons([Cause.makeDieReason("Unexpected")])
6648
+ * ```
6649
+ *
6650
+ * @see {@link fail} — for typed errors
6651
+ * @see {@link interrupt} — for fiber interruptions
6652
+ *
6653
+ * @category constructors
6654
+ * @since 2.0.0
6655
+ */
6656
+ const die$1 = causeDie;
6657
+ /**
6663
6658
  * Transforms the typed error values inside a `Cause` using the
6664
6659
  * provided function. Only `Fail` reasons are affected; `Die` and `Interrupt`
6665
6660
  * reasons pass through unchanged.
@@ -6693,7 +6688,7 @@ const isFailReason = isFailReason$1;
6693
6688
  */
6694
6689
  const map$1 = causeMap;
6695
6690
  //#endregion
6696
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/dateTime.js
6691
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/dateTime.js
6697
6692
  /** @internal */
6698
6693
  const TypeId$8 = "~effect/DateTime";
6699
6694
  /** @internal */
@@ -6723,7 +6718,7 @@ const ProtoTimeZone = {
6723
6718
  /** @internal */
6724
6719
  const toDateUtc$1 = (self) => new Date(self.epochMilliseconds);
6725
6720
  //#endregion
6726
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Effect.js
6721
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Effect.js
6727
6722
  /**
6728
6723
  * Executes an effectful operation for each element in an `Iterable`.
6729
6724
  *
@@ -6816,6 +6811,96 @@ const forEach = forEach$1;
6816
6811
  */
6817
6812
  const succeed$1 = succeed$3;
6818
6813
  /**
6814
+ * Creates an `Effect` lazily, delaying construction until it is needed.
6815
+ *
6816
+ * **When to use**
6817
+ *
6818
+ * Use when you need to defer the evaluation of an effect until it is required.
6819
+ *
6820
+ * **Details**
6821
+ *
6822
+ * `suspend` takes a thunk that represents an effect and delays creating it
6823
+ * until the suspended effect is evaluated. This is useful for optimizing
6824
+ * expensive computations, managing circular dependencies such as recursive
6825
+ * functions, and helping TypeScript unify return types when branches construct
6826
+ * different effects. Any side effects or scoped captures inside the thunk are
6827
+ * re-executed on each invocation.
6828
+ *
6829
+ * **Example** (Lazily evaluating side effects)
6830
+ *
6831
+ * ```ts import.meta.vitest
6832
+ * import { Effect } from "effect"
6833
+ *
6834
+ * let i = 0
6835
+ *
6836
+ * const bad = Effect.succeed(i++)
6837
+ *
6838
+ * const good = Effect.suspend(() => Effect.succeed(i++))
6839
+ *
6840
+ * Effect.runSync(bad) // => 0
6841
+ * Effect.runSync(bad) // => 0
6842
+ *
6843
+ * Effect.runSync(good) // => 1
6844
+ * Effect.runSync(good) // => 2
6845
+ * ```
6846
+ *
6847
+ * **Example** (Suspending recursive Fibonacci evaluation)
6848
+ *
6849
+ * ```ts import.meta.vitest
6850
+ * import { Effect } from "effect"
6851
+ *
6852
+ * const blowsUp = (n: number): Effect.Effect<number> =>
6853
+ * n < 2
6854
+ * ? Effect.succeed(1)
6855
+ * : Effect.zipWith(blowsUp(n - 1), blowsUp(n - 2), (a, b) => a + b)
6856
+ *
6857
+ * // console.log(Effect.runSync(blowsUp(32)))
6858
+ * // crash: JavaScript heap out of memory
6859
+ *
6860
+ * const allGood = (n: number): Effect.Effect<number> =>
6861
+ * n < 2
6862
+ * ? Effect.succeed(1)
6863
+ * : Effect.zipWith(
6864
+ * Effect.suspend(() => allGood(n - 1)),
6865
+ * Effect.suspend(() => allGood(n - 2)),
6866
+ * (a, b) => a + b
6867
+ * )
6868
+ *
6869
+ * Effect.runSync(allGood(16)) // => 1597
6870
+ * ```
6871
+ *
6872
+ * **Example** (Helping TypeScript infer recursive effect types)
6873
+ *
6874
+ * ```ts import.meta.vitest
6875
+ * import { Effect } from "effect"
6876
+ *
6877
+ * // Without suspend, TypeScript may struggle with type inference.
6878
+ * // Inferred type:
6879
+ * // (a: number, b: number) =>
6880
+ * // Effect<never, Error, never> | Effect<number, never, never>
6881
+ * const withoutSuspend = (a: number, b: number) =>
6882
+ * b === 0
6883
+ * ? Effect.fail(new Error("Cannot divide by zero"))
6884
+ * : Effect.succeed(a / b)
6885
+ *
6886
+ * // Using suspend to unify return types.
6887
+ * // Inferred type:
6888
+ * // (a: number, b: number) => Effect<number, Error, never>
6889
+ * const withSuspend = (a: number, b: number) =>
6890
+ * Effect.suspend(() =>
6891
+ * b === 0
6892
+ * ? Effect.fail(new Error("Cannot divide by zero"))
6893
+ * : Effect.succeed(a / b)
6894
+ * )
6895
+ *
6896
+ * Effect.runSync(withSuspend(6, 2)) // => 3
6897
+ * ```
6898
+ *
6899
+ * @category constructors
6900
+ * @since 2.0.0
6901
+ */
6902
+ const suspend = suspend$1;
6903
+ /**
6819
6904
  * Creates an `Effect` that represents a synchronous side-effectful computation.
6820
6905
  *
6821
6906
  * **When to use**
@@ -7592,7 +7677,7 @@ const flatMapEager = flatMapEager$1;
7592
7677
  */
7593
7678
  const fnUntracedEager = fnUntracedEager$1;
7594
7679
  //#endregion
7595
- //#region ../../node_modules/.pnpm/effect-oxlint@0.3.4_effect@4.0.0-rc.117/node_modules/effect-oxlint/dist/RuleContext.js
7680
+ //#region ../../node_modules/.pnpm/effect-oxlint@0.3.4_effect@4.0.0/node_modules/effect-oxlint/dist/RuleContext.js
7596
7681
  const RuleContextBase = Service()("effect-oxlint/RuleContext");
7597
7682
  /**
7598
7683
  * The lint rule context, provided as an Effect service.
@@ -7625,7 +7710,7 @@ service(RuleContext).pipe(map((ctx) => ctx.sourceCode));
7625
7710
  service(RuleContext).pipe(map((ctx) => ctx.sourceCode.text));
7626
7711
  service(RuleContext).pipe(map((ctx) => ctx.sourceCode.ast));
7627
7712
  //#endregion
7628
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/BigDecimal.js
7713
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/BigDecimal.js
7629
7714
  /**
7630
7715
  * Decimal numbers and arithmetic for cases where JavaScript `number` rounding
7631
7716
  * is not precise enough. A `BigDecimal` stores digits as a `bigint` plus a
@@ -7640,10 +7725,10 @@ const BigDecimalProto = {
7640
7725
  [TypeId$7]: TypeId$7,
7641
7726
  [symbol$1]() {
7642
7727
  const normalized = normalize(this);
7643
- return combine(hash(normalized.value), number$1(normalized.scale));
7728
+ return combine(string$1(String(normalized.value)), number$1(normalized.scale));
7644
7729
  },
7645
7730
  [symbol](that) {
7646
- return isBigDecimal(that) && equals(this, that);
7731
+ return isBigDecimal(that) && compare(this, that) === 0;
7647
7732
  },
7648
7733
  toString() {
7649
7734
  return `BigDecimal(${format(this)})`;
@@ -7723,13 +7808,7 @@ const make$8 = (value, scale) => {
7723
7808
  o.scale = scale;
7724
7809
  return o;
7725
7810
  };
7726
- /**
7727
- * Internal function used to create pre-normalized `BigDecimal`s.
7728
- *
7729
- * @internal
7730
- */
7731
- const makeNormalizedUnsafe = (value, scale) => {
7732
- if (value !== bigint0 && value % bigint10 === bigint0) throw new RangeError("Value must be normalized");
7811
+ const makeNormalized = (value, scale) => {
7733
7812
  const o = make$8(value, scale);
7734
7813
  o.normalized = o;
7735
7814
  return o;
@@ -7737,7 +7816,7 @@ const makeNormalizedUnsafe = (value, scale) => {
7737
7816
  const bigint0 = /*#__PURE__*/ BigInt(0);
7738
7817
  const bigint1 = /*#__PURE__*/ BigInt(1);
7739
7818
  const bigint10 = /*#__PURE__*/ BigInt(10);
7740
- const zero = /*#__PURE__*/ makeNormalizedUnsafe(bigint0, 0);
7819
+ const zero = /*#__PURE__*/ makeNormalized(bigint0, 0);
7741
7820
  /**
7742
7821
  * Normalizes a given `BigDecimal` by removing trailing zeros.
7743
7822
  *
@@ -7768,13 +7847,9 @@ const normalize = (self) => {
7768
7847
  if (self.value === bigint0) self.normalized = zero;
7769
7848
  else {
7770
7849
  const digits = `${self.value}`;
7771
- let trail = 0;
7772
- for (let i = digits.length - 1; i >= 0; i--) if (digits[i] === "0") trail++;
7773
- else break;
7774
- if (trail === 0) self.normalized = self;
7775
- const value = BigInt(digits.substring(0, digits.length - trail));
7776
- const scale = self.scale - trail;
7777
- self.normalized = makeNormalizedUnsafe(value, scale);
7850
+ let end = digits.length;
7851
+ while (digits[end - 1] === "0") end--;
7852
+ self.normalized = makeNormalized(BigInt(digits.slice(0, end)), self.scale - (digits.length - end));
7778
7853
  }
7779
7854
  }
7780
7855
  return self.normalized;
@@ -7788,12 +7863,7 @@ const compareMagnitude = (self, that) => {
7788
7863
  const exponentDifference = BigInt(selfDigits.length - thatDigits.length) - BigInt(self.scale) + BigInt(that.scale);
7789
7864
  if (exponentDifference !== bigint0) return exponentDifference < bigint0 ? -1 : 1;
7790
7865
  const length = Math.max(selfDigits.length, thatDigits.length);
7791
- for (let i = 0; i < length; i++) {
7792
- const selfDigit = i < selfDigits.length ? selfDigits.charCodeAt(i) : 48;
7793
- const thatDigit = i < thatDigits.length ? thatDigits.charCodeAt(i) : 48;
7794
- if (selfDigit !== thatDigit) return selfDigit < thatDigit ? -1 : 1;
7795
- }
7796
- return 0;
7866
+ return String$4(selfDigits.padEnd(length, "0"), thatDigits.padEnd(length, "0"));
7797
7867
  };
7798
7868
  const compare = (self, that) => {
7799
7869
  if (self.scale === that.scale) return compareBigInt(self.value, that.value);
@@ -7829,78 +7899,6 @@ const compare = (self, that) => {
7829
7899
  */
7830
7900
  const sign = (n) => n.value === bigint0 ? 0 : n.value < bigint0 ? -1 : 1;
7831
7901
  /**
7832
- * Determines the absolute value of a given `BigDecimal`.
7833
- *
7834
- * **When to use**
7835
- *
7836
- * Use to remove the sign from a `BigDecimal` while preserving its magnitude.
7837
- *
7838
- * **Example** (Calculating absolute values)
7839
- *
7840
- * ```ts import.meta.vitest
7841
- * import { BigDecimal } from "effect"
7842
- *
7843
- * BigDecimal.abs(BigDecimal.fromStringUnsafe("-5")) // => BigDecimal.fromBigInt(5n)
7844
- * BigDecimal.abs(BigDecimal.fromStringUnsafe("0")) // => BigDecimal.fromBigInt(0n)
7845
- * BigDecimal.abs(BigDecimal.fromStringUnsafe("5")) // => BigDecimal.fromBigInt(5n)
7846
- * ```
7847
- *
7848
- * @category math
7849
- * @since 2.0.0
7850
- */
7851
- const abs = (n) => n.value < bigint0 ? make$8(-n.value, n.scale) : n;
7852
- /**
7853
- * Provides an `Equivalence` instance for `BigDecimal` that determines equality between BigDecimal values.
7854
- *
7855
- * **When to use**
7856
- *
7857
- * Use when comparing decimal values through APIs that accept an equivalence
7858
- * relation.
7859
- *
7860
- * **Example** (Checking decimal equivalence)
7861
- *
7862
- * ```ts import.meta.vitest
7863
- * import { BigDecimal } from "effect"
7864
- *
7865
- * const a = BigDecimal.fromStringUnsafe("1.50")
7866
- * const b = BigDecimal.fromStringUnsafe("1.5")
7867
- * const c = BigDecimal.fromStringUnsafe("2.0")
7868
- *
7869
- * BigDecimal.Equivalence(a, b) // => true
7870
- * BigDecimal.Equivalence(a, c) // => false
7871
- * ```
7872
- *
7873
- * @category instances
7874
- * @since 2.0.0
7875
- */
7876
- const Equivalence$1 = /*#__PURE__*/ make$14((self, that) => compare(self, that) === 0);
7877
- /**
7878
- * Checks whether two `BigDecimal`s are equal.
7879
- *
7880
- * **When to use**
7881
- *
7882
- * Use to compare two `BigDecimal` values for numeric equality.
7883
- *
7884
- * **Example** (Checking decimal equality)
7885
- *
7886
- * ```ts import.meta.vitest
7887
- * import { BigDecimal } from "effect"
7888
- *
7889
- * const a = BigDecimal.fromStringUnsafe("1.5")
7890
- * const b = BigDecimal.fromStringUnsafe("1.50")
7891
- * const c = BigDecimal.fromStringUnsafe("2.0")
7892
- *
7893
- * BigDecimal.equals(a, b) // => true
7894
- * BigDecimal.equals(a, c) // => false
7895
- * ```
7896
- *
7897
- * @see {@link Equivalence} for passing decimal equality to APIs that require an `Equivalence`
7898
- *
7899
- * @category predicates
7900
- * @since 2.0.0
7901
- */
7902
- const equals = /*#__PURE__*/ dual(2, (self, that) => Equivalence$1(self, that));
7903
- /**
7904
7902
  * Formats a `BigDecimal` as a string.
7905
7903
  *
7906
7904
  * **When to use**
@@ -7932,24 +7930,10 @@ const format = (n) => {
7932
7930
  const normalized = normalize(n);
7933
7931
  if (Math.abs(normalized.scale) >= 16) return toExponential(normalized);
7934
7932
  const negative = normalized.value < bigint0;
7935
- const absolute = negative ? `${normalized.value}`.substring(1) : `${normalized.value}`;
7936
- let before;
7937
- let after;
7938
- if (normalized.scale >= absolute.length) {
7939
- before = "0";
7940
- after = "0".repeat(normalized.scale - absolute.length) + absolute;
7941
- } else {
7942
- const location = absolute.length - normalized.scale;
7943
- if (location > absolute.length) {
7944
- const zeros = location - absolute.length;
7945
- before = `${absolute}${"0".repeat(zeros)}`;
7946
- after = "";
7947
- } else {
7948
- after = absolute.slice(location);
7949
- before = absolute.slice(0, location);
7950
- }
7951
- }
7952
- const complete = after === "" ? before : `${before}.${after}`;
7933
+ const absolute = `${negative ? -normalized.value : normalized.value}`;
7934
+ const digits = normalized.scale > 0 ? absolute.padStart(normalized.scale + 1, "0") : absolute.padEnd(absolute.length - normalized.scale, "0");
7935
+ const point = digits.length - normalized.scale;
7936
+ const complete = normalized.scale > 0 ? `${digits.slice(0, point)}.${digits.slice(point)}` : digits;
7953
7937
  return negative ? `-${complete}` : complete;
7954
7938
  };
7955
7939
  /**
@@ -7975,13 +7959,12 @@ const format = (n) => {
7975
7959
  const toExponential = (n) => {
7976
7960
  if (isZero(n)) return "0e+0";
7977
7961
  const normalized = normalize(n);
7978
- const digits = `${abs(normalized).value}`;
7979
- const head = digits.slice(0, 1);
7980
- const tail = digits.slice(1);
7981
- let output = `${isNegative(normalized) ? "-" : ""}${head}`;
7982
- if (tail !== "") output += `.${tail}`;
7962
+ const digits = `${normalized.value}`;
7963
+ const point = normalized.value < bigint0 ? 2 : 1;
7964
+ const head = digits.slice(0, point);
7965
+ const tail = digits.slice(point);
7983
7966
  const exp = tail.length - normalized.scale;
7984
- return `${output}e${exp >= 0 ? "+" : ""}${exp}`;
7967
+ return `${head}${tail === "" ? "" : `.${tail}`}e${exp >= 0 ? "+" : ""}${exp}`;
7985
7968
  };
7986
7969
  /**
7987
7970
  * Checks whether a given `BigDecimal` is `0`.
@@ -8003,29 +7986,15 @@ const toExponential = (n) => {
8003
7986
  * @since 2.0.0
8004
7987
  */
8005
7988
  const isZero = (n) => n.value === bigint0;
8006
- /**
8007
- * Checks whether a given `BigDecimal` is negative.
8008
- *
8009
- * **When to use**
8010
- *
8011
- * Use to test whether a `BigDecimal` is less than zero.
8012
- *
8013
- * **Example** (Checking negative decimals)
8014
- *
8015
- * ```ts import.meta.vitest
8016
- * import { BigDecimal } from "effect"
8017
- *
8018
- * BigDecimal.isNegative(BigDecimal.fromStringUnsafe("-1")) // => true
8019
- * BigDecimal.isNegative(BigDecimal.fromStringUnsafe("0")) // => false
8020
- * BigDecimal.isNegative(BigDecimal.fromStringUnsafe("1")) // => false
8021
- * ```
8022
- *
8023
- * @category predicates
8024
- * @since 2.0.0
8025
- */
8026
- const isNegative = (n) => n.value < bigint0;
7989
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
7990
+ const codes = /*#__PURE__*/ (/* @__PURE__ */ new Uint8Array(123)).fill(255);
7991
+ for (let i = 0; i < 64; i++) codes[/*#__PURE__*/ alphabet.charCodeAt(i)] = i;
7992
+ codes[/*#__PURE__*/ "=".charCodeAt(0)] = 0;
7993
+ ({ ...BaseProto });
7994
+ ({ ...BaseProto });
7995
+ ({ ...PipeInspectableProto });
8027
7996
  //#endregion
8028
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/annotations.js
7997
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/schema/annotations.js
8029
7998
  /** @internal */
8030
7999
  function resolve$1(ast) {
8031
8000
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
@@ -8041,7 +8010,7 @@ const getExpected = /*#__PURE__*/ memoize((ast) => {
8041
8010
  return ast.getExpected(getExpected);
8042
8011
  });
8043
8012
  //#endregion
8044
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/parser.js
8013
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/schema/parser.js
8045
8014
  /** @internal */
8046
8015
  const missing = /*#__PURE__*/ Symbol();
8047
8016
  /** @internal */
@@ -8055,7 +8024,7 @@ const toOption = (value) => value === missing ? none() : some$1(value);
8055
8024
  /** @internal */
8056
8025
  const fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed(option.value);
8057
8026
  //#endregion
8058
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/SchemaIssue.js
8027
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/SchemaIssue.js
8059
8028
  /**
8060
8029
  * Describes problems found while decoding, encoding, or checking data with
8061
8030
  * schemas.
@@ -8067,7 +8036,7 @@ const fromOptionExit = (option) => option._tag === "None" ? missingExit : succee
8067
8036
  *
8068
8037
  * @since 4.0.0
8069
8038
  */
8070
- const TypeId$6 = "~effect/SchemaIssue/Issue";
8039
+ const TypeId$4 = "~effect/SchemaIssue/Issue";
8071
8040
  /**
8072
8041
  * Returns `true` if the given value is an {@link Issue}.
8073
8042
  *
@@ -8097,7 +8066,7 @@ const TypeId$6 = "~effect/SchemaIssue/Issue";
8097
8066
  * @since 4.0.0
8098
8067
  */
8099
8068
  function isIssue(u) {
8100
- return hasProperty(u, TypeId$6) && u[TypeId$6] === TypeId$6;
8069
+ return hasProperty(u, TypeId$4) && u[TypeId$4] === TypeId$4;
8101
8070
  }
8102
8071
  /**
8103
8072
  * Returns `true` when an issue contains an input reported by the schema parser.
@@ -8132,7 +8101,7 @@ function hasInput(issue) {
8132
8101
  return Object.hasOwn(issue, "input");
8133
8102
  }
8134
8103
  var IssueNodeImpl = class {
8135
- [TypeId$6] = TypeId$6;
8104
+ [TypeId$4] = TypeId$4;
8136
8105
  constructor(input, options) {
8137
8106
  if (options?.reportInput === true && input !== missing) this.input = input;
8138
8107
  }
@@ -8536,7 +8505,7 @@ function findMessage(issue) {
8536
8505
  if (typeof message === "string") return message;
8537
8506
  }
8538
8507
  //#endregion
8539
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/cause.js
8508
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/schema/cause.js
8540
8509
  /** @internal */
8541
8510
  function getSchemaIssue(cause) {
8542
8511
  let issue;
@@ -8546,8 +8515,14 @@ function getSchemaIssue(cause) {
8546
8515
  }
8547
8516
  return issue;
8548
8517
  }
8518
+ /** @internal */
8519
+ function getSchemaIssueOrThrow(cause, message) {
8520
+ const issue = getSchemaIssue(cause);
8521
+ if (issue === void 0) throw new Error(message, { cause });
8522
+ return issue;
8523
+ }
8549
8524
  //#endregion
8550
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/SchemaGetter.js
8525
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/SchemaGetter.js
8551
8526
  const makeGetter = (fields) => Object.assign(Object.create(Prototype$1), fields);
8552
8527
  /**
8553
8528
  * Creates a getter that applies a pure function to present values.
@@ -8652,7 +8627,7 @@ function Number$3() {
8652
8627
  return transform$1(globalThis.Number);
8653
8628
  }
8654
8629
  //#endregion
8655
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/SchemaTransformation.js
8630
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/SchemaTransformation.js
8656
8631
  /**
8657
8632
  * Constructs schema middleware from its decode and encode functions.
8658
8633
  *
@@ -8672,7 +8647,7 @@ const Middleware = class extends Class$1 {
8672
8647
  return new Middleware(this.encode, this.decode);
8673
8648
  }
8674
8649
  };
8675
- const TypeId$5 = "~effect/SchemaTransformation/Transformation";
8650
+ const TypeId$3 = "~effect/SchemaTransformation/Transformation";
8676
8651
  /**
8677
8652
  * Constructs a bidirectional schema transformation from its decode and encode getters.
8678
8653
  *
@@ -8680,7 +8655,7 @@ const TypeId$5 = "~effect/SchemaTransformation/Transformation";
8680
8655
  * @since 4.0.0
8681
8656
  */
8682
8657
  const Transformation = class extends Class$1 {
8683
- [TypeId$5] = TypeId$5;
8658
+ [TypeId$3] = TypeId$3;
8684
8659
  _tag = "Transformation";
8685
8660
  decode;
8686
8661
  encode;
@@ -8728,7 +8703,7 @@ const Transformation = class extends Class$1 {
8728
8703
  */
8729
8704
  const numberFromString = /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$3(), /*#__PURE__*/ String$3());
8730
8705
  //#endregion
8731
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/SchemaAST.js
8706
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/SchemaAST.js
8732
8707
  /**
8733
8708
  * Represents Effect schemas as runtime trees.
8734
8709
  *
@@ -8838,9 +8813,28 @@ const Link = class {
8838
8813
  };
8839
8814
  /** @internal */
8840
8815
  const defaultParseOptions = {};
8841
- const TypeId$4 = "~effect/Schema";
8816
+ /**
8817
+ * Constructs a {@link Context}.
8818
+ *
8819
+ * @category constructors
8820
+ * @since 4.0.0
8821
+ */
8822
+ const Context = class {
8823
+ isOptional;
8824
+ isMutable;
8825
+ /** Used for constructor default values (e.g. `withConstructorDefault` API) */
8826
+ constructorDefault;
8827
+ annotations;
8828
+ constructor(isOptional, isMutable, constructorDefault = void 0, annotations = void 0) {
8829
+ this.isOptional = isOptional;
8830
+ this.isMutable = isMutable;
8831
+ this.constructorDefault = constructorDefault;
8832
+ this.annotations = annotations;
8833
+ }
8834
+ };
8835
+ const TypeId$2 = "~effect/Schema";
8842
8836
  var ASTNodeImpl = class {
8843
- [TypeId$4] = TypeId$4;
8837
+ [TypeId$2] = TypeId$2;
8844
8838
  annotations;
8845
8839
  checks;
8846
8840
  encoding;
@@ -9106,19 +9100,20 @@ const Arrays = class extends ASTNodeImpl {
9106
9100
  else if (index >= tailThreshold) return rest[index - tailThreshold + 1];
9107
9101
  return rest[0];
9108
9102
  }
9109
- return fnUntracedEager(function* (input, options) {
9110
- if (input === missing) return missing;
9111
- if (!Array.isArray(input)) return yield* fail$1(new InvalidType(ast, input, options));
9112
- if (!elements) {
9113
- elements = ast.elements.map((ast) => ({
9114
- ast,
9115
- parser: compileField(ast)
9116
- }));
9117
- rest = ast.rest.map((ast) => ({
9118
- ast,
9119
- parser: compileField(ast)
9120
- }));
9103
+ const finish = (state) => {
9104
+ const { input, len, options } = state;
9105
+ if (ast.rest.length === 0 && len > elementLen) for (let i = elementLen; i < len; i++) {
9106
+ const unexpected = new UnexpectedKey(ast, input[i], options);
9107
+ const issue = new Pointer([i], unexpected);
9108
+ if (options.errors === "all") {
9109
+ if (state.issues) state.issues.push(issue);
9110
+ else state.issues = [issue];
9111
+ } else return fail$1(new Composite(ast, [issue], input, options));
9121
9112
  }
9113
+ if (state.issues) return fail$1(new Composite(ast, state.issues, input, options));
9114
+ return succeed(state.output);
9115
+ };
9116
+ const parse = (input, options) => {
9122
9117
  const len = input.length;
9123
9118
  const state = {
9124
9119
  ast,
@@ -9136,18 +9131,34 @@ const Arrays = class extends ASTNodeImpl {
9136
9131
  concurrency,
9137
9132
  end
9138
9133
  });
9139
- if (eff) yield* eff;
9140
- if (ast.rest.length === 0 && len > elementLen) for (let i = elementLen; i <= len - 1; i++) {
9141
- const unexpected = new UnexpectedKey(ast, input[i], options);
9142
- const issue = new Pointer([i], unexpected);
9143
- if (options.errors === "all") {
9144
- if (state.issues) state.issues.push(issue);
9145
- else state.issues = [issue];
9146
- } else return yield* fail$1(new Composite(ast, [issue], input, options));
9134
+ if (!eff) return finish(state);
9135
+ if (effectIsExit(eff)) return flatMapEager(eff, () => finish(state));
9136
+ let first = true;
9137
+ return suspend(() => {
9138
+ if (!first) return parse(input, options);
9139
+ first = false;
9140
+ return flatMap(eff, () => finish(state));
9141
+ });
9142
+ };
9143
+ return (input, options) => {
9144
+ if (input === missing) return missingExit;
9145
+ try {
9146
+ if (!Array.isArray(input)) return fail$1(new InvalidType(ast, input, options));
9147
+ if (!elements) {
9148
+ elements = ast.elements.map((ast) => ({
9149
+ ast,
9150
+ parser: compileField(ast)
9151
+ }));
9152
+ rest = ast.rest.map((ast) => ({
9153
+ ast,
9154
+ parser: compileField(ast)
9155
+ }));
9156
+ }
9157
+ return parse(input, options);
9158
+ } catch (error) {
9159
+ return die(error);
9147
9160
  }
9148
- if (state.issues) return yield* fail$1(new Composite(ast, state.issues, input, options));
9149
- return state.output;
9150
- });
9161
+ };
9151
9162
  }
9152
9163
  _rebuild(recur, checks, encodingChecks) {
9153
9164
  const elements = mapOrSame(this.elements, recur);
@@ -9219,7 +9230,7 @@ function getIndexSignatureKeys(input, parameter, options = defaultParseOptions)
9219
9230
  case "String":
9220
9231
  case "TemplateLiteral": return (stringKeys ??= Object.keys(input)).filter((k) => parameter.matchPart(k, options) !== void 0);
9221
9232
  case "Number": return (stringKeys ??= Object.keys(input)).filter((k) => parameter.matchKey(k, options) !== void 0);
9222
- case "Symbol": return (symbolKeys ??= Object.getOwnPropertySymbols(input)).filter((k) => parameter.matchKey(k, options) !== void 0);
9233
+ case "Symbol": return (symbolKeys ??= Object.getOwnPropertySymbols(input)).filter((k) => Object.prototype.propertyIsEnumerable.call(input, k) && parameter.matchKey(k, options) !== void 0);
9223
9234
  case "Union": return [...new Set(parameter.types.flatMap(go))];
9224
9235
  default: return [];
9225
9236
  }
@@ -9296,56 +9307,15 @@ const Objects = class extends ASTNodeImpl {
9296
9307
  this.propertySignatures = propertySignatures;
9297
9308
  this.indexSignatures = indexSignatures;
9298
9309
  this.encodingChecks = encodingChecks;
9299
- const seen = /* @__PURE__ */ new Set();
9300
- const duplicates = [];
9301
- for (const propertySignature of propertySignatures) {
9302
- const name = propertySignature.name;
9303
- if (seen.has(name)) duplicates.push(name);
9304
- else seen.add(name);
9305
- }
9306
- if (duplicates.length > 0) throw new Error(`Duplicate identifiers: ${JSON.stringify(duplicates)}. ts(2300)`);
9307
9310
  }
9308
9311
  /** @internal */
9309
9312
  getParser(compile, compileField = compile) {
9310
9313
  const ast = this;
9311
- const expectedKeys = [];
9312
- for (const ps of ast.propertySignatures) expectedKeys.push(typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name);
9313
- const hasProperties = expectedKeys.length;
9314
+ const hasProperties = ast.propertySignatures.length;
9314
9315
  const indexCount = ast.indexSignatures.length;
9315
- let expectedKeysSet = hasProperties && indexCount ? new Set(expectedKeys) : void 0;
9316
9316
  if (!hasProperties && !indexCount) return fromRefinement(ast, isNotNullish);
9317
9317
  let properties;
9318
9318
  let indexes;
9319
- const finishIndex = (s, key, k2, inputValue, exitValue) => {
9320
- if (exitValue._tag === "Failure") return wrapPropertyKeyIssue(s, ast, key, exitValue) ?? void_$1;
9321
- const value = exitValue === sameExit ? inputValue : exitValue[args];
9322
- if (k2 !== missing && value !== missing) {
9323
- if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(typeof k2 === "number" ? globalThis.String(k2) : k2))) return void_$1;
9324
- assignProperty(s.out, k2, value);
9325
- }
9326
- return void_$1;
9327
- };
9328
- const parseIndex = (s, key, index, exitKey) => {
9329
- if (!exitKey) {
9330
- const eff = index.parserKey(key, s.options);
9331
- if (!effectIsExit(eff)) return flatMap(exit(eff), (exit) => parseIndex(s, key, index, exit));
9332
- exitKey = eff;
9333
- }
9334
- if (exitKey._tag === "Failure") return wrapPropertyKeyIssue(s, ast, key, exitKey) ?? void_$1;
9335
- const k2 = exitKey === sameExit ? key : exitKey[args];
9336
- const inputValue = s.input[key];
9337
- const result = index.parserValue(inputValue, s.options);
9338
- return effectIsExit(result) ? finishIndex(s, key, k2, inputValue, result) : flatMap(exit(result), (exit) => finishIndex(s, key, k2, inputValue, exit));
9339
- };
9340
- const parseStringIndex = (s, key, index) => {
9341
- const inputValue = s.input[key];
9342
- const result = index.parserValue(inputValue, s.options);
9343
- return effectIsExit(result) ? finishIndex(s, key, key, inputValue, result) : flatMap(exit(result), (exit) => finishIndex(s, key, key, inputValue, exit));
9344
- };
9345
- const parseIndexes = indexCount ? iterateConcurrent()({
9346
- onItem: (s, [key, index]) => index.is.parameter === string ? parseStringIndex(s, key, index) : parseIndex(s, key, index),
9347
- step: (_s, _item, exit) => exit._tag === "Failure" ? exit : void 0
9348
- }) : void 0;
9349
9319
  const compileMembers = () => {
9350
9320
  if (!properties) {
9351
9321
  properties = ast.propertySignatures.map((ps) => ({
@@ -9361,69 +9331,102 @@ const Objects = class extends ASTNodeImpl {
9361
9331
  }
9362
9332
  return properties;
9363
9333
  };
9364
- const fallback = fnUntracedEager(function* (input, options) {
9365
- if (input === missing) return missing;
9366
- if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return yield* fail$1(new InvalidType(ast, input, options));
9367
- compileMembers();
9368
- const record = input;
9369
- const out = {};
9370
- const state = {
9371
- ast,
9372
- input: record,
9373
- out,
9374
- issues: void 0,
9375
- options
9334
+ const makeFallback = () => {
9335
+ const expectedKeys = new Set(ast.propertySignatures.map((ps) => typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name));
9336
+ const finishIndex = (s, key, k2, inputValue, exitValue) => {
9337
+ if (exitValue._tag === "Failure") return wrapPropertyKeyIssue(s, ast, key, exitValue) ?? void_$1;
9338
+ const value = exitValue === sameExit ? inputValue : exitValue[args];
9339
+ if (k2 !== missing && value !== missing) {
9340
+ if (hasProperties && (expectedKeys.has(key) || expectedKeys.has(typeof k2 === "number" ? globalThis.String(k2) : k2))) return void_$1;
9341
+ assignProperty(s.out, k2, value);
9342
+ }
9343
+ return void_$1;
9376
9344
  };
9377
- const errorsAllOption = options.errors === "all";
9378
- const onExcessPropertyError = options.onExcessProperty === "error";
9379
- const concurrency = options.concurrency === void 0 ? 1 : resolveConcurrency(options.concurrency);
9380
- const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map((index) => getIndexSignatureKeys(record, index.parameter, options)) : void 0;
9381
- if (onExcessPropertyError) {
9382
- expectedKeysSet ??= new Set(expectedKeys);
9383
- const coveredKeys = indexKeys ? new Set(expectedKeysSet) : expectedKeysSet;
9384
- if (indexKeys) for (const keys of indexKeys) for (const key of keys) coveredKeys.add(key);
9385
- const inputKeys = Reflect.ownKeys(record);
9386
- for (let i = 0; i < inputKeys.length; i++) {
9387
- const key = inputKeys[i];
9388
- if (!coveredKeys.has(key)) {
9389
- const unexpected = new UnexpectedKey(ast, record[key], options);
9390
- const issue = new Pointer([key], unexpected);
9391
- if (errorsAllOption) {
9392
- if (state.issues) state.issues.push(issue);
9393
- else state.issues = [issue];
9394
- continue;
9395
- } else return yield* fail$1(new Composite(ast, [issue], input, options));
9345
+ const parseIndex = (s, key, index, exitKey) => {
9346
+ if (!exitKey) {
9347
+ const eff = index.parserKey(key, s.options);
9348
+ if (!effectIsExit(eff)) return flatMap(exit(eff), (exit) => parseIndex(s, key, index, exit));
9349
+ exitKey = eff;
9350
+ }
9351
+ if (exitKey._tag === "Failure") return wrapPropertyKeyIssue(s, ast, key, exitKey) ?? void_$1;
9352
+ const k2 = exitKey === sameExit ? key : exitKey[args];
9353
+ const inputValue = s.input[key];
9354
+ const result = index.parserValue(inputValue, s.options);
9355
+ return effectIsExit(result) ? finishIndex(s, key, k2, inputValue, result) : flatMap(exit(result), (exit) => finishIndex(s, key, k2, inputValue, exit));
9356
+ };
9357
+ const parseStringIndex = (s, key, index) => {
9358
+ const inputValue = s.input[key];
9359
+ const result = index.parserValue(inputValue, s.options);
9360
+ return effectIsExit(result) ? finishIndex(s, key, key, inputValue, result) : flatMap(exit(result), (exit) => finishIndex(s, key, key, inputValue, exit));
9361
+ };
9362
+ const parseIndexes = indexCount ? iterateConcurrent()({
9363
+ onItem: (s, [key, index]) => index.is.parameter === string ? parseStringIndex(s, key, index) : parseIndex(s, key, index),
9364
+ step: (_s, _item, exit) => exit._tag === "Failure" ? exit : void 0
9365
+ }) : void 0;
9366
+ return fnUntracedEager(function* (input, options) {
9367
+ if (input === missing) return missing;
9368
+ if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return yield* fail$1(new InvalidType(ast, input, options));
9369
+ compileMembers();
9370
+ const record = input;
9371
+ const out = {};
9372
+ const state = {
9373
+ ast,
9374
+ input: record,
9375
+ out,
9376
+ issues: void 0,
9377
+ options
9378
+ };
9379
+ const errorsAllOption = options.errors === "all";
9380
+ const onExcessPropertyError = options.onExcessProperty === "error";
9381
+ const concurrency = options.concurrency === void 0 ? 1 : resolveConcurrency(options.concurrency);
9382
+ const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map((index) => getIndexSignatureKeys(record, index.parameter, options)) : void 0;
9383
+ if (onExcessPropertyError) {
9384
+ const coveredKeys = indexKeys ? new Set(expectedKeys) : expectedKeys;
9385
+ if (indexKeys) for (const keys of indexKeys) for (const key of keys) coveredKeys.add(key);
9386
+ const inputKeys = Reflect.ownKeys(record);
9387
+ for (let i = 0; i < inputKeys.length; i++) {
9388
+ const key = inputKeys[i];
9389
+ if (!coveredKeys.has(key) && Object.prototype.propertyIsEnumerable.call(record, key)) {
9390
+ const unexpected = new UnexpectedKey(ast, record[key], options);
9391
+ const issue = new Pointer([key], unexpected);
9392
+ if (errorsAllOption) {
9393
+ if (state.issues) state.issues.push(issue);
9394
+ else state.issues = [issue];
9395
+ continue;
9396
+ } else return yield* fail$1(new Composite(ast, [issue], input, options));
9397
+ }
9396
9398
  }
9397
9399
  }
9398
- }
9399
- if (hasProperties) {
9400
- const eff = concurrency === 1 ? parseProperties(state, properties) : parsePropertiesConcurrent(state, properties, { concurrency });
9401
- if (eff) yield* eff;
9402
- }
9403
- if (indexCount && concurrency === 1) for (let i = 0; i < indexCount; i++) {
9404
- const index = indexes[i];
9405
- const parse = index.is.parameter === string ? parseStringIndex : parseIndex;
9406
- const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
9407
- for (let j = 0; j < keys.length; j++) {
9408
- const eff = parse(state, keys[j], index);
9409
- if (!effectIsExit(eff)) yield* eff;
9410
- else if (eff._tag === "Failure") return yield* eff;
9400
+ if (hasProperties) {
9401
+ const eff = concurrency === 1 ? parseProperties(state, properties) : parsePropertiesConcurrent(state, properties, { concurrency });
9402
+ if (eff) yield* eff;
9411
9403
  }
9412
- }
9413
- else if (parseIndexes) {
9414
- const keyPairs = empty();
9415
- for (let i = 0; i < indexCount; i++) {
9404
+ if (indexCount && concurrency === 1) for (let i = 0; i < indexCount; i++) {
9416
9405
  const index = indexes[i];
9406
+ const parse = index.is.parameter === string ? parseStringIndex : parseIndex;
9417
9407
  const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
9418
- for (let j = 0; j < keys.length; j++) keyPairs.push([keys[j], index]);
9408
+ for (let j = 0; j < keys.length; j++) {
9409
+ const eff = parse(state, keys[j], index);
9410
+ if (!effectIsExit(eff)) yield* eff;
9411
+ else if (eff._tag === "Failure") return yield* eff;
9412
+ }
9419
9413
  }
9420
- const eff = parseIndexes(state, keyPairs, { concurrency });
9421
- if (eff) yield* eff;
9422
- }
9423
- if (state.issues) return yield* fail$1(new Composite(ast, state.issues, input, options));
9424
- return out;
9425
- });
9426
- if (indexCount) return fallback;
9414
+ else if (parseIndexes) {
9415
+ const keyPairs = empty();
9416
+ for (let i = 0; i < indexCount; i++) {
9417
+ const index = indexes[i];
9418
+ const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
9419
+ for (let j = 0; j < keys.length; j++) keyPairs.push([keys[j], index]);
9420
+ }
9421
+ const eff = parseIndexes(state, keyPairs, { concurrency });
9422
+ if (eff) yield* eff;
9423
+ }
9424
+ if (state.issues) return yield* fail$1(new Composite(ast, state.issues, input, options));
9425
+ return out;
9426
+ });
9427
+ };
9428
+ if (indexCount) return makeFallback();
9429
+ let fallback;
9427
9430
  const resume = (state, index, pending) => {
9428
9431
  const property = properties[index];
9429
9432
  return flatMap(exit(pending), (exit) => {
@@ -9436,7 +9439,7 @@ const Objects = class extends ASTNodeImpl {
9436
9439
  };
9437
9440
  return (input, options) => {
9438
9441
  if (input === missing) return missingExit;
9439
- if (options.errors === "all" || options.onExcessProperty !== void 0 || options.concurrency !== void 0 && resolveConcurrency(options.concurrency) !== 1) return fallback(input, options);
9442
+ if (options.errors === "all" || options.onExcessProperty !== void 0 || options.concurrency !== void 0 && resolveConcurrency(options.concurrency) !== 1) return (fallback ??= makeFallback())(input, options);
9440
9443
  if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return fail$1(new InvalidType(ast, input, options));
9441
9444
  const props = compileMembers();
9442
9445
  const record = input;
@@ -9629,8 +9632,10 @@ function collectSentinels(ast) {
9629
9632
  }
9630
9633
  const candidateIndexCache = /*#__PURE__*/ new WeakMap();
9631
9634
  const emptyCandidates = /*#__PURE__*/ Object.freeze([]);
9635
+ const getRuntimeType = (input) => input === null ? "null" : Array.isArray(input) ? "array" : typeof input;
9632
9636
  const hasPropertySignature = (input, key) => key === "__proto__" ? Object.hasOwn(input, key) : key in input;
9633
- function getIndex(types) {
9637
+ /** @internal */
9638
+ function getCandidateIndex(types) {
9634
9639
  let index = candidateIndexCache.get(types);
9635
9640
  if (index) return index;
9636
9641
  let bySentinel;
@@ -9638,19 +9643,19 @@ function getIndex(types) {
9638
9643
  let otherwise;
9639
9644
  let literalCandidates;
9640
9645
  let onlyLiterals = true;
9646
+ const literalOf = [];
9641
9647
  for (let i = 0; i < types.length; i++) {
9642
9648
  const a = types[i];
9643
9649
  const encoded = toCandidate(a);
9644
9650
  if (isNever(encoded)) continue;
9645
- if (onlyLiterals) {
9646
- if (isLiteral(encoded) || isUniqueSymbol(encoded)) {
9647
- literalCandidates ??= /* @__PURE__ */ new Map();
9648
- const literal = isLiteral(encoded) ? encoded.literal : encoded.symbol;
9649
- let arr = literalCandidates.get(literal);
9650
- if (!arr) literalCandidates.set(literal, arr = []);
9651
- arr.push(a);
9652
- } else onlyLiterals = false;
9653
- }
9651
+ if (isLiteral(encoded) || isUniqueSymbol(encoded)) {
9652
+ literalCandidates ??= /* @__PURE__ */ new Map();
9653
+ const literal = isLiteral(encoded) ? encoded.literal : encoded.symbol;
9654
+ literalOf[i] = literal;
9655
+ let arr = literalCandidates.get(literal);
9656
+ if (!arr) literalCandidates.set(literal, arr = []);
9657
+ arr.push(i);
9658
+ } else onlyLiterals = false;
9654
9659
  const sentinels = collectSentinels(encoded);
9655
9660
  if (sentinels.length) {
9656
9661
  bySentinel ??= /* @__PURE__ */ new Map();
@@ -9669,18 +9674,21 @@ function getIndex(types) {
9669
9674
  for (const t of candidateTypes) (otherwise[t] ??= []).push(i);
9670
9675
  }
9671
9676
  }
9677
+ const fallbacks = {};
9678
+ const getFallback = (type) => fallbacks[type] ??= Object.freeze(otherwise?.[type] ?? emptyCandidates);
9672
9679
  if (onlyLiterals && literalCandidates) {
9673
9680
  literalCandidates.forEach(Object.freeze);
9674
9681
  index = (input) => literalCandidates.get(input) ?? emptyCandidates;
9675
9682
  } else if (bySentinel?.size === 1 && !otherwise) {
9676
9683
  const [key, [byValue]] = bySentinel.entries().next().value;
9677
- const candidates = byValue;
9678
- for (const [literal, indexes] of byValue) candidates.set(literal, Object.freeze(Array.from(indexes, (index) => types[index])));
9684
+ const candidates = /* @__PURE__ */ new Map();
9685
+ for (const [literal, indexes] of byValue) candidates.set(literal, Object.freeze(Array.from(indexes)));
9686
+ const all = Object.freeze(types.map((_, i) => i));
9679
9687
  index = (input, isConstructor) => {
9680
9688
  if (isObjectKeyword(input)) {
9681
9689
  const value = hasPropertySignature(input, key) ? input[key] : void 0;
9682
9690
  if (value !== void 0) return candidates.get(value) ?? emptyCandidates;
9683
- if (isConstructor) return types;
9691
+ if (isConstructor) return all;
9684
9692
  }
9685
9693
  return emptyCandidates;
9686
9694
  };
@@ -9688,9 +9696,9 @@ function getIndex(types) {
9688
9696
  let commonSentinel;
9689
9697
  for (const entry of bySentinel) if ((!commonSentinel || entry[1][0].size > commonSentinel[1][0].size) && entry[1][1].size === sentinelCandidateCount) commonSentinel = entry;
9690
9698
  index = (input, isConstructor) => {
9691
- const base = otherwise?.[input === null ? "null" : Array.isArray(input) ? "array" : typeof input] ?? emptyCandidates;
9692
- if (!isObjectKeyword(input)) return base.map((i) => types[i]);
9693
- const selected = new Set(base);
9699
+ const runtimeType = getRuntimeType(input);
9700
+ if (!isObjectKeyword(input)) return getFallback(runtimeType);
9701
+ const selected = new Set(otherwise?.[runtimeType]);
9694
9702
  let directKey;
9695
9703
  if (commonSentinel) {
9696
9704
  const [key, [byValue]] = commonSentinel;
@@ -9698,7 +9706,7 @@ function getIndex(types) {
9698
9706
  const value = hasKey ? input[key] : void 0;
9699
9707
  if (hasKey && (!isConstructor || value !== void 0)) {
9700
9708
  const match = byValue.get(value);
9701
- if (!match) return base.map((i) => types[i]);
9709
+ if (!match) return getFallback(runtimeType);
9702
9710
  for (const i of match) selected.add(i);
9703
9711
  directKey = key;
9704
9712
  }
@@ -9720,29 +9728,15 @@ function getIndex(types) {
9720
9728
  for (const i of selected) if (all.has(i) && !match?.has(i)) selected.delete(i);
9721
9729
  }
9722
9730
  }
9723
- return Array.from(selected).sort((a, b) => a - b).map((i) => types[i]);
9731
+ return Array.from(selected).sort((a, b) => a - b);
9724
9732
  };
9725
9733
  } else index = (input) => {
9726
- return (otherwise?.[input === null ? "null" : Array.isArray(input) ? "array" : typeof input] ?? emptyCandidates).map((i) => types[i]).filter(filterLiterals(input));
9734
+ const fallback = getFallback(getRuntimeType(input));
9735
+ return literalCandidates ? fallback.filter((i) => literalOf[i] === void 0 || literalOf[i] === input) : fallback;
9727
9736
  };
9728
9737
  candidateIndexCache.set(types, index);
9729
9738
  return index;
9730
9739
  }
9731
- function filterLiterals(input) {
9732
- return (ast) => {
9733
- const encoded = toCandidate(ast);
9734
- return encoded._tag === "Literal" ? encoded.literal === input : encoded._tag === "UniqueSymbol" ? encoded.symbol === input : true;
9735
- };
9736
- }
9737
- /**
9738
- * The goal is to reduce the number of a union members that will be checked.
9739
- * This is useful to reduce the number of issues that will be returned.
9740
- *
9741
- * @internal
9742
- */
9743
- function getCandidates(input, types, isConstructor = false) {
9744
- return getIndex(types)(input, isConstructor);
9745
- }
9746
9740
  /**
9747
9741
  * Constructs a {@link Union}.
9748
9742
  *
@@ -9763,34 +9757,20 @@ const Union$1 = class extends ASTNodeImpl {
9763
9757
  /** @internal */
9764
9758
  getParser(compile, compileField) {
9765
9759
  const ast = this;
9760
+ const isConstructor = compileField !== void 0;
9761
+ const parsers = [];
9762
+ const parser = (i) => parsers[i] ??= compile(ast.types[i]);
9763
+ let index;
9766
9764
  return (input, options) => {
9767
9765
  if (input === missing) return missingExit;
9768
- const candidates = getCandidates(input, ast.types, compileField !== void 0);
9766
+ const candidates = (index ??= getCandidateIndex(ast.types))(input, isConstructor);
9769
9767
  if (candidates.length === 0) return fail$1(new AnyOf(ast, [], input, options));
9770
9768
  if (candidates.length === 1) {
9771
- const result = compile(candidates[0])(input, options);
9769
+ const result = parser(candidates[0])(input, options);
9772
9770
  if (result._tag === "Success") return result;
9773
- return effectIsExit(result) ? failSingleUnionCandidate(ast, result.cause, input, options) : catchCause(result, (cause) => failSingleUnionCandidate(ast, cause, input, options));
9771
+ return effectIsExit(result) ? failSingleUnionCandidate(ast, result.cause, input, options) : catchSingleUnionCandidate(ast, result, input, options);
9774
9772
  }
9775
- const state = {
9776
- ast,
9777
- compile,
9778
- input,
9779
- out: void 0,
9780
- successes: ast.options?.mode === "oneOf" ? [] : void 0,
9781
- issues: void 0,
9782
- options
9783
- };
9784
- const eff = parseUnion(state, candidates);
9785
- if (!eff) {
9786
- if (state.out) return state.out;
9787
- return fail$1(new AnyOf(ast, state.issues ?? [], input, options));
9788
- }
9789
- return flatMapEager(eff, (_) => {
9790
- if (state.out === sameExit) return succeed$1(input);
9791
- if (state.out) return state.out;
9792
- return fail$1(new AnyOf(ast, state.issues ?? [], input, options));
9793
- });
9773
+ return parseUnionCandidates(ast, parser, candidates, input, options);
9794
9774
  };
9795
9775
  }
9796
9776
  _rebuild(recur, checks, encodingChecks) {
@@ -9841,11 +9821,38 @@ function failSingleUnionCandidate(ast, cause, input, options) {
9841
9821
  if (!issue) return failCause(cause);
9842
9822
  return fail$2(new AnyOf(ast, [issue], input, options));
9843
9823
  }
9824
+ function catchSingleUnionCandidate(ast, result, input, options) {
9825
+ return catchCause(result, (cause) => failSingleUnionCandidate(ast, cause, input, options));
9826
+ }
9827
+ function parseUnionCandidates(ast, parser, candidates, input, options) {
9828
+ const state = {
9829
+ ast,
9830
+ parser,
9831
+ input,
9832
+ out: void 0,
9833
+ successes: ast.options?.mode === "oneOf" ? [] : void 0,
9834
+ issues: void 0,
9835
+ options
9836
+ };
9837
+ const eff = parseUnion(state, candidates);
9838
+ if (!eff) {
9839
+ if (state.out) return state.out;
9840
+ return fail$1(new AnyOf(ast, state.issues ?? [], input, options));
9841
+ }
9842
+ return resumeUnion(eff, state);
9843
+ }
9844
+ function resumeUnion(eff, state) {
9845
+ return flatMapEager(eff, (_) => {
9846
+ if (state.out === sameExit) return succeed$1(state.input);
9847
+ if (state.out) return state.out;
9848
+ return fail$1(new AnyOf(state.ast, state.issues ?? [], state.input, state.options));
9849
+ });
9850
+ }
9844
9851
  const parseUnion = /*#__PURE__*/ iterateEager()({
9845
- onItem(s, ast) {
9846
- return s.compile(ast)(s.input, s.options);
9852
+ onItem(s, i) {
9853
+ return s.parser(i)(s.input, s.options);
9847
9854
  },
9848
- step(s, candidate, exit) {
9855
+ step(s, i, exit) {
9849
9856
  if (exit._tag === "Failure") {
9850
9857
  const issue = getSchemaIssue(exit.cause);
9851
9858
  if (issue === void 0) return exit;
@@ -9853,11 +9860,11 @@ const parseUnion = /*#__PURE__*/ iterateEager()({
9853
9860
  else s.issues = [issue];
9854
9861
  } else {
9855
9862
  if (s.out && s.successes) {
9856
- s.successes.push(candidate);
9863
+ s.successes.push(s.ast.types[i]);
9857
9864
  return fail$2(new OneOf(s.ast, s.successes, s.input, s.options));
9858
9865
  }
9859
9866
  s.out = exit;
9860
- if (s.successes) s.successes.push(candidate);
9867
+ if (s.successes) s.successes.push(s.ast.types[i]);
9861
9868
  else return void_$1;
9862
9869
  }
9863
9870
  }
@@ -9972,9 +9979,9 @@ const numberToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/* @__PUR
9972
9979
  * Arbitrary metadata preserves both `regExp.source` and `regExp.flags`.
9973
9980
  * Implementations that cannot consume all flags may still use the source as a
9974
9981
  * generation hint because the Schema filter validates every generated value.
9975
- * JSON Schema has no way to carry JavaScript regular-expression flags. The
9976
- * generated `pattern` contains the source only, so validation can differ when
9977
- * the RegExp uses flags or relies on JavaScript's non-Unicode behavior.
9982
+ * JSON Schema has no way to carry JavaScript regular-expression flags. Unless
9983
+ * annotations provide `toJsonSchema`, the RegExp constraint is omitted from
9984
+ * JSON Schema export.
9978
9985
  *
9979
9986
  * **Example** (Validating an email pattern)
9980
9987
  *
@@ -9991,51 +9998,71 @@ const numberToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/* @__PUR
9991
9998
  * @since 4.0.0
9992
9999
  */
9993
10000
  function isPattern$1(regExp, annotations) {
9994
- const source = regExp.source;
9995
- const pattern = new globalThis.RegExp(source, regExp.flags);
10001
+ const copy = new globalThis.RegExp(regExp);
10002
+ const payload = {
10003
+ source: copy.source,
10004
+ flags: copy.flags
10005
+ };
9996
10006
  return makeFilter$1((s) => {
9997
- pattern.lastIndex = 0;
9998
- return pattern.test(s);
10007
+ copy.lastIndex = 0;
10008
+ return copy.test(s);
9999
10009
  }, {
10000
- expected: `a string matching the RegExp ${source}`,
10010
+ expected: `a string matching the RegExp ${payload.source}`,
10001
10011
  representation: {
10002
10012
  id: "effect/schema/isPattern",
10003
- payload: {
10004
- source,
10005
- flags: regExp.flags
10006
- }
10013
+ payload
10007
10014
  },
10008
- toJsonSchema: () => ({ pattern: source }),
10009
- arbitraryConstraint: { patterns: [{
10010
- source: regExp.source,
10011
- flags: regExp.flags
10012
- }] },
10015
+ toJsonSchema: () => [{}, true],
10016
+ arbitraryConstraint: { patterns: [payload] },
10013
10017
  ...annotations
10014
10018
  });
10015
10019
  }
10016
- function modifyOwnPropertyDescriptors(ast, f) {
10017
- const d = Object.getOwnPropertyDescriptors(ast);
10018
- f(d);
10019
- return Object.create(Object.getPrototypeOf(ast), d);
10020
+ const bodyOwners = /*#__PURE__*/ new WeakMap();
10021
+ function copy(ast, changes) {
10022
+ const out = Object.assign(Object.create(Object.getPrototypeOf(ast)), ast, changes);
10023
+ if (Reflect.ownKeys(changes).every((key) => key === "context" || key === "encoding")) bodyOwners.set(out, getContextOwner(ast));
10024
+ return out;
10025
+ }
10026
+ /** @internal */
10027
+ function getContextOwner(ast) {
10028
+ const existing = bodyOwners.get(ast);
10029
+ if (existing !== void 0) return existing;
10030
+ if (ast.encoding === void 0) return ast;
10031
+ const owner = Object.assign(Object.create(Object.getPrototypeOf(ast)), ast, { encoding: void 0 });
10032
+ bodyOwners.set(ast, owner);
10033
+ return owner;
10020
10034
  }
10021
10035
  /** @internal */
10022
10036
  function replaceEncoding(ast, encoding) {
10023
- if (ast.encoding === encoding) return ast;
10024
- return modifyOwnPropertyDescriptors(ast, (d) => {
10025
- d.encoding.value = encoding;
10026
- });
10037
+ return ast.encoding === encoding ? ast : copy(ast, { encoding });
10038
+ }
10039
+ /** @internal */
10040
+ function replaceContext(ast, context) {
10041
+ if (ast.context === context) return ast;
10042
+ const owner = getContextOwner(ast);
10043
+ if (owner.context === context && owner.encoding === ast.encoding) return owner;
10044
+ return copy(ast, { context });
10027
10045
  }
10028
10046
  /** @internal */
10029
10047
  function getLastEncoding(ast) {
10030
10048
  return ast.encoding ? getLastEncoding(ast.encoding[ast.encoding.length - 1].to) : ast;
10031
10049
  }
10032
10050
  /** @internal */
10051
+ function annotate(ast, annotations) {
10052
+ if (ast.checks) {
10053
+ const last = ast.checks[ast.checks.length - 1];
10054
+ return replaceChecks(ast, append(ast.checks.slice(0, -1), last.annotate(annotations)));
10055
+ }
10056
+ return copy(ast, { annotations: {
10057
+ ...ast.annotations,
10058
+ ...annotations
10059
+ } });
10060
+ }
10061
+ /** @internal */
10033
10062
  function replaceChecks(ast, checks) {
10034
10063
  if (ast._tag === "Suspend" && checks) throw new Error("Cannot add checks to Suspend");
10035
10064
  if (ast.checks === checks) return ast;
10036
- return modifyOwnPropertyDescriptors(ast, (d) => {
10037
- d.checks.value = checks;
10038
- });
10065
+ return copy(ast, { checks });
10039
10066
  }
10040
10067
  /** @internal */
10041
10068
  function appendChecks(ast, checks) {
@@ -10064,15 +10091,25 @@ function applyToSelfOrLastLinkEncodingIdempotent(f, options) {
10064
10091
  return memoizeIdempotent(out);
10065
10092
  }
10066
10093
  function mapOrSame(as, f) {
10067
- let changed = false;
10068
- const out = new Array(as.length);
10094
+ let out;
10069
10095
  for (let i = 0; i < as.length; i++) {
10070
10096
  const a = as[i];
10071
10097
  const fa = f(a);
10072
- if (fa !== a) changed = true;
10073
- out[i] = fa;
10098
+ if (out) out[i] = fa;
10099
+ else if (fa !== a) {
10100
+ out = new Array(as.length);
10101
+ for (let j = 0; j < i; j++) out[j] = as[j];
10102
+ out[i] = fa;
10103
+ }
10074
10104
  }
10075
- return changed ? out : as;
10105
+ return out ?? as;
10106
+ }
10107
+ /** @internal */
10108
+ function annotateKey(ast, annotations) {
10109
+ return replaceContext(ast, ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, ast.context.constructorDefault, {
10110
+ ...ast.context.annotations,
10111
+ ...annotations
10112
+ }) : new Context(false, false, void 0, annotations));
10076
10113
  }
10077
10114
  /**
10078
10115
  * Returns `true` if the AST node represents an optional property.
@@ -10101,6 +10138,16 @@ function extractStructuralChecks(checks) {
10101
10138
  const out = checks.flatMap(extract);
10102
10139
  return isArrayNonEmpty(out) ? out : void 0;
10103
10140
  }
10141
+ function canPreserveEncodingChecks(ast) {
10142
+ let preserve = true;
10143
+ function visit(child) {
10144
+ preserve = preserve && !child.encoding && !isSuspend(child);
10145
+ if (preserve && "recur" in child) child.recur(visit);
10146
+ return child;
10147
+ }
10148
+ if ("recur" in ast) ast.recur(visit);
10149
+ return preserve;
10150
+ }
10104
10151
  /**
10105
10152
  * Strips all encoding transformations from an AST, returning the decoded
10106
10153
  * (type-level) representation.
@@ -10127,15 +10174,17 @@ function extractStructuralChecks(checks) {
10127
10174
  * @since 4.0.0
10128
10175
  */
10129
10176
  const toType = /*#__PURE__*/ memoizeIdempotent((ast) => {
10130
- if (ast.encoding) return toType(replaceEncoding(ast, void 0));
10131
- const out = ast;
10132
- const type = out.recur?.(toType) ?? out;
10133
- const encodingChecks = type.encodingChecks;
10134
- if (encodingChecks) {
10135
- const checks = type === ast ? encodingChecks : isArrays(type) || isObjects(type) || isDeclaration(type) && type.typeParameters.length > 0 ? extractStructuralChecks(encodingChecks) : void 0;
10136
- return modifyOwnPropertyDescriptors(type, (d) => {
10137
- d.encodingChecks.value = void 0;
10138
- d.checks.value = combineChecks(type.checks, checks);
10177
+ const owner = getContextOwner(ast);
10178
+ if (owner !== ast) {
10179
+ const type = toType(owner);
10180
+ return type === owner && ast.encoding === void 0 ? ast : replaceContext(type, ast.context);
10181
+ }
10182
+ const type = "recur" in ast ? ast.recur(toType) : ast;
10183
+ if ("encodingChecks" in type && type.encodingChecks) {
10184
+ const checks = canPreserveEncodingChecks(ast) ? type.encodingChecks : isArrays(type) || isObjects(type) || isDeclaration(type) && type.typeParameters.length > 0 ? extractStructuralChecks(type.encodingChecks) : void 0;
10185
+ return copy(type, {
10186
+ encodingChecks: void 0,
10187
+ checks: combineChecks(type.checks, checks)
10139
10188
  });
10140
10189
  }
10141
10190
  return type;
@@ -10198,8 +10247,12 @@ function flipEncoding(ast, encoding) {
10198
10247
  */
10199
10248
  const flip = /*#__PURE__*/ memoize((ast) => {
10200
10249
  if (ast.encoding) return flipEncoding(ast, ast.encoding);
10201
- const out = ast;
10202
- return out.flip?.(flip) ?? out.recur?.(flip) ?? out;
10250
+ const owner = getContextOwner(ast);
10251
+ if (owner !== ast) {
10252
+ const flipped = flip(owner);
10253
+ return flipped === owner ? ast : replaceContext(flipped, ast.context);
10254
+ }
10255
+ return "flip" in ast ? ast.flip(flip) : "recur" in ast ? ast.recur(flip) : ast;
10203
10256
  });
10204
10257
  /** @internal */
10205
10258
  function containsUndefined(ast) {
@@ -10275,7 +10328,7 @@ function getConstructorDescriptor(ast) {
10275
10328
  return isFunction$3(getDescriptor) ? getDescriptor(ast.typeParameters) : void 0;
10276
10329
  }
10277
10330
  //#endregion
10278
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/interpreter.js
10331
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/schema/interpreter.js
10279
10332
  const flatMapTransformation = (result, current, f) => result === sameExit ? f(current) : flatMapEager(result, f);
10280
10333
  function compileTransformation(transformation) {
10281
10334
  if (transformation._tag === "Middleware") return (result, current, options) => {
@@ -10409,6 +10462,10 @@ function compile(ast, compile, compileField, base, specialize) {
10409
10462
  });
10410
10463
  };
10411
10464
  }
10465
+ //#endregion
10466
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/schema/compilerRegistry.js
10467
+ /** @internal */
10468
+ const invalid = /*#__PURE__*/ Symbol();
10412
10469
  const cache = /*#__PURE__*/ new WeakMap();
10413
10470
  const decodeChild = (ast) => resolve(ast).parser;
10414
10471
  const makeChild = (ast) => resolve(ast).makeEffect;
@@ -10436,6 +10493,102 @@ function resolve(ast) {
10436
10493
  cache.set(ast, entry);
10437
10494
  return entry;
10438
10495
  }
10496
+ //#endregion
10497
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/SchemaParser.js
10498
+ /**
10499
+ * Runs schemas against real values.
10500
+ *
10501
+ * Schema parsers construct values from schema input, check whether a value
10502
+ * matches a schema, decode encoded input, and encode decoded values back to
10503
+ * their external form. This module exposes those operations through several
10504
+ * result styles, including `Effect`, `Promise`, `Exit`, `Option`, `Result`, and
10505
+ * synchronous functions that throw. It also contains the lower-level runner that
10506
+ * walks a schema AST and reports schema failures as `SchemaIssue.Issue` values.
10507
+ *
10508
+ * @since 4.0.0
10509
+ */
10510
+ /**
10511
+ * Creates an effectful maker for the schema's decoded type side.
10512
+ *
10513
+ * **When to use**
10514
+ *
10515
+ * Use to construct decoded schema values in `Effect` while preserving
10516
+ * construction failures as `SchemaIssue.Issue` values in the error channel.
10517
+ *
10518
+ * **Details**
10519
+ *
10520
+ * The returned function accepts constructor input, applies constructor defaults,
10521
+ * runs type-side validation unless checks are disabled, and fails with a
10522
+ * `SchemaIssue.Issue` when construction fails.
10523
+ *
10524
+ * @category constructors
10525
+ * @since 4.0.0
10526
+ */
10527
+ function makeEffect(schema) {
10528
+ const ast = schema.ast;
10529
+ let parser;
10530
+ return (input, options) => {
10531
+ return (parser ??= runWithCompiler(constructorCompiler, toType(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
10532
+ ...options.parseOptions,
10533
+ disableChecks: true
10534
+ } : { disableChecks: true } : options?.parseOptions);
10535
+ };
10536
+ }
10537
+ /**
10538
+ * Creates a synchronous maker that returns `Option.some` with the constructed
10539
+ * value on success, or `Option.none` when construction fails with schema issues.
10540
+ *
10541
+ * **When to use**
10542
+ *
10543
+ * Use when you need to validate schema constructor input and only care whether
10544
+ * construction succeeds, without exposing `SchemaIssue.Issue` details.
10545
+ *
10546
+ * **Gotchas**
10547
+ *
10548
+ * Only causes made entirely of schema issues are converted to `Option.none`.
10549
+ * Causes that contain defects, interruptions, or asynchronous work at this
10550
+ * synchronous boundary throw an `Error` whose cause is the underlying `Cause`.
10551
+ *
10552
+ * @category constructors
10553
+ * @since 4.0.0
10554
+ */
10555
+ function makeOption(schema) {
10556
+ const parser = makeEffect(schema);
10557
+ return (input, options) => {
10558
+ const exit = runSyncExit(parser(input, options));
10559
+ if (isSuccess(exit)) return some$1(exit.value);
10560
+ getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
10561
+ return none();
10562
+ };
10563
+ }
10564
+ /**
10565
+ * Creates a synchronous maker for the schema's decoded type side.
10566
+ *
10567
+ * **When to use**
10568
+ *
10569
+ * Use to construct decoded schema values synchronously when invalid input
10570
+ * should throw an `Error` whose cause is `SchemaIssue.Issue`.
10571
+ *
10572
+ * **Details**
10573
+ *
10574
+ * The returned function constructs a value from constructor input and throws an
10575
+ * `Error` with the `SchemaIssue.Issue` in its `cause` when construction fails.
10576
+ * Schema validation failures use the generic message `"Schema validation failed"`.
10577
+ * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when
10578
+ * human-readable details are needed.
10579
+ *
10580
+ * **Gotchas**
10581
+ *
10582
+ * Causes that contain defects, interruptions, or asynchronous work at this
10583
+ * synchronous boundary throw an `Error` whose cause is the underlying `Cause`,
10584
+ * instead of being converted to a schema validation error.
10585
+ *
10586
+ * @category constructors
10587
+ * @since 4.0.0
10588
+ */
10589
+ function make$5(schema) {
10590
+ return makeConstructorSync(toType(schema.ast));
10591
+ }
10439
10592
  /**
10440
10593
  * Creates an effectful decoder for `unknown` input.
10441
10594
  *
@@ -10473,6 +10626,11 @@ const getValue = (value) => {
10473
10626
  function run(ast) {
10474
10627
  return runWithCompiler(normalCompiler, ast);
10475
10628
  }
10629
+ function parserResult(result, input) {
10630
+ if (result === sameExit) return succeed$1(input);
10631
+ if (!effectIsExit(result)) return flatMapEager(result, getValue);
10632
+ return result[args] === missing ? getValue(missing) : result;
10633
+ }
10476
10634
  function runWithCompiler(compiler, ast) {
10477
10635
  let parser;
10478
10636
  return (input, options) => {
@@ -10482,16 +10640,100 @@ function runWithCompiler(compiler, ast) {
10482
10640
  return result[args] === missing ? getValue(missing) : result;
10483
10641
  };
10484
10642
  }
10643
+ function runSync(effect, message) {
10644
+ const exit = runSyncExit(effect);
10645
+ if (isSuccess(exit)) return exit.value;
10646
+ const issue = getSchemaIssueOrThrow(exit.cause, message);
10647
+ throw new Error("Schema validation failed", { cause: issue });
10648
+ }
10649
+ function makeConstructorSync(ast) {
10650
+ let entry;
10651
+ let parser;
10652
+ return (input, options) => {
10653
+ entry ??= resolve(ast);
10654
+ const parseOptions = options?.disableChecks ? options.parseOptions ? {
10655
+ ...options.parseOptions,
10656
+ disableChecks: true
10657
+ } : { disableChecks: true } : options?.parseOptions ?? defaultParseOptions;
10658
+ const make = entry.make;
10659
+ if (make !== void 0 && input !== missing) {
10660
+ let output;
10661
+ try {
10662
+ output = make(input, parseOptions);
10663
+ } catch (error) {
10664
+ getSchemaIssueOrThrow(die$1(error), "Constructor adapter can only throw schema issues");
10665
+ throw error;
10666
+ }
10667
+ if (output !== invalid && output !== missing) return output;
10668
+ }
10669
+ return runSync(parserResult((parser ??= entry.makeEffect)(input, parseOptions), input), "Constructor adapter can only throw schema issues");
10670
+ };
10671
+ }
10485
10672
  const normalCompiler = (ast) => resolve(ast).parser;
10673
+ const constructorCompiler = (ast) => resolve(ast).makeEffect;
10486
10674
  //#endregion
10487
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schemaError.js
10675
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/schema/make.js
10676
+ /** @internal */
10677
+ const TypeId$1 = "~effect/Schema/Schema";
10678
+ const RebuildOptions = /*#__PURE__*/ Symbol();
10679
+ const SchemaProto = {
10680
+ [TypeId$1]: TypeId$1,
10681
+ get make() {
10682
+ const value = make$5(this);
10683
+ Object.defineProperty(this, "make", {
10684
+ value,
10685
+ enumerable: true
10686
+ });
10687
+ return value;
10688
+ },
10689
+ get makeEffect() {
10690
+ const value = makeEffect(this);
10691
+ Object.defineProperty(this, "makeEffect", {
10692
+ value,
10693
+ enumerable: true
10694
+ });
10695
+ return value;
10696
+ },
10697
+ get makeOption() {
10698
+ const value = makeOption(this);
10699
+ Object.defineProperty(this, "makeOption", {
10700
+ value,
10701
+ enumerable: true
10702
+ });
10703
+ return value;
10704
+ },
10705
+ pipe() {
10706
+ return pipeArguments(this, arguments);
10707
+ },
10708
+ annotate(annotations) {
10709
+ return this.rebuild(annotate(this.ast, annotations));
10710
+ },
10711
+ annotateKey(annotations) {
10712
+ return this.rebuild(annotateKey(this.ast, annotations));
10713
+ },
10714
+ check(...checks) {
10715
+ return this.rebuild(appendChecks(this.ast, checks));
10716
+ },
10717
+ rebuild(ast) {
10718
+ return make$4(ast, this[RebuildOptions]);
10719
+ }
10720
+ };
10721
+ /** @internal */
10722
+ function make$4(ast, options) {
10723
+ function Schema() {}
10724
+ const self = Object.setPrototypeOf(Schema, SchemaProto);
10725
+ if (options && (Object.hasOwn(options, "name") || Object.hasOwn(options, "length") || Object.hasOwn(options, "__proto__"))) Object.defineProperties(self, Object.getOwnPropertyDescriptors({ ...options }));
10726
+ else Object.assign(self, options);
10727
+ self[RebuildOptions] = options;
10728
+ self.ast = ast;
10729
+ return self;
10730
+ }
10731
+ //#endregion
10732
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/internal/schemaError.js
10488
10733
  const SchemaErrorTypeId = "~effect/Schema/SchemaError";
10489
10734
  function isSchemaError$1(u) {
10490
10735
  return hasProperty(u, "~effect/Schema/SchemaError") && u["~effect/Schema/SchemaError"] === "~effect/Schema/SchemaError";
10491
10736
  }
10492
- ({ ...BaseProto });
10493
- ({ ...BaseProto });
10494
- ({ ...PipeInspectableProto });
10495
10737
  /**
10496
10738
  * Error thrown or returned when schema decoding or encoding fails.
10497
10739
  *
@@ -10688,7 +10930,7 @@ globalThis.FormData;
10688
10930
  globalThis.URLSearchParams;
10689
10931
  globalThis.Uint8Array;
10690
10932
  //#endregion
10691
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/MutableRef.js
10933
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/MutableRef.js
10692
10934
  const TypeId = "~effect/MutableRef";
10693
10935
  const MutableRefProto = {
10694
10936
  [TypeId]: TypeId,
@@ -10738,7 +10980,7 @@ const make$2 = (value) => {
10738
10980
  return ref;
10739
10981
  };
10740
10982
  //#endregion
10741
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Ref.js
10983
+ //#region ../../node_modules/.pnpm/effect@4.0.0/node_modules/effect/dist/Ref.js
10742
10984
  /**
10743
10985
  * Stores fiber-safe mutable state inside Effect programs.
10744
10986
  *
@@ -10881,7 +11123,7 @@ const update = /*#__PURE__*/ dual(2, (self, f) => sync(() => {
10881
11123
  self.ref.current = f(self.ref.current);
10882
11124
  }));
10883
11125
  //#endregion
10884
- //#region ../../node_modules/.pnpm/effect-oxlint@0.3.4_effect@4.0.0-rc.117/node_modules/effect-oxlint/dist/index.js
11126
+ //#region ../../node_modules/.pnpm/effect-oxlint@0.3.4_effect@4.0.0/node_modules/effect-oxlint/dist/index.js
10885
11127
  var AST_exports = /* @__PURE__ */ __exportAll({
10886
11128
  calleeIdentifier: () => calleeIdentifier,
10887
11129
  calleeName: () => calleeName,
@@ -11860,6 +12102,8 @@ const resolveImportedPath = (references, node) => gen$2(function* () {
11860
12102
  });
11861
12103
  const foldkitNamespaceBySource = {
11862
12104
  "foldkit/command": "Command",
12105
+ "foldkit/experimental": "Experimental",
12106
+ "foldkit/experimental/query": "Query",
11863
12107
  "foldkit/html": "Html",
11864
12108
  "foldkit/managedResource": "ManagedResource",
11865
12109
  "foldkit/message": "Message",
@@ -12119,20 +12363,32 @@ const messageCases = (node, bindings, references) => {
12119
12363
  });
12120
12364
  };
12121
12365
  const hasMessagePayloadProperty = (fields) => fields.properties.some((property) => property.type === "Property" && (isIdentifier(property.key, "message") || isStringLiteral(property.key) && property.key.value === "message"));
12122
- const containsImportedMessageReference = (node, references, visited) => {
12366
+ const isLocalQueryMessageReference = (node, references) => exists(staticMemberPath(node), (memberPath) => {
12367
+ const [memberName, extraMember] = memberPath.members;
12368
+ if (memberName !== "Message" || extraMember !== void 0) return false;
12369
+ return exists(resolvedVariable(references, memberPath.root), (variable) => variable.defs.some((definition) => {
12370
+ if (definition.type !== "Variable" || !isVariableDeclarator$1(definition.node) || !isCallExpression$1(definition.node.init)) return false;
12371
+ return exists(resolveFoldkitApiPath(references, definition.node.init.callee), (apiPath) => {
12372
+ const apiName = apiPath.join(".");
12373
+ return apiName === "Query.define" || apiName === "Experimental.Query.define";
12374
+ });
12375
+ }));
12376
+ });
12377
+ const containsMessageReference = (node, references, visited) => {
12123
12378
  if (typeof node !== "object" || node === null || visited.has(node)) return false;
12124
12379
  visited.add(node);
12380
+ if (isLocalQueryMessageReference(node, references)) return true;
12125
12381
  if (exists(resolveImportedPath(references, node), (path) => {
12126
12382
  const [messageName] = path.members.slice(-1);
12127
12383
  return messageName === "Message";
12128
12384
  })) return true;
12129
- return Object.entries(node).some(([key, value]) => key !== "parent" && (Array.isArray(value) ? value.some((element) => containsImportedMessageReference(element, references, visited)) : containsImportedMessageReference(value, references, visited)));
12385
+ return Object.entries(node).some(([key, value]) => key !== "parent" && (Array.isArray(value) ? value.some((element) => containsMessageReference(element, references, visited)) : containsMessageReference(value, references, visited)));
12130
12386
  };
12131
12387
  const hasSubmodelMessagePayload = (fields, references) => {
12132
12388
  if (references === void 0) return hasMessagePayloadProperty(fields);
12133
12389
  return fields.properties.some((property) => {
12134
12390
  if (property.type !== "Property" || !(isIdentifier(property.key, "message") || isStringLiteral(property.key) && property.key.value === "message")) return false;
12135
- return containsImportedMessageReference(property.value, references, /* @__PURE__ */ new WeakSet());
12391
+ return containsMessageReference(property.value, references, /* @__PURE__ */ new WeakSet());
12136
12392
  });
12137
12393
  };
12138
12394
  //#endregion