@brytdesigns/shopify-ajax-client 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -920,14 +920,6 @@ var containsWith = (isEquivalent) => dual(2, (self, a) => isNone2(self) ? false
920
920
  var _equivalence = /* @__PURE__ */ equivalence();
921
921
  var contains = /* @__PURE__ */ containsWith(_equivalence);
922
922
  var exists = /* @__PURE__ */ dual(2, (self, refinement) => isNone2(self) ? false : refinement(self.value));
923
- var mergeWith = (f) => (o1, o2) => {
924
- if (isNone2(o1)) {
925
- return o2;
926
- } else if (isNone2(o2)) {
927
- return o1;
928
- }
929
- return some2(f(o1.value, o2.value));
930
- };
931
923
 
932
924
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/Tuple.js
933
925
  var make3 = (...elements) => elements;
@@ -968,8 +960,8 @@ var isEmptyArray = (self) => self.length === 0;
968
960
  var isEmptyReadonlyArray = isEmptyArray;
969
961
  var isNonEmptyArray2 = isNonEmptyArray;
970
962
  var isNonEmptyReadonlyArray = isNonEmptyArray;
971
- var isOutOfBounds = (i, as7) => i < 0 || i >= as7.length;
972
- var clamp = (i, as7) => Math.floor(Math.min(Math.max(0, i), as7.length));
963
+ var isOutOfBounds = (i, as6) => i < 0 || i >= as6.length;
964
+ var clamp = (i, as6) => Math.floor(Math.min(Math.max(0, i), as6.length));
973
965
  var get = /* @__PURE__ */ dual(2, (self, index) => {
974
966
  const i = Math.floor(index);
975
967
  return isOutOfBounds(i, self) ? none2() : some2(self[i]);
@@ -1009,13 +1001,13 @@ var sort = /* @__PURE__ */ dual(2, (self, O) => {
1009
1001
  });
1010
1002
  var zip = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, make3));
1011
1003
  var zipWith = /* @__PURE__ */ dual(3, (self, that, f) => {
1012
- const as7 = fromIterable(self);
1004
+ const as6 = fromIterable(self);
1013
1005
  const bs = fromIterable(that);
1014
- if (isNonEmptyReadonlyArray(as7) && isNonEmptyReadonlyArray(bs)) {
1015
- const out = [f(headNonEmpty(as7), headNonEmpty(bs))];
1016
- const len = Math.min(as7.length, bs.length);
1006
+ if (isNonEmptyReadonlyArray(as6) && isNonEmptyReadonlyArray(bs)) {
1007
+ const out = [f(headNonEmpty(as6), headNonEmpty(bs))];
1008
+ const len = Math.min(as6.length, bs.length);
1017
1009
  for (let i = 1; i < len; i++) {
1018
- out[i] = f(as7[i], bs[i]);
1010
+ out[i] = f(as6[i], bs[i]);
1019
1011
  }
1020
1012
  return out;
1021
1013
  }
@@ -1069,10 +1061,10 @@ var flatMap2 = /* @__PURE__ */ dual(2, (self, f) => {
1069
1061
  });
1070
1062
  var flatten = /* @__PURE__ */ flatMap2(identity);
1071
1063
  var filterMap = /* @__PURE__ */ dual(2, (self, f) => {
1072
- const as7 = fromIterable(self);
1064
+ const as6 = fromIterable(self);
1073
1065
  const out = [];
1074
- for (let i = 0; i < as7.length; i++) {
1075
- const o = f(as7[i], i);
1066
+ for (let i = 0; i < as6.length; i++) {
1067
+ const o = f(as6[i], i);
1076
1068
  if (isSome2(o)) {
1077
1069
  out.push(o.value);
1078
1070
  }
@@ -1080,11 +1072,11 @@ var filterMap = /* @__PURE__ */ dual(2, (self, f) => {
1080
1072
  return out;
1081
1073
  });
1082
1074
  var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
1083
- const as7 = fromIterable(self);
1075
+ const as6 = fromIterable(self);
1084
1076
  const out = [];
1085
- for (let i = 0; i < as7.length; i++) {
1086
- if (predicate(as7[i], i)) {
1087
- out.push(as7[i]);
1077
+ for (let i = 0; i < as6.length; i++) {
1078
+ if (predicate(as6[i], i)) {
1079
+ out.push(as6[i]);
1088
1080
  }
1089
1081
  }
1090
1082
  return out;
@@ -1170,53 +1162,53 @@ var ChunkProto = {
1170
1162
  }
1171
1163
  };
1172
1164
  var makeChunk = (backing) => {
1173
- const chunk3 = Object.create(ChunkProto);
1174
- chunk3.backing = backing;
1165
+ const chunk2 = Object.create(ChunkProto);
1166
+ chunk2.backing = backing;
1175
1167
  switch (backing._tag) {
1176
1168
  case "IEmpty": {
1177
- chunk3.length = 0;
1178
- chunk3.depth = 0;
1179
- chunk3.left = chunk3;
1180
- chunk3.right = chunk3;
1169
+ chunk2.length = 0;
1170
+ chunk2.depth = 0;
1171
+ chunk2.left = chunk2;
1172
+ chunk2.right = chunk2;
1181
1173
  break;
1182
1174
  }
1183
1175
  case "IConcat": {
1184
- chunk3.length = backing.left.length + backing.right.length;
1185
- chunk3.depth = 1 + Math.max(backing.left.depth, backing.right.depth);
1186
- chunk3.left = backing.left;
1187
- chunk3.right = backing.right;
1176
+ chunk2.length = backing.left.length + backing.right.length;
1177
+ chunk2.depth = 1 + Math.max(backing.left.depth, backing.right.depth);
1178
+ chunk2.left = backing.left;
1179
+ chunk2.right = backing.right;
1188
1180
  break;
1189
1181
  }
1190
1182
  case "IArray": {
1191
- chunk3.length = backing.array.length;
1192
- chunk3.depth = 0;
1193
- chunk3.left = _empty;
1194
- chunk3.right = _empty;
1183
+ chunk2.length = backing.array.length;
1184
+ chunk2.depth = 0;
1185
+ chunk2.left = _empty;
1186
+ chunk2.right = _empty;
1195
1187
  break;
1196
1188
  }
1197
1189
  case "ISingleton": {
1198
- chunk3.length = 1;
1199
- chunk3.depth = 0;
1200
- chunk3.left = _empty;
1201
- chunk3.right = _empty;
1190
+ chunk2.length = 1;
1191
+ chunk2.depth = 0;
1192
+ chunk2.left = _empty;
1193
+ chunk2.right = _empty;
1202
1194
  break;
1203
1195
  }
1204
1196
  case "ISlice": {
1205
- chunk3.length = backing.length;
1206
- chunk3.depth = backing.chunk.depth + 1;
1207
- chunk3.left = _empty;
1208
- chunk3.right = _empty;
1197
+ chunk2.length = backing.length;
1198
+ chunk2.depth = backing.chunk.depth + 1;
1199
+ chunk2.left = _empty;
1200
+ chunk2.right = _empty;
1209
1201
  break;
1210
1202
  }
1211
1203
  }
1212
- return chunk3;
1204
+ return chunk2;
1213
1205
  };
1214
1206
  var isChunk = (u) => hasProperty(u, TypeId3);
1215
1207
  var _empty = /* @__PURE__ */ makeChunk({
1216
1208
  _tag: "IEmpty"
1217
1209
  });
1218
1210
  var empty2 = () => _empty;
1219
- var make4 = (...as7) => unsafeFromNonEmptyArray(as7);
1211
+ var make4 = (...as6) => unsafeFromNonEmptyArray(as6);
1220
1212
  var of2 = (a) => makeChunk({
1221
1213
  _tag: "ISingleton",
1222
1214
  a
@@ -2243,14 +2235,6 @@ var failureOrCause = (self) => {
2243
2235
  }
2244
2236
  }
2245
2237
  };
2246
- var flipCauseOption = (self) => match3(self, {
2247
- onEmpty: some2(empty6),
2248
- onFail: map2(fail),
2249
- onDie: (defect) => some2(die(defect)),
2250
- onInterrupt: (fiberId2) => some2(interrupt(fiberId2)),
2251
- onSequential: mergeWith(sequential),
2252
- onParallel: mergeWith(parallel)
2253
- });
2254
2238
  var interruptOption = (self) => find(self, (cause2) => cause2._tag === OP_INTERRUPT ? some2(cause2.fiberId) : none2());
2255
2239
  var stripFailures = (self) => match3(self, {
2256
2240
  onEmpty: empty6,
@@ -2634,12 +2618,12 @@ var prettyErrorStack = (message, stack, span2) => {
2634
2618
  const stack2 = stackFn();
2635
2619
  if (typeof stack2 === "string") {
2636
2620
  const locationMatchAll = stack2.matchAll(locationRegex);
2637
- let match15 = false;
2621
+ let match14 = false;
2638
2622
  for (const [, location2] of locationMatchAll) {
2639
- match15 = true;
2623
+ match14 = true;
2640
2624
  out.push(` at ${current.name} (${location2})`);
2641
2625
  }
2642
- if (!match15) {
2626
+ if (!match14) {
2643
2627
  out.push(` at ${current.name} (${stack2.replace(/^at /, "")})`);
2644
2628
  }
2645
2629
  } else {
@@ -2827,12 +2811,6 @@ var unsafeGet3 = /* @__PURE__ */ dual(2, (self, tag2) => {
2827
2811
  return self.unsafeMap.get(tag2.key);
2828
2812
  });
2829
2813
  var get4 = unsafeGet3;
2830
- var getOrElse2 = /* @__PURE__ */ dual(3, (self, tag2, orElse9) => {
2831
- if (!self.unsafeMap.has(tag2.key)) {
2832
- return isReference(tag2) ? getDefaultValue(tag2) : orElse9();
2833
- }
2834
- return self.unsafeMap.get(tag2.key);
2835
- });
2836
2814
  var getOption = /* @__PURE__ */ dual(2, (self, tag2) => {
2837
2815
  if (!self.unsafeMap.has(tag2.key)) {
2838
2816
  return isReference(tag2) ? some(getDefaultValue(tag2)) : none;
@@ -2855,7 +2833,6 @@ var empty8 = empty7;
2855
2833
  var make9 = make8;
2856
2834
  var add4 = add3;
2857
2835
  var get5 = get4;
2858
- var getOrElse3 = getOrElse2;
2859
2836
  var unsafeGet4 = unsafeGet3;
2860
2837
  var getOption2 = getOption;
2861
2838
  var merge3 = merge2;
@@ -2886,9 +2863,9 @@ var decode = (input) => {
2886
2863
  }
2887
2864
  return nanos(BigInt(Math.round(input[0] * 1e9)) + BigInt(Math.round(input[1])));
2888
2865
  } else if (isString(input)) {
2889
- const match15 = DURATION_REGEX.exec(input);
2890
- if (match15) {
2891
- const [_, valueStr, unit] = match15;
2866
+ const match14 = DURATION_REGEX.exec(input);
2867
+ if (match14) {
2868
+ const [_, valueStr, unit] = match14;
2892
2869
  const value2 = Number(valueStr);
2893
2870
  switch (unit) {
2894
2871
  case "nano":
@@ -3355,27 +3332,27 @@ var ConsProto = {
3355
3332
  return cached(this, array2(toArray2(this)));
3356
3333
  },
3357
3334
  [Symbol.iterator]() {
3358
- let done8 = false;
3335
+ let done7 = false;
3359
3336
  let self = this;
3360
3337
  return {
3361
3338
  next() {
3362
- if (done8) {
3339
+ if (done7) {
3363
3340
  return this.return();
3364
3341
  }
3365
3342
  if (self._tag === "Nil") {
3366
- done8 = true;
3343
+ done7 = true;
3367
3344
  return this.return();
3368
3345
  }
3369
3346
  const value2 = self.head;
3370
3347
  self = self.tail;
3371
3348
  return {
3372
- done: done8,
3349
+ done: done7,
3373
3350
  value: value2
3374
3351
  };
3375
3352
  },
3376
3353
  return(value2) {
3377
- if (!done8) {
3378
- done8 = true;
3354
+ if (!done7) {
3355
+ done7 = true;
3379
3356
  }
3380
3357
  return {
3381
3358
  done: true,
@@ -3485,7 +3462,7 @@ var Structural = /* @__PURE__ */ function() {
3485
3462
  Structural2.prototype = StructuralPrototype;
3486
3463
  return Structural2;
3487
3464
  }();
3488
- var struct = (as7) => Object.assign(Object.create(StructuralPrototype), as7);
3465
+ var struct = (as6) => Object.assign(Object.create(StructuralPrototype), as6);
3489
3466
 
3490
3467
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/differ/contextPatch.js
3491
3468
  var ContextPatchTypeId = /* @__PURE__ */ Symbol.for("effect/DifferContextPatch");
@@ -4903,17 +4880,6 @@ var exitMap = /* @__PURE__ */ dual(2, (self, f) => {
4903
4880
  return exitSucceed(f(self.effect_instruction_i0));
4904
4881
  }
4905
4882
  });
4906
- var exitMapBoth = /* @__PURE__ */ dual(2, (self, {
4907
- onFailure,
4908
- onSuccess
4909
- }) => {
4910
- switch (self._tag) {
4911
- case OP_FAILURE:
4912
- return exitFailCause(pipe(self.effect_instruction_i0, map9(onFailure)));
4913
- case OP_SUCCESS:
4914
- return exitSucceed(onSuccess(self.effect_instruction_i0));
4915
- }
4916
- });
4917
4883
  var exitMatch = /* @__PURE__ */ dual(2, (self, {
4918
4884
  onFailure,
4919
4885
  onSuccess
@@ -4982,7 +4948,7 @@ var exitCollectAllInternal = (exits, combineCauses) => {
4982
4948
  return pipe(tailNonEmpty2(list), reduce(pipe(headNonEmpty2(list), exitMap(of2)), (accumulator, current) => pipe(accumulator, exitZipWith(current, {
4983
4949
  onSuccess: (list2, value2) => pipe(list2, prepend2(value2)),
4984
4950
  onFailure: combineCauses
4985
- }))), exitMap(reverse2), exitMap((chunk3) => toReadonlyArray(chunk3)), some2);
4951
+ }))), exitMap(reverse2), exitMap((chunk2) => toReadonlyArray(chunk2)), some2);
4986
4952
  };
4987
4953
  var deferredUnsafeMake = (fiberId2) => {
4988
4954
  const _deferred = {
@@ -5388,7 +5354,7 @@ var makeFlat = (options3) => ({
5388
5354
  enumerateChildren: options3.enumerateChildren
5389
5355
  });
5390
5356
  var fromFlat = (flat) => make20({
5391
- load: (config) => flatMap7(fromFlatLoop(flat, empty(), config, false), (chunk3) => match2(head(chunk3), {
5357
+ load: (config) => flatMap7(fromFlatLoop(flat, empty(), config, false), (chunk2) => match2(head(chunk2), {
5392
5358
  onNone: () => fail2(MissingData(empty(), `Expected a single value having structure: ${config}`)),
5393
5359
  onSome: succeed
5394
5360
  })),
@@ -5559,9 +5525,9 @@ var indicesFrom = (quotedIndices) => pipe(forEachSequential(quotedIndices, parse
5559
5525
  }), either2, map11(merge));
5560
5526
  var QUOTED_INDEX_REGEX = /^(\[(\d+)\])$/;
5561
5527
  var parseQuotedIndex = (str) => {
5562
- const match15 = str.match(QUOTED_INDEX_REGEX);
5563
- if (match15 !== null) {
5564
- const matchedIndex = match15[2];
5528
+ const match14 = str.match(QUOTED_INDEX_REGEX);
5529
+ if (match14 !== null) {
5530
+ const matchedIndex = match14[2];
5565
5531
  return pipe(matchedIndex !== void 0 && matchedIndex.length > 0 ? some2(matchedIndex) : none2(), flatMap(parseInteger));
5566
5532
  }
5567
5533
  return none2();
@@ -6958,15 +6924,56 @@ var memoize = (self) => pipe(deferredMake(), flatMap7((deferred) => pipe(diffFib
6958
6924
  var negate = (self) => map11(self, (b) => !b);
6959
6925
  var once = (self) => map11(make25(true), (ref) => asVoid(whenEffect(self, getAndSet2(ref, false))));
6960
6926
  var patchFiberRefs = (patch11) => updateFiberRefs((fiberId2, fiberRefs3) => pipe(patch11, patch6(fiberId2, fiberRefs3)));
6927
+ var promise = (evaluate2) => evaluate2.length >= 1 ? async_((resolve, signal) => {
6928
+ try {
6929
+ evaluate2(signal).then((a) => resolve(exitSucceed(a)), (e) => resolve(exitDie(e)));
6930
+ } catch (e) {
6931
+ resolve(exitDie(e));
6932
+ }
6933
+ }) : async_((resolve) => {
6934
+ try {
6935
+ ;
6936
+ evaluate2().then((a) => resolve(exitSucceed(a)), (e) => resolve(exitDie(e)));
6937
+ } catch (e) {
6938
+ resolve(exitDie(e));
6939
+ }
6940
+ });
6961
6941
  var provideService = /* @__PURE__ */ dual(3, (self, tag2, service2) => contextWithEffect((env) => provideContext(self, add4(env, tag2, service2))));
6962
6942
  var provideServiceEffect = /* @__PURE__ */ dual(3, (self, tag2, effect3) => contextWithEffect((env) => flatMap7(effect3, (service2) => provideContext(self, pipe(env, add4(tag2, service2))))));
6963
6943
  var sleep3 = sleep2;
6964
6944
  var succeedNone = /* @__PURE__ */ succeed(/* @__PURE__ */ none2());
6965
- var summarized = /* @__PURE__ */ dual(3, (self, summary5, f) => flatMap7(summary5, (start3) => flatMap7(self, (value2) => map11(summary5, (end4) => [f(start3, end4), value2]))));
6945
+ var summarized = /* @__PURE__ */ dual(3, (self, summary5, f) => flatMap7(summary5, (start3) => flatMap7(self, (value2) => map11(summary5, (end3) => [f(start3, end3), value2]))));
6966
6946
  var tapErrorCause = /* @__PURE__ */ dual(2, (self, f) => matchCauseEffect(self, {
6967
6947
  onFailure: (cause2) => zipRight(f(cause2), failCause(cause2)),
6968
6948
  onSuccess: succeed
6969
6949
  }));
6950
+ var tryPromise = (arg) => {
6951
+ let evaluate2;
6952
+ let catcher = void 0;
6953
+ if (typeof arg === "function") {
6954
+ evaluate2 = arg;
6955
+ } else {
6956
+ evaluate2 = arg.try;
6957
+ catcher = arg.catch;
6958
+ }
6959
+ const fail13 = (e) => catcher ? failSync(() => catcher(e)) : fail2(new UnknownException(e, "An unknown error occurred in Effect.tryPromise"));
6960
+ if (evaluate2.length >= 1) {
6961
+ return async_((resolve, signal) => {
6962
+ try {
6963
+ evaluate2(signal).then((a) => resolve(exitSucceed(a)), (e) => resolve(fail13(e)));
6964
+ } catch (e) {
6965
+ resolve(fail13(e));
6966
+ }
6967
+ });
6968
+ }
6969
+ return async_((resolve) => {
6970
+ try {
6971
+ evaluate2().then((a) => resolve(exitSucceed(a)), (e) => resolve(fail13(e)));
6972
+ } catch (e) {
6973
+ resolve(fail13(e));
6974
+ }
6975
+ });
6976
+ };
6970
6977
  var tryMap = /* @__PURE__ */ dual(2, (self, options3) => flatMap7(self, (a) => try_({
6971
6978
  try: () => options3.try(a),
6972
6979
  catch: options3.catch
@@ -7046,7 +7053,6 @@ var die3 = exitDie;
7046
7053
  var fail3 = exitFail;
7047
7054
  var failCause4 = exitFailCause;
7048
7055
  var map13 = exitMap;
7049
- var mapBoth2 = exitMapBoth;
7050
7056
  var match9 = exitMatch;
7051
7057
  var succeed4 = exitSucceed;
7052
7058
  var void_3 = exitVoid;
@@ -9467,10 +9473,10 @@ var forEach7 = /* @__PURE__ */ dual((args2) => isIterable(args2[0]), (self, f, o
9467
9473
  return match7(options3?.concurrency, () => finalizersMaskInternal(sequential3, options3?.concurrentFinalizers)((restore) => isRequestBatchingEnabled ? forEachParN(self, 1, (a, i) => restore(f(a, i)), true) : forEachSequential(self, (a, i) => restore(f(a, i)))), () => finalizersMaskInternal(parallel3, options3?.concurrentFinalizers)((restore) => forEachParUnbounded(self, (a, i) => restore(f(a, i)), isRequestBatchingEnabled)), (n) => finalizersMaskInternal(parallelN2(n), options3?.concurrentFinalizers)((restore) => forEachParN(self, n, (a, i) => restore(f(a, i)), isRequestBatchingEnabled)));
9468
9474
  }));
9469
9475
  var forEachParUnbounded = (self, f, batching) => suspend(() => {
9470
- const as7 = fromIterable(self);
9471
- const array4 = new Array(as7.length);
9476
+ const as6 = fromIterable(self);
9477
+ const array4 = new Array(as6.length);
9472
9478
  const fn = (a, i) => flatMap7(f(a, i), (b) => sync(() => array4[i] = b));
9473
- return zipRight(forEachConcurrentDiscard(as7, fn, batching, false), succeed(array4));
9479
+ return zipRight(forEachConcurrentDiscard(as6, fn, batching, false), succeed(array4));
9474
9480
  });
9475
9481
  var forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterruptibleMask((restore) => transplant((graft) => withFiberRuntime((parent) => {
9476
9482
  let todos = Array.from(self).reverse();
@@ -9626,10 +9632,10 @@ var forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterrupt
9626
9632
  })));
9627
9633
  })));
9628
9634
  var forEachParN = (self, n, f, batching) => suspend(() => {
9629
- const as7 = fromIterable(self);
9630
- const array4 = new Array(as7.length);
9635
+ const as6 = fromIterable(self);
9636
+ const array4 = new Array(as6.length);
9631
9637
  const fn = (a, i) => map11(f(a, i), (b) => array4[i] = b);
9632
- return zipRight(forEachConcurrentDiscard(as7, fn, batching, false, n), succeed(array4));
9638
+ return zipRight(forEachConcurrentDiscard(as6, fn, batching, false, n), succeed(array4));
9633
9639
  });
9634
9640
  var forkDaemon = (self) => forkWithScopeOverride(self, globalScope);
9635
9641
  var unsafeFork2 = (effect3, parentFiber, parentRuntimeFlags, overrideScope = null) => {
@@ -9922,7 +9928,6 @@ var isDieType2 = isDieType;
9922
9928
  var isInterrupted3 = isInterrupted;
9923
9929
  var interruptors2 = interruptors;
9924
9930
  var failureOrCause2 = failureOrCause;
9925
- var flipCauseOption2 = flipCauseOption;
9926
9931
  var map14 = map9;
9927
9932
  var squash = causeSquash;
9928
9933
  var pretty2 = pretty;
@@ -9959,8 +9964,8 @@ var isEmpty6 = (self) => {
9959
9964
  };
9960
9965
  var intersect = /* @__PURE__ */ dual(2, (self, that) => {
9961
9966
  const start3 = Math.max(self.startMillis, that.startMillis);
9962
- const end4 = Math.min(self.endMillis, that.endMillis);
9963
- return make34(start3, end4);
9967
+ const end3 = Math.min(self.endMillis, that.endMillis);
9968
+ return make34(start3, end3);
9964
9969
  });
9965
9970
  var after = (startMilliseconds) => {
9966
9971
  return make34(startMilliseconds, Number.POSITIVE_INFINITY);
@@ -10114,6 +10119,74 @@ var Semaphore = class {
10114
10119
  };
10115
10120
  var unsafeMakeSemaphore = (permits) => new Semaphore(permits);
10116
10121
  var makeSemaphore = (permits) => sync(() => unsafeMakeSemaphore(permits));
10122
+ var Latch = class extends Class2 {
10123
+ isOpen;
10124
+ waiters = [];
10125
+ scheduled = false;
10126
+ constructor(isOpen) {
10127
+ super();
10128
+ this.isOpen = isOpen;
10129
+ }
10130
+ commit() {
10131
+ return this.await;
10132
+ }
10133
+ unsafeSchedule(fiber) {
10134
+ if (this.scheduled || this.waiters.length === 0) {
10135
+ return void_;
10136
+ }
10137
+ this.scheduled = true;
10138
+ fiber.currentScheduler.scheduleTask(this.flushWaiters, fiber.getFiberRef(currentSchedulingPriority));
10139
+ return void_;
10140
+ }
10141
+ flushWaiters = () => {
10142
+ this.scheduled = false;
10143
+ const waiters = this.waiters;
10144
+ this.waiters = [];
10145
+ for (let i = 0; i < waiters.length; i++) {
10146
+ waiters[i](exitVoid);
10147
+ }
10148
+ };
10149
+ open = /* @__PURE__ */ withFiberRuntime((fiber) => {
10150
+ if (this.isOpen) {
10151
+ return void_;
10152
+ }
10153
+ this.isOpen = true;
10154
+ return this.unsafeSchedule(fiber);
10155
+ });
10156
+ unsafeOpen() {
10157
+ if (this.isOpen) return;
10158
+ this.isOpen = true;
10159
+ this.flushWaiters();
10160
+ }
10161
+ release = /* @__PURE__ */ withFiberRuntime((fiber) => {
10162
+ if (this.isOpen) {
10163
+ return void_;
10164
+ }
10165
+ return this.unsafeSchedule(fiber);
10166
+ });
10167
+ await = /* @__PURE__ */ asyncInterrupt((resume2) => {
10168
+ if (this.isOpen) {
10169
+ return resume2(void_);
10170
+ }
10171
+ this.waiters.push(resume2);
10172
+ return sync(() => {
10173
+ const index = this.waiters.indexOf(resume2);
10174
+ if (index !== -1) {
10175
+ this.waiters.splice(index, 1);
10176
+ }
10177
+ });
10178
+ });
10179
+ unsafeClose() {
10180
+ this.isOpen = false;
10181
+ }
10182
+ close = /* @__PURE__ */ sync(() => {
10183
+ this.isOpen = false;
10184
+ });
10185
+ whenOpen = (self) => {
10186
+ return zipRight(this.await, self);
10187
+ };
10188
+ };
10189
+ var unsafeMakeLatch = (open) => new Latch(open ?? false);
10117
10190
  var forkIn = /* @__PURE__ */ dual(2, (self, scope4) => withFiberRuntime((parent, parentStatus) => {
10118
10191
  const scopeImpl = scope4;
10119
10192
  const fiber = unsafeFork2(self, parent, parentStatus.runtimeFlags, globalScope);
@@ -10319,6 +10392,16 @@ var unsafeRunSyncExit = /* @__PURE__ */ makeDual((runtime4, effect3) => {
10319
10392
  }
10320
10393
  return exitDie(capture(asyncFiberException(fiberRuntime), currentSpanFromFiber(fiberRuntime)));
10321
10394
  });
10395
+ var unsafeRunPromise = /* @__PURE__ */ makeDual((runtime4, effect3, options3) => unsafeRunPromiseExit(runtime4, effect3, options3).then((result) => {
10396
+ switch (result._tag) {
10397
+ case OP_SUCCESS: {
10398
+ return result.effect_instruction_i0;
10399
+ }
10400
+ case OP_FAILURE: {
10401
+ throw fiberFailure(result.effect_instruction_i0);
10402
+ }
10403
+ }
10404
+ }));
10322
10405
  var unsafeRunPromiseExit = /* @__PURE__ */ makeDual((runtime4, effect3, options3) => new Promise((resolve) => {
10323
10406
  const op = fastPath(effect3);
10324
10407
  if (op) {
@@ -10362,6 +10445,7 @@ var defaultRuntime = /* @__PURE__ */ make39({
10362
10445
  fiberRefs: /* @__PURE__ */ empty17()
10363
10446
  });
10364
10447
  var unsafeForkEffect = /* @__PURE__ */ unsafeFork3(defaultRuntime);
10448
+ var unsafeRunPromiseEffect = /* @__PURE__ */ unsafeRunPromise(defaultRuntime);
10365
10449
  var unsafeRunSyncEffect = /* @__PURE__ */ unsafeRunSync(defaultRuntime);
10366
10450
 
10367
10451
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/synchronizedRef.js
@@ -10405,9 +10489,9 @@ var MemoMapImpl = class {
10405
10489
  * returns it. Otherwise, obtains the layer, stores it in the memo map,
10406
10490
  * and adds a finalizer to the `Scope`.
10407
10491
  */
10408
- getOrElseMemoize(layer, scope4) {
10492
+ getOrElseMemoize(layer3, scope4) {
10409
10493
  return pipe(modifyEffect(this.ref, (map22) => {
10410
- const inMap = map22.get(layer);
10494
+ const inMap = map22.get(layer3);
10411
10495
  if (inMap !== void 0) {
10412
10496
  const [acquire, release] = inMap;
10413
10497
  const cached4 = pipe(acquire, flatMap7(([patch11, b]) => pipe(patchFiberRefs(patch11), as(b))), onExit(exitMatch({
@@ -10417,13 +10501,13 @@ var MemoMapImpl = class {
10417
10501
  return succeed([cached4, map22]);
10418
10502
  }
10419
10503
  return pipe(make24(0), flatMap7((observers) => pipe(deferredMake(), flatMap7((deferred) => pipe(make24(() => void_), map11((finalizerRef) => {
10420
- const resource = uninterruptibleMask((restore) => pipe(scopeMake(), flatMap7((innerScope) => pipe(restore(flatMap7(makeBuilder(layer, innerScope, true), (f) => diffFiberRefs(f(this)))), exit, flatMap7((exit4) => {
10504
+ const resource = uninterruptibleMask((restore) => pipe(scopeMake(), flatMap7((innerScope) => pipe(restore(flatMap7(makeBuilder(layer3, innerScope, true), (f) => diffFiberRefs(f(this)))), exit, flatMap7((exit4) => {
10421
10505
  switch (exit4._tag) {
10422
10506
  case OP_FAILURE: {
10423
10507
  return pipe(deferredFailCause(deferred, exit4.effect_instruction_i0), zipRight(scopeClose(innerScope, exit4)), zipRight(failCause(exit4.effect_instruction_i0)));
10424
10508
  }
10425
10509
  case OP_SUCCESS: {
10426
- return pipe(set4(finalizerRef, (exit5) => pipe(scopeClose(innerScope, exit5), whenEffect(modify3(observers, (n) => [n === 1, n - 1])), asVoid)), zipRight(update2(observers, (n) => n + 1)), zipRight(scopeAddFinalizerExit(scope4, (exit5) => pipe(sync(() => map22.delete(layer)), zipRight(get10(finalizerRef)), flatMap7((finalizer2) => finalizer2(exit5))))), zipRight(deferredSucceed(deferred, exit4.effect_instruction_i0)), as(exit4.effect_instruction_i0[1]));
10510
+ return pipe(set4(finalizerRef, (exit5) => pipe(scopeClose(innerScope, exit5), whenEffect(modify3(observers, (n) => [n === 1, n - 1])), asVoid)), zipRight(update2(observers, (n) => n + 1)), zipRight(scopeAddFinalizerExit(scope4, (exit5) => pipe(sync(() => map22.delete(layer3)), zipRight(get10(finalizerRef)), flatMap7((finalizer2) => finalizer2(exit5))))), zipRight(deferredSucceed(deferred, exit4.effect_instruction_i0)), as(exit4.effect_instruction_i0[1]));
10427
10511
  }
10428
10512
  }
10429
10513
  })))));
@@ -10431,7 +10515,7 @@ var MemoMapImpl = class {
10431
10515
  onFailure: () => void_,
10432
10516
  onSuccess: () => update2(observers, (n) => n + 1)
10433
10517
  }))), (exit4) => pipe(get10(finalizerRef), flatMap7((finalizer2) => finalizer2(exit4)))];
10434
- return [resource, isFresh(layer) ? map22 : map22.set(layer, memoized)];
10518
+ return [resource, isFresh(layer3) ? map22 : map22.set(layer3, memoized)];
10435
10519
  }))))));
10436
10520
  }), flatten3);
10437
10521
  }
@@ -10501,10 +10585,10 @@ var mergeAll2 = (...layers) => {
10501
10585
  return final;
10502
10586
  };
10503
10587
  var suspend3 = (evaluate2) => {
10504
- const suspend9 = Object.create(proto3);
10505
- suspend9._op_layer = OP_SUSPEND;
10506
- suspend9.evaluate = evaluate2;
10507
- return suspend9;
10588
+ const suspend8 = Object.create(proto3);
10589
+ suspend8._op_layer = OP_SUSPEND;
10590
+ suspend8.evaluate = evaluate2;
10591
+ return suspend8;
10508
10592
  };
10509
10593
  var zipWith3 = /* @__PURE__ */ dual(3, (self, that, f) => suspend3(() => {
10510
10594
  const zipWith7 = Object.create(proto3);
@@ -10514,7 +10598,7 @@ var zipWith3 = /* @__PURE__ */ dual(3, (self, that, f) => suspend3(() => {
10514
10598
  zipWith7.zipK = f;
10515
10599
  return zipWith7;
10516
10600
  }));
10517
- var provideSomeLayer = /* @__PURE__ */ dual(2, (self, layer) => scopedWith((scope4) => flatMap7(buildWithScope(layer, scope4), (context5) => provideSomeContext(self, context5))));
10601
+ var provideSomeLayer = /* @__PURE__ */ dual(2, (self, layer3) => scopedWith((scope4) => flatMap7(buildWithScope(layer3, scope4), (context5) => provideSomeContext(self, context5))));
10518
10602
  var provideSomeRuntime = /* @__PURE__ */ dual(2, (self, rt) => {
10519
10603
  const patchRefs = diff6(defaultRuntime.fiberRefs, rt.fiberRefs);
10520
10604
  const patchFlags = diff4(defaultRuntime.runtimeFlags, rt.runtimeFlags);
@@ -10800,27 +10884,27 @@ var TypeId14 = /* @__PURE__ */ Symbol.for("effect/MutableList");
10800
10884
  var MutableListProto = {
10801
10885
  [TypeId14]: TypeId14,
10802
10886
  [Symbol.iterator]() {
10803
- let done8 = false;
10887
+ let done7 = false;
10804
10888
  let head7 = this.head;
10805
10889
  return {
10806
10890
  next() {
10807
- if (done8) {
10891
+ if (done7) {
10808
10892
  return this.return();
10809
10893
  }
10810
10894
  if (head7 == null) {
10811
- done8 = true;
10895
+ done7 = true;
10812
10896
  return this.return();
10813
10897
  }
10814
10898
  const value2 = head7.value;
10815
10899
  head7 = head7.next;
10816
10900
  return {
10817
- done: done8,
10901
+ done: done7,
10818
10902
  value: value2
10819
10903
  };
10820
10904
  },
10821
10905
  return(value2) {
10822
- if (!done8) {
10823
- done8 = true;
10906
+ if (!done7) {
10907
+ done7 = true;
10824
10908
  }
10825
10909
  return {
10826
10910
  done: true,
@@ -10988,13 +11072,12 @@ var isEffect2 = isEffect;
10988
11072
  var cached3 = memoize;
10989
11073
  var all4 = all3;
10990
11074
  var forEach8 = forEach7;
10991
- var async2 = async_;
10992
11075
  var withFiberRuntime2 = withFiberRuntime;
10993
11076
  var fail6 = fail2;
10994
11077
  var failCause6 = failCause;
10995
- var die5 = die2;
10996
11078
  var dieMessage2 = dieMessage;
10997
11079
  var gen2 = gen;
11080
+ var promise2 = promise;
10998
11081
  var succeed7 = succeed;
10999
11082
  var suspend4 = suspend;
11000
11083
  var sync4 = sync;
@@ -11004,6 +11087,7 @@ var catchAllCause2 = catchAllCause;
11004
11087
  var ignore2 = ignore;
11005
11088
  var try_2 = try_;
11006
11089
  var tryMap2 = tryMap;
11090
+ var tryPromise2 = tryPromise;
11007
11091
  var interrupt5 = interrupt2;
11008
11092
  var interruptible4 = interruptible2;
11009
11093
  var onInterrupt2 = onInterrupt;
@@ -11012,7 +11096,6 @@ var uninterruptibleMask3 = uninterruptibleMask;
11012
11096
  var as4 = as;
11013
11097
  var asVoid2 = asVoid;
11014
11098
  var map17 = map11;
11015
- var mapBoth3 = mapBoth;
11016
11099
  var mapError2 = mapError;
11017
11100
  var acquireRelease2 = acquireRelease;
11018
11101
  var acquireUseRelease2 = acquireUseRelease;
@@ -11041,13 +11124,14 @@ var repeat = repeat_combined;
11041
11124
  var match11 = match8;
11042
11125
  var matchCause3 = matchCause;
11043
11126
  var matchCauseEffect3 = matchCauseEffect;
11044
- var matchEffect2 = matchEffect;
11045
11127
  var logInfo2 = logInfo;
11046
11128
  var withLogSpan2 = withLogSpan;
11047
11129
  var annotateLogsScoped2 = annotateLogsScoped;
11048
11130
  var runtime3 = runtime2;
11049
11131
  var makeSemaphore2 = makeSemaphore;
11132
+ var unsafeMakeLatch2 = unsafeMakeLatch;
11050
11133
  var runFork2 = unsafeForkEffect;
11134
+ var runPromise = unsafeRunPromiseEffect;
11051
11135
  var runSync = unsafeRunSyncEffect;
11052
11136
  var zip5 = zipOptions;
11053
11137
  var zipLeft2 = zipLeftOptions;
@@ -11107,14 +11191,14 @@ var getKeysForIndexSignature = (input, parameter) => {
11107
11191
  };
11108
11192
  var ownKeys = (o) => Object.keys(o).concat(Object.getOwnPropertySymbols(o));
11109
11193
  var memoizeThunk = (f) => {
11110
- let done8 = false;
11194
+ let done7 = false;
11111
11195
  let a;
11112
11196
  return () => {
11113
- if (done8) {
11197
+ if (done7) {
11114
11198
  return a;
11115
11199
  }
11116
11200
  a = f();
11117
- done8 = true;
11201
+ done7 = true;
11118
11202
  return a;
11119
11203
  };
11120
11204
  };
@@ -11939,7 +12023,7 @@ var Union = class _Union {
11939
12023
  }
11940
12024
  };
11941
12025
  var mapMembers = (members, f) => members.map(f);
11942
- var isMembers = (as7) => as7.length > 1;
12026
+ var isMembers = (as6) => as6.length > 1;
11943
12027
  var isUnion = /* @__PURE__ */ createASTGuard("Union");
11944
12028
  var toJSONMemoMap = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Schema/AST/toJSONMemoMap"), () => /* @__PURE__ */ new WeakMap());
11945
12029
  var Suspend = class {
@@ -12272,18 +12356,18 @@ var createJSONIdentifierAnnotation = (annotated) => match2(getJSONIdentifier(ann
12272
12356
  [JSONIdentifierAnnotationId]: identifier2
12273
12357
  })
12274
12358
  });
12275
- function changeMap(as7, f) {
12359
+ function changeMap(as6, f) {
12276
12360
  let changed = false;
12277
- const out = allocate(as7.length);
12278
- for (let i = 0; i < as7.length; i++) {
12279
- const a = as7[i];
12361
+ const out = allocate(as6.length);
12362
+ for (let i = 0; i < as6.length; i++) {
12363
+ const a = as6[i];
12280
12364
  const fa = f(a);
12281
12365
  if (fa !== a) {
12282
12366
  changed = true;
12283
12367
  }
12284
12368
  out[i] = fa;
12285
12369
  }
12286
- return changed ? out : as7;
12370
+ return changed ? out : as6;
12287
12371
  }
12288
12372
  var encodedAST_ = (ast, isBound) => {
12289
12373
  switch (ast._tag) {
@@ -14303,8 +14387,6 @@ var takeRemainderLoop = (self, min3, max5, acc) => {
14303
14387
  }));
14304
14388
  };
14305
14389
  var bounded2 = (requestedCapacity) => pipe(sync(() => bounded(requestedCapacity)), flatMap7((queue) => make44(backingQueueFromMutableQueue(queue), backPressureStrategy())));
14306
- var dropping = (requestedCapacity) => pipe(sync(() => bounded(requestedCapacity)), flatMap7((queue) => make44(backingQueueFromMutableQueue(queue), droppingStrategy())));
14307
- var sliding = (requestedCapacity) => pipe(sync(() => bounded(requestedCapacity)), flatMap7((queue) => make44(backingQueueFromMutableQueue(queue), slidingStrategy())));
14308
14390
  var unbounded2 = () => pipe(sync(() => unbounded()), flatMap7((queue) => make44(backingQueueFromMutableQueue(queue), droppingStrategy())));
14309
14391
  var unsafeMake8 = (queue, takers, shutdownHook, shutdownFlag, strategy) => {
14310
14392
  return new QueueImpl(queue, takers, shutdownHook, shutdownFlag, strategy);
@@ -14343,7 +14425,6 @@ var take = (self) => self.take;
14343
14425
  var takeUpTo = /* @__PURE__ */ dual(2, (self, max5) => self.takeUpTo(max5));
14344
14426
  var backPressureStrategy = () => new BackPressureStrategy();
14345
14427
  var droppingStrategy = () => new DroppingStrategy();
14346
- var slidingStrategy = () => new SlidingStrategy();
14347
14428
  var BackPressureStrategy = class {
14348
14429
  [QueueStrategyTypeId] = queueStrategyVariance;
14349
14430
  putters = /* @__PURE__ */ unbounded();
@@ -14363,14 +14444,14 @@ var BackPressureStrategy = class {
14363
14444
  get shutdown() {
14364
14445
  return pipe(fiberId, flatMap7((fiberId2) => pipe(sync(() => unsafePollAll(this.putters)), flatMap7((putters) => forEachConcurrentDiscard(putters, ([_, deferred, isLastItem]) => isLastItem ? pipe(deferredInterruptWith(deferred, fiberId2), asVoid) : void_, false, false)))));
14365
14446
  }
14366
- handleSurplus(iterable, queue, takers, isShutdown3) {
14447
+ handleSurplus(iterable, queue, takers, isShutdown2) {
14367
14448
  return withFiberRuntime((state) => {
14368
14449
  const deferred = deferredUnsafeMake(state.id());
14369
14450
  return pipe(suspend(() => {
14370
14451
  this.unsafeOffer(iterable, deferred);
14371
14452
  this.unsafeOnQueueEmptySpace(queue, takers);
14372
14453
  unsafeCompleteTakers(this, queue, takers);
14373
- return get6(isShutdown3) ? interrupt2 : deferredAwait(deferred);
14454
+ return get6(isShutdown2) ? interrupt2 : deferredAwait(deferred);
14374
14455
  }), onInterrupt(() => sync(() => this.unsafeRemove(deferred))));
14375
14456
  });
14376
14457
  }
@@ -14422,43 +14503,11 @@ var DroppingStrategy = class {
14422
14503
  unsafeOnQueueEmptySpace(_queue, _takers) {
14423
14504
  }
14424
14505
  };
14425
- var SlidingStrategy = class {
14426
- [QueueStrategyTypeId] = queueStrategyVariance;
14427
- surplusSize() {
14428
- return 0;
14429
- }
14430
- get shutdown() {
14431
- return void_;
14432
- }
14433
- onCompleteTakersWithEmptyQueue() {
14434
- }
14435
- handleSurplus(iterable, queue, takers, _isShutdown) {
14436
- return sync(() => {
14437
- this.unsafeOffer(queue, iterable);
14438
- unsafeCompleteTakers(this, queue, takers);
14439
- return true;
14440
- });
14441
- }
14442
- unsafeOnQueueEmptySpace(_queue, _takers) {
14443
- }
14444
- unsafeOffer(queue, iterable) {
14445
- const iterator = iterable[Symbol.iterator]();
14446
- let next;
14447
- let offering = true;
14448
- while (!(next = iterator.next()).done && offering) {
14449
- if (queue.capacity() === 0) {
14450
- return;
14451
- }
14452
- queue.poll(EmptyMutableQueue);
14453
- offering = queue.offer(next.value);
14454
- }
14455
- }
14456
- };
14457
14506
  var unsafeCompleteDeferred = (deferred, a) => {
14458
14507
  return deferredUnsafeDone(deferred, succeed(a));
14459
14508
  };
14460
- var unsafeOfferAll = (queue, as7) => {
14461
- return pipe(queue, offerAll(as7));
14509
+ var unsafeOfferAll = (queue, as6) => {
14510
+ return pipe(queue, offerAll(as6));
14462
14511
  };
14463
14512
  var unsafePollAll = (queue) => {
14464
14513
  return pipe(queue, pollUpTo(Number.POSITIVE_INFINITY));
@@ -14493,8 +14542,6 @@ var unsafeCompleteTakers = (strategy, queue, takers) => {
14493
14542
 
14494
14543
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/Queue.js
14495
14544
  var bounded3 = bounded2;
14496
- var dropping2 = dropping;
14497
- var sliding2 = sliding;
14498
14545
  var unbounded3 = unbounded2;
14499
14546
  var size10 = size9;
14500
14547
  var shutdown2 = shutdown;
@@ -15671,9 +15718,9 @@ var stateError = (cause2) => ({
15671
15718
  _tag: OP_STATE_ERROR,
15672
15719
  cause: cause2
15673
15720
  });
15674
- var stateDone = (done8) => ({
15721
+ var stateDone = (done7) => ({
15675
15722
  _tag: OP_STATE_DONE2,
15676
- done: done8
15723
+ done: done7
15677
15724
  });
15678
15725
  var SingleProducerAsyncInputImpl = class {
15679
15726
  ref;
@@ -15750,7 +15797,7 @@ var SingleProducerAsyncInputImpl = class {
15750
15797
  }));
15751
15798
  }
15752
15799
  get take() {
15753
- return this.takeWith((cause2) => failCause4(map14(cause2, left2)), (elem) => succeed4(elem), (done8) => fail3(right2(done8)));
15800
+ return this.takeWith((cause2) => failCause4(map14(cause2, left2)), (elem) => succeed4(elem), (done7) => fail3(right2(done7)));
15754
15801
  }
15755
15802
  takeWith(onError4, onElement, onDone2) {
15756
15803
  return flatMap9(make23(), (deferred) => flatten5(modify4(this.ref, (state) => {
@@ -15786,7 +15833,6 @@ var SingleProducerAsyncInputImpl = class {
15786
15833
  var make45 = () => pipe(make23(), flatMap9((deferred) => make25(stateEmpty(deferred))), map17((ref) => new SingleProducerAsyncInputImpl(ref)));
15787
15834
 
15788
15835
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/channel.js
15789
- var as5 = /* @__PURE__ */ dual(2, (self, value2) => map20(self, () => value2));
15790
15836
  var concatMap = /* @__PURE__ */ dual(2, (self, f) => concatMapWith(self, f, () => void 0, () => void 0));
15791
15837
  var drain = (self) => {
15792
15838
  const drainer = readWithCause({
@@ -15829,7 +15875,7 @@ var mergeAllWith = ({
15829
15875
  const pull = yield* toPullIn(pipeTo(queueReader, channels), scope4);
15830
15876
  function evaluatePull(pull2) {
15831
15877
  return pull2.pipe(flatMap9(match({
15832
- onLeft: (done8) => succeed7(some2(done8)),
15878
+ onLeft: (done7) => succeed7(some2(done7)),
15833
15879
  onRight: (outElem) => as4(offer3(queue, succeed7(right2(outElem))), none2())
15834
15880
  })), repeat({
15835
15881
  until: (_) => isSome2(_)
@@ -15885,14 +15931,14 @@ var mergeAllWith = ({
15885
15931
  }));
15886
15932
  var mergeMap = /* @__PURE__ */ dual(3, (self, f, options3) => mergeAll4(options3)(mapOut(self, f)));
15887
15933
  var mergeWith2 = /* @__PURE__ */ dual(2, (self, options3) => {
15888
- function merge8(scope4) {
15934
+ function merge9(scope4) {
15889
15935
  return gen2(function* () {
15890
15936
  const input = yield* make45();
15891
15937
  const queueReader = fromInput(input);
15892
15938
  const pullL = yield* toPullIn(pipeTo(queueReader, self), scope4);
15893
15939
  const pullR = yield* toPullIn(pipeTo(queueReader, options3.other), scope4);
15894
15940
  function handleSide(exit4, fiber, pull) {
15895
- return (done8, both2, single) => {
15941
+ return (done7, both2, single) => {
15896
15942
  function onDecision(decision) {
15897
15943
  const op = decision;
15898
15944
  if (op._tag === OP_DONE4) {
@@ -15901,15 +15947,15 @@ var mergeWith2 = /* @__PURE__ */ dual(2, (self, options3) => {
15901
15947
  return map17(_await3(fiber), match9({
15902
15948
  onFailure: (cause2) => fromEffect4(op.f(failCause4(cause2))),
15903
15949
  onSuccess: match({
15904
- onLeft: (done9) => fromEffect4(op.f(succeed4(done9))),
15950
+ onLeft: (done8) => fromEffect4(op.f(succeed4(done8))),
15905
15951
  onRight: (elem) => zipRight4(write(elem), go2(single(op.f)))
15906
15952
  })
15907
15953
  }));
15908
15954
  }
15909
15955
  return match9(exit4, {
15910
- onFailure: (cause2) => onDecision(done8(failCause4(cause2))),
15956
+ onFailure: (cause2) => onDecision(done7(failCause4(cause2))),
15911
15957
  onSuccess: match({
15912
- onLeft: (z) => onDecision(done8(succeed4(z))),
15958
+ onLeft: (z) => onDecision(done7(succeed4(z))),
15913
15959
  onRight: (elem) => succeed7(flatMap12(write(elem), () => flatMap12(fromEffect4(forkIn2(interruptible4(pull), scope4)), (leftFiber) => go2(both2(leftFiber, fiber)))))
15914
15960
  })
15915
15961
  });
@@ -15929,7 +15975,7 @@ var mergeWith2 = /* @__PURE__ */ dual(2, (self, options3) => {
15929
15975
  return unwrap(map17(exit3(pullR), match9({
15930
15976
  onFailure: (cause2) => fromEffect4(state.f(failCause4(cause2))),
15931
15977
  onSuccess: match({
15932
- onLeft: (done8) => fromEffect4(state.f(succeed4(done8))),
15978
+ onLeft: (done7) => fromEffect4(state.f(succeed4(done7))),
15933
15979
  onRight: (elem) => flatMap12(write(elem), () => go2(LeftDone(state.f)))
15934
15980
  })
15935
15981
  })));
@@ -15938,7 +15984,7 @@ var mergeWith2 = /* @__PURE__ */ dual(2, (self, options3) => {
15938
15984
  return unwrap(map17(exit3(pullL), match9({
15939
15985
  onFailure: (cause2) => fromEffect4(state.f(failCause4(cause2))),
15940
15986
  onSuccess: match({
15941
- onLeft: (done8) => fromEffect4(state.f(succeed4(done8))),
15987
+ onLeft: (done7) => fromEffect4(state.f(succeed4(done7))),
15942
15988
  onRight: (elem) => flatMap12(write(elem), () => go2(RightDone(state.f)))
15943
15989
  })
15944
15990
  })));
@@ -15956,7 +16002,7 @@ var mergeWith2 = /* @__PURE__ */ dual(2, (self, options3) => {
15956
16002
  })).pipe(flatMap12(go2), embedInput(input));
15957
16003
  });
15958
16004
  }
15959
- return unwrapScopedWith(merge8);
16005
+ return unwrapScopedWith(merge9);
15960
16006
  });
15961
16007
  var pipeToOrFail = /* @__PURE__ */ dual(2, (self, that) => suspend5(() => {
15962
16008
  let channelException = void 0;
@@ -15989,7 +16035,7 @@ var interpretToPull = (channelState, exec) => {
15989
16035
  case OP_DONE3: {
15990
16036
  return match9(exec.getDone(), {
15991
16037
  onFailure: failCause6,
15992
- onSuccess: (done8) => succeed7(left2(done8))
16038
+ onSuccess: (done7) => succeed7(left2(done7))
15993
16039
  });
15994
16040
  }
15995
16041
  case OP_EMIT2: {
@@ -16007,8 +16053,8 @@ var unwrap = (channel) => flatten8(fromEffect4(channel));
16007
16053
  var unwrapScoped2 = (self) => concatAllWith(scoped3(self), (d, _) => d, (d, _) => d);
16008
16054
  var unwrapScopedWith = (f) => concatAllWith(scopedWith3(f), (d, _) => d, (d, _) => d);
16009
16055
  var writeChunk = (outs) => writeChunkWriter(0, outs.length, outs);
16010
- var writeChunkWriter = (idx, len, chunk3) => {
16011
- return idx === len ? void_5 : pipe(write(pipe(chunk3, unsafeGet2(idx))), flatMap12(() => writeChunkWriter(idx + 1, len, chunk3)));
16056
+ var writeChunkWriter = (idx, len, chunk2) => {
16057
+ return idx === len ? void_5 : pipe(write(pipe(chunk2, unsafeGet2(idx))), flatMap12(() => writeChunkWriter(idx + 1, len, chunk2)));
16012
16058
  };
16013
16059
  var zip6 = /* @__PURE__ */ dual((args2) => isChannel(args2[1]), (self, that, options3) => options3?.concurrent ? mergeWith2(self, {
16014
16060
  other: that,
@@ -16027,7 +16073,7 @@ var ChannelException = (error) => ({
16027
16073
  var isChannelException = (u) => hasProperty(u, ChannelExceptionTypeId);
16028
16074
 
16029
16075
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/Runtime.js
16030
- var runPromiseExit = unsafeRunPromiseExit;
16076
+ var runFork3 = unsafeFork3;
16031
16077
 
16032
16078
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/sink.js
16033
16079
  var SinkTypeId2 = /* @__PURE__ */ Symbol.for("effect/Sink");
@@ -16053,111 +16099,17 @@ var SinkImpl = class {
16053
16099
  return pipeArguments(this, arguments);
16054
16100
  }
16055
16101
  };
16056
- var suspend6 = (evaluate2) => new SinkImpl(suspend5(() => toChannel(evaluate2())));
16057
- var fold = (s, contFn, f) => suspend6(() => new SinkImpl(foldReader(s, contFn, f)));
16058
- var foldReader = (s, contFn, f) => {
16059
- if (!contFn(s)) {
16060
- return succeedNow(s);
16061
- }
16062
- return readWith({
16063
- onInput: (input) => {
16064
- const [nextS, leftovers] = foldChunkSplit(s, input, contFn, f, 0, input.length);
16065
- if (isNonEmpty(leftovers)) {
16066
- return pipe(write(leftovers), as5(nextS));
16067
- }
16068
- return foldReader(nextS, contFn, f);
16069
- },
16070
- onFailure: fail9,
16071
- onDone: () => succeedNow(s)
16102
+ var forEachChunk = (f) => {
16103
+ const process2 = readWithCause({
16104
+ onInput: (input) => pipe(fromEffect4(f(input)), flatMap12(() => process2)),
16105
+ onFailure: failCause8,
16106
+ onDone: () => void_5
16072
16107
  });
16073
- };
16074
- var foldChunkSplit = (s, chunk3, contFn, f, index, length3) => {
16075
- if (index === length3) {
16076
- return [s, empty2()];
16077
- }
16078
- const s1 = f(s, pipe(chunk3, unsafeGet2(index)));
16079
- if (contFn(s1)) {
16080
- return foldChunkSplit(s1, chunk3, contFn, f, index + 1, length3);
16081
- }
16082
- return [s1, pipe(chunk3, drop2(index + 1))];
16108
+ return new SinkImpl(process2);
16083
16109
  };
16084
16110
  var fromEffect6 = (effect3) => new SinkImpl(fromEffect4(effect3));
16085
16111
  var toChannel = (self) => isEffect2(self) ? toChannel(fromEffect6(self)) : self.channel;
16086
16112
 
16087
- // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/stream/emit.js
16088
- var make46 = (emit) => {
16089
- const ops = {
16090
- chunk(as7) {
16091
- return this(succeed7(as7));
16092
- },
16093
- die(defect) {
16094
- return this(die5(defect));
16095
- },
16096
- dieMessage(message) {
16097
- return this(dieMessage2(message));
16098
- },
16099
- done(exit4) {
16100
- return this(suspend4(() => mapBoth2(exit4, {
16101
- onFailure: some2,
16102
- onSuccess: of2
16103
- })));
16104
- },
16105
- end() {
16106
- return this(fail6(none2()));
16107
- },
16108
- fail(e) {
16109
- return this(fail6(some2(e)));
16110
- },
16111
- fromEffect(effect3) {
16112
- return this(mapBoth3(effect3, {
16113
- onFailure: some2,
16114
- onSuccess: of2
16115
- }));
16116
- },
16117
- fromEffectChunk(effect3) {
16118
- return this(pipe(effect3, mapError2(some2)));
16119
- },
16120
- halt(cause2) {
16121
- return this(failCause6(pipe(cause2, map14(some2))));
16122
- },
16123
- single(value2) {
16124
- return this(succeed7(of2(value2)));
16125
- }
16126
- };
16127
- return Object.assign(emit, ops);
16128
- };
16129
-
16130
- // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/take.js
16131
- var TakeSymbolKey = "effect/Take";
16132
- var TakeTypeId = /* @__PURE__ */ Symbol.for(TakeSymbolKey);
16133
- var takeVariance = {
16134
- /* c8 ignore next */
16135
- _A: (_) => _,
16136
- /* c8 ignore next */
16137
- _E: (_) => _
16138
- };
16139
- var TakeImpl = class {
16140
- exit;
16141
- [TakeTypeId] = takeVariance;
16142
- constructor(exit4) {
16143
- this.exit = exit4;
16144
- }
16145
- pipe() {
16146
- return pipeArguments(this, arguments);
16147
- }
16148
- };
16149
- var chunk2 = (chunk3) => new TakeImpl(succeed4(chunk3));
16150
- var done7 = (self) => suspend4(() => self.exit);
16151
- var end3 = /* @__PURE__ */ new TakeImpl(/* @__PURE__ */ fail3(/* @__PURE__ */ none2()));
16152
- var failCause9 = (cause2) => new TakeImpl(failCause4(pipe(cause2, map14(some2))));
16153
- var fromPull = (pull) => matchCause3(pull, {
16154
- onFailure: (cause2) => match2(flipCauseOption2(cause2), {
16155
- onNone: () => end3,
16156
- onSome: failCause9
16157
- }),
16158
- onSuccess: chunk2
16159
- });
16160
-
16161
16113
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/stream.js
16162
16114
  var StreamSymbolKey = "effect/Stream";
16163
16115
  var StreamTypeId2 = /* @__PURE__ */ Symbol.for(StreamSymbolKey);
@@ -16177,49 +16129,14 @@ var StreamImpl = class {
16177
16129
  }
16178
16130
  };
16179
16131
  var isStream = (u) => hasProperty(u, StreamTypeId2) || isEffect2(u);
16180
- var queueFromBufferOptions = (bufferSize) => {
16181
- if (bufferSize === "unbounded") {
16182
- return unbounded3();
16183
- } else if (typeof bufferSize === "number" || bufferSize === void 0) {
16184
- return bounded3(bufferSize ?? 16);
16185
- }
16186
- switch (bufferSize.strategy) {
16187
- case "dropping":
16188
- return dropping2(bufferSize.bufferSize ?? 16);
16189
- case "sliding":
16190
- return sliding2(bufferSize.bufferSize ?? 16);
16191
- default:
16192
- return bounded3(bufferSize.bufferSize ?? 16);
16193
- }
16194
- };
16195
- var _async = (register, bufferSize) => acquireRelease2(queueFromBufferOptions(bufferSize), (queue) => shutdown2(queue)).pipe(flatMap9((output) => runtime3().pipe(flatMap9((runtime4) => sync4(() => {
16196
- const runPromiseExit2 = runPromiseExit(runtime4);
16197
- const canceler = register(make46((resume2) => fromPull(resume2).pipe(flatMap9((take5) => offer3(output, take5)), asVoid2, runPromiseExit2).then((exit4) => {
16198
- if (isFailure(exit4)) {
16199
- if (!isInterrupted3(exit4.cause)) {
16200
- throw squash(exit4.cause);
16201
- }
16202
- }
16203
- })));
16204
- return canceler;
16205
- })), map17((value2) => {
16206
- const loop2 = take2(output).pipe(flatMap9((take5) => done7(take5)), match11({
16207
- onFailure: (maybeError) => fromEffect4(shutdown2(output)).pipe(zipRight4(match2(maybeError, {
16208
- onNone: () => void_5,
16209
- onSome: (error) => fail9(error)
16210
- }))),
16211
- onSuccess: (chunk3) => write(chunk3).pipe(flatMap12(() => loop2))
16212
- }), unwrap);
16213
- return fromChannel2(loop2).pipe(ensuring4(value2 ?? _void));
16214
- }))), unwrapScoped3);
16215
- var ensuring4 = /* @__PURE__ */ dual(2, (self, finalizer2) => new StreamImpl(pipe(toChannel2(self), ensuring3(finalizer2))));
16216
16132
  var ensuringWith2 = /* @__PURE__ */ dual(2, (self, finalizer2) => new StreamImpl(ensuringWith(toChannel2(self), finalizer2)));
16133
+ var fail11 = (error) => fromEffectOption(fail6(some2(error)));
16217
16134
  var flatMap14 = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (self, f, options3) => {
16218
16135
  const bufferSize = options3?.bufferSize ?? 16;
16219
16136
  if (options3?.switch) {
16220
16137
  return matchConcurrency(options3?.concurrency, () => flatMapParSwitchBuffer(self, 1, bufferSize, f), (n) => flatMapParSwitchBuffer(self, n, bufferSize, f));
16221
16138
  }
16222
- return matchConcurrency(options3?.concurrency, () => new StreamImpl(concatMap(toChannel2(self), (as7) => pipe(as7, map5((a) => toChannel2(f(a))), reduce2(void_5, (left3, right3) => pipe(left3, zipRight4(right3)))))), (_) => new StreamImpl(pipe(toChannel2(self), concatMap(writeChunk), mergeMap((out) => toChannel2(f(out)), options3))));
16139
+ return matchConcurrency(options3?.concurrency, () => new StreamImpl(concatMap(toChannel2(self), (as6) => pipe(as6, map5((a) => toChannel2(f(a))), reduce2(void_5, (left3, right3) => pipe(left3, zipRight4(right3)))))), (_) => new StreamImpl(pipe(toChannel2(self), concatMap(writeChunk), mergeMap((out) => toChannel2(f(out)), options3))));
16223
16140
  });
16224
16141
  var matchConcurrency = (concurrency, sequential4, bounded4) => {
16225
16142
  switch (concurrency) {
@@ -16237,12 +16154,11 @@ var flatMapParSwitchBuffer = /* @__PURE__ */ dual(4, (self, n, bufferSize, f) =>
16237
16154
  bufferSize
16238
16155
  }))));
16239
16156
  var flatten10 = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (self, options3) => flatMap14(self, identity, options3));
16240
- var fromChannel2 = (channel) => new StreamImpl(channel);
16241
- var toChannel2 = (stream3) => {
16242
- if ("channel" in stream3) {
16243
- return stream3.channel;
16244
- } else if (isEffect2(stream3)) {
16245
- return toChannel2(fromEffect7(stream3));
16157
+ var toChannel2 = (stream2) => {
16158
+ if ("channel" in stream2) {
16159
+ return stream2.channel;
16160
+ } else if (isEffect2(stream2)) {
16161
+ return toChannel2(fromEffect7(stream2));
16246
16162
  } else {
16247
16163
  throw new TypeError(`Expected a Stream.`);
16248
16164
  }
@@ -16255,18 +16171,84 @@ var fromEffectOption = (effect3) => new StreamImpl(unwrap(match11(effect3, {
16255
16171
  }),
16256
16172
  onSuccess: (a) => write(of2(a))
16257
16173
  })));
16174
+ var fromReadableStream = (...args2) => {
16175
+ const evaluate2 = args2.length === 1 ? args2[0].evaluate : args2[0];
16176
+ const onError4 = args2.length === 1 ? args2[0].onError : args2[1];
16177
+ const releaseLockOnEnd = args2.length === 1 ? args2[0].releaseLockOnEnd === true : false;
16178
+ return unwrapScoped3(map17(acquireRelease2(sync4(() => evaluate2().getReader()), (reader) => releaseLockOnEnd ? sync4(() => reader.releaseLock()) : promise2(() => reader.cancel())), (reader) => repeatEffectOption(flatMap9(tryPromise2({
16179
+ try: () => reader.read(),
16180
+ catch: (reason) => some2(onError4(reason))
16181
+ }), ({
16182
+ done: done7,
16183
+ value: value2
16184
+ }) => done7 ? fail6(none2()) : succeed7(value2)))));
16185
+ };
16186
+ var repeatEffectChunkOption = (effect3) => unfoldChunkEffect(effect3, (effect4) => pipe(map17(effect4, (chunk2) => some2([chunk2, effect4])), catchAll2(match2({
16187
+ onNone: () => succeed7(none2()),
16188
+ onSome: fail6
16189
+ }))));
16190
+ var repeatEffectOption = (effect3) => repeatEffectChunkOption(pipe(effect3, map17(of2)));
16258
16191
  var run2 = /* @__PURE__ */ dual(2, (self, sink) => toChannel2(self).pipe(pipeToOrFail(toChannel(sink)), runDrain));
16259
- var runFold = /* @__PURE__ */ dual(3, (self, s, f) => runFoldWhile(self, s, constTrue, f));
16260
- var runFoldWhile = /* @__PURE__ */ dual(4, (self, s, cont, f) => run2(self, fold(s, cont, f)));
16192
+ var runForEachChunk = /* @__PURE__ */ dual(2, (self, f) => run2(self, forEachChunk(f)));
16261
16193
  var scoped4 = (effect3) => new StreamImpl(ensuring3(scoped3(pipe(effect3, map17(of2))), _void));
16262
- var suspend7 = (stream3) => new StreamImpl(suspend5(() => toChannel2(stream3())));
16194
+ var suspend6 = (stream2) => new StreamImpl(suspend5(() => toChannel2(stream2())));
16195
+ var toReadableStreamEffect = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (self, options3) => map17(runtime3(), (runtime4) => toReadableStreamRuntime(self, runtime4, options3)));
16196
+ var toReadableStreamRuntime = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (self, runtime4, options3) => {
16197
+ const runFork4 = runFork3(runtime4);
16198
+ let currentResolve = void 0;
16199
+ let fiber = void 0;
16200
+ const latch = unsafeMakeLatch2(false);
16201
+ return new ReadableStream({
16202
+ start(controller) {
16203
+ fiber = runFork4(runForEachChunk(self, (chunk2) => {
16204
+ if (chunk2.length === 0) return _void;
16205
+ return latch.whenOpen(sync4(() => {
16206
+ latch.unsafeClose();
16207
+ for (const item of chunk2) {
16208
+ controller.enqueue(item);
16209
+ }
16210
+ currentResolve();
16211
+ currentResolve = void 0;
16212
+ }));
16213
+ }));
16214
+ fiber.addObserver((exit4) => {
16215
+ try {
16216
+ if (exit4._tag === "Failure") {
16217
+ controller.error(squash(exit4.cause));
16218
+ } else {
16219
+ controller.close();
16220
+ }
16221
+ } catch {
16222
+ }
16223
+ });
16224
+ },
16225
+ pull() {
16226
+ return new Promise((resolve) => {
16227
+ currentResolve = resolve;
16228
+ runSync(latch.open);
16229
+ });
16230
+ },
16231
+ cancel() {
16232
+ if (!fiber) return;
16233
+ return runPromise(asVoid2(interrupt4(fiber)));
16234
+ }
16235
+ }, options3?.strategy);
16236
+ });
16237
+ var unfoldChunkEffect = (s, f) => suspend6(() => {
16238
+ const loop2 = (s2) => unwrap(map17(f(s2), match2({
16239
+ onNone: () => void_5,
16240
+ onSome: ([chunk2, s3]) => flatMap12(write(chunk2), () => loop2(s3))
16241
+ })));
16242
+ return new StreamImpl(loop2(s));
16243
+ });
16263
16244
  var unwrapScoped3 = (effect3) => flatten10(scoped4(effect3));
16264
16245
 
16265
16246
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/Stream.js
16266
- var _async2 = _async;
16267
16247
  var ensuringWith3 = ensuringWith2;
16268
- var runFold2 = runFold;
16269
- var suspend8 = suspend7;
16248
+ var fail12 = fail11;
16249
+ var fromReadableStream2 = fromReadableStream;
16250
+ var suspend7 = suspend6;
16251
+ var toReadableStreamEffect2 = toReadableStreamEffect;
16270
16252
  var TypeIdError = (typeId, tag2) => {
16271
16253
  class Base3 extends Error3 {
16272
16254
  _tag = tag2;
@@ -16438,7 +16420,6 @@ function parseSetCookie(header) {
16438
16420
  options: Object.keys(options3).length > 0 ? options3 : void 0
16439
16421
  }));
16440
16422
  }
16441
- var empty30 = /* @__PURE__ */ fromIterable12([]);
16442
16423
  var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
16443
16424
  var CookieProto = {
16444
16425
  [CookieTypeId]: CookieTypeId,
@@ -16468,11 +16449,11 @@ var Proto3 = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null),
16468
16449
  return redact2(this, getOrDefault2(fiberRefs3, currentRedactedNames));
16469
16450
  }
16470
16451
  });
16471
- var make48 = (input) => Object.assign(Object.create(Proto3), input);
16472
- var empty31 = /* @__PURE__ */ Object.create(Proto3);
16452
+ var make47 = (input) => Object.assign(Object.create(Proto3), input);
16453
+ var empty30 = /* @__PURE__ */ Object.create(Proto3);
16473
16454
  var fromInput2 = (input) => {
16474
16455
  if (input === void 0) {
16475
- return empty31;
16456
+ return empty30;
16476
16457
  } else if (Symbol.iterator in input) {
16477
16458
  const out2 = Object.create(Proto3);
16478
16459
  for (const [k, v] of input) {
@@ -16492,16 +16473,21 @@ var fromInput2 = (input) => {
16492
16473
  };
16493
16474
  var unsafeFromRecord = (input) => Object.setPrototypeOf(input, Proto3);
16494
16475
  var set8 = /* @__PURE__ */ dual(3, (self, key, value2) => {
16495
- const out = make48(self);
16476
+ const out = make47(self);
16496
16477
  out[key.toLowerCase()] = value2;
16497
16478
  return out;
16498
16479
  });
16499
- var setAll3 = /* @__PURE__ */ dual(2, (self, headers) => make48({
16480
+ var setAll3 = /* @__PURE__ */ dual(2, (self, headers) => make47({
16500
16481
  ...self,
16501
16482
  ...fromInput2(headers)
16502
16483
  }));
16484
+ var merge8 = /* @__PURE__ */ dual(2, (self, headers) => {
16485
+ const out = make47(self);
16486
+ Object.assign(out, headers);
16487
+ return out;
16488
+ });
16503
16489
  var remove8 = /* @__PURE__ */ dual(2, (self, key) => {
16504
- const out = make48(self);
16490
+ const out = make47(self);
16505
16491
  const modify6 = (key2) => {
16506
16492
  if (typeof key2 === "string") {
16507
16493
  const k = key2.toLowerCase();
@@ -16612,7 +16598,7 @@ var fromInputNested = (input) => {
16612
16598
  }
16613
16599
  return out;
16614
16600
  };
16615
- var empty32 = [];
16601
+ var empty31 = [];
16616
16602
  var setAll4 = /* @__PURE__ */ dual(2, (self, input) => {
16617
16603
  const toSet3 = fromInput3(input);
16618
16604
  const keys6 = toSet3.map(([k]) => k);
@@ -16708,7 +16694,7 @@ var EmptyImpl = class extends BodyBase {
16708
16694
  };
16709
16695
  }
16710
16696
  };
16711
- var empty33 = /* @__PURE__ */ new EmptyImpl();
16697
+ var empty32 = /* @__PURE__ */ new EmptyImpl();
16712
16698
  var Uint8ArrayImpl = class extends BodyBase {
16713
16699
  body;
16714
16700
  contentType;
@@ -16774,19 +16760,19 @@ function makeInternal(method, url, urlParams, hash2, headers, body) {
16774
16760
  self.body = body;
16775
16761
  return self;
16776
16762
  }
16777
- var empty34 = /* @__PURE__ */ makeInternal("GET", "", empty32, /* @__PURE__ */ none2(), empty31, empty33);
16778
- var make49 = (method) => (url, options3) => modify5(empty34, {
16763
+ var empty33 = /* @__PURE__ */ makeInternal("GET", "", empty31, /* @__PURE__ */ none2(), empty30, empty32);
16764
+ var make48 = (method) => (url, options3) => modify5(empty33, {
16779
16765
  method,
16780
16766
  url,
16781
16767
  ...options3 ?? void 0
16782
16768
  });
16783
- var get15 = /* @__PURE__ */ make49("GET");
16784
- var post = /* @__PURE__ */ make49("POST");
16785
- var put = /* @__PURE__ */ make49("PUT");
16786
- var patch9 = /* @__PURE__ */ make49("PATCH");
16787
- var del = /* @__PURE__ */ make49("DELETE");
16788
- var head5 = /* @__PURE__ */ make49("HEAD");
16789
- var options = /* @__PURE__ */ make49("OPTIONS");
16769
+ var get15 = /* @__PURE__ */ make48("GET");
16770
+ var post = /* @__PURE__ */ make48("POST");
16771
+ var put = /* @__PURE__ */ make48("PUT");
16772
+ var patch9 = /* @__PURE__ */ make48("PATCH");
16773
+ var del = /* @__PURE__ */ make48("DELETE");
16774
+ var head5 = /* @__PURE__ */ make48("HEAD");
16775
+ var options = /* @__PURE__ */ make48("OPTIONS");
16790
16776
  var modify5 = /* @__PURE__ */ dual(2, (self, options3) => {
16791
16777
  let result = self;
16792
16778
  if (options3.method) {
@@ -16853,6 +16839,114 @@ var bodyJson = /* @__PURE__ */ dual(2, (self, body) => map17(json(body), (body2)
16853
16839
 
16854
16840
  // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/internal/httpClientResponse.js
16855
16841
  var TypeId24 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClientResponse");
16842
+ var fromWeb = (request, source) => new ClientResponseImpl(request, source);
16843
+ var ClientResponseImpl = class extends Class {
16844
+ request;
16845
+ source;
16846
+ [TypeId21];
16847
+ [TypeId24];
16848
+ constructor(request, source) {
16849
+ super();
16850
+ this.request = request;
16851
+ this.source = source;
16852
+ this[TypeId21] = TypeId21;
16853
+ this[TypeId24] = TypeId24;
16854
+ }
16855
+ toJSON() {
16856
+ return inspect(this, {
16857
+ _id: "@effect/platform/HttpClientResponse",
16858
+ request: this.request.toJSON(),
16859
+ status: this.status
16860
+ });
16861
+ }
16862
+ get status() {
16863
+ return this.source.status;
16864
+ }
16865
+ get headers() {
16866
+ return fromInput2(this.source.headers);
16867
+ }
16868
+ cachedCookies;
16869
+ get cookies() {
16870
+ if (this.cachedCookies) {
16871
+ return this.cachedCookies;
16872
+ }
16873
+ return this.cachedCookies = fromSetCookie(this.source.headers.getSetCookie());
16874
+ }
16875
+ get remoteAddress() {
16876
+ return none2();
16877
+ }
16878
+ get stream() {
16879
+ return this.source.body ? fromReadableStream2(() => this.source.body, (cause2) => new ResponseError({
16880
+ request: this.request,
16881
+ response: this,
16882
+ reason: "Decode",
16883
+ cause: cause2
16884
+ })) : fail12(new ResponseError({
16885
+ request: this.request,
16886
+ response: this,
16887
+ reason: "EmptyBody",
16888
+ description: "can not create stream from empty body"
16889
+ }));
16890
+ }
16891
+ get json() {
16892
+ return tryMap2(this.text, {
16893
+ try: (text2) => text2 === "" ? null : JSON.parse(text2),
16894
+ catch: (cause2) => new ResponseError({
16895
+ request: this.request,
16896
+ response: this,
16897
+ reason: "Decode",
16898
+ cause: cause2
16899
+ })
16900
+ });
16901
+ }
16902
+ textBody;
16903
+ get text() {
16904
+ return this.textBody ??= tryPromise2({
16905
+ try: () => this.source.text(),
16906
+ catch: (cause2) => new ResponseError({
16907
+ request: this.request,
16908
+ response: this,
16909
+ reason: "Decode",
16910
+ cause: cause2
16911
+ })
16912
+ }).pipe(cached3, runSync);
16913
+ }
16914
+ get urlParamsBody() {
16915
+ return flatMap9(this.text, (_) => try_2({
16916
+ try: () => fromInput3(new URLSearchParams(_)),
16917
+ catch: (cause2) => new ResponseError({
16918
+ request: this.request,
16919
+ response: this,
16920
+ reason: "Decode",
16921
+ cause: cause2
16922
+ })
16923
+ }));
16924
+ }
16925
+ formDataBody;
16926
+ get formData() {
16927
+ return this.formDataBody ??= tryPromise2({
16928
+ try: () => this.source.formData(),
16929
+ catch: (cause2) => new ResponseError({
16930
+ request: this.request,
16931
+ response: this,
16932
+ reason: "Decode",
16933
+ cause: cause2
16934
+ })
16935
+ }).pipe(cached3, runSync);
16936
+ }
16937
+ arrayBufferBody;
16938
+ get arrayBuffer() {
16939
+ return this.arrayBufferBody ??= tryPromise2({
16940
+ try: () => this.source.arrayBuffer(),
16941
+ catch: (cause2) => new ResponseError({
16942
+ request: this.request,
16943
+ response: this,
16944
+ reason: "Decode",
16945
+ cause: cause2
16946
+ })
16947
+ }).pipe(cached3, runSync);
16948
+ }
16949
+ };
16856
16950
 
16857
16951
  // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/internal/httpClient.js
16858
16952
  var TypeId25 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClient");
@@ -16932,7 +17026,7 @@ var responseRegistry = /* @__PURE__ */ globalValue("@effect/platform/HttpClient/
16932
17026
  };
16933
17027
  });
16934
17028
  var scopedRequests = /* @__PURE__ */ globalValue("@effect/platform/HttpClient/scopedRequests", () => /* @__PURE__ */ new WeakMap());
16935
- var make50 = (f) => makeWith((effect3) => flatMap9(effect3, (request) => withFiberRuntime2((fiber) => {
17029
+ var make49 = (f) => makeWith((effect3) => flatMap9(effect3, (request) => withFiberRuntime2((fiber) => {
16936
17030
  const scopedController = scopedRequests.get(request);
16937
17031
  const controller = scopedController ?? new AbortController();
16938
17032
  const urlResult = makeUrl(request.url, request.urlParams, request.hash);
@@ -17052,7 +17146,7 @@ var InterruptibleResponse = class {
17052
17146
  return this.applyInterrupt(this.original.arrayBuffer);
17053
17147
  }
17054
17148
  get stream() {
17055
- return suspend8(() => {
17149
+ return suspend7(() => {
17056
17150
  responseRegistry.unregister(this.original);
17057
17151
  return ensuringWith3(this.original.stream, (exit4) => {
17058
17152
  if (isInterrupted2(exit4)) {
@@ -17095,11 +17189,6 @@ var layerMergedContext = (effect3) => effect(tag, flatMap9(context2(), (context5
17095
17189
 
17096
17190
  // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/HttpClient.js
17097
17191
  var HttpClient = tag;
17098
- var make51 = make50;
17099
- var layerMergedContext2 = layerMergedContext;
17100
-
17101
- // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/HttpClientResponse.js
17102
- var TypeId26 = TypeId24;
17103
17192
 
17104
17193
  // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/HttpClientRequest.js
17105
17194
  var get17 = get15;
@@ -17107,443 +17196,44 @@ var post3 = post;
17107
17196
  var setUrlParams2 = setUrlParams;
17108
17197
  var bodyJson2 = bodyJson;
17109
17198
 
17110
- // ../../../node_modules/.pnpm/multipasta@0.2.7/node_modules/multipasta/dist/esm/internal/headers.js
17111
- var constMaxPairs = 100;
17112
- var constMaxSize = 16 * 1024;
17113
- var State;
17114
- (function(State2) {
17115
- State2[State2["key"] = 0] = "key";
17116
- State2[State2["whitespace"] = 1] = "whitespace";
17117
- State2[State2["value"] = 2] = "value";
17118
- })(State || (State = {}));
17119
- var constContinue = {
17120
- _tag: "Continue"
17121
- };
17122
- var constNameChars = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1];
17123
- var constValueChars = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
17124
- function make52() {
17125
- const decoder = new TextDecoder();
17126
- const state = {
17127
- state: State.key,
17128
- headers: /* @__PURE__ */ Object.create(null),
17129
- key: "",
17130
- value: void 0,
17131
- crlf: 0,
17132
- previousChunk: void 0,
17133
- pairs: 0,
17134
- size: 0
17135
- };
17136
- function reset(value2) {
17137
- state.state = State.key;
17138
- state.headers = /* @__PURE__ */ Object.create(null);
17139
- state.key = "";
17140
- state.value = void 0;
17141
- state.crlf = 0;
17142
- state.previousChunk = void 0;
17143
- state.pairs = 0;
17144
- state.size = 0;
17145
- return value2;
17146
- }
17147
- function concatUint8Array(a, b) {
17148
- const newUint8Array = new Uint8Array(a.length + b.length);
17149
- newUint8Array.set(a);
17150
- newUint8Array.set(b, a.length);
17151
- return newUint8Array;
17152
- }
17153
- function error(reason) {
17154
- return reset({
17155
- _tag: "Failure",
17156
- reason,
17157
- headers: state.headers
17158
- });
17159
- }
17160
- return function write2(chunk3, start3) {
17161
- let endOffset = 0;
17162
- let previousCursor;
17163
- if (state.previousChunk !== void 0) {
17164
- endOffset = state.previousChunk.length;
17165
- previousCursor = endOffset;
17166
- const newChunk = new Uint8Array(chunk3.length + endOffset);
17167
- newChunk.set(state.previousChunk);
17168
- newChunk.set(chunk3, endOffset);
17169
- state.previousChunk = void 0;
17170
- chunk3 = newChunk;
17171
- }
17172
- const end4 = chunk3.length;
17173
- outer: while (start3 < end4) {
17174
- if (state.state === State.key) {
17175
- let i = start3;
17176
- for (; i < end4; i++) {
17177
- if (state.size++ > constMaxSize) {
17178
- return error("HeaderTooLarge");
17179
- }
17180
- if (chunk3[i] === 58) {
17181
- state.key += decoder.decode(chunk3.subarray(start3, i)).toLowerCase();
17182
- if (state.key.length === 0) {
17183
- return error("InvalidHeaderName");
17184
- }
17185
- if (chunk3[i + 1] === 32 && chunk3[i + 2] !== 32 && chunk3[i + 2] !== 9) {
17186
- start3 = i + 2;
17187
- state.state = State.value;
17188
- state.size++;
17189
- } else if (chunk3[i + 1] !== 32 && chunk3[i + 1] !== 9) {
17190
- start3 = i + 1;
17191
- state.state = State.value;
17192
- } else {
17193
- start3 = i + 1;
17194
- state.state = State.whitespace;
17195
- }
17196
- break;
17197
- } else if (constNameChars[chunk3[i]] !== 1) {
17198
- return error("InvalidHeaderName");
17199
- }
17200
- }
17201
- if (i === end4) {
17202
- state.key += decoder.decode(chunk3.subarray(start3, end4)).toLowerCase();
17203
- return constContinue;
17204
- }
17205
- }
17206
- if (state.state === State.whitespace) {
17207
- for (; start3 < end4; start3++) {
17208
- if (state.size++ > constMaxSize) {
17209
- return error("HeaderTooLarge");
17210
- }
17211
- if (chunk3[start3] !== 32 && chunk3[start3] !== 9) {
17212
- state.state = State.value;
17213
- break;
17214
- }
17215
- }
17216
- if (start3 === end4) {
17217
- return constContinue;
17218
- }
17219
- }
17220
- if (state.state === State.value) {
17221
- let i = start3;
17222
- if (previousCursor !== void 0) {
17223
- i = previousCursor;
17224
- previousCursor = void 0;
17225
- }
17226
- for (; i < end4; i++) {
17227
- if (state.size++ > constMaxSize) {
17228
- return error("HeaderTooLarge");
17229
- }
17230
- if (chunk3[i] === 13 || state.crlf > 0) {
17231
- let byte = chunk3[i];
17232
- if (byte === 13 && state.crlf === 0) {
17233
- state.crlf = 1;
17234
- i++;
17235
- state.size++;
17236
- byte = chunk3[i];
17237
- }
17238
- if (byte === 10 && state.crlf === 1) {
17239
- state.crlf = 2;
17240
- i++;
17241
- state.size++;
17242
- byte = chunk3[i];
17243
- }
17244
- if (byte === 13 && state.crlf === 2) {
17245
- state.crlf = 3;
17246
- i++;
17247
- state.size++;
17248
- byte = chunk3[i];
17249
- }
17250
- if (byte === 10 && state.crlf === 3) {
17251
- state.crlf = 4;
17252
- i++;
17253
- state.size++;
17254
- }
17255
- if (state.crlf < 4 && i >= end4) {
17256
- state.previousChunk = chunk3.subarray(start3);
17257
- return constContinue;
17258
- } else if (state.crlf >= 2) {
17259
- state.value = state.value === void 0 ? chunk3.subarray(start3, i - state.crlf) : concatUint8Array(state.value, chunk3.subarray(start3, i - state.crlf));
17260
- const value2 = decoder.decode(state.value);
17261
- if (state.headers[state.key] === void 0) {
17262
- state.headers[state.key] = value2;
17263
- } else if (typeof state.headers[state.key] === "string") {
17264
- state.headers[state.key] = [state.headers[state.key], value2];
17265
- } else {
17266
- state.headers[state.key].push(value2);
17267
- }
17268
- start3 = i;
17269
- state.size--;
17270
- if (state.crlf !== 4 && state.pairs === constMaxPairs) {
17271
- return error("TooManyHeaders");
17272
- } else if (state.crlf === 3) {
17273
- return error("InvalidHeaderValue");
17274
- } else if (state.crlf === 4) {
17275
- return reset({
17276
- _tag: "Headers",
17277
- headers: state.headers,
17278
- endPosition: start3 - endOffset
17279
- });
17280
- }
17281
- state.pairs++;
17282
- state.key = "";
17283
- state.value = void 0;
17284
- state.crlf = 0;
17285
- state.state = State.key;
17286
- continue outer;
17287
- }
17288
- } else if (constValueChars[chunk3[i]] !== 1) {
17289
- return error("InvalidHeaderValue");
17290
- }
17291
- }
17292
- if (i === end4) {
17293
- state.value = state.value === void 0 ? chunk3.subarray(start3, end4) : concatUint8Array(state.value, chunk3.subarray(start3, end4));
17294
- return constContinue;
17295
- }
17296
- }
17297
- }
17298
- if (start3 > end4) {
17299
- state.size += end4 - start3;
17300
- }
17301
- return constContinue;
17302
- };
17303
- }
17304
-
17305
- // ../../../node_modules/.pnpm/multipasta@0.2.7/node_modules/multipasta/dist/esm/HeadersParser.js
17306
- var make53 = make52;
17307
-
17308
- // ../../../node_modules/.pnpm/@effect+platform-browser@0.70.0_@effect+platform@0.90.0_effect@3.17.2__effect@3.17.2/node_modules/@effect/platform-browser/dist/esm/internal/httpClient.js
17309
- var xhrTagKey = "@effect/platform-browser/BrowserHttpClient/XMLHttpRequest";
17310
- var xhrTag = /* @__PURE__ */ GenericTag(xhrTagKey);
17311
- var currentXHRResponseType = /* @__PURE__ */ globalValue("@effect/platform-browser/BrowserHttpClient/currentXHRResponseType", () => unsafeMake7("text"));
17312
- var makeXhr = () => new XMLHttpRequest();
17313
- var makeXMLHttpRequest = /* @__PURE__ */ make51((request, url, signal, fiber) => suspend4(() => {
17314
- const xhr = getOrElse3(fiber.getFiberRef(currentContext2), xhrTag, () => makeXhr)();
17315
- signal.addEventListener("abort", () => {
17316
- xhr.abort();
17317
- xhr.onreadystatechange = null;
17318
- }, {
17319
- once: true
17320
- });
17321
- xhr.open(request.method, url.toString(), true);
17322
- xhr.responseType = fiber.getFiberRef(currentXHRResponseType);
17323
- Object.entries(request.headers).forEach(([k, v]) => {
17324
- xhr.setRequestHeader(k, v);
17325
- });
17326
- return zipRight3(sendBody(xhr, request), async2((resume2) => {
17327
- let sent = false;
17328
- const onChange = () => {
17329
- if (!sent && xhr.readyState >= 2) {
17330
- sent = true;
17331
- resume2(succeed7(new ClientResponseImpl2(request, xhr)));
17332
- }
17333
- };
17334
- xhr.onreadystatechange = onChange;
17335
- xhr.onerror = (_event) => {
17336
- resume2(fail6(new RequestError({
17337
- request,
17338
- reason: "Transport",
17339
- cause: xhr.statusText
17340
- })));
17341
- };
17342
- onChange();
17343
- return _void;
17344
- }));
17345
- }));
17346
- var sendBody = (xhr, request) => {
17347
- const body = request.body;
17348
- switch (body._tag) {
17349
- case "Empty":
17350
- return sync4(() => xhr.send());
17199
+ // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/internal/fetchHttpClient.js
17200
+ var fetchTagKey = "@effect/platform/FetchHttpClient/Fetch";
17201
+ var requestInitTagKey = "@effect/platform/FetchHttpClient/FetchOptions";
17202
+ var fetch = /* @__PURE__ */ make49((request, url, signal, fiber) => {
17203
+ const context5 = fiber.getFiberRef(currentContext2);
17204
+ const fetch2 = context5.unsafeMap.get(fetchTagKey) ?? globalThis.fetch;
17205
+ const options3 = context5.unsafeMap.get(requestInitTagKey) ?? {};
17206
+ const headers = options3.headers ? merge8(fromInput2(options3.headers), request.headers) : request.headers;
17207
+ const send = (body) => map17(tryPromise2({
17208
+ try: () => fetch2(url, {
17209
+ ...options3,
17210
+ method: request.method,
17211
+ headers,
17212
+ body,
17213
+ duplex: request.body._tag === "Stream" ? "half" : void 0,
17214
+ signal
17215
+ }),
17216
+ catch: (cause2) => new RequestError({
17217
+ request,
17218
+ reason: "Transport",
17219
+ cause: cause2
17220
+ })
17221
+ }), (response) => fromWeb(request, response));
17222
+ switch (request.body._tag) {
17351
17223
  case "Raw":
17352
- return sync4(() => xhr.send(body.body));
17353
17224
  case "Uint8Array":
17354
- return sync4(() => xhr.send(body.body));
17225
+ return send(request.body.body);
17355
17226
  case "FormData":
17356
- return sync4(() => xhr.send(body.formData));
17227
+ return send(request.body.formData);
17357
17228
  case "Stream":
17358
- return matchEffect2(runFold2(body.stream, new Uint8Array(0), (acc, chunk3) => {
17359
- const next = new Uint8Array(acc.length + chunk3.length);
17360
- next.set(acc, 0);
17361
- next.set(chunk3, acc.length);
17362
- return next;
17363
- }), {
17364
- onFailure: (cause2) => fail6(new RequestError({
17365
- request,
17366
- reason: "Encode",
17367
- cause: cause2
17368
- })),
17369
- onSuccess: (body2) => sync4(() => xhr.send(body2))
17370
- });
17371
- }
17372
- };
17373
- var encoder2 = /* @__PURE__ */ new TextEncoder();
17374
- var IncomingMessageImpl = class extends Class {
17375
- source;
17376
- onError;
17377
- [TypeId21];
17378
- constructor(source, onError4) {
17379
- super();
17380
- this.source = source;
17381
- this.onError = onError4;
17382
- this[TypeId21] = TypeId21;
17383
- this._rawHeaderString = source.getAllResponseHeaders();
17384
- }
17385
- _rawHeaderString;
17386
- _rawHeaders;
17387
- _headers;
17388
- get headers() {
17389
- if (this._headers) {
17390
- return this._headers;
17391
- }
17392
- if (this._rawHeaderString === "") {
17393
- return this._headers = empty31;
17394
- }
17395
- const parser = make53();
17396
- const result = parser(encoder2.encode(this._rawHeaderString + "\r\n"), 0);
17397
- this._rawHeaders = result._tag === "Headers" ? result.headers : void 0;
17398
- const parsed = result._tag === "Headers" ? fromInput2(result.headers) : empty31;
17399
- return this._headers = parsed;
17400
- }
17401
- cachedCookies;
17402
- get cookies() {
17403
- if (this.cachedCookies) {
17404
- return this.cachedCookies;
17405
- }
17406
- if (this._rawHeaders === void 0) {
17407
- return empty30;
17408
- } else if (this._rawHeaders["set-cookie"] === void 0) {
17409
- return this.cachedCookies = empty30;
17410
- }
17411
- return this.cachedCookies = fromSetCookie(this._rawHeaders["set-cookie"]);
17412
- }
17413
- get remoteAddress() {
17414
- return none2();
17415
- }
17416
- _textEffect;
17417
- get text() {
17418
- if (this._textEffect) {
17419
- return this._textEffect;
17420
- }
17421
- return this._textEffect = async2((resume2) => {
17422
- if (this.source.readyState === 4) {
17423
- resume2(succeed7(this.source.responseText));
17424
- return;
17425
- }
17426
- const onReadyStateChange = () => {
17427
- if (this.source.readyState === 4) {
17428
- resume2(succeed7(this.source.responseText));
17429
- }
17430
- };
17431
- const onError4 = () => {
17432
- resume2(fail6(this.onError(this.source.statusText)));
17433
- };
17434
- this.source.addEventListener("readystatechange", onReadyStateChange);
17435
- this.source.addEventListener("error", onError4);
17436
- return sync4(() => {
17437
- this.source.removeEventListener("readystatechange", onReadyStateChange);
17438
- this.source.removeEventListener("error", onError4);
17439
- });
17440
- }).pipe(cached3, runSync);
17441
- }
17442
- get json() {
17443
- return tryMap2(this.text, {
17444
- try: (_) => _ === "" ? null : JSON.parse(_),
17445
- catch: this.onError
17446
- });
17447
- }
17448
- get urlParamsBody() {
17449
- return flatMap9(this.text, (_) => try_2({
17450
- try: () => fromInput3(new URLSearchParams(_)),
17451
- catch: this.onError
17452
- }));
17453
- }
17454
- get stream() {
17455
- return _async2((emit) => {
17456
- let offset = 0;
17457
- const onReadyStateChange = () => {
17458
- if (this.source.readyState === 3) {
17459
- emit.single(encoder2.encode(this.source.responseText.slice(offset)));
17460
- offset = this.source.responseText.length;
17461
- } else if (this.source.readyState === 4) {
17462
- if (offset < this.source.responseText.length) {
17463
- emit.single(encoder2.encode(this.source.responseText.slice(offset)));
17464
- }
17465
- emit.end();
17466
- }
17467
- };
17468
- const onError4 = () => {
17469
- emit.fail(this.onError(this.source.statusText));
17470
- };
17471
- this.source.addEventListener("readystatechange", onReadyStateChange);
17472
- this.source.addEventListener("error", onError4);
17473
- onReadyStateChange();
17474
- return sync4(() => {
17475
- this.source.removeEventListener("readystatechange", onReadyStateChange);
17476
- this.source.removeEventListener("error", onError4);
17477
- });
17478
- });
17229
+ return flatMap9(toReadableStreamEffect2(request.body.stream), send);
17479
17230
  }
17480
- _arrayBufferEffect;
17481
- get arrayBuffer() {
17482
- if (this._arrayBufferEffect) {
17483
- return this._arrayBufferEffect;
17484
- }
17485
- return this._arrayBufferEffect = async2((resume2) => {
17486
- if (this.source.readyState === 4) {
17487
- resume2(succeed7(this.source.response));
17488
- return;
17489
- }
17490
- const onReadyStateChange = () => {
17491
- if (this.source.readyState === 4) {
17492
- resume2(succeed7(this.source.response));
17493
- }
17494
- };
17495
- const onError4 = () => {
17496
- resume2(fail6(this.onError(this.source.statusText)));
17497
- };
17498
- this.source.addEventListener("readystatechange", onReadyStateChange);
17499
- this.source.addEventListener("error", onError4);
17500
- return sync4(() => {
17501
- this.source.removeEventListener("readystatechange", onReadyStateChange);
17502
- this.source.removeEventListener("error", onError4);
17503
- });
17504
- }).pipe(map17((response) => {
17505
- if (typeof response === "string") {
17506
- const arr = encoder2.encode(response);
17507
- return arr.byteLength !== arr.buffer.byteLength ? arr.buffer.slice(arr.byteOffset, arr.byteOffset + arr.byteLength) : arr.buffer;
17508
- }
17509
- return response;
17510
- }), cached3, runSync);
17511
- }
17512
- };
17513
- var ClientResponseImpl2 = class extends IncomingMessageImpl {
17514
- request;
17515
- [TypeId26];
17516
- constructor(request, source) {
17517
- super(source, (cause2) => new ResponseError({
17518
- request,
17519
- response: this,
17520
- reason: "Decode",
17521
- cause: cause2
17522
- }));
17523
- this.request = request;
17524
- this[TypeId26] = TypeId26;
17525
- }
17526
- get status() {
17527
- return this.source.status;
17528
- }
17529
- get formData() {
17530
- return die5("Not implemented");
17531
- }
17532
- toString() {
17533
- return `ClientResponse(${this.status})`;
17534
- }
17535
- toJSON() {
17536
- return inspect(this, {
17537
- _id: "@effect/platform/HttpClientResponse",
17538
- request: this.request.toJSON(),
17539
- status: this.status
17540
- });
17541
- }
17542
- };
17543
- var layerXMLHttpRequest = /* @__PURE__ */ layerMergedContext2(/* @__PURE__ */ succeed7(makeXMLHttpRequest));
17231
+ return send(void 0);
17232
+ });
17233
+ var layer = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed7(fetch));
17544
17234
 
17545
- // ../../../node_modules/.pnpm/@effect+platform-browser@0.70.0_@effect+platform@0.90.0_effect@3.17.2__effect@3.17.2/node_modules/@effect/platform-browser/dist/esm/BrowserHttpClient.js
17546
- var layerXMLHttpRequest2 = layerXMLHttpRequest;
17235
+ // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/FetchHttpClient.js
17236
+ var layer2 = layer;
17547
17237
 
17548
17238
  // ../../utils/dist/effect/Resource/schema.js
17549
17239
  Literal2(
@@ -17607,7 +17297,7 @@ var ShopifyRoutes_exports = {};
17607
17297
  __export(ShopifyRoutes_exports, {
17608
17298
  Defaults: () => Defaults,
17609
17299
  ShopifyRoutes: () => ShopifyRoutes,
17610
- make: () => make54
17300
+ make: () => make50
17611
17301
  });
17612
17302
  var Defaults = {
17613
17303
  account_addresses_url: "/account/addresses",
@@ -17639,7 +17329,7 @@ var ShopifyRoutes = class extends Class3 {
17639
17329
  });
17640
17330
  }
17641
17331
  };
17642
- var make54 = () => _case()({
17332
+ var make50 = () => _case()({
17643
17333
  ...Defaults,
17644
17334
  ...window?.BrytDesigns?.routes || {}
17645
17335
  });
@@ -17648,7 +17338,7 @@ var make54 = () => _case()({
17648
17338
  var StorefrontClientConfig_exports = {};
17649
17339
  __export(StorefrontClientConfig_exports, {
17650
17340
  StorefrontClientConfig: () => StorefrontClientConfig,
17651
- make: () => make55
17341
+ make: () => make51
17652
17342
  });
17653
17343
  var StorefrontClientConfig = class extends Class3 {
17654
17344
  constructor() {
@@ -17657,7 +17347,7 @@ var StorefrontClientConfig = class extends Class3 {
17657
17347
  });
17658
17348
  }
17659
17349
  };
17660
- var make55 = () => _case()({
17350
+ var make51 = () => _case()({
17661
17351
  ...window.BrytDesigns.storefront.config
17662
17352
  });
17663
17353
 
@@ -17736,7 +17426,7 @@ var InvalidAjaxMethodError = class extends TaggedError(
17736
17426
  };
17737
17427
 
17738
17428
  // src/AjaxClientResponse.ts
17739
- var make56 = (data) => _case()(data);
17429
+ var make52 = (data) => _case()(data);
17740
17430
 
17741
17431
  // src/index.ts
17742
17432
  Struct({});
@@ -17746,7 +17436,7 @@ extend3(
17746
17436
  handle: String$
17747
17437
  })
17748
17438
  );
17749
- var Default = layerXMLHttpRequest2;
17439
+ var Default = layer2;
17750
17440
  var METHOD = {
17751
17441
  GET: "get",
17752
17442
  POST: "post"
@@ -17805,7 +17495,7 @@ var makeFactory = ({
17805
17495
  const response = yield* client.execute(request);
17806
17496
  if (response.status !== 200) {
17807
17497
  const data = yield* response.json;
17808
- return make56({
17498
+ return make52({
17809
17499
  error: {
17810
17500
  description: data.description,
17811
17501
  status: data.status,
@@ -17825,7 +17515,7 @@ var makeFactory = ({
17825
17515
  response,
17826
17516
  schemaBodyJson(output2)
17827
17517
  );
17828
- const clientResponse2 = make56({
17518
+ const clientResponse2 = make52({
17829
17519
  data: json3
17830
17520
  });
17831
17521
  yield* annotateLogsScoped2({
@@ -17841,7 +17531,7 @@ var makeFactory = ({
17841
17531
  response,
17842
17532
  schemaBodyJson(output)
17843
17533
  );
17844
- const clientResponse = make56({
17534
+ const clientResponse = make52({
17845
17535
  data: json2
17846
17536
  });
17847
17537
  yield* annotateLogsScoped2({