@synnaxlabs/x 0.44.0 → 0.44.1
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 +16 -16
- package/dist/box-CO_2_DGG.js +209 -0
- package/dist/box-Cxki783Y.cjs +1 -0
- package/dist/box.cjs +1 -1
- package/dist/box.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +6 -6
- package/dist/{position-DAL0Qqdf.cjs → position-DSy2hONH.cjs} +1 -1
- package/dist/{position-bA6pUwLn.js → position-PQ6op54I.js} +1 -1
- package/dist/position.cjs +1 -1
- package/dist/position.js +1 -1
- package/dist/{scale-Bzn1Cl0r.cjs → scale-C6qKDbRb.cjs} +1 -1
- package/dist/{scale-CdTNWu-d.js → scale-EWNUk-bn.js} +2 -2
- package/dist/scale.cjs +1 -1
- package/dist/scale.js +1 -1
- package/dist/{series-BeJyqCoP.js → series-Bn5y1tD1.js} +3 -3
- package/dist/{series-anlpaR_I.cjs → series-CYAhDD6B.cjs} +1 -1
- package/dist/spatial.cjs +1 -1
- package/dist/spatial.js +4 -4
- package/dist/src/spatial/box/box.d.ts +1 -0
- package/dist/src/spatial/box/box.d.ts.map +1 -1
- package/dist/src/spatial/xy/xy.d.ts +1 -0
- package/dist/src/spatial/xy/xy.d.ts.map +1 -1
- package/dist/telem.cjs +1 -1
- package/dist/telem.js +1 -1
- package/dist/xy-CUE3QDNn.cjs +1 -0
- package/dist/{xy-D_LqxaGt.js → xy-C_-hb3Q2.js} +27 -22
- package/dist/xy.cjs +1 -1
- package/dist/xy.js +1 -1
- package/package.json +1 -1
- package/src/spatial/box/box.ts +5 -0
- package/src/spatial/xy/xy.ts +5 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/box-BcGdqkt4.cjs +0 -1
- package/dist/box-D_qdUyEe.js +0 -205
- package/dist/xy-B7065J2S.cjs +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @synnaxlabs/x@0.44.
|
|
2
|
+
> @synnaxlabs/x@0.44.1 build /home/runner/work/synnax/synnax/x/ts
|
|
3
3
|
> tsc --noEmit && vite build
|
|
4
4
|
|
|
5
5
|
[34m Synnax - Production mode[0m
|
|
@@ -38,7 +38,7 @@ computing gzip size...
|
|
|
38
38
|
[2mdist/[22m[36mlink.js [39m[1m[2m 0.44 kB[22m[1m[22m[2m │ gzip: 0.34 kB[22m
|
|
39
39
|
[2mdist/[22m[36mindex-D4NCYiQB.js [39m[1m[2m 0.45 kB[22m[1m[22m[2m │ gzip: 0.30 kB[22m
|
|
40
40
|
[2mdist/[22m[36mrecord-CAcQ5PNX.js [39m[1m[2m 0.51 kB[22m[1m[22m[2m │ gzip: 0.32 kB[22m
|
|
41
|
-
[2mdist/[22m[36mspatial.js [39m[1m[2m 0.58 kB[22m[1m[22m[2m │ gzip: 0.
|
|
41
|
+
[2mdist/[22m[36mspatial.js [39m[1m[2m 0.58 kB[22m[1m[22m[2m │ gzip: 0.29 kB[22m
|
|
42
42
|
[2mdist/[22m[36mdirection-8etxfKaR.js [39m[1m[2m 0.67 kB[22m[1m[22m[2m │ gzip: 0.38 kB[22m
|
|
43
43
|
[2mdist/[22m[36mexternal-BYuXBYJh.js [39m[1m[2m 0.79 kB[22m[1m[22m[2m │ gzip: 0.34 kB[22m
|
|
44
44
|
[2mdist/[22m[36mexternal-BFgJjMcS.js [39m[1m[2m 0.86 kB[22m[1m[22m[2m │ gzip: 0.52 kB[22m
|
|
@@ -49,24 +49,24 @@ computing gzip size...
|
|
|
49
49
|
[2mdist/[22m[36mdimensions-CRgergMS.js [39m[1m[2m 1.49 kB[22m[1m[22m[2m │ gzip: 0.66 kB[22m
|
|
50
50
|
[2mdist/[22m[36murl.js [39m[1m[2m 1.70 kB[22m[1m[22m[2m │ gzip: 0.76 kB[22m
|
|
51
51
|
[2mdist/[22m[36mindex-D2xcvEO5.js [39m[1m[2m 1.86 kB[22m[1m[22m[2m │ gzip: 0.89 kB[22m
|
|
52
|
-
[2mdist/[22m[36mposition-
|
|
52
|
+
[2mdist/[22m[36mposition-PQ6op54I.js [39m[1m[2m 2.23 kB[22m[1m[22m[2m │ gzip: 1.06 kB[22m
|
|
53
53
|
[2mdist/[22m[36mpath-BXdMenka.js [39m[1m[2m 2.44 kB[22m[1m[22m[2m │ gzip: 0.89 kB[22m
|
|
54
54
|
[2mdist/[22m[36mindex-B5l_quQn.js [39m[1m[2m 2.56 kB[22m[1m[22m[2m │ gzip: 1.00 kB[22m
|
|
55
55
|
[2mdist/[22m[36mlocation-Ar5y2DX2.js [39m[1m[2m 2.86 kB[22m[1m[22m[2m │ gzip: 1.18 kB[22m
|
|
56
56
|
[2mdist/[22m[36mindex-PNh31WTW.js [39m[1m[2m 3.58 kB[22m[1m[22m[2m │ gzip: 1.36 kB[22m
|
|
57
57
|
[2mdist/[22m[36mdeep.js [39m[1m[2m 3.71 kB[22m[1m[22m[2m │ gzip: 1.42 kB[22m
|
|
58
|
-
[2mdist/[22m[36mxy-
|
|
58
|
+
[2mdist/[22m[36mxy-C_-hb3Q2.js [39m[1m[2m 3.94 kB[22m[1m[22m[2m │ gzip: 1.47 kB[22m
|
|
59
59
|
[2mdist/[22m[36mbounds-Dj9nG39I.js [39m[1m[2m 6.04 kB[22m[1m[22m[2m │ gzip: 2.00 kB[22m
|
|
60
|
-
[2mdist/[22m[36mbox-
|
|
61
|
-
[2mdist/[22m[36mscale-
|
|
60
|
+
[2mdist/[22m[36mbox-CO_2_DGG.js [39m[1m[2m 6.44 kB[22m[1m[22m[2m │ gzip: 2.26 kB[22m
|
|
61
|
+
[2mdist/[22m[36mscale-EWNUk-bn.js [39m[1m[2m 6.49 kB[22m[1m[22m[2m │ gzip: 1.89 kB[22m
|
|
62
62
|
[2mdist/[22m[36mindex.js [39m[1m[2m26.85 kB[22m[1m[22m[2m │ gzip: 8.64 kB[22m
|
|
63
|
-
[2mdist/[22m[36mseries-
|
|
64
|
-
[vite:dts] Declaration files built in
|
|
63
|
+
[2mdist/[22m[36mseries-Bn5y1tD1.js [39m[1m[2m87.74 kB[22m[1m[22m[2m │ gzip: 18.83 kB[22m
|
|
64
|
+
[vite:dts] Declaration files built in 4715ms.
|
|
65
65
|
|
|
66
66
|
[33mGenerated an empty chunk: "destructor".[39m
|
|
67
67
|
[2mdist/[22m[36mdestructor.cjs [39m[1m[2m 0.01 kB[22m[1m[22m[2m │ gzip: 0.03 kB[22m
|
|
68
|
-
[2mdist/[22m[36mxy.cjs [39m[1m[2m 0.13 kB[22m[1m[22m[2m │ gzip: 0.
|
|
69
|
-
[2mdist/[22m[36mbox.cjs [39m[1m[2m 0.14 kB[22m[1m[22m[2m │ gzip: 0.
|
|
68
|
+
[2mdist/[22m[36mxy.cjs [39m[1m[2m 0.13 kB[22m[1m[22m[2m │ gzip: 0.14 kB[22m
|
|
69
|
+
[2mdist/[22m[36mbox.cjs [39m[1m[2m 0.14 kB[22m[1m[22m[2m │ gzip: 0.15 kB[22m
|
|
70
70
|
[2mdist/[22m[36mscale.cjs [39m[1m[2m 0.14 kB[22m[1m[22m[2m │ gzip: 0.15 kB[22m
|
|
71
71
|
[2mdist/[22m[36mbinary.cjs [39m[1m[2m 0.14 kB[22m[1m[22m[2m │ gzip: 0.15 kB[22m
|
|
72
72
|
[2mdist/[22m[36munique.cjs [39m[1m[2m 0.15 kB[22m[1m[22m[2m │ gzip: 0.15 kB[22m
|
|
@@ -102,16 +102,16 @@ computing gzip size...
|
|
|
102
102
|
[2mdist/[22m[36mdimensions-D2QGoNXO.cjs [39m[1m[2m 1.17 kB[22m[1m[22m[2m │ gzip: 0.58 kB[22m
|
|
103
103
|
[2mdist/[22m[36mindex-DdhM_E4k.cjs [39m[1m[2m 1.35 kB[22m[1m[22m[2m │ gzip: 0.72 kB[22m
|
|
104
104
|
[2mdist/[22m[36mbase-BAM2mqCy.cjs [39m[1m[2m 1.40 kB[22m[1m[22m[2m │ gzip: 0.58 kB[22m
|
|
105
|
-
[2mdist/[22m[36mposition-
|
|
105
|
+
[2mdist/[22m[36mposition-DSy2hONH.cjs [39m[1m[2m 1.70 kB[22m[1m[22m[2m │ gzip: 0.94 kB[22m
|
|
106
106
|
[2mdist/[22m[36mpath-st_E5-LJ.cjs [39m[1m[2m 1.78 kB[22m[1m[22m[2m │ gzip: 0.79 kB[22m
|
|
107
107
|
[2mdist/[22m[36mindex-BQe8OIgm.cjs [39m[1m[2m 1.98 kB[22m[1m[22m[2m │ gzip: 0.90 kB[22m
|
|
108
108
|
[2mdist/[22m[36mlocation-DZi8ftXp.cjs [39m[1m[2m 2.49 kB[22m[1m[22m[2m │ gzip: 1.06 kB[22m
|
|
109
109
|
[2mdist/[22m[36mindex-B1m2qvBT.cjs [39m[1m[2m 2.52 kB[22m[1m[22m[2m │ gzip: 1.10 kB[22m
|
|
110
110
|
[2mdist/[22m[36mdeep.cjs [39m[1m[2m 2.62 kB[22m[1m[22m[2m │ gzip: 1.19 kB[22m
|
|
111
|
-
[2mdist/[22m[36mxy-
|
|
112
|
-
[2mdist/[22m[36mscale-
|
|
111
|
+
[2mdist/[22m[36mxy-CUE3QDNn.cjs [39m[1m[2m 2.88 kB[22m[1m[22m[2m │ gzip: 1.31 kB[22m
|
|
112
|
+
[2mdist/[22m[36mscale-C6qKDbRb.cjs [39m[1m[2m 4.11 kB[22m[1m[22m[2m │ gzip: 1.47 kB[22m
|
|
113
113
|
[2mdist/[22m[36mbounds-D6e9xoHt.cjs [39m[1m[2m 4.56 kB[22m[1m[22m[2m │ gzip: 1.77 kB[22m
|
|
114
|
-
[2mdist/[22m[36mbox-
|
|
114
|
+
[2mdist/[22m[36mbox-Cxki783Y.cjs [39m[1m[2m 4.99 kB[22m[1m[22m[2m │ gzip: 2.02 kB[22m
|
|
115
115
|
[2mdist/[22m[36mindex.cjs [39m[1m[2m20.35 kB[22m[1m[22m[2m │ gzip: 7.58 kB[22m
|
|
116
|
-
[2mdist/[22m[36mseries-
|
|
117
|
-
[32m✓ built in
|
|
116
|
+
[2mdist/[22m[36mseries-CYAhDD6B.cjs [39m[1m[2m37.82 kB[22m[1m[22m[2m │ gzip: 10.09 kB[22m
|
|
117
|
+
[32m✓ built in 5.51s[39m
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { z as x } from "zod";
|
|
2
|
+
import { c as O } from "./direction-8etxfKaR.js";
|
|
3
|
+
import { c as A, T as M, B as N, b as S, d as Z, e as q, f as F, g as G, h as D, i as X, j as Y } from "./location-Ar5y2DX2.js";
|
|
4
|
+
import { Z as g, O as U, e as I, t as T, c as k, a as L, r as $ } from "./xy-C_-hb3Q2.js";
|
|
5
|
+
import { x as j, X as H, Y as J } from "./base-DFq0vvGn.js";
|
|
6
|
+
const h = x.union([x.number(), x.string()]), K = x.object({
|
|
7
|
+
top: h,
|
|
8
|
+
left: h,
|
|
9
|
+
width: h,
|
|
10
|
+
height: h
|
|
11
|
+
}), Q = x.object({
|
|
12
|
+
left: x.number(),
|
|
13
|
+
top: x.number(),
|
|
14
|
+
right: x.number(),
|
|
15
|
+
bottom: x.number()
|
|
16
|
+
}), V = x.object({
|
|
17
|
+
one: j,
|
|
18
|
+
two: j,
|
|
19
|
+
root: A
|
|
20
|
+
}), P = { one: g, two: g, root: M }, oo = { one: g, two: U, root: N }, v = (o, t) => ({
|
|
21
|
+
one: o.one,
|
|
22
|
+
two: o.two,
|
|
23
|
+
root: t ?? o.root
|
|
24
|
+
}), c = (o, t, e = 0, n = 0, r) => {
|
|
25
|
+
const s = {
|
|
26
|
+
one: { ...g },
|
|
27
|
+
two: { ...g },
|
|
28
|
+
root: r ?? M
|
|
29
|
+
};
|
|
30
|
+
if (typeof o == "number") {
|
|
31
|
+
if (typeof t != "number")
|
|
32
|
+
throw new Error("Box constructor called with invalid arguments");
|
|
33
|
+
return s.one = { x: o, y: t }, s.two = { x: s.one.x + e, y: s.one.y + n }, s;
|
|
34
|
+
}
|
|
35
|
+
return "one" in o && "two" in o && "root" in o ? { ...o, root: r ?? o.root } : ("getBoundingClientRect" in o && (o = o.getBoundingClientRect()), "left" in o ? (s.one = { x: o.left, y: o.top }, s.two = { x: o.right, y: o.bottom }, s) : (s.one = o, t == null ? s.two = { x: s.one.x + e, y: s.one.y + n } : typeof t == "number" ? s.two = { x: s.one.x + t, y: s.one.y + e } : "width" in t ? s.two = {
|
|
36
|
+
x: s.one.x + t.width,
|
|
37
|
+
y: s.one.y + t.height
|
|
38
|
+
} : "signedWidth" in t ? s.two = {
|
|
39
|
+
x: s.one.x + t.signedWidth,
|
|
40
|
+
y: s.one.y + t.signedHeight
|
|
41
|
+
} : s.two = t, s));
|
|
42
|
+
}, to = (o, t, e) => {
|
|
43
|
+
const n = c(o);
|
|
44
|
+
if (typeof t == "string") {
|
|
45
|
+
if (e == null) throw new Error("Invalid arguments for resize");
|
|
46
|
+
const r = O(t);
|
|
47
|
+
return c(
|
|
48
|
+
n.one,
|
|
49
|
+
void 0,
|
|
50
|
+
r === "x" ? e : w(n),
|
|
51
|
+
r === "y" ? e : d(n),
|
|
52
|
+
n.root
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return c(n.one, t, void 0, void 0, n.root);
|
|
56
|
+
}, no = (o, t, e = !0) => {
|
|
57
|
+
const n = c(o);
|
|
58
|
+
let r = (s, i) => s < i;
|
|
59
|
+
return e && (r = (s, i) => s <= i), "one" in t ? r(a(n), a(t)) && r(f(t), f(n)) && r(u(n), u(t)) && r(l(t), l(n)) : r(a(n), t.x) && r(t.x, f(n)) && r(u(n), t.y) && r(t.y, l(n));
|
|
60
|
+
}, eo = (o, t) => I(o.one, t.one) && I(o.two, t.two) && S(o.root, t.root), W = (o) => ({
|
|
61
|
+
width: w(o),
|
|
62
|
+
height: d(o)
|
|
63
|
+
}), so = (o) => ({
|
|
64
|
+
signedWidth: _(o),
|
|
65
|
+
signedHeight: b(o)
|
|
66
|
+
}), ro = (o) => ({
|
|
67
|
+
top: u(o),
|
|
68
|
+
left: a(o),
|
|
69
|
+
width: w(o),
|
|
70
|
+
height: d(o)
|
|
71
|
+
}), C = (o, t, e = !1) => {
|
|
72
|
+
const n = O(t) === "y" ? b(o) : _(o);
|
|
73
|
+
return e ? n : Math.abs(n);
|
|
74
|
+
}, y = (o, t) => {
|
|
75
|
+
const e = c(o);
|
|
76
|
+
return {
|
|
77
|
+
x: t.x === "center" ? E(e).x : m(e, t.x),
|
|
78
|
+
y: t.y === "center" ? E(e).y : m(e, t.y)
|
|
79
|
+
};
|
|
80
|
+
}, m = (o, t) => {
|
|
81
|
+
const e = c(o), n = Z(e.root).includes(t) ? Math.min : Math.max;
|
|
82
|
+
return H.includes(t) ? n(e.one.x, e.two.x) : n(e.one.y, e.two.y);
|
|
83
|
+
}, co = (o) => o.one.x === o.two.x && o.one.y === o.two.y, w = (o) => C(o, "x"), d = (o) => C(o, "y"), _ = (o) => {
|
|
84
|
+
const t = c(o);
|
|
85
|
+
return t.two.x - t.one.x;
|
|
86
|
+
}, b = (o) => {
|
|
87
|
+
const t = c(o);
|
|
88
|
+
return t.two.y - t.one.y;
|
|
89
|
+
}, z = (o) => y(o, M), io = (o) => y(o, q), xo = (o) => y(o, F), yo = (o) => y(o, N), ao = (o) => y(o, G), uo = (o) => y(o, D), wo = (o) => y(o, X), fo = (o) => y(o, Y), f = (o) => m(o, "right"), l = (o) => m(o, "bottom"), a = (o) => m(o, "left"), u = (o) => m(o, "top"), E = (o) => T(z(o), {
|
|
90
|
+
x: _(o) / 2,
|
|
91
|
+
y: b(o) / 2
|
|
92
|
+
}), B = (o) => {
|
|
93
|
+
const t = c(o);
|
|
94
|
+
return t.root.x === "left" ? a(t) : f(t);
|
|
95
|
+
}, R = (o) => {
|
|
96
|
+
const t = c(o);
|
|
97
|
+
return t.root.y === "top" ? u(t) : l(t);
|
|
98
|
+
}, lo = (o) => ({ x: B(o), y: R(o) }), mo = (o) => {
|
|
99
|
+
const t = c(o);
|
|
100
|
+
return { lower: t.one.x, upper: t.two.x };
|
|
101
|
+
}, po = (o) => {
|
|
102
|
+
const t = c(o);
|
|
103
|
+
return { lower: t.one.y, upper: t.two.y };
|
|
104
|
+
}, go = (o, t) => v(o, t), ho = (o, t) => {
|
|
105
|
+
const e = c(o), n = H.includes(t) ? "x" : J.includes(t) ? "y" : null;
|
|
106
|
+
if (n === null) throw new Error(`Invalid location: ${t}`);
|
|
107
|
+
const r = t === "top" || t === "left" ? Math.min : Math.max, s = { ...e.one }, i = { ...e.two };
|
|
108
|
+
return s[n] = r(e.one[n], e.two[n]), i[n] = r(e.one[n], e.two[n]), [s, i];
|
|
109
|
+
}, _o = (o, t) => {
|
|
110
|
+
const e = c(o), n = c(t), r = B(n) + (w(n) - w(e)) / 2, s = R(n) + (d(n) - d(e)) / 2;
|
|
111
|
+
return c({ x: r, y: s }, W(e));
|
|
112
|
+
}, bo = (o) => typeof o != "object" || o == null ? !1 : "one" in o && "two" in o && "root" in o, To = (o) => w(o) / d(o), Eo = (o, t, e) => {
|
|
113
|
+
if (typeof t == "string") {
|
|
114
|
+
if (e == null) throw new Error("Undefined amount passed into box.translate");
|
|
115
|
+
const r = O(t);
|
|
116
|
+
t = k(r, e);
|
|
117
|
+
}
|
|
118
|
+
const n = c(o);
|
|
119
|
+
return c(
|
|
120
|
+
T(n.one, t),
|
|
121
|
+
T(n.two, t),
|
|
122
|
+
void 0,
|
|
123
|
+
void 0,
|
|
124
|
+
n.root
|
|
125
|
+
);
|
|
126
|
+
}, Oo = (o, t) => {
|
|
127
|
+
const e = Math.max(a(o), a(t)), n = Math.max(u(o), u(t)), r = Math.min(f(o), f(t)), s = Math.min(l(o), l(t));
|
|
128
|
+
return e > r || n > s ? P : c({ x: e, y: n }, { x: r, y: s }, void 0, void 0, o.root);
|
|
129
|
+
}, Mo = (o) => w(o) * d(o), Co = (o, t) => {
|
|
130
|
+
const e = c(o);
|
|
131
|
+
return c(
|
|
132
|
+
L(e.one, t),
|
|
133
|
+
L(e.two, t),
|
|
134
|
+
void 0,
|
|
135
|
+
void 0,
|
|
136
|
+
e.root
|
|
137
|
+
);
|
|
138
|
+
}, Bo = (o, t, e, n, r, s) => {
|
|
139
|
+
const i = { x: o, y: t }, p = { x: o + e, y: t + n };
|
|
140
|
+
return r.x !== s.x && (r.x === "center" ? (i.x -= e / 2, p.x -= e / 2) : (i.x -= e, p.x -= e)), r.y !== s.y && (r.y === "center" ? (i.y -= n / 2, p.y -= n / 2) : (i.y -= n, p.y -= n)), c(i, p, void 0, void 0, s);
|
|
141
|
+
}, Ro = (o) => {
|
|
142
|
+
const t = c(o);
|
|
143
|
+
return c($(t.one), $(t.two), void 0, void 0, t.root);
|
|
144
|
+
}, Ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
145
|
+
__proto__: null,
|
|
146
|
+
DECIMAL: oo,
|
|
147
|
+
ZERO: P,
|
|
148
|
+
area: Mo,
|
|
149
|
+
areaIsZero: co,
|
|
150
|
+
aspect: To,
|
|
151
|
+
bottom: l,
|
|
152
|
+
bottomCenter: ao,
|
|
153
|
+
bottomLeft: yo,
|
|
154
|
+
bottomRight: uo,
|
|
155
|
+
box: V,
|
|
156
|
+
center: E,
|
|
157
|
+
centerLeft: wo,
|
|
158
|
+
centerRight: fo,
|
|
159
|
+
construct: c,
|
|
160
|
+
constructWithAlternateRoot: Bo,
|
|
161
|
+
contains: no,
|
|
162
|
+
copy: v,
|
|
163
|
+
css: ro,
|
|
164
|
+
cssBox: K,
|
|
165
|
+
dim: C,
|
|
166
|
+
dims: W,
|
|
167
|
+
domRect: Q,
|
|
168
|
+
edgePoints: ho,
|
|
169
|
+
equals: eo,
|
|
170
|
+
height: d,
|
|
171
|
+
intersection: Oo,
|
|
172
|
+
isBox: bo,
|
|
173
|
+
left: a,
|
|
174
|
+
loc: m,
|
|
175
|
+
positionInCenter: _o,
|
|
176
|
+
reRoot: go,
|
|
177
|
+
resize: to,
|
|
178
|
+
right: f,
|
|
179
|
+
root: lo,
|
|
180
|
+
round: Ro,
|
|
181
|
+
signedDims: so,
|
|
182
|
+
signedHeight: b,
|
|
183
|
+
signedWidth: _,
|
|
184
|
+
top: u,
|
|
185
|
+
topCenter: io,
|
|
186
|
+
topLeft: z,
|
|
187
|
+
topRight: xo,
|
|
188
|
+
translate: Eo,
|
|
189
|
+
truncate: Co,
|
|
190
|
+
width: w,
|
|
191
|
+
x: B,
|
|
192
|
+
xBounds: mo,
|
|
193
|
+
xyLoc: y,
|
|
194
|
+
y: R,
|
|
195
|
+
yBounds: po
|
|
196
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
197
|
+
export {
|
|
198
|
+
Bo as a,
|
|
199
|
+
Ho as b,
|
|
200
|
+
c,
|
|
201
|
+
Mo as d,
|
|
202
|
+
bo as e,
|
|
203
|
+
mo as f,
|
|
204
|
+
d as h,
|
|
205
|
+
Oo as i,
|
|
206
|
+
w,
|
|
207
|
+
y as x,
|
|
208
|
+
po as y
|
|
209
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const y=require("zod"),R=require("./direction-386XDm2w.cjs"),u=require("./location-DZi8ftXp.cjs"),i=require("./xy-CUE3QDNn.cjs"),m=require("./base-BAM2mqCy.cjs"),p=y.z.union([y.z.number(),y.z.string()]),H=y.z.object({top:p,left:p,width:p,height:p}),W=y.z.object({left:y.z.number(),top:y.z.number(),right:y.z.number(),bottom:y.z.number()}),v=y.z.object({one:m.xy,two:m.xy,root:u.corner}),B={one:i.ZERO,two:i.ZERO,root:u.TOP_LEFT},S={one:i.ZERO,two:i.ONE,root:u.BOTTOM_LEFT},C=(t,o)=>({one:t.one,two:t.two,root:o??t.root}),c=(t,o,e=0,n=0,s)=>{const r={one:{...i.ZERO},two:{...i.ZERO},root:s??u.TOP_LEFT};if(typeof t=="number"){if(typeof o!="number")throw new Error("Box constructor called with invalid arguments");return r.one={x:t,y:o},r.two={x:r.one.x+e,y:r.one.y+n},r}return"one"in t&&"two"in t&&"root"in t?{...t,root:s??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(r.one={x:t.left,y:t.top},r.two={x:t.right,y:t.bottom},r):(r.one=t,o==null?r.two={x:r.one.x+e,y:r.one.y+n}:typeof o=="number"?r.two={x:r.one.x+o,y:r.one.y+e}:"width"in o?r.two={x:r.one.x+o.width,y:r.one.y+o.height}:"signedWidth"in o?r.two={x:r.one.x+o.signedWidth,y:r.one.y+o.signedHeight}:r.two=o,r))},G=(t,o,e)=>{const n=c(t);if(typeof o=="string"){if(e==null)throw new Error("Invalid arguments for resize");const s=R.construct(o);return c(n.one,void 0,s==="x"?e:l(n),s==="y"?e:w(n),n.root)}return c(n.one,o,void 0,void 0,n.root)},D=(t,o,e=!0)=>{const n=c(t);let s=(r,x)=>r<x;return e&&(s=(r,x)=>r<=x),"one"in o?s(a(n),a(o))&&s(_(o),_(n))&&s(f(n),f(o))&&s(h(o),h(n)):s(a(n),o.x)&&s(o.x,_(n))&&s(f(n),o.y)&&s(o.y,h(n))},X=(t,o)=>i.equals(t.one,o.one)&&i.equals(t.two,o.two)&&u.xyEquals(t.root,o.root),I=t=>({width:l(t),height:w(t)}),$=t=>({signedWidth:O(t),signedHeight:E(t)}),U=t=>({top:f(t),left:a(t),width:l(t),height:w(t)}),L=(t,o,e=!1)=>{const n=R.construct(o)==="y"?E(t):O(t);return e?n:Math.abs(n)},d=(t,o)=>{const e=c(t);return{x:o.x==="center"?b(e).x:g(e,o.x),y:o.y==="center"?b(e).y:g(e,o.y)}},g=(t,o)=>{const e=c(t),n=u.xyCouple(e.root).includes(o)?Math.min:Math.max;return m.X_LOCATIONS.includes(o)?n(e.one.x,e.two.x):n(e.one.y,e.two.y)},Y=t=>t.one.x===t.two.x&&t.one.y===t.two.y,l=t=>L(t,"x"),w=t=>L(t,"y"),O=t=>{const o=c(t);return o.two.x-o.one.x},E=t=>{const o=c(t);return o.two.y-o.one.y},q=t=>d(t,u.TOP_LEFT),k=t=>d(t,u.TOP_CENTER),J=t=>d(t,u.TOP_RIGHT),K=t=>d(t,u.BOTTOM_LEFT),Q=t=>d(t,u.BOTTOM_CENTER),V=t=>d(t,u.BOTTOM_RIGHT),tt=t=>d(t,u.CENTER_LEFT),ot=t=>d(t,u.CENTER_RIGHT),_=t=>g(t,"right"),h=t=>g(t,"bottom"),a=t=>g(t,"left"),f=t=>g(t,"top"),b=t=>i.translate(q(t),{x:O(t)/2,y:E(t)/2}),M=t=>{const o=c(t);return o.root.x==="left"?a(o):_(o)},z=t=>{const o=c(t);return o.root.y==="top"?f(o):h(o)},nt=t=>({x:M(t),y:z(t)}),N=t=>{const o=c(t);return{lower:o.one.x,upper:o.two.x}},P=t=>{const o=c(t);return{lower:o.one.y,upper:o.two.y}},et=(t,o)=>C(t,o),rt=(t,o)=>{const e=c(t),n=m.X_LOCATIONS.includes(o)?"x":m.Y_LOCATIONS.includes(o)?"y":null;if(n===null)throw new Error(`Invalid location: ${o}`);const s=o==="top"||o==="left"?Math.min:Math.max,r={...e.one},x={...e.two};return r[n]=s(e.one[n],e.two[n]),x[n]=s(e.one[n],e.two[n]),[r,x]},st=(t,o)=>{const e=c(t),n=c(o),s=M(n)+(l(n)-l(e))/2,r=z(n)+(w(n)-w(e))/2;return c({x:s,y:r},I(e))},Z=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,ct=t=>l(t)/w(t),it=(t,o,e)=>{if(typeof o=="string"){if(e==null)throw new Error("Undefined amount passed into box.translate");const s=R.construct(o);o=i.construct(s,e)}const n=c(t);return c(i.translate(n.one,o),i.translate(n.two,o),void 0,void 0,n.root)},j=(t,o)=>{const e=Math.max(a(t),a(o)),n=Math.max(f(t),f(o)),s=Math.min(_(t),_(o)),r=Math.min(h(t),h(o));return e>s||n>r?B:c({x:e,y:n},{x:s,y:r},void 0,void 0,t.root)},A=t=>l(t)*w(t),ut=(t,o)=>{const e=c(t);return c(i.truncate(e.one,o),i.truncate(e.two,o),void 0,void 0,e.root)},F=(t,o,e,n,s,r)=>{const x={x:t,y:o},T={x:t+e,y:o+n};return s.x!==r.x&&(s.x==="center"?(x.x-=e/2,T.x-=e/2):(x.x-=e,T.x-=e)),s.y!==r.y&&(s.y==="center"?(x.y-=n/2,T.y-=n/2):(x.y-=n,T.y-=n)),c(x,T,void 0,void 0,r)},xt=t=>{const o=c(t);return c(i.round(o.one),i.round(o.two),void 0,void 0,o.root)},yt=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:S,ZERO:B,area:A,areaIsZero:Y,aspect:ct,bottom:h,bottomCenter:Q,bottomLeft:K,bottomRight:V,box:v,center:b,centerLeft:tt,centerRight:ot,construct:c,constructWithAlternateRoot:F,contains:D,copy:C,css:U,cssBox:H,dim:L,dims:I,domRect:W,edgePoints:rt,equals:X,height:w,intersection:j,isBox:Z,left:a,loc:g,positionInCenter:st,reRoot:et,resize:G,right:_,root:nt,round:xt,signedDims:$,signedHeight:E,signedWidth:O,top:f,topCenter:k,topLeft:q,topRight:J,translate:it,truncate:ut,width:l,x:M,xBounds:N,xyLoc:d,y:z,yBounds:P},Symbol.toStringTag,{value:"Module"}));exports.area=A;exports.box=yt;exports.construct=c;exports.constructWithAlternateRoot=F;exports.height=w;exports.intersection=j;exports.isBox=Z;exports.width=l;exports.xBounds=N;exports.xyLoc=d;exports.yBounds=P;
|
package/dist/box.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./box-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./box-Cxki783Y.cjs");exports.box=e.box;
|
package/dist/box.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _e=require("./array.cjs"),U=require("./index-BQe8OIgm.cjs"),o=require("zod"),h=require("./series-anlpaR_I.cjs"),Se=require("./index-DdhM_E4k.cjs"),ve=require("./change-C-YELKx6.cjs"),H=require("./scale-Bzn1Cl0r.cjs"),g=require("./index-B1m2qvBT.cjs"),B=require("./debounce.cjs"),we=require("./deep.cjs"),Te=require("./identity.cjs"),Me=require("./external-B9AAGv50.cjs"),je=require("./link.cjs"),m=require("./bounds-D6e9xoHt.cjs"),ze=require("./observe.cjs"),Ee=require("./record-YvCh7bzB.cjs"),$e=require("./external-uXk0Avrg.cjs"),xe=require("./box-BcGdqkt4.cjs"),ke=require("./dimensions-D2QGoNXO.cjs"),Oe=require("./direction-386XDm2w.cjs"),qe=require("./location-DZi8ftXp.cjs"),Ae=require("./position-DAL0Qqdf.cjs"),Re=require("./spatial-DGpZ2sO3.cjs"),Ne=require("./xy-B7065J2S.cjs"),Pe=require("./index-udOjA9d-.cjs"),V=require("./url.cjs"),L=require("./worker.cjs"),Ze=require("./external-mffsMzJx.cjs"),Ce=2,Le=3,Ie=2,We=(e,t)=>{if(Number.isNaN(e)||!Number.isFinite(e))return e;const r=m.span(t);if(r==0)return e;let n;r>=1e3?n=Ce:r>=1?n=Le:n=Math.ceil(-Math.log10(r))+Ie;const s=10**n;return Math.round(e*s)/s},De=Object.freeze(Object.defineProperty({__proto__:null,abs:m.abs,add:m.add,closeTo:m.closeTo,div:m.div,equal:m.equal,max:m.max$1,min:m.min,mult:m.mult,roundBySpan:We,roundToNearestMagnitude:m.roundToNearestMagnitude,sub:m.sub},Symbol.toStringTag,{value:"Module"})),F=async e=>await new Promise(t=>setTimeout(t,h.TimeSpan.fromMilliseconds(e).milliseconds)),Ue=Object.freeze(Object.defineProperty({__proto__:null,sleep:F},Symbol.toStringTag,{value:"Module"}));class He{config;retries;interval;constructor(t){this.config={baseInterval:new h.TimeSpan(t?.baseInterval??h.TimeSpan.seconds(1)),maxRetries:t?.maxRetries??5,scale:t?.scale??1,sleepFn:t?.sleepFn??F},this.retries=0,this.interval=new h.TimeSpan(this.config.baseInterval)}async wait(){const{maxRetries:t,scale:r,sleepFn:n}=this.config;return this.retries>=t?!1:(await n(this.interval),this.interval=this.interval.mult(r),this.retries++,!0)}reset(){this.retries=0,this.interval=this.config.baseInterval}}const Be=o.z.object({baseInterval:h.TimeSpan.z.optional(),maxRetries:o.z.number().optional(),scale:o.z.number().optional()}),Ve=Object.freeze(Object.defineProperty({__proto__:null,Breaker:He,breakerConfigZ:Be},Symbol.toStringTag,{value:"Module"})),Fe=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,Q=o.z.string().regex(Fe),y=o.z.number().min(0).max(255),G=o.z.number().min(0).max(1),k=o.z.tuple([y,y,y,G]),Qe=o.z.tuple([y,y,y]),Ge=o.z.object({rgba255:k}),Je=o.z.number().min(0).max(360),Ye=o.z.number().min(0).max(100),Ke=o.z.number().min(0).max(100),J=o.z.tuple([Je,Ye,Ke,G]),O=o.z.union([Q,Qe,k,J,Ge]),q=O.transform(e=>f(e)),Xe=e=>q.safeParse(e).success,et=e=>k.safeParse(e).success,tt=e=>{if(e==null)return;const t=q.safeParse(e);if(t.success)return K(t.data);if(typeof e=="string")return e;throw t.error},f=(e,t=1)=>{if(e=O.parse(e),typeof e=="string")return ft(e,t);if(Array.isArray(e)){if(e.length<3||e.length>4)throw new Error(`Invalid color: [${e.join(", ")}]`);return e.length===3?[...e,t]:e}return e.rgba255},Y=(e,t)=>{if(e==null||t==null)return e==t;const r=f(e),n=f(t);return r.every((s,i)=>s===n[i])},rt=e=>{if(e==null)return;const[t,r,n,s]=f(e);return`#${$(t)}${$(r)}${$(n)}${s===1?"":$(s*255)}`},K=e=>{const[t,r,n,s]=f(e);return`rgba(${t}, ${r}, ${n}, ${s})`},nt=e=>`rgb(${X(e)})`,X=e=>{const[t,r,n]=f(e);return`${t}, ${r}, ${n}`},ot=e=>[...I(e),T(e)],I=e=>[S(e)/255,v(e)/255,w(e)/255],S=e=>f(e)[0],v=e=>f(e)[1],w=e=>f(e)[2],T=e=>f(e)[3],st=e=>Y(W,e),it=e=>mt(f(e)),ct=(e,t)=>{const[r,n,s]=f(e);if(t>100)throw new Error(`Color opacity must be between 0 and 100, got ${t}`);return t>1&&(t/=100),[r,n,s,t]},M=e=>{const[t,r,n]=I(e).map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return Number((.2126*t+.7152*r+.0722*n).toFixed(3))},at=e=>{const[t,r,n]=I(e);return 1-(Math.max(t,r,n)-Math.min(t,r,n))},N=(e,t)=>{const r=f(e),n=f(t),s=M(r),i=M(n);return(Math.max(s,i)+.5)/(Math.min(s,i)+.5)},lt=(e,...t)=>{if(t.length===0)throw new Error("[Color.pickByContrast] - must provide at least one color");const r=f(e),[n]=t.sort((s,i)=>N(r,i)-N(r,s));return f(n)},ut=e=>M(e)<.5,dt=e=>M(e)>.5,ft=(e,t=1)=>(e=Q.parse(e),e=ht(e),[x(e,0),x(e,2),x(e,4),e.length===8?x(e,6)/255:t]),W=[0,0,0,0],$=e=>Math.floor(e).toString(16).padStart(2,"0"),x=(e,t)=>parseInt(e.slice(t,t+2),16),ht=e=>e.startsWith("#")?e.slice(1):e,pt=e=>{e=J.parse(e);let[t,r,n]=e;const s=e[3];t/=360,r/=100,n/=100;let i,c,d;if(r===0)i=c=d=n;else{const l=n<.5?n*(1+r):n+r-n*r,a=2*n-l;i=R(a,l,t+1/3),c=R(a,l,t),d=R(a,l,t-1/3)}return[Math.round(i*255),Math.round(c*255),Math.round(d*255),s]},R=(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),mt=e=>{e=k.parse(e);let[t,r,n]=e;const s=e[3];t/=255,r/=255,n/=255;const i=Math.max(t,r,n),c=Math.min(t,r,n);let d,l,a=(i+c)/2;if(i===c)d=l=0;else{const u=i-c;l=a>.5?u/(2-i-c):u/(i+c),i===t?d=(r-n)/u+(r<n?6:0):i===r?d=(n-t)/u+2:d=(t-r)/u+4,d/=6}return d*=360,l*=100,a*=100,[Math.round(d),Math.round(l),Math.round(a),s]},gt=f("#000000"),bt=f("#ffffff"),ee=o.z.object({key:o.z.string(),color:O,position:o.z.number(),switched:o.z.boolean().optional()}),yt=o.z.array(ee),_t=(e,t)=>{if(e.length===0)return W;if(e=e.slice().sort((r,n)=>r.position-n.position),t<=e[0].position)return f(e[0].color);if(t>=e[e.length-1].position)return f(e[e.length-1].color);for(let r=0;r<e.length-1;r++){const n=e[r],s=e[r+1];if(t<n.position||t>s.position)continue;if(t===n.position)return f(n.color);if(t===s.position)return f(s.color);const i=(t-n.position)/(s.position-n.position),c=f(n.color),d=f(s.color),l=Math.round(S(c)+i*(S(d)-S(c))),a=Math.round(v(c)+i*(v(d)-v(c))),u=Math.round(w(c)+i*(w(d)-w(c))),p=T(c)+i*(T(d)-T(c));return f([l,a,u,p])}return f(e[e.length-1].color)},St=o.z.object({key:o.z.string(),name:o.z.string(),color:q}),vt=o.z.object({key:o.z.string(),name:o.z.string(),swatches:o.z.array(St)}),wt=Object.freeze(Object.defineProperty({__proto__:null,BLACK:gt,WHITE:bt,ZERO:W,aValue:T,bValue:w,colorZ:q,construct:f,contrast:N,crudeZ:O,cssString:tt,equals:Y,fromGradient:_t,fromHSLA:pt,gValue:v,gradientZ:yt,grayness:at,hex:rt,hsla:it,isColor:et,isCrude:Xe,isDark:ut,isLight:dt,isZero:st,luminance:M,paletteZ:vt,pickByContrast:lt,rValue:S,rgbCSS:nt,rgbString:X,rgba1:ot,rgbaCSS:K,setAlpha:ct,stopZ:ee},Symbol.toStringTag,{value:"Module"})),te=o.z.int().min(0).max(255),re=255,ne=0,Tt={lower:ne,upper:re+1},oe=o.z.object({name:o.z.string(),key:o.z.string()}),j=e=>o.z.object({subject:oe,resource:e,authority:te}),Mt=(...e)=>t=>t.filter(r=>{let n=!1;return r.to!=null&&(n=e.includes(r.to.resource)),r.from!=null&&!n&&(n=e.includes(r.from.resource)),n}),se=e=>o.z.object({from:j(e),to:o.z.null()}),ie=e=>o.z.object({from:o.z.null(),to:j(e)}),jt=e=>o.z.union([se(e),ie(e),o.z.object({from:j(e),to:j(e)})]),zt=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:re,AUTHORITY_BOUNDS:Tt,ZERO_AUTHORITY:ne,acquireZ:ie,authorityZ:te,filterTransfersByChannelKey:Mt,releaseZ:se,stateZ:j,subjectZ:oe,transferZ:jt},Symbol.toStringTag,{value:"Module"})),Et=e=>Object.getOwnPropertySymbols(globalThis).includes(e),$t=(e,t)=>{const r=Symbol.for(e);if(!Et(r)){const n=t();Object.defineProperty(globalThis,r,{value:n})}return()=>globalThis[r]},ce="sy_x_error",xt=e=>t=>t!=null&&typeof t=="object"&&"type"in t&&typeof t.type=="string"?t.type.startsWith(e):t instanceof Error?t.message.startsWith(e):typeof t!="string"?!1:t.startsWith(e),z=e=>class _ extends Error{static discriminator=ce;discriminator=_.discriminator;static TYPE=e;type=_.TYPE;static matches=xt(e);matches=_.matches;constructor(r,n){super(r,n),this.name=_.TYPE}static sub(r){return z(`${e}.${r}`)}},ae=e=>{if(e==null||typeof e!="object")return!1;const t=e;if(t.discriminator!==ce)return!1;if(!("type"in t))throw new Error(`X Error is missing its type property: ${JSON.stringify(t)}`);return!0},b="unknown",P="nil";class kt{providers=[];register(t){this.providers.push(t)}encode(t){if(t==null)return{type:P,data:""};if(ae(t))for(const r of this.providers){const n=r.encode(t);if(n!=null)return n}if(t instanceof Error)return{type:b,data:t.message};if(typeof t=="string")return{type:b,data:t};try{return{type:b,data:JSON.stringify(t)}}catch{return{type:b,data:"unable to encode error information"}}}decode(t){if(t==null||t.type===P)return null;if(t.type===b)return new Z(t.data);for(const r of this.providers){const n=r.decode(t);if(n!=null)return n}return new Z(t.data)}}const D=$t("synnax-error-registry",()=>new kt),Ot=({encode:e,decode:t})=>D().register({encode:e,decode:t}),qt=e=>D().encode(e),At=e=>e==null?null:D().decode(e);class Z extends z("unknown"){}const Rt=o.z.object({type:o.z.string(),data:o.z.string()});class Nt extends z("canceled"){}class Pt extends z("not_implemented"){}const Zt=Object.freeze(Object.defineProperty({__proto__:null,Canceled:Nt,NONE:P,NotImplemented:Pt,UNKNOWN:b,Unknown:Z,createTyped:z,decode:At,encode:qt,isTyped:ae,payloadZ:Rt,register:Ot},Symbol.toStringTag,{value:"Module"})),Ct=()=>Promise.resolve(),Lt=()=>new Promise(e=>setTimeout(e,0)),It=e=>e?-1:1,le=o.object({jsonrpc:o.literal("2.0"),method:o.string(),params:o.any().optional(),id:o.union([o.string(),o.number(),o.null()]).optional()}),ue=o.object({jsonrpc:o.literal("2.0"),id:o.union([o.string(),o.number(),o.null()])}),Wt=ue.extend({result:o.json()}),Dt=ue.extend({error:o.object({code:o.number().int(),message:o.string().optional(),data:o.json().optional()})}),de=o.union([Wt,Dt]),fe=o.union([le,de]),Ut=e=>{const t=new TextDecoder;let r=new Uint8Array(0),n=null;return s=>{let i;typeof s=="string"?i=new TextEncoder().encode(s):s instanceof ArrayBuffer?i=new Uint8Array(s):i=s;const c=new Uint8Array(r.length+i.length);for(c.set(r),c.set(i,r.length),r=c;r.length>0;){if(n===null){const l=t.decode(r).match(/^Content-Length: (\d+)\r?\n\r?\n/);if(!l)break;n=parseInt(l[1]);const a=new TextEncoder().encode(l[0]).length;r=r.slice(a)}if(n!==null&&r.length>=n){const d=r.slice(0,n);r=r.slice(n),n=null;const l=t.decode(d),a=U.JSON_CODEC.decodeString(l,fe);e(a)}else break}}},Ht=e=>{const t=JSON.stringify(e);return`Content-Length: ${new TextEncoder().encode(t).length}\r
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _e=require("./array.cjs"),U=require("./index-BQe8OIgm.cjs"),o=require("zod"),h=require("./series-CYAhDD6B.cjs"),Se=require("./index-DdhM_E4k.cjs"),ve=require("./change-C-YELKx6.cjs"),H=require("./scale-C6qKDbRb.cjs"),g=require("./index-B1m2qvBT.cjs"),B=require("./debounce.cjs"),we=require("./deep.cjs"),Te=require("./identity.cjs"),Me=require("./external-B9AAGv50.cjs"),je=require("./link.cjs"),m=require("./bounds-D6e9xoHt.cjs"),ze=require("./observe.cjs"),Ee=require("./record-YvCh7bzB.cjs"),$e=require("./external-uXk0Avrg.cjs"),xe=require("./box-Cxki783Y.cjs"),ke=require("./dimensions-D2QGoNXO.cjs"),Oe=require("./direction-386XDm2w.cjs"),qe=require("./location-DZi8ftXp.cjs"),Ae=require("./position-DSy2hONH.cjs"),Re=require("./spatial-DGpZ2sO3.cjs"),Ne=require("./xy-CUE3QDNn.cjs"),Pe=require("./index-udOjA9d-.cjs"),V=require("./url.cjs"),L=require("./worker.cjs"),Ze=require("./external-mffsMzJx.cjs"),Ce=2,Le=3,Ie=2,We=(e,t)=>{if(Number.isNaN(e)||!Number.isFinite(e))return e;const r=m.span(t);if(r==0)return e;let n;r>=1e3?n=Ce:r>=1?n=Le:n=Math.ceil(-Math.log10(r))+Ie;const s=10**n;return Math.round(e*s)/s},De=Object.freeze(Object.defineProperty({__proto__:null,abs:m.abs,add:m.add,closeTo:m.closeTo,div:m.div,equal:m.equal,max:m.max$1,min:m.min,mult:m.mult,roundBySpan:We,roundToNearestMagnitude:m.roundToNearestMagnitude,sub:m.sub},Symbol.toStringTag,{value:"Module"})),F=async e=>await new Promise(t=>setTimeout(t,h.TimeSpan.fromMilliseconds(e).milliseconds)),Ue=Object.freeze(Object.defineProperty({__proto__:null,sleep:F},Symbol.toStringTag,{value:"Module"}));class He{config;retries;interval;constructor(t){this.config={baseInterval:new h.TimeSpan(t?.baseInterval??h.TimeSpan.seconds(1)),maxRetries:t?.maxRetries??5,scale:t?.scale??1,sleepFn:t?.sleepFn??F},this.retries=0,this.interval=new h.TimeSpan(this.config.baseInterval)}async wait(){const{maxRetries:t,scale:r,sleepFn:n}=this.config;return this.retries>=t?!1:(await n(this.interval),this.interval=this.interval.mult(r),this.retries++,!0)}reset(){this.retries=0,this.interval=this.config.baseInterval}}const Be=o.z.object({baseInterval:h.TimeSpan.z.optional(),maxRetries:o.z.number().optional(),scale:o.z.number().optional()}),Ve=Object.freeze(Object.defineProperty({__proto__:null,Breaker:He,breakerConfigZ:Be},Symbol.toStringTag,{value:"Module"})),Fe=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,Q=o.z.string().regex(Fe),y=o.z.number().min(0).max(255),G=o.z.number().min(0).max(1),k=o.z.tuple([y,y,y,G]),Qe=o.z.tuple([y,y,y]),Ge=o.z.object({rgba255:k}),Je=o.z.number().min(0).max(360),Ye=o.z.number().min(0).max(100),Ke=o.z.number().min(0).max(100),J=o.z.tuple([Je,Ye,Ke,G]),O=o.z.union([Q,Qe,k,J,Ge]),q=O.transform(e=>f(e)),Xe=e=>q.safeParse(e).success,et=e=>k.safeParse(e).success,tt=e=>{if(e==null)return;const t=q.safeParse(e);if(t.success)return K(t.data);if(typeof e=="string")return e;throw t.error},f=(e,t=1)=>{if(e=O.parse(e),typeof e=="string")return ft(e,t);if(Array.isArray(e)){if(e.length<3||e.length>4)throw new Error(`Invalid color: [${e.join(", ")}]`);return e.length===3?[...e,t]:e}return e.rgba255},Y=(e,t)=>{if(e==null||t==null)return e==t;const r=f(e),n=f(t);return r.every((s,i)=>s===n[i])},rt=e=>{if(e==null)return;const[t,r,n,s]=f(e);return`#${$(t)}${$(r)}${$(n)}${s===1?"":$(s*255)}`},K=e=>{const[t,r,n,s]=f(e);return`rgba(${t}, ${r}, ${n}, ${s})`},nt=e=>`rgb(${X(e)})`,X=e=>{const[t,r,n]=f(e);return`${t}, ${r}, ${n}`},ot=e=>[...I(e),T(e)],I=e=>[S(e)/255,v(e)/255,w(e)/255],S=e=>f(e)[0],v=e=>f(e)[1],w=e=>f(e)[2],T=e=>f(e)[3],st=e=>Y(W,e),it=e=>mt(f(e)),ct=(e,t)=>{const[r,n,s]=f(e);if(t>100)throw new Error(`Color opacity must be between 0 and 100, got ${t}`);return t>1&&(t/=100),[r,n,s,t]},M=e=>{const[t,r,n]=I(e).map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return Number((.2126*t+.7152*r+.0722*n).toFixed(3))},at=e=>{const[t,r,n]=I(e);return 1-(Math.max(t,r,n)-Math.min(t,r,n))},N=(e,t)=>{const r=f(e),n=f(t),s=M(r),i=M(n);return(Math.max(s,i)+.5)/(Math.min(s,i)+.5)},lt=(e,...t)=>{if(t.length===0)throw new Error("[Color.pickByContrast] - must provide at least one color");const r=f(e),[n]=t.sort((s,i)=>N(r,i)-N(r,s));return f(n)},ut=e=>M(e)<.5,dt=e=>M(e)>.5,ft=(e,t=1)=>(e=Q.parse(e),e=ht(e),[x(e,0),x(e,2),x(e,4),e.length===8?x(e,6)/255:t]),W=[0,0,0,0],$=e=>Math.floor(e).toString(16).padStart(2,"0"),x=(e,t)=>parseInt(e.slice(t,t+2),16),ht=e=>e.startsWith("#")?e.slice(1):e,pt=e=>{e=J.parse(e);let[t,r,n]=e;const s=e[3];t/=360,r/=100,n/=100;let i,c,d;if(r===0)i=c=d=n;else{const l=n<.5?n*(1+r):n+r-n*r,a=2*n-l;i=R(a,l,t+1/3),c=R(a,l,t),d=R(a,l,t-1/3)}return[Math.round(i*255),Math.round(c*255),Math.round(d*255),s]},R=(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),mt=e=>{e=k.parse(e);let[t,r,n]=e;const s=e[3];t/=255,r/=255,n/=255;const i=Math.max(t,r,n),c=Math.min(t,r,n);let d,l,a=(i+c)/2;if(i===c)d=l=0;else{const u=i-c;l=a>.5?u/(2-i-c):u/(i+c),i===t?d=(r-n)/u+(r<n?6:0):i===r?d=(n-t)/u+2:d=(t-r)/u+4,d/=6}return d*=360,l*=100,a*=100,[Math.round(d),Math.round(l),Math.round(a),s]},gt=f("#000000"),bt=f("#ffffff"),ee=o.z.object({key:o.z.string(),color:O,position:o.z.number(),switched:o.z.boolean().optional()}),yt=o.z.array(ee),_t=(e,t)=>{if(e.length===0)return W;if(e=e.slice().sort((r,n)=>r.position-n.position),t<=e[0].position)return f(e[0].color);if(t>=e[e.length-1].position)return f(e[e.length-1].color);for(let r=0;r<e.length-1;r++){const n=e[r],s=e[r+1];if(t<n.position||t>s.position)continue;if(t===n.position)return f(n.color);if(t===s.position)return f(s.color);const i=(t-n.position)/(s.position-n.position),c=f(n.color),d=f(s.color),l=Math.round(S(c)+i*(S(d)-S(c))),a=Math.round(v(c)+i*(v(d)-v(c))),u=Math.round(w(c)+i*(w(d)-w(c))),p=T(c)+i*(T(d)-T(c));return f([l,a,u,p])}return f(e[e.length-1].color)},St=o.z.object({key:o.z.string(),name:o.z.string(),color:q}),vt=o.z.object({key:o.z.string(),name:o.z.string(),swatches:o.z.array(St)}),wt=Object.freeze(Object.defineProperty({__proto__:null,BLACK:gt,WHITE:bt,ZERO:W,aValue:T,bValue:w,colorZ:q,construct:f,contrast:N,crudeZ:O,cssString:tt,equals:Y,fromGradient:_t,fromHSLA:pt,gValue:v,gradientZ:yt,grayness:at,hex:rt,hsla:it,isColor:et,isCrude:Xe,isDark:ut,isLight:dt,isZero:st,luminance:M,paletteZ:vt,pickByContrast:lt,rValue:S,rgbCSS:nt,rgbString:X,rgba1:ot,rgbaCSS:K,setAlpha:ct,stopZ:ee},Symbol.toStringTag,{value:"Module"})),te=o.z.int().min(0).max(255),re=255,ne=0,Tt={lower:ne,upper:re+1},oe=o.z.object({name:o.z.string(),key:o.z.string()}),j=e=>o.z.object({subject:oe,resource:e,authority:te}),Mt=(...e)=>t=>t.filter(r=>{let n=!1;return r.to!=null&&(n=e.includes(r.to.resource)),r.from!=null&&!n&&(n=e.includes(r.from.resource)),n}),se=e=>o.z.object({from:j(e),to:o.z.null()}),ie=e=>o.z.object({from:o.z.null(),to:j(e)}),jt=e=>o.z.union([se(e),ie(e),o.z.object({from:j(e),to:j(e)})]),zt=Object.freeze(Object.defineProperty({__proto__:null,ABSOLUTE_AUTHORITY:re,AUTHORITY_BOUNDS:Tt,ZERO_AUTHORITY:ne,acquireZ:ie,authorityZ:te,filterTransfersByChannelKey:Mt,releaseZ:se,stateZ:j,subjectZ:oe,transferZ:jt},Symbol.toStringTag,{value:"Module"})),Et=e=>Object.getOwnPropertySymbols(globalThis).includes(e),$t=(e,t)=>{const r=Symbol.for(e);if(!Et(r)){const n=t();Object.defineProperty(globalThis,r,{value:n})}return()=>globalThis[r]},ce="sy_x_error",xt=e=>t=>t!=null&&typeof t=="object"&&"type"in t&&typeof t.type=="string"?t.type.startsWith(e):t instanceof Error?t.message.startsWith(e):typeof t!="string"?!1:t.startsWith(e),z=e=>class _ extends Error{static discriminator=ce;discriminator=_.discriminator;static TYPE=e;type=_.TYPE;static matches=xt(e);matches=_.matches;constructor(r,n){super(r,n),this.name=_.TYPE}static sub(r){return z(`${e}.${r}`)}},ae=e=>{if(e==null||typeof e!="object")return!1;const t=e;if(t.discriminator!==ce)return!1;if(!("type"in t))throw new Error(`X Error is missing its type property: ${JSON.stringify(t)}`);return!0},b="unknown",P="nil";class kt{providers=[];register(t){this.providers.push(t)}encode(t){if(t==null)return{type:P,data:""};if(ae(t))for(const r of this.providers){const n=r.encode(t);if(n!=null)return n}if(t instanceof Error)return{type:b,data:t.message};if(typeof t=="string")return{type:b,data:t};try{return{type:b,data:JSON.stringify(t)}}catch{return{type:b,data:"unable to encode error information"}}}decode(t){if(t==null||t.type===P)return null;if(t.type===b)return new Z(t.data);for(const r of this.providers){const n=r.decode(t);if(n!=null)return n}return new Z(t.data)}}const D=$t("synnax-error-registry",()=>new kt),Ot=({encode:e,decode:t})=>D().register({encode:e,decode:t}),qt=e=>D().encode(e),At=e=>e==null?null:D().decode(e);class Z extends z("unknown"){}const Rt=o.z.object({type:o.z.string(),data:o.z.string()});class Nt extends z("canceled"){}class Pt extends z("not_implemented"){}const Zt=Object.freeze(Object.defineProperty({__proto__:null,Canceled:Nt,NONE:P,NotImplemented:Pt,UNKNOWN:b,Unknown:Z,createTyped:z,decode:At,encode:qt,isTyped:ae,payloadZ:Rt,register:Ot},Symbol.toStringTag,{value:"Module"})),Ct=()=>Promise.resolve(),Lt=()=>new Promise(e=>setTimeout(e,0)),It=e=>e?-1:1,le=o.object({jsonrpc:o.literal("2.0"),method:o.string(),params:o.any().optional(),id:o.union([o.string(),o.number(),o.null()]).optional()}),ue=o.object({jsonrpc:o.literal("2.0"),id:o.union([o.string(),o.number(),o.null()])}),Wt=ue.extend({result:o.json()}),Dt=ue.extend({error:o.object({code:o.number().int(),message:o.string().optional(),data:o.json().optional()})}),de=o.union([Wt,Dt]),fe=o.union([le,de]),Ut=e=>{const t=new TextDecoder;let r=new Uint8Array(0),n=null;return s=>{let i;typeof s=="string"?i=new TextEncoder().encode(s):s instanceof ArrayBuffer?i=new Uint8Array(s):i=s;const c=new Uint8Array(r.length+i.length);for(c.set(r),c.set(i,r.length),r=c;r.length>0;){if(n===null){const l=t.decode(r).match(/^Content-Length: (\d+)\r?\n\r?\n/);if(!l)break;n=parseInt(l[1]);const a=new TextEncoder().encode(l[0]).length;r=r.slice(a)}if(n!==null&&r.length>=n){const d=r.slice(0,n);r=r.slice(n),n=null;const l=t.decode(d),a=U.JSON_CODEC.decodeString(l,fe);e(a)}else break}}},Ht=e=>{const t=JSON.stringify(e);return`Content-Length: ${new TextEncoder().encode(t).length}\r
|
|
2
2
|
\r
|
|
3
3
|
`+t},Bt=Object.freeze(Object.defineProperty({__proto__:null,encodeMessage:Ht,messageZ:fe,requestZ:le,responseZ:de,streamDecodeChunks:Ut},Symbol.toStringTag,{value:"Module"})),Vt=(e,t,r)=>{const n=e.get(t);return n===void 0?(e.set(t,r),r):n},Ft=Object.freeze(Object.defineProperty({__proto__:null,getOrSetDefault:Vt},Symbol.toStringTag,{value:"Module"})),C=o.z.string().regex(/^\d+\.\d+\.\d+$/),E=(e,t,r={})=>{r.checkMajor??=!0,r.checkMinor??=!0,r.checkPatch??=!0;const n=C.parse(e),s=C.parse(t),[i,c,d]=n.split(".").map(Number),[l,a,u]=s.split(".").map(Number);if(r.checkMajor){if(i<l)return g.LESS_THAN;if(i>l)return g.GREATER_THAN}if(r.checkMinor){if(c<a)return g.LESS_THAN;if(c>a)return g.GREATER_THAN}if(r.checkPatch){if(d<u)return g.LESS_THAN;if(d>u)return g.GREATER_THAN}return g.EQUAL},Qt=(e,t,r={})=>g.isEqualTo(E(e,t,r)),he=(e,t,r={})=>g.isGreaterThan(E(e,t,r)),Gt=(e,t,r={})=>g.isLessThan(E(e,t,r)),Jt=({name:e,migrate:t})=>r=>{try{const n=t(r);return console.log(`${e} migrated: ${r.version} -> ${n.version}`),n}catch(n){throw console.log(`${e} failed to migrate from ${r.version}`),console.error(n),n}},Yt=({name:e,migrations:t,targetSchema:r,defaultVersion:n,def:s})=>{const i=Object.keys(t).sort(E).pop();if(i==null)return a=>{if(a.version??=n,a.version!==s.version)return console.log(`${e} version ${a.version} is newer than latest version of ${s.version}.
|
|
4
4
|
Returning default instead.
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,11 @@ import { array as jr } from "./array.js";
|
|
|
2
2
|
import { J as ge } from "./index-B5l_quQn.js";
|
|
3
3
|
import { c as Tr } from "./index-B5l_quQn.js";
|
|
4
4
|
import h, { z as i } from "zod";
|
|
5
|
-
import { a as _, T as U, h as be } from "./series-
|
|
6
|
-
import { c as Er, D as Or, M as kr, R as Ar, S as Pr, d as Zr, b as Nr, g as Ir, f as Rr, j as Cr, m as Lr, i as qr, e as Wr, t as zr, u as Dr } from "./series-
|
|
5
|
+
import { a as _, T as U, h as be } from "./series-Bn5y1tD1.js";
|
|
6
|
+
import { c as Er, D as Or, M as kr, R as Ar, S as Pr, d as Zr, b as Nr, g as Ir, f as Rr, j as Cr, m as Lr, i as qr, e as Wr, t as zr, u as Dr } from "./series-Bn5y1tD1.js";
|
|
7
7
|
import { a as Br } from "./index-D2xcvEO5.js";
|
|
8
8
|
import { c as Hr } from "./change-DLl6DccR.js";
|
|
9
|
-
import { c as Jr, s as Gr } from "./scale-
|
|
9
|
+
import { c as Jr, s as Gr } from "./scale-EWNUk-bn.js";
|
|
10
10
|
import { i as _e, a as ye, b as we, L as Z, G as N, E as ve } from "./index-PNh31WTW.js";
|
|
11
11
|
import { c as Yr, p as Kr } from "./index-PNh31WTW.js";
|
|
12
12
|
import { debounce as en, throttle as tn } from "./debounce.js";
|
|
@@ -19,13 +19,13 @@ import { b as dn } from "./bounds-Dj9nG39I.js";
|
|
|
19
19
|
import { observe as pn } from "./observe.js";
|
|
20
20
|
import { r as gn } from "./record-CAcQ5PNX.js";
|
|
21
21
|
import { e as _n } from "./external-BPgtxa8d.js";
|
|
22
|
-
import { b as wn } from "./box-
|
|
22
|
+
import { b as wn } from "./box-CO_2_DGG.js";
|
|
23
23
|
import { d as Sn } from "./dimensions-CRgergMS.js";
|
|
24
24
|
import { d as jn } from "./direction-8etxfKaR.js";
|
|
25
25
|
import { l as Tn } from "./location-Ar5y2DX2.js";
|
|
26
|
-
import { p as En } from "./position-
|
|
26
|
+
import { p as En } from "./position-PQ6op54I.js";
|
|
27
27
|
import { s as kn } from "./spatial-BSWPzMkK.js";
|
|
28
|
-
import { x as Pn } from "./xy-
|
|
28
|
+
import { x as Pn } from "./xy-C_-hb3Q2.js";
|
|
29
29
|
import { u as Nn } from "./index-D4NCYiQB.js";
|
|
30
30
|
import { URL as Rn, buildQueryString as Cn } from "./url.js";
|
|
31
31
|
import { RoutedWorker as qn, TypedWorker as Wn, createMockWorkers as zn } from "./worker.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("./box-
|
|
1
|
+
"use strict";const c=require("./box-Cxki783Y.cjs"),T=require("./direction-386XDm2w.cjs"),s=require("./location-DZi8ftXp.cjs"),b=require("./base-BAM2mqCy.cjs"),P=t=>{if(t==null)return{x:void 0,y:void 0};const n=s.xy.safeParse(t);if(n.success)return n.data;const e=b.location.safeParse(t);return e.success?T.construct(e.data)==="x"?{x:e.data,y:void 0}:{x:void 0,y:e.data}:t},N=({container:t,target:n,dialog:e,initial:u,prefer:a,alignments:f=["start"],disable:x=[]})=>{const i=P(u);let l=s.XY_LOCATIONS;if(a!=null){const o=a.map(r=>P(r));l=l.slice().sort((r,p)=>{const d=o.findIndex(h=>s.xyMatches(r,h)),g=o.findIndex(h=>s.xyMatches(p,h));return d>-1&&g>-1?d-g:d>-1?-1:g>-1?1:0})}const O=l.filter(o=>!s.xyEquals(o,s.CENTER)&&(i.x==null||o.x===i.x)&&(i.y==null||o.y===i.y)&&!x.some(r=>s.xyMatches(o,r))).map(o=>f?.map(r=>[o,r])).flat(),A=c.construct(t),M=c.construct(n),_=c.construct(e);let E=-1/0;const y={location:s.CENTER,adjustedDialog:_};return O.forEach(([o,r])=>{const[p,d]=m({option:o,alignment:r,container:A,target:M,dialog:_});d>E&&(E=d,y.location=o,y.adjustedDialog=p)}),y},m=({option:t,alignment:n,container:e,target:u,dialog:a})=>{const f=L(t,n),x=c.xyLoc(u,t),i=c.constructWithAlternateRoot(x.x,x.y,c.width(a),c.height(a),f,s.TOP_LEFT),l=c.area(c.intersection(i,e));return[i,l]},v={start:"left",center:"center",end:"right"},I={start:"bottom",center:"center",end:"top"},L=(t,n)=>{const e={x:"center",y:"center"};if(t.y!=="center"){e.y=s.swap(t.y);const u=t.x==="left"?s.swap:a=>a;e.x=u(v[n])}else e.x=s.swap(t.x),e.y=I[n];return e},j=Object.freeze(Object.defineProperty({__proto__:null,dialog:N,getRoot:L,parseLocationOptions:P},Symbol.toStringTag,{value:"Module"}));exports.position=j;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as g, x as v, a as I, h as M, w as N, d as X, i as j } from "./box-
|
|
1
|
+
import { c as g, x as v, a as I, h as M, w as N, d as X, i as j } from "./box-CO_2_DGG.js";
|
|
2
2
|
import { c as w } from "./direction-8etxfKaR.js";
|
|
3
3
|
import { x as B, X as C, a as m, b as R, C as O, s as h, T as S } from "./location-Ar5y2DX2.js";
|
|
4
4
|
import { l as Y } from "./base-DFq0vvGn.js";
|
package/dist/position.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./position-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./position-DSy2hONH.cjs");exports.position=o.position;
|
package/dist/position.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const l=require("zod"),y=require("./bounds-D6e9xoHt.cjs"),u=require("./box-
|
|
1
|
+
"use strict";const l=require("zod"),y=require("./bounds-D6e9xoHt.cjs"),u=require("./box-Cxki783Y.cjs"),m=require("./location-DZi8ftXp.cjs"),h=require("./xy-CUE3QDNn.cjs"),f=(n,t,e)=>t!==void 0&&n<t?t:e!==void 0&&n>e?e:n,B=l.z.object({offset:h.crudeZ,scale:h.crudeZ}),g=l.z.object({offset:l.z.number(),scale:l.z.number()}),v=n=>(t,e,s,r)=>e==="dimension"?[t,s]:[t,r?s-n:s+n],R=n=>(t,e,s,r)=>[t,r?s/n:s*n],T=n=>(t,e,s)=>{if(t===null)return[n,s];const{lower:r,upper:o}=t,{lower:a,upper:p}=n,x=o-r,d=p-a;if(e==="dimension")return[n,s*(d/x)];const w=(s-r)*(d/x)+a;return[n,w]},q=n=>(t,e,s)=>[n,s],z=()=>(n,t,e)=>{if(n===null)throw new Error("cannot invert without bounds");if(t==="dimension")return[n,e];const{lower:s,upper:r}=n;return[n,r-(e-s)]},E=n=>(t,e,s)=>{const{lower:r,upper:o}=n;return s=f(s,r,o),[t,s]};class i{ops=[];currBounds=null;currType=null;reversed=!1;constructor(){this.ops=[]}static translate(t){return new i().translate(t)}static magnify(t){return new i().magnify(t)}static scale(t,e){return new i().scale(t,e)}translate(t){const e=this.new(),s=v(t);return s.type="translate",e.ops.push(s),e}magnify(t){const e=this.new(),s=R(t);return s.type="magnify",e.ops.push(s),e}scale(t,e){const s=y.construct(t,e),r=this.new(),o=T(s);return o.type="scale",r.ops.push(o),r}clamp(t,e){const s=y.construct(t,e),r=this.new(),o=E(s);return o.type="clamp",r.ops.push(o),r}reBound(t,e){const s=y.construct(t,e),r=this.new(),o=q(s);return o.type="re-bound",r.ops.push(o),r}invert(){const t=z();t.type="invert";const e=this.new();return e.ops.push(t),e}pos(t){return this.exec("position",t)}dim(t){return this.exec("dimension",t)}new(){const t=new i;return t.ops=this.ops.slice(),t.reversed=this.reversed,t}exec(t,e){return this.currBounds=null,this.ops.reduce(([s,r],o)=>o(s,t,r,this.reversed),[null,e])[1]}reverse(){const t=this.new();t.ops.reverse();const e=[];return t.ops.forEach((s,r)=>{if(s.type==="scale"||e.some(([a,p])=>r>=a&&r<=p))return;const o=t.ops.findIndex((a,p)=>a.type==="scale"&&p>r);o!==-1&&e.push([r,o])}),e.forEach(([s,r])=>{const o=t.ops.slice(s,r);o.unshift(t.ops[r]),t.ops.splice(s,r-s+1,...o)}),t.reversed=!t.reversed,t}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}static IDENTITY=new i}class c{x;y;currRoot;constructor(t=new i,e=new i,s=null){this.x=t,this.y=e,this.currRoot=s}static translate(t,e){return new c().translate(t,e)}static translateX(t){return new c().translateX(t)}static translateY(t){return new c().translateY(t)}static clamp(t){return new c().clamp(t)}static magnify(t){return new c().magnify(t)}static scale(t){return new c().scale(t)}static reBound(t){return new c().reBound(t)}translate(t,e){const s=h.construct(t,e),r=this.copy();return r.x=this.x.translate(s.x),r.y=this.y.translate(s.y),r}translateX(t){const e=this.copy();return e.x=this.x.translate(t),e}translateY(t){const e=this.copy();return e.y=this.y.translate(t),e}magnify(t){const e=this.copy();return e.x=this.x.magnify(t.x),e.y=this.y.magnify(t.y),e}scale(t){const e=this.copy();if(u.isBox(t)){const s=this.currRoot;return e.currRoot=t.root,s!=null&&!m.xyEquals(s,t.root)&&(s.x!==t.root.x&&(e.x=e.x.invert()),s.y!==t.root.y&&(e.y=e.y.invert())),e.x=e.x.scale(u.xBounds(t)),e.y=e.y.scale(u.yBounds(t)),e}return e.x=e.x.scale(t.width),e.y=e.y.scale(t.height),e}reBound(t){const e=this.copy();return e.x=this.x.reBound(u.xBounds(t)),e.y=this.y.reBound(u.yBounds(t)),e}clamp(t){const e=this.copy();return e.x=this.x.clamp(u.xBounds(t)),e.y=this.y.clamp(u.yBounds(t)),e}copy(){const t=new c;return t.currRoot=this.currRoot,t.x=this.x,t.y=this.y,t}reverse(){const t=this.copy();return t.x=this.x.reverse(),t.y=this.y.reverse(),t}pos(t){return{x:this.x.pos(t.x),y:this.y.pos(t.y)}}dim(t){return{x:this.x.dim(t.x),y:this.y.dim(t.y)}}box(t){return u.construct(this.pos(t.one),this.pos(t.two),0,0,this.currRoot??t.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}static IDENTITY=new c}const I=Object.freeze(Object.defineProperty({__proto__:null,Scale:i,XY:c,crudeXYTransform:B,transform:g},Symbol.toStringTag,{value:"Module"}));exports.clamp=f;exports.scale=I;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z as p } from "zod";
|
|
2
2
|
import { c as l } from "./bounds-Dj9nG39I.js";
|
|
3
|
-
import { e as w, f as y, y as h, c as g } from "./box-
|
|
3
|
+
import { e as w, f as y, y as h, c as g } from "./box-CO_2_DGG.js";
|
|
4
4
|
import { b as v } from "./location-Ar5y2DX2.js";
|
|
5
|
-
import { b as d, c as B } from "./xy-
|
|
5
|
+
import { b as d, c as B } from "./xy-C_-hb3Q2.js";
|
|
6
6
|
const R = (n, t, e) => t !== void 0 && n < t ? t : e !== void 0 && n > e ? e : n, T = p.object({ offset: d, scale: d }), E = p.object({ offset: p.number(), scale: p.number() }), I = (n) => (t, e, s, r) => e === "dimension" ? [t, s] : [
|
|
7
7
|
t,
|
|
8
8
|
r ? s - n : s + n
|
package/dist/scale.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./scale-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./scale-C6qKDbRb.cjs");exports.scale=e.scale;
|
package/dist/scale.js
CHANGED
|
@@ -3,12 +3,12 @@ import { J as L } from "./index-B5l_quQn.js";
|
|
|
3
3
|
import { s as z } from "./index-D2xcvEO5.js";
|
|
4
4
|
import { V as M, n as _ } from "./index-PNh31WTW.js";
|
|
5
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-
|
|
6
|
+
import "./box-CO_2_DGG.js";
|
|
7
7
|
import "./dimensions-CRgergMS.js";
|
|
8
8
|
import "./base-DFq0vvGn.js";
|
|
9
9
|
import "./location-Ar5y2DX2.js";
|
|
10
|
-
import "./scale-
|
|
11
|
-
import "./xy-
|
|
10
|
+
import "./scale-EWNUk-bn.js";
|
|
11
|
+
import "./xy-C_-hb3Q2.js";
|
|
12
12
|
let rt = (i, t = 21) => (e = t) => {
|
|
13
13
|
let s = "", u = e | 0;
|
|
14
14
|
for (; u--; )
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const o=require("zod"),T=require("./index-BQe8OIgm.cjs"),X=require("./index-DdhM_E4k.cjs"),M=require("./index-B1m2qvBT.cjs"),O=require("./bounds-D6e9xoHt.cjs");require("./box-BcGdqkt4.cjs");require("./dimensions-D2QGoNXO.cjs");require("./base-BAM2mqCy.cjs");require("./location-DZi8ftXp.cjs");require("./scale-Bzn1Cl0r.cjs");require("./xy-B7065J2S.cjs");let Q=(i,t=21)=>(e=t)=>{let s="",u=e|0;for(;u--;)s+=i[Math.random()*i.length|0];return s};const _="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Z=11,tt=Q(_,Z),p=()=>tt(),et=Object.freeze(Object.defineProperty({__proto__:null,LENGTH:Z,create:p},Symbol.toStringTag,{value:"Module"})),k=(i,t)=>e=>e instanceof t||typeof e=="object"&&e!==null&&"discriminator"in e&&e.discriminator===i,st=Object.freeze(Object.defineProperty({__proto__:null,createMatcher:k},Symbol.toStringTag,{value:"Module"})),rt=o.z.enum(["static","dynamic"]),nt=o.z.union([o.z.tuple([o.z.int()]),o.z.tuple([o.z.int(),o.z.int().min(1).max(12)]),o.z.tuple([o.z.int(),o.z.int().min(1).max(12),o.z.int().min(1).max(31)])]),G=(i,t)=>{const e=new n(t);if(![a.DAY,a.HOUR,a.MINUTE,a.SECOND,a.MILLISECOND,a.MICROSECOND,a.NANOSECOND].some(u=>u.equals(e)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const s=i.valueOf()%e.valueOf();return i instanceof n?new n(s):new a(s)};class n extends M.ValueExtension{constructor(t,e="UTC"){if(t==null)super(n.now().valueOf());else if(t instanceof Date)super(BigInt(t.getTime())*n.MILLISECOND.valueOf());else if(typeof t=="string")super(n.parseDateTimeString(t,e).valueOf());else if(Array.isArray(t))super(n.parseDate(t));else{let s=0n;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)}}static parseDate([t=1970,e=1,s=1]){const u=new Date(t,e-1,s,0,0,0,0);return new n(BigInt(u.getTime())*n.MILLISECOND.valueOf()).truncate(n.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(t,e="UTC"){const[s,u,c]=t.split(":");let f="00",N="00";c!=null&&([f,N]=c.split("."));let g=n.hours(parseInt(s??"00")).add(n.minutes(parseInt(u??"00"))).add(n.seconds(parseInt(f??"00"))).add(n.milliseconds(parseInt(N??"00")));return e==="local"&&(g=g.add(n.utcOffset)),g.valueOf()}static parseDateTimeString(t,e="UTC"){if(!t.includes("/")&&!t.includes("-"))return n.parseTimeString(t,e);const s=new Date(t);return t.includes(":")||s.setUTCHours(0,0,0,0),new n(BigInt(s.getTime())*n.MILLISECOND.valueOf(),e).valueOf()}fString(t="ISO",e="UTC"){switch(t){case"ISODate":return this.toISOString(e).slice(0,10);case"ISOTime":return this.toISOString(e).slice(11,23);case"time":return this.timeString(!1,e);case"preciseTime":return this.timeString(!0,e);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,e)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,e)}`;default:return this.toISOString(e)}}toISOString(t="UTC"){return t==="UTC"?this.date().toISOString():this.sub(n.utcOffset).date().toISOString()}timeString(t=!1,e="UTC"){const s=this.toISOString(e);return t?s.slice(11,23):s.slice(11,19)}dateString(){const t=this.date(),e=t.toLocaleString("default",{month:"short"}),s=t.toLocaleString("default",{day:"numeric"});return`${e} ${s}`}static get utcOffset(){return new a(BigInt(new Date().getTimezoneOffset())*n.MINUTE.valueOf())}static since(t){return new n().span(t)}date(){return new Date(this.milliseconds)}equals(t){return this.valueOf()===new n(t).valueOf()}span(t){return this.range(t).span}range(t){return new b(this,t).makeValid()}spanRange(t){return this.range(this.add(t)).makeValid()}get isZero(){return this.valueOf()===0n}after(t){return this.valueOf()>new n(t).valueOf()}afterEq(t){return this.valueOf()>=new n(t).valueOf()}before(t){return this.valueOf()<new n(t).valueOf()}beforeEq(t){return this.valueOf()<=new n(t).valueOf()}add(t){return new n(this.valueOf()+BigInt(t.valueOf()))}sub(t){return new n(this.valueOf()-BigInt(t.valueOf()))}get hours(){return Number(this.valueOf())/Number(a.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(a.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(a.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(a.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(n.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(n.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(t){const e=this.date();return e.setUTCFullYear(t),new n(e)}get month(){return this.date().getUTCMonth()}setMonth(t){const e=this.date();return e.setUTCMonth(t),new n(e)}get day(){return this.date().getUTCDate()}setDay(t){const e=this.date();return e.setUTCDate(t),new n(e)}get hour(){return this.date().getUTCHours()}setHour(t){const e=this.date();return e.setUTCHours(t),new n(e,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(t){const e=this.date();return e.setUTCMinutes(t),new n(e)}get second(){return this.date().getUTCSeconds()}setSecond(t){const e=this.date();return e.setUTCSeconds(t),new n(e)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(t){const e=this.date();return e.setUTCMilliseconds(t),new n(e)}toString(){return this.date().toISOString()}remainder(t){return G(this,t)}get isToday(){return this.truncate(a.DAY).equals(n.now().truncate(a.DAY))}truncate(t){return this.sub(this.remainder(t))}static now(){return new n(new Date)}static max(...t){let e=n.MIN;for(const s of t){const u=new n(s);u.after(e)&&(e=u)}return e}static min(...t){let e=n.MAX;for(const s of t){const u=new n(s);u.before(e)&&(e=u)}return e}static nanoseconds(t,e="UTC"){return new n(t,e)}static NANOSECOND=n.nanoseconds(1);static microseconds(t,e="UTC"){return n.nanoseconds(t*1e3,e)}static MICROSECOND=n.microseconds(1);static milliseconds(t,e="UTC"){return n.microseconds(t*1e3,e)}static MILLISECOND=n.milliseconds(1);static seconds(t,e="UTC"){return n.milliseconds(t*1e3,e)}static SECOND=n.seconds(1);static minutes(t,e="UTC"){return n.seconds(t*60,e)}static MINUTE=n.minutes(1);static hours(t,e="UTC"){return n.minutes(t*60,e)}static HOUR=n.hours(1);static days(t,e="UTC"){return n.hours(t*24,e)}static DAY=n.days(1);static MAX=new n((1n<<63n)-1n);static MIN=new n(0);static ZERO=new n(0);static z=o.z.union([o.z.instanceof(n),o.z.object({value:o.z.bigint()}).transform(t=>new n(t.value)),o.z.string().transform(t=>new n(BigInt(t))),o.z.number().transform(t=>new n(t)),o.z.bigint().transform(t=>new n(t)),o.z.date().transform(t=>new n(t)),o.z.custom(t=>t instanceof a).transform(t=>new n(t)),nt.transform(t=>new n(t))]);static sort(t,e){return Number(t.valueOf()-e.valueOf())}}class a extends M.ValueExtension{constructor(t){typeof t=="number"&&(t=Math.trunc(t.valueOf())),super(BigInt(t.valueOf()))}static fromSeconds(t){return t instanceof a?t:t instanceof v?t.period:t instanceof n?new a(t):["number","bigint"].includes(typeof t)?a.seconds(t):new a(t)}static fromMilliseconds(t){return t instanceof a?t:t instanceof v?t.period:t instanceof n?new a(t):["number","bigint"].includes(typeof t)?a.milliseconds(t):new a(t)}valueOf(){return this.value}lessThan(t){return this.valueOf()<new a(t).valueOf()}greaterThan(t){return this.valueOf()>new a(t).valueOf()}lessThanOrEqual(t){return this.valueOf()<=new a(t).valueOf()}greaterThanOrEqual(t){return this.valueOf()>=new a(t).valueOf()}remainder(t){return G(this,t)}truncate(t){return new a(BigInt(Math.trunc(Number(this.valueOf()/t.valueOf())))*t.valueOf())}toString(){const t=this.truncate(a.DAY),e=this.truncate(a.HOUR),s=this.truncate(a.MINUTE),u=this.truncate(a.SECOND),c=this.truncate(a.MILLISECOND),f=this.truncate(a.MICROSECOND),N=this.truncate(a.NANOSECOND),g=t,y=e.sub(t),m=s.sub(e),l=u.sub(s),U=c.sub(u),A=f.sub(c),$=N.sub(f);let E="";return g.isZero||(E+=`${g.days}d `),y.isZero||(E+=`${y.hours}h `),m.isZero||(E+=`${m.minutes}m `),l.isZero||(E+=`${l.seconds}s `),U.isZero||(E+=`${U.milliseconds}ms `),A.isZero||(E+=`${A.microseconds}µs `),$.isZero||(E+=`${$.nanoseconds}ns`),E.trim()}mult(t){return new a(this.valueOf()*BigInt(t))}get days(){return Number(this.valueOf())/Number(a.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(a.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(a.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(a.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(a.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(a.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===0n}equals(t){return this.valueOf()===new a(t).valueOf()}add(t){return new a(this.valueOf()+new a(t).valueOf())}sub(t){return new a(this.valueOf()-new a(t).valueOf())}static nanoseconds(t=1){return new a(t)}static NANOSECOND=a.nanoseconds(1);static microseconds(t=1){return a.nanoseconds(O.mult(t,1e3))}static MICROSECOND=a.microseconds(1);static milliseconds(t=1){return a.microseconds(O.mult(t,1e3))}static MILLISECOND=a.milliseconds(1);static seconds(t=1){return a.milliseconds(O.mult(t,1e3))}static SECOND=a.seconds(1);static minutes(t=1){return a.seconds(O.mult(t,60))}static MINUTE=a.minutes(1);static hours(t){return a.minutes(O.mult(t,60))}static HOUR=a.hours(1);static days(t){return a.hours(O.mult(t,24))}static DAY=a.days(1);static MAX=new a((1n<<63n)-1n);static MIN=new a(0);static ZERO=new a(0);static z=o.z.union([o.z.object({value:o.z.bigint()}).transform(t=>new a(t.value)),o.z.string().transform(t=>new a(BigInt(t))),o.z.number().transform(t=>new a(t)),o.z.instanceof(a)])}class v extends M.ValueExtension{constructor(t){super(t.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(t){return this.valueOf()===new v(t).valueOf()}get period(){return a.seconds(1/this.valueOf())}sampleCount(t){return new a(t).seconds*this.valueOf()}byteCount(t,e){return this.sampleCount(t)*new d(e).valueOf()}span(t){return a.seconds(t/this.valueOf())}byteSpan(t,e){return this.span(t.valueOf()/e.valueOf())}static hz(t){return new v(t)}static khz(t){return v.hz(t*1e3)}static z=o.z.union([o.z.number().transform(t=>new v(t)),o.z.instanceof(v)])}class d extends M.ValueExtension{constructor(t){super(t.valueOf())}length(t){return t.valueOf()/this.valueOf()}size(t){return new h(t*this.valueOf())}static UNKNOWN=new d(0);static BIT128=new d(16);static BIT64=new d(8);static BIT32=new d(4);static BIT16=new d(2);static BIT8=new d(1);static z=o.z.union([o.z.number().transform(t=>new d(t)),o.z.instanceof(d)])}class b{start;end;constructor(t,e){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))}get span(){return new a(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new b(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(t,e=a.ZERO){if(e.isZero)return this.start.equals(t.start)&&this.end.equals(t.end);let s=this.start.sub(t.start).valueOf(),u=this.end.sub(t.end).valueOf();return s<0&&(s=-s),u<0&&(u=-u),s<=e.valueOf()&&u<=e.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(t,e=a.ZERO){t=t.makeValid();const s=this.makeValid();if(this.equals(t))return!0;if(t.end.equals(s.start)||s.end.equals(t.start))return!1;const u=n.max(s.start,t.start),c=n.min(s.end,t.end);return c.before(u)?!1:new a(c.sub(u)).greaterThanOrEqual(e)}contains(t){return t instanceof b?this.contains(t.start)&&this.contains(t.end):this.start.beforeEq(t)&&this.end.after(t)}boundBy(t){const e=new b(this.start,this.end);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}static max(...t){return new b(n.min(...t.map(e=>e.start)),n.max(...t.map(e=>e.end)))}static MAX=new b(n.MIN,n.MAX);static MIN=new b(n.MAX,n.MIN);static ZERO=new b(n.ZERO,n.ZERO);static z=o.z.union([o.z.object({start:n.z,end:n.z}).transform(t=>new b(t.start,t.end)),o.z.instanceof(b)]);static sort(t,e){return n.sort(t.start,e.start)||n.sort(t.end,e.end)}}class r extends M.ValueExtension{constructor(t){if(t instanceof r||typeof t=="string"||typeof t.valueOf()=="string")super(t.valueOf());else{const e=r.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);if(e==null)throw new Error(`unable to find data type for ${t.toString()}`);super(e.valueOf())}}get Array(){const t=r.ARRAY_CONSTRUCTORS.get(this.toString());if(t==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return t}equals(t){return this.valueOf()===t.valueOf()}matches(...t){return t.some(e=>this.equals(e))}toString(){return this.valueOf()}get isVariable(){return this.equals(r.JSON)||this.equals(r.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(r.UUID)}get isInteger(){const t=this.toString();return t.startsWith("int")||t.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const t=r.DENSITIES.get(this.toString());if(t==null)throw new Error(`unable to find density for ${this.valueOf()}`);return t}get isUnsignedInteger(){return this.equals(r.UINT8)||this.equals(r.UINT16)||this.equals(r.UINT32)||this.equals(r.UINT64)}get isSignedInteger(){return this.equals(r.INT8)||this.equals(r.INT16)||this.equals(r.INT32)||this.equals(r.INT64)}canSafelyCastTo(t){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}canCastTo(t){return this.isNumeric&&t.isNumeric?!0:this.equals(t)}checkArray(t){return t.constructor===this.Array}get usesBigInt(){return r.BIG_INT_TYPES.some(t=>t.equals(this))}static UNKNOWN=new r("unknown");static FLOAT64=new r("float64");static FLOAT32=new r("float32");static INT64=new r("int64");static INT32=new r("int32");static INT16=new r("int16");static INT8=new r("int8");static UINT64=new r("uint64");static UINT32=new r("uint32");static UINT16=new r("uint16");static UINT8=new r("uint8");static BOOLEAN=this.UINT8;static TIMESTAMP=new r("timestamp");static UUID=new r("uuid");static STRING=new r("string");static JSON=new r("json");static ARRAY_CONSTRUCTORS=new Map([[r.UINT8.toString(),Uint8Array],[r.UINT16.toString(),Uint16Array],[r.UINT32.toString(),Uint32Array],[r.UINT64.toString(),BigUint64Array],[r.FLOAT32.toString(),Float32Array],[r.FLOAT64.toString(),Float64Array],[r.INT8.toString(),Int8Array],[r.INT16.toString(),Int16Array],[r.INT32.toString(),Int32Array],[r.INT64.toString(),BigInt64Array],[r.TIMESTAMP.toString(),BigInt64Array],[r.STRING.toString(),Uint8Array],[r.JSON.toString(),Uint8Array],[r.UUID.toString(),Uint8Array]]);static ARRAY_CONSTRUCTOR_DATA_TYPES=new Map([[Uint8Array.name,r.UINT8],[Uint16Array.name,r.UINT16],[Uint32Array.name,r.UINT32],[BigUint64Array.name,r.UINT64],[Float32Array.name,r.FLOAT32],[Float64Array.name,r.FLOAT64],[Int8Array.name,r.INT8],[Int16Array.name,r.INT16],[Int32Array.name,r.INT32],[BigInt64Array.name,r.INT64]]);static DENSITIES=new Map([[r.UINT8.toString(),d.BIT8],[r.UINT16.toString(),d.BIT16],[r.UINT32.toString(),d.BIT32],[r.UINT64.toString(),d.BIT64],[r.FLOAT32.toString(),d.BIT32],[r.FLOAT64.toString(),d.BIT64],[r.INT8.toString(),d.BIT8],[r.INT16.toString(),d.BIT16],[r.INT32.toString(),d.BIT32],[r.INT64.toString(),d.BIT64],[r.TIMESTAMP.toString(),d.BIT64],[r.STRING.toString(),d.UNKNOWN],[r.JSON.toString(),d.UNKNOWN],[r.UUID.toString(),d.BIT128]]);static ALL=[r.UNKNOWN,r.FLOAT64,r.FLOAT32,r.INT64,r.INT32,r.INT16,r.INT8,r.UINT64,r.UINT32,r.UINT16,r.UINT8,r.TIMESTAMP,r.UUID,r.STRING,r.JSON];static BIG_INT_TYPES=[r.INT64,r.UINT64,r.TIMESTAMP];static z=o.z.union([o.z.string().transform(t=>new r(t)),o.z.instanceof(r)])}class h extends M.ValueExtension{constructor(t){super(t.valueOf())}largerThan(t){return this.valueOf()>t.valueOf()}smallerThan(t){return this.valueOf()<t.valueOf()}add(t){return h.bytes(this.valueOf()+t.valueOf())}sub(t){return h.bytes(this.valueOf()-t.valueOf())}truncate(t){return new h(Math.trunc(this.valueOf()/t.valueOf())*t.valueOf())}remainder(t){return h.bytes(this.valueOf()%t.valueOf())}get gigabytes(){return this.valueOf()/h.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/h.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/h.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/h.TERABYTE.valueOf()}toString(){const t=this.truncate(h.TERABYTE),e=this.truncate(h.GIGABYTE),s=this.truncate(h.MEGABYTE),u=this.truncate(h.KILOBYTE),c=this.truncate(h.BYTE),f=t,N=e.sub(t),g=s.sub(e),y=u.sub(s),m=c.sub(u);let l="";return f.isZero||(l+=`${f.terabytes}TB `),N.isZero||(l+=`${N.gigabytes}GB `),g.isZero||(l+=`${g.megabytes}MB `),y.isZero||(l+=`${y.kilobytes}KB `),(!m.isZero||l==="")&&(l+=`${m.valueOf()}B`),l.trim()}static bytes(t=1){return new h(t)}static BYTE=new h(1);static kilobytes(t=1){return h.bytes(t.valueOf()*1e3)}static KILOBYTE=h.kilobytes(1);static megabytes(t=1){return h.kilobytes(t.valueOf()*1e3)}static MEGABYTE=h.megabytes(1);static gigabytes(t=1){return h.megabytes(t.valueOf()*1e3)}static GIGABYTE=h.gigabytes(1);static terabytes(t){return h.gigabytes(t.valueOf()*1e3)}static TERABYTE=h.terabytes(1);static ZERO=new h(0);static z=o.z.union([o.z.number().transform(t=>new h(t)),o.z.instanceof(h)]);get isZero(){return this.valueOf()===0}}const it=o.z.union([o.z.instanceof(Uint8Array),o.z.instanceof(Uint16Array),o.z.instanceof(Uint32Array),o.z.instanceof(BigUint64Array),o.z.instanceof(Float32Array),o.z.instanceof(Float64Array),o.z.instanceof(Int8Array),o.z.instanceof(Int16Array),o.z.instanceof(Int32Array),o.z.instanceof(BigInt64Array)]),q=i=>{const t=typeof i;return t==="string"||t==="number"||t==="boolean"||t==="bigint"||i instanceof n||i instanceof a||i instanceof Date},J=(i,t,e,s=0)=>i.usesBigInt&&!t.usesBigInt?Number(e)-Number(s):!i.usesBigInt&&t.usesBigInt?BigInt(e.valueOf())-BigInt(s.valueOf()):C(e,-s),C=(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),at="00000000-0000-0000-0000-000000000000",ut=/^(?:[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;function ot(i){return typeof i=="string"&&ut.test(i)}const w=[];for(let i=0;i<256;++i)w.push((i+256).toString(16).slice(1));function j(i,t=0){return(w[i[t+0]]+w[i[t+1]]+w[i[t+2]]+w[i[t+3]]+"-"+w[i[t+4]]+w[i[t+5]]+"-"+w[i[t+6]]+w[i[t+7]]+"-"+w[i[t+8]]+w[i[t+9]]+"-"+w[i[t+10]]+w[i[t+11]]+w[i[t+12]]+w[i[t+13]]+w[i[t+14]]+w[i[t+15]]).toLowerCase()}function lt(i,t=0){const e=j(i,t);if(!ot(e))throw TypeError("Stringified UUID is invalid");return e}let x;const ct=new Uint8Array(16);function ft(){if(!x){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");x=crypto.getRandomValues.bind(crypto)}return x(ct)}const ht=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),F={randomUUID:ht};function dt(i,t,e){if(F.randomUUID&&!i)return F.randomUUID();i=i||{};const s=i.random??i.rng?.()??ft();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,j(s)}const gt=()=>dt(),z=(i,t)=>lt(i,t),Ot=at,bt=Object.freeze(Object.defineProperty({__proto__:null,ZERO:Ot,create:gt,parse:z},Symbol.toStringTag,{value:"Module"})),B=-1,S={[Symbol.iterator]:()=>S,next:()=>({done:!0,value:void 0})},wt=o.z.string().transform(i=>new Uint8Array(atob(i).split("").map(t=>t.charCodeAt(0))).buffer),It=o.z.union([o.z.null(),o.z.undefined()]).transform(()=>new Uint8Array().buffer),L=10,W=(i,t)=>{if(i==="number"&&!t.isNumeric)throw new Error(`cannot convert series of type ${t.toString()} to number`);if(i==="bigint"&&!t.usesBigInt)throw new Error(`cannot convert series of type ${t.toString()} to bigint`)},H="sy_x_telem_series";class I{key;discriminator=H;dataType;sampleOffset;gl;_data;timeRange=b.ZERO;alignment=0n;cachedMin;cachedMax;writePos=B;_refCount=0;cachedLength;_cachedIndexes;static crudeZ=o.z.object({timeRange:b.z.optional(),dataType:r.z,alignment:o.z.coerce.bigint().optional(),data:o.z.union([wt,It,o.z.instanceof(ArrayBuffer),o.z.instanceof(Uint8Array)]),glBufferUsage:rt.optional().default("static").optional()});static z=I.crudeZ.transform(t=>new I(t));constructor(t){D(t)&&(t={data:t}),t.data??=[];const{dataType:e,timeRange:s,sampleOffset:u=0,glBufferUsage:c="static",alignment:f=0n,key:N=p(),data:g}=t;if(K(g)){const l=g;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;return}const y=q(g),m=Array.isArray(g);if(e!=null)this.dataType=new r(e);else{if(g instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(m||y){let l=g;if(!y){if(g.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");l=g[0]}if(typeof l=="string")this.dataType=r.STRING;else if(typeof l=="number")this.dataType=r.FLOAT64;else if(typeof l=="bigint")this.dataType=r.INT64;else if(typeof l=="boolean")this.dataType=r.BOOLEAN;else if(l instanceof n||l instanceof Date||l instanceof n)this.dataType=r.TIMESTAMP;else if(typeof l=="object")this.dataType=r.JSON;else throw new Error(`cannot infer data type of ${typeof l} when constructing a Series from a JS array`)}else this.dataType=new r(g)}if(!m&&!y)this._data=g;else if(m&&g.length===0)this._data=new this.dataType.Array([]).buffer;else{let l=y?[g]:g;const U=l[0];(U instanceof n||U instanceof Date||U instanceof a)&&(l=l.map(A=>new n(A).valueOf())),this.dataType.equals(r.STRING)?(this.cachedLength=l.length,this._data=new TextEncoder().encode(`${l.join(`
|
|
1
|
+
"use strict";const o=require("zod"),T=require("./index-BQe8OIgm.cjs"),X=require("./index-DdhM_E4k.cjs"),M=require("./index-B1m2qvBT.cjs"),O=require("./bounds-D6e9xoHt.cjs");require("./box-Cxki783Y.cjs");require("./dimensions-D2QGoNXO.cjs");require("./base-BAM2mqCy.cjs");require("./location-DZi8ftXp.cjs");require("./scale-C6qKDbRb.cjs");require("./xy-CUE3QDNn.cjs");let Q=(i,t=21)=>(e=t)=>{let s="",u=e|0;for(;u--;)s+=i[Math.random()*i.length|0];return s};const _="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Z=11,tt=Q(_,Z),p=()=>tt(),et=Object.freeze(Object.defineProperty({__proto__:null,LENGTH:Z,create:p},Symbol.toStringTag,{value:"Module"})),k=(i,t)=>e=>e instanceof t||typeof e=="object"&&e!==null&&"discriminator"in e&&e.discriminator===i,st=Object.freeze(Object.defineProperty({__proto__:null,createMatcher:k},Symbol.toStringTag,{value:"Module"})),rt=o.z.enum(["static","dynamic"]),nt=o.z.union([o.z.tuple([o.z.int()]),o.z.tuple([o.z.int(),o.z.int().min(1).max(12)]),o.z.tuple([o.z.int(),o.z.int().min(1).max(12),o.z.int().min(1).max(31)])]),G=(i,t)=>{const e=new n(t);if(![a.DAY,a.HOUR,a.MINUTE,a.SECOND,a.MILLISECOND,a.MICROSECOND,a.NANOSECOND].some(u=>u.equals(e)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const s=i.valueOf()%e.valueOf();return i instanceof n?new n(s):new a(s)};class n extends M.ValueExtension{constructor(t,e="UTC"){if(t==null)super(n.now().valueOf());else if(t instanceof Date)super(BigInt(t.getTime())*n.MILLISECOND.valueOf());else if(typeof t=="string")super(n.parseDateTimeString(t,e).valueOf());else if(Array.isArray(t))super(n.parseDate(t));else{let s=0n;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)}}static parseDate([t=1970,e=1,s=1]){const u=new Date(t,e-1,s,0,0,0,0);return new n(BigInt(u.getTime())*n.MILLISECOND.valueOf()).truncate(n.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(t,e="UTC"){const[s,u,c]=t.split(":");let f="00",N="00";c!=null&&([f,N]=c.split("."));let g=n.hours(parseInt(s??"00")).add(n.minutes(parseInt(u??"00"))).add(n.seconds(parseInt(f??"00"))).add(n.milliseconds(parseInt(N??"00")));return e==="local"&&(g=g.add(n.utcOffset)),g.valueOf()}static parseDateTimeString(t,e="UTC"){if(!t.includes("/")&&!t.includes("-"))return n.parseTimeString(t,e);const s=new Date(t);return t.includes(":")||s.setUTCHours(0,0,0,0),new n(BigInt(s.getTime())*n.MILLISECOND.valueOf(),e).valueOf()}fString(t="ISO",e="UTC"){switch(t){case"ISODate":return this.toISOString(e).slice(0,10);case"ISOTime":return this.toISOString(e).slice(11,23);case"time":return this.timeString(!1,e);case"preciseTime":return this.timeString(!0,e);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,e)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,e)}`;default:return this.toISOString(e)}}toISOString(t="UTC"){return t==="UTC"?this.date().toISOString():this.sub(n.utcOffset).date().toISOString()}timeString(t=!1,e="UTC"){const s=this.toISOString(e);return t?s.slice(11,23):s.slice(11,19)}dateString(){const t=this.date(),e=t.toLocaleString("default",{month:"short"}),s=t.toLocaleString("default",{day:"numeric"});return`${e} ${s}`}static get utcOffset(){return new a(BigInt(new Date().getTimezoneOffset())*n.MINUTE.valueOf())}static since(t){return new n().span(t)}date(){return new Date(this.milliseconds)}equals(t){return this.valueOf()===new n(t).valueOf()}span(t){return this.range(t).span}range(t){return new b(this,t).makeValid()}spanRange(t){return this.range(this.add(t)).makeValid()}get isZero(){return this.valueOf()===0n}after(t){return this.valueOf()>new n(t).valueOf()}afterEq(t){return this.valueOf()>=new n(t).valueOf()}before(t){return this.valueOf()<new n(t).valueOf()}beforeEq(t){return this.valueOf()<=new n(t).valueOf()}add(t){return new n(this.valueOf()+BigInt(t.valueOf()))}sub(t){return new n(this.valueOf()-BigInt(t.valueOf()))}get hours(){return Number(this.valueOf())/Number(a.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(a.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(a.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(a.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(n.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(n.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getUTCFullYear()}setYear(t){const e=this.date();return e.setUTCFullYear(t),new n(e)}get month(){return this.date().getUTCMonth()}setMonth(t){const e=this.date();return e.setUTCMonth(t),new n(e)}get day(){return this.date().getUTCDate()}setDay(t){const e=this.date();return e.setUTCDate(t),new n(e)}get hour(){return this.date().getUTCHours()}setHour(t){const e=this.date();return e.setUTCHours(t),new n(e,"UTC")}get minute(){return this.date().getUTCMinutes()}setMinute(t){const e=this.date();return e.setUTCMinutes(t),new n(e)}get second(){return this.date().getUTCSeconds()}setSecond(t){const e=this.date();return e.setUTCSeconds(t),new n(e)}get millisecond(){return this.date().getUTCMilliseconds()}setMillisecond(t){const e=this.date();return e.setUTCMilliseconds(t),new n(e)}toString(){return this.date().toISOString()}remainder(t){return G(this,t)}get isToday(){return this.truncate(a.DAY).equals(n.now().truncate(a.DAY))}truncate(t){return this.sub(this.remainder(t))}static now(){return new n(new Date)}static max(...t){let e=n.MIN;for(const s of t){const u=new n(s);u.after(e)&&(e=u)}return e}static min(...t){let e=n.MAX;for(const s of t){const u=new n(s);u.before(e)&&(e=u)}return e}static nanoseconds(t,e="UTC"){return new n(t,e)}static NANOSECOND=n.nanoseconds(1);static microseconds(t,e="UTC"){return n.nanoseconds(t*1e3,e)}static MICROSECOND=n.microseconds(1);static milliseconds(t,e="UTC"){return n.microseconds(t*1e3,e)}static MILLISECOND=n.milliseconds(1);static seconds(t,e="UTC"){return n.milliseconds(t*1e3,e)}static SECOND=n.seconds(1);static minutes(t,e="UTC"){return n.seconds(t*60,e)}static MINUTE=n.minutes(1);static hours(t,e="UTC"){return n.minutes(t*60,e)}static HOUR=n.hours(1);static days(t,e="UTC"){return n.hours(t*24,e)}static DAY=n.days(1);static MAX=new n((1n<<63n)-1n);static MIN=new n(0);static ZERO=new n(0);static z=o.z.union([o.z.instanceof(n),o.z.object({value:o.z.bigint()}).transform(t=>new n(t.value)),o.z.string().transform(t=>new n(BigInt(t))),o.z.number().transform(t=>new n(t)),o.z.bigint().transform(t=>new n(t)),o.z.date().transform(t=>new n(t)),o.z.custom(t=>t instanceof a).transform(t=>new n(t)),nt.transform(t=>new n(t))]);static sort(t,e){return Number(t.valueOf()-e.valueOf())}}class a extends M.ValueExtension{constructor(t){typeof t=="number"&&(t=Math.trunc(t.valueOf())),super(BigInt(t.valueOf()))}static fromSeconds(t){return t instanceof a?t:t instanceof v?t.period:t instanceof n?new a(t):["number","bigint"].includes(typeof t)?a.seconds(t):new a(t)}static fromMilliseconds(t){return t instanceof a?t:t instanceof v?t.period:t instanceof n?new a(t):["number","bigint"].includes(typeof t)?a.milliseconds(t):new a(t)}valueOf(){return this.value}lessThan(t){return this.valueOf()<new a(t).valueOf()}greaterThan(t){return this.valueOf()>new a(t).valueOf()}lessThanOrEqual(t){return this.valueOf()<=new a(t).valueOf()}greaterThanOrEqual(t){return this.valueOf()>=new a(t).valueOf()}remainder(t){return G(this,t)}truncate(t){return new a(BigInt(Math.trunc(Number(this.valueOf()/t.valueOf())))*t.valueOf())}toString(){const t=this.truncate(a.DAY),e=this.truncate(a.HOUR),s=this.truncate(a.MINUTE),u=this.truncate(a.SECOND),c=this.truncate(a.MILLISECOND),f=this.truncate(a.MICROSECOND),N=this.truncate(a.NANOSECOND),g=t,y=e.sub(t),m=s.sub(e),l=u.sub(s),U=c.sub(u),A=f.sub(c),$=N.sub(f);let E="";return g.isZero||(E+=`${g.days}d `),y.isZero||(E+=`${y.hours}h `),m.isZero||(E+=`${m.minutes}m `),l.isZero||(E+=`${l.seconds}s `),U.isZero||(E+=`${U.milliseconds}ms `),A.isZero||(E+=`${A.microseconds}µs `),$.isZero||(E+=`${$.nanoseconds}ns`),E.trim()}mult(t){return new a(this.valueOf()*BigInt(t))}get days(){return Number(this.valueOf())/Number(a.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(a.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(a.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(a.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(a.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(a.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===0n}equals(t){return this.valueOf()===new a(t).valueOf()}add(t){return new a(this.valueOf()+new a(t).valueOf())}sub(t){return new a(this.valueOf()-new a(t).valueOf())}static nanoseconds(t=1){return new a(t)}static NANOSECOND=a.nanoseconds(1);static microseconds(t=1){return a.nanoseconds(O.mult(t,1e3))}static MICROSECOND=a.microseconds(1);static milliseconds(t=1){return a.microseconds(O.mult(t,1e3))}static MILLISECOND=a.milliseconds(1);static seconds(t=1){return a.milliseconds(O.mult(t,1e3))}static SECOND=a.seconds(1);static minutes(t=1){return a.seconds(O.mult(t,60))}static MINUTE=a.minutes(1);static hours(t){return a.minutes(O.mult(t,60))}static HOUR=a.hours(1);static days(t){return a.hours(O.mult(t,24))}static DAY=a.days(1);static MAX=new a((1n<<63n)-1n);static MIN=new a(0);static ZERO=new a(0);static z=o.z.union([o.z.object({value:o.z.bigint()}).transform(t=>new a(t.value)),o.z.string().transform(t=>new a(BigInt(t))),o.z.number().transform(t=>new a(t)),o.z.instanceof(a)])}class v extends M.ValueExtension{constructor(t){super(t.valueOf())}toString(){return`${this.valueOf()} Hz`}equals(t){return this.valueOf()===new v(t).valueOf()}get period(){return a.seconds(1/this.valueOf())}sampleCount(t){return new a(t).seconds*this.valueOf()}byteCount(t,e){return this.sampleCount(t)*new d(e).valueOf()}span(t){return a.seconds(t/this.valueOf())}byteSpan(t,e){return this.span(t.valueOf()/e.valueOf())}static hz(t){return new v(t)}static khz(t){return v.hz(t*1e3)}static z=o.z.union([o.z.number().transform(t=>new v(t)),o.z.instanceof(v)])}class d extends M.ValueExtension{constructor(t){super(t.valueOf())}length(t){return t.valueOf()/this.valueOf()}size(t){return new h(t*this.valueOf())}static UNKNOWN=new d(0);static BIT128=new d(16);static BIT64=new d(8);static BIT32=new d(4);static BIT16=new d(2);static BIT8=new d(1);static z=o.z.union([o.z.number().transform(t=>new d(t)),o.z.instanceof(d)])}class b{start;end;constructor(t,e){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))}get span(){return new a(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new b(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(t,e=a.ZERO){if(e.isZero)return this.start.equals(t.start)&&this.end.equals(t.end);let s=this.start.sub(t.start).valueOf(),u=this.end.sub(t.end).valueOf();return s<0&&(s=-s),u<0&&(u=-u),s<=e.valueOf()&&u<=e.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(t,e=a.ZERO){t=t.makeValid();const s=this.makeValid();if(this.equals(t))return!0;if(t.end.equals(s.start)||s.end.equals(t.start))return!1;const u=n.max(s.start,t.start),c=n.min(s.end,t.end);return c.before(u)?!1:new a(c.sub(u)).greaterThanOrEqual(e)}contains(t){return t instanceof b?this.contains(t.start)&&this.contains(t.end):this.start.beforeEq(t)&&this.end.after(t)}boundBy(t){const e=new b(this.start,this.end);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}static max(...t){return new b(n.min(...t.map(e=>e.start)),n.max(...t.map(e=>e.end)))}static MAX=new b(n.MIN,n.MAX);static MIN=new b(n.MAX,n.MIN);static ZERO=new b(n.ZERO,n.ZERO);static z=o.z.union([o.z.object({start:n.z,end:n.z}).transform(t=>new b(t.start,t.end)),o.z.instanceof(b)]);static sort(t,e){return n.sort(t.start,e.start)||n.sort(t.end,e.end)}}class r extends M.ValueExtension{constructor(t){if(t instanceof r||typeof t=="string"||typeof t.valueOf()=="string")super(t.valueOf());else{const e=r.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);if(e==null)throw new Error(`unable to find data type for ${t.toString()}`);super(e.valueOf())}}get Array(){const t=r.ARRAY_CONSTRUCTORS.get(this.toString());if(t==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return t}equals(t){return this.valueOf()===t.valueOf()}matches(...t){return t.some(e=>this.equals(e))}toString(){return this.valueOf()}get isVariable(){return this.equals(r.JSON)||this.equals(r.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(r.UUID)}get isInteger(){const t=this.toString();return t.startsWith("int")||t.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const t=r.DENSITIES.get(this.toString());if(t==null)throw new Error(`unable to find density for ${this.valueOf()}`);return t}get isUnsignedInteger(){return this.equals(r.UINT8)||this.equals(r.UINT16)||this.equals(r.UINT32)||this.equals(r.UINT64)}get isSignedInteger(){return this.equals(r.INT8)||this.equals(r.INT16)||this.equals(r.INT32)||this.equals(r.INT64)}canSafelyCastTo(t){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}canCastTo(t){return this.isNumeric&&t.isNumeric?!0:this.equals(t)}checkArray(t){return t.constructor===this.Array}get usesBigInt(){return r.BIG_INT_TYPES.some(t=>t.equals(this))}static UNKNOWN=new r("unknown");static FLOAT64=new r("float64");static FLOAT32=new r("float32");static INT64=new r("int64");static INT32=new r("int32");static INT16=new r("int16");static INT8=new r("int8");static UINT64=new r("uint64");static UINT32=new r("uint32");static UINT16=new r("uint16");static UINT8=new r("uint8");static BOOLEAN=this.UINT8;static TIMESTAMP=new r("timestamp");static UUID=new r("uuid");static STRING=new r("string");static JSON=new r("json");static ARRAY_CONSTRUCTORS=new Map([[r.UINT8.toString(),Uint8Array],[r.UINT16.toString(),Uint16Array],[r.UINT32.toString(),Uint32Array],[r.UINT64.toString(),BigUint64Array],[r.FLOAT32.toString(),Float32Array],[r.FLOAT64.toString(),Float64Array],[r.INT8.toString(),Int8Array],[r.INT16.toString(),Int16Array],[r.INT32.toString(),Int32Array],[r.INT64.toString(),BigInt64Array],[r.TIMESTAMP.toString(),BigInt64Array],[r.STRING.toString(),Uint8Array],[r.JSON.toString(),Uint8Array],[r.UUID.toString(),Uint8Array]]);static ARRAY_CONSTRUCTOR_DATA_TYPES=new Map([[Uint8Array.name,r.UINT8],[Uint16Array.name,r.UINT16],[Uint32Array.name,r.UINT32],[BigUint64Array.name,r.UINT64],[Float32Array.name,r.FLOAT32],[Float64Array.name,r.FLOAT64],[Int8Array.name,r.INT8],[Int16Array.name,r.INT16],[Int32Array.name,r.INT32],[BigInt64Array.name,r.INT64]]);static DENSITIES=new Map([[r.UINT8.toString(),d.BIT8],[r.UINT16.toString(),d.BIT16],[r.UINT32.toString(),d.BIT32],[r.UINT64.toString(),d.BIT64],[r.FLOAT32.toString(),d.BIT32],[r.FLOAT64.toString(),d.BIT64],[r.INT8.toString(),d.BIT8],[r.INT16.toString(),d.BIT16],[r.INT32.toString(),d.BIT32],[r.INT64.toString(),d.BIT64],[r.TIMESTAMP.toString(),d.BIT64],[r.STRING.toString(),d.UNKNOWN],[r.JSON.toString(),d.UNKNOWN],[r.UUID.toString(),d.BIT128]]);static ALL=[r.UNKNOWN,r.FLOAT64,r.FLOAT32,r.INT64,r.INT32,r.INT16,r.INT8,r.UINT64,r.UINT32,r.UINT16,r.UINT8,r.TIMESTAMP,r.UUID,r.STRING,r.JSON];static BIG_INT_TYPES=[r.INT64,r.UINT64,r.TIMESTAMP];static z=o.z.union([o.z.string().transform(t=>new r(t)),o.z.instanceof(r)])}class h extends M.ValueExtension{constructor(t){super(t.valueOf())}largerThan(t){return this.valueOf()>t.valueOf()}smallerThan(t){return this.valueOf()<t.valueOf()}add(t){return h.bytes(this.valueOf()+t.valueOf())}sub(t){return h.bytes(this.valueOf()-t.valueOf())}truncate(t){return new h(Math.trunc(this.valueOf()/t.valueOf())*t.valueOf())}remainder(t){return h.bytes(this.valueOf()%t.valueOf())}get gigabytes(){return this.valueOf()/h.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/h.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/h.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/h.TERABYTE.valueOf()}toString(){const t=this.truncate(h.TERABYTE),e=this.truncate(h.GIGABYTE),s=this.truncate(h.MEGABYTE),u=this.truncate(h.KILOBYTE),c=this.truncate(h.BYTE),f=t,N=e.sub(t),g=s.sub(e),y=u.sub(s),m=c.sub(u);let l="";return f.isZero||(l+=`${f.terabytes}TB `),N.isZero||(l+=`${N.gigabytes}GB `),g.isZero||(l+=`${g.megabytes}MB `),y.isZero||(l+=`${y.kilobytes}KB `),(!m.isZero||l==="")&&(l+=`${m.valueOf()}B`),l.trim()}static bytes(t=1){return new h(t)}static BYTE=new h(1);static kilobytes(t=1){return h.bytes(t.valueOf()*1e3)}static KILOBYTE=h.kilobytes(1);static megabytes(t=1){return h.kilobytes(t.valueOf()*1e3)}static MEGABYTE=h.megabytes(1);static gigabytes(t=1){return h.megabytes(t.valueOf()*1e3)}static GIGABYTE=h.gigabytes(1);static terabytes(t){return h.gigabytes(t.valueOf()*1e3)}static TERABYTE=h.terabytes(1);static ZERO=new h(0);static z=o.z.union([o.z.number().transform(t=>new h(t)),o.z.instanceof(h)]);get isZero(){return this.valueOf()===0}}const it=o.z.union([o.z.instanceof(Uint8Array),o.z.instanceof(Uint16Array),o.z.instanceof(Uint32Array),o.z.instanceof(BigUint64Array),o.z.instanceof(Float32Array),o.z.instanceof(Float64Array),o.z.instanceof(Int8Array),o.z.instanceof(Int16Array),o.z.instanceof(Int32Array),o.z.instanceof(BigInt64Array)]),q=i=>{const t=typeof i;return t==="string"||t==="number"||t==="boolean"||t==="bigint"||i instanceof n||i instanceof a||i instanceof Date},J=(i,t,e,s=0)=>i.usesBigInt&&!t.usesBigInt?Number(e)-Number(s):!i.usesBigInt&&t.usesBigInt?BigInt(e.valueOf())-BigInt(s.valueOf()):C(e,-s),C=(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),at="00000000-0000-0000-0000-000000000000",ut=/^(?:[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;function ot(i){return typeof i=="string"&&ut.test(i)}const w=[];for(let i=0;i<256;++i)w.push((i+256).toString(16).slice(1));function j(i,t=0){return(w[i[t+0]]+w[i[t+1]]+w[i[t+2]]+w[i[t+3]]+"-"+w[i[t+4]]+w[i[t+5]]+"-"+w[i[t+6]]+w[i[t+7]]+"-"+w[i[t+8]]+w[i[t+9]]+"-"+w[i[t+10]]+w[i[t+11]]+w[i[t+12]]+w[i[t+13]]+w[i[t+14]]+w[i[t+15]]).toLowerCase()}function lt(i,t=0){const e=j(i,t);if(!ot(e))throw TypeError("Stringified UUID is invalid");return e}let x;const ct=new Uint8Array(16);function ft(){if(!x){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");x=crypto.getRandomValues.bind(crypto)}return x(ct)}const ht=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),F={randomUUID:ht};function dt(i,t,e){if(F.randomUUID&&!i)return F.randomUUID();i=i||{};const s=i.random??i.rng?.()??ft();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,j(s)}const gt=()=>dt(),z=(i,t)=>lt(i,t),Ot=at,bt=Object.freeze(Object.defineProperty({__proto__:null,ZERO:Ot,create:gt,parse:z},Symbol.toStringTag,{value:"Module"})),B=-1,S={[Symbol.iterator]:()=>S,next:()=>({done:!0,value:void 0})},wt=o.z.string().transform(i=>new Uint8Array(atob(i).split("").map(t=>t.charCodeAt(0))).buffer),It=o.z.union([o.z.null(),o.z.undefined()]).transform(()=>new Uint8Array().buffer),L=10,W=(i,t)=>{if(i==="number"&&!t.isNumeric)throw new Error(`cannot convert series of type ${t.toString()} to number`);if(i==="bigint"&&!t.usesBigInt)throw new Error(`cannot convert series of type ${t.toString()} to bigint`)},H="sy_x_telem_series";class I{key;discriminator=H;dataType;sampleOffset;gl;_data;timeRange=b.ZERO;alignment=0n;cachedMin;cachedMax;writePos=B;_refCount=0;cachedLength;_cachedIndexes;static crudeZ=o.z.object({timeRange:b.z.optional(),dataType:r.z,alignment:o.z.coerce.bigint().optional(),data:o.z.union([wt,It,o.z.instanceof(ArrayBuffer),o.z.instanceof(Uint8Array)]),glBufferUsage:rt.optional().default("static").optional()});static z=I.crudeZ.transform(t=>new I(t));constructor(t){D(t)&&(t={data:t}),t.data??=[];const{dataType:e,timeRange:s,sampleOffset:u=0,glBufferUsage:c="static",alignment:f=0n,key:N=p(),data:g}=t;if(K(g)){const l=g;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;return}const y=q(g),m=Array.isArray(g);if(e!=null)this.dataType=new r(e);else{if(g instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(m||y){let l=g;if(!y){if(g.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");l=g[0]}if(typeof l=="string")this.dataType=r.STRING;else if(typeof l=="number")this.dataType=r.FLOAT64;else if(typeof l=="bigint")this.dataType=r.INT64;else if(typeof l=="boolean")this.dataType=r.BOOLEAN;else if(l instanceof n||l instanceof Date||l instanceof n)this.dataType=r.TIMESTAMP;else if(typeof l=="object")this.dataType=r.JSON;else throw new Error(`cannot infer data type of ${typeof l} when constructing a Series from a JS array`)}else this.dataType=new r(g)}if(!m&&!y)this._data=g;else if(m&&g.length===0)this._data=new this.dataType.Array([]).buffer;else{let l=y?[g]:g;const U=l[0];(U instanceof n||U instanceof Date||U instanceof a)&&(l=l.map(A=>new n(A).valueOf())),this.dataType.equals(r.STRING)?(this.cachedLength=l.length,this._data=new TextEncoder().encode(`${l.join(`
|
|
2
2
|
`)}
|
|
3
3
|
`).buffer):this.dataType.equals(r.JSON)?(this.cachedLength=l.length,this._data=new TextEncoder().encode(`${l.map(A=>T.JSON_CODEC.encodeString(A)).join(`
|
|
4
4
|
`)}
|