@synnaxlabs/freighter 0.38.1 → 0.40.0

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) ? Ie(f, n.keepTypesOnRecursion) || (f = e(f, n)) : n.recursiveInArray && Ne(f) && (f = [...f].map((p) => {
18
+ n.recursive && (ce(f) ? Ne(f, n.keepTypesOnRecursion) || (f = e(f, n)) : n.recursiveInArray && Ie(f) && (f = [...f].map((p) => {
19
19
  let m = p;
20
- return ce(p) ? Ie(m, n.keepTypesOnRecursion) || (m = e(p, n)) : Ne(p) && (m = e({ key: p }, n).key), m;
20
+ return ce(p) ? Ne(m, n.keepTypesOnRecursion) || (m = e(p, n)) : Ie(p) && (m = e({ key: p }, n).key), m;
21
21
  }))), s[d] = f;
22
22
  }), s;
23
23
  };
@@ -33,11 +33,11 @@ const dt = (r) => {
33
33
  recursive: !0,
34
34
  recursiveInArray: !0,
35
35
  keepTypesOnRecursion: [Number, String, Uint8Array]
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);
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);
36
+ }, 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);
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, _ = (r, e, t) => wt(r, typeof e != "symbol" ? e + "" : e, t);
38
38
  let bt = class {
39
39
  constructor() {
40
- Q(this, "contentType", "application/json"), Q(this, "decoder"), Q(this, "encoder"), this.decoder = new TextDecoder(), this.encoder = new TextEncoder();
40
+ _(this, "contentType", "application/json"), _(this, "decoder"), _(this, "encoder"), this.decoder = new TextDecoder(), this.encoder = new TextEncoder();
41
41
  }
42
42
  encode(e) {
43
43
  return this.encoder.encode(this.encodeString(e)).buffer;
@@ -57,7 +57,7 @@ let bt = class {
57
57
  }
58
58
  }, Tt = class {
59
59
  constructor() {
60
- Q(this, "contentType", "text/csv");
60
+ _(this, "contentType", "text/csv");
61
61
  }
62
62
  encode(e) {
63
63
  const t = this.encodeString(e);
@@ -102,7 +102,7 @@ let bt = class {
102
102
  }
103
103
  }, Ot = class {
104
104
  constructor() {
105
- Q(this, "contentType", "text/plain");
105
+ _(this, "contentType", "text/plain");
106
106
  }
107
107
  encode(e) {
108
108
  return new TextEncoder().encode(e).buffer;
@@ -112,7 +112,7 @@ let bt = class {
112
112
  return t != null ? t.parse(n) : n;
113
113
  }
114
114
  };
115
- const ee = new bt();
115
+ const te = new bt();
116
116
  new Tt();
117
117
  new Ot();
118
118
  const vt = (r) => r != null && typeof r == "object" && "toString" in r, St = (r, e = !1) => {
@@ -140,10 +140,10 @@ const vt = (r) => r != null && typeof r == "object" && "toString" in r, St = (r,
140
140
  default:
141
141
  return console.warn(`sortFunc: unknown type ${t}`), () => -1;
142
142
  }
143
- return e ? Nt(n) : n;
144
- }, Nt = (r) => (e, t) => r(t, e), ae = i.tuple([i.number(), i.number()]);
143
+ return e ? It(n) : n;
144
+ }, It = (r) => (e, t) => r(t, e), ae = i.tuple([i.number(), i.number()]);
145
145
  i.tuple([i.bigint(), i.bigint()]);
146
- const Je = i.object({ width: i.number(), height: i.number() }), It = i.object({
146
+ const Je = i.object({ width: i.number(), height: i.number() }), Nt = i.object({
147
147
  signedWidth: i.number(),
148
148
  signedHeight: i.number()
149
149
  }), Et = ["width", "height"];
@@ -159,9 +159,9 @@ i.enum(Ct);
159
159
  const Dt = i.object({ lower: i.number(), upper: i.number() }), Lt = i.object({ lower: i.bigint(), upper: i.bigint() });
160
160
  i.union([Dt, ae]);
161
161
  i.union([Lt, ae]);
162
- i.union([He, et]);
162
+ i.enum([...He.options, ...et.options]);
163
163
  i.union([He, et, i.instanceof(String)]);
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) => {
164
+ const Pt = (r) => typeof r == "bigint" || r instanceof BigInt, F = (r, e) => Pt(r) ? r.valueOf() * BigInt(e.valueOf()) : r.valueOf() * Number(e.valueOf()), q = (r, e) => {
165
165
  const t = {};
166
166
  if (typeof r == "number" || typeof r == "bigint")
167
167
  e != null ? (t.lower = r, t.upper = e) : (t.lower = typeof r == "bigint" ? 0n : 0, t.upper = r);
@@ -171,7 +171,7 @@ const Pt = (r) => typeof r == "bigint" || r instanceof BigInt, q = (r, e) => Pt(
171
171
  } else return Ae(r);
172
172
  return Ae(t);
173
173
  }, Ae = (r) => r.lower > r.upper ? { lower: r.upper, upper: r.lower } : r, xe = (r, e) => {
174
- const t = j(r);
174
+ const t = q(r);
175
175
  return e < t.lower ? t.lower : e >= t.upper ? t.upper - (typeof t.upper == "number" ? 1 : 1n) : e;
176
176
  };
177
177
  i.object({
@@ -183,7 +183,7 @@ const Yt = i.object({ x: Ke, y: Qe }), kt = Object.freeze({ x: "left", y: "top"
183
183
  se,
184
184
  ae,
185
185
  Je,
186
- It,
186
+ Nt,
187
187
  Mt
188
188
  ]), qt = (r, e) => {
189
189
  if (typeof r == "string") {
@@ -191,12 +191,12 @@ const Yt = i.object({ x: Ke, y: Qe }), kt = Object.freeze({ x: "left", y: "top"
191
191
  return r === "x" ? { x: e, y: 0 } : { x: 0, y: e };
192
192
  }
193
193
  return typeof r == "number" ? { x: r, y: e ?? r } : Array.isArray(r) ? { x: r[0], y: r[1] } : "signedWidth" in r ? { x: r.signedWidth, y: r.signedHeight } : "clientX" in r ? { x: r.clientX, y: r.clientY } : "width" in r ? { x: r.width, y: r.height } : { x: r.x, y: r.y };
194
- }, $e = Object.freeze({ x: 0, y: 0 }), _ = i.union([i.number(), i.string()]);
194
+ }, $e = Object.freeze({ x: 0, y: 0 }), ee = i.union([i.number(), i.string()]);
195
195
  i.object({
196
- top: _,
197
- left: _,
198
- width: _,
199
- height: _
196
+ top: ee,
197
+ left: ee,
198
+ width: ee,
199
+ height: ee
200
200
  });
201
201
  i.object({
202
202
  left: i.number(),
@@ -235,7 +235,7 @@ const Te = (r, e, t = 0, n = 0, s) => {
235
235
  return { lower: e.one.y, upper: e.two.y };
236
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
237
  i.union([Je, Gt, se, ae]);
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);
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, L = (r, e, t) => zt(r, typeof e != "symbol" ? e + "" : e, t);
239
239
  const Vt = (r, e, t) => e !== void 0 && r < e ? e : t !== void 0 && r > t ? t : r;
240
240
  i.object({ offset: Me, scale: Me });
241
241
  i.object({ offset: i.number(), scale: i.number() });
@@ -261,7 +261,7 @@ const Zt = (r) => (e, t, n, s) => t === "dimension" ? [e, n] : [
261
261
  return n = Vt(n, s, a), [e, n];
262
262
  }, ge = class V {
263
263
  constructor() {
264
- D(this, "ops", []), D(this, "currBounds", null), D(this, "currType", null), D(this, "reversed", !1), this.ops = [];
264
+ L(this, "ops", []), L(this, "currBounds", null), L(this, "currType", null), L(this, "reversed", !1), this.ops = [];
265
265
  }
266
266
  /**
267
267
  * @returns a new scale with a translation as its first operation. Any number provided
@@ -303,15 +303,15 @@ const Zt = (r) => (e, t, n, s) => t === "dimension" ? [e, n] : [
303
303
  return n.type = "magnify", t.ops.push(n), t;
304
304
  }
305
305
  scale(e, t) {
306
- const n = j(e, t), s = this.new(), a = Ht(n);
306
+ const n = q(e, t), s = this.new(), a = Ht(n);
307
307
  return a.type = "scale", s.ops.push(a), s;
308
308
  }
309
309
  clamp(e, t) {
310
- const n = j(e, t), s = this.new(), a = Qt(n);
310
+ const n = q(e, t), s = this.new(), a = Qt(n);
311
311
  return a.type = "clamp", s.ops.push(a), s;
312
312
  }
313
313
  reBound(e, t) {
314
- const n = j(e, t), s = this.new(), a = Xt(n);
314
+ const n = q(e, t), s = this.new(), a = Xt(n);
315
315
  return a.type = "re-bound", s.ops.push(a), s;
316
316
  }
317
317
  invert() {
@@ -354,32 +354,32 @@ const Zt = (r) => (e, t, n, s) => t === "dimension" ? [e, n] : [
354
354
  return { scale: this.dim(1), offset: this.pos(0) };
355
355
  }
356
356
  };
357
- D(ge, "IDENTITY", new ge());
357
+ L(ge, "IDENTITY", new ge());
358
358
  let Ue = ge;
359
- const Be = class C {
359
+ const Be = class D {
360
360
  constructor(e = new Ue(), t = new Ue(), n = null) {
361
- D(this, "x"), D(this, "y"), D(this, "currRoot"), this.x = e, this.y = t, this.currRoot = n;
361
+ L(this, "x"), L(this, "y"), L(this, "currRoot"), this.x = e, this.y = t, this.currRoot = n;
362
362
  }
363
363
  static translate(e, t) {
364
- return new C().translate(e, t);
364
+ return new D().translate(e, t);
365
365
  }
366
366
  static translateX(e) {
367
- return new C().translateX(e);
367
+ return new D().translateX(e);
368
368
  }
369
369
  static translateY(e) {
370
- return new C().translateY(e);
370
+ return new D().translateY(e);
371
371
  }
372
372
  static clamp(e) {
373
- return new C().clamp(e);
373
+ return new D().clamp(e);
374
374
  }
375
375
  static magnify(e) {
376
- return new C().magnify(e);
376
+ return new D().magnify(e);
377
377
  }
378
378
  static scale(e) {
379
- return new C().scale(e);
379
+ return new D().scale(e);
380
380
  }
381
381
  static reBound(e) {
382
- return new C().reBound(e);
382
+ return new D().reBound(e);
383
383
  }
384
384
  translate(e, t) {
385
385
  const n = qt(e, t), s = this.copy();
@@ -414,7 +414,7 @@ const Be = class C {
414
414
  return t.x = this.x.clamp(le(e)), t.y = this.y.clamp(he(e)), t;
415
415
  }
416
416
  copy() {
417
- const e = new C();
417
+ const e = new D();
418
418
  return e.currRoot = this.currRoot, e.x = this.x, e.y = this.y, e;
419
419
  }
420
420
  reverse() {
@@ -443,16 +443,15 @@ const Be = class C {
443
443
  };
444
444
  }
445
445
  };
446
- D(Be, "IDENTITY", new Be());
447
- const _t = i.bigint().or(i.string().transform(BigInt));
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);
449
- let rr = (r, e = 21) => (t = e) => {
446
+ L(Be, "IDENTITY", new Be());
447
+ var _t = Object.defineProperty, er = (r, e, t) => e in r ? _t(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, u = (r, e, t) => er(r, typeof e != "symbol" ? e + "" : e, t);
448
+ let tr = (r, e = 21) => (t = e) => {
450
449
  let n = "", s = t | 0;
451
450
  for (; s--; )
452
451
  n += r[Math.random() * r.length | 0];
453
452
  return n;
454
453
  };
455
- const nr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", sr = rr(nr, 11), ir = i.enum(["static", "dynamic"]), tt = (r, e) => {
454
+ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr = tr(rr, 11), sr = () => nr(), ir = i.enum(["static", "dynamic"]), tt = (r, e) => {
456
455
  const t = new v(e);
457
456
  if (![
458
457
  O.DAY,
@@ -883,9 +882,9 @@ const T = class g {
883
882
  );
884
883
  }
885
884
  toString() {
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);
885
+ 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), N = a.sub(s), $ = c.sub(a), R = f.sub(c);
887
886
  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();
887
+ 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 `), N.isZero || (M += `${N.milliseconds}ms `), $.isZero || (M += `${$.microseconds}µs `), R.isZero || (M += `${R.nanoseconds}ns`), M.trim();
889
888
  }
890
889
  mult(e) {
891
890
  return new g(this.valueOf() * BigInt(e));
@@ -964,7 +963,7 @@ const T = class g {
964
963
  * @returns A TimeSpan representing the given number of microseconds.
965
964
  */
966
965
  static microseconds(e = 1) {
967
- return g.nanoseconds(q(e, 1e3));
966
+ return g.nanoseconds(F(e, 1e3));
968
967
  }
969
968
  /**
970
969
  * Creates a TimeSpan representing the given number of milliseconds.
@@ -973,7 +972,7 @@ const T = class g {
973
972
  * @returns A TimeSpan representing the given number of milliseconds.
974
973
  */
975
974
  static milliseconds(e = 1) {
976
- return g.microseconds(q(e, 1e3));
975
+ return g.microseconds(F(e, 1e3));
977
976
  }
978
977
  /**
979
978
  * Creates a TimeSpan representing the given number of seconds.
@@ -982,7 +981,7 @@ const T = class g {
982
981
  * @returns A TimeSpan representing the given number of seconds.
983
982
  */
984
983
  static seconds(e = 1) {
985
- return g.milliseconds(q(e, 1e3));
984
+ return g.milliseconds(F(e, 1e3));
986
985
  }
987
986
  /**
988
987
  * Creates a TimeSpan representing the given number of minutes.
@@ -991,7 +990,7 @@ const T = class g {
991
990
  * @returns A TimeSpan representing the given number of minutes.
992
991
  */
993
992
  static minutes(e = 1) {
994
- return g.seconds(q(e, 60));
993
+ return g.seconds(F(e, 60));
995
994
  }
996
995
  /**
997
996
  * Creates a TimeSpan representing the given number of hours.
@@ -1000,7 +999,7 @@ const T = class g {
1000
999
  * @returns A TimeSpan representing the given number of hours.
1001
1000
  */
1002
1001
  static hours(e) {
1003
- return g.minutes(q(e, 60));
1002
+ return g.minutes(F(e, 60));
1004
1003
  }
1005
1004
  /**
1006
1005
  * Creates a TimeSpan representing the given number of days.
@@ -1009,7 +1008,7 @@ const T = class g {
1009
1008
  * @returns A TimeSpan representing the given number of days.
1010
1009
  */
1011
1010
  static days(e) {
1012
- return g.hours(q(e, 24));
1011
+ return g.hours(F(e, 24));
1013
1012
  }
1014
1013
  };
1015
1014
  u(T, "NANOSECOND", T.nanoseconds(1)), /** A microsecond. */
@@ -1030,7 +1029,7 @@ u(T, "z", i.union([
1030
1029
  i.instanceof(T)
1031
1030
  ]));
1032
1031
  let O = T;
1033
- const Z = class te extends Number {
1032
+ const Z = class re extends Number {
1034
1033
  constructor(e) {
1035
1034
  e instanceof Number ? super(e.valueOf()) : super(e);
1036
1035
  }
@@ -1040,7 +1039,7 @@ const Z = class te extends Number {
1040
1039
  }
1041
1040
  /** @returns The number of seconds in the Rate. */
1042
1041
  equals(e) {
1043
- return this.valueOf() === new te(e).valueOf();
1042
+ return this.valueOf() === new re(e).valueOf();
1044
1043
  }
1045
1044
  /**
1046
1045
  * Calculates the period of the Rate as a TimeSpan.
@@ -1095,7 +1094,7 @@ const Z = class te extends Number {
1095
1094
  * @returns A Rate representing the given number of Hz.
1096
1095
  */
1097
1096
  static hz(e) {
1098
- return new te(e);
1097
+ return new re(e);
1099
1098
  }
1100
1099
  /**
1101
1100
  * Creates a Rate representing the given number of kHz.
@@ -1104,7 +1103,7 @@ const Z = class te extends Number {
1104
1103
  * @returns A Rate representing the given number of kHz.
1105
1104
  */
1106
1105
  static khz(e) {
1107
- return te.hz(e * 1e3);
1106
+ return re.hz(e * 1e3);
1108
1107
  }
1109
1108
  };
1110
1109
  u(Z, "z", i.union([
@@ -1113,7 +1112,7 @@ u(Z, "z", i.union([
1113
1112
  i.instanceof(Z)
1114
1113
  ]));
1115
1114
  let Re = Z;
1116
- const I = class extends Number {
1115
+ const E = class extends Number {
1117
1116
  /**
1118
1117
  * Creates a Density representing the given number of bytes per value.
1119
1118
  *
@@ -1131,19 +1130,19 @@ const I = class extends Number {
1131
1130
  return new pe(e * this.valueOf());
1132
1131
  }
1133
1132
  };
1134
- u(I, "UNKNOWN", new I(0)), /** 128 bits per value. */
1135
- u(I, "BIT128", new I(16)), /** 64 bits per value. */
1136
- u(I, "BIT64", new I(8)), /** 32 bits per value. */
1137
- u(I, "BIT32", new I(4)), /** 16 bits per value. */
1138
- u(I, "BIT16", new I(2)), /** 8 bits per value. */
1139
- u(I, "BIT8", new I(1)), /** A zod schema for validating and transforming densities */
1140
- u(I, "z", i.union([
1141
- i.number().transform((r) => new I(r)),
1142
- i.instanceof(Number).transform((r) => new I(r)),
1143
- i.instanceof(I)
1133
+ u(E, "UNKNOWN", new E(0)), /** 128 bits per value. */
1134
+ u(E, "BIT128", new E(16)), /** 64 bits per value. */
1135
+ u(E, "BIT64", new E(8)), /** 32 bits per value. */
1136
+ u(E, "BIT32", new E(4)), /** 16 bits per value. */
1137
+ u(E, "BIT16", new E(2)), /** 8 bits per value. */
1138
+ u(E, "BIT8", new E(1)), /** A zod schema for validating and transforming densities */
1139
+ u(E, "z", i.union([
1140
+ i.number().transform((r) => new E(r)),
1141
+ i.instanceof(Number).transform((r) => new E(r)),
1142
+ i.instanceof(E)
1144
1143
  ]));
1145
- let x = I;
1146
- const $ = class re {
1144
+ let x = E;
1145
+ const U = class ne {
1147
1146
  /**
1148
1147
  * Creates a TimeRange from the given start and end TimeStamps.
1149
1148
  *
@@ -1193,7 +1192,7 @@ const $ = class re {
1193
1192
  * @returns A TimeRange with the start and end swapped.
1194
1193
  */
1195
1194
  swap() {
1196
- return new re(this.end, this.start);
1195
+ return new ne(this.end, this.start);
1197
1196
  }
1198
1197
  /**
1199
1198
  * Checks if the TimeRange is equal to the given TimeRange.
@@ -1231,21 +1230,21 @@ const $ = class re {
1231
1230
  return n < 0 && (n = -n), s < 0 && (s = -s), n <= t.valueOf() && s <= t.valueOf();
1232
1231
  }
1233
1232
  contains(e) {
1234
- return e instanceof re ? this.contains(e.start) && this.contains(e.end) : this.start.beforeEq(e) && this.end.after(e);
1233
+ return e instanceof ne ? this.contains(e.start) && this.contains(e.end) : this.start.beforeEq(e) && this.end.after(e);
1235
1234
  }
1236
1235
  boundBy(e) {
1237
- const t = new re(this.start, this.end);
1236
+ const t = new ne(this.start, this.end);
1238
1237
  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;
1239
1238
  }
1240
1239
  };
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($)
1240
+ u(U, "MAX", new U(v.MIN, v.MAX)), /** The minimum possible time range. */
1241
+ u(U, "MIN", new U(v.MAX, v.MIN)), /** A zero time range. */
1242
+ u(U, "ZERO", new U(v.ZERO, v.ZERO)), /** A zod schema for validating and transforming time ranges */
1243
+ u(U, "z", i.union([
1244
+ i.object({ start: v.z, end: v.z }).transform((r) => new U(r.start, r.end)),
1245
+ i.instanceof(U)
1247
1246
  ]));
1248
- let Oe = $;
1247
+ let Oe = U;
1249
1248
  const o = class S extends String {
1250
1249
  constructor(e) {
1251
1250
  if (e instanceof S || typeof e == "string" || typeof e.valueOf() == "string") {
@@ -1413,7 +1412,7 @@ u(o, "z", i.union([
1413
1412
  i.instanceof(o)
1414
1413
  ]));
1415
1414
  let w = o;
1416
- const E = class N extends Number {
1415
+ const A = class I extends Number {
1417
1416
  constructor(e) {
1418
1417
  super(e.valueOf());
1419
1418
  }
@@ -1426,31 +1425,31 @@ const E = class N extends Number {
1426
1425
  return this.valueOf() < e.valueOf();
1427
1426
  }
1428
1427
  add(e) {
1429
- return N.bytes(this.valueOf() + e.valueOf());
1428
+ return I.bytes(this.valueOf() + e.valueOf());
1430
1429
  }
1431
1430
  sub(e) {
1432
- return N.bytes(this.valueOf() - e.valueOf());
1431
+ return I.bytes(this.valueOf() - e.valueOf());
1433
1432
  }
1434
1433
  truncate(e) {
1435
- return new N(Math.trunc(this.valueOf() / e.valueOf()) * e.valueOf());
1434
+ return new I(Math.trunc(this.valueOf() / e.valueOf()) * e.valueOf());
1436
1435
  }
1437
1436
  remainder(e) {
1438
- return N.bytes(this.valueOf() % e.valueOf());
1437
+ return I.bytes(this.valueOf() % e.valueOf());
1439
1438
  }
1440
1439
  get gigabytes() {
1441
- return this.valueOf() / N.GIGABYTE.valueOf();
1440
+ return this.valueOf() / I.GIGABYTE.valueOf();
1442
1441
  }
1443
1442
  get megabytes() {
1444
- return this.valueOf() / N.MEGABYTE.valueOf();
1443
+ return this.valueOf() / I.MEGABYTE.valueOf();
1445
1444
  }
1446
1445
  get kilobytes() {
1447
- return this.valueOf() / N.KILOBYTE.valueOf();
1446
+ return this.valueOf() / I.KILOBYTE.valueOf();
1448
1447
  }
1449
1448
  get terabytes() {
1450
- return this.valueOf() / N.TERABYTE.valueOf();
1449
+ return this.valueOf() / I.TERABYTE.valueOf();
1451
1450
  }
1452
1451
  toString() {
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);
1452
+ const e = this.truncate(I.TERABYTE), t = this.truncate(I.GIGABYTE), n = this.truncate(I.MEGABYTE), s = this.truncate(I.KILOBYTE), a = this.truncate(I.BYTE), c = e, f = t.sub(e), d = n.sub(t), p = s.sub(n), m = a.sub(s);
1454
1453
  let l = "";
1455
1454
  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();
1456
1455
  }
@@ -1461,7 +1460,7 @@ const E = class N extends Number {
1461
1460
  * @returns A Size representing the given number of bytes.
1462
1461
  */
1463
1462
  static bytes(e = 1) {
1464
- return new N(e);
1463
+ return new I(e);
1465
1464
  }
1466
1465
  /**
1467
1466
  * Creates a Size from the given number if kilobytes.
@@ -1470,7 +1469,7 @@ const E = class N extends Number {
1470
1469
  * @returns A Size representing the given number of kilobytes.
1471
1470
  */
1472
1471
  static kilobytes(e = 1) {
1473
- return N.bytes(e.valueOf() * 1e3);
1472
+ return I.bytes(e.valueOf() * 1e3);
1474
1473
  }
1475
1474
  /**
1476
1475
  * Creates a Size from the given number of megabytes.
@@ -1479,7 +1478,7 @@ const E = class N extends Number {
1479
1478
  * @returns A Size representing the given number of megabytes.
1480
1479
  */
1481
1480
  static megabytes(e = 1) {
1482
- return N.kilobytes(e.valueOf() * 1e3);
1481
+ return I.kilobytes(e.valueOf() * 1e3);
1483
1482
  }
1484
1483
  /**
1485
1484
  * Creates a Size from the given number of gigabytes.
@@ -1488,7 +1487,7 @@ const E = class N extends Number {
1488
1487
  * @returns A Size representing the given number of gigabytes.
1489
1488
  */
1490
1489
  static gigabytes(e = 1) {
1491
- return N.megabytes(e.valueOf() * 1e3);
1490
+ return I.megabytes(e.valueOf() * 1e3);
1492
1491
  }
1493
1492
  /**
1494
1493
  * Creates a Size from the given number of terabytes.
@@ -1497,23 +1496,23 @@ const E = class N extends Number {
1497
1496
  * @returns A Size representing the given number of terabytes.
1498
1497
  */
1499
1498
  static terabytes(e) {
1500
- return N.gigabytes(e.valueOf() * 1e3);
1499
+ return I.gigabytes(e.valueOf() * 1e3);
1501
1500
  }
1502
1501
  get isZero() {
1503
1502
  return this.valueOf() === 0;
1504
1503
  }
1505
1504
  };
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
+ u(A, "BYTE", new A(1)), /** A kilobyte */
1506
+ u(A, "KILOBYTE", A.kilobytes(1)), /** A megabyte */
1507
+ u(A, "MEGABYTE", A.megabytes(1)), /** A gigabyte */
1508
+ u(A, "GIGABYTE", A.gigabytes(1)), /** A terabyte. */
1509
+ u(A, "TERABYTE", A.terabytes(1)), /** The zero value for Size */
1510
+ u(A, "ZERO", new A(0)), /** A zod schema for a Size. */
1511
+ u(A, "z", i.union([
1512
+ i.number().transform((r) => new A(r)),
1513
+ i.instanceof(A)
1515
1514
  ]));
1516
- let pe = E;
1515
+ let pe = A;
1517
1516
  i.union([
1518
1517
  i.instanceof(Uint8Array),
1519
1518
  i.instanceof(Uint16Array),
@@ -1529,13 +1528,13 @@ i.union([
1529
1528
  const rt = (r) => {
1530
1529
  const e = typeof r;
1531
1530
  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(
1531
+ }, ar = (r, e, t, n = 0) => r.usesBigInt && !e.usesBigInt ? Number(t) - Number(n) : !r.usesBigInt && e.usesBigInt ? BigInt(t.valueOf()) - BigInt(n.valueOf()) : J(t, -n).valueOf(), J = (r, e) => typeof r == "bigint" && typeof e == "bigint" || typeof r == "number" && typeof e == "number" ? r + e : e === 0 ? r : r === 0 ? e : Number(r) + Number(e), 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(
1533
1532
  (r) => new Uint8Array(
1534
1533
  atob(r).split("").map((e) => e.charCodeAt(0))
1535
1534
  ).buffer
1536
- ), cr = i.union([i.null(), i.undefined()]).transform(() => new Uint8Array().buffer), ye = 10, J = class U {
1535
+ ), cr = i.union([i.null(), i.undefined()]).transform(() => new Uint8Array().buffer), ye = 10, H = class B {
1537
1536
  constructor(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 });
1537
+ 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 });
1539
1538
  const {
1540
1539
  dataType: t,
1541
1540
  timeRange: n,
@@ -1544,7 +1543,7 @@ const rt = (r) => {
1544
1543
  alignment: c = 0n,
1545
1544
  key: f = sr()
1546
1545
  } = e, d = e.data ?? [];
1547
- if (d instanceof U || typeof d == "object" && "isSynnaxSeries" in d && d.isSynnaxSeries === !0) {
1546
+ if (d instanceof B || typeof d == "object" && "isSynnaxSeries" in d && d.isSynnaxSeries === !0) {
1548
1547
  const l = d;
1549
1548
  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;
1550
1549
  return;
@@ -1581,14 +1580,18 @@ const rt = (r) => {
1581
1580
  if (!m && !p) this._data = d;
1582
1581
  else {
1583
1582
  let l = p ? [d] : d;
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(`
1583
+ const N = l[0];
1584
+ (N instanceof v || N instanceof Date || N instanceof O) && (l = l.map(($) => new v($).valueOf())), this.dataType.equals(w.STRING) ? (this._cachedLength = l.length, this._data = new TextEncoder().encode(`${l.join(`
1586
1585
  `)}
1587
1586
  `).buffer) : this.dataType.equals(w.JSON) ? (this._cachedLength = l.length, this._data = new TextEncoder().encode(
1588
- `${l.map((B) => ee.encodeString(B)).join(`
1587
+ `${l.map(($) => te.encodeString($)).join(`
1589
1588
  `)}
1590
1589
  `
1591
- ).buffer) : this._data = new this.dataType.Array(l).buffer;
1590
+ ).buffer) : this.dataType.usesBigInt && typeof N == "number" ? this._data = new this.dataType.Array(
1591
+ l.map(($) => BigInt(Math.round($)))
1592
+ ).buffer : !this.dataType.usesBigInt && typeof N == "bigint" ? this._data = new this.dataType.Array(
1593
+ l.map(($) => Number($))
1594
+ ).buffer : this._data = new this.dataType.Array(l).buffer;
1592
1595
  }
1593
1596
  this.key = f, this.alignment = c, this.sampleOffset = s ?? 0, this._timeRange = n, this.gl = {
1594
1597
  control: null,
@@ -1600,18 +1603,18 @@ const rt = (r) => {
1600
1603
  static alloc({ capacity: e, dataType: t, ...n }) {
1601
1604
  if (e === 0)
1602
1605
  throw new Error("[Series] - cannot allocate an array of length 0");
1603
- const s = new new w(t).Array(e), a = new U({
1606
+ const s = new new w(t).Array(e), a = new B({
1604
1607
  data: s.buffer,
1605
1608
  dataType: t,
1606
1609
  ...n
1607
1610
  });
1608
1611
  return a.writePos = 0, a;
1609
1612
  }
1610
- static generateTimestamps(e, t, n) {
1613
+ static createTimestamps(e, t, n) {
1611
1614
  const s = n.spanRange(t.span(e)), a = new BigInt64Array(e);
1612
1615
  for (let c = 0; c < e; c++)
1613
1616
  a[c] = BigInt(n.add(t.span(c)).valueOf());
1614
- return new U({ data: a, dataType: w.TIMESTAMP, timeRange: s });
1617
+ return new B({ data: a, dataType: w.TIMESTAMP, timeRange: s });
1615
1618
  }
1616
1619
  get refCount() {
1617
1620
  return this._refCount;
@@ -1622,15 +1625,15 @@ const rt = (r) => {
1622
1625
  `)}
1623
1626
  `
1624
1627
  );
1625
- return new U({ data: n, dataType: w.STRING, timeRange: t });
1628
+ return new B({ data: n, dataType: w.STRING, timeRange: t });
1626
1629
  }
1627
1630
  static fromJSON(e, t) {
1628
1631
  const n = new TextEncoder().encode(
1629
- `${e.map((s) => ee.encodeString(s)).join(`
1632
+ `${e.map((s) => te.encodeString(s)).join(`
1630
1633
  `)}
1631
1634
  `
1632
1635
  );
1633
- return new U({ data: n, dataType: w.JSON, timeRange: t });
1636
+ return new B({ data: n, dataType: w.JSON, timeRange: t });
1634
1637
  }
1635
1638
  acquire(e) {
1636
1639
  this._refCount++, e != null && this.updateGLBuffer(e);
@@ -1655,12 +1658,12 @@ const rt = (r) => {
1655
1658
  return this.dataType.isVariable ? this.writeVariable(e) : this.writeFixed(e);
1656
1659
  }
1657
1660
  writeVariable(e) {
1658
- if (this.writePos === L) return 0;
1661
+ if (this.writePos === P) return 0;
1659
1662
  const t = this.byteCapacity.valueOf() - this.writePos, n = e.subBytes(0, t);
1660
1663
  return this.writeToUnderlyingData(n), this.writePos += n.byteLength.valueOf(), this._cachedLength != null && (this._cachedLength += n.length, this.calculateCachedLength()), n.length;
1661
1664
  }
1662
1665
  writeFixed(e) {
1663
- if (this.writePos === L) return 0;
1666
+ if (this.writePos === P) return 0;
1664
1667
  const t = this.capacity - this.writePos, n = e.sub(0, t);
1665
1668
  return this.writeToUnderlyingData(n), this._cachedLength = void 0, this.maybeRecomputeMinMax(n), this.writePos += n.length, n.length;
1666
1669
  }
@@ -1679,7 +1682,7 @@ const rt = (r) => {
1679
1682
  }
1680
1683
  /** @returns a native typed array with the proper data type. */
1681
1684
  get data() {
1682
- return this.writePos === L ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
1685
+ return this.writePos === P ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
1683
1686
  }
1684
1687
  toStrings() {
1685
1688
  if (!this.dataType.matches(w.STRING, w.UUID))
@@ -1704,7 +1707,7 @@ const rt = (r) => {
1704
1707
  if (!this.dataType.equals(w.JSON))
1705
1708
  throw new Error("cannot parse non-JSON series as JSON");
1706
1709
  return new TextDecoder().decode(this.underlyingData).split(`
1707
- `).slice(0, -1).map((t) => e.parse(ee.decodeString(t)));
1710
+ `).slice(0, -1).map((t) => e.parse(te.decodeString(t)));
1708
1711
  }
1709
1712
  /** @returns the time range of this array. */
1710
1713
  get timeRange() {
@@ -1721,11 +1724,11 @@ const rt = (r) => {
1721
1724
  }
1722
1725
  /** @returns the length of the series in bytes. */
1723
1726
  get byteLength() {
1724
- return this.writePos === L ? this.byteCapacity : this.dataType.isVariable ? new pe(this.writePos) : this.dataType.density.size(this.writePos);
1727
+ return this.writePos === P ? this.byteCapacity : this.dataType.isVariable ? new pe(this.writePos) : this.dataType.density.size(this.writePos);
1725
1728
  }
1726
1729
  /** @returns the number of samples in this array. */
1727
1730
  get length() {
1728
- return this._cachedLength != null ? this._cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === L ? this.data.length : this.writePos;
1731
+ return this._cachedLength != null ? this._cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === P ? this.data.length : this.writePos;
1729
1732
  }
1730
1733
  calculateCachedLength() {
1731
1734
  if (!this.dataType.isVariable)
@@ -1750,7 +1753,7 @@ const rt = (r) => {
1750
1753
  const n = new e.Array(this.length);
1751
1754
  for (let s = 0; s < this.length; s++)
1752
1755
  n[s] = ar(this.dataType, e, this.data[s], t);
1753
- return new U({
1756
+ return new B({
1754
1757
  data: n.buffer,
1755
1758
  dataType: e,
1756
1759
  timeRange: this._timeRange,
@@ -1776,7 +1779,7 @@ const rt = (r) => {
1776
1779
  get max() {
1777
1780
  if (this.dataType.isVariable)
1778
1781
  throw new Error("cannot calculate maximum on a variable length data type");
1779
- return this.writePos === 0 ? -1 / 0 : (this._cachedMax ?? (this._cachedMax = this.calcRawMax()), H(this._cachedMax, this.sampleOffset));
1782
+ return this.writePos === 0 ? -1 / 0 : (this._cachedMax ?? (this._cachedMax = this.calcRawMax()), J(this._cachedMax, this.sampleOffset));
1780
1783
  }
1781
1784
  calcRawMin() {
1782
1785
  if (this.length === 0) return 1 / 0;
@@ -1794,11 +1797,11 @@ const rt = (r) => {
1794
1797
  get min() {
1795
1798
  if (this.dataType.isVariable)
1796
1799
  throw new Error("cannot calculate minimum on a variable length data type");
1797
- return this.writePos === 0 ? 1 / 0 : (this._cachedMin ?? (this._cachedMin = this.calcRawMin()), H(this._cachedMin, this.sampleOffset));
1800
+ return this.writePos === 0 ? 1 / 0 : (this._cachedMin ?? (this._cachedMin = this.calcRawMin()), J(this._cachedMin, this.sampleOffset));
1798
1801
  }
1799
1802
  /** @returns the bounds of this array. */
1800
1803
  get bounds() {
1801
- return j(Number(this.min), Number(this.max));
1804
+ return q(Number(this.min), Number(this.max));
1802
1805
  }
1803
1806
  maybeRecomputeMinMax(e) {
1804
1807
  if (this._cachedMin != null) {
@@ -1814,7 +1817,7 @@ const rt = (r) => {
1814
1817
  this.max, this.min;
1815
1818
  }
1816
1819
  get range() {
1817
- return H(this.max, -this.min);
1820
+ return J(this.max, -this.min);
1818
1821
  }
1819
1822
  atAlignment(e, t) {
1820
1823
  const n = Number(e - this.alignment);
@@ -1832,7 +1835,7 @@ const rt = (r) => {
1832
1835
  if (t === !0) throw new Error(`[series] - no value at index ${e}`);
1833
1836
  return;
1834
1837
  }
1835
- return H(n, this.sampleOffset);
1838
+ return J(n, this.sampleOffset);
1836
1839
  }
1837
1840
  atVariable(e, t) {
1838
1841
  let n = 0, s = 0;
@@ -1876,7 +1879,7 @@ const rt = (r) => {
1876
1879
  throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
1877
1880
  const { buffer: t, bufferUsage: n, prevBuffer: s } = this.gl;
1878
1881
  if (t == null && (this.gl.buffer = e.createBuffer()), this.writePos !== s)
1879
- if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== L) {
1882
+ if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== P) {
1880
1883
  s === 0 && e.bufferData(e.ARRAY_BUFFER, this.byteCapacity.valueOf(), e.STATIC_DRAW);
1881
1884
  const a = this.dataType.density.size(s).valueOf(), c = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
1882
1885
  e.bufferSubData(e.ARRAY_BUFFER, a, c.buffer), this.gl.prevBuffer = this.writePos;
@@ -1885,7 +1888,7 @@ const rt = (r) => {
1885
1888
  e.ARRAY_BUFFER,
1886
1889
  this.buffer,
1887
1890
  n === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW
1888
- ), this.gl.prevBuffer = L;
1891
+ ), this.gl.prevBuffer = P;
1889
1892
  }
1890
1893
  as(e) {
1891
1894
  if (e === "string") {
@@ -1935,7 +1938,7 @@ const rt = (r) => {
1935
1938
  };
1936
1939
  }
1937
1940
  get alignmentBounds() {
1938
- return j(this.alignment, this.alignment + BigInt(this.length));
1941
+ return q(this.alignment, this.alignment + BigInt(this.length));
1939
1942
  }
1940
1943
  maybeGarbageCollectGLBuffer(e) {
1941
1944
  this.gl.buffer != null && (e.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
@@ -1970,7 +1973,7 @@ const rt = (r) => {
1970
1973
  subBytes(e, t) {
1971
1974
  if (e >= 0 && (t == null || t >= this.byteLength.valueOf())) return this;
1972
1975
  const n = this.data.subarray(e, t);
1973
- return new U({
1976
+ return new B({
1974
1977
  data: n,
1975
1978
  dataType: this.dataType,
1976
1979
  timeRange: this._timeRange,
@@ -1982,7 +1985,7 @@ const rt = (r) => {
1982
1985
  sliceSub(e, t, n) {
1983
1986
  if (t <= 0 && (n == null || n >= this.length)) return this;
1984
1987
  let s;
1985
- return e ? s = this.data.subarray(t, n) : s = this.data.slice(t, n), new U({
1988
+ return e ? s = this.data.subarray(t, n) : s = this.data.slice(t, n), new B({
1986
1989
  data: s,
1987
1990
  dataType: this.dataType,
1988
1991
  timeRange: this._timeRange,
@@ -1992,7 +1995,7 @@ const rt = (r) => {
1992
1995
  });
1993
1996
  }
1994
1997
  reAlign(e) {
1995
- return new U({
1998
+ return new B({
1996
1999
  data: this.buffer,
1997
2000
  dataType: this.dataType,
1998
2001
  timeRange: Oe.ZERO,
@@ -2002,10 +2005,10 @@ const rt = (r) => {
2002
2005
  });
2003
2006
  }
2004
2007
  };
2005
- u(J, "crudeZ", i.object({
2008
+ u(H, "crudeZ", i.object({
2006
2009
  timeRange: Oe.z.optional(),
2007
2010
  dataType: w.z,
2008
- alignment: _t.optional(),
2011
+ alignment: i.coerce.bigint().optional(),
2009
2012
  data: i.union([
2010
2013
  ur,
2011
2014
  cr,
@@ -2013,12 +2016,12 @@ u(J, "crudeZ", i.object({
2013
2016
  i.instanceof(Uint8Array)
2014
2017
  ]),
2015
2018
  glBufferUsage: ir.optional().default("static").optional()
2016
- })), u(J, "z", J.crudeZ.transform((r) => new J(r)));
2017
- let lr = J;
2019
+ })), u(H, "z", H.crudeZ.transform((r) => new H(r)));
2020
+ let lr = H;
2018
2021
  class Ce {
2019
2022
  constructor(e, t, n) {
2020
2023
  u(this, "series"), u(this, "end"), u(this, "index"), this.series = e;
2021
- const s = j(0, e.length);
2024
+ const s = q(0, e.length);
2022
2025
  this.end = xe(s, n), this.index = xe(s, t);
2023
2026
  }
2024
2027
  next() {
@@ -2055,7 +2058,7 @@ class fr {
2055
2058
  const e = this.wrapped.next();
2056
2059
  return e.done === !0 ? { done: !0, value: void 0 } : {
2057
2060
  done: !1,
2058
- value: ee.decodeString(e.value)
2061
+ value: te.decodeString(e.value)
2059
2062
  };
2060
2063
  }
2061
2064
  [(Le = Symbol.iterator, De = Symbol.toStringTag, Le)]() {
@@ -2077,7 +2080,7 @@ class dr {
2077
2080
  return this;
2078
2081
  }
2079
2082
  }
2080
- const H = (r, e) => typeof r == "bigint" && typeof e == "bigint" || typeof r == "number" && typeof e == "number" ? r + e : e === 0 ? r : r === 0 ? e : Number(r) + Number(e), ke = (r) => {
2083
+ const ke = (r) => {
2081
2084
  const e = r >> 32n, t = r & 0xffffffffn;
2082
2085
  return { domain: e, sample: t };
2083
2086
  };
@@ -2112,7 +2115,7 @@ const br = (r = {}) => {
2112
2115
  osZ: mr
2113
2116
  }, Symbol.toStringTag, { value: "Module" }));
2114
2117
  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 {
2118
+ 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 {
2116
2119
  /**
2117
2120
  * @param host - The hostname or IP address of the server.
2118
2121
  * @param port - The port number of the server.
@@ -2154,45 +2157,65 @@ const vr = (...r) => r.map(at).join(""), at = (r) => (r.endsWith("/") || (r += "
2154
2157
  }
2155
2158
  };
2156
2159
  X(me, "UNKNOWN", new me({ host: "unknown", port: 0 }));
2157
- let Ir = me;
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);
2159
- const xr = async (r) => await new Promise(
2160
+ let Nr = me;
2161
+ const Er = -128, Ar = 127;
2162
+ i.number().int().min(Er).max(Ar);
2163
+ const xr = -32768, Mr = 32767;
2164
+ i.number().int().min(xr).max(Mr);
2165
+ const $r = -2147483648, Ur = 2147483647;
2166
+ i.number().int().min($r).max(Ur);
2167
+ const Br = -9223372036854775808n, Rr = 9223372036854775807n;
2168
+ i.bigint().min(Br).max(Rr);
2169
+ const Cr = 255;
2170
+ i.number().int().min(0).max(Cr);
2171
+ const Dr = 65535;
2172
+ i.number().int().min(0).max(Dr);
2173
+ const Lr = 4294967295;
2174
+ i.number().int().min(0).max(Lr);
2175
+ const Pr = 18446744073709551615n;
2176
+ i.bigint().min(0n).max(Pr);
2177
+ var Yr = Object.defineProperty, kr = (r, e, t) => e in r ? Yr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, K = (r, e, t) => kr(r, typeof e != "symbol" ? e + "" : e, t);
2178
+ const jr = async (r) => await new Promise(
2160
2179
  (e) => setTimeout(e, O.fromMilliseconds(r).milliseconds)
2161
- ), Mr = i.object({
2180
+ ), qr = i.object({
2162
2181
  interval: O.z.optional(),
2163
2182
  maxRetries: i.number().optional(),
2164
2183
  scale: i.number().optional()
2165
- }), $r = (r = {}) => {
2166
- const e = r.sleepFn || xr, t = r.maxRetries ?? 5, n = r.scale ?? 1;
2184
+ }), Fr = (r = {}) => {
2185
+ const e = r.sleepFn || jr, t = r.maxRetries ?? 5, n = r.scale ?? 1;
2167
2186
  let s = 0, a = new O(r.interval ?? O.milliseconds(1));
2168
2187
  return async () => s >= t ? !1 : (await e(a), a = a.mult(n), s++, !0);
2169
- }, Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2188
+ }, Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2170
2189
  __proto__: null,
2171
- breakerConfig: Mr,
2172
- create: $r
2173
- }, Symbol.toStringTag, { value: "Module" })), F = class extends Number {
2190
+ breakerConfig: qr,
2191
+ create: Fr
2192
+ }, Symbol.toStringTag, { value: "Module" })), C = class extends Number {
2174
2193
  };
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))
2194
+ K(C, "ABSOLUTE", 255), K(C, "MINIMUM", 0), K(C, "BOUNDS", {
2195
+ lower: C.MINIMUM,
2196
+ // upper bound is exclusive, so we add 1
2197
+ upper: C.ABSOLUTE + 1
2198
+ }), K(C, "z", i.union([
2199
+ i.instanceof(C),
2200
+ i.number().int().min(0).max(255).transform((r) => new C(r)),
2201
+ i.instanceof(Number).transform((r) => new C(r))
2179
2202
  ]));
2180
2203
  i.object({
2181
2204
  name: i.string(),
2182
2205
  key: i.string()
2183
2206
  });
2184
- const ot = class K extends Error {
2207
+ const ot = class Q extends Error {
2185
2208
  constructor() {
2186
- super(K.MESSAGE);
2209
+ super(Q.MESSAGE);
2187
2210
  }
2188
2211
  /** Returns true if the error or message is a cancellation error" */
2189
2212
  matches(e) {
2190
- return typeof e == "string" ? e.includes(K.MESSAGE) : e instanceof K || e.message.includes(K.MESSAGE);
2213
+ return typeof e == "string" ? e.includes(Q.MESSAGE) : e instanceof Q || e.message.includes(Q.MESSAGE);
2191
2214
  }
2192
2215
  };
2193
- ne(ot, "MESSAGE", "canceled");
2194
- let Br = ot;
2195
- new Br();
2216
+ K(ot, "MESSAGE", "canceled");
2217
+ let Wr = ot;
2218
+ new Wr();
2196
2219
  i.string().regex(/^\d+\.\d+\.\d+$/);
2197
2220
  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);
2198
2221
  class oe extends Error {
@@ -2202,7 +2225,7 @@ class oe extends Error {
2202
2225
  y(this, "type", "");
2203
2226
  }
2204
2227
  }
2205
- const Rr = (r) => {
2228
+ const zr = (r) => {
2206
2229
  if (r == null || typeof r != "object") return !1;
2207
2230
  const e = r;
2208
2231
  if (e.discriminator !== "FreighterError") return !1;
@@ -2211,8 +2234,8 @@ const Rr = (r) => {
2211
2234
  `Freighter error is missing its type property: ${JSON.stringify(e)}`
2212
2235
  );
2213
2236
  return !0;
2214
- }, je = "unknown", qe = "nil", Cr = "freighter", ut = i.object({ type: i.string(), data: i.string() });
2215
- class Dr {
2237
+ }, je = "unknown", qe = "nil", Vr = "freighter", ut = i.object({ type: i.string(), data: i.string() });
2238
+ class Zr {
2216
2239
  constructor() {
2217
2240
  y(this, "providers", []);
2218
2241
  }
@@ -2221,7 +2244,7 @@ class Dr {
2221
2244
  }
2222
2245
  encode(e) {
2223
2246
  if (e == null) return { type: qe, data: "" };
2224
- if (Rr(e))
2247
+ if (zr(e))
2225
2248
  for (const t of this.providers) {
2226
2249
  const n = t.encode(e);
2227
2250
  if (n != null) return n;
@@ -2238,10 +2261,10 @@ class Dr {
2238
2261
  return new Fe(e.data);
2239
2262
  }
2240
2263
  }
2241
- const Se = new Dr(), Lr = ({
2264
+ const Se = new Zr(), Jr = ({
2242
2265
  encode: r,
2243
2266
  decode: e
2244
- }) => Se.register({ encode: r, decode: e }), en = (r) => Se.encode(r), be = (r) => Se.decode(r);
2267
+ }) => Se.register({ encode: r, decode: e }), dn = (r) => Se.encode(r), be = (r) => Se.decode(r);
2245
2268
  class Fe extends oe {
2246
2269
  constructor() {
2247
2270
  super(...arguments);
@@ -2255,7 +2278,7 @@ const ue = "freighter.", G = class G extends oe {
2255
2278
  }
2256
2279
  };
2257
2280
  y(G, "TYPE", `${ue}eof`), y(G, "matches", ve(G.TYPE));
2258
- let P = G;
2281
+ let Y = G;
2259
2282
  const W = class W extends oe {
2260
2283
  constructor() {
2261
2284
  super("StreamClosed");
@@ -2263,10 +2286,10 @@ const W = class W extends oe {
2263
2286
  }
2264
2287
  };
2265
2288
  y(W, "TYPE", `${ue}stream_closed`), y(W, "matches", ve(W.TYPE));
2266
- let Y = W;
2289
+ let k = W;
2267
2290
  const z = class z extends oe {
2268
2291
  constructor(t = {}) {
2269
- const { message: n = "Unreachable", url: s = Ir.UNKNOWN } = t;
2292
+ const { message: n = "Unreachable", url: s = Nr.UNKNOWN } = t;
2270
2293
  super(n);
2271
2294
  y(this, "type", z.TYPE);
2272
2295
  y(this, "url");
@@ -2274,31 +2297,31 @@ const z = class z extends oe {
2274
2297
  }
2275
2298
  };
2276
2299
  y(z, "TYPE", `${ue}unreachable`), y(z, "matches", ve(z.TYPE));
2277
- let k = z;
2278
- const Pr = (r) => {
2279
- if (!r.type.startsWith(Cr)) return null;
2280
- if (P.matches(r)) return { type: P.TYPE, data: "EOF" };
2281
- if (Y.matches(r))
2282
- return { type: Y.TYPE, data: "StreamClosed" };
2300
+ let j = z;
2301
+ const Hr = (r) => {
2302
+ if (!r.type.startsWith(Vr)) return null;
2303
+ if (Y.matches(r)) return { type: Y.TYPE, data: "EOF" };
2283
2304
  if (k.matches(r))
2284
- return { type: k.TYPE, data: "Unreachable" };
2305
+ return { type: k.TYPE, data: "StreamClosed" };
2306
+ if (j.matches(r))
2307
+ return { type: j.TYPE, data: "Unreachable" };
2285
2308
  throw new Error(`Unknown error type: ${r.type}: ${r.message}`);
2286
- }, Yr = (r) => {
2309
+ }, Xr = (r) => {
2287
2310
  if (!r.type.startsWith(ue)) return null;
2288
2311
  switch (r.type) {
2289
- case P.TYPE:
2290
- return new P();
2291
2312
  case Y.TYPE:
2292
2313
  return new Y();
2293
2314
  case k.TYPE:
2294
2315
  return new k();
2316
+ case j.TYPE:
2317
+ return new j();
2295
2318
  default:
2296
2319
  throw new Error(`Unknown error type: ${r.data}`);
2297
2320
  }
2298
2321
  };
2299
- Lr({
2300
- encode: Pr,
2301
- decode: Yr
2322
+ Jr({
2323
+ encode: Hr,
2324
+ decode: Xr
2302
2325
  });
2303
2326
  class ct {
2304
2327
  constructor() {
@@ -2334,7 +2357,7 @@ const lt = "Content-Type", Ge = (r) => {
2334
2357
  const t = require("https"), n = new t.Agent({ rejectUnauthorized: !1 });
2335
2358
  return async (s, a) => await e(s, { ...a, agent: n });
2336
2359
  };
2337
- class tn extends ct {
2360
+ class gn extends ct {
2338
2361
  constructor(t, n, s = !1) {
2339
2362
  super();
2340
2363
  y(this, "endpoint");
@@ -2367,25 +2390,25 @@ class tn extends ct {
2367
2390
  ...this.headers,
2368
2391
  ...m.params
2369
2392
  };
2370
- let A;
2393
+ let N;
2371
2394
  try {
2372
- A = await Ge(m.protocol)(m.target, d);
2395
+ N = await Ge(m.protocol)(m.target, d);
2373
2396
  } catch (R) {
2374
2397
  let M = R;
2375
- return M.message === "Load failed" && (M = new k({ url: f })), [l, M];
2398
+ return M.message === "Load failed" && (M = new j({ url: f })), [l, M];
2376
2399
  }
2377
- const B = await A.arrayBuffer();
2378
- if (A != null && A.ok)
2379
- return a != null && (c = this.encoder.decode(B, a)), [l, null];
2400
+ const $ = await N.arrayBuffer();
2401
+ if (N != null && N.ok)
2402
+ return a != null && (c = this.encoder.decode($, a)), [l, null];
2380
2403
  try {
2381
- if (A.status !== 400) return [l, new Error(A.statusText)];
2382
- const R = this.encoder.decode(B, ut), M = be(R);
2404
+ if (N.status !== 400) return [l, new Error(N.statusText)];
2405
+ const R = this.encoder.decode($, ut), M = be(R);
2383
2406
  return [l, M];
2384
2407
  } catch (R) {
2385
2408
  return [
2386
2409
  l,
2387
2410
  new Error(
2388
- `[freighter] - failed to decode error: ${A.statusText}: ${R.message}`
2411
+ `[freighter] - failed to decode error: ${N.statusText}: ${R.message}`
2389
2412
  )
2390
2413
  ];
2391
2414
  }
@@ -2394,7 +2417,7 @@ class tn extends ct {
2394
2417
  return [c, p];
2395
2418
  }
2396
2419
  }
2397
- const rn = (r, e) => {
2420
+ const pn = (r, e) => {
2398
2421
  class t {
2399
2422
  constructor(s) {
2400
2423
  y(this, "wrapped");
@@ -2404,25 +2427,25 @@ const rn = (r, e) => {
2404
2427
  this.wrapped.use(...s);
2405
2428
  }
2406
2429
  async send(s, a, c, f) {
2407
- const d = Ur.create(e);
2430
+ const d = Gr.create(e);
2408
2431
  do {
2409
2432
  const [p, m] = await this.wrapped.send(s, a, c, f);
2410
- if (m == null || !k.matches(m)) return [p, m];
2433
+ if (m == null || !j.matches(m)) return [p, m];
2411
2434
  if (!await d()) return [p, m];
2412
2435
  } while (!0);
2413
2436
  }
2414
2437
  }
2415
2438
  return new t(r);
2416
- }, nn = async (r, e, t, n, s) => {
2439
+ }, yn = async (r, e, t, n, s) => {
2417
2440
  const [a, c] = await r.send(e, t, n, s);
2418
2441
  if (c != null) throw c;
2419
2442
  return a;
2420
- }, kr = () => it.RUNTIME !== "node" ? (r) => new WebSocket(r) : (r) => new (require("ws")).WebSocket(r, { rejectUnauthorized: !1 }), jr = i.object({
2421
- type: i.union([i.literal("data"), i.literal("close"), i.literal("open")]),
2443
+ }, Kr = () => it.RUNTIME !== "node" ? (r) => new WebSocket(r) : (r) => new (require("ws")).WebSocket(r, { rejectUnauthorized: !1 }), Qr = i.object({
2444
+ type: i.enum(["data", "close", "open"]),
2422
2445
  payload: i.unknown().optional(),
2423
2446
  error: i.optional(ut)
2424
2447
  });
2425
- class qr {
2448
+ class _r {
2426
2449
  constructor(e, t, n, s) {
2427
2450
  y(this, "encoder");
2428
2451
  y(this, "reqSchema");
@@ -2444,8 +2467,8 @@ class qr {
2444
2467
  }
2445
2468
  /** Implements the Stream protocol */
2446
2469
  send(e) {
2447
- if (this.serverClosed != null) return new P();
2448
- if (this.sendClosed) throw new Y();
2470
+ if (this.serverClosed != null) return new Y();
2471
+ if (this.sendClosed) throw new k();
2449
2472
  return this.ws.send(this.encoder.encode({ type: "data", payload: e })), null;
2450
2473
  }
2451
2474
  /** Implements the Stream protocol */
@@ -2483,13 +2506,13 @@ class qr {
2483
2506
  t != null ? t.resolve(e) : this.receiveDataQueue.push(e);
2484
2507
  }
2485
2508
  listenForMessages() {
2486
- this.ws.onmessage = (e) => this.addMessage(this.encoder.decode(e.data, jr)), this.ws.onclose = (e) => this.addMessage({
2509
+ this.ws.onmessage = (e) => this.addMessage(this.encoder.decode(e.data, Qr)), this.ws.onclose = (e) => this.addMessage({
2487
2510
  type: "close",
2488
- error: { type: Vr(e) ? P.TYPE : Y.TYPE, data: "" }
2511
+ error: { type: sn(e) ? Y.TYPE : k.TYPE, data: "" }
2489
2512
  });
2490
2513
  }
2491
2514
  }
2492
- const Fr = "freighterctx", Gr = 1e3, Wr = 1001, zr = [Gr, Wr], Vr = (r) => zr.includes(r.code), ie = class ie extends ct {
2515
+ const en = "freighterctx", tn = 1e3, rn = 1001, nn = [tn, rn], sn = (r) => nn.includes(r.code), ie = class ie extends ct {
2493
2516
  /**
2494
2517
  * @param encoder - The encoder to use for encoding messages and decoding
2495
2518
  * responses.
@@ -2503,7 +2526,7 @@ const Fr = "freighterctx", Gr = 1e3, Wr = 1001, zr = [Gr, Wr], Vr = (r) => zr.in
2503
2526
  }
2504
2527
  /** Implements the StreamClient interface. */
2505
2528
  async stream(t, n, s) {
2506
- const a = kr();
2529
+ const a = Kr();
2507
2530
  let c;
2508
2531
  const [, f] = await this.executeMiddleware(
2509
2532
  { target: t, protocol: "websocket", params: {}, role: "client" },
@@ -2518,19 +2541,19 @@ const Fr = "freighterctx", Gr = 1e3, Wr = 1001, zr = [Gr, Wr], Vr = (r) => zr.in
2518
2541
  return c;
2519
2542
  }
2520
2543
  buildURL(t, n) {
2521
- const s = Nr(
2544
+ const s = Ir(
2522
2545
  {
2523
2546
  [lt]: this.encoder.contentType,
2524
2547
  ...n.params
2525
2548
  },
2526
- Fr
2549
+ en
2527
2550
  );
2528
2551
  return this.baseUrl.child(t).toString() + s;
2529
2552
  }
2530
2553
  async wrapSocket(t, n, s) {
2531
2554
  return await new Promise((a) => {
2532
2555
  t.onopen = () => {
2533
- const c = new qr(t, this.encoder, n, s);
2556
+ const c = new _r(t, this.encoder, n, s);
2534
2557
  c.receiveOpenAck().then((f) => {
2535
2558
  f != null ? a(f) : a(c);
2536
2559
  }).catch((f) => a(f));
@@ -2545,16 +2568,16 @@ y(ie, "MESSAGE_TYPE", "arraybuffer");
2545
2568
  let We = ie;
2546
2569
  export {
2547
2570
  oe as BaseTypedError,
2548
- P as EOF,
2549
- tn as HTTPClient,
2550
- Y as StreamClosed,
2551
- k as Unreachable,
2571
+ Y as EOF,
2572
+ gn as HTTPClient,
2573
+ k as StreamClosed,
2574
+ j as Unreachable,
2552
2575
  We as WebSocketClient,
2553
2576
  be as decodeError,
2554
- en as encodeError,
2577
+ dn as encodeError,
2555
2578
  ve as errorMatcher,
2556
2579
  ut as errorZ,
2557
- Lr as registerError,
2558
- nn as sendRequired,
2559
- rn as unaryWithBreaker
2580
+ Jr as registerError,
2581
+ yn as sendRequired,
2582
+ pn as unaryWithBreaker
2560
2583
  };