@synnaxlabs/x 0.29.0 → 0.31.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.
@@ -1,42 +1,43 @@
1
- var W = Object.defineProperty;
2
- var K = (f, t, e) => t in f ? W(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
1
+ var j = Object.defineProperty;
2
+ var K = (f, t, e) => t in f ? j(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e;
3
3
  var s = (f, t, e) => K(f, typeof t != "symbol" ? t + "" : t, e);
4
+ import { z as o } from "zod";
4
5
  import { J as L } from "./index-B5THJ1eb.js";
5
- import { s as j } from "./index-Duv1uH08.js";
6
- import { n as H } from "./index-DPWtMAJa.js";
7
- import { c as D } from "./bounds-CpboA0q6.js";
6
+ import { s as z } from "./index-Duv1uH08.js";
7
+ import { n as H } from "./index-B3BUDIdi.js";
8
+ import { c as $ } from "./bounds-CpboA0q6.js";
8
9
  import "./box-xRqO6NvI.js";
9
10
  import "./dimensions-D-1PnJVI.js";
10
11
  import "./base-DnZzEvvz.js";
11
12
  import "./location-DjcaXEps.js";
12
13
  import "./scale-qw6vRO4s.js";
13
14
  import "./xy-CrgPnICw.js";
14
- import { z as c } from "zod";
15
- let X = (f, t = 21) => (e = t) => {
15
+ import { b as X } from "./zodutil-qNM8aVYC.js";
16
+ let Q = (f, t = 21) => (e = t) => {
16
17
  let r = "", u = e;
17
18
  for (; u--; )
18
19
  r += f[Math.random() * f.length | 0];
19
20
  return r;
20
21
  };
21
- const z = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Z = X(z, 11), mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
22
+ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k = Q(_, 11), Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
22
23
  __proto__: null,
23
- id: Z
24
- }, Symbol.toStringTag, { value: "Module" })), k = (f, t) => {
24
+ id: k
25
+ }, Symbol.toStringTag, { value: "Module" })), tt = o.enum(["static", "dynamic"]), J = (f, t) => {
25
26
  const e = new m(t);
26
27
  if (![
27
- w.DAY,
28
- w.HOUR,
29
- w.MINUTE,
30
- w.SECOND,
31
- w.MILLISECOND,
32
- w.MICROSECOND,
33
- w.NANOSECOND
28
+ y.DAY,
29
+ y.HOUR,
30
+ y.MINUTE,
31
+ y.SECOND,
32
+ y.MILLISECOND,
33
+ y.MICROSECOND,
34
+ y.NANOSECOND
34
35
  ].some((u) => u.equals(e)))
35
36
  throw new Error(
36
37
  "Invalid argument for remainder. Must be an even TimeSpan or Timestamp"
37
38
  );
38
39
  const r = f.valueOf() % e.valueOf();
39
- return f instanceof m ? new m(r) : new w(r);
40
+ return f instanceof m ? new m(r) : new y(r);
40
41
  }, i = class i {
41
42
  constructor(t, e = "UTC") {
42
43
  s(this, "value");
@@ -63,9 +64,9 @@ const z = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Z =
63
64
  return this.value;
64
65
  }
65
66
  static parseTimeString(t, e = "UTC") {
66
- const [r, u, h] = t.split(":");
67
+ const [r, u, d] = t.split(":");
67
68
  let g = "00", S = "00";
68
- h != null && ([g, S] = h.split("."));
69
+ d != null && ([g, S] = d.split("."));
69
70
  let O = i.hours(parseInt(r ?? "00", 10)).add(i.minutes(parseInt(u ?? "00", 10))).add(i.seconds(parseInt(g ?? "00", 10))).add(i.milliseconds(parseInt(S ?? "00", 10)));
70
71
  return e === "local" && (O = O.add(i.utcOffset)), O.valueOf();
71
72
  }
@@ -110,7 +111,7 @@ const z = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Z =
110
111
  return `${e} ${r}`;
111
112
  }
112
113
  static get utcOffset() {
113
- return new w(
114
+ return new y(
114
115
  BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * i.MINUTE.valueOf()
115
116
  );
116
117
  }
@@ -153,7 +154,7 @@ const z = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Z =
153
154
  * valid, regardless of the TimeStamp order.
154
155
  */
155
156
  range(t) {
156
- return new U(this, t).makeValid();
157
+ return new B(this, t).makeValid();
157
158
  }
158
159
  /**
159
160
  * Creates a TimeRange starting at the TimeStamp and spanning the given
@@ -255,11 +256,11 @@ const z = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Z =
255
256
  * @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
256
257
  */
257
258
  remainder(t) {
258
- return k(this, t);
259
+ return J(this, t);
259
260
  }
260
261
  /** @returns true if the day portion TimeStamp is today, false otherwise. */
261
262
  get isToday() {
262
- return this.truncate(w.DAY).equals(i.now().truncate(w.DAY));
263
+ return this.truncate(y.DAY).equals(i.now().truncate(y.DAY));
263
264
  }
264
265
  truncate(t) {
265
266
  return this.sub(this.remainder(t));
@@ -328,12 +329,12 @@ s(i, "DAY", i.days(1)), /** The maximum possible value for a timestamp */
328
329
  s(i, "MAX", new i((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
329
330
  s(i, "MIN", new i(0)), /** The unix epoch */
330
331
  s(i, "ZERO", new i(0)), /** A zod schema for validating timestamps */
331
- s(i, "z", c.union([
332
- c.object({ value: c.bigint() }).transform((t) => new i(t.value)),
333
- c.string().transform((t) => new i(BigInt(t))),
334
- c.instanceof(Number).transform((t) => new i(t)),
335
- c.number().transform((t) => new i(t)),
336
- c.instanceof(i)
332
+ s(i, "z", o.union([
333
+ o.object({ value: o.bigint() }).transform((t) => new i(t.value)),
334
+ o.string().transform((t) => new i(BigInt(t))),
335
+ o.instanceof(Number).transform((t) => new i(t)),
336
+ o.number().transform((t) => new i(t)),
337
+ o.instanceof(i)
337
338
  ]));
338
339
  let m = i;
339
340
  const a = class a {
@@ -361,7 +362,7 @@ const a = class a {
361
362
  return this.valueOf() >= new a(t).valueOf();
362
363
  }
363
364
  remainder(t) {
364
- return k(this, t);
365
+ return J(this, t);
365
366
  }
366
367
  truncate(t) {
367
368
  return new a(
@@ -369,9 +370,9 @@ const a = class a {
369
370
  );
370
371
  }
371
372
  toString() {
372
- const t = this.truncate(a.DAY), e = this.truncate(a.HOUR), r = this.truncate(a.MINUTE), u = this.truncate(a.SECOND), h = this.truncate(a.MILLISECOND), g = this.truncate(a.MICROSECOND), S = this.truncate(a.NANOSECOND), O = t, T = e.sub(t), p = r.sub(e), o = u.sub(r), M = h.sub(u), B = g.sub(h), x = S.sub(g);
373
+ const t = this.truncate(a.DAY), e = this.truncate(a.HOUR), r = this.truncate(a.MINUTE), u = this.truncate(a.SECOND), d = this.truncate(a.MILLISECOND), g = this.truncate(a.MICROSECOND), S = this.truncate(a.NANOSECOND), O = t, N = e.sub(t), p = r.sub(e), c = u.sub(r), M = d.sub(u), U = g.sub(d), D = S.sub(g);
373
374
  let A = "";
374
- return O.isZero || (A += `${O.days}d `), T.isZero || (A += `${T.hours}h `), p.isZero || (A += `${p.minutes}m `), o.isZero || (A += `${o.seconds}s `), M.isZero || (A += `${M.milliseconds}ms `), B.isZero || (A += `${B.microseconds}µs `), x.isZero || (A += `${x.nanoseconds}ns`), A.trim();
375
+ return O.isZero || (A += `${O.days}d `), N.isZero || (A += `${N.hours}h `), p.isZero || (A += `${p.minutes}m `), c.isZero || (A += `${c.seconds}s `), M.isZero || (A += `${M.milliseconds}ms `), U.isZero || (A += `${U.microseconds}µs `), D.isZero || (A += `${D.nanoseconds}ns`), A.trim();
375
376
  }
376
377
  /** @returns the decimal number of days in the timespan */
377
378
  get days() {
@@ -506,14 +507,14 @@ s(a, "DAY", a.days(1)), /** The maximum possible value for a TimeSpan. */
506
507
  s(a, "MAX", new a((1n << 63n) - 1n)), /** The minimum possible value for a TimeSpan. */
507
508
  s(a, "MIN", new a(0)), /** The zero value for a TimeSpan. */
508
509
  s(a, "ZERO", new a(0)), /** A zod schema for validating and transforming timespans */
509
- s(a, "z", c.union([
510
- c.object({ value: c.bigint() }).transform((t) => new a(t.value)),
511
- c.string().transform((t) => new a(BigInt(t))),
512
- c.instanceof(Number).transform((t) => new a(t)),
513
- c.number().transform((t) => new a(t)),
514
- c.instanceof(a)
510
+ s(a, "z", o.union([
511
+ o.object({ value: o.bigint() }).transform((t) => new a(t.value)),
512
+ o.string().transform((t) => new a(BigInt(t))),
513
+ o.instanceof(Number).transform((t) => new a(t)),
514
+ o.number().transform((t) => new a(t)),
515
+ o.instanceof(a)
515
516
  ]));
516
- let w = a;
517
+ let y = a;
517
518
  const v = class v extends Number {
518
519
  constructor(t) {
519
520
  t instanceof Number ? super(t.valueOf()) : super(t);
@@ -532,7 +533,7 @@ const v = class v extends Number {
532
533
  * @returns A TimeSpan representing the period of the Rate.
533
534
  */
534
535
  get period() {
535
- return w.seconds(1 / this.valueOf());
536
+ return y.seconds(1 / this.valueOf());
536
537
  }
537
538
  /**
538
539
  * Calculates the number of samples in the given TimeSpan at this rate.
@@ -541,7 +542,7 @@ const v = class v extends Number {
541
542
  * @returns The number of samples in the given TimeSpan at this rate.
542
543
  */
543
544
  sampleCount(t) {
544
- return new w(t).seconds * this.valueOf();
545
+ return new y(t).seconds * this.valueOf();
545
546
  }
546
547
  /**
547
548
  * Calculates the number of bytes in the given TimeSpan at this rate.
@@ -551,7 +552,7 @@ const v = class v extends Number {
551
552
  * @returns The number of bytes in the given TimeSpan at this rate.
552
553
  */
553
554
  byteCount(t, e) {
554
- return this.sampleCount(t) * new I(e).valueOf();
555
+ return this.sampleCount(t) * new b(e).valueOf();
555
556
  }
556
557
  /**
557
558
  * Calculates a TimeSpan given the number of samples at this rate.
@@ -560,7 +561,7 @@ const v = class v extends Number {
560
561
  * @returns A TimeSpan that corresponds to the given number of samples.
561
562
  */
562
563
  span(t) {
563
- return w.seconds(t / this.valueOf());
564
+ return y.seconds(t / this.valueOf());
564
565
  }
565
566
  /**
566
567
  * Calculates a TimeSpan given the number of bytes at this rate.
@@ -592,13 +593,13 @@ const v = class v extends Number {
592
593
  }
593
594
  };
594
595
  /** A zod schema for validating and transforming rates */
595
- s(v, "z", c.union([
596
- c.number().transform((t) => new v(t)),
597
- c.instanceof(Number).transform((t) => new v(t)),
598
- c.instanceof(v)
596
+ s(v, "z", o.union([
597
+ o.number().transform((t) => new v(t)),
598
+ o.instanceof(Number).transform((t) => new v(t)),
599
+ o.instanceof(v)
599
600
  ]));
600
- let $ = v;
601
- const y = class y extends Number {
601
+ let q = v;
602
+ const w = class w extends Number {
602
603
  /**
603
604
  * Creates a Density representing the given number of bytes per value.
604
605
  *
@@ -617,19 +618,19 @@ const y = class y extends Number {
617
618
  }
618
619
  };
619
620
  /** Unknown/Invalid Density. */
620
- s(y, "UNKNOWN", new y(0)), /** 128 bits per value. */
621
- s(y, "BIT128", new y(16)), /** 64 bits per value. */
622
- s(y, "BIT64", new y(8)), /** 32 bits per value. */
623
- s(y, "BIT32", new y(4)), /** 16 bits per value. */
624
- s(y, "BIT16", new y(2)), /** 8 bits per value. */
625
- s(y, "BIT8", new y(1)), /** A zod schema for validating and transforming densities */
626
- s(y, "z", c.union([
627
- c.number().transform((t) => new y(t)),
628
- c.instanceof(Number).transform((t) => new y(t)),
629
- c.instanceof(y)
621
+ s(w, "UNKNOWN", new w(0)), /** 128 bits per value. */
622
+ s(w, "BIT128", new w(16)), /** 64 bits per value. */
623
+ s(w, "BIT64", new w(8)), /** 32 bits per value. */
624
+ s(w, "BIT32", new w(4)), /** 16 bits per value. */
625
+ s(w, "BIT16", new w(2)), /** 8 bits per value. */
626
+ s(w, "BIT8", new w(1)), /** A zod schema for validating and transforming densities */
627
+ s(w, "z", o.union([
628
+ o.number().transform((t) => new w(t)),
629
+ o.instanceof(Number).transform((t) => new w(t)),
630
+ o.instanceof(w)
630
631
  ]));
631
- let I = y;
632
- const b = class b {
632
+ let b = w;
633
+ const I = class I {
633
634
  /**
634
635
  * Creates a TimeRange from the given start and end TimeStamps.
635
636
  *
@@ -659,7 +660,7 @@ const b = class b {
659
660
  }
660
661
  /** @returns The TimeSpan occupied by the TimeRange. */
661
662
  get span() {
662
- return new w(this.end.valueOf() - this.start.valueOf());
663
+ return new y(this.end.valueOf() - this.start.valueOf());
663
664
  }
664
665
  /**
665
666
  * Checks if the timestamp is valid i.e. the start is before the end.
@@ -697,7 +698,7 @@ const b = class b {
697
698
  * @returns A TimeRange with the start and end swapped.
698
699
  */
699
700
  swap() {
700
- return new b(this.end, this.start);
701
+ return new I(this.end, this.start);
701
702
  }
702
703
  /**
703
704
  * Checks if the TimeRange is equal to the given TimeRange.
@@ -722,35 +723,35 @@ const b = class b {
722
723
  * @param other - The other TimeRange to compare to.
723
724
  * @returns True if the two TimeRanges overlap, false otherwise.
724
725
  */
725
- overlapsWith(t, e = w.ZERO) {
726
+ overlapsWith(t, e = y.ZERO) {
726
727
  t = t.makeValid();
727
728
  const r = this.makeValid();
728
729
  if (this.equals(t)) return !0;
729
730
  if (t.end.equals(r.start) || r.end.equals(t.start)) return !1;
730
- const u = m.max(r.start, t.start), h = m.min(r.end, t.end);
731
- return h.before(u) ? !1 : new w(h.sub(u)).greaterThanOrEqual(e);
731
+ const u = m.max(r.start, t.start), d = m.min(r.end, t.end);
732
+ return d.before(u) ? !1 : new y(d.sub(u)).greaterThanOrEqual(e);
732
733
  }
733
734
  roughlyEquals(t, e) {
734
735
  let r = this.start.sub(t.start).valueOf(), u = this.end.sub(t.end).valueOf();
735
736
  return r < 0 && (r = -r), u < 0 && (u = -u), r <= e.valueOf() && u <= e.valueOf();
736
737
  }
737
738
  contains(t) {
738
- return t instanceof b ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
739
+ return t instanceof I ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
739
740
  }
740
741
  boundBy(t) {
741
- const e = new b(this.start, this.end);
742
+ const e = new I(this.start, this.end);
742
743
  return t.start.after(this.start) && (e.start = t.start), t.start.after(this.end) && (e.end = t.start), t.end.before(this.end) && (e.end = t.end), t.end.before(this.start) && (e.start = t.end), e;
743
744
  }
744
745
  };
745
746
  /** The maximum possible time range. */
746
- s(b, "MAX", new b(m.MIN, m.MAX)), /** The minimum possible time range. */
747
- s(b, "MIN", new b(m.MAX, m.MIN)), /** A zero time range. */
748
- s(b, "ZERO", new b(m.ZERO, m.ZERO)), /** A zod schema for validating and transforming time ranges */
749
- s(b, "z", c.union([
750
- c.object({ start: m.z, end: m.z }).transform((t) => new b(t.start, t.end)),
751
- c.instanceof(b)
747
+ s(I, "MAX", new I(m.MIN, m.MAX)), /** The minimum possible time range. */
748
+ s(I, "MIN", new I(m.MAX, m.MIN)), /** A zero time range. */
749
+ s(I, "ZERO", new I(m.ZERO, m.ZERO)), /** A zod schema for validating and transforming time ranges */
750
+ s(I, "z", o.union([
751
+ o.object({ start: m.z, end: m.z }).transform((t) => new I(t.start, t.end)),
752
+ o.instanceof(I)
752
753
  ]));
753
- let U = b;
754
+ let B = I;
754
755
  const n = class n extends String {
755
756
  constructor(t) {
756
757
  if (t instanceof n || typeof t == "string" || typeof t.valueOf() == "string") {
@@ -876,20 +877,20 @@ s(n, "JSON", new n("json")), s(n, "ARRAY_CONSTRUCTORS", /* @__PURE__ */ new Map(
876
877
  [Int32Array.name, n.INT32],
877
878
  [BigInt64Array.name, n.INT64]
878
879
  ])), s(n, "DENSITIES", /* @__PURE__ */ new Map([
879
- [n.UINT8.toString(), I.BIT8],
880
- [n.UINT16.toString(), I.BIT16],
881
- [n.UINT32.toString(), I.BIT32],
882
- [n.UINT64.toString(), I.BIT64],
883
- [n.FLOAT32.toString(), I.BIT32],
884
- [n.FLOAT64.toString(), I.BIT64],
885
- [n.INT8.toString(), I.BIT8],
886
- [n.INT16.toString(), I.BIT16],
887
- [n.INT32.toString(), I.BIT32],
888
- [n.INT64.toString(), I.BIT64],
889
- [n.TIMESTAMP.toString(), I.BIT64],
890
- [n.STRING.toString(), I.UNKNOWN],
891
- [n.JSON.toString(), I.UNKNOWN],
892
- [n.UUID.toString(), I.BIT128]
880
+ [n.UINT8.toString(), b.BIT8],
881
+ [n.UINT16.toString(), b.BIT16],
882
+ [n.UINT32.toString(), b.BIT32],
883
+ [n.UINT64.toString(), b.BIT64],
884
+ [n.FLOAT32.toString(), b.BIT32],
885
+ [n.FLOAT64.toString(), b.BIT64],
886
+ [n.INT8.toString(), b.BIT8],
887
+ [n.INT16.toString(), b.BIT16],
888
+ [n.INT32.toString(), b.BIT32],
889
+ [n.INT64.toString(), b.BIT64],
890
+ [n.TIMESTAMP.toString(), b.BIT64],
891
+ [n.STRING.toString(), b.UNKNOWN],
892
+ [n.JSON.toString(), b.UNKNOWN],
893
+ [n.UUID.toString(), b.BIT128]
893
894
  ])), /** All the data types. */
894
895
  s(n, "ALL", [
895
896
  n.UNKNOWN,
@@ -908,11 +909,11 @@ s(n, "ALL", [
908
909
  n.STRING,
909
910
  n.JSON
910
911
  ]), s(n, "BIG_INT_TYPES", [n.INT64, n.UINT64, n.TIMESTAMP]), /** A zod schema for a DataType. */
911
- s(n, "z", c.union([
912
- c.string().transform((t) => new n(t)),
913
- c.instanceof(n)
912
+ s(n, "z", o.union([
913
+ o.string().transform((t) => new n(t)),
914
+ o.instanceof(n)
914
915
  ]));
915
- let d = n;
916
+ let h = n;
916
917
  const l = class l extends Number {
917
918
  constructor(t) {
918
919
  super(t.valueOf());
@@ -950,9 +951,9 @@ const l = class l extends Number {
950
951
  return this.valueOf() / l.TERABYTE.valueOf();
951
952
  }
952
953
  toString() {
953
- const t = this.truncate(l.TERABYTE), e = this.truncate(l.GIGABYTE), r = this.truncate(l.MEGABYTE), u = this.truncate(l.KILOBYTE), h = this.truncate(l.BYTE), g = t, S = e.sub(t), O = r.sub(e), T = u.sub(r), p = h.sub(u);
954
- let o = "";
955
- return g.isZero || (o += `${g.terabytes}TB `), S.isZero || (o += `${S.gigabytes}GB `), O.isZero || (o += `${O.megabytes}MB `), T.isZero || (o += `${T.kilobytes}KB `), (!p.isZero || o === "") && (o += `${p.valueOf()}B`), o.trim();
954
+ const t = this.truncate(l.TERABYTE), e = this.truncate(l.GIGABYTE), r = this.truncate(l.MEGABYTE), u = this.truncate(l.KILOBYTE), d = this.truncate(l.BYTE), g = t, S = e.sub(t), O = r.sub(e), N = u.sub(r), p = d.sub(u);
955
+ let c = "";
956
+ return g.isZero || (c += `${g.terabytes}TB `), S.isZero || (c += `${S.gigabytes}GB `), O.isZero || (c += `${O.megabytes}MB `), N.isZero || (c += `${N.kilobytes}KB `), (!p.isZero || c === "") && (c += `${p.valueOf()}B`), c.trim();
956
957
  }
957
958
  /**
958
959
  * Creates a Size from the given number of bytes.
@@ -1010,27 +1011,30 @@ s(l, "MEGABYTE", l.megabytes(1)), /** A gigabyte */
1010
1011
  s(l, "GIGABYTE", l.gigabytes(1)), /** A terabyte. */
1011
1012
  s(l, "TERABYTE", l.terabytes(1)), /** The zero value for Size */
1012
1013
  s(l, "ZERO", new l(0)), /** A zod schema for a Size. */
1013
- s(l, "z", c.union([
1014
- c.number().transform((t) => new l(t)),
1015
- c.instanceof(l)
1014
+ s(l, "z", o.union([
1015
+ o.number().transform((t) => new l(t)),
1016
+ o.instanceof(l)
1016
1017
  ]));
1017
1018
  let C = l;
1018
- const wt = c.union([
1019
- c.instanceof(Uint8Array),
1020
- c.instanceof(Uint16Array),
1021
- c.instanceof(Uint32Array),
1022
- c.instanceof(BigUint64Array),
1023
- c.instanceof(Float32Array),
1024
- c.instanceof(Float64Array),
1025
- c.instanceof(Int8Array),
1026
- c.instanceof(Int16Array),
1027
- c.instanceof(Int32Array),
1028
- c.instanceof(BigInt64Array)
1029
- ]), J = (f) => {
1019
+ const St = o.union([
1020
+ o.instanceof(Uint8Array),
1021
+ o.instanceof(Uint16Array),
1022
+ o.instanceof(Uint32Array),
1023
+ o.instanceof(BigUint64Array),
1024
+ o.instanceof(Float32Array),
1025
+ o.instanceof(Float64Array),
1026
+ o.instanceof(Int8Array),
1027
+ o.instanceof(Int16Array),
1028
+ o.instanceof(Int32Array),
1029
+ o.instanceof(BigInt64Array)
1030
+ ]), W = (f) => {
1030
1031
  const t = typeof f;
1031
- return t === "string" || t === "number" || t === "boolean" || t === "bigint" || f instanceof m || f instanceof w || f instanceof Date;
1032
- }, Q = (f, t, e, r = 0) => f.usesBigInt && !t.usesBigInt ? Number(e) - Number(r) : !f.usesBigInt && t.usesBigInt ? BigInt(e) - BigInt(r) : R(e, -r), _ = (f) => f == null ? !1 : Array.isArray(f) || f instanceof ArrayBuffer || ArrayBuffer.isView(f) && !(f instanceof DataView) || f instanceof N ? !0 : J(f), E = -1;
1033
- class N {
1032
+ return t === "string" || t === "number" || t === "boolean" || t === "bigint" || f instanceof m || f instanceof y || f instanceof Date;
1033
+ }, et = (f, t, e, r = 0) => f.usesBigInt && !t.usesBigInt ? Number(e) - Number(r) : !f.usesBigInt && t.usesBigInt ? BigInt(e) - BigInt(r) : R(e, -r), rt = (f) => f == null ? !1 : Array.isArray(f) || f instanceof ArrayBuffer || ArrayBuffer.isView(f) && !(f instanceof DataView) || f instanceof x ? !0 : W(f), E = -1, nt = o.string().transform(
1034
+ (f) => new Uint8Array(
1035
+ atob(f).split("").map((t) => t.charCodeAt(0))
1036
+ ).buffer
1037
+ ), st = o.union([o.null(), o.undefined()]).transform(() => new Uint8Array().buffer), T = class T {
1034
1038
  constructor(t) {
1035
1039
  s(this, "key", "");
1036
1040
  s(this, "isSynnaxSeries", !0);
@@ -1059,83 +1063,83 @@ class N {
1059
1063
  /** Tracks the number of entities currently using this array. */
1060
1064
  s(this, "_refCount", 0);
1061
1065
  s(this, "_cachedLength");
1062
- _(t) && (t = { data: t });
1066
+ rt(t) && (t = { data: t });
1063
1067
  const {
1064
1068
  dataType: e,
1065
1069
  timeRange: r,
1066
1070
  sampleOffset: u = 0,
1067
- glBufferUsage: h = "static",
1071
+ glBufferUsage: d = "static",
1068
1072
  alignment: g = 0n,
1069
- key: S = Z()
1070
- } = t, { data: O } = t;
1071
- if (O instanceof N || typeof O == "object" && "isSynnaxSeries" in O && O.isSynnaxSeries === !0) {
1072
- const o = O;
1073
- this.key = o.key, this.dataType = o.dataType, this.sampleOffset = o.sampleOffset, this.gl = o.gl, this._data = o._data, this._timeRange = o._timeRange, this.alignment = o.alignment, this._cachedMin = o._cachedMin, this._cachedMax = o._cachedMax, this.writePos = o.writePos, this._refCount = o._refCount, this._cachedLength = o._cachedLength;
1073
+ key: S = k()
1074
+ } = t, O = t.data ?? [];
1075
+ if (O instanceof T || typeof O == "object" && "isSynnaxSeries" in O && O.isSynnaxSeries === !0) {
1076
+ const c = O;
1077
+ this.key = c.key, this.dataType = c.dataType, this.sampleOffset = c.sampleOffset, this.gl = c.gl, this._data = c._data, this._timeRange = c._timeRange, this.alignment = c.alignment, this._cachedMin = c._cachedMin, this._cachedMax = c._cachedMax, this.writePos = c.writePos, this._refCount = c._refCount, this._cachedLength = c._cachedLength;
1074
1078
  return;
1075
1079
  }
1076
- const T = J(O), p = Array.isArray(O);
1077
- if (e != null) this.dataType = new d(e);
1080
+ const N = W(O), p = Array.isArray(O);
1081
+ if (e != null) this.dataType = new h(e);
1078
1082
  else {
1079
1083
  if (O instanceof ArrayBuffer)
1080
1084
  throw new Error(
1081
1085
  "cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
1082
1086
  );
1083
- if (p || T) {
1084
- let o = O;
1085
- if (!T) {
1087
+ if (p || N) {
1088
+ let c = O;
1089
+ if (!N) {
1086
1090
  if (O.length === 0)
1087
1091
  throw new Error(
1088
1092
  "cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
1089
1093
  );
1090
- o = O[0];
1094
+ c = O[0];
1091
1095
  }
1092
- if (typeof o == "string") this.dataType = d.STRING;
1093
- else if (typeof o == "number") this.dataType = d.FLOAT64;
1094
- else if (typeof o == "bigint") this.dataType = d.INT64;
1095
- else if (typeof o == "boolean") this.dataType = d.BOOLEAN;
1096
- else if (o instanceof m || o instanceof Date || o instanceof m)
1097
- this.dataType = d.TIMESTAMP;
1098
- else if (typeof o == "object") this.dataType = d.JSON;
1096
+ if (typeof c == "string") this.dataType = h.STRING;
1097
+ else if (typeof c == "number") this.dataType = h.FLOAT64;
1098
+ else if (typeof c == "bigint") this.dataType = h.INT64;
1099
+ else if (typeof c == "boolean") this.dataType = h.BOOLEAN;
1100
+ else if (c instanceof m || c instanceof Date || c instanceof m)
1101
+ this.dataType = h.TIMESTAMP;
1102
+ else if (typeof c == "object") this.dataType = h.JSON;
1099
1103
  else
1100
1104
  throw new Error(
1101
- `cannot infer data type of ${typeof o} when constructing a Series from a JS array`
1105
+ `cannot infer data type of ${typeof c} when constructing a Series from a JS array`
1102
1106
  );
1103
- } else this.dataType = new d(O);
1107
+ } else this.dataType = new h(O);
1104
1108
  }
1105
- if (!p && !T) this._data = O;
1109
+ if (!p && !N) this._data = O;
1106
1110
  else {
1107
- let o = T ? [O] : O;
1108
- const M = o[0];
1109
- (M instanceof m || M instanceof Date || M instanceof w) && (o = o.map((B) => new m(B).valueOf())), this.dataType.equals(d.STRING) ? (this._cachedLength = o.length, this._data = new TextEncoder().encode(o.join(`
1111
+ let c = N ? [O] : O;
1112
+ const M = c[0];
1113
+ (M instanceof m || M instanceof Date || M instanceof y) && (c = c.map((U) => new m(U).valueOf())), this.dataType.equals(h.STRING) ? (this._cachedLength = c.length, this._data = new TextEncoder().encode(c.join(`
1110
1114
  `) + `
1111
- `)) : this.dataType.equals(d.JSON) ? (this._cachedLength = o.length, this._data = new TextEncoder().encode(
1112
- o.map((B) => L.encodeString(B)).join(`
1115
+ `)) : this.dataType.equals(h.JSON) ? (this._cachedLength = c.length, this._data = new TextEncoder().encode(
1116
+ c.map((U) => L.encodeString(U)).join(`
1113
1117
  `) + `
1114
1118
  `
1115
- )) : this._data = new this.dataType.Array(o).buffer;
1119
+ )) : this._data = new this.dataType.Array(c).buffer;
1116
1120
  }
1117
1121
  this.key = S, this.alignment = g, this.sampleOffset = u ?? 0, this._timeRange = r, this.gl = {
1118
1122
  control: null,
1119
1123
  buffer: null,
1120
1124
  prevBuffer: 0,
1121
- bufferUsage: h
1125
+ bufferUsage: d
1122
1126
  };
1123
1127
  }
1124
1128
  static alloc({ capacity: t, dataType: e, ...r }) {
1125
1129
  if (t === 0)
1126
1130
  throw new Error("[Series] - cannot allocate an array of length 0");
1127
- const u = new new d(e).Array(t), h = new N({
1131
+ const u = new new h(e).Array(t), d = new T({
1128
1132
  data: u.buffer,
1129
1133
  dataType: e,
1130
1134
  ...r
1131
1135
  });
1132
- return h.writePos = 0, h;
1136
+ return d.writePos = 0, d;
1133
1137
  }
1134
1138
  static generateTimestamps(t, e, r) {
1135
- const u = r.spanRange(e.span(t)), h = new BigInt64Array(t);
1139
+ const u = r.spanRange(e.span(t)), d = new BigInt64Array(t);
1136
1140
  for (let g = 0; g < t; g++)
1137
- h[g] = BigInt(r.add(e.span(g)).valueOf());
1138
- return new N({ data: h, dataType: d.TIMESTAMP, timeRange: u });
1141
+ d[g] = BigInt(r.add(e.span(g)).valueOf());
1142
+ return new T({ data: d, dataType: h.TIMESTAMP, timeRange: u });
1139
1143
  }
1140
1144
  get refCount() {
1141
1145
  return this._refCount;
@@ -1144,7 +1148,7 @@ class N {
1144
1148
  const r = new TextEncoder().encode(t.join(`
1145
1149
  `) + `
1146
1150
  `);
1147
- return new N({ data: r, dataType: d.STRING, timeRange: e });
1151
+ return new T({ data: r, dataType: h.STRING, timeRange: e });
1148
1152
  }
1149
1153
  static fromJSON(t, e) {
1150
1154
  const r = new TextEncoder().encode(
@@ -1152,7 +1156,7 @@ class N {
1152
1156
  `) + `
1153
1157
  `
1154
1158
  );
1155
- return new N({ data: r, dataType: d.JSON, timeRange: e });
1159
+ return new T({ data: r, dataType: h.JSON, timeRange: e });
1156
1160
  }
1157
1161
  acquire(t) {
1158
1162
  this._refCount++, t != null && this.updateGLBuffer(t);
@@ -1193,23 +1197,23 @@ class N {
1193
1197
  return this.writePos === E ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
1194
1198
  }
1195
1199
  toStrings() {
1196
- if (!this.dataType.matches(d.STRING, d.UUID))
1200
+ if (!this.dataType.matches(h.STRING, h.UUID))
1197
1201
  throw new Error("cannot convert non-string series to strings");
1198
1202
  return new TextDecoder().decode(this.buffer).split(`
1199
1203
  `).slice(0, -1);
1200
1204
  }
1201
1205
  toUUIDs() {
1202
- if (!this.dataType.equals(d.UUID))
1206
+ if (!this.dataType.equals(h.UUID))
1203
1207
  throw new Error("cannot convert non-uuid series to uuids");
1204
- const t = d.UUID.density.valueOf(), e = Array(this.length);
1208
+ const t = h.UUID.density.valueOf(), e = Array(this.length);
1205
1209
  for (let r = 0; r < this.length; r++) {
1206
- const u = this.buffer.slice(r * t, (r + 1) * t), h = Array.from(new Uint8Array(u), (g) => g.toString(16).padStart(2, "0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
1207
- e[r] = h;
1210
+ const u = this.buffer.slice(r * t, (r + 1) * t), d = Array.from(new Uint8Array(u), (g) => g.toString(16).padStart(2, "0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
1211
+ e[r] = d;
1208
1212
  }
1209
1213
  return e;
1210
1214
  }
1211
1215
  parseJSON(t) {
1212
- if (!this.dataType.equals(d.JSON))
1216
+ if (!this.dataType.equals(h.JSON))
1213
1217
  throw new Error("cannot convert non-string series to strings");
1214
1218
  return new TextDecoder().decode(this.buffer).split(`
1215
1219
  `).slice(0, -1).map((e) => t.parse(L.decodeString(e)));
@@ -1256,8 +1260,8 @@ class N {
1256
1260
  if (this.dataType.equals(t)) return this;
1257
1261
  const r = new t.Array(this.length);
1258
1262
  for (let u = 0; u < this.length; u++)
1259
- r[u] = Q(this.dataType, t, this.data[u], e);
1260
- return new N({
1263
+ r[u] = et(this.dataType, t, this.data[u], e);
1264
+ return new T({
1261
1265
  data: r.buffer,
1262
1266
  dataType: t,
1263
1267
  timeRange: this._timeRange,
@@ -1268,7 +1272,7 @@ class N {
1268
1272
  }
1269
1273
  calcRawMax() {
1270
1274
  if (this.length === 0) return -1 / 0;
1271
- if (this.dataType.equals(d.TIMESTAMP))
1275
+ if (this.dataType.equals(h.TIMESTAMP))
1272
1276
  this._cachedMax = this.data[this.data.length - 1];
1273
1277
  else if (this.dataType.usesBigInt) {
1274
1278
  const t = this.data;
@@ -1287,7 +1291,7 @@ class N {
1287
1291
  }
1288
1292
  calcRawMin() {
1289
1293
  if (this.length === 0) return 1 / 0;
1290
- if (this.dataType.equals(d.TIMESTAMP))
1294
+ if (this.dataType.equals(h.TIMESTAMP))
1291
1295
  this._cachedMin = this.data[0];
1292
1296
  else if (this.dataType.usesBigInt) {
1293
1297
  const t = this.data;
@@ -1306,7 +1310,7 @@ class N {
1306
1310
  }
1307
1311
  /** @returns the bounds of this array. */
1308
1312
  get bounds() {
1309
- return D(Number(this.min), Number(this.max));
1313
+ return $(Number(this.min), Number(this.max));
1310
1314
  }
1311
1315
  maybeRecomputeMinMax(t) {
1312
1316
  if (this._cachedMin != null) {
@@ -1349,9 +1353,9 @@ class N {
1349
1353
  if (e) throw new Error(`[series] - no value at index ${t}`);
1350
1354
  return;
1351
1355
  }
1352
- const h = this.data.slice(r, u);
1353
- return this.dataType.equals(d.STRING) ? new TextDecoder().decode(h) : j(
1354
- JSON.parse(new TextDecoder().decode(h))
1356
+ const d = this.data.slice(r, u);
1357
+ return this.dataType.equals(h.STRING) ? new TextDecoder().decode(d) : z(
1358
+ JSON.parse(new TextDecoder().decode(d))
1355
1359
  );
1356
1360
  }
1357
1361
  /**
@@ -1363,21 +1367,21 @@ class N {
1363
1367
  let e = 0, r = this.length - 1;
1364
1368
  const u = H(t);
1365
1369
  for (; e <= r; ) {
1366
- const h = Math.floor((e + r) / 2), g = u(this.at(h, !0), t);
1367
- if (g === 0) return h;
1368
- g < 0 ? e = h + 1 : r = h - 1;
1370
+ const d = Math.floor((e + r) / 2), g = u(this.at(d, !0), t);
1371
+ if (g === 0) return d;
1372
+ g < 0 ? e = d + 1 : r = d - 1;
1369
1373
  }
1370
1374
  return e;
1371
1375
  }
1372
1376
  updateGLBuffer(t) {
1373
- if (this.gl.control = t, !this.dataType.equals(d.FLOAT32))
1377
+ if (this.gl.control = t, !this.dataType.equals(h.FLOAT32))
1374
1378
  throw new Error("Only FLOAT32 arrays can be used in WebGL");
1375
1379
  const { buffer: e, bufferUsage: r, prevBuffer: u } = this.gl;
1376
1380
  if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !== u)
1377
1381
  if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !== E) {
1378
1382
  u === 0 && t.bufferData(t.ARRAY_BUFFER, this.byteCapacity.valueOf(), t.STATIC_DRAW);
1379
- const h = this.dataType.density.size(u).valueOf(), g = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
1380
- t.bufferSubData(t.ARRAY_BUFFER, h, g.buffer), this.gl.prevBuffer = this.writePos;
1383
+ const d = this.dataType.density.size(u).valueOf(), g = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
1384
+ t.bufferSubData(t.ARRAY_BUFFER, d, g.buffer), this.gl.prevBuffer = this.writePos;
1381
1385
  } else
1382
1386
  t.bufferData(
1383
1387
  t.ARRAY_BUFFER,
@@ -1387,7 +1391,7 @@ class N {
1387
1391
  }
1388
1392
  as(t) {
1389
1393
  if (t === "string") {
1390
- if (!this.dataType.equals(d.STRING))
1394
+ if (!this.dataType.equals(h.STRING))
1391
1395
  throw new Error(
1392
1396
  `cannot convert series of type ${this.dataType.toString()} to string`
1393
1397
  );
@@ -1401,7 +1405,7 @@ class N {
1401
1405
  return this;
1402
1406
  }
1403
1407
  if (t === "bigint") {
1404
- if (!this.dataType.equals(d.INT64))
1408
+ if (!this.dataType.equals(h.INT64))
1405
1409
  throw new Error(
1406
1410
  `cannot convert series of type ${this.dataType.toString()} to bigint`
1407
1411
  );
@@ -1430,7 +1434,7 @@ class N {
1430
1434
  };
1431
1435
  }
1432
1436
  get alignmentBounds() {
1433
- return D(this.alignment, this.alignment + BigInt(this.length));
1437
+ return $(this.alignment, this.alignment + BigInt(this.length));
1434
1438
  }
1435
1439
  maybeGarbageCollectGLBuffer(t) {
1436
1440
  this.gl.buffer != null && (t.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
@@ -1441,15 +1445,15 @@ class N {
1441
1445
  }
1442
1446
  [Symbol.iterator]() {
1443
1447
  if (this.dataType.isVariable) {
1444
- const t = new tt(this);
1445
- return this.dataType.equals(d.JSON) ? new et(t) : t;
1448
+ const t = new it(this);
1449
+ return this.dataType.equals(h.JSON) ? new at(t) : t;
1446
1450
  }
1447
- return new rt(this);
1451
+ return new ut(this);
1448
1452
  }
1449
1453
  slice(t, e) {
1450
1454
  if (t <= 0 && (e == null || e >= this.length)) return this;
1451
1455
  const r = this.data.slice(t, e);
1452
- return new N({
1456
+ return new T({
1453
1457
  data: r,
1454
1458
  dataType: this.dataType,
1455
1459
  timeRange: this._timeRange,
@@ -1459,17 +1463,25 @@ class N {
1459
1463
  });
1460
1464
  }
1461
1465
  reAlign(t) {
1462
- return new N({
1466
+ return new T({
1463
1467
  data: this.buffer,
1464
1468
  dataType: this.dataType,
1465
- timeRange: U.ZERO,
1469
+ timeRange: B.ZERO,
1466
1470
  sampleOffset: this.sampleOffset,
1467
1471
  glBufferUsage: "static",
1468
1472
  alignment: t
1469
1473
  });
1470
1474
  }
1471
- }
1472
- class tt {
1475
+ };
1476
+ s(T, "crudeZ", o.object({
1477
+ timeRange: B.z.optional(),
1478
+ dataType: h.z,
1479
+ alignment: X.optional(),
1480
+ data: o.union([nt, st, o.instanceof(ArrayBuffer)]),
1481
+ glBufferUsage: tt.optional().default("static").optional()
1482
+ })), s(T, "z", T.crudeZ.transform((t) => new T(t)));
1483
+ let x = T;
1484
+ class it {
1473
1485
  constructor(t) {
1474
1486
  s(this, "series");
1475
1487
  s(this, "index");
@@ -1490,11 +1502,11 @@ class tt {
1490
1502
  return this;
1491
1503
  }
1492
1504
  }
1493
- var q, F;
1494
- class et {
1505
+ var F, P;
1506
+ class at {
1495
1507
  constructor(t) {
1496
1508
  s(this, "wrapped");
1497
- s(this, q, "JSONSeriesIterator");
1509
+ s(this, F, "JSONSeriesIterator");
1498
1510
  this.wrapped = t;
1499
1511
  }
1500
1512
  next() {
@@ -1504,16 +1516,16 @@ class et {
1504
1516
  value: L.decodeString(t.value)
1505
1517
  };
1506
1518
  }
1507
- [(F = Symbol.iterator, q = Symbol.toStringTag, F)]() {
1519
+ [(P = Symbol.iterator, F = Symbol.toStringTag, P)]() {
1508
1520
  return this;
1509
1521
  }
1510
1522
  }
1511
- var P, Y;
1512
- class rt {
1523
+ var Y, Z;
1524
+ class ut {
1513
1525
  constructor(t) {
1514
1526
  s(this, "series");
1515
1527
  s(this, "index");
1516
- s(this, P, "SeriesIterator");
1528
+ s(this, Y, "SeriesIterator");
1517
1529
  this.series = t, this.index = 0;
1518
1530
  }
1519
1531
  next() {
@@ -1522,12 +1534,12 @@ class rt {
1522
1534
  value: this.series.at(this.index++, !0)
1523
1535
  };
1524
1536
  }
1525
- [(Y = Symbol.iterator, P = Symbol.toStringTag, Y)]() {
1537
+ [(Z = Symbol.iterator, Y = Symbol.toStringTag, Z)]() {
1526
1538
  return this;
1527
1539
  }
1528
1540
  }
1529
1541
  const R = (f, t) => typeof f == "bigint" && typeof t == "bigint" || typeof f == "number" && typeof t == "number" ? f + t : t === 0 ? f : f === 0 ? t : Number(f) + Number(t);
1530
- class yt {
1542
+ class vt {
1531
1543
  constructor(t) {
1532
1544
  s(this, "series");
1533
1545
  if (t.length !== 0) {
@@ -1539,17 +1551,17 @@ class yt {
1539
1551
  this.series = t;
1540
1552
  }
1541
1553
  as(t) {
1542
- if (!new d(t).equals(this.dataType))
1554
+ if (!new h(t).equals(this.dataType))
1543
1555
  throw new Error(
1544
1556
  `cannot convert series of type ${this.dataType.toString()} to ${t.toString()}`
1545
1557
  );
1546
1558
  return this;
1547
1559
  }
1548
1560
  get dataType() {
1549
- return this.series.length === 0 ? d.UNKNOWN : this.series[0].dataType;
1561
+ return this.series.length === 0 ? h.UNKNOWN : this.series[0].dataType;
1550
1562
  }
1551
1563
  get timeRange() {
1552
- return this.series.length === 0 ? U.ZERO : new U(
1564
+ return this.series.length === 0 ? B.ZERO : new B(
1553
1565
  this.series[0].timeRange.start,
1554
1566
  this.series[this.series.length - 1].timeRange.end
1555
1567
  );
@@ -1583,11 +1595,11 @@ class yt {
1583
1595
  next() {
1584
1596
  return { done: !0, value: void 0 };
1585
1597
  }
1586
- } : new nt(this.series);
1598
+ } : new ot(this.series);
1587
1599
  }
1588
1600
  }
1589
1601
  var G, V;
1590
- class nt {
1602
+ class ot {
1591
1603
  constructor(t) {
1592
1604
  s(this, "series");
1593
1605
  s(this, "seriesIndex");
@@ -1604,19 +1616,19 @@ class nt {
1604
1616
  }
1605
1617
  }
1606
1618
  export {
1607
- I as D,
1608
- yt as M,
1609
- $ as R,
1610
- N as S,
1619
+ b as D,
1620
+ vt as M,
1621
+ q as R,
1622
+ x as S,
1611
1623
  m as T,
1612
1624
  R as a,
1613
- w as b,
1614
- U as c,
1615
- d,
1625
+ y as b,
1626
+ B as c,
1627
+ h as d,
1616
1628
  C as e,
1617
- J as f,
1618
- Q as g,
1619
- mt as h,
1620
- _ as i,
1621
- wt as t
1629
+ W as f,
1630
+ et as g,
1631
+ Nt as h,
1632
+ rt as i,
1633
+ St as t
1622
1634
  };