@synnaxlabs/freighter 0.41.0 → 0.42.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/dist/alamos.d.ts.map +1 -1
- package/dist/errors.d.ts +18 -87
- package/dist/errors.d.ts.map +1 -1
- package/dist/freighter.cjs +9 -9
- package/dist/freighter.js +2092 -976
- package/dist/http.d.ts +1 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/unary.d.ts +2 -2
- package/dist/unary.d.ts.map +1 -1
- package/dist/websocket.d.ts +8 -1
- package/dist/websocket.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/alamos.ts +4 -3
- package/src/errors.spec.ts +6 -73
- package/src/errors.ts +20 -168
- package/src/http.ts +19 -12
- package/src/index.ts +2 -14
- package/src/unary.ts +7 -6
- package/src/websocket.spec.ts +9 -17
- package/src/websocket.ts +51 -29
package/dist/freighter.js
CHANGED
|
@@ -1,97 +1,1041 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { z as i } from "zod";
|
|
5
|
-
const
|
|
6
|
-
const e =
|
|
1
|
+
var Lt = Object.defineProperty;
|
|
2
|
+
var kt = (s, e, t) => e in s ? Lt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var S = (s, e, t) => kt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import Y, { z as i } from "zod";
|
|
5
|
+
const Pt = (s) => {
|
|
6
|
+
const e = s.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
7
7
|
return e.length > 1 && e[0] === e[0].toUpperCase() && e[1] === e[1].toUpperCase() || e.length === 0 ? e : e[0].toLowerCase() + e.slice(1);
|
|
8
|
-
},
|
|
9
|
-
const e = (t,
|
|
10
|
-
if (typeof t == "string") return
|
|
11
|
-
if (Array.isArray(t)) return t.map((
|
|
12
|
-
if (!
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
return Object.keys(a).forEach((
|
|
16
|
-
let
|
|
17
|
-
const d =
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
return
|
|
21
|
-
}))),
|
|
22
|
-
}),
|
|
8
|
+
}, ot = (s) => {
|
|
9
|
+
const e = (t, r = Ie) => {
|
|
10
|
+
if (typeof t == "string") return s(t);
|
|
11
|
+
if (Array.isArray(t)) return t.map((o) => e(o, r));
|
|
12
|
+
if (!be(t)) return t;
|
|
13
|
+
r = Ft(r);
|
|
14
|
+
const n = {}, a = t;
|
|
15
|
+
return Object.keys(a).forEach((o) => {
|
|
16
|
+
let c = a[o];
|
|
17
|
+
const d = s(o);
|
|
18
|
+
r.recursive && (be(c) ? We(c, r.keepTypesOnRecursion) || (c = e(c, r)) : r.recursiveInArray && Ye(c) && (c = [...c].map((p) => {
|
|
19
|
+
let y = p;
|
|
20
|
+
return be(p) ? We(y, r.keepTypesOnRecursion) || (y = e(p, r)) : Ye(p) && (y = e({ key: p }, r).key), y;
|
|
21
|
+
}))), n[d] = c;
|
|
22
|
+
}), n;
|
|
23
23
|
};
|
|
24
24
|
return e;
|
|
25
|
-
},
|
|
25
|
+
}, De = ot(Pt), jt = (s) => (
|
|
26
26
|
// Don't convert the first character and don't convert a character that is after a
|
|
27
27
|
// non-alphanumeric character
|
|
28
|
-
|
|
28
|
+
s.replace(
|
|
29
29
|
/([a-z0-9])([A-Z])/g,
|
|
30
|
-
(e, t,
|
|
30
|
+
(e, t, r) => `${t}_${r.toLowerCase()}`
|
|
31
31
|
)
|
|
32
|
-
),
|
|
32
|
+
), ht = ot(jt), Ie = {
|
|
33
33
|
recursive: !0,
|
|
34
34
|
recursiveInArray: !0,
|
|
35
35
|
keepTypesOnRecursion: [Number, String, Uint8Array]
|
|
36
|
-
},
|
|
37
|
-
var
|
|
38
|
-
|
|
36
|
+
}, Ft = (s = Ie) => (s.recursive == null ? s = Ie : s.recursiveInArray ?? (s.recursiveInArray = !1), s), Ye = (s) => s != null && Array.isArray(s), be = (s) => s != null && typeof s == "object" && !Array.isArray(s), We = (s, e) => (e || []).some((t) => s instanceof t), Le = (s) => s != null && typeof s == "object" && !Array.isArray(s);
|
|
37
|
+
var zt = Object.defineProperty, Yt = (s, e, t) => e in s ? zt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, V = (s, e, t) => Yt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
38
|
+
function Wt(s) {
|
|
39
|
+
const e = s.length;
|
|
40
|
+
let t = 0, r = 0;
|
|
41
|
+
for (; r < e; ) {
|
|
42
|
+
let n = s.charCodeAt(r++);
|
|
43
|
+
if ((n & 4294967168) === 0) {
|
|
44
|
+
t++;
|
|
45
|
+
continue;
|
|
46
|
+
} else if ((n & 4294965248) === 0)
|
|
47
|
+
t += 2;
|
|
48
|
+
else {
|
|
49
|
+
if (n >= 55296 && n <= 56319 && r < e) {
|
|
50
|
+
const a = s.charCodeAt(r);
|
|
51
|
+
(a & 64512) === 56320 && (++r, n = ((n & 1023) << 10) + (a & 1023) + 65536);
|
|
52
|
+
}
|
|
53
|
+
(n & 4294901760) === 0 ? t += 3 : t += 4;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
}
|
|
58
|
+
function qt(s, e, t) {
|
|
59
|
+
const r = s.length;
|
|
60
|
+
let n = t, a = 0;
|
|
61
|
+
for (; a < r; ) {
|
|
62
|
+
let o = s.charCodeAt(a++);
|
|
63
|
+
if ((o & 4294967168) === 0) {
|
|
64
|
+
e[n++] = o;
|
|
65
|
+
continue;
|
|
66
|
+
} else if ((o & 4294965248) === 0)
|
|
67
|
+
e[n++] = o >> 6 & 31 | 192;
|
|
68
|
+
else {
|
|
69
|
+
if (o >= 55296 && o <= 56319 && a < r) {
|
|
70
|
+
const c = s.charCodeAt(a);
|
|
71
|
+
(c & 64512) === 56320 && (++a, o = ((o & 1023) << 10) + (c & 1023) + 65536);
|
|
72
|
+
}
|
|
73
|
+
(o & 4294901760) === 0 ? (e[n++] = o >> 12 & 15 | 224, e[n++] = o >> 6 & 63 | 128) : (e[n++] = o >> 18 & 7 | 240, e[n++] = o >> 12 & 63 | 128, e[n++] = o >> 6 & 63 | 128);
|
|
74
|
+
}
|
|
75
|
+
e[n++] = o & 63 | 128;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const Vt = new TextEncoder(), Ht = 50;
|
|
79
|
+
function Zt(s, e, t) {
|
|
80
|
+
Vt.encodeInto(s, e.subarray(t));
|
|
81
|
+
}
|
|
82
|
+
function Gt(s, e, t) {
|
|
83
|
+
s.length > Ht ? Zt(s, e, t) : qt(s, e, t);
|
|
84
|
+
}
|
|
85
|
+
const Kt = 4096;
|
|
86
|
+
function ut(s, e, t) {
|
|
87
|
+
let r = e;
|
|
88
|
+
const n = r + t, a = [];
|
|
89
|
+
let o = "";
|
|
90
|
+
for (; r < n; ) {
|
|
91
|
+
const c = s[r++];
|
|
92
|
+
if ((c & 128) === 0)
|
|
93
|
+
a.push(c);
|
|
94
|
+
else if ((c & 224) === 192) {
|
|
95
|
+
const d = s[r++] & 63;
|
|
96
|
+
a.push((c & 31) << 6 | d);
|
|
97
|
+
} else if ((c & 240) === 224) {
|
|
98
|
+
const d = s[r++] & 63, p = s[r++] & 63;
|
|
99
|
+
a.push((c & 31) << 12 | d << 6 | p);
|
|
100
|
+
} else if ((c & 248) === 240) {
|
|
101
|
+
const d = s[r++] & 63, p = s[r++] & 63, y = s[r++] & 63;
|
|
102
|
+
let l = (c & 7) << 18 | d << 12 | p << 6 | y;
|
|
103
|
+
l > 65535 && (l -= 65536, a.push(l >>> 10 & 1023 | 55296), l = 56320 | l & 1023), a.push(l);
|
|
104
|
+
} else
|
|
105
|
+
a.push(c);
|
|
106
|
+
a.length >= Kt && (o += String.fromCharCode(...a), a.length = 0);
|
|
107
|
+
}
|
|
108
|
+
return a.length > 0 && (o += String.fromCharCode(...a)), o;
|
|
109
|
+
}
|
|
110
|
+
const Jt = new TextDecoder(), Xt = 200;
|
|
111
|
+
function Qt(s, e, t) {
|
|
112
|
+
const r = s.subarray(e, e + t);
|
|
113
|
+
return Jt.decode(r);
|
|
114
|
+
}
|
|
115
|
+
function _t(s, e, t) {
|
|
116
|
+
return t > Xt ? Qt(s, e, t) : ut(s, e, t);
|
|
117
|
+
}
|
|
118
|
+
let ce = class {
|
|
119
|
+
constructor(e, t) {
|
|
120
|
+
this.type = e, this.data = t;
|
|
121
|
+
}
|
|
122
|
+
}, C = class Ue extends Error {
|
|
123
|
+
constructor(e) {
|
|
124
|
+
super(e);
|
|
125
|
+
const t = Object.create(Ue.prototype);
|
|
126
|
+
Object.setPrototypeOf(this, t), Object.defineProperty(this, "name", {
|
|
127
|
+
configurable: !0,
|
|
128
|
+
enumerable: !1,
|
|
129
|
+
value: Ue.name
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const J = 4294967295;
|
|
134
|
+
function es(s, e, t) {
|
|
135
|
+
const r = t / 4294967296, n = t;
|
|
136
|
+
s.setUint32(e, r), s.setUint32(e + 4, n);
|
|
137
|
+
}
|
|
138
|
+
function ct(s, e, t) {
|
|
139
|
+
const r = Math.floor(t / 4294967296), n = t;
|
|
140
|
+
s.setUint32(e, r), s.setUint32(e + 4, n);
|
|
141
|
+
}
|
|
142
|
+
function lt(s, e) {
|
|
143
|
+
const t = s.getInt32(e), r = s.getUint32(e + 4);
|
|
144
|
+
return t * 4294967296 + r;
|
|
145
|
+
}
|
|
146
|
+
function ts(s, e) {
|
|
147
|
+
const t = s.getUint32(e), r = s.getUint32(e + 4);
|
|
148
|
+
return t * 4294967296 + r;
|
|
149
|
+
}
|
|
150
|
+
const ss = -1, rs = 4294967296 - 1, ns = 17179869184 - 1;
|
|
151
|
+
function is({ sec: s, nsec: e }) {
|
|
152
|
+
if (s >= 0 && e >= 0 && s <= ns)
|
|
153
|
+
if (e === 0 && s <= rs) {
|
|
154
|
+
const t = new Uint8Array(4);
|
|
155
|
+
return new DataView(t.buffer).setUint32(0, s), t;
|
|
156
|
+
} else {
|
|
157
|
+
const t = s / 4294967296, r = s & 4294967295, n = new Uint8Array(8), a = new DataView(n.buffer);
|
|
158
|
+
return a.setUint32(0, e << 2 | t & 3), a.setUint32(4, r), n;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
const t = new Uint8Array(12), r = new DataView(t.buffer);
|
|
162
|
+
return r.setUint32(0, e), ct(r, 4, s), t;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function as(s) {
|
|
166
|
+
const e = s.getTime(), t = Math.floor(e / 1e3), r = (e - t * 1e3) * 1e6, n = Math.floor(r / 1e9);
|
|
167
|
+
return {
|
|
168
|
+
sec: t + n,
|
|
169
|
+
nsec: r - n * 1e9
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function os(s) {
|
|
173
|
+
if (s instanceof Date) {
|
|
174
|
+
const e = as(s);
|
|
175
|
+
return is(e);
|
|
176
|
+
} else
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
function hs(s) {
|
|
180
|
+
const e = new DataView(s.buffer, s.byteOffset, s.byteLength);
|
|
181
|
+
switch (s.byteLength) {
|
|
182
|
+
case 4:
|
|
183
|
+
return { sec: e.getUint32(0), nsec: 0 };
|
|
184
|
+
case 8: {
|
|
185
|
+
const t = e.getUint32(0), r = e.getUint32(4), n = (t & 3) * 4294967296 + r, a = t >>> 2;
|
|
186
|
+
return { sec: n, nsec: a };
|
|
187
|
+
}
|
|
188
|
+
case 12: {
|
|
189
|
+
const t = lt(e, 4), r = e.getUint32(0);
|
|
190
|
+
return { sec: t, nsec: r };
|
|
191
|
+
}
|
|
192
|
+
default:
|
|
193
|
+
throw new C(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${s.length}`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function us(s) {
|
|
197
|
+
const e = hs(s);
|
|
198
|
+
return new Date(e.sec * 1e3 + e.nsec / 1e6);
|
|
199
|
+
}
|
|
200
|
+
const cs = {
|
|
201
|
+
type: ss,
|
|
202
|
+
encode: os,
|
|
203
|
+
decode: us
|
|
204
|
+
};
|
|
205
|
+
let he = class {
|
|
39
206
|
constructor() {
|
|
40
|
-
|
|
207
|
+
this.builtInEncoders = [], this.builtInDecoders = [], this.encoders = [], this.decoders = [], this.register(cs);
|
|
208
|
+
}
|
|
209
|
+
register({ type: e, encode: t, decode: r }) {
|
|
210
|
+
if (e >= 0)
|
|
211
|
+
this.encoders[e] = t, this.decoders[e] = r;
|
|
212
|
+
else {
|
|
213
|
+
const n = -1 - e;
|
|
214
|
+
this.builtInEncoders[n] = t, this.builtInDecoders[n] = r;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
tryToEncode(e, t) {
|
|
218
|
+
for (let r = 0; r < this.builtInEncoders.length; r++) {
|
|
219
|
+
const n = this.builtInEncoders[r];
|
|
220
|
+
if (n != null) {
|
|
221
|
+
const a = n(e, t);
|
|
222
|
+
if (a != null) {
|
|
223
|
+
const o = -1 - r;
|
|
224
|
+
return new ce(o, a);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
for (let r = 0; r < this.encoders.length; r++) {
|
|
229
|
+
const n = this.encoders[r];
|
|
230
|
+
if (n != null) {
|
|
231
|
+
const a = n(e, t);
|
|
232
|
+
if (a != null) {
|
|
233
|
+
const o = r;
|
|
234
|
+
return new ce(o, a);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return e instanceof ce ? e : null;
|
|
239
|
+
}
|
|
240
|
+
decode(e, t, r) {
|
|
241
|
+
const n = t < 0 ? this.builtInDecoders[-1 - t] : this.decoders[t];
|
|
242
|
+
return n ? n(e, t, r) : new ce(t, e);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
he.defaultCodec = new he();
|
|
246
|
+
function ls(s) {
|
|
247
|
+
return s instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && s instanceof SharedArrayBuffer;
|
|
248
|
+
}
|
|
249
|
+
function xe(s) {
|
|
250
|
+
return s instanceof Uint8Array ? s : ArrayBuffer.isView(s) ? new Uint8Array(s.buffer, s.byteOffset, s.byteLength) : ls(s) ? new Uint8Array(s) : Uint8Array.from(s);
|
|
251
|
+
}
|
|
252
|
+
const ds = 100, fs = 2048;
|
|
253
|
+
let gs = class dt {
|
|
254
|
+
constructor(e) {
|
|
255
|
+
this.entered = !1, this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? he.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.maxDepth = (e == null ? void 0 : e.maxDepth) ?? ds, this.initialBufferSize = (e == null ? void 0 : e.initialBufferSize) ?? fs, this.sortKeys = (e == null ? void 0 : e.sortKeys) ?? !1, this.forceFloat32 = (e == null ? void 0 : e.forceFloat32) ?? !1, this.ignoreUndefined = (e == null ? void 0 : e.ignoreUndefined) ?? !1, this.forceIntegerToFloat = (e == null ? void 0 : e.forceIntegerToFloat) ?? !1, this.pos = 0, this.view = new DataView(new ArrayBuffer(this.initialBufferSize)), this.bytes = new Uint8Array(this.view.buffer);
|
|
256
|
+
}
|
|
257
|
+
clone() {
|
|
258
|
+
return new dt({
|
|
259
|
+
extensionCodec: this.extensionCodec,
|
|
260
|
+
context: this.context,
|
|
261
|
+
useBigInt64: this.useBigInt64,
|
|
262
|
+
maxDepth: this.maxDepth,
|
|
263
|
+
initialBufferSize: this.initialBufferSize,
|
|
264
|
+
sortKeys: this.sortKeys,
|
|
265
|
+
forceFloat32: this.forceFloat32,
|
|
266
|
+
ignoreUndefined: this.ignoreUndefined,
|
|
267
|
+
forceIntegerToFloat: this.forceIntegerToFloat
|
|
268
|
+
});
|
|
41
269
|
}
|
|
270
|
+
reinitializeState() {
|
|
271
|
+
this.pos = 0;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* This is almost equivalent to {@link Encoder#encode}, but it returns an reference of the encoder's internal buffer and thus much faster than {@link Encoder#encode}.
|
|
275
|
+
*
|
|
276
|
+
* @returns Encodes the object and returns a shared reference the encoder's internal buffer.
|
|
277
|
+
*/
|
|
278
|
+
encodeSharedRef(e) {
|
|
279
|
+
if (this.entered)
|
|
280
|
+
return this.clone().encodeSharedRef(e);
|
|
281
|
+
try {
|
|
282
|
+
return this.entered = !0, this.reinitializeState(), this.doEncode(e, 1), this.bytes.subarray(0, this.pos);
|
|
283
|
+
} finally {
|
|
284
|
+
this.entered = !1;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* @returns Encodes the object and returns a copy of the encoder's internal buffer.
|
|
289
|
+
*/
|
|
42
290
|
encode(e) {
|
|
43
|
-
|
|
291
|
+
if (this.entered)
|
|
292
|
+
return this.clone().encode(e);
|
|
293
|
+
try {
|
|
294
|
+
return this.entered = !0, this.reinitializeState(), this.doEncode(e, 1), this.bytes.slice(0, this.pos);
|
|
295
|
+
} finally {
|
|
296
|
+
this.entered = !1;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
doEncode(e, t) {
|
|
300
|
+
if (t > this.maxDepth)
|
|
301
|
+
throw new Error(`Too deep objects in depth ${t}`);
|
|
302
|
+
e == null ? this.encodeNil() : typeof e == "boolean" ? this.encodeBoolean(e) : typeof e == "number" ? this.forceIntegerToFloat ? this.encodeNumberAsFloat(e) : this.encodeNumber(e) : typeof e == "string" ? this.encodeString(e) : this.useBigInt64 && typeof e == "bigint" ? this.encodeBigInt64(e) : this.encodeObject(e, t);
|
|
303
|
+
}
|
|
304
|
+
ensureBufferSizeToWrite(e) {
|
|
305
|
+
const t = this.pos + e;
|
|
306
|
+
this.view.byteLength < t && this.resizeBuffer(t * 2);
|
|
307
|
+
}
|
|
308
|
+
resizeBuffer(e) {
|
|
309
|
+
const t = new ArrayBuffer(e), r = new Uint8Array(t), n = new DataView(t);
|
|
310
|
+
r.set(this.bytes), this.view = n, this.bytes = r;
|
|
311
|
+
}
|
|
312
|
+
encodeNil() {
|
|
313
|
+
this.writeU8(192);
|
|
314
|
+
}
|
|
315
|
+
encodeBoolean(e) {
|
|
316
|
+
e === !1 ? this.writeU8(194) : this.writeU8(195);
|
|
317
|
+
}
|
|
318
|
+
encodeNumber(e) {
|
|
319
|
+
!this.forceIntegerToFloat && Number.isSafeInteger(e) ? e >= 0 ? e < 128 ? this.writeU8(e) : e < 256 ? (this.writeU8(204), this.writeU8(e)) : e < 65536 ? (this.writeU8(205), this.writeU16(e)) : e < 4294967296 ? (this.writeU8(206), this.writeU32(e)) : this.useBigInt64 ? this.encodeNumberAsFloat(e) : (this.writeU8(207), this.writeU64(e)) : e >= -32 ? this.writeU8(224 | e + 32) : e >= -128 ? (this.writeU8(208), this.writeI8(e)) : e >= -32768 ? (this.writeU8(209), this.writeI16(e)) : e >= -2147483648 ? (this.writeU8(210), this.writeI32(e)) : this.useBigInt64 ? this.encodeNumberAsFloat(e) : (this.writeU8(211), this.writeI64(e)) : this.encodeNumberAsFloat(e);
|
|
320
|
+
}
|
|
321
|
+
encodeNumberAsFloat(e) {
|
|
322
|
+
this.forceFloat32 ? (this.writeU8(202), this.writeF32(e)) : (this.writeU8(203), this.writeF64(e));
|
|
323
|
+
}
|
|
324
|
+
encodeBigInt64(e) {
|
|
325
|
+
e >= BigInt(0) ? (this.writeU8(207), this.writeBigUint64(e)) : (this.writeU8(211), this.writeBigInt64(e));
|
|
326
|
+
}
|
|
327
|
+
writeStringHeader(e) {
|
|
328
|
+
if (e < 32)
|
|
329
|
+
this.writeU8(160 + e);
|
|
330
|
+
else if (e < 256)
|
|
331
|
+
this.writeU8(217), this.writeU8(e);
|
|
332
|
+
else if (e < 65536)
|
|
333
|
+
this.writeU8(218), this.writeU16(e);
|
|
334
|
+
else if (e < 4294967296)
|
|
335
|
+
this.writeU8(219), this.writeU32(e);
|
|
336
|
+
else
|
|
337
|
+
throw new Error(`Too long string: ${e} bytes in UTF-8`);
|
|
338
|
+
}
|
|
339
|
+
encodeString(e) {
|
|
340
|
+
const t = Wt(e);
|
|
341
|
+
this.ensureBufferSizeToWrite(5 + t), this.writeStringHeader(t), Gt(e, this.bytes, this.pos), this.pos += t;
|
|
342
|
+
}
|
|
343
|
+
encodeObject(e, t) {
|
|
344
|
+
const r = this.extensionCodec.tryToEncode(e, this.context);
|
|
345
|
+
if (r != null)
|
|
346
|
+
this.encodeExtension(r);
|
|
347
|
+
else if (Array.isArray(e))
|
|
348
|
+
this.encodeArray(e, t);
|
|
349
|
+
else if (ArrayBuffer.isView(e))
|
|
350
|
+
this.encodeBinary(e);
|
|
351
|
+
else if (typeof e == "object")
|
|
352
|
+
this.encodeMap(e, t);
|
|
353
|
+
else
|
|
354
|
+
throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`);
|
|
355
|
+
}
|
|
356
|
+
encodeBinary(e) {
|
|
357
|
+
const t = e.byteLength;
|
|
358
|
+
if (t < 256)
|
|
359
|
+
this.writeU8(196), this.writeU8(t);
|
|
360
|
+
else if (t < 65536)
|
|
361
|
+
this.writeU8(197), this.writeU16(t);
|
|
362
|
+
else if (t < 4294967296)
|
|
363
|
+
this.writeU8(198), this.writeU32(t);
|
|
364
|
+
else
|
|
365
|
+
throw new Error(`Too large binary: ${t}`);
|
|
366
|
+
const r = xe(e);
|
|
367
|
+
this.writeU8a(r);
|
|
368
|
+
}
|
|
369
|
+
encodeArray(e, t) {
|
|
370
|
+
const r = e.length;
|
|
371
|
+
if (r < 16)
|
|
372
|
+
this.writeU8(144 + r);
|
|
373
|
+
else if (r < 65536)
|
|
374
|
+
this.writeU8(220), this.writeU16(r);
|
|
375
|
+
else if (r < 4294967296)
|
|
376
|
+
this.writeU8(221), this.writeU32(r);
|
|
377
|
+
else
|
|
378
|
+
throw new Error(`Too large array: ${r}`);
|
|
379
|
+
for (const n of e)
|
|
380
|
+
this.doEncode(n, t + 1);
|
|
381
|
+
}
|
|
382
|
+
countWithoutUndefined(e, t) {
|
|
383
|
+
let r = 0;
|
|
384
|
+
for (const n of t)
|
|
385
|
+
e[n] !== void 0 && r++;
|
|
386
|
+
return r;
|
|
387
|
+
}
|
|
388
|
+
encodeMap(e, t) {
|
|
389
|
+
const r = Object.keys(e);
|
|
390
|
+
this.sortKeys && r.sort();
|
|
391
|
+
const n = this.ignoreUndefined ? this.countWithoutUndefined(e, r) : r.length;
|
|
392
|
+
if (n < 16)
|
|
393
|
+
this.writeU8(128 + n);
|
|
394
|
+
else if (n < 65536)
|
|
395
|
+
this.writeU8(222), this.writeU16(n);
|
|
396
|
+
else if (n < 4294967296)
|
|
397
|
+
this.writeU8(223), this.writeU32(n);
|
|
398
|
+
else
|
|
399
|
+
throw new Error(`Too large map object: ${n}`);
|
|
400
|
+
for (const a of r) {
|
|
401
|
+
const o = e[a];
|
|
402
|
+
this.ignoreUndefined && o === void 0 || (this.encodeString(a), this.doEncode(o, t + 1));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
encodeExtension(e) {
|
|
406
|
+
if (typeof e.data == "function") {
|
|
407
|
+
const r = e.data(this.pos + 6), n = r.length;
|
|
408
|
+
if (n >= 4294967296)
|
|
409
|
+
throw new Error(`Too large extension object: ${n}`);
|
|
410
|
+
this.writeU8(201), this.writeU32(n), this.writeI8(e.type), this.writeU8a(r);
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const t = e.data.length;
|
|
414
|
+
if (t === 1)
|
|
415
|
+
this.writeU8(212);
|
|
416
|
+
else if (t === 2)
|
|
417
|
+
this.writeU8(213);
|
|
418
|
+
else if (t === 4)
|
|
419
|
+
this.writeU8(214);
|
|
420
|
+
else if (t === 8)
|
|
421
|
+
this.writeU8(215);
|
|
422
|
+
else if (t === 16)
|
|
423
|
+
this.writeU8(216);
|
|
424
|
+
else if (t < 256)
|
|
425
|
+
this.writeU8(199), this.writeU8(t);
|
|
426
|
+
else if (t < 65536)
|
|
427
|
+
this.writeU8(200), this.writeU16(t);
|
|
428
|
+
else if (t < 4294967296)
|
|
429
|
+
this.writeU8(201), this.writeU32(t);
|
|
430
|
+
else
|
|
431
|
+
throw new Error(`Too large extension object: ${t}`);
|
|
432
|
+
this.writeI8(e.type), this.writeU8a(e.data);
|
|
433
|
+
}
|
|
434
|
+
writeU8(e) {
|
|
435
|
+
this.ensureBufferSizeToWrite(1), this.view.setUint8(this.pos, e), this.pos++;
|
|
436
|
+
}
|
|
437
|
+
writeU8a(e) {
|
|
438
|
+
const t = e.length;
|
|
439
|
+
this.ensureBufferSizeToWrite(t), this.bytes.set(e, this.pos), this.pos += t;
|
|
440
|
+
}
|
|
441
|
+
writeI8(e) {
|
|
442
|
+
this.ensureBufferSizeToWrite(1), this.view.setInt8(this.pos, e), this.pos++;
|
|
443
|
+
}
|
|
444
|
+
writeU16(e) {
|
|
445
|
+
this.ensureBufferSizeToWrite(2), this.view.setUint16(this.pos, e), this.pos += 2;
|
|
446
|
+
}
|
|
447
|
+
writeI16(e) {
|
|
448
|
+
this.ensureBufferSizeToWrite(2), this.view.setInt16(this.pos, e), this.pos += 2;
|
|
449
|
+
}
|
|
450
|
+
writeU32(e) {
|
|
451
|
+
this.ensureBufferSizeToWrite(4), this.view.setUint32(this.pos, e), this.pos += 4;
|
|
452
|
+
}
|
|
453
|
+
writeI32(e) {
|
|
454
|
+
this.ensureBufferSizeToWrite(4), this.view.setInt32(this.pos, e), this.pos += 4;
|
|
455
|
+
}
|
|
456
|
+
writeF32(e) {
|
|
457
|
+
this.ensureBufferSizeToWrite(4), this.view.setFloat32(this.pos, e), this.pos += 4;
|
|
458
|
+
}
|
|
459
|
+
writeF64(e) {
|
|
460
|
+
this.ensureBufferSizeToWrite(8), this.view.setFloat64(this.pos, e), this.pos += 8;
|
|
461
|
+
}
|
|
462
|
+
writeU64(e) {
|
|
463
|
+
this.ensureBufferSizeToWrite(8), es(this.view, this.pos, e), this.pos += 8;
|
|
464
|
+
}
|
|
465
|
+
writeI64(e) {
|
|
466
|
+
this.ensureBufferSizeToWrite(8), ct(this.view, this.pos, e), this.pos += 8;
|
|
467
|
+
}
|
|
468
|
+
writeBigUint64(e) {
|
|
469
|
+
this.ensureBufferSizeToWrite(8), this.view.setBigUint64(this.pos, e), this.pos += 8;
|
|
470
|
+
}
|
|
471
|
+
writeBigInt64(e) {
|
|
472
|
+
this.ensureBufferSizeToWrite(8), this.view.setBigInt64(this.pos, e), this.pos += 8;
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
function Q(s, e) {
|
|
476
|
+
return new gs(e).encodeSharedRef(s);
|
|
477
|
+
}
|
|
478
|
+
function ve(s) {
|
|
479
|
+
return `${s < 0 ? "-" : ""}0x${Math.abs(s).toString(16).padStart(2, "0")}`;
|
|
480
|
+
}
|
|
481
|
+
const ps = 16, ys = 16;
|
|
482
|
+
class ws {
|
|
483
|
+
constructor(e = ps, t = ys) {
|
|
484
|
+
this.hit = 0, this.miss = 0, this.maxKeyLength = e, this.maxLengthPerKey = t, this.caches = [];
|
|
485
|
+
for (let r = 0; r < this.maxKeyLength; r++)
|
|
486
|
+
this.caches.push([]);
|
|
487
|
+
}
|
|
488
|
+
canBeCached(e) {
|
|
489
|
+
return e > 0 && e <= this.maxKeyLength;
|
|
490
|
+
}
|
|
491
|
+
find(e, t, r) {
|
|
492
|
+
const n = this.caches[r - 1];
|
|
493
|
+
e: for (const a of n) {
|
|
494
|
+
const o = a.bytes;
|
|
495
|
+
for (let c = 0; c < r; c++)
|
|
496
|
+
if (o[c] !== e[t + c])
|
|
497
|
+
continue e;
|
|
498
|
+
return a.str;
|
|
499
|
+
}
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
502
|
+
store(e, t) {
|
|
503
|
+
const r = this.caches[e.length - 1], n = { bytes: e, str: t };
|
|
504
|
+
r.length >= this.maxLengthPerKey ? r[Math.random() * r.length | 0] = n : r.push(n);
|
|
505
|
+
}
|
|
506
|
+
decode(e, t, r) {
|
|
507
|
+
const n = this.find(e, t, r);
|
|
508
|
+
if (n != null)
|
|
509
|
+
return this.hit++, n;
|
|
510
|
+
this.miss++;
|
|
511
|
+
const a = ut(e, t, r), o = Uint8Array.prototype.slice.call(e, t, t + r);
|
|
512
|
+
return this.store(o, a), a;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
const Ne = "array", ie = "map_key", ft = "map_value", ms = (s) => {
|
|
516
|
+
if (typeof s == "string" || typeof s == "number")
|
|
517
|
+
return s;
|
|
518
|
+
throw new C("The type of key must be string or number but " + typeof s);
|
|
519
|
+
};
|
|
520
|
+
class bs {
|
|
521
|
+
constructor() {
|
|
522
|
+
this.stack = [], this.stackHeadPosition = -1;
|
|
523
|
+
}
|
|
524
|
+
get length() {
|
|
525
|
+
return this.stackHeadPosition + 1;
|
|
526
|
+
}
|
|
527
|
+
top() {
|
|
528
|
+
return this.stack[this.stackHeadPosition];
|
|
529
|
+
}
|
|
530
|
+
pushArrayState(e) {
|
|
531
|
+
const t = this.getUninitializedStateFromPool();
|
|
532
|
+
t.type = Ne, t.position = 0, t.size = e, t.array = new Array(e);
|
|
533
|
+
}
|
|
534
|
+
pushMapState(e) {
|
|
535
|
+
const t = this.getUninitializedStateFromPool();
|
|
536
|
+
t.type = ie, t.readCount = 0, t.size = e, t.map = {};
|
|
537
|
+
}
|
|
538
|
+
getUninitializedStateFromPool() {
|
|
539
|
+
if (this.stackHeadPosition++, this.stackHeadPosition === this.stack.length) {
|
|
540
|
+
const e = {
|
|
541
|
+
type: void 0,
|
|
542
|
+
size: 0,
|
|
543
|
+
array: void 0,
|
|
544
|
+
position: 0,
|
|
545
|
+
readCount: 0,
|
|
546
|
+
map: void 0,
|
|
547
|
+
key: null
|
|
548
|
+
};
|
|
549
|
+
this.stack.push(e);
|
|
550
|
+
}
|
|
551
|
+
return this.stack[this.stackHeadPosition];
|
|
552
|
+
}
|
|
553
|
+
release(e) {
|
|
554
|
+
if (this.stack[this.stackHeadPosition] !== e)
|
|
555
|
+
throw new Error("Invalid stack state. Released state is not on top of the stack.");
|
|
556
|
+
if (e.type === Ne) {
|
|
557
|
+
const t = e;
|
|
558
|
+
t.size = 0, t.array = void 0, t.position = 0, t.type = void 0;
|
|
559
|
+
}
|
|
560
|
+
if (e.type === ie || e.type === ft) {
|
|
561
|
+
const t = e;
|
|
562
|
+
t.size = 0, t.map = void 0, t.readCount = 0, t.type = void 0;
|
|
563
|
+
}
|
|
564
|
+
this.stackHeadPosition--;
|
|
565
|
+
}
|
|
566
|
+
reset() {
|
|
567
|
+
this.stack.length = 0, this.stackHeadPosition = -1;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
const X = -1, ke = new DataView(new ArrayBuffer(0)), vs = new Uint8Array(ke.buffer);
|
|
571
|
+
try {
|
|
572
|
+
ke.getInt8(0);
|
|
573
|
+
} catch (s) {
|
|
574
|
+
if (!(s instanceof RangeError))
|
|
575
|
+
throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access");
|
|
576
|
+
}
|
|
577
|
+
const qe = new RangeError("Insufficient data"), Ts = new ws();
|
|
578
|
+
let Os = class gt {
|
|
579
|
+
constructor(e) {
|
|
580
|
+
this.totalPos = 0, this.pos = 0, this.view = ke, this.bytes = vs, this.headByte = X, this.stack = new bs(), this.entered = !1, this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? he.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.rawStrings = (e == null ? void 0 : e.rawStrings) ?? !1, this.maxStrLength = (e == null ? void 0 : e.maxStrLength) ?? J, this.maxBinLength = (e == null ? void 0 : e.maxBinLength) ?? J, this.maxArrayLength = (e == null ? void 0 : e.maxArrayLength) ?? J, this.maxMapLength = (e == null ? void 0 : e.maxMapLength) ?? J, this.maxExtLength = (e == null ? void 0 : e.maxExtLength) ?? J, this.keyDecoder = (e == null ? void 0 : e.keyDecoder) !== void 0 ? e.keyDecoder : Ts, this.mapKeyConverter = (e == null ? void 0 : e.mapKeyConverter) ?? ms;
|
|
581
|
+
}
|
|
582
|
+
clone() {
|
|
583
|
+
return new gt({
|
|
584
|
+
extensionCodec: this.extensionCodec,
|
|
585
|
+
context: this.context,
|
|
586
|
+
useBigInt64: this.useBigInt64,
|
|
587
|
+
rawStrings: this.rawStrings,
|
|
588
|
+
maxStrLength: this.maxStrLength,
|
|
589
|
+
maxBinLength: this.maxBinLength,
|
|
590
|
+
maxArrayLength: this.maxArrayLength,
|
|
591
|
+
maxMapLength: this.maxMapLength,
|
|
592
|
+
maxExtLength: this.maxExtLength,
|
|
593
|
+
keyDecoder: this.keyDecoder
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
reinitializeState() {
|
|
597
|
+
this.totalPos = 0, this.headByte = X, this.stack.reset();
|
|
598
|
+
}
|
|
599
|
+
setBuffer(e) {
|
|
600
|
+
const t = xe(e);
|
|
601
|
+
this.bytes = t, this.view = new DataView(t.buffer, t.byteOffset, t.byteLength), this.pos = 0;
|
|
602
|
+
}
|
|
603
|
+
appendBuffer(e) {
|
|
604
|
+
if (this.headByte === X && !this.hasRemaining(1))
|
|
605
|
+
this.setBuffer(e);
|
|
606
|
+
else {
|
|
607
|
+
const t = this.bytes.subarray(this.pos), r = xe(e), n = new Uint8Array(t.length + r.length);
|
|
608
|
+
n.set(t), n.set(r, t.length), this.setBuffer(n);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
hasRemaining(e) {
|
|
612
|
+
return this.view.byteLength - this.pos >= e;
|
|
613
|
+
}
|
|
614
|
+
createExtraByteError(e) {
|
|
615
|
+
const { view: t, pos: r } = this;
|
|
616
|
+
return new RangeError(`Extra ${t.byteLength - r} of ${t.byteLength} byte(s) found at buffer[${e}]`);
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* @throws {@link DecodeError}
|
|
620
|
+
* @throws {@link RangeError}
|
|
621
|
+
*/
|
|
622
|
+
decode(e) {
|
|
623
|
+
if (this.entered)
|
|
624
|
+
return this.clone().decode(e);
|
|
625
|
+
try {
|
|
626
|
+
this.entered = !0, this.reinitializeState(), this.setBuffer(e);
|
|
627
|
+
const t = this.doDecodeSync();
|
|
628
|
+
if (this.hasRemaining(1))
|
|
629
|
+
throw this.createExtraByteError(this.pos);
|
|
630
|
+
return t;
|
|
631
|
+
} finally {
|
|
632
|
+
this.entered = !1;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
*decodeMulti(e) {
|
|
636
|
+
if (this.entered) {
|
|
637
|
+
yield* this.clone().decodeMulti(e);
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
try {
|
|
641
|
+
for (this.entered = !0, this.reinitializeState(), this.setBuffer(e); this.hasRemaining(1); )
|
|
642
|
+
yield this.doDecodeSync();
|
|
643
|
+
} finally {
|
|
644
|
+
this.entered = !1;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
async decodeAsync(e) {
|
|
648
|
+
if (this.entered)
|
|
649
|
+
return this.clone().decodeAsync(e);
|
|
650
|
+
try {
|
|
651
|
+
this.entered = !0;
|
|
652
|
+
let t = !1, r;
|
|
653
|
+
for await (const c of e) {
|
|
654
|
+
if (t)
|
|
655
|
+
throw this.entered = !1, this.createExtraByteError(this.totalPos);
|
|
656
|
+
this.appendBuffer(c);
|
|
657
|
+
try {
|
|
658
|
+
r = this.doDecodeSync(), t = !0;
|
|
659
|
+
} catch (d) {
|
|
660
|
+
if (!(d instanceof RangeError))
|
|
661
|
+
throw d;
|
|
662
|
+
}
|
|
663
|
+
this.totalPos += this.pos;
|
|
664
|
+
}
|
|
665
|
+
if (t) {
|
|
666
|
+
if (this.hasRemaining(1))
|
|
667
|
+
throw this.createExtraByteError(this.totalPos);
|
|
668
|
+
return r;
|
|
669
|
+
}
|
|
670
|
+
const { headByte: n, pos: a, totalPos: o } = this;
|
|
671
|
+
throw new RangeError(`Insufficient data in parsing ${ve(n)} at ${o} (${a} in the current buffer)`);
|
|
672
|
+
} finally {
|
|
673
|
+
this.entered = !1;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
decodeArrayStream(e) {
|
|
677
|
+
return this.decodeMultiAsync(e, !0);
|
|
678
|
+
}
|
|
679
|
+
decodeStream(e) {
|
|
680
|
+
return this.decodeMultiAsync(e, !1);
|
|
681
|
+
}
|
|
682
|
+
async *decodeMultiAsync(e, t) {
|
|
683
|
+
if (this.entered) {
|
|
684
|
+
yield* this.clone().decodeMultiAsync(e, t);
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
try {
|
|
688
|
+
this.entered = !0;
|
|
689
|
+
let r = t, n = -1;
|
|
690
|
+
for await (const a of e) {
|
|
691
|
+
if (t && n === 0)
|
|
692
|
+
throw this.createExtraByteError(this.totalPos);
|
|
693
|
+
this.appendBuffer(a), r && (n = this.readArraySize(), r = !1, this.complete());
|
|
694
|
+
try {
|
|
695
|
+
for (; yield this.doDecodeSync(), --n !== 0; )
|
|
696
|
+
;
|
|
697
|
+
} catch (o) {
|
|
698
|
+
if (!(o instanceof RangeError))
|
|
699
|
+
throw o;
|
|
700
|
+
}
|
|
701
|
+
this.totalPos += this.pos;
|
|
702
|
+
}
|
|
703
|
+
} finally {
|
|
704
|
+
this.entered = !1;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
doDecodeSync() {
|
|
708
|
+
e: for (; ; ) {
|
|
709
|
+
const e = this.readHeadByte();
|
|
710
|
+
let t;
|
|
711
|
+
if (e >= 224)
|
|
712
|
+
t = e - 256;
|
|
713
|
+
else if (e < 192)
|
|
714
|
+
if (e < 128)
|
|
715
|
+
t = e;
|
|
716
|
+
else if (e < 144) {
|
|
717
|
+
const n = e - 128;
|
|
718
|
+
if (n !== 0) {
|
|
719
|
+
this.pushMapState(n), this.complete();
|
|
720
|
+
continue e;
|
|
721
|
+
} else
|
|
722
|
+
t = {};
|
|
723
|
+
} else if (e < 160) {
|
|
724
|
+
const n = e - 144;
|
|
725
|
+
if (n !== 0) {
|
|
726
|
+
this.pushArrayState(n), this.complete();
|
|
727
|
+
continue e;
|
|
728
|
+
} else
|
|
729
|
+
t = [];
|
|
730
|
+
} else {
|
|
731
|
+
const n = e - 160;
|
|
732
|
+
t = this.decodeString(n, 0);
|
|
733
|
+
}
|
|
734
|
+
else if (e === 192)
|
|
735
|
+
t = null;
|
|
736
|
+
else if (e === 194)
|
|
737
|
+
t = !1;
|
|
738
|
+
else if (e === 195)
|
|
739
|
+
t = !0;
|
|
740
|
+
else if (e === 202)
|
|
741
|
+
t = this.readF32();
|
|
742
|
+
else if (e === 203)
|
|
743
|
+
t = this.readF64();
|
|
744
|
+
else if (e === 204)
|
|
745
|
+
t = this.readU8();
|
|
746
|
+
else if (e === 205)
|
|
747
|
+
t = this.readU16();
|
|
748
|
+
else if (e === 206)
|
|
749
|
+
t = this.readU32();
|
|
750
|
+
else if (e === 207)
|
|
751
|
+
this.useBigInt64 ? t = this.readU64AsBigInt() : t = this.readU64();
|
|
752
|
+
else if (e === 208)
|
|
753
|
+
t = this.readI8();
|
|
754
|
+
else if (e === 209)
|
|
755
|
+
t = this.readI16();
|
|
756
|
+
else if (e === 210)
|
|
757
|
+
t = this.readI32();
|
|
758
|
+
else if (e === 211)
|
|
759
|
+
this.useBigInt64 ? t = this.readI64AsBigInt() : t = this.readI64();
|
|
760
|
+
else if (e === 217) {
|
|
761
|
+
const n = this.lookU8();
|
|
762
|
+
t = this.decodeString(n, 1);
|
|
763
|
+
} else if (e === 218) {
|
|
764
|
+
const n = this.lookU16();
|
|
765
|
+
t = this.decodeString(n, 2);
|
|
766
|
+
} else if (e === 219) {
|
|
767
|
+
const n = this.lookU32();
|
|
768
|
+
t = this.decodeString(n, 4);
|
|
769
|
+
} else if (e === 220) {
|
|
770
|
+
const n = this.readU16();
|
|
771
|
+
if (n !== 0) {
|
|
772
|
+
this.pushArrayState(n), this.complete();
|
|
773
|
+
continue e;
|
|
774
|
+
} else
|
|
775
|
+
t = [];
|
|
776
|
+
} else if (e === 221) {
|
|
777
|
+
const n = this.readU32();
|
|
778
|
+
if (n !== 0) {
|
|
779
|
+
this.pushArrayState(n), this.complete();
|
|
780
|
+
continue e;
|
|
781
|
+
} else
|
|
782
|
+
t = [];
|
|
783
|
+
} else if (e === 222) {
|
|
784
|
+
const n = this.readU16();
|
|
785
|
+
if (n !== 0) {
|
|
786
|
+
this.pushMapState(n), this.complete();
|
|
787
|
+
continue e;
|
|
788
|
+
} else
|
|
789
|
+
t = {};
|
|
790
|
+
} else if (e === 223) {
|
|
791
|
+
const n = this.readU32();
|
|
792
|
+
if (n !== 0) {
|
|
793
|
+
this.pushMapState(n), this.complete();
|
|
794
|
+
continue e;
|
|
795
|
+
} else
|
|
796
|
+
t = {};
|
|
797
|
+
} else if (e === 196) {
|
|
798
|
+
const n = this.lookU8();
|
|
799
|
+
t = this.decodeBinary(n, 1);
|
|
800
|
+
} else if (e === 197) {
|
|
801
|
+
const n = this.lookU16();
|
|
802
|
+
t = this.decodeBinary(n, 2);
|
|
803
|
+
} else if (e === 198) {
|
|
804
|
+
const n = this.lookU32();
|
|
805
|
+
t = this.decodeBinary(n, 4);
|
|
806
|
+
} else if (e === 212)
|
|
807
|
+
t = this.decodeExtension(1, 0);
|
|
808
|
+
else if (e === 213)
|
|
809
|
+
t = this.decodeExtension(2, 0);
|
|
810
|
+
else if (e === 214)
|
|
811
|
+
t = this.decodeExtension(4, 0);
|
|
812
|
+
else if (e === 215)
|
|
813
|
+
t = this.decodeExtension(8, 0);
|
|
814
|
+
else if (e === 216)
|
|
815
|
+
t = this.decodeExtension(16, 0);
|
|
816
|
+
else if (e === 199) {
|
|
817
|
+
const n = this.lookU8();
|
|
818
|
+
t = this.decodeExtension(n, 1);
|
|
819
|
+
} else if (e === 200) {
|
|
820
|
+
const n = this.lookU16();
|
|
821
|
+
t = this.decodeExtension(n, 2);
|
|
822
|
+
} else if (e === 201) {
|
|
823
|
+
const n = this.lookU32();
|
|
824
|
+
t = this.decodeExtension(n, 4);
|
|
825
|
+
} else
|
|
826
|
+
throw new C(`Unrecognized type byte: ${ve(e)}`);
|
|
827
|
+
this.complete();
|
|
828
|
+
const r = this.stack;
|
|
829
|
+
for (; r.length > 0; ) {
|
|
830
|
+
const n = r.top();
|
|
831
|
+
if (n.type === Ne)
|
|
832
|
+
if (n.array[n.position] = t, n.position++, n.position === n.size)
|
|
833
|
+
t = n.array, r.release(n);
|
|
834
|
+
else
|
|
835
|
+
continue e;
|
|
836
|
+
else if (n.type === ie) {
|
|
837
|
+
if (t === "__proto__")
|
|
838
|
+
throw new C("The key __proto__ is not allowed");
|
|
839
|
+
n.key = this.mapKeyConverter(t), n.type = ft;
|
|
840
|
+
continue e;
|
|
841
|
+
} else if (n.map[n.key] = t, n.readCount++, n.readCount === n.size)
|
|
842
|
+
t = n.map, r.release(n);
|
|
843
|
+
else {
|
|
844
|
+
n.key = null, n.type = ie;
|
|
845
|
+
continue e;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return t;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
readHeadByte() {
|
|
852
|
+
return this.headByte === X && (this.headByte = this.readU8()), this.headByte;
|
|
853
|
+
}
|
|
854
|
+
complete() {
|
|
855
|
+
this.headByte = X;
|
|
856
|
+
}
|
|
857
|
+
readArraySize() {
|
|
858
|
+
const e = this.readHeadByte();
|
|
859
|
+
switch (e) {
|
|
860
|
+
case 220:
|
|
861
|
+
return this.readU16();
|
|
862
|
+
case 221:
|
|
863
|
+
return this.readU32();
|
|
864
|
+
default: {
|
|
865
|
+
if (e < 160)
|
|
866
|
+
return e - 144;
|
|
867
|
+
throw new C(`Unrecognized array type byte: ${ve(e)}`);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
pushMapState(e) {
|
|
872
|
+
if (e > this.maxMapLength)
|
|
873
|
+
throw new C(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);
|
|
874
|
+
this.stack.pushMapState(e);
|
|
875
|
+
}
|
|
876
|
+
pushArrayState(e) {
|
|
877
|
+
if (e > this.maxArrayLength)
|
|
878
|
+
throw new C(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);
|
|
879
|
+
this.stack.pushArrayState(e);
|
|
880
|
+
}
|
|
881
|
+
decodeString(e, t) {
|
|
882
|
+
return !this.rawStrings || this.stateIsMapKey() ? this.decodeUtf8String(e, t) : this.decodeBinary(e, t);
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* @throws {@link RangeError}
|
|
886
|
+
*/
|
|
887
|
+
decodeUtf8String(e, t) {
|
|
888
|
+
var r;
|
|
889
|
+
if (e > this.maxStrLength)
|
|
890
|
+
throw new C(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);
|
|
891
|
+
if (this.bytes.byteLength < this.pos + t + e)
|
|
892
|
+
throw qe;
|
|
893
|
+
const n = this.pos + t;
|
|
894
|
+
let a;
|
|
895
|
+
return this.stateIsMapKey() && (r = this.keyDecoder) != null && r.canBeCached(e) ? a = this.keyDecoder.decode(this.bytes, n, e) : a = _t(this.bytes, n, e), this.pos += t + e, a;
|
|
896
|
+
}
|
|
897
|
+
stateIsMapKey() {
|
|
898
|
+
return this.stack.length > 0 ? this.stack.top().type === ie : !1;
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* @throws {@link RangeError}
|
|
902
|
+
*/
|
|
903
|
+
decodeBinary(e, t) {
|
|
904
|
+
if (e > this.maxBinLength)
|
|
905
|
+
throw new C(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);
|
|
906
|
+
if (!this.hasRemaining(e + t))
|
|
907
|
+
throw qe;
|
|
908
|
+
const r = this.pos + t, n = this.bytes.subarray(r, r + e);
|
|
909
|
+
return this.pos += t + e, n;
|
|
910
|
+
}
|
|
911
|
+
decodeExtension(e, t) {
|
|
912
|
+
if (e > this.maxExtLength)
|
|
913
|
+
throw new C(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);
|
|
914
|
+
const r = this.view.getInt8(this.pos + t), n = this.decodeBinary(
|
|
915
|
+
e,
|
|
916
|
+
t + 1
|
|
917
|
+
/* extType */
|
|
918
|
+
);
|
|
919
|
+
return this.extensionCodec.decode(n, r, this.context);
|
|
920
|
+
}
|
|
921
|
+
lookU8() {
|
|
922
|
+
return this.view.getUint8(this.pos);
|
|
923
|
+
}
|
|
924
|
+
lookU16() {
|
|
925
|
+
return this.view.getUint16(this.pos);
|
|
926
|
+
}
|
|
927
|
+
lookU32() {
|
|
928
|
+
return this.view.getUint32(this.pos);
|
|
929
|
+
}
|
|
930
|
+
readU8() {
|
|
931
|
+
const e = this.view.getUint8(this.pos);
|
|
932
|
+
return this.pos++, e;
|
|
933
|
+
}
|
|
934
|
+
readI8() {
|
|
935
|
+
const e = this.view.getInt8(this.pos);
|
|
936
|
+
return this.pos++, e;
|
|
937
|
+
}
|
|
938
|
+
readU16() {
|
|
939
|
+
const e = this.view.getUint16(this.pos);
|
|
940
|
+
return this.pos += 2, e;
|
|
941
|
+
}
|
|
942
|
+
readI16() {
|
|
943
|
+
const e = this.view.getInt16(this.pos);
|
|
944
|
+
return this.pos += 2, e;
|
|
945
|
+
}
|
|
946
|
+
readU32() {
|
|
947
|
+
const e = this.view.getUint32(this.pos);
|
|
948
|
+
return this.pos += 4, e;
|
|
949
|
+
}
|
|
950
|
+
readI32() {
|
|
951
|
+
const e = this.view.getInt32(this.pos);
|
|
952
|
+
return this.pos += 4, e;
|
|
953
|
+
}
|
|
954
|
+
readU64() {
|
|
955
|
+
const e = ts(this.view, this.pos);
|
|
956
|
+
return this.pos += 8, e;
|
|
957
|
+
}
|
|
958
|
+
readI64() {
|
|
959
|
+
const e = lt(this.view, this.pos);
|
|
960
|
+
return this.pos += 8, e;
|
|
961
|
+
}
|
|
962
|
+
readU64AsBigInt() {
|
|
963
|
+
const e = this.view.getBigUint64(this.pos);
|
|
964
|
+
return this.pos += 8, e;
|
|
965
|
+
}
|
|
966
|
+
readI64AsBigInt() {
|
|
967
|
+
const e = this.view.getBigInt64(this.pos);
|
|
968
|
+
return this.pos += 8, e;
|
|
969
|
+
}
|
|
970
|
+
readF32() {
|
|
971
|
+
const e = this.view.getFloat32(this.pos);
|
|
972
|
+
return this.pos += 4, e;
|
|
973
|
+
}
|
|
974
|
+
readF64() {
|
|
975
|
+
const e = this.view.getFloat64(this.pos);
|
|
976
|
+
return this.pos += 8, e;
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
function pt(s, e) {
|
|
980
|
+
return new Os(e).decode(s);
|
|
981
|
+
}
|
|
982
|
+
let Ss = class {
|
|
983
|
+
constructor() {
|
|
984
|
+
V(this, "contentType", "application/json"), V(this, "decoder"), V(this, "encoder"), this.decoder = new TextDecoder(), this.encoder = new TextEncoder();
|
|
985
|
+
}
|
|
986
|
+
encode(e) {
|
|
987
|
+
return this.encoder.encode(this.encodeString(e));
|
|
44
988
|
}
|
|
45
989
|
decode(e, t) {
|
|
46
990
|
return this.decodeString(this.decoder.decode(e), t);
|
|
47
991
|
}
|
|
48
992
|
decodeString(e, t) {
|
|
49
|
-
const
|
|
50
|
-
return t != null ? t.parse(
|
|
993
|
+
const r = JSON.parse(e), n = De(r);
|
|
994
|
+
return t != null ? t.parse(n) : n;
|
|
51
995
|
}
|
|
52
996
|
encodeString(e) {
|
|
53
|
-
const t =
|
|
54
|
-
return JSON.stringify(t, (
|
|
997
|
+
const t = ht(e);
|
|
998
|
+
return JSON.stringify(t, (r, n) => ArrayBuffer.isView(n) ? Array.from(n) : Le(n) && "encode_value" in n ? typeof n.value == "bigint" ? n.value.toString() : n.value : typeof n == "bigint" ? n.toString() : n);
|
|
55
999
|
}
|
|
56
1000
|
static registerCustomType() {
|
|
57
1001
|
}
|
|
58
|
-
},
|
|
1002
|
+
}, Is = class {
|
|
59
1003
|
constructor() {
|
|
60
|
-
|
|
1004
|
+
V(this, "contentType", "text/csv");
|
|
61
1005
|
}
|
|
62
1006
|
encode(e) {
|
|
63
1007
|
const t = this.encodeString(e);
|
|
64
|
-
return new TextEncoder().encode(t)
|
|
1008
|
+
return new TextEncoder().encode(t);
|
|
65
1009
|
}
|
|
66
1010
|
decode(e, t) {
|
|
67
|
-
const
|
|
68
|
-
return this.decodeString(
|
|
1011
|
+
const r = new TextDecoder().decode(e);
|
|
1012
|
+
return this.decodeString(r, t);
|
|
69
1013
|
}
|
|
70
1014
|
encodeString(e) {
|
|
71
|
-
if (!Array.isArray(e) || e.length === 0 || !
|
|
1015
|
+
if (!Array.isArray(e) || e.length === 0 || !Le(e[0]))
|
|
72
1016
|
throw new Error("Payload must be an array of objects");
|
|
73
|
-
const t = Object.keys(e[0]),
|
|
74
|
-
return e.forEach((
|
|
75
|
-
const a = t.map((
|
|
76
|
-
|
|
77
|
-
}),
|
|
1017
|
+
const t = Object.keys(e[0]), r = [t.join(",")];
|
|
1018
|
+
return e.forEach((n) => {
|
|
1019
|
+
const a = t.map((o) => JSON.stringify(n[o] ?? ""));
|
|
1020
|
+
r.push(a.join(","));
|
|
1021
|
+
}), r.join(`
|
|
78
1022
|
`);
|
|
79
1023
|
}
|
|
80
1024
|
decodeString(e, t) {
|
|
81
|
-
const [
|
|
82
|
-
`).map((
|
|
83
|
-
if (
|
|
1025
|
+
const [r, ...n] = e.trim().split(`
|
|
1026
|
+
`).map((c) => c.trim());
|
|
1027
|
+
if (r.length === 0)
|
|
84
1028
|
return t != null ? t.parse({}) : {};
|
|
85
|
-
const a =
|
|
86
|
-
return a.forEach((
|
|
87
|
-
c
|
|
88
|
-
}),
|
|
89
|
-
const d =
|
|
90
|
-
a.forEach((p,
|
|
91
|
-
const l = this.parseValue(d[
|
|
92
|
-
l != null &&
|
|
1029
|
+
const a = r.split(",").map((c) => c.trim()), o = {};
|
|
1030
|
+
return a.forEach((c) => {
|
|
1031
|
+
o[c] = [];
|
|
1032
|
+
}), n.forEach((c) => {
|
|
1033
|
+
const d = c.split(",").map((p) => p.trim());
|
|
1034
|
+
a.forEach((p, y) => {
|
|
1035
|
+
const l = this.parseValue(d[y]);
|
|
1036
|
+
l != null && o[p].push(l);
|
|
93
1037
|
});
|
|
94
|
-
}), t != null ? t.parse(
|
|
1038
|
+
}), t != null ? t.parse(o) : o;
|
|
95
1039
|
}
|
|
96
1040
|
parseValue(e) {
|
|
97
1041
|
if (e == null || e.length === 0) return null;
|
|
@@ -100,103 +1044,131 @@ let bt = class {
|
|
|
100
1044
|
}
|
|
101
1045
|
static registerCustomType() {
|
|
102
1046
|
}
|
|
103
|
-
},
|
|
1047
|
+
}, Us = class {
|
|
1048
|
+
constructor() {
|
|
1049
|
+
V(this, "contentType", "text/plain");
|
|
1050
|
+
}
|
|
1051
|
+
encode(e) {
|
|
1052
|
+
return new TextEncoder().encode(e);
|
|
1053
|
+
}
|
|
1054
|
+
decode(e, t) {
|
|
1055
|
+
const r = new TextDecoder().decode(e);
|
|
1056
|
+
return t != null ? t.parse(r) : r;
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
1059
|
+
const j = new he();
|
|
1060
|
+
j.register({
|
|
1061
|
+
type: 0,
|
|
1062
|
+
encode: (s) => {
|
|
1063
|
+
if (ArrayBuffer.isView(s)) {
|
|
1064
|
+
const e = Array.from(s);
|
|
1065
|
+
return Q(e, { extensionCodec: j });
|
|
1066
|
+
}
|
|
1067
|
+
return Le(s) && "encode_value" in s ? typeof s.value == "bigint" ? Q(s.value.toString(), { extensionCodec: j }) : Q(s.value, { extensionCodec: j }) : typeof s == "bigint" ? Q(s.toString(), { extensionCodec: j }) : null;
|
|
1068
|
+
},
|
|
1069
|
+
decode: (s) => pt(s, { extensionCodec: j })
|
|
1070
|
+
});
|
|
1071
|
+
let xs = class {
|
|
104
1072
|
constructor() {
|
|
105
|
-
|
|
1073
|
+
V(this, "contentType", "application/msgpack");
|
|
106
1074
|
}
|
|
107
1075
|
encode(e) {
|
|
108
|
-
|
|
1076
|
+
const t = ht(e);
|
|
1077
|
+
return Q(t, { extensionCodec: j }).slice();
|
|
109
1078
|
}
|
|
110
1079
|
decode(e, t) {
|
|
111
|
-
const
|
|
1080
|
+
const r = pt(e, { extensionCodec: j }), n = De(r);
|
|
112
1081
|
return t != null ? t.parse(n) : n;
|
|
113
1082
|
}
|
|
1083
|
+
static registerCustomType() {
|
|
1084
|
+
}
|
|
114
1085
|
};
|
|
115
|
-
const
|
|
116
|
-
new
|
|
117
|
-
new
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
1086
|
+
const fe = new Ss();
|
|
1087
|
+
new Is();
|
|
1088
|
+
new Us();
|
|
1089
|
+
new xs();
|
|
1090
|
+
const Ns = (s) => s != null && typeof s == "object" && "toString" in s, Es = (s, e = !1) => {
|
|
1091
|
+
const t = Ns(s) ? "stringer" : typeof s;
|
|
1092
|
+
let r;
|
|
121
1093
|
switch (t) {
|
|
122
1094
|
case "string":
|
|
123
|
-
|
|
1095
|
+
r = (n, a) => n.localeCompare(a);
|
|
124
1096
|
break;
|
|
125
1097
|
case "stringer":
|
|
126
|
-
|
|
1098
|
+
r = (n, a) => n.toString().localeCompare(a.toString());
|
|
127
1099
|
break;
|
|
128
1100
|
case "number":
|
|
129
|
-
|
|
1101
|
+
r = (n, a) => Number(n) - Number(a);
|
|
130
1102
|
break;
|
|
131
1103
|
case "bigint":
|
|
132
|
-
|
|
1104
|
+
r = (n, a) => BigInt(n) - BigInt(a) > 0n ? 1 : -1;
|
|
133
1105
|
break;
|
|
134
1106
|
case "boolean":
|
|
135
|
-
|
|
1107
|
+
r = (n, a) => Number(n) - Number(a);
|
|
136
1108
|
break;
|
|
137
1109
|
case "undefined":
|
|
138
|
-
|
|
1110
|
+
r = () => 0;
|
|
139
1111
|
break;
|
|
140
1112
|
default:
|
|
141
1113
|
return console.warn(`sortFunc: unknown type ${t}`), () => -1;
|
|
142
1114
|
}
|
|
143
|
-
return e ?
|
|
144
|
-
},
|
|
1115
|
+
return e ? As(r) : r;
|
|
1116
|
+
}, As = (s) => (e, t) => s(t, e), we = i.tuple([i.number(), i.number()]);
|
|
145
1117
|
i.tuple([i.bigint(), i.bigint()]);
|
|
146
|
-
const
|
|
1118
|
+
const yt = i.object({ width: i.number(), height: i.number() }), Bs = i.object({
|
|
147
1119
|
signedWidth: i.number(),
|
|
148
1120
|
signedHeight: i.number()
|
|
149
|
-
}),
|
|
150
|
-
i.enum(
|
|
151
|
-
const
|
|
152
|
-
i.enum(
|
|
153
|
-
const
|
|
154
|
-
i.enum(
|
|
155
|
-
const
|
|
156
|
-
i.enum(
|
|
157
|
-
const
|
|
158
|
-
i.enum(
|
|
159
|
-
const
|
|
160
|
-
i.union([
|
|
161
|
-
i.union([
|
|
162
|
-
i.enum([...
|
|
163
|
-
i.union([
|
|
164
|
-
const
|
|
1121
|
+
}), $s = ["width", "height"];
|
|
1122
|
+
i.enum($s);
|
|
1123
|
+
const Ms = ["start", "center", "end"], Cs = ["signedWidth", "signedHeight"];
|
|
1124
|
+
i.enum(Cs);
|
|
1125
|
+
const pe = i.object({ x: i.number(), y: i.number() }), Rs = i.object({ clientX: i.number(), clientY: i.number() }), Ds = ["x", "y"], wt = i.enum(Ds), mt = ["top", "right", "bottom", "left"];
|
|
1126
|
+
i.enum(mt);
|
|
1127
|
+
const Ls = ["left", "right"], bt = i.enum(Ls), ks = ["top", "bottom"], vt = i.enum(ks), Tt = ["center"], Ve = i.enum(Tt), Ps = [...mt, ...Tt], Ot = i.enum(Ps);
|
|
1128
|
+
i.enum(Ms);
|
|
1129
|
+
const js = ["first", "last"];
|
|
1130
|
+
i.enum(js);
|
|
1131
|
+
const Fs = i.object({ lower: i.number(), upper: i.number() }), zs = i.object({ lower: i.bigint(), upper: i.bigint() });
|
|
1132
|
+
i.union([Fs, we]);
|
|
1133
|
+
i.union([zs, we]);
|
|
1134
|
+
i.enum([...wt.options, ...Ot.options]);
|
|
1135
|
+
i.union([wt, Ot, i.instanceof(String)]);
|
|
1136
|
+
const Ys = (s) => typeof s == "bigint" || s instanceof BigInt, W = (s, e) => Ys(s) ? s.valueOf() * BigInt(e.valueOf()) : s.valueOf() * Number(e.valueOf()), z = (s, e) => {
|
|
165
1137
|
const t = {};
|
|
166
|
-
if (typeof
|
|
167
|
-
e != null ? (t.lower =
|
|
168
|
-
else if (Array.isArray(
|
|
169
|
-
if (
|
|
170
|
-
[t.lower, t.upper] =
|
|
171
|
-
} else return
|
|
172
|
-
return
|
|
173
|
-
},
|
|
174
|
-
const t =
|
|
1138
|
+
if (typeof s == "number" || typeof s == "bigint")
|
|
1139
|
+
e != null ? (t.lower = s, t.upper = e) : (t.lower = typeof s == "bigint" ? 0n : 0, t.upper = s);
|
|
1140
|
+
else if (Array.isArray(s)) {
|
|
1141
|
+
if (s.length !== 2) throw new Error("bounds: expected array of length 2");
|
|
1142
|
+
[t.lower, t.upper] = s;
|
|
1143
|
+
} else return He(s);
|
|
1144
|
+
return He(t);
|
|
1145
|
+
}, He = (s) => s.lower > s.upper ? { lower: s.upper, upper: s.lower } : s, Ze = (s, e) => {
|
|
1146
|
+
const t = z(s);
|
|
175
1147
|
return e < t.lower ? t.lower : e >= t.upper ? t.upper - (typeof t.upper == "number" ? 1 : 1n) : e;
|
|
176
1148
|
};
|
|
177
1149
|
i.object({
|
|
178
|
-
x:
|
|
179
|
-
y:
|
|
1150
|
+
x: bt.or(Ve),
|
|
1151
|
+
y: vt.or(Ve)
|
|
180
1152
|
});
|
|
181
|
-
const
|
|
1153
|
+
const Ws = i.object({ x: bt, y: vt }), qs = Object.freeze({ x: "left", y: "top" }), Vs = (s, e) => s.x === e.x && s.y === e.y, Ge = i.union([
|
|
182
1154
|
i.number(),
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
]),
|
|
189
|
-
if (typeof
|
|
1155
|
+
pe,
|
|
1156
|
+
we,
|
|
1157
|
+
yt,
|
|
1158
|
+
Bs,
|
|
1159
|
+
Rs
|
|
1160
|
+
]), Hs = (s, e) => {
|
|
1161
|
+
if (typeof s == "string") {
|
|
190
1162
|
if (e === void 0) throw new Error("The y coordinate must be given.");
|
|
191
|
-
return
|
|
1163
|
+
return s === "x" ? { x: e, y: 0 } : { x: 0, y: e };
|
|
192
1164
|
}
|
|
193
|
-
return typeof
|
|
194
|
-
},
|
|
1165
|
+
return typeof s == "number" ? { x: s, y: e ?? s } : Array.isArray(s) ? { x: s[0], y: s[1] } : "signedWidth" in s ? { x: s.signedWidth, y: s.signedHeight } : "clientX" in s ? { x: s.clientX, y: s.clientY } : "width" in s ? { x: s.width, y: s.height } : { x: s.x, y: s.y };
|
|
1166
|
+
}, Ke = Object.freeze({ x: 0, y: 0 }), le = i.union([i.number(), i.string()]);
|
|
195
1167
|
i.object({
|
|
196
|
-
top:
|
|
197
|
-
left:
|
|
198
|
-
width:
|
|
199
|
-
height:
|
|
1168
|
+
top: le,
|
|
1169
|
+
left: le,
|
|
1170
|
+
width: le,
|
|
1171
|
+
height: le
|
|
200
1172
|
});
|
|
201
1173
|
i.object({
|
|
202
1174
|
left: i.number(),
|
|
@@ -205,63 +1177,63 @@ i.object({
|
|
|
205
1177
|
bottom: i.number()
|
|
206
1178
|
});
|
|
207
1179
|
i.object({
|
|
208
|
-
one:
|
|
209
|
-
two:
|
|
210
|
-
root:
|
|
1180
|
+
one: pe,
|
|
1181
|
+
two: pe,
|
|
1182
|
+
root: Ws
|
|
211
1183
|
});
|
|
212
|
-
const
|
|
1184
|
+
const Pe = (s, e, t = 0, r = 0, n) => {
|
|
213
1185
|
const a = {
|
|
214
|
-
one: {
|
|
215
|
-
two: {
|
|
216
|
-
root:
|
|
1186
|
+
one: { ...Ke },
|
|
1187
|
+
two: { ...Ke },
|
|
1188
|
+
root: n ?? qs
|
|
217
1189
|
};
|
|
218
|
-
if (typeof
|
|
1190
|
+
if (typeof s == "number") {
|
|
219
1191
|
if (typeof e != "number")
|
|
220
1192
|
throw new Error("Box constructor called with invalid arguments");
|
|
221
|
-
return a.one = { x:
|
|
1193
|
+
return a.one = { x: s, y: e }, a.two = { x: a.one.x + t, y: a.one.y + r }, a;
|
|
222
1194
|
}
|
|
223
|
-
return "one" in
|
|
1195
|
+
return "one" in s && "two" in s && "root" in s ? { ...s, root: n ?? s.root } : ("getBoundingClientRect" in s && (s = s.getBoundingClientRect()), "left" in s ? (a.one = { x: s.left, y: s.top }, a.two = { x: s.right, y: s.bottom }, a) : (a.one = s, e == null ? a.two = { x: a.one.x + t, y: a.one.y + r } : typeof e == "number" ? a.two = { x: a.one.x + e, y: a.one.y + t } : "width" in e ? a.two = {
|
|
224
1196
|
x: a.one.x + e.width,
|
|
225
1197
|
y: a.one.y + e.height
|
|
226
1198
|
} : "signedWidth" in e ? a.two = {
|
|
227
1199
|
x: a.one.x + e.signedWidth,
|
|
228
1200
|
y: a.one.y + e.signedHeight
|
|
229
1201
|
} : a.two = e, a));
|
|
230
|
-
},
|
|
231
|
-
const e =
|
|
1202
|
+
}, Te = (s) => {
|
|
1203
|
+
const e = Pe(s);
|
|
232
1204
|
return { lower: e.one.x, upper: e.two.x };
|
|
233
|
-
},
|
|
234
|
-
const e =
|
|
1205
|
+
}, Oe = (s) => {
|
|
1206
|
+
const e = Pe(s);
|
|
235
1207
|
return { lower: e.one.y, upper: e.two.y };
|
|
236
|
-
},
|
|
237
|
-
i.union([
|
|
238
|
-
var
|
|
239
|
-
const
|
|
240
|
-
i.object({ offset:
|
|
1208
|
+
}, Zs = (s) => typeof s != "object" || s == null ? !1 : "one" in s && "two" in s && "root" in s, Gs = i.object({ signedWidth: i.number(), signedHeight: i.number() });
|
|
1209
|
+
i.union([yt, Gs, pe, we]);
|
|
1210
|
+
var Ks = Object.defineProperty, Js = (s, e, t) => e in s ? Ks(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, k = (s, e, t) => Js(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1211
|
+
const Xs = (s, e, t) => e !== void 0 && s < e ? e : t !== void 0 && s > t ? t : s;
|
|
1212
|
+
i.object({ offset: Ge, scale: Ge });
|
|
241
1213
|
i.object({ offset: i.number(), scale: i.number() });
|
|
242
|
-
const
|
|
1214
|
+
const Qs = (s) => (e, t, r, n) => t === "dimension" ? [e, r] : [
|
|
243
1215
|
e,
|
|
244
|
-
|
|
245
|
-
],
|
|
1216
|
+
n ? r - s : r + s
|
|
1217
|
+
], _s = (s) => (e, t, r, n) => [
|
|
246
1218
|
e,
|
|
247
|
-
|
|
248
|
-
],
|
|
249
|
-
if (e === null) return [
|
|
250
|
-
const { lower:
|
|
251
|
-
if (t === "dimension") return [
|
|
252
|
-
const
|
|
253
|
-
return [
|
|
254
|
-
},
|
|
255
|
-
if (
|
|
256
|
-
if (e === "dimension") return [
|
|
257
|
-
const { lower:
|
|
258
|
-
return [
|
|
259
|
-
},
|
|
260
|
-
const { lower:
|
|
261
|
-
return
|
|
262
|
-
},
|
|
1219
|
+
n ? r / s : r * s
|
|
1220
|
+
], er = (s) => (e, t, r) => {
|
|
1221
|
+
if (e === null) return [s, r];
|
|
1222
|
+
const { lower: n, upper: a } = e, { lower: o, upper: c } = s, d = a - n, p = c - o;
|
|
1223
|
+
if (t === "dimension") return [s, r * (p / d)];
|
|
1224
|
+
const y = (r - n) * (p / d) + o;
|
|
1225
|
+
return [s, y];
|
|
1226
|
+
}, tr = (s) => (e, t, r) => [s, r], sr = () => (s, e, t) => {
|
|
1227
|
+
if (s === null) throw new Error("cannot invert without bounds");
|
|
1228
|
+
if (e === "dimension") return [s, t];
|
|
1229
|
+
const { lower: r, upper: n } = s;
|
|
1230
|
+
return [s, n - (t - r)];
|
|
1231
|
+
}, rr = (s) => (e, t, r) => {
|
|
1232
|
+
const { lower: n, upper: a } = s;
|
|
1233
|
+
return r = Xs(r, n, a), [e, r];
|
|
1234
|
+
}, Ee = class _ {
|
|
263
1235
|
constructor() {
|
|
264
|
-
|
|
1236
|
+
k(this, "ops", []), k(this, "currBounds", null), k(this, "currType", null), k(this, "reversed", !1), this.ops = [];
|
|
265
1237
|
}
|
|
266
1238
|
/**
|
|
267
1239
|
* @returns a new scale with a translation as its first operation. Any number provided
|
|
@@ -269,7 +1241,7 @@ const Zt = (r) => (e, t, n, s) => t === "dimension" ? [e, n] : [
|
|
|
269
1241
|
* @param value - The amount to translate by.
|
|
270
1242
|
*/
|
|
271
1243
|
static translate(e) {
|
|
272
|
-
return new
|
|
1244
|
+
return new _().translate(e);
|
|
273
1245
|
}
|
|
274
1246
|
/**
|
|
275
1247
|
* @returns a new scale with a magnification as its first operation. Any number provided
|
|
@@ -277,10 +1249,10 @@ const Zt = (r) => (e, t, n, s) => t === "dimension" ? [e, n] : [
|
|
|
277
1249
|
* @param value - The amount to translate by.
|
|
278
1250
|
*/
|
|
279
1251
|
static magnify(e) {
|
|
280
|
-
return new
|
|
1252
|
+
return new _().magnify(e);
|
|
281
1253
|
}
|
|
282
1254
|
static scale(e, t) {
|
|
283
|
-
return new
|
|
1255
|
+
return new _().scale(e, t);
|
|
284
1256
|
}
|
|
285
1257
|
/**
|
|
286
1258
|
* @returns a copy of the scale with a translation as its next operation. Any
|
|
@@ -289,8 +1261,8 @@ const Zt = (r) => (e, t, n, s) => t === "dimension" ? [e, n] : [
|
|
|
289
1261
|
* @param value - The amount to translate by.
|
|
290
1262
|
*/
|
|
291
1263
|
translate(e) {
|
|
292
|
-
const t = this.new(),
|
|
293
|
-
return
|
|
1264
|
+
const t = this.new(), r = Qs(e);
|
|
1265
|
+
return r.type = "translate", t.ops.push(r), t;
|
|
294
1266
|
}
|
|
295
1267
|
/**
|
|
296
1268
|
* @returns a copy of the scale with a translation as its next operation. Any number
|
|
@@ -299,23 +1271,23 @@ const Zt = (r) => (e, t, n, s) => t === "dimension" ? [e, n] : [
|
|
|
299
1271
|
* @param value - The amount to magnify by.
|
|
300
1272
|
*/
|
|
301
1273
|
magnify(e) {
|
|
302
|
-
const t = this.new(),
|
|
303
|
-
return
|
|
1274
|
+
const t = this.new(), r = _s(e);
|
|
1275
|
+
return r.type = "magnify", t.ops.push(r), t;
|
|
304
1276
|
}
|
|
305
1277
|
scale(e, t) {
|
|
306
|
-
const
|
|
307
|
-
return a.type = "scale",
|
|
1278
|
+
const r = z(e, t), n = this.new(), a = er(r);
|
|
1279
|
+
return a.type = "scale", n.ops.push(a), n;
|
|
308
1280
|
}
|
|
309
1281
|
clamp(e, t) {
|
|
310
|
-
const
|
|
311
|
-
return a.type = "clamp",
|
|
1282
|
+
const r = z(e, t), n = this.new(), a = rr(r);
|
|
1283
|
+
return a.type = "clamp", n.ops.push(a), n;
|
|
312
1284
|
}
|
|
313
1285
|
reBound(e, t) {
|
|
314
|
-
const
|
|
315
|
-
return a.type = "re-bound",
|
|
1286
|
+
const r = z(e, t), n = this.new(), a = tr(r);
|
|
1287
|
+
return a.type = "re-bound", n.ops.push(a), n;
|
|
316
1288
|
}
|
|
317
1289
|
invert() {
|
|
318
|
-
const e =
|
|
1290
|
+
const e = sr();
|
|
319
1291
|
e.type = "invert";
|
|
320
1292
|
const t = this.new();
|
|
321
1293
|
return t.ops.push(e), t;
|
|
@@ -327,12 +1299,12 @@ const Zt = (r) => (e, t, n, s) => t === "dimension" ? [e, n] : [
|
|
|
327
1299
|
return this.exec("dimension", e);
|
|
328
1300
|
}
|
|
329
1301
|
new() {
|
|
330
|
-
const e = new
|
|
1302
|
+
const e = new _();
|
|
331
1303
|
return e.ops = this.ops.slice(), e.reversed = this.reversed, e;
|
|
332
1304
|
}
|
|
333
1305
|
exec(e, t) {
|
|
334
1306
|
return this.currBounds = null, this.ops.reduce(
|
|
335
|
-
([
|
|
1307
|
+
([r, n], a) => a(r, e, n, this.reversed),
|
|
336
1308
|
[null, t]
|
|
337
1309
|
)[1];
|
|
338
1310
|
}
|
|
@@ -340,50 +1312,50 @@ const Zt = (r) => (e, t, n, s) => t === "dimension" ? [e, n] : [
|
|
|
340
1312
|
const e = this.new();
|
|
341
1313
|
e.ops.reverse();
|
|
342
1314
|
const t = [];
|
|
343
|
-
return e.ops.forEach((
|
|
344
|
-
if (
|
|
1315
|
+
return e.ops.forEach((r, n) => {
|
|
1316
|
+
if (r.type === "scale" || t.some(([o, c]) => n >= o && n <= c))
|
|
345
1317
|
return;
|
|
346
|
-
const a = e.ops.findIndex((
|
|
347
|
-
a !== -1 && t.push([
|
|
348
|
-
}), t.forEach(([
|
|
349
|
-
const a = e.ops.slice(
|
|
350
|
-
a.unshift(e.ops[
|
|
1318
|
+
const a = e.ops.findIndex((o, c) => o.type === "scale" && c > n);
|
|
1319
|
+
a !== -1 && t.push([n, a]);
|
|
1320
|
+
}), t.forEach(([r, n]) => {
|
|
1321
|
+
const a = e.ops.slice(r, n);
|
|
1322
|
+
a.unshift(e.ops[n]), e.ops.splice(r, n - r + 1, ...a);
|
|
351
1323
|
}), e.reversed = !e.reversed, e;
|
|
352
1324
|
}
|
|
353
1325
|
get transform() {
|
|
354
1326
|
return { scale: this.dim(1), offset: this.pos(0) };
|
|
355
1327
|
}
|
|
356
1328
|
};
|
|
357
|
-
|
|
358
|
-
let
|
|
359
|
-
const
|
|
360
|
-
constructor(e = new
|
|
361
|
-
|
|
1329
|
+
k(Ee, "IDENTITY", new Ee());
|
|
1330
|
+
let Je = Ee;
|
|
1331
|
+
const Xe = class L {
|
|
1332
|
+
constructor(e = new Je(), t = new Je(), r = null) {
|
|
1333
|
+
k(this, "x"), k(this, "y"), k(this, "currRoot"), this.x = e, this.y = t, this.currRoot = r;
|
|
362
1334
|
}
|
|
363
1335
|
static translate(e, t) {
|
|
364
|
-
return new
|
|
1336
|
+
return new L().translate(e, t);
|
|
365
1337
|
}
|
|
366
1338
|
static translateX(e) {
|
|
367
|
-
return new
|
|
1339
|
+
return new L().translateX(e);
|
|
368
1340
|
}
|
|
369
1341
|
static translateY(e) {
|
|
370
|
-
return new
|
|
1342
|
+
return new L().translateY(e);
|
|
371
1343
|
}
|
|
372
1344
|
static clamp(e) {
|
|
373
|
-
return new
|
|
1345
|
+
return new L().clamp(e);
|
|
374
1346
|
}
|
|
375
1347
|
static magnify(e) {
|
|
376
|
-
return new
|
|
1348
|
+
return new L().magnify(e);
|
|
377
1349
|
}
|
|
378
1350
|
static scale(e) {
|
|
379
|
-
return new
|
|
1351
|
+
return new L().scale(e);
|
|
380
1352
|
}
|
|
381
1353
|
static reBound(e) {
|
|
382
|
-
return new
|
|
1354
|
+
return new L().reBound(e);
|
|
383
1355
|
}
|
|
384
1356
|
translate(e, t) {
|
|
385
|
-
const
|
|
386
|
-
return
|
|
1357
|
+
const r = Hs(e, t), n = this.copy();
|
|
1358
|
+
return n.x = this.x.translate(r.x), n.y = this.y.translate(r.y), n;
|
|
387
1359
|
}
|
|
388
1360
|
translateX(e) {
|
|
389
1361
|
const t = this.copy();
|
|
@@ -399,22 +1371,22 @@ const Be = class D {
|
|
|
399
1371
|
}
|
|
400
1372
|
scale(e) {
|
|
401
1373
|
const t = this.copy();
|
|
402
|
-
if (
|
|
403
|
-
const
|
|
404
|
-
return t.currRoot = e.root,
|
|
1374
|
+
if (Zs(e)) {
|
|
1375
|
+
const r = this.currRoot;
|
|
1376
|
+
return t.currRoot = e.root, r != null && !Vs(r, e.root) && (r.x !== e.root.x && (t.x = t.x.invert()), r.y !== e.root.y && (t.y = t.y.invert())), t.x = t.x.scale(Te(e)), t.y = t.y.scale(Oe(e)), t;
|
|
405
1377
|
}
|
|
406
1378
|
return t.x = t.x.scale(e.width), t.y = t.y.scale(e.height), t;
|
|
407
1379
|
}
|
|
408
1380
|
reBound(e) {
|
|
409
1381
|
const t = this.copy();
|
|
410
|
-
return t.x = this.x.reBound(
|
|
1382
|
+
return t.x = this.x.reBound(Te(e)), t.y = this.y.reBound(Oe(e)), t;
|
|
411
1383
|
}
|
|
412
1384
|
clamp(e) {
|
|
413
1385
|
const t = this.copy();
|
|
414
|
-
return t.x = this.x.clamp(
|
|
1386
|
+
return t.x = this.x.clamp(Te(e)), t.y = this.y.clamp(Oe(e)), t;
|
|
415
1387
|
}
|
|
416
1388
|
copy() {
|
|
417
|
-
const e = new
|
|
1389
|
+
const e = new L();
|
|
418
1390
|
return e.currRoot = this.currRoot, e.x = this.x, e.y = this.y, e;
|
|
419
1391
|
}
|
|
420
1392
|
reverse() {
|
|
@@ -428,7 +1400,7 @@ const Be = class D {
|
|
|
428
1400
|
return { x: this.x.dim(e.x), y: this.y.dim(e.y) };
|
|
429
1401
|
}
|
|
430
1402
|
box(e) {
|
|
431
|
-
return
|
|
1403
|
+
return Pe(
|
|
432
1404
|
this.pos(e.one),
|
|
433
1405
|
this.pos(e.two),
|
|
434
1406
|
0,
|
|
@@ -443,66 +1415,63 @@ const Be = class D {
|
|
|
443
1415
|
};
|
|
444
1416
|
}
|
|
445
1417
|
};
|
|
446
|
-
|
|
447
|
-
var
|
|
448
|
-
let
|
|
449
|
-
let
|
|
450
|
-
for (;
|
|
451
|
-
|
|
452
|
-
return
|
|
1418
|
+
k(Xe, "IDENTITY", new Xe());
|
|
1419
|
+
var nr = Object.defineProperty, ir = (s, e, t) => e in s ? nr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, h = (s, e, t) => ir(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1420
|
+
let ar = (s, e = 21) => (t = e) => {
|
|
1421
|
+
let r = "", n = t | 0;
|
|
1422
|
+
for (; n--; )
|
|
1423
|
+
r += s[Math.random() * s.length | 0];
|
|
1424
|
+
return r;
|
|
453
1425
|
};
|
|
454
|
-
const
|
|
455
|
-
const t = new
|
|
1426
|
+
const or = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", hr = ar(or, 11), ur = () => hr(), cr = i.enum(["static", "dynamic"]), St = (s, e) => {
|
|
1427
|
+
const t = new T(e);
|
|
456
1428
|
if (![
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
].some((
|
|
1429
|
+
w.DAY,
|
|
1430
|
+
w.HOUR,
|
|
1431
|
+
w.MINUTE,
|
|
1432
|
+
w.SECOND,
|
|
1433
|
+
w.MILLISECOND,
|
|
1434
|
+
w.MICROSECOND,
|
|
1435
|
+
w.NANOSECOND
|
|
1436
|
+
].some((n) => n.equals(t)))
|
|
465
1437
|
throw new Error(
|
|
466
1438
|
"Invalid argument for remainder. Must be an even TimeSpan or Timestamp"
|
|
467
1439
|
);
|
|
468
|
-
const
|
|
469
|
-
return
|
|
470
|
-
},
|
|
1440
|
+
const r = s.valueOf() % t.valueOf();
|
|
1441
|
+
return s instanceof T ? new T(r) : new w(r);
|
|
1442
|
+
}, m = class f {
|
|
471
1443
|
constructor(e, t = "UTC") {
|
|
472
|
-
if (
|
|
1444
|
+
if (h(this, "value"), h(this, "encodeValue", !0), e == null) this.value = f.now().valueOf();
|
|
473
1445
|
else if (e instanceof Date)
|
|
474
|
-
this.value = BigInt(e.getTime()) *
|
|
1446
|
+
this.value = BigInt(e.getTime()) * f.MILLISECOND.valueOf();
|
|
475
1447
|
else if (typeof e == "string")
|
|
476
|
-
this.value =
|
|
477
|
-
else if (Array.isArray(e)) this.value =
|
|
1448
|
+
this.value = f.parseDateTimeString(e, t).valueOf();
|
|
1449
|
+
else if (Array.isArray(e)) this.value = f.parseDate(e);
|
|
478
1450
|
else {
|
|
479
|
-
let
|
|
480
|
-
e instanceof Number && (e = e.valueOf()), t === "local" && (
|
|
1451
|
+
let r = BigInt(0);
|
|
1452
|
+
e instanceof Number && (e = e.valueOf()), t === "local" && (r = f.utcOffset.valueOf()), typeof e == "number" && (isFinite(e) ? e = Math.trunc(e) : (isNaN(e) && (e = 0), e === 1 / 0 ? e = f.MAX : e = f.MIN)), this.value = BigInt(e.valueOf()) + r;
|
|
481
1453
|
}
|
|
482
1454
|
}
|
|
483
|
-
static parseDate([e = 1970, t = 1,
|
|
484
|
-
const
|
|
485
|
-
return new
|
|
486
|
-
}
|
|
487
|
-
encode() {
|
|
488
|
-
return this.value.toString();
|
|
1455
|
+
static parseDate([e = 1970, t = 1, r = 1]) {
|
|
1456
|
+
const n = new Date(e, t - 1, r, 0, 0, 0, 0);
|
|
1457
|
+
return new f(BigInt(n.getTime()) * f.MILLISECOND.valueOf()).truncate(f.DAY).valueOf();
|
|
489
1458
|
}
|
|
490
1459
|
valueOf() {
|
|
491
1460
|
return this.value;
|
|
492
1461
|
}
|
|
493
1462
|
static parseTimeString(e, t = "UTC") {
|
|
494
|
-
const [
|
|
495
|
-
let
|
|
496
|
-
a != null && ([
|
|
497
|
-
let d =
|
|
498
|
-
return t === "local" && (d = d.add(
|
|
1463
|
+
const [r, n, a] = e.split(":");
|
|
1464
|
+
let o = "00", c = "00";
|
|
1465
|
+
a != null && ([o, c] = a.split("."));
|
|
1466
|
+
let d = f.hours(parseInt(r ?? "00")).add(f.minutes(parseInt(n ?? "00"))).add(f.seconds(parseInt(o ?? "00"))).add(f.milliseconds(parseInt(c ?? "00")));
|
|
1467
|
+
return t === "local" && (d = d.add(f.utcOffset)), d.valueOf();
|
|
499
1468
|
}
|
|
500
1469
|
static parseDateTimeString(e, t = "UTC") {
|
|
501
1470
|
if (!e.includes("/") && !e.includes("-"))
|
|
502
|
-
return
|
|
503
|
-
const
|
|
504
|
-
return e.includes(":") ||
|
|
505
|
-
BigInt(
|
|
1471
|
+
return f.parseTimeString(e, t);
|
|
1472
|
+
const r = new Date(e);
|
|
1473
|
+
return e.includes(":") || r.setUTCHours(0, 0, 0, 0), new f(
|
|
1474
|
+
BigInt(r.getTime()) * f.MILLISECOND.valueOf(),
|
|
506
1475
|
t
|
|
507
1476
|
).valueOf();
|
|
508
1477
|
}
|
|
@@ -527,19 +1496,19 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
527
1496
|
}
|
|
528
1497
|
}
|
|
529
1498
|
toISOString(e = "UTC") {
|
|
530
|
-
return e === "UTC" ? this.date().toISOString() : this.sub(
|
|
1499
|
+
return e === "UTC" ? this.date().toISOString() : this.sub(f.utcOffset).date().toISOString();
|
|
531
1500
|
}
|
|
532
1501
|
timeString(e = !1, t = "UTC") {
|
|
533
|
-
const
|
|
534
|
-
return e ?
|
|
1502
|
+
const r = this.toISOString(t);
|
|
1503
|
+
return e ? r.slice(11, 23) : r.slice(11, 19);
|
|
535
1504
|
}
|
|
536
1505
|
dateString() {
|
|
537
|
-
const e = this.date(), t = e.toLocaleString("default", { month: "short" }),
|
|
538
|
-
return `${t} ${
|
|
1506
|
+
const e = this.date(), t = e.toLocaleString("default", { month: "short" }), r = e.toLocaleString("default", { day: "numeric" });
|
|
1507
|
+
return `${t} ${r}`;
|
|
539
1508
|
}
|
|
540
1509
|
static get utcOffset() {
|
|
541
|
-
return new
|
|
542
|
-
BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) *
|
|
1510
|
+
return new w(
|
|
1511
|
+
BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * f.MINUTE.valueOf()
|
|
543
1512
|
);
|
|
544
1513
|
}
|
|
545
1514
|
/**
|
|
@@ -548,7 +1517,7 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
548
1517
|
* @param other - The other timestamp.
|
|
549
1518
|
*/
|
|
550
1519
|
static since(e) {
|
|
551
|
-
return new
|
|
1520
|
+
return new f().span(e);
|
|
552
1521
|
}
|
|
553
1522
|
/** @returns A JavaScript Date object representing the TimeStamp. */
|
|
554
1523
|
date() {
|
|
@@ -561,7 +1530,7 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
561
1530
|
* @returns True if the TimeStamps are equal, false otherwise.
|
|
562
1531
|
*/
|
|
563
1532
|
equals(e) {
|
|
564
|
-
return this.valueOf() === new
|
|
1533
|
+
return this.valueOf() === new f(e).valueOf();
|
|
565
1534
|
}
|
|
566
1535
|
/**
|
|
567
1536
|
* Creates a TimeSpan representing the duration between the two timestamps.
|
|
@@ -581,7 +1550,7 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
581
1550
|
* valid, regardless of the TimeStamp order.
|
|
582
1551
|
*/
|
|
583
1552
|
range(e) {
|
|
584
|
-
return new
|
|
1553
|
+
return new ae(this, e).makeValid();
|
|
585
1554
|
}
|
|
586
1555
|
/**
|
|
587
1556
|
* Creates a TimeRange starting at the TimeStamp and spanning the given
|
|
@@ -610,7 +1579,7 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
610
1579
|
* otherwise.
|
|
611
1580
|
*/
|
|
612
1581
|
after(e) {
|
|
613
|
-
return this.valueOf() > new
|
|
1582
|
+
return this.valueOf() > new f(e).valueOf();
|
|
614
1583
|
}
|
|
615
1584
|
/**
|
|
616
1585
|
* Checks if the TimeStamp is after or equal to the given TimeStamp.
|
|
@@ -620,7 +1589,7 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
620
1589
|
* false otherwise.
|
|
621
1590
|
*/
|
|
622
1591
|
afterEq(e) {
|
|
623
|
-
return this.valueOf() >= new
|
|
1592
|
+
return this.valueOf() >= new f(e).valueOf();
|
|
624
1593
|
}
|
|
625
1594
|
/**
|
|
626
1595
|
* Checks if the TimeStamp is before the given TimeStamp.
|
|
@@ -630,7 +1599,7 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
630
1599
|
* otherwise.
|
|
631
1600
|
*/
|
|
632
1601
|
before(e) {
|
|
633
|
-
return this.valueOf() < new
|
|
1602
|
+
return this.valueOf() < new f(e).valueOf();
|
|
634
1603
|
}
|
|
635
1604
|
/**
|
|
636
1605
|
* Checks if TimeStamp is before or equal to the current timestamp.
|
|
@@ -640,7 +1609,7 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
640
1609
|
* false otherwise.
|
|
641
1610
|
*/
|
|
642
1611
|
beforeEq(e) {
|
|
643
|
-
return this.valueOf() <= new
|
|
1612
|
+
return this.valueOf() <= new f(e).valueOf();
|
|
644
1613
|
}
|
|
645
1614
|
/**
|
|
646
1615
|
* Adds a TimeSpan to the TimeStamp.
|
|
@@ -650,7 +1619,7 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
650
1619
|
* TimeSpan.
|
|
651
1620
|
*/
|
|
652
1621
|
add(e) {
|
|
653
|
-
return new
|
|
1622
|
+
return new f(this.valueOf() + BigInt(e.valueOf()));
|
|
654
1623
|
}
|
|
655
1624
|
/**
|
|
656
1625
|
* Subtracts a TimeSpan from the TimeStamp.
|
|
@@ -660,45 +1629,49 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
660
1629
|
* TimeSpan.
|
|
661
1630
|
*/
|
|
662
1631
|
sub(e) {
|
|
663
|
-
return new
|
|
1632
|
+
return new f(this.valueOf() - BigInt(e.valueOf()));
|
|
664
1633
|
}
|
|
665
1634
|
/**
|
|
666
1635
|
* @returns the floating point number of hours since the unix epoch to the timestamp
|
|
667
1636
|
* value.
|
|
668
1637
|
*/
|
|
669
1638
|
get hours() {
|
|
670
|
-
return Number(this.valueOf()) / Number(
|
|
1639
|
+
return Number(this.valueOf()) / Number(w.HOUR.valueOf());
|
|
671
1640
|
}
|
|
672
1641
|
/**
|
|
673
1642
|
* @returns the floating point number of minutes since the unix epoch to the timestamp
|
|
674
1643
|
* value.
|
|
675
1644
|
*/
|
|
676
1645
|
get minutes() {
|
|
677
|
-
return Number(this.valueOf()) / Number(
|
|
1646
|
+
return Number(this.valueOf()) / Number(w.MINUTE.valueOf());
|
|
678
1647
|
}
|
|
679
1648
|
/**
|
|
680
1649
|
* @returns the floating point number of days since the unix epoch to the timestamp
|
|
681
1650
|
* value.
|
|
682
1651
|
*/
|
|
683
1652
|
get days() {
|
|
684
|
-
return Number(this.valueOf()) / Number(
|
|
1653
|
+
return Number(this.valueOf()) / Number(w.DAY.valueOf());
|
|
685
1654
|
}
|
|
686
1655
|
/**
|
|
687
1656
|
* @returns the floating point number of seconds since the unix epoch to the timestamp
|
|
688
1657
|
* value.
|
|
689
1658
|
*/
|
|
690
1659
|
get seconds() {
|
|
691
|
-
return Number(this.valueOf()) / Number(
|
|
1660
|
+
return Number(this.valueOf()) / Number(w.SECOND.valueOf());
|
|
692
1661
|
}
|
|
693
|
-
/**
|
|
694
|
-
* @returns The number of milliseconds since the unix epoch.
|
|
695
|
-
*/
|
|
1662
|
+
/** @returns the floating point number of milliseconds since the unix epoch. */
|
|
696
1663
|
get milliseconds() {
|
|
697
|
-
return Number(this.valueOf()) / Number(
|
|
1664
|
+
return Number(this.valueOf()) / Number(f.MILLISECOND.valueOf());
|
|
698
1665
|
}
|
|
1666
|
+
/** @returns the floating point number of microseconds since the unix epoch */
|
|
699
1667
|
get microseconds() {
|
|
700
|
-
return Number(this.valueOf()) / Number(
|
|
1668
|
+
return Number(this.valueOf()) / Number(f.MICROSECOND.valueOf());
|
|
701
1669
|
}
|
|
1670
|
+
/**
|
|
1671
|
+
* @returns the floating point number of nanoseconds since the unix epoch.
|
|
1672
|
+
* Note that since we're converting to float64, this reduces the resolution
|
|
1673
|
+
* to a quarter of a microsecond.
|
|
1674
|
+
*/
|
|
702
1675
|
get nanoseconds() {
|
|
703
1676
|
return Number(this.valueOf());
|
|
704
1677
|
}
|
|
@@ -706,63 +1679,102 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
706
1679
|
get year() {
|
|
707
1680
|
return this.date().getFullYear();
|
|
708
1681
|
}
|
|
1682
|
+
/**
|
|
1683
|
+
* @returns a copy of the timestamp with the year changed.
|
|
1684
|
+
* @param year the value to set the year to.
|
|
1685
|
+
*/
|
|
709
1686
|
setYear(e) {
|
|
710
1687
|
const t = this.date();
|
|
711
|
-
return t.setFullYear(e), new
|
|
1688
|
+
return t.setFullYear(e), new f(t);
|
|
712
1689
|
}
|
|
713
1690
|
/** @returns the integer month that the timestamp corresponds to with its year. */
|
|
714
1691
|
get month() {
|
|
715
|
-
return this.date().
|
|
1692
|
+
return this.date().getUTCMonth();
|
|
716
1693
|
}
|
|
1694
|
+
/**
|
|
1695
|
+
* @returns a copy of the timestamp with the month changed.
|
|
1696
|
+
* @param month the value to set the month to.
|
|
1697
|
+
*/
|
|
717
1698
|
setMonth(e) {
|
|
718
1699
|
const t = this.date();
|
|
719
|
-
return t.
|
|
1700
|
+
return t.setUTCMonth(e), new f(t);
|
|
720
1701
|
}
|
|
721
1702
|
/** @returns the integer day that the timestamp corresponds to within its month. */
|
|
722
1703
|
get day() {
|
|
723
|
-
return this.date().
|
|
1704
|
+
return this.date().getUTCDate();
|
|
724
1705
|
}
|
|
1706
|
+
/**
|
|
1707
|
+
* @returns a copy of the timestamp with the day changed.
|
|
1708
|
+
* @param day the value the set the day to.
|
|
1709
|
+
*/
|
|
725
1710
|
setDay(e) {
|
|
726
1711
|
const t = this.date();
|
|
727
|
-
return t.
|
|
1712
|
+
return t.setUTCDate(e), new f(t);
|
|
728
1713
|
}
|
|
729
|
-
/**
|
|
1714
|
+
/**
|
|
1715
|
+
* @returns the integer hour that the timestamp corresponds to within its day.
|
|
1716
|
+
*/
|
|
730
1717
|
get hour() {
|
|
731
|
-
return this.date().
|
|
1718
|
+
return this.date().getUTCHours();
|
|
732
1719
|
}
|
|
1720
|
+
/**
|
|
1721
|
+
* @returns a copy of the timestamp with the hour changed.
|
|
1722
|
+
* @param hour the value to set the hour to.
|
|
1723
|
+
*/
|
|
733
1724
|
setHour(e) {
|
|
734
1725
|
const t = this.date();
|
|
735
|
-
return t.
|
|
1726
|
+
return t.setUTCHours(e), new f(t, "UTC");
|
|
736
1727
|
}
|
|
737
1728
|
/** @returns the integer minute that the timestamp corresponds to within its hour. */
|
|
738
1729
|
get minute() {
|
|
739
1730
|
return this.date().getMinutes();
|
|
740
1731
|
}
|
|
1732
|
+
/**
|
|
1733
|
+
* @returns a copy of the timestamp with the minute changed.
|
|
1734
|
+
* @param minute the value to set the minute to.
|
|
1735
|
+
*/
|
|
741
1736
|
setMinute(e) {
|
|
742
1737
|
const t = this.date();
|
|
743
|
-
return t.
|
|
1738
|
+
return t.setUTCMinutes(e), new f(t);
|
|
744
1739
|
}
|
|
1740
|
+
/**
|
|
1741
|
+
* @returns the integer second that the timestamp corresponds to within its
|
|
1742
|
+
* minute.
|
|
1743
|
+
*/
|
|
745
1744
|
get second() {
|
|
746
1745
|
return this.date().getSeconds();
|
|
747
1746
|
}
|
|
1747
|
+
/**
|
|
1748
|
+
* @returns a copy of the timestamp with the second changed.
|
|
1749
|
+
* @param second the value to set the second to.
|
|
1750
|
+
*/
|
|
748
1751
|
setSecond(e) {
|
|
749
1752
|
const t = this.date();
|
|
750
|
-
return t.
|
|
1753
|
+
return t.setUTCSeconds(e), new f(t);
|
|
751
1754
|
}
|
|
1755
|
+
/**
|
|
1756
|
+
* @reutrns the integer millisecond that the timestamp corresponds to within
|
|
1757
|
+
* its second.
|
|
1758
|
+
*/
|
|
752
1759
|
get millisecond() {
|
|
753
1760
|
return this.date().getMilliseconds();
|
|
754
1761
|
}
|
|
1762
|
+
/**
|
|
1763
|
+
* @returns a copy of the timestamp with the milliseconds changed.
|
|
1764
|
+
* @param millisecond the value to set the millisecond to.
|
|
1765
|
+
*/
|
|
755
1766
|
setMillisecond(e) {
|
|
756
1767
|
const t = this.date();
|
|
757
|
-
return t.setMilliseconds(e), new
|
|
1768
|
+
return t.setMilliseconds(e), new f(t);
|
|
758
1769
|
}
|
|
1770
|
+
/** @returns the time stamp formatted as an ISO string. */
|
|
759
1771
|
toString() {
|
|
760
1772
|
return this.date().toISOString();
|
|
761
1773
|
}
|
|
762
1774
|
/**
|
|
763
1775
|
* @returns A new TimeStamp that is the remainder of the TimeStamp divided by the
|
|
764
1776
|
* given span. This is useful in cases where you want only part of a TimeStamp's value
|
|
765
|
-
* i.e
|
|
1777
|
+
* i.e., the hours, minutes, seconds, milliseconds, microseconds, and nanoseconds but
|
|
766
1778
|
* not the days, years, etc.
|
|
767
1779
|
*
|
|
768
1780
|
* @param divisor - The TimeSpan to divide by. Must be an even TimeSpan or TimeStamp. Even
|
|
@@ -771,11 +1783,11 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
771
1783
|
* @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
|
|
772
1784
|
*/
|
|
773
1785
|
remainder(e) {
|
|
774
|
-
return
|
|
1786
|
+
return St(this, e);
|
|
775
1787
|
}
|
|
776
1788
|
/** @returns true if the day portion TimeStamp is today, false otherwise. */
|
|
777
1789
|
get isToday() {
|
|
778
|
-
return this.truncate(
|
|
1790
|
+
return this.truncate(w.DAY).equals(f.now().truncate(w.DAY));
|
|
779
1791
|
}
|
|
780
1792
|
truncate(e) {
|
|
781
1793
|
return this.sub(this.remainder(e));
|
|
@@ -786,80 +1798,82 @@ const rr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nr
|
|
|
786
1798
|
* JavaScript can do).
|
|
787
1799
|
*/
|
|
788
1800
|
static now() {
|
|
789
|
-
return new
|
|
1801
|
+
return new f(/* @__PURE__ */ new Date());
|
|
790
1802
|
}
|
|
1803
|
+
/** @returns the maximum value of all the timestamps. */
|
|
791
1804
|
static max(...e) {
|
|
792
|
-
let t =
|
|
793
|
-
for (const
|
|
794
|
-
const
|
|
795
|
-
|
|
1805
|
+
let t = f.MIN;
|
|
1806
|
+
for (const r of e) {
|
|
1807
|
+
const n = new f(r);
|
|
1808
|
+
n.after(t) && (t = n);
|
|
796
1809
|
}
|
|
797
1810
|
return t;
|
|
798
1811
|
}
|
|
1812
|
+
/** @returns the minimum value of all the timestamps. */
|
|
799
1813
|
static min(...e) {
|
|
800
|
-
let t =
|
|
801
|
-
for (const
|
|
802
|
-
const
|
|
803
|
-
|
|
1814
|
+
let t = f.MAX;
|
|
1815
|
+
for (const r of e) {
|
|
1816
|
+
const n = new f(r);
|
|
1817
|
+
n.before(t) && (t = n);
|
|
804
1818
|
}
|
|
805
1819
|
return t;
|
|
806
1820
|
}
|
|
807
1821
|
/** @returns a new TimeStamp n nanoseconds after the unix epoch */
|
|
808
|
-
static nanoseconds(e) {
|
|
809
|
-
return new
|
|
1822
|
+
static nanoseconds(e, t = "UTC") {
|
|
1823
|
+
return new f(e, t);
|
|
810
1824
|
}
|
|
811
1825
|
/** @returns a new TimeStamp n microseconds after the unix epoch */
|
|
812
|
-
static microseconds(e) {
|
|
813
|
-
return
|
|
1826
|
+
static microseconds(e, t = "UTC") {
|
|
1827
|
+
return f.nanoseconds(e * 1e3, t);
|
|
814
1828
|
}
|
|
815
1829
|
/** @returns a new TimeStamp n milliseconds after the unix epoch */
|
|
816
|
-
static milliseconds(e) {
|
|
817
|
-
return
|
|
1830
|
+
static milliseconds(e, t = "UTC") {
|
|
1831
|
+
return f.microseconds(e * 1e3, t);
|
|
818
1832
|
}
|
|
819
1833
|
/** @returns a new TimeStamp n seconds after the unix epoch */
|
|
820
|
-
static seconds(e) {
|
|
821
|
-
return
|
|
1834
|
+
static seconds(e, t = "UTC") {
|
|
1835
|
+
return f.milliseconds(e * 1e3, t);
|
|
822
1836
|
}
|
|
823
1837
|
/** @returns a new TimeStamp n minutes after the unix epoch */
|
|
824
|
-
static minutes(e) {
|
|
825
|
-
return
|
|
1838
|
+
static minutes(e, t = "UTC") {
|
|
1839
|
+
return f.seconds(e * 60, t);
|
|
826
1840
|
}
|
|
827
1841
|
/** @returns a new TimeStamp n hours after the unix epoch */
|
|
828
|
-
static hours(e) {
|
|
829
|
-
return
|
|
1842
|
+
static hours(e, t = "UTC") {
|
|
1843
|
+
return f.minutes(e * 60, t);
|
|
830
1844
|
}
|
|
831
1845
|
/** @returns a new TimeStamp n days after the unix epoch */
|
|
832
|
-
static days(e) {
|
|
833
|
-
return
|
|
1846
|
+
static days(e, t = "UTC") {
|
|
1847
|
+
return f.hours(e * 24, t);
|
|
834
1848
|
}
|
|
835
1849
|
};
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
i.object({ value: i.bigint() }).transform((
|
|
848
|
-
i.string().transform((
|
|
849
|
-
i.instanceof(Number).transform((
|
|
850
|
-
i.number().transform((
|
|
851
|
-
i.instanceof(
|
|
1850
|
+
h(m, "NANOSECOND", m.nanoseconds(1)), /** One microsecond after the unix epoch */
|
|
1851
|
+
h(m, "MICROSECOND", m.microseconds(1)), /** One millisecond after the unix epoch */
|
|
1852
|
+
h(m, "MILLISECOND", m.milliseconds(1)), /** One second after the unix epoch */
|
|
1853
|
+
h(m, "SECOND", m.seconds(1)), /** One minute after the unix epoch */
|
|
1854
|
+
h(m, "MINUTE", m.minutes(1)), /** One hour after the unix epoch */
|
|
1855
|
+
h(m, "HOUR", m.hours(1)), /** One day after the unix epoch */
|
|
1856
|
+
h(m, "DAY", m.days(1)), /** The maximum possible value for a timestamp */
|
|
1857
|
+
h(m, "MAX", new m((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
|
|
1858
|
+
h(m, "MIN", new m(0)), /** The unix epoch */
|
|
1859
|
+
h(m, "ZERO", new m(0)), /** A zod schema for validating timestamps */
|
|
1860
|
+
h(m, "z", i.union([
|
|
1861
|
+
i.object({ value: i.bigint() }).transform((s) => new m(s.value)),
|
|
1862
|
+
i.string().transform((s) => new m(BigInt(s))),
|
|
1863
|
+
i.instanceof(Number).transform((s) => new m(s)),
|
|
1864
|
+
i.number().transform((s) => new m(s)),
|
|
1865
|
+
i.instanceof(m)
|
|
852
1866
|
]));
|
|
853
|
-
let
|
|
1867
|
+
let T = m;
|
|
854
1868
|
const b = class g {
|
|
855
1869
|
constructor(e) {
|
|
856
|
-
|
|
1870
|
+
h(this, "value"), h(this, "encodeValue", !0), typeof e == "number" && (e = Math.trunc(e.valueOf())), this.value = BigInt(e.valueOf());
|
|
857
1871
|
}
|
|
858
1872
|
static fromSeconds(e) {
|
|
859
|
-
return e instanceof g ? e : e instanceof
|
|
1873
|
+
return e instanceof g ? e : e instanceof Qe ? e.period : e instanceof T ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.seconds(e) : new g(e);
|
|
860
1874
|
}
|
|
861
1875
|
static fromMilliseconds(e) {
|
|
862
|
-
return e instanceof g ? e : e instanceof
|
|
1876
|
+
return e instanceof g ? e : e instanceof Qe ? e.period : e instanceof T ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.milliseconds(e) : new g(e);
|
|
863
1877
|
}
|
|
864
1878
|
encode() {
|
|
865
1879
|
return this.value.toString();
|
|
@@ -880,7 +1894,7 @@ const b = class g {
|
|
|
880
1894
|
return this.valueOf() >= new g(e).valueOf();
|
|
881
1895
|
}
|
|
882
1896
|
remainder(e) {
|
|
883
|
-
return
|
|
1897
|
+
return St(this, e);
|
|
884
1898
|
}
|
|
885
1899
|
truncate(e) {
|
|
886
1900
|
return new g(
|
|
@@ -888,9 +1902,9 @@ const b = class g {
|
|
|
888
1902
|
);
|
|
889
1903
|
}
|
|
890
1904
|
toString() {
|
|
891
|
-
const e = this.truncate(g.DAY), t = this.truncate(g.HOUR),
|
|
892
|
-
let
|
|
893
|
-
return d.isZero || (
|
|
1905
|
+
const e = this.truncate(g.DAY), t = this.truncate(g.HOUR), r = this.truncate(g.MINUTE), n = this.truncate(g.SECOND), a = this.truncate(g.MILLISECOND), o = this.truncate(g.MICROSECOND), c = this.truncate(g.NANOSECOND), d = e, p = t.sub(e), y = r.sub(t), l = n.sub(r), U = a.sub(n), B = o.sub(a), D = c.sub(o);
|
|
1906
|
+
let A = "";
|
|
1907
|
+
return d.isZero || (A += `${d.days}d `), p.isZero || (A += `${p.hours}h `), y.isZero || (A += `${y.minutes}m `), l.isZero || (A += `${l.seconds}s `), U.isZero || (A += `${U.milliseconds}ms `), B.isZero || (A += `${B.microseconds}µs `), D.isZero || (A += `${D.nanoseconds}ns`), A.trim();
|
|
894
1908
|
}
|
|
895
1909
|
mult(e) {
|
|
896
1910
|
return new g(this.valueOf() * BigInt(e));
|
|
@@ -969,7 +1983,7 @@ const b = class g {
|
|
|
969
1983
|
* @returns A TimeSpan representing the given number of microseconds.
|
|
970
1984
|
*/
|
|
971
1985
|
static microseconds(e = 1) {
|
|
972
|
-
return g.nanoseconds(
|
|
1986
|
+
return g.nanoseconds(W(e, 1e3));
|
|
973
1987
|
}
|
|
974
1988
|
/**
|
|
975
1989
|
* Creates a TimeSpan representing the given number of milliseconds.
|
|
@@ -978,7 +1992,7 @@ const b = class g {
|
|
|
978
1992
|
* @returns A TimeSpan representing the given number of milliseconds.
|
|
979
1993
|
*/
|
|
980
1994
|
static milliseconds(e = 1) {
|
|
981
|
-
return g.microseconds(
|
|
1995
|
+
return g.microseconds(W(e, 1e3));
|
|
982
1996
|
}
|
|
983
1997
|
/**
|
|
984
1998
|
* Creates a TimeSpan representing the given number of seconds.
|
|
@@ -987,7 +2001,7 @@ const b = class g {
|
|
|
987
2001
|
* @returns A TimeSpan representing the given number of seconds.
|
|
988
2002
|
*/
|
|
989
2003
|
static seconds(e = 1) {
|
|
990
|
-
return g.milliseconds(
|
|
2004
|
+
return g.milliseconds(W(e, 1e3));
|
|
991
2005
|
}
|
|
992
2006
|
/**
|
|
993
2007
|
* Creates a TimeSpan representing the given number of minutes.
|
|
@@ -996,7 +2010,7 @@ const b = class g {
|
|
|
996
2010
|
* @returns A TimeSpan representing the given number of minutes.
|
|
997
2011
|
*/
|
|
998
2012
|
static minutes(e = 1) {
|
|
999
|
-
return g.seconds(
|
|
2013
|
+
return g.seconds(W(e, 60));
|
|
1000
2014
|
}
|
|
1001
2015
|
/**
|
|
1002
2016
|
* Creates a TimeSpan representing the given number of hours.
|
|
@@ -1005,7 +2019,7 @@ const b = class g {
|
|
|
1005
2019
|
* @returns A TimeSpan representing the given number of hours.
|
|
1006
2020
|
*/
|
|
1007
2021
|
static hours(e) {
|
|
1008
|
-
return g.minutes(
|
|
2022
|
+
return g.minutes(W(e, 60));
|
|
1009
2023
|
}
|
|
1010
2024
|
/**
|
|
1011
2025
|
* Creates a TimeSpan representing the given number of days.
|
|
@@ -1014,28 +2028,28 @@ const b = class g {
|
|
|
1014
2028
|
* @returns A TimeSpan representing the given number of days.
|
|
1015
2029
|
*/
|
|
1016
2030
|
static days(e) {
|
|
1017
|
-
return g.hours(
|
|
2031
|
+
return g.hours(W(e, 24));
|
|
1018
2032
|
}
|
|
1019
2033
|
};
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
i.object({ value: i.bigint() }).transform((
|
|
1032
|
-
i.string().transform((
|
|
1033
|
-
i.instanceof(Number).transform((
|
|
1034
|
-
i.number().transform((
|
|
2034
|
+
h(b, "NANOSECOND", b.nanoseconds(1)), /** A microsecond. */
|
|
2035
|
+
h(b, "MICROSECOND", b.microseconds(1)), /** A millisecond. */
|
|
2036
|
+
h(b, "MILLISECOND", b.milliseconds(1)), /** A second. */
|
|
2037
|
+
h(b, "SECOND", b.seconds(1)), /** A minute. */
|
|
2038
|
+
h(b, "MINUTE", b.minutes(1)), /** Represents an hour. */
|
|
2039
|
+
h(b, "HOUR", b.hours(1)), /** Represents a day. */
|
|
2040
|
+
h(b, "DAY", b.days(1)), /** The maximum possible value for a TimeSpan. */
|
|
2041
|
+
h(b, "MAX", new b((1n << 63n) - 1n)), /** The minimum possible value for a TimeSpan. */
|
|
2042
|
+
h(b, "MIN", new b(0)), /** The zero value for a TimeSpan. */
|
|
2043
|
+
h(b, "ZERO", new b(0)), /** A zod schema for validating and transforming timespans */
|
|
2044
|
+
h(b, "z", i.union([
|
|
2045
|
+
i.object({ value: i.bigint() }).transform((s) => new b(s.value)),
|
|
2046
|
+
i.string().transform((s) => new b(BigInt(s))),
|
|
2047
|
+
i.instanceof(Number).transform((s) => new b(s)),
|
|
2048
|
+
i.number().transform((s) => new b(s)),
|
|
1035
2049
|
i.instanceof(b)
|
|
1036
2050
|
]));
|
|
1037
|
-
let
|
|
1038
|
-
const
|
|
2051
|
+
let w = b;
|
|
2052
|
+
const ee = class ge extends Number {
|
|
1039
2053
|
constructor(e) {
|
|
1040
2054
|
e instanceof Number ? super(e.valueOf()) : super(e);
|
|
1041
2055
|
}
|
|
@@ -1045,7 +2059,7 @@ const Z = class re extends Number {
|
|
|
1045
2059
|
}
|
|
1046
2060
|
/** @returns The number of seconds in the Rate. */
|
|
1047
2061
|
equals(e) {
|
|
1048
|
-
return this.valueOf() === new
|
|
2062
|
+
return this.valueOf() === new ge(e).valueOf();
|
|
1049
2063
|
}
|
|
1050
2064
|
/**
|
|
1051
2065
|
* Calculates the period of the Rate as a TimeSpan.
|
|
@@ -1053,7 +2067,7 @@ const Z = class re extends Number {
|
|
|
1053
2067
|
* @returns A TimeSpan representing the period of the Rate.
|
|
1054
2068
|
*/
|
|
1055
2069
|
get period() {
|
|
1056
|
-
return
|
|
2070
|
+
return w.seconds(1 / this.valueOf());
|
|
1057
2071
|
}
|
|
1058
2072
|
/**
|
|
1059
2073
|
* Calculates the number of samples in the given TimeSpan at this rate.
|
|
@@ -1062,7 +2076,7 @@ const Z = class re extends Number {
|
|
|
1062
2076
|
* @returns The number of samples in the given TimeSpan at this rate.
|
|
1063
2077
|
*/
|
|
1064
2078
|
sampleCount(e) {
|
|
1065
|
-
return new
|
|
2079
|
+
return new w(e).seconds * this.valueOf();
|
|
1066
2080
|
}
|
|
1067
2081
|
/**
|
|
1068
2082
|
* Calculates the number of bytes in the given TimeSpan at this rate.
|
|
@@ -1072,7 +2086,7 @@ const Z = class re extends Number {
|
|
|
1072
2086
|
* @returns The number of bytes in the given TimeSpan at this rate.
|
|
1073
2087
|
*/
|
|
1074
2088
|
byteCount(e, t) {
|
|
1075
|
-
return this.sampleCount(e) * new
|
|
2089
|
+
return this.sampleCount(e) * new E(t).valueOf();
|
|
1076
2090
|
}
|
|
1077
2091
|
/**
|
|
1078
2092
|
* Calculates a TimeSpan given the number of samples at this rate.
|
|
@@ -1081,7 +2095,7 @@ const Z = class re extends Number {
|
|
|
1081
2095
|
* @returns A TimeSpan that corresponds to the given number of samples.
|
|
1082
2096
|
*/
|
|
1083
2097
|
span(e) {
|
|
1084
|
-
return
|
|
2098
|
+
return w.seconds(e / this.valueOf());
|
|
1085
2099
|
}
|
|
1086
2100
|
/**
|
|
1087
2101
|
* Calculates a TimeSpan given the number of bytes at this rate.
|
|
@@ -1100,7 +2114,7 @@ const Z = class re extends Number {
|
|
|
1100
2114
|
* @returns A Rate representing the given number of Hz.
|
|
1101
2115
|
*/
|
|
1102
2116
|
static hz(e) {
|
|
1103
|
-
return new
|
|
2117
|
+
return new ge(e);
|
|
1104
2118
|
}
|
|
1105
2119
|
/**
|
|
1106
2120
|
* Creates a Rate representing the given number of kHz.
|
|
@@ -1109,16 +2123,16 @@ const Z = class re extends Number {
|
|
|
1109
2123
|
* @returns A Rate representing the given number of kHz.
|
|
1110
2124
|
*/
|
|
1111
2125
|
static khz(e) {
|
|
1112
|
-
return
|
|
2126
|
+
return ge.hz(e * 1e3);
|
|
1113
2127
|
}
|
|
1114
2128
|
};
|
|
1115
|
-
|
|
1116
|
-
i.number().transform((
|
|
1117
|
-
i.instanceof(Number).transform((
|
|
1118
|
-
i.instanceof(
|
|
2129
|
+
h(ee, "z", i.union([
|
|
2130
|
+
i.number().transform((s) => new ee(s)),
|
|
2131
|
+
i.instanceof(Number).transform((s) => new ee(s)),
|
|
2132
|
+
i.instanceof(ee)
|
|
1119
2133
|
]));
|
|
1120
|
-
let
|
|
1121
|
-
const
|
|
2134
|
+
let Qe = ee;
|
|
2135
|
+
const x = class extends Number {
|
|
1122
2136
|
/**
|
|
1123
2137
|
* Creates a Density representing the given number of bytes per value.
|
|
1124
2138
|
*
|
|
@@ -1133,22 +2147,22 @@ const E = class extends Number {
|
|
|
1133
2147
|
return e.valueOf() / this.valueOf();
|
|
1134
2148
|
}
|
|
1135
2149
|
size(e) {
|
|
1136
|
-
return new
|
|
2150
|
+
return new Ae(e * this.valueOf());
|
|
1137
2151
|
}
|
|
1138
2152
|
};
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
i.number().transform((
|
|
1147
|
-
i.instanceof(Number).transform((
|
|
1148
|
-
i.instanceof(
|
|
2153
|
+
h(x, "UNKNOWN", new x(0)), /** 128 bits per value. */
|
|
2154
|
+
h(x, "BIT128", new x(16)), /** 64 bits per value. */
|
|
2155
|
+
h(x, "BIT64", new x(8)), /** 32 bits per value. */
|
|
2156
|
+
h(x, "BIT32", new x(4)), /** 16 bits per value. */
|
|
2157
|
+
h(x, "BIT16", new x(2)), /** 8 bits per value. */
|
|
2158
|
+
h(x, "BIT8", new x(1)), /** A zod schema for validating and transforming densities */
|
|
2159
|
+
h(x, "z", i.union([
|
|
2160
|
+
i.number().transform((s) => new x(s)),
|
|
2161
|
+
i.instanceof(Number).transform((s) => new x(s)),
|
|
2162
|
+
i.instanceof(x)
|
|
1149
2163
|
]));
|
|
1150
|
-
let
|
|
1151
|
-
const
|
|
2164
|
+
let E = x;
|
|
2165
|
+
const $ = class te {
|
|
1152
2166
|
/**
|
|
1153
2167
|
* Creates a TimeRange from the given start and end TimeStamps.
|
|
1154
2168
|
*
|
|
@@ -1156,11 +2170,11 @@ const U = class ne {
|
|
|
1156
2170
|
* @param end - A TimeStamp representing the end of the range.
|
|
1157
2171
|
*/
|
|
1158
2172
|
constructor(e, t) {
|
|
1159
|
-
|
|
2173
|
+
h(this, "start"), h(this, "end"), typeof e == "object" && "start" in e ? (this.start = new T(e.start), this.end = new T(e.end)) : (this.start = new T(e), this.end = new T(t));
|
|
1160
2174
|
}
|
|
1161
2175
|
/** @returns The TimeSpan occupied by the TimeRange. */
|
|
1162
2176
|
get span() {
|
|
1163
|
-
return new
|
|
2177
|
+
return new w(this.end.valueOf() - this.start.valueOf());
|
|
1164
2178
|
}
|
|
1165
2179
|
/**
|
|
1166
2180
|
* Checks if the timestamp is valid i.e. the start is before the end.
|
|
@@ -1198,7 +2212,13 @@ const U = class ne {
|
|
|
1198
2212
|
* @returns A TimeRange with the start and end swapped.
|
|
1199
2213
|
*/
|
|
1200
2214
|
swap() {
|
|
1201
|
-
return new
|
|
2215
|
+
return new te(this.end, this.start);
|
|
2216
|
+
}
|
|
2217
|
+
get numericBounds() {
|
|
2218
|
+
return {
|
|
2219
|
+
lower: Number(this.start.valueOf()),
|
|
2220
|
+
upper: Number(this.end.valueOf())
|
|
2221
|
+
};
|
|
1202
2222
|
}
|
|
1203
2223
|
/**
|
|
1204
2224
|
* Checks if the TimeRange is equal to the given TimeRange.
|
|
@@ -1206,8 +2226,11 @@ const U = class ne {
|
|
|
1206
2226
|
* @param other - The TimeRange to compare to.
|
|
1207
2227
|
* @returns True if the TimeRange is equal to the given TimeRange.
|
|
1208
2228
|
*/
|
|
1209
|
-
equals(e) {
|
|
1210
|
-
|
|
2229
|
+
equals(e, t = w.ZERO) {
|
|
2230
|
+
if (t.isZero)
|
|
2231
|
+
return this.start.equals(e.start) && this.end.equals(e.end);
|
|
2232
|
+
let r = this.start.sub(e.start).valueOf(), n = this.end.sub(e.end).valueOf();
|
|
2233
|
+
return r < 0 && (r = -r), n < 0 && (n = -n), r <= t.valueOf() && n <= t.valueOf();
|
|
1211
2234
|
}
|
|
1212
2235
|
toString() {
|
|
1213
2236
|
return `${this.start.toString()} - ${this.end.toString()}`;
|
|
@@ -1216,59 +2239,67 @@ const U = class ne {
|
|
|
1216
2239
|
return `${this.start.fString("preciseDate")} - ${this.span.toString()}`;
|
|
1217
2240
|
}
|
|
1218
2241
|
/**
|
|
1219
|
-
* Checks if
|
|
1220
|
-
* true. If the start of one range is equal to the end of the other, returns false.
|
|
1221
|
-
* Just follow the rule [start, end) i.e
|
|
2242
|
+
* Checks if the two time ranges overlap. If the two time ranges are equal, returns
|
|
2243
|
+
* true. If the start of one range is equal to the end of the other, it returns false.
|
|
2244
|
+
* Just follow the rule [start, end), i.e., start is inclusive, and the end is exclusive.
|
|
1222
2245
|
*
|
|
1223
2246
|
* @param other - The other TimeRange to compare to.
|
|
2247
|
+
* @param delta - A TimeSpan representing the minimum amount of overlap for
|
|
2248
|
+
* overlap to return true. This allows for a slight amount of leeway when
|
|
2249
|
+
* checking for overlap.
|
|
1224
2250
|
* @returns True if the two TimeRanges overlap, false otherwise.
|
|
1225
2251
|
*/
|
|
1226
|
-
overlapsWith(e, t =
|
|
2252
|
+
overlapsWith(e, t = w.ZERO) {
|
|
1227
2253
|
e = e.makeValid();
|
|
1228
|
-
const
|
|
2254
|
+
const r = this.makeValid();
|
|
1229
2255
|
if (this.equals(e)) return !0;
|
|
1230
|
-
if (e.end.equals(
|
|
1231
|
-
const
|
|
1232
|
-
return a.before(
|
|
1233
|
-
}
|
|
1234
|
-
roughlyEquals(e, t) {
|
|
1235
|
-
let n = this.start.sub(e.start).valueOf(), s = this.end.sub(e.end).valueOf();
|
|
1236
|
-
return n < 0 && (n = -n), s < 0 && (s = -s), n <= t.valueOf() && s <= t.valueOf();
|
|
2256
|
+
if (e.end.equals(r.start) || r.end.equals(e.start)) return !1;
|
|
2257
|
+
const n = T.max(r.start, e.start), a = T.min(r.end, e.end);
|
|
2258
|
+
return a.before(n) ? !1 : new w(a.sub(n)).greaterThanOrEqual(t);
|
|
1237
2259
|
}
|
|
1238
2260
|
contains(e) {
|
|
1239
|
-
return e instanceof
|
|
2261
|
+
return e instanceof te ? this.contains(e.start) && this.contains(e.end) : this.start.beforeEq(e) && this.end.after(e);
|
|
1240
2262
|
}
|
|
1241
2263
|
boundBy(e) {
|
|
1242
|
-
const t = new
|
|
2264
|
+
const t = new te(this.start, this.end);
|
|
1243
2265
|
return e.start.after(this.start) && (t.start = e.start), e.start.after(this.end) && (t.end = e.start), e.end.before(this.end) && (t.end = e.end), e.end.before(this.start) && (t.start = e.end), t;
|
|
1244
2266
|
}
|
|
2267
|
+
static max(...e) {
|
|
2268
|
+
return new te(
|
|
2269
|
+
T.min(...e.map((t) => t.start)),
|
|
2270
|
+
T.max(...e.map((t) => t.end))
|
|
2271
|
+
);
|
|
2272
|
+
}
|
|
1245
2273
|
};
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
i.object({ start:
|
|
1251
|
-
i.instanceof(
|
|
2274
|
+
h($, "MAX", new $(T.MIN, T.MAX)), /** The minimum possible time range. */
|
|
2275
|
+
h($, "MIN", new $(T.MAX, T.MIN)), /** A time range whose start and end are both zero. */
|
|
2276
|
+
h($, "ZERO", new $(T.ZERO, T.ZERO)), /** A zod schema for validating and transforming time ranges */
|
|
2277
|
+
h($, "z", i.union([
|
|
2278
|
+
i.object({ start: T.z, end: T.z }).transform((s) => new $(s.start, s.end)),
|
|
2279
|
+
i.instanceof($)
|
|
1252
2280
|
]));
|
|
1253
|
-
let
|
|
1254
|
-
const
|
|
2281
|
+
let ae = $;
|
|
2282
|
+
const u = class O {
|
|
1255
2283
|
constructor(e) {
|
|
1256
|
-
if (e instanceof
|
|
1257
|
-
|
|
2284
|
+
if (h(this, "value"), h(this, "encodeValue", !0), e instanceof O || typeof e == "string" || typeof e.valueOf() == "string") {
|
|
2285
|
+
this.value = e.valueOf();
|
|
1258
2286
|
return;
|
|
1259
2287
|
}
|
|
1260
|
-
const t =
|
|
2288
|
+
const t = O.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);
|
|
1261
2289
|
if (t != null) {
|
|
1262
|
-
|
|
2290
|
+
this.value = t.valueOf();
|
|
1263
2291
|
return;
|
|
1264
2292
|
}
|
|
1265
|
-
throw
|
|
2293
|
+
throw this.value = O.UNKNOWN.valueOf(), new Error(`unable to find data type for ${e.toString()}`);
|
|
2294
|
+
}
|
|
2295
|
+
valueOf() {
|
|
2296
|
+
return this.value;
|
|
1266
2297
|
}
|
|
1267
2298
|
/**
|
|
1268
2299
|
* @returns the TypedArray constructor for the DataType.
|
|
1269
2300
|
*/
|
|
1270
2301
|
get Array() {
|
|
1271
|
-
const e =
|
|
2302
|
+
const e = O.ARRAY_CONSTRUCTORS.get(this.toString());
|
|
1272
2303
|
if (e == null)
|
|
1273
2304
|
throw new Error(`unable to find array constructor for ${this.valueOf()}`);
|
|
1274
2305
|
return e;
|
|
@@ -1290,10 +2321,10 @@ const o = class S extends String {
|
|
|
1290
2321
|
return this.valueOf();
|
|
1291
2322
|
}
|
|
1292
2323
|
get isVariable() {
|
|
1293
|
-
return this.equals(
|
|
2324
|
+
return this.equals(O.JSON) || this.equals(O.STRING);
|
|
1294
2325
|
}
|
|
1295
2326
|
get isNumeric() {
|
|
1296
|
-
return !this.isVariable && !this.equals(
|
|
2327
|
+
return !this.isVariable && !this.equals(O.UUID);
|
|
1297
2328
|
}
|
|
1298
2329
|
get isInteger() {
|
|
1299
2330
|
const e = this.toString();
|
|
@@ -1303,122 +2334,115 @@ const o = class S extends String {
|
|
|
1303
2334
|
return this.toString().startsWith("float");
|
|
1304
2335
|
}
|
|
1305
2336
|
get density() {
|
|
1306
|
-
const e =
|
|
2337
|
+
const e = O.DENSITIES.get(this.toString());
|
|
1307
2338
|
if (e == null) throw new Error(`unable to find density for ${this.valueOf()}`);
|
|
1308
2339
|
return e;
|
|
1309
2340
|
}
|
|
2341
|
+
/** @returns ture if the data type is an unsigned numeric integer type */
|
|
1310
2342
|
get isUnsigned() {
|
|
1311
|
-
return this.equals(
|
|
2343
|
+
return this.equals(O.UINT8) || this.equals(O.UINT16) || this.equals(O.UINT32) || this.equals(O.UINT64);
|
|
1312
2344
|
}
|
|
2345
|
+
/** @returns true if the data type is a signed numeric integer type */
|
|
1313
2346
|
get isSigned() {
|
|
1314
|
-
return this.equals(
|
|
2347
|
+
return this.equals(O.INT8) || this.equals(O.INT16) || this.equals(O.INT32) || this.equals(O.INT64);
|
|
1315
2348
|
}
|
|
1316
2349
|
/** @returns true if the data type can be cast to the other data type without loss of precision. */
|
|
1317
2350
|
canSafelyCastTo(e) {
|
|
1318
|
-
return this.equals(e) ? !0 : !this.isNumeric || !e.isNumeric || this.isVariable || e.isVariable || this.isUnsigned && e.isSigned ? !1 : this.isFloat ? e.isFloat && this.density.valueOf() <= e.density.valueOf() : this.equals(
|
|
2351
|
+
return this.equals(e) ? !0 : !this.isNumeric || !e.isNumeric || this.isVariable || e.isVariable || this.isUnsigned && e.isSigned ? !1 : this.isFloat ? e.isFloat && this.density.valueOf() <= e.density.valueOf() : this.equals(O.INT32) && e.equals(O.FLOAT64) || this.equals(O.INT8) && e.equals(O.FLOAT32) ? !0 : this.isInteger && e.isInteger ? this.density.valueOf() <= e.density.valueOf() && this.isUnsigned === e.isUnsigned : !1;
|
|
1319
2352
|
}
|
|
1320
2353
|
/** @returns true if the data type can be cast to the other data type, even if there is a loss of precision. */
|
|
1321
2354
|
canCastTo(e) {
|
|
1322
2355
|
return this.isNumeric && e.isNumeric ? !0 : this.equals(e);
|
|
1323
2356
|
}
|
|
1324
|
-
/**
|
|
1325
|
-
* Checks whether the given TypedArray is of the same type as the DataType.
|
|
1326
|
-
*
|
|
1327
|
-
* @param array - The TypedArray to check.
|
|
1328
|
-
* @returns True if the TypedArray is of the same type as the DataType.
|
|
1329
|
-
*/
|
|
1330
|
-
checkArray(e) {
|
|
1331
|
-
return e.constructor === this.Array;
|
|
1332
|
-
}
|
|
1333
2357
|
toJSON() {
|
|
1334
2358
|
return this.toString();
|
|
1335
2359
|
}
|
|
1336
2360
|
get usesBigInt() {
|
|
1337
|
-
return
|
|
2361
|
+
return O.BIG_INT_TYPES.some((e) => e.equals(this));
|
|
1338
2362
|
}
|
|
1339
2363
|
};
|
|
1340
|
-
u
|
|
1341
|
-
u
|
|
1342
|
-
u
|
|
1343
|
-
u
|
|
1344
|
-
u
|
|
1345
|
-
u
|
|
1346
|
-
u
|
|
1347
|
-
u
|
|
1348
|
-
u
|
|
1349
|
-
u
|
|
1350
|
-
u
|
|
1351
|
-
u
|
|
1352
|
-
u
|
|
1353
|
-
u
|
|
2364
|
+
h(u, "UNKNOWN", new u("unknown")), /** Represents a 64-bit floating point value. */
|
|
2365
|
+
h(u, "FLOAT64", new u("float64")), /** Represents a 32-bit floating point value. */
|
|
2366
|
+
h(u, "FLOAT32", new u("float32")), /** Represents a 64-bit signed integer value. */
|
|
2367
|
+
h(u, "INT64", new u("int64")), /** Represents a 32-bit signed integer value. */
|
|
2368
|
+
h(u, "INT32", new u("int32")), /** Represents a 16-bit signed integer value. */
|
|
2369
|
+
h(u, "INT16", new u("int16")), /** Represents a 8-bit signed integer value. */
|
|
2370
|
+
h(u, "INT8", new u("int8")), /** Represents a 64-bit unsigned integer value. */
|
|
2371
|
+
h(u, "UINT64", new u("uint64")), /** Represents a 32-bit unsigned integer value. */
|
|
2372
|
+
h(u, "UINT32", new u("uint32")), /** Represents a 16-bit unsigned integer value. */
|
|
2373
|
+
h(u, "UINT16", new u("uint16")), /** Represents a 8-bit unsigned integer value. */
|
|
2374
|
+
h(u, "UINT8", new u("uint8")), /** Represents a boolean value. Alias for UINT8. */
|
|
2375
|
+
h(u, "BOOLEAN", u.UINT8), /** Represents a 64-bit unix epoch. */
|
|
2376
|
+
h(u, "TIMESTAMP", new u("timestamp")), /** Represents a UUID data type */
|
|
2377
|
+
h(u, "UUID", new u("uuid")), /** Represents a string data type. Strings have an unknown density, and are separate
|
|
1354
2378
|
* by a newline character. */
|
|
1355
|
-
u
|
|
2379
|
+
h(u, "STRING", new u("string")), /** Represents a JSON data type. JSON has an unknown density, and is separated by a
|
|
1356
2380
|
* newline character. */
|
|
1357
|
-
u
|
|
1358
|
-
[
|
|
1359
|
-
[
|
|
1360
|
-
[
|
|
1361
|
-
[
|
|
1362
|
-
[
|
|
1363
|
-
[
|
|
1364
|
-
[
|
|
1365
|
-
[
|
|
1366
|
-
[
|
|
1367
|
-
[
|
|
1368
|
-
[
|
|
1369
|
-
[
|
|
1370
|
-
[
|
|
1371
|
-
[
|
|
1372
|
-
])), u
|
|
1373
|
-
[Uint8Array.name,
|
|
1374
|
-
[Uint16Array.name,
|
|
1375
|
-
[Uint32Array.name,
|
|
1376
|
-
[BigUint64Array.name,
|
|
1377
|
-
[Float32Array.name,
|
|
1378
|
-
[Float64Array.name,
|
|
1379
|
-
[Int8Array.name,
|
|
1380
|
-
[Int16Array.name,
|
|
1381
|
-
[Int32Array.name,
|
|
1382
|
-
[BigInt64Array.name,
|
|
1383
|
-
])), u
|
|
1384
|
-
[
|
|
1385
|
-
[
|
|
1386
|
-
[
|
|
1387
|
-
[
|
|
1388
|
-
[
|
|
1389
|
-
[
|
|
1390
|
-
[
|
|
1391
|
-
[
|
|
1392
|
-
[
|
|
1393
|
-
[
|
|
1394
|
-
[
|
|
1395
|
-
[
|
|
1396
|
-
[
|
|
1397
|
-
[
|
|
2381
|
+
h(u, "JSON", new u("json")), h(u, "ARRAY_CONSTRUCTORS", /* @__PURE__ */ new Map([
|
|
2382
|
+
[u.UINT8.toString(), Uint8Array],
|
|
2383
|
+
[u.UINT16.toString(), Uint16Array],
|
|
2384
|
+
[u.UINT32.toString(), Uint32Array],
|
|
2385
|
+
[u.UINT64.toString(), BigUint64Array],
|
|
2386
|
+
[u.FLOAT32.toString(), Float32Array],
|
|
2387
|
+
[u.FLOAT64.toString(), Float64Array],
|
|
2388
|
+
[u.INT8.toString(), Int8Array],
|
|
2389
|
+
[u.INT16.toString(), Int16Array],
|
|
2390
|
+
[u.INT32.toString(), Int32Array],
|
|
2391
|
+
[u.INT64.toString(), BigInt64Array],
|
|
2392
|
+
[u.TIMESTAMP.toString(), BigInt64Array],
|
|
2393
|
+
[u.STRING.toString(), Uint8Array],
|
|
2394
|
+
[u.JSON.toString(), Uint8Array],
|
|
2395
|
+
[u.UUID.toString(), Uint8Array]
|
|
2396
|
+
])), h(u, "ARRAY_CONSTRUCTOR_DATA_TYPES", /* @__PURE__ */ new Map([
|
|
2397
|
+
[Uint8Array.name, u.UINT8],
|
|
2398
|
+
[Uint16Array.name, u.UINT16],
|
|
2399
|
+
[Uint32Array.name, u.UINT32],
|
|
2400
|
+
[BigUint64Array.name, u.UINT64],
|
|
2401
|
+
[Float32Array.name, u.FLOAT32],
|
|
2402
|
+
[Float64Array.name, u.FLOAT64],
|
|
2403
|
+
[Int8Array.name, u.INT8],
|
|
2404
|
+
[Int16Array.name, u.INT16],
|
|
2405
|
+
[Int32Array.name, u.INT32],
|
|
2406
|
+
[BigInt64Array.name, u.INT64]
|
|
2407
|
+
])), h(u, "DENSITIES", /* @__PURE__ */ new Map([
|
|
2408
|
+
[u.UINT8.toString(), E.BIT8],
|
|
2409
|
+
[u.UINT16.toString(), E.BIT16],
|
|
2410
|
+
[u.UINT32.toString(), E.BIT32],
|
|
2411
|
+
[u.UINT64.toString(), E.BIT64],
|
|
2412
|
+
[u.FLOAT32.toString(), E.BIT32],
|
|
2413
|
+
[u.FLOAT64.toString(), E.BIT64],
|
|
2414
|
+
[u.INT8.toString(), E.BIT8],
|
|
2415
|
+
[u.INT16.toString(), E.BIT16],
|
|
2416
|
+
[u.INT32.toString(), E.BIT32],
|
|
2417
|
+
[u.INT64.toString(), E.BIT64],
|
|
2418
|
+
[u.TIMESTAMP.toString(), E.BIT64],
|
|
2419
|
+
[u.STRING.toString(), E.UNKNOWN],
|
|
2420
|
+
[u.JSON.toString(), E.UNKNOWN],
|
|
2421
|
+
[u.UUID.toString(), E.BIT128]
|
|
1398
2422
|
])), /** All the data types. */
|
|
1399
|
-
u
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
]), u
|
|
1416
|
-
u
|
|
1417
|
-
i.string().transform((
|
|
1418
|
-
i.instanceof(
|
|
2423
|
+
h(u, "ALL", [
|
|
2424
|
+
u.UNKNOWN,
|
|
2425
|
+
u.FLOAT64,
|
|
2426
|
+
u.FLOAT32,
|
|
2427
|
+
u.INT64,
|
|
2428
|
+
u.INT32,
|
|
2429
|
+
u.INT16,
|
|
2430
|
+
u.INT8,
|
|
2431
|
+
u.UINT64,
|
|
2432
|
+
u.UINT32,
|
|
2433
|
+
u.UINT16,
|
|
2434
|
+
u.UINT8,
|
|
2435
|
+
u.TIMESTAMP,
|
|
2436
|
+
u.UUID,
|
|
2437
|
+
u.STRING,
|
|
2438
|
+
u.JSON
|
|
2439
|
+
]), h(u, "BIG_INT_TYPES", [u.INT64, u.UINT64, u.TIMESTAMP]), /** A zod schema for a DataType. */
|
|
2440
|
+
h(u, "z", i.union([
|
|
2441
|
+
i.string().transform((s) => new u(s)),
|
|
2442
|
+
i.instanceof(u)
|
|
1419
2443
|
]));
|
|
1420
|
-
let
|
|
1421
|
-
const
|
|
2444
|
+
let v = u;
|
|
2445
|
+
const N = class I extends Number {
|
|
1422
2446
|
constructor(e) {
|
|
1423
2447
|
super(e.valueOf());
|
|
1424
2448
|
}
|
|
@@ -1426,7 +2450,7 @@ const A = class I extends Number {
|
|
|
1426
2450
|
largerThan(e) {
|
|
1427
2451
|
return this.valueOf() > e.valueOf();
|
|
1428
2452
|
}
|
|
1429
|
-
/** @returns true if the Size is smaller than the other
|
|
2453
|
+
/** @returns true if the Size is smaller than the other size. */
|
|
1430
2454
|
smallerThan(e) {
|
|
1431
2455
|
return this.valueOf() < e.valueOf();
|
|
1432
2456
|
}
|
|
@@ -1455,9 +2479,9 @@ const A = class I extends Number {
|
|
|
1455
2479
|
return this.valueOf() / I.TERABYTE.valueOf();
|
|
1456
2480
|
}
|
|
1457
2481
|
toString() {
|
|
1458
|
-
const e = this.truncate(I.TERABYTE), t = this.truncate(I.GIGABYTE),
|
|
2482
|
+
const e = this.truncate(I.TERABYTE), t = this.truncate(I.GIGABYTE), r = this.truncate(I.MEGABYTE), n = this.truncate(I.KILOBYTE), a = this.truncate(I.BYTE), o = e, c = t.sub(e), d = r.sub(t), p = n.sub(r), y = a.sub(n);
|
|
1459
2483
|
let l = "";
|
|
1460
|
-
return
|
|
2484
|
+
return o.isZero || (l += `${o.terabytes}TB `), c.isZero || (l += `${c.gigabytes}GB `), d.isZero || (l += `${d.megabytes}MB `), p.isZero || (l += `${p.kilobytes}KB `), (!y.isZero || l === "") && (l += `${y.valueOf()}B`), l.trim();
|
|
1461
2485
|
}
|
|
1462
2486
|
/**
|
|
1463
2487
|
* Creates a Size from the given number of bytes.
|
|
@@ -1508,17 +2532,17 @@ const A = class I extends Number {
|
|
|
1508
2532
|
return this.valueOf() === 0;
|
|
1509
2533
|
}
|
|
1510
2534
|
};
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
i.number().transform((
|
|
1519
|
-
i.instanceof(
|
|
2535
|
+
h(N, "BYTE", new N(1)), /** A kilobyte */
|
|
2536
|
+
h(N, "KILOBYTE", N.kilobytes(1)), /** A megabyte */
|
|
2537
|
+
h(N, "MEGABYTE", N.megabytes(1)), /** A gigabyte */
|
|
2538
|
+
h(N, "GIGABYTE", N.gigabytes(1)), /** A terabyte. */
|
|
2539
|
+
h(N, "TERABYTE", N.terabytes(1)), /** The zero value for Size */
|
|
2540
|
+
h(N, "ZERO", new N(0)), /** A zod schema for a Size. */
|
|
2541
|
+
h(N, "z", i.union([
|
|
2542
|
+
i.number().transform((s) => new N(s)),
|
|
2543
|
+
i.instanceof(N)
|
|
1520
2544
|
]));
|
|
1521
|
-
let
|
|
2545
|
+
let Ae = N;
|
|
1522
2546
|
i.union([
|
|
1523
2547
|
i.instanceof(Uint8Array),
|
|
1524
2548
|
i.instanceof(Uint16Array),
|
|
@@ -1531,44 +2555,44 @@ i.union([
|
|
|
1531
2555
|
i.instanceof(Int32Array),
|
|
1532
2556
|
i.instanceof(BigInt64Array)
|
|
1533
2557
|
]);
|
|
1534
|
-
const
|
|
1535
|
-
const e = typeof
|
|
1536
|
-
return e === "string" || e === "number" || e === "boolean" || e === "bigint" ||
|
|
1537
|
-
},
|
|
1538
|
-
(
|
|
1539
|
-
atob(
|
|
2558
|
+
const It = (s) => {
|
|
2559
|
+
const e = typeof s;
|
|
2560
|
+
return e === "string" || e === "number" || e === "boolean" || e === "bigint" || s instanceof T || s instanceof w || s instanceof Date;
|
|
2561
|
+
}, lr = (s, e, t, r = 0) => s.usesBigInt && !e.usesBigInt ? Number(t) - Number(r) : !s.usesBigInt && e.usesBigInt ? BigInt(t.valueOf()) - BigInt(r.valueOf()) : se(t, -r).valueOf(), se = (s, e) => e == 0 ? s : s == 0 ? e : typeof s == "bigint" && typeof e == "bigint" || typeof s == "number" && typeof e == "number" ? s + e : Number(s) + Number(e), dr = (s) => s == null ? !1 : Array.isArray(s) || s instanceof ArrayBuffer || ArrayBuffer.isView(s) && !(s instanceof DataView) || s instanceof yr ? !0 : It(s), P = -1, fr = i.string().transform(
|
|
2562
|
+
(s) => new Uint8Array(
|
|
2563
|
+
atob(s).split("").map((e) => e.charCodeAt(0))
|
|
1540
2564
|
).buffer
|
|
1541
|
-
),
|
|
1542
|
-
if (
|
|
2565
|
+
), gr = i.union([i.null(), i.undefined()]).transform(() => new Uint8Array().buffer), Be = 10, pr = (s, e) => {
|
|
2566
|
+
if (s === "string" && !e.isVariable)
|
|
1543
2567
|
throw new Error(`cannot convert series of type ${e.toString()} to string`);
|
|
1544
|
-
if (
|
|
2568
|
+
if (s === "number" && !e.isNumeric)
|
|
1545
2569
|
throw new Error(`cannot convert series of type ${e.toString()} to number`);
|
|
1546
|
-
if (
|
|
2570
|
+
if (s === "bigint" && !e.usesBigInt)
|
|
1547
2571
|
throw new Error(`cannot convert series of type ${e.toString()} to bigint`);
|
|
1548
|
-
},
|
|
2572
|
+
}, re = class M {
|
|
1549
2573
|
constructor(e) {
|
|
1550
|
-
|
|
2574
|
+
h(this, "key", ""), h(this, "isSynnaxSeries", !0), h(this, "dataType"), h(this, "sampleOffset"), h(this, "gl"), h(this, "_data"), h(this, "timeRange", ae.ZERO), h(this, "alignment", 0n), h(this, "_cachedMin"), h(this, "_cachedMax"), h(this, "writePos", P), h(this, "_refCount", 0), h(this, "_cachedLength"), h(this, "_cachedIndexes"), dr(e) && (e = { data: e });
|
|
1551
2575
|
const {
|
|
1552
2576
|
dataType: t,
|
|
1553
|
-
timeRange:
|
|
1554
|
-
sampleOffset:
|
|
2577
|
+
timeRange: r,
|
|
2578
|
+
sampleOffset: n = 0,
|
|
1555
2579
|
glBufferUsage: a = "static",
|
|
1556
|
-
alignment:
|
|
1557
|
-
key:
|
|
2580
|
+
alignment: o = 0n,
|
|
2581
|
+
key: c = ur()
|
|
1558
2582
|
} = e, d = e.data ?? [];
|
|
1559
|
-
if (d instanceof
|
|
2583
|
+
if (d instanceof M || typeof d == "object" && "isSynnaxSeries" in d && d.isSynnaxSeries === !0) {
|
|
1560
2584
|
const l = d;
|
|
1561
|
-
this.key = l.key, this.dataType = l.dataType, this.sampleOffset = l.sampleOffset, this.gl = l.gl, this._data = l._data, this.
|
|
2585
|
+
this.key = l.key, this.dataType = l.dataType, this.sampleOffset = l.sampleOffset, this.gl = l.gl, this._data = l._data, this.timeRange = l.timeRange, this.alignment = l.alignment, this._cachedMin = l._cachedMin, this._cachedMax = l._cachedMax, this.writePos = l.writePos, this._refCount = l._refCount, this._cachedLength = l._cachedLength;
|
|
1562
2586
|
return;
|
|
1563
2587
|
}
|
|
1564
|
-
const p =
|
|
1565
|
-
if (t != null) this.dataType = new
|
|
2588
|
+
const p = It(d), y = Array.isArray(d);
|
|
2589
|
+
if (t != null) this.dataType = new v(t);
|
|
1566
2590
|
else {
|
|
1567
2591
|
if (d instanceof ArrayBuffer)
|
|
1568
2592
|
throw new Error(
|
|
1569
2593
|
"cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
|
|
1570
2594
|
);
|
|
1571
|
-
if (
|
|
2595
|
+
if (y || p) {
|
|
1572
2596
|
let l = d;
|
|
1573
2597
|
if (!p) {
|
|
1574
2598
|
if (d.length === 0)
|
|
@@ -1577,85 +2601,86 @@ const rt = (r) => {
|
|
|
1577
2601
|
);
|
|
1578
2602
|
l = d[0];
|
|
1579
2603
|
}
|
|
1580
|
-
if (typeof l == "string") this.dataType =
|
|
1581
|
-
else if (typeof l == "number") this.dataType =
|
|
1582
|
-
else if (typeof l == "bigint") this.dataType =
|
|
1583
|
-
else if (typeof l == "boolean") this.dataType =
|
|
1584
|
-
else if (l instanceof
|
|
1585
|
-
this.dataType =
|
|
1586
|
-
else if (typeof l == "object") this.dataType =
|
|
2604
|
+
if (typeof l == "string") this.dataType = v.STRING;
|
|
2605
|
+
else if (typeof l == "number") this.dataType = v.FLOAT64;
|
|
2606
|
+
else if (typeof l == "bigint") this.dataType = v.INT64;
|
|
2607
|
+
else if (typeof l == "boolean") this.dataType = v.BOOLEAN;
|
|
2608
|
+
else if (l instanceof T || l instanceof Date || l instanceof T)
|
|
2609
|
+
this.dataType = v.TIMESTAMP;
|
|
2610
|
+
else if (typeof l == "object") this.dataType = v.JSON;
|
|
1587
2611
|
else
|
|
1588
2612
|
throw new Error(
|
|
1589
2613
|
`cannot infer data type of ${typeof l} when constructing a Series from a JS array`
|
|
1590
2614
|
);
|
|
1591
|
-
} else this.dataType = new
|
|
2615
|
+
} else this.dataType = new v(d);
|
|
1592
2616
|
}
|
|
1593
|
-
if (!
|
|
2617
|
+
if (!y && !p) this._data = d;
|
|
1594
2618
|
else {
|
|
1595
2619
|
let l = p ? [d] : d;
|
|
1596
|
-
const
|
|
1597
|
-
(
|
|
2620
|
+
const U = l[0];
|
|
2621
|
+
(U instanceof T || U instanceof Date || U instanceof w) && (l = l.map((B) => new T(B).valueOf())), this.dataType.equals(v.STRING) ? (this._cachedLength = l.length, this._data = new TextEncoder().encode(`${l.join(`
|
|
1598
2622
|
`)}
|
|
1599
|
-
`).buffer) : this.dataType.equals(
|
|
1600
|
-
`${l.map((
|
|
2623
|
+
`).buffer) : this.dataType.equals(v.JSON) ? (this._cachedLength = l.length, this._data = new TextEncoder().encode(
|
|
2624
|
+
`${l.map((B) => fe.encodeString(B)).join(`
|
|
1601
2625
|
`)}
|
|
1602
2626
|
`
|
|
1603
|
-
).buffer) : this.dataType.usesBigInt && typeof
|
|
1604
|
-
l.map((
|
|
1605
|
-
).buffer : !this.dataType.usesBigInt && typeof
|
|
1606
|
-
l.map((
|
|
2627
|
+
).buffer) : this.dataType.usesBigInt && typeof U == "number" ? this._data = new this.dataType.Array(
|
|
2628
|
+
l.map((B) => BigInt(Math.round(B)))
|
|
2629
|
+
).buffer : !this.dataType.usesBigInt && typeof U == "bigint" ? this._data = new this.dataType.Array(
|
|
2630
|
+
l.map((B) => Number(B))
|
|
1607
2631
|
).buffer : this._data = new this.dataType.Array(l).buffer;
|
|
1608
2632
|
}
|
|
1609
|
-
this.key =
|
|
2633
|
+
this.key = c, this.alignment = o, this.sampleOffset = n ?? 0, this.timeRange = r ?? ae.ZERO, this.gl = {
|
|
1610
2634
|
control: null,
|
|
1611
2635
|
buffer: null,
|
|
1612
2636
|
prevBuffer: 0,
|
|
1613
2637
|
bufferUsage: a
|
|
1614
2638
|
};
|
|
1615
2639
|
}
|
|
1616
|
-
static alloc({ capacity: e, dataType: t, ...
|
|
2640
|
+
static alloc({ capacity: e, dataType: t, ...r }) {
|
|
1617
2641
|
if (e === 0)
|
|
1618
2642
|
throw new Error("[Series] - cannot allocate an array of length 0");
|
|
1619
|
-
const
|
|
1620
|
-
data:
|
|
2643
|
+
const n = new new v(t).Array(e), a = new M({
|
|
2644
|
+
data: n.buffer,
|
|
1621
2645
|
dataType: t,
|
|
1622
|
-
...
|
|
2646
|
+
...r
|
|
1623
2647
|
});
|
|
1624
2648
|
return a.writePos = 0, a;
|
|
1625
2649
|
}
|
|
1626
|
-
static createTimestamps(e, t,
|
|
1627
|
-
const
|
|
1628
|
-
for (let
|
|
1629
|
-
a[
|
|
1630
|
-
return new
|
|
2650
|
+
static createTimestamps(e, t, r) {
|
|
2651
|
+
const n = r.spanRange(t.span(e)), a = new BigInt64Array(e);
|
|
2652
|
+
for (let o = 0; o < e; o++)
|
|
2653
|
+
a[o] = BigInt(r.add(t.span(o)).valueOf());
|
|
2654
|
+
return new M({ data: a, dataType: v.TIMESTAMP, timeRange: n });
|
|
1631
2655
|
}
|
|
1632
2656
|
get refCount() {
|
|
1633
2657
|
return this._refCount;
|
|
1634
2658
|
}
|
|
1635
2659
|
static fromStrings(e, t) {
|
|
1636
|
-
const
|
|
2660
|
+
const r = new TextEncoder().encode(
|
|
1637
2661
|
`${e.join(`
|
|
1638
2662
|
`)}
|
|
1639
2663
|
`
|
|
1640
2664
|
);
|
|
1641
|
-
return new
|
|
2665
|
+
return new M({ data: r, dataType: v.STRING, timeRange: t });
|
|
1642
2666
|
}
|
|
1643
2667
|
static fromJSON(e, t) {
|
|
1644
|
-
const
|
|
1645
|
-
`${e.map((
|
|
2668
|
+
const r = new TextEncoder().encode(
|
|
2669
|
+
`${e.map((n) => fe.encodeString(n)).join(`
|
|
1646
2670
|
`)}
|
|
1647
2671
|
`
|
|
1648
2672
|
);
|
|
1649
|
-
return new
|
|
2673
|
+
return new M({ data: r, dataType: v.JSON, timeRange: t });
|
|
1650
2674
|
}
|
|
1651
2675
|
acquire(e) {
|
|
1652
2676
|
this._refCount++, e != null && this.updateGLBuffer(e);
|
|
1653
2677
|
}
|
|
1654
2678
|
release() {
|
|
1655
|
-
if (this._refCount
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
2679
|
+
if (this._refCount <= 0) {
|
|
2680
|
+
console.warn("attempted to release a series with a negative reference count");
|
|
2681
|
+
return;
|
|
2682
|
+
}
|
|
2683
|
+
this._refCount--, this._refCount === 0 && this.gl.control != null && this.maybeGarbageCollectGLBuffer(this.gl.control);
|
|
1659
2684
|
}
|
|
1660
2685
|
/**
|
|
1661
2686
|
* Writes the given series to this series. If the series being written exceeds the
|
|
@@ -1672,13 +2697,13 @@ const rt = (r) => {
|
|
|
1672
2697
|
}
|
|
1673
2698
|
writeVariable(e) {
|
|
1674
2699
|
if (this.writePos === P) return 0;
|
|
1675
|
-
const t = this.byteCapacity.valueOf() - this.writePos,
|
|
1676
|
-
return this.writeToUnderlyingData(
|
|
2700
|
+
const t = this.byteCapacity.valueOf() - this.writePos, r = e.subBytes(0, t);
|
|
2701
|
+
return this.writeToUnderlyingData(r), this.writePos += r.byteLength.valueOf(), this._cachedLength != null && (this._cachedLength += r.length, this.calculateCachedLength()), r.length;
|
|
1677
2702
|
}
|
|
1678
2703
|
writeFixed(e) {
|
|
1679
2704
|
if (this.writePos === P) return 0;
|
|
1680
|
-
const t = this.capacity - this.writePos,
|
|
1681
|
-
return this.writeToUnderlyingData(
|
|
2705
|
+
const t = this.capacity - this.writePos, r = e.sub(0, t);
|
|
2706
|
+
return this.writeToUnderlyingData(r), this._cachedLength = void 0, this.maybeRecomputeMinMax(r), this.writePos += r.length, r.length;
|
|
1682
2707
|
}
|
|
1683
2708
|
writeToUnderlyingData(e) {
|
|
1684
2709
|
this.underlyingData.set(
|
|
@@ -1698,38 +2723,33 @@ const rt = (r) => {
|
|
|
1698
2723
|
return this.writePos === P ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
|
|
1699
2724
|
}
|
|
1700
2725
|
toStrings() {
|
|
1701
|
-
if (!this.dataType.matches(
|
|
2726
|
+
if (!this.dataType.matches(v.STRING, v.UUID))
|
|
1702
2727
|
throw new Error("cannot convert non-string series to strings");
|
|
1703
2728
|
return new TextDecoder().decode(this.underlyingData).split(`
|
|
1704
2729
|
`).slice(0, -1);
|
|
1705
2730
|
}
|
|
1706
2731
|
toUUIDs() {
|
|
1707
|
-
if (!this.dataType.equals(
|
|
2732
|
+
if (!this.dataType.equals(v.UUID))
|
|
1708
2733
|
throw new Error("cannot convert non-uuid series to uuids");
|
|
1709
|
-
const e =
|
|
1710
|
-
for (let
|
|
1711
|
-
const
|
|
1712
|
-
new Uint8Array(
|
|
1713
|
-
(
|
|
2734
|
+
const e = v.UUID.density.valueOf(), t = Array(this.length);
|
|
2735
|
+
for (let r = 0; r < this.length; r++) {
|
|
2736
|
+
const n = this.underlyingData.slice(r * e, (r + 1) * e), a = Array.from(
|
|
2737
|
+
new Uint8Array(n.buffer),
|
|
2738
|
+
(o) => o.toString(16).padStart(2, "0")
|
|
1714
2739
|
).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
|
|
1715
|
-
t[
|
|
2740
|
+
t[r] = a;
|
|
1716
2741
|
}
|
|
1717
2742
|
return t;
|
|
1718
2743
|
}
|
|
1719
2744
|
parseJSON(e) {
|
|
1720
|
-
if (!this.dataType.equals(
|
|
2745
|
+
if (!this.dataType.equals(v.JSON))
|
|
1721
2746
|
throw new Error("cannot parse non-JSON series as JSON");
|
|
1722
2747
|
return new TextDecoder().decode(this.underlyingData).split(`
|
|
1723
|
-
`).slice(0, -1).map((t) => e.parse(
|
|
1724
|
-
}
|
|
1725
|
-
/** @returns the time range of this array. */
|
|
1726
|
-
get timeRange() {
|
|
1727
|
-
if (this._timeRange == null) throw new Error("time range not set on series");
|
|
1728
|
-
return this._timeRange;
|
|
2748
|
+
`).slice(0, -1).map((t) => e.parse(fe.decodeString(t)));
|
|
1729
2749
|
}
|
|
1730
2750
|
/** @returns the capacity of the series in bytes. */
|
|
1731
2751
|
get byteCapacity() {
|
|
1732
|
-
return new
|
|
2752
|
+
return new Ae(this.underlyingData.byteLength);
|
|
1733
2753
|
}
|
|
1734
2754
|
/** @returns the capacity of the series in samples. */
|
|
1735
2755
|
get capacity() {
|
|
@@ -1737,7 +2757,7 @@ const rt = (r) => {
|
|
|
1737
2757
|
}
|
|
1738
2758
|
/** @returns the length of the series in bytes. */
|
|
1739
2759
|
get byteLength() {
|
|
1740
|
-
return this.writePos === P ? this.byteCapacity : this.dataType.isVariable ? new
|
|
2760
|
+
return this.writePos === P ? this.byteCapacity : this.dataType.isVariable ? new Ae(this.writePos) : this.dataType.density.size(this.writePos);
|
|
1741
2761
|
}
|
|
1742
2762
|
/** @returns the number of samples in this array. */
|
|
1743
2763
|
get length() {
|
|
@@ -1748,8 +2768,8 @@ const rt = (r) => {
|
|
|
1748
2768
|
throw new Error("cannot calculate length of a non-variable length data type");
|
|
1749
2769
|
let e = 0;
|
|
1750
2770
|
const t = [0];
|
|
1751
|
-
return this.data.forEach((
|
|
1752
|
-
|
|
2771
|
+
return this.data.forEach((r, n) => {
|
|
2772
|
+
r === Be && (e++, t.push(n + 1));
|
|
1753
2773
|
}), this._cachedIndexes = t, this._cachedLength = e, e;
|
|
1754
2774
|
}
|
|
1755
2775
|
/**
|
|
@@ -1763,13 +2783,13 @@ const rt = (r) => {
|
|
|
1763
2783
|
*/
|
|
1764
2784
|
convert(e, t = 0) {
|
|
1765
2785
|
if (this.dataType.equals(e)) return this;
|
|
1766
|
-
const
|
|
1767
|
-
for (let
|
|
1768
|
-
n
|
|
1769
|
-
return new
|
|
1770
|
-
data:
|
|
2786
|
+
const r = new e.Array(this.length);
|
|
2787
|
+
for (let n = 0; n < this.length; n++)
|
|
2788
|
+
r[n] = lr(this.dataType, e, this.data[n], t);
|
|
2789
|
+
return new M({
|
|
2790
|
+
data: r.buffer,
|
|
1771
2791
|
dataType: e,
|
|
1772
|
-
timeRange: this.
|
|
2792
|
+
timeRange: this.timeRange,
|
|
1773
2793
|
sampleOffset: t,
|
|
1774
2794
|
glBufferUsage: this.gl.bufferUsage,
|
|
1775
2795
|
alignment: this.alignment
|
|
@@ -1777,14 +2797,14 @@ const rt = (r) => {
|
|
|
1777
2797
|
}
|
|
1778
2798
|
calcRawMax() {
|
|
1779
2799
|
if (this.length === 0) return -1 / 0;
|
|
1780
|
-
if (this.dataType.equals(
|
|
2800
|
+
if (this.dataType.equals(v.TIMESTAMP))
|
|
1781
2801
|
this._cachedMax = this.data[this.data.length - 1];
|
|
1782
2802
|
else if (this.dataType.usesBigInt) {
|
|
1783
2803
|
const e = this.data;
|
|
1784
|
-
this._cachedMax = e.reduce((t,
|
|
2804
|
+
this._cachedMax = e.reduce((t, r) => t > r ? t : r);
|
|
1785
2805
|
} else {
|
|
1786
2806
|
const e = this.data;
|
|
1787
|
-
this._cachedMax = e.reduce((t,
|
|
2807
|
+
this._cachedMax = e.reduce((t, r) => t > r ? t : r);
|
|
1788
2808
|
}
|
|
1789
2809
|
return this._cachedMax;
|
|
1790
2810
|
}
|
|
@@ -1792,17 +2812,17 @@ const rt = (r) => {
|
|
|
1792
2812
|
get max() {
|
|
1793
2813
|
if (this.dataType.isVariable)
|
|
1794
2814
|
throw new Error("cannot calculate maximum on a variable length data type");
|
|
1795
|
-
return this.writePos === 0 ? -1 / 0 : (this._cachedMax ?? (this._cachedMax = this.calcRawMax()),
|
|
2815
|
+
return this.writePos === 0 ? -1 / 0 : (this._cachedMax ?? (this._cachedMax = this.calcRawMax()), se(this._cachedMax, this.sampleOffset));
|
|
1796
2816
|
}
|
|
1797
2817
|
calcRawMin() {
|
|
1798
2818
|
if (this.length === 0) return 1 / 0;
|
|
1799
|
-
if (this.dataType.equals(
|
|
2819
|
+
if (this.dataType.equals(v.TIMESTAMP)) this._cachedMin = this.data[0];
|
|
1800
2820
|
else if (this.dataType.usesBigInt) {
|
|
1801
2821
|
const e = this.data;
|
|
1802
|
-
this._cachedMin = e.reduce((t,
|
|
2822
|
+
this._cachedMin = e.reduce((t, r) => t < r ? t : r);
|
|
1803
2823
|
} else {
|
|
1804
2824
|
const e = this.data;
|
|
1805
|
-
this._cachedMin = e.reduce((t,
|
|
2825
|
+
this._cachedMin = e.reduce((t, r) => t < r ? t : r);
|
|
1806
2826
|
}
|
|
1807
2827
|
return this._cachedMin;
|
|
1808
2828
|
}
|
|
@@ -1810,11 +2830,11 @@ const rt = (r) => {
|
|
|
1810
2830
|
get min() {
|
|
1811
2831
|
if (this.dataType.isVariable)
|
|
1812
2832
|
throw new Error("cannot calculate minimum on a variable length data type");
|
|
1813
|
-
return this.writePos === 0 ? 1 / 0 : (this._cachedMin ?? (this._cachedMin = this.calcRawMin()),
|
|
2833
|
+
return this.writePos === 0 ? 1 / 0 : (this._cachedMin ?? (this._cachedMin = this.calcRawMin()), se(this._cachedMin, this.sampleOffset));
|
|
1814
2834
|
}
|
|
1815
2835
|
/** @returns the bounds of this array. */
|
|
1816
2836
|
get bounds() {
|
|
1817
|
-
return
|
|
2837
|
+
return z(Number(this.min), Number(this.max));
|
|
1818
2838
|
}
|
|
1819
2839
|
maybeRecomputeMinMax(e) {
|
|
1820
2840
|
if (this._cachedMin != null) {
|
|
@@ -1830,47 +2850,47 @@ const rt = (r) => {
|
|
|
1830
2850
|
this.max, this.min;
|
|
1831
2851
|
}
|
|
1832
2852
|
get range() {
|
|
1833
|
-
return
|
|
2853
|
+
return se(this.max, -this.min);
|
|
1834
2854
|
}
|
|
1835
2855
|
atAlignment(e, t) {
|
|
1836
|
-
const
|
|
1837
|
-
if (
|
|
1838
|
-
if (t === !0) throw new Error(`[series] - no value at index ${
|
|
2856
|
+
const r = Number(e - this.alignment);
|
|
2857
|
+
if (r < 0 || r >= this.length) {
|
|
2858
|
+
if (t === !0) throw new Error(`[series] - no value at index ${r}`);
|
|
1839
2859
|
return;
|
|
1840
2860
|
}
|
|
1841
|
-
return this.at(
|
|
2861
|
+
return this.at(r, t);
|
|
1842
2862
|
}
|
|
1843
2863
|
at(e, t) {
|
|
1844
2864
|
if (this.dataType.isVariable) return this.atVariable(e, t ?? !1);
|
|
1845
2865
|
e < 0 && (e = this.length + e);
|
|
1846
|
-
const
|
|
1847
|
-
if (
|
|
2866
|
+
const r = this.data[e];
|
|
2867
|
+
if (r == null) {
|
|
1848
2868
|
if (t === !0) throw new Error(`[series] - no value at index ${e}`);
|
|
1849
2869
|
return;
|
|
1850
2870
|
}
|
|
1851
|
-
return
|
|
2871
|
+
return se(r, this.sampleOffset);
|
|
1852
2872
|
}
|
|
1853
2873
|
atVariable(e, t) {
|
|
1854
|
-
let
|
|
2874
|
+
let r = 0, n = 0;
|
|
1855
2875
|
if (this._cachedIndexes != null)
|
|
1856
|
-
|
|
2876
|
+
r = this._cachedIndexes[e], n = this._cachedIndexes[e + 1] - 1;
|
|
1857
2877
|
else {
|
|
1858
2878
|
e < 0 && (e = this.length + e);
|
|
1859
|
-
for (let
|
|
1860
|
-
if (this.data[
|
|
2879
|
+
for (let o = 0; o < this.data.length; o++)
|
|
2880
|
+
if (this.data[o] === Be) {
|
|
1861
2881
|
if (e === 0) {
|
|
1862
|
-
|
|
2882
|
+
n = o;
|
|
1863
2883
|
break;
|
|
1864
2884
|
}
|
|
1865
|
-
|
|
2885
|
+
r = o + 1, e--;
|
|
1866
2886
|
}
|
|
1867
|
-
if (
|
|
2887
|
+
if (n === 0 && (n = this.data.length), r >= n || e > 0) {
|
|
1868
2888
|
if (t) throw new Error(`[series] - no value at index ${e}`);
|
|
1869
2889
|
return;
|
|
1870
2890
|
}
|
|
1871
2891
|
}
|
|
1872
|
-
const a = this.data.slice(
|
|
1873
|
-
return this.dataType.equals(
|
|
2892
|
+
const a = this.data.slice(r, n);
|
|
2893
|
+
return this.dataType.equals(v.STRING) ? new TextDecoder().decode(a) : De(JSON.parse(new TextDecoder().decode(a)));
|
|
1874
2894
|
}
|
|
1875
2895
|
/**
|
|
1876
2896
|
* @returns the index of the first sample that is greater than or equal to the given value.
|
|
@@ -1878,33 +2898,33 @@ const rt = (r) => {
|
|
|
1878
2898
|
* @param value the value to search for.
|
|
1879
2899
|
*/
|
|
1880
2900
|
binarySearch(e) {
|
|
1881
|
-
let t = 0,
|
|
1882
|
-
const
|
|
1883
|
-
for (; t <=
|
|
1884
|
-
const a = Math.floor((t +
|
|
1885
|
-
if (
|
|
1886
|
-
|
|
2901
|
+
let t = 0, r = this.length - 1;
|
|
2902
|
+
const n = Es(e);
|
|
2903
|
+
for (; t <= r; ) {
|
|
2904
|
+
const a = Math.floor((t + r) / 2), o = n(this.at(a, !0), e);
|
|
2905
|
+
if (o === 0) return a;
|
|
2906
|
+
o < 0 ? t = a + 1 : r = a - 1;
|
|
1887
2907
|
}
|
|
1888
2908
|
return t;
|
|
1889
2909
|
}
|
|
1890
2910
|
updateGLBuffer(e) {
|
|
1891
|
-
if (this.gl.control = e, !this.dataType.equals(
|
|
2911
|
+
if (this.gl.control = e, !this.dataType.equals(v.FLOAT32) && !this.dataType.equals(v.UINT8))
|
|
1892
2912
|
throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
|
|
1893
|
-
const { buffer: t, bufferUsage:
|
|
1894
|
-
if (t == null && (this.gl.buffer = e.createBuffer()), this.writePos !==
|
|
2913
|
+
const { buffer: t, bufferUsage: r, prevBuffer: n } = this.gl;
|
|
2914
|
+
if (t == null && (this.gl.buffer = e.createBuffer()), this.writePos !== n)
|
|
1895
2915
|
if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== P) {
|
|
1896
|
-
|
|
1897
|
-
const a = this.dataType.density.size(
|
|
1898
|
-
e.bufferSubData(e.ARRAY_BUFFER, a,
|
|
2916
|
+
n === 0 && e.bufferData(e.ARRAY_BUFFER, this.byteCapacity.valueOf(), e.STATIC_DRAW);
|
|
2917
|
+
const a = this.dataType.density.size(n).valueOf(), o = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
|
|
2918
|
+
e.bufferSubData(e.ARRAY_BUFFER, a, o.buffer), this.gl.prevBuffer = this.writePos;
|
|
1899
2919
|
} else
|
|
1900
2920
|
e.bufferData(
|
|
1901
2921
|
e.ARRAY_BUFFER,
|
|
1902
2922
|
this.buffer,
|
|
1903
|
-
|
|
2923
|
+
r === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW
|
|
1904
2924
|
), this.gl.prevBuffer = P;
|
|
1905
2925
|
}
|
|
1906
2926
|
as(e) {
|
|
1907
|
-
return
|
|
2927
|
+
return pr(e, this.dataType), this;
|
|
1908
2928
|
}
|
|
1909
2929
|
get digest() {
|
|
1910
2930
|
var e;
|
|
@@ -1913,10 +2933,10 @@ const rt = (r) => {
|
|
|
1913
2933
|
dataType: this.dataType.toString(),
|
|
1914
2934
|
sampleOffset: this.sampleOffset,
|
|
1915
2935
|
alignment: {
|
|
1916
|
-
lower:
|
|
1917
|
-
upper:
|
|
2936
|
+
lower: nt(this.alignmentBounds.lower),
|
|
2937
|
+
upper: nt(this.alignmentBounds.upper)
|
|
1918
2938
|
},
|
|
1919
|
-
timeRange: (e = this.
|
|
2939
|
+
timeRange: (e = this.timeRange) == null ? void 0 : e.toString(),
|
|
1920
2940
|
length: this.length,
|
|
1921
2941
|
capacity: this.capacity
|
|
1922
2942
|
};
|
|
@@ -1930,7 +2950,7 @@ const rt = (r) => {
|
|
|
1930
2950
|
};
|
|
1931
2951
|
}
|
|
1932
2952
|
get alignmentBounds() {
|
|
1933
|
-
return
|
|
2953
|
+
return z(this.alignment, this.alignment + BigInt(this.length));
|
|
1934
2954
|
}
|
|
1935
2955
|
maybeGarbageCollectGLBuffer(e) {
|
|
1936
2956
|
this.gl.buffer != null && (e.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
|
|
@@ -1941,10 +2961,10 @@ const rt = (r) => {
|
|
|
1941
2961
|
}
|
|
1942
2962
|
[Symbol.iterator]() {
|
|
1943
2963
|
if (this.dataType.isVariable) {
|
|
1944
|
-
const e = new
|
|
1945
|
-
return this.dataType.equals(
|
|
2964
|
+
const e = new wr(this);
|
|
2965
|
+
return this.dataType.equals(v.JSON) ? new mr(e) : e;
|
|
1946
2966
|
}
|
|
1947
|
-
return new
|
|
2967
|
+
return new br(this);
|
|
1948
2968
|
}
|
|
1949
2969
|
slice(e, t) {
|
|
1950
2970
|
return this.sliceSub(!1, e, t);
|
|
@@ -1953,10 +2973,10 @@ const rt = (r) => {
|
|
|
1953
2973
|
return this.sliceSub(!0, e, t);
|
|
1954
2974
|
}
|
|
1955
2975
|
subIterator(e, t) {
|
|
1956
|
-
return new
|
|
2976
|
+
return new _e(this, e, t ?? this.length);
|
|
1957
2977
|
}
|
|
1958
2978
|
subAlignmentIterator(e, t) {
|
|
1959
|
-
return new
|
|
2979
|
+
return new _e(
|
|
1960
2980
|
this,
|
|
1961
2981
|
Number(e - this.alignment),
|
|
1962
2982
|
Number(t - this.alignment)
|
|
@@ -1964,57 +2984,69 @@ const rt = (r) => {
|
|
|
1964
2984
|
}
|
|
1965
2985
|
subBytes(e, t) {
|
|
1966
2986
|
if (e >= 0 && (t == null || t >= this.byteLength.valueOf())) return this;
|
|
1967
|
-
const
|
|
1968
|
-
return new
|
|
1969
|
-
data:
|
|
2987
|
+
const r = this.data.subarray(e, t);
|
|
2988
|
+
return new M({
|
|
2989
|
+
data: r,
|
|
1970
2990
|
dataType: this.dataType,
|
|
1971
|
-
timeRange: this.
|
|
2991
|
+
timeRange: this.timeRange,
|
|
1972
2992
|
sampleOffset: this.sampleOffset,
|
|
1973
2993
|
glBufferUsage: this.gl.bufferUsage,
|
|
1974
2994
|
alignment: this.alignment + BigInt(e)
|
|
1975
2995
|
});
|
|
1976
2996
|
}
|
|
1977
|
-
sliceSub(e, t,
|
|
1978
|
-
if (t <= 0 && (
|
|
1979
|
-
let
|
|
1980
|
-
return e ?
|
|
1981
|
-
data:
|
|
2997
|
+
sliceSub(e, t, r) {
|
|
2998
|
+
if (t <= 0 && (r == null || r >= this.length)) return this;
|
|
2999
|
+
let n;
|
|
3000
|
+
return e ? n = this.data.subarray(t, r) : n = this.data.slice(t, r), new M({
|
|
3001
|
+
data: n,
|
|
1982
3002
|
dataType: this.dataType,
|
|
1983
|
-
timeRange: this.
|
|
3003
|
+
timeRange: this.timeRange,
|
|
1984
3004
|
sampleOffset: this.sampleOffset,
|
|
1985
3005
|
glBufferUsage: this.gl.bufferUsage,
|
|
1986
3006
|
alignment: this.alignment + BigInt(t)
|
|
1987
3007
|
});
|
|
1988
3008
|
}
|
|
1989
3009
|
reAlign(e) {
|
|
1990
|
-
return new
|
|
3010
|
+
return new M({
|
|
1991
3011
|
data: this.buffer,
|
|
1992
3012
|
dataType: this.dataType,
|
|
1993
|
-
timeRange:
|
|
3013
|
+
timeRange: ae.ZERO,
|
|
1994
3014
|
sampleOffset: this.sampleOffset,
|
|
1995
3015
|
glBufferUsage: "static",
|
|
1996
3016
|
alignment: e
|
|
1997
3017
|
});
|
|
1998
3018
|
}
|
|
3019
|
+
toString() {
|
|
3020
|
+
var e, t;
|
|
3021
|
+
let r = `${this.dataType.toString()} ${this.length} [`;
|
|
3022
|
+
if (this.length <= 10) r += Array.from(this).map((n) => n.toString());
|
|
3023
|
+
else {
|
|
3024
|
+
for (let n = 0; n < 5; n++)
|
|
3025
|
+
r += `${(e = this.at(n)) == null ? void 0 : e.toString()}`, n < 4 && (r += ",");
|
|
3026
|
+
r += "...";
|
|
3027
|
+
for (let n = -5; n < 0; n++)
|
|
3028
|
+
r += (t = this.at(n)) == null ? void 0 : t.toString(), n < -1 && (r += ",");
|
|
3029
|
+
}
|
|
3030
|
+
return r += "]", r;
|
|
3031
|
+
}
|
|
1999
3032
|
};
|
|
2000
|
-
|
|
2001
|
-
timeRange:
|
|
2002
|
-
dataType:
|
|
3033
|
+
h(re, "crudeZ", i.object({
|
|
3034
|
+
timeRange: ae.z.optional(),
|
|
3035
|
+
dataType: v.z,
|
|
2003
3036
|
alignment: i.coerce.bigint().optional(),
|
|
2004
3037
|
data: i.union([
|
|
2005
|
-
|
|
2006
|
-
|
|
3038
|
+
fr,
|
|
3039
|
+
gr,
|
|
2007
3040
|
i.instanceof(ArrayBuffer),
|
|
2008
3041
|
i.instanceof(Uint8Array)
|
|
2009
3042
|
]),
|
|
2010
|
-
glBufferUsage:
|
|
2011
|
-
})),
|
|
2012
|
-
let
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
this.end = xe(s, n), this.index = xe(s, t);
|
|
3043
|
+
glBufferUsage: cr.optional().default("static").optional()
|
|
3044
|
+
})), h(re, "z", re.crudeZ.transform((s) => new re(s)));
|
|
3045
|
+
let yr = re, _e = class {
|
|
3046
|
+
constructor(e, t, r) {
|
|
3047
|
+
h(this, "series"), h(this, "end"), h(this, "index"), this.series = e;
|
|
3048
|
+
const n = z(0, e.length);
|
|
3049
|
+
this.end = Ze(n, r), this.index = Ze(n, t);
|
|
2018
3050
|
}
|
|
2019
3051
|
next() {
|
|
2020
3052
|
return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
|
|
@@ -2022,10 +3054,10 @@ class Ce {
|
|
|
2022
3054
|
[Symbol.iterator]() {
|
|
2023
3055
|
return this;
|
|
2024
3056
|
}
|
|
2025
|
-
}
|
|
2026
|
-
class
|
|
3057
|
+
};
|
|
3058
|
+
class wr {
|
|
2027
3059
|
constructor(e) {
|
|
2028
|
-
if (
|
|
3060
|
+
if (h(this, "series"), h(this, "index"), h(this, "decoder"), !e.dataType.isVariable)
|
|
2029
3061
|
throw new Error(
|
|
2030
3062
|
"cannot create a variable series iterator for a non-variable series"
|
|
2031
3063
|
);
|
|
@@ -2033,34 +3065,36 @@ class fr {
|
|
|
2033
3065
|
}
|
|
2034
3066
|
next() {
|
|
2035
3067
|
const e = this.index, t = this.series.data;
|
|
2036
|
-
for (; this.index < t.length && t[this.index] !==
|
|
2037
|
-
const
|
|
2038
|
-
return e ===
|
|
3068
|
+
for (; this.index < t.length && t[this.index] !== Be; ) this.index++;
|
|
3069
|
+
const r = this.index;
|
|
3070
|
+
return e === r ? { done: !0, value: void 0 } : (this.index++, { done: !1, value: this.decoder.decode(this.series.buffer.slice(e, r)) });
|
|
2039
3071
|
}
|
|
2040
3072
|
[Symbol.iterator]() {
|
|
2041
3073
|
return this;
|
|
2042
3074
|
}
|
|
2043
3075
|
}
|
|
2044
|
-
var
|
|
2045
|
-
class
|
|
3076
|
+
var et, tt;
|
|
3077
|
+
const Ut = class xt {
|
|
2046
3078
|
constructor(e) {
|
|
2047
|
-
|
|
3079
|
+
h(this, "wrapped"), h(this, et, "JSONSeriesIterator"), this.wrapped = e;
|
|
2048
3080
|
}
|
|
2049
3081
|
next() {
|
|
2050
3082
|
const e = this.wrapped.next();
|
|
2051
3083
|
return e.done === !0 ? { done: !0, value: void 0 } : {
|
|
2052
3084
|
done: !1,
|
|
2053
|
-
value:
|
|
3085
|
+
value: fe.decodeString(e.value, xt.SCHEMA)
|
|
2054
3086
|
};
|
|
2055
3087
|
}
|
|
2056
|
-
[(
|
|
3088
|
+
[(tt = Symbol.iterator, et = Symbol.toStringTag, tt)]() {
|
|
2057
3089
|
return this;
|
|
2058
3090
|
}
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
|
|
3091
|
+
};
|
|
3092
|
+
h(Ut, "SCHEMA", i.record(i.string(), i.unknown()));
|
|
3093
|
+
let mr = Ut;
|
|
3094
|
+
var st, rt;
|
|
3095
|
+
class br {
|
|
2062
3096
|
constructor(e) {
|
|
2063
|
-
|
|
3097
|
+
h(this, "series"), h(this, "index"), h(this, st, "SeriesIterator"), this.series = e, this.index = 0;
|
|
2064
3098
|
}
|
|
2065
3099
|
next() {
|
|
2066
3100
|
return this.index >= this.series.length ? { done: !0, value: void 0 } : {
|
|
@@ -2068,12 +3102,12 @@ class gr {
|
|
|
2068
3102
|
value: this.series.at(this.index++, !0)
|
|
2069
3103
|
};
|
|
2070
3104
|
}
|
|
2071
|
-
[(
|
|
3105
|
+
[(rt = Symbol.iterator, st = Symbol.toStringTag, rt)]() {
|
|
2072
3106
|
return this;
|
|
2073
3107
|
}
|
|
2074
3108
|
}
|
|
2075
|
-
const
|
|
2076
|
-
const e =
|
|
3109
|
+
const nt = (s) => {
|
|
3110
|
+
const e = s >> 32n, t = s & 0xffffffffn;
|
|
2077
3111
|
return { domain: e, sample: t };
|
|
2078
3112
|
};
|
|
2079
3113
|
i.object({ key: i.string(), value: i.string() });
|
|
@@ -2081,41 +3115,41 @@ i.record(
|
|
|
2081
3115
|
i.union([i.number(), i.string(), i.symbol()]),
|
|
2082
3116
|
i.unknown()
|
|
2083
3117
|
);
|
|
2084
|
-
const
|
|
3118
|
+
const Nt = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", vr = Nt(), Et = ["macOS", "Windows", "Linux"], Tr = ["macos", "windows", "linux"], Or = {
|
|
2085
3119
|
macos: "macOS",
|
|
2086
3120
|
windows: "Windows",
|
|
2087
3121
|
linux: "Linux"
|
|
2088
|
-
},
|
|
2089
|
-
i.enum(
|
|
2090
|
-
),
|
|
3122
|
+
}, Sr = i.enum(Et).or(
|
|
3123
|
+
i.enum(Tr).transform((s) => Or[s])
|
|
3124
|
+
), Ir = () => {
|
|
2091
3125
|
if (typeof window > "u") return;
|
|
2092
|
-
const
|
|
2093
|
-
if (
|
|
2094
|
-
if (
|
|
2095
|
-
if (
|
|
3126
|
+
const s = window.navigator.userAgent.toLowerCase();
|
|
3127
|
+
if (s.includes("mac")) return "macOS";
|
|
3128
|
+
if (s.includes("win")) return "Windows";
|
|
3129
|
+
if (s.includes("linux")) return "Linux";
|
|
2096
3130
|
};
|
|
2097
|
-
let
|
|
2098
|
-
const
|
|
2099
|
-
const { force: e, default: t } =
|
|
2100
|
-
return e ??
|
|
2101
|
-
},
|
|
3131
|
+
let Se;
|
|
3132
|
+
const Ur = (s = {}) => {
|
|
3133
|
+
const { force: e, default: t } = s;
|
|
3134
|
+
return e ?? Se ?? (Se = Ir(), Se ?? t);
|
|
3135
|
+
}, At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2102
3136
|
__proto__: null,
|
|
2103
|
-
OPERATING_SYSTEMS:
|
|
2104
|
-
RUNTIME:
|
|
2105
|
-
detect:
|
|
2106
|
-
getOS:
|
|
2107
|
-
osZ:
|
|
3137
|
+
OPERATING_SYSTEMS: Et,
|
|
3138
|
+
RUNTIME: vr,
|
|
3139
|
+
detect: Nt,
|
|
3140
|
+
getOS: Ur,
|
|
3141
|
+
osZ: Sr
|
|
2108
3142
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2109
|
-
var
|
|
2110
|
-
const
|
|
3143
|
+
var xr = Object.defineProperty, Nr = (s, e, t) => e in s ? xr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, ne = (s, e, t) => Nr(s, typeof e != "symbol" ? e + "" : e, t);
|
|
3144
|
+
const Er = (...s) => s.map(Bt).join(""), Bt = (s) => (s.endsWith("/") || (s += "/"), s.startsWith("/") && (s = s.slice(1)), s), Ar = (s) => s.endsWith("/") ? s.slice(0, -1) : s, Br = (s, e = "") => s === null ? "" : `?${Object.entries(s).filter(([, t]) => t == null ? !1 : Array.isArray(t) ? t.length > 0 : !0).map(([t, r]) => `${e}${t}=${r}`).join("&")}`, $e = class Me {
|
|
2111
3145
|
/**
|
|
2112
3146
|
* @param host - The hostname or IP address of the server.
|
|
2113
3147
|
* @param port - The port number of the server.
|
|
2114
3148
|
* @param protocol - The protocol to use for all requests. Defaults to "".
|
|
2115
3149
|
* @param pathPrefix - A path prefix to use for all requests. Defaults to "".
|
|
2116
3150
|
*/
|
|
2117
|
-
constructor({ host: e, port: t, protocol:
|
|
2118
|
-
|
|
3151
|
+
constructor({ host: e, port: t, protocol: r = "", pathPrefix: n = "" }) {
|
|
3152
|
+
ne(this, "protocol"), ne(this, "host"), ne(this, "port"), ne(this, "path"), this.protocol = r, this.host = e, this.port = t, this.path = Bt(n);
|
|
2119
3153
|
}
|
|
2120
3154
|
/**
|
|
2121
3155
|
* Replaces creates a new URL with the specified properties replaced.
|
|
@@ -2123,7 +3157,7 @@ const Sr = (...r) => r.map(at).join(""), at = (r) => (r.endsWith("/") || (r += "
|
|
|
2123
3157
|
* @returns a new URL.
|
|
2124
3158
|
*/
|
|
2125
3159
|
replace(e) {
|
|
2126
|
-
return new
|
|
3160
|
+
return new Me({
|
|
2127
3161
|
host: e.host ?? this.host,
|
|
2128
3162
|
port: e.port ?? this.port,
|
|
2129
3163
|
protocol: e.protocol ?? this.protocol,
|
|
@@ -2136,190 +3170,262 @@ const Sr = (...r) => r.map(at).join(""), at = (r) => (r.endsWith("/") || (r += "
|
|
|
2136
3170
|
* @returns a new URL.
|
|
2137
3171
|
*/
|
|
2138
3172
|
child(e) {
|
|
2139
|
-
return new
|
|
3173
|
+
return new Me({
|
|
2140
3174
|
...this,
|
|
2141
|
-
pathPrefix:
|
|
3175
|
+
pathPrefix: Er(this.path, e)
|
|
2142
3176
|
});
|
|
2143
3177
|
}
|
|
2144
3178
|
/** @returns a string representation of the url */
|
|
2145
3179
|
toString() {
|
|
2146
|
-
return
|
|
3180
|
+
return Ar(
|
|
2147
3181
|
`${this.protocol}://${this.host}:${this.port}/${this.path}`
|
|
2148
3182
|
);
|
|
2149
3183
|
}
|
|
2150
3184
|
};
|
|
2151
|
-
|
|
2152
|
-
let
|
|
2153
|
-
const
|
|
2154
|
-
i.number().int().min(
|
|
2155
|
-
const
|
|
2156
|
-
i.number().int().min(
|
|
2157
|
-
const
|
|
2158
|
-
i.number().int().min(
|
|
2159
|
-
const
|
|
2160
|
-
i.bigint().min(
|
|
2161
|
-
const
|
|
2162
|
-
i.number().int().min(0).max(
|
|
2163
|
-
const
|
|
2164
|
-
i.number().int().min(0).max(
|
|
2165
|
-
const
|
|
2166
|
-
i.number().int().min(0).max(
|
|
2167
|
-
const
|
|
2168
|
-
i.bigint().min(0n).max(
|
|
2169
|
-
var
|
|
2170
|
-
const
|
|
2171
|
-
(e) => setTimeout(e,
|
|
2172
|
-
)
|
|
2173
|
-
|
|
3185
|
+
ne($e, "UNKNOWN", new $e({ host: "unknown", port: 0 }));
|
|
3186
|
+
let $r = $e;
|
|
3187
|
+
const Mr = -128, Cr = 127;
|
|
3188
|
+
i.number().int().min(Mr).max(Cr);
|
|
3189
|
+
const Rr = -32768, Dr = 32767;
|
|
3190
|
+
i.number().int().min(Rr).max(Dr);
|
|
3191
|
+
const Lr = -2147483648, kr = 2147483647;
|
|
3192
|
+
i.number().int().min(Lr).max(kr);
|
|
3193
|
+
const Pr = -9223372036854775808n, jr = 9223372036854775807n;
|
|
3194
|
+
i.bigint().min(Pr).max(jr);
|
|
3195
|
+
const Fr = 255;
|
|
3196
|
+
i.number().int().min(0).max(Fr);
|
|
3197
|
+
const zr = 65535;
|
|
3198
|
+
i.number().int().min(0).max(zr);
|
|
3199
|
+
const Yr = 4294967295;
|
|
3200
|
+
i.number().int().min(0).max(Yr);
|
|
3201
|
+
const Wr = 18446744073709551615n;
|
|
3202
|
+
i.bigint().min(0n).max(Wr);
|
|
3203
|
+
var qr = Object.defineProperty, Vr = (s, e, t) => e in s ? qr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, R = (s, e, t) => Vr(s, typeof e != "symbol" ? e + "" : e, t);
|
|
3204
|
+
const Hr = async (s) => await new Promise(
|
|
3205
|
+
(e) => setTimeout(e, w.fromMilliseconds(s).milliseconds)
|
|
3206
|
+
);
|
|
3207
|
+
class Zr {
|
|
3208
|
+
constructor(e) {
|
|
3209
|
+
R(this, "config"), R(this, "retries"), R(this, "interval"), this.config = {
|
|
3210
|
+
baseInterval: new w((e == null ? void 0 : e.baseInterval) ?? w.seconds(1)),
|
|
3211
|
+
maxRetries: (e == null ? void 0 : e.maxRetries) ?? 5,
|
|
3212
|
+
scale: (e == null ? void 0 : e.scale) ?? 1,
|
|
3213
|
+
sleepFn: (e == null ? void 0 : e.sleepFn) ?? Hr
|
|
3214
|
+
}, this.retries = 0, this.interval = new w(this.config.baseInterval);
|
|
3215
|
+
}
|
|
3216
|
+
async wait() {
|
|
3217
|
+
const { maxRetries: e, scale: t, sleepFn: r } = this.config;
|
|
3218
|
+
return this.retries >= e ? !1 : (await r(this.interval), this.interval = this.interval.mult(t), this.retries++, !0);
|
|
3219
|
+
}
|
|
3220
|
+
reset() {
|
|
3221
|
+
this.retries = 0, this.interval = this.config.baseInterval;
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
const Gr = i.object({
|
|
3225
|
+
baseInterval: w.z.optional(),
|
|
2174
3226
|
maxRetries: i.number().optional(),
|
|
2175
3227
|
scale: i.number().optional()
|
|
2176
|
-
}),
|
|
2177
|
-
const e = r.sleepFn || qr, t = r.maxRetries ?? 5, n = r.scale ?? 1;
|
|
2178
|
-
let s = 0, a = new O(r.interval ?? O.milliseconds(1));
|
|
2179
|
-
return async () => s >= t ? !1 : (await e(a), a = a.mult(n), s++, !0);
|
|
2180
|
-
}, Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3228
|
+
}), Kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2181
3229
|
__proto__: null,
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
3230
|
+
Breaker: Zr,
|
|
3231
|
+
breakerConfig: Gr
|
|
3232
|
+
}, Symbol.toStringTag, { value: "Module" })), Jr = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, je = i.string().regex(Jr), H = i.number().min(0).max(255), Xr = i.number().min(0).max(1), $t = i.tuple([H, H, H, Xr]), Mt = i.tuple([H, H, H]), Fe = (s, e = 1) => {
|
|
3233
|
+
if (typeof s == "string") return _r(s, e);
|
|
3234
|
+
if (Array.isArray(s)) {
|
|
3235
|
+
if (s.length < 3 || s.length > 4)
|
|
3236
|
+
throw new Error(`Invalid color: [${s.join(", ")}]`);
|
|
3237
|
+
return s.length === 3 ? [...s, e] : s;
|
|
3238
|
+
}
|
|
3239
|
+
throw new Error(`Invalid color: ${JSON.stringify(s)}`);
|
|
3240
|
+
}, Qr = i.union([je, $t, Mt]).transform((s) => Fe(s)), _r = (s, e = 1) => {
|
|
3241
|
+
if (!je.safeParse(s).success) throw new Error(`Invalid hex color: ${s}`);
|
|
3242
|
+
return s = en(s), [
|
|
3243
|
+
de(s, 0),
|
|
3244
|
+
de(s, 2),
|
|
3245
|
+
de(s, 4),
|
|
3246
|
+
s.length === 8 ? de(s, 6) / 255 : e
|
|
3247
|
+
];
|
|
3248
|
+
}, de = (s, e) => parseInt(s.slice(e, e + 2), 16), en = (s) => s.startsWith("#") ? s.slice(1) : s, tn = i.union([je, $t, i.string(), Mt]);
|
|
3249
|
+
Fe("#000000");
|
|
3250
|
+
Fe("#ffffff");
|
|
3251
|
+
const sn = i.object({
|
|
3252
|
+
key: i.string(),
|
|
3253
|
+
color: tn,
|
|
3254
|
+
position: i.number(),
|
|
3255
|
+
switched: i.boolean().optional()
|
|
3256
|
+
});
|
|
3257
|
+
i.array(sn);
|
|
3258
|
+
const rn = i.object({
|
|
3259
|
+
key: i.string(),
|
|
3260
|
+
name: i.string(),
|
|
3261
|
+
color: Qr
|
|
3262
|
+
});
|
|
2195
3263
|
i.object({
|
|
3264
|
+
key: i.string(),
|
|
3265
|
+
name: i.string(),
|
|
3266
|
+
swatches: i.array(rn)
|
|
3267
|
+
});
|
|
3268
|
+
const nn = i.number().int().min(0).max(255), an = i.object({
|
|
2196
3269
|
name: i.string(),
|
|
2197
3270
|
key: i.string()
|
|
3271
|
+
}), ye = (s) => i.object({
|
|
3272
|
+
subject: an,
|
|
3273
|
+
resource: s,
|
|
3274
|
+
authority: nn
|
|
3275
|
+
}), on = i.object({
|
|
3276
|
+
from: ye(i.any()),
|
|
3277
|
+
to: i.null()
|
|
3278
|
+
}), hn = i.object({
|
|
3279
|
+
from: i.null(),
|
|
3280
|
+
to: ye(i.any())
|
|
2198
3281
|
});
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
3282
|
+
i.union([
|
|
3283
|
+
on,
|
|
3284
|
+
hn,
|
|
3285
|
+
i.object({
|
|
3286
|
+
from: ye(i.any()),
|
|
3287
|
+
to: ye(i.any())
|
|
3288
|
+
})
|
|
3289
|
+
]);
|
|
3290
|
+
const un = (s) => Object.getOwnPropertySymbols(globalThis).includes(s), cn = (s, e) => {
|
|
3291
|
+
const t = Symbol.for(s);
|
|
3292
|
+
if (!un(t)) {
|
|
3293
|
+
const r = e();
|
|
3294
|
+
Object.defineProperty(globalThis, t, { value: r });
|
|
3295
|
+
}
|
|
3296
|
+
return () => globalThis[t];
|
|
3297
|
+
}, ln = (s) => (e) => e != null && typeof e == "object" && "type" in e && typeof e.type == "string" ? e.type.startsWith(s) : e instanceof Error ? e.message.startsWith(s) : typeof e != "string" ? !1 : e.startsWith(s), me = (s) => {
|
|
3298
|
+
var e;
|
|
3299
|
+
return e = class extends Error {
|
|
3300
|
+
constructor(t, r) {
|
|
3301
|
+
super(t, r), R(this, "discriminator", e.discriminator), R(this, "type", e.TYPE), R(this, "matches", e.matches), this.name = e.TYPE;
|
|
3302
|
+
}
|
|
3303
|
+
static sub(t) {
|
|
3304
|
+
return me(`${s}.${t}`);
|
|
3305
|
+
}
|
|
3306
|
+
}, R(e, "discriminator", "FreighterError"), R(e, "TYPE", s), R(e, "matches", ln(s)), e;
|
|
3307
|
+
}, Ct = (s) => {
|
|
3308
|
+
if (s == null || typeof s != "object") return !1;
|
|
3309
|
+
const e = s;
|
|
2225
3310
|
if (e.discriminator !== "FreighterError") return !1;
|
|
2226
3311
|
if (!("type" in e))
|
|
2227
3312
|
throw new Error(
|
|
2228
3313
|
`Freighter error is missing its type property: ${JSON.stringify(e)}`
|
|
2229
3314
|
);
|
|
2230
3315
|
return !0;
|
|
2231
|
-
},
|
|
2232
|
-
class
|
|
3316
|
+
}, q = "unknown", Ce = "nil";
|
|
3317
|
+
class dn {
|
|
2233
3318
|
constructor() {
|
|
2234
|
-
|
|
3319
|
+
R(this, "providers", []);
|
|
2235
3320
|
}
|
|
2236
3321
|
register(e) {
|
|
2237
3322
|
this.providers.push(e);
|
|
2238
3323
|
}
|
|
2239
3324
|
encode(e) {
|
|
2240
|
-
if (e == null) return { type:
|
|
2241
|
-
if (
|
|
3325
|
+
if (e == null) return { type: Ce, data: "" };
|
|
3326
|
+
if (Ct(e))
|
|
2242
3327
|
for (const t of this.providers) {
|
|
2243
|
-
const
|
|
2244
|
-
if (
|
|
3328
|
+
const r = t.encode(e);
|
|
3329
|
+
if (r != null) return r;
|
|
2245
3330
|
}
|
|
2246
|
-
return { type:
|
|
3331
|
+
if (e instanceof Error) return { type: q, data: e.message };
|
|
3332
|
+
if (typeof e == "string") return { type: q, data: e };
|
|
3333
|
+
try {
|
|
3334
|
+
return { type: q, data: JSON.stringify(e) };
|
|
3335
|
+
} catch {
|
|
3336
|
+
return { type: q, data: "unable to encode error information" };
|
|
3337
|
+
}
|
|
2247
3338
|
}
|
|
2248
3339
|
decode(e) {
|
|
2249
|
-
if (e == null || e.type ===
|
|
2250
|
-
if (e.type ===
|
|
3340
|
+
if (e == null || e.type === Ce) return null;
|
|
3341
|
+
if (e.type === q) return new Re(e.data);
|
|
2251
3342
|
for (const t of this.providers) {
|
|
2252
|
-
const
|
|
2253
|
-
if (
|
|
3343
|
+
const r = t.decode(e);
|
|
3344
|
+
if (r != null) return r;
|
|
2254
3345
|
}
|
|
2255
|
-
return new
|
|
3346
|
+
return new Re(e.data);
|
|
2256
3347
|
}
|
|
2257
3348
|
}
|
|
2258
|
-
const
|
|
2259
|
-
encode:
|
|
3349
|
+
const ze = cn("synnax-error-registry", () => new dn()), fn = ({
|
|
3350
|
+
encode: s,
|
|
2260
3351
|
decode: e
|
|
2261
|
-
}) =>
|
|
2262
|
-
class
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
}
|
|
3352
|
+
}) => ze().register({ encode: s, decode: e }), gn = (s) => ze().encode(s), pn = (s) => s == null ? null : ze().decode(s);
|
|
3353
|
+
class Re extends me("unknown") {
|
|
3354
|
+
}
|
|
3355
|
+
const yn = i.object({ type: i.string(), data: i.string() });
|
|
3356
|
+
class wn extends me("canceled") {
|
|
2267
3357
|
}
|
|
2268
|
-
const
|
|
3358
|
+
const F = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3359
|
+
__proto__: null,
|
|
3360
|
+
Canceled: wn,
|
|
3361
|
+
NONE: Ce,
|
|
3362
|
+
UNKNOWN: q,
|
|
3363
|
+
Unknown: Re,
|
|
3364
|
+
createTyped: me,
|
|
3365
|
+
decode: pn,
|
|
3366
|
+
encode: gn,
|
|
3367
|
+
isTyped: Ct,
|
|
3368
|
+
payloadZ: yn,
|
|
3369
|
+
register: fn
|
|
3370
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3371
|
+
Y.object({
|
|
3372
|
+
jsonrpc: Y.string(),
|
|
3373
|
+
id: Y.number().optional(),
|
|
3374
|
+
method: Y.string().optional(),
|
|
3375
|
+
params: Y.unknown().optional(),
|
|
3376
|
+
result: Y.unknown().optional()
|
|
3377
|
+
});
|
|
3378
|
+
i.string().regex(/^\d+\.\d+\.\d+$/);
|
|
3379
|
+
const mn = ["standard", "scientific", "engineering"];
|
|
3380
|
+
i.enum(mn);
|
|
3381
|
+
class ue extends F.createTyped("freighter") {
|
|
3382
|
+
}
|
|
3383
|
+
class Z extends ue.sub("eof") {
|
|
2269
3384
|
constructor() {
|
|
2270
3385
|
super("EOF");
|
|
2271
|
-
y(this, "type", G.TYPE);
|
|
2272
3386
|
}
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
let Y = G;
|
|
2276
|
-
const W = class W extends oe {
|
|
3387
|
+
}
|
|
3388
|
+
class G extends ue.sub("stream_closed") {
|
|
2277
3389
|
constructor() {
|
|
2278
3390
|
super("StreamClosed");
|
|
2279
|
-
y(this, "type", W.TYPE);
|
|
2280
3391
|
}
|
|
2281
|
-
}
|
|
2282
|
-
|
|
2283
|
-
let k = W;
|
|
2284
|
-
const V = class V extends oe {
|
|
3392
|
+
}
|
|
3393
|
+
class K extends ue.sub("unreachable") {
|
|
2285
3394
|
constructor(t = {}) {
|
|
2286
|
-
const { message:
|
|
2287
|
-
super(
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
this.url = s;
|
|
3395
|
+
const { message: r = "Unreachable", url: n = $r.UNKNOWN } = t;
|
|
3396
|
+
super(r);
|
|
3397
|
+
S(this, "url");
|
|
3398
|
+
this.url = n;
|
|
2291
3399
|
}
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
if (
|
|
2297
|
-
|
|
2298
|
-
if (
|
|
2299
|
-
return { type:
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
case
|
|
2307
|
-
return new
|
|
2308
|
-
case
|
|
2309
|
-
return new
|
|
2310
|
-
case j.TYPE:
|
|
2311
|
-
return new j();
|
|
3400
|
+
}
|
|
3401
|
+
const bn = (s) => {
|
|
3402
|
+
if (!s.type.startsWith(ue.TYPE)) return null;
|
|
3403
|
+
if (Z.matches(s)) return { type: Z.TYPE, data: "EOF" };
|
|
3404
|
+
if (G.matches(s))
|
|
3405
|
+
return { type: G.TYPE, data: "StreamClosed" };
|
|
3406
|
+
if (K.matches(s))
|
|
3407
|
+
return { type: K.TYPE, data: "Unreachable" };
|
|
3408
|
+
throw new Error(`Unknown error type: ${s.type}: ${s.message}`);
|
|
3409
|
+
}, vn = (s) => {
|
|
3410
|
+
if (!s.type.startsWith(ue.TYPE)) return null;
|
|
3411
|
+
switch (s.type) {
|
|
3412
|
+
case Z.TYPE:
|
|
3413
|
+
return new Z();
|
|
3414
|
+
case G.TYPE:
|
|
3415
|
+
return new G();
|
|
3416
|
+
case K.TYPE:
|
|
3417
|
+
return new K();
|
|
2312
3418
|
default:
|
|
2313
|
-
throw new
|
|
3419
|
+
throw new F.Unknown(`Unknown error type: ${s.data}`);
|
|
2314
3420
|
}
|
|
2315
3421
|
};
|
|
2316
|
-
|
|
2317
|
-
encode:
|
|
2318
|
-
decode:
|
|
3422
|
+
F.register({
|
|
3423
|
+
encode: bn,
|
|
3424
|
+
decode: vn
|
|
2319
3425
|
});
|
|
2320
|
-
class
|
|
3426
|
+
class Rt {
|
|
2321
3427
|
constructor() {
|
|
2322
|
-
|
|
3428
|
+
S(this, "middleware", []);
|
|
2323
3429
|
}
|
|
2324
3430
|
/** Implements the Transport interface */
|
|
2325
3431
|
use(...e) {
|
|
@@ -2335,135 +3441,137 @@ class ct {
|
|
|
2335
3441
|
* @returns An error if one was encountered, otherwise undefined.
|
|
2336
3442
|
*/
|
|
2337
3443
|
async executeMiddleware(e, t) {
|
|
2338
|
-
let
|
|
2339
|
-
const
|
|
2340
|
-
if (
|
|
2341
|
-
const
|
|
2342
|
-
return
|
|
3444
|
+
let r = 0;
|
|
3445
|
+
const n = async (a) => {
|
|
3446
|
+
if (r === this.middleware.length) return await t(a);
|
|
3447
|
+
const o = this.middleware[r];
|
|
3448
|
+
return r++, await o(a, n);
|
|
2343
3449
|
};
|
|
2344
|
-
return await
|
|
3450
|
+
return await n(e);
|
|
2345
3451
|
}
|
|
2346
3452
|
}
|
|
2347
|
-
const
|
|
2348
|
-
if (
|
|
3453
|
+
const Dt = "Content-Type", it = (s) => {
|
|
3454
|
+
if (At.RUNTIME !== "node") return fetch;
|
|
2349
3455
|
const e = require("node-fetch");
|
|
2350
|
-
if (
|
|
2351
|
-
const t = require("https"),
|
|
2352
|
-
return async (
|
|
2353
|
-
};
|
|
2354
|
-
class
|
|
2355
|
-
constructor(t,
|
|
3456
|
+
if (s === "http") return e;
|
|
3457
|
+
const t = require("https"), r = new t.Agent({ rejectUnauthorized: !1 });
|
|
3458
|
+
return async (n, a) => await e(n, { ...a, agent: r });
|
|
3459
|
+
}, Tn = (s) => "code" in s && s.code === "ECONNREFUSED" || s.message.toLowerCase().includes("load failed"), On = 400;
|
|
3460
|
+
class Pn extends Rt {
|
|
3461
|
+
constructor(t, r, n = !1) {
|
|
2356
3462
|
super();
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
return this.endpoint = t.replace({ protocol:
|
|
2361
|
-
get: (a,
|
|
3463
|
+
S(this, "endpoint");
|
|
3464
|
+
S(this, "encoder");
|
|
3465
|
+
S(this, "fetch");
|
|
3466
|
+
return this.endpoint = t.replace({ protocol: n ? "https" : "http" }), this.encoder = r, this.fetch = it(this.endpoint.protocol), new Proxy(this, {
|
|
3467
|
+
get: (a, o, c) => o === "endpoint" ? this.endpoint : Reflect.get(a, o, c)
|
|
2362
3468
|
});
|
|
2363
3469
|
}
|
|
2364
3470
|
get headers() {
|
|
2365
3471
|
return {
|
|
2366
|
-
[
|
|
3472
|
+
[Dt]: this.encoder.contentType
|
|
2367
3473
|
};
|
|
2368
3474
|
}
|
|
2369
|
-
async send(t,
|
|
2370
|
-
|
|
2371
|
-
let
|
|
2372
|
-
const
|
|
2373
|
-
d.method = "POST", d.body = this.encoder.encode(
|
|
3475
|
+
async send(t, r, n, a) {
|
|
3476
|
+
r = n == null ? void 0 : n.parse(r);
|
|
3477
|
+
let o = null;
|
|
3478
|
+
const c = this.endpoint.child(t), d = {};
|
|
3479
|
+
d.method = "POST", d.body = this.encoder.encode(r ?? {});
|
|
2374
3480
|
const [, p] = await this.executeMiddleware(
|
|
2375
3481
|
{
|
|
2376
|
-
target:
|
|
3482
|
+
target: c.toString(),
|
|
2377
3483
|
protocol: this.endpoint.protocol,
|
|
2378
3484
|
params: {},
|
|
2379
3485
|
role: "client"
|
|
2380
3486
|
},
|
|
2381
|
-
async (
|
|
2382
|
-
const l = { ...
|
|
3487
|
+
async (y) => {
|
|
3488
|
+
const l = { ...y, params: {} };
|
|
2383
3489
|
d.headers = {
|
|
2384
3490
|
...this.headers,
|
|
2385
|
-
...
|
|
3491
|
+
...y.params
|
|
2386
3492
|
};
|
|
2387
|
-
let
|
|
3493
|
+
let U;
|
|
2388
3494
|
try {
|
|
2389
|
-
|
|
2390
|
-
} catch (
|
|
2391
|
-
let
|
|
2392
|
-
return
|
|
3495
|
+
U = await it(y.protocol)(y.target, d);
|
|
3496
|
+
} catch (D) {
|
|
3497
|
+
let A = D;
|
|
3498
|
+
return Tn(A) && (A = new K({ url: c })), [l, A];
|
|
2393
3499
|
}
|
|
2394
|
-
const
|
|
2395
|
-
if (
|
|
2396
|
-
return a != null && (
|
|
3500
|
+
const B = new Uint8Array(await (await U.blob()).arrayBuffer());
|
|
3501
|
+
if (U != null && U.ok)
|
|
3502
|
+
return a != null && (o = this.encoder.decode(B, a)), [l, null];
|
|
2397
3503
|
try {
|
|
2398
|
-
if (
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
3504
|
+
if (U.status !== On)
|
|
3505
|
+
return [l, new Error(U.statusText)];
|
|
3506
|
+
const D = this.encoder.decode(B, F.payloadZ), A = F.decode(D);
|
|
3507
|
+
return [l, A];
|
|
3508
|
+
} catch (D) {
|
|
2402
3509
|
return [
|
|
2403
3510
|
l,
|
|
2404
3511
|
new Error(
|
|
2405
|
-
`[freighter] - failed to decode error: ${
|
|
3512
|
+
`[freighter] - failed to decode error: ${U.statusText}: ${D.message}`
|
|
2406
3513
|
)
|
|
2407
3514
|
];
|
|
2408
3515
|
}
|
|
2409
3516
|
}
|
|
2410
3517
|
);
|
|
2411
|
-
return [
|
|
3518
|
+
return p != null ? [null, p] : [o, null];
|
|
2412
3519
|
}
|
|
2413
3520
|
}
|
|
2414
|
-
const
|
|
3521
|
+
const jn = (s, e) => {
|
|
2415
3522
|
class t {
|
|
2416
|
-
constructor(
|
|
2417
|
-
|
|
2418
|
-
this.wrapped =
|
|
3523
|
+
constructor(n) {
|
|
3524
|
+
S(this, "wrapped");
|
|
3525
|
+
this.wrapped = n;
|
|
2419
3526
|
}
|
|
2420
|
-
use(...
|
|
2421
|
-
this.wrapped.use(...
|
|
3527
|
+
use(...n) {
|
|
3528
|
+
this.wrapped.use(...n);
|
|
2422
3529
|
}
|
|
2423
|
-
async send(
|
|
2424
|
-
const d =
|
|
3530
|
+
async send(n, a, o, c) {
|
|
3531
|
+
const d = new Kr.Breaker(e);
|
|
2425
3532
|
do {
|
|
2426
|
-
const [p,
|
|
2427
|
-
if (
|
|
2428
|
-
if (!
|
|
3533
|
+
const [p, y] = await this.wrapped.send(n, a, o, c);
|
|
3534
|
+
if (y == null) return [p, null];
|
|
3535
|
+
if (!K.matches(y)) return [null, y];
|
|
3536
|
+
if (!await d.wait()) return [p, y];
|
|
2429
3537
|
} while (!0);
|
|
2430
3538
|
}
|
|
2431
3539
|
}
|
|
2432
|
-
return new t(
|
|
2433
|
-
},
|
|
2434
|
-
const [a,
|
|
2435
|
-
if (
|
|
3540
|
+
return new t(s);
|
|
3541
|
+
}, Fn = async (s, e, t, r, n) => {
|
|
3542
|
+
const [a, o] = await s.send(e, t, r, n);
|
|
3543
|
+
if (o != null) throw o;
|
|
2436
3544
|
return a;
|
|
2437
|
-
},
|
|
3545
|
+
}, Sn = () => At.RUNTIME !== "node" ? (s) => new WebSocket(s) : (s) => new (require("ws")).WebSocket(s, { rejectUnauthorized: !1 }), In = i.object({
|
|
2438
3546
|
type: i.enum(["data", "close", "open"]),
|
|
2439
|
-
payload: i.unknown()
|
|
2440
|
-
error: i.optional(
|
|
3547
|
+
payload: i.unknown(),
|
|
3548
|
+
error: i.optional(F.payloadZ)
|
|
2441
3549
|
});
|
|
2442
|
-
class
|
|
2443
|
-
constructor(e, t,
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
this.
|
|
3550
|
+
class Un {
|
|
3551
|
+
constructor(e, t, r, n) {
|
|
3552
|
+
S(this, "codec");
|
|
3553
|
+
S(this, "reqSchema");
|
|
3554
|
+
S(this, "resSchema");
|
|
3555
|
+
S(this, "ws");
|
|
3556
|
+
S(this, "serverClosed");
|
|
3557
|
+
S(this, "sendClosed");
|
|
3558
|
+
S(this, "receiveDataQueue", []);
|
|
3559
|
+
S(this, "receiveCallbacksQueue", []);
|
|
3560
|
+
this.codec = t, this.reqSchema = r, this.resSchema = n, this.ws = e, this.sendClosed = !1, this.serverClosed = null, this.listenForMessages();
|
|
2453
3561
|
}
|
|
2454
3562
|
async receiveOpenAck() {
|
|
2455
3563
|
const e = await this.receiveMsg();
|
|
2456
3564
|
if (e.type !== "open") {
|
|
2457
3565
|
if (e.error == null) throw new Error("Message error must be defined");
|
|
2458
|
-
return
|
|
3566
|
+
return F.decode(e.error);
|
|
2459
3567
|
}
|
|
2460
3568
|
return null;
|
|
2461
3569
|
}
|
|
2462
3570
|
/** Implements the Stream protocol */
|
|
2463
3571
|
send(e) {
|
|
2464
|
-
if (this.serverClosed != null) return new
|
|
2465
|
-
if (this.sendClosed) throw new
|
|
2466
|
-
return this.ws.send(this.
|
|
3572
|
+
if (this.serverClosed != null) return new Z();
|
|
3573
|
+
if (this.sendClosed) throw new G();
|
|
3574
|
+
return this.ws.send(this.codec.encode({ type: "data", payload: e })), null;
|
|
2467
3575
|
}
|
|
2468
3576
|
/** Implements the Stream protocol */
|
|
2469
3577
|
async receive() {
|
|
@@ -2471,7 +3579,7 @@ class tn {
|
|
|
2471
3579
|
const e = await this.receiveMsg();
|
|
2472
3580
|
if (e.type === "close") {
|
|
2473
3581
|
if (e.error == null) throw new Error("Message error must be defined");
|
|
2474
|
-
return this.serverClosed =
|
|
3582
|
+
return this.serverClosed = F.decode(e.error), [null, this.serverClosed];
|
|
2475
3583
|
}
|
|
2476
3584
|
return [this.resSchema.parse(e.payload), null];
|
|
2477
3585
|
}
|
|
@@ -2484,7 +3592,7 @@ class tn {
|
|
|
2484
3592
|
if (this.sendClosed || this.serverClosed != null) return;
|
|
2485
3593
|
const e = { type: "close" };
|
|
2486
3594
|
try {
|
|
2487
|
-
this.ws.send(this.
|
|
3595
|
+
this.ws.send(this.codec.encode(e));
|
|
2488
3596
|
} finally {
|
|
2489
3597
|
this.sendClosed = !0;
|
|
2490
3598
|
}
|
|
@@ -2492,7 +3600,7 @@ class tn {
|
|
|
2492
3600
|
async receiveMsg() {
|
|
2493
3601
|
const e = this.receiveDataQueue.shift();
|
|
2494
3602
|
return e ?? await new Promise(
|
|
2495
|
-
(t,
|
|
3603
|
+
(t, r) => this.receiveCallbacksQueue.push({ resolve: t, reject: r })
|
|
2496
3604
|
);
|
|
2497
3605
|
}
|
|
2498
3606
|
addMessage(e) {
|
|
@@ -2500,78 +3608,86 @@ class tn {
|
|
|
2500
3608
|
t != null ? t.resolve(e) : this.receiveDataQueue.push(e);
|
|
2501
3609
|
}
|
|
2502
3610
|
listenForMessages() {
|
|
2503
|
-
this.ws.onmessage =
|
|
3611
|
+
this.ws.onmessage = this.onMessage.bind(this), this.ws.onclose = this.onClose.bind(this);
|
|
3612
|
+
}
|
|
3613
|
+
onMessage(e) {
|
|
3614
|
+
this.addMessage(this.codec.decode(e.data, In));
|
|
3615
|
+
}
|
|
3616
|
+
onClose(e) {
|
|
3617
|
+
this.addMessage({
|
|
2504
3618
|
type: "close",
|
|
2505
|
-
error: {
|
|
3619
|
+
error: {
|
|
3620
|
+
type: e.code === Nn ? Z.TYPE : G.TYPE,
|
|
3621
|
+
data: ""
|
|
3622
|
+
}
|
|
2506
3623
|
});
|
|
2507
3624
|
}
|
|
2508
3625
|
}
|
|
2509
|
-
const
|
|
3626
|
+
const xn = "freighterctx", Nn = 1e3, oe = class oe extends Rt {
|
|
2510
3627
|
/**
|
|
2511
3628
|
* @param encoder - The encoder to use for encoding messages and decoding
|
|
2512
3629
|
* responses.
|
|
2513
3630
|
* @param baseEndpoint - A base url to use as a prefix for all requests.
|
|
2514
3631
|
*/
|
|
2515
|
-
constructor(t,
|
|
3632
|
+
constructor(t, r, n = !1) {
|
|
2516
3633
|
super();
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
this
|
|
3634
|
+
S(this, "baseUrl");
|
|
3635
|
+
S(this, "encoder");
|
|
3636
|
+
S(this, "secure");
|
|
3637
|
+
this.secure = n, this.baseUrl = t.replace({ protocol: n ? "wss" : "ws" }), this.encoder = r;
|
|
3638
|
+
}
|
|
3639
|
+
withCodec(t) {
|
|
3640
|
+
const r = new oe(this.baseUrl, t, this.secure);
|
|
3641
|
+
return r.use(...this.middleware), r;
|
|
2520
3642
|
}
|
|
2521
3643
|
/** Implements the StreamClient interface. */
|
|
2522
|
-
async stream(t,
|
|
2523
|
-
const a =
|
|
2524
|
-
let
|
|
2525
|
-
const [,
|
|
3644
|
+
async stream(t, r, n) {
|
|
3645
|
+
const a = Sn();
|
|
3646
|
+
let o;
|
|
3647
|
+
const [, c] = await this.executeMiddleware(
|
|
2526
3648
|
{ target: t, protocol: "websocket", params: {}, role: "client" },
|
|
2527
3649
|
async (d) => {
|
|
2528
|
-
const p = a(this.buildURL(t, d)),
|
|
2529
|
-
p.binaryType =
|
|
2530
|
-
const l = await this.wrapSocket(p,
|
|
2531
|
-
return l instanceof Error ? [
|
|
3650
|
+
const p = a(this.buildURL(t, d)), y = { ...d, params: {} };
|
|
3651
|
+
p.binaryType = oe.MESSAGE_TYPE;
|
|
3652
|
+
const l = await this.wrapSocket(p, r, n);
|
|
3653
|
+
return l instanceof Error ? [y, l] : (o = l, [y, null]);
|
|
2532
3654
|
}
|
|
2533
3655
|
);
|
|
2534
|
-
if (
|
|
2535
|
-
return
|
|
3656
|
+
if (c != null) throw c;
|
|
3657
|
+
return o;
|
|
2536
3658
|
}
|
|
2537
|
-
buildURL(t,
|
|
2538
|
-
const
|
|
3659
|
+
buildURL(t, r) {
|
|
3660
|
+
const n = Br(
|
|
2539
3661
|
{
|
|
2540
|
-
[
|
|
2541
|
-
...
|
|
3662
|
+
[Dt]: this.encoder.contentType,
|
|
3663
|
+
...r.params
|
|
2542
3664
|
},
|
|
2543
|
-
|
|
3665
|
+
xn
|
|
2544
3666
|
);
|
|
2545
|
-
return this.baseUrl.child(t).toString() +
|
|
3667
|
+
return this.baseUrl.child(t).toString() + n;
|
|
2546
3668
|
}
|
|
2547
|
-
async wrapSocket(t,
|
|
3669
|
+
async wrapSocket(t, r, n) {
|
|
2548
3670
|
return await new Promise((a) => {
|
|
2549
3671
|
t.onopen = () => {
|
|
2550
|
-
const
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
}).catch((
|
|
2554
|
-
}, t.onerror = (
|
|
2555
|
-
const
|
|
2556
|
-
a(new Error(
|
|
3672
|
+
const o = new Un(t, this.encoder, r, n);
|
|
3673
|
+
o.receiveOpenAck().then((c) => {
|
|
3674
|
+
c != null ? a(c) : a(o);
|
|
3675
|
+
}).catch((c) => a(c));
|
|
3676
|
+
}, t.onerror = (o) => {
|
|
3677
|
+
const c = o;
|
|
3678
|
+
a(new Error(c.message));
|
|
2557
3679
|
};
|
|
2558
3680
|
});
|
|
2559
3681
|
}
|
|
2560
3682
|
};
|
|
2561
|
-
|
|
2562
|
-
let
|
|
3683
|
+
S(oe, "MESSAGE_TYPE", "arraybuffer");
|
|
3684
|
+
let at = oe;
|
|
2563
3685
|
export {
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
pn as encodeError,
|
|
2572
|
-
ve as errorMatcher,
|
|
2573
|
-
ut as errorZ,
|
|
2574
|
-
Kr as registerError,
|
|
2575
|
-
wn as sendRequired,
|
|
2576
|
-
mn as unaryWithBreaker
|
|
3686
|
+
Z as EOF,
|
|
3687
|
+
Pn as HTTPClient,
|
|
3688
|
+
G as StreamClosed,
|
|
3689
|
+
K as Unreachable,
|
|
3690
|
+
at as WebSocketClient,
|
|
3691
|
+
Fn as sendRequired,
|
|
3692
|
+
jn as unaryWithBreaker
|
|
2577
3693
|
};
|