@synnaxlabs/x 0.43.0 → 0.44.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 +105 -93
- package/dist/base-BAM2mqCy.cjs +1 -0
- package/dist/base-DFq0vvGn.js +38 -0
- package/dist/binary.cjs +1 -1
- package/dist/binary.js +1 -1
- package/dist/bounds-D6e9xoHt.cjs +1 -0
- package/dist/bounds-Dj9nG39I.js +174 -0
- package/dist/bounds.cjs +1 -1
- package/dist/bounds.js +2 -2
- package/dist/box-BcGdqkt4.cjs +1 -0
- package/dist/box-D_qdUyEe.js +205 -0
- package/dist/box.cjs +1 -1
- package/dist/box.js +1 -1
- package/dist/caseconv.cjs +1 -1
- package/dist/caseconv.js +2 -2
- package/dist/change-C-YELKx6.cjs +1 -0
- package/dist/change-DLl6DccR.js +12 -0
- package/dist/change.cjs +1 -1
- package/dist/change.js +2 -10
- package/dist/compare.cjs +1 -1
- package/dist/compare.js +1 -1
- package/dist/deep.cjs +1 -1
- package/dist/deep.js +95 -96
- package/dist/dimensions-CRgergMS.js +43 -0
- package/dist/dimensions-D2QGoNXO.cjs +1 -0
- package/dist/dimensions.cjs +1 -1
- package/dist/dimensions.js +2 -41
- package/dist/direction-386XDm2w.cjs +1 -0
- package/dist/{index-DxU1zwsd.js → direction-8etxfKaR.js} +4 -3
- package/dist/direction.cjs +1 -1
- package/dist/direction.js +1 -1
- package/dist/external-B9AAGv50.cjs +1 -0
- package/dist/external-BFgJjMcS.js +23 -0
- package/dist/external-BPgtxa8d.js +29 -0
- package/dist/external-BYuXBYJh.js +40 -0
- package/dist/external-mffsMzJx.cjs +1 -0
- package/dist/external-uXk0Avrg.cjs +1 -0
- package/dist/index-B1m2qvBT.cjs +1 -0
- package/dist/{index-4GlOgZuh.js → index-B5l_quQn.js} +35 -42
- package/dist/index-BQe8OIgm.cjs +3 -0
- package/dist/index-D2xcvEO5.js +46 -0
- package/dist/index-DdhM_E4k.cjs +1 -0
- package/dist/index-PNh31WTW.js +125 -0
- package/dist/index.cjs +3 -5
- package/dist/index.js +685 -5363
- package/dist/kv.cjs +1 -1
- package/dist/kv.js +2 -45
- package/dist/{index-D6V-8SKw.js → location-Ar5y2DX2.js} +26 -26
- package/dist/location-DZi8ftXp.cjs +1 -0
- package/dist/location.cjs +1 -1
- package/dist/location.js +1 -1
- package/dist/observe.cjs +1 -1
- package/dist/observe.js +16 -20
- package/dist/path-BXdMenka.js +101 -0
- package/dist/path-st_E5-LJ.cjs +1 -0
- package/dist/position-DAL0Qqdf.cjs +1 -0
- package/dist/position-bA6pUwLn.js +85 -0
- package/dist/position.cjs +1 -1
- package/dist/position.js +2 -83
- package/dist/record-CAcQ5PNX.js +14 -0
- package/dist/record-YvCh7bzB.cjs +1 -0
- package/dist/record.cjs +1 -1
- package/dist/record.js +2 -8
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +2 -27
- package/dist/scale-Bzn1Cl0r.cjs +1 -0
- package/dist/{index-BUa-NXAX.js → scale-CdTNWu-d.js} +55 -59
- package/dist/scale.cjs +1 -1
- package/dist/scale.js +1 -1
- package/dist/{index-DBGAIs_7.js → series-BeJyqCoP.js} +835 -759
- package/dist/series-anlpaR_I.cjs +6 -0
- package/dist/spatial-BSWPzMkK.js +11 -0
- package/dist/spatial-DGpZ2sO3.cjs +1 -0
- package/dist/spatial.cjs +1 -1
- package/dist/spatial.js +18 -25
- package/dist/src/binary/codec.d.ts +1 -1
- package/dist/src/binary/codec.d.ts.map +1 -1
- package/dist/src/breaker/breaker.d.ts +2 -2
- package/dist/src/breaker/breaker.d.ts.map +1 -1
- package/dist/src/caseconv/caseconv.d.ts +0 -1
- package/dist/src/caseconv/caseconv.d.ts.map +1 -1
- package/dist/src/change/change.d.ts +1 -1
- package/dist/src/change/change.d.ts.map +1 -1
- package/dist/src/color/color.d.ts +2 -2
- package/dist/src/color/color.d.ts.map +1 -1
- package/dist/src/color/gradient.d.ts +1 -1
- package/dist/src/color/gradient.d.ts.map +1 -1
- package/dist/src/color/palette.d.ts +3 -3
- package/dist/src/color/palette.d.ts.map +1 -1
- package/dist/src/compare/compare.d.ts +4 -4
- package/dist/src/compare/compare.d.ts.map +1 -1
- package/dist/src/control/control.d.ts +9 -9
- package/dist/src/control/control.d.ts.map +1 -1
- package/dist/src/deep/merge.d.ts +1 -1
- package/dist/src/deep/merge.d.ts.map +1 -1
- package/dist/src/deep/path.d.ts +6 -6
- package/dist/src/deep/path.d.ts.map +1 -1
- package/dist/src/destructor.d.ts +6 -2
- package/dist/src/destructor.d.ts.map +1 -1
- package/dist/src/errors/errors.d.ts +5 -1
- package/dist/src/errors/errors.d.ts.map +1 -1
- package/dist/src/flush.d.ts +11 -0
- package/dist/src/flush.d.ts.map +1 -0
- package/dist/src/id/id.d.ts +1 -0
- package/dist/src/id/id.d.ts.map +1 -1
- package/dist/src/identity.d.ts +2 -2
- package/dist/src/identity.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/jsonrpc/jsonrpc.d.ts +1 -1
- package/dist/src/jsonrpc/jsonrpc.d.ts.map +1 -1
- package/dist/src/kv/types.d.ts +1 -1
- package/dist/src/kv/types.d.ts.map +1 -1
- package/dist/src/map/index.d.ts +2 -0
- package/dist/src/map/index.d.ts.map +1 -0
- package/dist/src/map/map.d.ts +2 -0
- package/dist/src/map/map.d.ts.map +1 -0
- package/dist/src/map/map.spec.d.ts +2 -0
- package/dist/src/map/map.spec.d.ts.map +1 -0
- package/dist/src/math/math.d.ts +2 -4
- package/dist/src/math/math.d.ts.map +1 -1
- package/dist/src/migrate/migrate.d.ts +1 -1
- package/dist/src/migrate/migrate.d.ts.map +1 -1
- package/dist/src/notation/notation.d.ts +1 -1
- package/dist/src/notation/notation.d.ts.map +1 -1
- package/dist/src/optional.d.ts +0 -3
- package/dist/src/optional.d.ts.map +1 -1
- package/dist/src/record/index.d.ts +2 -0
- package/dist/src/record/index.d.ts.map +1 -0
- package/dist/src/record/record.d.ts +90 -0
- package/dist/src/record/record.d.ts.map +1 -0
- package/dist/src/record/record.spec.d.ts.map +1 -0
- package/dist/src/runtime/os.d.ts +1 -1
- package/dist/src/runtime/os.d.ts.map +1 -1
- package/dist/src/spatial/base.d.ts +1 -1
- package/dist/src/spatial/base.d.ts.map +1 -1
- package/dist/src/spatial/box/box.d.ts +1 -1
- package/dist/src/spatial/box/box.d.ts.map +1 -1
- package/dist/src/spatial/dimensions/dimensions.d.ts +1 -1
- package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -1
- package/dist/src/spatial/direction/direction.d.ts +3 -3
- package/dist/src/spatial/direction/direction.d.ts.map +1 -1
- package/dist/src/spatial/location/location.d.ts +1 -1
- package/dist/src/spatial/location/location.d.ts.map +1 -1
- package/dist/src/spatial/scale/scale.d.ts +1 -1
- package/dist/src/spatial/scale/scale.d.ts.map +1 -1
- package/dist/src/spatial/xy/xy.d.ts +1 -1
- package/dist/src/spatial/xy/xy.d.ts.map +1 -1
- package/dist/src/status/index.d.ts +1 -1
- package/dist/src/status/index.d.ts.map +1 -1
- package/dist/src/status/status.d.ts +42 -0
- package/dist/src/status/status.d.ts.map +1 -0
- package/dist/src/status/status.spec.d.ts +2 -0
- package/dist/src/status/status.spec.d.ts.map +1 -0
- package/dist/src/strings/strings.d.ts +16 -0
- package/dist/src/strings/strings.d.ts.map +1 -1
- package/dist/src/telem/gl.d.ts +1 -1
- package/dist/src/telem/gl.d.ts.map +1 -1
- package/dist/src/telem/series.d.ts +17 -16
- package/dist/src/telem/series.d.ts.map +1 -1
- package/dist/src/telem/telem.d.ts +42 -19
- package/dist/src/telem/telem.d.ts.map +1 -1
- package/dist/src/testutil/testutil.d.ts +1 -0
- package/dist/src/testutil/testutil.d.ts.map +1 -1
- package/dist/src/testutil/testutil.spec.d.ts +2 -0
- package/dist/src/testutil/testutil.spec.d.ts.map +1 -0
- package/dist/src/zod/external.d.ts +1 -0
- package/dist/src/zod/external.d.ts.map +1 -1
- package/dist/src/zod/nullToUndefined.d.ts +1 -1
- package/dist/src/zod/nullToUndefined.d.ts.map +1 -1
- package/dist/src/zod/toArray.d.ts +3 -0
- package/dist/src/zod/toArray.d.ts.map +1 -0
- package/dist/src/zod/toArray.spec.d.ts +2 -0
- package/dist/src/zod/toArray.spec.d.ts.map +1 -0
- package/dist/src/zod/util.d.ts +1 -1
- package/dist/src/zod/util.d.ts.map +1 -1
- package/dist/telem.cjs +1 -1
- package/dist/telem.js +10 -11
- package/dist/url.cjs +1 -1
- package/dist/url.js +16 -19
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +18 -22
- package/dist/xy-B7065J2S.cjs +1 -0
- package/dist/{index-C-qYOegc.js → xy-D_LqxaGt.js} +62 -62
- package/dist/xy.cjs +1 -1
- package/dist/xy.js +1 -1
- package/dist/zod.cjs +1 -1
- package/dist/zod.js +2 -19
- package/package.json +13 -18
- package/src/binary/codec.spec.ts +1 -1
- package/src/binary/codec.ts +1 -1
- package/src/breaker/breaker.ts +1 -1
- package/src/caseconv/caseconv.ts +10 -12
- package/src/change/change.ts +1 -1
- package/src/color/color.ts +1 -1
- package/src/color/gradient.ts +1 -1
- package/src/color/palette.ts +1 -1
- package/src/compare/compare.ts +5 -5
- package/src/control/control.ts +2 -2
- package/src/deep/merge.spec.ts +2 -15
- package/src/deep/merge.ts +1 -1
- package/src/deep/path.spec.ts +41 -0
- package/src/deep/path.ts +48 -17
- package/src/destructor.ts +6 -2
- package/src/errors/errors.spec.ts +20 -20
- package/src/errors/errors.ts +4 -1
- package/src/flush.ts +21 -0
- package/src/id/id.spec.ts +1 -1
- package/src/id/id.ts +3 -1
- package/src/identity.ts +2 -2
- package/src/index.ts +3 -1
- package/src/instance/matcher.spec.ts +7 -7
- package/src/jsonrpc/jsonrpc.ts +1 -1
- package/src/kv/types.ts +1 -1
- package/src/map/index.ts +10 -0
- package/src/map/map.spec.ts +132 -0
- package/src/map/map.ts +17 -0
- package/src/math/math.ts +19 -27
- package/src/migrate/migrate.spec.ts +2 -2
- package/src/migrate/migrate.ts +2 -2
- package/src/notation/notation.ts +1 -1
- package/src/optional.ts +0 -4
- package/src/primitive/primitive.spec.ts +1 -1
- package/src/record/index.ts +10 -0
- package/src/record/record.spec.ts +319 -0
- package/src/record/record.ts +118 -0
- package/src/runtime/os.ts +1 -1
- package/src/spatial/base.ts +1 -1
- package/src/spatial/box/box.ts +1 -1
- package/src/spatial/dimensions/dimensions.ts +1 -1
- package/src/spatial/direction/direction.ts +1 -1
- package/src/spatial/location/location.ts +1 -1
- package/src/spatial/scale/scale.ts +1 -1
- package/src/spatial/xy/xy.ts +1 -1
- package/src/status/index.ts +1 -1
- package/src/status/status.spec.ts +25 -0
- package/src/status/status.ts +91 -0
- package/src/strings/strings.spec.ts +51 -13
- package/src/strings/strings.ts +20 -0
- package/src/telem/gl.ts +1 -1
- package/src/telem/series.spec.ts +193 -53
- package/src/telem/series.ts +53 -18
- package/src/telem/telem.spec.ts +202 -83
- package/src/telem/telem.ts +53 -35
- package/src/testutil/testutil.spec.ts +161 -0
- package/src/testutil/testutil.ts +12 -0
- package/src/zod/external.ts +1 -0
- package/src/zod/nullToUndefined.spec.ts +1 -1
- package/src/zod/nullToUndefined.ts +1 -1
- package/src/zod/toArray.spec.ts +182 -0
- package/src/{status/types.ts → zod/toArray.ts} +3 -12
- package/src/zod/util.spec.ts +2 -2
- package/src/zod/util.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +1 -2
- package/dist/base-B5lQIJKc.js +0 -38
- package/dist/base-CTq-lhpU.cjs +0 -1
- package/dist/index-B58dnYRu.cjs +0 -1
- package/dist/index-BMGaoK93.cjs +0 -1
- package/dist/index-BTet04Hd.cjs +0 -6
- package/dist/index-C07SBJhr.js +0 -128
- package/dist/index-C9EdKeu1.js +0 -174
- package/dist/index-CM8ZDZ6s.cjs +0 -1
- package/dist/index-CV2JaHfw.cjs +0 -1
- package/dist/index-CeBvOwG8.cjs +0 -3
- package/dist/index-ClrGyGDp.js +0 -205
- package/dist/index-CqQXXeCI.cjs +0 -1
- package/dist/index-DEdq2tza.cjs +0 -1
- package/dist/index-DKMnHBGR.cjs +0 -1
- package/dist/index-Dql5FMcH.js +0 -47
- package/dist/index-WwMnwoLy.cjs +0 -1
- package/dist/path-1tZLZ4AN.cjs +0 -1
- package/dist/path-DD6ytXzr.js +0 -76
- package/dist/schemas-55Usj0Fg.js +0 -3998
- package/dist/schemas-DbXuI2Qr.cjs +0 -27
- package/dist/search.cjs +0 -1
- package/dist/search.js +0 -14
- package/dist/src/record.d.ts +0 -18
- package/dist/src/record.d.ts.map +0 -1
- package/dist/src/record.spec.d.ts.map +0 -1
- package/dist/src/search.d.ts +0 -18
- package/dist/src/search.d.ts.map +0 -1
- package/dist/src/status/types.d.ts +0 -11
- package/dist/src/status/types.d.ts.map +0 -1
- package/src/record.spec.ts +0 -38
- package/src/record.ts +0 -45
- package/src/search.ts +0 -42
- /package/dist/src/{record.spec.d.ts → record/record.spec.d.ts} +0 -0
|
@@ -1,84 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
function qt(n) {
|
|
19
|
-
return pt(vt, n);
|
|
20
|
-
}
|
|
21
|
-
function $t(n) {
|
|
22
|
-
return St(At, n);
|
|
23
|
-
}
|
|
24
|
-
function st(n) {
|
|
25
|
-
return It(Et, n);
|
|
26
|
-
}
|
|
27
|
-
function Pt(n) {
|
|
28
|
-
return Ut(Bt, n);
|
|
29
|
-
}
|
|
30
|
-
const be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
31
|
-
__proto__: null,
|
|
32
|
-
bigint: st,
|
|
33
|
-
boolean: $t,
|
|
34
|
-
date: Pt,
|
|
35
|
-
number: qt,
|
|
36
|
-
string: Dt
|
|
37
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
38
|
-
let Ft = (n, t = 21) => (e = t) => {
|
|
39
|
-
let r = "", a = e | 0;
|
|
40
|
-
for (; a--; )
|
|
41
|
-
r += n[Math.random() * n.length | 0];
|
|
42
|
-
return r;
|
|
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-PNh31WTW.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";
|
|
6
|
+
import "./box-D_qdUyEe.js";
|
|
7
|
+
import "./dimensions-CRgergMS.js";
|
|
8
|
+
import "./base-DFq0vvGn.js";
|
|
9
|
+
import "./location-Ar5y2DX2.js";
|
|
10
|
+
import "./scale-CdTNWu-d.js";
|
|
11
|
+
import "./xy-D_LqxaGt.js";
|
|
12
|
+
let rt = (i, t = 21) => (e = t) => {
|
|
13
|
+
let s = "", u = e | 0;
|
|
14
|
+
for (; u--; )
|
|
15
|
+
s += i[Math.random() * i.length | 0];
|
|
16
|
+
return s;
|
|
43
17
|
};
|
|
44
|
-
const
|
|
18
|
+
const nt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", G = 11, it = rt(nt, G), J = () => it(), $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
45
19
|
__proto__: null,
|
|
46
|
-
|
|
47
|
-
|
|
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({
|
|
48
23
|
__proto__: null,
|
|
49
|
-
createMatcher:
|
|
50
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
51
|
-
|
|
24
|
+
createMatcher: j
|
|
25
|
+
}, Symbol.toStringTag, { value: "Module" })), at = o.enum(["static", "dynamic"]), ut = o.union([
|
|
26
|
+
o.tuple([o.int()]),
|
|
27
|
+
o.tuple([o.int(), o.int().min(1).max(12)]),
|
|
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);
|
|
52
31
|
if (![
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
].some((
|
|
32
|
+
a.DAY,
|
|
33
|
+
a.HOUR,
|
|
34
|
+
a.MINUTE,
|
|
35
|
+
a.SECOND,
|
|
36
|
+
a.MILLISECOND,
|
|
37
|
+
a.MICROSECOND,
|
|
38
|
+
a.NANOSECOND
|
|
39
|
+
].some((u) => u.equals(e)))
|
|
61
40
|
throw new Error(
|
|
62
41
|
"Invalid argument for remainder. Must be an even TimeSpan or Timestamp"
|
|
63
42
|
);
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
}
|
|
43
|
+
const s = i.valueOf() % e.valueOf();
|
|
44
|
+
return i instanceof n ? new n(s) : new a(s);
|
|
45
|
+
};
|
|
46
|
+
class n extends M {
|
|
67
47
|
constructor(t, e = "UTC") {
|
|
68
|
-
if (t == null) super(
|
|
48
|
+
if (t == null) super(n.now().valueOf());
|
|
69
49
|
else if (t instanceof Date)
|
|
70
|
-
super(BigInt(t.getTime()) *
|
|
50
|
+
super(BigInt(t.getTime()) * n.MILLISECOND.valueOf());
|
|
71
51
|
else if (typeof t == "string")
|
|
72
|
-
super(
|
|
73
|
-
else if (Array.isArray(t)) super(
|
|
52
|
+
super(n.parseDateTimeString(t, e).valueOf());
|
|
53
|
+
else if (Array.isArray(t)) super(n.parseDate(t));
|
|
74
54
|
else {
|
|
75
|
-
let
|
|
76
|
-
t instanceof Number && (t = t.valueOf()), e === "local" && (
|
|
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);
|
|
77
57
|
}
|
|
78
58
|
}
|
|
79
|
-
static parseDate([t = 1970, e = 1,
|
|
80
|
-
const
|
|
81
|
-
return new
|
|
59
|
+
static parseDate([t = 1970, e = 1, s = 1]) {
|
|
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();
|
|
82
62
|
}
|
|
83
63
|
/**
|
|
84
64
|
* @returns the primitive value of the TimeStamp. Overrides standard JS valueOf()
|
|
@@ -88,18 +68,18 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
88
68
|
return this.value;
|
|
89
69
|
}
|
|
90
70
|
static parseTimeString(t, e = "UTC") {
|
|
91
|
-
const [
|
|
92
|
-
let
|
|
93
|
-
f != null && ([
|
|
94
|
-
let
|
|
95
|
-
return e === "local" && (
|
|
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();
|
|
96
76
|
}
|
|
97
77
|
static parseDateTimeString(t, e = "UTC") {
|
|
98
78
|
if (!t.includes("/") && !t.includes("-"))
|
|
99
|
-
return
|
|
100
|
-
const
|
|
101
|
-
return t.includes(":") ||
|
|
102
|
-
BigInt(
|
|
79
|
+
return n.parseTimeString(t, e);
|
|
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(),
|
|
103
83
|
e
|
|
104
84
|
).valueOf();
|
|
105
85
|
}
|
|
@@ -131,20 +111,20 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
131
111
|
}
|
|
132
112
|
}
|
|
133
113
|
toISOString(t = "UTC") {
|
|
134
|
-
return t === "UTC" ? this.date().toISOString() : this.sub(
|
|
114
|
+
return t === "UTC" ? this.date().toISOString() : this.sub(n.utcOffset).date().toISOString();
|
|
135
115
|
}
|
|
136
116
|
timeString(t = !1, e = "UTC") {
|
|
137
|
-
const
|
|
138
|
-
return t ?
|
|
117
|
+
const s = this.toISOString(e);
|
|
118
|
+
return t ? s.slice(11, 23) : s.slice(11, 19);
|
|
139
119
|
}
|
|
140
120
|
dateString() {
|
|
141
|
-
const t = this.date(), e = t.toLocaleString("default", { month: "short" }),
|
|
142
|
-
return `${e} ${
|
|
121
|
+
const t = this.date(), e = t.toLocaleString("default", { month: "short" }), s = t.toLocaleString("default", { day: "numeric" });
|
|
122
|
+
return `${e} ${s}`;
|
|
143
123
|
}
|
|
144
124
|
/** @returns The UTC offset for the time zone of the machine. */
|
|
145
125
|
static get utcOffset() {
|
|
146
|
-
return new
|
|
147
|
-
BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) *
|
|
126
|
+
return new a(
|
|
127
|
+
BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * n.MINUTE.valueOf()
|
|
148
128
|
);
|
|
149
129
|
}
|
|
150
130
|
/**
|
|
@@ -153,7 +133,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
153
133
|
* @param other - The other timestamp.
|
|
154
134
|
*/
|
|
155
135
|
static since(t) {
|
|
156
|
-
return new
|
|
136
|
+
return new n().span(t);
|
|
157
137
|
}
|
|
158
138
|
/** @returns A JavaScript Date object representing the TimeStamp. */
|
|
159
139
|
date() {
|
|
@@ -166,7 +146,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
166
146
|
* @returns True if the TimeStamps are equal, false otherwise.
|
|
167
147
|
*/
|
|
168
148
|
equals(t) {
|
|
169
|
-
return this.valueOf() === new
|
|
149
|
+
return this.valueOf() === new n(t).valueOf();
|
|
170
150
|
}
|
|
171
151
|
/**
|
|
172
152
|
* Creates a TimeSpan representing the duration between the two timestamps.
|
|
@@ -186,7 +166,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
186
166
|
* valid, regardless of the TimeStamp order.
|
|
187
167
|
*/
|
|
188
168
|
range(t) {
|
|
189
|
-
return new
|
|
169
|
+
return new w(this, t).makeValid();
|
|
190
170
|
}
|
|
191
171
|
/**
|
|
192
172
|
* Creates a TimeRange starting at the TimeStamp and spanning the given
|
|
@@ -205,7 +185,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
205
185
|
* @returns True if the TimeStamp represents the unix epoch, false otherwise.
|
|
206
186
|
*/
|
|
207
187
|
get isZero() {
|
|
208
|
-
return this.valueOf() ===
|
|
188
|
+
return this.valueOf() === 0n;
|
|
209
189
|
}
|
|
210
190
|
/**
|
|
211
191
|
* Checks if the TimeStamp is after the given TimeStamp.
|
|
@@ -215,7 +195,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
215
195
|
* otherwise.
|
|
216
196
|
*/
|
|
217
197
|
after(t) {
|
|
218
|
-
return this.valueOf() > new
|
|
198
|
+
return this.valueOf() > new n(t).valueOf();
|
|
219
199
|
}
|
|
220
200
|
/**
|
|
221
201
|
* Checks if the TimeStamp is after or equal to the given TimeStamp.
|
|
@@ -225,7 +205,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
225
205
|
* false otherwise.
|
|
226
206
|
*/
|
|
227
207
|
afterEq(t) {
|
|
228
|
-
return this.valueOf() >= new
|
|
208
|
+
return this.valueOf() >= new n(t).valueOf();
|
|
229
209
|
}
|
|
230
210
|
/**
|
|
231
211
|
* Checks if the TimeStamp is before the given TimeStamp.
|
|
@@ -235,7 +215,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
235
215
|
* otherwise.
|
|
236
216
|
*/
|
|
237
217
|
before(t) {
|
|
238
|
-
return this.valueOf() < new
|
|
218
|
+
return this.valueOf() < new n(t).valueOf();
|
|
239
219
|
}
|
|
240
220
|
/**
|
|
241
221
|
* Checks if TimeStamp is before or equal to the current timestamp.
|
|
@@ -245,7 +225,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
245
225
|
* false otherwise.
|
|
246
226
|
*/
|
|
247
227
|
beforeEq(t) {
|
|
248
|
-
return this.valueOf() <= new
|
|
228
|
+
return this.valueOf() <= new n(t).valueOf();
|
|
249
229
|
}
|
|
250
230
|
/**
|
|
251
231
|
* Adds a TimeSpan to the TimeStamp.
|
|
@@ -255,7 +235,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
255
235
|
* TimeSpan.
|
|
256
236
|
*/
|
|
257
237
|
add(t) {
|
|
258
|
-
return new
|
|
238
|
+
return new n(this.valueOf() + BigInt(t.valueOf()));
|
|
259
239
|
}
|
|
260
240
|
/**
|
|
261
241
|
* Subtracts a TimeSpan from the TimeStamp.
|
|
@@ -265,43 +245,43 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
265
245
|
* TimeSpan.
|
|
266
246
|
*/
|
|
267
247
|
sub(t) {
|
|
268
|
-
return new
|
|
248
|
+
return new n(this.valueOf() - BigInt(t.valueOf()));
|
|
269
249
|
}
|
|
270
250
|
/**
|
|
271
251
|
* @returns the floating point number of hours since the unix epoch to the timestamp
|
|
272
252
|
* value.
|
|
273
253
|
*/
|
|
274
254
|
get hours() {
|
|
275
|
-
return Number(this.valueOf()) / Number(
|
|
255
|
+
return Number(this.valueOf()) / Number(a.HOUR.valueOf());
|
|
276
256
|
}
|
|
277
257
|
/**
|
|
278
258
|
* @returns the floating point number of minutes since the unix epoch to the timestamp
|
|
279
259
|
* value.
|
|
280
260
|
*/
|
|
281
261
|
get minutes() {
|
|
282
|
-
return Number(this.valueOf()) / Number(
|
|
262
|
+
return Number(this.valueOf()) / Number(a.MINUTE.valueOf());
|
|
283
263
|
}
|
|
284
264
|
/**
|
|
285
265
|
* @returns the floating point number of days since the unix epoch to the timestamp
|
|
286
266
|
* value.
|
|
287
267
|
*/
|
|
288
268
|
get days() {
|
|
289
|
-
return Number(this.valueOf()) / Number(
|
|
269
|
+
return Number(this.valueOf()) / Number(a.DAY.valueOf());
|
|
290
270
|
}
|
|
291
271
|
/**
|
|
292
272
|
* @returns the floating point number of seconds since the unix epoch to the timestamp
|
|
293
273
|
* value.
|
|
294
274
|
*/
|
|
295
275
|
get seconds() {
|
|
296
|
-
return Number(this.valueOf()) / Number(
|
|
276
|
+
return Number(this.valueOf()) / Number(a.SECOND.valueOf());
|
|
297
277
|
}
|
|
298
278
|
/** @returns the floating point number of milliseconds since the unix epoch. */
|
|
299
279
|
get milliseconds() {
|
|
300
|
-
return Number(this.valueOf()) / Number(
|
|
280
|
+
return Number(this.valueOf()) / Number(n.MILLISECOND.valueOf());
|
|
301
281
|
}
|
|
302
282
|
/** @returns the floating point number of microseconds since the unix epoch. */
|
|
303
283
|
get microseconds() {
|
|
304
|
-
return Number(this.valueOf()) / Number(
|
|
284
|
+
return Number(this.valueOf()) / Number(n.MICROSECOND.valueOf());
|
|
305
285
|
}
|
|
306
286
|
/**
|
|
307
287
|
* @returns the floating point number of nanoseconds since the unix epoch.
|
|
@@ -321,7 +301,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
321
301
|
*/
|
|
322
302
|
setYear(t) {
|
|
323
303
|
const e = this.date();
|
|
324
|
-
return e.setUTCFullYear(t), new
|
|
304
|
+
return e.setUTCFullYear(t), new n(e);
|
|
325
305
|
}
|
|
326
306
|
/** @returns the integer month that the timestamp corresponds to with its year. */
|
|
327
307
|
get month() {
|
|
@@ -333,7 +313,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
333
313
|
*/
|
|
334
314
|
setMonth(t) {
|
|
335
315
|
const e = this.date();
|
|
336
|
-
return e.setUTCMonth(t), new
|
|
316
|
+
return e.setUTCMonth(t), new n(e);
|
|
337
317
|
}
|
|
338
318
|
/** @returns the integer day that the timestamp corresponds to within its month. */
|
|
339
319
|
get day() {
|
|
@@ -345,7 +325,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
345
325
|
*/
|
|
346
326
|
setDay(t) {
|
|
347
327
|
const e = this.date();
|
|
348
|
-
return e.setUTCDate(t), new
|
|
328
|
+
return e.setUTCDate(t), new n(e);
|
|
349
329
|
}
|
|
350
330
|
/**
|
|
351
331
|
* @returns the integer hour that the timestamp corresponds to within its day.
|
|
@@ -359,7 +339,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
359
339
|
*/
|
|
360
340
|
setHour(t) {
|
|
361
341
|
const e = this.date();
|
|
362
|
-
return e.setUTCHours(t), new
|
|
342
|
+
return e.setUTCHours(t), new n(e, "UTC");
|
|
363
343
|
}
|
|
364
344
|
/** @returns the integer minute that the timestamp corresponds to within its hour. */
|
|
365
345
|
get minute() {
|
|
@@ -371,7 +351,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
371
351
|
*/
|
|
372
352
|
setMinute(t) {
|
|
373
353
|
const e = this.date();
|
|
374
|
-
return e.setUTCMinutes(t), new
|
|
354
|
+
return e.setUTCMinutes(t), new n(e);
|
|
375
355
|
}
|
|
376
356
|
/**
|
|
377
357
|
* @returns the integer second that the timestamp corresponds to within its
|
|
@@ -386,7 +366,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
386
366
|
*/
|
|
387
367
|
setSecond(t) {
|
|
388
368
|
const e = this.date();
|
|
389
|
-
return e.setUTCSeconds(t), new
|
|
369
|
+
return e.setUTCSeconds(t), new n(e);
|
|
390
370
|
}
|
|
391
371
|
/**
|
|
392
372
|
* @reutrns the integer millisecond that the timestamp corresponds to within
|
|
@@ -401,7 +381,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
401
381
|
*/
|
|
402
382
|
setMillisecond(t) {
|
|
403
383
|
const e = this.date();
|
|
404
|
-
return e.setUTCMilliseconds(t), new
|
|
384
|
+
return e.setUTCMilliseconds(t), new n(e);
|
|
405
385
|
}
|
|
406
386
|
/** @returns the time stamp formatted as an ISO string. */
|
|
407
387
|
toString() {
|
|
@@ -419,11 +399,11 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
419
399
|
* @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
|
|
420
400
|
*/
|
|
421
401
|
remainder(t) {
|
|
422
|
-
return
|
|
402
|
+
return W(this, t);
|
|
423
403
|
}
|
|
424
404
|
/** @returns true if the day portion TimeStamp is today, false otherwise. */
|
|
425
405
|
get isToday() {
|
|
426
|
-
return this.truncate(
|
|
406
|
+
return this.truncate(a.DAY).equals(n.now().truncate(a.DAY));
|
|
427
407
|
}
|
|
428
408
|
/**
|
|
429
409
|
* Truncates the TimeStamp to the nearest multiple of the given span.
|
|
@@ -440,7 +420,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
440
420
|
* JavaScript can do).
|
|
441
421
|
*/
|
|
442
422
|
static now() {
|
|
443
|
-
return new
|
|
423
|
+
return new n(/* @__PURE__ */ new Date());
|
|
444
424
|
}
|
|
445
425
|
/**
|
|
446
426
|
* Finds the maximum timestamp among the provided timestamps.
|
|
@@ -449,10 +429,10 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
449
429
|
* @returns The maximum (latest) timestamp from the input.
|
|
450
430
|
*/
|
|
451
431
|
static max(...t) {
|
|
452
|
-
let e =
|
|
453
|
-
for (const
|
|
454
|
-
const
|
|
455
|
-
|
|
432
|
+
let e = n.MIN;
|
|
433
|
+
for (const s of t) {
|
|
434
|
+
const u = new n(s);
|
|
435
|
+
u.after(e) && (e = u);
|
|
456
436
|
}
|
|
457
437
|
return e;
|
|
458
438
|
}
|
|
@@ -463,10 +443,10 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
463
443
|
* @returns The minimum (earliest) timestamp from the input.
|
|
464
444
|
*/
|
|
465
445
|
static min(...t) {
|
|
466
|
-
let e =
|
|
467
|
-
for (const
|
|
468
|
-
const
|
|
469
|
-
|
|
446
|
+
let e = n.MAX;
|
|
447
|
+
for (const s of t) {
|
|
448
|
+
const u = new n(s);
|
|
449
|
+
u.before(e) && (e = u);
|
|
470
450
|
}
|
|
471
451
|
return e;
|
|
472
452
|
}
|
|
@@ -477,53 +457,76 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
|
|
|
477
457
|
* @returns A TimeStamp representing the given number of nanoseconds.
|
|
478
458
|
*/
|
|
479
459
|
static nanoseconds(t, e = "UTC") {
|
|
480
|
-
return new
|
|
460
|
+
return new n(t, e);
|
|
481
461
|
}
|
|
462
|
+
/** One nanosecond after the unix epoch */
|
|
463
|
+
static NANOSECOND = n.nanoseconds(1);
|
|
482
464
|
/** @returns a new TimeStamp n microseconds after the unix epoch */
|
|
483
465
|
static microseconds(t, e = "UTC") {
|
|
484
|
-
return
|
|
466
|
+
return n.nanoseconds(t * 1e3, e);
|
|
485
467
|
}
|
|
468
|
+
/** One microsecond after the unix epoch */
|
|
469
|
+
static MICROSECOND = n.microseconds(1);
|
|
486
470
|
/** @returns a new TimeStamp n milliseconds after the unix epoch */
|
|
487
471
|
static milliseconds(t, e = "UTC") {
|
|
488
|
-
return
|
|
472
|
+
return n.microseconds(t * 1e3, e);
|
|
489
473
|
}
|
|
474
|
+
/** One millisecond after the unix epoch */
|
|
475
|
+
static MILLISECOND = n.milliseconds(1);
|
|
490
476
|
/** @returns a new TimeStamp n seconds after the unix epoch */
|
|
491
477
|
static seconds(t, e = "UTC") {
|
|
492
|
-
return
|
|
478
|
+
return n.milliseconds(t * 1e3, e);
|
|
493
479
|
}
|
|
480
|
+
/** One second after the unix epoch */
|
|
481
|
+
static SECOND = n.seconds(1);
|
|
494
482
|
/** @returns a new TimeStamp n minutes after the unix epoch */
|
|
495
483
|
static minutes(t, e = "UTC") {
|
|
496
|
-
return
|
|
484
|
+
return n.seconds(t * 60, e);
|
|
497
485
|
}
|
|
486
|
+
/** One minute after the unix epoch */
|
|
487
|
+
static MINUTE = n.minutes(1);
|
|
498
488
|
/** @returns a new TimeStamp n hours after the unix epoch */
|
|
499
489
|
static hours(t, e = "UTC") {
|
|
500
|
-
return
|
|
490
|
+
return n.minutes(t * 60, e);
|
|
501
491
|
}
|
|
492
|
+
/** One hour after the unix epoch */
|
|
493
|
+
static HOUR = n.hours(1);
|
|
502
494
|
/** @returns a new TimeStamp n days after the unix epoch */
|
|
503
495
|
static days(t, e = "UTC") {
|
|
504
|
-
return
|
|
496
|
+
return n.hours(t * 24, e);
|
|
497
|
+
}
|
|
498
|
+
/** One day after the unix epoch */
|
|
499
|
+
static DAY = n.days(1);
|
|
500
|
+
/** The maximum possible value for a timestamp */
|
|
501
|
+
static MAX = new n((1n << 63n) - 1n);
|
|
502
|
+
/** The minimum possible value for a timestamp */
|
|
503
|
+
static MIN = new n(0);
|
|
504
|
+
/** The unix epoch */
|
|
505
|
+
static ZERO = new n(0);
|
|
506
|
+
/** A zod schema for validating timestamps */
|
|
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))
|
|
516
|
+
]);
|
|
517
|
+
/**
|
|
518
|
+
* Sorts two timestamps.
|
|
519
|
+
*
|
|
520
|
+
* @param a - The first timestamp.
|
|
521
|
+
* @param b - The second timestamp.
|
|
522
|
+
* @returns A number indicating the order of the two timestamps (positive if a is
|
|
523
|
+
* greater than b, negative if a is less than b, and 0 if they are equal).
|
|
524
|
+
*/
|
|
525
|
+
static sort(t, e) {
|
|
526
|
+
return Number(t.valueOf() - e.valueOf());
|
|
505
527
|
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
i(u, "NANOSECOND", u.nanoseconds(1)), /** One microsecond after the unix epoch */
|
|
509
|
-
i(u, "MICROSECOND", u.microseconds(1)), /** One millisecond after the unix epoch */
|
|
510
|
-
i(u, "MILLISECOND", u.milliseconds(1)), /** One second after the unix epoch */
|
|
511
|
-
i(u, "SECOND", u.seconds(1)), /** One minute after the unix epoch */
|
|
512
|
-
i(u, "MINUTE", u.minutes(1)), /** One hour after the unix epoch */
|
|
513
|
-
i(u, "HOUR", u.hours(1)), /** One day after the unix epoch */
|
|
514
|
-
i(u, "DAY", u.days(1)), /** The maximum possible value for a timestamp */
|
|
515
|
-
i(u, "MAX", new u((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
|
|
516
|
-
i(u, "MIN", new u(0)), /** The unix epoch */
|
|
517
|
-
i(u, "ZERO", new u(0)), /** A zod schema for validating timestamps */
|
|
518
|
-
i(u, "z", S([
|
|
519
|
-
G({ value: rt() }).transform((t) => new u(t.value)),
|
|
520
|
-
$().transform((t) => new u(BigInt(t))),
|
|
521
|
-
O(Number).transform((t) => new u(t)),
|
|
522
|
-
P().transform((t) => new u(t)),
|
|
523
|
-
O(u)
|
|
524
|
-
]));
|
|
525
|
-
let d = u;
|
|
526
|
-
const o = class o extends D {
|
|
528
|
+
}
|
|
529
|
+
class a extends M {
|
|
527
530
|
constructor(t) {
|
|
528
531
|
typeof t == "number" && (t = Math.trunc(t.valueOf())), super(BigInt(t.valueOf()));
|
|
529
532
|
}
|
|
@@ -534,7 +537,7 @@ const o = class o extends D {
|
|
|
534
537
|
* @returns A TimeSpan representing the given number of seconds.
|
|
535
538
|
*/
|
|
536
539
|
static fromSeconds(t) {
|
|
537
|
-
return t instanceof
|
|
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);
|
|
538
541
|
}
|
|
539
542
|
/**
|
|
540
543
|
* Creates a TimeSpan representing the given number of milliseconds.
|
|
@@ -543,7 +546,7 @@ const o = class o extends D {
|
|
|
543
546
|
* @returns A TimeSpan representing the given number of milliseconds.
|
|
544
547
|
*/
|
|
545
548
|
static fromMilliseconds(t) {
|
|
546
|
-
return t instanceof
|
|
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);
|
|
547
550
|
}
|
|
548
551
|
/**
|
|
549
552
|
* @returns the primitive value of the TimeSpan. Overrides standard JS valueOf()
|
|
@@ -559,7 +562,7 @@ const o = class o extends D {
|
|
|
559
562
|
* @returns True if the TimeSpan is less than the other TimeSpan, false otherwise.
|
|
560
563
|
*/
|
|
561
564
|
lessThan(t) {
|
|
562
|
-
return this.valueOf() < new
|
|
565
|
+
return this.valueOf() < new a(t).valueOf();
|
|
563
566
|
}
|
|
564
567
|
/**
|
|
565
568
|
* Checks if the TimeSpan is greater than another TimeSpan.
|
|
@@ -568,7 +571,7 @@ const o = class o extends D {
|
|
|
568
571
|
* @returns True if the TimeSpan is greater than the other TimeSpan, false otherwise.
|
|
569
572
|
*/
|
|
570
573
|
greaterThan(t) {
|
|
571
|
-
return this.valueOf() > new
|
|
574
|
+
return this.valueOf() > new a(t).valueOf();
|
|
572
575
|
}
|
|
573
576
|
/**
|
|
574
577
|
* Checks if the TimeSpan is less than or equal to another TimeSpan.
|
|
@@ -577,7 +580,7 @@ const o = class o extends D {
|
|
|
577
580
|
* @returns True if the TimeSpan is less than or equal to the other TimeSpan, false otherwise.
|
|
578
581
|
*/
|
|
579
582
|
lessThanOrEqual(t) {
|
|
580
|
-
return this.valueOf() <= new
|
|
583
|
+
return this.valueOf() <= new a(t).valueOf();
|
|
581
584
|
}
|
|
582
585
|
/**
|
|
583
586
|
* Checks if the TimeSpan is greater than or equal to another TimeSpan.
|
|
@@ -586,7 +589,7 @@ const o = class o extends D {
|
|
|
586
589
|
* @returns True if the TimeSpan is greater than or equal to the other TimeSpan, false otherwise.
|
|
587
590
|
*/
|
|
588
591
|
greaterThanOrEqual(t) {
|
|
589
|
-
return this.valueOf() >= new
|
|
592
|
+
return this.valueOf() >= new a(t).valueOf();
|
|
590
593
|
}
|
|
591
594
|
/**
|
|
592
595
|
* Calculates the remainder of the TimeSpan when divided by another TimeSpan.
|
|
@@ -595,7 +598,7 @@ const o = class o extends D {
|
|
|
595
598
|
* @returns A new TimeSpan representing the remainder.
|
|
596
599
|
*/
|
|
597
600
|
remainder(t) {
|
|
598
|
-
return
|
|
601
|
+
return W(this, t);
|
|
599
602
|
}
|
|
600
603
|
/**
|
|
601
604
|
* Truncates the TimeSpan to the nearest multiple of the given span.
|
|
@@ -604,7 +607,7 @@ const o = class o extends D {
|
|
|
604
607
|
* @returns A new TimeSpan that is truncated to the nearest multiple of the given span.
|
|
605
608
|
*/
|
|
606
609
|
truncate(t) {
|
|
607
|
-
return new
|
|
610
|
+
return new a(
|
|
608
611
|
BigInt(Math.trunc(Number(this.valueOf() / t.valueOf()))) * t.valueOf()
|
|
609
612
|
);
|
|
610
613
|
}
|
|
@@ -614,9 +617,9 @@ const o = class o extends D {
|
|
|
614
617
|
* @returns A string representation of the TimeSpan.
|
|
615
618
|
*/
|
|
616
619
|
toString() {
|
|
617
|
-
const t = this.truncate(
|
|
618
|
-
let
|
|
619
|
-
return
|
|
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
623
|
}
|
|
621
624
|
/**
|
|
622
625
|
* Multiplies the TimeSpan by a scalar value.
|
|
@@ -625,31 +628,31 @@ const o = class o extends D {
|
|
|
625
628
|
* @returns A new TimeSpan that is this TimeSpan multiplied by the provided value.
|
|
626
629
|
*/
|
|
627
630
|
mult(t) {
|
|
628
|
-
return new
|
|
631
|
+
return new a(this.valueOf() * BigInt(t));
|
|
629
632
|
}
|
|
630
633
|
/** @returns the decimal number of days in the TimeSpan. */
|
|
631
634
|
get days() {
|
|
632
|
-
return Number(this.valueOf()) / Number(
|
|
635
|
+
return Number(this.valueOf()) / Number(a.DAY.valueOf());
|
|
633
636
|
}
|
|
634
637
|
/** @returns the decimal number of hours in the TimeSpan. */
|
|
635
638
|
get hours() {
|
|
636
|
-
return Number(this.valueOf()) / Number(
|
|
639
|
+
return Number(this.valueOf()) / Number(a.HOUR.valueOf());
|
|
637
640
|
}
|
|
638
641
|
/** @returns the decimal number of minutes in the TimeSpan. */
|
|
639
642
|
get minutes() {
|
|
640
|
-
return Number(this.valueOf()) / Number(
|
|
643
|
+
return Number(this.valueOf()) / Number(a.MINUTE.valueOf());
|
|
641
644
|
}
|
|
642
645
|
/** @returns The number of seconds in the TimeSpan. */
|
|
643
646
|
get seconds() {
|
|
644
|
-
return Number(this.valueOf()) / Number(
|
|
647
|
+
return Number(this.valueOf()) / Number(a.SECOND.valueOf());
|
|
645
648
|
}
|
|
646
649
|
/** @returns The number of milliseconds in the TimeSpan. */
|
|
647
650
|
get milliseconds() {
|
|
648
|
-
return Number(this.valueOf()) / Number(
|
|
651
|
+
return Number(this.valueOf()) / Number(a.MILLISECOND.valueOf());
|
|
649
652
|
}
|
|
650
653
|
/** @returns The number of microseconds in the TimeSpan. */
|
|
651
654
|
get microseconds() {
|
|
652
|
-
return Number(this.valueOf()) / Number(
|
|
655
|
+
return Number(this.valueOf()) / Number(a.MICROSECOND.valueOf());
|
|
653
656
|
}
|
|
654
657
|
/** @returns The number of nanoseconds in the TimeSpan. */
|
|
655
658
|
get nanoseconds() {
|
|
@@ -661,7 +664,7 @@ const o = class o extends D {
|
|
|
661
664
|
* @returns True if the TimeSpan represents a zero duration, false otherwise.
|
|
662
665
|
*/
|
|
663
666
|
get isZero() {
|
|
664
|
-
return this.valueOf() ===
|
|
667
|
+
return this.valueOf() === 0n;
|
|
665
668
|
}
|
|
666
669
|
/**
|
|
667
670
|
* Checks if the TimeSpan is equal to another TimeSpan.
|
|
@@ -669,7 +672,7 @@ const o = class o extends D {
|
|
|
669
672
|
* @returns True if the TimeSpans are equal, false otherwise.
|
|
670
673
|
*/
|
|
671
674
|
equals(t) {
|
|
672
|
-
return this.valueOf() === new
|
|
675
|
+
return this.valueOf() === new a(t).valueOf();
|
|
673
676
|
}
|
|
674
677
|
/**
|
|
675
678
|
* Adds a TimeSpan to the TimeSpan.
|
|
@@ -677,7 +680,7 @@ const o = class o extends D {
|
|
|
677
680
|
* @returns A new TimeSpan representing the sum of the two TimeSpans.
|
|
678
681
|
*/
|
|
679
682
|
add(t) {
|
|
680
|
-
return new
|
|
683
|
+
return new a(this.valueOf() + new a(t).valueOf());
|
|
681
684
|
}
|
|
682
685
|
/**
|
|
683
686
|
* Creates a TimeSpan representing the duration between the two timestamps.
|
|
@@ -685,7 +688,7 @@ const o = class o extends D {
|
|
|
685
688
|
* @param other
|
|
686
689
|
*/
|
|
687
690
|
sub(t) {
|
|
688
|
-
return new
|
|
691
|
+
return new a(this.valueOf() - new a(t).valueOf());
|
|
689
692
|
}
|
|
690
693
|
/**
|
|
691
694
|
* Creates a TimeSpan representing the given number of nanoseconds.
|
|
@@ -694,8 +697,10 @@ const o = class o extends D {
|
|
|
694
697
|
* @returns A TimeSpan representing the given number of nanoseconds.
|
|
695
698
|
*/
|
|
696
699
|
static nanoseconds(t = 1) {
|
|
697
|
-
return new
|
|
700
|
+
return new a(t);
|
|
698
701
|
}
|
|
702
|
+
/** A nanosecond. */
|
|
703
|
+
static NANOSECOND = a.nanoseconds(1);
|
|
699
704
|
/**
|
|
700
705
|
* Creates a TimeSpan representing the given number of microseconds.
|
|
701
706
|
*
|
|
@@ -703,8 +708,10 @@ const o = class o extends D {
|
|
|
703
708
|
* @returns A TimeSpan representing the given number of microseconds.
|
|
704
709
|
*/
|
|
705
710
|
static microseconds(t = 1) {
|
|
706
|
-
return
|
|
711
|
+
return a.nanoseconds(B(t, 1e3));
|
|
707
712
|
}
|
|
713
|
+
/** A microsecond. */
|
|
714
|
+
static MICROSECOND = a.microseconds(1);
|
|
708
715
|
/**
|
|
709
716
|
* Creates a TimeSpan representing the given number of milliseconds.
|
|
710
717
|
*
|
|
@@ -712,8 +719,10 @@ const o = class o extends D {
|
|
|
712
719
|
* @returns A TimeSpan representing the given number of milliseconds.
|
|
713
720
|
*/
|
|
714
721
|
static milliseconds(t = 1) {
|
|
715
|
-
return
|
|
722
|
+
return a.microseconds(B(t, 1e3));
|
|
716
723
|
}
|
|
724
|
+
/** A millisecond. */
|
|
725
|
+
static MILLISECOND = a.milliseconds(1);
|
|
717
726
|
/**
|
|
718
727
|
* Creates a TimeSpan representing the given number of seconds.
|
|
719
728
|
*
|
|
@@ -721,8 +730,10 @@ const o = class o extends D {
|
|
|
721
730
|
* @returns A TimeSpan representing the given number of seconds.
|
|
722
731
|
*/
|
|
723
732
|
static seconds(t = 1) {
|
|
724
|
-
return
|
|
733
|
+
return a.milliseconds(B(t, 1e3));
|
|
725
734
|
}
|
|
735
|
+
/** A second. */
|
|
736
|
+
static SECOND = a.seconds(1);
|
|
726
737
|
/**
|
|
727
738
|
* Creates a TimeSpan representing the given number of minutes.
|
|
728
739
|
*
|
|
@@ -730,8 +741,10 @@ const o = class o extends D {
|
|
|
730
741
|
* @returns A TimeSpan representing the given number of minutes.
|
|
731
742
|
*/
|
|
732
743
|
static minutes(t = 1) {
|
|
733
|
-
return
|
|
744
|
+
return a.seconds(B(t, 60));
|
|
734
745
|
}
|
|
746
|
+
/** A minute. */
|
|
747
|
+
static MINUTE = a.minutes(1);
|
|
735
748
|
/**
|
|
736
749
|
* Creates a TimeSpan representing the given number of hours.
|
|
737
750
|
*
|
|
@@ -739,8 +752,10 @@ const o = class o extends D {
|
|
|
739
752
|
* @returns A TimeSpan representing the given number of hours.
|
|
740
753
|
*/
|
|
741
754
|
static hours(t) {
|
|
742
|
-
return
|
|
755
|
+
return a.minutes(B(t, 60));
|
|
743
756
|
}
|
|
757
|
+
/** Represents an hour. */
|
|
758
|
+
static HOUR = a.hours(1);
|
|
744
759
|
/**
|
|
745
760
|
* Creates a TimeSpan representing the given number of days.
|
|
746
761
|
*
|
|
@@ -748,29 +763,25 @@ const o = class o extends D {
|
|
|
748
763
|
* @returns A TimeSpan representing the given number of days.
|
|
749
764
|
*/
|
|
750
765
|
static days(t) {
|
|
751
|
-
return
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
O(o)
|
|
771
|
-
]));
|
|
772
|
-
let g = o;
|
|
773
|
-
const U = class U extends D {
|
|
766
|
+
return a.hours(B(t, 24));
|
|
767
|
+
}
|
|
768
|
+
/** Represents a day. */
|
|
769
|
+
static DAY = a.days(1);
|
|
770
|
+
/** The maximum possible value for a TimeSpan. */
|
|
771
|
+
static MAX = new a((1n << 63n) - 1n);
|
|
772
|
+
/** The minimum possible value for a TimeSpan. */
|
|
773
|
+
static MIN = new a(0);
|
|
774
|
+
/** The zero value for a TimeSpan. */
|
|
775
|
+
static ZERO = new a(0);
|
|
776
|
+
/** A zod schema for validating and transforming timespans */
|
|
777
|
+
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)
|
|
782
|
+
]);
|
|
783
|
+
}
|
|
784
|
+
class E extends M {
|
|
774
785
|
constructor(t) {
|
|
775
786
|
super(t.valueOf());
|
|
776
787
|
}
|
|
@@ -780,7 +791,7 @@ const U = class U extends D {
|
|
|
780
791
|
}
|
|
781
792
|
/** @returns The number of seconds in the Rate. */
|
|
782
793
|
equals(t) {
|
|
783
|
-
return this.valueOf() === new
|
|
794
|
+
return this.valueOf() === new E(t).valueOf();
|
|
784
795
|
}
|
|
785
796
|
/**
|
|
786
797
|
* Calculates the period of the Rate as a TimeSpan.
|
|
@@ -788,7 +799,7 @@ const U = class U extends D {
|
|
|
788
799
|
* @returns A TimeSpan representing the period of the Rate.
|
|
789
800
|
*/
|
|
790
801
|
get period() {
|
|
791
|
-
return
|
|
802
|
+
return a.seconds(1 / this.valueOf());
|
|
792
803
|
}
|
|
793
804
|
/**
|
|
794
805
|
* Calculates the number of samples in the given TimeSpan at this rate.
|
|
@@ -797,7 +808,7 @@ const U = class U extends D {
|
|
|
797
808
|
* @returns The number of samples in the given TimeSpan at this rate.
|
|
798
809
|
*/
|
|
799
810
|
sampleCount(t) {
|
|
800
|
-
return new
|
|
811
|
+
return new a(t).seconds * this.valueOf();
|
|
801
812
|
}
|
|
802
813
|
/**
|
|
803
814
|
* Calculates the number of bytes in the given TimeSpan at this rate.
|
|
@@ -807,7 +818,7 @@ const U = class U extends D {
|
|
|
807
818
|
* @returns The number of bytes in the given TimeSpan at this rate.
|
|
808
819
|
*/
|
|
809
820
|
byteCount(t, e) {
|
|
810
|
-
return this.sampleCount(t) * new
|
|
821
|
+
return this.sampleCount(t) * new d(e).valueOf();
|
|
811
822
|
}
|
|
812
823
|
/**
|
|
813
824
|
* Calculates a TimeSpan given the number of samples at this rate.
|
|
@@ -816,7 +827,7 @@ const U = class U extends D {
|
|
|
816
827
|
* @returns A TimeSpan that corresponds to the given number of samples.
|
|
817
828
|
*/
|
|
818
829
|
span(t) {
|
|
819
|
-
return
|
|
830
|
+
return a.seconds(t / this.valueOf());
|
|
820
831
|
}
|
|
821
832
|
/**
|
|
822
833
|
* Calculates a TimeSpan given the number of bytes at this rate.
|
|
@@ -835,7 +846,7 @@ const U = class U extends D {
|
|
|
835
846
|
* @returns A Rate representing the given number of Hz.
|
|
836
847
|
*/
|
|
837
848
|
static hz(t) {
|
|
838
|
-
return new
|
|
849
|
+
return new E(t);
|
|
839
850
|
}
|
|
840
851
|
/**
|
|
841
852
|
* Creates a Rate representing the given number of kHz.
|
|
@@ -844,17 +855,15 @@ const U = class U extends D {
|
|
|
844
855
|
* @returns A Rate representing the given number of kHz.
|
|
845
856
|
*/
|
|
846
857
|
static khz(t) {
|
|
847
|
-
return
|
|
858
|
+
return E.hz(t * 1e3);
|
|
848
859
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
let Y = U;
|
|
857
|
-
const b = class b extends D {
|
|
860
|
+
/** A zod schema for validating and transforming rates */
|
|
861
|
+
static z = o.union([
|
|
862
|
+
o.number().transform((t) => new E(t)),
|
|
863
|
+
o.instanceof(E)
|
|
864
|
+
]);
|
|
865
|
+
}
|
|
866
|
+
class d extends M {
|
|
858
867
|
/**
|
|
859
868
|
* Creates a Density representing the given number of bytes per value.
|
|
860
869
|
*
|
|
@@ -881,23 +890,45 @@ const b = class b extends D {
|
|
|
881
890
|
* @returns A Size representing the given number of values.
|
|
882
891
|
*/
|
|
883
892
|
size(t) {
|
|
884
|
-
return new
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
893
|
+
return new h(t * this.valueOf());
|
|
894
|
+
}
|
|
895
|
+
/** Unknown/Invalid Density. */
|
|
896
|
+
static UNKNOWN = new d(0);
|
|
897
|
+
/** 128 bits per value. */
|
|
898
|
+
static BIT128 = new d(16);
|
|
899
|
+
/** 64 bits per value. */
|
|
900
|
+
static BIT64 = new d(8);
|
|
901
|
+
/** 32 bits per value. */
|
|
902
|
+
static BIT32 = new d(4);
|
|
903
|
+
/** 16 bits per value. */
|
|
904
|
+
static BIT16 = new d(2);
|
|
905
|
+
/** 8 bits per value. */
|
|
906
|
+
static BIT8 = new d(1);
|
|
907
|
+
/** A zod schema for validating and transforming densities */
|
|
908
|
+
static z = o.union([
|
|
909
|
+
o.number().transform((t) => new d(t)),
|
|
910
|
+
o.instanceof(d)
|
|
911
|
+
]);
|
|
912
|
+
}
|
|
913
|
+
class w {
|
|
914
|
+
/**
|
|
915
|
+
* The starting TimeStamp of the TimeRange.
|
|
916
|
+
*
|
|
917
|
+
* Note that this value is not guaranteed to be before or equal to the ending value.
|
|
918
|
+
* To ensure that this is the case, call TimeRange.make_valid().
|
|
919
|
+
*
|
|
920
|
+
* In most cases, operations should treat start as inclusive.
|
|
921
|
+
*/
|
|
922
|
+
start;
|
|
923
|
+
/**
|
|
924
|
+
* The starting TimeStamp of the TimeRange.
|
|
925
|
+
*
|
|
926
|
+
* Note that this value is not guaranteed to be before or equal to the ending value.
|
|
927
|
+
* To ensure that this is the case, call TimeRange.make_valid().
|
|
928
|
+
*
|
|
929
|
+
* In most cases, operations should treat end as exclusive.
|
|
930
|
+
*/
|
|
931
|
+
end;
|
|
901
932
|
/**
|
|
902
933
|
* Creates a TimeRange from the given start and end TimeStamps.
|
|
903
934
|
*
|
|
@@ -905,29 +936,11 @@ const T = class T {
|
|
|
905
936
|
* @param end - A TimeStamp representing the end of the range.
|
|
906
937
|
*/
|
|
907
938
|
constructor(t, e) {
|
|
908
|
-
|
|
909
|
-
* The starting TimeStamp of the TimeRange.
|
|
910
|
-
*
|
|
911
|
-
* Note that this value is not guaranteed to be before or equal to the ending value.
|
|
912
|
-
* To ensure that this is the case, call TimeRange.make_valid().
|
|
913
|
-
*
|
|
914
|
-
* In most cases, operations should treat start as inclusive.
|
|
915
|
-
*/
|
|
916
|
-
i(this, "start");
|
|
917
|
-
/**
|
|
918
|
-
* The starting TimeStamp of the TimeRange.
|
|
919
|
-
*
|
|
920
|
-
* Note that this value is not guaranteed to be before or equal to the ending value.
|
|
921
|
-
* To ensure that this is the case, call TimeRange.make_valid().
|
|
922
|
-
*
|
|
923
|
-
* In most cases, operations should treat end as exclusive.
|
|
924
|
-
*/
|
|
925
|
-
i(this, "end");
|
|
926
|
-
typeof t == "object" && "start" in t ? (this.start = new d(t.start), this.end = new d(t.end)) : (this.start = new d(t), this.end = new d(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));
|
|
927
940
|
}
|
|
928
941
|
/** @returns The TimeSpan occupied by the TimeRange. */
|
|
929
942
|
get span() {
|
|
930
|
-
return new
|
|
943
|
+
return new a(this.end.valueOf() - this.start.valueOf());
|
|
931
944
|
}
|
|
932
945
|
/**
|
|
933
946
|
* Checks if the timestamp is valid i.e. the start is before the end.
|
|
@@ -965,7 +978,7 @@ const T = class T {
|
|
|
965
978
|
* @returns A TimeRange with the start and end swapped.
|
|
966
979
|
*/
|
|
967
980
|
swap() {
|
|
968
|
-
return new
|
|
981
|
+
return new w(this.end, this.start);
|
|
969
982
|
}
|
|
970
983
|
get numericBounds() {
|
|
971
984
|
return {
|
|
@@ -979,11 +992,11 @@ const T = class T {
|
|
|
979
992
|
* @param other - The TimeRange to compare to.
|
|
980
993
|
* @returns True if the TimeRange is equal to the given TimeRange.
|
|
981
994
|
*/
|
|
982
|
-
equals(t, e =
|
|
995
|
+
equals(t, e = a.ZERO) {
|
|
983
996
|
if (e.isZero)
|
|
984
997
|
return this.start.equals(t.start) && this.end.equals(t.end);
|
|
985
|
-
let
|
|
986
|
-
return
|
|
998
|
+
let s = this.start.sub(t.start).valueOf(), u = this.end.sub(t.end).valueOf();
|
|
999
|
+
return s < 0 && (s = -s), u < 0 && (u = -u), s <= e.valueOf() && u <= e.valueOf();
|
|
987
1000
|
}
|
|
988
1001
|
/**
|
|
989
1002
|
* Returns a string representation of the TimeRange.
|
|
@@ -1012,16 +1025,16 @@ const T = class T {
|
|
|
1012
1025
|
* checking for overlap.
|
|
1013
1026
|
* @returns True if the two TimeRanges overlap, false otherwise.
|
|
1014
1027
|
*/
|
|
1015
|
-
overlapsWith(t, e =
|
|
1028
|
+
overlapsWith(t, e = a.ZERO) {
|
|
1016
1029
|
t = t.makeValid();
|
|
1017
|
-
const
|
|
1030
|
+
const s = this.makeValid();
|
|
1018
1031
|
if (this.equals(t)) return !0;
|
|
1019
|
-
if (t.end.equals(
|
|
1020
|
-
const
|
|
1021
|
-
return f.before(
|
|
1032
|
+
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);
|
|
1022
1035
|
}
|
|
1023
1036
|
contains(t) {
|
|
1024
|
-
return t instanceof
|
|
1037
|
+
return t instanceof w ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
|
|
1025
1038
|
}
|
|
1026
1039
|
/**
|
|
1027
1040
|
* Returns a new TimeRange that is bound by the given TimeRange.
|
|
@@ -1035,31 +1048,47 @@ const T = class T {
|
|
|
1035
1048
|
* console.log(bounded); // TimeRange(1500, 2000)
|
|
1036
1049
|
*/
|
|
1037
1050
|
boundBy(t) {
|
|
1038
|
-
const e = new
|
|
1051
|
+
const e = new w(this.start, this.end);
|
|
1039
1052
|
return t.start.after(this.start) && (e.start = t.start), t.start.after(this.end) && (e.end = t.start), t.end.before(this.end) && (e.end = t.end), t.end.before(this.start) && (e.start = t.end), e;
|
|
1040
1053
|
}
|
|
1041
1054
|
static max(...t) {
|
|
1042
|
-
return new
|
|
1043
|
-
|
|
1044
|
-
|
|
1055
|
+
return new w(
|
|
1056
|
+
n.min(...t.map((e) => e.start)),
|
|
1057
|
+
n.max(...t.map((e) => e.end))
|
|
1045
1058
|
);
|
|
1046
1059
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1060
|
+
/** The maximum possible time range. */
|
|
1061
|
+
static MAX = new w(n.MIN, n.MAX);
|
|
1062
|
+
/** The minimum possible time range. */
|
|
1063
|
+
static MIN = new w(n.MAX, n.MIN);
|
|
1064
|
+
/** A time range whose start and end are both zero. */
|
|
1065
|
+
static ZERO = new w(n.ZERO, n.ZERO);
|
|
1066
|
+
/** A zod schema for validating and transforming time ranges */
|
|
1067
|
+
static z = o.union([
|
|
1068
|
+
o.object({ start: n.z, end: n.z }).transform((t) => new w(t.start, t.end)),
|
|
1069
|
+
o.instanceof(w)
|
|
1070
|
+
]);
|
|
1071
|
+
/**
|
|
1072
|
+
* Sorts two time ranges. The range with the earlier start time is considered less than
|
|
1073
|
+
* the range with the later start time. If the start times are equal, the range with the
|
|
1074
|
+
* earlier end time is considered less than the range with the later end time.
|
|
1075
|
+
*
|
|
1076
|
+
* @param a - The first time range.
|
|
1077
|
+
* @param b - The second time range.
|
|
1078
|
+
* @returns A number indicating the order of the two time ranges. This number is
|
|
1079
|
+
* positive if a is earlier than b, negative if a is later than b, and 0 if they are
|
|
1080
|
+
* equal.
|
|
1081
|
+
*/
|
|
1082
|
+
static sort(t, e) {
|
|
1083
|
+
return n.sort(t.start, e.start) || n.sort(t.end, e.end);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
class r extends M {
|
|
1058
1087
|
constructor(t) {
|
|
1059
|
-
if (t instanceof
|
|
1088
|
+
if (t instanceof r || typeof t == "string" || typeof t.valueOf() == "string")
|
|
1060
1089
|
super(t.valueOf());
|
|
1061
1090
|
else {
|
|
1062
|
-
const e =
|
|
1091
|
+
const e = r.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
|
|
1063
1092
|
if (e == null)
|
|
1064
1093
|
throw new Error(`unable to find data type for ${t.toString()}`);
|
|
1065
1094
|
super(e.valueOf());
|
|
@@ -1069,7 +1098,7 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
|
|
|
1069
1098
|
* @returns the TypedArray constructor for the DataType.
|
|
1070
1099
|
*/
|
|
1071
1100
|
get Array() {
|
|
1072
|
-
const t =
|
|
1101
|
+
const t = r.ARRAY_CONSTRUCTORS.get(this.toString());
|
|
1073
1102
|
if (t == null)
|
|
1074
1103
|
throw new Error(`unable to find array constructor for ${this.valueOf()}`);
|
|
1075
1104
|
return t;
|
|
@@ -1096,7 +1125,7 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
|
|
|
1096
1125
|
* @example DataType.INT32.isVariable // false
|
|
1097
1126
|
*/
|
|
1098
1127
|
get isVariable() {
|
|
1099
|
-
return this.equals(
|
|
1128
|
+
return this.equals(r.JSON) || this.equals(r.STRING);
|
|
1100
1129
|
}
|
|
1101
1130
|
/**
|
|
1102
1131
|
* @returns true if the DataType is numeric.
|
|
@@ -1104,7 +1133,7 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
|
|
|
1104
1133
|
* @example DataType.STRING.isNumeric // false
|
|
1105
1134
|
*/
|
|
1106
1135
|
get isNumeric() {
|
|
1107
|
-
return !this.isVariable && !this.equals(
|
|
1136
|
+
return !this.isVariable && !this.equals(r.UUID);
|
|
1108
1137
|
}
|
|
1109
1138
|
/**
|
|
1110
1139
|
* @returns true if the DataType is an integer.
|
|
@@ -1129,7 +1158,7 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
|
|
|
1129
1158
|
* @example DataType.FLOAT32.density // Density.BIT32
|
|
1130
1159
|
*/
|
|
1131
1160
|
get density() {
|
|
1132
|
-
const t =
|
|
1161
|
+
const t = r.DENSITIES.get(this.toString());
|
|
1133
1162
|
if (t == null) throw new Error(`unable to find density for ${this.valueOf()}`);
|
|
1134
1163
|
return t;
|
|
1135
1164
|
}
|
|
@@ -1139,7 +1168,7 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
|
|
|
1139
1168
|
* @example DataType.INT32.isUnsigned // false
|
|
1140
1169
|
*/
|
|
1141
1170
|
get isUnsignedInteger() {
|
|
1142
|
-
return this.equals(
|
|
1171
|
+
return this.equals(r.UINT8) || this.equals(r.UINT16) || this.equals(r.UINT32) || this.equals(r.UINT64);
|
|
1143
1172
|
}
|
|
1144
1173
|
/**
|
|
1145
1174
|
* @returns true if the DataType is a signed integer.
|
|
@@ -1147,11 +1176,11 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
|
|
|
1147
1176
|
* @example DataType.UINT32.isSigned // false
|
|
1148
1177
|
*/
|
|
1149
1178
|
get isSignedInteger() {
|
|
1150
|
-
return this.equals(
|
|
1179
|
+
return this.equals(r.INT8) || this.equals(r.INT16) || this.equals(r.INT32) || this.equals(r.INT64);
|
|
1151
1180
|
}
|
|
1152
1181
|
/** @returns true if the data type can be cast to the other data type without loss of precision. */
|
|
1153
1182
|
canSafelyCastTo(t) {
|
|
1154
|
-
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(
|
|
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;
|
|
1155
1184
|
}
|
|
1156
1185
|
/** @returns true if the data type can be cast to the other data type, even if there is a loss of precision. */
|
|
1157
1186
|
canCastTo(t) {
|
|
@@ -1168,92 +1197,112 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
|
|
|
1168
1197
|
}
|
|
1169
1198
|
/** @returns true if the data type uses bigints to store values. */
|
|
1170
1199
|
get usesBigInt() {
|
|
1171
|
-
return
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
[
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
])
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1200
|
+
return r.BIG_INT_TYPES.some((t) => t.equals(this));
|
|
1201
|
+
}
|
|
1202
|
+
/** Represents an Unknown/Invalid DataType. */
|
|
1203
|
+
static UNKNOWN = new r("unknown");
|
|
1204
|
+
/** Represents a 64-bit floating point value. */
|
|
1205
|
+
static FLOAT64 = new r("float64");
|
|
1206
|
+
/** Represents a 32-bit floating point value. */
|
|
1207
|
+
static FLOAT32 = new r("float32");
|
|
1208
|
+
/** Represents a 64-bit signed integer value. */
|
|
1209
|
+
static INT64 = new r("int64");
|
|
1210
|
+
/** Represents a 32-bit signed integer value. */
|
|
1211
|
+
static INT32 = new r("int32");
|
|
1212
|
+
/** Represents a 16-bit signed integer value. */
|
|
1213
|
+
static INT16 = new r("int16");
|
|
1214
|
+
/** Represents a 8-bit signed integer value. */
|
|
1215
|
+
static INT8 = new r("int8");
|
|
1216
|
+
/** Represents a 64-bit unsigned integer value. */
|
|
1217
|
+
static UINT64 = new r("uint64");
|
|
1218
|
+
/** Represents a 32-bit unsigned integer value. */
|
|
1219
|
+
static UINT32 = new r("uint32");
|
|
1220
|
+
/** Represents a 16-bit unsigned integer value. */
|
|
1221
|
+
static UINT16 = new r("uint16");
|
|
1222
|
+
/** Represents a 8-bit unsigned integer value. */
|
|
1223
|
+
static UINT8 = new r("uint8");
|
|
1224
|
+
/** Represents a boolean value. Alias for UINT8. */
|
|
1225
|
+
static BOOLEAN = this.UINT8;
|
|
1226
|
+
/** Represents a 64-bit unix epoch. */
|
|
1227
|
+
static TIMESTAMP = new r("timestamp");
|
|
1228
|
+
/** Represents a UUID data type */
|
|
1229
|
+
static UUID = new r("uuid");
|
|
1230
|
+
/** Represents a string data type. Strings have an unknown density, and are separate
|
|
1231
|
+
* by a newline character. */
|
|
1232
|
+
static STRING = new r("string");
|
|
1233
|
+
/** Represents a JSON data type. JSON has an unknown density, and is separated by a
|
|
1234
|
+
* newline character. */
|
|
1235
|
+
static JSON = new r("json");
|
|
1236
|
+
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]
|
|
1251
|
+
]);
|
|
1252
|
+
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]
|
|
1263
|
+
]);
|
|
1264
|
+
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]
|
|
1279
|
+
]);
|
|
1280
|
+
/** All the data types. */
|
|
1281
|
+
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
|
|
1297
|
+
];
|
|
1298
|
+
static BIG_INT_TYPES = [r.INT64, r.UINT64, r.TIMESTAMP];
|
|
1299
|
+
/** A zod schema for a DataType. */
|
|
1300
|
+
static z = o.union([
|
|
1301
|
+
o.string().transform((t) => new r(t)),
|
|
1302
|
+
o.instanceof(r)
|
|
1303
|
+
]);
|
|
1304
|
+
}
|
|
1305
|
+
class h extends M {
|
|
1257
1306
|
constructor(t) {
|
|
1258
1307
|
super(t.valueOf());
|
|
1259
1308
|
}
|
|
@@ -1267,41 +1316,41 @@ const c = class c extends D {
|
|
|
1267
1316
|
}
|
|
1268
1317
|
/** @returns a new Size representing the sum of the two Sizes. */
|
|
1269
1318
|
add(t) {
|
|
1270
|
-
return
|
|
1319
|
+
return h.bytes(this.valueOf() + t.valueOf());
|
|
1271
1320
|
}
|
|
1272
1321
|
/** @returns a new Size representing the difference of the two Sizes. */
|
|
1273
1322
|
sub(t) {
|
|
1274
|
-
return
|
|
1323
|
+
return h.bytes(this.valueOf() - t.valueOf());
|
|
1275
1324
|
}
|
|
1276
1325
|
/** @returns a new Size representing the truncated value of the Size. */
|
|
1277
1326
|
truncate(t) {
|
|
1278
|
-
return new
|
|
1327
|
+
return new h(Math.trunc(this.valueOf() / t.valueOf()) * t.valueOf());
|
|
1279
1328
|
}
|
|
1280
1329
|
/** @returns a new Size representing the remainder of the Size. */
|
|
1281
1330
|
remainder(t) {
|
|
1282
|
-
return
|
|
1331
|
+
return h.bytes(this.valueOf() % t.valueOf());
|
|
1283
1332
|
}
|
|
1284
1333
|
/** @returns the number of gigabytes in the Size. */
|
|
1285
1334
|
get gigabytes() {
|
|
1286
|
-
return this.valueOf() /
|
|
1335
|
+
return this.valueOf() / h.GIGABYTE.valueOf();
|
|
1287
1336
|
}
|
|
1288
1337
|
/** @returns the number of megabytes in the Size. */
|
|
1289
1338
|
get megabytes() {
|
|
1290
|
-
return this.valueOf() /
|
|
1339
|
+
return this.valueOf() / h.MEGABYTE.valueOf();
|
|
1291
1340
|
}
|
|
1292
1341
|
/** @returns the number of kilobytes in the Size. */
|
|
1293
1342
|
get kilobytes() {
|
|
1294
|
-
return this.valueOf() /
|
|
1343
|
+
return this.valueOf() / h.KILOBYTE.valueOf();
|
|
1295
1344
|
}
|
|
1296
1345
|
/** @returns the number of terabytes in the Size. */
|
|
1297
1346
|
get terabytes() {
|
|
1298
|
-
return this.valueOf() /
|
|
1347
|
+
return this.valueOf() / h.TERABYTE.valueOf();
|
|
1299
1348
|
}
|
|
1300
1349
|
/** @returns a nicely formatted string representation of the Size. */
|
|
1301
1350
|
toString() {
|
|
1302
|
-
const t = this.truncate(
|
|
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);
|
|
1303
1352
|
let l = "";
|
|
1304
|
-
return
|
|
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();
|
|
1305
1354
|
}
|
|
1306
1355
|
/**
|
|
1307
1356
|
* Creates a Size from the given number of bytes.
|
|
@@ -1310,8 +1359,10 @@ const c = class c extends D {
|
|
|
1310
1359
|
* @returns A Size representing the given number of bytes.
|
|
1311
1360
|
*/
|
|
1312
1361
|
static bytes(t = 1) {
|
|
1313
|
-
return new
|
|
1362
|
+
return new h(t);
|
|
1314
1363
|
}
|
|
1364
|
+
/** A single byte */
|
|
1365
|
+
static BYTE = new h(1);
|
|
1315
1366
|
/**
|
|
1316
1367
|
* Creates a Size from the given number if kilobytes.
|
|
1317
1368
|
*
|
|
@@ -1319,8 +1370,10 @@ const c = class c extends D {
|
|
|
1319
1370
|
* @returns A Size representing the given number of kilobytes.
|
|
1320
1371
|
*/
|
|
1321
1372
|
static kilobytes(t = 1) {
|
|
1322
|
-
return
|
|
1373
|
+
return h.bytes(t.valueOf() * 1e3);
|
|
1323
1374
|
}
|
|
1375
|
+
/** A kilobyte */
|
|
1376
|
+
static KILOBYTE = h.kilobytes(1);
|
|
1324
1377
|
/**
|
|
1325
1378
|
* Creates a Size from the given number of megabytes.
|
|
1326
1379
|
*
|
|
@@ -1328,8 +1381,10 @@ const c = class c extends D {
|
|
|
1328
1381
|
* @returns A Size representing the given number of megabytes.
|
|
1329
1382
|
*/
|
|
1330
1383
|
static megabytes(t = 1) {
|
|
1331
|
-
return
|
|
1384
|
+
return h.kilobytes(t.valueOf() * 1e3);
|
|
1332
1385
|
}
|
|
1386
|
+
/** A megabyte */
|
|
1387
|
+
static MEGABYTE = h.megabytes(1);
|
|
1333
1388
|
/**
|
|
1334
1389
|
* Creates a Size from the given number of gigabytes.
|
|
1335
1390
|
*
|
|
@@ -1337,8 +1392,10 @@ const c = class c extends D {
|
|
|
1337
1392
|
* @returns A Size representing the given number of gigabytes.
|
|
1338
1393
|
*/
|
|
1339
1394
|
static gigabytes(t = 1) {
|
|
1340
|
-
return
|
|
1395
|
+
return h.megabytes(t.valueOf() * 1e3);
|
|
1341
1396
|
}
|
|
1397
|
+
/** A gigabyte */
|
|
1398
|
+
static GIGABYTE = h.gigabytes(1);
|
|
1342
1399
|
/**
|
|
1343
1400
|
* Creates a Size from the given number of terabytes.
|
|
1344
1401
|
*
|
|
@@ -1346,96 +1403,156 @@ const c = class c extends D {
|
|
|
1346
1403
|
* @returns A Size representing the given number of terabytes.
|
|
1347
1404
|
*/
|
|
1348
1405
|
static terabytes(t) {
|
|
1349
|
-
return
|
|
1350
|
-
}
|
|
1406
|
+
return h.gigabytes(t.valueOf() * 1e3);
|
|
1407
|
+
}
|
|
1408
|
+
/** A terabyte. */
|
|
1409
|
+
static TERABYTE = h.terabytes(1);
|
|
1410
|
+
/** The zero value for Size */
|
|
1411
|
+
static ZERO = new h(0);
|
|
1412
|
+
/** A zod schema for a Size. */
|
|
1413
|
+
static z = o.union([
|
|
1414
|
+
o.number().transform((t) => new h(t)),
|
|
1415
|
+
o.instanceof(h)
|
|
1416
|
+
]);
|
|
1351
1417
|
/** @returns true if the Size is zero. */
|
|
1352
1418
|
get isZero() {
|
|
1353
1419
|
return this.valueOf() === 0;
|
|
1354
1420
|
}
|
|
1355
|
-
};
|
|
1356
|
-
/** A single byte */
|
|
1357
|
-
i(c, "BYTE", new c(1)), /** A kilobyte */
|
|
1358
|
-
i(c, "KILOBYTE", c.kilobytes(1)), /** A megabyte */
|
|
1359
|
-
i(c, "MEGABYTE", c.megabytes(1)), /** A gigabyte */
|
|
1360
|
-
i(c, "GIGABYTE", c.gigabytes(1)), /** A terabyte. */
|
|
1361
|
-
i(c, "TERABYTE", c.terabytes(1)), /** The zero value for Size */
|
|
1362
|
-
i(c, "ZERO", new c(0)), /** A zod schema for a Size. */
|
|
1363
|
-
i(c, "z", S([
|
|
1364
|
-
P().transform((t) => new c(t)),
|
|
1365
|
-
O(c)
|
|
1366
|
-
]));
|
|
1367
|
-
let L = c;
|
|
1368
|
-
const Ne = S([
|
|
1369
|
-
O(Uint8Array),
|
|
1370
|
-
O(Uint16Array),
|
|
1371
|
-
O(Uint32Array),
|
|
1372
|
-
O(BigUint64Array),
|
|
1373
|
-
O(Float32Array),
|
|
1374
|
-
O(Float64Array),
|
|
1375
|
-
O(Int8Array),
|
|
1376
|
-
O(Int16Array),
|
|
1377
|
-
O(Int32Array),
|
|
1378
|
-
O(BigInt64Array)
|
|
1379
|
-
]), ut = (n) => {
|
|
1380
|
-
const t = typeof n;
|
|
1381
|
-
return t === "string" || t === "number" || t === "boolean" || t === "bigint" || n instanceof d || n instanceof g || n instanceof Date;
|
|
1382
|
-
}, kt = (n, t, e, r = 0) => n.usesBigInt && !t.usesBigInt ? Number(e) - Number(r) : !n.usesBigInt && t.usesBigInt ? BigInt(e.valueOf()) - BigInt(r.valueOf()) : Z(e, -r).valueOf(), Z = (n, t) => t == 0 ? n : n == 0 ? t : typeof n == "bigint" && typeof t == "bigint" || typeof n == "number" && typeof t == "number" ? n + t : Number(n) + Number(t), Gt = "00000000-0000-0000-0000-000000000000", Jt = /^(?:[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;
|
|
1383
|
-
function jt(n) {
|
|
1384
|
-
return typeof n == "string" && Jt.test(n);
|
|
1385
1421
|
}
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1422
|
+
const Yt = o.union([
|
|
1423
|
+
o.instanceof(Uint8Array),
|
|
1424
|
+
o.instanceof(Uint16Array),
|
|
1425
|
+
o.instanceof(Uint32Array),
|
|
1426
|
+
o.instanceof(BigUint64Array),
|
|
1427
|
+
o.instanceof(Float32Array),
|
|
1428
|
+
o.instanceof(Float64Array),
|
|
1429
|
+
o.instanceof(Int8Array),
|
|
1430
|
+
o.instanceof(Int16Array),
|
|
1431
|
+
o.instanceof(Int32Array),
|
|
1432
|
+
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);
|
|
1391
1439
|
}
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1440
|
+
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();
|
|
1445
|
+
}
|
|
1446
|
+
function ht(i, t = 0) {
|
|
1447
|
+
const e = K(i, t);
|
|
1448
|
+
if (!ct(e))
|
|
1395
1449
|
throw TypeError("Stringified UUID is invalid");
|
|
1396
1450
|
return e;
|
|
1397
1451
|
}
|
|
1398
|
-
let
|
|
1399
|
-
const
|
|
1400
|
-
function
|
|
1401
|
-
if (!
|
|
1452
|
+
let T;
|
|
1453
|
+
const dt = new Uint8Array(16);
|
|
1454
|
+
function gt() {
|
|
1455
|
+
if (!T) {
|
|
1402
1456
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1403
1457
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1404
|
-
|
|
1458
|
+
T = crypto.getRandomValues.bind(crypto);
|
|
1405
1459
|
}
|
|
1406
|
-
return
|
|
1460
|
+
return T(dt);
|
|
1407
1461
|
}
|
|
1408
|
-
const
|
|
1409
|
-
function
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
if (r.length < 16)
|
|
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();
|
|
1468
|
+
if (s.length < 16)
|
|
1416
1469
|
throw new Error("Random bytes length must be >= 16");
|
|
1417
|
-
return
|
|
1470
|
+
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, K(s);
|
|
1418
1471
|
}
|
|
1419
|
-
const
|
|
1472
|
+
const bt = () => wt(), P = (i, t) => ht(i, t), It = lt, Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1420
1473
|
__proto__: null,
|
|
1421
|
-
ZERO:
|
|
1422
|
-
create:
|
|
1423
|
-
parse:
|
|
1424
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1425
|
-
[Symbol.iterator]: () =>
|
|
1474
|
+
ZERO: It,
|
|
1475
|
+
create: bt,
|
|
1476
|
+
parse: P
|
|
1477
|
+
}, Symbol.toStringTag, { value: "Module" })), A = -1, p = {
|
|
1478
|
+
[Symbol.iterator]: () => p,
|
|
1426
1479
|
next: () => ({ done: !0, value: void 0 })
|
|
1427
|
-
},
|
|
1428
|
-
(
|
|
1429
|
-
atob(
|
|
1480
|
+
}, yt = o.string().transform(
|
|
1481
|
+
(i) => new Uint8Array(
|
|
1482
|
+
atob(i).split("").map((t) => t.charCodeAt(0))
|
|
1430
1483
|
).buffer
|
|
1431
|
-
),
|
|
1432
|
-
if (
|
|
1433
|
-
throw new Error(`cannot convert series of type ${t.toString()} to string`);
|
|
1434
|
-
if (n === "number" && !t.isNumeric)
|
|
1484
|
+
), Nt = o.union([o.null(), o.undefined()]).transform(() => new Uint8Array().buffer), q = 10, D = (i, t) => {
|
|
1485
|
+
if (i === "number" && !t.isNumeric)
|
|
1435
1486
|
throw new Error(`cannot convert series of type ${t.toString()} to number`);
|
|
1436
|
-
if (
|
|
1487
|
+
if (i === "bigint" && !t.usesBigInt)
|
|
1437
1488
|
throw new Error(`cannot convert series of type ${t.toString()} to bigint`);
|
|
1438
|
-
},
|
|
1489
|
+
}, X = "sy_x_telem_series";
|
|
1490
|
+
class I {
|
|
1491
|
+
/**
|
|
1492
|
+
* A unique identifier for the series. If specified by the user, it is their
|
|
1493
|
+
* responsibility to ensure that it is unique. If not specified, a new ID will be
|
|
1494
|
+
* generated.
|
|
1495
|
+
*/
|
|
1496
|
+
key;
|
|
1497
|
+
/**
|
|
1498
|
+
* A discriminator used for identifying instances of the series class even
|
|
1499
|
+
* when bundlers mangle the class name.
|
|
1500
|
+
*/
|
|
1501
|
+
discriminator = X;
|
|
1502
|
+
/** The data type of the series. */
|
|
1503
|
+
dataType;
|
|
1504
|
+
/**
|
|
1505
|
+
* A sample offset that can be used to shift the values of all samples upwards or
|
|
1506
|
+
* downwards. Useful to convert series to lower precision data types while preserving
|
|
1507
|
+
* the relative range of actual values.
|
|
1508
|
+
*/
|
|
1509
|
+
sampleOffset;
|
|
1510
|
+
/**
|
|
1511
|
+
* Stores information about the buffer state of this array into a WebGL buffer.
|
|
1512
|
+
*/
|
|
1513
|
+
gl;
|
|
1514
|
+
/** The underlying data. */
|
|
1515
|
+
_data;
|
|
1516
|
+
/** The time range occupied by the series' data. */
|
|
1517
|
+
timeRange = w.ZERO;
|
|
1518
|
+
/**
|
|
1519
|
+
* Alignment defines the location of the series relative to other series in a logical
|
|
1520
|
+
* group. Useful for defining the position of the series within a channel's data.
|
|
1521
|
+
*/
|
|
1522
|
+
alignment = 0n;
|
|
1523
|
+
/** A cached minimum value. */
|
|
1524
|
+
cachedMin;
|
|
1525
|
+
/** A cached maximum value. */
|
|
1526
|
+
cachedMax;
|
|
1527
|
+
/** The write position of the buffer. */
|
|
1528
|
+
writePos = A;
|
|
1529
|
+
/** Tracks the number of entities currently using this array. */
|
|
1530
|
+
_refCount = 0;
|
|
1531
|
+
/** Caches the length of the array for variable length data types. */
|
|
1532
|
+
cachedLength;
|
|
1533
|
+
/** Caches the indexes of the array for variable length data types. */
|
|
1534
|
+
_cachedIndexes;
|
|
1535
|
+
/**
|
|
1536
|
+
* A zod schema that can be used to validate that a particular value
|
|
1537
|
+
* can be constructed into a series.
|
|
1538
|
+
*/
|
|
1539
|
+
static crudeZ = o.object({
|
|
1540
|
+
timeRange: w.z.optional(),
|
|
1541
|
+
dataType: r.z,
|
|
1542
|
+
alignment: o.coerce.bigint().optional(),
|
|
1543
|
+
data: o.union([
|
|
1544
|
+
yt,
|
|
1545
|
+
Nt,
|
|
1546
|
+
o.instanceof(ArrayBuffer),
|
|
1547
|
+
o.instanceof(Uint8Array)
|
|
1548
|
+
]),
|
|
1549
|
+
glBufferUsage: at.optional().default("static").optional()
|
|
1550
|
+
});
|
|
1551
|
+
/**
|
|
1552
|
+
* A zod schema that validates and constructs a series from it's crude
|
|
1553
|
+
* representation.
|
|
1554
|
+
*/
|
|
1555
|
+
static z = I.crudeZ.transform((t) => new I(t));
|
|
1439
1556
|
/**
|
|
1440
1557
|
* The Series constructor accepts either a SeriesArgs object or a CrudeSeries value.
|
|
1441
1558
|
*
|
|
@@ -1510,111 +1627,69 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1510
1627
|
* @throws Error if data type cannot be inferred from input
|
|
1511
1628
|
*/
|
|
1512
1629
|
constructor(t) {
|
|
1513
|
-
|
|
1514
|
-
* A unique identifier for the series. If specified by the user, it is their
|
|
1515
|
-
* responsibility to ensure that it is unique. If not specified, a new ID will be
|
|
1516
|
-
* generated.
|
|
1517
|
-
*/
|
|
1518
|
-
i(this, "key");
|
|
1519
|
-
/**
|
|
1520
|
-
* A discriminator used for identifying instances of the series class even
|
|
1521
|
-
* when bundlers mangle the class name.
|
|
1522
|
-
*/
|
|
1523
|
-
i(this, "discriminator", ct);
|
|
1524
|
-
/** The data type of the series. */
|
|
1525
|
-
i(this, "dataType");
|
|
1526
|
-
/**
|
|
1527
|
-
* A sample offset that can be used to shift the values of all samples upwards or
|
|
1528
|
-
* downwards. Useful to convert series to lower precision data types while preserving
|
|
1529
|
-
* the relative range of actual values.
|
|
1530
|
-
*/
|
|
1531
|
-
i(this, "sampleOffset");
|
|
1532
|
-
/**
|
|
1533
|
-
* Stores information about the buffer state of this array into a WebGL buffer.
|
|
1534
|
-
*/
|
|
1535
|
-
i(this, "gl");
|
|
1536
|
-
/** The underlying data. */
|
|
1537
|
-
i(this, "_data");
|
|
1538
|
-
/** The time range occupied by the series' data. */
|
|
1539
|
-
i(this, "timeRange", B.ZERO);
|
|
1540
|
-
/**
|
|
1541
|
-
* Alignment defines the location of the series relative to other series in a logical
|
|
1542
|
-
* group. Useful for defining the position of the series within a channel's data.
|
|
1543
|
-
*/
|
|
1544
|
-
i(this, "alignment", 0n);
|
|
1545
|
-
/** A cached minimum value. */
|
|
1546
|
-
i(this, "cachedMin");
|
|
1547
|
-
/** A cached maximum value. */
|
|
1548
|
-
i(this, "cachedMax");
|
|
1549
|
-
/** The write position of the buffer. */
|
|
1550
|
-
i(this, "writePos", R);
|
|
1551
|
-
/** Tracks the number of entities currently using this array. */
|
|
1552
|
-
i(this, "_refCount", 0);
|
|
1553
|
-
/** Caches the length of the array for variable length data types. */
|
|
1554
|
-
i(this, "cachedLength");
|
|
1555
|
-
/** Caches the indexes of the array for variable length data types. */
|
|
1556
|
-
i(this, "_cachedIndexes");
|
|
1557
|
-
re(t) && (t = { data: t }), t.data ?? (t.data = []);
|
|
1630
|
+
mt(t) && (t = { data: t }), t.data ??= [];
|
|
1558
1631
|
const {
|
|
1559
1632
|
dataType: e,
|
|
1560
|
-
timeRange:
|
|
1561
|
-
sampleOffset:
|
|
1633
|
+
timeRange: s,
|
|
1634
|
+
sampleOffset: u = 0,
|
|
1562
1635
|
glBufferUsage: f = "static",
|
|
1563
|
-
alignment:
|
|
1564
|
-
key:
|
|
1565
|
-
data:
|
|
1636
|
+
alignment: c = 0n,
|
|
1637
|
+
key: y = J(),
|
|
1638
|
+
data: g
|
|
1566
1639
|
} = t;
|
|
1567
|
-
if (
|
|
1568
|
-
const l =
|
|
1640
|
+
if (Q(g)) {
|
|
1641
|
+
const l = g;
|
|
1569
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;
|
|
1570
1643
|
return;
|
|
1571
1644
|
}
|
|
1572
|
-
const
|
|
1573
|
-
if (e != null) this.dataType = new
|
|
1645
|
+
const b = H(g), N = Array.isArray(g);
|
|
1646
|
+
if (e != null) this.dataType = new r(e);
|
|
1574
1647
|
else {
|
|
1575
|
-
if (
|
|
1648
|
+
if (g instanceof ArrayBuffer)
|
|
1576
1649
|
throw new Error(
|
|
1577
1650
|
"cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
|
|
1578
1651
|
);
|
|
1579
|
-
if (
|
|
1580
|
-
let l =
|
|
1581
|
-
if (!
|
|
1582
|
-
if (
|
|
1652
|
+
if (N || b) {
|
|
1653
|
+
let l = g;
|
|
1654
|
+
if (!b) {
|
|
1655
|
+
if (g.length === 0)
|
|
1583
1656
|
throw new Error(
|
|
1584
1657
|
"cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
|
|
1585
1658
|
);
|
|
1586
|
-
l =
|
|
1659
|
+
l = g[0];
|
|
1587
1660
|
}
|
|
1588
|
-
if (typeof l == "string") this.dataType =
|
|
1589
|
-
else if (typeof l == "number") this.dataType =
|
|
1590
|
-
else if (typeof l == "bigint") this.dataType =
|
|
1591
|
-
else if (typeof l == "boolean") this.dataType =
|
|
1592
|
-
else if (l instanceof
|
|
1593
|
-
this.dataType =
|
|
1594
|
-
else if (typeof l == "object") this.dataType =
|
|
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;
|
|
1595
1668
|
else
|
|
1596
1669
|
throw new Error(
|
|
1597
1670
|
`cannot infer data type of ${typeof l} when constructing a Series from a JS array`
|
|
1598
1671
|
);
|
|
1599
|
-
} else this.dataType = new
|
|
1672
|
+
} else this.dataType = new r(g);
|
|
1600
1673
|
}
|
|
1601
|
-
if (!
|
|
1674
|
+
if (!N && !b) this._data = g;
|
|
1675
|
+
else if (N && g.length === 0)
|
|
1676
|
+
this._data = new this.dataType.Array([]).buffer;
|
|
1602
1677
|
else {
|
|
1603
|
-
let l =
|
|
1604
|
-
const
|
|
1605
|
-
(
|
|
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(`
|
|
1606
1681
|
`)}
|
|
1607
|
-
`).buffer) : this.dataType.equals(
|
|
1608
|
-
`${l.map((v) =>
|
|
1682
|
+
`).buffer) : this.dataType.equals(r.JSON) ? (this.cachedLength = l.length, this._data = new TextEncoder().encode(
|
|
1683
|
+
`${l.map((v) => L.encodeString(v)).join(`
|
|
1609
1684
|
`)}
|
|
1610
1685
|
`
|
|
1611
|
-
).buffer) : this.dataType.usesBigInt && typeof
|
|
1686
|
+
).buffer) : this.dataType.usesBigInt && typeof m == "number" ? this._data = new this.dataType.Array(
|
|
1612
1687
|
l.map((v) => BigInt(Math.round(v)))
|
|
1613
|
-
).buffer : !this.dataType.usesBigInt && typeof
|
|
1614
|
-
l.map(
|
|
1688
|
+
).buffer : !this.dataType.usesBigInt && typeof m == "bigint" ? this._data = new this.dataType.Array(
|
|
1689
|
+
l.map(Number)
|
|
1615
1690
|
).buffer : this._data = new this.dataType.Array(l).buffer;
|
|
1616
1691
|
}
|
|
1617
|
-
this.key =
|
|
1692
|
+
this.key = y, this.alignment = c, this.sampleOffset = u ?? 0, this.timeRange = s ?? w.ZERO, this.gl = {
|
|
1618
1693
|
control: null,
|
|
1619
1694
|
buffer: null,
|
|
1620
1695
|
prevBuffer: 0,
|
|
@@ -1628,10 +1703,10 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1628
1703
|
* @param args.dataType the data type of the series.
|
|
1629
1704
|
* @param args.rest the rest of the arguments to pass to the series constructor.
|
|
1630
1705
|
*/
|
|
1631
|
-
static alloc({ capacity: t, dataType: e, ...
|
|
1706
|
+
static alloc({ capacity: t, dataType: e, ...s }) {
|
|
1632
1707
|
if (t === 0)
|
|
1633
1708
|
throw new Error("[Series] - cannot allocate an array of length 0");
|
|
1634
|
-
const
|
|
1709
|
+
const u = new new r(e).Array(t), f = new I({ data: u.buffer, dataType: e, ...s });
|
|
1635
1710
|
return f.writePos = 0, f;
|
|
1636
1711
|
}
|
|
1637
1712
|
/**
|
|
@@ -1674,14 +1749,14 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1674
1749
|
return this.dataType.isVariable ? this.writeVariable(t) : this.writeFixed(t);
|
|
1675
1750
|
}
|
|
1676
1751
|
writeVariable(t) {
|
|
1677
|
-
if (this.writePos ===
|
|
1678
|
-
const e = this.byteCapacity.valueOf() - this.writePos,
|
|
1679
|
-
return this.writeToUnderlyingData(
|
|
1752
|
+
if (this.writePos === A) return 0;
|
|
1753
|
+
const e = this.byteCapacity.valueOf() - this.writePos, s = t.subBytes(0, e);
|
|
1754
|
+
return this.writeToUnderlyingData(s), this.writePos += s.byteLength.valueOf(), this.cachedLength != null && (this.cachedLength += s.length, this.calculateCachedLength()), s.length;
|
|
1680
1755
|
}
|
|
1681
1756
|
writeFixed(t) {
|
|
1682
|
-
if (this.writePos ===
|
|
1683
|
-
const e = this.capacity - this.writePos,
|
|
1684
|
-
return this.writeToUnderlyingData(
|
|
1757
|
+
if (this.writePos === A) return 0;
|
|
1758
|
+
const e = this.capacity - this.writePos, s = t.sub(0, e);
|
|
1759
|
+
return this.writeToUnderlyingData(s), this.cachedLength = void 0, this.maybeRecomputeMinMax(s), this.writePos += s.length, s.length;
|
|
1685
1760
|
}
|
|
1686
1761
|
writeToUnderlyingData(t) {
|
|
1687
1762
|
this.underlyingData.set(
|
|
@@ -1702,7 +1777,7 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1702
1777
|
* @returns A typed array containing the series data.
|
|
1703
1778
|
*/
|
|
1704
1779
|
get data() {
|
|
1705
|
-
return this.writePos ===
|
|
1780
|
+
return this.writePos === A ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
|
|
1706
1781
|
}
|
|
1707
1782
|
/**
|
|
1708
1783
|
* Returns an array of the values in the series as strings.
|
|
@@ -1713,17 +1788,6 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1713
1788
|
return this.dataType.isVariable ? new TextDecoder().decode(this.underlyingData).split(`
|
|
1714
1789
|
`).slice(0, -1) : Array.from(this).map((t) => t.toString());
|
|
1715
1790
|
}
|
|
1716
|
-
/**
|
|
1717
|
-
* Returns a parsed array of UUIDs from the series.
|
|
1718
|
-
* @throws Error if the series does not have a data type of UUID.
|
|
1719
|
-
* @returns An array of UUID strings.
|
|
1720
|
-
*/
|
|
1721
|
-
toUUIDs() {
|
|
1722
|
-
if (!this.dataType.equals(m.UUID))
|
|
1723
|
-
throw new Error("cannot convert non-uuid series to uuids");
|
|
1724
|
-
const t = m.UUID.density.valueOf(), e = new Uint8Array(this.underlyingData.buffer);
|
|
1725
|
-
return Array.from({ length: this.length }, (r, a) => lt(e, a * t));
|
|
1726
|
-
}
|
|
1727
1791
|
/**
|
|
1728
1792
|
* Parses a JSON series into an array of values using the provided zod schema.
|
|
1729
1793
|
* @template Z The zod schema type.
|
|
@@ -1732,16 +1796,16 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1732
1796
|
* @returns An array of values parsed from the JSON series.
|
|
1733
1797
|
*/
|
|
1734
1798
|
parseJSON(t) {
|
|
1735
|
-
if (!this.dataType.equals(
|
|
1799
|
+
if (!this.dataType.equals(r.JSON))
|
|
1736
1800
|
throw new Error("cannot parse non-JSON series as JSON");
|
|
1737
|
-
return this.toStrings().map((e) => t.parse(
|
|
1801
|
+
return this.toStrings().map((e) => t.parse(L.decodeString(e)));
|
|
1738
1802
|
}
|
|
1739
1803
|
/**
|
|
1740
1804
|
* Returns the capacity of the series in bytes.
|
|
1741
1805
|
* @returns The size of the underlying buffer in bytes.
|
|
1742
1806
|
*/
|
|
1743
1807
|
get byteCapacity() {
|
|
1744
|
-
return new
|
|
1808
|
+
return new h(this.underlyingData.byteLength);
|
|
1745
1809
|
}
|
|
1746
1810
|
/**
|
|
1747
1811
|
* Returns the capacity of the series in samples.
|
|
@@ -1757,7 +1821,7 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1757
1821
|
* @returns The size of the data in bytes.
|
|
1758
1822
|
*/
|
|
1759
1823
|
get byteLength() {
|
|
1760
|
-
return this.writePos ===
|
|
1824
|
+
return this.writePos === A ? this.byteCapacity : this.dataType.isVariable ? new h(this.writePos) : this.dataType.density.size(this.writePos);
|
|
1761
1825
|
}
|
|
1762
1826
|
/**
|
|
1763
1827
|
* Returns the number of samples in this array.
|
|
@@ -1765,15 +1829,15 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1765
1829
|
* @returns The number of samples in the series.
|
|
1766
1830
|
*/
|
|
1767
1831
|
get length() {
|
|
1768
|
-
return this.cachedLength != null ? this.cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos ===
|
|
1832
|
+
return this.cachedLength != null ? this.cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === A ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos;
|
|
1769
1833
|
}
|
|
1770
1834
|
calculateCachedLength() {
|
|
1771
1835
|
if (!this.dataType.isVariable)
|
|
1772
1836
|
throw new Error("cannot calculate length of a non-variable length data type");
|
|
1773
1837
|
let t = 0;
|
|
1774
1838
|
const e = [0];
|
|
1775
|
-
return this.data.forEach((
|
|
1776
|
-
|
|
1839
|
+
return this.data.forEach((s, u) => {
|
|
1840
|
+
s === q && (t++, e.push(u + 1));
|
|
1777
1841
|
}), this._cachedIndexes = e, this.cachedLength = t, t;
|
|
1778
1842
|
}
|
|
1779
1843
|
/**
|
|
@@ -1787,11 +1851,11 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1787
1851
|
*/
|
|
1788
1852
|
convert(t, e = 0) {
|
|
1789
1853
|
if (this.dataType.equals(t)) return this;
|
|
1790
|
-
const
|
|
1791
|
-
for (let
|
|
1792
|
-
|
|
1793
|
-
return new
|
|
1794
|
-
data:
|
|
1854
|
+
const s = new t.Array(this.length);
|
|
1855
|
+
for (let u = 0; u < this.length; u++)
|
|
1856
|
+
s[u] = ot(this.dataType, t, this.data[u], e);
|
|
1857
|
+
return new I({
|
|
1858
|
+
data: s.buffer,
|
|
1795
1859
|
dataType: t,
|
|
1796
1860
|
timeRange: this.timeRange,
|
|
1797
1861
|
sampleOffset: e,
|
|
@@ -1801,14 +1865,14 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1801
1865
|
}
|
|
1802
1866
|
calcRawMax() {
|
|
1803
1867
|
if (this.length === 0) return -1 / 0;
|
|
1804
|
-
if (this.dataType.equals(
|
|
1868
|
+
if (this.dataType.equals(r.TIMESTAMP))
|
|
1805
1869
|
this.cachedMax = this.data[this.data.length - 1];
|
|
1806
1870
|
else if (this.dataType.usesBigInt) {
|
|
1807
1871
|
const t = this.data;
|
|
1808
|
-
this.cachedMax = t.reduce((e,
|
|
1872
|
+
this.cachedMax = t.reduce((e, s) => e > s ? e : s);
|
|
1809
1873
|
} else {
|
|
1810
1874
|
const t = this.data;
|
|
1811
|
-
this.cachedMax = t.reduce((e,
|
|
1875
|
+
this.cachedMax = t.reduce((e, s) => e > s ? e : s);
|
|
1812
1876
|
}
|
|
1813
1877
|
return this.cachedMax;
|
|
1814
1878
|
}
|
|
@@ -1819,17 +1883,17 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1819
1883
|
calcMax() {
|
|
1820
1884
|
if (this.dataType.isVariable)
|
|
1821
1885
|
throw new Error("cannot calculate maximum on a variable length data type");
|
|
1822
|
-
return this.writePos === 0 ? -1 / 0 : (this.cachedMax
|
|
1886
|
+
return this.writePos === 0 ? -1 / 0 : (this.cachedMax ??= this.calcRawMax(), x(this.cachedMax, this.sampleOffset));
|
|
1823
1887
|
}
|
|
1824
1888
|
calcRawMin() {
|
|
1825
1889
|
if (this.length === 0) return 1 / 0;
|
|
1826
|
-
if (this.dataType.equals(
|
|
1890
|
+
if (this.dataType.equals(r.TIMESTAMP)) this.cachedMin = this.data[0];
|
|
1827
1891
|
else if (this.dataType.usesBigInt) {
|
|
1828
1892
|
const t = this.data;
|
|
1829
|
-
this.cachedMin = t.reduce((e,
|
|
1893
|
+
this.cachedMin = t.reduce((e, s) => e < s ? e : s);
|
|
1830
1894
|
} else {
|
|
1831
1895
|
const t = this.data;
|
|
1832
|
-
this.cachedMin = t.reduce((e,
|
|
1896
|
+
this.cachedMin = t.reduce((e, s) => e < s ? e : s);
|
|
1833
1897
|
}
|
|
1834
1898
|
return this.cachedMin;
|
|
1835
1899
|
}
|
|
@@ -1840,11 +1904,11 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1840
1904
|
calcMin() {
|
|
1841
1905
|
if (this.dataType.isVariable)
|
|
1842
1906
|
throw new Error("cannot calculate minimum on a variable length data type");
|
|
1843
|
-
return this.writePos === 0 ? 1 / 0 : (this.cachedMin
|
|
1907
|
+
return this.writePos === 0 ? 1 / 0 : (this.cachedMin ??= this.calcRawMin(), x(this.cachedMin, this.sampleOffset));
|
|
1844
1908
|
}
|
|
1845
1909
|
/** @returns the bounds of the series. */
|
|
1846
1910
|
get bounds() {
|
|
1847
|
-
return
|
|
1911
|
+
return C(Number(this.min), Number(this.max), { makeValid: !1 });
|
|
1848
1912
|
}
|
|
1849
1913
|
maybeRecomputeMinMax(t) {
|
|
1850
1914
|
if (this.cachedMin != null) {
|
|
@@ -1857,44 +1921,56 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1857
1921
|
}
|
|
1858
1922
|
}
|
|
1859
1923
|
atAlignment(t, e) {
|
|
1860
|
-
const
|
|
1861
|
-
if (
|
|
1862
|
-
if (e === !0) throw new Error(`[series] - no value at index ${
|
|
1924
|
+
const s = Number(t - this.alignment);
|
|
1925
|
+
if (s < 0 || s >= this.length) {
|
|
1926
|
+
if (e === !0) throw new Error(`[series] - no value at index ${s}`);
|
|
1863
1927
|
return;
|
|
1864
1928
|
}
|
|
1865
|
-
return this.at(
|
|
1929
|
+
return this.at(s, e);
|
|
1866
1930
|
}
|
|
1867
|
-
at(t, e) {
|
|
1931
|
+
at(t, e = !1) {
|
|
1868
1932
|
if (this.dataType.isVariable) return this.atVariable(t, e ?? !1);
|
|
1933
|
+
if (this.dataType.equals(r.UUID)) return this.atUUID(t, e);
|
|
1869
1934
|
t < 0 && (t = this.length + t);
|
|
1870
|
-
const
|
|
1871
|
-
if (
|
|
1935
|
+
const s = this.data[t];
|
|
1936
|
+
if (s == null) {
|
|
1872
1937
|
if (e === !0) throw new Error(`[series] - no value at index ${t}`);
|
|
1873
1938
|
return;
|
|
1874
1939
|
}
|
|
1875
|
-
return
|
|
1940
|
+
return x(s, this.sampleOffset);
|
|
1941
|
+
}
|
|
1942
|
+
atUUID(t, e) {
|
|
1943
|
+
t < 0 && (t = this.length + t);
|
|
1944
|
+
const s = P(
|
|
1945
|
+
new Uint8Array(this.buffer, t * this.dataType.density.valueOf())
|
|
1946
|
+
);
|
|
1947
|
+
if (s == null) {
|
|
1948
|
+
if (e) throw new Error(`[series] - no value at index ${t}`);
|
|
1949
|
+
return;
|
|
1950
|
+
}
|
|
1951
|
+
return s;
|
|
1876
1952
|
}
|
|
1877
1953
|
atVariable(t, e) {
|
|
1878
|
-
let
|
|
1954
|
+
let s = 0, u = 0;
|
|
1879
1955
|
if (this._cachedIndexes != null)
|
|
1880
|
-
|
|
1956
|
+
s = this._cachedIndexes[t], u = this._cachedIndexes[t + 1] - 1;
|
|
1881
1957
|
else {
|
|
1882
1958
|
t < 0 && (t = this.length + t);
|
|
1883
|
-
for (let
|
|
1884
|
-
if (this.data[
|
|
1959
|
+
for (let c = 0; c < this.data.length; c++)
|
|
1960
|
+
if (this.data[c] === q) {
|
|
1885
1961
|
if (t === 0) {
|
|
1886
|
-
|
|
1962
|
+
u = c;
|
|
1887
1963
|
break;
|
|
1888
1964
|
}
|
|
1889
|
-
|
|
1965
|
+
s = c + 1, t--;
|
|
1890
1966
|
}
|
|
1891
|
-
if (
|
|
1967
|
+
if (u === 0 && (u = this.data.length), s >= u || t > 0) {
|
|
1892
1968
|
if (e) throw new Error(`[series] - no value at index ${t}`);
|
|
1893
1969
|
return;
|
|
1894
1970
|
}
|
|
1895
1971
|
}
|
|
1896
|
-
const f = this.data.slice(
|
|
1897
|
-
return this.dataType.equals(
|
|
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)));
|
|
1898
1974
|
}
|
|
1899
1975
|
/**
|
|
1900
1976
|
* @returns the index of the first sample that is greater than or equal to the given value.
|
|
@@ -1902,12 +1978,12 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1902
1978
|
* @param value the value to search for.
|
|
1903
1979
|
*/
|
|
1904
1980
|
binarySearch(t) {
|
|
1905
|
-
let e = 0,
|
|
1906
|
-
const
|
|
1907
|
-
for (; e <=
|
|
1908
|
-
const f = Math.floor((e +
|
|
1909
|
-
if (
|
|
1910
|
-
|
|
1981
|
+
let e = 0, s = this.length - 1;
|
|
1982
|
+
const u = _(t);
|
|
1983
|
+
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;
|
|
1911
1987
|
}
|
|
1912
1988
|
return e;
|
|
1913
1989
|
}
|
|
@@ -1919,23 +1995,23 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1919
1995
|
* be the same buffer previously passed to {@method acquire} or {@method updateGLBuffer}.
|
|
1920
1996
|
*/
|
|
1921
1997
|
updateGLBuffer(t) {
|
|
1922
|
-
if (this.gl.control = t, !this.dataType.equals(
|
|
1998
|
+
if (this.gl.control = t, !this.dataType.equals(r.FLOAT32) && !this.dataType.equals(r.UINT8))
|
|
1923
1999
|
throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
|
|
1924
|
-
const { buffer: e, bufferUsage:
|
|
1925
|
-
if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !==
|
|
1926
|
-
if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !==
|
|
1927
|
-
|
|
1928
|
-
const f = this.dataType.density.size(
|
|
1929
|
-
t.bufferSubData(t.ARRAY_BUFFER, f,
|
|
2000
|
+
const { buffer: e, bufferUsage: s, prevBuffer: u } = this.gl;
|
|
2001
|
+
if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !== u)
|
|
2002
|
+
if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !== A) {
|
|
2003
|
+
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;
|
|
1930
2006
|
} else
|
|
1931
2007
|
t.bufferData(
|
|
1932
2008
|
t.ARRAY_BUFFER,
|
|
1933
2009
|
this.buffer,
|
|
1934
|
-
|
|
1935
|
-
), this.gl.prevBuffer =
|
|
2010
|
+
s === "static" ? t.STATIC_DRAW : t.DYNAMIC_DRAW
|
|
2011
|
+
), this.gl.prevBuffer = A;
|
|
1936
2012
|
}
|
|
1937
2013
|
as(t) {
|
|
1938
|
-
return
|
|
2014
|
+
return D(t, this.dataType), this;
|
|
1939
2015
|
}
|
|
1940
2016
|
/** @returns a digest containing information about the series. */
|
|
1941
2017
|
get digest() {
|
|
@@ -1944,8 +2020,8 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1944
2020
|
dataType: this.dataType.toString(),
|
|
1945
2021
|
sampleOffset: this.sampleOffset,
|
|
1946
2022
|
alignment: {
|
|
1947
|
-
lower:
|
|
1948
|
-
upper:
|
|
2023
|
+
lower: k(this.alignmentBounds.lower),
|
|
2024
|
+
upper: k(this.alignmentBounds.upper)
|
|
1949
2025
|
},
|
|
1950
2026
|
timeRange: this.timeRange.toString(),
|
|
1951
2027
|
length: this.length,
|
|
@@ -1962,7 +2038,7 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1962
2038
|
* is exclusive.
|
|
1963
2039
|
*/
|
|
1964
2040
|
get alignmentBounds() {
|
|
1965
|
-
return
|
|
2041
|
+
return C(this.alignment, this.alignment + BigInt(this.length));
|
|
1966
2042
|
}
|
|
1967
2043
|
maybeGarbageCollectGLBuffer(t) {
|
|
1968
2044
|
this.gl.buffer != null && (t.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
|
|
@@ -1979,10 +2055,10 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
1979
2055
|
}
|
|
1980
2056
|
[Symbol.iterator]() {
|
|
1981
2057
|
if (this.dataType.isVariable) {
|
|
1982
|
-
const t = new
|
|
1983
|
-
return this.dataType.equals(
|
|
2058
|
+
const t = new vt(this);
|
|
2059
|
+
return this.dataType.equals(r.JSON) ? new $(t) : t;
|
|
1984
2060
|
}
|
|
1985
|
-
return new
|
|
2061
|
+
return this.dataType.equals(r.UUID) ? new Ut(this) : new At(this);
|
|
1986
2062
|
}
|
|
1987
2063
|
/**
|
|
1988
2064
|
* Returns a slice of the series from start to end.
|
|
@@ -2009,7 +2085,7 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
2009
2085
|
* @returns An iterator over the specified range.
|
|
2010
2086
|
*/
|
|
2011
2087
|
subIterator(t, e) {
|
|
2012
|
-
return new
|
|
2088
|
+
return new V(this, t, e ?? this.length);
|
|
2013
2089
|
}
|
|
2014
2090
|
/**
|
|
2015
2091
|
* Returns an iterator over a portion of the series based on alignment.
|
|
@@ -2018,7 +2094,7 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
2018
2094
|
* @returns An iterator over the specified alignment range.
|
|
2019
2095
|
*/
|
|
2020
2096
|
subAlignmentIterator(t, e) {
|
|
2021
|
-
return new
|
|
2097
|
+
return new V(
|
|
2022
2098
|
this,
|
|
2023
2099
|
Number(t - this.alignment),
|
|
2024
2100
|
Number(e - this.alignment)
|
|
@@ -2026,9 +2102,9 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
2026
2102
|
}
|
|
2027
2103
|
subBytes(t, e) {
|
|
2028
2104
|
if (t >= 0 && (e == null || e >= this.byteLength.valueOf())) return this;
|
|
2029
|
-
const
|
|
2030
|
-
return new
|
|
2031
|
-
data:
|
|
2105
|
+
const s = this.data.subarray(t, e);
|
|
2106
|
+
return new I({
|
|
2107
|
+
data: s,
|
|
2032
2108
|
dataType: this.dataType,
|
|
2033
2109
|
timeRange: this.timeRange,
|
|
2034
2110
|
sampleOffset: this.sampleOffset,
|
|
@@ -2036,11 +2112,11 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
2036
2112
|
alignment: this.alignment + BigInt(t)
|
|
2037
2113
|
});
|
|
2038
2114
|
}
|
|
2039
|
-
sliceSub(t, e,
|
|
2040
|
-
if (e <= 0 && (
|
|
2041
|
-
let
|
|
2042
|
-
return t ?
|
|
2043
|
-
data:
|
|
2115
|
+
sliceSub(t, e, s) {
|
|
2116
|
+
if (e <= 0 && (s == null || s >= this.length)) return this;
|
|
2117
|
+
let u;
|
|
2118
|
+
return t ? u = this.data.subarray(e, s) : u = this.data.slice(e, s), new I({
|
|
2119
|
+
data: u,
|
|
2044
2120
|
dataType: this.dataType,
|
|
2045
2121
|
timeRange: this.timeRange,
|
|
2046
2122
|
sampleOffset: this.sampleOffset,
|
|
@@ -2054,10 +2130,10 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
2054
2130
|
* @returns A new series with the specified alignment.
|
|
2055
2131
|
*/
|
|
2056
2132
|
reAlign(t) {
|
|
2057
|
-
return new
|
|
2133
|
+
return new I({
|
|
2058
2134
|
data: this.buffer,
|
|
2059
2135
|
dataType: this.dataType,
|
|
2060
|
-
timeRange:
|
|
2136
|
+
timeRange: w.ZERO,
|
|
2061
2137
|
sampleOffset: this.sampleOffset,
|
|
2062
2138
|
glBufferUsage: "static",
|
|
2063
2139
|
alignment: t
|
|
@@ -2069,59 +2145,37 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
|
|
|
2069
2145
|
* @returns A string representation of the series.
|
|
2070
2146
|
*/
|
|
2071
2147
|
toString() {
|
|
2072
|
-
var e, r;
|
|
2073
2148
|
let t = `Series(${this.dataType.toString()} ${this.length} [`;
|
|
2074
|
-
if (this.length <= 10) t += Array.from(this).map((
|
|
2149
|
+
if (this.length <= 10) t += Array.from(this).map((e) => e.toString());
|
|
2075
2150
|
else {
|
|
2076
|
-
for (let
|
|
2077
|
-
t += `${
|
|
2151
|
+
for (let e = 0; e < 5; e++)
|
|
2152
|
+
t += `${this.at(e)?.toString()}`, t += ",";
|
|
2078
2153
|
t += "...,";
|
|
2079
|
-
for (let
|
|
2080
|
-
t +=
|
|
2154
|
+
for (let e = -5; e < 0; e++)
|
|
2155
|
+
t += this.at(e)?.toString(), e < -1 && (t += ",");
|
|
2081
2156
|
}
|
|
2082
2157
|
return t += "])", t;
|
|
2083
2158
|
}
|
|
2084
|
-
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
dataType: m.z,
|
|
2092
|
-
alignment: st().optional(),
|
|
2093
|
-
data: S([
|
|
2094
|
-
te,
|
|
2095
|
-
ee,
|
|
2096
|
-
O(ArrayBuffer),
|
|
2097
|
-
O(Uint8Array)
|
|
2098
|
-
]),
|
|
2099
|
-
glBufferUsage: Vt.optional().default("static").optional()
|
|
2100
|
-
})), /**
|
|
2101
|
-
* A zod schema that validates and constructs a series from it's crude
|
|
2102
|
-
* representation.
|
|
2103
|
-
*/
|
|
2104
|
-
i(N, "z", N.crudeZ.transform((t) => new N(t)));
|
|
2105
|
-
let V = N;
|
|
2106
|
-
const re = (n) => n == null ? !1 : Array.isArray(n) || n instanceof ArrayBuffer || ArrayBuffer.isView(n) && !(n instanceof DataView) || n instanceof V ? !0 : ut(n), ht = it(ct, V);
|
|
2107
|
-
class tt {
|
|
2108
|
-
constructor(t, e, r) {
|
|
2109
|
-
i(this, "series");
|
|
2110
|
-
i(this, "end");
|
|
2111
|
-
i(this, "index");
|
|
2159
|
+
}
|
|
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 {
|
|
2162
|
+
series;
|
|
2163
|
+
end;
|
|
2164
|
+
index;
|
|
2165
|
+
constructor(t, e, s) {
|
|
2112
2166
|
this.series = t;
|
|
2113
|
-
const
|
|
2114
|
-
this.end =
|
|
2167
|
+
const u = C(0, t.length);
|
|
2168
|
+
this.end = Y(u, s), this.index = Y(u, e);
|
|
2115
2169
|
}
|
|
2116
2170
|
next() {
|
|
2117
2171
|
return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
|
|
2118
2172
|
}
|
|
2119
2173
|
}
|
|
2120
|
-
class
|
|
2174
|
+
class vt {
|
|
2175
|
+
series;
|
|
2176
|
+
index;
|
|
2177
|
+
decoder;
|
|
2121
2178
|
constructor(t) {
|
|
2122
|
-
i(this, "series");
|
|
2123
|
-
i(this, "index");
|
|
2124
|
-
i(this, "decoder");
|
|
2125
2179
|
if (!t.dataType.isVariable)
|
|
2126
2180
|
throw new Error(
|
|
2127
2181
|
"cannot create a variable series iterator for a non-variable series"
|
|
@@ -2130,30 +2184,45 @@ class se {
|
|
|
2130
2184
|
}
|
|
2131
2185
|
next() {
|
|
2132
2186
|
const t = this.index, e = this.series.data;
|
|
2133
|
-
for (; this.index < e.length && e[this.index] !==
|
|
2134
|
-
const
|
|
2135
|
-
return t ===
|
|
2187
|
+
for (; this.index < e.length && e[this.index] !== q; ) this.index++;
|
|
2188
|
+
const s = this.index;
|
|
2189
|
+
return t === s ? { done: !0, value: void 0 } : (this.index++, { done: !1, value: this.decoder.decode(this.series.buffer.slice(t, s)) });
|
|
2136
2190
|
}
|
|
2137
2191
|
}
|
|
2138
|
-
|
|
2192
|
+
class $ {
|
|
2193
|
+
wrapped;
|
|
2194
|
+
static schema = o.record(o.string(), o.unknown());
|
|
2139
2195
|
constructor(t) {
|
|
2140
|
-
i(this, "wrapped");
|
|
2141
2196
|
this.wrapped = t;
|
|
2142
2197
|
}
|
|
2143
2198
|
next() {
|
|
2144
2199
|
const t = this.wrapped.next();
|
|
2145
2200
|
return t.done === !0 ? { done: !0, value: void 0 } : {
|
|
2146
2201
|
done: !1,
|
|
2147
|
-
value:
|
|
2202
|
+
value: L.decodeString(t.value, $.schema)
|
|
2148
2203
|
};
|
|
2149
2204
|
}
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2205
|
+
}
|
|
2206
|
+
class Ut {
|
|
2207
|
+
series;
|
|
2208
|
+
index;
|
|
2209
|
+
data;
|
|
2210
|
+
density;
|
|
2211
|
+
constructor(t) {
|
|
2212
|
+
if (!t.dataType.equals(r.UUID))
|
|
2213
|
+
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();
|
|
2215
|
+
}
|
|
2216
|
+
next() {
|
|
2217
|
+
if (this.index >= this.series.length) return { done: !0, value: void 0 };
|
|
2218
|
+
const t = P(this.data, this.index * this.density);
|
|
2219
|
+
return this.index++, { done: !1, value: t };
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
class At {
|
|
2223
|
+
series;
|
|
2224
|
+
index;
|
|
2154
2225
|
constructor(t) {
|
|
2155
|
-
i(this, "series");
|
|
2156
|
-
i(this, "index");
|
|
2157
2226
|
this.series = t, this.index = 0;
|
|
2158
2227
|
}
|
|
2159
2228
|
next() {
|
|
@@ -2163,7 +2232,9 @@ class ne {
|
|
|
2163
2232
|
};
|
|
2164
2233
|
}
|
|
2165
2234
|
}
|
|
2166
|
-
class
|
|
2235
|
+
class Vt {
|
|
2236
|
+
/** The array of series in this collection */
|
|
2237
|
+
series;
|
|
2167
2238
|
/**
|
|
2168
2239
|
* The MultiSeries constructor accepts an optional array of Series instances. All series
|
|
2169
2240
|
* in the collection must have the same data type.
|
|
@@ -2205,25 +2276,23 @@ class ve {
|
|
|
2205
2276
|
* @throws Error if attempting to add a series with a different data type
|
|
2206
2277
|
*/
|
|
2207
2278
|
constructor(t = []) {
|
|
2208
|
-
/** The array of series in this collection */
|
|
2209
|
-
i(this, "series");
|
|
2210
2279
|
if (t.length !== 0) {
|
|
2211
2280
|
const e = t[0].dataType;
|
|
2212
|
-
for (let
|
|
2213
|
-
if (!t[
|
|
2281
|
+
for (let s = 1; s < t.length; s++)
|
|
2282
|
+
if (!t[s].dataType.equals(e))
|
|
2214
2283
|
throw new Error("[multi-series] - series must have the same data type");
|
|
2215
2284
|
}
|
|
2216
2285
|
this.series = t;
|
|
2217
2286
|
}
|
|
2218
2287
|
as(t) {
|
|
2219
|
-
return
|
|
2288
|
+
return D(t, this.dataType), this;
|
|
2220
2289
|
}
|
|
2221
2290
|
/**
|
|
2222
2291
|
* Returns the data type of the series in this collection. If the collection is empty,
|
|
2223
2292
|
* returns DataType.UNKNOWN.
|
|
2224
2293
|
*/
|
|
2225
2294
|
get dataType() {
|
|
2226
|
-
return this.series.length === 0 ?
|
|
2295
|
+
return this.series.length === 0 ? r.UNKNOWN : this.series[0].dataType;
|
|
2227
2296
|
}
|
|
2228
2297
|
/**
|
|
2229
2298
|
* Returns the combined time range of all series in the collection. If the collection
|
|
@@ -2231,7 +2300,7 @@ class ve {
|
|
|
2231
2300
|
* series to the end of the last series.
|
|
2232
2301
|
*/
|
|
2233
2302
|
get timeRange() {
|
|
2234
|
-
return this.series.length === 0 ?
|
|
2303
|
+
return this.series.length === 0 ? w.ZERO : new w(
|
|
2235
2304
|
this.series[0].timeRange.start,
|
|
2236
2305
|
this.series[this.series.length - 1].timeRange.end
|
|
2237
2306
|
);
|
|
@@ -2249,7 +2318,7 @@ class ve {
|
|
|
2249
2318
|
* series + its length. If the collection is empty, returns bounds.construct(0n, 0n).
|
|
2250
2319
|
*/
|
|
2251
2320
|
get alignmentBounds() {
|
|
2252
|
-
return this.series.length === 0 ?
|
|
2321
|
+
return this.series.length === 0 ? C(0n, 0n) : C(
|
|
2253
2322
|
this.series[0].alignmentBounds.lower,
|
|
2254
2323
|
this.series[this.series.length - 1].alignmentBounds.upper
|
|
2255
2324
|
);
|
|
@@ -2257,12 +2326,12 @@ class ve {
|
|
|
2257
2326
|
push(t) {
|
|
2258
2327
|
const e = () => new Error(
|
|
2259
2328
|
`cannot push a ${t.dataType.toString()} series to a ${this.dataType.toString()} multi-series`
|
|
2260
|
-
),
|
|
2261
|
-
if (
|
|
2262
|
-
if (this.series.length !== 0 && !
|
|
2329
|
+
), s = t.dataType.equals(this.dataType);
|
|
2330
|
+
if (Q(t)) {
|
|
2331
|
+
if (this.series.length !== 0 && !s) throw e();
|
|
2263
2332
|
this.series.push(t);
|
|
2264
2333
|
} else {
|
|
2265
|
-
if (this.series.length !== 0 && t.series.length !== 0 && !
|
|
2334
|
+
if (this.series.length !== 0 && t.series.length !== 0 && !s)
|
|
2266
2335
|
throw e();
|
|
2267
2336
|
this.series.push(...t.series);
|
|
2268
2337
|
}
|
|
@@ -2275,16 +2344,16 @@ class ve {
|
|
|
2275
2344
|
return this.series.reduce((t, e) => t + e.length, 0);
|
|
2276
2345
|
}
|
|
2277
2346
|
atAlignment(t, e) {
|
|
2278
|
-
for (const
|
|
2279
|
-
if (
|
|
2280
|
-
return
|
|
2347
|
+
for (const s of this.series)
|
|
2348
|
+
if (R(s.alignmentBounds, t))
|
|
2349
|
+
return s.atAlignment(t, e);
|
|
2281
2350
|
if (e) throw new Error(`[series] - no value at alignment ${t}`);
|
|
2282
2351
|
}
|
|
2283
2352
|
at(t, e = !1) {
|
|
2284
2353
|
t < 0 && (t = this.length + t);
|
|
2285
|
-
for (const
|
|
2286
|
-
if (t <
|
|
2287
|
-
t -=
|
|
2354
|
+
for (const s of this.series) {
|
|
2355
|
+
if (t < s.length) return s.at(t, e);
|
|
2356
|
+
t -= s.length;
|
|
2288
2357
|
}
|
|
2289
2358
|
if (e) throw new Error(`[series] - no value at index ${t}`);
|
|
2290
2359
|
}
|
|
@@ -2295,7 +2364,7 @@ class ve {
|
|
|
2295
2364
|
* @returns An iterator over the specified range.
|
|
2296
2365
|
*/
|
|
2297
2366
|
subIterator(t, e) {
|
|
2298
|
-
return new
|
|
2367
|
+
return new S(this, t, e ?? this.length);
|
|
2299
2368
|
}
|
|
2300
2369
|
/**
|
|
2301
2370
|
* Returns an iterator over a portion of the multi-series based on alignment.
|
|
@@ -2305,28 +2374,28 @@ class ve {
|
|
|
2305
2374
|
*/
|
|
2306
2375
|
subAlignmentIterator(t, e) {
|
|
2307
2376
|
if (t >= this.alignmentBounds.upper || e <= this.alignmentBounds.lower)
|
|
2308
|
-
return
|
|
2309
|
-
let
|
|
2377
|
+
return p;
|
|
2378
|
+
let s = 0;
|
|
2310
2379
|
for (let f = 0; f < this.series.length; f++) {
|
|
2311
|
-
const
|
|
2312
|
-
if (t <
|
|
2313
|
-
if (t >=
|
|
2314
|
-
else if (
|
|
2315
|
-
|
|
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);
|
|
2316
2385
|
break;
|
|
2317
2386
|
}
|
|
2318
2387
|
}
|
|
2319
|
-
let
|
|
2388
|
+
let u = 0;
|
|
2320
2389
|
for (let f = 0; f < this.series.length; f++) {
|
|
2321
|
-
const
|
|
2322
|
-
if (e <
|
|
2323
|
-
if (e >=
|
|
2324
|
-
else if (
|
|
2325
|
-
|
|
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);
|
|
2326
2395
|
break;
|
|
2327
2396
|
}
|
|
2328
2397
|
}
|
|
2329
|
-
return new
|
|
2398
|
+
return new S(this, s, u);
|
|
2330
2399
|
}
|
|
2331
2400
|
/**
|
|
2332
2401
|
* Returns an iterator over the specified alignment range and span.
|
|
@@ -2335,19 +2404,19 @@ class ve {
|
|
|
2335
2404
|
* @returns An iterator over the specified range.
|
|
2336
2405
|
*/
|
|
2337
2406
|
subAlignmentSpanIterator(t, e) {
|
|
2338
|
-
if (t >= this.alignmentBounds.upper) return
|
|
2407
|
+
if (t >= this.alignmentBounds.upper) return p;
|
|
2339
2408
|
e = Math.min(e, Number(this.distance(t, this.alignmentBounds.upper)));
|
|
2340
|
-
let
|
|
2341
|
-
for (let
|
|
2342
|
-
const f = this.series[
|
|
2409
|
+
let s = 0;
|
|
2410
|
+
for (let u = 0; u < this.series.length; u++) {
|
|
2411
|
+
const f = this.series[u];
|
|
2343
2412
|
if (t < f.alignment) break;
|
|
2344
|
-
if (t >= f.alignmentBounds.upper)
|
|
2345
|
-
else if (
|
|
2346
|
-
|
|
2413
|
+
if (t >= f.alignmentBounds.upper) s += f.length;
|
|
2414
|
+
else if (R(f.alignmentBounds, t)) {
|
|
2415
|
+
s += Number(t - f.alignment);
|
|
2347
2416
|
break;
|
|
2348
2417
|
}
|
|
2349
2418
|
}
|
|
2350
|
-
return new
|
|
2419
|
+
return new S(this, s, s + e);
|
|
2351
2420
|
}
|
|
2352
2421
|
/**
|
|
2353
2422
|
* Updates the WebGL buffer for all series in the collection.
|
|
@@ -2360,13 +2429,13 @@ class ve {
|
|
|
2360
2429
|
* Returns the bounds containing the minimum and maximum values across all series.
|
|
2361
2430
|
*/
|
|
2362
2431
|
get bounds() {
|
|
2363
|
-
return
|
|
2432
|
+
return tt(this.series.map((t) => t.bounds));
|
|
2364
2433
|
}
|
|
2365
2434
|
/**
|
|
2366
2435
|
* Returns the sum of the byte lengths of all series.
|
|
2367
2436
|
*/
|
|
2368
2437
|
get byteLength() {
|
|
2369
|
-
return new
|
|
2438
|
+
return new h(this.series.reduce((t, e) => t + e.byteLength.valueOf(), 0));
|
|
2370
2439
|
}
|
|
2371
2440
|
/**
|
|
2372
2441
|
* Returns a combined typed array containing all data from all series.
|
|
@@ -2375,8 +2444,8 @@ class ve {
|
|
|
2375
2444
|
get data() {
|
|
2376
2445
|
const t = new this.dataType.Array(this.length);
|
|
2377
2446
|
let e = 0;
|
|
2378
|
-
for (const
|
|
2379
|
-
t.set(
|
|
2447
|
+
for (const s of this.series)
|
|
2448
|
+
t.set(s.data, e), e += s.length;
|
|
2380
2449
|
return new this.dataType.Array(t.buffer);
|
|
2381
2450
|
}
|
|
2382
2451
|
/**
|
|
@@ -2386,8 +2455,8 @@ class ve {
|
|
|
2386
2455
|
* @returns The resulting alignment after traversal.
|
|
2387
2456
|
*/
|
|
2388
2457
|
traverseAlignment(t, e) {
|
|
2389
|
-
const
|
|
2390
|
-
return
|
|
2458
|
+
const s = this.series.map((u) => u.alignmentBounds);
|
|
2459
|
+
return et(s, t, e);
|
|
2391
2460
|
}
|
|
2392
2461
|
/**
|
|
2393
2462
|
* Acquires a reference to the WebGL buffer for all series.
|
|
@@ -2409,8 +2478,8 @@ class ve {
|
|
|
2409
2478
|
* @returns The distance between the alignments.
|
|
2410
2479
|
*/
|
|
2411
2480
|
distance(t, e) {
|
|
2412
|
-
const
|
|
2413
|
-
return
|
|
2481
|
+
const s = this.series.map((u) => u.alignmentBounds);
|
|
2482
|
+
return st(s, t, e);
|
|
2414
2483
|
}
|
|
2415
2484
|
/**
|
|
2416
2485
|
* Parses a JSON multi-series into an array of values using the provided zod schema.
|
|
@@ -2420,7 +2489,7 @@ class ve {
|
|
|
2420
2489
|
* @returns An array of values parsed from the JSON series.
|
|
2421
2490
|
*/
|
|
2422
2491
|
parseJSON(t) {
|
|
2423
|
-
if (!this.dataType.equals(
|
|
2492
|
+
if (!this.dataType.equals(r.JSON))
|
|
2424
2493
|
throw new Error("cannot parse non-JSON series as JSON");
|
|
2425
2494
|
return this.series.flatMap((e) => e.parseJSON(t));
|
|
2426
2495
|
}
|
|
@@ -2433,14 +2502,22 @@ class ve {
|
|
|
2433
2502
|
next() {
|
|
2434
2503
|
return { done: !0, value: void 0 };
|
|
2435
2504
|
}
|
|
2436
|
-
} : new
|
|
2505
|
+
} : new Et(this.series);
|
|
2506
|
+
}
|
|
2507
|
+
/**
|
|
2508
|
+
* Returns an array of the values in the multi-series as strings.
|
|
2509
|
+
* For variable length data types (like STRING or JSON), this decodes the underlying buffer.
|
|
2510
|
+
* @returns An array of string representations of the multi-series values.
|
|
2511
|
+
*/
|
|
2512
|
+
toStrings() {
|
|
2513
|
+
return this.series.flatMap((t) => t.toStrings());
|
|
2437
2514
|
}
|
|
2438
2515
|
}
|
|
2439
|
-
class
|
|
2516
|
+
class Et {
|
|
2517
|
+
series;
|
|
2518
|
+
seriesIndex;
|
|
2519
|
+
internal;
|
|
2440
2520
|
constructor(t) {
|
|
2441
|
-
i(this, "series");
|
|
2442
|
-
i(this, "seriesIndex");
|
|
2443
|
-
i(this, "internal");
|
|
2444
2521
|
this.series = t, this.seriesIndex = 0, this.internal = t[0][Symbol.iterator]();
|
|
2445
2522
|
}
|
|
2446
2523
|
next() {
|
|
@@ -2451,12 +2528,12 @@ class ie {
|
|
|
2451
2528
|
return this;
|
|
2452
2529
|
}
|
|
2453
2530
|
}
|
|
2454
|
-
class
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
this.series = t, this.end =
|
|
2531
|
+
class S {
|
|
2532
|
+
series;
|
|
2533
|
+
index;
|
|
2534
|
+
end;
|
|
2535
|
+
constructor(t, e, s) {
|
|
2536
|
+
this.series = t, this.end = s, this.index = e;
|
|
2460
2537
|
}
|
|
2461
2538
|
next() {
|
|
2462
2539
|
return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
|
|
@@ -2465,28 +2542,27 @@ class j {
|
|
|
2465
2542
|
return this;
|
|
2466
2543
|
}
|
|
2467
2544
|
}
|
|
2468
|
-
const
|
|
2469
|
-
const t =
|
|
2545
|
+
const k = (i) => {
|
|
2546
|
+
const t = i >> 32n, e = i & 0xffffffffn;
|
|
2470
2547
|
return { domain: t, sample: e };
|
|
2471
2548
|
};
|
|
2472
2549
|
export {
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
pe as u
|
|
2550
|
+
d as D,
|
|
2551
|
+
Vt as M,
|
|
2552
|
+
E as R,
|
|
2553
|
+
I as S,
|
|
2554
|
+
n as T,
|
|
2555
|
+
a,
|
|
2556
|
+
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
|
|
2492
2568
|
};
|