@synnaxlabs/freighter 0.37.0 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/freighter.js CHANGED
@@ -15,9 +15,9 @@ const dt = (r) => {
15
15
  return Object.keys(a).forEach((c) => {
16
16
  let f = a[c];
17
17
  const d = r(c);
18
- n.recursive && (ce(f) ? Ne(f, n.keepTypesOnRecursion) || (f = e(f, n)) : n.recursiveInArray && Ie(f) && (f = [...f].map((p) => {
18
+ n.recursive && (ce(f) ? Ie(f, n.keepTypesOnRecursion) || (f = e(f, n)) : n.recursiveInArray && Ne(f) && (f = [...f].map((p) => {
19
19
  let m = p;
20
- return ce(p) ? Ne(m, n.keepTypesOnRecursion) || (m = e(p, n)) : Ie(p) && (m = e({ key: p }, n).key), m;
20
+ return ce(p) ? Ie(m, n.keepTypesOnRecursion) || (m = e(p, n)) : Ne(p) && (m = e({ key: p }, n).key), m;
21
21
  }))), s[d] = f;
22
22
  }), s;
23
23
  };
@@ -25,12 +25,15 @@ const dt = (r) => {
25
25
  }, Ve = ze(dt), gt = (r) => (
26
26
  // Don't convert the first character and don't convert a character that is after a
27
27
  // non-alphanumeric character
28
- r.replace(/([a-z0-9])([A-Z])/g, (e, t, n) => `${t}_${n.toLowerCase()}`)
28
+ r.replace(
29
+ /([a-z0-9])([A-Z])/g,
30
+ (e, t, n) => `${t}_${n.toLowerCase()}`
31
+ )
29
32
  ), pt = ze(gt), de = {
30
33
  recursive: !0,
31
34
  recursiveInArray: !0,
32
35
  keepTypesOnRecursion: [Number, String, Uint8Array]
33
- }, yt = (r = de) => (r.recursive == null ? r = de : r.recursiveInArray ?? (r.recursiveInArray = !1), r), Ie = (r) => r != null && Array.isArray(r), ce = (r) => r != null && typeof r == "object" && !Array.isArray(r), Ne = (r, e) => (e || []).some((t) => r instanceof t), Ze = (r) => r != null && typeof r == "object" && !Array.isArray(r);
36
+ }, yt = (r = de) => (r.recursive == null ? r = de : r.recursiveInArray ?? (r.recursiveInArray = !1), r), Ne = (r) => r != null && Array.isArray(r), ce = (r) => r != null && typeof r == "object" && !Array.isArray(r), Ie = (r, e) => (e || []).some((t) => r instanceof t), Ze = (r) => r != null && typeof r == "object" && !Array.isArray(r);
34
37
  var mt = Object.defineProperty, wt = (r, e, t) => e in r ? mt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, Q = (r, e, t) => wt(r, typeof e != "symbol" ? e + "" : e, t);
35
38
  let bt = class {
36
39
  constructor() {
@@ -52,7 +55,7 @@ let bt = class {
52
55
  }
53
56
  static registerCustomType() {
54
57
  }
55
- }, Ot = class {
58
+ }, Tt = class {
56
59
  constructor() {
57
60
  Q(this, "contentType", "text/csv");
58
61
  }
@@ -97,7 +100,7 @@ let bt = class {
97
100
  }
98
101
  static registerCustomType() {
99
102
  }
100
- }, Tt = class {
103
+ }, Ot = class {
101
104
  constructor() {
102
105
  Q(this, "contentType", "text/plain");
103
106
  }
@@ -110,8 +113,8 @@ let bt = class {
110
113
  }
111
114
  };
112
115
  const ee = new bt();
113
- new Ot();
114
116
  new Tt();
117
+ new Ot();
115
118
  const vt = (r) => r != null && typeof r == "object" && "toString" in r, St = (r, e = !1) => {
116
119
  const t = vt(r) ? "stringer" : typeof r;
117
120
  let n;
@@ -137,10 +140,10 @@ const vt = (r) => r != null && typeof r == "object" && "toString" in r, St = (r,
137
140
  default:
138
141
  return console.warn(`sortFunc: unknown type ${t}`), () => -1;
139
142
  }
140
- return e ? It(n) : n;
141
- }, It = (r) => (e, t) => r(t, e), ae = i.tuple([i.number(), i.number()]);
143
+ return e ? Nt(n) : n;
144
+ }, Nt = (r) => (e, t) => r(t, e), ae = i.tuple([i.number(), i.number()]);
142
145
  i.tuple([i.bigint(), i.bigint()]);
143
- const Je = i.object({ width: i.number(), height: i.number() }), Nt = i.object({
146
+ const Je = i.object({ width: i.number(), height: i.number() }), It = i.object({
144
147
  signedWidth: i.number(),
145
148
  signedHeight: i.number()
146
149
  }), Et = ["width", "height"];
@@ -149,16 +152,16 @@ const At = ["start", "center", "end"], xt = ["signedWidth", "signedHeight"];
149
152
  i.enum(xt);
150
153
  const se = i.object({ x: i.number(), y: i.number() }), Mt = i.object({ clientX: i.number(), clientY: i.number() }), $t = ["x", "y"], He = i.enum($t), Xe = ["top", "right", "bottom", "left"];
151
154
  i.enum(Xe);
152
- const Bt = ["left", "right"], Ke = i.enum(Bt), Rt = ["top", "bottom"], Qe = i.enum(Rt), _e = ["center"], Ee = i.enum(_e), Ut = [...Xe, ..._e], et = i.enum(Ut);
155
+ const Ut = ["left", "right"], Ke = i.enum(Ut), Bt = ["top", "bottom"], Qe = i.enum(Bt), _e = ["center"], Ee = i.enum(_e), Rt = [...Xe, ..._e], et = i.enum(Rt);
153
156
  i.enum(At);
154
157
  const Ct = ["first", "last"];
155
158
  i.enum(Ct);
156
- const Dt = i.object({ lower: i.number(), upper: i.number() }), Pt = i.object({ lower: i.bigint(), upper: i.bigint() });
159
+ const Dt = i.object({ lower: i.number(), upper: i.number() }), Lt = i.object({ lower: i.bigint(), upper: i.bigint() });
157
160
  i.union([Dt, ae]);
158
- i.union([Pt, ae]);
161
+ i.union([Lt, ae]);
159
162
  i.union([He, et]);
160
163
  i.union([He, et, i.instanceof(String)]);
161
- const Lt = (r) => typeof r == "bigint" || r instanceof BigInt, F = (r, e) => Lt(r) ? r.valueOf() * BigInt(e.valueOf()) : r.valueOf() * Number(e.valueOf()), j = (r, e) => {
164
+ const Pt = (r) => typeof r == "bigint" || r instanceof BigInt, q = (r, e) => Pt(r) ? r.valueOf() * BigInt(e.valueOf()) : r.valueOf() * Number(e.valueOf()), j = (r, e) => {
162
165
  const t = {};
163
166
  if (typeof r == "number" || typeof r == "bigint")
164
167
  e != null ? (t.lower = r, t.upper = e) : (t.lower = typeof r == "bigint" ? 0n : 0, t.upper = r);
@@ -180,9 +183,9 @@ const Yt = i.object({ x: Ke, y: Qe }), kt = Object.freeze({ x: "left", y: "top"
180
183
  se,
181
184
  ae,
182
185
  Je,
183
- Nt,
186
+ It,
184
187
  Mt
185
- ]), Ft = (r, e) => {
188
+ ]), qt = (r, e) => {
186
189
  if (typeof r == "string") {
187
190
  if (e === void 0) throw new Error("The y coordinate must be given.");
188
191
  return r === "x" ? { x: e, y: 0 } : { x: 0, y: e };
@@ -206,7 +209,7 @@ i.object({
206
209
  two: se,
207
210
  root: Yt
208
211
  });
209
- const Oe = (r, e, t = 0, n = 0, s) => {
212
+ const Te = (r, e, t = 0, n = 0, s) => {
210
213
  const a = {
211
214
  one: { ...$e },
212
215
  two: { ...$e },
@@ -225,13 +228,13 @@ const Oe = (r, e, t = 0, n = 0, s) => {
225
228
  y: a.one.y + e.signedHeight
226
229
  } : a.two = e, a));
227
230
  }, le = (r) => {
228
- const e = Oe(r);
231
+ const e = Te(r);
229
232
  return { lower: e.one.x, upper: e.two.x };
230
233
  }, he = (r) => {
231
- const e = Oe(r);
234
+ const e = Te(r);
232
235
  return { lower: e.one.y, upper: e.two.y };
233
- }, Gt = (r) => typeof r != "object" || r == null ? !1 : "one" in r && "two" in r && "root" in r, qt = i.object({ signedWidth: i.number(), signedHeight: i.number() });
234
- i.union([Je, qt, se, ae]);
236
+ }, Ft = (r) => typeof r != "object" || r == null ? !1 : "one" in r && "two" in r && "root" in r, Gt = i.object({ signedWidth: i.number(), signedHeight: i.number() });
237
+ i.union([Je, Gt, se, ae]);
235
238
  var Wt = Object.defineProperty, zt = (r, e, t) => e in r ? Wt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, D = (r, e, t) => zt(r, typeof e != "symbol" ? e + "" : e, t);
236
239
  const Vt = (r, e, t) => e !== void 0 && r < e ? e : t !== void 0 && r > t ? t : r;
237
240
  i.object({ offset: Me, scale: Me });
@@ -352,9 +355,9 @@ const Zt = (r) => (e, t, n, s) => t === "dimension" ? [e, n] : [
352
355
  }
353
356
  };
354
357
  D(ge, "IDENTITY", new ge());
355
- let Be = ge;
356
- const Re = class C {
357
- constructor(e = new Be(), t = new Be(), n = null) {
358
+ let Ue = ge;
359
+ const Be = class C {
360
+ constructor(e = new Ue(), t = new Ue(), n = null) {
358
361
  D(this, "x"), D(this, "y"), D(this, "currRoot"), this.x = e, this.y = t, this.currRoot = n;
359
362
  }
360
363
  static translate(e, t) {
@@ -379,7 +382,7 @@ const Re = class C {
379
382
  return new C().reBound(e);
380
383
  }
381
384
  translate(e, t) {
382
- const n = Ft(e, t), s = this.copy();
385
+ const n = qt(e, t), s = this.copy();
383
386
  return s.x = this.x.translate(n.x), s.y = this.y.translate(n.y), s;
384
387
  }
385
388
  translateX(e) {
@@ -396,7 +399,7 @@ const Re = class C {
396
399
  }
397
400
  scale(e) {
398
401
  const t = this.copy();
399
- if (Gt(e)) {
402
+ if (Ft(e)) {
400
403
  const n = this.currRoot;
401
404
  return t.currRoot = e.root, n != null && !jt(n, e.root) && (n.x !== e.root.x && (t.x = t.x.invert()), n.y !== e.root.y && (t.y = t.y.invert())), t.x = t.x.scale(le(e)), t.y = t.y.scale(he(e)), t;
402
405
  }
@@ -425,7 +428,7 @@ const Re = class C {
425
428
  return { x: this.x.dim(e.x), y: this.y.dim(e.y) };
426
429
  }
427
430
  box(e) {
428
- return Oe(
431
+ return Te(
429
432
  this.pos(e.one),
430
433
  this.pos(e.two),
431
434
  0,
@@ -440,7 +443,7 @@ const Re = class C {
440
443
  };
441
444
  }
442
445
  };
443
- D(Re, "IDENTITY", new Re());
446
+ D(Be, "IDENTITY", new Be());
444
447
  const _t = i.bigint().or(i.string().transform(BigInt));
445
448
  var er = Object.defineProperty, tr = (r, e, t) => e in r ? er(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, u = (r, e, t) => tr(r, typeof e != "symbol" ? e + "" : e, t);
446
449
  let rr = (r, e = 21) => (t = e) => {
@@ -452,20 +455,20 @@ let rr = (r, e = 21) => (t = e) => {
452
455
  const nr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", sr = rr(nr, 11), ir = i.enum(["static", "dynamic"]), tt = (r, e) => {
453
456
  const t = new v(e);
454
457
  if (![
455
- T.DAY,
456
- T.HOUR,
457
- T.MINUTE,
458
- T.SECOND,
459
- T.MILLISECOND,
460
- T.MICROSECOND,
461
- T.NANOSECOND
458
+ O.DAY,
459
+ O.HOUR,
460
+ O.MINUTE,
461
+ O.SECOND,
462
+ O.MILLISECOND,
463
+ O.MICROSECOND,
464
+ O.NANOSECOND
462
465
  ].some((s) => s.equals(t)))
463
466
  throw new Error(
464
467
  "Invalid argument for remainder. Must be an even TimeSpan or Timestamp"
465
468
  );
466
469
  const n = r.valueOf() % t.valueOf();
467
- return r instanceof v ? new v(n) : new T(n);
468
- }, w = class h {
470
+ return r instanceof v ? new v(n) : new O(n);
471
+ }, b = class h {
469
472
  constructor(e, t = "UTC") {
470
473
  if (u(this, "value"), u(this, "encodeValue", !0), e == null) this.value = h.now().valueOf();
471
474
  else if (e instanceof Date)
@@ -536,7 +539,7 @@ const nr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", sr
536
539
  return `${t} ${n}`;
537
540
  }
538
541
  static get utcOffset() {
539
- return new T(
542
+ return new O(
540
543
  BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * h.MINUTE.valueOf()
541
544
  );
542
545
  }
@@ -579,7 +582,7 @@ const nr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", sr
579
582
  * valid, regardless of the TimeStamp order.
580
583
  */
581
584
  range(e) {
582
- return new Te(this, e).makeValid();
585
+ return new Oe(this, e).makeValid();
583
586
  }
584
587
  /**
585
588
  * Creates a TimeRange starting at the TimeStamp and spanning the given
@@ -665,28 +668,28 @@ const nr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", sr
665
668
  * value.
666
669
  */
667
670
  get hours() {
668
- return Number(this.valueOf()) / Number(T.HOUR.valueOf());
671
+ return Number(this.valueOf()) / Number(O.HOUR.valueOf());
669
672
  }
670
673
  /**
671
674
  * @returns the floating point number of minutes since the unix epoch to the timestamp
672
675
  * value.
673
676
  */
674
677
  get minutes() {
675
- return Number(this.valueOf()) / Number(T.MINUTE.valueOf());
678
+ return Number(this.valueOf()) / Number(O.MINUTE.valueOf());
676
679
  }
677
680
  /**
678
681
  * @returns the floating point number of days since the unix epoch to the timestamp
679
682
  * value.
680
683
  */
681
684
  get days() {
682
- return Number(this.valueOf()) / Number(T.DAY.valueOf());
685
+ return Number(this.valueOf()) / Number(O.DAY.valueOf());
683
686
  }
684
687
  /**
685
688
  * @returns the floating point number of seconds since the unix epoch to the timestamp
686
689
  * value.
687
690
  */
688
691
  get seconds() {
689
- return Number(this.valueOf()) / Number(T.SECOND.valueOf());
692
+ return Number(this.valueOf()) / Number(O.SECOND.valueOf());
690
693
  }
691
694
  /**
692
695
  * @returns The number of milliseconds since the unix epoch.
@@ -767,7 +770,7 @@ const nr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", sr
767
770
  }
768
771
  /** @returns true if the day portion TimeStamp is today, false otherwise. */
769
772
  get isToday() {
770
- return this.truncate(T.DAY).equals(h.now().truncate(T.DAY));
773
+ return this.truncate(O.DAY).equals(h.now().truncate(O.DAY));
771
774
  }
772
775
  truncate(e) {
773
776
  return this.sub(this.remainder(e));
@@ -825,33 +828,33 @@ const nr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", sr
825
828
  return h.hours(e * 24);
826
829
  }
827
830
  };
828
- u(w, "NANOSECOND", w.nanoseconds(1)), /** One microsecond after the unix epoch */
829
- u(w, "MICROSECOND", w.microseconds(1)), /** One millisecond after the unix epoch */
830
- u(w, "MILLISECOND", w.milliseconds(1)), /** One second after the unix epoch */
831
- u(w, "SECOND", w.seconds(1)), /** One minute after the unix epoch */
832
- u(w, "MINUTE", w.minutes(1)), /** One hour after the unix epoch */
833
- u(w, "HOUR", w.hours(1)), /** One day after the unix epoch */
834
- u(w, "DAY", w.days(1)), /** The maximum possible value for a timestamp */
835
- u(w, "MAX", new w((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
836
- u(w, "MIN", new w(0)), /** The unix epoch */
837
- u(w, "ZERO", new w(0)), /** A zod schema for validating timestamps */
838
- u(w, "z", i.union([
839
- i.object({ value: i.bigint() }).transform((r) => new w(r.value)),
840
- i.string().transform((r) => new w(BigInt(r))),
841
- i.instanceof(Number).transform((r) => new w(r)),
842
- i.number().transform((r) => new w(r)),
843
- i.instanceof(w)
831
+ u(b, "NANOSECOND", b.nanoseconds(1)), /** One microsecond after the unix epoch */
832
+ u(b, "MICROSECOND", b.microseconds(1)), /** One millisecond after the unix epoch */
833
+ u(b, "MILLISECOND", b.milliseconds(1)), /** One second after the unix epoch */
834
+ u(b, "SECOND", b.seconds(1)), /** One minute after the unix epoch */
835
+ u(b, "MINUTE", b.minutes(1)), /** One hour after the unix epoch */
836
+ u(b, "HOUR", b.hours(1)), /** One day after the unix epoch */
837
+ u(b, "DAY", b.days(1)), /** The maximum possible value for a timestamp */
838
+ u(b, "MAX", new b((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
839
+ u(b, "MIN", new b(0)), /** The unix epoch */
840
+ u(b, "ZERO", new b(0)), /** A zod schema for validating timestamps */
841
+ u(b, "z", i.union([
842
+ i.object({ value: i.bigint() }).transform((r) => new b(r.value)),
843
+ i.string().transform((r) => new b(BigInt(r))),
844
+ i.instanceof(Number).transform((r) => new b(r)),
845
+ i.number().transform((r) => new b(r)),
846
+ i.instanceof(b)
844
847
  ]));
845
- let v = w;
846
- const b = class g {
848
+ let v = b;
849
+ const T = class g {
847
850
  constructor(e) {
848
851
  u(this, "value"), u(this, "encodeValue", !0), typeof e == "number" && (e = Math.trunc(e.valueOf())), this.value = BigInt(e.valueOf());
849
852
  }
850
853
  static fromSeconds(e) {
851
- return e instanceof g ? e : e instanceof Ue ? e.period : e instanceof v ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.seconds(e) : new g(e);
854
+ return e instanceof g ? e : e instanceof Re ? e.period : e instanceof v ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.seconds(e) : new g(e);
852
855
  }
853
856
  static fromMilliseconds(e) {
854
- return e instanceof g ? e : e instanceof Ue ? e.period : e instanceof v ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.milliseconds(e) : new g(e);
857
+ return e instanceof g ? e : e instanceof Re ? e.period : e instanceof v ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.milliseconds(e) : new g(e);
855
858
  }
856
859
  encode() {
857
860
  return this.value.toString();
@@ -880,9 +883,9 @@ const b = class g {
880
883
  );
881
884
  }
882
885
  toString() {
883
- const e = this.truncate(g.DAY), t = this.truncate(g.HOUR), n = this.truncate(g.MINUTE), s = this.truncate(g.SECOND), a = this.truncate(g.MILLISECOND), c = this.truncate(g.MICROSECOND), f = this.truncate(g.NANOSECOND), d = e, p = t.sub(e), m = n.sub(t), l = s.sub(n), E = a.sub(s), R = c.sub(a), U = f.sub(c);
884
- let x = "";
885
- return d.isZero || (x += `${d.days}d `), p.isZero || (x += `${p.hours}h `), m.isZero || (x += `${m.minutes}m `), l.isZero || (x += `${l.seconds}s `), E.isZero || (x += `${E.milliseconds}ms `), R.isZero || (x += `${R.microseconds}µs `), U.isZero || (x += `${U.nanoseconds}ns`), x.trim();
886
+ const e = this.truncate(g.DAY), t = this.truncate(g.HOUR), n = this.truncate(g.MINUTE), s = this.truncate(g.SECOND), a = this.truncate(g.MILLISECOND), c = this.truncate(g.MICROSECOND), f = this.truncate(g.NANOSECOND), d = e, p = t.sub(e), m = n.sub(t), l = s.sub(n), A = a.sub(s), B = c.sub(a), R = f.sub(c);
887
+ let M = "";
888
+ return d.isZero || (M += `${d.days}d `), p.isZero || (M += `${p.hours}h `), m.isZero || (M += `${m.minutes}m `), l.isZero || (M += `${l.seconds}s `), A.isZero || (M += `${A.milliseconds}ms `), B.isZero || (M += `${B.microseconds}µs `), R.isZero || (M += `${R.nanoseconds}ns`), M.trim();
886
889
  }
887
890
  mult(e) {
888
891
  return new g(this.valueOf() * BigInt(e));
@@ -961,7 +964,7 @@ const b = class g {
961
964
  * @returns A TimeSpan representing the given number of microseconds.
962
965
  */
963
966
  static microseconds(e = 1) {
964
- return g.nanoseconds(F(e, 1e3));
967
+ return g.nanoseconds(q(e, 1e3));
965
968
  }
966
969
  /**
967
970
  * Creates a TimeSpan representing the given number of milliseconds.
@@ -970,7 +973,7 @@ const b = class g {
970
973
  * @returns A TimeSpan representing the given number of milliseconds.
971
974
  */
972
975
  static milliseconds(e = 1) {
973
- return g.microseconds(F(e, 1e3));
976
+ return g.microseconds(q(e, 1e3));
974
977
  }
975
978
  /**
976
979
  * Creates a TimeSpan representing the given number of seconds.
@@ -979,7 +982,7 @@ const b = class g {
979
982
  * @returns A TimeSpan representing the given number of seconds.
980
983
  */
981
984
  static seconds(e = 1) {
982
- return g.milliseconds(F(e, 1e3));
985
+ return g.milliseconds(q(e, 1e3));
983
986
  }
984
987
  /**
985
988
  * Creates a TimeSpan representing the given number of minutes.
@@ -988,7 +991,7 @@ const b = class g {
988
991
  * @returns A TimeSpan representing the given number of minutes.
989
992
  */
990
993
  static minutes(e = 1) {
991
- return g.seconds(F(e, 60));
994
+ return g.seconds(q(e, 60));
992
995
  }
993
996
  /**
994
997
  * Creates a TimeSpan representing the given number of hours.
@@ -997,7 +1000,7 @@ const b = class g {
997
1000
  * @returns A TimeSpan representing the given number of hours.
998
1001
  */
999
1002
  static hours(e) {
1000
- return g.minutes(F(e, 60));
1003
+ return g.minutes(q(e, 60));
1001
1004
  }
1002
1005
  /**
1003
1006
  * Creates a TimeSpan representing the given number of days.
@@ -1006,27 +1009,27 @@ const b = class g {
1006
1009
  * @returns A TimeSpan representing the given number of days.
1007
1010
  */
1008
1011
  static days(e) {
1009
- return g.hours(F(e, 24));
1012
+ return g.hours(q(e, 24));
1010
1013
  }
1011
1014
  };
1012
- u(b, "NANOSECOND", b.nanoseconds(1)), /** A microsecond. */
1013
- u(b, "MICROSECOND", b.microseconds(1)), /** A millisecond. */
1014
- u(b, "MILLISECOND", b.milliseconds(1)), /** A second. */
1015
- u(b, "SECOND", b.seconds(1)), /** A minute. */
1016
- u(b, "MINUTE", b.minutes(1)), /** Represents an hour. */
1017
- u(b, "HOUR", b.hours(1)), /** Represents a day. */
1018
- u(b, "DAY", b.days(1)), /** The maximum possible value for a TimeSpan. */
1019
- u(b, "MAX", new b((1n << 63n) - 1n)), /** The minimum possible value for a TimeSpan. */
1020
- u(b, "MIN", new b(0)), /** The zero value for a TimeSpan. */
1021
- u(b, "ZERO", new b(0)), /** A zod schema for validating and transforming timespans */
1022
- u(b, "z", i.union([
1023
- i.object({ value: i.bigint() }).transform((r) => new b(r.value)),
1024
- i.string().transform((r) => new b(BigInt(r))),
1025
- i.instanceof(Number).transform((r) => new b(r)),
1026
- i.number().transform((r) => new b(r)),
1027
- i.instanceof(b)
1015
+ u(T, "NANOSECOND", T.nanoseconds(1)), /** A microsecond. */
1016
+ u(T, "MICROSECOND", T.microseconds(1)), /** A millisecond. */
1017
+ u(T, "MILLISECOND", T.milliseconds(1)), /** A second. */
1018
+ u(T, "SECOND", T.seconds(1)), /** A minute. */
1019
+ u(T, "MINUTE", T.minutes(1)), /** Represents an hour. */
1020
+ u(T, "HOUR", T.hours(1)), /** Represents a day. */
1021
+ u(T, "DAY", T.days(1)), /** The maximum possible value for a TimeSpan. */
1022
+ u(T, "MAX", new T((1n << 63n) - 1n)), /** The minimum possible value for a TimeSpan. */
1023
+ u(T, "MIN", new T(0)), /** The zero value for a TimeSpan. */
1024
+ u(T, "ZERO", new T(0)), /** A zod schema for validating and transforming timespans */
1025
+ u(T, "z", i.union([
1026
+ i.object({ value: i.bigint() }).transform((r) => new T(r.value)),
1027
+ i.string().transform((r) => new T(BigInt(r))),
1028
+ i.instanceof(Number).transform((r) => new T(r)),
1029
+ i.number().transform((r) => new T(r)),
1030
+ i.instanceof(T)
1028
1031
  ]));
1029
- let T = b;
1032
+ let O = T;
1030
1033
  const Z = class te extends Number {
1031
1034
  constructor(e) {
1032
1035
  e instanceof Number ? super(e.valueOf()) : super(e);
@@ -1045,7 +1048,7 @@ const Z = class te extends Number {
1045
1048
  * @returns A TimeSpan representing the period of the Rate.
1046
1049
  */
1047
1050
  get period() {
1048
- return T.seconds(1 / this.valueOf());
1051
+ return O.seconds(1 / this.valueOf());
1049
1052
  }
1050
1053
  /**
1051
1054
  * Calculates the number of samples in the given TimeSpan at this rate.
@@ -1054,7 +1057,7 @@ const Z = class te extends Number {
1054
1057
  * @returns The number of samples in the given TimeSpan at this rate.
1055
1058
  */
1056
1059
  sampleCount(e) {
1057
- return new T(e).seconds * this.valueOf();
1060
+ return new O(e).seconds * this.valueOf();
1058
1061
  }
1059
1062
  /**
1060
1063
  * Calculates the number of bytes in the given TimeSpan at this rate.
@@ -1064,7 +1067,7 @@ const Z = class te extends Number {
1064
1067
  * @returns The number of bytes in the given TimeSpan at this rate.
1065
1068
  */
1066
1069
  byteCount(e, t) {
1067
- return this.sampleCount(e) * new A(t).valueOf();
1070
+ return this.sampleCount(e) * new x(t).valueOf();
1068
1071
  }
1069
1072
  /**
1070
1073
  * Calculates a TimeSpan given the number of samples at this rate.
@@ -1073,7 +1076,7 @@ const Z = class te extends Number {
1073
1076
  * @returns A TimeSpan that corresponds to the given number of samples.
1074
1077
  */
1075
1078
  span(e) {
1076
- return T.seconds(e / this.valueOf());
1079
+ return O.seconds(e / this.valueOf());
1077
1080
  }
1078
1081
  /**
1079
1082
  * Calculates a TimeSpan given the number of bytes at this rate.
@@ -1109,7 +1112,7 @@ u(Z, "z", i.union([
1109
1112
  i.instanceof(Number).transform((r) => new Z(r)),
1110
1113
  i.instanceof(Z)
1111
1114
  ]));
1112
- let Ue = Z;
1115
+ let Re = Z;
1113
1116
  const I = class extends Number {
1114
1117
  /**
1115
1118
  * Creates a Density representing the given number of bytes per value.
@@ -1139,8 +1142,8 @@ u(I, "z", i.union([
1139
1142
  i.instanceof(Number).transform((r) => new I(r)),
1140
1143
  i.instanceof(I)
1141
1144
  ]));
1142
- let A = I;
1143
- const M = class re {
1145
+ let x = I;
1146
+ const $ = class re {
1144
1147
  /**
1145
1148
  * Creates a TimeRange from the given start and end TimeStamps.
1146
1149
  *
@@ -1152,7 +1155,7 @@ const M = class re {
1152
1155
  }
1153
1156
  /** @returns The TimeSpan occupied by the TimeRange. */
1154
1157
  get span() {
1155
- return new T(this.end.valueOf() - this.start.valueOf());
1158
+ return new O(this.end.valueOf() - this.start.valueOf());
1156
1159
  }
1157
1160
  /**
1158
1161
  * Checks if the timestamp is valid i.e. the start is before the end.
@@ -1215,13 +1218,13 @@ const M = class re {
1215
1218
  * @param other - The other TimeRange to compare to.
1216
1219
  * @returns True if the two TimeRanges overlap, false otherwise.
1217
1220
  */
1218
- overlapsWith(e, t = T.ZERO) {
1221
+ overlapsWith(e, t = O.ZERO) {
1219
1222
  e = e.makeValid();
1220
1223
  const n = this.makeValid();
1221
1224
  if (this.equals(e)) return !0;
1222
1225
  if (e.end.equals(n.start) || n.end.equals(e.start)) return !1;
1223
1226
  const s = v.max(n.start, e.start), a = v.min(n.end, e.end);
1224
- return a.before(s) ? !1 : new T(a.sub(s)).greaterThanOrEqual(t);
1227
+ return a.before(s) ? !1 : new O(a.sub(s)).greaterThanOrEqual(t);
1225
1228
  }
1226
1229
  roughlyEquals(e, t) {
1227
1230
  let n = this.start.sub(e.start).valueOf(), s = this.end.sub(e.end).valueOf();
@@ -1235,32 +1238,32 @@ const M = class re {
1235
1238
  return e.start.after(this.start) && (t.start = e.start), e.start.after(this.end) && (t.end = e.start), e.end.before(this.end) && (t.end = e.end), e.end.before(this.start) && (t.start = e.end), t;
1236
1239
  }
1237
1240
  };
1238
- u(M, "MAX", new M(v.MIN, v.MAX)), /** The minimum possible time range. */
1239
- u(M, "MIN", new M(v.MAX, v.MIN)), /** A zero time range. */
1240
- u(M, "ZERO", new M(v.ZERO, v.ZERO)), /** A zod schema for validating and transforming time ranges */
1241
- u(M, "z", i.union([
1242
- i.object({ start: v.z, end: v.z }).transform((r) => new M(r.start, r.end)),
1243
- i.instanceof(M)
1241
+ u($, "MAX", new $(v.MIN, v.MAX)), /** The minimum possible time range. */
1242
+ u($, "MIN", new $(v.MAX, v.MIN)), /** A zero time range. */
1243
+ u($, "ZERO", new $(v.ZERO, v.ZERO)), /** A zod schema for validating and transforming time ranges */
1244
+ u($, "z", i.union([
1245
+ i.object({ start: v.z, end: v.z }).transform((r) => new $(r.start, r.end)),
1246
+ i.instanceof($)
1244
1247
  ]));
1245
- let Te = M;
1246
- const o = class $ extends String {
1248
+ let Oe = $;
1249
+ const o = class S extends String {
1247
1250
  constructor(e) {
1248
- if (e instanceof $ || typeof e == "string" || typeof e.valueOf() == "string") {
1251
+ if (e instanceof S || typeof e == "string" || typeof e.valueOf() == "string") {
1249
1252
  super(e.valueOf());
1250
1253
  return;
1251
1254
  }
1252
- const t = $.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);
1255
+ const t = S.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);
1253
1256
  if (t != null) {
1254
1257
  super(t.valueOf());
1255
1258
  return;
1256
1259
  }
1257
- throw super($.UNKNOWN.valueOf()), new Error(`unable to find data type for ${e.toString()}`);
1260
+ throw super(S.UNKNOWN.valueOf()), new Error(`unable to find data type for ${e.toString()}`);
1258
1261
  }
1259
1262
  /**
1260
1263
  * @returns the TypedArray constructor for the DataType.
1261
1264
  */
1262
1265
  get Array() {
1263
- const e = $.ARRAY_CONSTRUCTORS.get(this.toString());
1266
+ const e = S.ARRAY_CONSTRUCTORS.get(this.toString());
1264
1267
  if (e == null)
1265
1268
  throw new Error(`unable to find array constructor for ${this.valueOf()}`);
1266
1269
  return e;
@@ -1282,25 +1285,32 @@ const o = class $ extends String {
1282
1285
  return this.valueOf();
1283
1286
  }
1284
1287
  get isVariable() {
1285
- return this.equals($.JSON) || this.equals($.STRING);
1288
+ return this.equals(S.JSON) || this.equals(S.STRING);
1286
1289
  }
1287
1290
  get isNumeric() {
1288
- return !this.isVariable && !this.equals($.UUID);
1291
+ return !this.isVariable && !this.equals(S.UUID);
1289
1292
  }
1290
1293
  get isInteger() {
1291
- return this.toString().startsWith("int");
1294
+ const e = this.toString();
1295
+ return e.startsWith("int") || e.startsWith("uint");
1292
1296
  }
1293
1297
  get isFloat() {
1294
1298
  return this.toString().startsWith("float");
1295
1299
  }
1296
1300
  get density() {
1297
- const e = $.DENSITIES.get(this.toString());
1301
+ const e = S.DENSITIES.get(this.toString());
1298
1302
  if (e == null) throw new Error(`unable to find density for ${this.valueOf()}`);
1299
1303
  return e;
1300
1304
  }
1305
+ get isUnsigned() {
1306
+ return this.equals(S.UINT8) || this.equals(S.UINT16) || this.equals(S.UINT32) || this.equals(S.UINT64);
1307
+ }
1308
+ get isSigned() {
1309
+ return this.equals(S.INT8) || this.equals(S.INT16) || this.equals(S.INT32) || this.equals(S.INT64);
1310
+ }
1301
1311
  /** @returns true if the data type can be cast to the other data type without loss of precision. */
1302
1312
  canSafelyCastTo(e) {
1303
- return this.equals(e) ? !0 : this.isVariable && !e.isVariable || !this.isVariable && e.isVariable ? !1 : this.isFloat && e.isInteger || this.isInteger && e.isFloat ? this.density.valueOf() < e.density.valueOf() : this.isFloat && e.isFloat || this.isInteger && e.isInteger ? this.density.valueOf() <= e.density.valueOf() : !1;
1313
+ return this.equals(e) ? !0 : !this.isNumeric || !e.isNumeric || this.isVariable || e.isVariable || this.isUnsigned && e.isSigned ? !1 : this.isFloat ? e.isFloat && this.density.valueOf() <= e.density.valueOf() : this.equals(S.INT32) && e.equals(S.FLOAT64) || this.equals(S.INT8) && e.equals(S.FLOAT32) ? !0 : this.isInteger && e.isInteger ? this.density.valueOf() <= e.density.valueOf() && this.isUnsigned === e.isUnsigned : !1;
1304
1314
  }
1305
1315
  /** @returns true if the data type can be cast to the other data type, even if there is a loss of precision. */
1306
1316
  canCastTo(e) {
@@ -1319,7 +1329,7 @@ const o = class $ extends String {
1319
1329
  return this.toString();
1320
1330
  }
1321
1331
  get usesBigInt() {
1322
- return $.BIG_INT_TYPES.some((e) => e.equals(this));
1332
+ return S.BIG_INT_TYPES.some((e) => e.equals(this));
1323
1333
  }
1324
1334
  };
1325
1335
  u(o, "UNKNOWN", new o("unknown")), /** Represents a 64-bit floating point value. */
@@ -1366,20 +1376,20 @@ u(o, "JSON", new o("json")), u(o, "ARRAY_CONSTRUCTORS", /* @__PURE__ */ new Map(
1366
1376
  [Int32Array.name, o.INT32],
1367
1377
  [BigInt64Array.name, o.INT64]
1368
1378
  ])), u(o, "DENSITIES", /* @__PURE__ */ new Map([
1369
- [o.UINT8.toString(), A.BIT8],
1370
- [o.UINT16.toString(), A.BIT16],
1371
- [o.UINT32.toString(), A.BIT32],
1372
- [o.UINT64.toString(), A.BIT64],
1373
- [o.FLOAT32.toString(), A.BIT32],
1374
- [o.FLOAT64.toString(), A.BIT64],
1375
- [o.INT8.toString(), A.BIT8],
1376
- [o.INT16.toString(), A.BIT16],
1377
- [o.INT32.toString(), A.BIT32],
1378
- [o.INT64.toString(), A.BIT64],
1379
- [o.TIMESTAMP.toString(), A.BIT64],
1380
- [o.STRING.toString(), A.UNKNOWN],
1381
- [o.JSON.toString(), A.UNKNOWN],
1382
- [o.UUID.toString(), A.BIT128]
1379
+ [o.UINT8.toString(), x.BIT8],
1380
+ [o.UINT16.toString(), x.BIT16],
1381
+ [o.UINT32.toString(), x.BIT32],
1382
+ [o.UINT64.toString(), x.BIT64],
1383
+ [o.FLOAT32.toString(), x.BIT32],
1384
+ [o.FLOAT64.toString(), x.BIT64],
1385
+ [o.INT8.toString(), x.BIT8],
1386
+ [o.INT16.toString(), x.BIT16],
1387
+ [o.INT32.toString(), x.BIT32],
1388
+ [o.INT64.toString(), x.BIT64],
1389
+ [o.TIMESTAMP.toString(), x.BIT64],
1390
+ [o.STRING.toString(), x.UNKNOWN],
1391
+ [o.JSON.toString(), x.UNKNOWN],
1392
+ [o.UUID.toString(), x.BIT128]
1383
1393
  ])), /** All the data types. */
1384
1394
  u(o, "ALL", [
1385
1395
  o.UNKNOWN,
@@ -1402,8 +1412,8 @@ u(o, "z", i.union([
1402
1412
  i.string().transform((r) => new o(r)),
1403
1413
  i.instanceof(o)
1404
1414
  ]));
1405
- let O = o;
1406
- const N = class S extends Number {
1415
+ let w = o;
1416
+ const E = class N extends Number {
1407
1417
  constructor(e) {
1408
1418
  super(e.valueOf());
1409
1419
  }
@@ -1416,31 +1426,31 @@ const N = class S extends Number {
1416
1426
  return this.valueOf() < e.valueOf();
1417
1427
  }
1418
1428
  add(e) {
1419
- return S.bytes(this.valueOf() + e.valueOf());
1429
+ return N.bytes(this.valueOf() + e.valueOf());
1420
1430
  }
1421
1431
  sub(e) {
1422
- return S.bytes(this.valueOf() - e.valueOf());
1432
+ return N.bytes(this.valueOf() - e.valueOf());
1423
1433
  }
1424
1434
  truncate(e) {
1425
- return new S(Math.trunc(this.valueOf() / e.valueOf()) * e.valueOf());
1435
+ return new N(Math.trunc(this.valueOf() / e.valueOf()) * e.valueOf());
1426
1436
  }
1427
1437
  remainder(e) {
1428
- return S.bytes(this.valueOf() % e.valueOf());
1438
+ return N.bytes(this.valueOf() % e.valueOf());
1429
1439
  }
1430
1440
  get gigabytes() {
1431
- return this.valueOf() / S.GIGABYTE.valueOf();
1441
+ return this.valueOf() / N.GIGABYTE.valueOf();
1432
1442
  }
1433
1443
  get megabytes() {
1434
- return this.valueOf() / S.MEGABYTE.valueOf();
1444
+ return this.valueOf() / N.MEGABYTE.valueOf();
1435
1445
  }
1436
1446
  get kilobytes() {
1437
- return this.valueOf() / S.KILOBYTE.valueOf();
1447
+ return this.valueOf() / N.KILOBYTE.valueOf();
1438
1448
  }
1439
1449
  get terabytes() {
1440
- return this.valueOf() / S.TERABYTE.valueOf();
1450
+ return this.valueOf() / N.TERABYTE.valueOf();
1441
1451
  }
1442
1452
  toString() {
1443
- const e = this.truncate(S.TERABYTE), t = this.truncate(S.GIGABYTE), n = this.truncate(S.MEGABYTE), s = this.truncate(S.KILOBYTE), a = this.truncate(S.BYTE), c = e, f = t.sub(e), d = n.sub(t), p = s.sub(n), m = a.sub(s);
1453
+ const e = this.truncate(N.TERABYTE), t = this.truncate(N.GIGABYTE), n = this.truncate(N.MEGABYTE), s = this.truncate(N.KILOBYTE), a = this.truncate(N.BYTE), c = e, f = t.sub(e), d = n.sub(t), p = s.sub(n), m = a.sub(s);
1444
1454
  let l = "";
1445
1455
  return c.isZero || (l += `${c.terabytes}TB `), f.isZero || (l += `${f.gigabytes}GB `), d.isZero || (l += `${d.megabytes}MB `), p.isZero || (l += `${p.kilobytes}KB `), (!m.isZero || l === "") && (l += `${m.valueOf()}B`), l.trim();
1446
1456
  }
@@ -1451,7 +1461,7 @@ const N = class S extends Number {
1451
1461
  * @returns A Size representing the given number of bytes.
1452
1462
  */
1453
1463
  static bytes(e = 1) {
1454
- return new S(e);
1464
+ return new N(e);
1455
1465
  }
1456
1466
  /**
1457
1467
  * Creates a Size from the given number if kilobytes.
@@ -1460,7 +1470,7 @@ const N = class S extends Number {
1460
1470
  * @returns A Size representing the given number of kilobytes.
1461
1471
  */
1462
1472
  static kilobytes(e = 1) {
1463
- return S.bytes(e.valueOf() * 1e3);
1473
+ return N.bytes(e.valueOf() * 1e3);
1464
1474
  }
1465
1475
  /**
1466
1476
  * Creates a Size from the given number of megabytes.
@@ -1469,7 +1479,7 @@ const N = class S extends Number {
1469
1479
  * @returns A Size representing the given number of megabytes.
1470
1480
  */
1471
1481
  static megabytes(e = 1) {
1472
- return S.kilobytes(e.valueOf() * 1e3);
1482
+ return N.kilobytes(e.valueOf() * 1e3);
1473
1483
  }
1474
1484
  /**
1475
1485
  * Creates a Size from the given number of gigabytes.
@@ -1478,7 +1488,7 @@ const N = class S extends Number {
1478
1488
  * @returns A Size representing the given number of gigabytes.
1479
1489
  */
1480
1490
  static gigabytes(e = 1) {
1481
- return S.megabytes(e.valueOf() * 1e3);
1491
+ return N.megabytes(e.valueOf() * 1e3);
1482
1492
  }
1483
1493
  /**
1484
1494
  * Creates a Size from the given number of terabytes.
@@ -1487,23 +1497,23 @@ const N = class S extends Number {
1487
1497
  * @returns A Size representing the given number of terabytes.
1488
1498
  */
1489
1499
  static terabytes(e) {
1490
- return S.gigabytes(e.valueOf() * 1e3);
1500
+ return N.gigabytes(e.valueOf() * 1e3);
1491
1501
  }
1492
1502
  get isZero() {
1493
1503
  return this.valueOf() === 0;
1494
1504
  }
1495
1505
  };
1496
- u(N, "BYTE", new N(1)), /** A kilobyte */
1497
- u(N, "KILOBYTE", N.kilobytes(1)), /** A megabyte */
1498
- u(N, "MEGABYTE", N.megabytes(1)), /** A gigabyte */
1499
- u(N, "GIGABYTE", N.gigabytes(1)), /** A terabyte. */
1500
- u(N, "TERABYTE", N.terabytes(1)), /** The zero value for Size */
1501
- u(N, "ZERO", new N(0)), /** A zod schema for a Size. */
1502
- u(N, "z", i.union([
1503
- i.number().transform((r) => new N(r)),
1504
- i.instanceof(N)
1506
+ u(E, "BYTE", new E(1)), /** A kilobyte */
1507
+ u(E, "KILOBYTE", E.kilobytes(1)), /** A megabyte */
1508
+ u(E, "MEGABYTE", E.megabytes(1)), /** A gigabyte */
1509
+ u(E, "GIGABYTE", E.gigabytes(1)), /** A terabyte. */
1510
+ u(E, "TERABYTE", E.terabytes(1)), /** The zero value for Size */
1511
+ u(E, "ZERO", new E(0)), /** A zod schema for a Size. */
1512
+ u(E, "z", i.union([
1513
+ i.number().transform((r) => new E(r)),
1514
+ i.instanceof(E)
1505
1515
  ]));
1506
- let pe = N;
1516
+ let pe = E;
1507
1517
  i.union([
1508
1518
  i.instanceof(Uint8Array),
1509
1519
  i.instanceof(Uint16Array),
@@ -1518,14 +1528,14 @@ i.union([
1518
1528
  ]);
1519
1529
  const rt = (r) => {
1520
1530
  const e = typeof r;
1521
- return e === "string" || e === "number" || e === "boolean" || e === "bigint" || r instanceof v || r instanceof T || r instanceof Date;
1522
- }, ar = (r, e, t, n = 0) => r.usesBigInt && !e.usesBigInt ? Number(t) - Number(n) : !r.usesBigInt && e.usesBigInt ? BigInt(t.valueOf()) - BigInt(n.valueOf()) : H(t, -n).valueOf(), or = (r) => r == null ? !1 : Array.isArray(r) || r instanceof ArrayBuffer || ArrayBuffer.isView(r) && !(r instanceof DataView) || r instanceof lr ? !0 : rt(r), P = -1, ur = i.string().transform(
1531
+ return e === "string" || e === "number" || e === "boolean" || e === "bigint" || r instanceof v || r instanceof O || r instanceof Date;
1532
+ }, ar = (r, e, t, n = 0) => r.usesBigInt && !e.usesBigInt ? Number(t) - Number(n) : !r.usesBigInt && e.usesBigInt ? BigInt(t.valueOf()) - BigInt(n.valueOf()) : H(t, -n).valueOf(), or = (r) => r == null ? !1 : Array.isArray(r) || r instanceof ArrayBuffer || ArrayBuffer.isView(r) && !(r instanceof DataView) || r instanceof lr ? !0 : rt(r), L = -1, ur = i.string().transform(
1523
1533
  (r) => new Uint8Array(
1524
1534
  atob(r).split("").map((e) => e.charCodeAt(0))
1525
1535
  ).buffer
1526
- ), cr = i.union([i.null(), i.undefined()]).transform(() => new Uint8Array().buffer), ye = 10, J = class B {
1536
+ ), cr = i.union([i.null(), i.undefined()]).transform(() => new Uint8Array().buffer), ye = 10, J = class U {
1527
1537
  constructor(e) {
1528
- u(this, "key", ""), u(this, "isSynnaxSeries", !0), u(this, "dataType"), u(this, "sampleOffset"), u(this, "gl"), u(this, "_data"), u(this, "_timeRange"), u(this, "alignment", 0n), u(this, "_cachedMin"), u(this, "_cachedMax"), u(this, "writePos", P), u(this, "_refCount", 0), u(this, "_cachedLength"), u(this, "_cachedIndexes"), or(e) && (e = { data: e });
1538
+ u(this, "key", ""), u(this, "isSynnaxSeries", !0), u(this, "dataType"), u(this, "sampleOffset"), u(this, "gl"), u(this, "_data"), u(this, "_timeRange"), u(this, "alignment", 0n), u(this, "_cachedMin"), u(this, "_cachedMax"), u(this, "writePos", L), u(this, "_refCount", 0), u(this, "_cachedLength"), u(this, "_cachedIndexes"), or(e) && (e = { data: e });
1529
1539
  const {
1530
1540
  dataType: t,
1531
1541
  timeRange: n,
@@ -1534,13 +1544,13 @@ const rt = (r) => {
1534
1544
  alignment: c = 0n,
1535
1545
  key: f = sr()
1536
1546
  } = e, d = e.data ?? [];
1537
- if (d instanceof B || typeof d == "object" && "isSynnaxSeries" in d && d.isSynnaxSeries === !0) {
1547
+ if (d instanceof U || typeof d == "object" && "isSynnaxSeries" in d && d.isSynnaxSeries === !0) {
1538
1548
  const l = d;
1539
1549
  this.key = l.key, this.dataType = l.dataType, this.sampleOffset = l.sampleOffset, this.gl = l.gl, this._data = l._data, this._timeRange = l._timeRange, this.alignment = l.alignment, this._cachedMin = l._cachedMin, this._cachedMax = l._cachedMax, this.writePos = l.writePos, this._refCount = l._refCount, this._cachedLength = l._cachedLength;
1540
1550
  return;
1541
1551
  }
1542
1552
  const p = rt(d), m = Array.isArray(d);
1543
- if (t != null) this.dataType = new O(t);
1553
+ if (t != null) this.dataType = new w(t);
1544
1554
  else {
1545
1555
  if (d instanceof ArrayBuffer)
1546
1556
  throw new Error(
@@ -1555,27 +1565,27 @@ const rt = (r) => {
1555
1565
  );
1556
1566
  l = d[0];
1557
1567
  }
1558
- if (typeof l == "string") this.dataType = O.STRING;
1559
- else if (typeof l == "number") this.dataType = O.FLOAT64;
1560
- else if (typeof l == "bigint") this.dataType = O.INT64;
1561
- else if (typeof l == "boolean") this.dataType = O.BOOLEAN;
1568
+ if (typeof l == "string") this.dataType = w.STRING;
1569
+ else if (typeof l == "number") this.dataType = w.FLOAT64;
1570
+ else if (typeof l == "bigint") this.dataType = w.INT64;
1571
+ else if (typeof l == "boolean") this.dataType = w.BOOLEAN;
1562
1572
  else if (l instanceof v || l instanceof Date || l instanceof v)
1563
- this.dataType = O.TIMESTAMP;
1564
- else if (typeof l == "object") this.dataType = O.JSON;
1573
+ this.dataType = w.TIMESTAMP;
1574
+ else if (typeof l == "object") this.dataType = w.JSON;
1565
1575
  else
1566
1576
  throw new Error(
1567
1577
  `cannot infer data type of ${typeof l} when constructing a Series from a JS array`
1568
1578
  );
1569
- } else this.dataType = new O(d);
1579
+ } else this.dataType = new w(d);
1570
1580
  }
1571
1581
  if (!m && !p) this._data = d;
1572
1582
  else {
1573
1583
  let l = p ? [d] : d;
1574
- const E = l[0];
1575
- (E instanceof v || E instanceof Date || E instanceof T) && (l = l.map((R) => new v(R).valueOf())), this.dataType.equals(O.STRING) ? (this._cachedLength = l.length, this._data = new TextEncoder().encode(`${l.join(`
1584
+ const A = l[0];
1585
+ (A instanceof v || A instanceof Date || A instanceof O) && (l = l.map((B) => new v(B).valueOf())), this.dataType.equals(w.STRING) ? (this._cachedLength = l.length, this._data = new TextEncoder().encode(`${l.join(`
1576
1586
  `)}
1577
- `).buffer) : this.dataType.equals(O.JSON) ? (this._cachedLength = l.length, this._data = new TextEncoder().encode(
1578
- `${l.map((R) => ee.encodeString(R)).join(`
1587
+ `).buffer) : this.dataType.equals(w.JSON) ? (this._cachedLength = l.length, this._data = new TextEncoder().encode(
1588
+ `${l.map((B) => ee.encodeString(B)).join(`
1579
1589
  `)}
1580
1590
  `
1581
1591
  ).buffer) : this._data = new this.dataType.Array(l).buffer;
@@ -1590,7 +1600,7 @@ const rt = (r) => {
1590
1600
  static alloc({ capacity: e, dataType: t, ...n }) {
1591
1601
  if (e === 0)
1592
1602
  throw new Error("[Series] - cannot allocate an array of length 0");
1593
- const s = new new O(t).Array(e), a = new B({
1603
+ const s = new new w(t).Array(e), a = new U({
1594
1604
  data: s.buffer,
1595
1605
  dataType: t,
1596
1606
  ...n
@@ -1601,7 +1611,7 @@ const rt = (r) => {
1601
1611
  const s = n.spanRange(t.span(e)), a = new BigInt64Array(e);
1602
1612
  for (let c = 0; c < e; c++)
1603
1613
  a[c] = BigInt(n.add(t.span(c)).valueOf());
1604
- return new B({ data: a, dataType: O.TIMESTAMP, timeRange: s });
1614
+ return new U({ data: a, dataType: w.TIMESTAMP, timeRange: s });
1605
1615
  }
1606
1616
  get refCount() {
1607
1617
  return this._refCount;
@@ -1612,7 +1622,7 @@ const rt = (r) => {
1612
1622
  `)}
1613
1623
  `
1614
1624
  );
1615
- return new B({ data: n, dataType: O.STRING, timeRange: t });
1625
+ return new U({ data: n, dataType: w.STRING, timeRange: t });
1616
1626
  }
1617
1627
  static fromJSON(e, t) {
1618
1628
  const n = new TextEncoder().encode(
@@ -1620,7 +1630,7 @@ const rt = (r) => {
1620
1630
  `)}
1621
1631
  `
1622
1632
  );
1623
- return new B({ data: n, dataType: O.JSON, timeRange: t });
1633
+ return new U({ data: n, dataType: w.JSON, timeRange: t });
1624
1634
  }
1625
1635
  acquire(e) {
1626
1636
  this._refCount++, e != null && this.updateGLBuffer(e);
@@ -1645,12 +1655,12 @@ const rt = (r) => {
1645
1655
  return this.dataType.isVariable ? this.writeVariable(e) : this.writeFixed(e);
1646
1656
  }
1647
1657
  writeVariable(e) {
1648
- if (this.writePos === P) return 0;
1658
+ if (this.writePos === L) return 0;
1649
1659
  const t = this.byteCapacity.valueOf() - this.writePos, n = e.subBytes(0, t);
1650
1660
  return this.writeToUnderlyingData(n), this.writePos += n.byteLength.valueOf(), this._cachedLength != null && (this._cachedLength += n.length, this.calculateCachedLength()), n.length;
1651
1661
  }
1652
1662
  writeFixed(e) {
1653
- if (this.writePos === P) return 0;
1663
+ if (this.writePos === L) return 0;
1654
1664
  const t = this.capacity - this.writePos, n = e.sub(0, t);
1655
1665
  return this.writeToUnderlyingData(n), this._cachedLength = void 0, this.maybeRecomputeMinMax(n), this.writePos += n.length, n.length;
1656
1666
  }
@@ -1669,18 +1679,18 @@ const rt = (r) => {
1669
1679
  }
1670
1680
  /** @returns a native typed array with the proper data type. */
1671
1681
  get data() {
1672
- return this.writePos === P ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
1682
+ return this.writePos === L ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
1673
1683
  }
1674
1684
  toStrings() {
1675
- if (!this.dataType.matches(O.STRING, O.UUID))
1685
+ if (!this.dataType.matches(w.STRING, w.UUID))
1676
1686
  throw new Error("cannot convert non-string series to strings");
1677
1687
  return new TextDecoder().decode(this.underlyingData).split(`
1678
1688
  `).slice(0, -1);
1679
1689
  }
1680
1690
  toUUIDs() {
1681
- if (!this.dataType.equals(O.UUID))
1691
+ if (!this.dataType.equals(w.UUID))
1682
1692
  throw new Error("cannot convert non-uuid series to uuids");
1683
- const e = O.UUID.density.valueOf(), t = Array(this.length);
1693
+ const e = w.UUID.density.valueOf(), t = Array(this.length);
1684
1694
  for (let n = 0; n < this.length; n++) {
1685
1695
  const s = this.underlyingData.slice(n * e, (n + 1) * e), a = Array.from(
1686
1696
  new Uint8Array(s.buffer),
@@ -1691,8 +1701,8 @@ const rt = (r) => {
1691
1701
  return t;
1692
1702
  }
1693
1703
  parseJSON(e) {
1694
- if (!this.dataType.equals(O.JSON))
1695
- throw new Error("cannot convert non-string series to strings");
1704
+ if (!this.dataType.equals(w.JSON))
1705
+ throw new Error("cannot parse non-JSON series as JSON");
1696
1706
  return new TextDecoder().decode(this.underlyingData).split(`
1697
1707
  `).slice(0, -1).map((t) => e.parse(ee.decodeString(t)));
1698
1708
  }
@@ -1711,11 +1721,11 @@ const rt = (r) => {
1711
1721
  }
1712
1722
  /** @returns the length of the series in bytes. */
1713
1723
  get byteLength() {
1714
- return this.writePos === P ? this.byteCapacity : this.dataType.isVariable ? new pe(this.writePos) : this.dataType.density.size(this.writePos);
1724
+ return this.writePos === L ? this.byteCapacity : this.dataType.isVariable ? new pe(this.writePos) : this.dataType.density.size(this.writePos);
1715
1725
  }
1716
1726
  /** @returns the number of samples in this array. */
1717
1727
  get length() {
1718
- return this._cachedLength != null ? this._cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === P ? this.data.length : this.writePos;
1728
+ return this._cachedLength != null ? this._cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === L ? this.data.length : this.writePos;
1719
1729
  }
1720
1730
  calculateCachedLength() {
1721
1731
  if (!this.dataType.isVariable)
@@ -1740,7 +1750,7 @@ const rt = (r) => {
1740
1750
  const n = new e.Array(this.length);
1741
1751
  for (let s = 0; s < this.length; s++)
1742
1752
  n[s] = ar(this.dataType, e, this.data[s], t);
1743
- return new B({
1753
+ return new U({
1744
1754
  data: n.buffer,
1745
1755
  dataType: e,
1746
1756
  timeRange: this._timeRange,
@@ -1751,7 +1761,7 @@ const rt = (r) => {
1751
1761
  }
1752
1762
  calcRawMax() {
1753
1763
  if (this.length === 0) return -1 / 0;
1754
- if (this.dataType.equals(O.TIMESTAMP))
1764
+ if (this.dataType.equals(w.TIMESTAMP))
1755
1765
  this._cachedMax = this.data[this.data.length - 1];
1756
1766
  else if (this.dataType.usesBigInt) {
1757
1767
  const e = this.data;
@@ -1770,7 +1780,7 @@ const rt = (r) => {
1770
1780
  }
1771
1781
  calcRawMin() {
1772
1782
  if (this.length === 0) return 1 / 0;
1773
- if (this.dataType.equals(O.TIMESTAMP)) this._cachedMin = this.data[0];
1783
+ if (this.dataType.equals(w.TIMESTAMP)) this._cachedMin = this.data[0];
1774
1784
  else if (this.dataType.usesBigInt) {
1775
1785
  const e = this.data;
1776
1786
  this._cachedMin = e.reduce((t, n) => t < n ? t : n);
@@ -1844,9 +1854,7 @@ const rt = (r) => {
1844
1854
  }
1845
1855
  }
1846
1856
  const a = this.data.slice(n, s);
1847
- return this.dataType.equals(O.STRING) ? new TextDecoder().decode(a) : Ve(
1848
- JSON.parse(new TextDecoder().decode(a))
1849
- );
1857
+ return this.dataType.equals(w.STRING) ? new TextDecoder().decode(a) : Ve(JSON.parse(new TextDecoder().decode(a)));
1850
1858
  }
1851
1859
  /**
1852
1860
  * @returns the index of the first sample that is greater than or equal to the given value.
@@ -1864,11 +1872,11 @@ const rt = (r) => {
1864
1872
  return t;
1865
1873
  }
1866
1874
  updateGLBuffer(e) {
1867
- if (this.gl.control = e, !this.dataType.equals(O.FLOAT32))
1868
- throw new Error("Only FLOAT32 arrays can be used in WebGL");
1875
+ if (this.gl.control = e, !this.dataType.equals(w.FLOAT32) && !this.dataType.equals(w.UINT8))
1876
+ throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
1869
1877
  const { buffer: t, bufferUsage: n, prevBuffer: s } = this.gl;
1870
1878
  if (t == null && (this.gl.buffer = e.createBuffer()), this.writePos !== s)
1871
- if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== P) {
1879
+ if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== L) {
1872
1880
  s === 0 && e.bufferData(e.ARRAY_BUFFER, this.byteCapacity.valueOf(), e.STATIC_DRAW);
1873
1881
  const a = this.dataType.density.size(s).valueOf(), c = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
1874
1882
  e.bufferSubData(e.ARRAY_BUFFER, a, c.buffer), this.gl.prevBuffer = this.writePos;
@@ -1877,11 +1885,11 @@ const rt = (r) => {
1877
1885
  e.ARRAY_BUFFER,
1878
1886
  this.buffer,
1879
1887
  n === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW
1880
- ), this.gl.prevBuffer = P;
1888
+ ), this.gl.prevBuffer = L;
1881
1889
  }
1882
1890
  as(e) {
1883
1891
  if (e === "string") {
1884
- if (!this.dataType.equals(O.STRING))
1892
+ if (!this.dataType.equals(w.STRING))
1885
1893
  throw new Error(
1886
1894
  `cannot convert series of type ${this.dataType.toString()} to string`
1887
1895
  );
@@ -1895,7 +1903,7 @@ const rt = (r) => {
1895
1903
  return this;
1896
1904
  }
1897
1905
  if (e === "bigint") {
1898
- if (!this.dataType.equals(O.INT64))
1906
+ if (!this.dataType.equals(w.INT64))
1899
1907
  throw new Error(
1900
1908
  `cannot convert series of type ${this.dataType.toString()} to bigint`
1901
1909
  );
@@ -1939,7 +1947,7 @@ const rt = (r) => {
1939
1947
  [Symbol.iterator]() {
1940
1948
  if (this.dataType.isVariable) {
1941
1949
  const e = new hr(this);
1942
- return this.dataType.equals(O.JSON) ? new fr(e) : e;
1950
+ return this.dataType.equals(w.JSON) ? new fr(e) : e;
1943
1951
  }
1944
1952
  return new dr(this);
1945
1953
  }
@@ -1962,7 +1970,7 @@ const rt = (r) => {
1962
1970
  subBytes(e, t) {
1963
1971
  if (e >= 0 && (t == null || t >= this.byteLength.valueOf())) return this;
1964
1972
  const n = this.data.subarray(e, t);
1965
- return new B({
1973
+ return new U({
1966
1974
  data: n,
1967
1975
  dataType: this.dataType,
1968
1976
  timeRange: this._timeRange,
@@ -1974,7 +1982,7 @@ const rt = (r) => {
1974
1982
  sliceSub(e, t, n) {
1975
1983
  if (t <= 0 && (n == null || n >= this.length)) return this;
1976
1984
  let s;
1977
- return e ? s = this.data.subarray(t, n) : s = this.data.slice(t, n), new B({
1985
+ return e ? s = this.data.subarray(t, n) : s = this.data.slice(t, n), new U({
1978
1986
  data: s,
1979
1987
  dataType: this.dataType,
1980
1988
  timeRange: this._timeRange,
@@ -1984,10 +1992,10 @@ const rt = (r) => {
1984
1992
  });
1985
1993
  }
1986
1994
  reAlign(e) {
1987
- return new B({
1995
+ return new U({
1988
1996
  data: this.buffer,
1989
1997
  dataType: this.dataType,
1990
- timeRange: Te.ZERO,
1998
+ timeRange: Oe.ZERO,
1991
1999
  sampleOffset: this.sampleOffset,
1992
2000
  glBufferUsage: "static",
1993
2001
  alignment: e
@@ -1995,8 +2003,8 @@ const rt = (r) => {
1995
2003
  }
1996
2004
  };
1997
2005
  u(J, "crudeZ", i.object({
1998
- timeRange: Te.z.optional(),
1999
- dataType: O.z,
2006
+ timeRange: Oe.z.optional(),
2007
+ dataType: w.z,
2000
2008
  alignment: _t.optional(),
2001
2009
  data: i.union([
2002
2010
  ur,
@@ -2038,7 +2046,7 @@ class hr {
2038
2046
  return this;
2039
2047
  }
2040
2048
  }
2041
- var De, Pe;
2049
+ var De, Le;
2042
2050
  class fr {
2043
2051
  constructor(e) {
2044
2052
  u(this, "wrapped"), u(this, De, "JSONSeriesIterator"), this.wrapped = e;
@@ -2050,14 +2058,14 @@ class fr {
2050
2058
  value: ee.decodeString(e.value)
2051
2059
  };
2052
2060
  }
2053
- [(Pe = Symbol.iterator, De = Symbol.toStringTag, Pe)]() {
2061
+ [(Le = Symbol.iterator, De = Symbol.toStringTag, Le)]() {
2054
2062
  return this;
2055
2063
  }
2056
2064
  }
2057
- var Le, Ye;
2065
+ var Pe, Ye;
2058
2066
  class dr {
2059
2067
  constructor(e) {
2060
- u(this, "series"), u(this, "index"), u(this, Le, "SeriesIterator"), this.series = e, this.index = 0;
2068
+ u(this, "series"), u(this, "index"), u(this, Pe, "SeriesIterator"), this.series = e, this.index = 0;
2061
2069
  }
2062
2070
  next() {
2063
2071
  return this.index >= this.series.length ? { done: !0, value: void 0 } : {
@@ -2065,7 +2073,7 @@ class dr {
2065
2073
  value: this.series.at(this.index++, !0)
2066
2074
  };
2067
2075
  }
2068
- [(Ye = Symbol.iterator, Le = Symbol.toStringTag, Ye)]() {
2076
+ [(Ye = Symbol.iterator, Pe = Symbol.toStringTag, Ye)]() {
2069
2077
  return this;
2070
2078
  }
2071
2079
  }
@@ -2073,30 +2081,26 @@ const H = (r, e) => typeof r == "bigint" && typeof e == "bigint" || typeof r ==
2073
2081
  const e = r >> 32n, t = r & 0xffffffffn;
2074
2082
  return { domain: e, sample: t };
2075
2083
  };
2076
- i.object({
2077
- key: i.string(),
2078
- value: i.string()
2079
- });
2084
+ i.object({ key: i.string(), value: i.string() });
2080
2085
  i.record(
2081
2086
  i.union([i.number(), i.string(), i.symbol()]),
2082
2087
  i.unknown()
2083
2088
  );
2084
- const nt = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", gr = nt(), st = ["MacOS", "Windows", "Linux", "Docker"], pr = ["macos", "windows", "linux", "docker"], yr = {
2085
- macos: "MacOS",
2089
+ const nt = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", gr = nt(), st = ["macOS", "Windows", "Linux"], pr = ["macos", "windows", "linux"], yr = {
2090
+ macos: "macOS",
2086
2091
  windows: "Windows",
2087
- linux: "Linux",
2088
- docker: "Docker"
2092
+ linux: "Linux"
2089
2093
  }, mr = i.enum(st).or(
2090
2094
  i.enum(pr).transform((r) => yr[r])
2091
- );
2092
- let fe;
2093
- const wr = () => {
2095
+ ), wr = () => {
2094
2096
  if (typeof window > "u") return;
2095
2097
  const r = window.navigator.userAgent.toLowerCase();
2096
- if (r.includes("mac")) return "MacOS";
2098
+ if (r.includes("mac")) return "macOS";
2097
2099
  if (r.includes("win")) return "Windows";
2098
2100
  if (r.includes("linux")) return "Linux";
2099
- }, br = (r = {}) => {
2101
+ };
2102
+ let fe;
2103
+ const br = (r = {}) => {
2100
2104
  const { force: e, default: t } = r;
2101
2105
  return e ?? fe ?? (fe = wr(), fe ?? t);
2102
2106
  }, it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -2107,8 +2111,8 @@ const wr = () => {
2107
2111
  getOS: br,
2108
2112
  osZ: mr
2109
2113
  }, Symbol.toStringTag, { value: "Module" }));
2110
- var Or = Object.defineProperty, Tr = (r, e, t) => e in r ? Or(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, X = (r, e, t) => Tr(r, typeof e != "symbol" ? e + "" : e, t);
2111
- const vr = (...r) => r.map(at).join(""), at = (r) => (r.endsWith("/") || (r += "/"), r.startsWith("/") && (r = r.slice(1)), r), Sr = (r) => r.endsWith("/") ? r.slice(0, -1) : r, Ir = (r, e = "") => r === null ? "" : `?${Object.entries(r).filter(([, t]) => t == null ? !1 : Array.isArray(t) ? t.length > 0 : !0).map(([t, n]) => `${e}${t}=${n}`).join("&")}`, me = class we {
2114
+ var Tr = Object.defineProperty, Or = (r, e, t) => e in r ? Tr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, X = (r, e, t) => Or(r, typeof e != "symbol" ? e + "" : e, t);
2115
+ const vr = (...r) => r.map(at).join(""), at = (r) => (r.endsWith("/") || (r += "/"), r.startsWith("/") && (r = r.slice(1)), r), Sr = (r) => r.endsWith("/") ? r.slice(0, -1) : r, Nr = (r, e = "") => r === null ? "" : `?${Object.entries(r).filter(([, t]) => t == null ? !1 : Array.isArray(t) ? t.length > 0 : !0).map(([t, n]) => `${e}${t}=${n}`).join("&")}`, me = class we {
2112
2116
  /**
2113
2117
  * @param host - The hostname or IP address of the server.
2114
2118
  * @param port - The port number of the server.
@@ -2150,28 +2154,28 @@ const vr = (...r) => r.map(at).join(""), at = (r) => (r.endsWith("/") || (r += "
2150
2154
  }
2151
2155
  };
2152
2156
  X(me, "UNKNOWN", new me({ host: "unknown", port: 0 }));
2153
- let Nr = me;
2157
+ let Ir = me;
2154
2158
  var Er = Object.defineProperty, Ar = (r, e, t) => e in r ? Er(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, ne = (r, e, t) => Ar(r, typeof e != "symbol" ? e + "" : e, t);
2155
2159
  const xr = async (r) => await new Promise(
2156
- (e) => setTimeout(e, T.fromMilliseconds(r).milliseconds)
2160
+ (e) => setTimeout(e, O.fromMilliseconds(r).milliseconds)
2157
2161
  ), Mr = i.object({
2158
- interval: T.z.optional(),
2162
+ interval: O.z.optional(),
2159
2163
  maxRetries: i.number().optional(),
2160
2164
  scale: i.number().optional()
2161
2165
  }), $r = (r = {}) => {
2162
2166
  const e = r.sleepFn || xr, t = r.maxRetries ?? 5, n = r.scale ?? 1;
2163
- let s = 0, a = new T(r.interval ?? T.milliseconds(1));
2167
+ let s = 0, a = new O(r.interval ?? O.milliseconds(1));
2164
2168
  return async () => s >= t ? !1 : (await e(a), a = a.mult(n), s++, !0);
2165
- }, Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2169
+ }, Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2166
2170
  __proto__: null,
2167
2171
  breakerConfig: Mr,
2168
2172
  create: $r
2169
- }, Symbol.toStringTag, { value: "Module" })), G = class extends Number {
2173
+ }, Symbol.toStringTag, { value: "Module" })), F = class extends Number {
2170
2174
  };
2171
- ne(G, "Absolute", 255), ne(G, "Default", 1), ne(G, "z", i.union([
2172
- i.instanceof(G),
2173
- i.number().int().min(0).max(255).transform((r) => new G(r)),
2174
- i.instanceof(Number).transform((r) => new G(r))
2175
+ ne(F, "Absolute", 255), ne(F, "Default", 1), ne(F, "z", i.union([
2176
+ i.instanceof(F),
2177
+ i.number().int().min(0).max(255).transform((r) => new F(r)),
2178
+ i.instanceof(Number).transform((r) => new F(r))
2175
2179
  ]));
2176
2180
  i.object({
2177
2181
  name: i.string(),
@@ -2187,8 +2191,8 @@ const ot = class K extends Error {
2187
2191
  }
2188
2192
  };
2189
2193
  ne(ot, "MESSAGE", "canceled");
2190
- let Rr = ot;
2191
- new Rr();
2194
+ let Br = ot;
2195
+ new Br();
2192
2196
  i.string().regex(/^\d+\.\d+\.\d+$/);
2193
2197
  const ve = (r) => (e) => e != null && typeof e == "object" && "type" in e && typeof e.type == "string" ? e.type.includes(r) : e instanceof Error ? e.message.includes(r) : typeof e != "string" ? !1 : e.includes(r);
2194
2198
  class oe extends Error {
@@ -2198,7 +2202,7 @@ class oe extends Error {
2198
2202
  y(this, "type", "");
2199
2203
  }
2200
2204
  }
2201
- const Ur = (r) => {
2205
+ const Rr = (r) => {
2202
2206
  if (r == null || typeof r != "object") return !1;
2203
2207
  const e = r;
2204
2208
  if (e.discriminator !== "FreighterError") return !1;
@@ -2207,7 +2211,7 @@ const Ur = (r) => {
2207
2211
  `Freighter error is missing its type property: ${JSON.stringify(e)}`
2208
2212
  );
2209
2213
  return !0;
2210
- }, je = "unknown", Fe = "nil", Cr = "freighter", ut = i.object({ type: i.string(), data: i.string() });
2214
+ }, je = "unknown", qe = "nil", Cr = "freighter", ut = i.object({ type: i.string(), data: i.string() });
2211
2215
  class Dr {
2212
2216
  constructor() {
2213
2217
  y(this, "providers", []);
@@ -2216,8 +2220,8 @@ class Dr {
2216
2220
  this.providers.push(e);
2217
2221
  }
2218
2222
  encode(e) {
2219
- if (e == null) return { type: Fe, data: "" };
2220
- if (Ur(e))
2223
+ if (e == null) return { type: qe, data: "" };
2224
+ if (Rr(e))
2221
2225
  for (const t of this.providers) {
2222
2226
  const n = t.encode(e);
2223
2227
  if (n != null) return n;
@@ -2225,33 +2229,33 @@ class Dr {
2225
2229
  return { type: je, data: JSON.stringify(e) };
2226
2230
  }
2227
2231
  decode(e) {
2228
- if (e == null || e.type === Fe) return null;
2229
- if (e.type === je) return new Ge(e.data);
2232
+ if (e == null || e.type === qe) return null;
2233
+ if (e.type === je) return new Fe(e.data);
2230
2234
  for (const t of this.providers) {
2231
2235
  const n = t.decode(e);
2232
2236
  if (n != null) return n;
2233
2237
  }
2234
- return new Ge(e.data);
2238
+ return new Fe(e.data);
2235
2239
  }
2236
2240
  }
2237
- const Se = new Dr(), Pr = ({
2241
+ const Se = new Dr(), Lr = ({
2238
2242
  encode: r,
2239
2243
  decode: e
2240
2244
  }) => Se.register({ encode: r, decode: e }), en = (r) => Se.encode(r), be = (r) => Se.decode(r);
2241
- class Ge extends oe {
2245
+ class Fe extends oe {
2242
2246
  constructor() {
2243
2247
  super(...arguments);
2244
2248
  y(this, "type", "unknown");
2245
2249
  }
2246
2250
  }
2247
- const ue = "freighter.", q = class q extends oe {
2251
+ const ue = "freighter.", G = class G extends oe {
2248
2252
  constructor() {
2249
2253
  super("EOF");
2250
- y(this, "type", q.TYPE);
2254
+ y(this, "type", G.TYPE);
2251
2255
  }
2252
2256
  };
2253
- y(q, "TYPE", `${ue}eof`), y(q, "matches", ve(q.TYPE));
2254
- let L = q;
2257
+ y(G, "TYPE", `${ue}eof`), y(G, "matches", ve(G.TYPE));
2258
+ let P = G;
2255
2259
  const W = class W extends oe {
2256
2260
  constructor() {
2257
2261
  super("StreamClosed");
@@ -2262,7 +2266,7 @@ y(W, "TYPE", `${ue}stream_closed`), y(W, "matches", ve(W.TYPE));
2262
2266
  let Y = W;
2263
2267
  const z = class z extends oe {
2264
2268
  constructor(t = {}) {
2265
- const { message: n = "Unreachable", url: s = Nr.UNKNOWN } = t;
2269
+ const { message: n = "Unreachable", url: s = Ir.UNKNOWN } = t;
2266
2270
  super(n);
2267
2271
  y(this, "type", z.TYPE);
2268
2272
  y(this, "url");
@@ -2271,9 +2275,9 @@ const z = class z extends oe {
2271
2275
  };
2272
2276
  y(z, "TYPE", `${ue}unreachable`), y(z, "matches", ve(z.TYPE));
2273
2277
  let k = z;
2274
- const Lr = (r) => {
2278
+ const Pr = (r) => {
2275
2279
  if (!r.type.startsWith(Cr)) return null;
2276
- if (L.matches(r)) return { type: L.TYPE, data: "EOF" };
2280
+ if (P.matches(r)) return { type: P.TYPE, data: "EOF" };
2277
2281
  if (Y.matches(r))
2278
2282
  return { type: Y.TYPE, data: "StreamClosed" };
2279
2283
  if (k.matches(r))
@@ -2282,8 +2286,8 @@ const Lr = (r) => {
2282
2286
  }, Yr = (r) => {
2283
2287
  if (!r.type.startsWith(ue)) return null;
2284
2288
  switch (r.type) {
2285
- case L.TYPE:
2286
- return new L();
2289
+ case P.TYPE:
2290
+ return new P();
2287
2291
  case Y.TYPE:
2288
2292
  return new Y();
2289
2293
  case k.TYPE:
@@ -2292,8 +2296,8 @@ const Lr = (r) => {
2292
2296
  throw new Error(`Unknown error type: ${r.data}`);
2293
2297
  }
2294
2298
  };
2295
- Pr({
2296
- encode: Lr,
2299
+ Lr({
2300
+ encode: Pr,
2297
2301
  decode: Yr
2298
2302
  });
2299
2303
  class ct {
@@ -2323,7 +2327,7 @@ class ct {
2323
2327
  return await s(e);
2324
2328
  }
2325
2329
  }
2326
- const lt = "Content-Type", qe = (r) => {
2330
+ const lt = "Content-Type", Ge = (r) => {
2327
2331
  if (it.RUNTIME !== "node") return fetch;
2328
2332
  const e = require("node-fetch");
2329
2333
  if (r === "http") return e;
@@ -2336,7 +2340,7 @@ class tn extends ct {
2336
2340
  y(this, "endpoint");
2337
2341
  y(this, "encoder");
2338
2342
  y(this, "fetch");
2339
- return this.endpoint = t.replace({ protocol: s ? "https" : "http" }), this.encoder = n, this.fetch = qe(this.endpoint.protocol), new Proxy(this, {
2343
+ return this.endpoint = t.replace({ protocol: s ? "https" : "http" }), this.encoder = n, this.fetch = Ge(this.endpoint.protocol), new Proxy(this, {
2340
2344
  get: (a, c, f) => c === "endpoint" ? this.endpoint : Reflect.get(a, c, f)
2341
2345
  });
2342
2346
  }
@@ -2363,25 +2367,25 @@ class tn extends ct {
2363
2367
  ...this.headers,
2364
2368
  ...m.params
2365
2369
  };
2366
- let E;
2370
+ let A;
2367
2371
  try {
2368
- E = await qe(m.protocol)(m.target, d);
2369
- } catch (U) {
2370
- let x = U;
2371
- return x.message === "Load failed" && (x = new k({ url: f })), [l, x];
2372
+ A = await Ge(m.protocol)(m.target, d);
2373
+ } catch (R) {
2374
+ let M = R;
2375
+ return M.message === "Load failed" && (M = new k({ url: f })), [l, M];
2372
2376
  }
2373
- const R = await E.arrayBuffer();
2374
- if (E != null && E.ok)
2375
- return a != null && (c = this.encoder.decode(R, a)), [l, null];
2377
+ const B = await A.arrayBuffer();
2378
+ if (A != null && A.ok)
2379
+ return a != null && (c = this.encoder.decode(B, a)), [l, null];
2376
2380
  try {
2377
- if (E.status !== 400) return [l, new Error(E.statusText)];
2378
- const U = this.encoder.decode(R, ut), x = be(U);
2379
- return [l, x];
2380
- } catch (U) {
2381
+ if (A.status !== 400) return [l, new Error(A.statusText)];
2382
+ const R = this.encoder.decode(B, ut), M = be(R);
2383
+ return [l, M];
2384
+ } catch (R) {
2381
2385
  return [
2382
2386
  l,
2383
2387
  new Error(
2384
- `[freighter] - failed to decode error: ${E.statusText}: ${U.message}`
2388
+ `[freighter] - failed to decode error: ${A.statusText}: ${R.message}`
2385
2389
  )
2386
2390
  ];
2387
2391
  }
@@ -2400,7 +2404,7 @@ const rn = (r, e) => {
2400
2404
  this.wrapped.use(...s);
2401
2405
  }
2402
2406
  async send(s, a, c, f) {
2403
- const d = Br.create(e);
2407
+ const d = Ur.create(e);
2404
2408
  do {
2405
2409
  const [p, m] = await this.wrapped.send(s, a, c, f);
2406
2410
  if (m == null || !k.matches(m)) return [p, m];
@@ -2418,7 +2422,7 @@ const rn = (r, e) => {
2418
2422
  payload: i.unknown().optional(),
2419
2423
  error: i.optional(ut)
2420
2424
  });
2421
- class Fr {
2425
+ class qr {
2422
2426
  constructor(e, t, n, s) {
2423
2427
  y(this, "encoder");
2424
2428
  y(this, "reqSchema");
@@ -2440,7 +2444,7 @@ class Fr {
2440
2444
  }
2441
2445
  /** Implements the Stream protocol */
2442
2446
  send(e) {
2443
- if (this.serverClosed != null) return new L();
2447
+ if (this.serverClosed != null) return new P();
2444
2448
  if (this.sendClosed) throw new Y();
2445
2449
  return this.ws.send(this.encoder.encode({ type: "data", payload: e })), null;
2446
2450
  }
@@ -2481,11 +2485,11 @@ class Fr {
2481
2485
  listenForMessages() {
2482
2486
  this.ws.onmessage = (e) => this.addMessage(this.encoder.decode(e.data, jr)), this.ws.onclose = (e) => this.addMessage({
2483
2487
  type: "close",
2484
- error: { type: Vr(e) ? L.TYPE : Y.TYPE, data: "" }
2488
+ error: { type: Vr(e) ? P.TYPE : Y.TYPE, data: "" }
2485
2489
  });
2486
2490
  }
2487
2491
  }
2488
- const Gr = "freighterctx", qr = 1e3, Wr = 1001, zr = [qr, Wr], Vr = (r) => zr.includes(r.code), ie = class ie extends ct {
2492
+ const Fr = "freighterctx", Gr = 1e3, Wr = 1001, zr = [Gr, Wr], Vr = (r) => zr.includes(r.code), ie = class ie extends ct {
2489
2493
  /**
2490
2494
  * @param encoder - The encoder to use for encoding messages and decoding
2491
2495
  * responses.
@@ -2514,19 +2518,19 @@ const Gr = "freighterctx", qr = 1e3, Wr = 1001, zr = [qr, Wr], Vr = (r) => zr.in
2514
2518
  return c;
2515
2519
  }
2516
2520
  buildURL(t, n) {
2517
- const s = Ir(
2521
+ const s = Nr(
2518
2522
  {
2519
2523
  [lt]: this.encoder.contentType,
2520
2524
  ...n.params
2521
2525
  },
2522
- Gr
2526
+ Fr
2523
2527
  );
2524
2528
  return this.baseUrl.child(t).toString() + s;
2525
2529
  }
2526
2530
  async wrapSocket(t, n, s) {
2527
2531
  return await new Promise((a) => {
2528
2532
  t.onopen = () => {
2529
- const c = new Fr(t, this.encoder, n, s);
2533
+ const c = new qr(t, this.encoder, n, s);
2530
2534
  c.receiveOpenAck().then((f) => {
2531
2535
  f != null ? a(f) : a(c);
2532
2536
  }).catch((f) => a(f));
@@ -2541,7 +2545,7 @@ y(ie, "MESSAGE_TYPE", "arraybuffer");
2541
2545
  let We = ie;
2542
2546
  export {
2543
2547
  oe as BaseTypedError,
2544
- L as EOF,
2548
+ P as EOF,
2545
2549
  tn as HTTPClient,
2546
2550
  Y as StreamClosed,
2547
2551
  k as Unreachable,
@@ -2550,7 +2554,7 @@ export {
2550
2554
  en as encodeError,
2551
2555
  ve as errorMatcher,
2552
2556
  ut as errorZ,
2553
- Pr as registerError,
2557
+ Lr as registerError,
2554
2558
  nn as sendRequired,
2555
2559
  rn as unaryWithBreaker
2556
2560
  };