@synnaxlabs/x 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +30 -30
- package/dist/bounds-8aFLdbEj.cjs +1 -0
- package/dist/{bounds-CFI9wDXn.js → bounds-BtccGJW0.js} +22 -18
- package/dist/bounds.cjs +1 -1
- package/dist/bounds.js +1 -1
- package/dist/{box-Mf8E1Ypp.cjs → box-BpSX4si6.cjs} +1 -1
- package/dist/{box-DVCNGsJG.js → box-CYXc9-qp.js} +2 -2
- package/dist/box.cjs +1 -1
- package/dist/box.js +1 -1
- package/dist/deep.cjs +1 -1
- package/dist/deep.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +169 -151
- package/dist/location-Cn1ByVTZ.js +95 -0
- package/dist/location-DLP2ZS0o.cjs +1 -0
- package/dist/location.cjs +1 -1
- package/dist/location.js +1 -1
- package/dist/path-1tZLZ4AN.cjs +1 -0
- package/dist/path-DD6ytXzr.js +76 -0
- package/dist/{position-CFc9RsSn.js → position-DJXB-pDS.js} +2 -2
- package/dist/{position-DKhPhvPh.cjs → position-JCN6-sJC.cjs} +1 -1
- package/dist/position.cjs +1 -1
- package/dist/position.js +1 -1
- package/dist/record.cjs +1 -1
- package/dist/record.js +5 -4
- package/dist/scale-BI4wJF3b.cjs +1 -0
- package/dist/{scale-DNQE1LMm.js → scale-rZ1YKDFy.js} +70 -67
- package/dist/scale.cjs +1 -1
- package/dist/scale.js +1 -1
- package/dist/series-BN9CILsQ.cjs +11 -0
- package/dist/{series-sjWkW8qe.js → series-CnEQe1dh.js} +473 -370
- package/dist/spatial.cjs +1 -1
- package/dist/spatial.js +6 -6
- package/dist/src/breaker/breaker.d.ts +33 -0
- package/dist/src/breaker/breaker.d.ts.map +1 -0
- package/dist/src/breaker/breaker.spec.d.ts +2 -0
- package/dist/src/breaker/breaker.spec.d.ts.map +1 -0
- package/dist/src/breaker/index.d.ts +2 -0
- package/dist/src/breaker/index.d.ts.map +1 -0
- package/dist/src/change/change.d.ts +5 -5
- package/dist/src/change/change.d.ts.map +1 -1
- package/dist/src/control/control.d.ts +5 -5
- package/dist/src/control/control.d.ts.map +1 -1
- package/dist/src/deep/path.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mock/MockGLBufferController.d.ts +2 -2
- package/dist/src/mock/MockGLBufferController.d.ts.map +1 -1
- package/dist/src/record.d.ts +1 -0
- package/dist/src/record.d.ts.map +1 -1
- package/dist/src/record.spec.d.ts +2 -0
- package/dist/src/record.spec.d.ts.map +1 -0
- package/dist/src/sleep/index.d.ts +2 -0
- package/dist/src/sleep/index.d.ts.map +1 -0
- package/dist/src/sleep/sleep.d.ts +3 -0
- package/dist/src/sleep/sleep.d.ts.map +1 -0
- package/dist/src/spatial/bounds/bounds.d.ts +12 -0
- package/dist/src/spatial/bounds/bounds.d.ts.map +1 -1
- package/dist/src/spatial/location/location.d.ts +1 -0
- package/dist/src/spatial/location/location.d.ts.map +1 -1
- package/dist/src/spatial/scale/scale.d.ts +17 -1
- package/dist/src/spatial/scale/scale.d.ts.map +1 -1
- package/dist/src/spatial/xy/xy.d.ts +36 -1
- package/dist/src/spatial/xy/xy.d.ts.map +1 -1
- package/dist/src/telem/gl.d.ts +2 -2
- package/dist/src/telem/gl.d.ts.map +1 -1
- package/dist/src/telem/series.d.ts +16 -9
- package/dist/src/telem/series.d.ts.map +1 -1
- package/dist/src/telem/telem.d.ts +43 -2
- package/dist/src/telem/telem.d.ts.map +1 -1
- package/dist/src/zodutil/zodutil.d.ts.map +1 -1
- package/dist/telem.cjs +1 -1
- package/dist/telem.js +11 -10
- package/dist/xy-DQdccWlc.js +128 -0
- package/dist/xy-LADI2wVU.cjs +1 -0
- package/dist/xy.cjs +1 -1
- package/dist/xy.js +1 -1
- package/dist/zodutil-BRjUdYAv.cjs +1 -0
- package/dist/{zodutil-Tmuc4CNq.js → zodutil-DI4gVZkT.js} +11 -11
- package/dist/zodutil.cjs +1 -1
- package/dist/zodutil.js +1 -1
- package/package.json +64 -65
- package/src/binary/encoder.ts +3 -3
- package/src/breaker/breaker.spec.ts +74 -0
- package/src/breaker/breaker.ts +32 -0
- package/src/breaker/index.ts +1 -0
- package/src/deep/path.ts +6 -1
- package/src/index.ts +1 -0
- package/src/mock/MockGLBufferController.ts +6 -6
- package/src/record.spec.ts +29 -0
- package/src/record.ts +6 -0
- package/src/sleep/index.ts +1 -0
- package/src/sleep/sleep.ts +6 -0
- package/src/spatial/bounds/bounds.spec.ts +6 -0
- package/src/spatial/bounds/bounds.ts +16 -0
- package/src/spatial/location/location.ts +1 -0
- package/src/spatial/scale/scale.spec.ts +62 -51
- package/src/spatial/scale/scale.ts +21 -12
- package/src/spatial/xy/xy.spec.ts +22 -1
- package/src/spatial/xy/xy.ts +101 -5
- package/src/strings/strings.spec.ts +0 -4
- package/src/telem/gl.ts +6 -2
- package/src/telem/series.spec.ts +3 -3
- package/src/telem/series.ts +45 -16
- package/src/telem/telem.ts +121 -2
- package/src/zodutil/zodutil.ts +4 -1
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/bounds-DzCDHgdE.cjs +0 -1
- package/dist/location-CI9x53qR.js +0 -94
- package/dist/location-DetomF8Z.cjs +0 -1
- package/dist/path-BBCx3K6k.cjs +0 -1
- package/dist/path-CmnoH3RC.js +0 -72
- package/dist/scale-CT61XD_X.cjs +0 -1
- package/dist/series-DWLXo7J6.cjs +0 -11
- package/dist/xy-CrgPnICw.js +0 -89
- package/dist/xy-cP-FXJtR.cjs +0 -1
- package/dist/zodutil-C6RYzvXd.cjs +0 -1
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var s = (
|
|
4
|
-
import { z as
|
|
1
|
+
var et = Object.defineProperty;
|
|
2
|
+
var rt = (o, t, e) => t in o ? et(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var s = (o, t, e) => rt(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { z as l } from "zod";
|
|
5
5
|
import { J as $ } from "./index-BBa2mWG1.js";
|
|
6
6
|
import { s as nt } from "./index-eue4dSQX.js";
|
|
7
|
-
import { n as
|
|
8
|
-
import { m as R, c as L, a as k, d as D, t as
|
|
9
|
-
import "./box-
|
|
7
|
+
import { n as st } from "./index-HQonyH7n.js";
|
|
8
|
+
import { m as R, c as L, a as k, d as D, t as it, e as at } from "./bounds-BtccGJW0.js";
|
|
9
|
+
import "./box-CYXc9-qp.js";
|
|
10
10
|
import "./dimensions-D-1PnJVI.js";
|
|
11
11
|
import "./base-DnZzEvvz.js";
|
|
12
|
-
import "./location-
|
|
13
|
-
import "./scale-
|
|
14
|
-
import "./xy-
|
|
15
|
-
import { b as
|
|
16
|
-
let
|
|
17
|
-
let
|
|
12
|
+
import "./location-Cn1ByVTZ.js";
|
|
13
|
+
import "./scale-rZ1YKDFy.js";
|
|
14
|
+
import "./xy-DQdccWlc.js";
|
|
15
|
+
import { b as ut } from "./zodutil-DI4gVZkT.js";
|
|
16
|
+
let ot = (o, t = 21) => (e = t) => {
|
|
17
|
+
let r = "", i = e;
|
|
18
18
|
for (; i--; )
|
|
19
|
-
|
|
20
|
-
return
|
|
19
|
+
r += o[Math.random() * o.length | 0];
|
|
20
|
+
return r;
|
|
21
21
|
};
|
|
22
|
-
const
|
|
22
|
+
const lt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Q = ot(lt, 11), xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
23
23
|
__proto__: null,
|
|
24
|
-
id:
|
|
25
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
24
|
+
id: Q
|
|
25
|
+
}, Symbol.toStringTag, { value: "Module" })), ft = l.enum(["static", "dynamic"]), _ = (o, t) => {
|
|
26
26
|
const e = new m(t);
|
|
27
27
|
if (![
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
w.DAY,
|
|
29
|
+
w.HOUR,
|
|
30
|
+
w.MINUTE,
|
|
31
|
+
w.SECOND,
|
|
32
|
+
w.MILLISECOND,
|
|
33
|
+
w.MICROSECOND,
|
|
34
|
+
w.NANOSECOND
|
|
35
35
|
].some((i) => i.equals(e)))
|
|
36
36
|
throw new Error(
|
|
37
37
|
"Invalid argument for remainder. Must be an even TimeSpan or Timestamp"
|
|
38
38
|
);
|
|
39
|
-
const
|
|
40
|
-
return
|
|
39
|
+
const r = o.valueOf() % e.valueOf();
|
|
40
|
+
return o instanceof m ? new m(r) : new w(r);
|
|
41
41
|
}, a = class a {
|
|
42
42
|
constructor(t, e = "UTC") {
|
|
43
43
|
s(this, "value");
|
|
@@ -49,12 +49,12 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", X =
|
|
|
49
49
|
this.value = a.parseDateTimeString(t, e).valueOf();
|
|
50
50
|
else if (Array.isArray(t)) this.value = a.parseDate(t);
|
|
51
51
|
else {
|
|
52
|
-
let
|
|
53
|
-
t instanceof Number && (t = t.valueOf()), e === "local" && (
|
|
52
|
+
let r = BigInt(0);
|
|
53
|
+
t instanceof Number && (t = t.valueOf()), e === "local" && (r = a.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = Math.trunc(t) : (isNaN(t) && (t = 0), t === 1 / 0 ? t = a.MAX : t = a.MIN)), this.value = BigInt(t.valueOf()) + r;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
static parseDate([t = 1970, e = 1,
|
|
57
|
-
const i = new Date(t, e - 1,
|
|
56
|
+
static parseDate([t = 1970, e = 1, r = 1]) {
|
|
57
|
+
const i = new Date(t, e - 1, r, 0, 0, 0, 0);
|
|
58
58
|
return new a(BigInt(i.getTime()) * a.MILLISECOND.valueOf()).truncate(a.DAY).valueOf();
|
|
59
59
|
}
|
|
60
60
|
encode() {
|
|
@@ -64,18 +64,18 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", X =
|
|
|
64
64
|
return this.value;
|
|
65
65
|
}
|
|
66
66
|
static parseTimeString(t, e = "UTC") {
|
|
67
|
-
const [
|
|
68
|
-
let h = "00",
|
|
69
|
-
|
|
70
|
-
let O = a.hours(parseInt(
|
|
67
|
+
const [r, i, f] = t.split(":");
|
|
68
|
+
let h = "00", v = "00";
|
|
69
|
+
f != null && ([h, v] = f.split("."));
|
|
70
|
+
let O = a.hours(parseInt(r ?? "00")).add(a.minutes(parseInt(i ?? "00"))).add(a.seconds(parseInt(h ?? "00"))).add(a.milliseconds(parseInt(v ?? "00")));
|
|
71
71
|
return e === "local" && (O = O.add(a.utcOffset)), O.valueOf();
|
|
72
72
|
}
|
|
73
73
|
static parseDateTimeString(t, e = "UTC") {
|
|
74
74
|
if (!t.includes("/") && !t.includes("-"))
|
|
75
75
|
return a.parseTimeString(t, e);
|
|
76
|
-
const
|
|
77
|
-
return t.includes(":") ||
|
|
78
|
-
BigInt(
|
|
76
|
+
const r = new Date(t);
|
|
77
|
+
return t.includes(":") || r.setUTCHours(0, 0, 0, 0), new a(
|
|
78
|
+
BigInt(r.getTime()) * a.MILLISECOND.valueOf(),
|
|
79
79
|
e
|
|
80
80
|
).valueOf();
|
|
81
81
|
}
|
|
@@ -103,15 +103,15 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", X =
|
|
|
103
103
|
return t === "UTC" ? this.date().toISOString() : this.sub(a.utcOffset).date().toISOString();
|
|
104
104
|
}
|
|
105
105
|
timeString(t = !1, e = "UTC") {
|
|
106
|
-
const
|
|
107
|
-
return t ?
|
|
106
|
+
const r = this.toISOString(e);
|
|
107
|
+
return t ? r.slice(11, 23) : r.slice(11, 19);
|
|
108
108
|
}
|
|
109
109
|
dateString() {
|
|
110
|
-
const t = this.date(), e = t.toLocaleString("default", { month: "short" }),
|
|
111
|
-
return `${e} ${
|
|
110
|
+
const t = this.date(), e = t.toLocaleString("default", { month: "short" }), r = t.toLocaleString("default", { day: "numeric" });
|
|
111
|
+
return `${e} ${r}`;
|
|
112
112
|
}
|
|
113
113
|
static get utcOffset() {
|
|
114
|
-
return new
|
|
114
|
+
return new w(
|
|
115
115
|
BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * a.MINUTE.valueOf()
|
|
116
116
|
);
|
|
117
117
|
}
|
|
@@ -125,7 +125,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", X =
|
|
|
125
125
|
}
|
|
126
126
|
/** @returns A JavaScript Date object representing the TimeStamp. */
|
|
127
127
|
date() {
|
|
128
|
-
return new Date(this.milliseconds
|
|
128
|
+
return new Date(this.milliseconds);
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
131
|
* Checks if the TimeStamp is equal to another TimeStamp.
|
|
@@ -235,12 +235,94 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", X =
|
|
|
235
235
|
sub(t) {
|
|
236
236
|
return new a(this.valueOf() - BigInt(t.valueOf()));
|
|
237
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* @returns the floating point number of hours since the unix epoch to the timestamp
|
|
240
|
+
* value.
|
|
241
|
+
*/
|
|
242
|
+
get hours() {
|
|
243
|
+
return Number(this.valueOf()) / Number(w.HOUR.valueOf());
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* @returns the floating point number of minutes since the unix epoch to the timestamp
|
|
247
|
+
* value.
|
|
248
|
+
*/
|
|
249
|
+
get minutes() {
|
|
250
|
+
return Number(this.valueOf()) / Number(w.MINUTE.valueOf());
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* @returns the floating point number of days since the unix epoch to the timestamp
|
|
254
|
+
* value.
|
|
255
|
+
*/
|
|
256
|
+
get days() {
|
|
257
|
+
return Number(this.valueOf()) / Number(w.DAY.valueOf());
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* @returns the floating point number of seconds since the unix epoch to the timestamp
|
|
261
|
+
* value.
|
|
262
|
+
*/
|
|
263
|
+
get seconds() {
|
|
264
|
+
return Number(this.valueOf()) / Number(w.SECOND.valueOf());
|
|
265
|
+
}
|
|
238
266
|
/**
|
|
239
267
|
* @returns The number of milliseconds since the unix epoch.
|
|
240
268
|
*/
|
|
241
|
-
milliseconds() {
|
|
269
|
+
get milliseconds() {
|
|
242
270
|
return Number(this.valueOf()) / Number(a.MILLISECOND.valueOf());
|
|
243
271
|
}
|
|
272
|
+
/** @returns the integer year that the timestamp corresponds to. */
|
|
273
|
+
get year() {
|
|
274
|
+
return this.date().getFullYear();
|
|
275
|
+
}
|
|
276
|
+
setYear(t) {
|
|
277
|
+
const e = this.date();
|
|
278
|
+
return e.setFullYear(t), new a(e);
|
|
279
|
+
}
|
|
280
|
+
/** @returns the integer month that the timestamp corresponds to with its year. */
|
|
281
|
+
get month() {
|
|
282
|
+
return this.date().getMonth();
|
|
283
|
+
}
|
|
284
|
+
setMonth(t) {
|
|
285
|
+
const e = this.date();
|
|
286
|
+
return e.setMonth(t), new a(e);
|
|
287
|
+
}
|
|
288
|
+
/** @returns the integer day that the timestamp corresponds to within its month. */
|
|
289
|
+
get day() {
|
|
290
|
+
return this.date().getDate();
|
|
291
|
+
}
|
|
292
|
+
setDay(t) {
|
|
293
|
+
const e = this.date();
|
|
294
|
+
return e.setDate(t), new a(e);
|
|
295
|
+
}
|
|
296
|
+
/** @returns the integer hour that the timestamp corresponds to within its day. */
|
|
297
|
+
get hour() {
|
|
298
|
+
return this.date().getHours();
|
|
299
|
+
}
|
|
300
|
+
setHour(t) {
|
|
301
|
+
const e = this.date();
|
|
302
|
+
return e.setHours(t), new a(e);
|
|
303
|
+
}
|
|
304
|
+
/** @returns the integer minute that the timestamp corresponds to within its hour. */
|
|
305
|
+
get minute() {
|
|
306
|
+
return this.date().getMinutes();
|
|
307
|
+
}
|
|
308
|
+
setMinute(t) {
|
|
309
|
+
const e = this.date();
|
|
310
|
+
return e.setMinutes(t), new a(e);
|
|
311
|
+
}
|
|
312
|
+
get second() {
|
|
313
|
+
return this.date().getSeconds();
|
|
314
|
+
}
|
|
315
|
+
setSecond(t) {
|
|
316
|
+
const e = this.date();
|
|
317
|
+
return e.setSeconds(t), new a(e);
|
|
318
|
+
}
|
|
319
|
+
get millisecond() {
|
|
320
|
+
return this.date().getMilliseconds();
|
|
321
|
+
}
|
|
322
|
+
setMillisecond(t) {
|
|
323
|
+
const e = this.date();
|
|
324
|
+
return e.setMilliseconds(t), new a(e);
|
|
325
|
+
}
|
|
244
326
|
toString() {
|
|
245
327
|
return this.date().toISOString();
|
|
246
328
|
}
|
|
@@ -256,11 +338,11 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", X =
|
|
|
256
338
|
* @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
|
|
257
339
|
*/
|
|
258
340
|
remainder(t) {
|
|
259
|
-
return
|
|
341
|
+
return _(this, t);
|
|
260
342
|
}
|
|
261
343
|
/** @returns true if the day portion TimeStamp is today, false otherwise. */
|
|
262
344
|
get isToday() {
|
|
263
|
-
return this.truncate(
|
|
345
|
+
return this.truncate(w.DAY).equals(a.now().truncate(w.DAY));
|
|
264
346
|
}
|
|
265
347
|
truncate(t) {
|
|
266
348
|
return this.sub(this.remainder(t));
|
|
@@ -275,16 +357,16 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", X =
|
|
|
275
357
|
}
|
|
276
358
|
static max(...t) {
|
|
277
359
|
let e = a.MIN;
|
|
278
|
-
for (const
|
|
279
|
-
const i = new a(
|
|
360
|
+
for (const r of t) {
|
|
361
|
+
const i = new a(r);
|
|
280
362
|
i.after(e) && (e = i);
|
|
281
363
|
}
|
|
282
364
|
return e;
|
|
283
365
|
}
|
|
284
366
|
static min(...t) {
|
|
285
367
|
let e = a.MAX;
|
|
286
|
-
for (const
|
|
287
|
-
const i = new a(
|
|
368
|
+
for (const r of t) {
|
|
369
|
+
const i = new a(r);
|
|
288
370
|
i.before(e) && (e = i);
|
|
289
371
|
}
|
|
290
372
|
return e;
|
|
@@ -329,12 +411,12 @@ s(a, "DAY", a.days(1)), /** The maximum possible value for a timestamp */
|
|
|
329
411
|
s(a, "MAX", new a((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
|
|
330
412
|
s(a, "MIN", new a(0)), /** The unix epoch */
|
|
331
413
|
s(a, "ZERO", new a(0)), /** A zod schema for validating timestamps */
|
|
332
|
-
s(a, "z",
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
414
|
+
s(a, "z", l.union([
|
|
415
|
+
l.object({ value: l.bigint() }).transform((t) => new a(t.value)),
|
|
416
|
+
l.string().transform((t) => new a(BigInt(t))),
|
|
417
|
+
l.instanceof(Number).transform((t) => new a(t)),
|
|
418
|
+
l.number().transform((t) => new a(t)),
|
|
419
|
+
l.instanceof(a)
|
|
338
420
|
]));
|
|
339
421
|
let m = a;
|
|
340
422
|
const u = class u {
|
|
@@ -344,10 +426,10 @@ const u = class u {
|
|
|
344
426
|
typeof t == "number" && (t = Math.trunc(t.valueOf())), this.value = BigInt(t.valueOf());
|
|
345
427
|
}
|
|
346
428
|
static fromSeconds(t) {
|
|
347
|
-
return t instanceof u ? t : t instanceof
|
|
429
|
+
return t instanceof u ? t : t instanceof F ? t.period : t instanceof m ? new u(t) : ["number", "bigint"].includes(typeof t) ? u.seconds(t) : new u(t);
|
|
348
430
|
}
|
|
349
431
|
static fromMilliseconds(t) {
|
|
350
|
-
return t instanceof u ? t : t instanceof
|
|
432
|
+
return t instanceof u ? t : t instanceof F ? t.period : t instanceof m ? new u(t) : ["number", "bigint"].includes(typeof t) ? u.milliseconds(t) : new u(t);
|
|
351
433
|
}
|
|
352
434
|
encode() {
|
|
353
435
|
return this.value.toString();
|
|
@@ -368,7 +450,7 @@ const u = class u {
|
|
|
368
450
|
return this.valueOf() >= new u(t).valueOf();
|
|
369
451
|
}
|
|
370
452
|
remainder(t) {
|
|
371
|
-
return
|
|
453
|
+
return _(this, t);
|
|
372
454
|
}
|
|
373
455
|
truncate(t) {
|
|
374
456
|
return new u(
|
|
@@ -376,9 +458,12 @@ const u = class u {
|
|
|
376
458
|
);
|
|
377
459
|
}
|
|
378
460
|
toString() {
|
|
379
|
-
const t = this.truncate(u.DAY), e = this.truncate(u.HOUR),
|
|
461
|
+
const t = this.truncate(u.DAY), e = this.truncate(u.HOUR), r = this.truncate(u.MINUTE), i = this.truncate(u.SECOND), f = this.truncate(u.MILLISECOND), h = this.truncate(u.MICROSECOND), v = this.truncate(u.NANOSECOND), O = t, N = e.sub(t), p = r.sub(e), c = i.sub(r), M = f.sub(i), U = h.sub(f), Z = v.sub(h);
|
|
380
462
|
let A = "";
|
|
381
|
-
return O.isZero || (A += `${O.days}d `), N.isZero || (A += `${N.hours}h `), p.isZero || (A += `${p.minutes}m `),
|
|
463
|
+
return O.isZero || (A += `${O.days}d `), N.isZero || (A += `${N.hours}h `), p.isZero || (A += `${p.minutes}m `), c.isZero || (A += `${c.seconds}s `), M.isZero || (A += `${M.milliseconds}ms `), U.isZero || (A += `${U.microseconds}µs `), Z.isZero || (A += `${Z.nanoseconds}ns`), A.trim();
|
|
464
|
+
}
|
|
465
|
+
mult(t) {
|
|
466
|
+
return new u(this.valueOf() * BigInt(t));
|
|
382
467
|
}
|
|
383
468
|
/** @returns the decimal number of days in the timespan */
|
|
384
469
|
get days() {
|
|
@@ -513,15 +598,15 @@ s(u, "DAY", u.days(1)), /** The maximum possible value for a TimeSpan. */
|
|
|
513
598
|
s(u, "MAX", new u((1n << 63n) - 1n)), /** The minimum possible value for a TimeSpan. */
|
|
514
599
|
s(u, "MIN", new u(0)), /** The zero value for a TimeSpan. */
|
|
515
600
|
s(u, "ZERO", new u(0)), /** A zod schema for validating and transforming timespans */
|
|
516
|
-
s(u, "z",
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
601
|
+
s(u, "z", l.union([
|
|
602
|
+
l.object({ value: l.bigint() }).transform((t) => new u(t.value)),
|
|
603
|
+
l.string().transform((t) => new u(BigInt(t))),
|
|
604
|
+
l.instanceof(Number).transform((t) => new u(t)),
|
|
605
|
+
l.number().transform((t) => new u(t)),
|
|
606
|
+
l.instanceof(u)
|
|
522
607
|
]));
|
|
523
|
-
let
|
|
524
|
-
const
|
|
608
|
+
let w = u;
|
|
609
|
+
const S = class S extends Number {
|
|
525
610
|
constructor(t) {
|
|
526
611
|
t instanceof Number ? super(t.valueOf()) : super(t);
|
|
527
612
|
}
|
|
@@ -531,7 +616,7 @@ const v = class v extends Number {
|
|
|
531
616
|
}
|
|
532
617
|
/** @returns The number of seconds in the Rate. */
|
|
533
618
|
equals(t) {
|
|
534
|
-
return this.valueOf() === new
|
|
619
|
+
return this.valueOf() === new S(t).valueOf();
|
|
535
620
|
}
|
|
536
621
|
/**
|
|
537
622
|
* Calculates the period of the Rate as a TimeSpan.
|
|
@@ -539,7 +624,7 @@ const v = class v extends Number {
|
|
|
539
624
|
* @returns A TimeSpan representing the period of the Rate.
|
|
540
625
|
*/
|
|
541
626
|
get period() {
|
|
542
|
-
return
|
|
627
|
+
return w.seconds(1 / this.valueOf());
|
|
543
628
|
}
|
|
544
629
|
/**
|
|
545
630
|
* Calculates the number of samples in the given TimeSpan at this rate.
|
|
@@ -548,7 +633,7 @@ const v = class v extends Number {
|
|
|
548
633
|
* @returns The number of samples in the given TimeSpan at this rate.
|
|
549
634
|
*/
|
|
550
635
|
sampleCount(t) {
|
|
551
|
-
return new
|
|
636
|
+
return new w(t).seconds * this.valueOf();
|
|
552
637
|
}
|
|
553
638
|
/**
|
|
554
639
|
* Calculates the number of bytes in the given TimeSpan at this rate.
|
|
@@ -567,7 +652,7 @@ const v = class v extends Number {
|
|
|
567
652
|
* @returns A TimeSpan that corresponds to the given number of samples.
|
|
568
653
|
*/
|
|
569
654
|
span(t) {
|
|
570
|
-
return
|
|
655
|
+
return w.seconds(t / this.valueOf());
|
|
571
656
|
}
|
|
572
657
|
/**
|
|
573
658
|
* Calculates a TimeSpan given the number of bytes at this rate.
|
|
@@ -586,7 +671,7 @@ const v = class v extends Number {
|
|
|
586
671
|
* @returns A Rate representing the given number of Hz.
|
|
587
672
|
*/
|
|
588
673
|
static hz(t) {
|
|
589
|
-
return new
|
|
674
|
+
return new S(t);
|
|
590
675
|
}
|
|
591
676
|
/**
|
|
592
677
|
* Creates a Rate representing the given number of kHz.
|
|
@@ -595,17 +680,17 @@ const v = class v extends Number {
|
|
|
595
680
|
* @returns A Rate representing the given number of kHz.
|
|
596
681
|
*/
|
|
597
682
|
static khz(t) {
|
|
598
|
-
return
|
|
683
|
+
return S.hz(t * 1e3);
|
|
599
684
|
}
|
|
600
685
|
};
|
|
601
686
|
/** A zod schema for validating and transforming rates */
|
|
602
|
-
s(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
687
|
+
s(S, "z", l.union([
|
|
688
|
+
l.number().transform((t) => new S(t)),
|
|
689
|
+
l.instanceof(Number).transform((t) => new S(t)),
|
|
690
|
+
l.instanceof(S)
|
|
606
691
|
]));
|
|
607
|
-
let
|
|
608
|
-
const
|
|
692
|
+
let F = S;
|
|
693
|
+
const y = class y extends Number {
|
|
609
694
|
/**
|
|
610
695
|
* Creates a Density representing the given number of bytes per value.
|
|
611
696
|
*
|
|
@@ -624,18 +709,18 @@ const w = class w extends Number {
|
|
|
624
709
|
}
|
|
625
710
|
};
|
|
626
711
|
/** Unknown/Invalid Density. */
|
|
627
|
-
s(
|
|
628
|
-
s(
|
|
629
|
-
s(
|
|
630
|
-
s(
|
|
631
|
-
s(
|
|
632
|
-
s(
|
|
633
|
-
s(
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
712
|
+
s(y, "UNKNOWN", new y(0)), /** 128 bits per value. */
|
|
713
|
+
s(y, "BIT128", new y(16)), /** 64 bits per value. */
|
|
714
|
+
s(y, "BIT64", new y(8)), /** 32 bits per value. */
|
|
715
|
+
s(y, "BIT32", new y(4)), /** 16 bits per value. */
|
|
716
|
+
s(y, "BIT16", new y(2)), /** 8 bits per value. */
|
|
717
|
+
s(y, "BIT8", new y(1)), /** A zod schema for validating and transforming densities */
|
|
718
|
+
s(y, "z", l.union([
|
|
719
|
+
l.number().transform((t) => new y(t)),
|
|
720
|
+
l.instanceof(Number).transform((t) => new y(t)),
|
|
721
|
+
l.instanceof(y)
|
|
637
722
|
]));
|
|
638
|
-
let b =
|
|
723
|
+
let b = y;
|
|
639
724
|
const T = class T {
|
|
640
725
|
/**
|
|
641
726
|
* Creates a TimeRange from the given start and end TimeStamps.
|
|
@@ -666,7 +751,7 @@ const T = class T {
|
|
|
666
751
|
}
|
|
667
752
|
/** @returns The TimeSpan occupied by the TimeRange. */
|
|
668
753
|
get span() {
|
|
669
|
-
return new
|
|
754
|
+
return new w(this.end.valueOf() - this.start.valueOf());
|
|
670
755
|
}
|
|
671
756
|
/**
|
|
672
757
|
* Checks if the timestamp is valid i.e. the start is before the end.
|
|
@@ -729,17 +814,17 @@ const T = class T {
|
|
|
729
814
|
* @param other - The other TimeRange to compare to.
|
|
730
815
|
* @returns True if the two TimeRanges overlap, false otherwise.
|
|
731
816
|
*/
|
|
732
|
-
overlapsWith(t, e =
|
|
817
|
+
overlapsWith(t, e = w.ZERO) {
|
|
733
818
|
t = t.makeValid();
|
|
734
|
-
const
|
|
819
|
+
const r = this.makeValid();
|
|
735
820
|
if (this.equals(t)) return !0;
|
|
736
|
-
if (t.end.equals(
|
|
737
|
-
const i = m.max(
|
|
738
|
-
return
|
|
821
|
+
if (t.end.equals(r.start) || r.end.equals(t.start)) return !1;
|
|
822
|
+
const i = m.max(r.start, t.start), f = m.min(r.end, t.end);
|
|
823
|
+
return f.before(i) ? !1 : new w(f.sub(i)).greaterThanOrEqual(e);
|
|
739
824
|
}
|
|
740
825
|
roughlyEquals(t, e) {
|
|
741
|
-
let
|
|
742
|
-
return
|
|
826
|
+
let r = this.start.sub(t.start).valueOf(), i = this.end.sub(t.end).valueOf();
|
|
827
|
+
return r < 0 && (r = -r), i < 0 && (i = -i), r <= e.valueOf() && i <= e.valueOf();
|
|
743
828
|
}
|
|
744
829
|
contains(t) {
|
|
745
830
|
return t instanceof T ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
|
|
@@ -753,29 +838,29 @@ const T = class T {
|
|
|
753
838
|
s(T, "MAX", new T(m.MIN, m.MAX)), /** The minimum possible time range. */
|
|
754
839
|
s(T, "MIN", new T(m.MAX, m.MIN)), /** A zero time range. */
|
|
755
840
|
s(T, "ZERO", new T(m.ZERO, m.ZERO)), /** A zod schema for validating and transforming time ranges */
|
|
756
|
-
s(T, "z",
|
|
757
|
-
|
|
758
|
-
|
|
841
|
+
s(T, "z", l.union([
|
|
842
|
+
l.object({ start: m.z, end: m.z }).transform((t) => new T(t.start, t.end)),
|
|
843
|
+
l.instanceof(T)
|
|
759
844
|
]));
|
|
760
845
|
let E = T;
|
|
761
|
-
const
|
|
846
|
+
const Ct = (o, t) => o.start.before(t.start) ? -1 : o.start.after(t.start) ? 1 : o.end.before(t.end) ? -1 : o.end.after(t.end) ? 1 : 0, n = class n extends String {
|
|
762
847
|
constructor(t) {
|
|
763
|
-
if (t instanceof
|
|
848
|
+
if (t instanceof n || typeof t == "string" || typeof t.valueOf() == "string") {
|
|
764
849
|
super(t.valueOf());
|
|
765
850
|
return;
|
|
766
851
|
}
|
|
767
|
-
const e =
|
|
852
|
+
const e = n.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
|
|
768
853
|
if (e != null) {
|
|
769
854
|
super(e.valueOf());
|
|
770
855
|
return;
|
|
771
856
|
}
|
|
772
|
-
throw super(
|
|
857
|
+
throw super(n.UNKNOWN.valueOf()), new Error(`unable to find data type for ${t.toString()}`);
|
|
773
858
|
}
|
|
774
859
|
/**
|
|
775
860
|
* @returns the TypedArray constructor for the DataType.
|
|
776
861
|
*/
|
|
777
862
|
get Array() {
|
|
778
|
-
const t =
|
|
863
|
+
const t = n.ARRAY_CONSTRUCTORS.get(this.toString());
|
|
779
864
|
if (t == null)
|
|
780
865
|
throw new Error(`unable to find array constructor for ${this.valueOf()}`);
|
|
781
866
|
return t;
|
|
@@ -797,10 +882,10 @@ const r = class r extends String {
|
|
|
797
882
|
return this.valueOf();
|
|
798
883
|
}
|
|
799
884
|
get isVariable() {
|
|
800
|
-
return this.equals(
|
|
885
|
+
return this.equals(n.JSON) || this.equals(n.STRING);
|
|
801
886
|
}
|
|
802
887
|
get isNumeric() {
|
|
803
|
-
return !this.isVariable && !this.equals(
|
|
888
|
+
return !this.isVariable && !this.equals(n.UUID);
|
|
804
889
|
}
|
|
805
890
|
get isInteger() {
|
|
806
891
|
return this.toString().startsWith("int");
|
|
@@ -809,7 +894,7 @@ const r = class r extends String {
|
|
|
809
894
|
return this.toString().startsWith("float");
|
|
810
895
|
}
|
|
811
896
|
get density() {
|
|
812
|
-
const t =
|
|
897
|
+
const t = n.DENSITIES.get(this.toString());
|
|
813
898
|
if (t == null) throw new Error(`unable to find density for ${this.valueOf()}`);
|
|
814
899
|
return t;
|
|
815
900
|
}
|
|
@@ -834,91 +919,91 @@ const r = class r extends String {
|
|
|
834
919
|
return this.toString();
|
|
835
920
|
}
|
|
836
921
|
get usesBigInt() {
|
|
837
|
-
return
|
|
922
|
+
return n.BIG_INT_TYPES.some((t) => t.equals(this));
|
|
838
923
|
}
|
|
839
924
|
};
|
|
840
925
|
/** Represents an Unknown/Invalid DataType. */
|
|
841
|
-
s(
|
|
842
|
-
s(
|
|
843
|
-
s(
|
|
844
|
-
s(
|
|
845
|
-
s(
|
|
846
|
-
s(
|
|
847
|
-
s(
|
|
848
|
-
s(
|
|
849
|
-
s(
|
|
850
|
-
s(
|
|
851
|
-
s(
|
|
852
|
-
s(
|
|
853
|
-
s(
|
|
854
|
-
s(
|
|
926
|
+
s(n, "UNKNOWN", new n("unknown")), /** Represents a 64-bit floating point value. */
|
|
927
|
+
s(n, "FLOAT64", new n("float64")), /** Represents a 32-bit floating point value. */
|
|
928
|
+
s(n, "FLOAT32", new n("float32")), /** Represents a 64-bit signed integer value. */
|
|
929
|
+
s(n, "INT64", new n("int64")), /** Represents a 32-bit signed integer value. */
|
|
930
|
+
s(n, "INT32", new n("int32")), /** Represents a 16-bit signed integer value. */
|
|
931
|
+
s(n, "INT16", new n("int16")), /** Represents a 8-bit signed integer value. */
|
|
932
|
+
s(n, "INT8", new n("int8")), /** Represents a 64-bit unsigned integer value. */
|
|
933
|
+
s(n, "UINT64", new n("uint64")), /** Represents a 32-bit unsigned integer value. */
|
|
934
|
+
s(n, "UINT32", new n("uint32")), /** Represents a 16-bit unsigned integer value. */
|
|
935
|
+
s(n, "UINT16", new n("uint16")), /** Represents a 8-bit unsigned integer value. */
|
|
936
|
+
s(n, "UINT8", new n("uint8")), /** Represents a boolean value. Alias for UINT8. */
|
|
937
|
+
s(n, "BOOLEAN", n.UINT8), /** Represents a 64-bit unix epoch. */
|
|
938
|
+
s(n, "TIMESTAMP", new n("timestamp")), /** Represents a UUID data type */
|
|
939
|
+
s(n, "UUID", new n("uuid")), /** Represents a string data type. Strings have an unknown density, and are separate
|
|
855
940
|
* by a newline character. */
|
|
856
|
-
s(
|
|
941
|
+
s(n, "STRING", new n("string")), /** Represents a JSON data type. JSON has an unknown density, and is separated by a
|
|
857
942
|
* newline character. */
|
|
858
|
-
s(
|
|
859
|
-
[
|
|
860
|
-
[
|
|
861
|
-
[
|
|
862
|
-
[
|
|
863
|
-
[
|
|
864
|
-
[
|
|
865
|
-
[
|
|
866
|
-
[
|
|
867
|
-
[
|
|
868
|
-
[
|
|
869
|
-
[
|
|
870
|
-
[
|
|
871
|
-
[
|
|
872
|
-
[
|
|
873
|
-
])), s(
|
|
874
|
-
[Uint8Array.name,
|
|
875
|
-
[Uint16Array.name,
|
|
876
|
-
[Uint32Array.name,
|
|
877
|
-
[BigUint64Array.name,
|
|
878
|
-
[Float32Array.name,
|
|
879
|
-
[Float64Array.name,
|
|
880
|
-
[Int8Array.name,
|
|
881
|
-
[Int16Array.name,
|
|
882
|
-
[Int32Array.name,
|
|
883
|
-
[BigInt64Array.name,
|
|
884
|
-
])), s(
|
|
885
|
-
[
|
|
886
|
-
[
|
|
887
|
-
[
|
|
888
|
-
[
|
|
889
|
-
[
|
|
890
|
-
[
|
|
891
|
-
[
|
|
892
|
-
[
|
|
893
|
-
[
|
|
894
|
-
[
|
|
895
|
-
[
|
|
896
|
-
[
|
|
897
|
-
[
|
|
898
|
-
[
|
|
943
|
+
s(n, "JSON", new n("json")), s(n, "ARRAY_CONSTRUCTORS", /* @__PURE__ */ new Map([
|
|
944
|
+
[n.UINT8.toString(), Uint8Array],
|
|
945
|
+
[n.UINT16.toString(), Uint16Array],
|
|
946
|
+
[n.UINT32.toString(), Uint32Array],
|
|
947
|
+
[n.UINT64.toString(), BigUint64Array],
|
|
948
|
+
[n.FLOAT32.toString(), Float32Array],
|
|
949
|
+
[n.FLOAT64.toString(), Float64Array],
|
|
950
|
+
[n.INT8.toString(), Int8Array],
|
|
951
|
+
[n.INT16.toString(), Int16Array],
|
|
952
|
+
[n.INT32.toString(), Int32Array],
|
|
953
|
+
[n.INT64.toString(), BigInt64Array],
|
|
954
|
+
[n.TIMESTAMP.toString(), BigInt64Array],
|
|
955
|
+
[n.STRING.toString(), Uint8Array],
|
|
956
|
+
[n.JSON.toString(), Uint8Array],
|
|
957
|
+
[n.UUID.toString(), Uint8Array]
|
|
958
|
+
])), s(n, "ARRAY_CONSTRUCTOR_DATA_TYPES", /* @__PURE__ */ new Map([
|
|
959
|
+
[Uint8Array.name, n.UINT8],
|
|
960
|
+
[Uint16Array.name, n.UINT16],
|
|
961
|
+
[Uint32Array.name, n.UINT32],
|
|
962
|
+
[BigUint64Array.name, n.UINT64],
|
|
963
|
+
[Float32Array.name, n.FLOAT32],
|
|
964
|
+
[Float64Array.name, n.FLOAT64],
|
|
965
|
+
[Int8Array.name, n.INT8],
|
|
966
|
+
[Int16Array.name, n.INT16],
|
|
967
|
+
[Int32Array.name, n.INT32],
|
|
968
|
+
[BigInt64Array.name, n.INT64]
|
|
969
|
+
])), s(n, "DENSITIES", /* @__PURE__ */ new Map([
|
|
970
|
+
[n.UINT8.toString(), b.BIT8],
|
|
971
|
+
[n.UINT16.toString(), b.BIT16],
|
|
972
|
+
[n.UINT32.toString(), b.BIT32],
|
|
973
|
+
[n.UINT64.toString(), b.BIT64],
|
|
974
|
+
[n.FLOAT32.toString(), b.BIT32],
|
|
975
|
+
[n.FLOAT64.toString(), b.BIT64],
|
|
976
|
+
[n.INT8.toString(), b.BIT8],
|
|
977
|
+
[n.INT16.toString(), b.BIT16],
|
|
978
|
+
[n.INT32.toString(), b.BIT32],
|
|
979
|
+
[n.INT64.toString(), b.BIT64],
|
|
980
|
+
[n.TIMESTAMP.toString(), b.BIT64],
|
|
981
|
+
[n.STRING.toString(), b.UNKNOWN],
|
|
982
|
+
[n.JSON.toString(), b.UNKNOWN],
|
|
983
|
+
[n.UUID.toString(), b.BIT128]
|
|
899
984
|
])), /** All the data types. */
|
|
900
|
-
s(
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
]), s(
|
|
917
|
-
s(
|
|
918
|
-
|
|
919
|
-
|
|
985
|
+
s(n, "ALL", [
|
|
986
|
+
n.UNKNOWN,
|
|
987
|
+
n.FLOAT64,
|
|
988
|
+
n.FLOAT32,
|
|
989
|
+
n.INT64,
|
|
990
|
+
n.INT32,
|
|
991
|
+
n.INT16,
|
|
992
|
+
n.INT8,
|
|
993
|
+
n.UINT64,
|
|
994
|
+
n.UINT32,
|
|
995
|
+
n.UINT16,
|
|
996
|
+
n.UINT8,
|
|
997
|
+
n.TIMESTAMP,
|
|
998
|
+
n.UUID,
|
|
999
|
+
n.STRING,
|
|
1000
|
+
n.JSON
|
|
1001
|
+
]), s(n, "BIG_INT_TYPES", [n.INT64, n.UINT64, n.TIMESTAMP]), /** A zod schema for a DataType. */
|
|
1002
|
+
s(n, "z", l.union([
|
|
1003
|
+
l.string().transform((t) => new n(t)),
|
|
1004
|
+
l.instanceof(n)
|
|
920
1005
|
]));
|
|
921
|
-
let g =
|
|
1006
|
+
let g = n;
|
|
922
1007
|
const d = class d extends Number {
|
|
923
1008
|
constructor(t) {
|
|
924
1009
|
super(t.valueOf());
|
|
@@ -956,9 +1041,9 @@ const d = class d extends Number {
|
|
|
956
1041
|
return this.valueOf() / d.TERABYTE.valueOf();
|
|
957
1042
|
}
|
|
958
1043
|
toString() {
|
|
959
|
-
const t = this.truncate(d.TERABYTE), e = this.truncate(d.GIGABYTE),
|
|
960
|
-
let
|
|
961
|
-
return h.isZero || (
|
|
1044
|
+
const t = this.truncate(d.TERABYTE), e = this.truncate(d.GIGABYTE), r = this.truncate(d.MEGABYTE), i = this.truncate(d.KILOBYTE), f = this.truncate(d.BYTE), h = t, v = e.sub(t), O = r.sub(e), N = i.sub(r), p = f.sub(i);
|
|
1045
|
+
let c = "";
|
|
1046
|
+
return h.isZero || (c += `${h.terabytes}TB `), v.isZero || (c += `${v.gigabytes}GB `), O.isZero || (c += `${O.megabytes}MB `), N.isZero || (c += `${N.kilobytes}KB `), (!p.isZero || c === "") && (c += `${p.valueOf()}B`), c.trim();
|
|
962
1047
|
}
|
|
963
1048
|
/**
|
|
964
1049
|
* Creates a Size from the given number of bytes.
|
|
@@ -1016,33 +1101,33 @@ s(d, "MEGABYTE", d.megabytes(1)), /** A gigabyte */
|
|
|
1016
1101
|
s(d, "GIGABYTE", d.gigabytes(1)), /** A terabyte. */
|
|
1017
1102
|
s(d, "TERABYTE", d.terabytes(1)), /** The zero value for Size */
|
|
1018
1103
|
s(d, "ZERO", new d(0)), /** A zod schema for a Size. */
|
|
1019
|
-
s(d, "z",
|
|
1020
|
-
|
|
1021
|
-
|
|
1104
|
+
s(d, "z", l.union([
|
|
1105
|
+
l.number().transform((t) => new d(t)),
|
|
1106
|
+
l.instanceof(d)
|
|
1022
1107
|
]));
|
|
1023
1108
|
let x = d;
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
]),
|
|
1036
|
-
const t = typeof
|
|
1037
|
-
return t === "string" || t === "number" || t === "boolean" || t === "bigint" ||
|
|
1038
|
-
}, ct = (
|
|
1039
|
-
[Symbol.iterator]: () =>
|
|
1109
|
+
const Lt = l.union([
|
|
1110
|
+
l.instanceof(Uint8Array),
|
|
1111
|
+
l.instanceof(Uint16Array),
|
|
1112
|
+
l.instanceof(Uint32Array),
|
|
1113
|
+
l.instanceof(BigUint64Array),
|
|
1114
|
+
l.instanceof(Float32Array),
|
|
1115
|
+
l.instanceof(Float64Array),
|
|
1116
|
+
l.instanceof(Int8Array),
|
|
1117
|
+
l.instanceof(Int16Array),
|
|
1118
|
+
l.instanceof(Int32Array),
|
|
1119
|
+
l.instanceof(BigInt64Array)
|
|
1120
|
+
]), tt = (o) => {
|
|
1121
|
+
const t = typeof o;
|
|
1122
|
+
return t === "string" || t === "number" || t === "boolean" || t === "bigint" || o instanceof m || o instanceof w || o instanceof Date;
|
|
1123
|
+
}, ct = (o, t, e, r = 0) => o.usesBigInt && !t.usesBigInt ? Number(e) - Number(r) : !o.usesBigInt && t.usesBigInt ? BigInt(e.valueOf()) - BigInt(r.valueOf()) : C(e, -r).valueOf(), ht = (o) => o == null ? !1 : Array.isArray(o) || o instanceof ArrayBuffer || ArrayBuffer.isView(o) && !(o instanceof DataView) || o instanceof V ? !0 : tt(o), B = -1, Y = {
|
|
1124
|
+
[Symbol.iterator]: () => Y,
|
|
1040
1125
|
next: () => ({ done: !0, value: void 0 })
|
|
1041
|
-
},
|
|
1042
|
-
(
|
|
1043
|
-
atob(
|
|
1126
|
+
}, dt = l.string().transform(
|
|
1127
|
+
(o) => new Uint8Array(
|
|
1128
|
+
atob(o).split("").map((t) => t.charCodeAt(0))
|
|
1044
1129
|
).buffer
|
|
1045
|
-
),
|
|
1130
|
+
), gt = l.union([l.null(), l.undefined()]).transform(() => new Uint8Array().buffer), q = 10, I = class I {
|
|
1046
1131
|
constructor(t) {
|
|
1047
1132
|
s(this, "key", "");
|
|
1048
1133
|
s(this, "isSynnaxSeries", !0);
|
|
@@ -1074,21 +1159,21 @@ const xt = o.union([
|
|
|
1074
1159
|
s(this, "_cachedLength");
|
|
1075
1160
|
/** Caches the indexes of the array for variable length data types. */
|
|
1076
1161
|
s(this, "_cachedIndexes");
|
|
1077
|
-
|
|
1162
|
+
ht(t) && (t = { data: t });
|
|
1078
1163
|
const {
|
|
1079
1164
|
dataType: e,
|
|
1080
|
-
timeRange:
|
|
1165
|
+
timeRange: r,
|
|
1081
1166
|
sampleOffset: i = 0,
|
|
1082
|
-
glBufferUsage:
|
|
1167
|
+
glBufferUsage: f = "static",
|
|
1083
1168
|
alignment: h = 0n,
|
|
1084
|
-
key:
|
|
1169
|
+
key: v = Q()
|
|
1085
1170
|
} = t, O = t.data ?? [];
|
|
1086
1171
|
if (O instanceof I || typeof O == "object" && "isSynnaxSeries" in O && O.isSynnaxSeries === !0) {
|
|
1087
|
-
const
|
|
1088
|
-
this.key =
|
|
1172
|
+
const c = O;
|
|
1173
|
+
this.key = c.key, this.dataType = c.dataType, this.sampleOffset = c.sampleOffset, this.gl = c.gl, this._data = c._data, this._timeRange = c._timeRange, this.alignment = c.alignment, this._cachedMin = c._cachedMin, this._cachedMax = c._cachedMax, this.writePos = c.writePos, this._refCount = c._refCount, this._cachedLength = c._cachedLength;
|
|
1089
1174
|
return;
|
|
1090
1175
|
}
|
|
1091
|
-
const N =
|
|
1176
|
+
const N = tt(O), p = Array.isArray(O);
|
|
1092
1177
|
if (e != null) this.dataType = new g(e);
|
|
1093
1178
|
else {
|
|
1094
1179
|
if (O instanceof ArrayBuffer)
|
|
@@ -1096,78 +1181,80 @@ const xt = o.union([
|
|
|
1096
1181
|
"cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
|
|
1097
1182
|
);
|
|
1098
1183
|
if (p || N) {
|
|
1099
|
-
let
|
|
1184
|
+
let c = O;
|
|
1100
1185
|
if (!N) {
|
|
1101
1186
|
if (O.length === 0)
|
|
1102
1187
|
throw new Error(
|
|
1103
1188
|
"cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
|
|
1104
1189
|
);
|
|
1105
|
-
|
|
1190
|
+
c = O[0];
|
|
1106
1191
|
}
|
|
1107
|
-
if (typeof
|
|
1108
|
-
else if (typeof
|
|
1109
|
-
else if (typeof
|
|
1110
|
-
else if (typeof
|
|
1111
|
-
else if (
|
|
1192
|
+
if (typeof c == "string") this.dataType = g.STRING;
|
|
1193
|
+
else if (typeof c == "number") this.dataType = g.FLOAT64;
|
|
1194
|
+
else if (typeof c == "bigint") this.dataType = g.INT64;
|
|
1195
|
+
else if (typeof c == "boolean") this.dataType = g.BOOLEAN;
|
|
1196
|
+
else if (c instanceof m || c instanceof Date || c instanceof m)
|
|
1112
1197
|
this.dataType = g.TIMESTAMP;
|
|
1113
|
-
else if (typeof
|
|
1198
|
+
else if (typeof c == "object") this.dataType = g.JSON;
|
|
1114
1199
|
else
|
|
1115
1200
|
throw new Error(
|
|
1116
|
-
`cannot infer data type of ${typeof
|
|
1201
|
+
`cannot infer data type of ${typeof c} when constructing a Series from a JS array`
|
|
1117
1202
|
);
|
|
1118
1203
|
} else this.dataType = new g(O);
|
|
1119
1204
|
}
|
|
1120
1205
|
if (!p && !N) this._data = O;
|
|
1121
1206
|
else {
|
|
1122
|
-
let
|
|
1123
|
-
const M =
|
|
1124
|
-
(M instanceof m || M instanceof Date || M instanceof
|
|
1207
|
+
let c = N ? [O] : O;
|
|
1208
|
+
const M = c[0];
|
|
1209
|
+
(M instanceof m || M instanceof Date || M instanceof w) && (c = c.map((U) => new m(U).valueOf())), this.dataType.equals(g.STRING) ? (this._cachedLength = c.length, this._data = new TextEncoder().encode(`${c.join(`
|
|
1125
1210
|
`)}
|
|
1126
|
-
`)) : this.dataType.equals(g.JSON) ? (this._cachedLength =
|
|
1127
|
-
`${
|
|
1211
|
+
`).buffer) : this.dataType.equals(g.JSON) ? (this._cachedLength = c.length, this._data = new TextEncoder().encode(
|
|
1212
|
+
`${c.map((U) => $.encodeString(U)).join(`
|
|
1128
1213
|
`)}
|
|
1129
1214
|
`
|
|
1130
|
-
)) : this._data = new this.dataType.Array(
|
|
1215
|
+
).buffer) : this._data = new this.dataType.Array(c).buffer;
|
|
1131
1216
|
}
|
|
1132
|
-
this.key =
|
|
1217
|
+
this.key = v, this.alignment = h, this.sampleOffset = i ?? 0, this._timeRange = r, this.gl = {
|
|
1133
1218
|
control: null,
|
|
1134
1219
|
buffer: null,
|
|
1135
1220
|
prevBuffer: 0,
|
|
1136
|
-
bufferUsage:
|
|
1221
|
+
bufferUsage: f
|
|
1137
1222
|
};
|
|
1138
1223
|
}
|
|
1139
|
-
static alloc({ capacity: t, dataType: e, ...
|
|
1224
|
+
static alloc({ capacity: t, dataType: e, ...r }) {
|
|
1140
1225
|
if (t === 0)
|
|
1141
1226
|
throw new Error("[Series] - cannot allocate an array of length 0");
|
|
1142
|
-
const i = new new g(e).Array(t),
|
|
1227
|
+
const i = new new g(e).Array(t), f = new I({
|
|
1143
1228
|
data: i.buffer,
|
|
1144
1229
|
dataType: e,
|
|
1145
|
-
...
|
|
1230
|
+
...r
|
|
1146
1231
|
});
|
|
1147
|
-
return
|
|
1232
|
+
return f.writePos = 0, f;
|
|
1148
1233
|
}
|
|
1149
|
-
static generateTimestamps(t, e,
|
|
1150
|
-
const i =
|
|
1234
|
+
static generateTimestamps(t, e, r) {
|
|
1235
|
+
const i = r.spanRange(e.span(t)), f = new BigInt64Array(t);
|
|
1151
1236
|
for (let h = 0; h < t; h++)
|
|
1152
|
-
|
|
1153
|
-
return new I({ data:
|
|
1237
|
+
f[h] = BigInt(r.add(e.span(h)).valueOf());
|
|
1238
|
+
return new I({ data: f, dataType: g.TIMESTAMP, timeRange: i });
|
|
1154
1239
|
}
|
|
1155
1240
|
get refCount() {
|
|
1156
1241
|
return this._refCount;
|
|
1157
1242
|
}
|
|
1158
1243
|
static fromStrings(t, e) {
|
|
1159
|
-
const
|
|
1244
|
+
const r = new TextEncoder().encode(
|
|
1245
|
+
`${t.join(`
|
|
1160
1246
|
`)}
|
|
1161
|
-
`
|
|
1162
|
-
|
|
1247
|
+
`
|
|
1248
|
+
);
|
|
1249
|
+
return new I({ data: r, dataType: g.STRING, timeRange: e });
|
|
1163
1250
|
}
|
|
1164
1251
|
static fromJSON(t, e) {
|
|
1165
|
-
const
|
|
1252
|
+
const r = new TextEncoder().encode(
|
|
1166
1253
|
`${t.map((i) => $.encodeString(i)).join(`
|
|
1167
1254
|
`)}
|
|
1168
1255
|
`
|
|
1169
1256
|
);
|
|
1170
|
-
return new I({ data:
|
|
1257
|
+
return new I({ data: r, dataType: g.JSON, timeRange: e });
|
|
1171
1258
|
}
|
|
1172
1259
|
acquire(t) {
|
|
1173
1260
|
this._refCount++, t != null && this.updateGLBuffer(t);
|
|
@@ -1193,13 +1280,13 @@ const xt = o.union([
|
|
|
1193
1280
|
}
|
|
1194
1281
|
writeVariable(t) {
|
|
1195
1282
|
if (this.writePos === B) return 0;
|
|
1196
|
-
const e = this.byteCapacity.valueOf() - this.writePos,
|
|
1197
|
-
return this.writeToUnderlyingData(
|
|
1283
|
+
const e = this.byteCapacity.valueOf() - this.writePos, r = t.subBytes(0, e);
|
|
1284
|
+
return this.writeToUnderlyingData(r), this.writePos += r.byteLength.valueOf(), this._cachedLength != null && (this._cachedLength += r.length, this.calculateCachedLength()), r.length;
|
|
1198
1285
|
}
|
|
1199
1286
|
writeFixed(t) {
|
|
1200
1287
|
if (this.writePos === B) return 0;
|
|
1201
|
-
const e = this.capacity - this.writePos,
|
|
1202
|
-
return this.writeToUnderlyingData(
|
|
1288
|
+
const e = this.capacity - this.writePos, r = t.sub(0, e);
|
|
1289
|
+
return this.writeToUnderlyingData(r), this._cachedLength = void 0, this.maybeRecomputeMinMax(r), this.writePos += r.length, r.length;
|
|
1203
1290
|
}
|
|
1204
1291
|
writeToUnderlyingData(t) {
|
|
1205
1292
|
this.underlyingData.set(
|
|
@@ -1209,7 +1296,7 @@ const xt = o.union([
|
|
|
1209
1296
|
}
|
|
1210
1297
|
/** @returns the underlying buffer backing this array. */
|
|
1211
1298
|
get buffer() {
|
|
1212
|
-
return this._data
|
|
1299
|
+
return typeof this._data == "object" && "buffer" in this._data ? this._data.buffer : this._data;
|
|
1213
1300
|
}
|
|
1214
1301
|
get underlyingData() {
|
|
1215
1302
|
return new this.dataType.Array(this._data);
|
|
@@ -1228,9 +1315,12 @@ const xt = o.union([
|
|
|
1228
1315
|
if (!this.dataType.equals(g.UUID))
|
|
1229
1316
|
throw new Error("cannot convert non-uuid series to uuids");
|
|
1230
1317
|
const t = g.UUID.density.valueOf(), e = Array(this.length);
|
|
1231
|
-
for (let
|
|
1232
|
-
const i = this.underlyingData.slice(
|
|
1233
|
-
|
|
1318
|
+
for (let r = 0; r < this.length; r++) {
|
|
1319
|
+
const i = this.underlyingData.slice(r * t, (r + 1) * t), f = Array.from(
|
|
1320
|
+
new Uint8Array(i.buffer),
|
|
1321
|
+
(h) => h.toString(16).padStart(2, "0")
|
|
1322
|
+
).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
|
|
1323
|
+
e[r] = f;
|
|
1234
1324
|
}
|
|
1235
1325
|
return e;
|
|
1236
1326
|
}
|
|
@@ -1266,8 +1356,8 @@ const xt = o.union([
|
|
|
1266
1356
|
throw new Error("cannot calculate length of a non-variable length data type");
|
|
1267
1357
|
let t = 0;
|
|
1268
1358
|
const e = [0];
|
|
1269
|
-
return this.data.forEach((
|
|
1270
|
-
|
|
1359
|
+
return this.data.forEach((r, i) => {
|
|
1360
|
+
r === q && (t++, e.push(i + 1));
|
|
1271
1361
|
}), this._cachedIndexes = e, this._cachedLength = t, t;
|
|
1272
1362
|
}
|
|
1273
1363
|
/**
|
|
@@ -1281,11 +1371,11 @@ const xt = o.union([
|
|
|
1281
1371
|
*/
|
|
1282
1372
|
convert(t, e = 0) {
|
|
1283
1373
|
if (this.dataType.equals(t)) return this;
|
|
1284
|
-
const
|
|
1374
|
+
const r = new t.Array(this.length);
|
|
1285
1375
|
for (let i = 0; i < this.length; i++)
|
|
1286
|
-
|
|
1376
|
+
r[i] = ct(this.dataType, t, this.data[i], e);
|
|
1287
1377
|
return new I({
|
|
1288
|
-
data:
|
|
1378
|
+
data: r.buffer,
|
|
1289
1379
|
dataType: t,
|
|
1290
1380
|
timeRange: this._timeRange,
|
|
1291
1381
|
sampleOffset: e,
|
|
@@ -1299,10 +1389,10 @@ const xt = o.union([
|
|
|
1299
1389
|
this._cachedMax = this.data[this.data.length - 1];
|
|
1300
1390
|
else if (this.dataType.usesBigInt) {
|
|
1301
1391
|
const t = this.data;
|
|
1302
|
-
this._cachedMax = t.reduce((e,
|
|
1392
|
+
this._cachedMax = t.reduce((e, r) => e > r ? e : r);
|
|
1303
1393
|
} else {
|
|
1304
1394
|
const t = this.data;
|
|
1305
|
-
this._cachedMax = t.reduce((e,
|
|
1395
|
+
this._cachedMax = t.reduce((e, r) => e > r ? e : r);
|
|
1306
1396
|
}
|
|
1307
1397
|
return this._cachedMax;
|
|
1308
1398
|
}
|
|
@@ -1317,10 +1407,10 @@ const xt = o.union([
|
|
|
1317
1407
|
if (this.dataType.equals(g.TIMESTAMP)) this._cachedMin = this.data[0];
|
|
1318
1408
|
else if (this.dataType.usesBigInt) {
|
|
1319
1409
|
const t = this.data;
|
|
1320
|
-
this._cachedMin = t.reduce((e,
|
|
1410
|
+
this._cachedMin = t.reduce((e, r) => e < r ? e : r);
|
|
1321
1411
|
} else {
|
|
1322
1412
|
const t = this.data;
|
|
1323
|
-
this._cachedMin = t.reduce((e,
|
|
1413
|
+
this._cachedMin = t.reduce((e, r) => e < r ? e : r);
|
|
1324
1414
|
}
|
|
1325
1415
|
return this._cachedMin;
|
|
1326
1416
|
}
|
|
@@ -1351,45 +1441,45 @@ const xt = o.union([
|
|
|
1351
1441
|
return C(this.max, -this.min);
|
|
1352
1442
|
}
|
|
1353
1443
|
atAlignment(t, e) {
|
|
1354
|
-
const
|
|
1355
|
-
if (
|
|
1356
|
-
if (e === !0) throw new Error(`[series] - no value at index ${
|
|
1444
|
+
const r = Number(t - this.alignment);
|
|
1445
|
+
if (r < 0 || r >= this.length) {
|
|
1446
|
+
if (e === !0) throw new Error(`[series] - no value at index ${r}`);
|
|
1357
1447
|
return;
|
|
1358
1448
|
}
|
|
1359
|
-
return this.at(
|
|
1449
|
+
return this.at(r, e);
|
|
1360
1450
|
}
|
|
1361
1451
|
at(t, e) {
|
|
1362
1452
|
if (this.dataType.isVariable) return this.atVariable(t, e ?? !1);
|
|
1363
1453
|
t < 0 && (t = this.length + t);
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1454
|
+
const r = this.data[t];
|
|
1455
|
+
if (r == null) {
|
|
1366
1456
|
if (e === !0) throw new Error(`[series] - no value at index ${t}`);
|
|
1367
1457
|
return;
|
|
1368
1458
|
}
|
|
1369
|
-
return C(
|
|
1459
|
+
return C(r, this.sampleOffset);
|
|
1370
1460
|
}
|
|
1371
1461
|
atVariable(t, e) {
|
|
1372
|
-
let
|
|
1462
|
+
let r = 0, i = 0;
|
|
1373
1463
|
if (this._cachedIndexes != null)
|
|
1374
|
-
|
|
1464
|
+
r = this._cachedIndexes[t], i = this._cachedIndexes[t + 1] - 1;
|
|
1375
1465
|
else {
|
|
1376
1466
|
t < 0 && (t = this.length + t);
|
|
1377
1467
|
for (let h = 0; h < this.data.length; h++)
|
|
1378
|
-
if (this.data[h] ===
|
|
1468
|
+
if (this.data[h] === q) {
|
|
1379
1469
|
if (t === 0) {
|
|
1380
1470
|
i = h;
|
|
1381
1471
|
break;
|
|
1382
1472
|
}
|
|
1383
|
-
|
|
1473
|
+
r = h + 1, t--;
|
|
1384
1474
|
}
|
|
1385
|
-
if (i === 0 && (i = this.data.length),
|
|
1475
|
+
if (i === 0 && (i = this.data.length), r >= i || t > 0) {
|
|
1386
1476
|
if (e) throw new Error(`[series] - no value at index ${t}`);
|
|
1387
1477
|
return;
|
|
1388
1478
|
}
|
|
1389
1479
|
}
|
|
1390
|
-
const
|
|
1391
|
-
return this.dataType.equals(g.STRING) ? new TextDecoder().decode(
|
|
1392
|
-
JSON.parse(new TextDecoder().decode(
|
|
1480
|
+
const f = this.data.slice(r, i);
|
|
1481
|
+
return this.dataType.equals(g.STRING) ? new TextDecoder().decode(f) : nt(
|
|
1482
|
+
JSON.parse(new TextDecoder().decode(f))
|
|
1393
1483
|
);
|
|
1394
1484
|
}
|
|
1395
1485
|
/**
|
|
@@ -1398,29 +1488,29 @@ const xt = o.union([
|
|
|
1398
1488
|
* @param value the value to search for.
|
|
1399
1489
|
*/
|
|
1400
1490
|
binarySearch(t) {
|
|
1401
|
-
let e = 0,
|
|
1402
|
-
const i =
|
|
1403
|
-
for (; e <=
|
|
1404
|
-
const
|
|
1405
|
-
if (h === 0) return
|
|
1406
|
-
h < 0 ? e =
|
|
1491
|
+
let e = 0, r = this.length - 1;
|
|
1492
|
+
const i = st(t);
|
|
1493
|
+
for (; e <= r; ) {
|
|
1494
|
+
const f = Math.floor((e + r) / 2), h = i(this.at(f, !0), t);
|
|
1495
|
+
if (h === 0) return f;
|
|
1496
|
+
h < 0 ? e = f + 1 : r = f - 1;
|
|
1407
1497
|
}
|
|
1408
1498
|
return e;
|
|
1409
1499
|
}
|
|
1410
1500
|
updateGLBuffer(t) {
|
|
1411
1501
|
if (this.gl.control = t, !this.dataType.equals(g.FLOAT32))
|
|
1412
1502
|
throw new Error("Only FLOAT32 arrays can be used in WebGL");
|
|
1413
|
-
const { buffer: e, bufferUsage:
|
|
1503
|
+
const { buffer: e, bufferUsage: r, prevBuffer: i } = this.gl;
|
|
1414
1504
|
if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !== i)
|
|
1415
1505
|
if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !== B) {
|
|
1416
1506
|
i === 0 && t.bufferData(t.ARRAY_BUFFER, this.byteCapacity.valueOf(), t.STATIC_DRAW);
|
|
1417
|
-
const
|
|
1418
|
-
t.bufferSubData(t.ARRAY_BUFFER,
|
|
1507
|
+
const f = this.dataType.density.size(i).valueOf(), h = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
|
|
1508
|
+
t.bufferSubData(t.ARRAY_BUFFER, f, h.buffer), this.gl.prevBuffer = this.writePos;
|
|
1419
1509
|
} else
|
|
1420
1510
|
t.bufferData(
|
|
1421
1511
|
t.ARRAY_BUFFER,
|
|
1422
|
-
this.
|
|
1423
|
-
|
|
1512
|
+
this.buffer,
|
|
1513
|
+
r === "static" ? t.STATIC_DRAW : t.DYNAMIC_DRAW
|
|
1424
1514
|
), this.gl.prevBuffer = B;
|
|
1425
1515
|
}
|
|
1426
1516
|
as(t) {
|
|
@@ -1453,7 +1543,10 @@ const xt = o.union([
|
|
|
1453
1543
|
key: this.key,
|
|
1454
1544
|
dataType: this.dataType.toString(),
|
|
1455
1545
|
sampleOffset: this.sampleOffset,
|
|
1456
|
-
alignment:
|
|
1546
|
+
alignment: {
|
|
1547
|
+
lower: J(this.alignmentBounds.lower),
|
|
1548
|
+
upper: J(this.alignmentBounds.upper)
|
|
1549
|
+
},
|
|
1457
1550
|
timeRange: (t = this._timeRange) == null ? void 0 : t.toString(),
|
|
1458
1551
|
length: this.length,
|
|
1459
1552
|
capacity: this.capacity
|
|
@@ -1479,10 +1572,10 @@ const xt = o.union([
|
|
|
1479
1572
|
}
|
|
1480
1573
|
[Symbol.iterator]() {
|
|
1481
1574
|
if (this.dataType.isVariable) {
|
|
1482
|
-
const t = new
|
|
1483
|
-
return this.dataType.equals(g.JSON) ? new
|
|
1575
|
+
const t = new mt(this);
|
|
1576
|
+
return this.dataType.equals(g.JSON) ? new Ot(t) : t;
|
|
1484
1577
|
}
|
|
1485
|
-
return new
|
|
1578
|
+
return new wt(this);
|
|
1486
1579
|
}
|
|
1487
1580
|
slice(t, e) {
|
|
1488
1581
|
return this.sliceSub(!1, t, e);
|
|
@@ -1502,9 +1595,9 @@ const xt = o.union([
|
|
|
1502
1595
|
}
|
|
1503
1596
|
subBytes(t, e) {
|
|
1504
1597
|
if (t >= 0 && (e == null || e >= this.byteLength.valueOf())) return this;
|
|
1505
|
-
const
|
|
1598
|
+
const r = this.data.subarray(t, e);
|
|
1506
1599
|
return new I({
|
|
1507
|
-
data:
|
|
1600
|
+
data: r,
|
|
1508
1601
|
dataType: this.dataType,
|
|
1509
1602
|
timeRange: this._timeRange,
|
|
1510
1603
|
sampleOffset: this.sampleOffset,
|
|
@@ -1512,10 +1605,10 @@ const xt = o.union([
|
|
|
1512
1605
|
alignment: this.alignment + BigInt(t)
|
|
1513
1606
|
});
|
|
1514
1607
|
}
|
|
1515
|
-
sliceSub(t, e,
|
|
1516
|
-
if (e <= 0 && (
|
|
1608
|
+
sliceSub(t, e, r) {
|
|
1609
|
+
if (e <= 0 && (r == null || r >= this.length)) return this;
|
|
1517
1610
|
let i;
|
|
1518
|
-
return t ? i = this.data.subarray(e,
|
|
1611
|
+
return t ? i = this.data.subarray(e, r) : i = this.data.slice(e, r), new I({
|
|
1519
1612
|
data: i,
|
|
1520
1613
|
dataType: this.dataType,
|
|
1521
1614
|
timeRange: this._timeRange,
|
|
@@ -1535,22 +1628,27 @@ const xt = o.union([
|
|
|
1535
1628
|
});
|
|
1536
1629
|
}
|
|
1537
1630
|
};
|
|
1538
|
-
s(I, "crudeZ",
|
|
1631
|
+
s(I, "crudeZ", l.object({
|
|
1539
1632
|
timeRange: E.z.optional(),
|
|
1540
1633
|
dataType: g.z,
|
|
1541
|
-
alignment:
|
|
1542
|
-
data:
|
|
1543
|
-
|
|
1634
|
+
alignment: ut.optional(),
|
|
1635
|
+
data: l.union([
|
|
1636
|
+
dt,
|
|
1637
|
+
gt,
|
|
1638
|
+
l.instanceof(ArrayBuffer),
|
|
1639
|
+
l.instanceof(Uint8Array)
|
|
1640
|
+
]),
|
|
1641
|
+
glBufferUsage: ft.optional().default("static").optional()
|
|
1544
1642
|
})), s(I, "z", I.crudeZ.transform((t) => new I(t)));
|
|
1545
1643
|
let V = I;
|
|
1546
1644
|
class G {
|
|
1547
|
-
constructor(t, e,
|
|
1645
|
+
constructor(t, e, r) {
|
|
1548
1646
|
s(this, "series");
|
|
1549
1647
|
s(this, "end");
|
|
1550
1648
|
s(this, "index");
|
|
1551
1649
|
this.series = t;
|
|
1552
1650
|
const i = L(0, t.length);
|
|
1553
|
-
this.end = k(i,
|
|
1651
|
+
this.end = k(i, r), this.index = k(i, e);
|
|
1554
1652
|
}
|
|
1555
1653
|
next() {
|
|
1556
1654
|
return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
|
|
@@ -1559,7 +1657,7 @@ class G {
|
|
|
1559
1657
|
return this;
|
|
1560
1658
|
}
|
|
1561
1659
|
}
|
|
1562
|
-
class
|
|
1660
|
+
class mt {
|
|
1563
1661
|
constructor(t) {
|
|
1564
1662
|
s(this, "series");
|
|
1565
1663
|
s(this, "index");
|
|
@@ -1572,19 +1670,19 @@ class gt {
|
|
|
1572
1670
|
}
|
|
1573
1671
|
next() {
|
|
1574
1672
|
const t = this.index, e = this.series.data;
|
|
1575
|
-
for (; this.index < e.length && e[this.index] !==
|
|
1576
|
-
const
|
|
1577
|
-
return t ===
|
|
1673
|
+
for (; this.index < e.length && e[this.index] !== q; ) this.index++;
|
|
1674
|
+
const r = this.index;
|
|
1675
|
+
return t === r ? { done: !0, value: void 0 } : (this.index++, { done: !1, value: this.decoder.decode(this.series.buffer.slice(t, r)) });
|
|
1578
1676
|
}
|
|
1579
1677
|
[Symbol.iterator]() {
|
|
1580
1678
|
return this;
|
|
1581
1679
|
}
|
|
1582
1680
|
}
|
|
1583
|
-
var
|
|
1584
|
-
class
|
|
1681
|
+
var W, j;
|
|
1682
|
+
class Ot {
|
|
1585
1683
|
constructor(t) {
|
|
1586
1684
|
s(this, "wrapped");
|
|
1587
|
-
s(this,
|
|
1685
|
+
s(this, W, "JSONSeriesIterator");
|
|
1588
1686
|
this.wrapped = t;
|
|
1589
1687
|
}
|
|
1590
1688
|
next() {
|
|
@@ -1594,16 +1692,16 @@ class mt {
|
|
|
1594
1692
|
value: $.decodeString(t.value)
|
|
1595
1693
|
};
|
|
1596
1694
|
}
|
|
1597
|
-
[(
|
|
1695
|
+
[(j = Symbol.iterator, W = Symbol.toStringTag, j)]() {
|
|
1598
1696
|
return this;
|
|
1599
1697
|
}
|
|
1600
1698
|
}
|
|
1601
|
-
var
|
|
1602
|
-
class
|
|
1699
|
+
var H, K;
|
|
1700
|
+
class wt {
|
|
1603
1701
|
constructor(t) {
|
|
1604
1702
|
s(this, "series");
|
|
1605
1703
|
s(this, "index");
|
|
1606
|
-
s(this,
|
|
1704
|
+
s(this, H, "SeriesIterator");
|
|
1607
1705
|
this.series = t, this.index = 0;
|
|
1608
1706
|
}
|
|
1609
1707
|
next() {
|
|
@@ -1612,18 +1710,18 @@ class Ot {
|
|
|
1612
1710
|
value: this.series.at(this.index++, !0)
|
|
1613
1711
|
};
|
|
1614
1712
|
}
|
|
1615
|
-
[(K = Symbol.iterator,
|
|
1713
|
+
[(K = Symbol.iterator, H = Symbol.toStringTag, K)]() {
|
|
1616
1714
|
return this;
|
|
1617
1715
|
}
|
|
1618
1716
|
}
|
|
1619
|
-
const C = (
|
|
1620
|
-
class
|
|
1717
|
+
const C = (o, t) => typeof o == "bigint" && typeof t == "bigint" || typeof o == "number" && typeof t == "number" ? o + t : t === 0 ? o : o === 0 ? t : Number(o) + Number(t);
|
|
1718
|
+
class Dt {
|
|
1621
1719
|
constructor(t) {
|
|
1622
1720
|
s(this, "series");
|
|
1623
1721
|
if (t.length !== 0) {
|
|
1624
1722
|
const e = t[0].dataType;
|
|
1625
|
-
for (let
|
|
1626
|
-
if (!t[
|
|
1723
|
+
for (let r = 1; r < t.length; r++)
|
|
1724
|
+
if (!t[r].dataType.equals(e))
|
|
1627
1725
|
throw new Error("[multi-series] - series must have the same data type");
|
|
1628
1726
|
}
|
|
1629
1727
|
this.series = t;
|
|
@@ -1664,38 +1762,38 @@ class Ct {
|
|
|
1664
1762
|
if (e) throw new Error(`[series] - no value at alignment ${t}`);
|
|
1665
1763
|
return;
|
|
1666
1764
|
}
|
|
1667
|
-
for (const
|
|
1668
|
-
if (D(
|
|
1669
|
-
return
|
|
1765
|
+
for (const r of this.series)
|
|
1766
|
+
if (D(r.alignmentBounds, t))
|
|
1767
|
+
return r.atAlignment(t, e);
|
|
1670
1768
|
if (e) throw new Error(`[series] - no value at alignment ${t}`);
|
|
1671
1769
|
}
|
|
1672
1770
|
at(t, e = !1) {
|
|
1673
1771
|
t < 0 && (t = this.length + t);
|
|
1674
|
-
for (const
|
|
1675
|
-
if (t <
|
|
1676
|
-
t -=
|
|
1772
|
+
for (const r of this.series) {
|
|
1773
|
+
if (t < r.length) return r.at(t, e);
|
|
1774
|
+
t -= r.length;
|
|
1677
1775
|
}
|
|
1678
1776
|
if (e) throw new Error(`[series] - no value at index ${t}`);
|
|
1679
1777
|
}
|
|
1680
1778
|
subIterator(t, e) {
|
|
1681
|
-
return new
|
|
1779
|
+
return new P(this, t, e ?? this.length);
|
|
1682
1780
|
}
|
|
1683
1781
|
subAlignmentIterator(t, e) {
|
|
1684
1782
|
if (t >= this.alignmentBounds.upper || e <= this.alignmentBounds.lower)
|
|
1685
|
-
return
|
|
1686
|
-
let
|
|
1687
|
-
for (let
|
|
1688
|
-
const h = this.series[
|
|
1783
|
+
return Y;
|
|
1784
|
+
let r = 0;
|
|
1785
|
+
for (let f = 0; f < this.series.length; f++) {
|
|
1786
|
+
const h = this.series[f];
|
|
1689
1787
|
if (t < h.alignment) break;
|
|
1690
|
-
if (t >= h.alignmentBounds.upper)
|
|
1788
|
+
if (t >= h.alignmentBounds.upper) r += h.length;
|
|
1691
1789
|
else if (D(h.alignmentBounds, t)) {
|
|
1692
|
-
|
|
1790
|
+
r += Number(t - h.alignment);
|
|
1693
1791
|
break;
|
|
1694
1792
|
}
|
|
1695
1793
|
}
|
|
1696
1794
|
let i = 0;
|
|
1697
|
-
for (let
|
|
1698
|
-
const h = this.series[
|
|
1795
|
+
for (let f = 0; f < this.series.length; f++) {
|
|
1796
|
+
const h = this.series[f];
|
|
1699
1797
|
if (e < h.alignment) break;
|
|
1700
1798
|
if (e >= h.alignmentBounds.upper) i += h.length;
|
|
1701
1799
|
else if (D(h.alignmentBounds, e)) {
|
|
@@ -1703,21 +1801,21 @@ class Ct {
|
|
|
1703
1801
|
break;
|
|
1704
1802
|
}
|
|
1705
1803
|
}
|
|
1706
|
-
return new
|
|
1804
|
+
return new P(this, r, i);
|
|
1707
1805
|
}
|
|
1708
1806
|
subAlignmentSpanIterator(t, e) {
|
|
1709
|
-
if (t >= this.alignmentBounds.upper) return
|
|
1710
|
-
let
|
|
1807
|
+
if (t >= this.alignmentBounds.upper) return Y;
|
|
1808
|
+
let r = 0;
|
|
1711
1809
|
for (let i = 0; i < this.series.length; i++) {
|
|
1712
|
-
const
|
|
1713
|
-
if (t <
|
|
1714
|
-
if (t >=
|
|
1715
|
-
else if (D(
|
|
1716
|
-
|
|
1810
|
+
const f = this.series[i];
|
|
1811
|
+
if (t < f.alignment) break;
|
|
1812
|
+
if (t >= f.alignmentBounds.upper) r += f.length;
|
|
1813
|
+
else if (D(f.alignmentBounds, t)) {
|
|
1814
|
+
r += Number(t - f.alignment);
|
|
1717
1815
|
break;
|
|
1718
1816
|
}
|
|
1719
1817
|
}
|
|
1720
|
-
return new
|
|
1818
|
+
return new P(this, r, r + e);
|
|
1721
1819
|
}
|
|
1722
1820
|
get byteLength() {
|
|
1723
1821
|
return new x(this.series.reduce((t, e) => t + e.byteLength.valueOf(), 0));
|
|
@@ -1725,17 +1823,17 @@ class Ct {
|
|
|
1725
1823
|
get data() {
|
|
1726
1824
|
const t = new this.dataType.Array(this.length);
|
|
1727
1825
|
let e = 0;
|
|
1728
|
-
for (const
|
|
1729
|
-
t.set(
|
|
1730
|
-
return new this.dataType.Array(t);
|
|
1826
|
+
for (const r of this.series)
|
|
1827
|
+
t.set(r.data, e), e += r.length;
|
|
1828
|
+
return new this.dataType.Array(t.buffer);
|
|
1731
1829
|
}
|
|
1732
1830
|
traverseAlignment(t, e) {
|
|
1733
|
-
const
|
|
1734
|
-
return
|
|
1831
|
+
const r = this.series.map((i) => i.alignmentBounds);
|
|
1832
|
+
return it(r, t, e);
|
|
1735
1833
|
}
|
|
1736
1834
|
distance(t, e) {
|
|
1737
|
-
const
|
|
1738
|
-
return
|
|
1835
|
+
const r = this.series.map((i) => i.alignmentBounds);
|
|
1836
|
+
return at(r, t, e);
|
|
1739
1837
|
}
|
|
1740
1838
|
[Symbol.iterator]() {
|
|
1741
1839
|
return this.series.length === 0 ? {
|
|
@@ -1745,7 +1843,7 @@ class Ct {
|
|
|
1745
1843
|
} : new yt(this.series);
|
|
1746
1844
|
}
|
|
1747
1845
|
}
|
|
1748
|
-
var z,
|
|
1846
|
+
var z, X;
|
|
1749
1847
|
class yt {
|
|
1750
1848
|
constructor(t) {
|
|
1751
1849
|
s(this, "series");
|
|
@@ -1758,16 +1856,16 @@ class yt {
|
|
|
1758
1856
|
const t = this.internal.next();
|
|
1759
1857
|
return t.done === !1 ? t : this.seriesIndex === this.series.length - 1 ? { done: !0, value: void 0 } : (this.internal = this.series[++this.seriesIndex][Symbol.iterator](), this.next());
|
|
1760
1858
|
}
|
|
1761
|
-
[(
|
|
1859
|
+
[(X = Symbol.iterator, z = Symbol.toStringTag, X)]() {
|
|
1762
1860
|
return this;
|
|
1763
1861
|
}
|
|
1764
1862
|
}
|
|
1765
|
-
class
|
|
1766
|
-
constructor(t, e,
|
|
1863
|
+
class P {
|
|
1864
|
+
constructor(t, e, r) {
|
|
1767
1865
|
s(this, "series");
|
|
1768
1866
|
s(this, "index");
|
|
1769
1867
|
s(this, "end");
|
|
1770
|
-
this.series = t, this.end =
|
|
1868
|
+
this.series = t, this.end = r, this.index = e;
|
|
1771
1869
|
}
|
|
1772
1870
|
next() {
|
|
1773
1871
|
return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
|
|
@@ -1776,20 +1874,25 @@ class F {
|
|
|
1776
1874
|
return this;
|
|
1777
1875
|
}
|
|
1778
1876
|
}
|
|
1877
|
+
const J = (o) => {
|
|
1878
|
+
const t = o >> 32n, e = o & 0xffffffffn;
|
|
1879
|
+
return { domain: t, sample: e };
|
|
1880
|
+
};
|
|
1779
1881
|
export {
|
|
1780
1882
|
b as D,
|
|
1781
|
-
|
|
1782
|
-
|
|
1883
|
+
Dt as M,
|
|
1884
|
+
F as R,
|
|
1783
1885
|
V as S,
|
|
1784
1886
|
m as T,
|
|
1785
1887
|
C as a,
|
|
1786
|
-
|
|
1888
|
+
w as b,
|
|
1787
1889
|
E as c,
|
|
1788
1890
|
g as d,
|
|
1789
1891
|
x as e,
|
|
1790
|
-
|
|
1892
|
+
tt as f,
|
|
1791
1893
|
ct as g,
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1894
|
+
xt as h,
|
|
1895
|
+
ht as i,
|
|
1896
|
+
Ct as s,
|
|
1897
|
+
Lt as t
|
|
1795
1898
|
};
|