@synnaxlabs/x 0.44.2 → 0.44.3

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.
Files changed (63) hide show
  1. package/.turbo/turbo-build.log +15 -15
  2. package/dist/bounds-8OC_obRs.js +186 -0
  3. package/dist/bounds-CRK04jp7.cjs +1 -0
  4. package/dist/bounds.cjs +1 -1
  5. package/dist/bounds.js +1 -1
  6. package/dist/deep.cjs +1 -1
  7. package/dist/deep.js +1 -1
  8. package/dist/{external-Birv9jaY.js → external-BM_NS5yM.js} +6 -6
  9. package/dist/external-E3ErJeeM.cjs +1 -0
  10. package/dist/index.cjs +3 -3
  11. package/dist/index.js +235 -229
  12. package/dist/{path-DVFrKaNI.js → path-Blh4wJuA.js} +24 -21
  13. package/dist/path-CPSfCjde.cjs +1 -0
  14. package/dist/{scale-C6qKDbRb.cjs → scale-C3fEtXxW.cjs} +1 -1
  15. package/dist/{scale-EWNUk-bn.js → scale-Db1Gunj0.js} +1 -1
  16. package/dist/scale.cjs +1 -1
  17. package/dist/scale.js +1 -1
  18. package/dist/series-BcF7A8Je.cjs +6 -0
  19. package/dist/{series-EA1uaEDj.js → series-Cl3Vh_u-.js} +588 -471
  20. package/dist/spatial.cjs +1 -1
  21. package/dist/spatial.js +2 -2
  22. package/dist/src/breaker/breaker.d.ts +2 -1
  23. package/dist/src/breaker/breaker.d.ts.map +1 -1
  24. package/dist/src/deep/path.d.ts.map +1 -1
  25. package/dist/src/id/id.d.ts +3 -1
  26. package/dist/src/id/id.d.ts.map +1 -1
  27. package/dist/src/math/math.d.ts +2 -1
  28. package/dist/src/math/math.d.ts.map +1 -1
  29. package/dist/src/status/status.d.ts +1 -0
  30. package/dist/src/status/status.d.ts.map +1 -1
  31. package/dist/src/strings/strings.d.ts +1 -1
  32. package/dist/src/strings/strings.d.ts.map +1 -1
  33. package/dist/src/telem/series.d.ts +7 -0
  34. package/dist/src/telem/series.d.ts.map +1 -1
  35. package/dist/src/telem/telem.d.ts +78 -1
  36. package/dist/src/telem/telem.d.ts.map +1 -1
  37. package/dist/src/zod/util.d.ts.map +1 -1
  38. package/dist/telem.cjs +1 -1
  39. package/dist/telem.js +1 -1
  40. package/dist/zod.cjs +1 -1
  41. package/dist/zod.js +1 -1
  42. package/package.json +3 -3
  43. package/src/breaker/breaker.ts +4 -0
  44. package/src/deep/path.spec.ts +14 -0
  45. package/src/deep/path.ts +9 -2
  46. package/src/id/id.ts +8 -4
  47. package/src/math/math.spec.ts +20 -0
  48. package/src/math/math.ts +32 -29
  49. package/src/spatial/bounds/bounds.ts +1 -1
  50. package/src/status/status.ts +11 -0
  51. package/src/strings/strings.spec.ts +3 -0
  52. package/src/strings/strings.ts +2 -1
  53. package/src/telem/series.spec.ts +543 -2
  54. package/src/telem/series.ts +28 -9
  55. package/src/telem/telem.spec.ts +556 -0
  56. package/src/telem/telem.ts +118 -5
  57. package/src/zod/util.ts +5 -3
  58. package/tsconfig.tsbuildinfo +1 -1
  59. package/dist/bounds-D6e9xoHt.cjs +0 -1
  60. package/dist/bounds-Dj9nG39I.js +0 -174
  61. package/dist/external-DsmsSN1Y.cjs +0 -1
  62. package/dist/path-BeMr8xWN.cjs +0 -1
  63. package/dist/series-CcA_WjbJ.cjs +0 -6
@@ -1,64 +1,64 @@
1
1
  import { z as o } from "zod";
2
- import { J as L } from "./index-B5l_quQn.js";
3
- import { s as z } from "./index-D2xcvEO5.js";
4
- import { V as M, n as _ } from "./index-CBMHFqs4.js";
5
- import { m as B, c as C, a as Y, d as R, e as tt, t as et, f as st } from "./bounds-Dj9nG39I.js";
2
+ import { J as $ } from "./index-B5l_quQn.js";
3
+ import { s as nt } from "./index-D2xcvEO5.js";
4
+ import { V as C, n as rt } from "./index-CBMHFqs4.js";
5
+ import { a as p, s as L, m as N, d as S, c as x, e as k, f as R, g as it, t as at, h as ut } from "./bounds-8OC_obRs.js";
6
6
  import "./box-CO_2_DGG.js";
7
7
  import "./dimensions-CRgergMS.js";
8
8
  import "./base-DFq0vvGn.js";
9
9
  import "./location-Ar5y2DX2.js";
10
- import "./scale-EWNUk-bn.js";
10
+ import "./scale-Db1Gunj0.js";
11
11
  import "./xy-C_-hb3Q2.js";
12
- let rt = (i, t = 21) => (e = t) => {
12
+ let W = (a, t = 21) => (e = t) => {
13
13
  let s = "", u = e | 0;
14
14
  for (; u--; )
15
- s += i[Math.random() * i.length | 0];
15
+ s += a[Math.random() * a.length | 0];
16
16
  return s;
17
17
  };
18
- const nt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", G = 11, it = rt(nt, G), J = () => it(), $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18
+ const H = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", ot = `0123456789${H}`, K = 11, lt = W(H, 1), ft = W(ot, K - 1), X = () => `${lt()}${ft()}`, kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19
19
  __proto__: null,
20
- LENGTH: G,
21
- create: J
22
- }, Symbol.toStringTag, { value: "Module" })), j = (i, t) => (e) => e instanceof t || typeof e == "object" && e !== null && "discriminator" in e && e.discriminator === i, Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
20
+ LENGTH: K,
21
+ create: X
22
+ }, Symbol.toStringTag, { value: "Module" })), D = (a, t) => (e) => e instanceof t || typeof e == "object" && e !== null && "discriminator" in e && e.discriminator === a, Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
23
23
  __proto__: null,
24
- createMatcher: j
25
- }, Symbol.toStringTag, { value: "Module" })), at = o.enum(["static", "dynamic"]), ut = o.union([
24
+ createMatcher: D
25
+ }, Symbol.toStringTag, { value: "Module" })), ht = o.enum(["static", "dynamic"]), ct = o.union([
26
26
  o.tuple([o.int()]),
27
27
  o.tuple([o.int(), o.int().min(1).max(12)]),
28
28
  o.tuple([o.int(), o.int().min(1).max(12), o.int().min(1).max(31)])
29
- ]), W = (i, t) => {
30
- const e = new n(t);
29
+ ]), Q = (a, t) => {
30
+ const e = new r(t);
31
31
  if (![
32
- a.DAY,
33
- a.HOUR,
34
- a.MINUTE,
35
- a.SECOND,
36
- a.MILLISECOND,
37
- a.MICROSECOND,
38
- a.NANOSECOND
32
+ i.DAY,
33
+ i.HOUR,
34
+ i.MINUTE,
35
+ i.SECOND,
36
+ i.MILLISECOND,
37
+ i.MICROSECOND,
38
+ i.NANOSECOND
39
39
  ].some((u) => u.equals(e)))
40
40
  throw new Error(
41
41
  "Invalid argument for remainder. Must be an even TimeSpan or Timestamp"
42
42
  );
43
- const s = i.valueOf() % e.valueOf();
44
- return i instanceof n ? new n(s) : new a(s);
43
+ const s = a.valueOf() % e.valueOf();
44
+ return a instanceof r ? new r(s) : new i(s);
45
45
  };
46
- class n extends M {
46
+ class r extends C {
47
47
  constructor(t, e = "UTC") {
48
- if (t == null) super(n.now().valueOf());
48
+ if (t == null) super(r.now().valueOf());
49
49
  else if (t instanceof Date)
50
- super(BigInt(t.getTime()) * n.MILLISECOND.valueOf());
50
+ super(BigInt(t.getTime()) * r.MILLISECOND.valueOf());
51
51
  else if (typeof t == "string")
52
- super(n.parseDateTimeString(t, e).valueOf());
53
- else if (Array.isArray(t)) super(n.parseDate(t));
52
+ super(r.parseDateTimeString(t, e).valueOf());
53
+ else if (Array.isArray(t)) super(r.parseDate(t));
54
54
  else {
55
55
  let s = 0n;
56
- t instanceof Number && (t = t.valueOf()), e === "local" && (s = n.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = Math.trunc(t) : (isNaN(t) && (t = 0), t === 1 / 0 ? t = n.MAX : t = n.MIN)), super(BigInt(t.valueOf()) + s);
56
+ t instanceof Number && (t = t.valueOf()), e === "local" && (s = r.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = Math.trunc(t) : (isNaN(t) && (t = 0), t === 1 / 0 ? t = r.MAX : t = r.MIN)), super(BigInt(t.valueOf()) + s);
57
57
  }
58
58
  }
59
59
  static parseDate([t = 1970, e = 1, s = 1]) {
60
60
  const u = new Date(t, e - 1, s, 0, 0, 0, 0);
61
- return new n(BigInt(u.getTime()) * n.MILLISECOND.valueOf()).truncate(n.DAY).valueOf();
61
+ return new r(BigInt(u.getTime()) * r.MILLISECOND.valueOf()).truncate(r.DAY).valueOf();
62
62
  }
63
63
  /**
64
64
  * @returns the primitive value of the TimeStamp. Overrides standard JS valueOf()
@@ -68,18 +68,18 @@ class n extends M {
68
68
  return this.value;
69
69
  }
70
70
  static parseTimeString(t, e = "UTC") {
71
- const [s, u, f] = t.split(":");
72
- let c = "00", y = "00";
73
- f != null && ([c, y] = f.split("."));
74
- let g = n.hours(parseInt(s ?? "00")).add(n.minutes(parseInt(u ?? "00"))).add(n.seconds(parseInt(c ?? "00"))).add(n.milliseconds(parseInt(y ?? "00")));
75
- return e === "local" && (g = g.add(n.utcOffset)), g.valueOf();
71
+ const [s, u, l] = t.split(":");
72
+ let h = "00", U = "00";
73
+ l != null && ([h, U] = l.split("."));
74
+ let y = r.hours(parseInt(s ?? "00")).add(r.minutes(parseInt(u ?? "00"))).add(r.seconds(parseInt(h ?? "00"))).add(r.milliseconds(parseInt(U ?? "00")));
75
+ return e === "local" && (y = y.add(r.utcOffset)), y.valueOf();
76
76
  }
77
77
  static parseDateTimeString(t, e = "UTC") {
78
78
  if (!t.includes("/") && !t.includes("-"))
79
- return n.parseTimeString(t, e);
79
+ return r.parseTimeString(t, e);
80
80
  const s = new Date(t);
81
- return t.includes(":") || s.setUTCHours(0, 0, 0, 0), new n(
82
- BigInt(s.getTime()) * n.MILLISECOND.valueOf(),
81
+ return t.includes(":") || s.setUTCHours(0, 0, 0, 0), new r(
82
+ BigInt(s.getTime()) * r.MILLISECOND.valueOf(),
83
83
  e
84
84
  ).valueOf();
85
85
  }
@@ -111,7 +111,7 @@ class n extends M {
111
111
  }
112
112
  }
113
113
  toISOString(t = "UTC") {
114
- return t === "UTC" ? this.date().toISOString() : this.sub(n.utcOffset).date().toISOString();
114
+ return t === "UTC" ? this.date().toISOString() : this.sub(r.utcOffset).date().toISOString();
115
115
  }
116
116
  timeString(t = !1, e = "UTC") {
117
117
  const s = this.toISOString(e);
@@ -123,8 +123,8 @@ class n extends M {
123
123
  }
124
124
  /** @returns The UTC offset for the time zone of the machine. */
125
125
  static get utcOffset() {
126
- return new a(
127
- BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * n.MINUTE.valueOf()
126
+ return new i(
127
+ BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * r.MINUTE.valueOf()
128
128
  );
129
129
  }
130
130
  /**
@@ -133,7 +133,7 @@ class n extends M {
133
133
  * @param other - The other timestamp.
134
134
  */
135
135
  static since(t) {
136
- return new n().span(t);
136
+ return new r().span(t);
137
137
  }
138
138
  /** @returns A JavaScript Date object representing the TimeStamp. */
139
139
  date() {
@@ -146,7 +146,7 @@ class n extends M {
146
146
  * @returns True if the TimeStamps are equal, false otherwise.
147
147
  */
148
148
  equals(t) {
149
- return this.valueOf() === new n(t).valueOf();
149
+ return this.valueOf() === new r(t).valueOf();
150
150
  }
151
151
  /**
152
152
  * Creates a TimeSpan representing the duration between the two timestamps.
@@ -195,7 +195,7 @@ class n extends M {
195
195
  * otherwise.
196
196
  */
197
197
  after(t) {
198
- return this.valueOf() > new n(t).valueOf();
198
+ return this.valueOf() > new r(t).valueOf();
199
199
  }
200
200
  /**
201
201
  * Checks if the TimeStamp is after or equal to the given TimeStamp.
@@ -205,7 +205,7 @@ class n extends M {
205
205
  * false otherwise.
206
206
  */
207
207
  afterEq(t) {
208
- return this.valueOf() >= new n(t).valueOf();
208
+ return this.valueOf() >= new r(t).valueOf();
209
209
  }
210
210
  /**
211
211
  * Checks if the TimeStamp is before the given TimeStamp.
@@ -215,7 +215,7 @@ class n extends M {
215
215
  * otherwise.
216
216
  */
217
217
  before(t) {
218
- return this.valueOf() < new n(t).valueOf();
218
+ return this.valueOf() < new r(t).valueOf();
219
219
  }
220
220
  /**
221
221
  * Checks if TimeStamp is before or equal to the current timestamp.
@@ -225,7 +225,7 @@ class n extends M {
225
225
  * false otherwise.
226
226
  */
227
227
  beforeEq(t) {
228
- return this.valueOf() <= new n(t).valueOf();
228
+ return this.valueOf() <= new r(t).valueOf();
229
229
  }
230
230
  /**
231
231
  * Adds a TimeSpan to the TimeStamp.
@@ -235,7 +235,7 @@ class n extends M {
235
235
  * TimeSpan.
236
236
  */
237
237
  add(t) {
238
- return new n(this.valueOf() + BigInt(t.valueOf()));
238
+ return new r(p(this.valueOf(), new i(t).valueOf()));
239
239
  }
240
240
  /**
241
241
  * Subtracts a TimeSpan from the TimeStamp.
@@ -245,43 +245,43 @@ class n extends M {
245
245
  * TimeSpan.
246
246
  */
247
247
  sub(t) {
248
- return new n(this.valueOf() - BigInt(t.valueOf()));
248
+ return new r(L(this.valueOf(), new i(t).valueOf()));
249
249
  }
250
250
  /**
251
251
  * @returns the floating point number of hours since the unix epoch to the timestamp
252
252
  * value.
253
253
  */
254
254
  get hours() {
255
- return Number(this.valueOf()) / Number(a.HOUR.valueOf());
255
+ return Number(this.valueOf()) / Number(i.HOUR.valueOf());
256
256
  }
257
257
  /**
258
258
  * @returns the floating point number of minutes since the unix epoch to the timestamp
259
259
  * value.
260
260
  */
261
261
  get minutes() {
262
- return Number(this.valueOf()) / Number(a.MINUTE.valueOf());
262
+ return Number(this.valueOf()) / Number(i.MINUTE.valueOf());
263
263
  }
264
264
  /**
265
265
  * @returns the floating point number of days since the unix epoch to the timestamp
266
266
  * value.
267
267
  */
268
268
  get days() {
269
- return Number(this.valueOf()) / Number(a.DAY.valueOf());
269
+ return Number(this.valueOf()) / Number(i.DAY.valueOf());
270
270
  }
271
271
  /**
272
272
  * @returns the floating point number of seconds since the unix epoch to the timestamp
273
273
  * value.
274
274
  */
275
275
  get seconds() {
276
- return Number(this.valueOf()) / Number(a.SECOND.valueOf());
276
+ return Number(this.valueOf()) / Number(i.SECOND.valueOf());
277
277
  }
278
278
  /** @returns the floating point number of milliseconds since the unix epoch. */
279
279
  get milliseconds() {
280
- return Number(this.valueOf()) / Number(n.MILLISECOND.valueOf());
280
+ return Number(this.valueOf()) / Number(r.MILLISECOND.valueOf());
281
281
  }
282
282
  /** @returns the floating point number of microseconds since the unix epoch. */
283
283
  get microseconds() {
284
- return Number(this.valueOf()) / Number(n.MICROSECOND.valueOf());
284
+ return Number(this.valueOf()) / Number(r.MICROSECOND.valueOf());
285
285
  }
286
286
  /**
287
287
  * @returns the floating point number of nanoseconds since the unix epoch.
@@ -301,7 +301,7 @@ class n extends M {
301
301
  */
302
302
  setYear(t) {
303
303
  const e = this.date();
304
- return e.setUTCFullYear(t), new n(e);
304
+ return e.setUTCFullYear(t), new r(e);
305
305
  }
306
306
  /** @returns the integer month that the timestamp corresponds to with its year. */
307
307
  get month() {
@@ -313,7 +313,7 @@ class n extends M {
313
313
  */
314
314
  setMonth(t) {
315
315
  const e = this.date();
316
- return e.setUTCMonth(t), new n(e);
316
+ return e.setUTCMonth(t), new r(e);
317
317
  }
318
318
  /** @returns the integer day that the timestamp corresponds to within its month. */
319
319
  get day() {
@@ -325,7 +325,7 @@ class n extends M {
325
325
  */
326
326
  setDay(t) {
327
327
  const e = this.date();
328
- return e.setUTCDate(t), new n(e);
328
+ return e.setUTCDate(t), new r(e);
329
329
  }
330
330
  /**
331
331
  * @returns the integer hour that the timestamp corresponds to within its day.
@@ -339,7 +339,7 @@ class n extends M {
339
339
  */
340
340
  setHour(t) {
341
341
  const e = this.date();
342
- return e.setUTCHours(t), new n(e, "UTC");
342
+ return e.setUTCHours(t), new r(e, "UTC");
343
343
  }
344
344
  /** @returns the integer minute that the timestamp corresponds to within its hour. */
345
345
  get minute() {
@@ -351,7 +351,7 @@ class n extends M {
351
351
  */
352
352
  setMinute(t) {
353
353
  const e = this.date();
354
- return e.setUTCMinutes(t), new n(e);
354
+ return e.setUTCMinutes(t), new r(e);
355
355
  }
356
356
  /**
357
357
  * @returns the integer second that the timestamp corresponds to within its
@@ -366,7 +366,7 @@ class n extends M {
366
366
  */
367
367
  setSecond(t) {
368
368
  const e = this.date();
369
- return e.setUTCSeconds(t), new n(e);
369
+ return e.setUTCSeconds(t), new r(e);
370
370
  }
371
371
  /**
372
372
  * @reutrns the integer millisecond that the timestamp corresponds to within
@@ -381,7 +381,7 @@ class n extends M {
381
381
  */
382
382
  setMillisecond(t) {
383
383
  const e = this.date();
384
- return e.setUTCMilliseconds(t), new n(e);
384
+ return e.setUTCMilliseconds(t), new r(e);
385
385
  }
386
386
  /** @returns the time stamp formatted as an ISO string. */
387
387
  toString() {
@@ -399,11 +399,11 @@ class n extends M {
399
399
  * @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
400
400
  */
401
401
  remainder(t) {
402
- return W(this, t);
402
+ return Q(this, t);
403
403
  }
404
404
  /** @returns true if the day portion TimeStamp is today, false otherwise. */
405
405
  get isToday() {
406
- return this.truncate(a.DAY).equals(n.now().truncate(a.DAY));
406
+ return this.truncate(i.DAY).equals(r.now().truncate(i.DAY));
407
407
  }
408
408
  /**
409
409
  * Truncates the TimeStamp to the nearest multiple of the given span.
@@ -420,7 +420,7 @@ class n extends M {
420
420
  * JavaScript can do).
421
421
  */
422
422
  static now() {
423
- return new n(/* @__PURE__ */ new Date());
423
+ return new r(/* @__PURE__ */ new Date());
424
424
  }
425
425
  /**
426
426
  * Finds the maximum timestamp among the provided timestamps.
@@ -429,9 +429,9 @@ class n extends M {
429
429
  * @returns The maximum (latest) timestamp from the input.
430
430
  */
431
431
  static max(...t) {
432
- let e = n.MIN;
432
+ let e = r.MIN;
433
433
  for (const s of t) {
434
- const u = new n(s);
434
+ const u = new r(s);
435
435
  u.after(e) && (e = u);
436
436
  }
437
437
  return e;
@@ -443,9 +443,9 @@ class n extends M {
443
443
  * @returns The minimum (earliest) timestamp from the input.
444
444
  */
445
445
  static min(...t) {
446
- let e = n.MAX;
446
+ let e = r.MAX;
447
447
  for (const s of t) {
448
- const u = new n(s);
448
+ const u = new r(s);
449
449
  u.before(e) && (e = u);
450
450
  }
451
451
  return e;
@@ -457,62 +457,62 @@ class n extends M {
457
457
  * @returns A TimeStamp representing the given number of nanoseconds.
458
458
  */
459
459
  static nanoseconds(t, e = "UTC") {
460
- return new n(t, e);
460
+ return new r(t, e);
461
461
  }
462
462
  /** One nanosecond after the unix epoch */
463
- static NANOSECOND = n.nanoseconds(1);
463
+ static NANOSECOND = r.nanoseconds(1);
464
464
  /** @returns a new TimeStamp n microseconds after the unix epoch */
465
465
  static microseconds(t, e = "UTC") {
466
- return n.nanoseconds(t * 1e3, e);
466
+ return r.nanoseconds(t * 1e3, e);
467
467
  }
468
468
  /** One microsecond after the unix epoch */
469
- static MICROSECOND = n.microseconds(1);
469
+ static MICROSECOND = r.microseconds(1);
470
470
  /** @returns a new TimeStamp n milliseconds after the unix epoch */
471
471
  static milliseconds(t, e = "UTC") {
472
- return n.microseconds(t * 1e3, e);
472
+ return r.microseconds(t * 1e3, e);
473
473
  }
474
474
  /** One millisecond after the unix epoch */
475
- static MILLISECOND = n.milliseconds(1);
475
+ static MILLISECOND = r.milliseconds(1);
476
476
  /** @returns a new TimeStamp n seconds after the unix epoch */
477
477
  static seconds(t, e = "UTC") {
478
- return n.milliseconds(t * 1e3, e);
478
+ return r.milliseconds(t * 1e3, e);
479
479
  }
480
480
  /** One second after the unix epoch */
481
- static SECOND = n.seconds(1);
481
+ static SECOND = r.seconds(1);
482
482
  /** @returns a new TimeStamp n minutes after the unix epoch */
483
483
  static minutes(t, e = "UTC") {
484
- return n.seconds(t * 60, e);
484
+ return r.seconds(t * 60, e);
485
485
  }
486
486
  /** One minute after the unix epoch */
487
- static MINUTE = n.minutes(1);
487
+ static MINUTE = r.minutes(1);
488
488
  /** @returns a new TimeStamp n hours after the unix epoch */
489
489
  static hours(t, e = "UTC") {
490
- return n.minutes(t * 60, e);
490
+ return r.minutes(t * 60, e);
491
491
  }
492
492
  /** One hour after the unix epoch */
493
- static HOUR = n.hours(1);
493
+ static HOUR = r.hours(1);
494
494
  /** @returns a new TimeStamp n days after the unix epoch */
495
495
  static days(t, e = "UTC") {
496
- return n.hours(t * 24, e);
496
+ return r.hours(t * 24, e);
497
497
  }
498
498
  /** One day after the unix epoch */
499
- static DAY = n.days(1);
499
+ static DAY = r.days(1);
500
500
  /** The maximum possible value for a timestamp */
501
- static MAX = new n((1n << 63n) - 1n);
501
+ static MAX = new r((1n << 63n) - 1n);
502
502
  /** The minimum possible value for a timestamp */
503
- static MIN = new n(0);
503
+ static MIN = new r(0);
504
504
  /** The unix epoch */
505
- static ZERO = new n(0);
505
+ static ZERO = new r(0);
506
506
  /** A zod schema for validating timestamps */
507
507
  static z = o.union([
508
- o.instanceof(n),
509
- o.object({ value: o.bigint() }).transform((t) => new n(t.value)),
510
- o.string().transform((t) => new n(BigInt(t))),
511
- o.number().transform((t) => new n(t)),
512
- o.bigint().transform((t) => new n(t)),
513
- o.date().transform((t) => new n(t)),
514
- o.custom((t) => t instanceof a).transform((t) => new n(t)),
515
- ut.transform((t) => new n(t))
508
+ o.instanceof(r),
509
+ o.object({ value: o.bigint() }).transform((t) => new r(t.value)),
510
+ o.string().transform((t) => new r(BigInt(t))),
511
+ o.number().transform((t) => new r(t)),
512
+ o.bigint().transform((t) => new r(t)),
513
+ o.date().transform((t) => new r(t)),
514
+ o.custom((t) => t instanceof i).transform((t) => new r(t)),
515
+ ct.transform((t) => new r(t))
516
516
  ]);
517
517
  /**
518
518
  * Sorts two timestamps.
@@ -526,7 +526,7 @@ class n extends M {
526
526
  return Number(t.valueOf() - e.valueOf());
527
527
  }
528
528
  }
529
- class a extends M {
529
+ class i extends C {
530
530
  constructor(t) {
531
531
  typeof t == "number" && (t = Math.trunc(t.valueOf())), super(BigInt(t.valueOf()));
532
532
  }
@@ -537,7 +537,7 @@ class a extends M {
537
537
  * @returns A TimeSpan representing the given number of seconds.
538
538
  */
539
539
  static fromSeconds(t) {
540
- return t instanceof a ? t : t instanceof E ? t.period : t instanceof n ? new a(t) : ["number", "bigint"].includes(typeof t) ? a.seconds(t) : new a(t);
540
+ return t instanceof i ? t : t instanceof I ? t.period : t instanceof r ? new i(t) : ["number", "bigint"].includes(typeof t) ? i.seconds(t) : new i(t);
541
541
  }
542
542
  /**
543
543
  * Creates a TimeSpan representing the given number of milliseconds.
@@ -546,7 +546,7 @@ class a extends M {
546
546
  * @returns A TimeSpan representing the given number of milliseconds.
547
547
  */
548
548
  static fromMilliseconds(t) {
549
- return t instanceof a ? t : t instanceof E ? t.period : t instanceof n ? new a(t) : ["number", "bigint"].includes(typeof t) ? a.milliseconds(t) : new a(t);
549
+ return t instanceof i ? t : t instanceof I ? t.period : t instanceof r ? new i(t) : ["number", "bigint"].includes(typeof t) ? i.milliseconds(t) : new i(t);
550
550
  }
551
551
  /**
552
552
  * @returns the primitive value of the TimeSpan. Overrides standard JS valueOf()
@@ -562,7 +562,7 @@ class a extends M {
562
562
  * @returns True if the TimeSpan is less than the other TimeSpan, false otherwise.
563
563
  */
564
564
  lessThan(t) {
565
- return this.valueOf() < new a(t).valueOf();
565
+ return this.valueOf() < new i(t).valueOf();
566
566
  }
567
567
  /**
568
568
  * Checks if the TimeSpan is greater than another TimeSpan.
@@ -571,7 +571,7 @@ class a extends M {
571
571
  * @returns True if the TimeSpan is greater than the other TimeSpan, false otherwise.
572
572
  */
573
573
  greaterThan(t) {
574
- return this.valueOf() > new a(t).valueOf();
574
+ return this.valueOf() > new i(t).valueOf();
575
575
  }
576
576
  /**
577
577
  * Checks if the TimeSpan is less than or equal to another TimeSpan.
@@ -580,7 +580,7 @@ class a extends M {
580
580
  * @returns True if the TimeSpan is less than or equal to the other TimeSpan, false otherwise.
581
581
  */
582
582
  lessThanOrEqual(t) {
583
- return this.valueOf() <= new a(t).valueOf();
583
+ return this.valueOf() <= new i(t).valueOf();
584
584
  }
585
585
  /**
586
586
  * Checks if the TimeSpan is greater than or equal to another TimeSpan.
@@ -589,7 +589,7 @@ class a extends M {
589
589
  * @returns True if the TimeSpan is greater than or equal to the other TimeSpan, false otherwise.
590
590
  */
591
591
  greaterThanOrEqual(t) {
592
- return this.valueOf() >= new a(t).valueOf();
592
+ return this.valueOf() >= new i(t).valueOf();
593
593
  }
594
594
  /**
595
595
  * Calculates the remainder of the TimeSpan when divided by another TimeSpan.
@@ -598,7 +598,7 @@ class a extends M {
598
598
  * @returns A new TimeSpan representing the remainder.
599
599
  */
600
600
  remainder(t) {
601
- return W(this, t);
601
+ return Q(this, t);
602
602
  }
603
603
  /**
604
604
  * Truncates the TimeSpan to the nearest multiple of the given span.
@@ -607,7 +607,7 @@ class a extends M {
607
607
  * @returns A new TimeSpan that is truncated to the nearest multiple of the given span.
608
608
  */
609
609
  truncate(t) {
610
- return new a(
610
+ return new i(
611
611
  BigInt(Math.trunc(Number(this.valueOf() / t.valueOf()))) * t.valueOf()
612
612
  );
613
613
  }
@@ -617,9 +617,9 @@ class a extends M {
617
617
  * @returns A string representation of the TimeSpan.
618
618
  */
619
619
  toString() {
620
- const t = this.truncate(a.DAY), e = this.truncate(a.HOUR), s = this.truncate(a.MINUTE), u = this.truncate(a.SECOND), f = this.truncate(a.MILLISECOND), c = this.truncate(a.MICROSECOND), y = this.truncate(a.NANOSECOND), g = t, b = e.sub(t), N = s.sub(e), l = u.sub(s), m = f.sub(u), v = c.sub(f), F = y.sub(c);
621
- let U = "";
622
- return g.isZero || (U += `${g.days}d `), b.isZero || (U += `${b.hours}h `), N.isZero || (U += `${N.minutes}m `), l.isZero || (U += `${l.seconds}s `), m.isZero || (U += `${m.milliseconds}ms `), v.isZero || (U += `${v.microseconds}µs `), F.isZero || (U += `${F.nanoseconds}ns`), U.trim();
620
+ const t = this.truncate(i.DAY), e = this.truncate(i.HOUR), s = this.truncate(i.MINUTE), u = this.truncate(i.SECOND), l = this.truncate(i.MILLISECOND), h = this.truncate(i.MICROSECOND), U = this.truncate(i.NANOSECOND), y = t, g = e.sub(t), m = s.sub(e), b = u.sub(s), f = l.sub(u), A = h.sub(l), M = U.sub(h);
621
+ let E = "";
622
+ return y.isZero || (E += `${y.days}d `), g.isZero || (E += `${g.hours}h `), m.isZero || (E += `${m.minutes}m `), b.isZero || (E += `${b.seconds}s `), f.isZero || (E += `${f.milliseconds}ms `), A.isZero || (E += `${A.microseconds}µs `), M.isZero || (E += `${M.nanoseconds}ns`), E.trim();
623
623
  }
624
624
  /**
625
625
  * Multiplies the TimeSpan by a scalar value.
@@ -628,31 +628,40 @@ class a extends M {
628
628
  * @returns A new TimeSpan that is this TimeSpan multiplied by the provided value.
629
629
  */
630
630
  mult(t) {
631
- return new a(this.valueOf() * BigInt(t));
631
+ return new i(N(this.valueOf(), t));
632
+ }
633
+ /**
634
+ * Divides the TimeSpan by a scalar value.
635
+ *
636
+ * @param value - The scalar value to divide by.
637
+ * @returns A new TimeSpan that is this TimeSpan divided by the provided value.
638
+ */
639
+ div(t) {
640
+ return new i(S(this.valueOf(), t));
632
641
  }
633
642
  /** @returns the decimal number of days in the TimeSpan. */
634
643
  get days() {
635
- return Number(this.valueOf()) / Number(a.DAY.valueOf());
644
+ return Number(this.valueOf()) / Number(i.DAY.valueOf());
636
645
  }
637
646
  /** @returns the decimal number of hours in the TimeSpan. */
638
647
  get hours() {
639
- return Number(this.valueOf()) / Number(a.HOUR.valueOf());
648
+ return Number(this.valueOf()) / Number(i.HOUR.valueOf());
640
649
  }
641
650
  /** @returns the decimal number of minutes in the TimeSpan. */
642
651
  get minutes() {
643
- return Number(this.valueOf()) / Number(a.MINUTE.valueOf());
652
+ return Number(this.valueOf()) / Number(i.MINUTE.valueOf());
644
653
  }
645
654
  /** @returns The number of seconds in the TimeSpan. */
646
655
  get seconds() {
647
- return Number(this.valueOf()) / Number(a.SECOND.valueOf());
656
+ return Number(this.valueOf()) / Number(i.SECOND.valueOf());
648
657
  }
649
658
  /** @returns The number of milliseconds in the TimeSpan. */
650
659
  get milliseconds() {
651
- return Number(this.valueOf()) / Number(a.MILLISECOND.valueOf());
660
+ return Number(this.valueOf()) / Number(i.MILLISECOND.valueOf());
652
661
  }
653
662
  /** @returns The number of microseconds in the TimeSpan. */
654
663
  get microseconds() {
655
- return Number(this.valueOf()) / Number(a.MICROSECOND.valueOf());
664
+ return Number(this.valueOf()) / Number(i.MICROSECOND.valueOf());
656
665
  }
657
666
  /** @returns The number of nanoseconds in the TimeSpan. */
658
667
  get nanoseconds() {
@@ -672,7 +681,7 @@ class a extends M {
672
681
  * @returns True if the TimeSpans are equal, false otherwise.
673
682
  */
674
683
  equals(t) {
675
- return this.valueOf() === new a(t).valueOf();
684
+ return this.valueOf() === new i(t).valueOf();
676
685
  }
677
686
  /**
678
687
  * Adds a TimeSpan to the TimeSpan.
@@ -680,7 +689,7 @@ class a extends M {
680
689
  * @returns A new TimeSpan representing the sum of the two TimeSpans.
681
690
  */
682
691
  add(t) {
683
- return new a(this.valueOf() + new a(t).valueOf());
692
+ return new i(this.valueOf() + new i(t).valueOf());
684
693
  }
685
694
  /**
686
695
  * Creates a TimeSpan representing the duration between the two timestamps.
@@ -688,7 +697,7 @@ class a extends M {
688
697
  * @param other
689
698
  */
690
699
  sub(t) {
691
- return new a(this.valueOf() - new a(t).valueOf());
700
+ return new i(this.valueOf() - new i(t).valueOf());
692
701
  }
693
702
  /**
694
703
  * Creates a TimeSpan representing the given number of nanoseconds.
@@ -697,10 +706,10 @@ class a extends M {
697
706
  * @returns A TimeSpan representing the given number of nanoseconds.
698
707
  */
699
708
  static nanoseconds(t = 1) {
700
- return new a(t);
709
+ return new i(t);
701
710
  }
702
711
  /** A nanosecond. */
703
- static NANOSECOND = a.nanoseconds(1);
712
+ static NANOSECOND = i.nanoseconds(1);
704
713
  /**
705
714
  * Creates a TimeSpan representing the given number of microseconds.
706
715
  *
@@ -708,10 +717,10 @@ class a extends M {
708
717
  * @returns A TimeSpan representing the given number of microseconds.
709
718
  */
710
719
  static microseconds(t = 1) {
711
- return a.nanoseconds(B(t, 1e3));
720
+ return i.nanoseconds(N(t, 1e3));
712
721
  }
713
722
  /** A microsecond. */
714
- static MICROSECOND = a.microseconds(1);
723
+ static MICROSECOND = i.microseconds(1);
715
724
  /**
716
725
  * Creates a TimeSpan representing the given number of milliseconds.
717
726
  *
@@ -719,10 +728,10 @@ class a extends M {
719
728
  * @returns A TimeSpan representing the given number of milliseconds.
720
729
  */
721
730
  static milliseconds(t = 1) {
722
- return a.microseconds(B(t, 1e3));
731
+ return i.microseconds(N(t, 1e3));
723
732
  }
724
733
  /** A millisecond. */
725
- static MILLISECOND = a.milliseconds(1);
734
+ static MILLISECOND = i.milliseconds(1);
726
735
  /**
727
736
  * Creates a TimeSpan representing the given number of seconds.
728
737
  *
@@ -730,10 +739,10 @@ class a extends M {
730
739
  * @returns A TimeSpan representing the given number of seconds.
731
740
  */
732
741
  static seconds(t = 1) {
733
- return a.milliseconds(B(t, 1e3));
742
+ return i.milliseconds(N(t, 1e3));
734
743
  }
735
744
  /** A second. */
736
- static SECOND = a.seconds(1);
745
+ static SECOND = i.seconds(1);
737
746
  /**
738
747
  * Creates a TimeSpan representing the given number of minutes.
739
748
  *
@@ -741,10 +750,10 @@ class a extends M {
741
750
  * @returns A TimeSpan representing the given number of minutes.
742
751
  */
743
752
  static minutes(t = 1) {
744
- return a.seconds(B(t, 60));
753
+ return i.seconds(N(t, 60));
745
754
  }
746
755
  /** A minute. */
747
- static MINUTE = a.minutes(1);
756
+ static MINUTE = i.minutes(1);
748
757
  /**
749
758
  * Creates a TimeSpan representing the given number of hours.
750
759
  *
@@ -752,10 +761,10 @@ class a extends M {
752
761
  * @returns A TimeSpan representing the given number of hours.
753
762
  */
754
763
  static hours(t) {
755
- return a.minutes(B(t, 60));
764
+ return i.minutes(N(t, 60));
756
765
  }
757
766
  /** Represents an hour. */
758
- static HOUR = a.hours(1);
767
+ static HOUR = i.hours(1);
759
768
  /**
760
769
  * Creates a TimeSpan representing the given number of days.
761
770
  *
@@ -763,25 +772,28 @@ class a extends M {
763
772
  * @returns A TimeSpan representing the given number of days.
764
773
  */
765
774
  static days(t) {
766
- return a.hours(B(t, 24));
775
+ return i.hours(N(t, 24));
767
776
  }
768
777
  /** Represents a day. */
769
- static DAY = a.days(1);
778
+ static DAY = i.days(1);
770
779
  /** The maximum possible value for a TimeSpan. */
771
- static MAX = new a((1n << 63n) - 1n);
780
+ static MAX = new i((1n << 63n) - 1n);
772
781
  /** The minimum possible value for a TimeSpan. */
773
- static MIN = new a(0);
782
+ static MIN = new i(0);
774
783
  /** The zero value for a TimeSpan. */
775
- static ZERO = new a(0);
784
+ static ZERO = new i(0);
776
785
  /** A zod schema for validating and transforming timespans */
777
786
  static z = o.union([
778
- o.object({ value: o.bigint() }).transform((t) => new a(t.value)),
779
- o.string().transform((t) => new a(BigInt(t))),
780
- o.number().transform((t) => new a(t)),
781
- o.instanceof(a)
787
+ o.object({ value: o.bigint() }).transform((t) => new i(t.value)),
788
+ o.string().transform((t) => new i(BigInt(t))),
789
+ o.number().transform((t) => new i(t)),
790
+ o.bigint().transform((t) => new i(t)),
791
+ o.instanceof(i),
792
+ o.instanceof(r).transform((t) => new i(t)),
793
+ o.custom((t) => t instanceof I).transform((t) => new i(t))
782
794
  ]);
783
795
  }
784
- class E extends M {
796
+ class I extends C {
785
797
  constructor(t) {
786
798
  super(t.valueOf());
787
799
  }
@@ -791,7 +803,7 @@ class E extends M {
791
803
  }
792
804
  /** @returns The number of seconds in the Rate. */
793
805
  equals(t) {
794
- return this.valueOf() === new E(t).valueOf();
806
+ return this.valueOf() === new I(t).valueOf();
795
807
  }
796
808
  /**
797
809
  * Calculates the period of the Rate as a TimeSpan.
@@ -799,7 +811,7 @@ class E extends M {
799
811
  * @returns A TimeSpan representing the period of the Rate.
800
812
  */
801
813
  get period() {
802
- return a.seconds(1 / this.valueOf());
814
+ return i.seconds(1 / this.valueOf());
803
815
  }
804
816
  /**
805
817
  * Calculates the number of samples in the given TimeSpan at this rate.
@@ -808,7 +820,7 @@ class E extends M {
808
820
  * @returns The number of samples in the given TimeSpan at this rate.
809
821
  */
810
822
  sampleCount(t) {
811
- return new a(t).seconds * this.valueOf();
823
+ return new i(t).seconds * this.valueOf();
812
824
  }
813
825
  /**
814
826
  * Calculates the number of bytes in the given TimeSpan at this rate.
@@ -827,7 +839,7 @@ class E extends M {
827
839
  * @returns A TimeSpan that corresponds to the given number of samples.
828
840
  */
829
841
  span(t) {
830
- return a.seconds(t / this.valueOf());
842
+ return i.seconds(t / this.valueOf());
831
843
  }
832
844
  /**
833
845
  * Calculates a TimeSpan given the number of bytes at this rate.
@@ -839,6 +851,42 @@ class E extends M {
839
851
  byteSpan(t, e) {
840
852
  return this.span(t.valueOf() / e.valueOf());
841
853
  }
854
+ /**
855
+ * Adds another Rate to this Rate.
856
+ *
857
+ * @param other - The Rate to add.
858
+ * @returns A new Rate representing the sum of the two rates.
859
+ */
860
+ add(t) {
861
+ return new I(p(this.valueOf(), t.valueOf()));
862
+ }
863
+ /**
864
+ * Subtracts another Rate from this Rate.
865
+ *
866
+ * @param other - The Rate to subtract.
867
+ * @returns A new Rate representing the difference of the two rates.
868
+ */
869
+ sub(t) {
870
+ return new I(L(this.valueOf(), t.valueOf()));
871
+ }
872
+ /**
873
+ * Multiplies this Rate by a scalar value.
874
+ *
875
+ * @param value - The scalar value to multiply by.
876
+ * @returns A new Rate representing this Rate multiplied by the value.
877
+ */
878
+ mult(t) {
879
+ return new I(N(this.valueOf(), t));
880
+ }
881
+ /**
882
+ * Divides this Rate by a scalar value.
883
+ *
884
+ * @param value - The scalar value to divide by.
885
+ * @returns A new Rate representing this Rate divided by the value.
886
+ */
887
+ div(t) {
888
+ return new I(S(this.valueOf(), t));
889
+ }
842
890
  /**
843
891
  * Creates a Rate representing the given number of Hz.
844
892
  *
@@ -846,7 +894,7 @@ class E extends M {
846
894
  * @returns A Rate representing the given number of Hz.
847
895
  */
848
896
  static hz(t) {
849
- return new E(t);
897
+ return new I(t);
850
898
  }
851
899
  /**
852
900
  * Creates a Rate representing the given number of kHz.
@@ -855,15 +903,15 @@ class E extends M {
855
903
  * @returns A Rate representing the given number of kHz.
856
904
  */
857
905
  static khz(t) {
858
- return E.hz(t * 1e3);
906
+ return I.hz(t * 1e3);
859
907
  }
860
908
  /** A zod schema for validating and transforming rates */
861
909
  static z = o.union([
862
- o.number().transform((t) => new E(t)),
863
- o.instanceof(E)
910
+ o.number().transform((t) => new I(t)),
911
+ o.instanceof(I)
864
912
  ]);
865
913
  }
866
- class d extends M {
914
+ class d extends C {
867
915
  /**
868
916
  * Creates a Density representing the given number of bytes per value.
869
917
  *
@@ -890,7 +938,43 @@ class d extends M {
890
938
  * @returns A Size representing the given number of values.
891
939
  */
892
940
  size(t) {
893
- return new h(t * this.valueOf());
941
+ return new c(t * this.valueOf());
942
+ }
943
+ /**
944
+ * Adds another Density to this Density.
945
+ *
946
+ * @param other - The Density to add.
947
+ * @returns A new Density representing the sum of the two densities.
948
+ */
949
+ add(t) {
950
+ return new d(p(this.valueOf(), t.valueOf()));
951
+ }
952
+ /**
953
+ * Subtracts another Density from this Density.
954
+ *
955
+ * @param other - The Density to subtract.
956
+ * @returns A new Density representing the difference of the two densities.
957
+ */
958
+ sub(t) {
959
+ return new d(L(this.valueOf(), t.valueOf()));
960
+ }
961
+ /**
962
+ * Multiplies this Density by a scalar value.
963
+ *
964
+ * @param value - The scalar value to multiply by.
965
+ * @returns A new Density representing this Density multiplied by the value.
966
+ */
967
+ mult(t) {
968
+ return new d(N(this.valueOf(), t));
969
+ }
970
+ /**
971
+ * Divides this Density by a scalar value.
972
+ *
973
+ * @param value - The scalar value to divide by.
974
+ * @returns A new Density representing this Density divided by the value.
975
+ */
976
+ div(t) {
977
+ return new d(S(this.valueOf(), t));
894
978
  }
895
979
  /** Unknown/Invalid Density. */
896
980
  static UNKNOWN = new d(0);
@@ -936,11 +1020,11 @@ class w {
936
1020
  * @param end - A TimeStamp representing the end of the range.
937
1021
  */
938
1022
  constructor(t, e) {
939
- typeof t == "object" && "start" in t ? (this.start = new n(t.start), this.end = new n(t.end)) : (this.start = new n(t), this.end = new n(e));
1023
+ typeof t == "object" && "start" in t ? (this.start = new r(t.start), this.end = new r(t.end)) : (this.start = new r(t), this.end = new r(e));
940
1024
  }
941
1025
  /** @returns The TimeSpan occupied by the TimeRange. */
942
1026
  get span() {
943
- return new a(this.end.valueOf() - this.start.valueOf());
1027
+ return new i(this.end.valueOf() - this.start.valueOf());
944
1028
  }
945
1029
  /**
946
1030
  * Checks if the timestamp is valid i.e. the start is before the end.
@@ -992,7 +1076,7 @@ class w {
992
1076
  * @param other - The TimeRange to compare to.
993
1077
  * @returns True if the TimeRange is equal to the given TimeRange.
994
1078
  */
995
- equals(t, e = a.ZERO) {
1079
+ equals(t, e = i.ZERO) {
996
1080
  if (e.isZero)
997
1081
  return this.start.equals(t.start) && this.end.equals(t.end);
998
1082
  let s = this.start.sub(t.start).valueOf(), u = this.end.sub(t.end).valueOf();
@@ -1025,13 +1109,13 @@ class w {
1025
1109
  * checking for overlap.
1026
1110
  * @returns True if the two TimeRanges overlap, false otherwise.
1027
1111
  */
1028
- overlapsWith(t, e = a.ZERO) {
1112
+ overlapsWith(t, e = i.ZERO) {
1029
1113
  t = t.makeValid();
1030
1114
  const s = this.makeValid();
1031
1115
  if (this.equals(t)) return !0;
1032
1116
  if (t.end.equals(s.start) || s.end.equals(t.start)) return !1;
1033
- const u = n.max(s.start, t.start), f = n.min(s.end, t.end);
1034
- return f.before(u) ? !1 : new a(f.sub(u)).greaterThanOrEqual(e);
1117
+ const u = r.max(s.start, t.start), l = r.min(s.end, t.end);
1118
+ return l.before(u) ? !1 : new i(l.sub(u)).greaterThanOrEqual(e);
1035
1119
  }
1036
1120
  contains(t) {
1037
1121
  return t instanceof w ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
@@ -1053,19 +1137,19 @@ class w {
1053
1137
  }
1054
1138
  static max(...t) {
1055
1139
  return new w(
1056
- n.min(...t.map((e) => e.start)),
1057
- n.max(...t.map((e) => e.end))
1140
+ r.min(...t.map((e) => e.start)),
1141
+ r.max(...t.map((e) => e.end))
1058
1142
  );
1059
1143
  }
1060
1144
  /** The maximum possible time range. */
1061
- static MAX = new w(n.MIN, n.MAX);
1145
+ static MAX = new w(r.MIN, r.MAX);
1062
1146
  /** The minimum possible time range. */
1063
- static MIN = new w(n.MAX, n.MIN);
1147
+ static MIN = new w(r.MAX, r.MIN);
1064
1148
  /** A time range whose start and end are both zero. */
1065
- static ZERO = new w(n.ZERO, n.ZERO);
1149
+ static ZERO = new w(r.ZERO, r.ZERO);
1066
1150
  /** A zod schema for validating and transforming time ranges */
1067
1151
  static z = o.union([
1068
- o.object({ start: n.z, end: n.z }).transform((t) => new w(t.start, t.end)),
1152
+ o.object({ start: r.z, end: r.z }).transform((t) => new w(t.start, t.end)),
1069
1153
  o.instanceof(w)
1070
1154
  ]);
1071
1155
  /**
@@ -1080,15 +1164,15 @@ class w {
1080
1164
  * equal.
1081
1165
  */
1082
1166
  static sort(t, e) {
1083
- return n.sort(t.start, e.start) || n.sort(t.end, e.end);
1167
+ return r.sort(t.start, e.start) || r.sort(t.end, e.end);
1084
1168
  }
1085
1169
  }
1086
- class r extends M {
1170
+ class n extends C {
1087
1171
  constructor(t) {
1088
- if (t instanceof r || typeof t == "string" || typeof t.valueOf() == "string")
1172
+ if (t instanceof n || typeof t == "string" || typeof t.valueOf() == "string")
1089
1173
  super(t.valueOf());
1090
1174
  else {
1091
- const e = r.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
1175
+ const e = n.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
1092
1176
  if (e == null)
1093
1177
  throw new Error(`unable to find data type for ${t.toString()}`);
1094
1178
  super(e.valueOf());
@@ -1098,7 +1182,7 @@ class r extends M {
1098
1182
  * @returns the TypedArray constructor for the DataType.
1099
1183
  */
1100
1184
  get Array() {
1101
- const t = r.ARRAY_CONSTRUCTORS.get(this.toString());
1185
+ const t = n.ARRAY_CONSTRUCTORS.get(this.toString());
1102
1186
  if (t == null)
1103
1187
  throw new Error(`unable to find array constructor for ${this.valueOf()}`);
1104
1188
  return t;
@@ -1125,7 +1209,7 @@ class r extends M {
1125
1209
  * @example DataType.INT32.isVariable // false
1126
1210
  */
1127
1211
  get isVariable() {
1128
- return this.equals(r.JSON) || this.equals(r.STRING);
1212
+ return this.equals(n.JSON) || this.equals(n.STRING);
1129
1213
  }
1130
1214
  /**
1131
1215
  * @returns true if the DataType is numeric.
@@ -1133,7 +1217,7 @@ class r extends M {
1133
1217
  * @example DataType.STRING.isNumeric // false
1134
1218
  */
1135
1219
  get isNumeric() {
1136
- return !this.isVariable && !this.equals(r.UUID);
1220
+ return !this.isVariable && !this.equals(n.UUID);
1137
1221
  }
1138
1222
  /**
1139
1223
  * @returns true if the DataType is an integer.
@@ -1158,7 +1242,7 @@ class r extends M {
1158
1242
  * @example DataType.FLOAT32.density // Density.BIT32
1159
1243
  */
1160
1244
  get density() {
1161
- const t = r.DENSITIES.get(this.toString());
1245
+ const t = n.DENSITIES.get(this.toString());
1162
1246
  if (t == null) throw new Error(`unable to find density for ${this.valueOf()}`);
1163
1247
  return t;
1164
1248
  }
@@ -1168,7 +1252,7 @@ class r extends M {
1168
1252
  * @example DataType.INT32.isUnsigned // false
1169
1253
  */
1170
1254
  get isUnsignedInteger() {
1171
- return this.equals(r.UINT8) || this.equals(r.UINT16) || this.equals(r.UINT32) || this.equals(r.UINT64);
1255
+ return this.equals(n.UINT8) || this.equals(n.UINT16) || this.equals(n.UINT32) || this.equals(n.UINT64);
1172
1256
  }
1173
1257
  /**
1174
1258
  * @returns true if the DataType is a signed integer.
@@ -1176,11 +1260,11 @@ class r extends M {
1176
1260
  * @example DataType.UINT32.isSigned // false
1177
1261
  */
1178
1262
  get isSignedInteger() {
1179
- return this.equals(r.INT8) || this.equals(r.INT16) || this.equals(r.INT32) || this.equals(r.INT64);
1263
+ return this.equals(n.INT8) || this.equals(n.INT16) || this.equals(n.INT32) || this.equals(n.INT64);
1180
1264
  }
1181
1265
  /** @returns true if the data type can be cast to the other data type without loss of precision. */
1182
1266
  canSafelyCastTo(t) {
1183
- return this.equals(t) ? !0 : !this.isNumeric || !t.isNumeric || this.isVariable || t.isVariable || this.isUnsignedInteger && t.isSignedInteger ? !1 : this.isFloat ? t.isFloat && this.density.valueOf() <= t.density.valueOf() : this.equals(r.INT32) && t.equals(r.FLOAT64) || this.equals(r.INT8) && t.equals(r.FLOAT32) ? !0 : this.isInteger && t.isInteger ? this.density.valueOf() <= t.density.valueOf() && this.isUnsignedInteger === t.isUnsignedInteger : !1;
1267
+ return this.equals(t) ? !0 : !this.isNumeric || !t.isNumeric || this.isVariable || t.isVariable || this.isUnsignedInteger && t.isSignedInteger ? !1 : this.isFloat ? t.isFloat && this.density.valueOf() <= t.density.valueOf() : this.equals(n.INT32) && t.equals(n.FLOAT64) || this.equals(n.INT8) && t.equals(n.FLOAT32) ? !0 : this.isInteger && t.isInteger ? this.density.valueOf() <= t.density.valueOf() && this.isUnsignedInteger === t.isUnsignedInteger : !1;
1184
1268
  }
1185
1269
  /** @returns true if the data type can be cast to the other data type, even if there is a loss of precision. */
1186
1270
  canCastTo(t) {
@@ -1197,112 +1281,112 @@ class r extends M {
1197
1281
  }
1198
1282
  /** @returns true if the data type uses bigints to store values. */
1199
1283
  get usesBigInt() {
1200
- return r.BIG_INT_TYPES.some((t) => t.equals(this));
1284
+ return n.BIG_INT_TYPES.some((t) => t.equals(this));
1201
1285
  }
1202
1286
  /** Represents an Unknown/Invalid DataType. */
1203
- static UNKNOWN = new r("unknown");
1287
+ static UNKNOWN = new n("unknown");
1204
1288
  /** Represents a 64-bit floating point value. */
1205
- static FLOAT64 = new r("float64");
1289
+ static FLOAT64 = new n("float64");
1206
1290
  /** Represents a 32-bit floating point value. */
1207
- static FLOAT32 = new r("float32");
1291
+ static FLOAT32 = new n("float32");
1208
1292
  /** Represents a 64-bit signed integer value. */
1209
- static INT64 = new r("int64");
1293
+ static INT64 = new n("int64");
1210
1294
  /** Represents a 32-bit signed integer value. */
1211
- static INT32 = new r("int32");
1295
+ static INT32 = new n("int32");
1212
1296
  /** Represents a 16-bit signed integer value. */
1213
- static INT16 = new r("int16");
1297
+ static INT16 = new n("int16");
1214
1298
  /** Represents a 8-bit signed integer value. */
1215
- static INT8 = new r("int8");
1299
+ static INT8 = new n("int8");
1216
1300
  /** Represents a 64-bit unsigned integer value. */
1217
- static UINT64 = new r("uint64");
1301
+ static UINT64 = new n("uint64");
1218
1302
  /** Represents a 32-bit unsigned integer value. */
1219
- static UINT32 = new r("uint32");
1303
+ static UINT32 = new n("uint32");
1220
1304
  /** Represents a 16-bit unsigned integer value. */
1221
- static UINT16 = new r("uint16");
1305
+ static UINT16 = new n("uint16");
1222
1306
  /** Represents a 8-bit unsigned integer value. */
1223
- static UINT8 = new r("uint8");
1307
+ static UINT8 = new n("uint8");
1224
1308
  /** Represents a boolean value. Alias for UINT8. */
1225
1309
  static BOOLEAN = this.UINT8;
1226
1310
  /** Represents a 64-bit unix epoch. */
1227
- static TIMESTAMP = new r("timestamp");
1311
+ static TIMESTAMP = new n("timestamp");
1228
1312
  /** Represents a UUID data type */
1229
- static UUID = new r("uuid");
1313
+ static UUID = new n("uuid");
1230
1314
  /** Represents a string data type. Strings have an unknown density, and are separate
1231
1315
  * by a newline character. */
1232
- static STRING = new r("string");
1316
+ static STRING = new n("string");
1233
1317
  /** Represents a JSON data type. JSON has an unknown density, and is separated by a
1234
1318
  * newline character. */
1235
- static JSON = new r("json");
1319
+ static JSON = new n("json");
1236
1320
  static ARRAY_CONSTRUCTORS = /* @__PURE__ */ new Map([
1237
- [r.UINT8.toString(), Uint8Array],
1238
- [r.UINT16.toString(), Uint16Array],
1239
- [r.UINT32.toString(), Uint32Array],
1240
- [r.UINT64.toString(), BigUint64Array],
1241
- [r.FLOAT32.toString(), Float32Array],
1242
- [r.FLOAT64.toString(), Float64Array],
1243
- [r.INT8.toString(), Int8Array],
1244
- [r.INT16.toString(), Int16Array],
1245
- [r.INT32.toString(), Int32Array],
1246
- [r.INT64.toString(), BigInt64Array],
1247
- [r.TIMESTAMP.toString(), BigInt64Array],
1248
- [r.STRING.toString(), Uint8Array],
1249
- [r.JSON.toString(), Uint8Array],
1250
- [r.UUID.toString(), Uint8Array]
1321
+ [n.UINT8.toString(), Uint8Array],
1322
+ [n.UINT16.toString(), Uint16Array],
1323
+ [n.UINT32.toString(), Uint32Array],
1324
+ [n.UINT64.toString(), BigUint64Array],
1325
+ [n.FLOAT32.toString(), Float32Array],
1326
+ [n.FLOAT64.toString(), Float64Array],
1327
+ [n.INT8.toString(), Int8Array],
1328
+ [n.INT16.toString(), Int16Array],
1329
+ [n.INT32.toString(), Int32Array],
1330
+ [n.INT64.toString(), BigInt64Array],
1331
+ [n.TIMESTAMP.toString(), BigInt64Array],
1332
+ [n.STRING.toString(), Uint8Array],
1333
+ [n.JSON.toString(), Uint8Array],
1334
+ [n.UUID.toString(), Uint8Array]
1251
1335
  ]);
1252
1336
  static ARRAY_CONSTRUCTOR_DATA_TYPES = /* @__PURE__ */ new Map([
1253
- [Uint8Array.name, r.UINT8],
1254
- [Uint16Array.name, r.UINT16],
1255
- [Uint32Array.name, r.UINT32],
1256
- [BigUint64Array.name, r.UINT64],
1257
- [Float32Array.name, r.FLOAT32],
1258
- [Float64Array.name, r.FLOAT64],
1259
- [Int8Array.name, r.INT8],
1260
- [Int16Array.name, r.INT16],
1261
- [Int32Array.name, r.INT32],
1262
- [BigInt64Array.name, r.INT64]
1337
+ [Uint8Array.name, n.UINT8],
1338
+ [Uint16Array.name, n.UINT16],
1339
+ [Uint32Array.name, n.UINT32],
1340
+ [BigUint64Array.name, n.UINT64],
1341
+ [Float32Array.name, n.FLOAT32],
1342
+ [Float64Array.name, n.FLOAT64],
1343
+ [Int8Array.name, n.INT8],
1344
+ [Int16Array.name, n.INT16],
1345
+ [Int32Array.name, n.INT32],
1346
+ [BigInt64Array.name, n.INT64]
1263
1347
  ]);
1264
1348
  static DENSITIES = /* @__PURE__ */ new Map([
1265
- [r.UINT8.toString(), d.BIT8],
1266
- [r.UINT16.toString(), d.BIT16],
1267
- [r.UINT32.toString(), d.BIT32],
1268
- [r.UINT64.toString(), d.BIT64],
1269
- [r.FLOAT32.toString(), d.BIT32],
1270
- [r.FLOAT64.toString(), d.BIT64],
1271
- [r.INT8.toString(), d.BIT8],
1272
- [r.INT16.toString(), d.BIT16],
1273
- [r.INT32.toString(), d.BIT32],
1274
- [r.INT64.toString(), d.BIT64],
1275
- [r.TIMESTAMP.toString(), d.BIT64],
1276
- [r.STRING.toString(), d.UNKNOWN],
1277
- [r.JSON.toString(), d.UNKNOWN],
1278
- [r.UUID.toString(), d.BIT128]
1349
+ [n.UINT8.toString(), d.BIT8],
1350
+ [n.UINT16.toString(), d.BIT16],
1351
+ [n.UINT32.toString(), d.BIT32],
1352
+ [n.UINT64.toString(), d.BIT64],
1353
+ [n.FLOAT32.toString(), d.BIT32],
1354
+ [n.FLOAT64.toString(), d.BIT64],
1355
+ [n.INT8.toString(), d.BIT8],
1356
+ [n.INT16.toString(), d.BIT16],
1357
+ [n.INT32.toString(), d.BIT32],
1358
+ [n.INT64.toString(), d.BIT64],
1359
+ [n.TIMESTAMP.toString(), d.BIT64],
1360
+ [n.STRING.toString(), d.UNKNOWN],
1361
+ [n.JSON.toString(), d.UNKNOWN],
1362
+ [n.UUID.toString(), d.BIT128]
1279
1363
  ]);
1280
1364
  /** All the data types. */
1281
1365
  static ALL = [
1282
- r.UNKNOWN,
1283
- r.FLOAT64,
1284
- r.FLOAT32,
1285
- r.INT64,
1286
- r.INT32,
1287
- r.INT16,
1288
- r.INT8,
1289
- r.UINT64,
1290
- r.UINT32,
1291
- r.UINT16,
1292
- r.UINT8,
1293
- r.TIMESTAMP,
1294
- r.UUID,
1295
- r.STRING,
1296
- r.JSON
1366
+ n.UNKNOWN,
1367
+ n.FLOAT64,
1368
+ n.FLOAT32,
1369
+ n.INT64,
1370
+ n.INT32,
1371
+ n.INT16,
1372
+ n.INT8,
1373
+ n.UINT64,
1374
+ n.UINT32,
1375
+ n.UINT16,
1376
+ n.UINT8,
1377
+ n.TIMESTAMP,
1378
+ n.UUID,
1379
+ n.STRING,
1380
+ n.JSON
1297
1381
  ];
1298
- static BIG_INT_TYPES = [r.INT64, r.UINT64, r.TIMESTAMP];
1382
+ static BIG_INT_TYPES = [n.INT64, n.UINT64, n.TIMESTAMP];
1299
1383
  /** A zod schema for a DataType. */
1300
1384
  static z = o.union([
1301
- o.string().transform((t) => new r(t)),
1302
- o.instanceof(r)
1385
+ o.string().transform((t) => new n(t)),
1386
+ o.instanceof(n)
1303
1387
  ]);
1304
1388
  }
1305
- class h extends M {
1389
+ class c extends C {
1306
1390
  constructor(t) {
1307
1391
  super(t.valueOf());
1308
1392
  }
@@ -1316,41 +1400,59 @@ class h extends M {
1316
1400
  }
1317
1401
  /** @returns a new Size representing the sum of the two Sizes. */
1318
1402
  add(t) {
1319
- return h.bytes(this.valueOf() + t.valueOf());
1403
+ return new c(p(this.valueOf(), t.valueOf()));
1320
1404
  }
1321
1405
  /** @returns a new Size representing the difference of the two Sizes. */
1322
1406
  sub(t) {
1323
- return h.bytes(this.valueOf() - t.valueOf());
1407
+ return new c(L(this.valueOf(), t.valueOf()));
1408
+ }
1409
+ /**
1410
+ * Multiplies this Size by a scalar value.
1411
+ *
1412
+ * @param value - The scalar value to multiply by.
1413
+ * @returns A new Size representing this Size multiplied by the value.
1414
+ */
1415
+ mult(t) {
1416
+ return new c(N(this.valueOf(), t));
1417
+ }
1418
+ /**
1419
+ * Divides this Size by a scalar value.
1420
+ *
1421
+ * @param value - The scalar value to divide by.
1422
+ * @returns A new Size representing this Size divided by the value.
1423
+ */
1424
+ div(t) {
1425
+ return new c(S(this.valueOf(), t));
1324
1426
  }
1325
1427
  /** @returns a new Size representing the truncated value of the Size. */
1326
1428
  truncate(t) {
1327
- return new h(Math.trunc(this.valueOf() / t.valueOf()) * t.valueOf());
1429
+ return new c(Math.trunc(this.valueOf() / t.valueOf()) * t.valueOf());
1328
1430
  }
1329
1431
  /** @returns a new Size representing the remainder of the Size. */
1330
1432
  remainder(t) {
1331
- return h.bytes(this.valueOf() % t.valueOf());
1433
+ return c.bytes(this.valueOf() % t.valueOf());
1332
1434
  }
1333
1435
  /** @returns the number of gigabytes in the Size. */
1334
1436
  get gigabytes() {
1335
- return this.valueOf() / h.GIGABYTE.valueOf();
1437
+ return this.valueOf() / c.GIGABYTE.valueOf();
1336
1438
  }
1337
1439
  /** @returns the number of megabytes in the Size. */
1338
1440
  get megabytes() {
1339
- return this.valueOf() / h.MEGABYTE.valueOf();
1441
+ return this.valueOf() / c.MEGABYTE.valueOf();
1340
1442
  }
1341
1443
  /** @returns the number of kilobytes in the Size. */
1342
1444
  get kilobytes() {
1343
- return this.valueOf() / h.KILOBYTE.valueOf();
1445
+ return this.valueOf() / c.KILOBYTE.valueOf();
1344
1446
  }
1345
1447
  /** @returns the number of terabytes in the Size. */
1346
1448
  get terabytes() {
1347
- return this.valueOf() / h.TERABYTE.valueOf();
1449
+ return this.valueOf() / c.TERABYTE.valueOf();
1348
1450
  }
1349
1451
  /** @returns a nicely formatted string representation of the Size. */
1350
1452
  toString() {
1351
- const t = this.truncate(h.TERABYTE), e = this.truncate(h.GIGABYTE), s = this.truncate(h.MEGABYTE), u = this.truncate(h.KILOBYTE), f = this.truncate(h.BYTE), c = t, y = e.sub(t), g = s.sub(e), b = u.sub(s), N = f.sub(u);
1352
- let l = "";
1353
- return c.isZero || (l += `${c.terabytes}TB `), y.isZero || (l += `${y.gigabytes}GB `), g.isZero || (l += `${g.megabytes}MB `), b.isZero || (l += `${b.kilobytes}KB `), (!N.isZero || l === "") && (l += `${N.valueOf()}B`), l.trim();
1453
+ const t = this.truncate(c.TERABYTE), e = this.truncate(c.GIGABYTE), s = this.truncate(c.MEGABYTE), u = this.truncate(c.KILOBYTE), l = this.truncate(c.BYTE), h = t, U = e.sub(t), y = s.sub(e), g = u.sub(s), m = l.sub(u);
1454
+ let b = "";
1455
+ return h.isZero || (b += `${h.terabytes}TB `), U.isZero || (b += `${U.gigabytes}GB `), y.isZero || (b += `${y.megabytes}MB `), g.isZero || (b += `${g.kilobytes}KB `), (!m.isZero || b === "") && (b += `${m.valueOf()}B`), b.trim();
1354
1456
  }
1355
1457
  /**
1356
1458
  * Creates a Size from the given number of bytes.
@@ -1359,10 +1461,10 @@ class h extends M {
1359
1461
  * @returns A Size representing the given number of bytes.
1360
1462
  */
1361
1463
  static bytes(t = 1) {
1362
- return new h(t);
1464
+ return new c(t);
1363
1465
  }
1364
1466
  /** A single byte */
1365
- static BYTE = new h(1);
1467
+ static BYTE = new c(1);
1366
1468
  /**
1367
1469
  * Creates a Size from the given number if kilobytes.
1368
1470
  *
@@ -1370,10 +1472,10 @@ class h extends M {
1370
1472
  * @returns A Size representing the given number of kilobytes.
1371
1473
  */
1372
1474
  static kilobytes(t = 1) {
1373
- return h.bytes(t.valueOf() * 1e3);
1475
+ return c.bytes(t.valueOf() * 1e3);
1374
1476
  }
1375
1477
  /** A kilobyte */
1376
- static KILOBYTE = h.kilobytes(1);
1478
+ static KILOBYTE = c.kilobytes(1);
1377
1479
  /**
1378
1480
  * Creates a Size from the given number of megabytes.
1379
1481
  *
@@ -1381,10 +1483,10 @@ class h extends M {
1381
1483
  * @returns A Size representing the given number of megabytes.
1382
1484
  */
1383
1485
  static megabytes(t = 1) {
1384
- return h.kilobytes(t.valueOf() * 1e3);
1486
+ return c.kilobytes(t.valueOf() * 1e3);
1385
1487
  }
1386
1488
  /** A megabyte */
1387
- static MEGABYTE = h.megabytes(1);
1489
+ static MEGABYTE = c.megabytes(1);
1388
1490
  /**
1389
1491
  * Creates a Size from the given number of gigabytes.
1390
1492
  *
@@ -1392,10 +1494,10 @@ class h extends M {
1392
1494
  * @returns A Size representing the given number of gigabytes.
1393
1495
  */
1394
1496
  static gigabytes(t = 1) {
1395
- return h.megabytes(t.valueOf() * 1e3);
1497
+ return c.megabytes(t.valueOf() * 1e3);
1396
1498
  }
1397
1499
  /** A gigabyte */
1398
- static GIGABYTE = h.gigabytes(1);
1500
+ static GIGABYTE = c.gigabytes(1);
1399
1501
  /**
1400
1502
  * Creates a Size from the given number of terabytes.
1401
1503
  *
@@ -1403,23 +1505,23 @@ class h extends M {
1403
1505
  * @returns A Size representing the given number of terabytes.
1404
1506
  */
1405
1507
  static terabytes(t) {
1406
- return h.gigabytes(t.valueOf() * 1e3);
1508
+ return c.gigabytes(t.valueOf() * 1e3);
1407
1509
  }
1408
1510
  /** A terabyte. */
1409
- static TERABYTE = h.terabytes(1);
1511
+ static TERABYTE = c.terabytes(1);
1410
1512
  /** The zero value for Size */
1411
- static ZERO = new h(0);
1513
+ static ZERO = new c(0);
1412
1514
  /** A zod schema for a Size. */
1413
1515
  static z = o.union([
1414
- o.number().transform((t) => new h(t)),
1415
- o.instanceof(h)
1516
+ o.number().transform((t) => new c(t)),
1517
+ o.instanceof(c)
1416
1518
  ]);
1417
1519
  /** @returns true if the Size is zero. */
1418
1520
  get isZero() {
1419
1521
  return this.valueOf() === 0;
1420
1522
  }
1421
1523
  }
1422
- const Yt = o.union([
1524
+ const Jt = o.union([
1423
1525
  o.instanceof(Uint8Array),
1424
1526
  o.instanceof(Uint16Array),
1425
1527
  o.instanceof(Uint32Array),
@@ -1430,64 +1532,64 @@ const Yt = o.union([
1430
1532
  o.instanceof(Int16Array),
1431
1533
  o.instanceof(Int32Array),
1432
1534
  o.instanceof(BigInt64Array)
1433
- ]), H = (i) => {
1434
- const t = typeof i;
1435
- return t === "string" || t === "number" || t === "boolean" || t === "bigint" || i instanceof n || i instanceof a || i instanceof Date;
1436
- }, ot = (i, t, e, s = 0) => i.usesBigInt && !t.usesBigInt ? Number(e) - Number(s) : !i.usesBigInt && t.usesBigInt ? BigInt(e.valueOf()) - BigInt(s.valueOf()) : x(e, -s), x = (i, t) => t == 0 ? i : i == 0 ? t : typeof i == "bigint" && typeof t == "bigint" || typeof i == "number" && typeof t == "number" ? i + t : Number(i) + Number(t), lt = "00000000-0000-0000-0000-000000000000", ft = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1437
- function ct(i) {
1438
- return typeof i == "string" && ft.test(i);
1535
+ ]), z = (a) => {
1536
+ const t = typeof a;
1537
+ return t === "string" || t === "number" || t === "boolean" || t === "bigint" || a instanceof r || a instanceof i || a instanceof Date;
1538
+ }, dt = (a, t, e, s = 0) => a.usesBigInt && !t.usesBigInt ? Number(e) - Number(s) : !a.usesBigInt && t.usesBigInt ? BigInt(e.valueOf()) - BigInt(s.valueOf()) : T(e, -s), T = (a, t) => t == 0 ? a : a == 0 ? t : typeof a == "bigint" && typeof t == "bigint" || typeof a == "number" && typeof t == "number" ? a + t : Number(a) + Number(t), gt = "00000000-0000-0000-0000-000000000000", Ot = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1539
+ function wt(a) {
1540
+ return typeof a == "string" && Ot.test(a);
1439
1541
  }
1440
1542
  const O = [];
1441
- for (let i = 0; i < 256; ++i)
1442
- O.push((i + 256).toString(16).slice(1));
1443
- function K(i, t = 0) {
1444
- return (O[i[t + 0]] + O[i[t + 1]] + O[i[t + 2]] + O[i[t + 3]] + "-" + O[i[t + 4]] + O[i[t + 5]] + "-" + O[i[t + 6]] + O[i[t + 7]] + "-" + O[i[t + 8]] + O[i[t + 9]] + "-" + O[i[t + 10]] + O[i[t + 11]] + O[i[t + 12]] + O[i[t + 13]] + O[i[t + 14]] + O[i[t + 15]]).toLowerCase();
1543
+ for (let a = 0; a < 256; ++a)
1544
+ O.push((a + 256).toString(16).slice(1));
1545
+ function _(a, t = 0) {
1546
+ return (O[a[t + 0]] + O[a[t + 1]] + O[a[t + 2]] + O[a[t + 3]] + "-" + O[a[t + 4]] + O[a[t + 5]] + "-" + O[a[t + 6]] + O[a[t + 7]] + "-" + O[a[t + 8]] + O[a[t + 9]] + "-" + O[a[t + 10]] + O[a[t + 11]] + O[a[t + 12]] + O[a[t + 13]] + O[a[t + 14]] + O[a[t + 15]]).toLowerCase();
1445
1547
  }
1446
- function ht(i, t = 0) {
1447
- const e = K(i, t);
1448
- if (!ct(e))
1548
+ function bt(a, t = 0) {
1549
+ const e = _(a, t);
1550
+ if (!wt(e))
1449
1551
  throw TypeError("Stringified UUID is invalid");
1450
1552
  return e;
1451
1553
  }
1452
- let T;
1453
- const dt = new Uint8Array(16);
1454
- function gt() {
1455
- if (!T) {
1554
+ let q;
1555
+ const It = new Uint8Array(16);
1556
+ function yt() {
1557
+ if (!q) {
1456
1558
  if (typeof crypto > "u" || !crypto.getRandomValues)
1457
1559
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1458
- T = crypto.getRandomValues.bind(crypto);
1560
+ q = crypto.getRandomValues.bind(crypto);
1459
1561
  }
1460
- return T(dt);
1562
+ return q(It);
1461
1563
  }
1462
- const Ot = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Z = { randomUUID: Ot };
1463
- function wt(i, t, e) {
1464
- if (Z.randomUUID && !i)
1465
- return Z.randomUUID();
1466
- i = i || {};
1467
- const s = i.random ?? i.rng?.() ?? gt();
1564
+ const mt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), G = { randomUUID: mt };
1565
+ function Nt(a, t, e) {
1566
+ if (G.randomUUID && !a)
1567
+ return G.randomUUID();
1568
+ a = a || {};
1569
+ const s = a.random ?? a.rng?.() ?? yt();
1468
1570
  if (s.length < 16)
1469
1571
  throw new Error("Random bytes length must be >= 16");
1470
- return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, K(s);
1572
+ return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, _(s);
1471
1573
  }
1472
- const bt = () => wt(), P = (i, t) => ht(i, t), It = lt, Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1574
+ const vt = () => Nt(), Z = (a, t) => bt(a, t), Ut = gt, jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1473
1575
  __proto__: null,
1474
- ZERO: It,
1475
- create: bt,
1476
- parse: P
1477
- }, Symbol.toStringTag, { value: "Module" })), A = -1, p = {
1478
- [Symbol.iterator]: () => p,
1576
+ ZERO: Ut,
1577
+ create: vt,
1578
+ parse: Z
1579
+ }, Symbol.toStringTag, { value: "Module" })), B = -1, F = {
1580
+ [Symbol.iterator]: () => F,
1479
1581
  next: () => ({ done: !0, value: void 0 })
1480
- }, yt = o.string().transform(
1481
- (i) => new Uint8Array(
1482
- atob(i).split("").map((t) => t.charCodeAt(0))
1582
+ }, At = o.string().transform(
1583
+ (a) => new Uint8Array(
1584
+ atob(a).split("").map((t) => t.charCodeAt(0))
1483
1585
  ).buffer
1484
- ), Nt = o.union([o.null(), o.undefined()]).transform(() => new Uint8Array().buffer), q = 10, D = (i, t) => {
1485
- if (i === "number" && !t.isNumeric)
1586
+ ), Mt = o.union([o.null(), o.undefined()]).transform(() => new Uint8Array().buffer), Y = 10, tt = (a, t) => {
1587
+ if (a === "number" && !t.isNumeric)
1486
1588
  throw new Error(`cannot convert series of type ${t.toString()} to number`);
1487
- if (i === "bigint" && !t.usesBigInt)
1589
+ if (a === "bigint" && !t.usesBigInt)
1488
1590
  throw new Error(`cannot convert series of type ${t.toString()} to bigint`);
1489
- }, X = "sy_x_telem_series";
1490
- class I {
1591
+ }, et = "sy_x_telem_series";
1592
+ class v {
1491
1593
  /**
1492
1594
  * A unique identifier for the series. If specified by the user, it is their
1493
1595
  * responsibility to ensure that it is unique. If not specified, a new ID will be
@@ -1498,7 +1600,7 @@ class I {
1498
1600
  * A discriminator used for identifying instances of the series class even
1499
1601
  * when bundlers mangle the class name.
1500
1602
  */
1501
- discriminator = X;
1603
+ discriminator = et;
1502
1604
  /** The data type of the series. */
1503
1605
  dataType;
1504
1606
  /**
@@ -1520,12 +1622,18 @@ class I {
1520
1622
  * group. Useful for defining the position of the series within a channel's data.
1521
1623
  */
1522
1624
  alignment = 0n;
1625
+ /**
1626
+ * Alignment multiple defines the number of alignment steps taken per sample. This is
1627
+ * useful for when the samples in a series represent a partial view of the raw data
1628
+ * i.e. decimation or averaging.
1629
+ */
1630
+ alignmentMultiple = 1n;
1523
1631
  /** A cached minimum value. */
1524
1632
  cachedMin;
1525
1633
  /** A cached maximum value. */
1526
1634
  cachedMax;
1527
1635
  /** The write position of the buffer. */
1528
- writePos = A;
1636
+ writePos = B;
1529
1637
  /** Tracks the number of entities currently using this array. */
1530
1638
  _refCount = 0;
1531
1639
  /** Caches the length of the array for variable length data types. */
@@ -1538,21 +1646,21 @@ class I {
1538
1646
  */
1539
1647
  static crudeZ = o.object({
1540
1648
  timeRange: w.z.optional(),
1541
- dataType: r.z,
1649
+ dataType: n.z,
1542
1650
  alignment: o.coerce.bigint().optional(),
1543
1651
  data: o.union([
1544
- yt,
1545
- Nt,
1652
+ At,
1653
+ Mt,
1546
1654
  o.instanceof(ArrayBuffer),
1547
1655
  o.instanceof(Uint8Array)
1548
1656
  ]),
1549
- glBufferUsage: at.optional().default("static").optional()
1657
+ glBufferUsage: ht.optional().default("static").optional()
1550
1658
  });
1551
1659
  /**
1552
1660
  * A zod schema that validates and constructs a series from it's crude
1553
1661
  * representation.
1554
1662
  */
1555
- static z = I.crudeZ.transform((t) => new I(t));
1663
+ static z = v.crudeZ.transform((t) => new v(t));
1556
1664
  /**
1557
1665
  * The Series constructor accepts either a SeriesArgs object or a CrudeSeries value.
1558
1666
  *
@@ -1627,73 +1735,74 @@ class I {
1627
1735
  * @throws Error if data type cannot be inferred from input
1628
1736
  */
1629
1737
  constructor(t) {
1630
- mt(t) && (t = { data: t }), t.data ??= [];
1738
+ Et(t) && (t = { data: t }), t.data ??= [];
1631
1739
  const {
1632
1740
  dataType: e,
1633
1741
  timeRange: s,
1634
1742
  sampleOffset: u = 0,
1635
- glBufferUsage: f = "static",
1636
- alignment: c = 0n,
1637
- key: y = J(),
1743
+ glBufferUsage: l = "static",
1744
+ alignment: h = 0n,
1745
+ alignmentMultiple: U = 1n,
1746
+ key: y = X(),
1638
1747
  data: g
1639
1748
  } = t;
1640
- if (Q(g)) {
1641
- const l = g;
1642
- 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;
1749
+ if (st(g)) {
1750
+ const f = g;
1751
+ this.key = f.key, this.dataType = f.dataType, this.sampleOffset = f.sampleOffset, this.gl = f.gl, this._data = f._data, this.timeRange = f.timeRange, this.alignment = f.alignment, this.alignmentMultiple = f.alignmentMultiple, this.cachedMin = f.cachedMin, this.cachedMax = f.cachedMax, this.writePos = f.writePos, this._refCount = f._refCount, this.cachedLength = f.cachedLength;
1643
1752
  return;
1644
1753
  }
1645
- const b = H(g), N = Array.isArray(g);
1646
- if (e != null) this.dataType = new r(e);
1754
+ const m = z(g), b = Array.isArray(g);
1755
+ if (e != null) this.dataType = new n(e);
1647
1756
  else {
1648
1757
  if (g instanceof ArrayBuffer)
1649
1758
  throw new Error(
1650
1759
  "cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
1651
1760
  );
1652
- if (N || b) {
1653
- let l = g;
1654
- if (!b) {
1761
+ if (b || m) {
1762
+ let f = g;
1763
+ if (!m) {
1655
1764
  if (g.length === 0)
1656
1765
  throw new Error(
1657
1766
  "cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
1658
1767
  );
1659
- l = g[0];
1768
+ f = g[0];
1660
1769
  }
1661
- if (typeof l == "string") this.dataType = r.STRING;
1662
- else if (typeof l == "number") this.dataType = r.FLOAT64;
1663
- else if (typeof l == "bigint") this.dataType = r.INT64;
1664
- else if (typeof l == "boolean") this.dataType = r.BOOLEAN;
1665
- else if (l instanceof n || l instanceof Date || l instanceof n)
1666
- this.dataType = r.TIMESTAMP;
1667
- else if (typeof l == "object") this.dataType = r.JSON;
1770
+ if (typeof f == "string") this.dataType = n.STRING;
1771
+ else if (typeof f == "number") this.dataType = n.FLOAT64;
1772
+ else if (typeof f == "bigint") this.dataType = n.INT64;
1773
+ else if (typeof f == "boolean") this.dataType = n.BOOLEAN;
1774
+ else if (f instanceof r || f instanceof Date || f instanceof r)
1775
+ this.dataType = n.TIMESTAMP;
1776
+ else if (typeof f == "object") this.dataType = n.JSON;
1668
1777
  else
1669
1778
  throw new Error(
1670
- `cannot infer data type of ${typeof l} when constructing a Series from a JS array`
1779
+ `cannot infer data type of ${typeof f} when constructing a Series from a JS array`
1671
1780
  );
1672
- } else this.dataType = new r(g);
1781
+ } else this.dataType = new n(g);
1673
1782
  }
1674
- if (!N && !b) this._data = g;
1675
- else if (N && g.length === 0)
1783
+ if (!b && !m) this._data = g;
1784
+ else if (b && g.length === 0)
1676
1785
  this._data = new this.dataType.Array([]).buffer;
1677
1786
  else {
1678
- let l = b ? [g] : g;
1679
- const m = l[0];
1680
- (m instanceof n || m instanceof Date || m instanceof a) && (l = l.map((v) => new n(v).valueOf())), this.dataType.equals(r.STRING) ? (this.cachedLength = l.length, this._data = new TextEncoder().encode(`${l.join(`
1787
+ let f = m ? [g] : g;
1788
+ const A = f[0];
1789
+ (A instanceof r || A instanceof Date || A instanceof i) && (f = f.map((M) => new r(M).valueOf())), this.dataType.equals(n.STRING) ? (this.cachedLength = f.length, this._data = new TextEncoder().encode(`${f.join(`
1681
1790
  `)}
1682
- `).buffer) : this.dataType.equals(r.JSON) ? (this.cachedLength = l.length, this._data = new TextEncoder().encode(
1683
- `${l.map((v) => L.encodeString(v)).join(`
1791
+ `).buffer) : this.dataType.equals(n.JSON) ? (this.cachedLength = f.length, this._data = new TextEncoder().encode(
1792
+ `${f.map((M) => $.encodeString(M)).join(`
1684
1793
  `)}
1685
1794
  `
1686
- ).buffer) : this.dataType.usesBigInt && typeof m == "number" ? this._data = new this.dataType.Array(
1687
- l.map((v) => BigInt(Math.round(v)))
1688
- ).buffer : !this.dataType.usesBigInt && typeof m == "bigint" ? this._data = new this.dataType.Array(
1689
- l.map(Number)
1690
- ).buffer : this._data = new this.dataType.Array(l).buffer;
1795
+ ).buffer) : this.dataType.usesBigInt && typeof A == "number" ? this._data = new this.dataType.Array(
1796
+ f.map((M) => BigInt(Math.round(M)))
1797
+ ).buffer : !this.dataType.usesBigInt && typeof A == "bigint" ? this._data = new this.dataType.Array(
1798
+ f.map(Number)
1799
+ ).buffer : this._data = new this.dataType.Array(f).buffer;
1691
1800
  }
1692
- this.key = y, this.alignment = c, this.sampleOffset = u ?? 0, this.timeRange = s ?? w.ZERO, this.gl = {
1801
+ this.key = y, this.alignment = h, this.alignmentMultiple = U, this.sampleOffset = u ?? 0, this.timeRange = s ?? w.ZERO, this.gl = {
1693
1802
  control: null,
1694
1803
  buffer: null,
1695
1804
  prevBuffer: 0,
1696
- bufferUsage: f
1805
+ bufferUsage: l
1697
1806
  };
1698
1807
  }
1699
1808
  /**
@@ -1706,8 +1815,8 @@ class I {
1706
1815
  static alloc({ capacity: t, dataType: e, ...s }) {
1707
1816
  if (t === 0)
1708
1817
  throw new Error("[Series] - cannot allocate an array of length 0");
1709
- const u = new new r(e).Array(t), f = new I({ data: u.buffer, dataType: e, ...s });
1710
- return f.writePos = 0, f;
1818
+ const u = new new n(e).Array(t), l = new v({ data: u.buffer, dataType: e, ...s });
1819
+ return l.writePos = 0, l;
1711
1820
  }
1712
1821
  /**
1713
1822
  * @returns the number of references to this series i.e. the number of times this
@@ -1749,12 +1858,12 @@ class I {
1749
1858
  return this.dataType.isVariable ? this.writeVariable(t) : this.writeFixed(t);
1750
1859
  }
1751
1860
  writeVariable(t) {
1752
- if (this.writePos === A) return 0;
1861
+ if (this.writePos === B) return 0;
1753
1862
  const e = this.byteCapacity.valueOf() - this.writePos, s = t.subBytes(0, e);
1754
1863
  return this.writeToUnderlyingData(s), this.writePos += s.byteLength.valueOf(), this.cachedLength != null && (this.cachedLength += s.length, this.calculateCachedLength()), s.length;
1755
1864
  }
1756
1865
  writeFixed(t) {
1757
- if (this.writePos === A) return 0;
1866
+ if (this.writePos === B) return 0;
1758
1867
  const e = this.capacity - this.writePos, s = t.sub(0, e);
1759
1868
  return this.writeToUnderlyingData(s), this.cachedLength = void 0, this.maybeRecomputeMinMax(s), this.writePos += s.length, s.length;
1760
1869
  }
@@ -1777,7 +1886,7 @@ class I {
1777
1886
  * @returns A typed array containing the series data.
1778
1887
  */
1779
1888
  get data() {
1780
- return this.writePos === A ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
1889
+ return this.writePos === B ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
1781
1890
  }
1782
1891
  /**
1783
1892
  * Returns an array of the values in the series as strings.
@@ -1796,16 +1905,16 @@ class I {
1796
1905
  * @returns An array of values parsed from the JSON series.
1797
1906
  */
1798
1907
  parseJSON(t) {
1799
- if (!this.dataType.equals(r.JSON))
1908
+ if (!this.dataType.equals(n.JSON))
1800
1909
  throw new Error("cannot parse non-JSON series as JSON");
1801
- return this.toStrings().map((e) => t.parse(L.decodeString(e)));
1910
+ return this.toStrings().map((e) => t.parse($.decodeString(e)));
1802
1911
  }
1803
1912
  /**
1804
1913
  * Returns the capacity of the series in bytes.
1805
1914
  * @returns The size of the underlying buffer in bytes.
1806
1915
  */
1807
1916
  get byteCapacity() {
1808
- return new h(this.underlyingData.byteLength);
1917
+ return new c(this.underlyingData.byteLength);
1809
1918
  }
1810
1919
  /**
1811
1920
  * Returns the capacity of the series in samples.
@@ -1821,7 +1930,7 @@ class I {
1821
1930
  * @returns The size of the data in bytes.
1822
1931
  */
1823
1932
  get byteLength() {
1824
- return this.writePos === A ? this.byteCapacity : this.dataType.isVariable ? new h(this.writePos) : this.dataType.density.size(this.writePos);
1933
+ return this.writePos === B ? this.byteCapacity : this.dataType.isVariable ? new c(this.writePos) : this.dataType.density.size(this.writePos);
1825
1934
  }
1826
1935
  /**
1827
1936
  * Returns the number of samples in this array.
@@ -1829,7 +1938,7 @@ class I {
1829
1938
  * @returns The number of samples in the series.
1830
1939
  */
1831
1940
  get length() {
1832
- return this.cachedLength != null ? this.cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === A ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos;
1941
+ return this.cachedLength != null ? this.cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === B ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos;
1833
1942
  }
1834
1943
  calculateCachedLength() {
1835
1944
  if (!this.dataType.isVariable)
@@ -1837,7 +1946,7 @@ class I {
1837
1946
  let t = 0;
1838
1947
  const e = [0];
1839
1948
  return this.data.forEach((s, u) => {
1840
- s === q && (t++, e.push(u + 1));
1949
+ s === Y && (t++, e.push(u + 1));
1841
1950
  }), this._cachedIndexes = e, this.cachedLength = t, t;
1842
1951
  }
1843
1952
  /**
@@ -1853,8 +1962,8 @@ class I {
1853
1962
  if (this.dataType.equals(t)) return this;
1854
1963
  const s = new t.Array(this.length);
1855
1964
  for (let u = 0; u < this.length; u++)
1856
- s[u] = ot(this.dataType, t, this.data[u], e);
1857
- return new I({
1965
+ s[u] = dt(this.dataType, t, this.data[u], e);
1966
+ return new v({
1858
1967
  data: s.buffer,
1859
1968
  dataType: t,
1860
1969
  timeRange: this.timeRange,
@@ -1865,7 +1974,7 @@ class I {
1865
1974
  }
1866
1975
  calcRawMax() {
1867
1976
  if (this.length === 0) return -1 / 0;
1868
- if (this.dataType.equals(r.TIMESTAMP))
1977
+ if (this.dataType.equals(n.TIMESTAMP))
1869
1978
  this.cachedMax = this.data[this.data.length - 1];
1870
1979
  else if (this.dataType.usesBigInt) {
1871
1980
  const t = this.data;
@@ -1883,11 +1992,11 @@ class I {
1883
1992
  calcMax() {
1884
1993
  if (this.dataType.isVariable)
1885
1994
  throw new Error("cannot calculate maximum on a variable length data type");
1886
- return this.writePos === 0 ? -1 / 0 : (this.cachedMax ??= this.calcRawMax(), x(this.cachedMax, this.sampleOffset));
1995
+ return this.writePos === 0 ? -1 / 0 : (this.cachedMax ??= this.calcRawMax(), T(this.cachedMax, this.sampleOffset));
1887
1996
  }
1888
1997
  calcRawMin() {
1889
1998
  if (this.length === 0) return 1 / 0;
1890
- if (this.dataType.equals(r.TIMESTAMP)) this.cachedMin = this.data[0];
1999
+ if (this.dataType.equals(n.TIMESTAMP)) this.cachedMin = this.data[0];
1891
2000
  else if (this.dataType.usesBigInt) {
1892
2001
  const t = this.data;
1893
2002
  this.cachedMin = t.reduce((e, s) => e < s ? e : s);
@@ -1904,11 +2013,11 @@ class I {
1904
2013
  calcMin() {
1905
2014
  if (this.dataType.isVariable)
1906
2015
  throw new Error("cannot calculate minimum on a variable length data type");
1907
- return this.writePos === 0 ? 1 / 0 : (this.cachedMin ??= this.calcRawMin(), x(this.cachedMin, this.sampleOffset));
2016
+ return this.writePos === 0 ? 1 / 0 : (this.cachedMin ??= this.calcRawMin(), T(this.cachedMin, this.sampleOffset));
1908
2017
  }
1909
2018
  /** @returns the bounds of the series. */
1910
2019
  get bounds() {
1911
- return C(Number(this.min), Number(this.max), { makeValid: !1 });
2020
+ return x(Number(this.min), Number(this.max), { makeValid: !1 });
1912
2021
  }
1913
2022
  maybeRecomputeMinMax(t) {
1914
2023
  if (this.cachedMin != null) {
@@ -1921,7 +2030,7 @@ class I {
1921
2030
  }
1922
2031
  }
1923
2032
  atAlignment(t, e) {
1924
- const s = Number(t - this.alignment);
2033
+ const s = Number((t - this.alignment) / this.alignmentMultiple);
1925
2034
  if (s < 0 || s >= this.length) {
1926
2035
  if (e === !0) throw new Error(`[series] - no value at index ${s}`);
1927
2036
  return;
@@ -1930,18 +2039,18 @@ class I {
1930
2039
  }
1931
2040
  at(t, e = !1) {
1932
2041
  if (this.dataType.isVariable) return this.atVariable(t, e ?? !1);
1933
- if (this.dataType.equals(r.UUID)) return this.atUUID(t, e);
2042
+ if (this.dataType.equals(n.UUID)) return this.atUUID(t, e);
1934
2043
  t < 0 && (t = this.length + t);
1935
2044
  const s = this.data[t];
1936
2045
  if (s == null) {
1937
2046
  if (e === !0) throw new Error(`[series] - no value at index ${t}`);
1938
2047
  return;
1939
2048
  }
1940
- return x(s, this.sampleOffset);
2049
+ return T(s, this.sampleOffset);
1941
2050
  }
1942
2051
  atUUID(t, e) {
1943
2052
  t < 0 && (t = this.length + t);
1944
- const s = P(
2053
+ const s = Z(
1945
2054
  new Uint8Array(this.buffer, t * this.dataType.density.valueOf())
1946
2055
  );
1947
2056
  if (s == null) {
@@ -1956,21 +2065,21 @@ class I {
1956
2065
  s = this._cachedIndexes[t], u = this._cachedIndexes[t + 1] - 1;
1957
2066
  else {
1958
2067
  t < 0 && (t = this.length + t);
1959
- for (let c = 0; c < this.data.length; c++)
1960
- if (this.data[c] === q) {
2068
+ for (let h = 0; h < this.data.length; h++)
2069
+ if (this.data[h] === Y) {
1961
2070
  if (t === 0) {
1962
- u = c;
2071
+ u = h;
1963
2072
  break;
1964
2073
  }
1965
- s = c + 1, t--;
2074
+ s = h + 1, t--;
1966
2075
  }
1967
2076
  if (u === 0 && (u = this.data.length), s >= u || t > 0) {
1968
2077
  if (e) throw new Error(`[series] - no value at index ${t}`);
1969
2078
  return;
1970
2079
  }
1971
2080
  }
1972
- const f = this.data.slice(s, u);
1973
- return this.dataType.equals(r.STRING) ? new TextDecoder().decode(f) : z(JSON.parse(new TextDecoder().decode(f)));
2081
+ const l = this.data.slice(s, u);
2082
+ return this.dataType.equals(n.STRING) ? new TextDecoder().decode(l) : nt(JSON.parse(new TextDecoder().decode(l)));
1974
2083
  }
1975
2084
  /**
1976
2085
  * @returns the index of the first sample that is greater than or equal to the given value.
@@ -1979,11 +2088,11 @@ class I {
1979
2088
  */
1980
2089
  binarySearch(t) {
1981
2090
  let e = 0, s = this.length - 1;
1982
- const u = _(t);
2091
+ const u = rt(t);
1983
2092
  for (; e <= s; ) {
1984
- const f = Math.floor((e + s) / 2), c = u(this.at(f, !0), t);
1985
- if (c === 0) return f;
1986
- c < 0 ? e = f + 1 : s = f - 1;
2093
+ const l = Math.floor((e + s) / 2), h = u(this.at(l, !0), t);
2094
+ if (h === 0) return l;
2095
+ h < 0 ? e = l + 1 : s = l - 1;
1987
2096
  }
1988
2097
  return e;
1989
2098
  }
@@ -1995,23 +2104,23 @@ class I {
1995
2104
  * be the same buffer previously passed to {@method acquire} or {@method updateGLBuffer}.
1996
2105
  */
1997
2106
  updateGLBuffer(t) {
1998
- if (this.gl.control = t, !this.dataType.equals(r.FLOAT32) && !this.dataType.equals(r.UINT8))
2107
+ if (this.gl.control = t, !this.dataType.equals(n.FLOAT32) && !this.dataType.equals(n.UINT8))
1999
2108
  throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
2000
2109
  const { buffer: e, bufferUsage: s, prevBuffer: u } = this.gl;
2001
2110
  if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !== u)
2002
- if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !== A) {
2111
+ if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !== B) {
2003
2112
  u === 0 && t.bufferData(t.ARRAY_BUFFER, this.byteCapacity.valueOf(), t.STATIC_DRAW);
2004
- const f = this.dataType.density.size(u).valueOf(), c = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
2005
- t.bufferSubData(t.ARRAY_BUFFER, f, c.buffer), this.gl.prevBuffer = this.writePos;
2113
+ const l = this.dataType.density.size(u).valueOf(), h = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
2114
+ t.bufferSubData(t.ARRAY_BUFFER, l, h.buffer), this.gl.prevBuffer = this.writePos;
2006
2115
  } else
2007
2116
  t.bufferData(
2008
2117
  t.ARRAY_BUFFER,
2009
2118
  this.buffer,
2010
2119
  s === "static" ? t.STATIC_DRAW : t.DYNAMIC_DRAW
2011
- ), this.gl.prevBuffer = A;
2120
+ ), this.gl.prevBuffer = B;
2012
2121
  }
2013
2122
  as(t) {
2014
- return D(t, this.dataType), this;
2123
+ return tt(t, this.dataType), this;
2015
2124
  }
2016
2125
  /** @returns a digest containing information about the series. */
2017
2126
  get digest() {
@@ -2020,8 +2129,8 @@ class I {
2020
2129
  dataType: this.dataType.toString(),
2021
2130
  sampleOffset: this.sampleOffset,
2022
2131
  alignment: {
2023
- lower: k(this.alignmentBounds.lower),
2024
- upper: k(this.alignmentBounds.upper)
2132
+ lower: j(this.alignmentBounds.lower),
2133
+ upper: j(this.alignmentBounds.upper)
2025
2134
  },
2026
2135
  timeRange: this.timeRange.toString(),
2027
2136
  length: this.length,
@@ -2038,7 +2147,10 @@ class I {
2038
2147
  * is exclusive.
2039
2148
  */
2040
2149
  get alignmentBounds() {
2041
- return C(this.alignment, this.alignment + BigInt(this.length));
2150
+ return x(
2151
+ this.alignment,
2152
+ this.alignment + BigInt(this.length) * this.alignmentMultiple
2153
+ );
2042
2154
  }
2043
2155
  maybeGarbageCollectGLBuffer(t) {
2044
2156
  this.gl.buffer != null && (t.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
@@ -2055,10 +2167,10 @@ class I {
2055
2167
  }
2056
2168
  [Symbol.iterator]() {
2057
2169
  if (this.dataType.isVariable) {
2058
- const t = new vt(this);
2059
- return this.dataType.equals(r.JSON) ? new $(t) : t;
2170
+ const t = new Bt(this);
2171
+ return this.dataType.equals(n.JSON) ? new V(t) : t;
2060
2172
  }
2061
- return this.dataType.equals(r.UUID) ? new Ut(this) : new At(this);
2173
+ return this.dataType.equals(n.UUID) ? new Ct(this) : new xt(this);
2062
2174
  }
2063
2175
  /**
2064
2176
  * Returns a slice of the series from start to end.
@@ -2085,7 +2197,7 @@ class I {
2085
2197
  * @returns An iterator over the specified range.
2086
2198
  */
2087
2199
  subIterator(t, e) {
2088
- return new V(this, t, e ?? this.length);
2200
+ return new J(this, t, e ?? this.length);
2089
2201
  }
2090
2202
  /**
2091
2203
  * Returns an iterator over a portion of the series based on alignment.
@@ -2094,16 +2206,17 @@ class I {
2094
2206
  * @returns An iterator over the specified alignment range.
2095
2207
  */
2096
2208
  subAlignmentIterator(t, e) {
2097
- return new V(
2098
- this,
2099
- Number(t - this.alignment),
2100
- Number(e - this.alignment)
2209
+ const s = Math.ceil(
2210
+ Number(t - this.alignment) / Number(this.alignmentMultiple)
2211
+ ), u = Math.ceil(
2212
+ Number(e - this.alignment) / Number(this.alignmentMultiple)
2101
2213
  );
2214
+ return new J(this, s, u);
2102
2215
  }
2103
2216
  subBytes(t, e) {
2104
2217
  if (t >= 0 && (e == null || e >= this.byteLength.valueOf())) return this;
2105
2218
  const s = this.data.subarray(t, e);
2106
- return new I({
2219
+ return new v({
2107
2220
  data: s,
2108
2221
  dataType: this.dataType,
2109
2222
  timeRange: this.timeRange,
@@ -2115,7 +2228,7 @@ class I {
2115
2228
  sliceSub(t, e, s) {
2116
2229
  if (e <= 0 && (s == null || s >= this.length)) return this;
2117
2230
  let u;
2118
- return t ? u = this.data.subarray(e, s) : u = this.data.slice(e, s), new I({
2231
+ return t ? u = this.data.subarray(e, s) : u = this.data.slice(e, s), new v({
2119
2232
  data: u,
2120
2233
  dataType: this.dataType,
2121
2234
  timeRange: this.timeRange,
@@ -2130,7 +2243,7 @@ class I {
2130
2243
  * @returns A new series with the specified alignment.
2131
2244
  */
2132
2245
  reAlign(t) {
2133
- return new I({
2246
+ return new v({
2134
2247
  data: this.buffer,
2135
2248
  dataType: this.dataType,
2136
2249
  timeRange: w.ZERO,
@@ -2157,21 +2270,21 @@ class I {
2157
2270
  return t += "])", t;
2158
2271
  }
2159
2272
  }
2160
- const mt = (i) => i == null ? !1 : Array.isArray(i) || i instanceof ArrayBuffer || ArrayBuffer.isView(i) && !(i instanceof DataView) || i instanceof I ? !0 : H(i), Q = j(X, I);
2161
- class V {
2273
+ const Et = (a) => a == null ? !1 : Array.isArray(a) || a instanceof ArrayBuffer || ArrayBuffer.isView(a) && !(a instanceof DataView) || a instanceof v ? !0 : z(a), st = D(et, v);
2274
+ class J {
2162
2275
  series;
2163
2276
  end;
2164
2277
  index;
2165
2278
  constructor(t, e, s) {
2166
2279
  this.series = t;
2167
- const u = C(0, t.length);
2168
- this.end = Y(u, s), this.index = Y(u, e);
2280
+ const u = x(0, t.length + 1);
2281
+ this.end = k(u, s), this.index = k(u, e);
2169
2282
  }
2170
2283
  next() {
2171
2284
  return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
2172
2285
  }
2173
2286
  }
2174
- class vt {
2287
+ class Bt {
2175
2288
  series;
2176
2289
  index;
2177
2290
  decoder;
@@ -2184,12 +2297,12 @@ class vt {
2184
2297
  }
2185
2298
  next() {
2186
2299
  const t = this.index, e = this.series.data;
2187
- for (; this.index < e.length && e[this.index] !== q; ) this.index++;
2300
+ for (; this.index < e.length && e[this.index] !== Y; ) this.index++;
2188
2301
  const s = this.index;
2189
2302
  return t === s ? { done: !0, value: void 0 } : (this.index++, { done: !1, value: this.decoder.decode(this.series.buffer.slice(t, s)) });
2190
2303
  }
2191
2304
  }
2192
- class $ {
2305
+ class V {
2193
2306
  wrapped;
2194
2307
  static schema = o.record(o.string(), o.unknown());
2195
2308
  constructor(t) {
@@ -2199,27 +2312,27 @@ class $ {
2199
2312
  const t = this.wrapped.next();
2200
2313
  return t.done === !0 ? { done: !0, value: void 0 } : {
2201
2314
  done: !1,
2202
- value: L.decodeString(t.value, $.schema)
2315
+ value: $.decodeString(t.value, V.schema)
2203
2316
  };
2204
2317
  }
2205
2318
  }
2206
- class Ut {
2319
+ class Ct {
2207
2320
  series;
2208
2321
  index;
2209
2322
  data;
2210
2323
  density;
2211
2324
  constructor(t) {
2212
- if (!t.dataType.equals(r.UUID))
2325
+ if (!t.dataType.equals(n.UUID))
2213
2326
  throw new Error("cannot create a UUID series iterator for a non-UUID series");
2214
- this.series = t, this.index = 0, this.data = new Uint8Array(t.buffer), this.density = r.UUID.density.valueOf();
2327
+ this.series = t, this.index = 0, this.data = new Uint8Array(t.buffer), this.density = n.UUID.density.valueOf();
2215
2328
  }
2216
2329
  next() {
2217
2330
  if (this.index >= this.series.length) return { done: !0, value: void 0 };
2218
- const t = P(this.data, this.index * this.density);
2331
+ const t = Z(this.data, this.index * this.density);
2219
2332
  return this.index++, { done: !1, value: t };
2220
2333
  }
2221
2334
  }
2222
- class At {
2335
+ class xt {
2223
2336
  series;
2224
2337
  index;
2225
2338
  constructor(t) {
@@ -2232,7 +2345,7 @@ class At {
2232
2345
  };
2233
2346
  }
2234
2347
  }
2235
- class Vt {
2348
+ class Wt {
2236
2349
  /** The array of series in this collection */
2237
2350
  series;
2238
2351
  /**
@@ -2285,14 +2398,14 @@ class Vt {
2285
2398
  this.series = t;
2286
2399
  }
2287
2400
  as(t) {
2288
- return D(t, this.dataType), this;
2401
+ return tt(t, this.dataType), this;
2289
2402
  }
2290
2403
  /**
2291
2404
  * Returns the data type of the series in this collection. If the collection is empty,
2292
2405
  * returns DataType.UNKNOWN.
2293
2406
  */
2294
2407
  get dataType() {
2295
- return this.series.length === 0 ? r.UNKNOWN : this.series[0].dataType;
2408
+ return this.series.length === 0 ? n.UNKNOWN : this.series[0].dataType;
2296
2409
  }
2297
2410
  /**
2298
2411
  * Returns the combined time range of all series in the collection. If the collection
@@ -2318,7 +2431,7 @@ class Vt {
2318
2431
  * series + its length. If the collection is empty, returns bounds.construct(0n, 0n).
2319
2432
  */
2320
2433
  get alignmentBounds() {
2321
- return this.series.length === 0 ? C(0n, 0n) : C(
2434
+ return this.series.length === 0 ? x(0n, 0n) : x(
2322
2435
  this.series[0].alignmentBounds.lower,
2323
2436
  this.series[this.series.length - 1].alignmentBounds.upper
2324
2437
  );
@@ -2327,7 +2440,7 @@ class Vt {
2327
2440
  const e = () => new Error(
2328
2441
  `cannot push a ${t.dataType.toString()} series to a ${this.dataType.toString()} multi-series`
2329
2442
  ), s = t.dataType.equals(this.dataType);
2330
- if (Q(t)) {
2443
+ if (st(t)) {
2331
2444
  if (this.series.length !== 0 && !s) throw e();
2332
2445
  this.series.push(t);
2333
2446
  } else {
@@ -2364,7 +2477,7 @@ class Vt {
2364
2477
  * @returns An iterator over the specified range.
2365
2478
  */
2366
2479
  subIterator(t, e) {
2367
- return new S(this, t, e ?? this.length);
2480
+ return new P(this, t, e ?? this.length);
2368
2481
  }
2369
2482
  /**
2370
2483
  * Returns an iterator over a portion of the multi-series based on alignment.
@@ -2374,28 +2487,32 @@ class Vt {
2374
2487
  */
2375
2488
  subAlignmentIterator(t, e) {
2376
2489
  if (t >= this.alignmentBounds.upper || e <= this.alignmentBounds.lower)
2377
- return p;
2490
+ return F;
2378
2491
  let s = 0;
2379
- for (let f = 0; f < this.series.length; f++) {
2380
- const c = this.series[f];
2381
- if (t < c.alignment) break;
2382
- if (t >= c.alignmentBounds.upper) s += c.length;
2383
- else if (R(c.alignmentBounds, t)) {
2384
- s += Number(t - c.alignment);
2492
+ for (let l = 0; l < this.series.length; l++) {
2493
+ const h = this.series[l];
2494
+ if (t < h.alignment) break;
2495
+ if (t >= h.alignmentBounds.upper) s += h.length;
2496
+ else if (R(h.alignmentBounds, t)) {
2497
+ s += Math.ceil(
2498
+ Number(t - h.alignment) / Number(h.alignmentMultiple)
2499
+ );
2385
2500
  break;
2386
2501
  }
2387
2502
  }
2388
2503
  let u = 0;
2389
- for (let f = 0; f < this.series.length; f++) {
2390
- const c = this.series[f];
2391
- if (e < c.alignment) break;
2392
- if (e >= c.alignmentBounds.upper) u += c.length;
2393
- else if (R(c.alignmentBounds, e)) {
2394
- u += Number(e - c.alignment);
2504
+ for (let l = 0; l < this.series.length; l++) {
2505
+ const h = this.series[l];
2506
+ if (e < h.alignment) break;
2507
+ if (e >= h.alignmentBounds.upper) u += h.length;
2508
+ else if (R(h.alignmentBounds, e)) {
2509
+ u += Math.ceil(
2510
+ Number(e - h.alignment) / Number(h.alignmentMultiple)
2511
+ );
2395
2512
  break;
2396
2513
  }
2397
2514
  }
2398
- return new S(this, s, u);
2515
+ return new P(this, s, u);
2399
2516
  }
2400
2517
  /**
2401
2518
  * Returns an iterator over the specified alignment range and span.
@@ -2404,19 +2521,19 @@ class Vt {
2404
2521
  * @returns An iterator over the specified range.
2405
2522
  */
2406
2523
  subAlignmentSpanIterator(t, e) {
2407
- if (t >= this.alignmentBounds.upper) return p;
2524
+ if (t >= this.alignmentBounds.upper) return F;
2408
2525
  e = Math.min(e, Number(this.distance(t, this.alignmentBounds.upper)));
2409
2526
  let s = 0;
2410
2527
  for (let u = 0; u < this.series.length; u++) {
2411
- const f = this.series[u];
2412
- if (t < f.alignment) break;
2413
- if (t >= f.alignmentBounds.upper) s += f.length;
2414
- else if (R(f.alignmentBounds, t)) {
2415
- s += Number(t - f.alignment);
2528
+ const l = this.series[u];
2529
+ if (t < l.alignment) break;
2530
+ if (t >= l.alignmentBounds.upper) s += l.length;
2531
+ else if (R(l.alignmentBounds, t)) {
2532
+ s += Number(t - l.alignment);
2416
2533
  break;
2417
2534
  }
2418
2535
  }
2419
- return new S(this, s, s + e);
2536
+ return new P(this, s, s + e);
2420
2537
  }
2421
2538
  /**
2422
2539
  * Updates the WebGL buffer for all series in the collection.
@@ -2429,13 +2546,13 @@ class Vt {
2429
2546
  * Returns the bounds containing the minimum and maximum values across all series.
2430
2547
  */
2431
2548
  get bounds() {
2432
- return tt(this.series.map((t) => t.bounds));
2549
+ return it(this.series.map((t) => t.bounds));
2433
2550
  }
2434
2551
  /**
2435
2552
  * Returns the sum of the byte lengths of all series.
2436
2553
  */
2437
2554
  get byteLength() {
2438
- return new h(this.series.reduce((t, e) => t + e.byteLength.valueOf(), 0));
2555
+ return new c(this.series.reduce((t, e) => t + e.byteLength.valueOf(), 0));
2439
2556
  }
2440
2557
  /**
2441
2558
  * Returns a combined typed array containing all data from all series.
@@ -2456,7 +2573,7 @@ class Vt {
2456
2573
  */
2457
2574
  traverseAlignment(t, e) {
2458
2575
  const s = this.series.map((u) => u.alignmentBounds);
2459
- return et(s, t, e);
2576
+ return at(s, t, e);
2460
2577
  }
2461
2578
  /**
2462
2579
  * Acquires a reference to the WebGL buffer for all series.
@@ -2479,7 +2596,7 @@ class Vt {
2479
2596
  */
2480
2597
  distance(t, e) {
2481
2598
  const s = this.series.map((u) => u.alignmentBounds);
2482
- return st(s, t, e);
2599
+ return ut(s, t, e);
2483
2600
  }
2484
2601
  /**
2485
2602
  * Parses a JSON multi-series into an array of values using the provided zod schema.
@@ -2489,7 +2606,7 @@ class Vt {
2489
2606
  * @returns An array of values parsed from the JSON series.
2490
2607
  */
2491
2608
  parseJSON(t) {
2492
- if (!this.dataType.equals(r.JSON))
2609
+ if (!this.dataType.equals(n.JSON))
2493
2610
  throw new Error("cannot parse non-JSON series as JSON");
2494
2611
  return this.series.flatMap((e) => e.parseJSON(t));
2495
2612
  }
@@ -2502,7 +2619,7 @@ class Vt {
2502
2619
  next() {
2503
2620
  return { done: !0, value: void 0 };
2504
2621
  }
2505
- } : new Et(this.series);
2622
+ } : new Rt(this.series);
2506
2623
  }
2507
2624
  /**
2508
2625
  * Returns an array of the values in the multi-series as strings.
@@ -2513,7 +2630,7 @@ class Vt {
2513
2630
  return this.series.flatMap((t) => t.toStrings());
2514
2631
  }
2515
2632
  }
2516
- class Et {
2633
+ class Rt {
2517
2634
  series;
2518
2635
  seriesIndex;
2519
2636
  internal;
@@ -2528,7 +2645,7 @@ class Et {
2528
2645
  return this;
2529
2646
  }
2530
2647
  }
2531
- class S {
2648
+ class P {
2532
2649
  series;
2533
2650
  index;
2534
2651
  end;
@@ -2542,27 +2659,27 @@ class S {
2542
2659
  return this;
2543
2660
  }
2544
2661
  }
2545
- const k = (i) => {
2546
- const t = i >> 32n, e = i & 0xffffffffn;
2662
+ const j = (a) => {
2663
+ const t = a >> 32n, e = a & 0xffffffffn;
2547
2664
  return { domain: t, sample: e };
2548
2665
  };
2549
2666
  export {
2550
2667
  d as D,
2551
- Vt as M,
2552
- E as R,
2553
- I as S,
2554
- n as T,
2555
- a,
2668
+ Wt as M,
2669
+ I as R,
2670
+ v as S,
2671
+ r as T,
2672
+ i as a,
2556
2673
  w as b,
2557
- r as c,
2558
- h as d,
2559
- H as e,
2560
- ot as f,
2561
- x as g,
2562
- J as h,
2563
- mt as i,
2564
- $t as j,
2565
- Ft as m,
2566
- Yt as t,
2567
- Zt as u
2674
+ n as c,
2675
+ c as d,
2676
+ z as e,
2677
+ dt as f,
2678
+ T as g,
2679
+ X as h,
2680
+ Et as i,
2681
+ kt as j,
2682
+ Gt as m,
2683
+ Jt as t,
2684
+ jt as u
2568
2685
  };