@synnaxlabs/freighter 0.55.0 → 0.56.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -10
- package/dist/freighter.cjs +7 -7
- package/dist/freighter.js +552 -463
- package/dist/src/alamos.d.ts.map +1 -1
- package/dist/src/errors.d.ts +3 -0
- package/dist/src/errors.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 +11 -11
- package/src/alamos.ts +21 -12
- package/src/errors.ts +5 -2
- package/src/http.spec.ts +10 -36
- package/src/http.ts +26 -21
- package/src/index.ts +1 -1
- package/src/middleware.ts +20 -19
- package/src/stream.ts +27 -29
- package/src/unary.ts +17 -24
- 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) => {
|
|
@@ -138,40 +144,32 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
138
144
|
} else if (r !== i) return !1;
|
|
139
145
|
}
|
|
140
146
|
return !0;
|
|
141
|
-
}, ie = (e,
|
|
142
|
-
if (t.length === 0) return e;
|
|
143
|
-
let n = t.shift();
|
|
144
|
-
if (_(e) && _(n)) for (let t in n) try {
|
|
145
|
-
_(n[t]) ? (t in e || Object.assign(e, { [t]: {} }), ie(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
|
|
146
|
-
} catch (e) {
|
|
147
|
-
throw e instanceof TypeError ? TypeError(`.${t}: ${e.message}`, { cause: e }) : e;
|
|
148
|
-
}
|
|
149
|
-
return ie(e, ...t);
|
|
150
|
-
}, ae = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), oe = (e, t) => {
|
|
147
|
+
}, ie = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), ae = (e, t) => {
|
|
151
148
|
let n = Symbol.for(e);
|
|
152
|
-
if (!
|
|
149
|
+
if (!ie(n)) {
|
|
153
150
|
let e = t();
|
|
154
151
|
Object.defineProperty(globalThis, n, { value: e });
|
|
155
152
|
}
|
|
156
153
|
return () => globalThis[n];
|
|
157
154
|
}, v = /* @__PURE__ */ r({
|
|
158
|
-
Canceled: () =>
|
|
155
|
+
Canceled: () => ye,
|
|
159
156
|
NONE: () => "nil",
|
|
160
|
-
NotImplemented: () =>
|
|
157
|
+
NotImplemented: () => be,
|
|
161
158
|
UNKNOWN: () => b,
|
|
162
|
-
Unknown: () =>
|
|
159
|
+
Unknown: () => _e,
|
|
163
160
|
createTyped: () => y,
|
|
164
|
-
decode: () =>
|
|
165
|
-
encode: () =>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
161
|
+
decode: () => ge,
|
|
162
|
+
encode: () => he,
|
|
163
|
+
fromUnknown: () => le,
|
|
164
|
+
isTyped: () => ce,
|
|
165
|
+
payloadZ: () => ve,
|
|
166
|
+
register: () => me
|
|
167
|
+
}), oe = "sy_x_error", se = (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 {
|
|
168
|
+
static discriminator = oe;
|
|
171
169
|
discriminator = t.discriminator;
|
|
172
170
|
static TYPE = e;
|
|
173
171
|
type = t.TYPE;
|
|
174
|
-
static matches =
|
|
172
|
+
static matches = se(e);
|
|
175
173
|
matches = t.matches;
|
|
176
174
|
constructor(e, n) {
|
|
177
175
|
super(e, n), this.name = t.TYPE;
|
|
@@ -179,13 +177,26 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
179
177
|
static sub(t) {
|
|
180
178
|
return y(`${e}.${t}`);
|
|
181
179
|
}
|
|
182
|
-
},
|
|
180
|
+
}, ce = (e) => {
|
|
183
181
|
if (typeof e != "object" || !e) return !1;
|
|
184
182
|
let t = e;
|
|
185
|
-
if (t.discriminator !==
|
|
183
|
+
if (t.discriminator !== oe) return !1;
|
|
186
184
|
if (!("type" in t)) throw Error(`X Error is missing its type property: ${JSON.stringify(t)}`);
|
|
187
185
|
return !0;
|
|
188
|
-
},
|
|
186
|
+
}, le = (e) => {
|
|
187
|
+
if (e instanceof Error) return e;
|
|
188
|
+
let t;
|
|
189
|
+
try {
|
|
190
|
+
t = JSON.stringify(e) ?? String(e);
|
|
191
|
+
} catch {
|
|
192
|
+
t = String(e);
|
|
193
|
+
}
|
|
194
|
+
return Error(t, { cause: e });
|
|
195
|
+
}, b = "unknown", ue = (e, t) => ({
|
|
196
|
+
...e,
|
|
197
|
+
name: t.name,
|
|
198
|
+
stack: t.stack
|
|
199
|
+
}), de = (e, t) => (t.name != null && (e.name = t.name), t.stack != null && (e.stack = t.stack), e), fe = class {
|
|
189
200
|
providers = [];
|
|
190
201
|
register(e) {
|
|
191
202
|
this.providers.push(e);
|
|
@@ -195,14 +206,14 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
195
206
|
type: "nil",
|
|
196
207
|
data: ""
|
|
197
208
|
};
|
|
198
|
-
if (
|
|
209
|
+
if (ce(e)) for (let t of this.providers) {
|
|
199
210
|
let n = t.encode(e);
|
|
200
|
-
if (n != null) return n;
|
|
211
|
+
if (n != null) return ue(n, e);
|
|
201
212
|
}
|
|
202
|
-
if (e instanceof Error) return {
|
|
213
|
+
if (e instanceof Error) return ue({
|
|
203
214
|
type: b,
|
|
204
215
|
data: e.message
|
|
205
|
-
};
|
|
216
|
+
}, e);
|
|
206
217
|
if (typeof e == "string") return {
|
|
207
218
|
type: b,
|
|
208
219
|
data: e
|
|
@@ -221,27 +232,38 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
221
232
|
}
|
|
222
233
|
decode(e) {
|
|
223
234
|
if (e == null || e.type === "nil") return null;
|
|
224
|
-
if (e.type === "unknown") return new
|
|
235
|
+
if (e.type === "unknown") return de(new _e(e.data), e);
|
|
225
236
|
for (let t of this.providers) {
|
|
226
237
|
let n = t.decode(e);
|
|
227
|
-
if (n != null) return n;
|
|
238
|
+
if (n != null) return de(n, e);
|
|
228
239
|
}
|
|
229
|
-
return new
|
|
240
|
+
return de(new _e(e.data), e);
|
|
230
241
|
}
|
|
231
|
-
},
|
|
242
|
+
}, pe = ae("synnax-error-registry", () => new fe()), me = ({ encode: e, decode: t }) => pe().register({
|
|
232
243
|
encode: e,
|
|
233
244
|
decode: t
|
|
234
|
-
}),
|
|
245
|
+
}), he = (e) => pe().encode(e), ge = (e) => e == null ? null : pe().decode(e), _e = class extends y("unknown") {}, ve = t.object({
|
|
235
246
|
type: t.string(),
|
|
236
|
-
data: t.string()
|
|
237
|
-
|
|
247
|
+
data: t.string(),
|
|
248
|
+
name: t.string().optional(),
|
|
249
|
+
stack: t.string().optional()
|
|
250
|
+
}), ye = class extends y("canceled") {}, be = class extends y("not_implemented") {}, xe = (e, ...t) => {
|
|
251
|
+
if (t.length === 0) return e;
|
|
252
|
+
let n = t.shift();
|
|
253
|
+
if (_(e) && _(n)) for (let t in n) try {
|
|
254
|
+
_(n[t]) ? (t in e || Object.assign(e, { [t]: {} }), xe(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
|
|
255
|
+
} catch (e) {
|
|
256
|
+
throw e instanceof TypeError ? TypeError(`.${t}: ${e.message}`, { cause: e }) : le(e);
|
|
257
|
+
}
|
|
258
|
+
return xe(e, ...t);
|
|
259
|
+
}, Se = (e) => {
|
|
238
260
|
if (e.length === 0) return "<root>";
|
|
239
261
|
let t = "";
|
|
240
262
|
return e.forEach((e, n) => {
|
|
241
263
|
typeof e == "number" ? t += `[${e}]` : n === 0 ? t += String(e) : t += `.${String(e)}`;
|
|
242
264
|
}), t;
|
|
243
|
-
},
|
|
244
|
-
let n = t.maxStringLength ??
|
|
265
|
+
}, Ce = 200, we = 10, Te = 8, x = (e, t = {}) => {
|
|
266
|
+
let n = t.maxStringLength ?? Ce, r = t.maxArrayLength ?? we, i = t.maxDepth ?? Te, a = (e, t) => {
|
|
245
267
|
if (e === null) return null;
|
|
246
268
|
if (e === void 0) return "[undefined]";
|
|
247
269
|
let o = typeof e;
|
|
@@ -272,7 +294,7 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
272
294
|
}
|
|
273
295
|
};
|
|
274
296
|
return a(e, 0);
|
|
275
|
-
},
|
|
297
|
+
}, Ee = (e, t = {}) => JSON.stringify(x(e, t), null, 2), S = (e) => typeof e == "object" && !!e && "value" in e, C = class {
|
|
276
298
|
value;
|
|
277
299
|
constructor(e) {
|
|
278
300
|
this.value = e;
|
|
@@ -286,11 +308,11 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
286
308
|
toString() {
|
|
287
309
|
return this.value.toString();
|
|
288
310
|
}
|
|
289
|
-
},
|
|
311
|
+
}, De = (e) => typeof e == "object" && !!e && "toString" in e, Oe = (e) => e == null || typeof e != "object" && typeof e != "function", ke = "value", Ae = "zod.parse", je = "✗", Me = 60, Ne = {
|
|
290
312
|
maxStringLength: 60,
|
|
291
313
|
maxArrayLength: 3,
|
|
292
314
|
maxDepth: 3
|
|
293
|
-
},
|
|
315
|
+
}, Pe = (e) => e.slice(0, -1), Fe = (e) => {
|
|
294
316
|
switch (e.code) {
|
|
295
317
|
case "invalid_type": return `expected ${e.expected}`;
|
|
296
318
|
case "invalid_value": return `expected one of ${JSON.stringify(e.values)}`;
|
|
@@ -308,9 +330,9 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
308
330
|
case "custom": return e.message || "custom validation failed";
|
|
309
331
|
default: return e.message;
|
|
310
332
|
}
|
|
311
|
-
},
|
|
333
|
+
}, Ie = (e, t, n) => {
|
|
312
334
|
let r = JSON.stringify(x(t, n));
|
|
313
|
-
return `${
|
|
335
|
+
return `${Fe(e)}, received ${r}`;
|
|
314
336
|
}, w = (e) => {
|
|
315
337
|
let t = 0;
|
|
316
338
|
for (let n of e) {
|
|
@@ -351,7 +373,7 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
351
373
|
});
|
|
352
374
|
}
|
|
353
375
|
return n;
|
|
354
|
-
},
|
|
376
|
+
}, Le = (e) => {
|
|
355
377
|
let t = [];
|
|
356
378
|
for (let n of e) {
|
|
357
379
|
if (n.code === "unrecognized_keys" && "keys" in n && Array.isArray(n.keys)) {
|
|
@@ -364,9 +386,9 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
364
386
|
t.push(n);
|
|
365
387
|
}
|
|
366
388
|
return t;
|
|
367
|
-
},
|
|
368
|
-
let i = `${n} `, a = `${n +
|
|
369
|
-
...
|
|
389
|
+
}, Re = (e, t, n, r) => {
|
|
390
|
+
let i = `${n} `, a = `${n + je} `, o = {
|
|
391
|
+
...Ne,
|
|
370
392
|
...r
|
|
371
393
|
};
|
|
372
394
|
if (Array.isArray(e)) {
|
|
@@ -416,7 +438,7 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
416
438
|
return u.forEach((e, t) => {
|
|
417
439
|
if (e.mark == null) return;
|
|
418
440
|
let n = +(t < u.length - 1), r = e.content.length + n;
|
|
419
|
-
r > d && r <=
|
|
441
|
+
r > d && r <= Me && (d = r);
|
|
420
442
|
}), u.forEach((e, t) => {
|
|
421
443
|
let n = t < u.length - 1 ? "," : "", r = e.content + n;
|
|
422
444
|
if (e.mark != null) {
|
|
@@ -424,48 +446,48 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
424
446
|
c.push(`${a}${r}${t}× ${e.mark.reason}`);
|
|
425
447
|
} else c.push(`${i}${r}`);
|
|
426
448
|
}), c.push(n + (l ? "]" : "}")), c;
|
|
427
|
-
},
|
|
449
|
+
}, ze = "__root__", Be = (e, t, n) => {
|
|
428
450
|
let r = /* @__PURE__ */ new Map();
|
|
429
451
|
for (let t of e) {
|
|
430
|
-
let e = t.path.length === 0 ?
|
|
452
|
+
let e = t.path.length === 0 ? ze : `::${Se(Pe(t.path))}`, n = r.get(e);
|
|
431
453
|
n == null ? r.set(e, [t]) : n.push(t);
|
|
432
454
|
}
|
|
433
455
|
let i = [];
|
|
434
456
|
for (let [e, a] of r) {
|
|
435
|
-
if (e ===
|
|
436
|
-
i.push(a.map((e) => ` × ${
|
|
457
|
+
if (e === ze) {
|
|
458
|
+
i.push(a.map((e) => ` × ${Ie(e, t, n)}`).join("\n"));
|
|
437
459
|
continue;
|
|
438
460
|
}
|
|
439
|
-
let r =
|
|
461
|
+
let r = Pe(a[0].path), { present: o, value: s } = te(t, r);
|
|
440
462
|
if (!o) {
|
|
441
|
-
i.push(a.map((e) => ` at ${
|
|
463
|
+
i.push(a.map((e) => ` at ${Se(e.path)}\n × ${Ie(e, t, n)}`).join("\n"));
|
|
442
464
|
continue;
|
|
443
465
|
}
|
|
444
466
|
let c = /* @__PURE__ */ new Map();
|
|
445
467
|
for (let e of a) {
|
|
446
468
|
let n = String(e.path[e.path.length - 1]), r = te(t, e.path);
|
|
447
469
|
c.set(n, {
|
|
448
|
-
reason:
|
|
470
|
+
reason: Fe(e),
|
|
449
471
|
missing: !r.present
|
|
450
472
|
});
|
|
451
473
|
}
|
|
452
|
-
let l = r.length === 0, u =
|
|
453
|
-
l ? i.push(u.join("\n")) : i.push([` at ${
|
|
474
|
+
let l = r.length === 0, u = Re(s, c, l ? " " : " ", n);
|
|
475
|
+
l ? i.push(u.join("\n")) : i.push([` at ${Se(r)}`, ...u].join("\n"));
|
|
454
476
|
}
|
|
455
477
|
return i.join("\n\n");
|
|
456
|
-
},
|
|
478
|
+
}, Ve = (e, t) => {
|
|
457
479
|
let n = Object.entries(e);
|
|
458
|
-
return n.every(([, e]) =>
|
|
459
|
-
},
|
|
460
|
-
let a = i ?? {}, o =
|
|
461
|
-
return s.push(
|
|
462
|
-
},
|
|
480
|
+
return n.every(([, e]) => Oe(e)) ? n.map(([e, t]) => `${e}=${typeof t == "string" ? t : String(t)}`).join(", ") : Ee(e, t);
|
|
481
|
+
}, He = ({ issues: e, input: t, label: n, context: r, formatOptions: i }) => {
|
|
482
|
+
let a = i ?? {}, o = Le(T(e)), s = [`Failed to parse ${n} (${o.length === 1 ? "1 issue" : `${o.length} issues`})`];
|
|
483
|
+
return s.push(Be(o, t, a)), r != null && Object.keys(r).length > 0 && s.push(` context: ${Ve(r, a)}`), s.join("\n\n");
|
|
484
|
+
}, Ue = class extends y(Ae) {
|
|
463
485
|
issues;
|
|
464
486
|
input;
|
|
465
487
|
label;
|
|
466
488
|
context;
|
|
467
489
|
constructor({ issues: e, input: t, label: n, context: r, cause: i, formatOptions: a }) {
|
|
468
|
-
super(
|
|
490
|
+
super(He({
|
|
469
491
|
issues: e,
|
|
470
492
|
input: t,
|
|
471
493
|
label: n,
|
|
@@ -485,9 +507,9 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
485
507
|
};
|
|
486
508
|
}
|
|
487
509
|
};
|
|
488
|
-
|
|
510
|
+
me({
|
|
489
511
|
encode: (e) => {
|
|
490
|
-
if (!
|
|
512
|
+
if (!Ue.matches(e)) return null;
|
|
491
513
|
let t = e, n = {
|
|
492
514
|
label: t.label,
|
|
493
515
|
context: t.context,
|
|
@@ -495,14 +517,14 @@ fe({
|
|
|
495
517
|
input: x(t.input)
|
|
496
518
|
};
|
|
497
519
|
return {
|
|
498
|
-
type:
|
|
520
|
+
type: Ae,
|
|
499
521
|
data: JSON.stringify(n)
|
|
500
522
|
};
|
|
501
523
|
},
|
|
502
524
|
decode: (e) => {
|
|
503
|
-
if (e.type !==
|
|
525
|
+
if (e.type !== Ae) return null;
|
|
504
526
|
let t = JSON.parse(e.data);
|
|
505
|
-
return new
|
|
527
|
+
return new Ue({
|
|
506
528
|
issues: t.issues,
|
|
507
529
|
input: t.input,
|
|
508
530
|
label: t.label,
|
|
@@ -510,31 +532,33 @@ fe({
|
|
|
510
532
|
});
|
|
511
533
|
}
|
|
512
534
|
});
|
|
513
|
-
var
|
|
535
|
+
var We = (e, t, n = {}) => {
|
|
514
536
|
let r = e.safeParse(t);
|
|
515
537
|
if (r.success) return r.data;
|
|
516
|
-
throw new
|
|
538
|
+
throw new Ue({
|
|
517
539
|
issues: r.error.issues,
|
|
518
540
|
input: t,
|
|
519
|
-
label: n.label ??
|
|
541
|
+
label: n.label ?? ke,
|
|
520
542
|
context: n.context,
|
|
521
543
|
cause: r.error
|
|
522
544
|
});
|
|
523
|
-
},
|
|
545
|
+
}, Ge = 2 ** 12 - 1, Ke = 2 ** 16 - 1, qe = 2 ** 20 - 1, Je = -128, Ye = -(2 ** 15), Xe = 2 ** 15 - 1, Ze = -(2n ** 63n), E = 2n ** 63n - 1n, Qe = -(2 ** 63), $e = 2 ** 63 - 1, et = (e) => (t, n) => {
|
|
524
546
|
if (typeof t == "bigint") {
|
|
525
|
-
if (
|
|
547
|
+
if (tt(n)) return e(t, BigInt(n));
|
|
526
548
|
let r = e(Number(t), Number(n));
|
|
527
549
|
return typeof r == "number" ? BigInt(Math.round(r)) : r;
|
|
528
550
|
}
|
|
529
551
|
return e(Number(t), Number(n));
|
|
530
|
-
},
|
|
552
|
+
}, D = et((e, t) => e - t), O = et((e, t) => e + t), tt = (e) => typeof e == "bigint" ? !0 : Number.isInteger(e), k = et((e, t) => e * t), A = et((e, t) => e / t), nt = ["left", "right"], rt = t.enum(nt), it = t.enum(["top", "bottom"]), at = t.enum(["px", "decimal"]), ot = [
|
|
531
553
|
"top",
|
|
532
554
|
"right",
|
|
533
555
|
"bottom",
|
|
534
556
|
"left"
|
|
535
557
|
];
|
|
536
|
-
t.enum(
|
|
537
|
-
var
|
|
558
|
+
t.enum(ot);
|
|
559
|
+
var st = t.enum(["x", "y"]);
|
|
560
|
+
t.enum(["clockwise", "counterclockwise"]);
|
|
561
|
+
var ct = ["center"], lt = t.enum(ct);
|
|
538
562
|
t.enum([
|
|
539
563
|
"top",
|
|
540
564
|
"right",
|
|
@@ -545,31 +569,36 @@ t.enum([
|
|
|
545
569
|
"start",
|
|
546
570
|
"center",
|
|
547
571
|
"end"
|
|
548
|
-
]), t.enum(["first", "last"]);
|
|
549
|
-
var
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}),
|
|
572
|
+
]), t.enum(["first", "last"]), t.enum(["width", "height"]), t.enum(["signedWidth", "signedHeight"]);
|
|
573
|
+
var j = t.object({
|
|
574
|
+
x: t.number(),
|
|
575
|
+
y: t.number()
|
|
576
|
+
}), ut = t.object({
|
|
577
|
+
x: rt,
|
|
578
|
+
y: it
|
|
579
|
+
}), dt = t.object({
|
|
580
|
+
x: at,
|
|
581
|
+
y: at
|
|
582
|
+
}), ft = t.object({
|
|
553
583
|
width: t.number(),
|
|
554
584
|
height: t.number()
|
|
555
|
-
}),
|
|
585
|
+
}), pt = t.object({
|
|
556
586
|
signedWidth: t.number(),
|
|
557
587
|
signedHeight: t.number()
|
|
588
|
+
}), mt = t.object({
|
|
589
|
+
clientX: t.number(),
|
|
590
|
+
clientY: t.number()
|
|
558
591
|
});
|
|
559
592
|
t.object({
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
})
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
t.enum([...et, ...it]),
|
|
570
|
-
t.instanceof(String)
|
|
571
|
-
]);
|
|
572
|
-
var M = (e, t, n) => {
|
|
593
|
+
zoom: t.number().default(1),
|
|
594
|
+
position: j
|
|
595
|
+
});
|
|
596
|
+
var ht = t.object({
|
|
597
|
+
x: t.number(),
|
|
598
|
+
y: t.number(),
|
|
599
|
+
root: ut.optional(),
|
|
600
|
+
units: dt.optional()
|
|
601
|
+
}), gt = t.tuple([t.number(), t.number()]), M = (e, t, n) => {
|
|
573
602
|
let r = {};
|
|
574
603
|
if (typeof t == "object" && (n = t, t = void 0), n = {
|
|
575
604
|
makeValid: !0,
|
|
@@ -579,7 +608,7 @@ var M = (e, t, n) => {
|
|
|
579
608
|
if (e.length !== 2) throw Error("bounds: expected array of length 2");
|
|
580
609
|
[r.lower, r.upper] = e;
|
|
581
610
|
} else r.lower = e.lower, r.upper = e.upper;
|
|
582
|
-
return n?.makeValid ?
|
|
611
|
+
return n?.makeValid ? _t(r) : r;
|
|
583
612
|
};
|
|
584
613
|
Object.freeze({
|
|
585
614
|
lower: 0,
|
|
@@ -594,17 +623,17 @@ Object.freeze({
|
|
|
594
623
|
lower: -1,
|
|
595
624
|
upper: 1
|
|
596
625
|
});
|
|
597
|
-
var
|
|
626
|
+
var _t = (e) => e.lower > e.upper ? {
|
|
598
627
|
lower: e.upper,
|
|
599
628
|
upper: e.lower
|
|
600
|
-
} : e,
|
|
629
|
+
} : e, vt = (e, t) => {
|
|
601
630
|
let n = M(e);
|
|
602
631
|
return t < n.lower ? n.lower : t >= n.upper ? n.upper - (typeof n.upper == "number" ? 1 : 1n) : t;
|
|
603
632
|
};
|
|
604
|
-
t.int().min(
|
|
605
|
-
var
|
|
606
|
-
t.int().min(0).max(
|
|
607
|
-
var
|
|
633
|
+
t.int().min(Je).max(127), t.int().min(Ye).max(Xe), t.int().min(Qe).max($e);
|
|
634
|
+
var yt = t.int().min(0).max(255);
|
|
635
|
+
t.int().min(0).max(Ge), t.int().min(0).max(Ke), t.int().min(0).max(qe);
|
|
636
|
+
var bt = class {
|
|
608
637
|
contentType = "application/json";
|
|
609
638
|
decoder;
|
|
610
639
|
encoder;
|
|
@@ -619,13 +648,13 @@ var ft = class {
|
|
|
619
648
|
}
|
|
620
649
|
decodeString(e, t) {
|
|
621
650
|
let n = f(JSON.parse(e), { schema: t });
|
|
622
|
-
return t == null ? n :
|
|
651
|
+
return t == null ? n : We(t, n);
|
|
623
652
|
}
|
|
624
653
|
encodeString(e, t) {
|
|
625
|
-
let n = p((t == null ? e :
|
|
654
|
+
let n = p((t == null ? e : We(t, e)) ?? {}, { schema: t });
|
|
626
655
|
return JSON.stringify(n, (e, t) => ArrayBuffer.isView(t) ? Array.from(t) : typeof t == "bigint" ? t.toString() : t);
|
|
627
656
|
}
|
|
628
|
-
},
|
|
657
|
+
}, xt = class {
|
|
629
658
|
contentType = "text/csv";
|
|
630
659
|
encode(e) {
|
|
631
660
|
let t = this.encodeString(e);
|
|
@@ -662,7 +691,7 @@ var ft = class {
|
|
|
662
691
|
let t = Number(e);
|
|
663
692
|
return isNaN(t) ? e.startsWith("\"") && e.endsWith("\"") ? e.slice(1, -1) : e : t;
|
|
664
693
|
}
|
|
665
|
-
},
|
|
694
|
+
}, St = class {
|
|
666
695
|
contentType = "text/plain";
|
|
667
696
|
encode(e) {
|
|
668
697
|
if (typeof e != "string") throw Error("TextCodec.encode payload must be a string");
|
|
@@ -672,9 +701,9 @@ var ft = class {
|
|
|
672
701
|
let n = new TextDecoder().decode(e);
|
|
673
702
|
return t == null ? n : t.parse(n);
|
|
674
703
|
}
|
|
675
|
-
},
|
|
676
|
-
new
|
|
677
|
-
var
|
|
704
|
+
}, Ct = new bt();
|
|
705
|
+
new xt(), new St();
|
|
706
|
+
var wt = 365, N = 30, Tt = t.union([
|
|
678
707
|
t.tuple([t.int()]),
|
|
679
708
|
t.tuple([t.int(), t.int().min(1).max(12)]),
|
|
680
709
|
t.tuple([
|
|
@@ -682,7 +711,7 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
682
711
|
t.int().min(1).max(12),
|
|
683
712
|
t.int().min(1).max(31)
|
|
684
713
|
])
|
|
685
|
-
]),
|
|
714
|
+
]), Et = (e, t) => {
|
|
686
715
|
let n = new P(t);
|
|
687
716
|
if (![
|
|
688
717
|
F.DAY,
|
|
@@ -696,6 +725,9 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
696
725
|
let r = e.valueOf() % n.valueOf();
|
|
697
726
|
return e instanceof P ? new P(r) : new F(r);
|
|
698
727
|
}, P = class e extends C {
|
|
728
|
+
hash() {
|
|
729
|
+
return this.value.toString();
|
|
730
|
+
}
|
|
699
731
|
constructor(t, n = "UTC") {
|
|
700
732
|
if (t == null) super(e.now().valueOf());
|
|
701
733
|
else if (t instanceof Date) super(BigInt(t.getTime()) * e.MILLISECOND.valueOf());
|
|
@@ -703,7 +735,7 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
703
735
|
else if (Array.isArray(t)) super(e.parseDate(t));
|
|
704
736
|
else {
|
|
705
737
|
let r = 0n;
|
|
706
|
-
t instanceof Number && (t = t.valueOf()), n === "local" && (r = e.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = t ===
|
|
738
|
+
t instanceof Number && (t = t.valueOf()), n === "local" && (r = e.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = t === $e ? E : Math.trunc(t) : (isNaN(t) && (t = 0), t = t === Infinity ? e.MAX : e.MIN)), S(t) && (t = t.value), super(BigInt(t.valueOf()) + r);
|
|
707
739
|
}
|
|
708
740
|
}
|
|
709
741
|
static parseDate([t = 1970, n = 1, r = 1]) {
|
|
@@ -764,7 +796,7 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
764
796
|
return this.range(e).span;
|
|
765
797
|
}
|
|
766
798
|
range(e) {
|
|
767
|
-
return new
|
|
799
|
+
return new R(this, e).makeValid();
|
|
768
800
|
}
|
|
769
801
|
spanRange(e) {
|
|
770
802
|
return this.range(this.add(e)).makeValid();
|
|
@@ -785,10 +817,10 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
785
817
|
return this.valueOf() <= new e(t).valueOf();
|
|
786
818
|
}
|
|
787
819
|
add(t) {
|
|
788
|
-
return new e(
|
|
820
|
+
return new e(O(this.valueOf(), new F(t).valueOf()));
|
|
789
821
|
}
|
|
790
822
|
sub(t) {
|
|
791
|
-
return new e(
|
|
823
|
+
return new e(D(this.valueOf(), new F(t).valueOf()));
|
|
792
824
|
}
|
|
793
825
|
get hours() {
|
|
794
826
|
return Number(this.valueOf()) / Number(F.HOUR.valueOf());
|
|
@@ -912,7 +944,6 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
912
944
|
toString(e = "ISO", t = "UTC") {
|
|
913
945
|
switch (e) {
|
|
914
946
|
case "ISODate": return this.toISOString(t).slice(0, 10);
|
|
915
|
-
case "ISOTime": return this.toISOString(t).slice(11, 23);
|
|
916
947
|
case "time": return this.timeString(!1, t);
|
|
917
948
|
case "preciseTime": return this.timeString(!0, t);
|
|
918
949
|
case "date": return this.dateString();
|
|
@@ -922,7 +953,7 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
922
953
|
}
|
|
923
954
|
}
|
|
924
955
|
remainder(e) {
|
|
925
|
-
return
|
|
956
|
+
return Et(this, e);
|
|
926
957
|
}
|
|
927
958
|
get isToday() {
|
|
928
959
|
return this.truncate(F.DAY).equals(e.now().truncate(F.DAY));
|
|
@@ -931,7 +962,7 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
931
962
|
return this.sub(this.remainder(e));
|
|
932
963
|
}
|
|
933
964
|
formatBySpan(e) {
|
|
934
|
-
return e.greaterThanOrEqual(F.days(30)) ? "
|
|
965
|
+
return e.greaterThanOrEqual(F.days(30)) ? "date" : e.greaterThanOrEqual(F.DAY) ? "dateTime" : e.greaterThanOrEqual(F.HOUR) ? "time" : "preciseTime";
|
|
935
966
|
}
|
|
936
967
|
static now() {
|
|
937
968
|
return new e(/* @__PURE__ */ new Date());
|
|
@@ -991,7 +1022,7 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
991
1022
|
t.bigint().transform((t) => new e(t)),
|
|
992
1023
|
t.date().transform((t) => new e(t)),
|
|
993
1024
|
t.custom((e) => e instanceof F).transform((t) => new e(t)),
|
|
994
|
-
|
|
1025
|
+
Tt.transform((t) => new e(t))
|
|
995
1026
|
]);
|
|
996
1027
|
static sort(e, t) {
|
|
997
1028
|
return Number(e.valueOf() - t.valueOf());
|
|
@@ -1001,14 +1032,17 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1001
1032
|
typeof e == "number" && (e = Math.trunc(e.valueOf())), S(e) && (e = e.value), super(BigInt(e.valueOf()));
|
|
1002
1033
|
}
|
|
1003
1034
|
static fromSeconds(t) {
|
|
1004
|
-
return t instanceof e ? t : t instanceof
|
|
1035
|
+
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));
|
|
1005
1036
|
}
|
|
1006
1037
|
static fromMilliseconds(t) {
|
|
1007
|
-
return t instanceof e ? t : t instanceof
|
|
1038
|
+
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));
|
|
1008
1039
|
}
|
|
1009
1040
|
valueOf() {
|
|
1010
1041
|
return this.value;
|
|
1011
1042
|
}
|
|
1043
|
+
hash() {
|
|
1044
|
+
return this.value.toString();
|
|
1045
|
+
}
|
|
1012
1046
|
lessThan(t) {
|
|
1013
1047
|
return this.valueOf() < new e(t).valueOf();
|
|
1014
1048
|
}
|
|
@@ -1022,7 +1056,7 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1022
1056
|
return this.valueOf() >= new e(t).valueOf();
|
|
1023
1057
|
}
|
|
1024
1058
|
remainder(e) {
|
|
1025
|
-
return
|
|
1059
|
+
return Et(this, e);
|
|
1026
1060
|
}
|
|
1027
1061
|
truncate(t) {
|
|
1028
1062
|
return new e(BigInt(Math.trunc(Number(this.valueOf() / t.valueOf()))) * t.valueOf());
|
|
@@ -1036,11 +1070,11 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1036
1070
|
let t = new e(this.valueOf() < 0n ? -this.valueOf() : this.valueOf()), n = this.valueOf() < 0n;
|
|
1037
1071
|
if (t.valueOf() === 0n) return "0s";
|
|
1038
1072
|
if (t.lessThan(e.SECOND)) return "< 1s";
|
|
1039
|
-
let r = t.days, i = t.hours, a = t.minutes, o = t.seconds, s = Math.floor(r /
|
|
1073
|
+
let r = t.days, i = t.hours, a = t.minutes, o = t.seconds, s = Math.floor(r / wt), 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 ? "-" : "";
|
|
1040
1074
|
if (s >= 1) {
|
|
1041
1075
|
let e = `${s}y`;
|
|
1042
1076
|
if (s < 2) {
|
|
1043
|
-
let t = Math.floor(r %
|
|
1077
|
+
let t = Math.floor(r % wt / N);
|
|
1044
1078
|
t > 0 && (e += ` ${t}mo`);
|
|
1045
1079
|
}
|
|
1046
1080
|
return m + e;
|
|
@@ -1084,10 +1118,10 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1084
1118
|
return `${m}${p}s`;
|
|
1085
1119
|
}
|
|
1086
1120
|
mult(t) {
|
|
1087
|
-
return new e(
|
|
1121
|
+
return new e(k(this.valueOf(), t));
|
|
1088
1122
|
}
|
|
1089
1123
|
div(t) {
|
|
1090
|
-
return new e(
|
|
1124
|
+
return new e(A(this.valueOf(), t));
|
|
1091
1125
|
}
|
|
1092
1126
|
get days() {
|
|
1093
1127
|
return Number(this.valueOf()) / Number(e.DAY.valueOf());
|
|
@@ -1131,27 +1165,27 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1131
1165
|
}
|
|
1132
1166
|
static NANOSECOND = e.nanoseconds(1);
|
|
1133
1167
|
static microseconds(t = 1) {
|
|
1134
|
-
return e.nanoseconds(
|
|
1168
|
+
return e.nanoseconds(k(t, 1e3));
|
|
1135
1169
|
}
|
|
1136
1170
|
static MICROSECOND = e.microseconds(1);
|
|
1137
1171
|
static milliseconds(t = 1) {
|
|
1138
|
-
return e.microseconds(
|
|
1172
|
+
return e.microseconds(k(t, 1e3));
|
|
1139
1173
|
}
|
|
1140
1174
|
static MILLISECOND = e.milliseconds(1);
|
|
1141
1175
|
static seconds(t = 1) {
|
|
1142
|
-
return e.milliseconds(
|
|
1176
|
+
return e.milliseconds(k(t, 1e3));
|
|
1143
1177
|
}
|
|
1144
1178
|
static SECOND = e.seconds(1);
|
|
1145
1179
|
static minutes(t = 1) {
|
|
1146
|
-
return e.seconds(
|
|
1180
|
+
return e.seconds(k(t, 60));
|
|
1147
1181
|
}
|
|
1148
1182
|
static MINUTE = e.minutes(1);
|
|
1149
1183
|
static hours(t) {
|
|
1150
|
-
return e.minutes(
|
|
1184
|
+
return e.minutes(k(t, 60));
|
|
1151
1185
|
}
|
|
1152
1186
|
static HOUR = e.hours(1);
|
|
1153
1187
|
static days(t) {
|
|
1154
|
-
return e.hours(
|
|
1188
|
+
return e.hours(k(t, 24));
|
|
1155
1189
|
}
|
|
1156
1190
|
static DAY = e.days(1);
|
|
1157
1191
|
static MAX = new e(E);
|
|
@@ -1164,12 +1198,15 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1164
1198
|
t.bigint().transform((t) => new e(t)),
|
|
1165
1199
|
t.instanceof(e),
|
|
1166
1200
|
t.instanceof(P).transform((t) => new e(t)),
|
|
1167
|
-
t.custom((e) => e instanceof
|
|
1201
|
+
t.custom((e) => e instanceof I).transform((t) => new e(t))
|
|
1168
1202
|
]);
|
|
1169
|
-
},
|
|
1203
|
+
}, I = class e extends C {
|
|
1170
1204
|
constructor(e) {
|
|
1171
1205
|
S(e) && (e = e.value), super(e.valueOf());
|
|
1172
1206
|
}
|
|
1207
|
+
hash() {
|
|
1208
|
+
return this.value.toString();
|
|
1209
|
+
}
|
|
1173
1210
|
toString() {
|
|
1174
1211
|
return `${this.valueOf()} Hz`;
|
|
1175
1212
|
}
|
|
@@ -1183,25 +1220,25 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1183
1220
|
return new F(e).seconds * this.valueOf();
|
|
1184
1221
|
}
|
|
1185
1222
|
byteCount(e, t) {
|
|
1186
|
-
return this.sampleCount(e) * new
|
|
1223
|
+
return this.sampleCount(e) * new L(t).valueOf();
|
|
1187
1224
|
}
|
|
1188
1225
|
span(e) {
|
|
1189
1226
|
return F.seconds(e / this.valueOf());
|
|
1190
1227
|
}
|
|
1191
1228
|
byteSpan(e, t) {
|
|
1192
|
-
return this.span(e.valueOf() / new
|
|
1229
|
+
return this.span(e.valueOf() / new L(t).valueOf());
|
|
1193
1230
|
}
|
|
1194
1231
|
add(t) {
|
|
1195
|
-
return new e(
|
|
1232
|
+
return new e(O(this.valueOf(), new e(t).valueOf()));
|
|
1196
1233
|
}
|
|
1197
1234
|
sub(t) {
|
|
1198
|
-
return new e(
|
|
1235
|
+
return new e(D(this.valueOf(), new e(t).valueOf()));
|
|
1199
1236
|
}
|
|
1200
1237
|
mult(t) {
|
|
1201
|
-
return new e(
|
|
1238
|
+
return new e(k(this.valueOf(), t));
|
|
1202
1239
|
}
|
|
1203
1240
|
div(t) {
|
|
1204
|
-
return new e(
|
|
1241
|
+
return new e(A(this.valueOf(), t));
|
|
1205
1242
|
}
|
|
1206
1243
|
static hz(t) {
|
|
1207
1244
|
return new e(t);
|
|
@@ -1210,7 +1247,7 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1210
1247
|
return e.hz(t * 1e3);
|
|
1211
1248
|
}
|
|
1212
1249
|
static z = t.union([t.number().transform((t) => new e(t)), t.instanceof(e)]);
|
|
1213
|
-
},
|
|
1250
|
+
}, L = class e extends C {
|
|
1214
1251
|
constructor(e) {
|
|
1215
1252
|
S(e) && (e = e.value), super(e.valueOf());
|
|
1216
1253
|
}
|
|
@@ -1218,19 +1255,19 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1218
1255
|
return e.valueOf() / this.valueOf();
|
|
1219
1256
|
}
|
|
1220
1257
|
size(e) {
|
|
1221
|
-
return new
|
|
1258
|
+
return new B(e * this.valueOf());
|
|
1222
1259
|
}
|
|
1223
1260
|
add(t) {
|
|
1224
|
-
return new e(
|
|
1261
|
+
return new e(O(this.valueOf(), new e(t).valueOf()));
|
|
1225
1262
|
}
|
|
1226
1263
|
sub(t) {
|
|
1227
|
-
return new e(
|
|
1264
|
+
return new e(D(this.valueOf(), new e(t).valueOf()));
|
|
1228
1265
|
}
|
|
1229
1266
|
mult(t) {
|
|
1230
|
-
return new e(
|
|
1267
|
+
return new e(k(this.valueOf(), t));
|
|
1231
1268
|
}
|
|
1232
1269
|
div(t) {
|
|
1233
|
-
return new e(
|
|
1270
|
+
return new e(A(this.valueOf(), t));
|
|
1234
1271
|
}
|
|
1235
1272
|
static UNKNOWN = new e(0);
|
|
1236
1273
|
static BIT128 = new e(16);
|
|
@@ -1239,7 +1276,10 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1239
1276
|
static BIT16 = new e(2);
|
|
1240
1277
|
static BIT8 = new e(1);
|
|
1241
1278
|
static z = t.union([t.number().transform((t) => new e(t)), t.instanceof(e)]);
|
|
1242
|
-
},
|
|
1279
|
+
}, R = class e {
|
|
1280
|
+
hash() {
|
|
1281
|
+
return `${this.start.hash()}-${this.end.hash()}`;
|
|
1282
|
+
}
|
|
1243
1283
|
start;
|
|
1244
1284
|
end;
|
|
1245
1285
|
constructor(e, t) {
|
|
@@ -1307,14 +1347,17 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1307
1347
|
start: P.z,
|
|
1308
1348
|
end: P.z
|
|
1309
1349
|
}).transform((t) => new e(t.start, t.end)), t.instanceof(e)]);
|
|
1310
|
-
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() <= E, { message: "Time range end time must be less than or equal to the maximum value of an int64" }).refine(({ start: e }) => e.valueOf() >=
|
|
1350
|
+
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() <= E, { message: "Time range end time must be less than or equal to the maximum value of an int64" }).refine(({ start: e }) => e.valueOf() >= Ze, { message: "Time range start time must be greater than or equal to the minimum value of an int64" });
|
|
1311
1351
|
static sort(e, t) {
|
|
1312
1352
|
return P.sort(e.start, t.start) || P.sort(e.end, t.end);
|
|
1313
1353
|
}
|
|
1314
1354
|
static merge(...t) {
|
|
1315
1355
|
return e.max(...t.map((t) => new e(t).makeValid()));
|
|
1316
1356
|
}
|
|
1317
|
-
},
|
|
1357
|
+
}, z = class e extends C {
|
|
1358
|
+
hash() {
|
|
1359
|
+
return this.value;
|
|
1360
|
+
}
|
|
1318
1361
|
constructor(t) {
|
|
1319
1362
|
if (S(t) && (t = t.value), t instanceof e || typeof t == "string" || typeof t.valueOf() == "string") super(t.valueOf());
|
|
1320
1363
|
else {
|
|
@@ -1419,21 +1462,21 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1419
1462
|
[BigInt64Array.name, e.INT64]
|
|
1420
1463
|
]);
|
|
1421
1464
|
static DENSITIES = new Map([
|
|
1422
|
-
[e.UINT8.toString(),
|
|
1423
|
-
[e.UINT16.toString(),
|
|
1424
|
-
[e.UINT32.toString(),
|
|
1425
|
-
[e.UINT64.toString(),
|
|
1426
|
-
[e.FLOAT32.toString(),
|
|
1427
|
-
[e.FLOAT64.toString(),
|
|
1428
|
-
[e.INT8.toString(),
|
|
1429
|
-
[e.INT16.toString(),
|
|
1430
|
-
[e.INT32.toString(),
|
|
1431
|
-
[e.INT64.toString(),
|
|
1432
|
-
[e.TIMESTAMP.toString(),
|
|
1433
|
-
[e.STRING.toString(),
|
|
1434
|
-
[e.JSON.toString(),
|
|
1435
|
-
[e.UUID.toString(),
|
|
1436
|
-
[e.BYTES.toString(),
|
|
1465
|
+
[e.UINT8.toString(), L.BIT8],
|
|
1466
|
+
[e.UINT16.toString(), L.BIT16],
|
|
1467
|
+
[e.UINT32.toString(), L.BIT32],
|
|
1468
|
+
[e.UINT64.toString(), L.BIT64],
|
|
1469
|
+
[e.FLOAT32.toString(), L.BIT32],
|
|
1470
|
+
[e.FLOAT64.toString(), L.BIT64],
|
|
1471
|
+
[e.INT8.toString(), L.BIT8],
|
|
1472
|
+
[e.INT16.toString(), L.BIT16],
|
|
1473
|
+
[e.INT32.toString(), L.BIT32],
|
|
1474
|
+
[e.INT64.toString(), L.BIT64],
|
|
1475
|
+
[e.TIMESTAMP.toString(), L.BIT64],
|
|
1476
|
+
[e.STRING.toString(), L.UNKNOWN],
|
|
1477
|
+
[e.JSON.toString(), L.UNKNOWN],
|
|
1478
|
+
[e.UUID.toString(), L.BIT128],
|
|
1479
|
+
[e.BYTES.toString(), L.UNKNOWN]
|
|
1437
1480
|
]);
|
|
1438
1481
|
static ALL = [
|
|
1439
1482
|
e.UNKNOWN,
|
|
@@ -1476,7 +1519,7 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1476
1519
|
e.TIMESTAMP
|
|
1477
1520
|
];
|
|
1478
1521
|
static z = t.union([t.string().transform((t) => new e(t)), t.instanceof(e)]);
|
|
1479
|
-
},
|
|
1522
|
+
}, B = class e extends C {
|
|
1480
1523
|
constructor(e) {
|
|
1481
1524
|
S(e) && (e = e.value), super(e.valueOf());
|
|
1482
1525
|
}
|
|
@@ -1487,16 +1530,16 @@ var gt = 365, N = 30, _t = t.union([
|
|
|
1487
1530
|
return S(e) && (e = e.value), this.valueOf() < e.valueOf();
|
|
1488
1531
|
}
|
|
1489
1532
|
add(t) {
|
|
1490
|
-
return S(t) && (t = t.value), new e(
|
|
1533
|
+
return S(t) && (t = t.value), new e(O(this.valueOf(), t.valueOf()));
|
|
1491
1534
|
}
|
|
1492
1535
|
sub(t) {
|
|
1493
|
-
return S(t) && (t = t.value), new e(
|
|
1536
|
+
return S(t) && (t = t.value), new e(D(this.valueOf(), t.valueOf()));
|
|
1494
1537
|
}
|
|
1495
1538
|
mult(t) {
|
|
1496
|
-
return new e(
|
|
1539
|
+
return new e(k(this.valueOf(), t));
|
|
1497
1540
|
}
|
|
1498
1541
|
div(t) {
|
|
1499
|
-
return new e(
|
|
1542
|
+
return new e(A(this.valueOf(), t));
|
|
1500
1543
|
}
|
|
1501
1544
|
truncate(t) {
|
|
1502
1545
|
return new e(Math.trunc(this.valueOf() / new e(t).valueOf()) * new e(t).valueOf());
|
|
@@ -1561,13 +1604,13 @@ t.object({
|
|
|
1561
1604
|
t.instanceof(Int32Array),
|
|
1562
1605
|
t.instanceof(BigInt64Array)
|
|
1563
1606
|
]);
|
|
1564
|
-
var
|
|
1607
|
+
var Dt = (e) => {
|
|
1565
1608
|
let t = typeof e;
|
|
1566
1609
|
return t === "string" || t === "number" || t === "boolean" || t === "bigint" || e instanceof P || e instanceof F || e instanceof Date;
|
|
1567
|
-
},
|
|
1568
|
-
|
|
1569
|
-
var
|
|
1570
|
-
let n =
|
|
1610
|
+
}, Ot = (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);
|
|
1611
|
+
R.z, P.z, F.z, I.z, B.z, z.z, R.boundedZ;
|
|
1612
|
+
var kt = (e, t = !1) => {
|
|
1613
|
+
let n = De(e) ? "stringer" : typeof e, r;
|
|
1571
1614
|
switch (n) {
|
|
1572
1615
|
case "string":
|
|
1573
1616
|
r = (e, t) => e.localeCompare(t);
|
|
@@ -1589,75 +1632,73 @@ var St = (e, t = !1) => {
|
|
|
1589
1632
|
break;
|
|
1590
1633
|
default: return console.warn(`sortFunc: unknown type ${n}`), () => -1;
|
|
1591
1634
|
}
|
|
1592
|
-
return t ?
|
|
1593
|
-
},
|
|
1635
|
+
return t ? At(r) : r;
|
|
1636
|
+
}, At = (e) => (t, n) => e(n, t), jt = (e, t = 21) => (n = t) => {
|
|
1594
1637
|
let r = "", i = n | 0;
|
|
1595
1638
|
for (; i--;) r += e[Math.random() * e.length | 0];
|
|
1596
1639
|
return r;
|
|
1597
|
-
},
|
|
1598
|
-
|
|
1599
|
-
x
|
|
1600
|
-
y
|
|
1640
|
+
}, Mt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Nt = `0123456789${Mt}`, Pt = jt(Mt, 1), Ft = jt(Nt, 10), It = () => `${Pt()}${Ft()}`, Lt = (e, t) => (n) => n instanceof t || typeof n == "object" && !!n && "discriminator" in n && n.discriminator === e;
|
|
1641
|
+
e.enum([
|
|
1642
|
+
"x",
|
|
1643
|
+
"y",
|
|
1644
|
+
...ot,
|
|
1645
|
+
...ct
|
|
1646
|
+
]);
|
|
1647
|
+
var Rt = ut;
|
|
1648
|
+
t.union([
|
|
1649
|
+
st,
|
|
1650
|
+
t.enum([...ot, ...ct]),
|
|
1651
|
+
t.instanceof(String)
|
|
1652
|
+
]), t.object({
|
|
1653
|
+
x: rt.or(lt),
|
|
1654
|
+
y: it.or(lt)
|
|
1601
1655
|
});
|
|
1602
|
-
var
|
|
1603
|
-
x: nt,
|
|
1604
|
-
y: rt
|
|
1605
|
-
}), Mt = Object.freeze({
|
|
1656
|
+
var zt = Object.freeze({
|
|
1606
1657
|
x: "left",
|
|
1607
1658
|
y: "top"
|
|
1608
|
-
}),
|
|
1659
|
+
}), Bt = Object.freeze({
|
|
1609
1660
|
x: "right",
|
|
1610
1661
|
y: "top"
|
|
1611
|
-
}),
|
|
1662
|
+
}), Vt = Object.freeze({
|
|
1612
1663
|
x: "left",
|
|
1613
1664
|
y: "bottom"
|
|
1614
|
-
}),
|
|
1665
|
+
}), Ht = Object.freeze({
|
|
1615
1666
|
x: "right",
|
|
1616
1667
|
y: "bottom"
|
|
1617
|
-
}),
|
|
1668
|
+
}), Ut = Object.freeze({
|
|
1618
1669
|
x: "center",
|
|
1619
1670
|
y: "center"
|
|
1620
|
-
}),
|
|
1671
|
+
}), Wt = Object.freeze({
|
|
1621
1672
|
x: "center",
|
|
1622
1673
|
y: "top"
|
|
1623
|
-
}),
|
|
1674
|
+
}), Gt = Object.freeze({
|
|
1624
1675
|
x: "center",
|
|
1625
1676
|
y: "bottom"
|
|
1626
|
-
}),
|
|
1677
|
+
}), Kt = Object.freeze({
|
|
1627
1678
|
x: "right",
|
|
1628
1679
|
y: "center"
|
|
1629
|
-
}),
|
|
1680
|
+
}), qt = Object.freeze({
|
|
1630
1681
|
x: "left",
|
|
1631
1682
|
y: "center"
|
|
1632
1683
|
});
|
|
1633
1684
|
Object.freeze([
|
|
1634
|
-
|
|
1685
|
+
qt,
|
|
1686
|
+
Kt,
|
|
1687
|
+
Wt,
|
|
1688
|
+
Gt,
|
|
1635
1689
|
zt,
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
Pt,
|
|
1641
|
-
Ft,
|
|
1642
|
-
It
|
|
1643
|
-
]);
|
|
1644
|
-
var Vt = (e, t) => e.x === t.x && e.y === t.y, Ht = (e) => [e.x, e.y];
|
|
1645
|
-
t.enum([
|
|
1646
|
-
"top",
|
|
1647
|
-
"right",
|
|
1648
|
-
"bottom",
|
|
1649
|
-
"left"
|
|
1690
|
+
Bt,
|
|
1691
|
+
Vt,
|
|
1692
|
+
Ht,
|
|
1693
|
+
Ut
|
|
1650
1694
|
]);
|
|
1651
|
-
var
|
|
1652
|
-
x: t.number(),
|
|
1653
|
-
y: t.number()
|
|
1654
|
-
}), Ut = t.union([
|
|
1695
|
+
var Jt = (e, t) => e.x === t.x && e.y === t.y, Yt = (e) => [e.x, e.y], Xt = t.union([
|
|
1655
1696
|
t.number(),
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1697
|
+
j,
|
|
1698
|
+
gt,
|
|
1699
|
+
ft,
|
|
1700
|
+
pt,
|
|
1701
|
+
mt
|
|
1661
1702
|
]), V = (e, t) => {
|
|
1662
1703
|
if (typeof e == "string") {
|
|
1663
1704
|
if (t === void 0) throw Error("The y coordinate must be given.");
|
|
@@ -1702,22 +1743,22 @@ Object.freeze({
|
|
|
1702
1743
|
x: NaN,
|
|
1703
1744
|
y: NaN
|
|
1704
1745
|
});
|
|
1705
|
-
var
|
|
1746
|
+
var Zt = (e, t) => {
|
|
1706
1747
|
let n = V(e);
|
|
1707
1748
|
return {
|
|
1708
1749
|
x: n.x + t,
|
|
1709
1750
|
y: n.y
|
|
1710
1751
|
};
|
|
1711
|
-
},
|
|
1752
|
+
}, Qt = (e, t) => {
|
|
1712
1753
|
let n = V(e);
|
|
1713
1754
|
return {
|
|
1714
1755
|
x: n.x,
|
|
1715
1756
|
y: n.y + t
|
|
1716
1757
|
};
|
|
1717
|
-
},
|
|
1758
|
+
}, $t = (e, t, n, ...r) => {
|
|
1718
1759
|
if (typeof t == "string") {
|
|
1719
1760
|
if (typeof n != "number") throw Error("The value must be a number.");
|
|
1720
|
-
return t === "x" ?
|
|
1761
|
+
return t === "x" ? Zt(e, n) : Qt(e, n);
|
|
1721
1762
|
}
|
|
1722
1763
|
if (typeof t == "object" && "x" in t && typeof t.x == "string") {
|
|
1723
1764
|
let r = V(n), i = V(e);
|
|
@@ -1750,15 +1791,15 @@ t.object({
|
|
|
1750
1791
|
right: t.number(),
|
|
1751
1792
|
bottom: t.number()
|
|
1752
1793
|
}), t.object({
|
|
1753
|
-
one:
|
|
1754
|
-
two:
|
|
1755
|
-
root:
|
|
1794
|
+
one: j,
|
|
1795
|
+
two: j,
|
|
1796
|
+
root: Rt
|
|
1756
1797
|
});
|
|
1757
1798
|
var W = (e, t, n = 0, r = 0, i) => {
|
|
1758
1799
|
let a = {
|
|
1759
1800
|
one: { ...H },
|
|
1760
1801
|
two: { ...H },
|
|
1761
|
-
root: i ??
|
|
1802
|
+
root: i ?? zt
|
|
1762
1803
|
};
|
|
1763
1804
|
if (typeof e == "number") {
|
|
1764
1805
|
if (typeof t != "number") throw Error("Box constructor called with invalid arguments");
|
|
@@ -1792,64 +1833,64 @@ var W = (e, t, n = 0, r = 0, i) => {
|
|
|
1792
1833
|
x: a.one.x + t.signedWidth,
|
|
1793
1834
|
y: a.one.y + t.signedHeight
|
|
1794
1835
|
} : a.two = t, a));
|
|
1795
|
-
},
|
|
1836
|
+
}, en = (e, t) => {
|
|
1796
1837
|
let n = W(e);
|
|
1797
1838
|
return {
|
|
1798
|
-
x: t.x === "center" ?
|
|
1799
|
-
y: t.y === "center" ?
|
|
1839
|
+
x: t.x === "center" ? on(n).x : tn(n, t.x),
|
|
1840
|
+
y: t.y === "center" ? on(n).y : tn(n, t.y)
|
|
1800
1841
|
};
|
|
1801
|
-
},
|
|
1802
|
-
let n = W(e), r =
|
|
1803
|
-
return
|
|
1804
|
-
},
|
|
1842
|
+
}, tn = (e, t) => {
|
|
1843
|
+
let n = W(e), r = Yt(n.root).includes(t) ? Math.min : Math.max;
|
|
1844
|
+
return nt.includes(t) ? r(n.one.x, n.two.x) : r(n.one.y, n.two.y);
|
|
1845
|
+
}, nn = (e) => {
|
|
1805
1846
|
let t = W(e);
|
|
1806
1847
|
return t.two.x - t.one.x;
|
|
1807
|
-
},
|
|
1848
|
+
}, rn = (e) => {
|
|
1808
1849
|
let t = W(e);
|
|
1809
1850
|
return t.two.y - t.one.y;
|
|
1810
|
-
},
|
|
1811
|
-
x:
|
|
1812
|
-
y:
|
|
1813
|
-
}),
|
|
1851
|
+
}, an = (e) => en(e, zt), on = (e) => $t(an(e), {
|
|
1852
|
+
x: nn(e) / 2,
|
|
1853
|
+
y: rn(e) / 2
|
|
1854
|
+
}), sn = (e) => {
|
|
1814
1855
|
let t = W(e);
|
|
1815
1856
|
return {
|
|
1816
1857
|
lower: t.one.x,
|
|
1817
1858
|
upper: t.two.x
|
|
1818
1859
|
};
|
|
1819
|
-
},
|
|
1860
|
+
}, cn = (e) => {
|
|
1820
1861
|
let t = W(e);
|
|
1821
1862
|
return {
|
|
1822
1863
|
lower: t.one.y,
|
|
1823
1864
|
upper: t.two.y
|
|
1824
1865
|
};
|
|
1825
|
-
},
|
|
1866
|
+
}, ln = (e) => typeof e != "object" || !e ? !1 : "one" in e && "two" in e && "root" in e;
|
|
1826
1867
|
t.union([
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1868
|
+
ft,
|
|
1869
|
+
pt,
|
|
1870
|
+
j,
|
|
1871
|
+
gt
|
|
1831
1872
|
]);
|
|
1832
|
-
var
|
|
1873
|
+
var un = (e, t, n) => t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e;
|
|
1833
1874
|
t.object({
|
|
1834
|
-
offset:
|
|
1835
|
-
scale:
|
|
1875
|
+
offset: Xt,
|
|
1876
|
+
scale: Xt
|
|
1836
1877
|
}), t.object({
|
|
1837
1878
|
offset: t.number(),
|
|
1838
1879
|
scale: t.number()
|
|
1839
1880
|
});
|
|
1840
|
-
var
|
|
1881
|
+
var dn = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r + e], fn = (e) => (t, n, r, i) => [t, i ? r / e : r * e], pn = (e) => (t, n, r) => {
|
|
1841
1882
|
if (t === null) return [e, r];
|
|
1842
1883
|
let { lower: i, upper: a } = t, { lower: o, upper: s } = e, c = a - i, l = s - o;
|
|
1843
1884
|
return n === "dimension" ? [e, l / c * r] : [e, (r - i) * (l / c) + o];
|
|
1844
|
-
},
|
|
1885
|
+
}, mn = (e) => (t, n, r) => [e, r], hn = () => (e, t, n) => {
|
|
1845
1886
|
if (e === null) throw Error("cannot invert without bounds");
|
|
1846
1887
|
if (t === "dimension") return [e, n];
|
|
1847
1888
|
let { lower: r, upper: i } = e;
|
|
1848
1889
|
return [e, i - (n - r)];
|
|
1849
|
-
},
|
|
1890
|
+
}, gn = (e) => (t, n, r) => {
|
|
1850
1891
|
let { lower: i, upper: a } = e;
|
|
1851
|
-
return r =
|
|
1852
|
-
},
|
|
1892
|
+
return r = un(r, i, a), [t, r];
|
|
1893
|
+
}, _n = class e {
|
|
1853
1894
|
ops = [];
|
|
1854
1895
|
currBounds = null;
|
|
1855
1896
|
currType = null;
|
|
@@ -1867,27 +1908,27 @@ var rn = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r +
|
|
|
1867
1908
|
return new e().scale(t, n);
|
|
1868
1909
|
}
|
|
1869
1910
|
translate(e) {
|
|
1870
|
-
let t = this.new(), n =
|
|
1911
|
+
let t = this.new(), n = dn(e);
|
|
1871
1912
|
return n.type = "translate", t.ops.push(n), t;
|
|
1872
1913
|
}
|
|
1873
1914
|
magnify(e) {
|
|
1874
|
-
let t = this.new(), n =
|
|
1915
|
+
let t = this.new(), n = fn(e);
|
|
1875
1916
|
return n.type = "magnify", t.ops.push(n), t;
|
|
1876
1917
|
}
|
|
1877
1918
|
scale(e, t) {
|
|
1878
|
-
let n = M(e, t), r = this.new(), i =
|
|
1919
|
+
let n = M(e, t), r = this.new(), i = pn(n);
|
|
1879
1920
|
return i.type = "scale", r.ops.push(i), r;
|
|
1880
1921
|
}
|
|
1881
1922
|
clamp(e, t) {
|
|
1882
|
-
let n = M(e, t), r = this.new(), i =
|
|
1923
|
+
let n = M(e, t), r = this.new(), i = gn(n);
|
|
1883
1924
|
return i.type = "clamp", r.ops.push(i), r;
|
|
1884
1925
|
}
|
|
1885
1926
|
reBound(e, t) {
|
|
1886
|
-
let n = M(e, t), r = this.new(), i =
|
|
1927
|
+
let n = M(e, t), r = this.new(), i = mn(n);
|
|
1887
1928
|
return i.type = "re-bound", r.ops.push(i), r;
|
|
1888
1929
|
}
|
|
1889
1930
|
invert() {
|
|
1890
|
-
let e =
|
|
1931
|
+
let e = hn();
|
|
1891
1932
|
e.type = "invert";
|
|
1892
1933
|
let t = this.new();
|
|
1893
1934
|
return t.ops.push(e), t;
|
|
@@ -1930,7 +1971,7 @@ var rn = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r +
|
|
|
1930
1971
|
x;
|
|
1931
1972
|
y;
|
|
1932
1973
|
currRoot;
|
|
1933
|
-
constructor(e = new
|
|
1974
|
+
constructor(e = new _n(), t = new _n(), n = null) {
|
|
1934
1975
|
this.x = e, this.y = t, this.currRoot = n;
|
|
1935
1976
|
}
|
|
1936
1977
|
static translate(t, n) {
|
|
@@ -1972,19 +2013,19 @@ var rn = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r +
|
|
|
1972
2013
|
}
|
|
1973
2014
|
scale(e) {
|
|
1974
2015
|
let t = this.copy();
|
|
1975
|
-
if (
|
|
2016
|
+
if (ln(e)) {
|
|
1976
2017
|
let n = this.currRoot;
|
|
1977
|
-
return t.currRoot = e.root, n != null && !
|
|
2018
|
+
return t.currRoot = e.root, n != null && !Jt(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(sn(e)), t.y = t.y.scale(cn(e)), t;
|
|
1978
2019
|
}
|
|
1979
2020
|
return t.x = t.x.scale(e.width), t.y = t.y.scale(e.height), t;
|
|
1980
2021
|
}
|
|
1981
2022
|
reBound(e) {
|
|
1982
2023
|
let t = this.copy();
|
|
1983
|
-
return t.x = this.x.reBound(
|
|
2024
|
+
return t.x = this.x.reBound(sn(e)), t.y = this.y.reBound(cn(e)), t;
|
|
1984
2025
|
}
|
|
1985
2026
|
clamp(e) {
|
|
1986
2027
|
let t = this.copy();
|
|
1987
|
-
return t.x = this.x.clamp(
|
|
2028
|
+
return t.x = this.x.clamp(sn(e)), t.y = this.y.clamp(cn(e)), t;
|
|
1988
2029
|
}
|
|
1989
2030
|
copy() {
|
|
1990
2031
|
let t = new e();
|
|
@@ -2022,48 +2063,49 @@ var rn = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r +
|
|
|
2022
2063
|
};
|
|
2023
2064
|
}
|
|
2024
2065
|
static IDENTITY = new e();
|
|
2025
|
-
}),
|
|
2026
|
-
root: jt,
|
|
2027
|
-
units: e.object({
|
|
2028
|
-
x: e.enum(["px", "decimal"]),
|
|
2029
|
-
y: e.enum(["px", "decimal"])
|
|
2030
|
-
})
|
|
2031
|
-
}).partial({
|
|
2066
|
+
}), ht.required({
|
|
2032
2067
|
root: !0,
|
|
2033
2068
|
units: !0
|
|
2034
2069
|
});
|
|
2035
|
-
var
|
|
2036
|
-
function
|
|
2037
|
-
return typeof e == "string" &&
|
|
2070
|
+
var vn = t.enum(["static", "dynamic"]), yn = /^(?:[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;
|
|
2071
|
+
function bn(e) {
|
|
2072
|
+
return typeof e == "string" && yn.test(e);
|
|
2038
2073
|
}
|
|
2039
2074
|
var G = [];
|
|
2040
2075
|
for (let e = 0; e < 256; ++e) G.push((e + 256).toString(16).slice(1));
|
|
2041
|
-
function
|
|
2076
|
+
function xn(e, t = 0) {
|
|
2042
2077
|
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();
|
|
2043
2078
|
}
|
|
2044
|
-
function
|
|
2045
|
-
let n =
|
|
2046
|
-
if (!
|
|
2079
|
+
function Sn(e, t = 0) {
|
|
2080
|
+
let n = xn(e, t);
|
|
2081
|
+
if (!bn(n)) throw TypeError("Stringified UUID is invalid");
|
|
2047
2082
|
return n;
|
|
2048
2083
|
}
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2084
|
+
var Cn = (e, t) => Sn(e, t), wn = (e) => {
|
|
2085
|
+
let t = Math.fround(e);
|
|
2086
|
+
if (!Number.isFinite(t)) return t.toString();
|
|
2087
|
+
for (let e = 1; e <= 9; e++) {
|
|
2088
|
+
let n = parseFloat(t.toPrecision(e));
|
|
2089
|
+
if (Math.fround(n) === t) return n.toString();
|
|
2090
|
+
}
|
|
2091
|
+
return t.toString();
|
|
2092
|
+
}, K = -1, Tn = {
|
|
2093
|
+
[Symbol.iterator]: () => Tn,
|
|
2052
2094
|
next: () => ({
|
|
2053
2095
|
done: !0,
|
|
2054
2096
|
value: void 0
|
|
2055
2097
|
})
|
|
2056
|
-
},
|
|
2098
|
+
}, En = t.string().transform((e) => new Uint8Array(atob(e).split("").map((e) => e.charCodeAt(0))).buffer), Dn = t.union([t.null(), t.undefined()]).transform(() => new Uint8Array().buffer), q = 4, On = (e, t) => {
|
|
2057
2099
|
if (e === "number" && !t.isNumeric) throw Error(`cannot convert series of type ${t.toString()} to number`);
|
|
2058
2100
|
if (e === "bigint" && !t.usesBigInt) throw Error(`cannot convert series of type ${t.toString()} to bigint`);
|
|
2059
|
-
},
|
|
2101
|
+
}, kn = "sy_x_telem_series", An = class e {
|
|
2060
2102
|
key;
|
|
2061
|
-
discriminator =
|
|
2103
|
+
discriminator = kn;
|
|
2062
2104
|
dataType;
|
|
2063
2105
|
sampleOffset;
|
|
2064
2106
|
gl;
|
|
2065
2107
|
_data;
|
|
2066
|
-
timeRange =
|
|
2108
|
+
timeRange = R.ZERO;
|
|
2067
2109
|
alignment = 0n;
|
|
2068
2110
|
alignmentMultiple = 1n;
|
|
2069
2111
|
cachedMin;
|
|
@@ -2073,28 +2115,28 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2073
2115
|
cachedLength;
|
|
2074
2116
|
_cachedIndexes;
|
|
2075
2117
|
static crudeZ = t.object({
|
|
2076
|
-
timeRange:
|
|
2077
|
-
dataType:
|
|
2118
|
+
timeRange: R.z.optional(),
|
|
2119
|
+
dataType: z.z,
|
|
2078
2120
|
alignment: t.coerce.bigint().optional(),
|
|
2079
2121
|
data: t.union([
|
|
2080
|
-
|
|
2081
|
-
|
|
2122
|
+
En,
|
|
2123
|
+
Dn,
|
|
2082
2124
|
t.instanceof(ArrayBuffer),
|
|
2083
2125
|
t.instanceof(Uint8Array)
|
|
2084
|
-
]),
|
|
2085
|
-
glBufferUsage:
|
|
2126
|
+
]).default(() => new Uint8Array().buffer),
|
|
2127
|
+
glBufferUsage: vn.default("static").optional()
|
|
2086
2128
|
});
|
|
2087
2129
|
static z = e.crudeZ.transform((t) => new e(t));
|
|
2088
2130
|
constructor(e) {
|
|
2089
|
-
|
|
2090
|
-
let { dataType: t, timeRange: n, sampleOffset: r = 0, glBufferUsage: i = "static", alignment: a = 0n, alignmentMultiple: o = 1n, key: s =
|
|
2091
|
-
if (
|
|
2131
|
+
jn(e) && (e = { data: e }), e.data ??= [];
|
|
2132
|
+
let { dataType: t, timeRange: n, sampleOffset: r = 0, glBufferUsage: i = "static", alignment: a = 0n, alignmentMultiple: o = 1n, key: s = It(), data: c } = e;
|
|
2133
|
+
if (Mn(c)) {
|
|
2092
2134
|
let e = c;
|
|
2093
2135
|
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;
|
|
2094
2136
|
return;
|
|
2095
2137
|
}
|
|
2096
|
-
let l =
|
|
2097
|
-
if (t != null) this.dataType = new
|
|
2138
|
+
let l = Dt(c), u = Array.isArray(c);
|
|
2139
|
+
if (t != null) this.dataType = new z(t);
|
|
2098
2140
|
else if (c instanceof ArrayBuffer) throw Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");
|
|
2099
2141
|
else if (u || l) {
|
|
2100
2142
|
let e = c;
|
|
@@ -2102,31 +2144,31 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2102
2144
|
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.");
|
|
2103
2145
|
e = c[0];
|
|
2104
2146
|
}
|
|
2105
|
-
if (typeof e == "string") this.dataType =
|
|
2106
|
-
else if (typeof e == "number") this.dataType =
|
|
2107
|
-
else if (typeof e == "bigint") this.dataType =
|
|
2108
|
-
else if (typeof e == "boolean") this.dataType =
|
|
2109
|
-
else if (e instanceof P || e instanceof Date || e instanceof P) this.dataType =
|
|
2110
|
-
else if (typeof e == "object") this.dataType =
|
|
2147
|
+
if (typeof e == "string") this.dataType = z.STRING;
|
|
2148
|
+
else if (typeof e == "number") this.dataType = z.FLOAT64;
|
|
2149
|
+
else if (typeof e == "bigint") this.dataType = z.INT64;
|
|
2150
|
+
else if (typeof e == "boolean") this.dataType = z.UINT8;
|
|
2151
|
+
else if (e instanceof P || e instanceof Date || e instanceof P) this.dataType = z.TIMESTAMP;
|
|
2152
|
+
else if (typeof e == "object") this.dataType = z.JSON;
|
|
2111
2153
|
else throw Error(`cannot infer data type of ${typeof e} when constructing a Series from a JS array`);
|
|
2112
|
-
} else this.dataType = new
|
|
2154
|
+
} else this.dataType = new z(c);
|
|
2113
2155
|
if (!u && !l) this._data = c;
|
|
2114
2156
|
else if (u && c.length === 0) this._data = new this.dataType.Array([]).buffer;
|
|
2115
2157
|
else {
|
|
2116
2158
|
let e = l ? [c] : c, t = e[0];
|
|
2117
|
-
if ((t instanceof P || t instanceof Date || t instanceof F) && (e = e.map((e) => new P(e).valueOf())), this.dataType.equals(
|
|
2159
|
+
if ((t instanceof P || t instanceof Date || t instanceof F) && (e = e.map((e) => new P(e).valueOf())), this.dataType.equals(z.STRING)) {
|
|
2118
2160
|
this.cachedLength = e.length;
|
|
2119
2161
|
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;
|
|
2120
2162
|
for (let e of t) i.setUint32(o, e.byteLength, !0), o += q, a.set(e, o), o += e.byteLength;
|
|
2121
2163
|
this._data = r;
|
|
2122
|
-
} else if (this.dataType.equals(
|
|
2164
|
+
} else if (this.dataType.equals(z.JSON)) {
|
|
2123
2165
|
this.cachedLength = e.length;
|
|
2124
|
-
let t = e.map((e) => new TextEncoder().encode(
|
|
2166
|
+
let t = e.map((e) => new TextEncoder().encode(Ct.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;
|
|
2125
2167
|
for (let e of t) i.setUint32(o, e.byteLength, !0), o += q, a.set(e, o), o += e.byteLength;
|
|
2126
2168
|
this._data = r;
|
|
2127
2169
|
} 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;
|
|
2128
2170
|
}
|
|
2129
|
-
this.key = s, this.alignment = a, this.alignmentMultiple = o, this.sampleOffset = r ?? 0, this.timeRange = n ??
|
|
2171
|
+
this.key = s, this.alignment = a, this.alignmentMultiple = o, this.sampleOffset = r ?? 0, this.timeRange = n ?? R.ZERO, this.gl = {
|
|
2130
2172
|
control: null,
|
|
2131
2173
|
buffer: null,
|
|
2132
2174
|
prevBuffer: 0,
|
|
@@ -2136,7 +2178,7 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2136
2178
|
static alloc({ capacity: t, dataType: n, ...r }) {
|
|
2137
2179
|
if (t === 0) throw Error("[Series] - cannot allocate an array of length 0");
|
|
2138
2180
|
let i = new e({
|
|
2139
|
-
data: new new
|
|
2181
|
+
data: new new z(n).Array(t).buffer,
|
|
2140
2182
|
dataType: n,
|
|
2141
2183
|
...r
|
|
2142
2184
|
});
|
|
@@ -2196,17 +2238,17 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2196
2238
|
return Array.from(this).map((e) => e.toString());
|
|
2197
2239
|
}
|
|
2198
2240
|
parseJSON(e) {
|
|
2199
|
-
if (!this.dataType.equals(
|
|
2200
|
-
return this.toStrings().map((t) => e.parse(
|
|
2241
|
+
if (!this.dataType.equals(z.JSON)) throw Error("cannot parse non-JSON series as JSON");
|
|
2242
|
+
return this.toStrings().map((t) => e.parse(Ct.decodeString(t)));
|
|
2201
2243
|
}
|
|
2202
2244
|
get byteCapacity() {
|
|
2203
|
-
return new
|
|
2245
|
+
return new B(this.underlyingData.byteLength);
|
|
2204
2246
|
}
|
|
2205
2247
|
get capacity() {
|
|
2206
2248
|
return this.dataType.isVariable ? this.byteCapacity.valueOf() : this.dataType.density.length(this.byteCapacity);
|
|
2207
2249
|
}
|
|
2208
2250
|
get byteLength() {
|
|
2209
|
-
return this.writePos === K ? this.byteCapacity : this.dataType.isVariable ? new
|
|
2251
|
+
return this.writePos === K ? this.byteCapacity : this.dataType.isVariable ? new B(this.writePos) : this.dataType.density.size(this.writePos);
|
|
2210
2252
|
}
|
|
2211
2253
|
get length() {
|
|
2212
2254
|
return this.cachedLength == null ? this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === K ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos : this.cachedLength;
|
|
@@ -2223,7 +2265,7 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2223
2265
|
convert(t, n = 0) {
|
|
2224
2266
|
if (this.dataType.equals(t)) return this;
|
|
2225
2267
|
let r = new t.Array(this.length);
|
|
2226
|
-
for (let e = 0; e < this.length; e++) r[e] =
|
|
2268
|
+
for (let e = 0; e < this.length; e++) r[e] = Ot(this.dataType, t, this.data[e], n);
|
|
2227
2269
|
return new e({
|
|
2228
2270
|
data: r.buffer,
|
|
2229
2271
|
dataType: t,
|
|
@@ -2234,24 +2276,42 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2234
2276
|
});
|
|
2235
2277
|
}
|
|
2236
2278
|
calcRawMax() {
|
|
2237
|
-
|
|
2279
|
+
if (this.length === 0) return -Infinity;
|
|
2280
|
+
if (this.dataType.equals(z.TIMESTAMP)) this.cachedMax = this.data[this.data.length - 1];
|
|
2281
|
+
else if (this.dataType.usesBigInt) {
|
|
2282
|
+
let e = this.data;
|
|
2283
|
+
this.cachedMax = e.reduce((e, t) => e > t ? e : t);
|
|
2284
|
+
} else {
|
|
2285
|
+
let e = this.data;
|
|
2286
|
+
this.cachedMax = e.reduce((e, t) => e > t ? e : t);
|
|
2287
|
+
}
|
|
2288
|
+
return this.cachedMax;
|
|
2238
2289
|
}
|
|
2239
2290
|
get max() {
|
|
2240
2291
|
return this.calcMax();
|
|
2241
2292
|
}
|
|
2242
2293
|
calcMax() {
|
|
2243
2294
|
if (this.dataType.isVariable) throw Error("cannot calculate maximum on a variable length data type");
|
|
2244
|
-
return this.writePos === 0 ? -Infinity : (this.cachedMax ??= this.calcRawMax(),
|
|
2295
|
+
return this.writePos === 0 ? -Infinity : (this.cachedMax ??= this.calcRawMax(), this.applyOffset(this.cachedMax));
|
|
2245
2296
|
}
|
|
2246
2297
|
calcRawMin() {
|
|
2247
|
-
|
|
2298
|
+
if (this.length === 0) return Infinity;
|
|
2299
|
+
if (this.dataType.equals(z.TIMESTAMP)) this.cachedMin = this.data[0];
|
|
2300
|
+
else if (this.dataType.usesBigInt) {
|
|
2301
|
+
let e = this.data;
|
|
2302
|
+
this.cachedMin = e.reduce((e, t) => e < t ? e : t);
|
|
2303
|
+
} else {
|
|
2304
|
+
let e = this.data;
|
|
2305
|
+
this.cachedMin = e.reduce((e, t) => e < t ? e : t);
|
|
2306
|
+
}
|
|
2307
|
+
return this.cachedMin;
|
|
2248
2308
|
}
|
|
2249
2309
|
get min() {
|
|
2250
2310
|
return this.calcMin();
|
|
2251
2311
|
}
|
|
2252
2312
|
calcMin() {
|
|
2253
2313
|
if (this.dataType.isVariable) throw Error("cannot calculate minimum on a variable length data type");
|
|
2254
|
-
return this.writePos === 0 ? Infinity : (this.cachedMin ??= this.calcRawMin(),
|
|
2314
|
+
return this.writePos === 0 ? Infinity : (this.cachedMin ??= this.calcRawMin(), this.applyOffset(this.cachedMin));
|
|
2255
2315
|
}
|
|
2256
2316
|
get bounds() {
|
|
2257
2317
|
return M(Number(this.min), Number(this.max), { makeValid: !1 });
|
|
@@ -2275,25 +2335,37 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2275
2335
|
return this.at(n, t);
|
|
2276
2336
|
}
|
|
2277
2337
|
at(e, t = !1) {
|
|
2278
|
-
if (this.dataType.isVariable)
|
|
2279
|
-
|
|
2338
|
+
if (this.dataType.isVariable) {
|
|
2339
|
+
let n = this.atVariable(e, t);
|
|
2340
|
+
return n == null ? void 0 : this.dataType.equals(z.STRING) ? n : f(JSON.parse(n));
|
|
2341
|
+
}
|
|
2342
|
+
if (this.dataType.equals(z.UUID)) return this.atUUID(e, t);
|
|
2280
2343
|
e < 0 && (e = this.length + e);
|
|
2281
2344
|
let n = this.data[e];
|
|
2282
2345
|
if (n == null) {
|
|
2283
2346
|
if (t === !0) throw Error(`[series] - no value at index ${e}`);
|
|
2284
2347
|
return;
|
|
2285
2348
|
}
|
|
2286
|
-
return
|
|
2349
|
+
return this.applyOffset(n);
|
|
2350
|
+
}
|
|
2351
|
+
applyOffset(e) {
|
|
2352
|
+
return typeof this.sampleOffset == "bigint" && typeof e == "number" ? BigInt(Math.round(e)) + this.sampleOffset : O(e, this.sampleOffset);
|
|
2287
2353
|
}
|
|
2288
2354
|
atUUID(e, t) {
|
|
2289
2355
|
e < 0 && (e = this.length + e);
|
|
2290
|
-
let n =
|
|
2356
|
+
let n = Cn(new Uint8Array(this.buffer, e * this.dataType.density.valueOf()));
|
|
2291
2357
|
if (n == null) {
|
|
2292
2358
|
if (t) throw Error(`[series] - no value at index ${e}`);
|
|
2293
2359
|
return;
|
|
2294
2360
|
}
|
|
2295
2361
|
return n;
|
|
2296
2362
|
}
|
|
2363
|
+
asString(e, t = !1) {
|
|
2364
|
+
if (this.dataType.isVariable) return this.atVariable(e, t);
|
|
2365
|
+
if (this.dataType.equals(z.UUID)) return this.atUUID(e, t);
|
|
2366
|
+
let n = this.at(e, t);
|
|
2367
|
+
if (n != null) return this.dataType.equals(z.FLOAT32) ? wn(n) : String(n);
|
|
2368
|
+
}
|
|
2297
2369
|
atVariable(e, t) {
|
|
2298
2370
|
let n = 0, r = 0, i = this.buffer, a = new DataView(i);
|
|
2299
2371
|
if (this._cachedIndexes != null) {
|
|
@@ -2319,10 +2391,10 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2319
2391
|
}
|
|
2320
2392
|
}
|
|
2321
2393
|
let o = new Uint8Array(i, n, r);
|
|
2322
|
-
return
|
|
2394
|
+
return new TextDecoder().decode(o);
|
|
2323
2395
|
}
|
|
2324
2396
|
binarySearch(e) {
|
|
2325
|
-
let t = 0, n = this.length - 1, r =
|
|
2397
|
+
let t = 0, n = this.length - 1, r = kt(e);
|
|
2326
2398
|
for (; t <= n;) {
|
|
2327
2399
|
let i = Math.floor((t + n) / 2), a = r(this.at(i, !0), e);
|
|
2328
2400
|
if (a === 0) return i;
|
|
@@ -2331,7 +2403,7 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2331
2403
|
return t;
|
|
2332
2404
|
}
|
|
2333
2405
|
updateGLBuffer(e) {
|
|
2334
|
-
if (this.gl.control = e, !this.dataType.equals(
|
|
2406
|
+
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");
|
|
2335
2407
|
let { buffer: t, bufferUsage: n, prevBuffer: r } = this.gl;
|
|
2336
2408
|
if (t ?? (this.gl.buffer = e.createBuffer()), this.writePos !== r) if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== K) {
|
|
2337
2409
|
r === 0 && e.bufferData(e.ARRAY_BUFFER, this.byteCapacity.valueOf(), e.STATIC_DRAW);
|
|
@@ -2340,7 +2412,7 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2340
2412
|
} else e.bufferData(e.ARRAY_BUFFER, this.buffer, n === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW), this.gl.prevBuffer = K;
|
|
2341
2413
|
}
|
|
2342
2414
|
as(e) {
|
|
2343
|
-
return
|
|
2415
|
+
return On(e, this.dataType), this;
|
|
2344
2416
|
}
|
|
2345
2417
|
get digest() {
|
|
2346
2418
|
return {
|
|
@@ -2348,8 +2420,8 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2348
2420
|
dataType: this.dataType.toString(),
|
|
2349
2421
|
sampleOffset: this.sampleOffset,
|
|
2350
2422
|
alignment: {
|
|
2351
|
-
lower:
|
|
2352
|
-
upper:
|
|
2423
|
+
lower: Rn(this.alignmentBounds.lower),
|
|
2424
|
+
upper: Rn(this.alignmentBounds.upper),
|
|
2353
2425
|
multiple: this.alignmentMultiple
|
|
2354
2426
|
},
|
|
2355
2427
|
timeRange: this.timeRange.toString(),
|
|
@@ -2369,10 +2441,10 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2369
2441
|
}
|
|
2370
2442
|
[Symbol.iterator]() {
|
|
2371
2443
|
if (this.dataType.isVariable) {
|
|
2372
|
-
let e = new
|
|
2373
|
-
return this.dataType.equals(
|
|
2444
|
+
let e = new Pn(this);
|
|
2445
|
+
return this.dataType.equals(z.JSON) ? new Fn(e) : e;
|
|
2374
2446
|
}
|
|
2375
|
-
return this.dataType.equals(
|
|
2447
|
+
return this.dataType.equals(z.UUID) ? new In(this) : new Ln(this);
|
|
2376
2448
|
}
|
|
2377
2449
|
slice(e, t) {
|
|
2378
2450
|
return this.sliceSub(!1, e, t);
|
|
@@ -2381,11 +2453,11 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2381
2453
|
return this.sliceSub(!0, e, t);
|
|
2382
2454
|
}
|
|
2383
2455
|
subIterator(e, t) {
|
|
2384
|
-
return new
|
|
2456
|
+
return new Nn(this, e, t ?? this.length);
|
|
2385
2457
|
}
|
|
2386
2458
|
subAlignmentIterator(e, t) {
|
|
2387
2459
|
let n = Math.ceil(Number(e - this.alignment) / Number(this.alignmentMultiple)), r = Math.ceil(Number(t - this.alignment) / Number(this.alignmentMultiple));
|
|
2388
|
-
return new
|
|
2460
|
+
return new Nn(this, n, r);
|
|
2389
2461
|
}
|
|
2390
2462
|
subBytes(t, n) {
|
|
2391
2463
|
return t >= 0 && (n == null || n >= this.byteLength.valueOf()) ? this : new e({
|
|
@@ -2413,7 +2485,7 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2413
2485
|
return new e({
|
|
2414
2486
|
data: this.buffer,
|
|
2415
2487
|
dataType: this.dataType,
|
|
2416
|
-
timeRange:
|
|
2488
|
+
timeRange: R.ZERO,
|
|
2417
2489
|
sampleOffset: this.sampleOffset,
|
|
2418
2490
|
glBufferUsage: "static",
|
|
2419
2491
|
alignment: t
|
|
@@ -2429,14 +2501,14 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2429
2501
|
}
|
|
2430
2502
|
return e += "])", e;
|
|
2431
2503
|
}
|
|
2432
|
-
},
|
|
2504
|
+
}, jn = (e) => e == null ? !1 : Array.isArray(e) || e instanceof ArrayBuffer || ArrayBuffer.isView(e) && !(e instanceof DataView) || e instanceof An ? !0 : Dt(e), Mn = Lt(kn, An), Nn = class {
|
|
2433
2505
|
series;
|
|
2434
2506
|
end;
|
|
2435
2507
|
index;
|
|
2436
2508
|
constructor(e, t, n) {
|
|
2437
2509
|
this.series = e;
|
|
2438
2510
|
let r = M(0, e.length + 1);
|
|
2439
|
-
this.end =
|
|
2511
|
+
this.end = vt(r, n), this.index = vt(r, t);
|
|
2440
2512
|
}
|
|
2441
2513
|
next() {
|
|
2442
2514
|
return this.index >= this.end ? {
|
|
@@ -2447,7 +2519,7 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2447
2519
|
value: this.series.at(this.index++, !0)
|
|
2448
2520
|
};
|
|
2449
2521
|
}
|
|
2450
|
-
},
|
|
2522
|
+
}, Pn = class {
|
|
2451
2523
|
series;
|
|
2452
2524
|
byteOffset;
|
|
2453
2525
|
decoder;
|
|
@@ -2470,7 +2542,7 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2470
2542
|
value: n
|
|
2471
2543
|
};
|
|
2472
2544
|
}
|
|
2473
|
-
},
|
|
2545
|
+
}, Fn = class e {
|
|
2474
2546
|
wrapped;
|
|
2475
2547
|
static schema = t.record(t.string(), t.unknown());
|
|
2476
2548
|
constructor(e) {
|
|
@@ -2483,30 +2555,30 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2483
2555
|
value: void 0
|
|
2484
2556
|
} : {
|
|
2485
2557
|
done: !1,
|
|
2486
|
-
value:
|
|
2558
|
+
value: Ct.decodeString(t.value, e.schema)
|
|
2487
2559
|
};
|
|
2488
2560
|
}
|
|
2489
|
-
},
|
|
2561
|
+
}, In = class {
|
|
2490
2562
|
series;
|
|
2491
2563
|
index;
|
|
2492
2564
|
data;
|
|
2493
2565
|
density;
|
|
2494
2566
|
constructor(e) {
|
|
2495
|
-
if (!e.dataType.equals(
|
|
2496
|
-
this.series = e, this.index = 0, this.data = new Uint8Array(e.buffer), this.density =
|
|
2567
|
+
if (!e.dataType.equals(z.UUID)) throw Error("cannot create a UUID series iterator for a non-UUID series");
|
|
2568
|
+
this.series = e, this.index = 0, this.data = new Uint8Array(e.buffer), this.density = z.UUID.density.valueOf();
|
|
2497
2569
|
}
|
|
2498
2570
|
next() {
|
|
2499
2571
|
if (this.index >= this.series.length) return {
|
|
2500
2572
|
done: !0,
|
|
2501
2573
|
value: void 0
|
|
2502
2574
|
};
|
|
2503
|
-
let e =
|
|
2575
|
+
let e = Cn(this.data, this.index * this.density);
|
|
2504
2576
|
return this.index++, {
|
|
2505
2577
|
done: !1,
|
|
2506
2578
|
value: e
|
|
2507
2579
|
};
|
|
2508
2580
|
}
|
|
2509
|
-
},
|
|
2581
|
+
}, Ln = class {
|
|
2510
2582
|
series;
|
|
2511
2583
|
index;
|
|
2512
2584
|
constructor(e) {
|
|
@@ -2521,13 +2593,23 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2521
2593
|
value: this.series.at(this.index++, !0)
|
|
2522
2594
|
};
|
|
2523
2595
|
}
|
|
2524
|
-
},
|
|
2596
|
+
}, Rn = (e) => ({
|
|
2525
2597
|
domain: e >> 32n,
|
|
2526
2598
|
sample: e & 4294967295n
|
|
2527
|
-
})
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2599
|
+
});
|
|
2600
|
+
t.enum([
|
|
2601
|
+
"ISO",
|
|
2602
|
+
"ISODate",
|
|
2603
|
+
"time",
|
|
2604
|
+
"preciseTime",
|
|
2605
|
+
"date",
|
|
2606
|
+
"preciseDate",
|
|
2607
|
+
"dateTime"
|
|
2608
|
+
]), t.enum(["local", "UTC"]);
|
|
2609
|
+
var zn = async (e) => await new Promise((t) => setTimeout(t, F.fromMilliseconds(e).milliseconds)), Bn = /* @__PURE__ */ r({
|
|
2610
|
+
Breaker: () => Vn,
|
|
2611
|
+
breakerConfigZ: () => Hn
|
|
2612
|
+
}), Vn = class {
|
|
2531
2613
|
config;
|
|
2532
2614
|
retries;
|
|
2533
2615
|
interval;
|
|
@@ -2536,7 +2618,7 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2536
2618
|
baseInterval: new F(e?.baseInterval ?? F.seconds(1)),
|
|
2537
2619
|
maxRetries: e?.maxRetries ?? 5,
|
|
2538
2620
|
scale: e?.scale ?? 1,
|
|
2539
|
-
sleepFn: e?.sleepFn ??
|
|
2621
|
+
sleepFn: e?.sleepFn ?? zn
|
|
2540
2622
|
}, this.retries = 0, this.interval = new F(this.config.baseInterval);
|
|
2541
2623
|
}
|
|
2542
2624
|
async wait() {
|
|
@@ -2549,38 +2631,38 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2549
2631
|
reset() {
|
|
2550
2632
|
this.retries = 0, this.interval = this.config.baseInterval;
|
|
2551
2633
|
}
|
|
2552
|
-
},
|
|
2634
|
+
}, Hn = t.object({
|
|
2553
2635
|
baseInterval: F.z.optional(),
|
|
2554
2636
|
maxRetries: t.number().optional(),
|
|
2555
2637
|
scale: t.number().optional()
|
|
2556
|
-
}),
|
|
2638
|
+
}), Un = t.string().regex(/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i), J = yt, Wn = t.number().min(0).max(1), Gn = t.tuple([
|
|
2557
2639
|
J,
|
|
2558
2640
|
J,
|
|
2559
2641
|
J,
|
|
2560
|
-
|
|
2561
|
-
]),
|
|
2642
|
+
Wn
|
|
2643
|
+
]), Kn = t.tuple([
|
|
2562
2644
|
J,
|
|
2563
2645
|
J,
|
|
2564
2646
|
J
|
|
2565
|
-
]),
|
|
2647
|
+
]), qn = t.object({ rgba255: Gn }), Jn = t.object({
|
|
2566
2648
|
r: J,
|
|
2567
2649
|
g: J,
|
|
2568
2650
|
b: J,
|
|
2569
|
-
a:
|
|
2570
|
-
}),
|
|
2571
|
-
|
|
2572
|
-
|
|
2651
|
+
a: Wn
|
|
2652
|
+
}), Yn = t.number().min(0).max(360), Xn = t.number().min(0).max(100), Zn = t.number().min(0).max(100), Qn = t.tuple([
|
|
2653
|
+
Yn,
|
|
2654
|
+
Xn,
|
|
2655
|
+
Zn,
|
|
2656
|
+
Wn
|
|
2657
|
+
]), $n = t.union([
|
|
2573
2658
|
Un,
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
Bn
|
|
2582
|
-
]), Kn = Gn.transform((e) => qn(e)), qn = (e, t = 1) => {
|
|
2583
|
-
if (e = Gn.parse(e), typeof e == "string") return Jn(e, t);
|
|
2659
|
+
Kn,
|
|
2660
|
+
Gn,
|
|
2661
|
+
Qn,
|
|
2662
|
+
qn,
|
|
2663
|
+
Jn
|
|
2664
|
+
]), er = $n.transform((e) => tr(e)), tr = (e, t = 1) => {
|
|
2665
|
+
if (e = $n.parse(e), typeof e == "string") return nr(e, t);
|
|
2584
2666
|
if (Array.isArray(e)) {
|
|
2585
2667
|
if (e.length < 3 || e.length > 4) throw Error(`Invalid color: [${e.join(", ")}]`);
|
|
2586
2668
|
return e.length === 3 ? [...e, t] : e;
|
|
@@ -2591,34 +2673,34 @@ var gn = (e, t) => hn(e, t), K = -1, _n = {
|
|
|
2591
2673
|
e.b,
|
|
2592
2674
|
e.a
|
|
2593
2675
|
] : e.rgba255;
|
|
2594
|
-
},
|
|
2676
|
+
}, nr = (e, t = 1) => (e = Un.parse(e), e = rr(e), [
|
|
2595
2677
|
Y(e, 0),
|
|
2596
2678
|
Y(e, 2),
|
|
2597
2679
|
Y(e, 4),
|
|
2598
2680
|
e.length === 8 ? Y(e, 6) / 255 : t
|
|
2599
|
-
]), Y = (e, t) => parseInt(e.slice(t, t + 2), 16),
|
|
2600
|
-
|
|
2601
|
-
var
|
|
2681
|
+
]), Y = (e, t) => parseInt(e.slice(t, t + 2), 16), rr = (e) => e.startsWith("#") ? e.slice(1) : e;
|
|
2682
|
+
tr("#000000"), tr("#ffffff");
|
|
2683
|
+
var ir = t.object({
|
|
2602
2684
|
key: t.string(),
|
|
2603
|
-
color:
|
|
2685
|
+
color: $n,
|
|
2604
2686
|
position: t.number(),
|
|
2605
2687
|
switched: t.boolean().optional()
|
|
2606
2688
|
});
|
|
2607
|
-
t.array(
|
|
2608
|
-
var
|
|
2689
|
+
t.array(ir);
|
|
2690
|
+
var ar = t.object({
|
|
2609
2691
|
key: t.string(),
|
|
2610
2692
|
name: t.string(),
|
|
2611
|
-
color:
|
|
2693
|
+
color: er
|
|
2612
2694
|
});
|
|
2613
2695
|
t.object({
|
|
2614
2696
|
key: t.string(),
|
|
2615
2697
|
name: t.string(),
|
|
2616
|
-
swatches: t.array(
|
|
2698
|
+
swatches: t.array(ar)
|
|
2617
2699
|
});
|
|
2618
|
-
var
|
|
2700
|
+
var or = /* @__PURE__ */ function(e) {
|
|
2619
2701
|
return e[e.exclusive = 0] = "exclusive", e[e.shared = 1] = "shared", e;
|
|
2620
2702
|
}({});
|
|
2621
|
-
t.enum(
|
|
2703
|
+
t.enum(or), t.object({
|
|
2622
2704
|
key: t.string(),
|
|
2623
2705
|
name: t.string(),
|
|
2624
2706
|
group: t.uint32().optional()
|
|
@@ -2636,53 +2718,71 @@ t.enum(Qn), t.object({
|
|
|
2636
2718
|
key: t.string(),
|
|
2637
2719
|
value: t.string()
|
|
2638
2720
|
});
|
|
2639
|
-
var
|
|
2721
|
+
var sr = t.uuid();
|
|
2640
2722
|
t.object({
|
|
2641
|
-
key:
|
|
2723
|
+
key: sr,
|
|
2642
2724
|
name: t.string().min(1),
|
|
2643
|
-
color:
|
|
2725
|
+
color: er
|
|
2644
2726
|
}).partial({ key: !0 }), t.string().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/), t.enum([
|
|
2645
2727
|
"standard",
|
|
2646
2728
|
"scientific",
|
|
2647
2729
|
"engineering"
|
|
2648
2730
|
]);
|
|
2649
|
-
var
|
|
2731
|
+
var cr = t.union([t.string(), t.number()]), lr = () => t.record(cr, t.unknown());
|
|
2650
2732
|
typeof process < "u" && process.versions != null && process.versions.node != null || typeof window > "u" || window.document;
|
|
2651
|
-
var
|
|
2733
|
+
var ur = [
|
|
2652
2734
|
"macOS",
|
|
2653
2735
|
"Windows",
|
|
2654
2736
|
"Linux"
|
|
2655
|
-
],
|
|
2737
|
+
], dr = [
|
|
2656
2738
|
"macos",
|
|
2657
2739
|
"windows",
|
|
2658
2740
|
"linux"
|
|
2659
|
-
],
|
|
2741
|
+
], fr = {
|
|
2660
2742
|
macos: "macOS",
|
|
2661
2743
|
windows: "Windows",
|
|
2662
2744
|
linux: "Linux"
|
|
2663
2745
|
};
|
|
2664
|
-
t.enum(
|
|
2746
|
+
t.enum(ur).or(t.enum(dr).transform((e) => fr[e])), t.object({
|
|
2665
2747
|
message: t.string().optional(),
|
|
2666
2748
|
description: t.string().optional(),
|
|
2667
|
-
details:
|
|
2749
|
+
details: lr().optional()
|
|
2668
2750
|
}), t.object({
|
|
2669
2751
|
stack: t.string(),
|
|
2670
2752
|
error: t.instanceof(Error)
|
|
2671
|
-
}).and(
|
|
2753
|
+
}).and(lr()), t.enum([
|
|
2672
2754
|
"success",
|
|
2673
2755
|
"info",
|
|
2674
2756
|
"warning",
|
|
2675
2757
|
"error",
|
|
2676
2758
|
"loading",
|
|
2677
2759
|
"disabled"
|
|
2678
|
-
]), t.literal("success"), t.literal("info"), t.literal("warning"), t.literal("error"), t.literal("loading"), t.literal("disabled")
|
|
2679
|
-
|
|
2760
|
+
]), t.literal("success"), t.literal("info"), t.literal("warning"), t.literal("error"), t.literal("loading"), t.literal("disabled"), t.enum([
|
|
2761
|
+
"h1",
|
|
2762
|
+
"h2",
|
|
2763
|
+
"h3",
|
|
2764
|
+
"h4",
|
|
2765
|
+
"h5",
|
|
2766
|
+
"p",
|
|
2767
|
+
"small"
|
|
2768
|
+
]), t.union([t.number(), t.enum([
|
|
2769
|
+
"normal",
|
|
2770
|
+
"bold",
|
|
2771
|
+
"bolder",
|
|
2772
|
+
"lighter"
|
|
2773
|
+
])]), t.object({
|
|
2774
|
+
size: t.number(),
|
|
2775
|
+
weight: t.union([t.number(), t.string()]),
|
|
2776
|
+
lineHeight: t.number(),
|
|
2777
|
+
textTransform: t.string().optional()
|
|
2778
|
+
});
|
|
2779
|
+
var pr = (...e) => e.map(mr).join(""), mr = (e) => (e.endsWith("/") || (e += "/"), e.startsWith("/") && (e = e.slice(1)), e), hr = (e) => e.endsWith("/") ? e.slice(0, -1) : e, gr = (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("&")}`, _r = class e {
|
|
2680
2780
|
protocol;
|
|
2681
2781
|
host;
|
|
2682
2782
|
port;
|
|
2683
2783
|
path;
|
|
2684
2784
|
constructor({ host: e, port: t, protocol: n = "", pathPrefix: r = "" }) {
|
|
2685
|
-
this.protocol = n, this.host = e, this.port = t, this.path =
|
|
2785
|
+
this.protocol = n, this.host = e, this.port = t, this.path = mr(r);
|
|
2686
2786
|
}
|
|
2687
2787
|
replace(t) {
|
|
2688
2788
|
return new e({
|
|
@@ -2695,11 +2795,11 @@ var ar = (...e) => e.map(or).join(""), or = (e) => (e.endsWith("/") || (e += "/"
|
|
|
2695
2795
|
child(t) {
|
|
2696
2796
|
return new e({
|
|
2697
2797
|
...this,
|
|
2698
|
-
pathPrefix:
|
|
2798
|
+
pathPrefix: pr(this.path, t)
|
|
2699
2799
|
});
|
|
2700
2800
|
}
|
|
2701
2801
|
toString() {
|
|
2702
|
-
return
|
|
2802
|
+
return hr(`${this.protocol}://${this.host}:${this.port}/${this.path}`);
|
|
2703
2803
|
}
|
|
2704
2804
|
static UNKNOWN = new e({
|
|
2705
2805
|
host: "unknown",
|
|
@@ -2716,8 +2816,8 @@ var ar = (...e) => e.map(or).join(""), or = (e) => (e.endsWith("/") || (e += "/"
|
|
|
2716
2816
|
}, $ = class extends X.sub("unreachable") {
|
|
2717
2817
|
url;
|
|
2718
2818
|
constructor(e = {}) {
|
|
2719
|
-
let { message: t = "Unreachable", url: n =
|
|
2720
|
-
super(t), this.url = n;
|
|
2819
|
+
let { message: t = "Unreachable", url: n = _r.UNKNOWN, cause: r } = e;
|
|
2820
|
+
super(t, r === void 0 ? void 0 : { cause: r }), this.url = n;
|
|
2721
2821
|
}
|
|
2722
2822
|
};
|
|
2723
2823
|
v.register({
|
|
@@ -2749,7 +2849,7 @@ v.register({
|
|
|
2749
2849
|
});
|
|
2750
2850
|
//#endregion
|
|
2751
2851
|
//#region src/middleware.ts
|
|
2752
|
-
var
|
|
2852
|
+
var vr = class {
|
|
2753
2853
|
middleware = [];
|
|
2754
2854
|
use(...e) {
|
|
2755
2855
|
this.middleware.push(...e);
|
|
@@ -2762,34 +2862,33 @@ var ur = class {
|
|
|
2762
2862
|
};
|
|
2763
2863
|
return await r(e);
|
|
2764
2864
|
}
|
|
2765
|
-
},
|
|
2865
|
+
}, yr = "Content-Type", br = new Set([
|
|
2766
2866
|
"ECONNREFUSED",
|
|
2767
2867
|
"ECONNRESET",
|
|
2768
2868
|
"ETIMEDOUT",
|
|
2769
2869
|
"EPIPE",
|
|
2770
2870
|
"UND_ERR_CONNECT_TIMEOUT",
|
|
2771
2871
|
"UND_ERR_SOCKET"
|
|
2772
|
-
]),
|
|
2872
|
+
]), xr = (e) => {
|
|
2773
2873
|
let t = e?.cause?.code ?? e?.code ?? e?.errno;
|
|
2774
|
-
if (typeof t == "string" &&
|
|
2874
|
+
if (typeof t == "string" && br.has(t)) return !0;
|
|
2775
2875
|
if (e.name === "TypeError") {
|
|
2776
2876
|
let t = String(e.message || "").toLowerCase();
|
|
2777
2877
|
if (/load failed|failed to fetch|networkerror|network error/.test(t)) return typeof navigator < "u" && navigator.onLine, !0;
|
|
2778
2878
|
}
|
|
2779
2879
|
return e?.name === "AbortError" || e?.code, !1;
|
|
2780
|
-
},
|
|
2880
|
+
}, Sr = 400, Cr = class extends vr {
|
|
2781
2881
|
endpoint;
|
|
2782
2882
|
encoder;
|
|
2783
2883
|
constructor(e, t, n = !1) {
|
|
2784
2884
|
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) });
|
|
2785
2885
|
}
|
|
2786
2886
|
get headers() {
|
|
2787
|
-
return { [
|
|
2887
|
+
return { [yr]: this.encoder.contentType };
|
|
2788
2888
|
}
|
|
2789
2889
|
async send(e, t, n, r) {
|
|
2790
2890
|
let i = null, a = this.endpoint.child(e), o = {};
|
|
2791
|
-
o.method = "POST", o.body = this.encoder.encode(t, n)
|
|
2792
|
-
let [, s] = await this.executeMiddleware({
|
|
2891
|
+
if (o.method = "POST", o.body = this.encoder.encode(t, n), await this.executeMiddleware({
|
|
2793
2892
|
target: a.toString(),
|
|
2794
2893
|
protocol: this.endpoint.protocol,
|
|
2795
2894
|
params: {},
|
|
@@ -2807,24 +2906,27 @@ var ur = class {
|
|
|
2807
2906
|
try {
|
|
2808
2907
|
n = await fetch(e.target, o);
|
|
2809
2908
|
} catch (e) {
|
|
2810
|
-
|
|
2811
|
-
|
|
2909
|
+
let t = v.fromUnknown(e);
|
|
2910
|
+
throw xr(t) ? new $({
|
|
2911
|
+
url: a,
|
|
2912
|
+
cause: t
|
|
2913
|
+
}) : t;
|
|
2812
2914
|
}
|
|
2813
2915
|
let s = await n.arrayBuffer();
|
|
2814
|
-
if (n?.ok) return r != null && (i = this.encoder.decode(s, r)),
|
|
2916
|
+
if (n?.ok) return r != null && (i = this.encoder.decode(s, r)), t;
|
|
2917
|
+
if (n.status !== Sr) throw Error(`[freighter] HTTP ${n.status} from ${e.target}: ${n.statusText}`);
|
|
2918
|
+
let c;
|
|
2815
2919
|
try {
|
|
2816
|
-
|
|
2817
|
-
let e = this.encoder.decode(s, v.payloadZ);
|
|
2818
|
-
return [t, v.decode(e)];
|
|
2920
|
+
c = v.decode(this.encoder.decode(s, v.payloadZ));
|
|
2819
2921
|
} catch (e) {
|
|
2820
|
-
|
|
2922
|
+
let t = v.fromUnknown(e);
|
|
2923
|
+
throw Error(`[freighter] - failed to decode error: ${n.statusText}: ${t.message}`, { cause: e });
|
|
2821
2924
|
}
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
return [i, null];
|
|
2925
|
+
throw c ?? /* @__PURE__ */ Error(`[freighter] HTTP ${n.status} from ${e.target}: ${n.statusText}`);
|
|
2926
|
+
}), i == null) throw Error("Response must be defined");
|
|
2927
|
+
return i;
|
|
2826
2928
|
}
|
|
2827
|
-
},
|
|
2929
|
+
}, wr = (e, t) => {
|
|
2828
2930
|
class n {
|
|
2829
2931
|
wrapped;
|
|
2830
2932
|
constructor(e) {
|
|
@@ -2834,21 +2936,19 @@ var ur = class {
|
|
|
2834
2936
|
this.wrapped.use(...e);
|
|
2835
2937
|
}
|
|
2836
2938
|
async send(e, n, r, i) {
|
|
2837
|
-
let a = new
|
|
2838
|
-
do
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2939
|
+
let a = new Bn.Breaker(t);
|
|
2940
|
+
do
|
|
2941
|
+
try {
|
|
2942
|
+
return await this.wrapped.send(e, n, r, i);
|
|
2943
|
+
} catch (e) {
|
|
2944
|
+
let t = v.fromUnknown(e);
|
|
2945
|
+
if (!$.matches(t) || (console.warn(`[freighter] ${a.retryMessage}`, t), !await a.wait())) throw t;
|
|
2946
|
+
}
|
|
2947
|
+
while (!0);
|
|
2844
2948
|
}
|
|
2845
2949
|
}
|
|
2846
2950
|
return new n(e);
|
|
2847
|
-
},
|
|
2848
|
-
let [a, o] = await e.send(t, n, r, i);
|
|
2849
|
-
if (o != null) throw o;
|
|
2850
|
-
return a;
|
|
2851
|
-
}, vr = t.object({
|
|
2951
|
+
}, Tr = t.object({
|
|
2852
2952
|
type: t.enum([
|
|
2853
2953
|
"data",
|
|
2854
2954
|
"close",
|
|
@@ -2856,7 +2956,7 @@ var ur = class {
|
|
|
2856
2956
|
]),
|
|
2857
2957
|
payload: t.unknown(),
|
|
2858
2958
|
error: t.optional(v.payloadZ)
|
|
2859
|
-
}),
|
|
2959
|
+
}), Er = class {
|
|
2860
2960
|
codec;
|
|
2861
2961
|
reqSchema;
|
|
2862
2962
|
resSchema;
|
|
@@ -2870,28 +2970,21 @@ var ur = class {
|
|
|
2870
2970
|
}
|
|
2871
2971
|
async receiveOpenAck() {
|
|
2872
2972
|
let e = await this.receiveMsg();
|
|
2873
|
-
if (e.type !== "open") {
|
|
2874
|
-
if (e.error == null) throw Error("Message error must be defined");
|
|
2875
|
-
return v.decode(e.error);
|
|
2876
|
-
}
|
|
2877
|
-
return null;
|
|
2973
|
+
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}`);
|
|
2878
2974
|
}
|
|
2879
2975
|
send(e) {
|
|
2880
|
-
if (this.serverClosed != null)
|
|
2976
|
+
if (this.serverClosed != null) throw new Z();
|
|
2881
2977
|
if (this.sendClosed) throw new Q();
|
|
2882
|
-
|
|
2978
|
+
this.ws.send(this.codec.encode({
|
|
2883
2979
|
type: "data",
|
|
2884
2980
|
payload: e
|
|
2885
|
-
}))
|
|
2981
|
+
}));
|
|
2886
2982
|
}
|
|
2887
2983
|
async receive() {
|
|
2888
|
-
if (this.serverClosed != null)
|
|
2984
|
+
if (this.serverClosed != null) throw this.serverClosed;
|
|
2889
2985
|
let e = await this.receiveMsg();
|
|
2890
|
-
if (e.type === "close")
|
|
2891
|
-
|
|
2892
|
-
return [null, this.serverClosed];
|
|
2893
|
-
}
|
|
2894
|
-
return [this.resSchema.parse(e.payload), null];
|
|
2986
|
+
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;
|
|
2987
|
+
return this.resSchema.parse(e.payload);
|
|
2895
2988
|
}
|
|
2896
2989
|
received() {
|
|
2897
2990
|
return this.receiveDataQueue.length !== 0;
|
|
@@ -2919,18 +3012,18 @@ var ur = class {
|
|
|
2919
3012
|
this.ws.onmessage = this.onMessage.bind(this), this.ws.onclose = this.onClose.bind(this);
|
|
2920
3013
|
}
|
|
2921
3014
|
onMessage(e) {
|
|
2922
|
-
this.addMessage(this.codec.decode(e.data,
|
|
3015
|
+
this.addMessage(this.codec.decode(e.data, Tr));
|
|
2923
3016
|
}
|
|
2924
3017
|
onClose(e) {
|
|
2925
3018
|
this.addMessage({
|
|
2926
3019
|
type: "close",
|
|
2927
3020
|
error: {
|
|
2928
|
-
type: e.code ===
|
|
3021
|
+
type: e.code === Or ? Z.TYPE : Q.TYPE,
|
|
2929
3022
|
data: ""
|
|
2930
3023
|
}
|
|
2931
3024
|
});
|
|
2932
3025
|
}
|
|
2933
|
-
},
|
|
3026
|
+
}, Dr = "freighterctx", Or = 1e3, kr = class e extends vr {
|
|
2934
3027
|
baseUrl;
|
|
2935
3028
|
encoder;
|
|
2936
3029
|
secure;
|
|
@@ -2943,7 +3036,8 @@ var ur = class {
|
|
|
2943
3036
|
return n.use(...this.middleware), n;
|
|
2944
3037
|
}
|
|
2945
3038
|
async stream(t, n, r) {
|
|
2946
|
-
let i
|
|
3039
|
+
let i;
|
|
3040
|
+
return await this.executeMiddleware({
|
|
2947
3041
|
target: t,
|
|
2948
3042
|
protocol: "websocket",
|
|
2949
3043
|
params: {},
|
|
@@ -2953,32 +3047,27 @@ var ur = class {
|
|
|
2953
3047
|
...a,
|
|
2954
3048
|
params: {}
|
|
2955
3049
|
};
|
|
2956
|
-
o.binaryType = e.MESSAGE_TYPE;
|
|
2957
|
-
|
|
2958
|
-
return c instanceof Error ? [s, c] : (i = c, [s, null]);
|
|
2959
|
-
});
|
|
2960
|
-
if (a != null) throw a;
|
|
2961
|
-
return i;
|
|
3050
|
+
return o.binaryType = e.MESSAGE_TYPE, i = await this.wrapSocket(o, n, r), s;
|
|
3051
|
+
}), i;
|
|
2962
3052
|
}
|
|
2963
3053
|
buildURL(e, t) {
|
|
2964
|
-
let n =
|
|
2965
|
-
[
|
|
3054
|
+
let n = gr({
|
|
3055
|
+
[yr]: this.encoder.contentType,
|
|
2966
3056
|
...t.params
|
|
2967
|
-
},
|
|
3057
|
+
}, Dr);
|
|
2968
3058
|
return this.baseUrl.child(e).toString() + n;
|
|
2969
3059
|
}
|
|
2970
3060
|
async wrapSocket(e, t, n) {
|
|
2971
|
-
return await new Promise((r) => {
|
|
3061
|
+
return await new Promise((r, i) => {
|
|
2972
3062
|
e.onopen = () => {
|
|
2973
|
-
let
|
|
2974
|
-
|
|
2975
|
-
r(e ?? i);
|
|
2976
|
-
}).catch((e) => r(e));
|
|
3063
|
+
let a = new Er(e, this.encoder, t, n);
|
|
3064
|
+
a.receiveOpenAck().then(() => r(a)).catch((e) => i(v.fromUnknown(e)));
|
|
2977
3065
|
}, e.onerror = (e) => {
|
|
2978
|
-
|
|
3066
|
+
let t = e;
|
|
3067
|
+
i(Error(t.message ?? "websocket error", { cause: t.error ?? e }));
|
|
2979
3068
|
};
|
|
2980
3069
|
});
|
|
2981
3070
|
}
|
|
2982
3071
|
};
|
|
2983
3072
|
//#endregion
|
|
2984
|
-
export { Z as EOF,
|
|
3073
|
+
export { Z as EOF, Cr as HTTPClient, Q as StreamClosed, $ as Unreachable, kr as WebSocketClient, wr as unaryWithBreaker };
|