@deslop/gateway 0.1.1241 → 0.1.1244

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/server.js CHANGED
@@ -2167,7 +2167,7 @@ const emptyContext$1 = {
2167
2167
  * @category formatting
2168
2168
  * @since 2.0.0
2169
2169
  */
2170
- function format$2(input, options) {
2170
+ function format$4(input, options) {
2171
2171
  const space = options?.space ?? 0;
2172
2172
  const ancestors = /* @__PURE__ */ new WeakSet();
2173
2173
  const gap = !space ? "" : typeof space === "number" ? " ".repeat(space) : space;
@@ -2331,7 +2331,7 @@ function formatJson(input, options) {
2331
2331
  return JSON.stringify(input, function(key, value) {
2332
2332
  const original = Object.getOwnPropertyDescriptor(sources.get(this) ?? this, key)?.value;
2333
2333
  const redacted = hasProperty(original, symbolRedactable) ? redact$2(original) : redact$2(value);
2334
- if (typeof redacted === "bigint") return format$2(redacted);
2334
+ if (typeof redacted === "bigint") return format$4(redacted);
2335
2335
  if (typeof redacted !== "object" || redacted === null) return redacted;
2336
2336
  const current = redacted instanceof Error && !hasProperty(redacted, "toJSON") ? {
2337
2337
  ...redacted,
@@ -2476,7 +2476,7 @@ const toJson = (input) => {
2476
2476
  const toStringUnknown = (u, whitespace = 2) => {
2477
2477
  if (typeof u === "string") return u;
2478
2478
  try {
2479
- return typeof u === "object" ? formatJson(u, { space: whitespace }) : format$2(u, { space: whitespace });
2479
+ return typeof u === "object" ? formatJson(u, { space: whitespace }) : format$4(u, { space: whitespace });
2480
2480
  } catch {
2481
2481
  return String(u);
2482
2482
  }
@@ -2526,7 +2526,7 @@ const BaseProto = {
2526
2526
  return this.toJSON();
2527
2527
  },
2528
2528
  toString() {
2529
- return format$2(this.toJSON());
2529
+ return format$4(this.toJSON());
2530
2530
  }
2531
2531
  };
2532
2532
  /**
@@ -2598,7 +2598,7 @@ var Class$2 = class {
2598
2598
  * @since 2.0.0
2599
2599
  */
2600
2600
  toString() {
2601
- return format$2(this.toJSON());
2601
+ return format$4(this.toJSON());
2602
2602
  }
2603
2603
  };
2604
2604
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/stackTraceLimit.js
@@ -2766,7 +2766,7 @@ const PipeInspectableProto = {
2766
2766
  return { ...this };
2767
2767
  },
2768
2768
  toString() {
2769
- return format$2(this.toJSON(), {
2769
+ return format$4(this.toJSON(), {
2770
2770
  ignoreToString: true,
2771
2771
  space: 2
2772
2772
  });
@@ -2818,7 +2818,7 @@ var CauseImpl = class {
2818
2818
  };
2819
2819
  }
2820
2820
  toString() {
2821
- return `Cause(${format$2(this.reasons)})`;
2821
+ return `Cause(${format$4(this.reasons)})`;
2822
2822
  }
2823
2823
  [NodeInspectSymbol]() {
2824
2824
  return this.toJSON();
@@ -2862,7 +2862,7 @@ var ReasonBase = class {
2862
2862
  return pipeArguments(this, arguments);
2863
2863
  }
2864
2864
  toString() {
2865
- return format$2(this);
2865
+ return format$4(this);
2866
2866
  }
2867
2867
  [NodeInspectSymbol]() {
2868
2868
  return this.toString();
@@ -2877,7 +2877,7 @@ var Fail = class extends ReasonBase {
2877
2877
  this.error = error;
2878
2878
  }
2879
2879
  toString() {
2880
- return `Fail(${format$2(this.error)})`;
2880
+ return `Fail(${format$4(this.error)})`;
2881
2881
  }
2882
2882
  toJSON() {
2883
2883
  return {
@@ -2937,7 +2937,7 @@ var Die = class extends ReasonBase {
2937
2937
  this.defect = defect;
2938
2938
  }
2939
2939
  toString() {
2940
- return `Die(${format$2(this.defect)})`;
2940
+ return `Die(${format$4(this.defect)})`;
2941
2941
  }
2942
2942
  toJSON() {
2943
2943
  return {
@@ -2998,7 +2998,7 @@ const makeExit = (options) => {
2998
2998
  },
2999
2999
  ...makePrimitiveProto(options),
3000
3000
  toString() {
3001
- return `${options.op}(${format$2(this[args])})`;
3001
+ return `${options.op}(${format$4(this[args])})`;
3002
3002
  },
3003
3003
  toJSON() {
3004
3004
  return {
@@ -3239,7 +3239,7 @@ const Prototype = (options) => makePrimitiveProto({
3239
3239
  * @category constructors
3240
3240
  * @since 2.0.0
3241
3241
  */
3242
- const make$82 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
3242
+ const make$84 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
3243
3243
  const isStrictEquivalent = (x, y) => x === y;
3244
3244
  /**
3245
3245
  * Creates an equivalence relation that uses strict equality (`===`) to compare values.
@@ -3349,7 +3349,7 @@ const strictEqual = () => isStrictEquivalent;
3349
3349
  * @since 4.0.0
3350
3350
  */
3351
3351
  function Tuple$1(elements) {
3352
- return make$82((self, that) => {
3352
+ return make$84((self, that) => {
3353
3353
  if (self.length !== that.length) return false;
3354
3354
  for (let i = 0; i < self.length; i++) if (!elements[i](self[i], that[i])) return false;
3355
3355
  return true;
@@ -3359,7 +3359,7 @@ function Tuple$1(elements) {
3359
3359
  * @since 4.0.0
3360
3360
  */
3361
3361
  function Array_(item) {
3362
- return make$82((self, that) => {
3362
+ return make$84((self, that) => {
3363
3363
  if (self.length !== that.length) return false;
3364
3364
  for (let i = 0; i < self.length; i++) if (!item(self[i], that[i])) return false;
3365
3365
  return true;
@@ -3369,9 +3369,9 @@ function Array_(item) {
3369
3369
  /**
3370
3370
  * @since 2.0.0
3371
3371
  */
3372
- const TypeId$67 = "~effect/Option";
3372
+ const TypeId$69 = "~effect/Option";
3373
3373
  const CommonProto$1 = {
3374
- [TypeId$67]: { _A: (_) => _ },
3374
+ [TypeId$69]: { _A: (_) => _ },
3375
3375
  ...PipeInspectableProto,
3376
3376
  [Symbol.iterator]() {
3377
3377
  return new SingleShotGen(this);
@@ -3387,7 +3387,7 @@ const SomeProto = /*#__PURE__*/ Object.defineProperty(/*#__PURE__*/ Object.assig
3387
3387
  return combine$2(hash(this._tag))(hash(this.value));
3388
3388
  },
3389
3389
  toString() {
3390
- return `some(${format$2(this.value)})`;
3390
+ return `some(${format$4(this.value)})`;
3391
3391
  },
3392
3392
  toJSON() {
3393
3393
  return {
@@ -3421,7 +3421,7 @@ const NoneProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Common
3421
3421
  }
3422
3422
  });
3423
3423
  /** @internal */
3424
- const isOption$1 = (input) => hasProperty(input, TypeId$67);
3424
+ const isOption$1 = (input) => hasProperty(input, TypeId$69);
3425
3425
  /** @internal */
3426
3426
  const isNone$1 = (fa) => fa._tag === "None";
3427
3427
  /** @internal */
@@ -3436,9 +3436,9 @@ SomeImpl.prototype = SomeProto;
3436
3436
  /** @internal */
3437
3437
  const some$2 = (value) => new SomeImpl(value);
3438
3438
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/result.js
3439
- const TypeId$66 = "~effect/Result";
3439
+ const TypeId$68 = "~effect/Result";
3440
3440
  const CommonProto = {
3441
- [TypeId$66]: {
3441
+ [TypeId$68]: {
3442
3442
  /* v8 ignore next 2 */
3443
3443
  _A: (_) => _,
3444
3444
  _E: (_) => _
@@ -3458,7 +3458,7 @@ const SuccessProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Com
3458
3458
  return combine$2(hash(this._tag))(hash(this.success));
3459
3459
  },
3460
3460
  toString() {
3461
- return `success(${format$2(this.success)})`;
3461
+ return `success(${format$4(this.success)})`;
3462
3462
  },
3463
3463
  toJSON() {
3464
3464
  return {
@@ -3478,7 +3478,7 @@ const FailureProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Com
3478
3478
  return combine$2(hash(this._tag))(hash(this.failure));
3479
3479
  },
3480
3480
  toString() {
3481
- return `failure(${format$2(this.failure)})`;
3481
+ return `failure(${format$4(this.failure)})`;
3482
3482
  },
3483
3483
  toJSON() {
3484
3484
  return {
@@ -3489,7 +3489,7 @@ const FailureProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Com
3489
3489
  }
3490
3490
  });
3491
3491
  /** @internal */
3492
- const isResult$1 = (input) => hasProperty(input, TypeId$66);
3492
+ const isResult$1 = (input) => hasProperty(input, TypeId$68);
3493
3493
  /** @internal */
3494
3494
  const isFailure$2 = (result) => result._tag === "Failure";
3495
3495
  /** @internal */
@@ -3508,6 +3508,8 @@ const SuccessImpl = function(success) {
3508
3508
  SuccessImpl.prototype = SuccessProto;
3509
3509
  /** @internal */
3510
3510
  const succeed$11 = (success) => new SuccessImpl(success);
3511
+ /** @internal */
3512
+ const getSuccess$1 = (self) => isFailure$2(self) ? none$1 : some$2(self.success);
3511
3513
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Order.js
3512
3514
  /**
3513
3515
  * Defines comparison functions for ordered values.
@@ -3558,7 +3560,7 @@ const succeed$11 = (success) => new SuccessImpl(success);
3558
3560
  * @category constructors
3559
3561
  * @since 2.0.0
3560
3562
  */
3561
- function make$81(compare) {
3563
+ function make$83(compare) {
3562
3564
  return (self, that) => self === that ? 0 : compare(self, that);
3563
3565
  }
3564
3566
  /**
@@ -3589,7 +3591,7 @@ function make$81(compare) {
3589
3591
  * @category instances
3590
3592
  * @since 4.0.0
3591
3593
  */
3592
- const String$10 = /*#__PURE__*/ make$81((self, that) => self < that ? -1 : 1);
3594
+ const String$10 = /*#__PURE__*/ make$83((self, that) => self < that ? -1 : 1);
3593
3595
  /**
3594
3596
  * Order instance for numbers that compares them numerically.
3595
3597
  *
@@ -3622,7 +3624,7 @@ const String$10 = /*#__PURE__*/ make$81((self, that) => self < that ? -1 : 1);
3622
3624
  * @category instances
3623
3625
  * @since 4.0.0
3624
3626
  */
3625
- const Number$6 = /*#__PURE__*/ make$81((self, that) => {
3627
+ const Number$6 = /*#__PURE__*/ make$83((self, that) => {
3626
3628
  if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that)) return 0;
3627
3629
  if (globalThis.Number.isNaN(self)) return -1;
3628
3630
  if (globalThis.Number.isNaN(that)) return 1;
@@ -3661,7 +3663,7 @@ const Number$6 = /*#__PURE__*/ make$81((self, that) => {
3661
3663
  * @category mapping
3662
3664
  * @since 2.0.0
3663
3665
  */
3664
- const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$81((b1, b2) => self(f(b1), f(b2))));
3666
+ const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$83((b1, b2) => self(f(b1), f(b2))));
3665
3667
  /**
3666
3668
  * Checks whether one value is strictly less than another according to the given order.
3667
3669
  *
@@ -4461,7 +4463,7 @@ const containsWith$1 = (isEquivalent) => dual(2, (self, a) => isNone(self) ? fal
4461
4463
  * @category predicates
4462
4464
  * @since 2.0.0
4463
4465
  */
4464
- const contains$1 = /*#__PURE__*/ containsWith$1(/*#__PURE__*/ asEquivalence());
4466
+ const contains$2 = /*#__PURE__*/ containsWith$1(/*#__PURE__*/ asEquivalence());
4465
4467
  /**
4466
4468
  * Checks whether the value in a `Some` satisfies a predicate or refinement.
4467
4469
  *
@@ -4591,7 +4593,7 @@ const ServiceProto = {
4591
4593
  return self;
4592
4594
  },
4593
4595
  context(self) {
4594
- return make$80(this, self);
4596
+ return make$82(this, self);
4595
4597
  },
4596
4598
  use(f) {
4597
4599
  return withFiber$1((fiber) => f(get$10(fiber.context, this)));
@@ -4602,7 +4604,7 @@ const ServiceProto = {
4602
4604
  };
4603
4605
  const cacheKeys = /*#__PURE__*/ new Set();
4604
4606
  const ReferenceTypeId = "~effect/Context/Reference";
4605
- const TypeId$65 = "~effect/Context";
4607
+ const TypeId$67 = "~effect/Context";
4606
4608
  const FlattenAfterBaseHits = 8;
4607
4609
  const makeImpl$1 = (cacheRoot, base, overlay, depth, maxDepth) => {
4608
4610
  const self = Object.create(Proto$22);
@@ -4701,7 +4703,7 @@ const Proto$22 = {
4701
4703
  return flatten$4(this);
4702
4704
  },
4703
4705
  ...PipeInspectableProto,
4704
- [TypeId$65]: { _Services: (_) => _ },
4706
+ [TypeId$67]: { _Services: (_) => _ },
4705
4707
  toJSON() {
4706
4708
  return {
4707
4709
  _id: "Context",
@@ -4757,7 +4759,7 @@ const hasSameCache = (self, that) => self.cacheRoot === that.cacheRoot;
4757
4759
  * @category guards
4758
4760
  * @since 2.0.0
4759
4761
  */
4760
- const isContext = (u) => hasProperty(u, TypeId$65);
4762
+ const isContext = (u) => hasProperty(u, TypeId$67);
4761
4763
  /**
4762
4764
  * Checks whether the provided argument is a `Reference`.
4763
4765
  *
@@ -4814,7 +4816,7 @@ const emptyContext = /*#__PURE__*/ makeUnsafe$9(/*#__PURE__*/ new Map());
4814
4816
  * @category constructors
4815
4817
  * @since 2.0.0
4816
4818
  */
4817
- const make$80 = (key, service) => makeUnsafe$9(/* @__PURE__ */ new Map([[key.key, service]]));
4819
+ const make$82 = (key, service) => makeUnsafe$9(/* @__PURE__ */ new Map([[key.key, service]]));
4818
4820
  /**
4819
4821
  * Adds a service to a given `Context`.
4820
4822
  *
@@ -5372,6 +5374,37 @@ const isFailure$1 = isFailure$2;
5372
5374
  */
5373
5375
  const isSuccess$1 = isSuccess$2;
5374
5376
  /**
5377
+ * Extracts the success value as an `Option`, discarding the failure.
5378
+ *
5379
+ * **When to use**
5380
+ *
5381
+ * Use when you need to extract the success value from a `Result` as an
5382
+ * `Option` and discard failure information.
5383
+ *
5384
+ * **Details**
5385
+ *
5386
+ * - `Success<A>` becomes `Some<A>`
5387
+ * - `Failure<E>` becomes `None`
5388
+ *
5389
+ * **Example** (Extracting the success as an Option)
5390
+ *
5391
+ * ```ts import.meta.vitest
5392
+ * import { Option, Result } from "effect"
5393
+ *
5394
+ * Result.getSuccess(Result.succeed("ok")) // => Option.some("ok")
5395
+ *
5396
+ * Result.getSuccess(Result.fail("err")) // => Option.none()
5397
+ * ```
5398
+ *
5399
+ * @see {@link getFailure} to extract the error instead
5400
+ * @see {@link fromOption} for the reverse conversion
5401
+ *
5402
+ * @stability stable
5403
+ * @category getters
5404
+ * @since 4.0.0
5405
+ */
5406
+ const getSuccess = getSuccess$1;
5407
+ /**
5375
5408
  * Transforms the failure channel of a `Result`, leaving the success channel unchanged.
5376
5409
  *
5377
5410
  * **When to use**
@@ -6655,7 +6688,62 @@ const containsWith = (isEquivalent) => dual(2, (self, a) => {
6655
6688
  * @category predicates
6656
6689
  * @since 2.0.0
6657
6690
  */
6658
- const contains = /*#__PURE__*/ containsWith(/*#__PURE__*/ asEquivalence());
6691
+ const contains$1 = /*#__PURE__*/ containsWith(/*#__PURE__*/ asEquivalence());
6692
+ const hashBucketsAdd = (buckets, value) => {
6693
+ const hash$6 = hash(value);
6694
+ const bucket = buckets.get(hash$6);
6695
+ if (bucket === void 0) {
6696
+ buckets.set(hash$6, [value]);
6697
+ return true;
6698
+ }
6699
+ for (const previous of bucket) if (equals$1(previous, value)) return false;
6700
+ bucket.push(value);
6701
+ return true;
6702
+ };
6703
+ const makeHashBuckets = (values) => {
6704
+ const buckets = /* @__PURE__ */ new Map();
6705
+ for (const value of values) hashBucketsAdd(buckets, value);
6706
+ return buckets;
6707
+ };
6708
+ const hashBucketsHas = (buckets, value) => {
6709
+ const bucket = buckets.get(hash(value));
6710
+ if (bucket === void 0) return false;
6711
+ for (const candidate of bucket) if (equals$1(candidate, value)) return true;
6712
+ return false;
6713
+ };
6714
+ /**
6715
+ * Computes elements in the first array that are not in the second, using
6716
+ * `Equal.asEquivalence()`.
6717
+ *
6718
+ * **When to use**
6719
+ *
6720
+ * Use when you need to keep values from the first array that are absent from
6721
+ * the second and the default `Equal.asEquivalence()` comparison is appropriate.
6722
+ *
6723
+ * **Example** (Computing array differences)
6724
+ *
6725
+ * ```ts import.meta.vitest
6726
+ * import { Array } from "effect"
6727
+ *
6728
+ * Array.difference([1, 2, 3], [2, 3, 4]) // => [1]
6729
+ * ```
6730
+ *
6731
+ * @see {@link differenceWith} — use custom equality
6732
+ * @see {@link union} — elements in either array
6733
+ * @see {@link intersection} — elements in both arrays
6734
+ *
6735
+ * @stability stable
6736
+ * @category set operations
6737
+ * @since 2.0.0
6738
+ */
6739
+ const difference = /*#__PURE__*/ dual(2, (self, that) => {
6740
+ const thatArray = fromIterable$5(that);
6741
+ const selfArray = fromIterable$5(self);
6742
+ if (selfArray.length === 0) return [];
6743
+ if (thatArray.length === 0) return selfArray.filter(() => true);
6744
+ const buckets = makeHashBuckets(thatArray);
6745
+ return selfArray.filter((value) => !hashBucketsHas(buckets, value));
6746
+ });
6659
6747
  /**
6660
6748
  * Creates an empty array.
6661
6749
  *
@@ -6932,7 +7020,7 @@ const makeEquivalence$2 = Array_;
6932
7020
  */
6933
7021
  const join$2 = /*#__PURE__*/ dual(2, (self, sep) => fromIterable$5(self).join(sep));
6934
7022
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Duration.js
6935
- const TypeId$64 = "~effect/Duration";
7023
+ const TypeId$66 = "~effect/Duration";
6936
7024
  const bigint0$3 = /*#__PURE__*/ BigInt(0);
6937
7025
  const bigint1$2 = /*#__PURE__*/ BigInt(1);
6938
7026
  const bigint2 = /*#__PURE__*/ BigInt(2);
@@ -6948,7 +7036,7 @@ const bigintNanosPerDay = /*#__PURE__*/ BigInt(864e11);
6948
7036
  const bigintNanosPerWeek = /*#__PURE__*/ BigInt(6048e11);
6949
7037
  const roundTiesAwayFromZero = (input) => BigInt(Math.sign(input) * Math.round(Math.abs(input)));
6950
7038
  const roundMillisToNanos = (millis) => Number.isInteger(millis) ? BigInt(millis) * bigint1e6 : roundTiesAwayFromZero(millis * 1e6);
6951
- const fromNanosNumber = (nanos) => make$79(Number.isFinite(nanos) ? roundTiesAwayFromZero(nanos) : nanos);
7039
+ const fromNanosNumber = (nanos) => make$81(Number.isFinite(nanos) ? roundTiesAwayFromZero(nanos) : nanos);
6952
7040
  const nanosToUnit = (nanos, divisor) => {
6953
7041
  const value = Number(nanos);
6954
7042
  if (Number.isFinite(value)) return value / divisor;
@@ -6971,9 +7059,9 @@ const divideTiesAwayFromZero = (numerator, denominator) => {
6971
7059
  };
6972
7060
  const fromMillisString = (input, scale) => {
6973
7061
  const millis = Number(input) * scale;
6974
- if (!Number.isFinite(millis)) return make$79(millis);
7062
+ if (!Number.isFinite(millis)) return make$81(millis);
6975
7063
  const nanos = parseNanos(input, BigInt(scale) * bigint1e6);
6976
- return make$79(Number.isInteger(millis) && BigInt(millis) * bigint1e6 === nanos ? millis : nanos);
7064
+ return make$81(Number.isInteger(millis) && BigInt(millis) * bigint1e6 === nanos ? millis : nanos);
6977
7065
  };
6978
7066
  const DURATION_REGEXP = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/;
6979
7067
  /**
@@ -7033,14 +7121,14 @@ const fromInputUnsafe$1 = (input) => {
7033
7121
  }
7034
7122
  case "object": {
7035
7123
  if (input === null) break;
7036
- if (TypeId$64 in input) return input;
7124
+ if (TypeId$66 in input) return input;
7037
7125
  if (Array.isArray(input)) {
7038
7126
  if (input.length !== 2 || !input.every(isNumber)) return invalid$3(input);
7039
7127
  if (Number.isNaN(input[0]) || Number.isNaN(input[1])) return zero$2;
7040
7128
  if (input[0] === -Infinity || input[1] === -Infinity) return negativeInfinity;
7041
7129
  if (input[0] === Infinity || input[1] === Infinity) return infinity;
7042
7130
  const nanos = input[0] * 1e9 + input[1];
7043
- return Number.isFinite(nanos) && Number.isInteger(input[0]) && Number.isInteger(input[1]) ? make$79(BigInt(input[0]) * bigint1e9 + BigInt(input[1])) : fromNanosNumber(nanos);
7131
+ return Number.isFinite(nanos) && Number.isInteger(input[0]) && Number.isInteger(input[1]) ? make$81(BigInt(input[0]) * bigint1e9 + BigInt(input[1])) : fromNanosNumber(nanos);
7044
7132
  }
7045
7133
  const obj = input;
7046
7134
  let millis = 0;
@@ -7051,13 +7139,13 @@ const fromInputUnsafe$1 = (input) => {
7051
7139
  if (obj.seconds) millis += obj.seconds * 1e3;
7052
7140
  if (obj.milliseconds) millis += obj.milliseconds;
7053
7141
  if (!obj.microseconds && !obj.nanoseconds) {
7054
- if (!Number.isFinite(millis)) return make$79(millis);
7142
+ if (!Number.isFinite(millis)) return make$81(millis);
7055
7143
  const exact = sumObjectNanos(obj);
7056
- return exact === void 0 || BigInt(millis) * bigint1e6 === exact ? make$79(millis) : make$79(exact);
7144
+ return exact === void 0 || BigInt(millis) * bigint1e6 === exact ? make$81(millis) : make$81(exact);
7057
7145
  }
7058
7146
  const nanos = millis * 1e6 + (obj.microseconds ?? 0) * 1e3 + (obj.nanoseconds ?? 0);
7059
7147
  const exact = Number.isFinite(nanos) ? sumObjectNanos(obj) : void 0;
7060
- return exact === void 0 ? fromNanosNumber(nanos) : make$79(exact);
7148
+ return exact === void 0 ? fromNanosNumber(nanos) : make$81(exact);
7061
7149
  }
7062
7150
  }
7063
7151
  return invalid$3(input);
@@ -7104,7 +7192,7 @@ const zeroDurationValue = {
7104
7192
  const infinityDurationValue = { _tag: "Infinity" };
7105
7193
  const negativeInfinityDurationValue = { _tag: "NegativeInfinity" };
7106
7194
  const DurationProto = {
7107
- [TypeId$64]: TypeId$64,
7195
+ [TypeId$66]: TypeId$66,
7108
7196
  [symbol$3]() {
7109
7197
  switch (this.value._tag) {
7110
7198
  case "Millis": return hash(roundMillisToNanos(this.value.millis));
@@ -7152,7 +7240,7 @@ const DurationProto = {
7152
7240
  return pipeArguments(this, arguments);
7153
7241
  }
7154
7242
  };
7155
- const make$79 = (input) => {
7243
+ const make$81 = (input) => {
7156
7244
  const duration = Object.create(DurationProto);
7157
7245
  if (typeof input === "number") {
7158
7246
  if (isNaN(input) || input === 0 || Object.is(input, -0)) duration.value = zeroDurationValue;
@@ -7188,7 +7276,7 @@ const make$79 = (input) => {
7188
7276
  * @category guards
7189
7277
  * @since 2.0.0
7190
7278
  */
7191
- const isDuration = (u) => hasProperty(u, TypeId$64);
7279
+ const isDuration = (u) => hasProperty(u, TypeId$66);
7192
7280
  /**
7193
7281
  * Checks whether a Duration is finite (not infinite).
7194
7282
  *
@@ -7275,8 +7363,8 @@ const abs = (self) => {
7275
7363
  switch (self.value._tag) {
7276
7364
  case "Infinity":
7277
7365
  case "NegativeInfinity": return infinity;
7278
- case "Millis": return self.value.millis < 0 ? make$79(-self.value.millis) : self;
7279
- case "Nanos": return self.value.nanos < bigint0$3 ? make$79(-self.value.nanos) : self;
7366
+ case "Millis": return self.value.millis < 0 ? make$81(-self.value.millis) : self;
7367
+ case "Nanos": return self.value.nanos < bigint0$3 ? make$81(-self.value.nanos) : self;
7280
7368
  }
7281
7369
  };
7282
7370
  /**
@@ -7294,7 +7382,7 @@ const abs = (self) => {
7294
7382
  * @category constructors
7295
7383
  * @since 2.0.0
7296
7384
  */
7297
- const zero$2 = /*#__PURE__*/ make$79(0);
7385
+ const zero$2 = /*#__PURE__*/ make$81(0);
7298
7386
  /**
7299
7387
  * A Duration representing infinite time.
7300
7388
  *
@@ -7310,7 +7398,7 @@ const zero$2 = /*#__PURE__*/ make$79(0);
7310
7398
  * @category constructors
7311
7399
  * @since 2.0.0
7312
7400
  */
7313
- const infinity = /*#__PURE__*/ make$79(Infinity);
7401
+ const infinity = /*#__PURE__*/ make$81(Infinity);
7314
7402
  /**
7315
7403
  * A Duration representing negative infinite time.
7316
7404
  *
@@ -7326,7 +7414,7 @@ const infinity = /*#__PURE__*/ make$79(Infinity);
7326
7414
  * @category constructors
7327
7415
  * @since 4.0.0
7328
7416
  */
7329
- const negativeInfinity = /*#__PURE__*/ make$79(-Infinity);
7417
+ const negativeInfinity = /*#__PURE__*/ make$81(-Infinity);
7330
7418
  /**
7331
7419
  * Creates a Duration from nanoseconds.
7332
7420
  *
@@ -7342,7 +7430,7 @@ const negativeInfinity = /*#__PURE__*/ make$79(-Infinity);
7342
7430
  * @category constructors
7343
7431
  * @since 2.0.0
7344
7432
  */
7345
- const nanos = (nanos) => make$79(nanos);
7433
+ const nanos = (nanos) => make$81(nanos);
7346
7434
  /**
7347
7435
  * Creates a Duration from milliseconds.
7348
7436
  *
@@ -7358,7 +7446,7 @@ const nanos = (nanos) => make$79(nanos);
7358
7446
  * @category constructors
7359
7447
  * @since 2.0.0
7360
7448
  */
7361
- const millis = (millis) => make$79(millis);
7449
+ const millis = (millis) => make$81(millis);
7362
7450
  /**
7363
7451
  * Creates a Duration from seconds.
7364
7452
  *
@@ -7374,7 +7462,7 @@ const millis = (millis) => make$79(millis);
7374
7462
  * @category constructors
7375
7463
  * @since 2.0.0
7376
7464
  */
7377
- const seconds = (seconds) => make$79(seconds * 1e3);
7465
+ const seconds = (seconds) => make$81(seconds * 1e3);
7378
7466
  /**
7379
7467
  * Converts a Duration to milliseconds.
7380
7468
  *
@@ -7541,7 +7629,7 @@ const matchPair = /*#__PURE__*/ dual(3, (self, that, options) => {
7541
7629
  * @category instances
7542
7630
  * @since 2.0.0
7543
7631
  */
7544
- const Order$3 = /*#__PURE__*/ make$81((self, that) => matchPair(self, that, {
7632
+ const Order$3 = /*#__PURE__*/ make$83((self, that) => matchPair(self, that, {
7545
7633
  onMillis: (self, that) => self < that ? -1 : self > that ? 1 : 0,
7546
7634
  onNanos: (self, that) => self < that ? -1 : self > that ? 1 : 0,
7547
7635
  onInfinity: (self, that) => {
@@ -7614,8 +7702,8 @@ const max = /*#__PURE__*/ max$1(Order$3);
7614
7702
  * @since 2.0.0
7615
7703
  */
7616
7704
  const sum = /*#__PURE__*/ dual(2, (self, that) => matchPair(self, that, {
7617
- onMillis: (self, that) => make$79(self + that),
7618
- onNanos: (self, that) => make$79(self + that),
7705
+ onMillis: (self, that) => make$81(self + that),
7706
+ onNanos: (self, that) => make$81(self + that),
7619
7707
  onInfinity: (self, that) => {
7620
7708
  const s = self.value._tag;
7621
7709
  const t = that.value._tag;
@@ -7725,11 +7813,11 @@ const parts = (self) => {
7725
7813
  * @category converting
7726
7814
  * @since 2.0.0
7727
7815
  */
7728
- const format$1 = (self) => {
7816
+ const format$3 = (self) => {
7729
7817
  if (self.value._tag === "Infinity") return "Infinity";
7730
7818
  if (self.value._tag === "NegativeInfinity") return "-Infinity";
7731
7819
  if (isZero$1(self)) return "0";
7732
- if (isNegative(self)) return "-" + format$1(abs(self));
7820
+ if (isNegative(self)) return "-" + format$3(abs(self));
7733
7821
  const fragments = parts(self);
7734
7822
  const pieces = [];
7735
7823
  if (fragments.days !== 0) pieces.push(`${fragments.days}d`);
@@ -8439,7 +8527,7 @@ var ParentSpan = class extends (/*#__PURE__*/ Service$1()(ParentSpanKey, { fiber
8439
8527
  * @category constructors
8440
8528
  * @since 2.0.0
8441
8529
  */
8442
- const make$78 = (options) => options;
8530
+ const make$80 = (options) => options;
8443
8531
  /**
8444
8532
  * Creates an `ExternalSpan` from trace and span identifiers, defaulting
8445
8533
  * `sampled` to `true` and annotations to an empty context when they are not
@@ -8619,7 +8707,7 @@ const Tracer = /*#__PURE__*/ Reference(TracerKey, {
8619
8707
  * @category references
8620
8708
  * @since 4.0.0
8621
8709
  */
8622
- const nativeTracer = /*#__PURE__*/ make$78({ span: (options) => new NativeSpan(options) });
8710
+ const nativeTracer = /*#__PURE__*/ make$80({ span: (options) => new NativeSpan(options) });
8623
8711
  /**
8624
8712
  * Default in-memory `Span` implementation used by the native tracer. It
8625
8713
  * generates span and trace identifiers, stores attributes, events, and links,
@@ -9063,7 +9151,7 @@ var FiberImpl = class {
9063
9151
  interruptUnsafe(fiberId, annotations) {
9064
9152
  if (this._exit) return;
9065
9153
  let cause = causeInterrupt(fiberId);
9066
- if (this.cache.stackFrame) cause = causeAnnotate(cause, make$80(StackTraceKey, this.cache.stackFrame));
9154
+ if (this.cache.stackFrame) cause = causeAnnotate(cause, make$82(StackTraceKey, this.cache.stackFrame));
9067
9155
  if (annotations) cause = causeAnnotate(cause, annotations);
9068
9156
  this._interruptedCause = this._interruptedCause ? causeAddInterrupts(this._interruptedCause, cause) : cause;
9069
9157
  if (this.interruptible) {
@@ -10026,7 +10114,7 @@ const delay$1 = /*#__PURE__*/ dual(2, (self, duration) => andThen$1(sleep$2(dura
10026
10114
  /** @internal */
10027
10115
  const timeoutOrElse$1 = /*#__PURE__*/ dual(2, (self, options) => flatMap$4(timeoutOption$1(self, options.duration), (option) => isNone(option) ? options.orElse() : succeed$9(option.value)));
10028
10116
  /** @internal */
10029
- const timeoutErrorFromDuration = (duration) => new TimeoutError(`Operation timed out after '${format$1(duration)}'`);
10117
+ const timeoutErrorFromDuration = (duration) => new TimeoutError(`Operation timed out after '${format$3(duration)}'`);
10030
10118
  /** @internal */
10031
10119
  const timeout$1 = /*#__PURE__*/ dual(2, (self, duration) => {
10032
10120
  const decoded = fromInputUnsafe$1(duration);
@@ -12197,7 +12285,7 @@ const hasInterrupts = exitHasInterrupts;
12197
12285
  */
12198
12286
  const asVoidAll = exitAsVoidAll;
12199
12287
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Deferred.js
12200
- const TypeId$63 = "~effect/Deferred";
12288
+ const TypeId$65 = "~effect/Deferred";
12201
12289
  /**
12202
12290
  * Checks whether a value is a `Deferred`.
12203
12291
  *
@@ -12210,9 +12298,9 @@ const TypeId$63 = "~effect/Deferred";
12210
12298
  * @category guards
12211
12299
  * @since 4.0.0
12212
12300
  */
12213
- const isDeferred = (u) => hasProperty(u, TypeId$63);
12301
+ const isDeferred = (u) => hasProperty(u, TypeId$65);
12214
12302
  const DeferredProto = {
12215
- [TypeId$63]: {
12303
+ [TypeId$65]: {
12216
12304
  _A: identity,
12217
12305
  _E: identity
12218
12306
  },
@@ -12272,7 +12360,7 @@ const makeUnsafe$8 = () => new DeferredImpl();
12272
12360
  * @category constructors
12273
12361
  * @since 2.0.0
12274
12362
  */
12275
- const make$77 = () => sync$2(() => makeUnsafe$8());
12363
+ const make$79 = () => sync$2(() => makeUnsafe$8());
12276
12364
  const _await = (self) => callback$2((resume) => {
12277
12365
  if (self.effect) return resume(self.effect);
12278
12366
  self.resumes ??= [];
@@ -12884,7 +12972,7 @@ const Scope = scopeTag;
12884
12972
  * @category constructors
12885
12973
  * @since 2.0.0
12886
12974
  */
12887
- const make$76 = scopeMake;
12975
+ const make$78 = scopeMake;
12888
12976
  /**
12889
12977
  * Creates a new `Scope` synchronously without wrapping it in an `Effect`.
12890
12978
  * This is useful when you need a scope immediately but should be used with caution
@@ -13188,7 +13276,7 @@ const closeUnsafe = scopeCloseUnsafe;
13188
13276
  */
13189
13277
  const use$1 = scopeUse;
13190
13278
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Layer.js
13191
- const TypeId$62 = "~effect/Layer";
13279
+ const TypeId$64 = "~effect/Layer";
13192
13280
  const MemoMapTypeId = "~effect/Layer/MemoMap";
13193
13281
  const makeMemoMapEntry = (memoMap, layer) => {
13194
13282
  const entry = {
@@ -13210,7 +13298,7 @@ const memoMapObserve = (entry, scope) => {
13210
13298
  return true;
13211
13299
  };
13212
13300
  const LayerProto = {
13213
- [TypeId$62]: {
13301
+ [TypeId$64]: {
13214
13302
  _ROut: identity,
13215
13303
  _E: identity,
13216
13304
  _RIn: identity
@@ -13589,8 +13677,8 @@ const buildWithScope = /*#__PURE__*/ dual(2, (self, scope) => withFiber$1((fiber
13589
13677
  * @since 2.0.0
13590
13678
  */
13591
13679
  const succeed$6 = function() {
13592
- if (arguments.length === 1) return (resource) => succeedContext(make$80(arguments[0], resource));
13593
- return succeedContext(make$80(arguments[0], arguments[1]));
13680
+ if (arguments.length === 1) return (resource) => succeedContext(make$82(arguments[0], resource));
13681
+ return succeedContext(make$82(arguments[0], arguments[1]));
13594
13682
  };
13595
13683
  /**
13596
13684
  * Constructs a layer that provides all services in an already available
@@ -13702,8 +13790,8 @@ const empty$12 = /*#__PURE__*/ succeedContext(/*#__PURE__*/ empty$16());
13702
13790
  * @since 2.0.0
13703
13791
  */
13704
13792
  const sync$1 = function() {
13705
- if (arguments.length === 1) return (evaluate) => syncContext(() => make$80(arguments[0], evaluate()));
13706
- return syncContext(() => make$80(arguments[0], arguments[1]()));
13793
+ if (arguments.length === 1) return (evaluate) => syncContext(() => make$82(arguments[0], evaluate()));
13794
+ return syncContext(() => make$82(arguments[0], arguments[1]()));
13707
13795
  };
13708
13796
  /**
13709
13797
  * Constructs a layer lazily that provides all services in a `Context`.
@@ -13787,7 +13875,7 @@ const effect = function() {
13787
13875
  if (arguments.length === 1) return (effect) => effectImpl(arguments[0], effect);
13788
13876
  return effectImpl(arguments[0], arguments[1]);
13789
13877
  };
13790
- const effectImpl = (service, effect) => effectContext(map$7(effect, (value) => make$80(service, value)));
13878
+ const effectImpl = (service, effect) => effectContext(map$7(effect, (value) => make$82(service, value)));
13791
13879
  /**
13792
13880
  * Constructs a layer from an effect that produces all services in a `Context`.
13793
13881
  *
@@ -14494,11 +14582,11 @@ const currentTimeMillis = currentTimeMillis$1;
14494
14582
  const currentTimeNanos = currentTimeNanos$1;
14495
14583
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/dateTime.js
14496
14584
  /** @internal */
14497
- const TypeId$61 = "~effect/DateTime";
14585
+ const TypeId$63 = "~effect/DateTime";
14498
14586
  /** @internal */
14499
14587
  const TimeZoneTypeId = "~effect/DateTime/TimeZone";
14500
14588
  const Proto$21 = {
14501
- [TypeId$61]: TypeId$61,
14589
+ [TypeId$63]: TypeId$63,
14502
14590
  pipe() {
14503
14591
  return pipeArguments(this, arguments);
14504
14592
  },
@@ -14625,7 +14713,7 @@ const makeZonedProto = (epochMillis, zone, partsUtc) => {
14625
14713
  return self;
14626
14714
  };
14627
14715
  /** @internal */
14628
- const isDateTime$1 = (u) => hasProperty(u, TypeId$61);
14716
+ const isDateTime$1 = (u) => hasProperty(u, TypeId$63);
14629
14717
  /** @internal */
14630
14718
  const isTimeZone = (u) => hasProperty(u, TimeZoneTypeId);
14631
14719
  /** @internal */
@@ -14690,7 +14778,7 @@ const makeZonedUnsafe$1 = (input, options) => {
14690
14778
  return makeZonedFromAdjusted(self.epochMilliseconds, zone, options?.disambiguation ?? "compatible");
14691
14779
  };
14692
14780
  /** @internal */
14693
- const make$75 = /*#__PURE__*/ liftThrowable(makeUnsafe$6);
14781
+ const make$77 = /*#__PURE__*/ liftThrowable(makeUnsafe$6);
14694
14782
  /** @internal */
14695
14783
  const toUtc$1 = (self) => makeUtc(self.epochMilliseconds);
14696
14784
  const validZoneCache = /*#__PURE__*/ new Map();
@@ -15352,7 +15440,7 @@ const matchEffect$1 = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$
15352
15440
  }
15353
15441
  }));
15354
15442
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Schedule.js
15355
- const TypeId$60 = "~effect/Schedule";
15443
+ const TypeId$62 = "~effect/Schedule";
15356
15444
  /**
15357
15445
  * Context reference containing metadata for the currently running schedule step.
15358
15446
  *
@@ -15378,7 +15466,7 @@ const CurrentMetadata = /*#__PURE__*/ Reference("effect/Schedule/CurrentMetadata
15378
15466
  elapsedSincePrevious: 0
15379
15467
  }) });
15380
15468
  const ScheduleProto = {
15381
- [TypeId$60]: {
15469
+ [TypeId$62]: {
15382
15470
  _Out: identity,
15383
15471
  _In: identity,
15384
15472
  _Env: identity
@@ -15408,7 +15496,7 @@ const ScheduleProto = {
15408
15496
  * @category guards
15409
15497
  * @since 2.0.0
15410
15498
  */
15411
- const isSchedule = (u) => hasProperty(u, TypeId$60);
15499
+ const isSchedule = (u) => hasProperty(u, TypeId$62);
15412
15500
  /**
15413
15501
  * Creates a Schedule from a step function that returns a Pull.
15414
15502
  *
@@ -15780,14 +15868,14 @@ const buildFromOptions = (options) => {
15780
15868
  return schedule;
15781
15869
  };
15782
15870
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/MutableHashMap.js
15783
- const TypeId$59 = "~effect/MutableHashMap";
15871
+ const TypeId$61 = "~effect/MutableHashMap";
15784
15872
  const MutableHashMapProto = {
15785
- [TypeId$59]: TypeId$59,
15873
+ [TypeId$61]: TypeId$61,
15786
15874
  [Symbol.iterator]() {
15787
15875
  return this.backing[Symbol.iterator]();
15788
15876
  },
15789
15877
  toString() {
15790
- return `MutableHashMap(${format$2(Array.from(this))})`;
15878
+ return `MutableHashMap(${format$4(Array.from(this))})`;
15791
15879
  },
15792
15880
  toJSON() {
15793
15881
  return {
@@ -15869,7 +15957,7 @@ const empty$11 = () => {
15869
15957
  * @category constructors
15870
15958
  * @since 2.0.0
15871
15959
  */
15872
- const make$74 = (...entries) => fromIterable$4(entries);
15960
+ const make$76 = (...entries) => fromIterable$4(entries);
15873
15961
  /**
15874
15962
  * Creates a MutableHashMap from an iterable collection of key-value pairs.
15875
15963
  *
@@ -21409,7 +21497,7 @@ const Empty$2 = /*#__PURE__*/ Symbol.for("effect/MutableList/Empty");
21409
21497
  * @category constructors
21410
21498
  * @since 2.0.0
21411
21499
  */
21412
- const make$73 = () => ({
21500
+ const make$75 = () => ({
21413
21501
  head: void 0,
21414
21502
  tail: void 0,
21415
21503
  length: 0
@@ -21843,7 +21931,7 @@ const remove$5 = (self, value) => filter$2(self, (v) => v !== value);
21843
21931
  * @stability stable
21844
21932
  * @since 3.8.0
21845
21933
  */
21846
- const TypeId$58 = "~effect/Queue";
21934
+ const TypeId$60 = "~effect/Queue";
21847
21935
  const EnqueueTypeId = "~effect/Queue/Enqueue";
21848
21936
  const DequeueTypeId = "~effect/Queue/Dequeue";
21849
21937
  const variance$1 = {
@@ -21851,7 +21939,7 @@ const variance$1 = {
21851
21939
  _E: identity
21852
21940
  };
21853
21941
  const QueueProto = {
21854
- [TypeId$58]: variance$1,
21942
+ [TypeId$60]: variance$1,
21855
21943
  [EnqueueTypeId]: variance$1,
21856
21944
  [DequeueTypeId]: variance$1,
21857
21945
  ...PipeInspectableProto,
@@ -21906,12 +21994,12 @@ const QueueProto = {
21906
21994
  * @category constructors
21907
21995
  * @since 4.0.0
21908
21996
  */
21909
- const make$72 = (options) => withFiber$1((fiber) => {
21997
+ const make$74 = (options) => withFiber$1((fiber) => {
21910
21998
  const self = Object.create(QueueProto);
21911
21999
  self.dispatcher = fiber.currentDispatcher;
21912
22000
  self.capacity = options?.capacity ?? Number.POSITIVE_INFINITY;
21913
22001
  self.strategy = options?.strategy ?? "suspend";
21914
- self.messages = make$73();
22002
+ self.messages = make$75();
21915
22003
  self.scheduleRunning = false;
21916
22004
  self.state = {
21917
22005
  _tag: "Open",
@@ -21952,7 +22040,7 @@ const make$72 = (options) => withFiber$1((fiber) => {
21952
22040
  * @category constructors
21953
22041
  * @since 2.0.0
21954
22042
  */
21955
- const bounded = (capacity) => make$72({ capacity });
22043
+ const bounded = (capacity) => make$74({ capacity });
21956
22044
  /**
21957
22045
  * Creates a bounded queue with sliding strategy. When the queue reaches capacity,
21958
22046
  * new elements are added and the oldest elements are dropped.
@@ -21989,7 +22077,7 @@ const bounded = (capacity) => make$72({ capacity });
21989
22077
  * @category constructors
21990
22078
  * @since 2.0.0
21991
22079
  */
21992
- const sliding$1 = (capacity) => make$72({
22080
+ const sliding$1 = (capacity) => make$74({
21993
22081
  capacity,
21994
22082
  strategy: "sliding"
21995
22083
  });
@@ -22028,7 +22116,7 @@ const sliding$1 = (capacity) => make$72({
22028
22116
  * @category constructors
22029
22117
  * @since 2.0.0
22030
22118
  */
22031
- const dropping = (capacity) => make$72({
22119
+ const dropping = (capacity) => make$74({
22032
22120
  capacity,
22033
22121
  strategy: "dropping"
22034
22122
  });
@@ -23160,7 +23248,7 @@ const makeUuid = (bytes, randomBytes, format) => {
23160
23248
  * @category constructors
23161
23249
  * @since 4.0.0
23162
23250
  */
23163
- const make$71 = (randomBytes) => {
23251
+ const make$73 = (randomBytes) => {
23164
23252
  const randomBytesChecked = (size) => {
23165
23253
  checkSize(size);
23166
23254
  return randomBytes(size);
@@ -23206,7 +23294,7 @@ const fillRandom = (crypto, size) => {
23206
23294
  * @category layers
23207
23295
  * @since 4.0.0
23208
23296
  */
23209
- const layerWebCrypto$7 = /*#__PURE__*/ effect(SecureRandom, /*#__PURE__*/ WebCrypto.use((crypto) => succeed$5(make$71((size) => fillRandom(crypto, size)))));
23297
+ const layerWebCrypto$7 = /*#__PURE__*/ effect(SecureRandom, /*#__PURE__*/ WebCrypto.use((crypto) => succeed$5(make$73((size) => fillRandom(crypto, size)))));
23210
23298
  /**
23211
23299
  * Synchronously generates `size` cryptographically secure random bytes from
23212
23300
  * `globalThis.crypto`.
@@ -23417,7 +23505,7 @@ var SemaphoreImpl = class {
23417
23505
  * @category constructors
23418
23506
  * @since 4.0.0
23419
23507
  */
23420
- const make$70 = (permits) => sync$2(() => new SemaphoreImpl(permits));
23508
+ const make$72 = (permits) => sync$2(() => new SemaphoreImpl(permits));
23421
23509
  /**
23422
23510
  * Runs an effect with a single permit and releases the permit when the effect
23423
23511
  * completes.
@@ -23454,9 +23542,9 @@ const withPermit = (self, effect) => {
23454
23542
  * @stability stable
23455
23543
  * @since 2.0.0
23456
23544
  */
23457
- const TypeId$57 = "~effect/BigDecimal";
23545
+ const TypeId$59 = "~effect/BigDecimal";
23458
23546
  const BigDecimalProto = {
23459
- [TypeId$57]: TypeId$57,
23547
+ [TypeId$59]: TypeId$59,
23460
23548
  [symbol$3]() {
23461
23549
  const normalized = normalize$1(this);
23462
23550
  return combine$2(string$3(String(normalized.value)), number$5(normalized.scale));
@@ -23465,7 +23553,7 @@ const BigDecimalProto = {
23465
23553
  return isBigDecimal(that) && compare(this, that) === 0;
23466
23554
  },
23467
23555
  toString() {
23468
- return `BigDecimal(${format(this)})`;
23556
+ return `BigDecimal(${format$2(this)})`;
23469
23557
  },
23470
23558
  toJSON() {
23471
23559
  return {
@@ -23504,7 +23592,7 @@ const BigDecimalProto = {
23504
23592
  * @category guards
23505
23593
  * @since 2.0.0
23506
23594
  */
23507
- const isBigDecimal = (u) => hasProperty(u, TypeId$57);
23595
+ const isBigDecimal = (u) => hasProperty(u, TypeId$59);
23508
23596
  /**
23509
23597
  * Creates a `BigDecimal` from a `bigint` value and a safe integer scale.
23510
23598
  *
@@ -23537,7 +23625,7 @@ const isBigDecimal = (u) => hasProperty(u, TypeId$57);
23537
23625
  * @category constructors
23538
23626
  * @since 2.0.0
23539
23627
  */
23540
- const make$69 = (value, scale) => {
23628
+ const make$71 = (value, scale) => {
23541
23629
  if (!Number.isSafeInteger(scale)) throw new RangeError(`Scale must be a safe integer, got ${scale}`);
23542
23630
  const o = Object.create(BigDecimalProto);
23543
23631
  o.value = value;
@@ -23545,7 +23633,7 @@ const make$69 = (value, scale) => {
23545
23633
  return o;
23546
23634
  };
23547
23635
  const makeNormalized = (value, scale) => {
23548
- const o = make$69(value, scale);
23636
+ const o = make$71(value, scale);
23549
23637
  o.normalized = o;
23550
23638
  return o;
23551
23639
  };
@@ -23669,7 +23757,7 @@ const sign = (n) => n.value === bigint0$1 ? 0 : n.value < bigint0$1 ? -1 : 1;
23669
23757
  * @category converting
23670
23758
  * @since 2.0.0
23671
23759
  */
23672
- const format = (n) => {
23760
+ const format$2 = (n) => {
23673
23761
  const normalized = normalize$1(n);
23674
23762
  if (Math.abs(normalized.scale) >= 16) return toExponential(normalized);
23675
23763
  const negative = normalized.value < bigint0$1;
@@ -23979,7 +24067,7 @@ const binaryUnits = [
23979
24067
  const allUnits = [...decimalUnits, .../*#__PURE__*/ binaryUnits.slice(1)];
23980
24068
  const unitsByName = /*#__PURE__*/ new Map(/*#__PURE__*/ allUnits.flatMap((unit) => unit.names.map((name) => [name, unit])));
23981
24069
  const unitsBySymbol = /*#__PURE__*/ new Map(/*#__PURE__*/ allUnits.map((unit) => [unit.symbol, unit]));
23982
- const make$68 = (value) => value;
24070
+ const make$70 = (value) => value;
23983
24071
  /**
23984
24072
  * The byte size containing zero bytes.
23985
24073
  *
@@ -23987,13 +24075,13 @@ const make$68 = (value) => value;
23987
24075
  * @category constants
23988
24076
  * @since 4.0.0
23989
24077
  */
23990
- const zero = /*#__PURE__*/ make$68(bigint0);
24078
+ const zero = /*#__PURE__*/ make$70(bigint0);
23991
24079
  const invalid$2 = (message) => {
23992
24080
  throw new Error(`Invalid ByteSize: ${message}`);
23993
24081
  };
23994
24082
  const fromNumber = (input) => {
23995
24083
  if (!Number.isSafeInteger(input) || input < 0) return invalid$2(`expected a non-negative safe integer, received ${input}`);
23996
- return make$68(BigInt(input));
24084
+ return make$70(BigInt(input));
23997
24085
  };
23998
24086
  const maxSafeInteger = /*#__PURE__*/ BigInt(Number.MAX_SAFE_INTEGER);
23999
24087
  const scaleDecimal = (quantity, factor) => {
@@ -24009,14 +24097,14 @@ const scaleDecimal = (quantity, factor) => {
24009
24097
  const fromQuantity = (quantity, unit) => {
24010
24098
  if (typeof quantity === "bigint") {
24011
24099
  if (quantity < bigint0) return invalid$2(`expected a non-negative quantity, received ${quantity}`);
24012
- return make$68(quantity * unit.factor);
24100
+ return make$70(quantity * unit.factor);
24013
24101
  }
24014
24102
  if (binaryUnits.includes(unit)) {
24015
24103
  const value = quantity * Number(unit.factor);
24016
- if (Number.isSafeInteger(value) && value >= 0) return make$68(BigInt(value));
24104
+ if (Number.isSafeInteger(value) && value >= 0) return make$70(BigInt(value));
24017
24105
  } else {
24018
24106
  const value = scaleDecimal(String(quantity), unit.factor);
24019
- if (value !== void 0 && value <= maxSafeInteger) return make$68(value);
24107
+ if (value !== void 0 && value <= maxSafeInteger) return make$70(value);
24020
24108
  }
24021
24109
  return invalid$2(`expected an exact non-negative safe-integer byte result, received ${quantity} ${unit.symbol}`);
24022
24110
  };
@@ -24042,7 +24130,7 @@ const fromStringUnsafe = (input) => {
24042
24130
  if (unit === void 0) return invalid$2(`unsupported unit ${JSON.stringify(match[2])}`);
24043
24131
  const value = scaleDecimal(match[1], unit.factor);
24044
24132
  if (value === void 0) return invalid$2(`${JSON.stringify(input)} does not represent an integral number of bytes`);
24045
- return make$68(value);
24133
+ return make$70(value);
24046
24134
  };
24047
24135
  /**
24048
24136
  * Decodes a trusted input into a byte size and throws for invalid input.
@@ -24055,7 +24143,7 @@ const fromInputUnsafe = (input) => {
24055
24143
  switch (typeof input) {
24056
24144
  case "bigint":
24057
24145
  if (input < bigint0) return invalid$2(`expected a non-negative bigint, received ${input}`);
24058
- return make$68(input);
24146
+ return make$70(input);
24059
24147
  case "number": return fromNumber(input);
24060
24148
  case "string": return fromStringUnsafe(input);
24061
24149
  }
@@ -24087,7 +24175,7 @@ const unitConstructor = (symbol) => (value) => fromQuantity(value, unitsBySymbol
24087
24175
  */
24088
24176
  const mebibytes = /*#__PURE__*/ unitConstructor("MiB");
24089
24177
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Chunk.js
24090
- const TypeId$56 = "~effect/Chunk";
24178
+ const TypeId$58 = "~effect/Chunk";
24091
24179
  function copy$2(src, srcPos, dest, destPos, len) {
24092
24180
  for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) dest[destPos + i - srcPos] = src[i];
24093
24181
  return dest;
@@ -24115,7 +24203,7 @@ const emptyArray = [];
24115
24203
  * @category instances
24116
24204
  * @since 4.0.0
24117
24205
  */
24118
- const makeEquivalence$1 = (isEquivalent) => make$82((self, that) => {
24206
+ const makeEquivalence$1 = (isEquivalent) => make$84((self, that) => {
24119
24207
  if (self.length !== that.length) return false;
24120
24208
  const as = toReadonlyArray(self);
24121
24209
  const bs = toReadonlyArray(that);
@@ -24124,9 +24212,9 @@ const makeEquivalence$1 = (isEquivalent) => make$82((self, that) => {
24124
24212
  });
24125
24213
  const _equivalence = /*#__PURE__*/ makeEquivalence$1(equals$1);
24126
24214
  const ChunkProto = {
24127
- [TypeId$56]: { _A: (_) => _ },
24215
+ [TypeId$58]: { _A: (_) => _ },
24128
24216
  toString() {
24129
- return `Chunk(${format$2(toReadonlyArray(this))})`;
24217
+ return `Chunk(${format$4(toReadonlyArray(this))})`;
24130
24218
  },
24131
24219
  toJSON() {
24132
24220
  return {
@@ -24210,7 +24298,7 @@ const makeChunk = (backing) => {
24210
24298
  * @category guards
24211
24299
  * @since 2.0.0
24212
24300
  */
24213
- const isChunk = (u) => hasProperty(u, TypeId$56);
24301
+ const isChunk = (u) => hasProperty(u, TypeId$58);
24214
24302
  const _empty = /*#__PURE__*/ makeChunk({ _tag: "IEmpty" });
24215
24303
  const copyToArray = (self, array, initial) => {
24216
24304
  switch (self.backing._tag) {
@@ -24291,7 +24379,7 @@ const toReadonlyArray = toReadonlyArray_;
24291
24379
  * @stability unstable
24292
24380
  * @since 4.0.0
24293
24381
  */
24294
- const TypeId$55 = "~effect/crypto/CryptoError";
24382
+ const TypeId$57 = "~effect/crypto/CryptoError";
24295
24383
  const ReasonTypeId$1 = "~effect/crypto/CryptoError/Reason";
24296
24384
  /**
24297
24385
  * Reason for an argument that the operation rejects before using the key or
@@ -24444,7 +24532,7 @@ var CryptoError = class extends (/*#__PURE__*/ TaggedError$1("CryptoError")) {
24444
24532
  *
24445
24533
  * @since 4.0.0
24446
24534
  */
24447
- [TypeId$55] = TypeId$55;
24535
+ [TypeId$57] = TypeId$57;
24448
24536
  /**
24449
24537
  * The reason's cause, when it has one.
24450
24538
  *
@@ -25279,7 +25367,7 @@ const redactedProto = (typeId, label) => ({
25279
25367
  };
25280
25368
  },
25281
25369
  toString() {
25282
- return format$2(this.toJSON());
25370
+ return format$4(this.toJSON());
25283
25371
  },
25284
25372
  [NodeInspectSymbol]() {
25285
25373
  return this.toJSON();
@@ -25289,7 +25377,7 @@ const redactedProto = (typeId, label) => ({
25289
25377
  * Builds a key. Keys compare by reference: comparing key bytes is not constant
25290
25378
  * time, and structural equality would let secret keys act as `HashMap` keys.
25291
25379
  */
25292
- const make$67 = (proto, algorithm, material) => byReferenceUnsafe(Object.create(proto, {
25380
+ const make$69 = (proto, algorithm, material) => byReferenceUnsafe(Object.create(proto, {
25293
25381
  algorithm: {
25294
25382
  value: algorithm,
25295
25383
  enumerable: true
@@ -25297,7 +25385,7 @@ const make$67 = (proto, algorithm, material) => byReferenceUnsafe(Object.create(
25297
25385
  [MaterialId]: { value: material }
25298
25386
  }));
25299
25387
  /** @internal */
25300
- const makeBytes = (proto, algorithm, bytes) => make$67(proto, algorithm, {
25388
+ const makeBytes = (proto, algorithm, bytes) => make$69(proto, algorithm, {
25301
25389
  _tag: "Bytes",
25302
25390
  bytes
25303
25391
  });
@@ -25360,7 +25448,7 @@ const importedAlgorithm = (algorithm, cryptoKey) => {
25360
25448
  */
25361
25449
  const fromCryptoKey$3 = (module, method, proto, algorithm, cryptoKey, expected) => suspend$2(() => {
25362
25450
  const problem = checkCryptoKey(cryptoKey, expected);
25363
- return problem === void 0 ? succeed$5(make$67(proto, importedAlgorithm(algorithm, cryptoKey), {
25451
+ return problem === void 0 ? succeed$5(make$69(proto, importedAlgorithm(algorithm, cryptoKey), {
25364
25452
  _tag: "CryptoKey",
25365
25453
  cryptoKey
25366
25454
  })) : invalidKey(module, method, problem);
@@ -25373,7 +25461,7 @@ const exportRaw = async (subtle, cryptoKey) => new Uint8Array(await subtle.expor
25373
25461
  *
25374
25462
  * @internal
25375
25463
  */
25376
- const toBytes$5 = (module, key, exportKey) => suspend$2(() => {
25464
+ const toBytes$6 = (module, key, exportKey) => suspend$2(() => {
25377
25465
  const stored = material(key);
25378
25466
  if (stored._tag === "Bytes") return succeed$5(copyBytes(stored.bytes));
25379
25467
  if (!stored.cryptoKey.extractable) return notExtractable(module, "toBytes");
@@ -25437,10 +25525,10 @@ var Aead_exports = /* @__PURE__ */ __exportAll$1({
25437
25525
  key: () => key$3,
25438
25526
  layerWebCrypto: () => layerWebCrypto$6,
25439
25527
  layerWebCryptoWith: () => layerWebCryptoWith$1,
25440
- toBytes: () => toBytes$4,
25528
+ toBytes: () => toBytes$5,
25441
25529
  xchacha20Poly1305: () => xchacha20Poly1305
25442
25530
  });
25443
- const TypeId$54 = "~effect/crypto/Aead/Key";
25531
+ const TypeId$56 = "~effect/crypto/Aead/Key";
25444
25532
  /**
25445
25533
  * AES-128-GCM, with a 16-byte key and a 12-byte nonce.
25446
25534
  *
@@ -25509,7 +25597,7 @@ const xchacha20Poly1305 = {
25509
25597
  nonceLength: 24,
25510
25598
  implementation: /* @__PURE__ */ chachaImplementation(xchacha20Poly1305$1)
25511
25599
  };
25512
- const KeyProto$3 = /*#__PURE__*/ redactedProto(TypeId$54, "Aead.Key");
25600
+ const KeyProto$3 = /*#__PURE__*/ redactedProto(TypeId$56, "Aead.Key");
25513
25601
  /**
25514
25602
  * Checks whether a value is a {@link Key}.
25515
25603
  *
@@ -25517,7 +25605,7 @@ const KeyProto$3 = /*#__PURE__*/ redactedProto(TypeId$54, "Aead.Key");
25517
25605
  * @category guards
25518
25606
  * @since 4.0.0
25519
25607
  */
25520
- const isKey$3 = (u) => hasProperty(u, TypeId$54);
25608
+ const isKey$3 = (u) => hasProperty(u, TypeId$56);
25521
25609
  /**
25522
25610
  * Service that generates keys, encrypts, and decrypts with authentication.
25523
25611
  *
@@ -25706,7 +25794,7 @@ const fromCryptoKey$2 = (algorithm, cryptoKey) => algorithm.implementation !== v
25706
25794
  * @category converting
25707
25795
  * @since 4.0.0
25708
25796
  */
25709
- const toBytes$4 = (key) => toBytes$5("Aead", key, exportRaw);
25797
+ const toBytes$5 = (key) => toBytes$6("Aead", key, exportRaw);
25710
25798
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/crypto/Cipher.js
25711
25799
  /**
25712
25800
  * Unauthenticated encryption with no integrity: compose with `Mac`.
@@ -25746,9 +25834,9 @@ var Cipher_exports = /* @__PURE__ */ __exportAll$1({
25746
25834
  isKey: () => isKey$2,
25747
25835
  key: () => key$2,
25748
25836
  layerWebCrypto: () => layerWebCrypto$5,
25749
- toBytes: () => toBytes$3
25837
+ toBytes: () => toBytes$4
25750
25838
  });
25751
- const TypeId$53 = "~effect/crypto/Cipher/Key";
25839
+ const TypeId$55 = "~effect/crypto/Cipher/Key";
25752
25840
  /**
25753
25841
  * AES-128-CTR, with a 16-byte key.
25754
25842
  *
@@ -25807,7 +25895,7 @@ const aes256Cbc = {
25807
25895
  mode: "AES-CBC",
25808
25896
  keyLength: 32
25809
25897
  };
25810
- const KeyProto$2 = /*#__PURE__*/ redactedProto(TypeId$53, "Cipher.Key");
25898
+ const KeyProto$2 = /*#__PURE__*/ redactedProto(TypeId$55, "Cipher.Key");
25811
25899
  /**
25812
25900
  * Checks whether a value is a {@link Key}.
25813
25901
  *
@@ -25815,7 +25903,7 @@ const KeyProto$2 = /*#__PURE__*/ redactedProto(TypeId$53, "Cipher.Key");
25815
25903
  * @category guards
25816
25904
  * @since 4.0.0
25817
25905
  */
25818
- const isKey$2 = (u) => hasProperty(u, TypeId$53);
25906
+ const isKey$2 = (u) => hasProperty(u, TypeId$55);
25819
25907
  /**
25820
25908
  * Service that generates keys, encrypts, and decrypts without
25821
25909
  * authentication.
@@ -25935,7 +26023,7 @@ const fromCryptoKey$1 = (algorithm, cryptoKey) => fromCryptoKey$3("Cipher", "fro
25935
26023
  * @category converting
25936
26024
  * @since 4.0.0
25937
26025
  */
25938
- const toBytes$3 = (key) => toBytes$5("Cipher", key, exportRaw);
26026
+ const toBytes$4 = (key) => toBytes$6("Cipher", key, exportRaw);
25939
26027
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/crypto/internal/asymmetric.js
25940
26028
  const seedPrefix = (oid) => Uint8Array.of(48, 46, 2, 1, 0, 48, 5, 6, 3, 43, 101, oid, 4, 34, 4, 32);
25941
26029
  /** @internal */
@@ -26001,7 +26089,7 @@ const exportKey = (subtle, cryptoKey, spec, role) => role === "private" ? export
26001
26089
  *
26002
26090
  * @internal
26003
26091
  */
26004
- const toBytes$2 = (family, key) => toBytes$5(family.module, key, (subtle, cryptoKey) => exportKey(subtle, cryptoKey, family.specOf(key.algorithm), family.isPrivateKey(key) ? "private" : "public"));
26092
+ const toBytes$3 = (family, key) => toBytes$6(family.module, key, (subtle, cryptoKey) => exportKey(subtle, cryptoKey, family.specOf(key.algorithm), family.isPrivateKey(key) ? "private" : "public"));
26005
26093
  /**
26006
26094
  * Per-layer caches for imported byte-backed keys.
26007
26095
  *
@@ -26534,9 +26622,9 @@ var Mac_exports = /* @__PURE__ */ __exportAll$1({
26534
26622
  layerWebCrypto: () => layerWebCrypto$3,
26535
26623
  layerWebCryptoWith: () => layerWebCryptoWith,
26536
26624
  timingSafeEqual: () => timingSafeEqual,
26537
- toBytes: () => toBytes$1
26625
+ toBytes: () => toBytes$2
26538
26626
  });
26539
- const TypeId$52 = "~effect/crypto/Mac/Key";
26627
+ const TypeId$54 = "~effect/crypto/Mac/Key";
26540
26628
  /**
26541
26629
  * HMAC with SHA-1, with a 20-byte tag.
26542
26630
  *
@@ -26586,7 +26674,7 @@ const hmacSha512 = {
26586
26674
  name: "hmacSha512",
26587
26675
  hash: sha512
26588
26676
  };
26589
- const KeyProto$1 = /*#__PURE__*/ redactedProto(TypeId$52, "Mac.Key");
26677
+ const KeyProto$1 = /*#__PURE__*/ redactedProto(TypeId$54, "Mac.Key");
26590
26678
  /**
26591
26679
  * Checks whether a value is a {@link Key}.
26592
26680
  *
@@ -26594,7 +26682,7 @@ const KeyProto$1 = /*#__PURE__*/ redactedProto(TypeId$52, "Mac.Key");
26594
26682
  * @category guards
26595
26683
  * @since 4.0.0
26596
26684
  */
26597
- const isKey$1 = (u) => hasProperty(u, TypeId$52);
26685
+ const isKey$1 = (u) => hasProperty(u, TypeId$54);
26598
26686
  const blockSizes = {
26599
26687
  "MD5": 64,
26600
26688
  "SHA-1": 64,
@@ -26761,7 +26849,7 @@ const fromCryptoKey = (algorithm, cryptoKey) => fromCryptoKey$3("Mac", "fromCryp
26761
26849
  * @category converting
26762
26850
  * @since 4.0.0
26763
26851
  */
26764
- const toBytes$1 = (key) => toBytes$5("Mac", key, exportRaw);
26852
+ const toBytes$2 = (key) => toBytes$6("Mac", key, exportRaw);
26765
26853
  /**
26766
26854
  * Compares two byte arrays in constant time.
26767
26855
  *
@@ -26873,7 +26961,7 @@ const family$1 = {
26873
26961
  /** @internal */
26874
26962
  const secretFamily = (algorithm) => "nonceLength" in algorithm ? Aead_exports : "mode" in algorithm ? Cipher_exports : "_tag" in algorithm ? {
26875
26963
  key,
26876
- toBytes
26964
+ toBytes: toBytes$1
26877
26965
  } : Mac_exports;
26878
26966
  const hmacParams = {
26879
26967
  name: "HMAC",
@@ -27003,7 +27091,7 @@ const key = (algorithm, bytes) => fromBytes("KeyWrap", "key", KeyProto, algorith
27003
27091
  * @category converting
27004
27092
  * @since 4.0.0
27005
27093
  */
27006
- const toBytes = (key) => isKey(key) ? toBytes$5("KeyWrap", key, exportRaw) : toBytes$2(family$1, key);
27094
+ const toBytes$1 = (key) => isKey(key) ? toBytes$6("KeyWrap", key, exportRaw) : toBytes$3(family$1, key);
27007
27095
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/crypto/Signature.js
27008
27096
  /**
27009
27097
  * Digital signatures: Ed25519, ECDSA on P-256, P-384 and P-521, RSA-PSS, and
@@ -27349,7 +27437,7 @@ const makeZonedUnsafe = makeZonedUnsafe$1;
27349
27437
  * @category constructors
27350
27438
  * @since 3.6.0
27351
27439
  */
27352
- const make$66 = make$75;
27440
+ const make$68 = make$77;
27353
27441
  /**
27354
27442
  * Converts a `DateTime` to a UTC `DateTime`.
27355
27443
  *
@@ -27929,7 +28017,7 @@ var HashMapImpl = class {
27929
28017
  return toJson(this);
27930
28018
  }
27931
28019
  toString() {
27932
- return `HashMap(${format$2(Array.from(this))})`;
28020
+ return `HashMap(${format$4(Array.from(this))})`;
27933
28021
  }
27934
28022
  toJSON() {
27935
28023
  return {
@@ -28046,7 +28134,7 @@ const HashSetProto = {
28046
28134
  return keys(keyMap(this));
28047
28135
  },
28048
28136
  toString() {
28049
- return `HashSet(${format$2(Array.from(this))})`;
28137
+ return `HashSet(${format$4(Array.from(this))})`;
28050
28138
  },
28051
28139
  toJSON() {
28052
28140
  return {
@@ -28292,7 +28380,7 @@ const filter = /*#__PURE__*/ dual(2, filter$1);
28292
28380
  * @stability unstable
28293
28381
  * @since 4.0.0
28294
28382
  */
28295
- const TypeId$51 = "~effect/http/Cookies";
28383
+ const TypeId$53 = "~effect/http/Cookies";
28296
28384
  /**
28297
28385
  * Returns `true` when a value is a `Cookies` collection.
28298
28386
  *
@@ -28300,7 +28388,7 @@ const TypeId$51 = "~effect/http/Cookies";
28300
28388
  * @category guards
28301
28389
  * @since 4.0.0
28302
28390
  */
28303
- const isCookies = (u) => hasProperty(u, TypeId$51);
28391
+ const isCookies = (u) => hasProperty(u, TypeId$53);
28304
28392
  const CookieTypeId = "~effect/http/Cookies/Cookie";
28305
28393
  const CookieErrorTypeId = "~effect/http/Cookies/CookieError";
28306
28394
  /**
@@ -28354,7 +28442,7 @@ var CookiesError = class CookiesError extends (/*#__PURE__*/ TaggedError$1("Cook
28354
28442
  }
28355
28443
  };
28356
28444
  const Proto$20 = {
28357
- [TypeId$51]: TypeId$51,
28445
+ [TypeId$53]: TypeId$53,
28358
28446
  ...BaseProto,
28359
28447
  toJSON() {
28360
28448
  return {
@@ -28699,7 +28787,7 @@ const value$3 = (self) => {
28699
28787
  * @stability stable
28700
28788
  * @since 3.3.0
28701
28789
  */
28702
- const TypeId$50 = "~effect/Redacted";
28790
+ const TypeId$52 = "~effect/Redacted";
28703
28791
  /**
28704
28792
  * Returns `true` if a value is a `Redacted` wrapper.
28705
28793
  *
@@ -28728,7 +28816,7 @@ const TypeId$50 = "~effect/Redacted";
28728
28816
  * @category guards
28729
28817
  * @since 3.3.0
28730
28818
  */
28731
- const isRedacted = (u) => hasProperty(u, TypeId$50);
28819
+ const isRedacted = (u) => hasProperty(u, TypeId$52);
28732
28820
  /**
28733
28821
  * Creates a `Redacted` wrapper for a sensitive value.
28734
28822
  *
@@ -28756,14 +28844,14 @@ const isRedacted = (u) => hasProperty(u, TypeId$50);
28756
28844
  * @category constructors
28757
28845
  * @since 3.3.0
28758
28846
  */
28759
- const make$65 = (value, options) => {
28847
+ const make$67 = (value, options) => {
28760
28848
  const self = Object.create(Proto$19);
28761
28849
  if (options?.label) self.label = options.label;
28762
28850
  redactedRegistry.set(self, value);
28763
28851
  return self;
28764
28852
  };
28765
28853
  const Proto$19 = {
28766
- [TypeId$50]: { _A: (_) => _ },
28854
+ [TypeId$52]: { _A: (_) => _ },
28767
28855
  label: void 0,
28768
28856
  ...PipeInspectableProto,
28769
28857
  toJSON() {
@@ -28831,7 +28919,7 @@ const value$2 = value$3;
28831
28919
  * @category instances
28832
28920
  * @since 4.0.0
28833
28921
  */
28834
- const makeEquivalence = (isEquivalent) => make$82((x, y) => isEquivalent(value$2(x), value$2(y)));
28922
+ const makeEquivalence = (isEquivalent) => make$84((x, y) => isEquivalent(value$2(x), value$2(y)));
28835
28923
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/Headers.js
28836
28924
  /**
28837
28925
  * Models HTTP headers for the unstable HTTP client and server modules.
@@ -28856,9 +28944,9 @@ const makeEquivalence = (isEquivalent) => make$82((x, y) => isEquivalent(value$2
28856
28944
  * @category type IDs
28857
28945
  * @since 4.0.0
28858
28946
  */
28859
- const TypeId$49 = /*#__PURE__*/ Symbol.for("~effect/http/Headers");
28947
+ const TypeId$51 = /*#__PURE__*/ Symbol.for("~effect/http/Headers");
28860
28948
  const Proto$18 = /*#__PURE__*/ Object.defineProperties(/*#__PURE__*/ Object.create(null), {
28861
- [TypeId$49]: { value: TypeId$49 },
28949
+ [TypeId$51]: { value: TypeId$51 },
28862
28950
  [symbolRedactable]: { value(context) {
28863
28951
  return redact$1(this, get$10(context, CurrentRedactedNames$1));
28864
28952
  } },
@@ -28874,7 +28962,7 @@ const Proto$18 = /*#__PURE__*/ Object.defineProperties(/*#__PURE__*/ Object.crea
28874
28962
  toString: { value: BaseProto.toString },
28875
28963
  [NodeInspectSymbol]: { value: BaseProto[NodeInspectSymbol] }
28876
28964
  });
28877
- const make$64 = (input) => Object.assign(Object.create(Proto$18), input);
28965
+ const make$66 = (input) => Object.assign(Object.create(Proto$18), input);
28878
28966
  /**
28879
28967
  * Provides an `Equivalence` instance that compares `Headers` by header names
28880
28968
  * and string values.
@@ -28951,7 +29039,7 @@ const get$6 = /*#__PURE__*/ dual(2, (self, key) => fromUndefinedOr(self[key.toLo
28951
29039
  * @since 4.0.0
28952
29040
  */
28953
29041
  const set$2 = /*#__PURE__*/ dual(3, (self, key, value) => {
28954
- const out = make$64(self);
29042
+ const out = make$66(self);
28955
29043
  out[key.toLowerCase()] = value;
28956
29044
  return out;
28957
29045
  });
@@ -28966,7 +29054,7 @@ const set$2 = /*#__PURE__*/ dual(3, (self, key, value) => {
28966
29054
  * @category combinators
28967
29055
  * @since 4.0.0
28968
29056
  */
28969
- const setAll$1 = /*#__PURE__*/ dual(2, (self, headers) => make$64({
29057
+ const setAll$1 = /*#__PURE__*/ dual(2, (self, headers) => make$66({
28970
29058
  ...self,
28971
29059
  ...fromInput$1(headers)
28972
29060
  }));
@@ -28982,7 +29070,7 @@ const setAll$1 = /*#__PURE__*/ dual(2, (self, headers) => make$64({
28982
29070
  * @since 4.0.0
28983
29071
  */
28984
29072
  const merge$3 = /*#__PURE__*/ dual(2, (self, headers) => {
28985
- const out = make$64(self);
29073
+ const out = make$66(self);
28986
29074
  Object.assign(out, headers);
28987
29075
  return out;
28988
29076
  });
@@ -28998,7 +29086,7 @@ const merge$3 = /*#__PURE__*/ dual(2, (self, headers) => {
28998
29086
  * @since 4.0.0
28999
29087
  */
29000
29088
  const remove$1 = /*#__PURE__*/ dual(2, (self, key) => {
29001
- const out = make$64(self);
29089
+ const out = make$66(self);
29002
29090
  delete out[key.toLowerCase()];
29003
29091
  return out;
29004
29092
  });
@@ -29018,8 +29106,8 @@ const redact$1 = /*#__PURE__*/ dual(2, (self, key) => {
29018
29106
  const modify = (key) => {
29019
29107
  if (typeof key === "string") {
29020
29108
  const k = key.toLowerCase();
29021
- if (k in self) out[k] = make$65(self[k]);
29022
- } else for (const name in self) if (name.search(key) !== -1) out[name] = make$65(self[name]);
29109
+ if (k in self) out[k] = make$67(self[k]);
29110
+ } else for (const name in self) if (name.search(key) !== -1) out[name] = make$67(self[name]);
29023
29111
  };
29024
29112
  if (Array.isArray(key)) for (let i = 0; i < key.length; i++) modify(key[i]);
29025
29113
  else modify(key);
@@ -29277,7 +29365,7 @@ const toPath = (url) => {
29277
29365
  * @stability unstable
29278
29366
  * @since 4.0.0
29279
29367
  */
29280
- const TypeId$48 = "~effect/http/UrlParams";
29368
+ const TypeId$50 = "~effect/http/UrlParams";
29281
29369
  /**
29282
29370
  * Returns `true` when a value is a `UrlParams` instance.
29283
29371
  *
@@ -29285,10 +29373,10 @@ const TypeId$48 = "~effect/http/UrlParams";
29285
29373
  * @category guards
29286
29374
  * @since 4.0.0
29287
29375
  */
29288
- const isUrlParams = (u) => hasProperty(u, TypeId$48);
29376
+ const isUrlParams = (u) => hasProperty(u, TypeId$50);
29289
29377
  const Proto$17 = {
29290
29378
  ...PipeInspectableProto,
29291
- [TypeId$48]: TypeId$48,
29379
+ [TypeId$50]: TypeId$50,
29292
29380
  [Symbol.iterator]() {
29293
29381
  return this.params[Symbol.iterator]();
29294
29382
  },
@@ -29319,7 +29407,7 @@ const Proto$17 = {
29319
29407
  * @category constructors
29320
29408
  * @since 4.0.0
29321
29409
  */
29322
- const make$63 = (params) => {
29410
+ const make$65 = (params) => {
29323
29411
  const self = Object.create(Proto$17);
29324
29412
  self.params = params;
29325
29413
  return self;
@@ -29345,7 +29433,7 @@ const fromInput = (input) => {
29345
29433
  const [keys, value] = parsed[i];
29346
29434
  out.push([`${keys[0]}[${keys.slice(1).join("][")}]`, value]);
29347
29435
  } else out.push(parsed[i]);
29348
- return make$63(out);
29436
+ return make$65(out);
29349
29437
  };
29350
29438
  const fromInputNested = (input) => {
29351
29439
  const entries = typeof input[Symbol.iterator] === "function" ? fromIterable$5(input) : Object.entries(input);
@@ -29371,7 +29459,7 @@ const coerce = (value) => isRedacted(value) ? value : String(value);
29371
29459
  * @category instances
29372
29460
  * @since 4.0.0
29373
29461
  */
29374
- const Equivalence$1 = /*#__PURE__*/ make$82((a, b) => arrayEquivalence(a.params, b.params));
29462
+ const Equivalence$1 = /*#__PURE__*/ make$84((a, b) => arrayEquivalence(a.params, b.params));
29375
29463
  const arrayEquivalence = /*#__PURE__*/ makeEquivalence$2(/*#__PURE__*/ makeEquivalence$4([/*#__PURE__*/ strictEqual(), /*#__PURE__*/ asEquivalence()]));
29376
29464
  /**
29377
29465
  * An empty `UrlParams` value.
@@ -29380,7 +29468,7 @@ const arrayEquivalence = /*#__PURE__*/ makeEquivalence$2(/*#__PURE__*/ makeEquiv
29380
29468
  * @category constructors
29381
29469
  * @since 4.0.0
29382
29470
  */
29383
- const empty$5 = /*#__PURE__*/ make$63([]);
29471
+ const empty$5 = /*#__PURE__*/ make$65([]);
29384
29472
  /**
29385
29473
  * Sets multiple query parameters from input.
29386
29474
  *
@@ -29401,7 +29489,7 @@ const setAll = /*#__PURE__*/ dual(2, (self, input) => {
29401
29489
  if (keys.has(self.params[i][0])) continue;
29402
29490
  params.push(self.params[i]);
29403
29491
  }
29404
- return make$63(params);
29492
+ return make$65(params);
29405
29493
  });
29406
29494
  /**
29407
29495
  * Serializes `UrlParams` to a URL query string without a leading question mark.
@@ -29429,7 +29517,7 @@ const toString$1 = (input) => new URLSearchParams(fromInput(input).params.map(([
29429
29517
  */
29430
29518
  const redact = /*#__PURE__*/ dual(2, (self, key) => {
29431
29519
  const patterns = Array.isArray(key) ? key : [key];
29432
- return self.params.map(([name, value]) => [name, typeof value === "string" && isRedactedName(name, patterns) ? make$65(value) : value]);
29520
+ return self.params.map(([name, value]) => [name, typeof value === "string" && isRedactedName(name, patterns) ? make$67(value) : value]);
29433
29521
  });
29434
29522
  /**
29435
29523
  * Checks whether a parameter name matches one of the redaction patterns.
@@ -29618,7 +29706,7 @@ const fromOptionExit = (option) => option._tag === "None" ? missingExit : succee
29618
29706
  * @stability stable
29619
29707
  * @since 4.0.0
29620
29708
  */
29621
- const TypeId$47 = "~effect/SchemaIssue/Issue";
29709
+ const TypeId$49 = "~effect/SchemaIssue/Issue";
29622
29710
  /**
29623
29711
  * Returns `true` if the given value is an {@link Issue}.
29624
29712
  *
@@ -29649,7 +29737,7 @@ const TypeId$47 = "~effect/SchemaIssue/Issue";
29649
29737
  * @since 4.0.0
29650
29738
  */
29651
29739
  function isIssue(u) {
29652
- return hasProperty(u, TypeId$47) && u[TypeId$47] === TypeId$47;
29740
+ return hasProperty(u, TypeId$49) && u[TypeId$49] === TypeId$49;
29653
29741
  }
29654
29742
  /**
29655
29743
  * Returns `true` when an issue contains an input reported by the schema parser.
@@ -29685,7 +29773,7 @@ function hasInput(issue) {
29685
29773
  return Object.hasOwn(issue, "input");
29686
29774
  }
29687
29775
  var IssueNodeImpl = class {
29688
- [TypeId$47] = TypeId$47;
29776
+ [TypeId$49] = TypeId$49;
29689
29777
  constructor(input, options) {
29690
29778
  if (options?.reportInput === true && input !== missing) this.input = input;
29691
29779
  }
@@ -30030,7 +30118,7 @@ const defaultLeafHook = (issue) => {
30030
30118
  */
30031
30119
  const defaultCheckHook = (issue) => findMessage(issue) ?? findMessage(issue.issue);
30032
30120
  function formatInput(issue) {
30033
- return hasInput(issue) ? format$2(issue.input) : void 0;
30121
+ return hasInput(issue) ? format$4(issue.input) : void 0;
30034
30122
  }
30035
30123
  function findExpected(issue) {
30036
30124
  const expected = issue.annotations?.expected;
@@ -30942,7 +31030,7 @@ const Middleware = class extends Class$3 {
30942
31030
  return new Middleware(this.encode, this.decode);
30943
31031
  }
30944
31032
  };
30945
- const TypeId$46 = "~effect/SchemaTransformation/Transformation";
31033
+ const TypeId$48 = "~effect/SchemaTransformation/Transformation";
30946
31034
  /**
30947
31035
  * Constructs a bidirectional schema transformation from its decode and encode getters.
30948
31036
  *
@@ -30951,7 +31039,7 @@ const TypeId$46 = "~effect/SchemaTransformation/Transformation";
30951
31039
  * @since 4.0.0
30952
31040
  */
30953
31041
  const Transformation = class extends Class$3 {
30954
- [TypeId$46] = TypeId$46;
31042
+ [TypeId$48] = TypeId$48;
30955
31043
  _tag = "Transformation";
30956
31044
  decode;
30957
31045
  encode;
@@ -30994,7 +31082,7 @@ const Transformation = class extends Class$3 {
30994
31082
  * @since 4.0.0
30995
31083
  */
30996
31084
  function isTransformation(u) {
30997
- return hasProperty(u, TypeId$46) && u[TypeId$46] === TypeId$46;
31085
+ return hasProperty(u, TypeId$48) && u[TypeId$48] === TypeId$48;
30998
31086
  }
30999
31087
  /**
31000
31088
  * Constructs a `Transformation` from an object with `decode` and `encode`
@@ -31250,9 +31338,9 @@ const decodeJsonError = (input) => {
31250
31338
  const encodeUnknownAsJson = (input) => {
31251
31339
  try {
31252
31340
  const json = formatJson(input);
31253
- return json === void 0 ? format$2(input) : JSON.parse(json);
31341
+ return json === void 0 ? format$4(input) : JSON.parse(json);
31254
31342
  } catch {
31255
- return format$2(input);
31343
+ return format$4(input);
31256
31344
  }
31257
31345
  };
31258
31346
  const encodeJsonError = (input, options, encodeDefect) => {
@@ -31539,9 +31627,9 @@ const Context = class {
31539
31627
  this.annotations = annotations;
31540
31628
  }
31541
31629
  };
31542
- const TypeId$45 = "~effect/Schema";
31630
+ const TypeId$47 = "~effect/Schema";
31543
31631
  var ASTNodeImpl = class {
31544
- [TypeId$45] = TypeId$45;
31632
+ [TypeId$47] = TypeId$47;
31545
31633
  annotations;
31546
31634
  checks;
31547
31635
  encoding;
@@ -31892,7 +31980,7 @@ const Literal$1 = class extends ASTNodeImpl {
31892
31980
  literal;
31893
31981
  constructor(literal, annotations, checks, encoding, context) {
31894
31982
  super(annotations, checks, encoding, context);
31895
- if (typeof literal === "number" && !globalThis.Number.isFinite(literal)) throw new Error(`A numeric literal must be finite, got ${format$2(literal)}`);
31983
+ if (typeof literal === "number" && !globalThis.Number.isFinite(literal)) throw new Error(`A numeric literal must be finite, got ${format$4(literal)}`);
31896
31984
  this.literal = literal;
31897
31985
  }
31898
31986
  /** @internal */
@@ -33965,7 +34053,7 @@ function makeOption(schema) {
33965
34053
  * @category constructors
33966
34054
  * @since 4.0.0
33967
34055
  */
33968
- function make$62(schema) {
34056
+ function make$64(schema) {
33969
34057
  return makeConstructorSync(toType$1(schema.ast));
33970
34058
  }
33971
34059
  /**
@@ -34192,12 +34280,12 @@ const normalCompiler = (ast) => resolve(ast).parser;
34192
34280
  const constructorCompiler = (ast) => resolve(ast).makeEffect;
34193
34281
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/schema/make.js
34194
34282
  /** @internal */
34195
- const TypeId$44 = "~effect/Schema/Schema";
34283
+ const TypeId$46 = "~effect/Schema/Schema";
34196
34284
  const RebuildOptions = /*#__PURE__*/ Symbol();
34197
34285
  const SchemaProto = {
34198
- [TypeId$44]: TypeId$44,
34286
+ [TypeId$46]: TypeId$46,
34199
34287
  get make() {
34200
- const value = make$62(this);
34288
+ const value = make$64(this);
34201
34289
  Object.defineProperty(this, "make", {
34202
34290
  value,
34203
34291
  enumerable: true
@@ -34233,11 +34321,11 @@ const SchemaProto = {
34233
34321
  return this.rebuild(appendChecks(this.ast, checks));
34234
34322
  },
34235
34323
  rebuild(ast) {
34236
- return make$61(ast, this[RebuildOptions]);
34324
+ return make$63(ast, this[RebuildOptions]);
34237
34325
  }
34238
34326
  };
34239
34327
  /** @internal */
34240
- function make$61(ast, options) {
34328
+ function make$63(ast, options) {
34241
34329
  function Schema() {}
34242
34330
  const self = Object.setPrototypeOf(Schema, SchemaProto);
34243
34331
  if (options && (Object.hasOwn(options, "name") || Object.hasOwn(options, "length") || Object.hasOwn(options, "__proto__"))) Object.defineProperties(self, Object.getOwnPropertyDescriptors({ ...options }));
@@ -34489,7 +34577,7 @@ const PRE_2020_TO_2020_COLLISIONS = [
34489
34577
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/schema/toCodec.js
34490
34578
  /** @internal */
34491
34579
  function toCodecJson$1(schema) {
34492
- return make$61(toCodecJsonAST(schema.ast), { schema });
34580
+ return make$63(toCodecJsonAST(schema.ast), { schema });
34493
34581
  }
34494
34582
  /** @internal */
34495
34583
  const toCodecJsonAST = /*#__PURE__*/ makeCodecDerivation(toCodecJsonASTStep);
@@ -34533,7 +34621,7 @@ function toCodecJsonASTStep(ast, recur) {
34533
34621
  case "Declaration": {
34534
34622
  const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;
34535
34623
  if (!isFunction(getLink)) return replaceEncoding(ast, [unknownToJson]);
34536
- const link = getLink(ast.typeParameters.map((tp) => make$61(toEncoded$1(tp))));
34624
+ const link = getLink(ast.typeParameters.map((tp) => make$63(toEncoded$1(tp))));
34537
34625
  return link === void 0 ? ast : replaceEncoding(ast, [mapLink(link, recur)]);
34538
34626
  }
34539
34627
  case "Unknown": return replaceEncoding(ast, [unknownToJson]);
@@ -34560,7 +34648,7 @@ function toCodecJsonASTStep(ast, recur) {
34560
34648
  }
34561
34649
  /** @internal */
34562
34650
  function toCodecStringTree$1(schema) {
34563
- return make$61(toCodecStringTreeAST(schema.ast), { schema });
34651
+ return make$63(toCodecStringTreeAST(schema.ast), { schema });
34564
34652
  }
34565
34653
  const toStringTreeReorder = /*#__PURE__*/ makeReorder((ast) => {
34566
34654
  switch (ast._tag) {
@@ -34576,7 +34664,7 @@ const toStringTreeReorder = /*#__PURE__*/ makeReorder((ast) => {
34576
34664
  function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
34577
34665
  switch (ast._tag) {
34578
34666
  case "Declaration": {
34579
- const typeParameters = ast.typeParameters.map((tp) => make$61(recur(toEncoded$1(tp))));
34667
+ const typeParameters = ast.typeParameters.map((tp) => make$63(recur(toEncoded$1(tp))));
34580
34668
  const getStringTreeLink = ast.annotations?.toCodecStringTree;
34581
34669
  if (isFunction(getStringTreeLink)) {
34582
34670
  const link = getStringTreeLink(typeParameters);
@@ -35693,15 +35781,16 @@ const concat$2 = (chunks) => {
35693
35781
  * @category instances
35694
35782
  * @since 4.0.6
35695
35783
  */
35696
- const Order$1 = /*#__PURE__*/ make$81((self, that) => {
35784
+ const Order$1 = /*#__PURE__*/ make$83((self, that) => {
35697
35785
  const length = Math.min(self.length, that.length);
35698
35786
  for (let i = 0; i < length; i++) if (self[i] !== that[i]) return self[i] < that[i] ? -1 : 1;
35699
35787
  return self.length < that.length ? -1 : self.length > that.length ? 1 : 0;
35700
35788
  });
35701
35789
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/net/NetAddress.js
35702
- const TypeId$43 = "~effect/net/NetAddress";
35790
+ const TypeId$45 = "~effect/net/NetAddress";
35703
35791
  const ipv4Value = (self) => self.value;
35704
35792
  const ipv6Words = (self) => self;
35793
+ const getMacBytes = (self) => self.bytes;
35705
35794
  /**
35706
35795
  * A checked network-address operation failure retaining the address or supplied input.
35707
35796
  *
@@ -35717,7 +35806,7 @@ const ipv6Words = (self) => self;
35717
35806
  * @since 4.0.0
35718
35807
  */
35719
35808
  var NetAddressError = class extends (/*#__PURE__*/ TaggedError$1("NetAddressError")) {};
35720
- const isAddress = (u) => hasProperty(u, TypeId$43);
35809
+ const isAddress = (u) => hasProperty(u, TypeId$45);
35721
35810
  /**
35722
35811
  * Returns `true` when a value is an IPv4 address.
35723
35812
  *
@@ -35735,6 +35824,22 @@ const isIpv4Address = (u) => isAddress(u) && u._tag === "Ipv4Address";
35735
35824
  */
35736
35825
  const isIpv6Address = (u) => isAddress(u) && u._tag === "Ipv6Address";
35737
35826
  /**
35827
+ * Returns the bit width of an IP address.
35828
+ *
35829
+ * @stability unstable
35830
+ * @category getters
35831
+ * @since 4.0.0
35832
+ */
35833
+ const width$1 = (address) => isIpv4Address(address) ? 32 : 128;
35834
+ /**
35835
+ * Returns `true` when a value is a MAC address.
35836
+ *
35837
+ * @stability unstable
35838
+ * @category guards
35839
+ * @since 4.0.0
35840
+ */
35841
+ const isMacAddress = (u) => isAddress(u) && u._tag === "MacAddress";
35842
+ /**
35738
35843
  * Returns `true` when a value is a resolved IPv4 internet address.
35739
35844
  *
35740
35845
  * @stability unstable
@@ -35769,7 +35874,7 @@ const isUnixPathAddress = (u) => isAddress(u) && u._tag === "UnixPathAddress";
35769
35874
  const Ipv4Proto = {
35770
35875
  ...BaseProto,
35771
35876
  _tag: "Ipv4Address",
35772
- [TypeId$43]: TypeId$43,
35877
+ [TypeId$45]: TypeId$45,
35773
35878
  [symbol$2](that) {
35774
35879
  return isIpv4Address(that) && ipv4Value(this) === ipv4Value(that);
35775
35880
  },
@@ -35786,7 +35891,7 @@ const Ipv4Proto = {
35786
35891
  const Ipv6Proto = {
35787
35892
  ...BaseProto,
35788
35893
  _tag: "Ipv6Address",
35789
- [TypeId$43]: TypeId$43,
35894
+ [TypeId$45]: TypeId$45,
35790
35895
  [symbol$2](that) {
35791
35896
  if (!isIpv6Address(that)) return false;
35792
35897
  const self = ipv6Words(this);
@@ -35969,6 +36074,38 @@ const ipv6ToSegments = (self) => {
35969
36074
  ];
35970
36075
  };
35971
36076
  /**
36077
+ * Returns the sixteen numeric octets of an IPv6 address in a fresh array.
36078
+ *
36079
+ * @stability unstable
36080
+ * @category getters
36081
+ * @since 4.0.0
36082
+ */
36083
+ const ipv6ToOctets = (self) => {
36084
+ const { w0, w1, w2, w3 } = ipv6Words(self);
36085
+ return [
36086
+ ...wordToOctets(w0),
36087
+ ...wordToOctets(w1),
36088
+ ...wordToOctets(w2),
36089
+ ...wordToOctets(w3)
36090
+ ];
36091
+ };
36092
+ /**
36093
+ * Returns `true` when the MAC address is the all-ones broadcast address.
36094
+ *
36095
+ * @stability unstable
36096
+ * @category predicates
36097
+ * @since 4.0.0
36098
+ */
36099
+ const isMacBroadcast = (self) => getMacBytes(self).every((byte) => byte === 255);
36100
+ /**
36101
+ * Returns `true` when the MAC address has the IEEE group-address bit set.
36102
+ *
36103
+ * @stability unstable
36104
+ * @category predicates
36105
+ * @since 4.0.0
36106
+ */
36107
+ const isMacMulticast = (self) => (getMacBytes(self)[0] & 1) !== 0;
36108
+ /**
35972
36109
  * Formats an IP address in canonical numeric form.
35973
36110
  *
35974
36111
  * @stability unstable
@@ -35995,6 +36132,109 @@ const formatIp = (self) => {
35995
36132
  return `${segments.slice(0, bestStart).map((segment) => segment.toString(16)).join(":")}::${segments.slice(bestStart + bestLength).map((segment) => segment.toString(16)).join(":")}`;
35996
36133
  };
35997
36134
  /**
36135
+ * Returns `true` for the all-zero address of either IP version.
36136
+ *
36137
+ * @stability unstable
36138
+ * @category predicates
36139
+ * @since 4.0.0
36140
+ */
36141
+ const isUnspecified = (self) => {
36142
+ if (isIpv4Address(self)) return ipv4Value(self) === 0;
36143
+ const { w0, w1, w2, w3 } = ipv6Words(self);
36144
+ return w0 === 0 && w1 === 0 && w2 === 0 && w3 === 0;
36145
+ };
36146
+ /**
36147
+ * Returns `true` for IPv4 `127.0.0.0/8` or IPv6 `::1`.
36148
+ *
36149
+ * @stability unstable
36150
+ * @category predicates
36151
+ * @since 4.0.0
36152
+ */
36153
+ const isLoopback = (self) => {
36154
+ if (isIpv4Address(self)) return ipv4Value(self) >>> 24 === 127;
36155
+ const { w0, w1, w2, w3 } = ipv6Words(self);
36156
+ return w0 === 0 && w1 === 0 && w2 === 0 && w3 === 1;
36157
+ };
36158
+ /**
36159
+ * Returns `true` for IPv4 `224.0.0.0/4`, IPv6 `ff00::/8`, or a MAC address with
36160
+ * the IEEE group bit set, refining the value while preserving its address type.
36161
+ *
36162
+ * **Details**
36163
+ *
36164
+ * The MAC all-ones broadcast address has the group bit set and is multicast;
36165
+ * the IPv4 limited broadcast address `255.255.255.255` is not. Use
36166
+ * {@link isMacBroadcast} or {@link isBroadcast} to distinguish broadcast.
36167
+ *
36168
+ * **Example** (Classifying IP and MAC group addresses)
36169
+ *
36170
+ * ```ts import.meta.vitest
36171
+ * import { assert } from "@effect/vitest"
36172
+ * import { NetAddress } from "effect/net"
36173
+ *
36174
+ * const ip = NetAddress.ipFromStringUnsafe("239.255.0.1")
36175
+ * const mac = NetAddress.macAddressFromStringUnsafe("ff:ff:ff:ff:ff:ff")
36176
+ *
36177
+ * assert.isTrue(NetAddress.isMulticast(ip))
36178
+ * assert.isTrue(NetAddress.isMulticast(mac))
36179
+ * assert.isTrue(NetAddress.isBroadcast(mac))
36180
+ * assert.isFalse(NetAddress.isMulticast(NetAddress.ipv4Broadcast))
36181
+ * ```
36182
+ *
36183
+ * @stability unstable
36184
+ * @category predicates
36185
+ * @since 4.0.0
36186
+ */
36187
+ const isMulticast = (self) => {
36188
+ if (isMacAddress(self)) return isMacMulticast(self);
36189
+ if (isIpv4Address(self)) return ipv4Value(self) >>> 28 === 14;
36190
+ return ipv6Words(self).w0 >>> 24 === 255;
36191
+ };
36192
+ /**
36193
+ * Returns `true` for the IPv4 limited broadcast address `255.255.255.255` or
36194
+ * the MAC all-ones broadcast address.
36195
+ *
36196
+ * **Details**
36197
+ *
36198
+ * MAC broadcast is also multicast because its IEEE group bit is set. IPv4
36199
+ * limited broadcast is not multicast. Directed IPv4 broadcast cannot be
36200
+ * determined without a network prefix and is not classified here.
36201
+ *
36202
+ * @stability unstable
36203
+ * @category predicates
36204
+ * @since 4.0.0
36205
+ */
36206
+ const isBroadcast = (self) => isMacAddress(self) ? isMacBroadcast(self) : ipv4Value(self) === 4294967295;
36207
+ /**
36208
+ * Returns `true` for IPv4 `169.254.0.0/16` or IPv6 `fe80::/10`.
36209
+ *
36210
+ * @stability unstable
36211
+ * @category predicates
36212
+ * @since 4.0.0
36213
+ */
36214
+ const isLinkLocal = (self) => {
36215
+ if (isIpv4Address(self)) return ipv4Value(self) >>> 16 === 43518;
36216
+ return (ipv6Words(self).w0 >>> 16 & 65472) === 65152;
36217
+ };
36218
+ /**
36219
+ * Returns `true` for IPv4 private-use ranges defined by RFC 1918.
36220
+ *
36221
+ * @stability unstable
36222
+ * @category predicates
36223
+ * @since 4.0.0
36224
+ */
36225
+ const isPrivate = (self) => {
36226
+ const value = ipv4Value(self);
36227
+ return value >>> 24 === 10 || (value >>> 16 & 65520) === 44048 || value >>> 16 === 49320;
36228
+ };
36229
+ /**
36230
+ * Returns `true` for IPv6 unique-local addresses in `fc00::/7`.
36231
+ *
36232
+ * @stability unstable
36233
+ * @category predicates
36234
+ * @since 4.0.0
36235
+ */
36236
+ const isUniqueLocal = (self) => (ipv6Words(self).w0 >>> 24 & 254) === 252;
36237
+ /**
35998
36238
  * Returns `true` when an IPv6 address is in the `::ffff:0:0/96` mapped range.
35999
36239
  *
36000
36240
  * @stability unstable
@@ -36005,10 +36245,18 @@ const isIpv4Mapped = (self) => {
36005
36245
  const { w0, w1, w2 } = ipv6Words(self);
36006
36246
  return w0 === 0 && w1 === 0 && w2 === 65535;
36007
36247
  };
36248
+ /**
36249
+ * Extracts the IPv4 value from an IPv4-mapped IPv6 address.
36250
+ *
36251
+ * @stability unstable
36252
+ * @category converting
36253
+ * @since 4.0.0
36254
+ */
36255
+ const fromIpv4Mapped = (self) => isIpv4Mapped(self) ? some$1(makeIpv4(ipv6Words(self).w3)) : none();
36008
36256
  const InetV4Proto = {
36009
36257
  ...BaseProto,
36010
36258
  _tag: "InetAddressV4",
36011
- [TypeId$43]: TypeId$43,
36259
+ [TypeId$45]: TypeId$45,
36012
36260
  [symbol$2](that) {
36013
36261
  return isInetAddressV4(that) && this.port === that.port && equals$1(this.address, that.address);
36014
36262
  },
@@ -36025,7 +36273,7 @@ const InetV4Proto = {
36025
36273
  const InetV6Proto = {
36026
36274
  ...BaseProto,
36027
36275
  _tag: "InetAddressV6",
36028
- [TypeId$43]: TypeId$43,
36276
+ [TypeId$45]: TypeId$45,
36029
36277
  [symbol$2](that) {
36030
36278
  return isInetAddressV6(that) && this.port === that.port && this.scopeId === that.scopeId && equals$1(this.address, that.address);
36031
36279
  },
@@ -36193,7 +36441,7 @@ const formatUrlUnsafe = (self, scheme = "http") => getOrThrow(formatUrl(self, sc
36193
36441
  const UnixPathProto = {
36194
36442
  ...BaseProto,
36195
36443
  _tag: "UnixPathAddress",
36196
- [TypeId$43]: TypeId$43,
36444
+ [TypeId$45]: TypeId$45,
36197
36445
  [symbol$2](that) {
36198
36446
  return isUnixPathAddress(that) && this.path === that.path;
36199
36447
  },
@@ -36234,8 +36482,200 @@ const unixPathAddress = (path) => {
36234
36482
  const formatUnixPath = (self) => `unix://${self.path}`;
36235
36483
  ({ ...BaseProto });
36236
36484
  ({ ...BaseProto });
36485
+ // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/net/IpInterface.js
36486
+ /**
36487
+ * IPv4 and IPv6 interface addresses that preserve host bits alongside a prefix length.
36488
+ *
36489
+ * @stability unstable
36490
+ * @since 4.0.0
36491
+ */
36492
+ const TypeId$43 = "~effect/net/IpInterface";
36493
+ /**
36494
+ * Returns `true` when a value is an IP interface address.
36495
+ *
36496
+ * @stability unstable
36497
+ * @category guards
36498
+ * @since 4.0.0
36499
+ */
36500
+ const isIpInterface = (u) => hasProperty(u, TypeId$43);
36501
+ const IpInterfaceProto = {
36502
+ ...BaseProto,
36503
+ _tag: "IpInterface",
36504
+ [TypeId$43]: TypeId$43,
36505
+ [symbol$2](that) {
36506
+ return isIpInterface(that) && this.prefixLength === that.prefixLength && equals$1(this.address, that.address);
36507
+ },
36508
+ [symbol$3]() {
36509
+ return combine$2(hash(this.address), number$5(this.prefixLength));
36510
+ },
36511
+ toString() {
36512
+ return format$1(this);
36513
+ },
36514
+ toJSON() {
36515
+ return this.toString();
36516
+ }
36517
+ };
36518
+ const interfaceError = (input, message) => fail$11(new NetAddressError({
36519
+ input,
36520
+ message
36521
+ }));
36522
+ /**
36523
+ * Creates an interface address while preserving all address bits.
36524
+ *
36525
+ * @stability unstable
36526
+ * @category constructors
36527
+ * @since 4.0.0
36528
+ */
36529
+ const make$62 = (address, prefixLength) => {
36530
+ const max = width$1(address);
36531
+ if (!Number.isInteger(prefixLength) || prefixLength < 0 || prefixLength > max) return interfaceError(address, `prefix length must be an integer from 0 through ${max}`);
36532
+ const self = Object.assign(Object.create(IpInterfaceProto), {
36533
+ address,
36534
+ prefixLength
36535
+ });
36536
+ return succeed$10(Object.freeze(self));
36537
+ };
36538
+ const parseAddressWithPrefix = (input, options) => {
36539
+ const slash = input.indexOf("/");
36540
+ if (slash === -1 && options?.prefix !== "required") return succeed$10({
36541
+ address: input,
36542
+ prefixLength: void 0
36543
+ });
36544
+ if (slash <= 0 || slash !== input.lastIndexOf("/") || slash === input.length - 1) return interfaceError(input, "expected an address and prefix length separated by one slash");
36545
+ const prefix = input.slice(slash + 1);
36546
+ if (!/^(0|[1-9][0-9]*)$/.test(prefix)) return interfaceError(input, "prefix length must be an unpadded ASCII decimal integer");
36547
+ return succeed$10({
36548
+ address: input.slice(0, slash),
36549
+ prefixLength: Number(prefix)
36550
+ });
36551
+ };
36552
+ /**
36553
+ * Parses an IP interface address while preserving host bits.
36554
+ *
36555
+ * **Details**
36556
+ *
36557
+ * A missing prefix defaults to the address width. Use `prefix: "required"` to
36558
+ * require one.
36559
+ *
36560
+ * @stability unstable
36561
+ * @category decoding
36562
+ * @since 4.0.0
36563
+ */
36564
+ const fromString$2 = (input, options) => flatMap$6(parseAddressWithPrefix(input, options), (parts) => flatMap$6(ipFromString(parts.address), (address) => make$62(address, parts.prefixLength ?? width$1(address))));
36565
+ /**
36566
+ * Formats an interface address using canonical address text and its decimal prefix length.
36567
+ *
36568
+ * @stability unstable
36569
+ * @category encoding
36570
+ * @since 4.0.0
36571
+ */
36572
+ const format$1 = (self) => `${formatIp(self.address)}/${self.prefixLength}`;
36573
+ // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/net/IpNetwork.js
36574
+ /**
36575
+ * Pure, canonical IPv4 and IPv6 network prefixes using CIDR notation.
36576
+ *
36577
+ * @stability unstable
36578
+ * @since 4.0.0
36579
+ */
36580
+ const TypeId$42 = "~effect/net/IpNetwork";
36581
+ /**
36582
+ * Returns `true` when a value is an IPv4 or IPv6 network prefix.
36583
+ *
36584
+ * @stability unstable
36585
+ * @category guards
36586
+ * @since 4.0.0
36587
+ */
36588
+ const isIpNetwork = (u) => hasProperty(u, TypeId$42);
36589
+ const IpNetworkProto = {
36590
+ ...BaseProto,
36591
+ _tag: "IpNetwork",
36592
+ [TypeId$42]: TypeId$42,
36593
+ [symbol$2](that) {
36594
+ return isIpNetwork(that) && this.prefixLength === that.prefixLength && equals$1(this.address, that.address);
36595
+ },
36596
+ [symbol$3]() {
36597
+ return combine$2(hash(this.address), number$5(this.prefixLength));
36598
+ },
36599
+ toString() {
36600
+ return format(this);
36601
+ },
36602
+ toJSON() {
36603
+ return this.toString();
36604
+ }
36605
+ };
36606
+ const fromInterfaceValue = (value) => {
36607
+ const self = Object.assign(Object.create(IpNetworkProto), {
36608
+ address: value.address,
36609
+ prefixLength: value.prefixLength
36610
+ });
36611
+ return Object.freeze(self);
36612
+ };
36613
+ const toBytes = (address) => isIpv4Address(address) ? ipv4ToOctets(address) : ipv6ToOctets(address);
36614
+ const maskBytes = (bytes, prefixLength) => {
36615
+ const wholeBytes = Math.floor(prefixLength / 8);
36616
+ const partialBits = prefixLength % 8;
36617
+ return bytes.map((byte, index) => {
36618
+ if (index < wholeBytes) return byte;
36619
+ if (index === wholeBytes && partialBits !== 0) return byte & (255 << 8 - partialBits & 255);
36620
+ return 0;
36621
+ });
36622
+ };
36623
+ /**
36624
+ * Creates a network prefix when the address has no host bits set.
36625
+ *
36626
+ * **Gotchas**
36627
+ *
36628
+ * Use {@link fromAddress} when a host address should be truncated to its containing network.
36629
+ *
36630
+ * @stability unstable
36631
+ * @category constructors
36632
+ * @since 4.0.0
36633
+ */
36634
+ const make$61 = (address, prefixLength) => {
36635
+ return flatMap$6(make$62(address, prefixLength), (value) => {
36636
+ const bytes = toBytes(address);
36637
+ const masked = maskBytes(bytes, prefixLength);
36638
+ if (bytes.some((byte, index) => byte !== masked[index])) return fail$11(new NetAddressError({
36639
+ input: address,
36640
+ message: "address has non-zero host bits"
36641
+ }));
36642
+ return succeed$10(fromInterfaceValue(value));
36643
+ });
36644
+ };
36645
+ /**
36646
+ * Parses a strict IPv4 or IPv6 network prefix in CIDR notation.
36647
+ *
36648
+ * @stability unstable
36649
+ * @category decoding
36650
+ * @since 4.0.0
36651
+ */
36652
+ const fromString$1 = (input) => {
36653
+ return flatMap$6(fromString$2(input, { prefix: "required" }), (value) => make$61(value.address, value.prefixLength));
36654
+ };
36655
+ /**
36656
+ * Formats a network prefix using canonical address text and its decimal prefix length.
36657
+ *
36658
+ * @stability unstable
36659
+ * @category encoding
36660
+ * @since 4.0.0
36661
+ */
36662
+ const format = (self) => `${formatIp(self.address)}/${self.prefixLength}`;
36663
+ const containsBytes = (self, address) => {
36664
+ if (isIpv4Address(self.address) !== isIpv4Address(address)) return false;
36665
+ const expected = toBytes(self.address);
36666
+ const actual = maskBytes(toBytes(address), self.prefixLength);
36667
+ return expected.every((byte, index) => byte === actual[index]);
36668
+ };
36669
+ /**
36670
+ * Returns `true` when a network prefix contains an IP address.
36671
+ *
36672
+ * @stability unstable
36673
+ * @category predicates
36674
+ * @since 4.0.0
36675
+ */
36676
+ const contains = /*#__PURE__*/ dual(2, containsBytes);
36237
36677
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Schema.js
36238
- const TypeId$41 = TypeId$44;
36678
+ const TypeId$41 = TypeId$46;
36239
36679
  /**
36240
36680
  * Creates a schema for a **parametric** type (a generic container such as
36241
36681
  * `Array<A>`, `Option<A>`, etc.) by accepting a list of type-parameter schemas
@@ -36772,7 +37212,7 @@ const encodeSync = encodeUnknownSync$1;
36772
37212
  * @category constructors
36773
37213
  * @since 3.10.0
36774
37214
  */
36775
- const make$60 = make$61;
37215
+ const make$60 = make$63;
36776
37216
  /**
36777
37217
  * Checks whether a value is a `Schema`.
36778
37218
  *
@@ -37876,7 +38316,7 @@ function isPattern(regExp, annotations) {
37876
38316
  const source = regExp.source;
37877
38317
  const flags = regExp.flags;
37878
38318
  const canExport = /^[dg]*uy?$/.test(flags);
37879
- const runtimeRegExp = flags === "" ? `new globalThis.RegExp(${format$2(source)})` : `new globalThis.RegExp(${format$2(source)}, ${format$2(flags)})`;
38319
+ const runtimeRegExp = flags === "" ? `new globalThis.RegExp(${format$4(source)})` : `new globalThis.RegExp(${format$4(source)}, ${format$4(flags)})`;
37880
38320
  return isPattern$1(regExp, {
37881
38321
  toJsonSchema: () => canExport ? { pattern: flags.endsWith("y") ? `^(?:${source})` : source } : [{}, true],
37882
38322
  toCode: () => ({ runtime: `Schema.isPattern(${runtimeRegExp})` }),
@@ -37901,7 +38341,7 @@ const Finite = /*#__PURE__*/ make$60(finite);
37901
38341
  */
37902
38342
  function makeIsGreaterThan(options) {
37903
38343
  const gt = isGreaterThan$1(options.order);
37904
- const formatter = options.formatter ?? format$2;
38344
+ const formatter = options.formatter ?? format$4;
37905
38345
  return (exclusiveMinimum, annotations) => {
37906
38346
  return makeFilter((input) => gt(input, exclusiveMinimum), {
37907
38347
  expected: `a value greater than ${formatter(exclusiveMinimum)}`,
@@ -37925,7 +38365,7 @@ function makeIsGreaterThan(options) {
37925
38365
  */
37926
38366
  function makeIsGreaterThanOrEqualTo(options) {
37927
38367
  const gte = isGreaterThanOrEqualTo$2(options.order);
37928
- const formatter = options.formatter ?? format$2;
38368
+ const formatter = options.formatter ?? format$4;
37929
38369
  return (minimum, annotations) => {
37930
38370
  return makeFilter((input) => gte(input, minimum), {
37931
38371
  expected: `a value greater than or equal to ${formatter(minimum)}`,
@@ -37951,7 +38391,7 @@ function makeIsBetween(deriveOptions) {
37951
38391
  const greaterThan = isGreaterThan$1(deriveOptions.order);
37952
38392
  const lessThanOrEqualTo = isLessThanOrEqualTo$1(deriveOptions.order);
37953
38393
  const lessThan = isLessThan$1(deriveOptions.order);
37954
- const formatter = deriveOptions.formatter ?? format$2;
38394
+ const formatter = deriveOptions.formatter ?? format$4;
37955
38395
  return (options, annotations) => {
37956
38396
  const gte = options.exclusiveMinimum ? greaterThan : greaterThanOrEqualTo;
37957
38397
  const lte = options.exclusiveMaximum ? lessThan : lessThanOrEqualTo;
@@ -37970,7 +38410,7 @@ function makeIsBetween(deriveOptions) {
37970
38410
  };
37971
38411
  }
37972
38412
  function encodeNumberPayload(number) {
37973
- if (!globalThis.Number.isFinite(number)) throw new globalThis.RangeError(`Expected a finite number, got ${format$2(number)}`);
38413
+ if (!globalThis.Number.isFinite(number)) throw new globalThis.RangeError(`Expected a finite number, got ${format$4(number)}`);
37974
38414
  return number;
37975
38415
  }
37976
38416
  /**
@@ -38000,7 +38440,7 @@ const isGreaterThan = /*#__PURE__*/ makeIsGreaterThan({
38000
38440
  payload: { exclusiveMinimum: encodeNumberPayload(exclusiveMinimum) }
38001
38441
  },
38002
38442
  toJsonSchema: () => ({ exclusiveMinimum }),
38003
- toCode: () => ({ runtime: `Schema.isGreaterThan(${format$2(exclusiveMinimum)})` })
38443
+ toCode: () => ({ runtime: `Schema.isGreaterThan(${format$4(exclusiveMinimum)})` })
38004
38444
  })
38005
38445
  });
38006
38446
  /**
@@ -38030,7 +38470,7 @@ const isGreaterThanOrEqualTo$1 = /*#__PURE__*/ makeIsGreaterThanOrEqualTo({
38030
38470
  payload: { minimum: encodeNumberPayload(minimum) }
38031
38471
  },
38032
38472
  toJsonSchema: () => ({ minimum }),
38033
- toCode: () => ({ runtime: `Schema.isGreaterThanOrEqualTo(${format$2(minimum)})` })
38473
+ toCode: () => ({ runtime: `Schema.isGreaterThanOrEqualTo(${format$4(minimum)})` })
38034
38474
  })
38035
38475
  });
38036
38476
  /**
@@ -38074,7 +38514,7 @@ const isBetween = /*#__PURE__*/ makeIsBetween({
38074
38514
  [exclusiveMinimum ? "exclusiveMinimum" : "minimum"]: options.minimum,
38075
38515
  [exclusiveMaximum ? "exclusiveMaximum" : "maximum"]: options.maximum
38076
38516
  }),
38077
- toCode: () => ({ runtime: `Schema.isBetween({ minimum: ${format$2(options.minimum)}, maximum: ${format$2(options.maximum)}, exclusiveMinimum: ${format$2(exclusiveMinimum)}, exclusiveMaximum: ${format$2(exclusiveMaximum)} })` })
38517
+ toCode: () => ({ runtime: `Schema.isBetween({ minimum: ${format$4(options.minimum)}, maximum: ${format$4(options.maximum)}, exclusiveMinimum: ${format$4(exclusiveMinimum)}, exclusiveMaximum: ${format$4(exclusiveMaximum)} })` })
38078
38518
  };
38079
38519
  }
38080
38520
  });
@@ -38559,7 +38999,7 @@ function Cause(error, defect) {
38559
38999
  }
38560
39000
  const dateTimeUtcFromString = /*#__PURE__*/ transformEffect({
38561
39001
  decode: (s, options) => {
38562
- return match$8(make$66(s), {
39002
+ return match$8(make$68(s), {
38563
39003
  onNone: () => fail$6(new InvalidValue$1({ expected: "a valid UTC DateTime string" }, s, options)),
38564
39004
  onSome: (result) => succeed$5(toUtc(result))
38565
39005
  });
@@ -38787,7 +39227,7 @@ function Redacted(value, options) {
38787
39227
  if (isRedacted(input)) {
38788
39228
  const label = decodeLabel !== void 0 ? mapErrorEager(decodeLabel(input.label, poptions), (issue) => new Pointer(["label"], issue)) : void_$1;
38789
39229
  return flatMapEager(label, () => mapBothEager(decodeUnknownEffect$1(value)(value$2(input), poptions), {
38790
- onSuccess: (value) => make$65(value, { label: input.label }),
39230
+ onSuccess: (value) => make$67(value, { label: input.label }),
38791
39231
  onFailure: () => {
38792
39232
  return new Composite(ast, [new Pointer(["value"], new InvalidValue$1(void 0, input, poptions))], input, poptions);
38793
39233
  }
@@ -38800,13 +39240,13 @@ function Redacted(value, options) {
38800
39240
  payload: normalizedOptions ?? null
38801
39241
  },
38802
39242
  toCode: ({ typeParameters }) => ({
38803
- runtime: normalizedOptions !== void 0 ? `Schema.Redacted(${typeParameters[0].runtime}, ${format$2(normalizedOptions)})` : `Schema.Redacted(${typeParameters[0].runtime})`,
39243
+ runtime: normalizedOptions !== void 0 ? `Schema.Redacted(${typeParameters[0].runtime}, ${format$4(normalizedOptions)})` : `Schema.Redacted(${typeParameters[0].runtime})`,
38804
39244
  Type: `Redacted.Redacted<${typeParameters[0].Type}>`,
38805
39245
  importDeclarations: [`import * as Redacted from "effect/Redacted"`]
38806
39246
  }),
38807
39247
  expected: "Redacted",
38808
39248
  toCodecJson: ([value]) => link$1()(value, {
38809
- decode: transform$3((e) => make$65(e, { label })),
39249
+ decode: transform$3((e) => make$67(e, { label })),
38810
39250
  encode: disallowJsonEncode ? forbidden((oe) => "Cannot serialize Redacted" + (isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : transform$3(value$2)
38811
39251
  }),
38812
39252
  toEquivalence: ([value]) => makeEquivalence(value)
@@ -39006,7 +39446,7 @@ function isStruct(schema) {
39006
39446
  const Class = (identifier) => (schema, annotations) => {
39007
39447
  const struct = isStruct(schema) ? schema : Struct(schema);
39008
39448
  return makeClass(Class$1, identifier, struct, annotations, (identifier) => ({ toString() {
39009
- return `${identifier}(${format$2({ ...this })})`;
39449
+ return `${identifier}(${format$4({ ...this })})`;
39010
39450
  } }));
39011
39451
  };
39012
39452
  /**
@@ -39342,7 +39782,7 @@ const TypeId$40 = "~effect/Cache";
39342
39782
  const makeWith$2 = (lookup, options) => contextWith$1((context) => {
39343
39783
  const self = Object.create(Proto$16);
39344
39784
  self.lookup = (key) => updateContext$1(lookup(key), (input) => merge$5(context, input));
39345
- self.map = make$74();
39785
+ self.map = make$76();
39346
39786
  self.capacity = options.capacity;
39347
39787
  self.timeToLive = options.timeToLive ? (exit, key) => fromInputUnsafe$1(options.timeToLive(exit, key)) : defaultTimeToLive;
39348
39788
  return succeed$9(self);
@@ -40419,7 +40859,7 @@ const removeSubscribers = (subscribers, subscription, pollers) => {
40419
40859
  set.delete(pollers);
40420
40860
  if (set.size === 0) subscribers.delete(subscription);
40421
40861
  };
40422
- const makeSubscriptionUnsafe = (pubsub, subscribers, strategy, ended) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(), make$73(), makeUnsafe$3(false), make$57(false), strategy, pubsub.replayWindow(), ended);
40862
+ const makeSubscriptionUnsafe = (pubsub, subscribers, strategy, ended) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(), make$75(), makeUnsafe$3(false), make$57(false), strategy, pubsub.replayWindow(), ended);
40423
40863
  var BoundedPubSubArb = class {
40424
40864
  array;
40425
40865
  replayIndices;
@@ -41462,7 +41902,7 @@ const fromTransformBracket = (f) => fromTransform$1(fnUntraced(function* (upstre
41462
41902
  * @since 4.0.0
41463
41903
  */
41464
41904
  const toTransform = (channel) => channel.transform;
41465
- const asyncQueue = (scope, f, options) => make$72({
41905
+ const asyncQueue = (scope, f, options) => make$74({
41466
41906
  capacity: options?.bufferSize,
41467
41907
  strategy: options?.strategy
41468
41908
  }).pipe(tap$1((queue) => addFinalizer$1(scope, shutdown(queue))), tap$1((queue) => provide$3(f(queue), scope).pipe(catchCause$2((cause) => failCause$2(queue, cause)), forkIn(scope, { startImmediately: true }))));
@@ -46511,7 +46951,7 @@ function describeUnknown(u, preserveEmptyStrings) {
46511
46951
  if (typeof u === "number" || typeof u === "boolean" || typeof u === "bigint") return makeValue(String(u));
46512
46952
  if (Array.isArray(u)) return makeArray(u.length);
46513
46953
  if (isObject$3(u)) return makeRecord(new Set(Object.keys(u)));
46514
- return makeValue(format$2(u));
46954
+ return makeValue(format$4(u));
46515
46955
  }
46516
46956
  function stringNode(value, preserveEmptyStrings) {
46517
46957
  const normalized = emptyStringAsMissing(value, preserveEmptyStrings);
@@ -49884,7 +50324,7 @@ var RateLimitError = class extends (/*#__PURE__*/ Error$1("effect/ai/AiError/Rat
49884
50324
  }
49885
50325
  get message() {
49886
50326
  let msg = "Rate limit exceeded";
49887
- if (this.retryAfter) msg += `. Retry after ${format$1(this.retryAfter)}`;
50327
+ if (this.retryAfter) msg += `. Retry after ${format$3(this.retryAfter)}`;
49888
50328
  return msg;
49889
50329
  }
49890
50330
  };
@@ -51531,7 +51971,7 @@ const FailureOrigin = /*#__PURE__*/ Reference("effect/ai/Toolkit/FailureOrigin",
51531
51971
  * @since 4.1.0
51532
51972
  */
51533
51973
  const PreliminaryBuffer = /*#__PURE__*/ Reference("effect/ai/Toolkit/PreliminaryBuffer", { defaultValue: () => "unbounded" });
51534
- const failureCause = (error, origin) => annotate$2(fail$9(error), make$80(FailureOrigin, origin));
51974
+ const failureCause = (error, origin) => annotate$2(fail$9(error), make$82(FailureOrigin, origin));
51535
51975
  const failureOrigin = (error) => isSchemaError(error) ? "result" : "handler";
51536
51976
  const Proto$10 = {
51537
51977
  .../*#__PURE__*/ Prototype({
@@ -51606,7 +52046,7 @@ const Proto$10 = {
51606
52046
  const decodedParams = decodedParamsResult.success;
51607
52047
  const capacity = yield* PreliminaryBuffer;
51608
52048
  if (capacity !== "unbounded" && !(Number.isInteger(capacity) && capacity > 0)) return yield* die$2(`Tool "${name}": PreliminaryBuffer must be a positive integer, got ${capacity}`);
51609
- const queue = yield* make$72(capacity === "unbounded" ? void 0 : { capacity });
52049
+ const queue = yield* make$74(capacity === "unbounded" ? void 0 : { capacity });
51610
52050
  const context = {
51611
52051
  toolCallId,
51612
52052
  preliminary: (result) => asVoid(offer(queue, {
@@ -51637,7 +52077,7 @@ const Proto$10 = {
51637
52077
  reason: error
51638
52078
  }) : error;
51639
52079
  };
51640
- return fromQueue(queue).pipe(tool.failureMode === "error" ? catchCause((cause) => failCause(map$6(fromReasons(cause.reasons.map((reason) => isFailReason(reason) ? reason.annotate(make$80(FailureOrigin, failureOrigin(reason.error)), { overwrite: true }) : reason)), normalizeError))) : catch_((error) => succeed$2({
52080
+ return fromQueue(queue).pipe(tool.failureMode === "error" ? catchCause((cause) => failCause(map$6(fromReasons(cause.reasons.map((reason) => isFailReason(reason) ? reason.annotate(make$82(FailureOrigin, failureOrigin(reason.error)), { overwrite: true }) : reason)), normalizeError))) : catch_((error) => succeed$2({
51641
52081
  result: normalizeError(error),
51642
52082
  isFailure: true,
51643
52083
  failureOrigin: failureOrigin(error),
@@ -51763,7 +52203,7 @@ var Proto$9 = class {
51763
52203
  return this.toJSON();
51764
52204
  }
51765
52205
  toString() {
51766
- return format$2(this, { ignoreToString: true });
52206
+ return format$4(this, { ignoreToString: true });
51767
52207
  }
51768
52208
  };
51769
52209
  /**
@@ -52330,6 +52770,17 @@ const updateContentLength = (headers, body) => {
52330
52770
  };
52331
52771
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/Url.js
52332
52772
  /**
52773
+ * Parses and edits platform `URL` values.
52774
+ *
52775
+ * The HTTP modules use the standard `URL` object as their URL representation.
52776
+ * This module adds safe parsing and helpers that return updated copies when
52777
+ * changing credentials, host, path, protocol, query, or hash parts. Query
52778
+ * strings can also be read or updated through `UrlParams`.
52779
+ *
52780
+ * @stability unstable
52781
+ * @since 4.0.0
52782
+ */
52783
+ /**
52333
52784
  * Error returned when constructing a `URL` fails.
52334
52785
  *
52335
52786
  * @stability unstable
@@ -52370,6 +52821,51 @@ const baseUrl = () => {
52370
52821
  }
52371
52822
  }
52372
52823
  };
52824
+ /**
52825
+ * Parses a URL string safely into a `URL` object, returning a `Result` type for
52826
+ * error handling.
52827
+ *
52828
+ * **Details**
52829
+ *
52830
+ * This function converts a string into a `URL` object, enabling safe URL
52831
+ * parsing with built-in error handling. If the string is invalid or fails to
52832
+ * parse, this function does not throw an error; instead, it wraps the error in
52833
+ * a `IllegalArgumentError` and returns it as the `Failure` value of an
52834
+ * `Result`. The `Success` value contains the successfully parsed `URL`.
52835
+ *
52836
+ * An optional `base` parameter can be provided to resolve relative URLs. If
52837
+ * specified, the function interprets the input `url` as relative to this
52838
+ * `base`. This is especially useful when dealing with URLs that might not be
52839
+ * fully qualified.
52840
+ *
52841
+ * **Example** (Parsing absolute and relative URLs)
52842
+ *
52843
+ * ```ts import.meta.vitest
52844
+ * import { Result } from "effect"
52845
+ * import { Url } from "effect/http"
52846
+ *
52847
+ * // Parse an absolute URL
52848
+ * //
52849
+ * // ┌─── Result<URL, IllegalArgumentError>
52850
+ * // ▼
52851
+ * const parsed = Url.fromString("https://example.com/path")
52852
+ *
52853
+ * Result.map(parsed, (url) => url.toString()) // => Result.succeed("https://example.com/path")
52854
+ *
52855
+ * // Parse a relative URL with a base
52856
+ * const relativeParsed = Url.fromString("/relative-path", "https://example.com")
52857
+ *
52858
+ * Result.map(relativeParsed, (url) => url.toString()) // => Result.succeed("https://example.com/relative-path")
52859
+ * ```
52860
+ *
52861
+ * @stability unstable
52862
+ * @category constructors
52863
+ * @since 4.0.0
52864
+ */
52865
+ const fromString = (url, base) => try_$2({
52866
+ try: () => new URL(url, base),
52867
+ catch: () => new IllegalArgumentError(`Invalid URL: "${url}"${base !== void 0 ? ` with base "${base}"` : ""}`)
52868
+ });
52373
52869
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/HttpClientRequest.js
52374
52870
  const TypeId$16 = "~effect/http/HttpClientRequest";
52375
52871
  /**
@@ -58047,7 +58543,7 @@ function decodeValueUnchecked(layout, r) {
58047
58543
  const value = r.zigzag();
58048
58544
  const scale = r.zigzag();
58049
58545
  if (scale > MAX_SAFE_BIGINT || -scale > MAX_SAFE_BIGINT) invalid("safe integer length", void 0, r.options);
58050
- return make$69(value, Number(scale));
58546
+ return make$71(value, Number(scale));
58051
58547
  }
58052
58548
  case "json": {
58053
58549
  const text = r.readUtf8(r.end - r.pos);
@@ -59113,7 +59609,7 @@ const RpcGroupProto = {
59113
59609
  });
59114
59610
  },
59115
59611
  annotateRpcs(service, value) {
59116
- return this.annotateRpcsMerge(make$80(service, value));
59612
+ return this.annotateRpcsMerge(make$82(service, value));
59117
59613
  },
59118
59614
  annotateMerge(context) {
59119
59615
  return makeProto({
@@ -67816,7 +68312,7 @@ const makeHandlers = (core, _lifecycle, context) => {
67816
68312
  const subscriptionMetadata = { "io.modelcontextprotocol/subscriptionId": requestId };
67817
68313
  const resourceSubscriptions = new Set(honored.resourceSubscriptions);
67818
68314
  const pending = yield* dropping(MAX_PENDING_SUBSCRIPTION_NOTIFICATIONS);
67819
- const overflowed = yield* make$77();
68315
+ const overflowed = yield* make$79();
67820
68316
  yield* gen(function* () {
67821
68317
  while (true) {
67822
68318
  const event = yield* take(events);
@@ -69406,7 +69902,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
69406
69902
  const services = yield* context();
69407
69903
  const scope = get$10(services, Scope);
69408
69904
  const trackFiber = runIn(forkUnsafe(scope, "parallel"));
69409
- const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$70(concurrency);
69905
+ const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$72(concurrency);
69410
69906
  const clients = /* @__PURE__ */ new Map();
69411
69907
  let isShutdown = false;
69412
69908
  const shutdownLatch = makeUnsafe$3(false);
@@ -69709,7 +70205,7 @@ const make$13 = /*#__PURE__*/ fnUntraced(function* (group, options) {
69709
70205
  const { codecFor, disconnects, end, run, send, supportsAck, supportsSpanPropagation, supportsTransferables } = yield* Protocol$1;
69710
70206
  const { encodeDefectUnsafe, encodeUnknownRequestExit } = defectCodecs(codecFor);
69711
70207
  const services = yield* context();
69712
- const scope = yield* make$76();
70208
+ const scope = yield* make$78();
69713
70209
  const server = yield* makeNoSerialization(group, {
69714
70210
  ...options,
69715
70211
  disableClientAcks: !supportsAck,
@@ -69985,7 +70481,7 @@ const makeProtocolWithHttpEffect = /*#__PURE__*/ fnUntraced(function* (options =
69985
70481
  const { encodeDefectUnsafe } = defectCodecs(serialization.codecFor);
69986
70482
  const includesFraming = serialization.includesFraming;
69987
70483
  const isBinary = !serialization.contentType.includes("json");
69988
- const disconnects = yield* make$72();
70484
+ const disconnects = yield* make$74();
69989
70485
  let writeRequest;
69990
70486
  let clientId = 0;
69991
70487
  const clients = /* @__PURE__ */ new Map();
@@ -69998,7 +70494,7 @@ const makeProtocolWithHttpEffect = /*#__PURE__*/ fnUntraced(function* (options =
69998
70494
  const requestHeaders = Object.entries(request.headers);
69999
70495
  const data = yield* orDie$2(isBinary ? map$5(request.arrayBuffer, (buf) => new Uint8Array(buf)) : request.text);
70000
70496
  const id = clientId++;
70001
- const queue = yield* make$72({ capacity: includesFraming && options.streamBufferSize !== "unbounded" ? options.streamBufferSize ?? 16 : void 0 });
70497
+ const queue = yield* make$74({ capacity: includesFraming && options.streamBufferSize !== "unbounded" ? options.streamBufferSize ?? 16 : void 0 });
70002
70498
  const parser = serialization.makeUnsafe();
70003
70499
  const requestIds = [];
70004
70500
  const offer$1 = (data) => typeof data === "string" ? offer(queue, encoder.encode(data)) : offer(queue, data);
@@ -70103,7 +70599,7 @@ const layerProtocolHttp = (options) => {
70103
70599
  const makeSocketProtocol = /*#__PURE__*/ gen(function* () {
70104
70600
  const serialization = yield* RpcSerialization;
70105
70601
  const { encodeDefectUnsafe } = defectCodecs(serialization.codecFor);
70106
- const disconnects = yield* make$72();
70602
+ const disconnects = yield* make$74();
70107
70603
  let clientId = 0;
70108
70604
  const clients = /* @__PURE__ */ new Map();
70109
70605
  const clientIds = /* @__PURE__ */ new Set();
@@ -70395,7 +70891,7 @@ const getMiddleware = (context) => {
70395
70891
  };
70396
70892
  const isMcpError = (error) => hasProperty(error, "code") && typeof error.code === "number" && hasProperty(error, "message") && typeof error.message === "string";
70397
70893
  const HandlerFailure = /*#__PURE__*/ Reference("effect/ai/McpServer/HandlerFailure", { defaultValue: () => false });
70398
- const handlerFailure = /*#__PURE__*/ make$80(HandlerFailure, true);
70894
+ const handlerFailure = /*#__PURE__*/ make$82(HandlerFailure, true);
70399
70895
  const internalError = /*#__PURE__*/ new InternalError$1({ message: "Internal error" });
70400
70896
  const rejectWith = (error) => fail$6(new RequestRejected({
70401
70897
  code: error.code,
@@ -70501,7 +70997,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
70501
70997
  const resources = [];
70502
70998
  const resourceTemplates = [];
70503
70999
  const prompts = [];
70504
- const notificationsQueue = yield* make$72();
71000
+ const notificationsQueue = yield* make$74();
70505
71001
  const globalMiddleware = [];
70506
71002
  const notificationDelivery = {
70507
71003
  consumers: 0,
@@ -70513,7 +71009,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
70513
71009
  const dispatcher = (yield* Scheduler).makeDispatcher();
70514
71010
  const notifications = yield* makeNoSerialization$1(BroadcastServerNotificationRpcs, {
70515
71011
  spanPrefix: "McpServer/Notifications",
70516
- onFromClient: (options) => make$77().pipe(flatMap$2((delivered) => withFiber((fiber) => {
71012
+ onFromClient: (options) => make$79().pipe(flatMap$2((delivered) => withFiber((fiber) => {
70517
71013
  const message = options.message;
70518
71014
  if (message._tag !== "Request") return void_$1;
70519
71015
  const notification = toInternalServerNotification(message);
@@ -70577,7 +71073,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
70577
71073
  });
70578
71074
  const service = McpServer.of({
70579
71075
  notifications: notifications.client,
70580
- notifyElicitationComplete: ({ clientId, elicitationId }) => withoutSharedConsumer() ? void_$1 : make$77().pipe(flatMap$2((delivered) => offer(notificationsQueue, {
71076
+ notifyElicitationComplete: ({ clientId, elicitationId }) => withoutSharedConsumer() ? void_$1 : make$79().pipe(flatMap$2((delivered) => offer(notificationsQueue, {
70581
71077
  notification: ServerNotification.ElicitationComplete({ elicitationId }),
70582
71078
  targetClientId: clientId,
70583
71079
  delivered
@@ -71519,7 +72015,7 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
71519
72015
  isError: false,
71520
72016
  content: []
71521
72017
  })) : successResult(result.encodedResult);
71522
- return result.failureOrigin === "handler" ? map$5(encodeReturnedFailure(result.encodedResult), failureResult) : failCause$3(annotate$2(fail$9(result.result), make$80(FailureOrigin, result.failureOrigin ?? "result")));
72018
+ return result.failureOrigin === "handler" ? map$5(encodeReturnedFailure(result.encodedResult), failureResult) : failCause$3(annotate$2(fail$9(result.result), make$82(FailureOrigin, result.failureOrigin ?? "result")));
71523
72019
  }), catchCause$2(handleCause));
71524
72020
  },
71525
72021
  services
@@ -71832,7 +72328,7 @@ const parseTemplate$1 = (texts, values) => {
71832
72328
  const endWord = () => {
71833
72329
  if (word.length === 0) return;
71834
72330
  const value = word.map(unwrap$1).join("");
71835
- words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ? make$65(value) : value);
72331
+ words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ? make$67(value) : value);
71836
72332
  word = [];
71837
72333
  plain = true;
71838
72334
  braceDepth = 0;
@@ -78527,7 +79023,7 @@ const layer$7 = /* @__PURE__ */ succeed$6(Stdio, /*#__PURE__*/ make$42({
78527
79023
  const layer$6 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
78528
79024
  const stdin = process.stdin;
78529
79025
  const stdout = process.stdout;
78530
- const lines = yield* make$72();
79026
+ const lines = yield* make$74();
78531
79027
  let inputEnded = stdin.readableEnded;
78532
79028
  let readlineActive = false;
78533
79029
  const onStdinEnd = () => {
@@ -78589,7 +79085,7 @@ const layer$6 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
78589
79085
  return queue;
78590
79086
  });
78591
79087
  const readInput = gen(function* () {
78592
- const queue = yield* make$72();
79088
+ const queue = yield* make$74();
78593
79089
  const handleKeypress = (s, k) => {
78594
79090
  const userInput = {
78595
79091
  input: fromUndefinedOr(s),
@@ -80205,7 +80701,7 @@ const String$4 = /*#__PURE__*/ makePrimitive("String", (value) => succeed$5(valu
80205
80701
  */
80206
80702
  const Choice = (choices) => {
80207
80703
  const choiceMap = new Map(choices);
80208
- const validChoices = choices.map(([key]) => format$2(key)).join(" | ");
80704
+ const validChoices = choices.map(([key]) => format$4(key)).join(" | ");
80209
80705
  const primitive = makePrimitive("Choice", (value) => {
80210
80706
  if (choiceMap.has(value)) return succeed$5(choiceMap.get(value));
80211
80707
  return fail$6(validChoices);
@@ -80716,7 +81212,7 @@ const map$1 = /*#__PURE__*/ dual(2, (self, f) => flatMap(self, (a) => succeed(f(
80716
81212
  * @category constructors
80717
81213
  * @since 4.0.0
80718
81214
  */
80719
- const Password = (options) => basePrompt(options, "password").pipe(map$1(make$65));
81215
+ const Password = (options) => basePrompt(options, "password").pipe(map$1(make$67));
80720
81216
  /**
80721
81217
  * Runs a prompt by reading terminal input and rendering prompt frames until the
80722
81218
  * prompt submits a value.
@@ -86604,7 +87100,7 @@ const runWith = (command, config) => {
86604
87100
  }
86605
87101
  const services = match$8(logLevel, {
86606
87102
  onNone: () => empty$16(),
86607
- onSome: (level) => make$80(MinimumLogLevel, level)
87103
+ onSome: (level) => make$82(MinimumLogLevel, level)
86608
87104
  });
86609
87105
  yield* provideContext$2(program, services);
86610
87106
  }, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$10(error) : fail$11(error), (error) => andThen(showHelp(command, error, config.renderErrors !== false), fail$6(error))), catchFilter((error) => {
@@ -86994,32 +87490,25 @@ Struct({
86994
87490
  expires_in: Finite,
86995
87491
  refresh_token: NonEmptyString
86996
87492
  });
86997
- const Origin = String$6.check(makeFilter((value) => {
86998
- if (!URL.canParse(value)) return false;
86999
- const url = new URL(value);
87000
- return contains(["http:", "https:"], url.protocol) && url.username === "" && url.password === "" && url.hash === "";
87001
- }, { expected: "an HTTP(S) URL without credentials or a fragment" })).check(makeFilter((value) => {
87002
- if (!URL.canParse(value)) return false;
87003
- const url = new URL(value);
87004
- return url.pathname === "/" && url.search === "";
87005
- }, { expected: "an HTTP(S) origin without a path or query" }));
87006
- const SecureOrigin = Origin.check(makeFilter((value) => {
87007
- if (!URL.canParse(value)) return false;
87008
- const url = new URL(value);
87009
- return url.protocol === "https:" || contains([
87010
- "localhost",
87011
- "127.0.0.1",
87012
- "[::1]"
87013
- ], url.hostname);
87014
- }, { expected: "HTTPS outside loopback" }));
87493
+ const Origin = String$6.check(makeFilter((value) => exists(getSuccess(fromString(value)), (url) => contains$1(["http:", "https:"], url.protocol) && url.username === "" && url.password === "" && url.hash === ""), { expected: "an HTTP(S) URL without credentials or a fragment" })).check(makeFilter((value) => exists(getSuccess(fromString(value)), (url) => url.pathname === "/" && url.search === ""), { expected: "an HTTP(S) origin without a path or query" }));
87494
+ const SecureOrigin = Origin.check(makeFilter((value) => exists(getSuccess(fromString(value)), (url) => url.protocol === "https:" || contains$1([
87495
+ "localhost",
87496
+ "127.0.0.1",
87497
+ "[::1]"
87498
+ ], url.hostname)), { expected: "HTTPS outside loopback" }));
87015
87499
  const Port = String$6.check(isPattern(/^\d{1,5}$/u), makeFilter((value) => exists(parse$3(value), (port) => port >= 1 && port <= 65535), { expected: "a port between 1 and 65535" }));
87016
87500
  const AppVersion = String$6.check(isPattern(/^0\.1\.\d+$/u));
87501
+ const RUNTIME_PATH = "/api/runtime";
87017
87502
  const RuntimeConfig = Struct({
87018
87503
  auth: optionalKey(String$6),
87019
87504
  name: String$6,
87020
87505
  traces: String$6,
87021
87506
  version: AppVersion
87022
87507
  });
87508
+ const RPC_PATH = "/api/rpc";
87509
+ const MCP_PATH = "/mcp";
87510
+ const MCP_METADATA_PATH = "/.well-known/oauth-protected-resource/mcp";
87511
+ const MANIFEST_PATH = "/manifest.webmanifest";
87023
87512
  const Account = Struct({
87024
87513
  ...User.fields,
87025
87514
  signOut: Boolean$5
@@ -87322,7 +87811,7 @@ const unknownToAttributeValue = (value) => {
87322
87811
  case "bigint": return BigInt.asIntN(64, value) === value ? { intValue: String(value) } : { stringValue: String(value) };
87323
87812
  case "number": return Number.isInteger(value) && value >= -int64Bound && value < int64Bound ? { intValue: Number.isSafeInteger(value) ? value : String(BigInt(value)) } : { doubleValue: value };
87324
87813
  case "boolean": return { boolValue: value };
87325
- default: return { stringValue: format$2(value) };
87814
+ default: return { stringValue: format$4(value) };
87326
87815
  }
87327
87816
  };
87328
87817
  // ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/observability/OtlpSerialization.js
@@ -87548,7 +88037,7 @@ const layer = /*#__PURE__*/ flow(/* @__PURE__ */ fnUntraced(function* (options)
87548
88037
  if (!span.sampled) return;
87549
88038
  exporter.push(makeOtlpSpan(span));
87550
88039
  }
87551
- return make$78({
88040
+ return make$80({
87552
88041
  span(options) {
87553
88042
  return new SpanImpl(options, exportFn);
87554
88043
  },
@@ -87736,11 +88225,23 @@ function layerOtlp(serviceName, url, runtime, version) {
87736
88225
  }));
87737
88226
  }
87738
88227
  // ../../packages/runtime/src/auth/lib/utils.ts
88228
+ const ISSUER_PATH = "/api/auth";
88229
+ const APPS_PATH = "/api/apps";
88230
+ const SESSION_PATH = "/auth/session";
88231
+ const VERIFY_PATH = "/auth/verify";
87739
88232
  const DEVELOPER = {
87740
88233
  id: "github:0",
87741
88234
  name: "dev"
87742
88235
  };
87743
88236
  const localAuth = map$2(option(String$5("AUTH_URL")), isNone);
88237
+ const adminIds = gen(function* () {
88238
+ const listed = Array$1(String$6, "GITHUB_ADMINS");
88239
+ if (yield* localAuth) return yield* withDefault$2(listed, ["0"]);
88240
+ return yield* listed;
88241
+ });
88242
+ function isAdmin(admins, id) {
88243
+ return contains$1(admins, replace("github:", "")(id));
88244
+ }
87744
88245
  function signInUrl(next) {
87745
88246
  return `${new URL(next).origin}/auth/sign-in?${new URLSearchParams({ next })}`;
87746
88247
  }
@@ -87776,7 +88277,7 @@ const unavailable = text("The authorization service is temporarily unavailable;
87776
88277
  status: 503
87777
88278
  });
87778
88279
  var Auth = class Auth extends Service$1()("@deslop/runtime/auth/service/Auth") {
87779
- static makeContext = (auth) => pipe$1(make$80(Auth, auth), add$1(RpcAuth, RpcAuth.of((effect, request) => pipe$1(auth.user(request.headers), flatMap$2((user) => raceFirst(provideService(effect, CurrentUser, user), pipe$1(delay(auth.user(request.headers), "5 minutes"), retry({ while: (error) => error.error === "temporarily_unavailable" }), forever)))))));
88280
+ static makeContext = (auth) => pipe$1(make$82(Auth, auth), add$1(RpcAuth, RpcAuth.of((effect, request) => pipe$1(auth.user(request.headers), flatMap$2((user) => raceFirst(provideService(effect, CurrentUser, user), pipe$1(delay(auth.user(request.headers), "5 minutes"), retry({ while: (error) => error.error === "temporarily_unavailable" }), forever)))))));
87780
88281
  static layer = effectContext(gen(function* () {
87781
88282
  if (yield* localAuth) return Auth.makeContext(Auth.of({
87782
88283
  access: developer,
@@ -87786,7 +88287,7 @@ var Auth = class Auth extends Service$1()("@deslop/runtime/auth/service/Auth") {
87786
88287
  const canonical = new URL(yield* String$5("APP_URL")).origin;
87787
88288
  const client = filterStatusOk(yield* HttpClient);
87788
88289
  const access = fn("Auth.access")(function* (headers, audience) {
87789
- return yield* pipe$1(client.get(new URL("/auth/verify", issuer).href, {
88290
+ return yield* pipe$1(client.get(new URL(VERIFY_PATH, issuer).href, {
87790
88291
  headers: { authorization: headers["authorization"] ?? "" },
87791
88292
  urlParams: { resource: audience }
87792
88293
  }), flatMap$2(schemaBodyJson(User)), timeout("10 seconds"));
@@ -87795,7 +88296,7 @@ var Auth = class Auth extends Service$1()("@deslop/runtime/auth/service/Auth") {
87795
88296
  access,
87796
88297
  user: fn("Auth.user")(function* (headers) {
87797
88298
  if (isSome(get$6(headers, "authorization"))) return yield* access(headers, canonical);
87798
- return yield* pipe$1(client.get(new URL("/auth/session", issuer).href, { headers: { cookie: headers["cookie"] ?? "" } }), flatMap$2(schemaBodyJson(User)), timeout("10 seconds"));
88299
+ return yield* pipe$1(client.get(new URL(SESSION_PATH, issuer).href, { headers: { cookie: headers["cookie"] ?? "" } }), flatMap$2(schemaBodyJson(User)), timeout("10 seconds"));
87799
88300
  }, rejected$1("Sign in first"))
87800
88301
  }));
87801
88302
  }));
@@ -87817,7 +88318,7 @@ function layerMcpAuth(resource) {
87817
88318
  if (yield* localAuth) return (app) => provideService(app, CurrentUser, DEVELOPER);
87818
88319
  return (app) => gen(function* () {
87819
88320
  const headers = (yield* HttpServerRequest).headers;
87820
- const challenge = `Bearer resource_metadata="${new URL("/.well-known/oauth-protected-resource/mcp", resource).href}", scope="deslop"`;
88321
+ const challenge = `Bearer resource_metadata="${new URL(MCP_METADATA_PATH, resource).href}", scope="deslop"`;
87821
88322
  if (isNone(get$6(headers, "authorization"))) return text("OAuth authorization required; sign in with your MCP client", {
87822
88323
  headers: { "www-authenticate": challenge },
87823
88324
  status: 401
@@ -87890,7 +88391,7 @@ const guard = make$21((app) => gen(function* () {
87890
88391
  const canonical = new URL(yield* String$5("APP_URL")).hostname;
87891
88392
  if (!exists(liftThrowable(() => new URL(`http://${host}`))(), (url) => url.hostname === canonical || isSome(match$3(LOOPBACK)(url.hostname)))) return empty({ status: 403 });
87892
88393
  }
87893
- if (exists(origin, (value) => !exists(liftThrowable(() => new URL(value).host)(), (originHost) => originHost === host)) && request.headers["sec-fetch-site"] !== "same-origin" && !contains(OTLP, headNonEmpty(split$1(request.url, "?")))) return empty({ status: 403 });
88394
+ if (exists(origin, (value) => !exists(liftThrowable(() => new URL(value).host)(), (originHost) => originHost === host)) && request.headers["sec-fetch-site"] !== "same-origin" && !contains$1(OTLP, headNonEmpty(split$1(request.url, "?")))) return empty({ status: 403 });
87894
88395
  return yield* app;
87895
88396
  }));
87896
88397
  function layerKeyValueStore(directory) {
@@ -87898,7 +88399,7 @@ function layerKeyValueStore(directory) {
87898
88399
  const base = yield* KeyValueStore;
87899
88400
  const fs = yield* FileSystem;
87900
88401
  const path = yield* Path$1;
87901
- const writes = yield* make$70(1);
88402
+ const writes = yield* make$72(1);
87902
88403
  return make$43({
87903
88404
  ...omit$1(base, [
87904
88405
  "set",
@@ -87953,7 +88454,7 @@ const layerRoutes = use((router) => gen(function* () {
87953
88454
  })
87954
88455
  });
87955
88456
  });
87956
- yield* router.add("GET", "/api/runtime", gen(function* () {
88457
+ yield* router.add("GET", RUNTIME_PATH, gen(function* () {
87957
88458
  return yield* schemaJson(RuntimeConfig)({
87958
88459
  ...match$8(issuer, {
87959
88460
  onNone: () => ({}),
@@ -87981,7 +88482,7 @@ const layerAnnounce = effectDiscard(gen(function* () {
87981
88482
  yield* match$8(yield* option(String$5("AUTH_URL")), {
87982
88483
  onNone: () => void_$1,
87983
88484
  onSome: fnUntraced(function* (issuer) {
87984
- yield* pipe$1(post(new URL("/api/apps", issuer).href), bodyJsonUnsafe({ origin }), client.execute, delay("2 seconds"), retry({
88485
+ yield* pipe$1(post(new URL(APPS_PATH, issuer).href), bodyJsonUnsafe({ origin }), client.execute, delay("2 seconds"), retry({
87985
88486
  schedule: spaced("1 minute"),
87986
88487
  times: 60
87987
88488
  }), ignore$1({
@@ -88002,7 +88503,7 @@ const layerWeb = unwrap$7(gen(function* () {
88002
88503
  const client = fileURLToPath(new URL("./client", import.meta.url));
88003
88504
  if (!(yield* (yield* FileSystem).exists((yield* Path$1).join(client, "index.html")))) return empty$12;
88004
88505
  const name = capitalize(yield* appName);
88005
- return mergeAll$1(add("GET", "/manifest.webmanifest", succeed$5(jsonUnsafe({
88506
+ return mergeAll$1(add("GET", MANIFEST_PATH, succeed$5(jsonUnsafe({
88006
88507
  background_color: "#0a0a0a",
88007
88508
  display: "standalone",
88008
88509
  icons: [{
@@ -88031,29 +88532,38 @@ const layerWeb = unwrap$7(gen(function* () {
88031
88532
  spa: true
88032
88533
  }));
88033
88534
  }));
88034
- function layerMcp$1(options) {
88535
+ function layerRpc(options) {
88536
+ return pipe$1(layerHttp$1({
88537
+ disableTracing: options.disableTracing,
88538
+ group: options.group,
88539
+ path: RPC_PATH,
88540
+ protocol: "websocket"
88541
+ }), provide$2(options.handlers));
88542
+ }
88543
+ function layerMcp(options) {
88035
88544
  return unwrap$7(gen(function* () {
88036
88545
  const metadata = yield* packageMetadata;
88037
88546
  const canonical = yield* String$5("APP_URL");
88038
88547
  const issuer = yield* option(String$5("AUTH_URL"));
88039
- const resource = new URL("/mcp", canonical).href;
88548
+ const resource = new URL(MCP_PATH, canonical).href;
88040
88549
  const endpoint = pipe$1(layerHttp({
88041
- ...options,
88042
88550
  allowSessionTermination: true,
88043
88551
  icons: [{ src: new URL("/icon", canonical).href }],
88552
+ instructions: options.instructions,
88044
88553
  name: yield* appName,
88045
- path: "/mcp",
88554
+ path: MCP_PATH,
88046
88555
  protocols: [
88047
88556
  v2026_07_28,
88048
88557
  v2025_11_25,
88049
88558
  v2025_06_18
88050
88559
  ],
88560
+ registrations: pipe$1(toolkit(options.tools), provide$2(options.handlers)),
88051
88561
  version: metadata.version
88052
88562
  }), provide$2(layerMcpAuth(resource)));
88053
88563
  return match$8(issuer, {
88054
88564
  onNone: () => endpoint,
88055
- onSome: (origin) => mergeAll$1(endpoint, add("GET", "/.well-known/oauth-protected-resource/mcp", succeed$5(jsonUnsafe({
88056
- authorization_servers: [new URL("/api/auth", origin).href],
88565
+ onSome: (origin) => mergeAll$1(endpoint, add("GET", MCP_METADATA_PATH, succeed$5(jsonUnsafe({
88566
+ authorization_servers: [new URL(ISSUER_PATH, origin).href],
88057
88567
  bearer_methods_supported: ["header"],
88058
88568
  resource,
88059
88569
  scopes_supported: ["deslop"]
@@ -88183,7 +88693,7 @@ const update = fnUntraced(function* (name) {
88183
88693
  yield* activate(name, path.join(directory, "node_modules", "@deslop", name));
88184
88694
  yield* restart(name);
88185
88695
  const kept = [latest, ...toArray$1(map$11(previous, (link) => path.basename(path.resolve(link, "../../.."))))];
88186
- yield* forEach$1(filter$5(yield* fs.readDirectory(path.join(root, "releases")), (entry) => !contains(kept, entry)), (entry) => fs.remove(path.join(root, "releases", entry), { recursive: true }), { concurrency: 1 });
88696
+ yield* forEach$1(difference(yield* fs.readDirectory(path.join(root, "releases")), kept), (entry) => fs.remove(path.join(root, "releases", entry), { recursive: true }), { concurrency: 1 });
88187
88697
  return `Updated ${name} from ${running} to ${latest}\n`;
88188
88698
  });
88189
88699
  // ../../packages/runtime/src/cli.ts
@@ -88283,152 +88793,6 @@ function runApp(app) {
88283
88793
  });
88284
88794
  runMain(pipe$1(program, scoped, provide(layerPlatform), provideService(LogToStderr, true)));
88285
88795
  }
88286
- // src/services/connections/schema.ts
88287
- var UpstreamError = class extends TaggedError()("UpstreamError", { cause: Defect() }) {};
88288
- const ServerId = String$6.check(isPattern(/^[a-z0-9][a-z0-9_-]{0,23}$/u));
88289
- const ServerUrl = NonEmptyString.check(isMaxLength(2048), makeFilter((value) => {
88290
- if (!URL.canParse(value)) return false;
88291
- const url = new URL(value);
88292
- return url.protocol === "https:" && url.username === "" && url.password === "" && url.hash === "";
88293
- }, { expected: "a public HTTPS URL without credentials or a fragment" }));
88294
- const AddServer = Struct({ url: ServerUrl });
88295
- const ServerParams = Struct({ id: ServerId });
88296
- const Metadata = Struct({
88297
- authorization_endpoint: NonEmptyString,
88298
- authorization_response_iss_parameter_supported: optionalKey(Boolean$5),
88299
- client_id_metadata_document_supported: optionalKey(Boolean$5),
88300
- issuer: NonEmptyString,
88301
- registration_endpoint: optionalKey(NonEmptyString),
88302
- token_endpoint: NonEmptyString
88303
- });
88304
- const Registration = Struct({ client_id: NonEmptyString });
88305
- const Token = Struct({
88306
- access_token: NonEmptyString,
88307
- expires_in: optionalKey(Finite.check(isGreaterThan(0))),
88308
- refresh_token: optionalKey(NonEmptyString),
88309
- token_type: String$6.check(isPattern(/^Bearer$/iu))
88310
- });
88311
- const OAuth = Struct({
88312
- client: TaggedUnion({
88313
- Document: {},
88314
- Registered: { clientId: NonEmptyString }
88315
- }),
88316
- metadata: Metadata,
88317
- scope: String$6
88318
- });
88319
- const Link = TaggedUnion({
88320
- Authorized: {
88321
- expiresAt: Finite,
88322
- token: Token
88323
- },
88324
- Connected: {},
88325
- Disconnected: {}
88326
- });
88327
- const ServerIcon = Struct({
88328
- src: String$6,
88329
- theme: optionalKey(Literals(["light", "dark"]))
88330
- });
88331
- const ConnectionStore = Record$1(String$6, Struct({
88332
- error: optionalKey(String$6),
88333
- generation: NonEmptyString,
88334
- icons: optionalKey(ArraySchema(ServerIcon)),
88335
- id: ServerId,
88336
- instructions: optionalKey(String$6),
88337
- link: Link,
88338
- mode: Literals(["oauth", "public"]),
88339
- name: NonEmptyString,
88340
- oauth: optionalKey(OAuth),
88341
- tools: ArraySchema(String$6),
88342
- url: ServerUrl
88343
- }));
88344
- const ConnectionInfo = Struct({
88345
- error: optionalKey(String$6),
88346
- icons: ArraySchema(ServerIcon),
88347
- id: ServerId,
88348
- name: NonEmptyString,
88349
- status: Literals([
88350
- "Connected",
88351
- "Not connected",
88352
- "Expired"
88353
- ]),
88354
- tools: ArraySchema(String$6),
88355
- url: ServerUrl
88356
- });
88357
- TaggedUnion({
88358
- Discovered: {
88359
- icons: ArraySchema(ServerIcon),
88360
- instructions: optionalKey(String$6),
88361
- tools: ArraySchema(String$6)
88362
- },
88363
- Failed: { error: String$6 }
88364
- });
88365
- const Callback = Struct({
88366
- code: optionalKey(NonEmptyString),
88367
- error: optionalKey(String$6),
88368
- iss: optionalKey(NonEmptyString),
88369
- state: NonEmptyString
88370
- });
88371
- // src/services/connections/lib/utils.ts
88372
- const gatewayUrl = String$5("APP_URL");
88373
- function clientMetadata(url) {
88374
- return {
88375
- client_id: `${url}/oauth/client.json`,
88376
- client_name: "Deslop MCP gateway",
88377
- grant_types: ["authorization_code", "refresh_token"],
88378
- redirect_uris: [`${url}/oauth/callback`],
88379
- response_types: ["code"],
88380
- token_endpoint_auth_method: "none"
88381
- };
88382
- }
88383
- function connectionStatus(connection, now) {
88384
- return valueTags(connection.link, {
88385
- Authorized: (link) => match$1(link.expiresAt <= now && link.token.refresh_token === void 0, {
88386
- onFalse: () => "Connected",
88387
- onTrue: () => "Expired"
88388
- }),
88389
- Connected: () => "Connected",
88390
- Disconnected: () => "Not connected"
88391
- });
88392
- }
88393
- function connectionInfo(connection, now) {
88394
- return {
88395
- ...match$8(fromUndefinedOr(connection.error), {
88396
- onNone: () => ({}),
88397
- onSome: (error) => ({ error })
88398
- }),
88399
- ...pick$1(connection, [
88400
- "id",
88401
- "name",
88402
- "tools",
88403
- "url"
88404
- ]),
88405
- icons: connection.icons ?? [],
88406
- status: connectionStatus(connection, now)
88407
- };
88408
- }
88409
- function serverIcons(implementation) {
88410
- return pipe$1(implementation?.icons ?? [], filter$5((icon) => isSome(match$3(/^(?:https:|data:image\/)/u)(icon.src)) && icon.src.length <= 32768), take$3(2), map$8((icon) => ({
88411
- src: icon.src,
88412
- ...match$8(fromUndefinedOr(icon.theme), {
88413
- onNone: () => ({}),
88414
- onSome: (theme) => ({ theme })
88415
- })
88416
- })));
88417
- }
88418
- function summary(connection) {
88419
- return pipe$1(fromUndefinedOr(connection.instructions), flatMap$7((text) => fromUndefinedOr(split$1(text, /(?<=\.)\s/u)[0])), map$11(slice(0, 160)), getOrElse(() => connection.name));
88420
- }
88421
- function describe(cause) {
88422
- if (is$2(AuthError)(cause)) return cause.message;
88423
- if (isTagged(cause, "TimeoutError")) return "It did not answer in time";
88424
- if (isHttpClientError(cause) && cause.reason._tag === "StatusCodeError") return `It answered HTTP ${cause.reason.response.status}`;
88425
- if (is$2(UpstreamError)(cause)) return describe(cause.cause);
88426
- if (hasProperty(cause, "message") && isString$1(cause.message)) return slice(0, 300)(cause.message);
88427
- return "It failed for an unknown reason";
88428
- }
88429
- function serverName(url) {
88430
- return pipe$1(new URL(url).hostname, replace(/^(?:api|app|mcp)\./u, ""), split$1("."), headNonEmpty, replaceAll(/[^a-z0-9_-]/giu, "-"), replaceAll(/^[^a-z0-9]+|[^a-z0-9]+$/giu, ""), slice(0, 16), toLowerCase);
88431
- }
88432
88796
  // ../../node_modules/.pnpm/@modelcontextprotocol+client@2.4.0/node_modules/@modelcontextprotocol/client/dist/chunk-DYPzFuB5.mjs
88433
88797
  var __create = Object.create;
88434
88798
  var __defProp = Object.defineProperty;
@@ -114995,6 +115359,169 @@ var StreamableHTTPClientTransport = class {
114995
115359
  });
114996
115360
  }
114997
115361
  };
115362
+ // src/services/connections/schema.ts
115363
+ var UpstreamError = class extends TaggedError()("UpstreamError", { cause: Defect() }) {};
115364
+ const ServerId = String$6.check(isPattern(/^[a-z0-9][a-z0-9_-]{0,23}$/u));
115365
+ const ServerUrl = NonEmptyString.check(isMaxLength(2048), makeFilter((value) => exists(getSuccess(fromString(value)), (url) => url.protocol === "https:" && url.username === "" && url.password === "" && url.hash === ""), { expected: "a public HTTPS URL without credentials or a fragment" }));
115366
+ const AddServer = Struct({ url: ServerUrl });
115367
+ const ServerParams = Struct({ id: ServerId });
115368
+ const Metadata = Struct({
115369
+ authorization_endpoint: NonEmptyString,
115370
+ authorization_response_iss_parameter_supported: optionalKey(Boolean$5),
115371
+ client_id_metadata_document_supported: optionalKey(Boolean$5),
115372
+ issuer: NonEmptyString,
115373
+ registration_endpoint: optionalKey(NonEmptyString),
115374
+ token_endpoint: NonEmptyString
115375
+ });
115376
+ const Registration = Struct({ client_id: NonEmptyString });
115377
+ const Token = Struct({
115378
+ access_token: NonEmptyString,
115379
+ expires_in: optionalKey(Finite.check(isGreaterThan(0))),
115380
+ refresh_token: optionalKey(NonEmptyString),
115381
+ token_type: String$6.check(isPattern(/^Bearer$/iu))
115382
+ });
115383
+ const OAuth = Struct({
115384
+ client: TaggedUnion({
115385
+ Document: {},
115386
+ Registered: { clientId: NonEmptyString }
115387
+ }),
115388
+ metadata: Metadata,
115389
+ scope: String$6
115390
+ });
115391
+ const Link = TaggedUnion({
115392
+ Authorized: {
115393
+ expiresAt: Finite,
115394
+ token: Token
115395
+ },
115396
+ Connected: {},
115397
+ Disconnected: {}
115398
+ });
115399
+ const ServerIcon = Struct({
115400
+ src: String$6,
115401
+ theme: optionalKey(Literals(["light", "dark"]))
115402
+ });
115403
+ const ConnectionStore = Record$1(String$6, Struct({
115404
+ error: optionalKey(String$6),
115405
+ generation: NonEmptyString,
115406
+ icons: optionalKey(ArraySchema(ServerIcon)),
115407
+ id: ServerId,
115408
+ instructions: optionalKey(String$6),
115409
+ link: Link,
115410
+ mode: Literals(["oauth", "public"]),
115411
+ name: NonEmptyString,
115412
+ oauth: optionalKey(OAuth),
115413
+ tools: ArraySchema(String$6),
115414
+ url: ServerUrl
115415
+ }));
115416
+ const ConnectionInfo = Struct({
115417
+ error: optionalKey(String$6),
115418
+ icons: ArraySchema(ServerIcon),
115419
+ id: ServerId,
115420
+ name: NonEmptyString,
115421
+ status: Literals([
115422
+ "Connected",
115423
+ "Not connected",
115424
+ "Expired"
115425
+ ]),
115426
+ tools: ArraySchema(String$6),
115427
+ url: ServerUrl
115428
+ });
115429
+ TaggedUnion({
115430
+ Discovered: {
115431
+ icons: ArraySchema(ServerIcon),
115432
+ instructions: optionalKey(String$6),
115433
+ tools: ArraySchema(String$6)
115434
+ },
115435
+ Failed: { error: String$6 }
115436
+ });
115437
+ const Callback = Struct({
115438
+ code: optionalKey(NonEmptyString),
115439
+ error: optionalKey(String$6),
115440
+ iss: optionalKey(NonEmptyString),
115441
+ state: NonEmptyString
115442
+ });
115443
+ // src/services/connections/lib/utils.ts
115444
+ const gatewayUrl = String$5("APP_URL");
115445
+ function mcpClient() {
115446
+ return new Client({
115447
+ name: "Deslop MCP gateway",
115448
+ version: "0.1.0"
115449
+ }, { versionNegotiation: { mode: "auto" } });
115450
+ }
115451
+ function endSession(transport, client, fail, kind) {
115452
+ return pipe$1(tryPromise({
115453
+ catch: fail,
115454
+ try: () => transport.terminateSession()
115455
+ }), timeout("3 seconds"), ignore$1({
115456
+ log: "Warn",
115457
+ message: `Cannot terminate the ${kind} MCP session`
115458
+ }), andThen(tryPromise({
115459
+ catch: fail,
115460
+ try: () => client.close()
115461
+ })), ignore$1({
115462
+ log: "Warn",
115463
+ message: `Cannot close the ${kind} MCP client`
115464
+ }));
115465
+ }
115466
+ function clientMetadata(url) {
115467
+ return {
115468
+ client_id: `${url}/oauth/client.json`,
115469
+ client_name: "Deslop MCP gateway",
115470
+ grant_types: ["authorization_code", "refresh_token"],
115471
+ redirect_uris: [`${url}/oauth/callback`],
115472
+ response_types: ["code"],
115473
+ token_endpoint_auth_method: "none"
115474
+ };
115475
+ }
115476
+ function connectionStatus(connection, now) {
115477
+ return valueTags(connection.link, {
115478
+ Authorized: (link) => match$1(link.expiresAt <= now && link.token.refresh_token === void 0, {
115479
+ onFalse: () => "Connected",
115480
+ onTrue: () => "Expired"
115481
+ }),
115482
+ Connected: () => "Connected",
115483
+ Disconnected: () => "Not connected"
115484
+ });
115485
+ }
115486
+ function connectionInfo(connection, now) {
115487
+ return {
115488
+ ...match$8(fromUndefinedOr(connection.error), {
115489
+ onNone: () => ({}),
115490
+ onSome: (error) => ({ error })
115491
+ }),
115492
+ ...pick$1(connection, [
115493
+ "id",
115494
+ "name",
115495
+ "tools",
115496
+ "url"
115497
+ ]),
115498
+ icons: connection.icons ?? [],
115499
+ status: connectionStatus(connection, now)
115500
+ };
115501
+ }
115502
+ function serverIcons(implementation) {
115503
+ return pipe$1(implementation?.icons ?? [], filter$5((icon) => isSome(match$3(/^(?:https:|data:image\/)/u)(icon.src)) && icon.src.length <= 32768), take$3(2), map$8((icon) => ({
115504
+ src: icon.src,
115505
+ ...match$8(fromUndefinedOr(icon.theme), {
115506
+ onNone: () => ({}),
115507
+ onSome: (theme) => ({ theme })
115508
+ })
115509
+ })));
115510
+ }
115511
+ function summary(connection) {
115512
+ return pipe$1(fromUndefinedOr(connection.instructions), flatMap$7((text) => fromUndefinedOr(split$1(text, /(?<=\.)\s/u)[0])), map$11(slice(0, 160)), getOrElse(() => connection.name));
115513
+ }
115514
+ function describe(cause) {
115515
+ if (is$2(AuthError)(cause)) return cause.message;
115516
+ if (isTagged(cause, "TimeoutError")) return "It did not answer in time";
115517
+ if (isHttpClientError(cause) && cause.reason._tag === "StatusCodeError") return `It answered HTTP ${cause.reason.response.status}`;
115518
+ if (is$2(UpstreamError)(cause)) return describe(cause.cause);
115519
+ if (hasProperty(cause, "message") && isString$1(cause.message)) return slice(0, 300)(cause.message);
115520
+ return "It failed for an unknown reason";
115521
+ }
115522
+ function serverName(url) {
115523
+ return pipe$1(new URL(url).hostname, replace(/^(?:api|app|mcp)\./u, ""), split$1("."), headNonEmpty, replaceAll(/[^a-z0-9_-]/giu, "-"), replaceAll(/^[^a-z0-9]+|[^a-z0-9]+$/giu, ""), slice(0, 16), toLowerCase);
115524
+ }
114998
115525
  // src/services/connections/service.ts
114999
115526
  function failed(message) {
115000
115527
  return mapError$2((cause) => {
@@ -115020,21 +115547,17 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
115020
115547
  const clientInfo = clientMetadata(origin);
115021
115548
  const store = toSchemaStore(yield* KeyValueStore, ConnectionStore);
115022
115549
  const state = yield* make$41(getOrElse(yield* store.get("servers"), () => ({})));
115023
- const listed = Array$1(String$6, "GITHUB_ADMINS");
115024
- const admins = yield* match$1(yield* localAuth, {
115025
- onFalse: () => listed,
115026
- onTrue: () => succeed$5(["0"])
115027
- });
115550
+ const admins = yield* adminIds;
115028
115551
  const traffic = yield* sliding(64);
115029
115552
  const admin = fnUntraced(function* (user) {
115030
- if (!contains(admins, replace("github:", "")(user.id))) return yield* AuthError.make({
115553
+ if (!isAdmin(admins, user.id)) return yield* AuthError.make({
115031
115554
  error: "access_denied",
115032
115555
  message: "Only an admin can manage MCP servers"
115033
115556
  });
115034
115557
  });
115035
115558
  const locks = yield* make$59({
115036
115559
  capacity: 256,
115037
- lookup: () => make$70(1)
115560
+ lookup: () => make$72(1)
115038
115561
  });
115039
115562
  const client = filterStatusOk(yield* HttpClient);
115040
115563
  const fetch = yield* Fetch;
@@ -115099,7 +115622,7 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
115099
115622
  }),
115100
115623
  resource: connection.url
115101
115624
  }), (request) => client.execute(request), flatMap$2(schemaBodyJson(Token)), tapErrorTag("HttpClientError", (cause) => {
115102
- if (cause.reason._tag !== "StatusCodeError" || !contains([400, 401], cause.reason.response.status)) return void_$1;
115625
+ if (cause.reason._tag !== "StatusCodeError" || !contains$1([400, 401], cause.reason.response.status)) return void_$1;
115103
115626
  return ended();
115104
115627
  }), timeout("20 seconds"));
115105
115628
  const now = yield* currentTimeMillis;
@@ -115194,16 +115717,7 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
115194
115717
  fetch,
115195
115718
  requestInit: { redirect: "error" }
115196
115719
  });
115197
- const anonymous = yield* acquireRelease(sync(() => new Client({
115198
- name: "Deslop MCP gateway",
115199
- version: "0.1.0"
115200
- }, { versionNegotiation: { mode: "auto" } })), (acquired) => pipe$1(tryPromise({
115201
- catch: (cause) => UpstreamError.make({ cause }),
115202
- try: () => transport.terminateSession()
115203
- }), timeout("3 seconds"), ignore$1({
115204
- log: "Warn",
115205
- message: "Cannot terminate the anonymous MCP session"
115206
- }), andThen(promise(() => acquired.close()))));
115720
+ const anonymous = yield* acquireRelease(sync(mcpClient), (acquired) => endSession(transport, acquired, (cause) => UpstreamError.make({ cause }), "anonymous"));
115207
115721
  yield* tryPromise({
115208
115722
  catch: (cause) => UpstreamError.make({ cause }),
115209
115723
  try: (signal) => anonymous.connect(transport, { signal })
@@ -115353,7 +115867,7 @@ var Connections = class Connections extends Service$1()("@deslop/gateway/service
115353
115867
  if (params.error !== void 0 || params.code === void 0) return yield* AuthError.make({ message: `The provider declined the connection (${params.error ?? "no code"})` });
115354
115868
  if (!valueTags(oauth.client, {
115355
115869
  Document: () => params.iss === oauth.metadata.issuer && isNone(route),
115356
- Registered: () => contains$1(route, connection.id) && (params.iss === void 0 || params.iss === oauth.metadata.issuer)
115870
+ Registered: () => contains$2(route, connection.id) && (params.iss === void 0 || params.iss === oauth.metadata.issuer)
115357
115871
  })) return yield* AuthError.make({ message: "The answer came from another authorization server" });
115358
115872
  yield* exchange(connection, oauth, {
115359
115873
  code: params.code,
@@ -115442,7 +115956,7 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
115442
115956
  const now = yield* currentTimeMillis;
115443
115957
  return exists(yield* option$1(connections.get(id)), (found) => found.generation === generation && connectionStatus(found, now) === "Connected");
115444
115958
  });
115445
- const refreshes = yield* make$70(1);
115959
+ const refreshes = yield* make$72(1);
115446
115960
  const scope$2 = yield* scope;
115447
115961
  const remove = fnUntraced(function* (name) {
115448
115962
  yield* update$1(installed, remove$7(name));
@@ -115492,22 +116006,7 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
115492
116006
  fetch,
115493
116007
  requestInit: { redirect: "error" }
115494
116008
  });
115495
- const client = yield* acquireRelease(sync(() => new Client({
115496
- name: "Deslop MCP gateway",
115497
- version: "0.1.0"
115498
- }, { versionNegotiation: { mode: "auto" } })), (acquired) => pipe$1(tryPromise({
115499
- catch: rejected(server),
115500
- try: () => transport.terminateSession()
115501
- }), timeout("3 seconds"), ignore$1({
115502
- log: "Warn",
115503
- message: "Cannot terminate the upstream MCP session"
115504
- }), andThen(tryPromise({
115505
- catch: rejected(server),
115506
- try: () => acquired.close()
115507
- })), ignore$1({
115508
- log: "Warn",
115509
- message: "Cannot close the upstream MCP client"
115510
- })));
116009
+ const client = yield* acquireRelease(sync(mcpClient), (acquired) => endSession(transport, acquired, rejected(server), "upstream"));
115511
116010
  yield* tryPromise({
115512
116011
  catch: rejected(server),
115513
116012
  try: (signal) => client.connect(transport, { signal })
@@ -115555,7 +116054,7 @@ var Gateway = class Gateway extends Service$1()("@deslop/gateway/services/gatewa
115555
116054
  "name",
115556
116055
  "mode"
115557
116056
  ]);
115558
- const names = make$73();
116057
+ const names = make$75();
115559
116058
  for (const tool of found.tools) {
115560
116059
  const upstreamName = tool.name;
115561
116060
  const name = yield* namespaced(`${server.id}__${tool.name}`);
@@ -115631,13 +116130,16 @@ const COOKIE = {
115631
116130
  sameSite: "lax",
115632
116131
  secure: true
115633
116132
  };
116133
+ function returning(step) {
116134
+ return pipe$1(step, orElseSucceed(() => redirect("/")), map$5(setHeader("cache-control", "no-store")));
116135
+ }
115634
116136
  const HttpHandlers = use((router) => gen(function* () {
115635
116137
  const auth = yield* Auth;
115636
116138
  const connections = yield* Connections;
115637
116139
  const gateway = yield* Gateway;
115638
116140
  const url = yield* gatewayUrl;
115639
116141
  yield* router.add("GET", "/oauth/client.json", jsonUnsafe(clientMetadata(url)));
115640
- yield* router.add("GET", "/oauth/connect", pipe$1(gen(function* () {
116142
+ yield* router.add("GET", "/oauth/connect", returning(gen(function* () {
115641
116143
  const request = yield* HttpServerRequest;
115642
116144
  const params = yield* schemaSearchParams(ServerParams);
115643
116145
  return yield* match$8(yield* option$1(auth.user(request.headers)), {
@@ -115650,7 +116152,7 @@ const HttpHandlers = use((router) => gen(function* () {
115650
116152
  })
115651
116153
  }))
115652
116154
  });
115653
- }), orElseSucceed(() => redirect("/")), map$5(setHeader("cache-control", "no-store"))));
116155
+ })));
115654
116156
  const callback = fnUntraced(function* (route) {
115655
116157
  const request = yield* HttpServerRequest;
115656
116158
  const user = yield* auth.user(request.headers);
@@ -115659,7 +116161,7 @@ const HttpHandlers = use((router) => gen(function* () {
115659
116161
  yield* connections.complete(params, route, user);
115660
116162
  yield* gateway.connected;
115661
116163
  return expireCookieUnsafe(redirect("/"), `__Host-mcp-${params.state}`, COOKIE);
115662
- }, orElseSucceed(() => redirect("/")), map$5(setHeader("cache-control", "no-store")));
116164
+ }, returning);
115663
116165
  yield* router.add("GET", "/oauth/callback", callback(none()));
115664
116166
  yield* router.add("GET", "/oauth/callback/:id", flatMap$2(params, (params) => callback(fromUndefinedOr(params["id"]))));
115665
116167
  }));
@@ -142744,985 +143246,57 @@ __reExport(Undici_exports, /* @__PURE__ */ __toESM$1(require_undici(), 1));
142744
143246
  * @since 4.0.0
142745
143247
  */
142746
143248
  var Undici_default = import_undici.default;
143249
+ // ../../packages/runtime/src/net.ts
143250
+ const BLOCKED = map$8([
143251
+ "0.0.0.0/8",
143252
+ "100.64.0.0/10",
143253
+ "192.0.0.0/24",
143254
+ "192.0.2.0/24",
143255
+ "192.31.196.0/24",
143256
+ "192.52.193.0/24",
143257
+ "192.88.99.0/24",
143258
+ "192.175.48.0/24",
143259
+ "198.18.0.0/15",
143260
+ "198.51.100.0/24",
143261
+ "203.0.113.0/24",
143262
+ "240.0.0.0/4",
143263
+ "100::/64",
143264
+ "2001::/23",
143265
+ "2001:db8::/32",
143266
+ "2002::/16",
143267
+ "2620:4f:8000::/48",
143268
+ "3fff::/20",
143269
+ "5f00::/16",
143270
+ "64:ff9b::/96",
143271
+ "64:ff9b:1::/48",
143272
+ "fec0::/10"
143273
+ ], (source) => getOrThrow(fromString$1(source)));
143274
+ function isHome(ip) {
143275
+ if (isIpv4Address(ip)) return isPrivate(ip);
143276
+ return isUniqueLocal(ip);
143277
+ }
143278
+ function isPublicIp(ip) {
143279
+ return !isUnspecified(ip) && !isLoopback(ip) && !isLinkLocal(ip) && !isMulticast(ip) && !(isIpv4Address(ip) && isBroadcast(ip)) && !isHome(ip) && !some(BLOCKED, (network) => contains(network, ip));
143280
+ }
143281
+ function isIpAddress(address) {
143282
+ return isSuccess$1(ipFromString(address));
143283
+ }
143284
+ function isPublicAddress(address) {
143285
+ return exists(getSuccess(ipFromString(address)), (ip) => {
143286
+ if (isIpv6Address(ip)) return isPublicIp(getOrElse(fromIpv4Mapped(ip), () => ip));
143287
+ return isPublicIp(ip);
143288
+ });
143289
+ }
142747
143290
  // src/services/network/service.ts
142748
- var import_ipaddr = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$1(((exports, module, this$1) => {
142749
- (function(root) {
142750
- "use strict";
142751
- const ipv4Part = "(0?\\d+|0x[a-f0-9]+)";
142752
- const ipv4Regexes = {
142753
- fourOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, "i"),
142754
- threeOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, "i"),
142755
- twoOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}$`, "i"),
142756
- longValue: new RegExp(`^${ipv4Part}$`, "i")
142757
- };
142758
- const octalRegex = new RegExp(`^0[0-7]+$`, "i");
142759
- const hexRegex = new RegExp(`^0x[a-f0-9]+$`, "i");
142760
- const zoneIndex = "%[0-9a-z]{1,}";
142761
- const ipv6Part = "(?:[0-9a-f]+::?)+";
142762
- const ipv6Regexes = {
142763
- zoneIndex: new RegExp(zoneIndex, "i"),
142764
- "native": new RegExp(`^(::)?(${ipv6Part})?([0-9a-f]+)?(::)?(${zoneIndex})?$`, "i"),
142765
- deprecatedTransitional: new RegExp(`^(?:::)(${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?)$`, "i"),
142766
- transitional: new RegExp(`^((?:${ipv6Part})|(?:::)(?:${ipv6Part})?)${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?$`, "i")
142767
- };
142768
- function expandIPv6(string, parts) {
142769
- if (string.indexOf("::") !== string.lastIndexOf("::")) return null;
142770
- let colonCount = 0;
142771
- let lastColon = -1;
142772
- let zoneId = (string.match(ipv6Regexes.zoneIndex) || [])[0];
142773
- let replacement, replacementCount;
142774
- if (zoneId) {
142775
- zoneId = zoneId.substring(1);
142776
- string = string.replace(/%.+$/, "");
142777
- }
142778
- while ((lastColon = string.indexOf(":", lastColon + 1)) >= 0) colonCount++;
142779
- if (string.substr(0, 2) === "::") colonCount--;
142780
- if (string.substr(-2, 2) === "::") colonCount--;
142781
- if (colonCount >= parts) return null;
142782
- replacementCount = parts - colonCount;
142783
- replacement = ":";
142784
- while (replacementCount--) replacement += "0:";
142785
- string = string.replace("::", replacement);
142786
- if (string[0] === ":") string = string.slice(1);
142787
- if (string[string.length - 1] === ":") string = string.slice(0, -1);
142788
- parts = (function() {
142789
- const ref = string.split(":");
142790
- const results = [];
142791
- for (let i = 0; i < ref.length; i++) results.push(ref[i].length > 4 ? NaN : parseInt(ref[i], 16));
142792
- return results;
142793
- })();
142794
- return {
142795
- parts,
142796
- zoneId
142797
- };
142798
- }
142799
- function matchCIDR(first, second, partSize, cidrBits) {
142800
- if (first.length !== second.length) throw new Error("ipaddr: cannot match CIDR for objects with different lengths");
142801
- let part = 0;
142802
- let shift;
142803
- while (cidrBits > 0) {
142804
- shift = partSize - cidrBits;
142805
- if (shift < 0) shift = 0;
142806
- if (first[part] >> shift !== second[part] >> shift) return false;
142807
- cidrBits -= partSize;
142808
- part += 1;
142809
- }
142810
- return true;
142811
- }
142812
- function parseIntAuto(string) {
142813
- if (hexRegex.test(string)) return parseInt(string, 16);
142814
- if (string[0] === "0" && !isNaN(parseInt(string[1], 10))) {
142815
- if (octalRegex.test(string)) return parseInt(string, 8);
142816
- throw new Error(`ipaddr: cannot parse ${string} as octal`);
142817
- }
142818
- return parseInt(string, 10);
142819
- }
142820
- function padPart(part, length) {
142821
- while (part.length < length) part = `0${part}`;
142822
- return part;
142823
- }
142824
- const ipaddr = {};
142825
- ipaddr.IPv4 = (function() {
142826
- function IPv4(octets) {
142827
- if (octets.length !== 4) throw new Error("ipaddr: ipv4 octet count should be 4");
142828
- let i, octet;
142829
- for (i = 0; i < octets.length; i++) {
142830
- octet = octets[i];
142831
- if (!(0 <= octet && octet <= 255)) throw new Error("ipaddr: ipv4 octet should fit in 8 bits");
142832
- }
142833
- this.octets = octets;
142834
- }
142835
- IPv4.prototype.SpecialRanges = {
142836
- unspecified: [[new IPv4([
142837
- 0,
142838
- 0,
142839
- 0,
142840
- 0
142841
- ]), 8]],
142842
- broadcast: [[new IPv4([
142843
- 255,
142844
- 255,
142845
- 255,
142846
- 255
142847
- ]), 32]],
142848
- multicast: [[new IPv4([
142849
- 224,
142850
- 0,
142851
- 0,
142852
- 0
142853
- ]), 4]],
142854
- linkLocal: [[new IPv4([
142855
- 169,
142856
- 254,
142857
- 0,
142858
- 0
142859
- ]), 16]],
142860
- loopback: [[new IPv4([
142861
- 127,
142862
- 0,
142863
- 0,
142864
- 0
142865
- ]), 8]],
142866
- carrierGradeNat: [[new IPv4([
142867
- 100,
142868
- 64,
142869
- 0,
142870
- 0
142871
- ]), 10]],
142872
- "private": [
142873
- [new IPv4([
142874
- 10,
142875
- 0,
142876
- 0,
142877
- 0
142878
- ]), 8],
142879
- [new IPv4([
142880
- 172,
142881
- 16,
142882
- 0,
142883
- 0
142884
- ]), 12],
142885
- [new IPv4([
142886
- 192,
142887
- 168,
142888
- 0,
142889
- 0
142890
- ]), 16]
142891
- ],
142892
- reserved: [
142893
- [new IPv4([
142894
- 192,
142895
- 0,
142896
- 0,
142897
- 0
142898
- ]), 24],
142899
- [new IPv4([
142900
- 192,
142901
- 0,
142902
- 2,
142903
- 0
142904
- ]), 24],
142905
- [new IPv4([
142906
- 192,
142907
- 88,
142908
- 99,
142909
- 0
142910
- ]), 24],
142911
- [new IPv4([
142912
- 198,
142913
- 18,
142914
- 0,
142915
- 0
142916
- ]), 15],
142917
- [new IPv4([
142918
- 198,
142919
- 51,
142920
- 100,
142921
- 0
142922
- ]), 24],
142923
- [new IPv4([
142924
- 203,
142925
- 0,
142926
- 113,
142927
- 0
142928
- ]), 24],
142929
- [new IPv4([
142930
- 240,
142931
- 0,
142932
- 0,
142933
- 0
142934
- ]), 4]
142935
- ],
142936
- as112: [[new IPv4([
142937
- 192,
142938
- 175,
142939
- 48,
142940
- 0
142941
- ]), 24], [new IPv4([
142942
- 192,
142943
- 31,
142944
- 196,
142945
- 0
142946
- ]), 24]],
142947
- amt: [[new IPv4([
142948
- 192,
142949
- 52,
142950
- 193,
142951
- 0
142952
- ]), 24]]
142953
- };
142954
- IPv4.prototype.kind = function() {
142955
- return "ipv4";
142956
- };
142957
- IPv4.prototype.match = function(other, cidrRange) {
142958
- let ref;
142959
- if (cidrRange === void 0) {
142960
- ref = other;
142961
- other = ref[0];
142962
- cidrRange = ref[1];
142963
- }
142964
- if (other.kind() !== "ipv4") throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");
142965
- return matchCIDR(this.octets, other.octets, 8, cidrRange);
142966
- };
142967
- IPv4.prototype.prefixLengthFromSubnetMask = function() {
142968
- let cidr = 0;
142969
- let stop = false;
142970
- const zerotable = {
142971
- 0: 8,
142972
- 128: 7,
142973
- 192: 6,
142974
- 224: 5,
142975
- 240: 4,
142976
- 248: 3,
142977
- 252: 2,
142978
- 254: 1,
142979
- 255: 0
142980
- };
142981
- let i, octet, zeros;
142982
- for (i = 3; i >= 0; i -= 1) {
142983
- octet = this.octets[i];
142984
- if (octet in zerotable) {
142985
- zeros = zerotable[octet];
142986
- if (stop && zeros !== 0) return null;
142987
- if (zeros !== 8) stop = true;
142988
- cidr += zeros;
142989
- } else return null;
142990
- }
142991
- return 32 - cidr;
142992
- };
142993
- IPv4.prototype.range = function() {
142994
- return ipaddr.subnetMatch(this, this.SpecialRanges);
142995
- };
142996
- IPv4.prototype.toByteArray = function() {
142997
- return this.octets.slice(0);
142998
- };
142999
- IPv4.prototype.toIPv4MappedAddress = function() {
143000
- return ipaddr.IPv6.parse(`::ffff:${this.toString()}`);
143001
- };
143002
- IPv4.prototype.toNormalizedString = function() {
143003
- return this.toString();
143004
- };
143005
- IPv4.prototype.toString = function() {
143006
- return this.octets.join(".");
143007
- };
143008
- return IPv4;
143009
- })();
143010
- ipaddr.IPv4.broadcastAddressFromCIDR = function(string) {
143011
- try {
143012
- const cidr = this.parseCIDR(string);
143013
- const ipInterfaceOctets = cidr[0].toByteArray();
143014
- const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
143015
- const octets = [];
143016
- let i = 0;
143017
- while (i < 4) {
143018
- octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255);
143019
- i++;
143020
- }
143021
- return new this(octets);
143022
- } catch (e) {
143023
- throw new Error("ipaddr: the address does not have IPv4 CIDR format", { cause: e });
143024
- }
143025
- };
143026
- ipaddr.IPv4.isIPv4 = function(string) {
143027
- return this.parser(string) !== null;
143028
- };
143029
- ipaddr.IPv4.isValid = function(string) {
143030
- try {
143031
- new this(this.parser(string));
143032
- return true;
143033
- } catch {
143034
- return false;
143035
- }
143036
- };
143037
- ipaddr.IPv4.isValidCIDR = function(string) {
143038
- try {
143039
- this.parseCIDR(string);
143040
- return true;
143041
- } catch {
143042
- return false;
143043
- }
143044
- };
143045
- ipaddr.IPv4.isValidFourPartDecimal = function(string) {
143046
- if (ipaddr.IPv4.isValid(string) && string.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)) return true;
143047
- else return false;
143048
- };
143049
- ipaddr.IPv4.isValidCIDRFourPartDecimal = function(string) {
143050
- const match = string.match(/^(.+)\/(\d+)$/);
143051
- if (!ipaddr.IPv4.isValidCIDR(string) || !match) return false;
143052
- return ipaddr.IPv4.isValidFourPartDecimal(match[1]);
143053
- };
143054
- ipaddr.IPv4.networkAddressFromCIDR = function(string) {
143055
- let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;
143056
- try {
143057
- cidr = this.parseCIDR(string);
143058
- ipInterfaceOctets = cidr[0].toByteArray();
143059
- subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
143060
- octets = [];
143061
- i = 0;
143062
- while (i < 4) {
143063
- octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));
143064
- i++;
143065
- }
143066
- return new this(octets);
143067
- } catch (e) {
143068
- throw new Error("ipaddr: the address does not have IPv4 CIDR format", { cause: e });
143069
- }
143070
- };
143071
- ipaddr.IPv4.parse = function(string) {
143072
- const parts = this.parser(string);
143073
- if (parts === null) throw new Error("ipaddr: string is not formatted like an IPv4 Address");
143074
- return new this(parts);
143075
- };
143076
- ipaddr.IPv4.parseCIDR = function(string) {
143077
- let match;
143078
- if (match = string.match(/^(.+)\/(\d+)$/)) {
143079
- const maskLength = parseInt(match[2]);
143080
- if (maskLength >= 0 && maskLength <= 32) {
143081
- const parsed = [this.parse(match[1]), maskLength];
143082
- Object.defineProperty(parsed, "toString", { value: function() {
143083
- return this.join("/");
143084
- } });
143085
- return parsed;
143086
- }
143087
- }
143088
- throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range");
143089
- };
143090
- ipaddr.IPv4.parser = function(string) {
143091
- let match, part, value;
143092
- if (match = string.match(ipv4Regexes.fourOctet)) return (function() {
143093
- const ref = match.slice(1, 6);
143094
- const results = [];
143095
- for (let i = 0; i < ref.length; i++) {
143096
- part = ref[i];
143097
- results.push(parseIntAuto(part));
143098
- }
143099
- return results;
143100
- })();
143101
- else if (match = string.match(ipv4Regexes.longValue)) {
143102
- value = parseIntAuto(match[1]);
143103
- if (value > 4294967295 || value < 0) throw new Error("ipaddr: address outside defined range");
143104
- return (function() {
143105
- const results = [];
143106
- let shift = 0;
143107
- for (; shift <= 24; shift += 8) results.push(value >> shift & 255);
143108
- return results;
143109
- })().reverse();
143110
- } else if (match = string.match(ipv4Regexes.twoOctet)) return (function() {
143111
- const ref = match.slice(1, 4);
143112
- const results = [];
143113
- value = parseIntAuto(ref[1]);
143114
- if (value > 16777215 || value < 0) throw new Error("ipaddr: address outside defined range");
143115
- results.push(parseIntAuto(ref[0]));
143116
- results.push(value >> 16 & 255);
143117
- results.push(value >> 8 & 255);
143118
- results.push(value & 255);
143119
- return results;
143120
- })();
143121
- else if (match = string.match(ipv4Regexes.threeOctet)) return (function() {
143122
- const ref = match.slice(1, 5);
143123
- const results = [];
143124
- value = parseIntAuto(ref[2]);
143125
- if (value > 65535 || value < 0) throw new Error("ipaddr: address outside defined range");
143126
- results.push(parseIntAuto(ref[0]));
143127
- results.push(parseIntAuto(ref[1]));
143128
- results.push(value >> 8 & 255);
143129
- results.push(value & 255);
143130
- return results;
143131
- })();
143132
- else return null;
143133
- };
143134
- ipaddr.IPv4.subnetMaskFromPrefixLength = function(prefix) {
143135
- prefix = parseInt(prefix);
143136
- if (Number.isNaN(prefix) || prefix < 0 || prefix > 32) throw new Error("ipaddr: invalid IPv4 prefix length");
143137
- const octets = [
143138
- 0,
143139
- 0,
143140
- 0,
143141
- 0
143142
- ];
143143
- let j = 0;
143144
- const filledOctetCount = Math.floor(prefix / 8);
143145
- while (j < filledOctetCount) {
143146
- octets[j] = 255;
143147
- j++;
143148
- }
143149
- if (filledOctetCount < 4) octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - prefix % 8;
143150
- return new this(octets);
143151
- };
143152
- ipaddr.IPv6 = (function() {
143153
- function IPv6(parts, zoneId) {
143154
- let i, part;
143155
- if (parts.length === 16) {
143156
- this.parts = [];
143157
- for (i = 0; i <= 14; i += 2) this.parts.push(parts[i] << 8 | parts[i + 1]);
143158
- } else if (parts.length === 8) this.parts = parts;
143159
- else throw new Error("ipaddr: ipv6 part count should be 8 or 16");
143160
- for (i = 0; i < this.parts.length; i++) {
143161
- part = this.parts[i];
143162
- if (!(0 <= part && part <= 65535)) throw new Error("ipaddr: ipv6 part should fit in 16 bits");
143163
- }
143164
- if (zoneId) this.zoneId = zoneId;
143165
- }
143166
- IPv6.prototype.SpecialRanges = {
143167
- unspecified: [new IPv6([
143168
- 0,
143169
- 0,
143170
- 0,
143171
- 0,
143172
- 0,
143173
- 0,
143174
- 0,
143175
- 0
143176
- ]), 128],
143177
- linkLocal: [new IPv6([
143178
- 65152,
143179
- 0,
143180
- 0,
143181
- 0,
143182
- 0,
143183
- 0,
143184
- 0,
143185
- 0
143186
- ]), 10],
143187
- multicast: [new IPv6([
143188
- 65280,
143189
- 0,
143190
- 0,
143191
- 0,
143192
- 0,
143193
- 0,
143194
- 0,
143195
- 0
143196
- ]), 8],
143197
- loopback: [new IPv6([
143198
- 0,
143199
- 0,
143200
- 0,
143201
- 0,
143202
- 0,
143203
- 0,
143204
- 0,
143205
- 1
143206
- ]), 128],
143207
- uniqueLocal: [new IPv6([
143208
- 64512,
143209
- 0,
143210
- 0,
143211
- 0,
143212
- 0,
143213
- 0,
143214
- 0,
143215
- 0
143216
- ]), 7],
143217
- ipv4Mapped: [new IPv6([
143218
- 0,
143219
- 0,
143220
- 0,
143221
- 0,
143222
- 0,
143223
- 65535,
143224
- 0,
143225
- 0
143226
- ]), 96],
143227
- deprecatedSiteLocal: [new IPv6([
143228
- 65216,
143229
- 0,
143230
- 0,
143231
- 0,
143232
- 0,
143233
- 0,
143234
- 0,
143235
- 0
143236
- ]), 10],
143237
- discard: [new IPv6([
143238
- 256,
143239
- 0,
143240
- 0,
143241
- 0,
143242
- 0,
143243
- 0,
143244
- 0,
143245
- 0
143246
- ]), 64],
143247
- rfc6145: [new IPv6([
143248
- 0,
143249
- 0,
143250
- 0,
143251
- 0,
143252
- 65535,
143253
- 0,
143254
- 0,
143255
- 0
143256
- ]), 96],
143257
- rfc6052: [[new IPv6([
143258
- 100,
143259
- 65435,
143260
- 0,
143261
- 0,
143262
- 0,
143263
- 0,
143264
- 0,
143265
- 0
143266
- ]), 96], [new IPv6([
143267
- 100,
143268
- 65435,
143269
- 1,
143270
- 0,
143271
- 0,
143272
- 0,
143273
- 0,
143274
- 0
143275
- ]), 48]],
143276
- "6to4": [new IPv6([
143277
- 8194,
143278
- 0,
143279
- 0,
143280
- 0,
143281
- 0,
143282
- 0,
143283
- 0,
143284
- 0
143285
- ]), 16],
143286
- teredo: [new IPv6([
143287
- 8193,
143288
- 0,
143289
- 0,
143290
- 0,
143291
- 0,
143292
- 0,
143293
- 0,
143294
- 0
143295
- ]), 32],
143296
- benchmarking: [new IPv6([
143297
- 8193,
143298
- 2,
143299
- 0,
143300
- 0,
143301
- 0,
143302
- 0,
143303
- 0,
143304
- 0
143305
- ]), 48],
143306
- amt: [new IPv6([
143307
- 8193,
143308
- 3,
143309
- 0,
143310
- 0,
143311
- 0,
143312
- 0,
143313
- 0,
143314
- 0
143315
- ]), 32],
143316
- as112v6: [[new IPv6([
143317
- 8193,
143318
- 4,
143319
- 274,
143320
- 0,
143321
- 0,
143322
- 0,
143323
- 0,
143324
- 0
143325
- ]), 48], [new IPv6([
143326
- 9760,
143327
- 79,
143328
- 32768,
143329
- 0,
143330
- 0,
143331
- 0,
143332
- 0,
143333
- 0
143334
- ]), 48]],
143335
- deprecatedOrchid: [new IPv6([
143336
- 8193,
143337
- 16,
143338
- 0,
143339
- 0,
143340
- 0,
143341
- 0,
143342
- 0,
143343
- 0
143344
- ]), 28],
143345
- orchid2: [new IPv6([
143346
- 8193,
143347
- 32,
143348
- 0,
143349
- 0,
143350
- 0,
143351
- 0,
143352
- 0,
143353
- 0
143354
- ]), 28],
143355
- droneRemoteIdProtocolEntityTags: [new IPv6([
143356
- 8193,
143357
- 48,
143358
- 0,
143359
- 0,
143360
- 0,
143361
- 0,
143362
- 0,
143363
- 0
143364
- ]), 28],
143365
- segmentRouting: [new IPv6([
143366
- 24320,
143367
- 0,
143368
- 0,
143369
- 0,
143370
- 0,
143371
- 0,
143372
- 0,
143373
- 0
143374
- ]), 16],
143375
- reserved: [
143376
- [new IPv6([
143377
- 8193,
143378
- 0,
143379
- 0,
143380
- 0,
143381
- 0,
143382
- 0,
143383
- 0,
143384
- 0
143385
- ]), 23],
143386
- [new IPv6([
143387
- 8193,
143388
- 3512,
143389
- 0,
143390
- 0,
143391
- 0,
143392
- 0,
143393
- 0,
143394
- 0
143395
- ]), 32],
143396
- [new IPv6([
143397
- 16383,
143398
- 0,
143399
- 0,
143400
- 0,
143401
- 0,
143402
- 0,
143403
- 0,
143404
- 0
143405
- ]), 20]
143406
- ]
143407
- };
143408
- IPv6.prototype.isIPv4MappedAddress = function() {
143409
- return this.range() === "ipv4Mapped";
143410
- };
143411
- IPv6.prototype.kind = function() {
143412
- return "ipv6";
143413
- };
143414
- IPv6.prototype.match = function(other, cidrRange) {
143415
- let ref;
143416
- if (cidrRange === void 0) {
143417
- ref = other;
143418
- other = ref[0];
143419
- cidrRange = ref[1];
143420
- }
143421
- if (other.kind() !== "ipv6") throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");
143422
- return matchCIDR(this.parts, other.parts, 16, cidrRange);
143423
- };
143424
- IPv6.prototype.prefixLengthFromSubnetMask = function() {
143425
- let cidr = 0;
143426
- let stop = false;
143427
- const zerotable = {
143428
- 0: 16,
143429
- 32768: 15,
143430
- 49152: 14,
143431
- 57344: 13,
143432
- 61440: 12,
143433
- 63488: 11,
143434
- 64512: 10,
143435
- 65024: 9,
143436
- 65280: 8,
143437
- 65408: 7,
143438
- 65472: 6,
143439
- 65504: 5,
143440
- 65520: 4,
143441
- 65528: 3,
143442
- 65532: 2,
143443
- 65534: 1,
143444
- 65535: 0
143445
- };
143446
- let part, zeros;
143447
- for (let i = 7; i >= 0; i -= 1) {
143448
- part = this.parts[i];
143449
- if (part in zerotable) {
143450
- zeros = zerotable[part];
143451
- if (stop && zeros !== 0) return null;
143452
- if (zeros !== 16) stop = true;
143453
- cidr += zeros;
143454
- } else return null;
143455
- }
143456
- return 128 - cidr;
143457
- };
143458
- IPv6.prototype.range = function() {
143459
- return ipaddr.subnetMatch(this, this.SpecialRanges);
143460
- };
143461
- IPv6.prototype.toByteArray = function() {
143462
- let part;
143463
- const bytes = [];
143464
- const ref = this.parts;
143465
- for (let i = 0; i < ref.length; i++) {
143466
- part = ref[i];
143467
- bytes.push(part >> 8);
143468
- bytes.push(part & 255);
143469
- }
143470
- return bytes;
143471
- };
143472
- IPv6.prototype.toFixedLengthString = function() {
143473
- const addr = (function() {
143474
- const results = [];
143475
- for (let i = 0; i < this.parts.length; i++) results.push(padPart(this.parts[i].toString(16), 4));
143476
- return results;
143477
- }).call(this).join(":");
143478
- let suffix = "";
143479
- if (this.zoneId) suffix = `%${this.zoneId}`;
143480
- return addr + suffix;
143481
- };
143482
- IPv6.prototype.toIPv4Address = function() {
143483
- if (!this.isIPv4MappedAddress()) throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");
143484
- const ref = this.parts.slice(-2);
143485
- const high = ref[0];
143486
- const low = ref[1];
143487
- return new ipaddr.IPv4([
143488
- high >> 8,
143489
- high & 255,
143490
- low >> 8,
143491
- low & 255
143492
- ]);
143493
- };
143494
- IPv6.prototype.toNormalizedString = function() {
143495
- const addr = (function() {
143496
- const results = [];
143497
- for (let i = 0; i < this.parts.length; i++) results.push(this.parts[i].toString(16));
143498
- return results;
143499
- }).call(this).join(":");
143500
- let suffix = "";
143501
- if (this.zoneId) suffix = `%${this.zoneId}`;
143502
- return addr + suffix;
143503
- };
143504
- IPv6.prototype.toRFC5952String = function() {
143505
- const regex = /((^|:)(0(:|$)){2,})/g;
143506
- let suffix = "";
143507
- if (this.zoneId) suffix = `%${this.zoneId}`;
143508
- const normalized = this.toNormalizedString();
143509
- const string = normalized.slice(0, normalized.length - suffix.length);
143510
- let bestMatchIndex = 0;
143511
- let bestMatchLength = -1;
143512
- let bestMatchGroups = -1;
143513
- let match;
143514
- while (match = regex.exec(string)) {
143515
- const groups = (match[0].match(/0/g) || []).length;
143516
- if (groups > bestMatchGroups) {
143517
- bestMatchGroups = groups;
143518
- bestMatchIndex = match.index;
143519
- bestMatchLength = match[0].length;
143520
- }
143521
- }
143522
- if (bestMatchLength < 0) return string + suffix;
143523
- return `${string.substring(0, bestMatchIndex)}::${string.substring(bestMatchIndex + bestMatchLength)}${suffix}`;
143524
- };
143525
- IPv6.prototype.toString = function() {
143526
- return this.toRFC5952String();
143527
- };
143528
- return IPv6;
143529
- })();
143530
- ipaddr.IPv6.broadcastAddressFromCIDR = function(string) {
143531
- try {
143532
- const cidr = this.parseCIDR(string);
143533
- const ipInterfaceOctets = cidr[0].toByteArray();
143534
- const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
143535
- const octets = [];
143536
- let i = 0;
143537
- while (i < 16) {
143538
- octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255);
143539
- i++;
143540
- }
143541
- return new this(octets);
143542
- } catch (e) {
143543
- throw new Error("ipaddr: the address does not have IPv6 CIDR format", { cause: e });
143544
- }
143545
- };
143546
- ipaddr.IPv6.isIPv6 = function(string) {
143547
- return this.parser(string) !== null;
143548
- };
143549
- ipaddr.IPv6.isValid = function(string) {
143550
- if (typeof string === "string" && string.indexOf(":") === -1) return false;
143551
- try {
143552
- const addr = this.parser(string);
143553
- new this(addr.parts, addr.zoneId);
143554
- return true;
143555
- } catch {
143556
- return false;
143557
- }
143558
- };
143559
- ipaddr.IPv6.isValidCIDR = function(string) {
143560
- if (typeof string === "string" && string.indexOf(":") === -1) return false;
143561
- try {
143562
- this.parseCIDR(string);
143563
- return true;
143564
- } catch {
143565
- return false;
143566
- }
143567
- };
143568
- ipaddr.IPv6.networkAddressFromCIDR = function(string) {
143569
- let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;
143570
- try {
143571
- cidr = this.parseCIDR(string);
143572
- ipInterfaceOctets = cidr[0].toByteArray();
143573
- subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
143574
- octets = [];
143575
- i = 0;
143576
- while (i < 16) {
143577
- octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));
143578
- i++;
143579
- }
143580
- return new this(octets);
143581
- } catch (e) {
143582
- throw new Error("ipaddr: the address does not have IPv6 CIDR format", { cause: e });
143583
- }
143584
- };
143585
- ipaddr.IPv6.parse = function(string) {
143586
- const addr = this.parser(string);
143587
- if (addr === null) throw new Error("ipaddr: string is not formatted like an IPv6 Address");
143588
- return new this(addr.parts, addr.zoneId);
143589
- };
143590
- ipaddr.IPv6.parseCIDR = function(string) {
143591
- let maskLength, match, parsed;
143592
- if (match = string.match(/^(.+)\/(\d+)$/)) {
143593
- maskLength = parseInt(match[2]);
143594
- if (maskLength >= 0 && maskLength <= 128) {
143595
- parsed = [this.parse(match[1]), maskLength];
143596
- Object.defineProperty(parsed, "toString", { value: function() {
143597
- return this.join("/");
143598
- } });
143599
- return parsed;
143600
- }
143601
- }
143602
- throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range");
143603
- };
143604
- ipaddr.IPv6.parser = function(string) {
143605
- let addr, i, match, octet, octets, zoneId;
143606
- if (match = string.match(ipv6Regexes.deprecatedTransitional)) return this.parser(`::ffff:${match[1]}`);
143607
- if (ipv6Regexes.native.test(string)) return expandIPv6(string, 8);
143608
- if (match = string.match(ipv6Regexes.transitional)) {
143609
- zoneId = match[6] || "";
143610
- addr = match[1];
143611
- if (!match[1].endsWith("::")) addr = addr.slice(0, -1);
143612
- addr = expandIPv6(addr + zoneId, 6);
143613
- if (addr && addr.parts) {
143614
- octets = [
143615
- parseInt(match[2]),
143616
- parseInt(match[3]),
143617
- parseInt(match[4]),
143618
- parseInt(match[5])
143619
- ];
143620
- for (i = 0; i < octets.length; i++) {
143621
- octet = octets[i];
143622
- if (!(0 <= octet && octet <= 255)) return null;
143623
- }
143624
- addr.parts.push(octets[0] << 8 | octets[1]);
143625
- addr.parts.push(octets[2] << 8 | octets[3]);
143626
- return {
143627
- parts: addr.parts,
143628
- zoneId: addr.zoneId
143629
- };
143630
- }
143631
- }
143632
- return null;
143633
- };
143634
- ipaddr.IPv6.subnetMaskFromPrefixLength = function(prefix) {
143635
- prefix = parseInt(prefix);
143636
- if (Number.isNaN(prefix) || prefix < 0 || prefix > 128) throw new Error("ipaddr: invalid IPv6 prefix length");
143637
- const octets = [
143638
- 0,
143639
- 0,
143640
- 0,
143641
- 0,
143642
- 0,
143643
- 0,
143644
- 0,
143645
- 0,
143646
- 0,
143647
- 0,
143648
- 0,
143649
- 0,
143650
- 0,
143651
- 0,
143652
- 0,
143653
- 0
143654
- ];
143655
- let j = 0;
143656
- const filledOctetCount = Math.floor(prefix / 8);
143657
- while (j < filledOctetCount) {
143658
- octets[j] = 255;
143659
- j++;
143660
- }
143661
- if (filledOctetCount < 16) octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - prefix % 8;
143662
- return new this(octets);
143663
- };
143664
- ipaddr.fromByteArray = function(bytes) {
143665
- const length = bytes.length;
143666
- if (length === 4) return new ipaddr.IPv4(bytes);
143667
- else if (length === 16) return new ipaddr.IPv6(bytes);
143668
- else throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address");
143669
- };
143670
- ipaddr.isValid = function(string) {
143671
- return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string);
143672
- };
143673
- ipaddr.isValidCIDR = function(string) {
143674
- return ipaddr.IPv6.isValidCIDR(string) || ipaddr.IPv4.isValidCIDR(string);
143675
- };
143676
- ipaddr.parse = function(string) {
143677
- if (ipaddr.IPv6.isValid(string)) return ipaddr.IPv6.parse(string);
143678
- else if (ipaddr.IPv4.isValid(string)) return ipaddr.IPv4.parse(string);
143679
- else throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format");
143680
- };
143681
- ipaddr.parseCIDR = function(string) {
143682
- try {
143683
- return ipaddr.IPv6.parseCIDR(string);
143684
- } catch {
143685
- try {
143686
- return ipaddr.IPv4.parseCIDR(string);
143687
- } catch (e) {
143688
- throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format", { cause: e });
143689
- }
143690
- }
143691
- };
143692
- ipaddr.process = function(string) {
143693
- const addr = this.parse(string);
143694
- if (addr.kind() === "ipv6" && addr.isIPv4MappedAddress()) return addr.toIPv4Address();
143695
- else return addr;
143696
- };
143697
- ipaddr.subnetMatch = function(address, rangeList, defaultName) {
143698
- let i, rangeName, rangeSubnets, subnet;
143699
- if (defaultName === void 0 || defaultName === null) defaultName = "unicast";
143700
- for (rangeName in rangeList) if (Object.prototype.hasOwnProperty.call(rangeList, rangeName)) {
143701
- rangeSubnets = rangeList[rangeName];
143702
- if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) rangeSubnets = [rangeSubnets];
143703
- for (i = 0; i < rangeSubnets.length; i++) {
143704
- subnet = rangeSubnets[i];
143705
- if (address.kind() === subnet[0].kind() && address.match.apply(address, subnet)) return rangeName;
143706
- }
143707
- }
143708
- return defaultName;
143709
- };
143710
- if (typeof module !== "undefined" && module.exports) module.exports = ipaddr;
143711
- else root.ipaddr = ipaddr;
143712
- })(this$1);
143713
- })))(), 1);
143714
143291
  function requestUrl(input) {
143715
143292
  if (input instanceof Request) return new URL(input.url);
143716
143293
  return new URL(input.toString());
143717
143294
  }
143718
- function publicAddress(address) {
143719
- return import_ipaddr.default.isValid(address) && import_ipaddr.default.process(address).range() === "unicast";
143720
- }
143721
143295
  const layerPublicFetch = effect(Fetch)(gen(function* () {
143722
143296
  const fetch = yield* Fetch;
143723
143297
  const dispatcher = yield* acquireRelease(sync(() => new Undici_exports.Agent({ connect: { lookup: (hostname, options, callback) => {
143724
143298
  lookup(hostname, { all: true }, (error, addresses) => {
143725
- if (error !== null || isArrayEmpty(addresses) || !every$1(addresses, (entry) => publicAddress(entry.address))) {
143299
+ if (error !== null || isArrayEmpty(addresses) || !every$1(addresses, (entry) => isPublicAddress(entry.address))) {
143726
143300
  callback(error ?? AuthError.make({ message: "MCP endpoints must resolve to public addresses" }), "", 4);
143727
143301
  return;
143728
143302
  }
@@ -143733,7 +143307,7 @@ const layerPublicFetch = effect(Fetch)(gen(function* () {
143733
143307
  return (input, options) => {
143734
143308
  const url = requestUrl(input);
143735
143309
  const hostname = replaceAll(/^\[|\]$/gu, "")(url.hostname);
143736
- if (url.protocol !== "https:" || url.username !== "" || url.password !== "" || url.hash !== "" || import_ipaddr.default.isValid(hostname) && !publicAddress(hostname)) return runPromise(fail$6(AuthError.make({ message: "MCP endpoints must use public HTTPS URLs" })));
143310
+ if (url.protocol !== "https:" || url.username !== "" || url.password !== "" || url.hash !== "" || isIpAddress(hostname) && !isPublicAddress(hostname)) return runPromise(fail$6(AuthError.make({ message: "MCP endpoints must use public HTTPS URLs" })));
143737
143311
  const init = {
143738
143312
  ...options,
143739
143313
  dispatcher,
@@ -143775,26 +143349,25 @@ const ToolHandlers = Tools.toLayer(gen(function* () {
143775
143349
  })) };
143776
143350
  }) });
143777
143351
  }));
143778
- const layerMcp = unwrap$7(gen(function* () {
143779
- const now = yield* currentTimeMillis;
143780
- return pipe$1(layerMcp$1({
143781
- instructions: join$2([
143782
- "Gateway to the user's MCP servers; tools are named <server>__<tool>.",
143783
- ...map$8(filter$5(yield* (yield* Connections).definitions, (server) => connectionStatus(server, now) === "Connected"), (server) => `${server.id}: ${summary(server)}`),
143784
- "If a tool is missing or failing, list_mcp_connections says why."
143785
- ], "\n"),
143786
- registrations: pipe$1(toolkit(Tools), provide$2(ToolHandlers))
143787
- }), provide$2(GatewayDiscovery.layer), provide$2(McpServer.layer));
143788
- }));
143789
143352
  // src/main.server.ts
143790
143353
  const layerServices = pipe$1(Gateway.layer, provide$2(McpServer.layer), provideMerge(Connections.layer), provide$2(mergeAll$1(layerDataStore, layerUpstream)));
143791
143354
  runApp({
143792
143355
  icon: icon_default,
143793
- routes: pipe$1(mergeAll$1(HttpHandlers, pipe$1(layerHttp$1({
143356
+ routes: pipe$1(mergeAll$1(HttpHandlers, layerRpc({
143794
143357
  group: RpcContracts,
143795
- path: "/api/rpc",
143796
- protocol: "websocket"
143797
- }), provide$2(RpcHandlers)), layerMcp), provide$2(layerServices)),
143358
+ handlers: RpcHandlers
143359
+ }), unwrap$7(gen(function* () {
143360
+ const now = yield* currentTimeMillis;
143361
+ return pipe$1(layerMcp({
143362
+ handlers: ToolHandlers,
143363
+ instructions: join$2([
143364
+ "Gateway to the user's MCP servers; tools are named <server>__<tool>.",
143365
+ ...map$8(filter$5(yield* (yield* Connections).definitions, (server) => connectionStatus(server, now) === "Connected"), (server) => `${server.id}: ${summary(server)}`),
143366
+ "If a tool is missing or failing, list_mcp_connections says why."
143367
+ ], "\n"),
143368
+ tools: Tools
143369
+ }), provide$2(GatewayDiscovery.layer), provide$2(McpServer.layer));
143370
+ }))), provide$2(layerServices)),
143798
143371
  settings: { GITHUB_ADMINS: ADMINS }
143799
143372
  });
143800
143373
  export {};