@synnaxlabs/x 0.46.0 → 0.46.2

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/dist/index.js CHANGED
@@ -1,79 +1,106 @@
1
- import { n as we } from "./external-Du5qzfYv.js";
2
- import { e as Qr } from "./external-Du5qzfYv.js";
3
- import { J as ve } from "./index-yz34Wc2p.js";
4
- import { c as Kr } from "./index-yz34Wc2p.js";
5
- import h, { z as i } from "zod";
6
- import { h as Se, j as Me, k as xe, l as Te, m as $e, o as je, p as Ee, q as Ne, r as Ie, s as Oe, u as ke, v as Ae, w as Pe, x as Ze, y as Re, a as _, T as F, z as Ce } from "./series-Clbw-fZI.js";
7
- import { c as tn, D as rn, M as nn, R as sn, S as on, d as an, b as cn, g as ln, f as un, A as fn, B as dn, i as hn, e as pn, n as gn, t as mn, C as bn } from "./series-Clbw-fZI.js";
8
- import { a as yn } from "./index-qmkoZBNO.js";
9
- import { c as vn } from "./change-DLl6DccR.js";
10
- import { c as Mn, s as xn } from "./scale-BBWhTUqJ.js";
11
- import { a as Le, b as Ue, c as qe, L as Z, G as R, E as We } from "./index-C452Pas0.js";
12
- import { d as $n, p as jn } from "./index-C452Pas0.js";
13
- import { debounce as Nn, throttle as In } from "./debounce.js";
14
- import { deep as kn } from "./deep.js";
15
- import { isObject as Pn } from "./identity.js";
16
- import { e as Rn } from "./external-BYuXBYJh.js";
17
- import { link as Ln } from "./link.js";
18
- import { i as ze, j as De, a as Be, k as Ve, d as Fe, l as Xe, n as He, o as Je, p as Ge, m as Qe, r as Ye, s as Ke } from "./bounds-DeUXrllt.js";
19
- import { b as qn } from "./bounds-DeUXrllt.js";
20
- import { observe as zn } from "./observe.js";
21
- import { r as Bn } from "./record-tSFQKmdG.js";
22
- import { e as Fn } from "./external-B80i4ymZ.js";
23
- import { b as Hn } from "./box-BXWXSkKu.js";
24
- import { d as Gn } from "./dimensions-DC0uLPwn.js";
25
- import { d as Yn } from "./direction-C_b4tfRN.js";
26
- import { l as es } from "./location-BIzpxczO.js";
27
- import { s as rs } from "./spatial-DnsaOypA.js";
28
- import { x as ss } from "./xy-DnrCAZaw.js";
29
- import { u as is } from "./index-D4NCYiQB.js";
30
- import { URL as cs, buildQueryString as ls } from "./url.js";
31
- import { RoutedWorker as fs, TypedWorker as ds, createMockWorkers as hs } from "./worker.js";
32
- import { e as gs } from "./external-2YWy569j.js";
33
- const et = 2, tt = 3, rt = 2, nt = (e, t) => {
1
+ import { n as xe } from "./external-Du5qzfYv.js";
2
+ import { e as tn } from "./external-Du5qzfYv.js";
3
+ import { J as Te } from "./index-yz34Wc2p.js";
4
+ import { c as nn } from "./index-yz34Wc2p.js";
5
+ import h, { z as a } from "zod";
6
+ import { h as $e, j as je, k as Ne, l as Ee, m as Ie, o as Oe, p as Ae, q as ke, r as Pe, s as Re, u as Ze, v as Ce, w as Le, x as Ue, y as qe, a as _, T as X, z as We } from "./series-Clbw-fZI.js";
7
+ import { c as on, D as an, M as cn, R as ln, S as un, d as fn, b as dn, g as hn, f as mn, A as pn, B as gn, i as bn, e as _n, n as yn, t as wn, C as Mn } from "./series-Clbw-fZI.js";
8
+ import { a as vn } from "./index-qmkoZBNO.js";
9
+ import { c as Tn } from "./change-DLl6DccR.js";
10
+ import { c as jn, s as Nn } from "./scale-BBWhTUqJ.js";
11
+ import { a as ze, b as De, c as Be, L as R, G as Z, E as Fe } from "./index-C452Pas0.js";
12
+ import { d as In, p as On } from "./index-C452Pas0.js";
13
+ import { debounce as kn, throttle as Pn } from "./debounce.js";
14
+ import { deep as Zn } from "./deep.js";
15
+ import { isObject as Ln } from "./identity.js";
16
+ import { e as qn } from "./external-BYuXBYJh.js";
17
+ import { link as zn } from "./link.js";
18
+ import { i as G, j as Ve, a as He, k as Xe, d as Ge, l as Je, n as Qe, o as Ye, p as Ke, m as et, r as tt, s as rt } from "./bounds-DeUXrllt.js";
19
+ import { b as Bn } from "./bounds-DeUXrllt.js";
20
+ import { observe as Vn } from "./observe.js";
21
+ import { r as Xn } from "./record-tSFQKmdG.js";
22
+ import { e as Jn } from "./external-B80i4ymZ.js";
23
+ import { b as Yn } from "./box-BXWXSkKu.js";
24
+ import { d as es } from "./dimensions-DC0uLPwn.js";
25
+ import { d as rs } from "./direction-C_b4tfRN.js";
26
+ import { l as ss } from "./location-BIzpxczO.js";
27
+ import { s as is } from "./spatial-DnsaOypA.js";
28
+ import { x as cs } from "./xy-DnrCAZaw.js";
29
+ import { u as us } from "./index-D4NCYiQB.js";
30
+ import { URL as ds, buildQueryString as hs } from "./url.js";
31
+ import { RoutedWorker as ps, TypedWorker as gs, createMockWorkers as bs } from "./worker.js";
32
+ import { e as ys } from "./external-2YWy569j.js";
33
+ const L = 2, U = 3, J = 2, nt = (e, t) => {
34
34
  if (Number.isNaN(e) || !Number.isFinite(e)) return e;
35
- const r = ze(t);
35
+ const r = G(t);
36
36
  if (r == 0) return e;
37
37
  let n;
38
- r >= 1e3 ? n = et : r >= 1 ? n = tt : n = Math.ceil(-Math.log10(r)) + rt;
38
+ r >= 1e3 ? n = L : r >= 1 ? n = U : n = Math.ceil(-Math.log10(r)) + J;
39
39
  const s = 10 ** n;
40
40
  return Math.round(e * s) / s;
41
- }, Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
41
+ }, st = 5, ot = 1e-10, it = (e, t) => {
42
+ if (Number.isNaN(e) || !Number.isFinite(e)) return e;
43
+ const r = Math.abs(e);
44
+ if (r === 0) return 0;
45
+ let n = !1, s = 0;
46
+ if (t != null) {
47
+ s = G(t);
48
+ const i = s / r;
49
+ n = s > 0 && i > ot;
50
+ }
51
+ if (n) {
52
+ let i;
53
+ s >= 1e3 ? i = L : s >= 1 ? i = U : i = Math.ceil(-Math.log10(s)) + J;
54
+ const l = 10 ** i;
55
+ return Math.round(e * l) / l;
56
+ }
57
+ if (r >= 1e3) {
58
+ const i = 10 ** L;
59
+ return Math.round(e * i) / i;
60
+ }
61
+ if (r >= 1) {
62
+ const i = 10 ** U;
63
+ return Math.round(e * i) / i;
64
+ }
65
+ const o = Math.floor(Math.log10(r)), f = 10 ** (st - o - 1);
66
+ return Math.round(e * f) / f;
67
+ }, kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
42
68
  __proto__: null,
43
- MAX_INT16: Se,
44
- MAX_INT32: Me,
45
- MAX_INT64: xe,
46
- MAX_INT64_NUMBER: Te,
47
- MAX_INT8: $e,
48
- MAX_UINT16: je,
49
- MAX_UINT32: Ee,
50
- MAX_UINT64: Ne,
51
- MAX_UINT64_NUMBER: Ie,
52
- MAX_UINT8: Oe,
53
- MIN_INT16: ke,
54
- MIN_INT32: Ae,
55
- MIN_INT64: Pe,
56
- MIN_INT64_NUMBER: Ze,
57
- MIN_INT8: Re,
58
- abs: De,
59
- add: Be,
60
- closeTo: Ve,
61
- div: Fe,
62
- equal: Xe,
63
- isInteger: He,
64
- max: Je,
65
- min: Ge,
66
- mult: Qe,
69
+ MAX_INT16: $e,
70
+ MAX_INT32: je,
71
+ MAX_INT64: Ne,
72
+ MAX_INT64_NUMBER: Ee,
73
+ MAX_INT8: Ie,
74
+ MAX_UINT16: Oe,
75
+ MAX_UINT32: Ae,
76
+ MAX_UINT64: ke,
77
+ MAX_UINT64_NUMBER: Pe,
78
+ MAX_UINT8: Re,
79
+ MIN_INT16: Ze,
80
+ MIN_INT32: Ce,
81
+ MIN_INT64: Le,
82
+ MIN_INT64_NUMBER: Ue,
83
+ MIN_INT8: qe,
84
+ abs: Ve,
85
+ add: He,
86
+ closeTo: Xe,
87
+ div: Ge,
88
+ equal: Je,
89
+ isInteger: Qe,
90
+ max: Ye,
91
+ min: Ke,
92
+ mult: et,
67
93
  roundBySpan: nt,
68
- roundToNearestMagnitude: Ye,
69
- sub: Ke
70
- }, Symbol.toStringTag, { value: "Module" })), X = async (e) => await new Promise(
94
+ roundToNearestMagnitude: tt,
95
+ smartRound: it,
96
+ sub: rt
97
+ }, Symbol.toStringTag, { value: "Module" })), Q = async (e) => await new Promise(
71
98
  (t) => setTimeout(t, _.fromMilliseconds(e).milliseconds)
72
- ), Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
99
+ ), Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
73
100
  __proto__: null,
74
- sleep: X
101
+ sleep: Q
75
102
  }, Symbol.toStringTag, { value: "Module" }));
76
- class st {
103
+ class at {
77
104
  config;
78
105
  retries;
79
106
  interval;
@@ -82,7 +109,7 @@ class st {
82
109
  baseInterval: new _(t?.baseInterval ?? _.seconds(1)),
83
110
  maxRetries: t?.maxRetries ?? 5,
84
111
  scale: t?.scale ?? 1,
85
- sleepFn: t?.sleepFn ?? X
112
+ sleepFn: t?.sleepFn ?? Q
86
113
  }, this.retries = 0, this.interval = new _(this.config.baseInterval);
87
114
  }
88
115
  async wait() {
@@ -96,73 +123,73 @@ class st {
96
123
  this.retries = 0, this.interval = this.config.baseInterval;
97
124
  }
98
125
  }
99
- const ot = i.object({
126
+ const ct = a.object({
100
127
  baseInterval: _.z.optional(),
101
- maxRetries: i.number().optional(),
102
- scale: i.number().optional()
103
- }), Or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
128
+ maxRetries: a.number().optional(),
129
+ scale: a.number().optional()
130
+ }), Rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
104
131
  __proto__: null,
105
- Breaker: st,
106
- breakerConfigZ: ot
107
- }, Symbol.toStringTag, { value: "Module" })), it = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, I = i.string().regex(it), m = i.number().min(0).max(255), H = i.number().min(0).max(1), O = i.tuple([m, m, m, H]), at = i.tuple([m, m, m]), ct = i.object({ rgba255: O }), lt = i.number().min(0).max(360), ut = i.number().min(0).max(100), ft = i.number().min(0).max(100), J = i.tuple([lt, ut, ft, H]), k = i.union([I, at, O, J, ct]), A = k.transform((e) => d(e)), dt = (e) => A.safeParse(e).success, ht = (e) => O.safeParse(e).success, pt = ((e) => {
132
+ Breaker: at,
133
+ breakerConfigZ: ct
134
+ }, Symbol.toStringTag, { value: "Module" })), lt = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, I = a.string().regex(lt), g = a.number().min(0).max(255), Y = a.number().min(0).max(1), O = a.tuple([g, g, g, Y]), ut = a.tuple([g, g, g]), ft = a.object({ rgba255: O }), dt = a.number().min(0).max(360), ht = a.number().min(0).max(100), mt = a.number().min(0).max(100), K = a.tuple([dt, ht, mt, Y]), A = a.union([I, ut, O, K, ft]), k = A.transform((e) => d(e)), pt = (e) => k.safeParse(e).success, gt = (e) => O.safeParse(e).success, bt = ((e) => {
108
135
  if (e == null) return;
109
- const t = A.safeParse(e);
110
- if (t.success) return Q(t.data);
136
+ const t = k.safeParse(e);
137
+ if (t.success) return te(t.data);
111
138
  if (typeof e == "string") return e;
112
139
  throw t.error;
113
140
  }), d = (e, t = 1) => {
114
- if (e = k.parse(e), typeof e == "string") return N(e, t);
141
+ if (e = A.parse(e), typeof e == "string") return E(e, t);
115
142
  if (Array.isArray(e)) {
116
143
  if (e.length < 3 || e.length > 4)
117
144
  throw new Error(`Invalid color: [${e.join(", ")}]`);
118
145
  return e.length === 3 ? [...e, t] : e;
119
146
  }
120
147
  return e.rgba255;
121
- }, G = (e, t) => {
148
+ }, ee = (e, t) => {
122
149
  if (e == null || t == null) return e == t;
123
150
  const r = d(e), n = d(t);
124
151
  return r.every((s, o) => s === n[o]);
125
- }, gt = ((e) => {
152
+ }, _t = ((e) => {
126
153
  if (e == null) return;
127
154
  const [t, r, n, s] = d(e);
128
155
  return `#${j(t)}${j(r)}${j(n)}${s === 1 ? "" : j(s * 255)}`;
129
- }), Q = (e) => {
156
+ }), te = (e) => {
130
157
  const [t, r, n, s] = d(e);
131
158
  return `rgba(${t}, ${r}, ${n}, ${s})`;
132
- }, mt = (e) => `rgb(${Y(e)})`, Y = (e) => {
159
+ }, yt = (e) => `rgb(${re(e)})`, re = (e) => {
133
160
  const [t, r, n] = d(e);
134
161
  return `${t}, ${r}, ${n}`;
135
- }, bt = (e) => [...z(e), S(e)], z = (e) => [
162
+ }, wt = (e) => [...B(e), S(e)], B = (e) => [
136
163
  y(e) / 255,
137
164
  w(e) / 255,
138
- v(e) / 255
139
- ], y = (e) => d(e)[0], w = (e) => d(e)[1], v = (e) => d(e)[2], S = (e) => d(e)[3], _t = (e) => G(D, e), yt = (e) => Et(d(e)), wt = (e, t) => {
165
+ M(e) / 255
166
+ ], y = (e) => d(e)[0], w = (e) => d(e)[1], M = (e) => d(e)[2], S = (e) => d(e)[3], Mt = (e) => ee(F, e), St = (e) => Ot(d(e)), vt = (e, t) => {
140
167
  const [r, n, s] = d(e);
141
168
  if (t > 100)
142
169
  throw new Error(`Color opacity must be between 0 and 100, got ${t}`);
143
170
  return t > 1 && (t /= 100), [r, n, s, t];
144
- }, M = (e) => {
145
- const [t, r, n] = z(e).map(
171
+ }, v = (e) => {
172
+ const [t, r, n] = B(e).map(
146
173
  (s) => s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4
147
174
  );
148
175
  return Number((0.2126 * t + 0.7152 * r + 0.0722 * n).toFixed(3));
149
- }, vt = (e) => {
150
- const [t, r, n] = z(e);
176
+ }, xt = (e) => {
177
+ const [t, r, n] = B(e);
151
178
  return 1 - (Math.max(t, r, n) - Math.min(t, r, n));
152
- }, L = (e, t) => {
153
- const r = d(e), n = d(t), s = M(r), o = M(n);
179
+ }, q = (e, t) => {
180
+ const r = d(e), n = d(t), s = v(r), o = v(n);
154
181
  return (Math.max(s, o) + 0.5) / (Math.min(s, o) + 0.5);
155
- }, St = (e, ...t) => {
182
+ }, Tt = (e, ...t) => {
156
183
  if (t.length === 0)
157
184
  throw new Error("[Color.pickByContrast] - must provide at least one color");
158
- const r = d(e), [n] = t.sort((s, o) => L(r, o) - L(r, s));
185
+ const r = d(e), [n] = t.sort((s, o) => q(r, o) - q(r, s));
159
186
  return d(n);
160
- }, Mt = (e) => M(e) < 0.5, xt = (e) => M(e) > 0.5, N = (e, t = 1) => (e = I.parse(e), e = Tt(e), [
161
- E(e, 0),
162
- E(e, 2),
163
- E(e, 4),
164
- e.length === 8 ? E(e, 6) / 255 : t
165
- ]), D = [0, 0, 0, 0], j = (e) => Math.floor(e).toString(16).padStart(2, "0"), E = (e, t) => parseInt(e.slice(t, t + 2), 16), Tt = (e) => e.startsWith("#") ? e.slice(1) : e, V = {
187
+ }, $t = (e) => v(e) < 0.5, jt = (e) => v(e) > 0.5, E = (e, t = 1) => (e = I.parse(e), e = Nt(e), [
188
+ N(e, 0),
189
+ N(e, 2),
190
+ N(e, 4),
191
+ e.length === 8 ? N(e, 6) / 255 : t
192
+ ]), F = [0, 0, 0, 0], j = (e) => Math.floor(e).toString(16).padStart(2, "0"), N = (e, t) => parseInt(e.slice(t, t + 2), 16), Nt = (e) => e.startsWith("#") ? e.slice(1) : e, H = {
166
193
  black: "#000000",
167
194
  white: "#ffffff",
168
195
  red: "#ff0000",
@@ -194,62 +221,62 @@ const ot = i.object({
194
221
  khaki: "#f0e68c",
195
222
  crimson: "#dc143c",
196
223
  transparent: "transparent"
197
- }, $t = (e) => {
224
+ }, Et = (e) => {
198
225
  if (!e) return;
199
226
  const t = e.trim().toLowerCase();
200
227
  if (!(t === "transparent" || t === "none")) {
201
228
  if (t.startsWith("#")) {
202
229
  if (t.length === 4) {
203
230
  const r = t[1], n = t[2], s = t[3], o = `#${r}${r}${n}${n}${s}${s}`;
204
- if (I.safeParse(o).success) return N(o);
231
+ if (I.safeParse(o).success) return E(o);
205
232
  }
206
- return (t.length === 7 || t.length === 9) && I.safeParse(t).success ? N(t) : void 0;
233
+ return (t.length === 7 || t.length === 9) && I.safeParse(t).success ? E(t) : void 0;
207
234
  }
208
235
  if (t.startsWith("rgb")) {
209
236
  const r = t.match(
210
237
  /rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/
211
238
  );
212
239
  if (r) {
213
- const [, n, s, o, a] = r;
214
- return [parseInt(n), parseInt(s), parseInt(o), a ? parseFloat(a) : 1];
240
+ const [, n, s, o, c] = r;
241
+ return [parseInt(n), parseInt(s), parseInt(o), c ? parseFloat(c) : 1];
215
242
  }
216
243
  }
217
- if (V[t]) return N(V[t]);
244
+ if (H[t]) return E(H[t]);
218
245
  }
219
- }, jt = (e) => {
220
- e = J.parse(e);
246
+ }, It = (e) => {
247
+ e = K.parse(e);
221
248
  let [t, r, n] = e;
222
249
  const s = e[3];
223
250
  t /= 360, r /= 100, n /= 100;
224
- let o, a, f;
251
+ let o, c, f;
225
252
  if (r === 0)
226
- o = a = f = n;
253
+ o = c = f = n;
227
254
  else {
228
- const l = n < 0.5 ? n * (1 + r) : n + r - n * r, c = 2 * n - l;
229
- o = C(c, l, t + 1 / 3), a = C(c, l, t), f = C(c, l, t - 1 / 3);
255
+ const i = n < 0.5 ? n * (1 + r) : n + r - n * r, l = 2 * n - i;
256
+ o = C(l, i, t + 1 / 3), c = C(l, i, t), f = C(l, i, t - 1 / 3);
230
257
  }
231
- return [Math.round(o * 255), Math.round(a * 255), Math.round(f * 255), s];
232
- }, C = (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), Et = (e) => {
258
+ return [Math.round(o * 255), Math.round(c * 255), Math.round(f * 255), s];
259
+ }, C = (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), Ot = (e) => {
233
260
  e = O.parse(e);
234
261
  let [t, r, n] = e;
235
262
  const s = e[3];
236
263
  t /= 255, r /= 255, n /= 255;
237
- const o = Math.max(t, r, n), a = Math.min(t, r, n);
238
- let f, l, c = (o + a) / 2;
239
- if (o === a)
240
- f = l = 0;
264
+ const o = Math.max(t, r, n), c = Math.min(t, r, n);
265
+ let f, i, l = (o + c) / 2;
266
+ if (o === c)
267
+ f = i = 0;
241
268
  else {
242
- const u = o - a;
243
- l = c > 0.5 ? u / (2 - o - a) : u / (o + a), o === t ? f = (r - n) / u + (r < n ? 6 : 0) : o === r ? f = (n - t) / u + 2 : f = (t - r) / u + 4, f /= 6;
244
- }
245
- return f *= 360, l *= 100, c *= 100, [Math.round(f), Math.round(l), Math.round(c), s];
246
- }, Nt = d("#000000"), It = d("#ffffff"), K = i.object({
247
- key: i.string(),
248
- color: k,
249
- position: i.number(),
250
- switched: i.boolean().optional()
251
- }), Ot = i.array(K), kt = (e, t) => {
252
- if (e.length === 0) return D;
269
+ const u = o - c;
270
+ i = l > 0.5 ? u / (2 - o - c) : u / (o + c), o === t ? f = (r - n) / u + (r < n ? 6 : 0) : o === r ? f = (n - t) / u + 2 : f = (t - r) / u + 4, f /= 6;
271
+ }
272
+ return f *= 360, i *= 100, l *= 100, [Math.round(f), Math.round(i), Math.round(l), s];
273
+ }, At = d("#000000"), kt = d("#ffffff"), ne = a.object({
274
+ key: a.string(),
275
+ color: A,
276
+ position: a.number(),
277
+ switched: a.boolean().optional()
278
+ }), Pt = a.array(ne), Rt = (e, t) => {
279
+ if (e.length === 0) return F;
253
280
  if (e = e.slice().sort((r, n) => r.position - n.position), t <= e[0].position) return d(e[0].color);
254
281
  if (t >= e[e.length - 1].position)
255
282
  return d(e[e.length - 1].color);
@@ -258,111 +285,111 @@ const ot = i.object({
258
285
  if (t < n.position || t > s.position) continue;
259
286
  if (t === n.position) return d(n.color);
260
287
  if (t === s.position) return d(s.color);
261
- const o = (t - n.position) / (s.position - n.position), a = d(n.color), f = d(s.color), l = Math.round(
262
- y(a) + o * (y(f) - y(a))
263
- ), c = Math.round(
264
- w(a) + o * (w(f) - w(a))
288
+ const o = (t - n.position) / (s.position - n.position), c = d(n.color), f = d(s.color), i = Math.round(
289
+ y(c) + o * (y(f) - y(c))
290
+ ), l = Math.round(
291
+ w(c) + o * (w(f) - w(c))
265
292
  ), u = Math.round(
266
- v(a) + o * (v(f) - v(a))
267
- ), p = S(a) + o * (S(f) - S(a));
268
- return d([l, c, u, p]);
293
+ M(c) + o * (M(f) - M(c))
294
+ ), m = S(c) + o * (S(f) - S(c));
295
+ return d([i, l, u, m]);
269
296
  }
270
297
  return d(e[e.length - 1].color);
271
- }, At = i.object({
272
- key: i.string(),
273
- name: i.string(),
274
- color: A
275
- }), Pt = i.object({
276
- key: i.string(),
277
- name: i.string(),
278
- swatches: i.array(At)
279
- }), kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
298
+ }, Zt = a.object({
299
+ key: a.string(),
300
+ name: a.string(),
301
+ color: k
302
+ }), Ct = a.object({
303
+ key: a.string(),
304
+ name: a.string(),
305
+ swatches: a.array(Zt)
306
+ }), Zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
280
307
  __proto__: null,
281
- BLACK: Nt,
282
- WHITE: It,
283
- ZERO: D,
308
+ BLACK: At,
309
+ WHITE: kt,
310
+ ZERO: F,
284
311
  aValue: S,
285
- bValue: v,
286
- colorZ: A,
312
+ bValue: M,
313
+ colorZ: k,
287
314
  construct: d,
288
- contrast: L,
289
- crudeZ: k,
290
- cssString: pt,
291
- equals: G,
292
- fromCSS: $t,
293
- fromGradient: kt,
294
- fromHSLA: jt,
315
+ contrast: q,
316
+ crudeZ: A,
317
+ cssString: bt,
318
+ equals: ee,
319
+ fromCSS: Et,
320
+ fromGradient: Rt,
321
+ fromHSLA: It,
295
322
  gValue: w,
296
- gradientZ: Ot,
297
- grayness: vt,
298
- hex: gt,
299
- hsla: yt,
300
- isColor: ht,
301
- isCrude: dt,
302
- isDark: Mt,
303
- isLight: xt,
304
- isZero: _t,
305
- luminance: M,
306
- paletteZ: Pt,
307
- pickByContrast: St,
323
+ gradientZ: Pt,
324
+ grayness: xt,
325
+ hex: _t,
326
+ hsla: St,
327
+ isColor: gt,
328
+ isCrude: pt,
329
+ isDark: $t,
330
+ isLight: jt,
331
+ isZero: Mt,
332
+ luminance: v,
333
+ paletteZ: Ct,
334
+ pickByContrast: Tt,
308
335
  rValue: y,
309
- rgbCSS: mt,
310
- rgbString: Y,
311
- rgba1: bt,
312
- rgbaCSS: Q,
313
- setAlpha: wt,
314
- stopZ: K
315
- }, Symbol.toStringTag, { value: "Module" })), ee = i.int().min(0).max(255), te = 255, re = 0, Zt = {
316
- lower: re,
317
- upper: te + 1
318
- }, ne = i.object({
319
- name: i.string(),
320
- key: i.string()
321
- }), x = (e) => i.object({
322
- subject: ne,
336
+ rgbCSS: yt,
337
+ rgbString: re,
338
+ rgba1: wt,
339
+ rgbaCSS: te,
340
+ setAlpha: vt,
341
+ stopZ: ne
342
+ }, Symbol.toStringTag, { value: "Module" })), se = a.int().min(0).max(255), oe = 255, ie = 0, Lt = {
343
+ lower: ie,
344
+ upper: oe + 1
345
+ }, ae = a.object({
346
+ name: a.string(),
347
+ key: a.string()
348
+ }), x = (e) => a.object({
349
+ subject: ae,
323
350
  resource: e,
324
- authority: ee
325
- }), Rt = (...e) => (t) => t.filter((r) => {
351
+ authority: se
352
+ }), Ut = (...e) => (t) => t.filter((r) => {
326
353
  let n = !1;
327
354
  return r.to != null && (n = e.includes(r.to.resource)), r.from != null && !n && (n = e.includes(r.from.resource)), n;
328
- }), se = (e) => i.object({
355
+ }), ce = (e) => a.object({
329
356
  from: x(e),
330
- to: i.null()
331
- }), oe = (e) => i.object({
332
- from: i.null(),
357
+ to: a.null()
358
+ }), le = (e) => a.object({
359
+ from: a.null(),
333
360
  to: x(e)
334
- }), Ct = (e) => i.union([
335
- se(e),
336
- oe(e),
337
- i.object({
361
+ }), qt = (e) => a.union([
362
+ ce(e),
363
+ le(e),
364
+ a.object({
338
365
  from: x(e),
339
366
  to: x(e)
340
367
  })
341
- ]), Ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
368
+ ]), Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
342
369
  __proto__: null,
343
- ABSOLUTE_AUTHORITY: te,
344
- AUTHORITY_BOUNDS: Zt,
345
- ZERO_AUTHORITY: re,
346
- acquireZ: oe,
347
- authorityZ: ee,
348
- filterTransfersByChannelKey: Rt,
349
- releaseZ: se,
370
+ ABSOLUTE_AUTHORITY: oe,
371
+ AUTHORITY_BOUNDS: Lt,
372
+ ZERO_AUTHORITY: ie,
373
+ acquireZ: le,
374
+ authorityZ: se,
375
+ filterTransfersByChannelKey: Ut,
376
+ releaseZ: ce,
350
377
  stateZ: x,
351
- subjectZ: ne,
352
- transferZ: Ct
353
- }, Symbol.toStringTag, { value: "Module" })), Lt = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), Ut = (e, t) => {
378
+ subjectZ: ae,
379
+ transferZ: qt
380
+ }, Symbol.toStringTag, { value: "Module" })), Wt = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), zt = (e, t) => {
354
381
  const r = Symbol.for(e);
355
- if (!Lt(r)) {
382
+ if (!Wt(r)) {
356
383
  const n = t();
357
384
  Object.defineProperty(globalThis, r, { value: n });
358
385
  }
359
386
  return () => globalThis[r];
360
- }, ie = "sy_x_error", qt = (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), T = (e) => class b extends Error {
361
- static discriminator = ie;
387
+ }, ue = "sy_x_error", Dt = (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), T = (e) => class b extends Error {
388
+ static discriminator = ue;
362
389
  discriminator = b.discriminator;
363
390
  static TYPE = e;
364
391
  type = b.TYPE;
365
- static matches = qt(e);
392
+ static matches = Dt(e);
366
393
  matches = b.matches;
367
394
  constructor(r, n) {
368
395
  super(r, n), this.name = b.TYPE;
@@ -370,68 +397,68 @@ const ot = i.object({
370
397
  static sub(r) {
371
398
  return T(`${e}.${r}`);
372
399
  }
373
- }, ae = (e) => {
400
+ }, fe = (e) => {
374
401
  if (e == null || typeof e != "object") return !1;
375
402
  const t = e;
376
- if (t.discriminator !== ie) return !1;
403
+ if (t.discriminator !== ue) return !1;
377
404
  if (!("type" in t))
378
405
  throw new Error(
379
406
  `X Error is missing its type property: ${JSON.stringify(t)}`
380
407
  );
381
408
  return !0;
382
- }, g = "unknown", U = "nil";
383
- class Wt {
409
+ }, p = "unknown", W = "nil";
410
+ class Bt {
384
411
  providers = [];
385
412
  register(t) {
386
413
  this.providers.push(t);
387
414
  }
388
415
  encode(t) {
389
- if (t == null) return { type: U, data: "" };
390
- if (ae(t))
416
+ if (t == null) return { type: W, data: "" };
417
+ if (fe(t))
391
418
  for (const r of this.providers) {
392
419
  const n = r.encode(t);
393
420
  if (n != null) return n;
394
421
  }
395
- if (t instanceof Error) return { type: g, data: t.message };
396
- if (typeof t == "string") return { type: g, data: t };
422
+ if (t instanceof Error) return { type: p, data: t.message };
423
+ if (typeof t == "string") return { type: p, data: t };
397
424
  try {
398
- return { type: g, data: JSON.stringify(t) };
425
+ return { type: p, data: JSON.stringify(t) };
399
426
  } catch {
400
- return { type: g, data: "unable to encode error information" };
427
+ return { type: p, data: "unable to encode error information" };
401
428
  }
402
429
  }
403
430
  decode(t) {
404
- if (t == null || t.type === U) return null;
405
- if (t.type === g) return new q(t.data);
431
+ if (t == null || t.type === W) return null;
432
+ if (t.type === p) return new z(t.data);
406
433
  for (const r of this.providers) {
407
434
  const n = r.decode(t);
408
435
  if (n != null) return n;
409
436
  }
410
- return new q(t.data);
437
+ return new z(t.data);
411
438
  }
412
439
  }
413
- const B = Ut("synnax-error-registry", () => new Wt()), zt = ({ encode: e, decode: t }) => B().register({ encode: e, decode: t }), Dt = (e) => B().encode(e), Bt = (e) => e == null ? null : B().decode(e);
414
- class q extends T("unknown") {
440
+ const V = zt("synnax-error-registry", () => new Bt()), Ft = ({ encode: e, decode: t }) => V().register({ encode: e, decode: t }), Vt = (e) => V().encode(e), Ht = (e) => e == null ? null : V().decode(e);
441
+ class z extends T("unknown") {
415
442
  }
416
- const Vt = i.object({ type: i.string(), data: i.string() });
417
- class Ft extends T("canceled") {
443
+ const Xt = a.object({ type: a.string(), data: a.string() });
444
+ class Gt extends T("canceled") {
418
445
  }
419
- class Xt extends T("not_implemented") {
446
+ class Jt extends T("not_implemented") {
420
447
  }
421
- const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
448
+ const Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
422
449
  __proto__: null,
423
- Canceled: Ft,
424
- NONE: U,
425
- NotImplemented: Xt,
426
- UNKNOWN: g,
427
- Unknown: q,
450
+ Canceled: Gt,
451
+ NONE: W,
452
+ NotImplemented: Jt,
453
+ UNKNOWN: p,
454
+ Unknown: z,
428
455
  createTyped: T,
429
- decode: Bt,
430
- encode: Dt,
431
- isTyped: ae,
432
- payloadZ: Vt,
433
- register: zt
434
- }, Symbol.toStringTag, { value: "Module" })), Zr = () => Promise.resolve(), Rr = () => new Promise((e) => setTimeout(e, 0)), Cr = (e) => e ? -1 : 1, ce = h.object({
456
+ decode: Ht,
457
+ encode: Vt,
458
+ isTyped: fe,
459
+ payloadZ: Xt,
460
+ register: Ft
461
+ }, Symbol.toStringTag, { value: "Module" })), Ur = () => Promise.resolve(), qr = () => new Promise((e) => setTimeout(e, 0)), Wr = (e) => e ? -1 : 1, de = h.object({
435
462
  jsonrpc: h.literal("2.0"),
436
463
  method: h.string(),
437
464
  // params should be z.union([z.record(z.string(), z.json()),
@@ -439,12 +466,12 @@ const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
439
466
  // definition of params then in the JSON-RPC spec.
440
467
  params: h.any().optional(),
441
468
  id: h.union([h.string(), h.number(), h.null()]).optional()
442
- }), le = h.object({
469
+ }), he = h.object({
443
470
  jsonrpc: h.literal("2.0"),
444
471
  id: h.union([h.string(), h.number(), h.null()])
445
- }), Ht = le.extend({
472
+ }), Qt = he.extend({
446
473
  result: h.json()
447
- }), Jt = le.extend({
474
+ }), Yt = he.extend({
448
475
  error: h.object({
449
476
  code: h.number().int(),
450
477
  // This should be z.string(), but the VSCode JSON RPC implementation uses a looser
@@ -452,72 +479,72 @@ const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
452
479
  message: h.string().optional(),
453
480
  data: h.json().optional()
454
481
  })
455
- }), ue = h.union([Ht, Jt]), fe = h.union([ce, ue]), Gt = (e) => {
482
+ }), me = h.union([Qt, Yt]), pe = h.union([de, me]), Kt = (e) => {
456
483
  const t = new TextDecoder();
457
484
  let r = new Uint8Array(0), n = null;
458
485
  return (s) => {
459
486
  let o;
460
487
  typeof s == "string" ? o = new TextEncoder().encode(s) : s instanceof ArrayBuffer ? o = new Uint8Array(s) : o = s;
461
- const a = new Uint8Array(r.length + o.length);
462
- for (a.set(r), a.set(o, r.length), r = a; r.length > 0; ) {
488
+ const c = new Uint8Array(r.length + o.length);
489
+ for (c.set(r), c.set(o, r.length), r = c; r.length > 0; ) {
463
490
  if (n === null) {
464
- const l = t.decode(r).match(/^Content-Length: (\d+)\r?\n\r?\n/);
465
- if (!l) break;
466
- n = parseInt(l[1]);
467
- const c = new TextEncoder().encode(l[0]).length;
468
- r = r.slice(c);
491
+ const i = t.decode(r).match(/^Content-Length: (\d+)\r?\n\r?\n/);
492
+ if (!i) break;
493
+ n = parseInt(i[1]);
494
+ const l = new TextEncoder().encode(i[0]).length;
495
+ r = r.slice(l);
469
496
  }
470
497
  if (n !== null && r.length >= n) {
471
498
  const f = r.slice(0, n);
472
499
  r = r.slice(n), n = null;
473
- const l = t.decode(f), c = ve.decodeString(l, fe);
474
- e(c);
500
+ const i = t.decode(f), l = Te.decodeString(i, pe);
501
+ e(l);
475
502
  } else break;
476
503
  }
477
504
  };
478
- }, Qt = (e) => {
505
+ }, er = (e) => {
479
506
  const t = JSON.stringify(e);
480
507
  return `Content-Length: ${new TextEncoder().encode(t).length}\r
481
508
  \r
482
509
  ` + t;
483
- }, Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
510
+ }, zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
484
511
  __proto__: null,
485
- encodeMessage: Qt,
486
- messageZ: fe,
487
- requestZ: ce,
488
- responseZ: ue,
489
- streamDecodeChunks: Gt
490
- }, Symbol.toStringTag, { value: "Module" })), de = h.uuid(), he = h.object({
491
- key: de,
512
+ encodeMessage: er,
513
+ messageZ: pe,
514
+ requestZ: de,
515
+ responseZ: me,
516
+ streamDecodeChunks: Kt
517
+ }, Symbol.toStringTag, { value: "Module" })), ge = h.uuid(), be = h.object({
518
+ key: ge,
492
519
  name: h.string().min(1),
493
520
  color: h.string()
494
- }), Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
521
+ }), Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
495
522
  __proto__: null,
496
- keyZ: de,
497
- labelZ: he
498
- }, Symbol.toStringTag, { value: "Module" })), Yt = (e, t, r) => {
523
+ keyZ: ge,
524
+ labelZ: be
525
+ }, Symbol.toStringTag, { value: "Module" })), tr = (e, t, r) => {
499
526
  const n = e.get(t);
500
527
  return n === void 0 ? (e.set(t, r), r) : n;
501
- }, qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
528
+ }, Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
502
529
  __proto__: null,
503
- getOrSetDefault: Yt
504
- }, Symbol.toStringTag, { value: "Module" })), W = i.string().regex(/^\d+\.\d+\.\d+$/), $ = ((e, t, r = {}) => {
530
+ getOrSetDefault: tr
531
+ }, Symbol.toStringTag, { value: "Module" })), D = a.string().regex(/^\d+\.\d+\.\d+$/), $ = ((e, t, r = {}) => {
505
532
  r.checkMajor ??= !0, r.checkMinor ??= !0, r.checkPatch ??= !0;
506
- const n = W.parse(e), s = W.parse(t), [o, a, f] = n.split(".").map(Number), [l, c, u] = s.split(".").map(Number);
533
+ const n = D.parse(e), s = D.parse(t), [o, c, f] = n.split(".").map(Number), [i, l, u] = s.split(".").map(Number);
507
534
  if (r.checkMajor) {
508
- if (o < l) return Z;
509
- if (o > l) return R;
535
+ if (o < i) return R;
536
+ if (o > i) return Z;
510
537
  }
511
538
  if (r.checkMinor) {
512
- if (a < c) return Z;
513
- if (a > c) return R;
539
+ if (c < l) return R;
540
+ if (c > l) return Z;
514
541
  }
515
542
  if (r.checkPatch) {
516
- if (f < u) return Z;
517
- if (f > u) return R;
543
+ if (f < u) return R;
544
+ if (f > u) return Z;
518
545
  }
519
- return We;
520
- }), Kt = (e, t, r = {}) => Le($(e, t, r)), pe = (e, t, r = {}) => Ue($(e, t, r)), er = (e, t, r = {}) => qe($(e, t, r)), tr = ({
546
+ return Fe;
547
+ }), rr = (e, t, r = {}) => ze($(e, t, r)), _e = (e, t, r = {}) => De($(e, t, r)), nr = (e, t, r = {}) => Be($(e, t, r)), sr = ({
521
548
  name: e,
522
549
  migrate: t
523
550
  }) => (r) => {
@@ -527,7 +554,7 @@ const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
527
554
  } catch (n) {
528
555
  throw console.log(`${e} failed to migrate from ${r.version}`), console.error(n), n;
529
556
  }
530
- }, rr = ({
557
+ }, or = ({
531
558
  name: e,
532
559
  migrations: t,
533
560
  targetSchema: r,
@@ -536,59 +563,59 @@ const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
536
563
  }) => {
537
564
  const o = Object.keys(t).sort($).pop();
538
565
  if (o == null)
539
- return (c) => {
540
- if (c.version ??= n, c.version !== s.version)
566
+ return (l) => {
567
+ if (l.version ??= n, l.version !== s.version)
541
568
  return console.log(
542
- `${e} version ${c.version} is newer than latest version of ${s.version}.
569
+ `${e} version ${l.version} is newer than latest version of ${s.version}.
543
570
  Returning default instead.
544
571
  `
545
572
  ), s;
546
573
  try {
547
- return r != null ? r.parse(c) : c;
574
+ return r != null ? r.parse(l) : l;
548
575
  } catch (u) {
549
576
  return console.log(`${e} failed to parse default. Exiting with default`), console.error(u), s;
550
577
  }
551
578
  };
552
- const a = Object.keys(t).length;
579
+ const c = Object.keys(t).length;
553
580
  let f = !1;
554
- const l = (c) => {
581
+ const i = (l) => {
555
582
  try {
556
- if (a === 0 || pe(c.version, o))
557
- return console.log(f ? `${e} ${c.version} now up to date` : `${e} version ${c.version} is up to date with target version ${s.version}`), c;
558
- const u = c.version, p = t[u], P = p(c);
559
- return f = !0, l(P);
583
+ if (c === 0 || _e(l.version, o))
584
+ return console.log(f ? `${e} ${l.version} now up to date` : `${e} version ${l.version} is up to date with target version ${s.version}`), l;
585
+ const u = l.version, m = t[u], P = m(l);
586
+ return f = !0, i(P);
560
587
  } catch (u) {
561
588
  return console.log(
562
- `${e} failed to migrate from ${c.version} to ${o}`
589
+ `${e} failed to migrate from ${l.version} to ${o}`
563
590
  ), console.error(u), s;
564
591
  }
565
592
  };
566
- return (c) => {
593
+ return (l) => {
567
594
  try {
568
- if (c.version == null)
595
+ if (l.version == null)
569
596
  if (n != null)
570
597
  console.log(
571
598
  `${e} version is null. Setting version to default of ${n}`
572
- ), c.version = n;
599
+ ), l.version = n;
573
600
  else
574
601
  return console.log(
575
602
  `${e} version is null and no default version set. Exiting with default`
576
603
  ), s;
577
- return l(c);
604
+ return i(l);
578
605
  } catch (u) {
579
606
  return console.log(`${e} failed to parse final result. Exiting with default`), console.error(u), s;
580
607
  }
581
608
  };
582
- }, Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
609
+ }, Fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
583
610
  __proto__: null,
584
611
  compareSemVer: $,
585
- createMigration: tr,
586
- migrator: rr,
587
- semVerNewer: pe,
588
- semVerOlder: er,
589
- semVerZ: W,
590
- versionsEqual: Kt
591
- }, Symbol.toStringTag, { value: "Module" })), ge = ["standard", "scientific", "engineering"], nr = i.enum(ge), sr = (e, t, r) => {
612
+ createMigration: sr,
613
+ migrator: or,
614
+ semVerNewer: _e,
615
+ semVerOlder: nr,
616
+ semVerZ: D,
617
+ versionsEqual: rr
618
+ }, Symbol.toStringTag, { value: "Module" })), ye = ["standard", "scientific", "engineering"], ir = a.enum(ye), ar = (e, t, r) => {
592
619
  if (Number.isNaN(e)) return "NaN";
593
620
  if (e === 1 / 0) return "∞";
594
621
  if (e === -1 / 0) return "-∞";
@@ -597,139 +624,146 @@ const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
597
624
  return t === 0 ? "0ᴇ0" : `0.${"0".repeat(t)}ᴇ0`;
598
625
  let n;
599
626
  return r === "scientific" ? n = Math.floor(Math.log10(Math.abs(e))) : n = Math.floor(Math.log10(Math.abs(e)) / 3) * 3, `${(e / 10 ** n).toFixed(t)}ᴇ${n}`;
600
- }, zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
627
+ }, Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
601
628
  __proto__: null,
602
- NOTATIONS: ge,
603
- notationZ: nr,
604
- stringifyNumber: sr
605
- }, Symbol.toStringTag, { value: "Module" })), Dr = (e) => {
629
+ NOTATIONS: ye,
630
+ notationZ: ir,
631
+ stringifyNumber: ar
632
+ }, Symbol.toStringTag, { value: "Module" })), Hr = (e) => {
606
633
  if (e === void 0 || typeof e == "string" || typeof e == "number")
607
634
  return e;
608
635
  if (e.toString === void 0) throw new Error("invalid renderer");
609
636
  return e.toString();
610
- }, Br = (e) => Array.isArray(e) ? [...e] : typeof e == "object" && e !== null ? { ...e } : e, me = i.enum([
637
+ }, Xr = (e) => Array.isArray(e) ? [...e] : typeof e == "object" && e !== null ? { ...e } : e, we = a.enum([
611
638
  "success",
612
639
  "info",
613
640
  "warning",
614
641
  "error",
615
642
  "loading",
616
643
  "disabled"
617
- ]), or = (e) => i.object({
618
- key: i.string(),
619
- name: i.string().default(""),
620
- variant: me,
621
- message: i.string(),
622
- description: i.string().optional(),
623
- time: F.z,
624
- labels: we(he).optional(),
625
- details: e ?? i.unknown().optional()
626
- }), ir = i.object({
627
- stack: i.string()
628
- }), ar = (e, t) => {
644
+ ]), cr = (e) => a.object({
645
+ key: a.string(),
646
+ name: a.string().default(""),
647
+ variant: we,
648
+ message: a.string(),
649
+ description: a.string().optional(),
650
+ time: X.z,
651
+ labels: xe(be).optional(),
652
+ details: e ?? a.unknown().optional()
653
+ }), lr = a.object({
654
+ stack: a.string(),
655
+ error: a.instanceof(Error)
656
+ }), ur = (e, t) => {
629
657
  if (!(e instanceof Error)) throw e;
630
- return be({
658
+ return Me({
631
659
  variant: "error",
632
660
  message: t ?? e.message,
633
661
  description: t != null ? e.message : void 0,
634
- details: {
635
- stack: e.stack ?? ""
636
- }
662
+ details: { stack: e.stack ?? "", error: e }
637
663
  });
638
- }, be = (e) => ({
639
- key: Ce(),
640
- time: F.now(),
664
+ }, Me = (e) => ({
665
+ key: We(),
666
+ time: X.now(),
641
667
  name: "",
642
668
  ...e
643
- }), cr = (e, t = []) => {
669
+ }), fr = (e, t = []) => {
644
670
  if (e != null)
645
671
  return Array.isArray(t) ? t.includes(e) ? e : void 0 : t === e ? e : void 0;
646
- }, lr = (e, t = []) => {
672
+ }, dr = (e, t = []) => {
647
673
  if (e != null)
648
674
  return Array.isArray(t) ? t.includes(e) ? void 0 : e : t === e ? void 0 : e;
649
- }, Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
675
+ }, Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
650
676
  __proto__: null,
651
- create: be,
652
- exceptionDetailsSchema: ir,
653
- fromException: ar,
654
- keepVariants: cr,
655
- removeVariants: lr,
656
- statusZ: or,
657
- variantZ: me
658
- }, Symbol.toStringTag, { value: "Module" })), ur = (e, t = "") => {
677
+ create: Me,
678
+ exceptionDetailsSchema: lr,
679
+ fromException: ur,
680
+ keepVariants: fr,
681
+ removeVariants: dr,
682
+ statusZ: cr,
683
+ variantZ: we
684
+ }, Symbol.toStringTag, { value: "Module" })), hr = (e, t) => {
685
+ if (!t.has(e)) return e;
686
+ let r = e, n = 1, s = e;
687
+ for (; t.has(s); ) {
688
+ const o = s.match(mr);
689
+ o ? (r = s.slice(0, o.index).trim(), n = parseInt(o[1]) + 1) : (r = s, n = 1), s = `${r} (${n})`;
690
+ }
691
+ return s;
692
+ }, mr = /\((\d+)\)$/, pr = (e, t = "") => {
659
693
  if (typeof e == "string") return e;
660
694
  const r = e.length;
661
695
  return r === 0 ? t : r === 1 ? e[0] : r === 2 ? `${e[0]} and ${e[1]}` : `${e.slice(0, -1).join(", ")}, and ${e[r - 1]}`;
662
- }, fr = (e) => {
663
- const t = e.split(" "), r = /* @__PURE__ */ new Set(), n = t.map((l) => l.charAt(0).toLowerCase()).join("");
696
+ }, gr = (e) => {
697
+ const t = e.split(" "), r = /* @__PURE__ */ new Set(), n = t.map((i) => i.charAt(0).toLowerCase()).join("");
664
698
  r.add(n.replace(/-/g, "_")), r.add(n.replace(/(.)(.)/g, "$1_$2").replace(/-/g, "_"));
665
699
  const s = /\d+/g;
666
- e.match(s) && t.forEach((l, c) => {
667
- if (s.test(l)) {
668
- const u = t.map((p, P) => P !== c ? p.charAt(0).toLowerCase() : p).join("");
700
+ e.match(s) && t.forEach((i, l) => {
701
+ if (s.test(i)) {
702
+ const u = t.map((m, P) => P !== l ? m.charAt(0).toLowerCase() : m).join("");
669
703
  r.add(u.replace(/-/g, "_")), r.add(
670
704
  u.replace(/(.)(.)/g, "$1_$2").replace(/-/g, "_")
671
705
  );
672
706
  }
673
707
  });
674
- const a = t.map(
675
- (l) => (l.length > 3 ? l.substring(0, 3) : l).toLowerCase()
708
+ const c = t.map(
709
+ (i) => (i.length > 3 ? i.substring(0, 3) : i).toLowerCase()
676
710
  );
677
- return r.add(a.join("").replace(/-/g, "_")), r.add(a.join("_").replace(/-/g, "_")), Array.from(r).filter(
678
- (l) => l.length >= 2 && l.length <= 12 && !/^\d/.test(l)
711
+ return r.add(c.join("").replace(/-/g, "_")), r.add(c.join("_").replace(/-/g, "_")), Array.from(r).filter(
712
+ (i) => i.length >= 2 && i.length <= 12 && !/^\d/.test(i)
679
713
  );
680
- }, dr = (e, t) => e.startsWith(t) ? e.slice(t.length) : e, hr = (e) => e.length === 0 ? e : e[e.length - 1] === "y" ? `${e.slice(0, -1)}ies` : e[e.length - 1] === "s" || e[e.length - 1] === "x" || e[e.length - 1] === "z" || e.endsWith("ch") || e.endsWith("sh") ? `${e}es` : `${e}s`, Fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
714
+ }, br = (e, t) => e.startsWith(t) ? e.slice(t.length) : e, Jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
681
715
  __proto__: null,
682
- createShortIdentifiers: fr,
683
- naturalLanguageJoin: ur,
684
- pluralName: hr,
685
- trimPrefix: dr
686
- }, Symbol.toStringTag, { value: "Module" })), pr = new Error("request for lock canceled");
687
- var gr = function(e, t, r, n) {
716
+ createShortIdentifiers: gr,
717
+ deduplicateFileName: hr,
718
+ naturalLanguageJoin: pr,
719
+ trimPrefix: br
720
+ }, Symbol.toStringTag, { value: "Module" })), _r = new Error("request for lock canceled");
721
+ var yr = function(e, t, r, n) {
688
722
  function s(o) {
689
- return o instanceof r ? o : new r(function(a) {
690
- a(o);
723
+ return o instanceof r ? o : new r(function(c) {
724
+ c(o);
691
725
  });
692
726
  }
693
- return new (r || (r = Promise))(function(o, a) {
727
+ return new (r || (r = Promise))(function(o, c) {
694
728
  function f(u) {
695
729
  try {
696
- c(n.next(u));
697
- } catch (p) {
698
- a(p);
730
+ l(n.next(u));
731
+ } catch (m) {
732
+ c(m);
699
733
  }
700
734
  }
701
- function l(u) {
735
+ function i(u) {
702
736
  try {
703
- c(n.throw(u));
704
- } catch (p) {
705
- a(p);
737
+ l(n.throw(u));
738
+ } catch (m) {
739
+ c(m);
706
740
  }
707
741
  }
708
- function c(u) {
709
- u.done ? o(u.value) : s(u.value).then(f, l);
742
+ function l(u) {
743
+ u.done ? o(u.value) : s(u.value).then(f, i);
710
744
  }
711
- c((n = n.apply(e, t || [])).next());
745
+ l((n = n.apply(e, t || [])).next());
712
746
  });
713
747
  };
714
- class mr {
715
- constructor(t, r = pr) {
748
+ class wr {
749
+ constructor(t, r = _r) {
716
750
  this._value = t, this._cancelError = r, this._queue = [], this._weightedWaiters = [];
717
751
  }
718
752
  acquire(t = 1, r = 0) {
719
753
  if (t <= 0)
720
754
  throw new Error(`invalid weight ${t}: must be positive`);
721
755
  return new Promise((n, s) => {
722
- const o = { resolve: n, reject: s, weight: t, priority: r }, a = _e(this._queue, (f) => r <= f.priority);
723
- a === -1 && t <= this._value ? this._dispatchItem(o) : this._queue.splice(a + 1, 0, o);
756
+ const o = { resolve: n, reject: s, weight: t, priority: r }, c = Se(this._queue, (f) => r <= f.priority);
757
+ c === -1 && t <= this._value ? this._dispatchItem(o) : this._queue.splice(c + 1, 0, o);
724
758
  });
725
759
  }
726
760
  runExclusive(t) {
727
- return gr(this, arguments, void 0, function* (r, n = 1, s = 0) {
728
- const [o, a] = yield this.acquire(n, s);
761
+ return yr(this, arguments, void 0, function* (r, n = 1, s = 0) {
762
+ const [o, c] = yield this.acquire(n, s);
729
763
  try {
730
764
  return yield r(o);
731
765
  } finally {
732
- a();
766
+ c();
733
767
  }
734
768
  });
735
769
  }
@@ -737,7 +771,7 @@ class mr {
737
771
  if (t <= 0)
738
772
  throw new Error(`invalid weight ${t}: must be positive`);
739
773
  return this._couldLockImmediately(t, r) ? Promise.resolve() : new Promise((n) => {
740
- this._weightedWaiters[t - 1] || (this._weightedWaiters[t - 1] = []), br(this._weightedWaiters[t - 1], { resolve: n, priority: r });
774
+ this._weightedWaiters[t - 1] || (this._weightedWaiters[t - 1] = []), Mr(this._weightedWaiters[t - 1], { resolve: n, priority: r });
741
775
  });
742
776
  }
743
777
  isLocked() {
@@ -792,49 +826,49 @@ class mr {
792
826
  return (this._queue.length === 0 || this._queue[0].priority < r) && t <= this._value;
793
827
  }
794
828
  }
795
- function br(e, t) {
796
- const r = _e(e, (n) => t.priority <= n.priority);
829
+ function Mr(e, t) {
830
+ const r = Se(e, (n) => t.priority <= n.priority);
797
831
  e.splice(r + 1, 0, t);
798
832
  }
799
- function _e(e, t) {
833
+ function Se(e, t) {
800
834
  for (let r = e.length - 1; r >= 0; r--)
801
835
  if (t(e[r]))
802
836
  return r;
803
837
  return -1;
804
838
  }
805
- var _r = function(e, t, r, n) {
839
+ var Sr = function(e, t, r, n) {
806
840
  function s(o) {
807
- return o instanceof r ? o : new r(function(a) {
808
- a(o);
841
+ return o instanceof r ? o : new r(function(c) {
842
+ c(o);
809
843
  });
810
844
  }
811
- return new (r || (r = Promise))(function(o, a) {
845
+ return new (r || (r = Promise))(function(o, c) {
812
846
  function f(u) {
813
847
  try {
814
- c(n.next(u));
815
- } catch (p) {
816
- a(p);
848
+ l(n.next(u));
849
+ } catch (m) {
850
+ c(m);
817
851
  }
818
852
  }
819
- function l(u) {
853
+ function i(u) {
820
854
  try {
821
- c(n.throw(u));
822
- } catch (p) {
823
- a(p);
855
+ l(n.throw(u));
856
+ } catch (m) {
857
+ c(m);
824
858
  }
825
859
  }
826
- function c(u) {
827
- u.done ? o(u.value) : s(u.value).then(f, l);
860
+ function l(u) {
861
+ u.done ? o(u.value) : s(u.value).then(f, i);
828
862
  }
829
- c((n = n.apply(e, t || [])).next());
863
+ l((n = n.apply(e, t || [])).next());
830
864
  });
831
865
  };
832
- class yr {
866
+ class vr {
833
867
  constructor(t) {
834
- this._semaphore = new mr(1, t);
868
+ this._semaphore = new wr(1, t);
835
869
  }
836
870
  acquire() {
837
- return _r(this, arguments, void 0, function* (t = 0) {
871
+ return Sr(this, arguments, void 0, function* (t = 0) {
838
872
  const [, r] = yield this._semaphore.acquire(1, t);
839
873
  return r;
840
874
  });
@@ -855,92 +889,92 @@ class yr {
855
889
  return this._semaphore.cancel();
856
890
  }
857
891
  }
858
- class ye extends yr {
892
+ class ve extends vr {
859
893
  constructor(t) {
860
894
  super(), Object.assign(this, t);
861
895
  }
862
896
  }
863
- const wr = (e) => new ye(e), Xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
897
+ const xr = (e) => new ve(e), Qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
864
898
  __proto__: null,
865
- mutex: ye,
866
- newMutex: wr
867
- }, Symbol.toStringTag, { value: "Module" })), vr = (e) => JSON.stringify(e, (t, r) => typeof r == "bigint" ? r.toString() : r), Sr = async (e, t = 200, r = 20) => {
899
+ mutex: ve,
900
+ newMutex: xr
901
+ }, Symbol.toStringTag, { value: "Module" })), Tr = (e) => JSON.stringify(e, (t, r) => typeof r == "bigint" ? r.toString() : r), $r = async (e, t = 200, r = 20) => {
868
902
  const n = Date.now();
869
903
  for (; Date.now() - n < t; )
870
904
  await e(), await new Promise((s) => setTimeout(s, r));
871
- }, Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
905
+ }, Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
872
906
  __proto__: null,
873
- expectAlways: Sr,
874
- toString: vr
907
+ expectAlways: $r,
908
+ toString: Tr
875
909
  }, Symbol.toStringTag, { value: "Module" }));
876
910
  export {
877
- tn as DataType,
878
- rn as Density,
879
- nn as MultiSeries,
880
- sn as Rate,
881
- fs as RoutedWorker,
882
- on as Series,
883
- an as Size,
884
- cn as TimeRange,
911
+ on as DataType,
912
+ an as Density,
913
+ cn as MultiSeries,
914
+ ln as Rate,
915
+ ps as RoutedWorker,
916
+ un as Series,
917
+ fn as Size,
918
+ dn as TimeRange,
885
919
  _ as TimeSpan,
886
- F as TimeStamp,
887
- ds as TypedWorker,
888
- cs as URL,
889
- ln as addSamples,
890
- Qr as array,
891
- Kr as binary,
892
- qn as bounds,
893
- Hn as box,
894
- Or as breaker,
895
- ls as buildQueryString,
896
- yn as caseconv,
897
- vn as change,
898
- Mn as clamp,
899
- kr as color,
900
- $n as compare,
901
- Ar as control,
902
- un as convertDataType,
903
- Dr as convertRenderV,
904
- hs as createMockWorkers,
905
- Nn as debounce,
906
- kn as deep,
907
- Gn as dimensions,
908
- Yn as direction,
909
- Pr as errors,
910
- Zr as flushMicrotasks,
911
- Rr as flushTaskQueue,
912
- fn as id,
913
- dn as instance,
914
- Cr as invert,
915
- hn as isCrudeSeries,
916
- Pn as isObject,
917
- pn as isTelemValue,
918
- Lr as jsonRPC,
919
- Rn as kv,
920
- Ur as label,
921
- Ln as link,
922
- es as location,
923
- qr as map,
924
- Nr as math,
925
- Wr as migrate,
926
- zr as notation,
927
- gn as numericTimeRangeZ,
928
- zn as observe,
929
- jn as primitive,
930
- Bn as record,
931
- Fn as runtime,
932
- xn as scale,
933
- Br as shallowCopy,
934
- Ir as sleep,
935
- rs as spatial,
936
- Vr as status,
937
- Fr as strings,
938
- Xr as sync,
939
- Hr as testutil,
940
- In as throttle,
941
- mn as typedArrayZ,
942
- is as unique,
943
- bn as uuid,
944
- ss as xy,
945
- gs as zod
920
+ X as TimeStamp,
921
+ gs as TypedWorker,
922
+ ds as URL,
923
+ hn as addSamples,
924
+ tn as array,
925
+ nn as binary,
926
+ Bn as bounds,
927
+ Yn as box,
928
+ Rr as breaker,
929
+ hs as buildQueryString,
930
+ vn as caseconv,
931
+ Tn as change,
932
+ jn as clamp,
933
+ Zr as color,
934
+ In as compare,
935
+ Cr as control,
936
+ mn as convertDataType,
937
+ Hr as convertRenderV,
938
+ bs as createMockWorkers,
939
+ kn as debounce,
940
+ Zn as deep,
941
+ es as dimensions,
942
+ rs as direction,
943
+ Lr as errors,
944
+ Ur as flushMicrotasks,
945
+ qr as flushTaskQueue,
946
+ pn as id,
947
+ gn as instance,
948
+ Wr as invert,
949
+ bn as isCrudeSeries,
950
+ Ln as isObject,
951
+ _n as isTelemValue,
952
+ zr as jsonRPC,
953
+ qn as kv,
954
+ Dr as label,
955
+ zn as link,
956
+ ss as location,
957
+ Br as map,
958
+ kr as math,
959
+ Fr as migrate,
960
+ Vr as notation,
961
+ yn as numericTimeRangeZ,
962
+ Vn as observe,
963
+ On as primitive,
964
+ Xn as record,
965
+ Jn as runtime,
966
+ Nn as scale,
967
+ Xr as shallowCopy,
968
+ Pr as sleep,
969
+ is as spatial,
970
+ Gr as status,
971
+ Jr as strings,
972
+ Qr as sync,
973
+ Yr as testutil,
974
+ Pn as throttle,
975
+ wn as typedArrayZ,
976
+ us as unique,
977
+ Mn as uuid,
978
+ cs as xy,
979
+ ys as zod
946
980
  };