@synnaxlabs/freighter 0.54.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -10
- package/dist/freighter.cjs +10 -5
- package/dist/freighter.js +1715 -1304
- package/dist/src/alamos.d.ts.map +1 -1
- package/dist/src/http.d.ts +1 -1
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/middleware.d.ts +19 -15
- package/dist/src/middleware.d.ts.map +1 -1
- package/dist/src/stream.d.ts +27 -29
- package/dist/src/stream.d.ts.map +1 -1
- package/dist/src/unary.d.ts +5 -4
- package/dist/src/unary.d.ts.map +1 -1
- package/dist/src/websocket.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/alamos.ts +23 -12
- package/src/http.spec.ts +10 -36
- package/src/http.ts +16 -20
- package/src/index.ts +1 -1
- package/src/middleware.ts +20 -19
- package/src/stream.ts +27 -29
- package/src/unary.ts +15 -23
- package/src/websocket.spec.ts +20 -33
- package/src/websocket.ts +20 -28
package/dist/freighter.js
CHANGED
|
@@ -26,6 +26,7 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
26
26
|
if (e == null) return;
|
|
27
27
|
let t = e._zod?.def;
|
|
28
28
|
if (t?.type === "array" && t.element != null) return t.element;
|
|
29
|
+
if (t?.innerType != null) return c(t.innerType);
|
|
29
30
|
if (t?.type === "union" && Array.isArray(t.options)) for (let e of t.options) {
|
|
30
31
|
let t = c(e);
|
|
31
32
|
if (t != null) return t;
|
|
@@ -41,9 +42,14 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
41
42
|
let n = t._zod?.def;
|
|
42
43
|
if (n == null) return null;
|
|
43
44
|
if (n.innerType != null) return l(n.innerType);
|
|
44
|
-
if (n.type === "union" && Array.isArray(n.options))
|
|
45
|
-
let
|
|
46
|
-
|
|
45
|
+
if (n.type === "union" && Array.isArray(n.options)) {
|
|
46
|
+
let e = null;
|
|
47
|
+
for (let t of n.options) {
|
|
48
|
+
let n = l(t);
|
|
49
|
+
if (n != null) if (e == null) e = { ...n };
|
|
50
|
+
else for (let t in n) t in e || (e[t] = n[t]);
|
|
51
|
+
}
|
|
52
|
+
return e;
|
|
47
53
|
}
|
|
48
54
|
return n.type === "pipe" ? l(n.in) ?? l(n.out) : null;
|
|
49
55
|
}, u = (e) => {
|
|
@@ -85,77 +91,200 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
85
91
|
recursive: !0,
|
|
86
92
|
recursiveInArray: !0,
|
|
87
93
|
schema: void 0
|
|
88
|
-
}, h = (e) => typeof e == "object" && !!e && !Array.isArray(e), g = (e) => e instanceof Uint8Array || e instanceof Number || e instanceof String, _ = (e) => typeof e == "object" && !!e && !Array.isArray(e), ee =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
}, h = (e) => typeof e == "object" && !!e && !Array.isArray(e), g = (e) => e instanceof Uint8Array || e instanceof Number || e instanceof String, _ = (e) => typeof e == "object" && !!e && !Array.isArray(e), ee = (e) => {
|
|
95
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
96
|
+
let t = Object.getPrototypeOf(e);
|
|
97
|
+
return t === Object.prototype || t === null;
|
|
98
|
+
}, te = (e, t) => {
|
|
99
|
+
let n = e;
|
|
100
|
+
for (let e of t) {
|
|
101
|
+
if (typeof n != "object" || !n) return {
|
|
102
|
+
present: !1,
|
|
103
|
+
value: void 0
|
|
104
|
+
};
|
|
105
|
+
let t = n;
|
|
106
|
+
if (!(e in t)) return {
|
|
107
|
+
present: !1,
|
|
108
|
+
value: void 0
|
|
109
|
+
};
|
|
110
|
+
n = t[e];
|
|
97
111
|
}
|
|
98
|
-
|
|
99
|
-
|
|
112
|
+
return {
|
|
113
|
+
present: !0,
|
|
114
|
+
value: n
|
|
115
|
+
};
|
|
116
|
+
}, ne = (e, t) => {
|
|
117
|
+
let n = Array.isArray(e), r = Array.isArray(t);
|
|
118
|
+
if (n !== r) return !1;
|
|
119
|
+
if (n && r) {
|
|
120
|
+
let n = e, r = t;
|
|
121
|
+
if (n.length !== r.length) return !1;
|
|
122
|
+
for (let e = 0; e < n.length; e++) if (!ne(n[e], r[e])) return !1;
|
|
123
|
+
return !0;
|
|
100
124
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
125
|
+
if (e == null || t == null || typeof e != "object" || typeof t != "object") return e === t;
|
|
126
|
+
if ("equals" in e) return e.equals(t);
|
|
127
|
+
let i = Object.keys(e), a = Object.keys(t);
|
|
128
|
+
if (i.length !== a.length) return !1;
|
|
129
|
+
for (let n of i) {
|
|
130
|
+
let r = e[n], i = t[n];
|
|
131
|
+
if (typeof r == "object" && typeof i == "object") {
|
|
132
|
+
if (!ne(r, i)) return !1;
|
|
133
|
+
} else if (r !== i) return !1;
|
|
104
134
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
135
|
+
return !0;
|
|
136
|
+
}, re = (e, t) => {
|
|
137
|
+
if (typeof e != "object" || !e) return e === t;
|
|
138
|
+
let n = Object.keys(e), r = Object.keys(t);
|
|
139
|
+
if (r.length > n.length) return !1;
|
|
140
|
+
for (let n of r) {
|
|
141
|
+
let r = e[n], i = t[n];
|
|
142
|
+
if (typeof r == "object" && typeof i == "object") {
|
|
143
|
+
if (!re(r, i)) return !1;
|
|
144
|
+
} else if (r !== i) return !1;
|
|
108
145
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
146
|
+
return !0;
|
|
147
|
+
}, ie = (e, ...t) => {
|
|
148
|
+
if (t.length === 0) return e;
|
|
149
|
+
let n = t.shift();
|
|
150
|
+
if (_(e) && _(n)) for (let t in n) try {
|
|
151
|
+
_(n[t]) ? (t in e || Object.assign(e, { [t]: {} }), ie(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
|
|
152
|
+
} catch (e) {
|
|
153
|
+
throw e instanceof TypeError ? TypeError(`.${t}: ${e.message}`, { cause: e }) : e;
|
|
114
154
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
155
|
+
return ie(e, ...t);
|
|
156
|
+
}, ae = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), oe = (e, t) => {
|
|
157
|
+
let n = Symbol.for(e);
|
|
158
|
+
if (!ae(n)) {
|
|
159
|
+
let e = t();
|
|
160
|
+
Object.defineProperty(globalThis, n, { value: e });
|
|
118
161
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
162
|
+
return () => globalThis[n];
|
|
163
|
+
}, v = /* @__PURE__ */ r({
|
|
164
|
+
Canceled: () => ye,
|
|
165
|
+
NONE: () => "nil",
|
|
166
|
+
NotImplemented: () => be,
|
|
167
|
+
UNKNOWN: () => b,
|
|
168
|
+
Unknown: () => _e,
|
|
169
|
+
createTyped: () => y,
|
|
170
|
+
decode: () => ge,
|
|
171
|
+
encode: () => he,
|
|
172
|
+
isTyped: () => le,
|
|
173
|
+
payloadZ: () => ve,
|
|
174
|
+
register: () => me
|
|
175
|
+
}), se = "sy_x_error", ce = (e) => (t) => typeof t == "object" && t && "type" in t && typeof t.type == "string" ? t.type.startsWith(e) : t instanceof Error ? t.message.startsWith(e) : typeof t == "string" ? t.startsWith(e) : !1, y = (e) => class t extends Error {
|
|
176
|
+
static discriminator = se;
|
|
177
|
+
discriminator = t.discriminator;
|
|
178
|
+
static TYPE = e;
|
|
179
|
+
type = t.TYPE;
|
|
180
|
+
static matches = ce(e);
|
|
181
|
+
matches = t.matches;
|
|
182
|
+
constructor(e, n) {
|
|
183
|
+
super(e, n), this.name = t.TYPE;
|
|
126
184
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (n.length === 0) return t == null ? {} : t.parse({});
|
|
130
|
-
let i = n.split(",").map((e) => e.trim()), a = {};
|
|
131
|
-
return i.forEach((e) => {
|
|
132
|
-
a[e] = [];
|
|
133
|
-
}), r.forEach((e) => {
|
|
134
|
-
let t = e.split(",").map((e) => e.trim());
|
|
135
|
-
i.forEach((e, n) => {
|
|
136
|
-
let r = this.parseValue(t[n]);
|
|
137
|
-
r != null && a[e].push(r);
|
|
138
|
-
});
|
|
139
|
-
}), t == null ? a : t.parse(a);
|
|
185
|
+
static sub(t) {
|
|
186
|
+
return y(`${e}.${t}`);
|
|
140
187
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
188
|
+
}, le = (e) => {
|
|
189
|
+
if (typeof e != "object" || !e) return !1;
|
|
190
|
+
let t = e;
|
|
191
|
+
if (t.discriminator !== se) return !1;
|
|
192
|
+
if (!("type" in t)) throw Error(`X Error is missing its type property: ${JSON.stringify(t)}`);
|
|
193
|
+
return !0;
|
|
194
|
+
}, b = "unknown", ue = (e, t) => ({
|
|
195
|
+
...e,
|
|
196
|
+
name: t.name,
|
|
197
|
+
stack: t.stack
|
|
198
|
+
}), de = (e, t) => (t.name != null && (e.name = t.name), t.stack != null && (e.stack = t.stack), e), fe = class {
|
|
199
|
+
providers = [];
|
|
200
|
+
register(e) {
|
|
201
|
+
this.providers.push(e);
|
|
145
202
|
}
|
|
146
|
-
}, ne = class {
|
|
147
|
-
contentType = "text/plain";
|
|
148
203
|
encode(e) {
|
|
149
|
-
if (
|
|
150
|
-
|
|
204
|
+
if (e == null) return {
|
|
205
|
+
type: "nil",
|
|
206
|
+
data: ""
|
|
207
|
+
};
|
|
208
|
+
if (le(e)) for (let t of this.providers) {
|
|
209
|
+
let n = t.encode(e);
|
|
210
|
+
if (n != null) return ue(n, e);
|
|
211
|
+
}
|
|
212
|
+
if (e instanceof Error) return ue({
|
|
213
|
+
type: b,
|
|
214
|
+
data: e.message
|
|
215
|
+
}, e);
|
|
216
|
+
if (typeof e == "string") return {
|
|
217
|
+
type: b,
|
|
218
|
+
data: e
|
|
219
|
+
};
|
|
220
|
+
try {
|
|
221
|
+
return {
|
|
222
|
+
type: b,
|
|
223
|
+
data: JSON.stringify(e)
|
|
224
|
+
};
|
|
225
|
+
} catch {
|
|
226
|
+
return {
|
|
227
|
+
type: b,
|
|
228
|
+
data: "unable to encode error information"
|
|
229
|
+
};
|
|
230
|
+
}
|
|
151
231
|
}
|
|
152
|
-
decode(e
|
|
153
|
-
|
|
154
|
-
|
|
232
|
+
decode(e) {
|
|
233
|
+
if (e == null || e.type === "nil") return null;
|
|
234
|
+
if (e.type === "unknown") return de(new _e(e.data), e);
|
|
235
|
+
for (let t of this.providers) {
|
|
236
|
+
let n = t.decode(e);
|
|
237
|
+
if (n != null) return de(n, e);
|
|
238
|
+
}
|
|
239
|
+
return de(new _e(e.data), e);
|
|
155
240
|
}
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
|
|
241
|
+
}, pe = oe("synnax-error-registry", () => new fe()), me = ({ encode: e, decode: t }) => pe().register({
|
|
242
|
+
encode: e,
|
|
243
|
+
decode: t
|
|
244
|
+
}), he = (e) => pe().encode(e), ge = (e) => e == null ? null : pe().decode(e), _e = class extends y("unknown") {}, ve = t.object({
|
|
245
|
+
type: t.string(),
|
|
246
|
+
data: t.string(),
|
|
247
|
+
name: t.string().optional(),
|
|
248
|
+
stack: t.string().optional()
|
|
249
|
+
}), ye = class extends y("canceled") {}, be = class extends y("not_implemented") {}, xe = (e) => {
|
|
250
|
+
if (e.length === 0) return "<root>";
|
|
251
|
+
let t = "";
|
|
252
|
+
return e.forEach((e, n) => {
|
|
253
|
+
typeof e == "number" ? t += `[${e}]` : n === 0 ? t += String(e) : t += `.${String(e)}`;
|
|
254
|
+
}), t;
|
|
255
|
+
}, Se = 200, Ce = 10, we = 8, x = (e, t = {}) => {
|
|
256
|
+
let n = t.maxStringLength ?? Se, r = t.maxArrayLength ?? Ce, i = t.maxDepth ?? we, a = (e, t) => {
|
|
257
|
+
if (e === null) return null;
|
|
258
|
+
if (e === void 0) return "[undefined]";
|
|
259
|
+
let o = typeof e;
|
|
260
|
+
if (o === "string") {
|
|
261
|
+
let t = e;
|
|
262
|
+
return t.length > n ? `${t.slice(0, n)}…(+${t.length - n} chars)` : t;
|
|
263
|
+
}
|
|
264
|
+
if (o === "number" || o === "boolean") return e;
|
|
265
|
+
if (o === "bigint") return `${e.toString()}n`;
|
|
266
|
+
if (o === "symbol" || o === "function") return `[${o}]`;
|
|
267
|
+
if (Array.isArray(e)) {
|
|
268
|
+
if (t >= i) return `[Array(${e.length})]`;
|
|
269
|
+
let n = e.slice(0, r).map((e) => a(e, t + 1));
|
|
270
|
+
return e.length > r && n.push(`…(+${e.length - r} more)`), n;
|
|
271
|
+
}
|
|
272
|
+
if (ee(e)) {
|
|
273
|
+
if (t >= i) return "[Object]";
|
|
274
|
+
let n = {};
|
|
275
|
+
for (let [r, i] of Object.entries(e)) n[r] = a(i, t + 1);
|
|
276
|
+
return n;
|
|
277
|
+
}
|
|
278
|
+
if (e instanceof Date) return e.toISOString();
|
|
279
|
+
if (e instanceof Error) return `[Error: ${e.message}]`;
|
|
280
|
+
try {
|
|
281
|
+
return `[${Object.prototype.toString.call(e)}]`;
|
|
282
|
+
} catch {
|
|
283
|
+
return "[unknown]";
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
return a(e, 0);
|
|
287
|
+
}, Te = (e, t = {}) => JSON.stringify(x(e, t), null, 2), S = (e) => typeof e == "object" && !!e && "value" in e, C = class {
|
|
159
288
|
value;
|
|
160
289
|
constructor(e) {
|
|
161
290
|
this.value = e;
|
|
@@ -169,49 +298,257 @@ var v = (e) => typeof e == "object" && !!e && "value" in e, y = class {
|
|
|
169
298
|
toString() {
|
|
170
299
|
return this.value.toString();
|
|
171
300
|
}
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
case "
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
case "
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
case "
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
301
|
+
}, Ee = (e) => typeof e == "object" && !!e && "toString" in e, De = (e) => e == null || typeof e != "object" && typeof e != "function", Oe = "value", ke = "zod.parse", Ae = "✗", je = 60, Me = {
|
|
302
|
+
maxStringLength: 60,
|
|
303
|
+
maxArrayLength: 3,
|
|
304
|
+
maxDepth: 3
|
|
305
|
+
}, Ne = (e) => e.slice(0, -1), Pe = (e) => {
|
|
306
|
+
switch (e.code) {
|
|
307
|
+
case "invalid_type": return `expected ${e.expected}`;
|
|
308
|
+
case "invalid_value": return `expected one of ${JSON.stringify(e.values)}`;
|
|
309
|
+
case "unrecognized_keys": return "unexpected key";
|
|
310
|
+
case "too_small": {
|
|
311
|
+
let t = e.inclusive === !1 ? ">" : ">=";
|
|
312
|
+
return `${e.origin} too small: expected ${t}${e.minimum}`;
|
|
313
|
+
}
|
|
314
|
+
case "too_big": {
|
|
315
|
+
let t = e.inclusive === !1 ? "<" : "<=";
|
|
316
|
+
return `${e.origin} too large: expected ${t}${e.maximum}`;
|
|
317
|
+
}
|
|
318
|
+
case "invalid_format": return `expected ${e.format} format`;
|
|
319
|
+
case "not_multiple_of": return `expected multiple of ${e.divisor}`;
|
|
320
|
+
case "custom": return e.message || "custom validation failed";
|
|
321
|
+
default: return e.message;
|
|
322
|
+
}
|
|
323
|
+
}, Fe = (e, t, n) => {
|
|
324
|
+
let r = JSON.stringify(x(t, n));
|
|
325
|
+
return `${Pe(e)}, received ${r}`;
|
|
326
|
+
}, w = (e) => {
|
|
327
|
+
let t = 0;
|
|
328
|
+
for (let n of e) {
|
|
329
|
+
if (n.path.length > t && (t = n.path.length), n.code === "invalid_union" && "errors" in n) for (let e of n.errors) {
|
|
330
|
+
let n = w(e);
|
|
331
|
+
n > t && (t = n);
|
|
332
|
+
}
|
|
333
|
+
if ((n.code === "invalid_key" || n.code === "invalid_element") && "issues" in n) {
|
|
334
|
+
let e = w(n.issues);
|
|
335
|
+
e > t && (t = e);
|
|
336
|
+
}
|
|
194
337
|
}
|
|
195
|
-
return t
|
|
196
|
-
},
|
|
197
|
-
let
|
|
198
|
-
for (
|
|
199
|
-
|
|
200
|
-
|
|
338
|
+
return t;
|
|
339
|
+
}, T = (e, t = []) => {
|
|
340
|
+
let n = [];
|
|
341
|
+
for (let r of e) {
|
|
342
|
+
let e = [...t, ...r.path];
|
|
343
|
+
if (r.code === "invalid_union" && "errors" in r && r.errors.length > 0) {
|
|
344
|
+
let t = r.errors[0], i = w(t);
|
|
345
|
+
for (let e = 1; e < r.errors.length; e++) {
|
|
346
|
+
let n = w(r.errors[e]);
|
|
347
|
+
n > i && (t = r.errors[e], i = n);
|
|
348
|
+
}
|
|
349
|
+
n.push(...T(t, e));
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
if (r.code === "invalid_element" && "issues" in r && "key" in r && (typeof r.key == "string" || typeof r.key == "number")) {
|
|
353
|
+
n.push(...T(r.issues, [...e, r.key]));
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
if (r.code === "invalid_key" && "issues" in r) {
|
|
357
|
+
n.push(...T(r.issues, e));
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
n.push({
|
|
361
|
+
...r,
|
|
362
|
+
path: e
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return n;
|
|
366
|
+
}, Ie = (e) => {
|
|
367
|
+
let t = [];
|
|
368
|
+
for (let n of e) {
|
|
369
|
+
if (n.code === "unrecognized_keys" && "keys" in n && Array.isArray(n.keys)) {
|
|
370
|
+
for (let e of n.keys) t.push({
|
|
371
|
+
...n,
|
|
372
|
+
path: [...n.path, e]
|
|
373
|
+
});
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
t.push(n);
|
|
377
|
+
}
|
|
378
|
+
return t;
|
|
379
|
+
}, Le = (e, t, n, r) => {
|
|
380
|
+
let i = `${n} `, a = `${n + Ae} `, o = {
|
|
381
|
+
...Me,
|
|
382
|
+
...r
|
|
383
|
+
};
|
|
384
|
+
if (Array.isArray(e)) {
|
|
385
|
+
let e = -1;
|
|
386
|
+
for (let n of t.keys()) {
|
|
387
|
+
let t = Number(n);
|
|
388
|
+
Number.isInteger(t) && t > e && (e = t);
|
|
389
|
+
}
|
|
390
|
+
let n = o.maxArrayLength ?? 3;
|
|
391
|
+
e >= n && (o = {
|
|
392
|
+
...o,
|
|
393
|
+
maxArrayLength: e + 2
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
let s = x(e, o);
|
|
397
|
+
if (typeof s != "object" || !s) {
|
|
398
|
+
let e = JSON.stringify(s), n = t.values().next().value;
|
|
399
|
+
return [`${a}${e}${n ? ` × ${n.reason}` : ""}`];
|
|
400
|
+
}
|
|
401
|
+
let c = [], l = Array.isArray(s);
|
|
402
|
+
c.push(`${n}${l ? "[" : "{"}`);
|
|
403
|
+
let u = [];
|
|
404
|
+
if (l) {
|
|
405
|
+
let e = s;
|
|
406
|
+
for (let n = 0; n < e.length; n++) {
|
|
407
|
+
let r = t.get(String(n));
|
|
408
|
+
u.push({
|
|
409
|
+
content: JSON.stringify(e[n]),
|
|
410
|
+
mark: r && !r.missing ? r : void 0
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
} else {
|
|
414
|
+
let e = s;
|
|
415
|
+
for (let n of Object.keys(e)) {
|
|
416
|
+
let r = t.get(n);
|
|
417
|
+
u.push({
|
|
418
|
+
content: `"${n}": ${JSON.stringify(e[n])}`,
|
|
419
|
+
mark: r && !r.missing ? r : void 0
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
for (let [e, n] of t.entries()) n.missing && u.push({
|
|
423
|
+
content: `"${e}": <missing>`,
|
|
424
|
+
mark: n
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
let d = 0;
|
|
428
|
+
return u.forEach((e, t) => {
|
|
429
|
+
if (e.mark == null) return;
|
|
430
|
+
let n = +(t < u.length - 1), r = e.content.length + n;
|
|
431
|
+
r > d && r <= je && (d = r);
|
|
432
|
+
}), u.forEach((e, t) => {
|
|
433
|
+
let n = t < u.length - 1 ? "," : "", r = e.content + n;
|
|
434
|
+
if (e.mark != null) {
|
|
435
|
+
let t = " ".repeat(Math.max(2, d - r.length + 2));
|
|
436
|
+
c.push(`${a}${r}${t}× ${e.mark.reason}`);
|
|
437
|
+
} else c.push(`${i}${r}`);
|
|
438
|
+
}), c.push(n + (l ? "]" : "}")), c;
|
|
439
|
+
}, Re = "__root__", ze = (e, t, n) => {
|
|
440
|
+
let r = /* @__PURE__ */ new Map();
|
|
441
|
+
for (let t of e) {
|
|
442
|
+
let e = t.path.length === 0 ? Re : `::${xe(Ne(t.path))}`, n = r.get(e);
|
|
443
|
+
n == null ? r.set(e, [t]) : n.push(t);
|
|
444
|
+
}
|
|
445
|
+
let i = [];
|
|
446
|
+
for (let [e, a] of r) {
|
|
447
|
+
if (e === Re) {
|
|
448
|
+
i.push(a.map((e) => ` × ${Fe(e, t, n)}`).join("\n"));
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
let r = Ne(a[0].path), { present: o, value: s } = te(t, r);
|
|
452
|
+
if (!o) {
|
|
453
|
+
i.push(a.map((e) => ` at ${xe(e.path)}\n × ${Fe(e, t, n)}`).join("\n"));
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
let c = /* @__PURE__ */ new Map();
|
|
457
|
+
for (let e of a) {
|
|
458
|
+
let n = String(e.path[e.path.length - 1]), r = te(t, e.path);
|
|
459
|
+
c.set(n, {
|
|
460
|
+
reason: Pe(e),
|
|
461
|
+
missing: !r.present
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
let l = r.length === 0, u = Le(s, c, l ? " " : " ", n);
|
|
465
|
+
l ? i.push(u.join("\n")) : i.push([` at ${xe(r)}`, ...u].join("\n"));
|
|
466
|
+
}
|
|
467
|
+
return i.join("\n\n");
|
|
468
|
+
}, Be = (e, t) => {
|
|
469
|
+
let n = Object.entries(e);
|
|
470
|
+
return n.every(([, e]) => De(e)) ? n.map(([e, t]) => `${e}=${typeof t == "string" ? t : String(t)}`).join(", ") : Te(e, t);
|
|
471
|
+
}, Ve = ({ issues: e, input: t, label: n, context: r, formatOptions: i }) => {
|
|
472
|
+
let a = i ?? {}, o = Ie(T(e)), s = [`Failed to parse ${n} (${o.length === 1 ? "1 issue" : `${o.length} issues`})`];
|
|
473
|
+
return s.push(ze(o, t, a)), r != null && Object.keys(r).length > 0 && s.push(` context: ${Be(r, a)}`), s.join("\n\n");
|
|
474
|
+
}, He = class extends y(ke) {
|
|
475
|
+
issues;
|
|
476
|
+
input;
|
|
477
|
+
label;
|
|
478
|
+
context;
|
|
479
|
+
constructor({ issues: e, input: t, label: n, context: r, cause: i, formatOptions: a }) {
|
|
480
|
+
super(Ve({
|
|
481
|
+
issues: e,
|
|
482
|
+
input: t,
|
|
483
|
+
label: n,
|
|
484
|
+
context: r,
|
|
485
|
+
formatOptions: a
|
|
486
|
+
}), { cause: i }), this.issues = e, this.input = t, this.label = n, this.context = r;
|
|
487
|
+
}
|
|
488
|
+
toStatus() {
|
|
489
|
+
let e = {
|
|
490
|
+
input: x(this.input),
|
|
491
|
+
issues: this.issues
|
|
492
|
+
};
|
|
493
|
+
return this.context != null && (e.context = this.context), {
|
|
494
|
+
message: `Failed to parse ${this.label}`,
|
|
495
|
+
description: this.message,
|
|
496
|
+
details: e
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
me({
|
|
501
|
+
encode: (e) => {
|
|
502
|
+
if (!He.matches(e)) return null;
|
|
503
|
+
let t = e, n = {
|
|
504
|
+
label: t.label,
|
|
505
|
+
context: t.context,
|
|
506
|
+
issues: t.issues,
|
|
507
|
+
input: x(t.input)
|
|
508
|
+
};
|
|
509
|
+
return {
|
|
510
|
+
type: ke,
|
|
511
|
+
data: JSON.stringify(n)
|
|
512
|
+
};
|
|
513
|
+
},
|
|
514
|
+
decode: (e) => {
|
|
515
|
+
if (e.type !== ke) return null;
|
|
516
|
+
let t = JSON.parse(e.data);
|
|
517
|
+
return new He({
|
|
518
|
+
issues: t.issues,
|
|
519
|
+
input: t.input,
|
|
520
|
+
label: t.label,
|
|
521
|
+
context: t.context
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
var Ue = (e, t, n = {}) => {
|
|
526
|
+
let r = e.safeParse(t);
|
|
527
|
+
if (r.success) return r.data;
|
|
528
|
+
throw new He({
|
|
529
|
+
issues: r.error.issues,
|
|
530
|
+
input: t,
|
|
531
|
+
label: n.label ?? Oe,
|
|
532
|
+
context: n.context,
|
|
533
|
+
cause: r.error
|
|
534
|
+
});
|
|
535
|
+
}, We = 2 ** 12 - 1, Ge = 2 ** 16 - 1, Ke = 2 ** 20 - 1, qe = -128, Je = -(2 ** 15), Ye = 2 ** 15 - 1, Xe = -(2n ** 63n), Ze = 2n ** 63n - 1n, Qe = -(2 ** 63), $e = 2 ** 63 - 1, E = (e) => (t, n) => {
|
|
201
536
|
if (typeof t == "bigint") {
|
|
202
|
-
if (
|
|
537
|
+
if (et(n)) return e(t, BigInt(n));
|
|
203
538
|
let r = e(Number(t), Number(n));
|
|
204
539
|
return typeof r == "number" ? BigInt(Math.round(r)) : r;
|
|
205
540
|
}
|
|
206
541
|
return e(Number(t), Number(n));
|
|
207
|
-
},
|
|
542
|
+
}, D = E((e, t) => e - t), O = E((e, t) => e + t), et = (e) => typeof e == "bigint" ? !0 : Number.isInteger(e), k = E((e, t) => e * t), A = E((e, t) => e / t), tt = ["left", "right"], nt = t.enum(tt), rt = t.enum(["top", "bottom"]), it = t.enum(["px", "decimal"]), at = [
|
|
208
543
|
"top",
|
|
209
544
|
"right",
|
|
210
545
|
"bottom",
|
|
211
546
|
"left"
|
|
212
547
|
];
|
|
213
|
-
t.enum(
|
|
214
|
-
var
|
|
548
|
+
t.enum(at);
|
|
549
|
+
var ot = t.enum(["x", "y"]);
|
|
550
|
+
t.enum(["clockwise", "counterclockwise"]);
|
|
551
|
+
var st = ["center"], ct = t.enum(st);
|
|
215
552
|
t.enum([
|
|
216
553
|
"top",
|
|
217
554
|
"right",
|
|
@@ -222,31 +559,36 @@ t.enum([
|
|
|
222
559
|
"start",
|
|
223
560
|
"center",
|
|
224
561
|
"end"
|
|
225
|
-
]), t.enum(["first", "last"]);
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}),
|
|
562
|
+
]), t.enum(["first", "last"]), t.enum(["width", "height"]), t.enum(["signedWidth", "signedHeight"]);
|
|
563
|
+
var j = t.object({
|
|
564
|
+
x: t.number(),
|
|
565
|
+
y: t.number()
|
|
566
|
+
}), lt = t.object({
|
|
567
|
+
x: nt,
|
|
568
|
+
y: rt
|
|
569
|
+
}), ut = t.object({
|
|
570
|
+
x: it,
|
|
571
|
+
y: it
|
|
572
|
+
}), dt = t.object({
|
|
230
573
|
width: t.number(),
|
|
231
574
|
height: t.number()
|
|
232
|
-
}),
|
|
575
|
+
}), ft = t.object({
|
|
233
576
|
signedWidth: t.number(),
|
|
234
577
|
signedHeight: t.number()
|
|
578
|
+
}), pt = t.object({
|
|
579
|
+
clientX: t.number(),
|
|
580
|
+
clientY: t.number()
|
|
235
581
|
});
|
|
236
582
|
t.object({
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
})
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
t.enum([...Ee, ...E]),
|
|
247
|
-
t.instanceof(String)
|
|
248
|
-
]);
|
|
249
|
-
var D = (e, t, n) => {
|
|
583
|
+
zoom: t.number().default(1),
|
|
584
|
+
position: j
|
|
585
|
+
});
|
|
586
|
+
var mt = t.object({
|
|
587
|
+
x: t.number(),
|
|
588
|
+
y: t.number(),
|
|
589
|
+
root: lt.optional(),
|
|
590
|
+
units: ut.optional()
|
|
591
|
+
}), ht = t.tuple([t.number(), t.number()]), M = (e, t, n) => {
|
|
250
592
|
let r = {};
|
|
251
593
|
if (typeof t == "object" && (n = t, t = void 0), n = {
|
|
252
594
|
makeValid: !0,
|
|
@@ -256,7 +598,7 @@ var D = (e, t, n) => {
|
|
|
256
598
|
if (e.length !== 2) throw Error("bounds: expected array of length 2");
|
|
257
599
|
[r.lower, r.upper] = e;
|
|
258
600
|
} else r.lower = e.lower, r.upper = e.upper;
|
|
259
|
-
return n?.makeValid ?
|
|
601
|
+
return n?.makeValid ? gt(r) : r;
|
|
260
602
|
};
|
|
261
603
|
Object.freeze({
|
|
262
604
|
lower: 0,
|
|
@@ -271,451 +613,87 @@ Object.freeze({
|
|
|
271
613
|
lower: -1,
|
|
272
614
|
upper: 1
|
|
273
615
|
});
|
|
274
|
-
var
|
|
616
|
+
var gt = (e) => e.lower > e.upper ? {
|
|
275
617
|
lower: e.upper,
|
|
276
618
|
upper: e.lower
|
|
277
|
-
} : e,
|
|
278
|
-
let n =
|
|
619
|
+
} : e, _t = (e, t) => {
|
|
620
|
+
let n = M(e);
|
|
279
621
|
return t < n.lower ? n.lower : t >= n.upper ? n.upper - (typeof n.upper == "number" ? 1 : 1n) : t;
|
|
280
622
|
};
|
|
281
|
-
t.
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}), O = Object.freeze({
|
|
289
|
-
x: "left",
|
|
290
|
-
y: "top"
|
|
291
|
-
}), Le = Object.freeze({
|
|
292
|
-
x: "right",
|
|
293
|
-
y: "top"
|
|
294
|
-
}), Re = Object.freeze({
|
|
295
|
-
x: "left",
|
|
296
|
-
y: "bottom"
|
|
297
|
-
}), ze = Object.freeze({
|
|
298
|
-
x: "right",
|
|
299
|
-
y: "bottom"
|
|
300
|
-
}), Be = Object.freeze({
|
|
301
|
-
x: "center",
|
|
302
|
-
y: "center"
|
|
303
|
-
}), Ve = Object.freeze({
|
|
304
|
-
x: "center",
|
|
305
|
-
y: "top"
|
|
306
|
-
}), He = Object.freeze({
|
|
307
|
-
x: "center",
|
|
308
|
-
y: "bottom"
|
|
309
|
-
}), Ue = Object.freeze({
|
|
310
|
-
x: "right",
|
|
311
|
-
y: "center"
|
|
312
|
-
}), We = Object.freeze({
|
|
313
|
-
x: "left",
|
|
314
|
-
y: "center"
|
|
315
|
-
});
|
|
316
|
-
Object.freeze([
|
|
317
|
-
We,
|
|
318
|
-
Ue,
|
|
319
|
-
Ve,
|
|
320
|
-
He,
|
|
321
|
-
O,
|
|
322
|
-
Le,
|
|
323
|
-
Re,
|
|
324
|
-
ze,
|
|
325
|
-
Be
|
|
326
|
-
]);
|
|
327
|
-
var Ge = (e, t) => e.x === t.x && e.y === t.y, Ke = (e) => [e.x, e.y];
|
|
328
|
-
t.enum([
|
|
329
|
-
"top",
|
|
330
|
-
"right",
|
|
331
|
-
"bottom",
|
|
332
|
-
"left"
|
|
333
|
-
]);
|
|
334
|
-
var k = t.object({
|
|
335
|
-
x: t.number(),
|
|
336
|
-
y: t.number()
|
|
337
|
-
}), qe = t.union([
|
|
338
|
-
t.number(),
|
|
339
|
-
k,
|
|
340
|
-
we,
|
|
341
|
-
Me,
|
|
342
|
-
Ne,
|
|
343
|
-
je
|
|
344
|
-
]), A = (e, t) => {
|
|
345
|
-
if (typeof e == "string") {
|
|
346
|
-
if (t === void 0) throw Error("The y coordinate must be given.");
|
|
347
|
-
return e === "x" ? {
|
|
348
|
-
x: t,
|
|
349
|
-
y: 0
|
|
350
|
-
} : {
|
|
351
|
-
x: 0,
|
|
352
|
-
y: t
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
return typeof e == "number" ? {
|
|
356
|
-
x: e,
|
|
357
|
-
y: t ?? e
|
|
358
|
-
} : Array.isArray(e) ? {
|
|
359
|
-
x: e[0],
|
|
360
|
-
y: e[1]
|
|
361
|
-
} : "signedWidth" in e ? {
|
|
362
|
-
x: e.signedWidth,
|
|
363
|
-
y: e.signedHeight
|
|
364
|
-
} : "clientX" in e ? {
|
|
365
|
-
x: e.clientX,
|
|
366
|
-
y: e.clientY
|
|
367
|
-
} : "width" in e ? {
|
|
368
|
-
x: e.width,
|
|
369
|
-
y: e.height
|
|
370
|
-
} : {
|
|
371
|
-
x: e.x,
|
|
372
|
-
y: e.y
|
|
373
|
-
};
|
|
374
|
-
}, j = Object.freeze({
|
|
375
|
-
x: 0,
|
|
376
|
-
y: 0
|
|
377
|
-
});
|
|
378
|
-
Object.freeze({
|
|
379
|
-
x: 1,
|
|
380
|
-
y: 1
|
|
381
|
-
}), Object.freeze({
|
|
382
|
-
x: Infinity,
|
|
383
|
-
y: Infinity
|
|
384
|
-
}), Object.freeze({
|
|
385
|
-
x: NaN,
|
|
386
|
-
y: NaN
|
|
387
|
-
});
|
|
388
|
-
var Je = (e, t) => {
|
|
389
|
-
let n = A(e);
|
|
390
|
-
return {
|
|
391
|
-
x: n.x + t,
|
|
392
|
-
y: n.y
|
|
393
|
-
};
|
|
394
|
-
}, Ye = (e, t) => {
|
|
395
|
-
let n = A(e);
|
|
396
|
-
return {
|
|
397
|
-
x: n.x,
|
|
398
|
-
y: n.y + t
|
|
399
|
-
};
|
|
400
|
-
}, Xe = (e, t, n, ...r) => {
|
|
401
|
-
if (typeof t == "string") {
|
|
402
|
-
if (typeof n != "number") throw Error("The value must be a number.");
|
|
403
|
-
return t === "x" ? Je(e, n) : Ye(e, n);
|
|
404
|
-
}
|
|
405
|
-
if (typeof t == "object" && "x" in t && typeof t.x == "string") {
|
|
406
|
-
let r = A(n), i = A(e);
|
|
407
|
-
return t.x === "left" ? r.x = -r.x : t.x === "center" && (r.x = 0), t.y === "top" ? r.y = -r.y : t.y === "center" && (r.y = 0), {
|
|
408
|
-
x: i.x + r.x,
|
|
409
|
-
y: i.y + r.y
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
return [
|
|
413
|
-
e,
|
|
414
|
-
t,
|
|
415
|
-
n ?? j,
|
|
416
|
-
...r
|
|
417
|
-
].reduce((e, t) => {
|
|
418
|
-
let n = A(t);
|
|
419
|
-
return {
|
|
420
|
-
x: e.x + n.x,
|
|
421
|
-
y: e.y + n.y
|
|
422
|
-
};
|
|
423
|
-
}, j);
|
|
424
|
-
}, M = t.union([t.number(), t.string()]);
|
|
425
|
-
t.object({
|
|
426
|
-
top: M,
|
|
427
|
-
left: M,
|
|
428
|
-
width: M,
|
|
429
|
-
height: M
|
|
430
|
-
}), t.object({
|
|
431
|
-
left: t.number(),
|
|
432
|
-
top: t.number(),
|
|
433
|
-
right: t.number(),
|
|
434
|
-
bottom: t.number()
|
|
435
|
-
}), t.object({
|
|
436
|
-
one: k,
|
|
437
|
-
two: k,
|
|
438
|
-
root: Ie
|
|
439
|
-
});
|
|
440
|
-
var N = (e, t, n = 0, r = 0, i) => {
|
|
441
|
-
let a = {
|
|
442
|
-
one: { ...j },
|
|
443
|
-
two: { ...j },
|
|
444
|
-
root: i ?? O
|
|
445
|
-
};
|
|
446
|
-
if (typeof e == "number") {
|
|
447
|
-
if (typeof t != "number") throw Error("Box constructor called with invalid arguments");
|
|
448
|
-
return a.one = {
|
|
449
|
-
x: e,
|
|
450
|
-
y: t
|
|
451
|
-
}, a.two = {
|
|
452
|
-
x: a.one.x + n,
|
|
453
|
-
y: a.one.y + r
|
|
454
|
-
}, a;
|
|
455
|
-
}
|
|
456
|
-
return "one" in e && "two" in e && "root" in e ? {
|
|
457
|
-
...e,
|
|
458
|
-
root: i ?? e.root
|
|
459
|
-
} : ("getBoundingClientRect" in e && (e = e.getBoundingClientRect()), "left" in e ? (a.one = {
|
|
460
|
-
x: e.left,
|
|
461
|
-
y: e.top
|
|
462
|
-
}, a.two = {
|
|
463
|
-
x: e.right,
|
|
464
|
-
y: e.bottom
|
|
465
|
-
}, a) : (a.one = e, t == null ? a.two = {
|
|
466
|
-
x: a.one.x + n,
|
|
467
|
-
y: a.one.y + r
|
|
468
|
-
} : typeof t == "number" ? a.two = {
|
|
469
|
-
x: a.one.x + t,
|
|
470
|
-
y: a.one.y + n
|
|
471
|
-
} : "width" in t ? a.two = {
|
|
472
|
-
x: a.one.x + t.width,
|
|
473
|
-
y: a.one.y + t.height
|
|
474
|
-
} : "signedWidth" in t ? a.two = {
|
|
475
|
-
x: a.one.x + t.signedWidth,
|
|
476
|
-
y: a.one.y + t.signedHeight
|
|
477
|
-
} : a.two = t, a));
|
|
478
|
-
}, Ze = (e, t) => {
|
|
479
|
-
let n = N(e);
|
|
480
|
-
return {
|
|
481
|
-
x: t.x === "center" ? nt(n).x : Qe(n, t.x),
|
|
482
|
-
y: t.y === "center" ? nt(n).y : Qe(n, t.y)
|
|
483
|
-
};
|
|
484
|
-
}, Qe = (e, t) => {
|
|
485
|
-
let n = N(e), r = Ke(n.root).includes(t) ? Math.min : Math.max;
|
|
486
|
-
return De.includes(t) ? r(n.one.x, n.two.x) : r(n.one.y, n.two.y);
|
|
487
|
-
}, $e = (e) => {
|
|
488
|
-
let t = N(e);
|
|
489
|
-
return t.two.x - t.one.x;
|
|
490
|
-
}, et = (e) => {
|
|
491
|
-
let t = N(e);
|
|
492
|
-
return t.two.y - t.one.y;
|
|
493
|
-
}, tt = (e) => Ze(e, O), nt = (e) => Xe(tt(e), {
|
|
494
|
-
x: $e(e) / 2,
|
|
495
|
-
y: et(e) / 2
|
|
496
|
-
}), P = (e) => {
|
|
497
|
-
let t = N(e);
|
|
498
|
-
return {
|
|
499
|
-
lower: t.one.x,
|
|
500
|
-
upper: t.two.x
|
|
501
|
-
};
|
|
502
|
-
}, rt = (e) => {
|
|
503
|
-
let t = N(e);
|
|
504
|
-
return {
|
|
505
|
-
lower: t.one.y,
|
|
506
|
-
upper: t.two.y
|
|
507
|
-
};
|
|
508
|
-
}, it = (e) => typeof e != "object" || !e ? !1 : "one" in e && "two" in e && "root" in e;
|
|
509
|
-
t.union([
|
|
510
|
-
Me,
|
|
511
|
-
Ne,
|
|
512
|
-
k,
|
|
513
|
-
we
|
|
514
|
-
]);
|
|
515
|
-
var at = (e, t, n) => t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e;
|
|
516
|
-
t.object({
|
|
517
|
-
offset: qe,
|
|
518
|
-
scale: qe
|
|
519
|
-
}), t.object({
|
|
520
|
-
offset: t.number(),
|
|
521
|
-
scale: t.number()
|
|
522
|
-
});
|
|
523
|
-
var ot = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r + e], st = (e) => (t, n, r, i) => [t, i ? r / e : r * e], ct = (e) => (t, n, r) => {
|
|
524
|
-
if (t === null) return [e, r];
|
|
525
|
-
let { lower: i, upper: a } = t, { lower: o, upper: s } = e, c = a - i, l = s - o;
|
|
526
|
-
return n === "dimension" ? [e, l / c * r] : [e, (r - i) * (l / c) + o];
|
|
527
|
-
}, lt = (e) => (t, n, r) => [e, r], ut = () => (e, t, n) => {
|
|
528
|
-
if (e === null) throw Error("cannot invert without bounds");
|
|
529
|
-
if (t === "dimension") return [e, n];
|
|
530
|
-
let { lower: r, upper: i } = e;
|
|
531
|
-
return [e, i - (n - r)];
|
|
532
|
-
}, dt = (e) => (t, n, r) => {
|
|
533
|
-
let { lower: i, upper: a } = e;
|
|
534
|
-
return r = at(r, i, a), [t, r];
|
|
535
|
-
}, ft = class e {
|
|
536
|
-
ops = [];
|
|
537
|
-
currBounds = null;
|
|
538
|
-
currType = null;
|
|
539
|
-
reversed = !1;
|
|
623
|
+
t.int().min(qe).max(127), t.int().min(Je).max(Ye), t.int().min(Qe).max($e);
|
|
624
|
+
var vt = t.int().min(0).max(255);
|
|
625
|
+
t.int().min(0).max(We), t.int().min(0).max(Ge), t.int().min(0).max(Ke);
|
|
626
|
+
var yt = class {
|
|
627
|
+
contentType = "application/json";
|
|
628
|
+
decoder;
|
|
629
|
+
encoder;
|
|
540
630
|
constructor() {
|
|
541
|
-
this.
|
|
542
|
-
}
|
|
543
|
-
static translate(t) {
|
|
544
|
-
return new e().translate(t);
|
|
545
|
-
}
|
|
546
|
-
static magnify(t) {
|
|
547
|
-
return new e().magnify(t);
|
|
548
|
-
}
|
|
549
|
-
static scale(t, n) {
|
|
550
|
-
return new e().scale(t, n);
|
|
551
|
-
}
|
|
552
|
-
translate(e) {
|
|
553
|
-
let t = this.new(), n = ot(e);
|
|
554
|
-
return n.type = "translate", t.ops.push(n), t;
|
|
555
|
-
}
|
|
556
|
-
magnify(e) {
|
|
557
|
-
let t = this.new(), n = st(e);
|
|
558
|
-
return n.type = "magnify", t.ops.push(n), t;
|
|
559
|
-
}
|
|
560
|
-
scale(e, t) {
|
|
561
|
-
let n = D(e, t), r = this.new(), i = ct(n);
|
|
562
|
-
return i.type = "scale", r.ops.push(i), r;
|
|
563
|
-
}
|
|
564
|
-
clamp(e, t) {
|
|
565
|
-
let n = D(e, t), r = this.new(), i = dt(n);
|
|
566
|
-
return i.type = "clamp", r.ops.push(i), r;
|
|
567
|
-
}
|
|
568
|
-
reBound(e, t) {
|
|
569
|
-
let n = D(e, t), r = this.new(), i = lt(n);
|
|
570
|
-
return i.type = "re-bound", r.ops.push(i), r;
|
|
571
|
-
}
|
|
572
|
-
invert() {
|
|
573
|
-
let e = ut();
|
|
574
|
-
e.type = "invert";
|
|
575
|
-
let t = this.new();
|
|
576
|
-
return t.ops.push(e), t;
|
|
577
|
-
}
|
|
578
|
-
pos(e) {
|
|
579
|
-
return this.exec("position", e);
|
|
580
|
-
}
|
|
581
|
-
dim(e) {
|
|
582
|
-
return this.exec("dimension", e);
|
|
583
|
-
}
|
|
584
|
-
new() {
|
|
585
|
-
let t = new e();
|
|
586
|
-
return t.ops = this.ops.slice(), t.reversed = this.reversed, t;
|
|
587
|
-
}
|
|
588
|
-
exec(e, t) {
|
|
589
|
-
return this.currBounds = null, this.ops.reduce(([t, n], r) => r(t, e, n, this.reversed), [null, t])[1];
|
|
590
|
-
}
|
|
591
|
-
reverse() {
|
|
592
|
-
let e = this.new();
|
|
593
|
-
e.ops.reverse();
|
|
594
|
-
let t = [];
|
|
595
|
-
return e.ops.forEach((n, r) => {
|
|
596
|
-
if (n.type === "scale" || t.some(([e, t]) => r >= e && r <= t)) return;
|
|
597
|
-
let i = e.ops.findIndex((e, t) => e.type === "scale" && t > r);
|
|
598
|
-
i !== -1 && t.push([r, i]);
|
|
599
|
-
}), t.forEach(([t, n]) => {
|
|
600
|
-
let r = e.ops.slice(t, n);
|
|
601
|
-
r.unshift(e.ops[n]), e.ops.splice(t, n - t + 1, ...r);
|
|
602
|
-
}), e.reversed = !e.reversed, e;
|
|
603
|
-
}
|
|
604
|
-
get transform() {
|
|
605
|
-
return {
|
|
606
|
-
scale: this.dim(1),
|
|
607
|
-
offset: this.pos(0)
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
static IDENTITY = new e();
|
|
611
|
-
};
|
|
612
|
-
(class e {
|
|
613
|
-
x;
|
|
614
|
-
y;
|
|
615
|
-
currRoot;
|
|
616
|
-
constructor(e = new ft(), t = new ft(), n = null) {
|
|
617
|
-
this.x = e, this.y = t, this.currRoot = n;
|
|
618
|
-
}
|
|
619
|
-
static translate(t, n) {
|
|
620
|
-
return new e().translate(t, n);
|
|
621
|
-
}
|
|
622
|
-
static translateX(t) {
|
|
623
|
-
return new e().translateX(t);
|
|
624
|
-
}
|
|
625
|
-
static translateY(t) {
|
|
626
|
-
return new e().translateY(t);
|
|
627
|
-
}
|
|
628
|
-
static clamp(t) {
|
|
629
|
-
return new e().clamp(t);
|
|
630
|
-
}
|
|
631
|
-
static magnify(t) {
|
|
632
|
-
return new e().magnify(t);
|
|
633
|
-
}
|
|
634
|
-
static scale(t) {
|
|
635
|
-
return new e().scale(t);
|
|
636
|
-
}
|
|
637
|
-
static reBound(t) {
|
|
638
|
-
return new e().reBound(t);
|
|
639
|
-
}
|
|
640
|
-
translate(e, t) {
|
|
641
|
-
let n = A(e, t), r = this.copy();
|
|
642
|
-
return r.x = this.x.translate(n.x), r.y = this.y.translate(n.y), r;
|
|
643
|
-
}
|
|
644
|
-
translateX(e) {
|
|
645
|
-
let t = this.copy();
|
|
646
|
-
return t.x = this.x.translate(e), t;
|
|
631
|
+
this.decoder = new TextDecoder(), this.encoder = new TextEncoder();
|
|
647
632
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
return t.y = this.y.translate(e), t;
|
|
633
|
+
encode(e, t) {
|
|
634
|
+
return this.encoder.encode(this.encodeString(e, t));
|
|
651
635
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
return t.x = this.x.magnify(e.x), t.y = this.y.magnify(e.y), t;
|
|
636
|
+
decode(e, t) {
|
|
637
|
+
return this.decodeString(this.decoder.decode(e), t);
|
|
655
638
|
}
|
|
656
|
-
|
|
657
|
-
let
|
|
658
|
-
|
|
659
|
-
let n = this.currRoot;
|
|
660
|
-
return t.currRoot = e.root, n != null && !Ge(n, e.root) && (n.x !== e.root.x && (t.x = t.x.invert()), n.y !== e.root.y && (t.y = t.y.invert())), t.x = t.x.scale(P(e)), t.y = t.y.scale(rt(e)), t;
|
|
661
|
-
}
|
|
662
|
-
return t.x = t.x.scale(e.width), t.y = t.y.scale(e.height), t;
|
|
639
|
+
decodeString(e, t) {
|
|
640
|
+
let n = f(JSON.parse(e), { schema: t });
|
|
641
|
+
return t == null ? n : Ue(t, n);
|
|
663
642
|
}
|
|
664
|
-
|
|
665
|
-
let
|
|
666
|
-
return t.
|
|
643
|
+
encodeString(e, t) {
|
|
644
|
+
let n = p((t == null ? e : Ue(t, e)) ?? {}, { schema: t });
|
|
645
|
+
return JSON.stringify(n, (e, t) => ArrayBuffer.isView(t) ? Array.from(t) : typeof t == "bigint" ? t.toString() : t);
|
|
667
646
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
647
|
+
}, bt = class {
|
|
648
|
+
contentType = "text/csv";
|
|
649
|
+
encode(e) {
|
|
650
|
+
let t = this.encodeString(e);
|
|
651
|
+
return new TextEncoder().encode(t);
|
|
671
652
|
}
|
|
672
|
-
|
|
673
|
-
let
|
|
674
|
-
return
|
|
653
|
+
decode(e, t) {
|
|
654
|
+
let n = new TextDecoder().decode(e);
|
|
655
|
+
return this.decodeString(n, t);
|
|
675
656
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
657
|
+
encodeString(e) {
|
|
658
|
+
if (!Array.isArray(e) || e.length === 0 || !_(e[0])) throw Error("Payload must be an array of objects");
|
|
659
|
+
let t = Object.keys(e[0]), n = [t.join(",")];
|
|
660
|
+
return e.forEach((e) => {
|
|
661
|
+
let r = t.map((t) => JSON.stringify(e[t] ?? ""));
|
|
662
|
+
n.push(r.join(","));
|
|
663
|
+
}), n.join("\n");
|
|
679
664
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
665
|
+
decodeString(e, t) {
|
|
666
|
+
let [n, ...r] = e.trim().split("\n").map((e) => e.trim());
|
|
667
|
+
if (n.length === 0) return t == null ? {} : t.parse({});
|
|
668
|
+
let i = n.split(",").map((e) => e.trim()), a = {};
|
|
669
|
+
return i.forEach((e) => {
|
|
670
|
+
a[e] = [];
|
|
671
|
+
}), r.forEach((e) => {
|
|
672
|
+
let t = e.split(",").map((e) => e.trim());
|
|
673
|
+
i.forEach((e, n) => {
|
|
674
|
+
let r = this.parseValue(t[n]);
|
|
675
|
+
r != null && a[e].push(r);
|
|
676
|
+
});
|
|
677
|
+
}), t == null ? a : t.parse(a);
|
|
685
678
|
}
|
|
686
|
-
|
|
687
|
-
return
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
};
|
|
679
|
+
parseValue(e) {
|
|
680
|
+
if (e == null || e.length === 0) return null;
|
|
681
|
+
let t = Number(e);
|
|
682
|
+
return isNaN(t) ? e.startsWith("\"") && e.endsWith("\"") ? e.slice(1, -1) : e : t;
|
|
691
683
|
}
|
|
692
|
-
|
|
693
|
-
|
|
684
|
+
}, xt = class {
|
|
685
|
+
contentType = "text/plain";
|
|
686
|
+
encode(e) {
|
|
687
|
+
if (typeof e != "string") throw Error("TextCodec.encode payload must be a string");
|
|
688
|
+
return new TextEncoder().encode(e);
|
|
694
689
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
x: 1,
|
|
699
|
-
y: 1
|
|
700
|
-
}),
|
|
701
|
-
offset: this.pos({
|
|
702
|
-
x: 0,
|
|
703
|
-
y: 0
|
|
704
|
-
})
|
|
705
|
-
};
|
|
690
|
+
decode(e, t) {
|
|
691
|
+
let n = new TextDecoder().decode(e);
|
|
692
|
+
return t == null ? n : t.parse(n);
|
|
706
693
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
units: e.object({
|
|
711
|
-
x: e.enum(["px", "decimal"]),
|
|
712
|
-
y: e.enum(["px", "decimal"])
|
|
713
|
-
})
|
|
714
|
-
}).partial({
|
|
715
|
-
root: !0,
|
|
716
|
-
units: !0
|
|
717
|
-
});
|
|
718
|
-
var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
694
|
+
}, St = new yt();
|
|
695
|
+
new bt(), new xt();
|
|
696
|
+
var Ct = 365, N = 30, wt = t.union([
|
|
719
697
|
t.tuple([t.int()]),
|
|
720
698
|
t.tuple([t.int(), t.int().min(1).max(12)]),
|
|
721
699
|
t.tuple([
|
|
@@ -723,20 +701,23 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
723
701
|
t.int().min(1).max(12),
|
|
724
702
|
t.int().min(1).max(31)
|
|
725
703
|
])
|
|
726
|
-
]),
|
|
727
|
-
let n = new
|
|
704
|
+
]), Tt = (e, t) => {
|
|
705
|
+
let n = new P(t);
|
|
728
706
|
if (![
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
707
|
+
F.DAY,
|
|
708
|
+
F.HOUR,
|
|
709
|
+
F.MINUTE,
|
|
710
|
+
F.SECOND,
|
|
711
|
+
F.MILLISECOND,
|
|
712
|
+
F.MICROSECOND,
|
|
713
|
+
F.NANOSECOND
|
|
736
714
|
].some((e) => e.equals(n))) throw Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");
|
|
737
715
|
let r = e.valueOf() % n.valueOf();
|
|
738
|
-
return e instanceof
|
|
739
|
-
},
|
|
716
|
+
return e instanceof P ? new P(r) : new F(r);
|
|
717
|
+
}, P = class e extends C {
|
|
718
|
+
hash() {
|
|
719
|
+
return this.value.toString();
|
|
720
|
+
}
|
|
740
721
|
constructor(t, n = "UTC") {
|
|
741
722
|
if (t == null) super(e.now().valueOf());
|
|
742
723
|
else if (t instanceof Date) super(BigInt(t.getTime()) * e.MILLISECOND.valueOf());
|
|
@@ -744,7 +725,7 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
744
725
|
else if (Array.isArray(t)) super(e.parseDate(t));
|
|
745
726
|
else {
|
|
746
727
|
let r = 0n;
|
|
747
|
-
t instanceof Number && (t = t.valueOf()), n === "local" && (r = e.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = t ===
|
|
728
|
+
t instanceof Number && (t = t.valueOf()), n === "local" && (r = e.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = t === $e ? Ze : Math.trunc(t) : (isNaN(t) && (t = 0), t = t === Infinity ? e.MAX : e.MIN)), S(t) && (t = t.value), super(BigInt(t.valueOf()) + r);
|
|
748
729
|
}
|
|
749
730
|
}
|
|
750
731
|
static parseDate([t = 1970, n = 1, r = 1]) {
|
|
@@ -778,7 +759,7 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
778
759
|
}
|
|
779
760
|
toISOString(t = "UTC") {
|
|
780
761
|
if (t === "UTC") return this.date().toISOString();
|
|
781
|
-
let n = this.date(), r = new
|
|
762
|
+
let n = this.date(), r = new F(BigInt(n.getTimezoneOffset()) * e.MINUTE.valueOf());
|
|
782
763
|
return this.sub(r).date().toISOString();
|
|
783
764
|
}
|
|
784
765
|
timeString(e = !1, t = "UTC") {
|
|
@@ -790,7 +771,7 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
790
771
|
return `${e.toLocaleString("default", { month: "short" })} ${e.toLocaleString("default", { day: "numeric" })}`;
|
|
791
772
|
}
|
|
792
773
|
static get utcOffset() {
|
|
793
|
-
return new
|
|
774
|
+
return new F(BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * e.MINUTE.valueOf());
|
|
794
775
|
}
|
|
795
776
|
static since(t) {
|
|
796
777
|
return new e().span(t);
|
|
@@ -805,7 +786,7 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
805
786
|
return this.range(e).span;
|
|
806
787
|
}
|
|
807
788
|
range(e) {
|
|
808
|
-
return new
|
|
789
|
+
return new R(this, e).makeValid();
|
|
809
790
|
}
|
|
810
791
|
spanRange(e) {
|
|
811
792
|
return this.range(this.add(e)).makeValid();
|
|
@@ -826,22 +807,22 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
826
807
|
return this.valueOf() <= new e(t).valueOf();
|
|
827
808
|
}
|
|
828
809
|
add(t) {
|
|
829
|
-
return new e(
|
|
810
|
+
return new e(O(this.valueOf(), new F(t).valueOf()));
|
|
830
811
|
}
|
|
831
812
|
sub(t) {
|
|
832
|
-
return new e(
|
|
813
|
+
return new e(D(this.valueOf(), new F(t).valueOf()));
|
|
833
814
|
}
|
|
834
815
|
get hours() {
|
|
835
|
-
return Number(this.valueOf()) / Number(
|
|
816
|
+
return Number(this.valueOf()) / Number(F.HOUR.valueOf());
|
|
836
817
|
}
|
|
837
818
|
get minutes() {
|
|
838
|
-
return Number(this.valueOf()) / Number(
|
|
819
|
+
return Number(this.valueOf()) / Number(F.MINUTE.valueOf());
|
|
839
820
|
}
|
|
840
821
|
get days() {
|
|
841
|
-
return Number(this.valueOf()) / Number(
|
|
822
|
+
return Number(this.valueOf()) / Number(F.DAY.valueOf());
|
|
842
823
|
}
|
|
843
824
|
get seconds() {
|
|
844
|
-
return Number(this.valueOf()) / Number(
|
|
825
|
+
return Number(this.valueOf()) / Number(F.SECOND.valueOf());
|
|
845
826
|
}
|
|
846
827
|
get milliseconds() {
|
|
847
828
|
return Number(this.valueOf()) / Number(e.MILLISECOND.valueOf());
|
|
@@ -953,7 +934,6 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
953
934
|
toString(e = "ISO", t = "UTC") {
|
|
954
935
|
switch (e) {
|
|
955
936
|
case "ISODate": return this.toISOString(t).slice(0, 10);
|
|
956
|
-
case "ISOTime": return this.toISOString(t).slice(11, 23);
|
|
957
937
|
case "time": return this.timeString(!1, t);
|
|
958
938
|
case "preciseTime": return this.timeString(!0, t);
|
|
959
939
|
case "date": return this.dateString();
|
|
@@ -963,16 +943,16 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
963
943
|
}
|
|
964
944
|
}
|
|
965
945
|
remainder(e) {
|
|
966
|
-
return
|
|
946
|
+
return Tt(this, e);
|
|
967
947
|
}
|
|
968
948
|
get isToday() {
|
|
969
|
-
return this.truncate(
|
|
949
|
+
return this.truncate(F.DAY).equals(e.now().truncate(F.DAY));
|
|
970
950
|
}
|
|
971
951
|
truncate(e) {
|
|
972
952
|
return this.sub(this.remainder(e));
|
|
973
953
|
}
|
|
974
954
|
formatBySpan(e) {
|
|
975
|
-
return e.greaterThanOrEqual(
|
|
955
|
+
return e.greaterThanOrEqual(F.days(30)) ? "date" : e.greaterThanOrEqual(F.DAY) ? "dateTime" : e.greaterThanOrEqual(F.HOUR) ? "time" : "preciseTime";
|
|
976
956
|
}
|
|
977
957
|
static now() {
|
|
978
958
|
return new e(/* @__PURE__ */ new Date());
|
|
@@ -1021,7 +1001,7 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
1021
1001
|
return e.hours(t * 24, n);
|
|
1022
1002
|
}
|
|
1023
1003
|
static DAY = e.days(1);
|
|
1024
|
-
static MAX = new e(
|
|
1004
|
+
static MAX = new e(Ze);
|
|
1025
1005
|
static MIN = new e(0);
|
|
1026
1006
|
static ZERO = new e(0);
|
|
1027
1007
|
static z = t.union([
|
|
@@ -1031,25 +1011,28 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
1031
1011
|
t.number().transform((t) => new e(t)),
|
|
1032
1012
|
t.bigint().transform((t) => new e(t)),
|
|
1033
1013
|
t.date().transform((t) => new e(t)),
|
|
1034
|
-
t.custom((e) => e instanceof
|
|
1035
|
-
|
|
1014
|
+
t.custom((e) => e instanceof F).transform((t) => new e(t)),
|
|
1015
|
+
wt.transform((t) => new e(t))
|
|
1036
1016
|
]);
|
|
1037
1017
|
static sort(e, t) {
|
|
1038
1018
|
return Number(e.valueOf() - t.valueOf());
|
|
1039
1019
|
}
|
|
1040
|
-
},
|
|
1020
|
+
}, F = class e extends C {
|
|
1041
1021
|
constructor(e) {
|
|
1042
|
-
typeof e == "number" && (e = Math.trunc(e.valueOf())),
|
|
1022
|
+
typeof e == "number" && (e = Math.trunc(e.valueOf())), S(e) && (e = e.value), super(BigInt(e.valueOf()));
|
|
1043
1023
|
}
|
|
1044
1024
|
static fromSeconds(t) {
|
|
1045
|
-
return t instanceof e ? t : t instanceof
|
|
1025
|
+
return t instanceof e ? t : t instanceof I ? t.period : t instanceof P ? new e(t) : (S(t) && (t = t.value), ["number", "bigint"].includes(typeof t) ? e.seconds(t) : new e(t));
|
|
1046
1026
|
}
|
|
1047
1027
|
static fromMilliseconds(t) {
|
|
1048
|
-
return t instanceof e ? t : t instanceof
|
|
1028
|
+
return t instanceof e ? t : t instanceof I ? t.period : t instanceof P ? new e(t) : (S(t) && (t = t.value), ["number", "bigint"].includes(typeof t) ? e.milliseconds(t) : new e(t));
|
|
1049
1029
|
}
|
|
1050
1030
|
valueOf() {
|
|
1051
1031
|
return this.value;
|
|
1052
1032
|
}
|
|
1033
|
+
hash() {
|
|
1034
|
+
return this.value.toString();
|
|
1035
|
+
}
|
|
1053
1036
|
lessThan(t) {
|
|
1054
1037
|
return this.valueOf() < new e(t).valueOf();
|
|
1055
1038
|
}
|
|
@@ -1063,7 +1046,7 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
1063
1046
|
return this.valueOf() >= new e(t).valueOf();
|
|
1064
1047
|
}
|
|
1065
1048
|
remainder(e) {
|
|
1066
|
-
return
|
|
1049
|
+
return Tt(this, e);
|
|
1067
1050
|
}
|
|
1068
1051
|
truncate(t) {
|
|
1069
1052
|
return new e(BigInt(Math.trunc(Number(this.valueOf() / t.valueOf()))) * t.valueOf());
|
|
@@ -1077,23 +1060,23 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
1077
1060
|
let t = new e(this.valueOf() < 0n ? -this.valueOf() : this.valueOf()), n = this.valueOf() < 0n;
|
|
1078
1061
|
if (t.valueOf() === 0n) return "0s";
|
|
1079
1062
|
if (t.lessThan(e.SECOND)) return "< 1s";
|
|
1080
|
-
let r = t.days, i = t.hours, a = t.minutes, o = t.seconds, s = Math.floor(r /
|
|
1063
|
+
let r = t.days, i = t.hours, a = t.minutes, o = t.seconds, s = Math.floor(r / Ct), c = Math.floor(r / N), l = Math.floor(r / 7), u = Math.floor(r), d = Math.floor(i), f = Math.floor(a), p = Math.floor(o), m = n ? "-" : "";
|
|
1081
1064
|
if (s >= 1) {
|
|
1082
1065
|
let e = `${s}y`;
|
|
1083
1066
|
if (s < 2) {
|
|
1084
|
-
let t = Math.floor(r %
|
|
1067
|
+
let t = Math.floor(r % Ct / N);
|
|
1085
1068
|
t > 0 && (e += ` ${t}mo`);
|
|
1086
1069
|
}
|
|
1087
1070
|
return m + e;
|
|
1088
1071
|
}
|
|
1089
|
-
if (l >= 1 && r <
|
|
1072
|
+
if (l >= 1 && r < N && r % 7 == 0) {
|
|
1090
1073
|
let e = `${l}w`, t = Math.floor(r % 7), n = Math.floor(i - l * 7 * 24);
|
|
1091
1074
|
return l < 2 && (t > 0 ? e += ` ${t}d` : n > 0 && n < 24 && (e += ` ${n}h`)), m + e;
|
|
1092
1075
|
}
|
|
1093
1076
|
if (c >= 1) {
|
|
1094
1077
|
let e = `${c}mo`;
|
|
1095
1078
|
if (c < 3) {
|
|
1096
|
-
let t = Math.floor(r %
|
|
1079
|
+
let t = Math.floor(r % N);
|
|
1097
1080
|
t > 0 && (e += ` ${t}d`);
|
|
1098
1081
|
}
|
|
1099
1082
|
return m + e;
|
|
@@ -1125,10 +1108,10 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
1125
1108
|
return `${m}${p}s`;
|
|
1126
1109
|
}
|
|
1127
1110
|
mult(t) {
|
|
1128
|
-
return new e(
|
|
1111
|
+
return new e(k(this.valueOf(), t));
|
|
1129
1112
|
}
|
|
1130
1113
|
div(t) {
|
|
1131
|
-
return new e(
|
|
1114
|
+
return new e(A(this.valueOf(), t));
|
|
1132
1115
|
}
|
|
1133
1116
|
get days() {
|
|
1134
1117
|
return Number(this.valueOf()) / Number(e.DAY.valueOf());
|
|
@@ -1163,35 +1146,39 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
1163
1146
|
sub(t) {
|
|
1164
1147
|
return new e(this.valueOf() - new e(t).valueOf());
|
|
1165
1148
|
}
|
|
1149
|
+
abs() {
|
|
1150
|
+
let t = this.valueOf();
|
|
1151
|
+
return new e(t < 0n ? -t : t);
|
|
1152
|
+
}
|
|
1166
1153
|
static nanoseconds(t = 1) {
|
|
1167
1154
|
return new e(t);
|
|
1168
1155
|
}
|
|
1169
1156
|
static NANOSECOND = e.nanoseconds(1);
|
|
1170
1157
|
static microseconds(t = 1) {
|
|
1171
|
-
return e.nanoseconds(
|
|
1158
|
+
return e.nanoseconds(k(t, 1e3));
|
|
1172
1159
|
}
|
|
1173
1160
|
static MICROSECOND = e.microseconds(1);
|
|
1174
1161
|
static milliseconds(t = 1) {
|
|
1175
|
-
return e.microseconds(
|
|
1162
|
+
return e.microseconds(k(t, 1e3));
|
|
1176
1163
|
}
|
|
1177
1164
|
static MILLISECOND = e.milliseconds(1);
|
|
1178
1165
|
static seconds(t = 1) {
|
|
1179
|
-
return e.milliseconds(
|
|
1166
|
+
return e.milliseconds(k(t, 1e3));
|
|
1180
1167
|
}
|
|
1181
1168
|
static SECOND = e.seconds(1);
|
|
1182
1169
|
static minutes(t = 1) {
|
|
1183
|
-
return e.seconds(
|
|
1170
|
+
return e.seconds(k(t, 60));
|
|
1184
1171
|
}
|
|
1185
1172
|
static MINUTE = e.minutes(1);
|
|
1186
1173
|
static hours(t) {
|
|
1187
|
-
return e.minutes(
|
|
1174
|
+
return e.minutes(k(t, 60));
|
|
1188
1175
|
}
|
|
1189
1176
|
static HOUR = e.hours(1);
|
|
1190
1177
|
static days(t) {
|
|
1191
|
-
return e.hours(
|
|
1178
|
+
return e.hours(k(t, 24));
|
|
1192
1179
|
}
|
|
1193
1180
|
static DAY = e.days(1);
|
|
1194
|
-
static MAX = new e(
|
|
1181
|
+
static MAX = new e(Ze);
|
|
1195
1182
|
static MIN = new e(0);
|
|
1196
1183
|
static ZERO = new e(0);
|
|
1197
1184
|
static z = t.union([
|
|
@@ -1200,472 +1187,946 @@ var pt = t.enum(["static", "dynamic"]), mt = 365, F = 30, ht = t.union([
|
|
|
1200
1187
|
t.number().transform((t) => new e(t)),
|
|
1201
1188
|
t.bigint().transform((t) => new e(t)),
|
|
1202
1189
|
t.instanceof(e),
|
|
1203
|
-
t.instanceof(
|
|
1204
|
-
t.custom((e) => e instanceof
|
|
1190
|
+
t.instanceof(P).transform((t) => new e(t)),
|
|
1191
|
+
t.custom((e) => e instanceof I).transform((t) => new e(t))
|
|
1192
|
+
]);
|
|
1193
|
+
}, I = class e extends C {
|
|
1194
|
+
constructor(e) {
|
|
1195
|
+
S(e) && (e = e.value), super(e.valueOf());
|
|
1196
|
+
}
|
|
1197
|
+
hash() {
|
|
1198
|
+
return this.value.toString();
|
|
1199
|
+
}
|
|
1200
|
+
toString() {
|
|
1201
|
+
return `${this.valueOf()} Hz`;
|
|
1202
|
+
}
|
|
1203
|
+
equals(t) {
|
|
1204
|
+
return this.valueOf() === new e(t).valueOf();
|
|
1205
|
+
}
|
|
1206
|
+
get period() {
|
|
1207
|
+
return F.seconds(1 / this.valueOf());
|
|
1208
|
+
}
|
|
1209
|
+
sampleCount(e) {
|
|
1210
|
+
return new F(e).seconds * this.valueOf();
|
|
1211
|
+
}
|
|
1212
|
+
byteCount(e, t) {
|
|
1213
|
+
return this.sampleCount(e) * new L(t).valueOf();
|
|
1214
|
+
}
|
|
1215
|
+
span(e) {
|
|
1216
|
+
return F.seconds(e / this.valueOf());
|
|
1217
|
+
}
|
|
1218
|
+
byteSpan(e, t) {
|
|
1219
|
+
return this.span(e.valueOf() / new L(t).valueOf());
|
|
1220
|
+
}
|
|
1221
|
+
add(t) {
|
|
1222
|
+
return new e(O(this.valueOf(), new e(t).valueOf()));
|
|
1223
|
+
}
|
|
1224
|
+
sub(t) {
|
|
1225
|
+
return new e(D(this.valueOf(), new e(t).valueOf()));
|
|
1226
|
+
}
|
|
1227
|
+
mult(t) {
|
|
1228
|
+
return new e(k(this.valueOf(), t));
|
|
1229
|
+
}
|
|
1230
|
+
div(t) {
|
|
1231
|
+
return new e(A(this.valueOf(), t));
|
|
1232
|
+
}
|
|
1233
|
+
static hz(t) {
|
|
1234
|
+
return new e(t);
|
|
1235
|
+
}
|
|
1236
|
+
static khz(t) {
|
|
1237
|
+
return e.hz(t * 1e3);
|
|
1238
|
+
}
|
|
1239
|
+
static z = t.union([t.number().transform((t) => new e(t)), t.instanceof(e)]);
|
|
1240
|
+
}, L = class e extends C {
|
|
1241
|
+
constructor(e) {
|
|
1242
|
+
S(e) && (e = e.value), super(e.valueOf());
|
|
1243
|
+
}
|
|
1244
|
+
length(e) {
|
|
1245
|
+
return e.valueOf() / this.valueOf();
|
|
1246
|
+
}
|
|
1247
|
+
size(e) {
|
|
1248
|
+
return new B(e * this.valueOf());
|
|
1249
|
+
}
|
|
1250
|
+
add(t) {
|
|
1251
|
+
return new e(O(this.valueOf(), new e(t).valueOf()));
|
|
1252
|
+
}
|
|
1253
|
+
sub(t) {
|
|
1254
|
+
return new e(D(this.valueOf(), new e(t).valueOf()));
|
|
1255
|
+
}
|
|
1256
|
+
mult(t) {
|
|
1257
|
+
return new e(k(this.valueOf(), t));
|
|
1258
|
+
}
|
|
1259
|
+
div(t) {
|
|
1260
|
+
return new e(A(this.valueOf(), t));
|
|
1261
|
+
}
|
|
1262
|
+
static UNKNOWN = new e(0);
|
|
1263
|
+
static BIT128 = new e(16);
|
|
1264
|
+
static BIT64 = new e(8);
|
|
1265
|
+
static BIT32 = new e(4);
|
|
1266
|
+
static BIT16 = new e(2);
|
|
1267
|
+
static BIT8 = new e(1);
|
|
1268
|
+
static z = t.union([t.number().transform((t) => new e(t)), t.instanceof(e)]);
|
|
1269
|
+
}, R = class e {
|
|
1270
|
+
hash() {
|
|
1271
|
+
return `${this.start.hash()}-${this.end.hash()}`;
|
|
1272
|
+
}
|
|
1273
|
+
start;
|
|
1274
|
+
end;
|
|
1275
|
+
constructor(e, t) {
|
|
1276
|
+
typeof e == "object" && "start" in e ? (this.start = new P(e.start), this.end = new P(e.end)) : (this.start = new P(e), this.end = new P(t));
|
|
1277
|
+
}
|
|
1278
|
+
get span() {
|
|
1279
|
+
return new F(this.end.valueOf() - this.start.valueOf());
|
|
1280
|
+
}
|
|
1281
|
+
get isValid() {
|
|
1282
|
+
return this.start.valueOf() <= this.end.valueOf();
|
|
1283
|
+
}
|
|
1284
|
+
makeValid() {
|
|
1285
|
+
return this.isValid ? this : this.swap();
|
|
1286
|
+
}
|
|
1287
|
+
get isZero() {
|
|
1288
|
+
return this.start.isZero && this.end.isZero;
|
|
1289
|
+
}
|
|
1290
|
+
get numeric() {
|
|
1291
|
+
return {
|
|
1292
|
+
start: Number(this.start.valueOf()),
|
|
1293
|
+
end: Number(this.end.valueOf())
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
swap() {
|
|
1297
|
+
return new e(this.end, this.start);
|
|
1298
|
+
}
|
|
1299
|
+
get numericBounds() {
|
|
1300
|
+
return {
|
|
1301
|
+
lower: Number(this.start.valueOf()),
|
|
1302
|
+
upper: Number(this.end.valueOf())
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
equals(e, t = F.ZERO) {
|
|
1306
|
+
if (t.isZero) return this.start.equals(e.start) && this.end.equals(e.end);
|
|
1307
|
+
let n = this.start.sub(e.start).valueOf(), r = this.end.sub(e.end).valueOf();
|
|
1308
|
+
return n < 0 && (n = -n), r < 0 && (r = -r), n <= t.valueOf() && r <= t.valueOf();
|
|
1309
|
+
}
|
|
1310
|
+
toString() {
|
|
1311
|
+
return `${this.start.toString()} - ${this.end.toString()}`;
|
|
1312
|
+
}
|
|
1313
|
+
toPrettyString() {
|
|
1314
|
+
return `${this.start.toString("preciseDate")} - ${this.span.toString()}`;
|
|
1315
|
+
}
|
|
1316
|
+
overlapsWith(e, t = F.ZERO) {
|
|
1317
|
+
e = e.makeValid();
|
|
1318
|
+
let n = this.makeValid();
|
|
1319
|
+
if (this.equals(e)) return !0;
|
|
1320
|
+
if (e.end.equals(n.start) || n.end.equals(e.start)) return !1;
|
|
1321
|
+
let r = P.max(n.start, e.start), i = P.min(n.end, e.end);
|
|
1322
|
+
return i.before(r) ? !1 : new F(i.sub(r)).greaterThanOrEqual(t);
|
|
1323
|
+
}
|
|
1324
|
+
contains(t) {
|
|
1325
|
+
return t instanceof e ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
|
|
1326
|
+
}
|
|
1327
|
+
boundBy(t) {
|
|
1328
|
+
let n = new e(this.start, this.end);
|
|
1329
|
+
return t.start.after(this.start) && (n.start = t.start), t.start.after(this.end) && (n.end = t.start), t.end.before(this.end) && (n.end = t.end), t.end.before(this.start) && (n.start = t.end), n;
|
|
1330
|
+
}
|
|
1331
|
+
static max(...t) {
|
|
1332
|
+
return new e(P.min(...t.map((e) => e.start)), P.max(...t.map((e) => e.end)));
|
|
1333
|
+
}
|
|
1334
|
+
static MAX = new e(P.MIN, P.MAX);
|
|
1335
|
+
static ZERO = new e(P.ZERO, P.ZERO);
|
|
1336
|
+
static z = t.union([t.object({
|
|
1337
|
+
start: P.z,
|
|
1338
|
+
end: P.z
|
|
1339
|
+
}).transform((t) => new e(t.start, t.end)), t.instanceof(e)]);
|
|
1340
|
+
static boundedZ = e.z.refine(({ isValid: e }) => e, { message: "Time range start time must be before or equal to time range end time" }).refine(({ end: e }) => e.valueOf() <= Ze, { message: "Time range end time must be less than or equal to the maximum value of an int64" }).refine(({ start: e }) => e.valueOf() >= Xe, { message: "Time range start time must be greater than or equal to the minimum value of an int64" });
|
|
1341
|
+
static sort(e, t) {
|
|
1342
|
+
return P.sort(e.start, t.start) || P.sort(e.end, t.end);
|
|
1343
|
+
}
|
|
1344
|
+
static merge(...t) {
|
|
1345
|
+
return e.max(...t.map((t) => new e(t).makeValid()));
|
|
1346
|
+
}
|
|
1347
|
+
}, z = class e extends C {
|
|
1348
|
+
hash() {
|
|
1349
|
+
return this.value;
|
|
1350
|
+
}
|
|
1351
|
+
constructor(t) {
|
|
1352
|
+
if (S(t) && (t = t.value), t instanceof e || typeof t == "string" || typeof t.valueOf() == "string") super(t.valueOf());
|
|
1353
|
+
else {
|
|
1354
|
+
let n = e.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
|
|
1355
|
+
if (n == null) throw Error(`unable to find data type for ${t.toString()}`);
|
|
1356
|
+
super(n.valueOf());
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
get Array() {
|
|
1360
|
+
let t = e.ARRAY_CONSTRUCTORS.get(this.toString());
|
|
1361
|
+
if (t == null) throw Error(`unable to find array constructor for ${this.valueOf()}`);
|
|
1362
|
+
return t;
|
|
1363
|
+
}
|
|
1364
|
+
equals(e) {
|
|
1365
|
+
return this.valueOf() === e.valueOf();
|
|
1366
|
+
}
|
|
1367
|
+
matches(...e) {
|
|
1368
|
+
return e.some((e) => this.equals(e));
|
|
1369
|
+
}
|
|
1370
|
+
toString(t = !1) {
|
|
1371
|
+
return t ? e.SHORT_STRINGS.get(this.valueOf()) ?? this.valueOf() : this.valueOf();
|
|
1372
|
+
}
|
|
1373
|
+
get isVariable() {
|
|
1374
|
+
return this.equals(e.JSON) || this.equals(e.STRING) || this.equals(e.BYTES);
|
|
1375
|
+
}
|
|
1376
|
+
get isNumeric() {
|
|
1377
|
+
return !this.isVariable && !this.equals(e.UUID);
|
|
1378
|
+
}
|
|
1379
|
+
get isInteger() {
|
|
1380
|
+
let e = this.toString();
|
|
1381
|
+
return e.startsWith("int") || e.startsWith("uint");
|
|
1382
|
+
}
|
|
1383
|
+
get isFloat() {
|
|
1384
|
+
return this.toString().startsWith("float");
|
|
1385
|
+
}
|
|
1386
|
+
get density() {
|
|
1387
|
+
let t = e.DENSITIES.get(this.toString());
|
|
1388
|
+
if (t == null) throw Error(`unable to find density for ${this.valueOf()}`);
|
|
1389
|
+
return t;
|
|
1390
|
+
}
|
|
1391
|
+
get isUnsignedInteger() {
|
|
1392
|
+
return this.equals(e.UINT8) || this.equals(e.UINT16) || this.equals(e.UINT32) || this.equals(e.UINT64);
|
|
1393
|
+
}
|
|
1394
|
+
get isSignedInteger() {
|
|
1395
|
+
return this.equals(e.INT8) || this.equals(e.INT16) || this.equals(e.INT32) || this.equals(e.INT64);
|
|
1396
|
+
}
|
|
1397
|
+
canSafelyCastTo(t) {
|
|
1398
|
+
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(e.INT32) && t.equals(e.FLOAT64) || this.equals(e.INT8) && t.equals(e.FLOAT32) ? !0 : this.isInteger && t.isInteger ? this.density.valueOf() <= t.density.valueOf() && this.isUnsignedInteger === t.isUnsignedInteger : !1;
|
|
1399
|
+
}
|
|
1400
|
+
canCastTo(e) {
|
|
1401
|
+
return this.isNumeric && e.isNumeric ? !0 : this.equals(e);
|
|
1402
|
+
}
|
|
1403
|
+
checkArray(e) {
|
|
1404
|
+
return e.constructor === this.Array;
|
|
1405
|
+
}
|
|
1406
|
+
get usesBigInt() {
|
|
1407
|
+
return e.BIG_INT_TYPES.some((e) => e.equals(this));
|
|
1408
|
+
}
|
|
1409
|
+
static UNKNOWN = new e("unknown");
|
|
1410
|
+
static FLOAT64 = new e("float64");
|
|
1411
|
+
static FLOAT32 = new e("float32");
|
|
1412
|
+
static INT64 = new e("int64");
|
|
1413
|
+
static INT32 = new e("int32");
|
|
1414
|
+
static INT16 = new e("int16");
|
|
1415
|
+
static INT8 = new e("int8");
|
|
1416
|
+
static UINT64 = new e("uint64");
|
|
1417
|
+
static UINT32 = new e("uint32");
|
|
1418
|
+
static UINT16 = new e("uint16");
|
|
1419
|
+
static UINT8 = new e("uint8");
|
|
1420
|
+
static TIMESTAMP = new e("timestamp");
|
|
1421
|
+
static UUID = new e("uuid");
|
|
1422
|
+
static STRING = new e("string");
|
|
1423
|
+
static JSON = new e("json");
|
|
1424
|
+
static BYTES = new e("bytes");
|
|
1425
|
+
static ARRAY_CONSTRUCTORS = new Map([
|
|
1426
|
+
[e.UINT8.toString(), Uint8Array],
|
|
1427
|
+
[e.UINT16.toString(), Uint16Array],
|
|
1428
|
+
[e.UINT32.toString(), Uint32Array],
|
|
1429
|
+
[e.UINT64.toString(), BigUint64Array],
|
|
1430
|
+
[e.FLOAT32.toString(), Float32Array],
|
|
1431
|
+
[e.FLOAT64.toString(), Float64Array],
|
|
1432
|
+
[e.INT8.toString(), Int8Array],
|
|
1433
|
+
[e.INT16.toString(), Int16Array],
|
|
1434
|
+
[e.INT32.toString(), Int32Array],
|
|
1435
|
+
[e.INT64.toString(), BigInt64Array],
|
|
1436
|
+
[e.TIMESTAMP.toString(), BigInt64Array],
|
|
1437
|
+
[e.STRING.toString(), Uint8Array],
|
|
1438
|
+
[e.JSON.toString(), Uint8Array],
|
|
1439
|
+
[e.UUID.toString(), Uint8Array],
|
|
1440
|
+
[e.BYTES.toString(), Uint8Array]
|
|
1441
|
+
]);
|
|
1442
|
+
static ARRAY_CONSTRUCTOR_DATA_TYPES = new Map([
|
|
1443
|
+
[Uint8Array.name, e.UINT8],
|
|
1444
|
+
[Uint16Array.name, e.UINT16],
|
|
1445
|
+
[Uint32Array.name, e.UINT32],
|
|
1446
|
+
[BigUint64Array.name, e.UINT64],
|
|
1447
|
+
[Float32Array.name, e.FLOAT32],
|
|
1448
|
+
[Float64Array.name, e.FLOAT64],
|
|
1449
|
+
[Int8Array.name, e.INT8],
|
|
1450
|
+
[Int16Array.name, e.INT16],
|
|
1451
|
+
[Int32Array.name, e.INT32],
|
|
1452
|
+
[BigInt64Array.name, e.INT64]
|
|
1453
|
+
]);
|
|
1454
|
+
static DENSITIES = new Map([
|
|
1455
|
+
[e.UINT8.toString(), L.BIT8],
|
|
1456
|
+
[e.UINT16.toString(), L.BIT16],
|
|
1457
|
+
[e.UINT32.toString(), L.BIT32],
|
|
1458
|
+
[e.UINT64.toString(), L.BIT64],
|
|
1459
|
+
[e.FLOAT32.toString(), L.BIT32],
|
|
1460
|
+
[e.FLOAT64.toString(), L.BIT64],
|
|
1461
|
+
[e.INT8.toString(), L.BIT8],
|
|
1462
|
+
[e.INT16.toString(), L.BIT16],
|
|
1463
|
+
[e.INT32.toString(), L.BIT32],
|
|
1464
|
+
[e.INT64.toString(), L.BIT64],
|
|
1465
|
+
[e.TIMESTAMP.toString(), L.BIT64],
|
|
1466
|
+
[e.STRING.toString(), L.UNKNOWN],
|
|
1467
|
+
[e.JSON.toString(), L.UNKNOWN],
|
|
1468
|
+
[e.UUID.toString(), L.BIT128],
|
|
1469
|
+
[e.BYTES.toString(), L.UNKNOWN]
|
|
1470
|
+
]);
|
|
1471
|
+
static ALL = [
|
|
1472
|
+
e.UNKNOWN,
|
|
1473
|
+
e.UINT8,
|
|
1474
|
+
e.UINT16,
|
|
1475
|
+
e.UINT32,
|
|
1476
|
+
e.UINT64,
|
|
1477
|
+
e.INT8,
|
|
1478
|
+
e.INT16,
|
|
1479
|
+
e.INT32,
|
|
1480
|
+
e.INT64,
|
|
1481
|
+
e.FLOAT32,
|
|
1482
|
+
e.FLOAT64,
|
|
1483
|
+
e.TIMESTAMP,
|
|
1484
|
+
e.UUID,
|
|
1485
|
+
e.STRING,
|
|
1486
|
+
e.JSON,
|
|
1487
|
+
e.BYTES
|
|
1488
|
+
];
|
|
1489
|
+
static SHORT_STRINGS = new Map([
|
|
1490
|
+
[e.UINT8.toString(), "u8"],
|
|
1491
|
+
[e.UINT16.toString(), "u16"],
|
|
1492
|
+
[e.UINT32.toString(), "u32"],
|
|
1493
|
+
[e.UINT64.toString(), "u64"],
|
|
1494
|
+
[e.INT8.toString(), "i8"],
|
|
1495
|
+
[e.INT16.toString(), "i16"],
|
|
1496
|
+
[e.INT32.toString(), "i32"],
|
|
1497
|
+
[e.INT64.toString(), "i64"],
|
|
1498
|
+
[e.FLOAT32.toString(), "f32"],
|
|
1499
|
+
[e.FLOAT64.toString(), "f64"],
|
|
1500
|
+
[e.TIMESTAMP.toString(), "ts"],
|
|
1501
|
+
[e.UUID.toString(), "uuid"],
|
|
1502
|
+
[e.STRING.toString(), "str"],
|
|
1503
|
+
[e.JSON.toString(), "json"],
|
|
1504
|
+
[e.BYTES.toString(), "bytes"]
|
|
1205
1505
|
]);
|
|
1206
|
-
|
|
1506
|
+
static BIG_INT_TYPES = [
|
|
1507
|
+
e.INT64,
|
|
1508
|
+
e.UINT64,
|
|
1509
|
+
e.TIMESTAMP
|
|
1510
|
+
];
|
|
1511
|
+
static z = t.union([t.string().transform((t) => new e(t)), t.instanceof(e)]);
|
|
1512
|
+
}, B = class e extends C {
|
|
1207
1513
|
constructor(e) {
|
|
1208
|
-
|
|
1209
|
-
}
|
|
1210
|
-
toString() {
|
|
1211
|
-
return `${this.valueOf()} Hz`;
|
|
1212
|
-
}
|
|
1213
|
-
equals(t) {
|
|
1214
|
-
return this.valueOf() === new e(t).valueOf();
|
|
1215
|
-
}
|
|
1216
|
-
get period() {
|
|
1217
|
-
return L.seconds(1 / this.valueOf());
|
|
1218
|
-
}
|
|
1219
|
-
sampleCount(e) {
|
|
1220
|
-
return new L(e).seconds * this.valueOf();
|
|
1221
|
-
}
|
|
1222
|
-
byteCount(e, t) {
|
|
1223
|
-
return this.sampleCount(e) * new z(t).valueOf();
|
|
1514
|
+
S(e) && (e = e.value), super(e.valueOf());
|
|
1224
1515
|
}
|
|
1225
|
-
|
|
1226
|
-
return
|
|
1516
|
+
largerThan(e) {
|
|
1517
|
+
return S(e) && (e = e.value), this.valueOf() > e.valueOf();
|
|
1227
1518
|
}
|
|
1228
|
-
|
|
1229
|
-
return
|
|
1519
|
+
smallerThan(e) {
|
|
1520
|
+
return S(e) && (e = e.value), this.valueOf() < e.valueOf();
|
|
1230
1521
|
}
|
|
1231
1522
|
add(t) {
|
|
1232
|
-
return new e(
|
|
1523
|
+
return S(t) && (t = t.value), new e(O(this.valueOf(), t.valueOf()));
|
|
1233
1524
|
}
|
|
1234
1525
|
sub(t) {
|
|
1235
|
-
return new e(
|
|
1526
|
+
return S(t) && (t = t.value), new e(D(this.valueOf(), t.valueOf()));
|
|
1236
1527
|
}
|
|
1237
1528
|
mult(t) {
|
|
1238
|
-
return new e(
|
|
1529
|
+
return new e(k(this.valueOf(), t));
|
|
1239
1530
|
}
|
|
1240
1531
|
div(t) {
|
|
1241
|
-
return new e(
|
|
1532
|
+
return new e(A(this.valueOf(), t));
|
|
1242
1533
|
}
|
|
1243
|
-
|
|
1244
|
-
return new e(t);
|
|
1245
|
-
}
|
|
1246
|
-
static khz(t) {
|
|
1247
|
-
return e.hz(t * 1e3);
|
|
1534
|
+
truncate(t) {
|
|
1535
|
+
return new e(Math.trunc(this.valueOf() / new e(t).valueOf()) * new e(t).valueOf());
|
|
1248
1536
|
}
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
constructor(e) {
|
|
1252
|
-
v(e) && (e = e.value), super(e.valueOf());
|
|
1537
|
+
remainder(t) {
|
|
1538
|
+
return e.bytes(this.valueOf() % new e(t).valueOf());
|
|
1253
1539
|
}
|
|
1254
|
-
|
|
1255
|
-
return
|
|
1540
|
+
get gigabytes() {
|
|
1541
|
+
return this.valueOf() / e.GIGABYTE.valueOf();
|
|
1256
1542
|
}
|
|
1257
|
-
|
|
1258
|
-
return
|
|
1543
|
+
get megabytes() {
|
|
1544
|
+
return this.valueOf() / e.MEGABYTE.valueOf();
|
|
1259
1545
|
}
|
|
1260
|
-
|
|
1261
|
-
return
|
|
1546
|
+
get kilobytes() {
|
|
1547
|
+
return this.valueOf() / e.KILOBYTE.valueOf();
|
|
1262
1548
|
}
|
|
1263
|
-
|
|
1264
|
-
return
|
|
1549
|
+
get terabytes() {
|
|
1550
|
+
return this.valueOf() / e.TERABYTE.valueOf();
|
|
1265
1551
|
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1552
|
+
toString() {
|
|
1553
|
+
let t = this.truncate(e.TERABYTE), n = this.truncate(e.GIGABYTE), r = this.truncate(e.MEGABYTE), i = this.truncate(e.KILOBYTE), a = this.truncate(e.BYTE), o = t, s = n.sub(t), c = r.sub(n), l = i.sub(r), u = a.sub(i), d = "";
|
|
1554
|
+
return o.isZero || (d += `${o.terabytes}TB `), s.isZero || (d += `${s.gigabytes}GB `), c.isZero || (d += `${c.megabytes}MB `), l.isZero || (d += `${l.kilobytes}KB `), (!u.isZero || d === "") && (d += `${u.valueOf()}B`), d.trim();
|
|
1268
1555
|
}
|
|
1269
|
-
|
|
1270
|
-
return new e(
|
|
1556
|
+
static bytes(t = 1) {
|
|
1557
|
+
return new e(t);
|
|
1271
1558
|
}
|
|
1272
|
-
static
|
|
1273
|
-
static
|
|
1274
|
-
|
|
1275
|
-
static BIT32 = new e(4);
|
|
1276
|
-
static BIT16 = new e(2);
|
|
1277
|
-
static BIT8 = new e(1);
|
|
1278
|
-
static z = t.union([t.number().transform((t) => new e(t)), t.instanceof(e)]);
|
|
1279
|
-
}, B = class e {
|
|
1280
|
-
start;
|
|
1281
|
-
end;
|
|
1282
|
-
constructor(e, t) {
|
|
1283
|
-
typeof e == "object" && "start" in e ? (this.start = new I(e.start), this.end = new I(e.end)) : (this.start = new I(e), this.end = new I(t));
|
|
1559
|
+
static BYTE = new e(1);
|
|
1560
|
+
static kilobytes(t = 1) {
|
|
1561
|
+
return e.bytes(new e(t).valueOf() * 1e3);
|
|
1284
1562
|
}
|
|
1285
|
-
|
|
1286
|
-
|
|
1563
|
+
static KILOBYTE = e.kilobytes(1);
|
|
1564
|
+
static megabytes(t = 1) {
|
|
1565
|
+
return e.kilobytes(new e(t).valueOf() * 1e3);
|
|
1287
1566
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1567
|
+
static MEGABYTE = e.megabytes(1);
|
|
1568
|
+
static gigabytes(t = 1) {
|
|
1569
|
+
return e.megabytes(new e(t).valueOf() * 1e3);
|
|
1290
1570
|
}
|
|
1291
|
-
|
|
1292
|
-
|
|
1571
|
+
static GIGABYTE = e.gigabytes(1);
|
|
1572
|
+
static terabytes(t) {
|
|
1573
|
+
return e.gigabytes(new e(t).valueOf() * 1e3);
|
|
1293
1574
|
}
|
|
1575
|
+
static TERABYTE = e.terabytes(1);
|
|
1576
|
+
static ZERO = new e(0);
|
|
1577
|
+
static z = t.union([t.number().transform((t) => new e(t)), t.instanceof(e)]);
|
|
1294
1578
|
get isZero() {
|
|
1295
|
-
return this.
|
|
1296
|
-
}
|
|
1297
|
-
get numeric() {
|
|
1298
|
-
return {
|
|
1299
|
-
start: Number(this.start.valueOf()),
|
|
1300
|
-
end: Number(this.end.valueOf())
|
|
1301
|
-
};
|
|
1579
|
+
return this.valueOf() === 0;
|
|
1302
1580
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1581
|
+
};
|
|
1582
|
+
t.object({
|
|
1583
|
+
start: t.number(),
|
|
1584
|
+
end: t.number()
|
|
1585
|
+
}), t.union([
|
|
1586
|
+
t.instanceof(Uint8Array),
|
|
1587
|
+
t.instanceof(Uint16Array),
|
|
1588
|
+
t.instanceof(Uint32Array),
|
|
1589
|
+
t.instanceof(BigUint64Array),
|
|
1590
|
+
t.instanceof(Float32Array),
|
|
1591
|
+
t.instanceof(Float64Array),
|
|
1592
|
+
t.instanceof(Int8Array),
|
|
1593
|
+
t.instanceof(Int16Array),
|
|
1594
|
+
t.instanceof(Int32Array),
|
|
1595
|
+
t.instanceof(BigInt64Array)
|
|
1596
|
+
]);
|
|
1597
|
+
var Et = (e) => {
|
|
1598
|
+
let t = typeof e;
|
|
1599
|
+
return t === "string" || t === "number" || t === "boolean" || t === "bigint" || e instanceof P || e instanceof F || e instanceof Date;
|
|
1600
|
+
}, Dt = (e, t, n, r = 0) => e.usesBigInt && !t.usesBigInt ? Number(BigInt(n.valueOf()) - BigInt(r.valueOf())) : !e.usesBigInt && t.usesBigInt ? BigInt(n.valueOf()) - BigInt(r.valueOf()) : D(n, r);
|
|
1601
|
+
R.z, P.z, F.z, I.z, B.z, z.z, R.boundedZ;
|
|
1602
|
+
var Ot = (e, t = !1) => {
|
|
1603
|
+
let n = Ee(e) ? "stringer" : typeof e, r;
|
|
1604
|
+
switch (n) {
|
|
1605
|
+
case "string":
|
|
1606
|
+
r = (e, t) => e.localeCompare(t);
|
|
1607
|
+
break;
|
|
1608
|
+
case "stringer":
|
|
1609
|
+
r = (e, t) => e.toString().localeCompare(t.toString());
|
|
1610
|
+
break;
|
|
1611
|
+
case "number":
|
|
1612
|
+
r = (e, t) => Number(e) - Number(t);
|
|
1613
|
+
break;
|
|
1614
|
+
case "bigint":
|
|
1615
|
+
r = (e, t) => BigInt(e) - BigInt(t) > 0n ? 1 : -1;
|
|
1616
|
+
break;
|
|
1617
|
+
case "boolean":
|
|
1618
|
+
r = (e, t) => Number(e) - Number(t);
|
|
1619
|
+
break;
|
|
1620
|
+
case "undefined":
|
|
1621
|
+
r = () => 0;
|
|
1622
|
+
break;
|
|
1623
|
+
default: return console.warn(`sortFunc: unknown type ${n}`), () => -1;
|
|
1305
1624
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1625
|
+
return t ? kt(r) : r;
|
|
1626
|
+
}, kt = (e) => (t, n) => e(n, t), At = (e, t = 21) => (n = t) => {
|
|
1627
|
+
let r = "", i = n | 0;
|
|
1628
|
+
for (; i--;) r += e[Math.random() * e.length | 0];
|
|
1629
|
+
return r;
|
|
1630
|
+
}, jt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Mt = `0123456789${jt}`, Nt = At(jt, 1), Pt = At(Mt, 10), Ft = () => `${Nt()}${Pt()}`, It = (e, t) => (n) => n instanceof t || typeof n == "object" && !!n && "discriminator" in n && n.discriminator === e;
|
|
1631
|
+
e.enum([
|
|
1632
|
+
"x",
|
|
1633
|
+
"y",
|
|
1634
|
+
...at,
|
|
1635
|
+
...st
|
|
1636
|
+
]);
|
|
1637
|
+
var Lt = lt;
|
|
1638
|
+
t.union([
|
|
1639
|
+
ot,
|
|
1640
|
+
t.enum([...at, ...st]),
|
|
1641
|
+
t.instanceof(String)
|
|
1642
|
+
]), t.object({
|
|
1643
|
+
x: nt.or(ct),
|
|
1644
|
+
y: rt.or(ct)
|
|
1645
|
+
});
|
|
1646
|
+
var Rt = Object.freeze({
|
|
1647
|
+
x: "left",
|
|
1648
|
+
y: "top"
|
|
1649
|
+
}), zt = Object.freeze({
|
|
1650
|
+
x: "right",
|
|
1651
|
+
y: "top"
|
|
1652
|
+
}), Bt = Object.freeze({
|
|
1653
|
+
x: "left",
|
|
1654
|
+
y: "bottom"
|
|
1655
|
+
}), Vt = Object.freeze({
|
|
1656
|
+
x: "right",
|
|
1657
|
+
y: "bottom"
|
|
1658
|
+
}), Ht = Object.freeze({
|
|
1659
|
+
x: "center",
|
|
1660
|
+
y: "center"
|
|
1661
|
+
}), Ut = Object.freeze({
|
|
1662
|
+
x: "center",
|
|
1663
|
+
y: "top"
|
|
1664
|
+
}), Wt = Object.freeze({
|
|
1665
|
+
x: "center",
|
|
1666
|
+
y: "bottom"
|
|
1667
|
+
}), Gt = Object.freeze({
|
|
1668
|
+
x: "right",
|
|
1669
|
+
y: "center"
|
|
1670
|
+
}), Kt = Object.freeze({
|
|
1671
|
+
x: "left",
|
|
1672
|
+
y: "center"
|
|
1673
|
+
});
|
|
1674
|
+
Object.freeze([
|
|
1675
|
+
Kt,
|
|
1676
|
+
Gt,
|
|
1677
|
+
Ut,
|
|
1678
|
+
Wt,
|
|
1679
|
+
Rt,
|
|
1680
|
+
zt,
|
|
1681
|
+
Bt,
|
|
1682
|
+
Vt,
|
|
1683
|
+
Ht
|
|
1684
|
+
]);
|
|
1685
|
+
var qt = (e, t) => e.x === t.x && e.y === t.y, Jt = (e) => [e.x, e.y], Yt = t.union([
|
|
1686
|
+
t.number(),
|
|
1687
|
+
j,
|
|
1688
|
+
ht,
|
|
1689
|
+
dt,
|
|
1690
|
+
ft,
|
|
1691
|
+
pt
|
|
1692
|
+
]), V = (e, t) => {
|
|
1693
|
+
if (typeof e == "string") {
|
|
1694
|
+
if (t === void 0) throw Error("The y coordinate must be given.");
|
|
1695
|
+
return e === "x" ? {
|
|
1696
|
+
x: t,
|
|
1697
|
+
y: 0
|
|
1698
|
+
} : {
|
|
1699
|
+
x: 0,
|
|
1700
|
+
y: t
|
|
1310
1701
|
};
|
|
1311
1702
|
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1703
|
+
return typeof e == "number" ? {
|
|
1704
|
+
x: e,
|
|
1705
|
+
y: t ?? e
|
|
1706
|
+
} : Array.isArray(e) ? {
|
|
1707
|
+
x: e[0],
|
|
1708
|
+
y: e[1]
|
|
1709
|
+
} : "signedWidth" in e ? {
|
|
1710
|
+
x: e.signedWidth,
|
|
1711
|
+
y: e.signedHeight
|
|
1712
|
+
} : "clientX" in e ? {
|
|
1713
|
+
x: e.clientX,
|
|
1714
|
+
y: e.clientY
|
|
1715
|
+
} : "width" in e ? {
|
|
1716
|
+
x: e.width,
|
|
1717
|
+
y: e.height
|
|
1718
|
+
} : {
|
|
1719
|
+
x: e.x,
|
|
1720
|
+
y: e.y
|
|
1721
|
+
};
|
|
1722
|
+
}, H = Object.freeze({
|
|
1723
|
+
x: 0,
|
|
1724
|
+
y: 0
|
|
1725
|
+
});
|
|
1726
|
+
Object.freeze({
|
|
1727
|
+
x: 1,
|
|
1728
|
+
y: 1
|
|
1729
|
+
}), Object.freeze({
|
|
1730
|
+
x: Infinity,
|
|
1731
|
+
y: Infinity
|
|
1732
|
+
}), Object.freeze({
|
|
1733
|
+
x: NaN,
|
|
1734
|
+
y: NaN
|
|
1735
|
+
});
|
|
1736
|
+
var Xt = (e, t) => {
|
|
1737
|
+
let n = V(e);
|
|
1738
|
+
return {
|
|
1739
|
+
x: n.x + t,
|
|
1740
|
+
y: n.y
|
|
1741
|
+
};
|
|
1742
|
+
}, Zt = (e, t) => {
|
|
1743
|
+
let n = V(e);
|
|
1744
|
+
return {
|
|
1745
|
+
x: n.x,
|
|
1746
|
+
y: n.y + t
|
|
1747
|
+
};
|
|
1748
|
+
}, Qt = (e, t, n, ...r) => {
|
|
1749
|
+
if (typeof t == "string") {
|
|
1750
|
+
if (typeof n != "number") throw Error("The value must be a number.");
|
|
1751
|
+
return t === "x" ? Xt(e, n) : Zt(e, n);
|
|
1350
1752
|
}
|
|
1351
|
-
|
|
1352
|
-
|
|
1753
|
+
if (typeof t == "object" && "x" in t && typeof t.x == "string") {
|
|
1754
|
+
let r = V(n), i = V(e);
|
|
1755
|
+
return t.x === "left" ? r.x = -r.x : t.x === "center" && (r.x = 0), t.y === "top" ? r.y = -r.y : t.y === "center" && (r.y = 0), {
|
|
1756
|
+
x: i.x + r.x,
|
|
1757
|
+
y: i.y + r.y
|
|
1758
|
+
};
|
|
1353
1759
|
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1760
|
+
return [
|
|
1761
|
+
e,
|
|
1762
|
+
t,
|
|
1763
|
+
n ?? H,
|
|
1764
|
+
...r
|
|
1765
|
+
].reduce((e, t) => {
|
|
1766
|
+
let n = V(t);
|
|
1767
|
+
return {
|
|
1768
|
+
x: e.x + n.x,
|
|
1769
|
+
y: e.y + n.y
|
|
1770
|
+
};
|
|
1771
|
+
}, H);
|
|
1772
|
+
}, U = t.union([t.number(), t.string()]);
|
|
1773
|
+
t.object({
|
|
1774
|
+
top: U,
|
|
1775
|
+
left: U,
|
|
1776
|
+
width: U,
|
|
1777
|
+
height: U
|
|
1778
|
+
}), t.object({
|
|
1779
|
+
left: t.number(),
|
|
1780
|
+
top: t.number(),
|
|
1781
|
+
right: t.number(),
|
|
1782
|
+
bottom: t.number()
|
|
1783
|
+
}), t.object({
|
|
1784
|
+
one: j,
|
|
1785
|
+
two: j,
|
|
1786
|
+
root: Lt
|
|
1787
|
+
});
|
|
1788
|
+
var W = (e, t, n = 0, r = 0, i) => {
|
|
1789
|
+
let a = {
|
|
1790
|
+
one: { ...H },
|
|
1791
|
+
two: { ...H },
|
|
1792
|
+
root: i ?? Rt
|
|
1793
|
+
};
|
|
1794
|
+
if (typeof e == "number") {
|
|
1795
|
+
if (typeof t != "number") throw Error("Box constructor called with invalid arguments");
|
|
1796
|
+
return a.one = {
|
|
1797
|
+
x: e,
|
|
1798
|
+
y: t
|
|
1799
|
+
}, a.two = {
|
|
1800
|
+
x: a.one.x + n,
|
|
1801
|
+
y: a.one.y + r
|
|
1802
|
+
}, a;
|
|
1362
1803
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1804
|
+
return "one" in e && "two" in e && "root" in e ? {
|
|
1805
|
+
...e,
|
|
1806
|
+
root: i ?? e.root
|
|
1807
|
+
} : ("getBoundingClientRect" in e && (e = e.getBoundingClientRect()), "left" in e ? (a.one = {
|
|
1808
|
+
x: e.left,
|
|
1809
|
+
y: e.top
|
|
1810
|
+
}, a.two = {
|
|
1811
|
+
x: e.right,
|
|
1812
|
+
y: e.bottom
|
|
1813
|
+
}, a) : (a.one = e, t == null ? a.two = {
|
|
1814
|
+
x: a.one.x + n,
|
|
1815
|
+
y: a.one.y + r
|
|
1816
|
+
} : typeof t == "number" ? a.two = {
|
|
1817
|
+
x: a.one.x + t,
|
|
1818
|
+
y: a.one.y + n
|
|
1819
|
+
} : "width" in t ? a.two = {
|
|
1820
|
+
x: a.one.x + t.width,
|
|
1821
|
+
y: a.one.y + t.height
|
|
1822
|
+
} : "signedWidth" in t ? a.two = {
|
|
1823
|
+
x: a.one.x + t.signedWidth,
|
|
1824
|
+
y: a.one.y + t.signedHeight
|
|
1825
|
+
} : a.two = t, a));
|
|
1826
|
+
}, $t = (e, t) => {
|
|
1827
|
+
let n = W(e);
|
|
1828
|
+
return {
|
|
1829
|
+
x: t.x === "center" ? an(n).x : en(n, t.x),
|
|
1830
|
+
y: t.y === "center" ? an(n).y : en(n, t.y)
|
|
1831
|
+
};
|
|
1832
|
+
}, en = (e, t) => {
|
|
1833
|
+
let n = W(e), r = Jt(n.root).includes(t) ? Math.min : Math.max;
|
|
1834
|
+
return tt.includes(t) ? r(n.one.x, n.two.x) : r(n.one.y, n.two.y);
|
|
1835
|
+
}, tn = (e) => {
|
|
1836
|
+
let t = W(e);
|
|
1837
|
+
return t.two.x - t.one.x;
|
|
1838
|
+
}, nn = (e) => {
|
|
1839
|
+
let t = W(e);
|
|
1840
|
+
return t.two.y - t.one.y;
|
|
1841
|
+
}, rn = (e) => $t(e, Rt), an = (e) => Qt(rn(e), {
|
|
1842
|
+
x: tn(e) / 2,
|
|
1843
|
+
y: nn(e) / 2
|
|
1844
|
+
}), on = (e) => {
|
|
1845
|
+
let t = W(e);
|
|
1846
|
+
return {
|
|
1847
|
+
lower: t.one.x,
|
|
1848
|
+
upper: t.two.x
|
|
1849
|
+
};
|
|
1850
|
+
}, sn = (e) => {
|
|
1851
|
+
let t = W(e);
|
|
1852
|
+
return {
|
|
1853
|
+
lower: t.one.y,
|
|
1854
|
+
upper: t.two.y
|
|
1855
|
+
};
|
|
1856
|
+
}, cn = (e) => typeof e != "object" || !e ? !1 : "one" in e && "two" in e && "root" in e;
|
|
1857
|
+
t.union([
|
|
1858
|
+
dt,
|
|
1859
|
+
ft,
|
|
1860
|
+
j,
|
|
1861
|
+
ht
|
|
1862
|
+
]);
|
|
1863
|
+
var ln = (e, t, n) => t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e;
|
|
1864
|
+
t.object({
|
|
1865
|
+
offset: Yt,
|
|
1866
|
+
scale: Yt
|
|
1867
|
+
}), t.object({
|
|
1868
|
+
offset: t.number(),
|
|
1869
|
+
scale: t.number()
|
|
1870
|
+
});
|
|
1871
|
+
var un = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r + e], dn = (e) => (t, n, r, i) => [t, i ? r / e : r * e], fn = (e) => (t, n, r) => {
|
|
1872
|
+
if (t === null) return [e, r];
|
|
1873
|
+
let { lower: i, upper: a } = t, { lower: o, upper: s } = e, c = a - i, l = s - o;
|
|
1874
|
+
return n === "dimension" ? [e, l / c * r] : [e, (r - i) * (l / c) + o];
|
|
1875
|
+
}, pn = (e) => (t, n, r) => [e, r], mn = () => (e, t, n) => {
|
|
1876
|
+
if (e === null) throw Error("cannot invert without bounds");
|
|
1877
|
+
if (t === "dimension") return [e, n];
|
|
1878
|
+
let { lower: r, upper: i } = e;
|
|
1879
|
+
return [e, i - (n - r)];
|
|
1880
|
+
}, hn = (e) => (t, n, r) => {
|
|
1881
|
+
let { lower: i, upper: a } = e;
|
|
1882
|
+
return r = ln(r, i, a), [t, r];
|
|
1883
|
+
}, gn = class e {
|
|
1884
|
+
ops = [];
|
|
1885
|
+
currBounds = null;
|
|
1886
|
+
currType = null;
|
|
1887
|
+
reversed = !1;
|
|
1888
|
+
constructor() {
|
|
1889
|
+
this.ops = [];
|
|
1367
1890
|
}
|
|
1368
|
-
|
|
1369
|
-
return
|
|
1891
|
+
static translate(t) {
|
|
1892
|
+
return new e().translate(t);
|
|
1370
1893
|
}
|
|
1371
|
-
|
|
1372
|
-
return e
|
|
1894
|
+
static magnify(t) {
|
|
1895
|
+
return new e().magnify(t);
|
|
1373
1896
|
}
|
|
1374
|
-
|
|
1375
|
-
return
|
|
1897
|
+
static scale(t, n) {
|
|
1898
|
+
return new e().scale(t, n);
|
|
1376
1899
|
}
|
|
1377
|
-
|
|
1378
|
-
|
|
1900
|
+
translate(e) {
|
|
1901
|
+
let t = this.new(), n = un(e);
|
|
1902
|
+
return n.type = "translate", t.ops.push(n), t;
|
|
1379
1903
|
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1904
|
+
magnify(e) {
|
|
1905
|
+
let t = this.new(), n = dn(e);
|
|
1906
|
+
return n.type = "magnify", t.ops.push(n), t;
|
|
1382
1907
|
}
|
|
1383
|
-
|
|
1384
|
-
let e = this.
|
|
1385
|
-
return
|
|
1908
|
+
scale(e, t) {
|
|
1909
|
+
let n = M(e, t), r = this.new(), i = fn(n);
|
|
1910
|
+
return i.type = "scale", r.ops.push(i), r;
|
|
1386
1911
|
}
|
|
1387
|
-
|
|
1388
|
-
|
|
1912
|
+
clamp(e, t) {
|
|
1913
|
+
let n = M(e, t), r = this.new(), i = hn(n);
|
|
1914
|
+
return i.type = "clamp", r.ops.push(i), r;
|
|
1389
1915
|
}
|
|
1390
|
-
|
|
1391
|
-
let t =
|
|
1392
|
-
|
|
1393
|
-
return t;
|
|
1916
|
+
reBound(e, t) {
|
|
1917
|
+
let n = M(e, t), r = this.new(), i = pn(n);
|
|
1918
|
+
return i.type = "re-bound", r.ops.push(i), r;
|
|
1394
1919
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1920
|
+
invert() {
|
|
1921
|
+
let e = mn();
|
|
1922
|
+
e.type = "invert";
|
|
1923
|
+
let t = this.new();
|
|
1924
|
+
return t.ops.push(e), t;
|
|
1397
1925
|
}
|
|
1398
|
-
|
|
1399
|
-
return this.
|
|
1926
|
+
pos(e) {
|
|
1927
|
+
return this.exec("position", e);
|
|
1400
1928
|
}
|
|
1401
|
-
|
|
1402
|
-
return this.
|
|
1929
|
+
dim(e) {
|
|
1930
|
+
return this.exec("dimension", e);
|
|
1403
1931
|
}
|
|
1404
|
-
|
|
1405
|
-
|
|
1932
|
+
new() {
|
|
1933
|
+
let t = new e();
|
|
1934
|
+
return t.ops = this.ops.slice(), t.reversed = this.reversed, t;
|
|
1406
1935
|
}
|
|
1407
|
-
|
|
1408
|
-
return
|
|
1936
|
+
exec(e, t) {
|
|
1937
|
+
return this.currBounds = null, this.ops.reduce(([t, n], r) => r(t, e, n, this.reversed), [null, t])[1];
|
|
1409
1938
|
}
|
|
1410
|
-
|
|
1411
|
-
|
|
1939
|
+
reverse() {
|
|
1940
|
+
let e = this.new();
|
|
1941
|
+
e.ops.reverse();
|
|
1942
|
+
let t = [];
|
|
1943
|
+
return e.ops.forEach((n, r) => {
|
|
1944
|
+
if (n.type === "scale" || t.some(([e, t]) => r >= e && r <= t)) return;
|
|
1945
|
+
let i = e.ops.findIndex((e, t) => e.type === "scale" && t > r);
|
|
1946
|
+
i !== -1 && t.push([r, i]);
|
|
1947
|
+
}), t.forEach(([t, n]) => {
|
|
1948
|
+
let r = e.ops.slice(t, n);
|
|
1949
|
+
r.unshift(e.ops[n]), e.ops.splice(t, n - t + 1, ...r);
|
|
1950
|
+
}), e.reversed = !e.reversed, e;
|
|
1412
1951
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
static INT16 = new e("int16");
|
|
1419
|
-
static INT8 = new e("int8");
|
|
1420
|
-
static UINT64 = new e("uint64");
|
|
1421
|
-
static UINT32 = new e("uint32");
|
|
1422
|
-
static UINT16 = new e("uint16");
|
|
1423
|
-
static UINT8 = new e("uint8");
|
|
1424
|
-
static TIMESTAMP = new e("timestamp");
|
|
1425
|
-
static UUID = new e("uuid");
|
|
1426
|
-
static STRING = new e("string");
|
|
1427
|
-
static JSON = new e("json");
|
|
1428
|
-
static BYTES = new e("bytes");
|
|
1429
|
-
static ARRAY_CONSTRUCTORS = new Map([
|
|
1430
|
-
[e.UINT8.toString(), Uint8Array],
|
|
1431
|
-
[e.UINT16.toString(), Uint16Array],
|
|
1432
|
-
[e.UINT32.toString(), Uint32Array],
|
|
1433
|
-
[e.UINT64.toString(), BigUint64Array],
|
|
1434
|
-
[e.FLOAT32.toString(), Float32Array],
|
|
1435
|
-
[e.FLOAT64.toString(), Float64Array],
|
|
1436
|
-
[e.INT8.toString(), Int8Array],
|
|
1437
|
-
[e.INT16.toString(), Int16Array],
|
|
1438
|
-
[e.INT32.toString(), Int32Array],
|
|
1439
|
-
[e.INT64.toString(), BigInt64Array],
|
|
1440
|
-
[e.TIMESTAMP.toString(), BigInt64Array],
|
|
1441
|
-
[e.STRING.toString(), Uint8Array],
|
|
1442
|
-
[e.JSON.toString(), Uint8Array],
|
|
1443
|
-
[e.UUID.toString(), Uint8Array],
|
|
1444
|
-
[e.BYTES.toString(), Uint8Array]
|
|
1445
|
-
]);
|
|
1446
|
-
static ARRAY_CONSTRUCTOR_DATA_TYPES = new Map([
|
|
1447
|
-
[Uint8Array.name, e.UINT8],
|
|
1448
|
-
[Uint16Array.name, e.UINT16],
|
|
1449
|
-
[Uint32Array.name, e.UINT32],
|
|
1450
|
-
[BigUint64Array.name, e.UINT64],
|
|
1451
|
-
[Float32Array.name, e.FLOAT32],
|
|
1452
|
-
[Float64Array.name, e.FLOAT64],
|
|
1453
|
-
[Int8Array.name, e.INT8],
|
|
1454
|
-
[Int16Array.name, e.INT16],
|
|
1455
|
-
[Int32Array.name, e.INT32],
|
|
1456
|
-
[BigInt64Array.name, e.INT64]
|
|
1457
|
-
]);
|
|
1458
|
-
static DENSITIES = new Map([
|
|
1459
|
-
[e.UINT8.toString(), z.BIT8],
|
|
1460
|
-
[e.UINT16.toString(), z.BIT16],
|
|
1461
|
-
[e.UINT32.toString(), z.BIT32],
|
|
1462
|
-
[e.UINT64.toString(), z.BIT64],
|
|
1463
|
-
[e.FLOAT32.toString(), z.BIT32],
|
|
1464
|
-
[e.FLOAT64.toString(), z.BIT64],
|
|
1465
|
-
[e.INT8.toString(), z.BIT8],
|
|
1466
|
-
[e.INT16.toString(), z.BIT16],
|
|
1467
|
-
[e.INT32.toString(), z.BIT32],
|
|
1468
|
-
[e.INT64.toString(), z.BIT64],
|
|
1469
|
-
[e.TIMESTAMP.toString(), z.BIT64],
|
|
1470
|
-
[e.STRING.toString(), z.UNKNOWN],
|
|
1471
|
-
[e.JSON.toString(), z.UNKNOWN],
|
|
1472
|
-
[e.UUID.toString(), z.BIT128],
|
|
1473
|
-
[e.BYTES.toString(), z.UNKNOWN]
|
|
1474
|
-
]);
|
|
1475
|
-
static ALL = [
|
|
1476
|
-
e.UNKNOWN,
|
|
1477
|
-
e.UINT8,
|
|
1478
|
-
e.UINT16,
|
|
1479
|
-
e.UINT32,
|
|
1480
|
-
e.UINT64,
|
|
1481
|
-
e.INT8,
|
|
1482
|
-
e.INT16,
|
|
1483
|
-
e.INT32,
|
|
1484
|
-
e.INT64,
|
|
1485
|
-
e.FLOAT32,
|
|
1486
|
-
e.FLOAT64,
|
|
1487
|
-
e.TIMESTAMP,
|
|
1488
|
-
e.UUID,
|
|
1489
|
-
e.STRING,
|
|
1490
|
-
e.JSON,
|
|
1491
|
-
e.BYTES
|
|
1492
|
-
];
|
|
1493
|
-
static SHORT_STRINGS = new Map([
|
|
1494
|
-
[e.UINT8.toString(), "u8"],
|
|
1495
|
-
[e.UINT16.toString(), "u16"],
|
|
1496
|
-
[e.UINT32.toString(), "u32"],
|
|
1497
|
-
[e.UINT64.toString(), "u64"],
|
|
1498
|
-
[e.INT8.toString(), "i8"],
|
|
1499
|
-
[e.INT16.toString(), "i16"],
|
|
1500
|
-
[e.INT32.toString(), "i32"],
|
|
1501
|
-
[e.INT64.toString(), "i64"],
|
|
1502
|
-
[e.FLOAT32.toString(), "f32"],
|
|
1503
|
-
[e.FLOAT64.toString(), "f64"],
|
|
1504
|
-
[e.TIMESTAMP.toString(), "ts"],
|
|
1505
|
-
[e.UUID.toString(), "uuid"],
|
|
1506
|
-
[e.STRING.toString(), "str"],
|
|
1507
|
-
[e.JSON.toString(), "json"],
|
|
1508
|
-
[e.BYTES.toString(), "bytes"]
|
|
1509
|
-
]);
|
|
1510
|
-
static BIG_INT_TYPES = [
|
|
1511
|
-
e.INT64,
|
|
1512
|
-
e.UINT64,
|
|
1513
|
-
e.TIMESTAMP
|
|
1514
|
-
];
|
|
1515
|
-
static z = t.union([t.string().transform((t) => new e(t)), t.instanceof(e)]);
|
|
1516
|
-
}, H = class e extends y {
|
|
1517
|
-
constructor(e) {
|
|
1518
|
-
v(e) && (e = e.value), super(e.valueOf());
|
|
1952
|
+
get transform() {
|
|
1953
|
+
return {
|
|
1954
|
+
scale: this.dim(1),
|
|
1955
|
+
offset: this.pos(0)
|
|
1956
|
+
};
|
|
1519
1957
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1958
|
+
static IDENTITY = new e();
|
|
1959
|
+
};
|
|
1960
|
+
(class e {
|
|
1961
|
+
x;
|
|
1962
|
+
y;
|
|
1963
|
+
currRoot;
|
|
1964
|
+
constructor(e = new gn(), t = new gn(), n = null) {
|
|
1965
|
+
this.x = e, this.y = t, this.currRoot = n;
|
|
1522
1966
|
}
|
|
1523
|
-
|
|
1524
|
-
return
|
|
1967
|
+
static translate(t, n) {
|
|
1968
|
+
return new e().translate(t, n);
|
|
1525
1969
|
}
|
|
1526
|
-
|
|
1527
|
-
return
|
|
1970
|
+
static translateX(t) {
|
|
1971
|
+
return new e().translateX(t);
|
|
1528
1972
|
}
|
|
1529
|
-
|
|
1530
|
-
return
|
|
1973
|
+
static translateY(t) {
|
|
1974
|
+
return new e().translateY(t);
|
|
1531
1975
|
}
|
|
1532
|
-
|
|
1533
|
-
return new e(
|
|
1976
|
+
static clamp(t) {
|
|
1977
|
+
return new e().clamp(t);
|
|
1534
1978
|
}
|
|
1535
|
-
|
|
1536
|
-
return new e(
|
|
1979
|
+
static magnify(t) {
|
|
1980
|
+
return new e().magnify(t);
|
|
1537
1981
|
}
|
|
1538
|
-
|
|
1539
|
-
return new e(
|
|
1982
|
+
static scale(t) {
|
|
1983
|
+
return new e().scale(t);
|
|
1540
1984
|
}
|
|
1541
|
-
|
|
1542
|
-
return
|
|
1985
|
+
static reBound(t) {
|
|
1986
|
+
return new e().reBound(t);
|
|
1543
1987
|
}
|
|
1544
|
-
|
|
1545
|
-
|
|
1988
|
+
translate(e, t) {
|
|
1989
|
+
let n = V(e, t), r = this.copy();
|
|
1990
|
+
return r.x = this.x.translate(n.x), r.y = this.y.translate(n.y), r;
|
|
1546
1991
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1992
|
+
translateX(e) {
|
|
1993
|
+
let t = this.copy();
|
|
1994
|
+
return t.x = this.x.translate(e), t;
|
|
1549
1995
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1996
|
+
translateY(e) {
|
|
1997
|
+
let t = this.copy();
|
|
1998
|
+
return t.y = this.y.translate(e), t;
|
|
1552
1999
|
}
|
|
1553
|
-
|
|
1554
|
-
|
|
2000
|
+
magnify(e) {
|
|
2001
|
+
let t = this.copy();
|
|
2002
|
+
return t.x = this.x.magnify(e.x), t.y = this.y.magnify(e.y), t;
|
|
1555
2003
|
}
|
|
1556
|
-
|
|
1557
|
-
let t = this.
|
|
1558
|
-
|
|
2004
|
+
scale(e) {
|
|
2005
|
+
let t = this.copy();
|
|
2006
|
+
if (cn(e)) {
|
|
2007
|
+
let n = this.currRoot;
|
|
2008
|
+
return t.currRoot = e.root, n != null && !qt(n, e.root) && (n.x !== e.root.x && (t.x = t.x.invert()), n.y !== e.root.y && (t.y = t.y.invert())), t.x = t.x.scale(on(e)), t.y = t.y.scale(sn(e)), t;
|
|
2009
|
+
}
|
|
2010
|
+
return t.x = t.x.scale(e.width), t.y = t.y.scale(e.height), t;
|
|
1559
2011
|
}
|
|
1560
|
-
|
|
1561
|
-
|
|
2012
|
+
reBound(e) {
|
|
2013
|
+
let t = this.copy();
|
|
2014
|
+
return t.x = this.x.reBound(on(e)), t.y = this.y.reBound(sn(e)), t;
|
|
1562
2015
|
}
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
return
|
|
2016
|
+
clamp(e) {
|
|
2017
|
+
let t = this.copy();
|
|
2018
|
+
return t.x = this.x.clamp(on(e)), t.y = this.y.clamp(sn(e)), t;
|
|
1566
2019
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
return
|
|
2020
|
+
copy() {
|
|
2021
|
+
let t = new e();
|
|
2022
|
+
return t.currRoot = this.currRoot, t.x = this.x, t.y = this.y, t;
|
|
1570
2023
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
return e.
|
|
2024
|
+
reverse() {
|
|
2025
|
+
let e = this.copy();
|
|
2026
|
+
return e.x = this.x.reverse(), e.y = this.y.reverse(), e;
|
|
1574
2027
|
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
2028
|
+
pos(e) {
|
|
2029
|
+
return {
|
|
2030
|
+
x: this.x.pos(e.x),
|
|
2031
|
+
y: this.y.pos(e.y)
|
|
2032
|
+
};
|
|
1578
2033
|
}
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
2034
|
+
dim(e) {
|
|
2035
|
+
return {
|
|
2036
|
+
x: this.x.dim(e.x),
|
|
2037
|
+
y: this.y.dim(e.y)
|
|
2038
|
+
};
|
|
1584
2039
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
return typeof e == "string" && yt.test(e);
|
|
2040
|
+
box(e) {
|
|
2041
|
+
return W(this.pos(e.one), this.pos(e.two), 0, 0, this.currRoot ?? e.root);
|
|
2042
|
+
}
|
|
2043
|
+
get transform() {
|
|
2044
|
+
return {
|
|
2045
|
+
scale: this.dim({
|
|
2046
|
+
x: 1,
|
|
2047
|
+
y: 1
|
|
2048
|
+
}),
|
|
2049
|
+
offset: this.pos({
|
|
2050
|
+
x: 0,
|
|
2051
|
+
y: 0
|
|
2052
|
+
})
|
|
2053
|
+
};
|
|
2054
|
+
}
|
|
2055
|
+
static IDENTITY = new e();
|
|
2056
|
+
}), mt.required({
|
|
2057
|
+
root: !0,
|
|
2058
|
+
units: !0
|
|
2059
|
+
});
|
|
2060
|
+
var _n = t.enum(["static", "dynamic"]), vn = /^(?:[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;
|
|
2061
|
+
function yn(e) {
|
|
2062
|
+
return typeof e == "string" && vn.test(e);
|
|
1609
2063
|
}
|
|
1610
|
-
var
|
|
1611
|
-
for (let e = 0; e < 256; ++e)
|
|
1612
|
-
function
|
|
1613
|
-
return (
|
|
2064
|
+
var G = [];
|
|
2065
|
+
for (let e = 0; e < 256; ++e) G.push((e + 256).toString(16).slice(1));
|
|
2066
|
+
function bn(e, t = 0) {
|
|
2067
|
+
return (G[e[t + 0]] + G[e[t + 1]] + G[e[t + 2]] + G[e[t + 3]] + "-" + G[e[t + 4]] + G[e[t + 5]] + "-" + G[e[t + 6]] + G[e[t + 7]] + "-" + G[e[t + 8]] + G[e[t + 9]] + "-" + G[e[t + 10]] + G[e[t + 11]] + G[e[t + 12]] + G[e[t + 13]] + G[e[t + 14]] + G[e[t + 15]]).toLowerCase();
|
|
1614
2068
|
}
|
|
1615
|
-
function
|
|
1616
|
-
let n =
|
|
1617
|
-
if (!
|
|
2069
|
+
function xn(e, t = 0) {
|
|
2070
|
+
let n = bn(e, t);
|
|
2071
|
+
if (!yn(n)) throw TypeError("Stringified UUID is invalid");
|
|
1618
2072
|
return n;
|
|
1619
2073
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
2074
|
+
var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
2075
|
+
let t = Math.fround(e);
|
|
2076
|
+
if (!Number.isFinite(t)) return t.toString();
|
|
2077
|
+
for (let e = 1; e <= 9; e++) {
|
|
2078
|
+
let n = parseFloat(t.toPrecision(e));
|
|
2079
|
+
if (Math.fround(n) === t) return n.toString();
|
|
2080
|
+
}
|
|
2081
|
+
return t.toString();
|
|
2082
|
+
}, K = -1, wn = {
|
|
2083
|
+
[Symbol.iterator]: () => wn,
|
|
1623
2084
|
next: () => ({
|
|
1624
2085
|
done: !0,
|
|
1625
2086
|
value: void 0
|
|
1626
2087
|
})
|
|
1627
|
-
},
|
|
2088
|
+
}, Tn = t.string().transform((e) => new Uint8Array(atob(e).split("").map((e) => e.charCodeAt(0))).buffer), En = t.union([t.null(), t.undefined()]).transform(() => new Uint8Array().buffer), q = 4, Dn = (e, t) => {
|
|
1628
2089
|
if (e === "number" && !t.isNumeric) throw Error(`cannot convert series of type ${t.toString()} to number`);
|
|
1629
2090
|
if (e === "bigint" && !t.usesBigInt) throw Error(`cannot convert series of type ${t.toString()} to bigint`);
|
|
1630
|
-
},
|
|
2091
|
+
}, On = "sy_x_telem_series", kn = class e {
|
|
1631
2092
|
key;
|
|
1632
|
-
discriminator =
|
|
2093
|
+
discriminator = On;
|
|
1633
2094
|
dataType;
|
|
1634
2095
|
sampleOffset;
|
|
1635
2096
|
gl;
|
|
1636
2097
|
_data;
|
|
1637
|
-
timeRange =
|
|
2098
|
+
timeRange = R.ZERO;
|
|
1638
2099
|
alignment = 0n;
|
|
1639
2100
|
alignmentMultiple = 1n;
|
|
1640
2101
|
cachedMin;
|
|
1641
2102
|
cachedMax;
|
|
1642
|
-
writePos =
|
|
2103
|
+
writePos = K;
|
|
1643
2104
|
_refCount = 0;
|
|
1644
2105
|
cachedLength;
|
|
1645
2106
|
_cachedIndexes;
|
|
1646
2107
|
static crudeZ = t.object({
|
|
1647
|
-
timeRange:
|
|
1648
|
-
dataType:
|
|
2108
|
+
timeRange: R.z.optional(),
|
|
2109
|
+
dataType: z.z,
|
|
1649
2110
|
alignment: t.coerce.bigint().optional(),
|
|
1650
2111
|
data: t.union([
|
|
1651
|
-
|
|
1652
|
-
|
|
2112
|
+
Tn,
|
|
2113
|
+
En,
|
|
1653
2114
|
t.instanceof(ArrayBuffer),
|
|
1654
2115
|
t.instanceof(Uint8Array)
|
|
1655
|
-
]),
|
|
1656
|
-
glBufferUsage:
|
|
2116
|
+
]).default(() => new Uint8Array().buffer),
|
|
2117
|
+
glBufferUsage: _n.default("static").optional()
|
|
1657
2118
|
});
|
|
1658
2119
|
static z = e.crudeZ.transform((t) => new e(t));
|
|
1659
2120
|
constructor(e) {
|
|
1660
|
-
|
|
1661
|
-
let { dataType: t, timeRange: n, sampleOffset: r = 0, glBufferUsage: i = "static", alignment: a = 0n, alignmentMultiple: o = 1n, key: s =
|
|
1662
|
-
if (
|
|
2121
|
+
An(e) && (e = { data: e }), e.data ??= [];
|
|
2122
|
+
let { dataType: t, timeRange: n, sampleOffset: r = 0, glBufferUsage: i = "static", alignment: a = 0n, alignmentMultiple: o = 1n, key: s = Ft(), data: c } = e;
|
|
2123
|
+
if (jn(c)) {
|
|
1663
2124
|
let e = c;
|
|
1664
2125
|
this.key = e.key, this.dataType = e.dataType, this.sampleOffset = e.sampleOffset, this.gl = e.gl, this._data = e._data, this.timeRange = e.timeRange, this.alignment = e.alignment, this.alignmentMultiple = e.alignmentMultiple, this.cachedMin = e.cachedMin, this.cachedMax = e.cachedMax, this.writePos = e.writePos, this._refCount = e._refCount, this.cachedLength = e.cachedLength;
|
|
1665
2126
|
return;
|
|
1666
2127
|
}
|
|
1667
|
-
let l =
|
|
1668
|
-
if (t != null) this.dataType = new
|
|
2128
|
+
let l = Et(c), u = Array.isArray(c);
|
|
2129
|
+
if (t != null) this.dataType = new z(t);
|
|
1669
2130
|
else if (c instanceof ArrayBuffer) throw Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");
|
|
1670
2131
|
else if (u || l) {
|
|
1671
2132
|
let e = c;
|
|
@@ -1673,21 +2134,31 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1673
2134
|
if (c.length === 0) throw Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");
|
|
1674
2135
|
e = c[0];
|
|
1675
2136
|
}
|
|
1676
|
-
if (typeof e == "string") this.dataType =
|
|
1677
|
-
else if (typeof e == "number") this.dataType =
|
|
1678
|
-
else if (typeof e == "bigint") this.dataType =
|
|
1679
|
-
else if (typeof e == "boolean") this.dataType =
|
|
1680
|
-
else if (e instanceof
|
|
1681
|
-
else if (typeof e == "object") this.dataType =
|
|
2137
|
+
if (typeof e == "string") this.dataType = z.STRING;
|
|
2138
|
+
else if (typeof e == "number") this.dataType = z.FLOAT64;
|
|
2139
|
+
else if (typeof e == "bigint") this.dataType = z.INT64;
|
|
2140
|
+
else if (typeof e == "boolean") this.dataType = z.UINT8;
|
|
2141
|
+
else if (e instanceof P || e instanceof Date || e instanceof P) this.dataType = z.TIMESTAMP;
|
|
2142
|
+
else if (typeof e == "object") this.dataType = z.JSON;
|
|
1682
2143
|
else throw Error(`cannot infer data type of ${typeof e} when constructing a Series from a JS array`);
|
|
1683
|
-
} else this.dataType = new
|
|
2144
|
+
} else this.dataType = new z(c);
|
|
1684
2145
|
if (!u && !l) this._data = c;
|
|
1685
2146
|
else if (u && c.length === 0) this._data = new this.dataType.Array([]).buffer;
|
|
1686
2147
|
else {
|
|
1687
2148
|
let e = l ? [c] : c, t = e[0];
|
|
1688
|
-
(t instanceof
|
|
2149
|
+
if ((t instanceof P || t instanceof Date || t instanceof F) && (e = e.map((e) => new P(e).valueOf())), this.dataType.equals(z.STRING)) {
|
|
2150
|
+
this.cachedLength = e.length;
|
|
2151
|
+
let t = e.map((e) => new TextEncoder().encode(e)), n = t.reduce((e, t) => e + q + t.byteLength, 0), r = new ArrayBuffer(n), i = new DataView(r), a = new Uint8Array(r), o = 0;
|
|
2152
|
+
for (let e of t) i.setUint32(o, e.byteLength, !0), o += q, a.set(e, o), o += e.byteLength;
|
|
2153
|
+
this._data = r;
|
|
2154
|
+
} else if (this.dataType.equals(z.JSON)) {
|
|
2155
|
+
this.cachedLength = e.length;
|
|
2156
|
+
let t = e.map((e) => new TextEncoder().encode(St.encodeString(e))), n = t.reduce((e, t) => e + q + t.byteLength, 0), r = new ArrayBuffer(n), i = new DataView(r), a = new Uint8Array(r), o = 0;
|
|
2157
|
+
for (let e of t) i.setUint32(o, e.byteLength, !0), o += q, a.set(e, o), o += e.byteLength;
|
|
2158
|
+
this._data = r;
|
|
2159
|
+
} else this.dataType.usesBigInt && typeof t == "number" ? this._data = new this.dataType.Array(e.map((e) => BigInt(Math.round(e)))).buffer : !this.dataType.usesBigInt && typeof t == "bigint" ? this._data = new this.dataType.Array(e.map(Number)).buffer : this._data = new this.dataType.Array(e).buffer;
|
|
1689
2160
|
}
|
|
1690
|
-
this.key = s, this.alignment = a, this.alignmentMultiple = o, this.sampleOffset = r ?? 0, this.timeRange = n ??
|
|
2161
|
+
this.key = s, this.alignment = a, this.alignmentMultiple = o, this.sampleOffset = r ?? 0, this.timeRange = n ?? R.ZERO, this.gl = {
|
|
1691
2162
|
control: null,
|
|
1692
2163
|
buffer: null,
|
|
1693
2164
|
prevBuffer: 0,
|
|
@@ -1697,7 +2168,7 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1697
2168
|
static alloc({ capacity: t, dataType: n, ...r }) {
|
|
1698
2169
|
if (t === 0) throw Error("[Series] - cannot allocate an array of length 0");
|
|
1699
2170
|
let i = new e({
|
|
1700
|
-
data: new new
|
|
2171
|
+
data: new new z(n).Array(t).buffer,
|
|
1701
2172
|
dataType: n,
|
|
1702
2173
|
...r
|
|
1703
2174
|
});
|
|
@@ -1717,12 +2188,19 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1717
2188
|
return this.dataType.isVariable ? this.writeVariable(e) : this.writeFixed(e);
|
|
1718
2189
|
}
|
|
1719
2190
|
writeVariable(e) {
|
|
1720
|
-
if (this.writePos ===
|
|
1721
|
-
let t = this.byteCapacity.valueOf() - this.writePos, n = e.
|
|
1722
|
-
|
|
2191
|
+
if (this.writePos === K) return 0;
|
|
2192
|
+
let t = this.byteCapacity.valueOf() - this.writePos, n = e.buffer, r = e.byteLength.valueOf(), i = new DataView(n), a = 0, o = 0;
|
|
2193
|
+
for (; a + q <= r;) {
|
|
2194
|
+
let e = q + i.getUint32(a, !0);
|
|
2195
|
+
if (a + e > t) break;
|
|
2196
|
+
a += e, o++;
|
|
2197
|
+
}
|
|
2198
|
+
if (a === 0) return 0;
|
|
2199
|
+
let s = e.subBytes(0, a);
|
|
2200
|
+
return this.writeToUnderlyingData(s), this.writePos += a, this.cachedLength = (this.cachedLength ?? 0) + o, this._cachedIndexes = void 0, o;
|
|
1723
2201
|
}
|
|
1724
2202
|
writeFixed(e) {
|
|
1725
|
-
if (this.writePos ===
|
|
2203
|
+
if (this.writePos === K) return 0;
|
|
1726
2204
|
let t = this.capacity - this.writePos, n = e.sub(0, t);
|
|
1727
2205
|
return this.writeToUnderlyingData(n), this.cachedLength = void 0, this.maybeRecomputeMinMax(n), this.writePos += n.length, n.length;
|
|
1728
2206
|
}
|
|
@@ -1736,38 +2214,48 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1736
2214
|
return new this.dataType.Array(this._data);
|
|
1737
2215
|
}
|
|
1738
2216
|
get data() {
|
|
1739
|
-
return this.writePos ===
|
|
2217
|
+
return this.writePos === K ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
|
|
1740
2218
|
}
|
|
1741
2219
|
toStrings() {
|
|
1742
|
-
|
|
2220
|
+
if (this.dataType.isVariable) {
|
|
2221
|
+
let e = [], t = this.buffer, n = this.byteLength.valueOf(), r = new DataView(t), i = new TextDecoder(), a = 0;
|
|
2222
|
+
for (; a + q <= n;) {
|
|
2223
|
+
let n = r.getUint32(a, !0);
|
|
2224
|
+
a += q, e.push(i.decode(new Uint8Array(t, a, n))), a += n;
|
|
2225
|
+
}
|
|
2226
|
+
return e;
|
|
2227
|
+
}
|
|
2228
|
+
return Array.from(this).map((e) => e.toString());
|
|
1743
2229
|
}
|
|
1744
2230
|
parseJSON(e) {
|
|
1745
|
-
if (!this.dataType.equals(
|
|
1746
|
-
return this.toStrings().map((t) => e.parse(
|
|
2231
|
+
if (!this.dataType.equals(z.JSON)) throw Error("cannot parse non-JSON series as JSON");
|
|
2232
|
+
return this.toStrings().map((t) => e.parse(St.decodeString(t)));
|
|
1747
2233
|
}
|
|
1748
2234
|
get byteCapacity() {
|
|
1749
|
-
return new
|
|
2235
|
+
return new B(this.underlyingData.byteLength);
|
|
1750
2236
|
}
|
|
1751
2237
|
get capacity() {
|
|
1752
2238
|
return this.dataType.isVariable ? this.byteCapacity.valueOf() : this.dataType.density.length(this.byteCapacity);
|
|
1753
2239
|
}
|
|
1754
2240
|
get byteLength() {
|
|
1755
|
-
return this.writePos ===
|
|
2241
|
+
return this.writePos === K ? this.byteCapacity : this.dataType.isVariable ? new B(this.writePos) : this.dataType.density.size(this.writePos);
|
|
1756
2242
|
}
|
|
1757
2243
|
get length() {
|
|
1758
|
-
return this.cachedLength == null ? this.dataType.isVariable ? this.calculateCachedLength() : this.writePos ===
|
|
2244
|
+
return this.cachedLength == null ? this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === K ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos : this.cachedLength;
|
|
1759
2245
|
}
|
|
1760
2246
|
calculateCachedLength() {
|
|
1761
2247
|
if (!this.dataType.isVariable) throw Error("cannot calculate length of a non-variable length data type");
|
|
1762
|
-
let e = 0, t = [0
|
|
1763
|
-
|
|
1764
|
-
n
|
|
1765
|
-
|
|
2248
|
+
let e = 0, t = [], n = this.buffer, r = this.byteLength.valueOf(), i = new DataView(n), a = 0;
|
|
2249
|
+
for (; a + q <= r;) {
|
|
2250
|
+
let n = i.getUint32(a, !0);
|
|
2251
|
+
a += q, t.push(a), a += n, e++;
|
|
2252
|
+
}
|
|
2253
|
+
return this._cachedIndexes = t, this.cachedLength = e, e;
|
|
1766
2254
|
}
|
|
1767
2255
|
convert(t, n = 0) {
|
|
1768
2256
|
if (this.dataType.equals(t)) return this;
|
|
1769
2257
|
let r = new t.Array(this.length);
|
|
1770
|
-
for (let e = 0; e < this.length; e++) r[e] =
|
|
2258
|
+
for (let e = 0; e < this.length; e++) r[e] = Dt(this.dataType, t, this.data[e], n);
|
|
1771
2259
|
return new e({
|
|
1772
2260
|
data: r.buffer,
|
|
1773
2261
|
dataType: t,
|
|
@@ -1778,27 +2266,45 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1778
2266
|
});
|
|
1779
2267
|
}
|
|
1780
2268
|
calcRawMax() {
|
|
1781
|
-
|
|
2269
|
+
if (this.length === 0) return -Infinity;
|
|
2270
|
+
if (this.dataType.equals(z.TIMESTAMP)) this.cachedMax = this.data[this.data.length - 1];
|
|
2271
|
+
else if (this.dataType.usesBigInt) {
|
|
2272
|
+
let e = this.data;
|
|
2273
|
+
this.cachedMax = e.reduce((e, t) => e > t ? e : t);
|
|
2274
|
+
} else {
|
|
2275
|
+
let e = this.data;
|
|
2276
|
+
this.cachedMax = e.reduce((e, t) => e > t ? e : t);
|
|
2277
|
+
}
|
|
2278
|
+
return this.cachedMax;
|
|
1782
2279
|
}
|
|
1783
2280
|
get max() {
|
|
1784
2281
|
return this.calcMax();
|
|
1785
2282
|
}
|
|
1786
2283
|
calcMax() {
|
|
1787
2284
|
if (this.dataType.isVariable) throw Error("cannot calculate maximum on a variable length data type");
|
|
1788
|
-
return this.writePos === 0 ? -Infinity : (this.cachedMax ??= this.calcRawMax(),
|
|
2285
|
+
return this.writePos === 0 ? -Infinity : (this.cachedMax ??= this.calcRawMax(), this.applyOffset(this.cachedMax));
|
|
1789
2286
|
}
|
|
1790
2287
|
calcRawMin() {
|
|
1791
|
-
|
|
2288
|
+
if (this.length === 0) return Infinity;
|
|
2289
|
+
if (this.dataType.equals(z.TIMESTAMP)) this.cachedMin = this.data[0];
|
|
2290
|
+
else if (this.dataType.usesBigInt) {
|
|
2291
|
+
let e = this.data;
|
|
2292
|
+
this.cachedMin = e.reduce((e, t) => e < t ? e : t);
|
|
2293
|
+
} else {
|
|
2294
|
+
let e = this.data;
|
|
2295
|
+
this.cachedMin = e.reduce((e, t) => e < t ? e : t);
|
|
2296
|
+
}
|
|
2297
|
+
return this.cachedMin;
|
|
1792
2298
|
}
|
|
1793
2299
|
get min() {
|
|
1794
2300
|
return this.calcMin();
|
|
1795
2301
|
}
|
|
1796
2302
|
calcMin() {
|
|
1797
2303
|
if (this.dataType.isVariable) throw Error("cannot calculate minimum on a variable length data type");
|
|
1798
|
-
return this.writePos === 0 ? Infinity : (this.cachedMin ??= this.calcRawMin(),
|
|
2304
|
+
return this.writePos === 0 ? Infinity : (this.cachedMin ??= this.calcRawMin(), this.applyOffset(this.cachedMin));
|
|
1799
2305
|
}
|
|
1800
2306
|
get bounds() {
|
|
1801
|
-
return
|
|
2307
|
+
return M(Number(this.min), Number(this.max), { makeValid: !1 });
|
|
1802
2308
|
}
|
|
1803
2309
|
maybeRecomputeMinMax(e) {
|
|
1804
2310
|
if (this.cachedMin != null) {
|
|
@@ -1819,47 +2325,66 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1819
2325
|
return this.at(n, t);
|
|
1820
2326
|
}
|
|
1821
2327
|
at(e, t = !1) {
|
|
1822
|
-
if (this.dataType.isVariable)
|
|
1823
|
-
|
|
2328
|
+
if (this.dataType.isVariable) {
|
|
2329
|
+
let n = this.atVariable(e, t);
|
|
2330
|
+
return n == null ? void 0 : this.dataType.equals(z.STRING) ? n : f(JSON.parse(n));
|
|
2331
|
+
}
|
|
2332
|
+
if (this.dataType.equals(z.UUID)) return this.atUUID(e, t);
|
|
1824
2333
|
e < 0 && (e = this.length + e);
|
|
1825
2334
|
let n = this.data[e];
|
|
1826
2335
|
if (n == null) {
|
|
1827
2336
|
if (t === !0) throw Error(`[series] - no value at index ${e}`);
|
|
1828
2337
|
return;
|
|
1829
2338
|
}
|
|
1830
|
-
return
|
|
2339
|
+
return this.applyOffset(n);
|
|
2340
|
+
}
|
|
2341
|
+
applyOffset(e) {
|
|
2342
|
+
return typeof this.sampleOffset == "bigint" && typeof e == "number" ? BigInt(Math.round(e)) + this.sampleOffset : O(e, this.sampleOffset);
|
|
1831
2343
|
}
|
|
1832
2344
|
atUUID(e, t) {
|
|
1833
2345
|
e < 0 && (e = this.length + e);
|
|
1834
|
-
let n =
|
|
2346
|
+
let n = Sn(new Uint8Array(this.buffer, e * this.dataType.density.valueOf()));
|
|
1835
2347
|
if (n == null) {
|
|
1836
2348
|
if (t) throw Error(`[series] - no value at index ${e}`);
|
|
1837
2349
|
return;
|
|
1838
2350
|
}
|
|
1839
2351
|
return n;
|
|
1840
2352
|
}
|
|
2353
|
+
asString(e, t = !1) {
|
|
2354
|
+
if (this.dataType.isVariable) return this.atVariable(e, t);
|
|
2355
|
+
if (this.dataType.equals(z.UUID)) return this.atUUID(e, t);
|
|
2356
|
+
let n = this.at(e, t);
|
|
2357
|
+
if (n != null) return this.dataType.equals(z.FLOAT32) ? Cn(n) : String(n);
|
|
2358
|
+
}
|
|
1841
2359
|
atVariable(e, t) {
|
|
1842
|
-
let n = 0, r = 0;
|
|
1843
|
-
if (this._cachedIndexes != null)
|
|
1844
|
-
|
|
2360
|
+
let n = 0, r = 0, i = this.buffer, a = new DataView(i);
|
|
2361
|
+
if (this._cachedIndexes != null) {
|
|
2362
|
+
if (e < 0 && (e = this._cachedIndexes.length + e), e < 0 || e >= this._cachedIndexes.length) {
|
|
2363
|
+
if (t) throw Error(`[series] - no value at index ${e}`);
|
|
2364
|
+
return;
|
|
2365
|
+
}
|
|
2366
|
+
n = this._cachedIndexes[e], r = a.getUint32(n - q, !0);
|
|
2367
|
+
} else {
|
|
1845
2368
|
e < 0 && (e = this.length + e);
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
2369
|
+
let i = this.byteLength.valueOf(), o = 0, s = !1;
|
|
2370
|
+
for (; o + q <= i;) {
|
|
2371
|
+
let t = a.getUint32(o, !0);
|
|
2372
|
+
if (o += q, e === 0) {
|
|
2373
|
+
n = o, r = t, s = !0;
|
|
1849
2374
|
break;
|
|
1850
2375
|
}
|
|
1851
|
-
|
|
2376
|
+
o += t, e--;
|
|
1852
2377
|
}
|
|
1853
|
-
if (
|
|
2378
|
+
if (!s) {
|
|
1854
2379
|
if (t) throw Error(`[series] - no value at index ${e}`);
|
|
1855
2380
|
return;
|
|
1856
2381
|
}
|
|
1857
2382
|
}
|
|
1858
|
-
let
|
|
1859
|
-
return
|
|
2383
|
+
let o = new Uint8Array(i, n, r);
|
|
2384
|
+
return new TextDecoder().decode(o);
|
|
1860
2385
|
}
|
|
1861
2386
|
binarySearch(e) {
|
|
1862
|
-
let t = 0, n = this.length - 1, r =
|
|
2387
|
+
let t = 0, n = this.length - 1, r = Ot(e);
|
|
1863
2388
|
for (; t <= n;) {
|
|
1864
2389
|
let i = Math.floor((t + n) / 2), a = r(this.at(i, !0), e);
|
|
1865
2390
|
if (a === 0) return i;
|
|
@@ -1868,16 +2393,16 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1868
2393
|
return t;
|
|
1869
2394
|
}
|
|
1870
2395
|
updateGLBuffer(e) {
|
|
1871
|
-
if (this.gl.control = e, !this.dataType.equals(
|
|
2396
|
+
if (this.gl.control = e, !this.dataType.equals(z.FLOAT32) && !this.dataType.equals(z.UINT8)) throw Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
|
|
1872
2397
|
let { buffer: t, bufferUsage: n, prevBuffer: r } = this.gl;
|
|
1873
|
-
if (t ?? (this.gl.buffer = e.createBuffer()), this.writePos !== r) if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !==
|
|
2398
|
+
if (t ?? (this.gl.buffer = e.createBuffer()), this.writePos !== r) if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== K) {
|
|
1874
2399
|
r === 0 && e.bufferData(e.ARRAY_BUFFER, this.byteCapacity.valueOf(), e.STATIC_DRAW);
|
|
1875
2400
|
let t = this.dataType.density.size(r).valueOf(), n = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
|
|
1876
2401
|
e.bufferSubData(e.ARRAY_BUFFER, t, n.buffer), this.gl.prevBuffer = this.writePos;
|
|
1877
|
-
} else e.bufferData(e.ARRAY_BUFFER, this.buffer, n === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW), this.gl.prevBuffer =
|
|
2402
|
+
} else e.bufferData(e.ARRAY_BUFFER, this.buffer, n === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW), this.gl.prevBuffer = K;
|
|
1878
2403
|
}
|
|
1879
2404
|
as(e) {
|
|
1880
|
-
return
|
|
2405
|
+
return Dn(e, this.dataType), this;
|
|
1881
2406
|
}
|
|
1882
2407
|
get digest() {
|
|
1883
2408
|
return {
|
|
@@ -1885,8 +2410,8 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1885
2410
|
dataType: this.dataType.toString(),
|
|
1886
2411
|
sampleOffset: this.sampleOffset,
|
|
1887
2412
|
alignment: {
|
|
1888
|
-
lower:
|
|
1889
|
-
upper:
|
|
2413
|
+
lower: Ln(this.alignmentBounds.lower),
|
|
2414
|
+
upper: Ln(this.alignmentBounds.upper),
|
|
1890
2415
|
multiple: this.alignmentMultiple
|
|
1891
2416
|
},
|
|
1892
2417
|
timeRange: this.timeRange.toString(),
|
|
@@ -1895,7 +2420,7 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1895
2420
|
};
|
|
1896
2421
|
}
|
|
1897
2422
|
get alignmentBounds() {
|
|
1898
|
-
return
|
|
2423
|
+
return M(this.alignment, this.alignment + BigInt(this.length) * this.alignmentMultiple);
|
|
1899
2424
|
}
|
|
1900
2425
|
maybeGarbageCollectGLBuffer(e) {
|
|
1901
2426
|
this.gl.buffer != null && (e.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
|
|
@@ -1906,10 +2431,10 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1906
2431
|
}
|
|
1907
2432
|
[Symbol.iterator]() {
|
|
1908
2433
|
if (this.dataType.isVariable) {
|
|
1909
|
-
let e = new
|
|
1910
|
-
return this.dataType.equals(
|
|
2434
|
+
let e = new Nn(this);
|
|
2435
|
+
return this.dataType.equals(z.JSON) ? new Pn(e) : e;
|
|
1911
2436
|
}
|
|
1912
|
-
return this.dataType.equals(
|
|
2437
|
+
return this.dataType.equals(z.UUID) ? new Fn(this) : new In(this);
|
|
1913
2438
|
}
|
|
1914
2439
|
slice(e, t) {
|
|
1915
2440
|
return this.sliceSub(!1, e, t);
|
|
@@ -1918,11 +2443,11 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1918
2443
|
return this.sliceSub(!0, e, t);
|
|
1919
2444
|
}
|
|
1920
2445
|
subIterator(e, t) {
|
|
1921
|
-
return new
|
|
2446
|
+
return new Mn(this, e, t ?? this.length);
|
|
1922
2447
|
}
|
|
1923
2448
|
subAlignmentIterator(e, t) {
|
|
1924
2449
|
let n = Math.ceil(Number(e - this.alignment) / Number(this.alignmentMultiple)), r = Math.ceil(Number(t - this.alignment) / Number(this.alignmentMultiple));
|
|
1925
|
-
return new
|
|
2450
|
+
return new Mn(this, n, r);
|
|
1926
2451
|
}
|
|
1927
2452
|
subBytes(t, n) {
|
|
1928
2453
|
return t >= 0 && (n == null || n >= this.byteLength.valueOf()) ? this : new e({
|
|
@@ -1950,7 +2475,7 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1950
2475
|
return new e({
|
|
1951
2476
|
data: this.buffer,
|
|
1952
2477
|
dataType: this.dataType,
|
|
1953
|
-
timeRange:
|
|
2478
|
+
timeRange: R.ZERO,
|
|
1954
2479
|
sampleOffset: this.sampleOffset,
|
|
1955
2480
|
glBufferUsage: "static",
|
|
1956
2481
|
alignment: t
|
|
@@ -1966,14 +2491,14 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1966
2491
|
}
|
|
1967
2492
|
return e += "])", e;
|
|
1968
2493
|
}
|
|
1969
|
-
},
|
|
2494
|
+
}, An = (e) => e == null ? !1 : Array.isArray(e) || e instanceof ArrayBuffer || ArrayBuffer.isView(e) && !(e instanceof DataView) || e instanceof kn ? !0 : Et(e), jn = It(On, kn), Mn = class {
|
|
1970
2495
|
series;
|
|
1971
2496
|
end;
|
|
1972
2497
|
index;
|
|
1973
2498
|
constructor(e, t, n) {
|
|
1974
2499
|
this.series = e;
|
|
1975
|
-
let r =
|
|
1976
|
-
this.end =
|
|
2500
|
+
let r = M(0, e.length + 1);
|
|
2501
|
+
this.end = _t(r, n), this.index = _t(r, t);
|
|
1977
2502
|
}
|
|
1978
2503
|
next() {
|
|
1979
2504
|
return this.index >= this.end ? {
|
|
@@ -1984,27 +2509,30 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
1984
2509
|
value: this.series.at(this.index++, !0)
|
|
1985
2510
|
};
|
|
1986
2511
|
}
|
|
1987
|
-
},
|
|
2512
|
+
}, Nn = class {
|
|
1988
2513
|
series;
|
|
1989
|
-
|
|
2514
|
+
byteOffset;
|
|
1990
2515
|
decoder;
|
|
2516
|
+
view;
|
|
1991
2517
|
constructor(e) {
|
|
1992
2518
|
if (!e.dataType.isVariable) throw Error("cannot create a variable series iterator for a non-variable series");
|
|
1993
|
-
this.series = e, this.
|
|
2519
|
+
this.series = e, this.byteOffset = 0, this.decoder = new TextDecoder(), this.view = new DataView(e.buffer);
|
|
1994
2520
|
}
|
|
1995
2521
|
next() {
|
|
1996
|
-
let e = this.
|
|
1997
|
-
|
|
1998
|
-
let n = this.index;
|
|
1999
|
-
return e === n ? {
|
|
2522
|
+
let e = this.series.byteLength.valueOf();
|
|
2523
|
+
if (this.byteOffset + q > e) return {
|
|
2000
2524
|
done: !0,
|
|
2001
2525
|
value: void 0
|
|
2002
|
-
}
|
|
2526
|
+
};
|
|
2527
|
+
let t = this.view.getUint32(this.byteOffset, !0);
|
|
2528
|
+
this.byteOffset += q;
|
|
2529
|
+
let n = this.decoder.decode(new Uint8Array(this.series.buffer, this.byteOffset, t));
|
|
2530
|
+
return this.byteOffset += t, {
|
|
2003
2531
|
done: !1,
|
|
2004
|
-
value:
|
|
2005
|
-
}
|
|
2532
|
+
value: n
|
|
2533
|
+
};
|
|
2006
2534
|
}
|
|
2007
|
-
},
|
|
2535
|
+
}, Pn = class e {
|
|
2008
2536
|
wrapped;
|
|
2009
2537
|
static schema = t.record(t.string(), t.unknown());
|
|
2010
2538
|
constructor(e) {
|
|
@@ -2017,30 +2545,30 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
2017
2545
|
value: void 0
|
|
2018
2546
|
} : {
|
|
2019
2547
|
done: !1,
|
|
2020
|
-
value:
|
|
2548
|
+
value: St.decodeString(t.value, e.schema)
|
|
2021
2549
|
};
|
|
2022
2550
|
}
|
|
2023
|
-
},
|
|
2551
|
+
}, Fn = class {
|
|
2024
2552
|
series;
|
|
2025
2553
|
index;
|
|
2026
2554
|
data;
|
|
2027
2555
|
density;
|
|
2028
2556
|
constructor(e) {
|
|
2029
|
-
if (!e.dataType.equals(
|
|
2030
|
-
this.series = e, this.index = 0, this.data = new Uint8Array(e.buffer), this.density =
|
|
2557
|
+
if (!e.dataType.equals(z.UUID)) throw Error("cannot create a UUID series iterator for a non-UUID series");
|
|
2558
|
+
this.series = e, this.index = 0, this.data = new Uint8Array(e.buffer), this.density = z.UUID.density.valueOf();
|
|
2031
2559
|
}
|
|
2032
2560
|
next() {
|
|
2033
2561
|
if (this.index >= this.series.length) return {
|
|
2034
2562
|
done: !0,
|
|
2035
2563
|
value: void 0
|
|
2036
2564
|
};
|
|
2037
|
-
let e =
|
|
2565
|
+
let e = Sn(this.data, this.index * this.density);
|
|
2038
2566
|
return this.index++, {
|
|
2039
2567
|
done: !1,
|
|
2040
2568
|
value: e
|
|
2041
2569
|
};
|
|
2042
2570
|
}
|
|
2043
|
-
},
|
|
2571
|
+
}, In = class {
|
|
2044
2572
|
series;
|
|
2045
2573
|
index;
|
|
2046
2574
|
constructor(e) {
|
|
@@ -2055,23 +2583,33 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
2055
2583
|
value: this.series.at(this.index++, !0)
|
|
2056
2584
|
};
|
|
2057
2585
|
}
|
|
2058
|
-
},
|
|
2586
|
+
}, Ln = (e) => ({
|
|
2059
2587
|
domain: e >> 32n,
|
|
2060
2588
|
sample: e & 4294967295n
|
|
2061
|
-
})
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2589
|
+
});
|
|
2590
|
+
t.enum([
|
|
2591
|
+
"ISO",
|
|
2592
|
+
"ISODate",
|
|
2593
|
+
"time",
|
|
2594
|
+
"preciseTime",
|
|
2595
|
+
"date",
|
|
2596
|
+
"preciseDate",
|
|
2597
|
+
"dateTime"
|
|
2598
|
+
]), t.enum(["local", "UTC"]);
|
|
2599
|
+
var Rn = async (e) => await new Promise((t) => setTimeout(t, F.fromMilliseconds(e).milliseconds)), zn = /* @__PURE__ */ r({
|
|
2600
|
+
Breaker: () => Bn,
|
|
2601
|
+
breakerConfigZ: () => Vn
|
|
2602
|
+
}), Bn = class {
|
|
2065
2603
|
config;
|
|
2066
2604
|
retries;
|
|
2067
2605
|
interval;
|
|
2068
2606
|
constructor(e) {
|
|
2069
2607
|
this.config = {
|
|
2070
|
-
baseInterval: new
|
|
2608
|
+
baseInterval: new F(e?.baseInterval ?? F.seconds(1)),
|
|
2071
2609
|
maxRetries: e?.maxRetries ?? 5,
|
|
2072
2610
|
scale: e?.scale ?? 1,
|
|
2073
|
-
sleepFn: e?.sleepFn ??
|
|
2074
|
-
}, this.retries = 0, this.interval = new
|
|
2611
|
+
sleepFn: e?.sleepFn ?? Rn
|
|
2612
|
+
}, this.retries = 0, this.interval = new F(this.config.baseInterval);
|
|
2075
2613
|
}
|
|
2076
2614
|
async wait() {
|
|
2077
2615
|
let { maxRetries: e, scale: t, sleepFn: n } = this.config;
|
|
@@ -2083,82 +2621,38 @@ var Ct = (e, t) => St(e, t), W = -1, wt = {
|
|
|
2083
2621
|
reset() {
|
|
2084
2622
|
this.retries = 0, this.interval = this.config.baseInterval;
|
|
2085
2623
|
}
|
|
2086
|
-
},
|
|
2087
|
-
baseInterval:
|
|
2624
|
+
}, Vn = t.object({
|
|
2625
|
+
baseInterval: F.z.optional(),
|
|
2088
2626
|
maxRetries: t.number().optional(),
|
|
2089
2627
|
scale: t.number().optional()
|
|
2090
|
-
})
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
if (
|
|
2118
|
-
for (let n of r) {
|
|
2119
|
-
let r = e[n], i = t[n];
|
|
2120
|
-
if (typeof r == "object" && typeof i == "object") {
|
|
2121
|
-
if (!Gt(r, i)) return !1;
|
|
2122
|
-
} else if (r !== i) return !1;
|
|
2123
|
-
}
|
|
2124
|
-
return !0;
|
|
2125
|
-
}, Kt = (e, ...t) => {
|
|
2126
|
-
if (t.length === 0) return e;
|
|
2127
|
-
let n = t.shift();
|
|
2128
|
-
if (_(e) && _(n)) for (let t in n) try {
|
|
2129
|
-
_(n[t]) ? (t in e || Object.assign(e, { [t]: {} }), Kt(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
|
|
2130
|
-
} catch (e) {
|
|
2131
|
-
throw e instanceof TypeError ? TypeError(`.${t}: ${e.message}`, { cause: e }) : e;
|
|
2132
|
-
}
|
|
2133
|
-
return Kt(e, ...t);
|
|
2134
|
-
}, qt = t.string().regex(/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i), G = Ut, Jt = t.number().min(0).max(1), Yt = t.tuple([
|
|
2135
|
-
G,
|
|
2136
|
-
G,
|
|
2137
|
-
G,
|
|
2138
|
-
Jt
|
|
2139
|
-
]), Xt = t.tuple([
|
|
2140
|
-
G,
|
|
2141
|
-
G,
|
|
2142
|
-
G
|
|
2143
|
-
]), Zt = t.object({ rgba255: Yt }), Qt = t.object({
|
|
2144
|
-
r: G,
|
|
2145
|
-
g: G,
|
|
2146
|
-
b: G,
|
|
2147
|
-
a: Jt
|
|
2148
|
-
}), $t = t.number().min(0).max(360), en = t.number().min(0).max(100), tn = t.number().min(0).max(100), nn = t.tuple([
|
|
2149
|
-
$t,
|
|
2150
|
-
en,
|
|
2151
|
-
tn,
|
|
2152
|
-
Jt
|
|
2153
|
-
]), rn = t.union([
|
|
2154
|
-
qt,
|
|
2155
|
-
Xt,
|
|
2156
|
-
Yt,
|
|
2157
|
-
nn,
|
|
2158
|
-
Zt,
|
|
2159
|
-
Qt
|
|
2160
|
-
]), an = rn.transform((e) => on(e)), on = (e, t = 1) => {
|
|
2161
|
-
if (e = rn.parse(e), typeof e == "string") return sn(e, t);
|
|
2628
|
+
}), Hn = t.string().regex(/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i), J = vt, Un = t.number().min(0).max(1), Wn = t.tuple([
|
|
2629
|
+
J,
|
|
2630
|
+
J,
|
|
2631
|
+
J,
|
|
2632
|
+
Un
|
|
2633
|
+
]), Gn = t.tuple([
|
|
2634
|
+
J,
|
|
2635
|
+
J,
|
|
2636
|
+
J
|
|
2637
|
+
]), Kn = t.object({ rgba255: Wn }), qn = t.object({
|
|
2638
|
+
r: J,
|
|
2639
|
+
g: J,
|
|
2640
|
+
b: J,
|
|
2641
|
+
a: Un
|
|
2642
|
+
}), Jn = t.number().min(0).max(360), Yn = t.number().min(0).max(100), Xn = t.number().min(0).max(100), Zn = t.tuple([
|
|
2643
|
+
Jn,
|
|
2644
|
+
Yn,
|
|
2645
|
+
Xn,
|
|
2646
|
+
Un
|
|
2647
|
+
]), Qn = t.union([
|
|
2648
|
+
Hn,
|
|
2649
|
+
Gn,
|
|
2650
|
+
Wn,
|
|
2651
|
+
Zn,
|
|
2652
|
+
Kn,
|
|
2653
|
+
qn
|
|
2654
|
+
]), $n = Qn.transform((e) => er(e)), er = (e, t = 1) => {
|
|
2655
|
+
if (e = Qn.parse(e), typeof e == "string") return tr(e, t);
|
|
2162
2656
|
if (Array.isArray(e)) {
|
|
2163
2657
|
if (e.length < 3 || e.length > 4) throw Error(`Invalid color: [${e.join(", ")}]`);
|
|
2164
2658
|
return e.length === 3 ? [...e, t] : e;
|
|
@@ -2169,127 +2663,38 @@ var Wt = (e, t) => {
|
|
|
2169
2663
|
e.b,
|
|
2170
2664
|
e.a
|
|
2171
2665
|
] : e.rgba255;
|
|
2172
|
-
},
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
e.length === 8 ?
|
|
2177
|
-
]),
|
|
2178
|
-
|
|
2179
|
-
var
|
|
2666
|
+
}, tr = (e, t = 1) => (e = Hn.parse(e), e = nr(e), [
|
|
2667
|
+
Y(e, 0),
|
|
2668
|
+
Y(e, 2),
|
|
2669
|
+
Y(e, 4),
|
|
2670
|
+
e.length === 8 ? Y(e, 6) / 255 : t
|
|
2671
|
+
]), Y = (e, t) => parseInt(e.slice(t, t + 2), 16), nr = (e) => e.startsWith("#") ? e.slice(1) : e;
|
|
2672
|
+
er("#000000"), er("#ffffff");
|
|
2673
|
+
var rr = t.object({
|
|
2180
2674
|
key: t.string(),
|
|
2181
|
-
color:
|
|
2675
|
+
color: Qn,
|
|
2182
2676
|
position: t.number(),
|
|
2183
2677
|
switched: t.boolean().optional()
|
|
2184
2678
|
});
|
|
2185
|
-
t.array(
|
|
2186
|
-
var
|
|
2679
|
+
t.array(rr);
|
|
2680
|
+
var ir = t.object({
|
|
2187
2681
|
key: t.string(),
|
|
2188
2682
|
name: t.string(),
|
|
2189
|
-
color:
|
|
2683
|
+
color: $n
|
|
2190
2684
|
});
|
|
2191
2685
|
t.object({
|
|
2192
2686
|
key: t.string(),
|
|
2193
2687
|
name: t.string(),
|
|
2194
|
-
swatches: t.array(
|
|
2688
|
+
swatches: t.array(ir)
|
|
2195
2689
|
});
|
|
2196
|
-
var
|
|
2690
|
+
var ar = /* @__PURE__ */ function(e) {
|
|
2197
2691
|
return e[e.exclusive = 0] = "exclusive", e[e.shared = 1] = "shared", e;
|
|
2198
2692
|
}({});
|
|
2199
|
-
t.enum(
|
|
2693
|
+
t.enum(ar), t.object({
|
|
2200
2694
|
key: t.string(),
|
|
2201
2695
|
name: t.string(),
|
|
2202
2696
|
group: t.uint32().optional()
|
|
2203
|
-
})
|
|
2204
|
-
var fn = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), pn = (e, t) => {
|
|
2205
|
-
let n = Symbol.for(e);
|
|
2206
|
-
if (!fn(n)) {
|
|
2207
|
-
let e = t();
|
|
2208
|
-
Object.defineProperty(globalThis, n, { value: e });
|
|
2209
|
-
}
|
|
2210
|
-
return () => globalThis[n];
|
|
2211
|
-
}, q = /* @__PURE__ */ r({
|
|
2212
|
-
Canceled: () => wn,
|
|
2213
|
-
NONE: () => "nil",
|
|
2214
|
-
NotImplemented: () => Tn,
|
|
2215
|
-
UNKNOWN: () => Y,
|
|
2216
|
-
Unknown: () => Sn,
|
|
2217
|
-
createTyped: () => J,
|
|
2218
|
-
decode: () => xn,
|
|
2219
|
-
encode: () => bn,
|
|
2220
|
-
isTyped: () => gn,
|
|
2221
|
-
payloadZ: () => Cn,
|
|
2222
|
-
register: () => yn
|
|
2223
|
-
}), mn = "sy_x_error", hn = (e) => (t) => typeof t == "object" && t && "type" in t && typeof t.type == "string" ? t.type.startsWith(e) : t instanceof Error ? t.message.startsWith(e) : typeof t == "string" ? t.startsWith(e) : !1, J = (e) => class t extends Error {
|
|
2224
|
-
static discriminator = mn;
|
|
2225
|
-
discriminator = t.discriminator;
|
|
2226
|
-
static TYPE = e;
|
|
2227
|
-
type = t.TYPE;
|
|
2228
|
-
static matches = hn(e);
|
|
2229
|
-
matches = t.matches;
|
|
2230
|
-
constructor(e, n) {
|
|
2231
|
-
super(e, n), this.name = t.TYPE;
|
|
2232
|
-
}
|
|
2233
|
-
static sub(t) {
|
|
2234
|
-
return J(`${e}.${t}`);
|
|
2235
|
-
}
|
|
2236
|
-
}, gn = (e) => {
|
|
2237
|
-
if (typeof e != "object" || !e) return !1;
|
|
2238
|
-
let t = e;
|
|
2239
|
-
if (t.discriminator !== mn) return !1;
|
|
2240
|
-
if (!("type" in t)) throw Error(`X Error is missing its type property: ${JSON.stringify(t)}`);
|
|
2241
|
-
return !0;
|
|
2242
|
-
}, Y = "unknown", _n = class {
|
|
2243
|
-
providers = [];
|
|
2244
|
-
register(e) {
|
|
2245
|
-
this.providers.push(e);
|
|
2246
|
-
}
|
|
2247
|
-
encode(e) {
|
|
2248
|
-
if (e == null) return {
|
|
2249
|
-
type: "nil",
|
|
2250
|
-
data: ""
|
|
2251
|
-
};
|
|
2252
|
-
if (gn(e)) for (let t of this.providers) {
|
|
2253
|
-
let n = t.encode(e);
|
|
2254
|
-
if (n != null) return n;
|
|
2255
|
-
}
|
|
2256
|
-
if (e instanceof Error) return {
|
|
2257
|
-
type: Y,
|
|
2258
|
-
data: e.message
|
|
2259
|
-
};
|
|
2260
|
-
if (typeof e == "string") return {
|
|
2261
|
-
type: Y,
|
|
2262
|
-
data: e
|
|
2263
|
-
};
|
|
2264
|
-
try {
|
|
2265
|
-
return {
|
|
2266
|
-
type: Y,
|
|
2267
|
-
data: JSON.stringify(e)
|
|
2268
|
-
};
|
|
2269
|
-
} catch {
|
|
2270
|
-
return {
|
|
2271
|
-
type: Y,
|
|
2272
|
-
data: "unable to encode error information"
|
|
2273
|
-
};
|
|
2274
|
-
}
|
|
2275
|
-
}
|
|
2276
|
-
decode(e) {
|
|
2277
|
-
if (e == null || e.type === "nil") return null;
|
|
2278
|
-
if (e.type === "unknown") return new Sn(e.data);
|
|
2279
|
-
for (let t of this.providers) {
|
|
2280
|
-
let n = t.decode(e);
|
|
2281
|
-
if (n != null) return n;
|
|
2282
|
-
}
|
|
2283
|
-
return new Sn(e.data);
|
|
2284
|
-
}
|
|
2285
|
-
}, vn = pn("synnax-error-registry", () => new _n()), yn = ({ encode: e, decode: t }) => vn().register({
|
|
2286
|
-
encode: e,
|
|
2287
|
-
decode: t
|
|
2288
|
-
}), bn = (e) => vn().encode(e), xn = (e) => e == null ? null : vn().decode(e), Sn = class extends J("unknown") {}, Cn = t.object({
|
|
2289
|
-
type: t.string(),
|
|
2290
|
-
data: t.string()
|
|
2291
|
-
}), wn = class extends J("canceled") {}, Tn = class extends J("not_implemented") {};
|
|
2292
|
-
t.string().regex(/^(?:$|(?:\/(?:[^~/]|~0|~1)*)+)$/, "must be a valid JSON pointer (RFC 6901)"), t.union([
|
|
2697
|
+
}), t.string().regex(/^(?:$|(?:\/(?:[^~/]|~0|~1)*)+)$/, "must be a valid JSON pointer (RFC 6901)"), t.union([
|
|
2293
2698
|
t.string(),
|
|
2294
2699
|
t.number(),
|
|
2295
2700
|
t.boolean(),
|
|
@@ -2303,47 +2708,71 @@ t.string().regex(/^(?:$|(?:\/(?:[^~/]|~0|~1)*)+)$/, "must be a valid JSON pointe
|
|
|
2303
2708
|
key: t.string(),
|
|
2304
2709
|
value: t.string()
|
|
2305
2710
|
});
|
|
2306
|
-
var
|
|
2711
|
+
var or = t.uuid();
|
|
2307
2712
|
t.object({
|
|
2308
|
-
key:
|
|
2713
|
+
key: or,
|
|
2309
2714
|
name: t.string().min(1),
|
|
2310
|
-
color:
|
|
2715
|
+
color: $n
|
|
2311
2716
|
}).partial({ key: !0 }), t.string().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/), t.enum([
|
|
2312
2717
|
"standard",
|
|
2313
2718
|
"scientific",
|
|
2314
2719
|
"engineering"
|
|
2315
|
-
])
|
|
2316
|
-
var
|
|
2720
|
+
]);
|
|
2721
|
+
var sr = t.union([t.string(), t.number()]), cr = () => t.record(sr, t.unknown());
|
|
2722
|
+
typeof process < "u" && process.versions != null && process.versions.node != null || typeof window > "u" || window.document;
|
|
2723
|
+
var lr = [
|
|
2317
2724
|
"macOS",
|
|
2318
2725
|
"Windows",
|
|
2319
2726
|
"Linux"
|
|
2320
|
-
],
|
|
2727
|
+
], ur = [
|
|
2321
2728
|
"macos",
|
|
2322
2729
|
"windows",
|
|
2323
2730
|
"linux"
|
|
2324
|
-
],
|
|
2731
|
+
], dr = {
|
|
2325
2732
|
macos: "macOS",
|
|
2326
2733
|
windows: "Windows",
|
|
2327
2734
|
linux: "Linux"
|
|
2328
2735
|
};
|
|
2329
|
-
t.enum(
|
|
2736
|
+
t.enum(lr).or(t.enum(ur).transform((e) => dr[e])), t.object({
|
|
2737
|
+
message: t.string().optional(),
|
|
2738
|
+
description: t.string().optional(),
|
|
2739
|
+
details: cr().optional()
|
|
2740
|
+
}), t.object({
|
|
2330
2741
|
stack: t.string(),
|
|
2331
2742
|
error: t.instanceof(Error)
|
|
2332
|
-
}), t.enum([
|
|
2743
|
+
}).and(cr()), t.enum([
|
|
2333
2744
|
"success",
|
|
2334
2745
|
"info",
|
|
2335
2746
|
"warning",
|
|
2336
2747
|
"error",
|
|
2337
2748
|
"loading",
|
|
2338
2749
|
"disabled"
|
|
2339
|
-
]), t.literal("success"), t.literal("info"), t.literal("warning"), t.literal("error"), t.literal("loading"), t.literal("disabled")
|
|
2340
|
-
|
|
2750
|
+
]), t.literal("success"), t.literal("info"), t.literal("warning"), t.literal("error"), t.literal("loading"), t.literal("disabled"), t.enum([
|
|
2751
|
+
"h1",
|
|
2752
|
+
"h2",
|
|
2753
|
+
"h3",
|
|
2754
|
+
"h4",
|
|
2755
|
+
"h5",
|
|
2756
|
+
"p",
|
|
2757
|
+
"small"
|
|
2758
|
+
]), t.union([t.number(), t.enum([
|
|
2759
|
+
"normal",
|
|
2760
|
+
"bold",
|
|
2761
|
+
"bolder",
|
|
2762
|
+
"lighter"
|
|
2763
|
+
])]), t.object({
|
|
2764
|
+
size: t.number(),
|
|
2765
|
+
weight: t.union([t.number(), t.string()]),
|
|
2766
|
+
lineHeight: t.number(),
|
|
2767
|
+
textTransform: t.string().optional()
|
|
2768
|
+
});
|
|
2769
|
+
var fr = (...e) => e.map(pr).join(""), pr = (e) => (e.endsWith("/") || (e += "/"), e.startsWith("/") && (e = e.slice(1)), e), mr = (e) => e.endsWith("/") ? e.slice(0, -1) : e, hr = (e, t = "") => e === null ? "" : `?${Object.entries(e).filter(([, e]) => e == null ? !1 : Array.isArray(e) ? e.length > 0 : !0).map(([e, n]) => `${t}${e}=${n}`).join("&")}`, gr = class e {
|
|
2341
2770
|
protocol;
|
|
2342
2771
|
host;
|
|
2343
2772
|
port;
|
|
2344
2773
|
path;
|
|
2345
2774
|
constructor({ host: e, port: t, protocol: n = "", pathPrefix: r = "" }) {
|
|
2346
|
-
this.protocol = n, this.host = e, this.port = t, this.path =
|
|
2775
|
+
this.protocol = n, this.host = e, this.port = t, this.path = pr(r);
|
|
2347
2776
|
}
|
|
2348
2777
|
replace(t) {
|
|
2349
2778
|
return new e({
|
|
@@ -2356,17 +2785,17 @@ var An = (...e) => e.map(jn).join(""), jn = (e) => (e.endsWith("/") || (e += "/"
|
|
|
2356
2785
|
child(t) {
|
|
2357
2786
|
return new e({
|
|
2358
2787
|
...this,
|
|
2359
|
-
pathPrefix:
|
|
2788
|
+
pathPrefix: fr(this.path, t)
|
|
2360
2789
|
});
|
|
2361
2790
|
}
|
|
2362
2791
|
toString() {
|
|
2363
|
-
return
|
|
2792
|
+
return mr(`${this.protocol}://${this.host}:${this.port}/${this.path}`);
|
|
2364
2793
|
}
|
|
2365
2794
|
static UNKNOWN = new e({
|
|
2366
2795
|
host: "unknown",
|
|
2367
2796
|
port: 0
|
|
2368
2797
|
});
|
|
2369
|
-
}, X = class extends
|
|
2798
|
+
}, X = class extends v.createTyped("freighter") {}, Z = class extends X.sub("eof") {
|
|
2370
2799
|
constructor() {
|
|
2371
2800
|
super("EOF");
|
|
2372
2801
|
}
|
|
@@ -2377,11 +2806,11 @@ var An = (...e) => e.map(jn).join(""), jn = (e) => (e.endsWith("/") || (e += "/"
|
|
|
2377
2806
|
}, $ = class extends X.sub("unreachable") {
|
|
2378
2807
|
url;
|
|
2379
2808
|
constructor(e = {}) {
|
|
2380
|
-
let { message: t = "Unreachable", url: n =
|
|
2809
|
+
let { message: t = "Unreachable", url: n = gr.UNKNOWN } = e;
|
|
2381
2810
|
super(t), this.url = n;
|
|
2382
2811
|
}
|
|
2383
2812
|
};
|
|
2384
|
-
|
|
2813
|
+
v.register({
|
|
2385
2814
|
encode: (e) => {
|
|
2386
2815
|
if (!e.type.startsWith(X.TYPE)) return null;
|
|
2387
2816
|
if (Z.matches(e)) return {
|
|
@@ -2404,13 +2833,13 @@ q.register({
|
|
|
2404
2833
|
case Z.TYPE: return new Z();
|
|
2405
2834
|
case Q.TYPE: return new Q();
|
|
2406
2835
|
case $.TYPE: return new $();
|
|
2407
|
-
default: throw new
|
|
2836
|
+
default: throw new v.Unknown(`Unknown error type: ${e.data}`);
|
|
2408
2837
|
}
|
|
2409
2838
|
}
|
|
2410
2839
|
});
|
|
2411
2840
|
//#endregion
|
|
2412
2841
|
//#region src/middleware.ts
|
|
2413
|
-
var
|
|
2842
|
+
var _r = class {
|
|
2414
2843
|
middleware = [];
|
|
2415
2844
|
use(...e) {
|
|
2416
2845
|
this.middleware.push(...e);
|
|
@@ -2423,34 +2852,33 @@ var Fn = class {
|
|
|
2423
2852
|
};
|
|
2424
2853
|
return await r(e);
|
|
2425
2854
|
}
|
|
2426
|
-
},
|
|
2855
|
+
}, vr = "Content-Type", yr = new Set([
|
|
2427
2856
|
"ECONNREFUSED",
|
|
2428
2857
|
"ECONNRESET",
|
|
2429
2858
|
"ETIMEDOUT",
|
|
2430
2859
|
"EPIPE",
|
|
2431
2860
|
"UND_ERR_CONNECT_TIMEOUT",
|
|
2432
2861
|
"UND_ERR_SOCKET"
|
|
2433
|
-
]),
|
|
2862
|
+
]), br = (e) => {
|
|
2434
2863
|
let t = e?.cause?.code ?? e?.code ?? e?.errno;
|
|
2435
|
-
if (typeof t == "string" &&
|
|
2864
|
+
if (typeof t == "string" && yr.has(t)) return !0;
|
|
2436
2865
|
if (e.name === "TypeError") {
|
|
2437
2866
|
let t = String(e.message || "").toLowerCase();
|
|
2438
2867
|
if (/load failed|failed to fetch|networkerror|network error/.test(t)) return typeof navigator < "u" && navigator.onLine, !0;
|
|
2439
2868
|
}
|
|
2440
2869
|
return e?.name === "AbortError" || e?.code, !1;
|
|
2441
|
-
},
|
|
2870
|
+
}, xr = 400, Sr = class extends _r {
|
|
2442
2871
|
endpoint;
|
|
2443
2872
|
encoder;
|
|
2444
2873
|
constructor(e, t, n = !1) {
|
|
2445
2874
|
return super(), this.endpoint = e.replace({ protocol: n ? "https" : "http" }), this.encoder = t, new Proxy(this, { get: (e, t, n) => t === "endpoint" ? this.endpoint : Reflect.get(e, t, n) });
|
|
2446
2875
|
}
|
|
2447
2876
|
get headers() {
|
|
2448
|
-
return { [
|
|
2877
|
+
return { [vr]: this.encoder.contentType };
|
|
2449
2878
|
}
|
|
2450
2879
|
async send(e, t, n, r) {
|
|
2451
2880
|
let i = null, a = this.endpoint.child(e), o = {};
|
|
2452
|
-
o.method = "POST", o.body = this.encoder.encode(t, n)
|
|
2453
|
-
let [, s] = await this.executeMiddleware({
|
|
2881
|
+
if (o.method = "POST", o.body = this.encoder.encode(t, n), await this.executeMiddleware({
|
|
2454
2882
|
target: a.toString(),
|
|
2455
2883
|
protocol: this.endpoint.protocol,
|
|
2456
2884
|
params: {},
|
|
@@ -2468,24 +2896,22 @@ var Fn = class {
|
|
|
2468
2896
|
try {
|
|
2469
2897
|
n = await fetch(e.target, o);
|
|
2470
2898
|
} catch (e) {
|
|
2471
|
-
|
|
2472
|
-
return [t, Rn(e) ? new $({ url: a }) : e];
|
|
2899
|
+
throw e instanceof Error && br(e) ? new $({ url: a }) : e;
|
|
2473
2900
|
}
|
|
2474
2901
|
let s = await n.arrayBuffer();
|
|
2475
|
-
if (n?.ok) return r != null && (i = this.encoder.decode(s, r)),
|
|
2902
|
+
if (n?.ok) return r != null && (i = this.encoder.decode(s, r)), t;
|
|
2903
|
+
if (n.status !== xr) throw Error(n.statusText);
|
|
2904
|
+
let c;
|
|
2476
2905
|
try {
|
|
2477
|
-
|
|
2478
|
-
let e = this.encoder.decode(s, q.payloadZ);
|
|
2479
|
-
return [t, q.decode(e)];
|
|
2906
|
+
c = v.decode(this.encoder.decode(s, v.payloadZ));
|
|
2480
2907
|
} catch (e) {
|
|
2481
|
-
|
|
2908
|
+
throw e instanceof Error ? Error(`[freighter] - failed to decode error: ${n.statusText}: ${e.message}`, { cause: e }) : e;
|
|
2482
2909
|
}
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
return [i, null];
|
|
2910
|
+
throw c ?? Error(n.statusText);
|
|
2911
|
+
}), i == null) throw Error("Response must be defined");
|
|
2912
|
+
return i;
|
|
2487
2913
|
}
|
|
2488
|
-
},
|
|
2914
|
+
}, Cr = (e, t) => {
|
|
2489
2915
|
class n {
|
|
2490
2916
|
wrapped;
|
|
2491
2917
|
constructor(e) {
|
|
@@ -2495,29 +2921,26 @@ var Fn = class {
|
|
|
2495
2921
|
this.wrapped.use(...e);
|
|
2496
2922
|
}
|
|
2497
2923
|
async send(e, n, r, i) {
|
|
2498
|
-
let a = new
|
|
2499
|
-
do
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2924
|
+
let a = new zn.Breaker(t);
|
|
2925
|
+
do
|
|
2926
|
+
try {
|
|
2927
|
+
return await this.wrapped.send(e, n, r, i);
|
|
2928
|
+
} catch (e) {
|
|
2929
|
+
if (!$.matches(e) || (console.warn(`[freighter] ${a.retryMessage}`, e), !await a.wait())) throw e;
|
|
2930
|
+
}
|
|
2931
|
+
while (!0);
|
|
2505
2932
|
}
|
|
2506
2933
|
}
|
|
2507
2934
|
return new n(e);
|
|
2508
|
-
},
|
|
2509
|
-
let [a, o] = await e.send(t, n, r, i);
|
|
2510
|
-
if (o != null) throw o;
|
|
2511
|
-
return a;
|
|
2512
|
-
}, Un = t.object({
|
|
2935
|
+
}, wr = t.object({
|
|
2513
2936
|
type: t.enum([
|
|
2514
2937
|
"data",
|
|
2515
2938
|
"close",
|
|
2516
2939
|
"open"
|
|
2517
2940
|
]),
|
|
2518
2941
|
payload: t.unknown(),
|
|
2519
|
-
error: t.optional(
|
|
2520
|
-
}),
|
|
2942
|
+
error: t.optional(v.payloadZ)
|
|
2943
|
+
}), Tr = class {
|
|
2521
2944
|
codec;
|
|
2522
2945
|
reqSchema;
|
|
2523
2946
|
resSchema;
|
|
@@ -2531,28 +2954,21 @@ var Fn = class {
|
|
|
2531
2954
|
}
|
|
2532
2955
|
async receiveOpenAck() {
|
|
2533
2956
|
let e = await this.receiveMsg();
|
|
2534
|
-
if (e.type !== "open") {
|
|
2535
|
-
if (e.error == null) throw Error("Message error must be defined");
|
|
2536
|
-
return q.decode(e.error);
|
|
2537
|
-
}
|
|
2538
|
-
return null;
|
|
2957
|
+
if (e.type !== "open") throw e.error == null ? Error("Message error must be defined") : v.decode(e.error) ?? /* @__PURE__ */ Error(`Unexpected open-ack message type: ${e.type}`);
|
|
2539
2958
|
}
|
|
2540
2959
|
send(e) {
|
|
2541
|
-
if (this.serverClosed != null)
|
|
2960
|
+
if (this.serverClosed != null) throw new Z();
|
|
2542
2961
|
if (this.sendClosed) throw new Q();
|
|
2543
|
-
|
|
2962
|
+
this.ws.send(this.codec.encode({
|
|
2544
2963
|
type: "data",
|
|
2545
2964
|
payload: e
|
|
2546
|
-
}))
|
|
2965
|
+
}));
|
|
2547
2966
|
}
|
|
2548
2967
|
async receive() {
|
|
2549
|
-
if (this.serverClosed != null)
|
|
2968
|
+
if (this.serverClosed != null) throw this.serverClosed;
|
|
2550
2969
|
let e = await this.receiveMsg();
|
|
2551
|
-
if (e.type === "close")
|
|
2552
|
-
|
|
2553
|
-
return [null, this.serverClosed];
|
|
2554
|
-
}
|
|
2555
|
-
return [this.resSchema.parse(e.payload), null];
|
|
2970
|
+
if (e.type === "close") throw e.error == null || (this.serverClosed = v.decode(e.error), this.serverClosed == null) ? Error("Message error must be defined") : this.serverClosed;
|
|
2971
|
+
return this.resSchema.parse(e.payload);
|
|
2556
2972
|
}
|
|
2557
2973
|
received() {
|
|
2558
2974
|
return this.receiveDataQueue.length !== 0;
|
|
@@ -2580,18 +2996,18 @@ var Fn = class {
|
|
|
2580
2996
|
this.ws.onmessage = this.onMessage.bind(this), this.ws.onclose = this.onClose.bind(this);
|
|
2581
2997
|
}
|
|
2582
2998
|
onMessage(e) {
|
|
2583
|
-
this.addMessage(this.codec.decode(e.data,
|
|
2999
|
+
this.addMessage(this.codec.decode(e.data, wr));
|
|
2584
3000
|
}
|
|
2585
3001
|
onClose(e) {
|
|
2586
3002
|
this.addMessage({
|
|
2587
3003
|
type: "close",
|
|
2588
3004
|
error: {
|
|
2589
|
-
type: e.code ===
|
|
3005
|
+
type: e.code === Dr ? Z.TYPE : Q.TYPE,
|
|
2590
3006
|
data: ""
|
|
2591
3007
|
}
|
|
2592
3008
|
});
|
|
2593
3009
|
}
|
|
2594
|
-
},
|
|
3010
|
+
}, Er = "freighterctx", Dr = 1e3, Or = class e extends _r {
|
|
2595
3011
|
baseUrl;
|
|
2596
3012
|
encoder;
|
|
2597
3013
|
secure;
|
|
@@ -2604,7 +3020,8 @@ var Fn = class {
|
|
|
2604
3020
|
return n.use(...this.middleware), n;
|
|
2605
3021
|
}
|
|
2606
3022
|
async stream(t, n, r) {
|
|
2607
|
-
let i
|
|
3023
|
+
let i;
|
|
3024
|
+
return await this.executeMiddleware({
|
|
2608
3025
|
target: t,
|
|
2609
3026
|
protocol: "websocket",
|
|
2610
3027
|
params: {},
|
|
@@ -2614,32 +3031,26 @@ var Fn = class {
|
|
|
2614
3031
|
...a,
|
|
2615
3032
|
params: {}
|
|
2616
3033
|
};
|
|
2617
|
-
o.binaryType = e.MESSAGE_TYPE;
|
|
2618
|
-
|
|
2619
|
-
return c instanceof Error ? [s, c] : (i = c, [s, null]);
|
|
2620
|
-
});
|
|
2621
|
-
if (a != null) throw a;
|
|
2622
|
-
return i;
|
|
3034
|
+
return o.binaryType = e.MESSAGE_TYPE, i = await this.wrapSocket(o, n, r), s;
|
|
3035
|
+
}), i;
|
|
2623
3036
|
}
|
|
2624
3037
|
buildURL(e, t) {
|
|
2625
|
-
let n =
|
|
2626
|
-
[
|
|
3038
|
+
let n = hr({
|
|
3039
|
+
[vr]: this.encoder.contentType,
|
|
2627
3040
|
...t.params
|
|
2628
|
-
},
|
|
3041
|
+
}, Er);
|
|
2629
3042
|
return this.baseUrl.child(e).toString() + n;
|
|
2630
3043
|
}
|
|
2631
3044
|
async wrapSocket(e, t, n) {
|
|
2632
|
-
return await new Promise((r) => {
|
|
3045
|
+
return await new Promise((r, i) => {
|
|
2633
3046
|
e.onopen = () => {
|
|
2634
|
-
let
|
|
2635
|
-
|
|
2636
|
-
r(e ?? i);
|
|
2637
|
-
}).catch((e) => r(e));
|
|
3047
|
+
let a = new Tr(e, this.encoder, t, n);
|
|
3048
|
+
a.receiveOpenAck().then(() => r(a)).catch((e) => i(e));
|
|
2638
3049
|
}, e.onerror = (e) => {
|
|
2639
|
-
|
|
3050
|
+
i(Error(e.message));
|
|
2640
3051
|
};
|
|
2641
3052
|
});
|
|
2642
3053
|
}
|
|
2643
3054
|
};
|
|
2644
3055
|
//#endregion
|
|
2645
|
-
export { Z as EOF,
|
|
3056
|
+
export { Z as EOF, Sr as HTTPClient, Q as StreamClosed, $ as Unreachable, Or as WebSocketClient, Cr as unaryWithBreaker };
|