@edifice.io/aiwiki-node-client 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1109 -1069
- package/dist/index.umd.cjs +11 -11
- package/dist/nats/client.d.ts +22 -3
- package/dist/nats/client.d.ts.map +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var di = Object.defineProperty;
|
|
2
2
|
var bi = (t, e, r) => e in t ? di(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var d = (t, e, r) => (bi(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
+
var pe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5
5
|
function yi(t) {
|
|
6
6
|
if (t.__esModule)
|
|
7
7
|
return t;
|
|
@@ -14,8 +14,8 @@ function yi(t) {
|
|
|
14
14
|
} else
|
|
15
15
|
r = {};
|
|
16
16
|
return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(t).forEach(function(i) {
|
|
17
|
-
var
|
|
18
|
-
Object.defineProperty(r, i,
|
|
17
|
+
var o = Object.getOwnPropertyDescriptor(t, i);
|
|
18
|
+
Object.defineProperty(r, i, o.get ? o : {
|
|
19
19
|
enumerable: !0,
|
|
20
20
|
get: function() {
|
|
21
21
|
return t[i];
|
|
@@ -26,50 +26,50 @@ function yi(t) {
|
|
|
26
26
|
var An = {}, Cn = {}, jt = {}, be = {}, Ue = {};
|
|
27
27
|
(function(t) {
|
|
28
28
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.TD = t.TE = t.Empty = void 0, t.encode = r, t.decode = i, t.Empty = new Uint8Array(0), t.TE = new TextEncoder(), t.TD = new TextDecoder();
|
|
29
|
-
function e(...
|
|
29
|
+
function e(...o) {
|
|
30
30
|
let u = 0;
|
|
31
|
-
for (let P = 0; P <
|
|
32
|
-
u +=
|
|
33
|
-
const
|
|
31
|
+
for (let P = 0; P < o.length; P++)
|
|
32
|
+
u += o[P].length;
|
|
33
|
+
const l = new Uint8Array(u);
|
|
34
34
|
let m = 0;
|
|
35
|
-
for (let P = 0; P <
|
|
36
|
-
|
|
37
|
-
return
|
|
35
|
+
for (let P = 0; P < o.length; P++)
|
|
36
|
+
l.set(o[P], m), m += o[P].length;
|
|
37
|
+
return l;
|
|
38
38
|
}
|
|
39
|
-
function r(...
|
|
39
|
+
function r(...o) {
|
|
40
40
|
const u = [];
|
|
41
|
-
for (let
|
|
42
|
-
u.push(t.TE.encode(
|
|
41
|
+
for (let l = 0; l < o.length; l++)
|
|
42
|
+
u.push(t.TE.encode(o[l]));
|
|
43
43
|
return u.length === 0 ? t.Empty : u.length === 1 ? u[0] : e(...u);
|
|
44
44
|
}
|
|
45
|
-
function i(
|
|
46
|
-
return !
|
|
45
|
+
function i(o) {
|
|
46
|
+
return !o || o.length === 0 ? "" : t.TD.decode(o);
|
|
47
47
|
}
|
|
48
48
|
})(Ue);
|
|
49
49
|
var re = {};
|
|
50
50
|
Object.defineProperty(re, "__esModule", { value: !0 });
|
|
51
51
|
re.errors = re.PermissionViolationError = re.NoRespondersError = re.TimeoutError = re.RequestError = re.ProtocolError = re.ConnectionError = re.DrainingConnectionError = re.ClosedConnectionError = re.AuthorizationError = re.UserAuthenticationExpiredError = re.InvalidOperationError = re.InvalidArgumentError = re.InvalidSubjectError = void 0;
|
|
52
|
-
class
|
|
52
|
+
class Mn extends Error {
|
|
53
53
|
constructor(e, r) {
|
|
54
54
|
super(`illegal subject: '${e}'`, r), this.name = "InvalidSubjectError";
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
re.InvalidSubjectError =
|
|
57
|
+
re.InvalidSubjectError = Mn;
|
|
58
58
|
class tr extends Error {
|
|
59
59
|
constructor(e, r) {
|
|
60
60
|
super(e, r), this.name = "InvalidArgumentError";
|
|
61
61
|
}
|
|
62
62
|
static format(e, r, i) {
|
|
63
|
-
return Array.isArray(r) && r.length > 1 && (r = r[0]), Array.isArray(e) ? (e = e.map((
|
|
63
|
+
return Array.isArray(r) && r.length > 1 && (r = r[0]), Array.isArray(e) ? (e = e.map((o) => `'${o}'`), e = e.join(",")) : e = `'${e}'`, new tr(`${e} ${r}`, i);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
re.InvalidArgumentError = tr;
|
|
67
|
-
class
|
|
67
|
+
class In extends Error {
|
|
68
68
|
constructor(e, r) {
|
|
69
69
|
super(e, r), this.name = "InvalidOperationError";
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
re.InvalidOperationError =
|
|
72
|
+
re.InvalidOperationError = In;
|
|
73
73
|
class rr extends Error {
|
|
74
74
|
constructor(e, r) {
|
|
75
75
|
super(e, r), this.name = "UserAuthenticationExpiredError";
|
|
@@ -89,8 +89,8 @@ class nr extends Error {
|
|
|
89
89
|
"account authentication expired",
|
|
90
90
|
"authentication timeout"
|
|
91
91
|
], i = e.toLowerCase();
|
|
92
|
-
for (let
|
|
93
|
-
if (i.indexOf(r[
|
|
92
|
+
for (let o = 0; o < r.length; o++)
|
|
93
|
+
if (i.indexOf(r[o]) !== -1)
|
|
94
94
|
return new nr(e);
|
|
95
95
|
return null;
|
|
96
96
|
}
|
|
@@ -102,18 +102,18 @@ class jn extends Error {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
re.ClosedConnectionError = jn;
|
|
105
|
-
class
|
|
105
|
+
class Nn extends Error {
|
|
106
106
|
constructor() {
|
|
107
107
|
super("connection draining"), this.name = "DrainingConnectionError";
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
re.DrainingConnectionError =
|
|
111
|
-
class
|
|
110
|
+
re.DrainingConnectionError = Nn;
|
|
111
|
+
class Tn extends Error {
|
|
112
112
|
constructor(e, r) {
|
|
113
113
|
super(e, r), this.name = "ConnectionError";
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
re.ConnectionError =
|
|
116
|
+
re.ConnectionError = Tn;
|
|
117
117
|
class Rn extends Error {
|
|
118
118
|
constructor(e, r) {
|
|
119
119
|
super(e, r), this.name = "ProtocolError";
|
|
@@ -138,40 +138,40 @@ re.TimeoutError = Un;
|
|
|
138
138
|
class kr extends Error {
|
|
139
139
|
constructor(r, i) {
|
|
140
140
|
super(`no responders: '${r}'`, i);
|
|
141
|
-
|
|
141
|
+
d(this, "subject");
|
|
142
142
|
this.subject = r, this.name = "NoResponders";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
re.NoRespondersError = kr;
|
|
146
146
|
class ir extends Error {
|
|
147
|
-
constructor(r, i,
|
|
148
|
-
super(r,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this.name = "PermissionViolationError", this.operation = i, this.subject =
|
|
147
|
+
constructor(r, i, o, u, l) {
|
|
148
|
+
super(r, l);
|
|
149
|
+
d(this, "operation");
|
|
150
|
+
d(this, "subject");
|
|
151
|
+
d(this, "queue");
|
|
152
|
+
this.name = "PermissionViolationError", this.operation = i, this.subject = o, this.queue = u;
|
|
153
153
|
}
|
|
154
154
|
static parse(r) {
|
|
155
155
|
if ((r ? r.toLowerCase() : "").indexOf("permissions violation") === -1)
|
|
156
156
|
return null;
|
|
157
|
-
let
|
|
157
|
+
let o = "publish", u = "", l;
|
|
158
158
|
const m = r.match(/(Publish|Subscription) to "(\S+)"/);
|
|
159
|
-
if (m && (
|
|
159
|
+
if (m && (o = m[1].toLowerCase(), u = m[2], o === "subscription")) {
|
|
160
160
|
const P = r.match(/using queue "(\S+)"/);
|
|
161
|
-
P && (
|
|
161
|
+
P && (l = P[1]);
|
|
162
162
|
}
|
|
163
|
-
return new ir(r,
|
|
163
|
+
return new ir(r, o, u, l);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
re.PermissionViolationError = ir;
|
|
167
167
|
re.errors = {
|
|
168
168
|
AuthorizationError: nr,
|
|
169
169
|
ClosedConnectionError: jn,
|
|
170
|
-
ConnectionError:
|
|
171
|
-
DrainingConnectionError:
|
|
170
|
+
ConnectionError: Tn,
|
|
171
|
+
DrainingConnectionError: Nn,
|
|
172
172
|
InvalidArgumentError: tr,
|
|
173
|
-
InvalidOperationError:
|
|
174
|
-
InvalidSubjectError:
|
|
173
|
+
InvalidOperationError: In,
|
|
174
|
+
InvalidSubjectError: Mn,
|
|
175
175
|
NoRespondersError: kr,
|
|
176
176
|
PermissionViolationError: ir,
|
|
177
177
|
ProtocolError: Rn,
|
|
@@ -185,21 +185,21 @@ be.extend = gi;
|
|
|
185
185
|
be.render = mi;
|
|
186
186
|
be.timeout = vi;
|
|
187
187
|
be.delay = xi;
|
|
188
|
-
be.deadline =
|
|
188
|
+
be.deadline = pi;
|
|
189
189
|
be.deferred = Ur;
|
|
190
|
-
be.debugDeferred =
|
|
190
|
+
be.debugDeferred = Ei;
|
|
191
191
|
be.shuffle = wi;
|
|
192
192
|
be.collect = Pi;
|
|
193
193
|
be.jitter = Ln;
|
|
194
194
|
be.backoff = Ai;
|
|
195
195
|
be.nanos = Ci;
|
|
196
|
-
be.millis =
|
|
196
|
+
be.millis = Mi;
|
|
197
197
|
const _i = Ue, Cr = re;
|
|
198
198
|
function gi(t, ...e) {
|
|
199
199
|
for (let r = 0; r < e.length; r++) {
|
|
200
200
|
const i = e[r];
|
|
201
|
-
Object.keys(i).forEach(function(
|
|
202
|
-
t[
|
|
201
|
+
Object.keys(i).forEach(function(o) {
|
|
202
|
+
t[o] = i[o];
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
return t;
|
|
@@ -209,11 +209,11 @@ function mi(t) {
|
|
|
209
209
|
}
|
|
210
210
|
function vi(t, e = !0) {
|
|
211
211
|
const r = e ? new Cr.TimeoutError() : null;
|
|
212
|
-
let i,
|
|
213
|
-
const u = new Promise((
|
|
212
|
+
let i, o;
|
|
213
|
+
const u = new Promise((l, m) => {
|
|
214
214
|
i = { cancel: () => {
|
|
215
|
-
|
|
216
|
-
} },
|
|
215
|
+
o && clearTimeout(o);
|
|
216
|
+
} }, o = setTimeout(() => {
|
|
217
217
|
m(r === null ? new Cr.TimeoutError() : r);
|
|
218
218
|
}, t);
|
|
219
219
|
});
|
|
@@ -222,16 +222,16 @@ function vi(t, e = !0) {
|
|
|
222
222
|
function xi(t = 0) {
|
|
223
223
|
let e;
|
|
224
224
|
const r = new Promise((i) => {
|
|
225
|
-
const
|
|
225
|
+
const o = setTimeout(() => {
|
|
226
226
|
i();
|
|
227
227
|
}, t);
|
|
228
228
|
e = { cancel: () => {
|
|
229
|
-
|
|
229
|
+
o && (clearTimeout(o), i());
|
|
230
230
|
} };
|
|
231
231
|
});
|
|
232
232
|
return Object.assign(r, e);
|
|
233
233
|
}
|
|
234
|
-
async function
|
|
234
|
+
async function pi(t, e = 1e3) {
|
|
235
235
|
const r = Ur(), i = setTimeout(() => {
|
|
236
236
|
r.reject(new Cr.TimeoutError());
|
|
237
237
|
}, e);
|
|
@@ -248,15 +248,15 @@ function Ur() {
|
|
|
248
248
|
});
|
|
249
249
|
return Object.assign(e, t);
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function Ei() {
|
|
252
252
|
let t = {};
|
|
253
253
|
const e = new Promise((r, i) => {
|
|
254
254
|
t = {
|
|
255
|
-
resolve: (
|
|
256
|
-
console.trace("resolve",
|
|
255
|
+
resolve: (o) => {
|
|
256
|
+
console.trace("resolve", o), r(o);
|
|
257
257
|
},
|
|
258
|
-
reject: (
|
|
259
|
-
console.trace("reject"), i(
|
|
258
|
+
reject: (o) => {
|
|
259
|
+
console.trace("reject"), i(o);
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
262
|
});
|
|
@@ -277,21 +277,21 @@ async function Pi(t) {
|
|
|
277
277
|
}
|
|
278
278
|
class Si {
|
|
279
279
|
constructor() {
|
|
280
|
-
|
|
281
|
-
|
|
280
|
+
d(this, "timers");
|
|
281
|
+
d(this, "measures");
|
|
282
282
|
this.timers = /* @__PURE__ */ new Map(), this.measures = /* @__PURE__ */ new Map();
|
|
283
283
|
}
|
|
284
284
|
mark(e) {
|
|
285
285
|
this.timers.set(e, performance.now());
|
|
286
286
|
}
|
|
287
287
|
measure(e, r, i) {
|
|
288
|
-
const
|
|
289
|
-
if (
|
|
288
|
+
const o = this.timers.get(r);
|
|
289
|
+
if (o === void 0)
|
|
290
290
|
throw new Error(`${r} is not defined`);
|
|
291
291
|
const u = this.timers.get(i);
|
|
292
292
|
if (u === void 0)
|
|
293
293
|
throw new Error(`${i} is not defined`);
|
|
294
|
-
this.measures.set(e, u -
|
|
294
|
+
this.measures.set(e, u - o);
|
|
295
295
|
}
|
|
296
296
|
getEntries() {
|
|
297
297
|
const e = [];
|
|
@@ -306,9 +306,9 @@ class Oi {
|
|
|
306
306
|
* @param max number of concurrent operations
|
|
307
307
|
*/
|
|
308
308
|
constructor(e = 1) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
309
|
+
d(this, "max");
|
|
310
|
+
d(this, "current");
|
|
311
|
+
d(this, "waiting");
|
|
312
312
|
this.max = e, this.current = 0, this.waiting = [];
|
|
313
313
|
}
|
|
314
314
|
/**
|
|
@@ -345,40 +345,40 @@ function Ai(t = [0, 250, 250, 500, 500, 3e3, 5e3]) {
|
|
|
345
345
|
function Ci(t) {
|
|
346
346
|
return t * 1e6;
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function Mi(t) {
|
|
349
349
|
return Math.floor(t / 1e6);
|
|
350
350
|
}
|
|
351
|
-
var je = {}, st = {},
|
|
351
|
+
var je = {}, st = {}, Ie = {}, Nt = {}, yt = {};
|
|
352
352
|
Object.defineProperty(yt, "__esModule", { value: !0 });
|
|
353
353
|
yt.nuid = yt.Nuid = void 0;
|
|
354
|
-
const nn = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
355
|
-
function
|
|
354
|
+
const nn = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", pr = 36, Xt = 12, Ii = 10, sn = 3656158440062976, on = 33, ji = 333, an = Xt + Ii;
|
|
355
|
+
function Ni(t) {
|
|
356
356
|
for (let e = 0; e < t.length; e++)
|
|
357
357
|
t[e] = Math.floor(Math.random() * 255);
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function Ti(t) {
|
|
360
360
|
var e;
|
|
361
|
-
(e = globalThis == null ? void 0 : globalThis.crypto) != null && e.getRandomValues ? globalThis.crypto.getRandomValues(t) :
|
|
361
|
+
(e = globalThis == null ? void 0 : globalThis.crypto) != null && e.getRandomValues ? globalThis.crypto.getRandomValues(t) : Ni(t);
|
|
362
362
|
}
|
|
363
363
|
class Fn {
|
|
364
364
|
constructor() {
|
|
365
365
|
/**
|
|
366
366
|
* @hidden
|
|
367
367
|
*/
|
|
368
|
-
|
|
368
|
+
d(this, "buf");
|
|
369
369
|
/**
|
|
370
370
|
* @hidden
|
|
371
371
|
*/
|
|
372
|
-
|
|
372
|
+
d(this, "seq");
|
|
373
373
|
/**
|
|
374
374
|
* @hidden
|
|
375
375
|
*/
|
|
376
|
-
|
|
376
|
+
d(this, "inc");
|
|
377
377
|
/**
|
|
378
378
|
* @hidden
|
|
379
379
|
*/
|
|
380
|
-
|
|
381
|
-
this.buf = new Uint8Array(
|
|
380
|
+
d(this, "inited");
|
|
381
|
+
this.buf = new Uint8Array(an), this.inited = !1;
|
|
382
382
|
}
|
|
383
383
|
/**
|
|
384
384
|
* Initializes a nuid with a crypto random prefix,
|
|
@@ -395,7 +395,7 @@ class Fn {
|
|
|
395
395
|
* @ignore
|
|
396
396
|
*/
|
|
397
397
|
initSeqAndInc() {
|
|
398
|
-
this.seq = Math.floor(Math.random() * sn), this.inc = Math.floor(Math.random() * (ji -
|
|
398
|
+
this.seq = Math.floor(Math.random() * sn), this.inc = Math.floor(Math.random() * (ji - on) + on);
|
|
399
399
|
}
|
|
400
400
|
/**
|
|
401
401
|
* Sets the prefix from crypto random bytes. Converts them to base36.
|
|
@@ -404,9 +404,9 @@ class Fn {
|
|
|
404
404
|
*/
|
|
405
405
|
setPre() {
|
|
406
406
|
const e = new Uint8Array(Xt);
|
|
407
|
-
|
|
407
|
+
Ti(e);
|
|
408
408
|
for (let r = 0; r < Xt; r++) {
|
|
409
|
-
const i = e[r] %
|
|
409
|
+
const i = e[r] % pr;
|
|
410
410
|
this.buf[r] = nn.charCodeAt(i);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
@@ -416,8 +416,8 @@ class Fn {
|
|
|
416
416
|
*/
|
|
417
417
|
fillSeq() {
|
|
418
418
|
let e = this.seq;
|
|
419
|
-
for (let r =
|
|
420
|
-
this.buf[r] = nn.charCodeAt(e %
|
|
419
|
+
for (let r = an - 1; r >= Xt; r--)
|
|
420
|
+
this.buf[r] = nn.charCodeAt(e % pr), e = Math.floor(e / pr);
|
|
421
421
|
}
|
|
422
422
|
/**
|
|
423
423
|
* Returns the next nuid.
|
|
@@ -444,13 +444,13 @@ yt.nuid = new Fn();
|
|
|
444
444
|
} }), Object.defineProperty(t, "nuid", { enumerable: !0, get: function() {
|
|
445
445
|
return e.nuid;
|
|
446
446
|
} });
|
|
447
|
-
})(
|
|
448
|
-
Object.defineProperty(
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
const Ri =
|
|
453
|
-
|
|
447
|
+
})(Nt);
|
|
448
|
+
Object.defineProperty(Ie, "__esModule", { value: !0 });
|
|
449
|
+
Ie.DEFAULT_HOST = Ie.DEFAULT_PORT = Ie.Match = void 0;
|
|
450
|
+
Ie.syncIterator = Ui;
|
|
451
|
+
Ie.createInbox = Li;
|
|
452
|
+
const Ri = Nt, ki = re;
|
|
453
|
+
Ie.Match = {
|
|
454
454
|
// Exact option is case-sensitive
|
|
455
455
|
Exact: "exact",
|
|
456
456
|
// Case-sensitive, but key is transformed to Canonical MIME representation
|
|
@@ -475,16 +475,16 @@ function Li(t = "") {
|
|
|
475
475
|
throw ki.InvalidArgumentError.format("prefix", `cannot have wildcards ('${t}')`);
|
|
476
476
|
}), `${t}.${Ri.nuid.next()}`;
|
|
477
477
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
var
|
|
481
|
-
Object.defineProperty(
|
|
482
|
-
|
|
478
|
+
Ie.DEFAULT_PORT = 4222;
|
|
479
|
+
Ie.DEFAULT_HOST = "127.0.0.1";
|
|
480
|
+
var ot = {};
|
|
481
|
+
Object.defineProperty(ot, "__esModule", { value: !0 });
|
|
482
|
+
ot.DataBuffer = void 0;
|
|
483
483
|
const cn = Ue;
|
|
484
484
|
class Fi {
|
|
485
485
|
constructor() {
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
d(this, "buffers");
|
|
487
|
+
d(this, "byteLength");
|
|
488
488
|
this.buffers = [], this.byteLength = 0;
|
|
489
489
|
}
|
|
490
490
|
static concat(...e) {
|
|
@@ -492,9 +492,9 @@ class Fi {
|
|
|
492
492
|
for (let u = 0; u < e.length; u++)
|
|
493
493
|
r += e[u].length;
|
|
494
494
|
const i = new Uint8Array(r);
|
|
495
|
-
let
|
|
495
|
+
let o = 0;
|
|
496
496
|
for (let u = 0; u < e.length; u++)
|
|
497
|
-
i.set(e[u],
|
|
497
|
+
i.set(e[u], o), o += e[u].length;
|
|
498
498
|
return i;
|
|
499
499
|
}
|
|
500
500
|
static fromAscii(e) {
|
|
@@ -530,8 +530,8 @@ class Fi {
|
|
|
530
530
|
if (r) {
|
|
531
531
|
const i = this.byteLength;
|
|
532
532
|
(e === void 0 || e > i) && (e = i);
|
|
533
|
-
const
|
|
534
|
-
return i > e && this.buffers.push(r.subarray(e)), this.byteLength = i - e,
|
|
533
|
+
const o = r.subarray(0, e);
|
|
534
|
+
return i > e && this.buffers.push(r.subarray(e)), this.byteLength = i - e, o;
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
return new Uint8Array(0);
|
|
@@ -551,31 +551,31 @@ class Fi {
|
|
|
551
551
|
return this.buffers.length;
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
|
-
|
|
554
|
+
ot.DataBuffer = Fi;
|
|
555
555
|
(function(t) {
|
|
556
|
-
Object.defineProperty(t, "__esModule", { value: !0 }), t.LF = t.CR = t.CRLF = t.CR_LF_LEN = t.CR_LF = void 0, t.setTransportFactory = u, t.defaultPort =
|
|
557
|
-
const e = Ue, r =
|
|
558
|
-
let
|
|
556
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), t.LF = t.CR = t.CRLF = t.CR_LF_LEN = t.CR_LF = void 0, t.setTransportFactory = u, t.defaultPort = l, t.getUrlParseFn = m, t.newTransport = P, t.getResolveFn = g, t.protoLen = E, t.extractProtocolMessage = w;
|
|
557
|
+
const e = Ue, r = Ie, i = ot;
|
|
558
|
+
let o;
|
|
559
559
|
function u(b) {
|
|
560
|
-
|
|
560
|
+
o = b;
|
|
561
561
|
}
|
|
562
|
-
function
|
|
563
|
-
return
|
|
562
|
+
function l() {
|
|
563
|
+
return o !== void 0 && o.defaultPort !== void 0 ? o.defaultPort : r.DEFAULT_PORT;
|
|
564
564
|
}
|
|
565
565
|
function m() {
|
|
566
|
-
return
|
|
566
|
+
return o !== void 0 && o.urlParseFn ? o.urlParseFn : void 0;
|
|
567
567
|
}
|
|
568
568
|
function P() {
|
|
569
|
-
if (!
|
|
569
|
+
if (!o || typeof o.factory != "function")
|
|
570
570
|
throw new Error("transport fn is not set");
|
|
571
|
-
return
|
|
571
|
+
return o.factory();
|
|
572
572
|
}
|
|
573
573
|
function g() {
|
|
574
|
-
return
|
|
574
|
+
return o !== void 0 && o.dnsResolveFn ? o.dnsResolveFn : void 0;
|
|
575
575
|
}
|
|
576
576
|
t.CR_LF = `\r
|
|
577
577
|
`, t.CR_LF_LEN = t.CR_LF.length, t.CRLF = i.DataBuffer.fromAscii(t.CR_LF), t.CR = new Uint8Array(t.CRLF)[0], t.LF = new Uint8Array(t.CRLF)[1];
|
|
578
|
-
function
|
|
578
|
+
function E(b) {
|
|
579
579
|
for (let x = 0; x < b.length; x++) {
|
|
580
580
|
const R = x + 1;
|
|
581
581
|
if (b.byteLength > R && b[x] === t.CR && b[R] === t.LF)
|
|
@@ -584,7 +584,7 @@ at.DataBuffer = Fi;
|
|
|
584
584
|
return 0;
|
|
585
585
|
}
|
|
586
586
|
function w(b) {
|
|
587
|
-
const x =
|
|
587
|
+
const x = E(b);
|
|
588
588
|
if (x > 0) {
|
|
589
589
|
const j = new Uint8Array(b).slice(0, x);
|
|
590
590
|
return e.TD.decode(j);
|
|
@@ -597,12 +597,12 @@ Object.defineProperty(gt, "__esModule", { value: !0 });
|
|
|
597
597
|
gt.ipV4 = Bn;
|
|
598
598
|
gt.isIP = Di;
|
|
599
599
|
gt.parseIP = Dn;
|
|
600
|
-
const
|
|
600
|
+
const It = 4, nt = 16, Qt = 48, Kn = 57, fn = 65, Ki = 70, un = 97, Bi = 102, Mr = 16777215;
|
|
601
601
|
function Bn(t, e, r, i) {
|
|
602
|
-
const
|
|
603
|
-
return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255].forEach((
|
|
604
|
-
|
|
605
|
-
}),
|
|
602
|
+
const o = new Uint8Array(nt);
|
|
603
|
+
return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255].forEach((l, m) => {
|
|
604
|
+
o[m] = l;
|
|
605
|
+
}), o[12] = t, o[13] = e, o[14] = r, o[15] = i, o;
|
|
606
606
|
}
|
|
607
607
|
function Di(t) {
|
|
608
608
|
return Dn(t) !== void 0;
|
|
@@ -617,8 +617,8 @@ function Dn(t) {
|
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
function $n(t) {
|
|
620
|
-
const e = new Uint8Array(
|
|
621
|
-
for (let r = 0; r <
|
|
620
|
+
const e = new Uint8Array(It);
|
|
621
|
+
for (let r = 0; r < It; r++) {
|
|
622
622
|
if (t.length === 0)
|
|
623
623
|
return;
|
|
624
624
|
if (r > 0) {
|
|
@@ -626,10 +626,10 @@ function $n(t) {
|
|
|
626
626
|
return;
|
|
627
627
|
t = t.substring(1);
|
|
628
628
|
}
|
|
629
|
-
const { n: i, c:
|
|
629
|
+
const { n: i, c: o, ok: u } = qi(t);
|
|
630
630
|
if (!u || i > 255)
|
|
631
631
|
return;
|
|
632
|
-
t = t.substring(
|
|
632
|
+
t = t.substring(o), e[r] = i;
|
|
633
633
|
}
|
|
634
634
|
return Bn(e[0], e[1], e[2], e[3]);
|
|
635
635
|
}
|
|
@@ -640,19 +640,19 @@ function $i(t) {
|
|
|
640
640
|
return e;
|
|
641
641
|
let i = 0;
|
|
642
642
|
for (; i < nt; ) {
|
|
643
|
-
const { n:
|
|
644
|
-
if (!
|
|
643
|
+
const { n: o, c: u, ok: l } = zi(t);
|
|
644
|
+
if (!l || o > 65535)
|
|
645
645
|
return;
|
|
646
646
|
if (u < t.length && t[u] === ".") {
|
|
647
|
-
if (r < 0 && i != nt -
|
|
647
|
+
if (r < 0 && i != nt - It || i + It > nt)
|
|
648
648
|
return;
|
|
649
649
|
const m = $n(t);
|
|
650
650
|
if (m === void 0)
|
|
651
651
|
return;
|
|
652
|
-
e[i] = m[12], e[i + 1] = m[13], e[i + 2] = m[14], e[i + 3] = m[15], t = "", i +=
|
|
652
|
+
e[i] = m[12], e[i + 1] = m[13], e[i + 2] = m[14], e[i + 3] = m[15], t = "", i += It;
|
|
653
653
|
break;
|
|
654
654
|
}
|
|
655
|
-
if (e[i] =
|
|
655
|
+
if (e[i] = o >> 8, e[i + 1] = o, i += 2, t = t.substring(u), t.length === 0)
|
|
656
656
|
break;
|
|
657
657
|
if (t[0] !== ":" || t.length == 1)
|
|
658
658
|
return;
|
|
@@ -667,10 +667,10 @@ function $i(t) {
|
|
|
667
667
|
if (i < nt) {
|
|
668
668
|
if (r < 0)
|
|
669
669
|
return;
|
|
670
|
-
const
|
|
670
|
+
const o = nt - i;
|
|
671
671
|
for (let u = i - 1; u >= r; u--)
|
|
672
|
-
e[u +
|
|
673
|
-
for (let u = r +
|
|
672
|
+
e[u + o] = e[u];
|
|
673
|
+
for (let u = r + o - 1; u >= r; u--)
|
|
674
674
|
e[u] = 0;
|
|
675
675
|
} else if (r >= 0)
|
|
676
676
|
return;
|
|
@@ -680,8 +680,8 @@ function $i(t) {
|
|
|
680
680
|
function qi(t) {
|
|
681
681
|
let e = 0, r = 0;
|
|
682
682
|
for (e = 0; e < t.length && Qt <= t.charCodeAt(e) && t.charCodeAt(e) <= Kn; e++)
|
|
683
|
-
if (r = r * 10 + (t.charCodeAt(e) - Qt), r >=
|
|
684
|
-
return { n:
|
|
683
|
+
if (r = r * 10 + (t.charCodeAt(e) - Qt), r >= Mr)
|
|
684
|
+
return { n: Mr, c: e, ok: !1 };
|
|
685
685
|
return e === 0 ? { n: 0, c: 0, ok: !1 } : { n: r, c: e, ok: !0 };
|
|
686
686
|
}
|
|
687
687
|
function zi(t) {
|
|
@@ -695,7 +695,7 @@ function zi(t) {
|
|
|
695
695
|
e *= 16, e += t.charCodeAt(r) - fn + 10;
|
|
696
696
|
else
|
|
697
697
|
break;
|
|
698
|
-
if (e >=
|
|
698
|
+
if (e >= Mr)
|
|
699
699
|
return { n: 0, c: r, ok: !1 };
|
|
700
700
|
}
|
|
701
701
|
return r === 0 ? { n: 0, c: r, ok: !1 } : { n: e, c: r, ok: !0 };
|
|
@@ -704,7 +704,7 @@ Object.defineProperty(We, "__esModule", { value: !0 });
|
|
|
704
704
|
We.Servers = We.ServerImpl = void 0;
|
|
705
705
|
We.isIPV4OrHostname = Gn;
|
|
706
706
|
We.hostPort = Hn;
|
|
707
|
-
const Yt = st, qn = be,
|
|
707
|
+
const Yt = st, qn = be, Ir = gt, zn = Ie;
|
|
708
708
|
function Gn(t) {
|
|
709
709
|
return t.indexOf("[") !== -1 || t.indexOf("::") !== -1 ? !1 : t.indexOf(".") !== -1 || t.split(":").length <= 2;
|
|
710
710
|
}
|
|
@@ -721,23 +721,23 @@ function Gi(t) {
|
|
|
721
721
|
}
|
|
722
722
|
function Hn(t) {
|
|
723
723
|
t = t.trim(), t.match(/^(.*:\/\/)(.*)/m) && (t = t.replace(/^(.*:\/\/)(.*)/gm, "$2")), t = Gi(t), jr(t) && t.indexOf("[") === -1 && (t = `[${t}]`);
|
|
724
|
-
const e = jr(t) ? t.match(/(]:)(\d+)/) : t.match(/(:)(\d+)/), r = e && e.length === 3 && e[1] && e[2] ? parseInt(e[2]) : zn.DEFAULT_PORT, i = r === 80 ? "https" : "http",
|
|
725
|
-
|
|
726
|
-
let u =
|
|
727
|
-
return u.charAt(0) === "[" && (u = u.substring(1, u.length - 1)), { listen:
|
|
724
|
+
const e = jr(t) ? t.match(/(]:)(\d+)/) : t.match(/(:)(\d+)/), r = e && e.length === 3 && e[1] && e[2] ? parseInt(e[2]) : zn.DEFAULT_PORT, i = r === 80 ? "https" : "http", o = new URL(`${i}://${t}`);
|
|
725
|
+
o.port = `${r}`;
|
|
726
|
+
let u = o.hostname;
|
|
727
|
+
return u.charAt(0) === "[" && (u = u.substring(1, u.length - 1)), { listen: o.host, hostname: u, port: r };
|
|
728
728
|
}
|
|
729
729
|
class dt {
|
|
730
730
|
constructor(e, r = !1) {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
731
|
+
d(this, "src");
|
|
732
|
+
d(this, "listen");
|
|
733
|
+
d(this, "hostname");
|
|
734
|
+
d(this, "port");
|
|
735
|
+
d(this, "didConnect");
|
|
736
|
+
d(this, "reconnects");
|
|
737
|
+
d(this, "lastConnect");
|
|
738
|
+
d(this, "gossiped");
|
|
739
|
+
d(this, "tlsName");
|
|
740
|
+
d(this, "resolves");
|
|
741
741
|
this.src = e, this.tlsName = "";
|
|
742
742
|
const i = Hn(e);
|
|
743
743
|
this.listen = i.listen, this.hostname = i.hostname, this.port = i.port, this.didConnect = !1, this.reconnects = 0, this.lastConnect = 0, this.gossiped = r;
|
|
@@ -749,15 +749,15 @@ class dt {
|
|
|
749
749
|
if (!e.fn || e.resolve === !1)
|
|
750
750
|
return [this];
|
|
751
751
|
const r = [];
|
|
752
|
-
if ((0,
|
|
752
|
+
if ((0, Ir.isIP)(this.hostname))
|
|
753
753
|
return [this];
|
|
754
754
|
{
|
|
755
755
|
const i = await e.fn(this.hostname);
|
|
756
756
|
e.debug && console.log(`resolve ${this.hostname} = ${i.join(",")}`);
|
|
757
|
-
for (const
|
|
758
|
-
const u = this.port === 80 ? "https" : "http",
|
|
759
|
-
|
|
760
|
-
const m = new dt(
|
|
757
|
+
for (const o of i) {
|
|
758
|
+
const u = this.port === 80 ? "https" : "http", l = new URL(`${u}://${jr(o) ? "[" + o + "]" : o}`);
|
|
759
|
+
l.port = `${this.port}`;
|
|
760
|
+
const m = new dt(l.host, !1);
|
|
761
761
|
m.tlsName = this.hostname, r.push(m);
|
|
762
762
|
}
|
|
763
763
|
}
|
|
@@ -767,15 +767,15 @@ class dt {
|
|
|
767
767
|
We.ServerImpl = dt;
|
|
768
768
|
class Hi {
|
|
769
769
|
constructor(e = [], r = {}) {
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
770
|
+
d(this, "firstSelect");
|
|
771
|
+
d(this, "servers");
|
|
772
|
+
d(this, "currentServer");
|
|
773
|
+
d(this, "tlsName");
|
|
774
|
+
d(this, "randomize");
|
|
775
775
|
this.firstSelect = !0, this.servers = [], this.tlsName = "", this.randomize = r.randomize || !1;
|
|
776
776
|
const i = (0, Yt.getUrlParseFn)();
|
|
777
|
-
e && (e.forEach((
|
|
778
|
-
|
|
777
|
+
e && (e.forEach((o) => {
|
|
778
|
+
o = i ? i(o) : o, this.servers.push(new dt(o));
|
|
779
779
|
}), this.randomize && (this.servers = (0, qn.shuffle)(this.servers))), this.servers.length === 0 && this.addServer(`${zn.DEFAULT_HOST}:${(0, Yt.defaultPort)()}`, !1), this.currentServer = this.servers[0];
|
|
780
780
|
}
|
|
781
781
|
clear() {
|
|
@@ -783,7 +783,7 @@ class Hi {
|
|
|
783
783
|
}
|
|
784
784
|
updateTLSName() {
|
|
785
785
|
const e = this.getCurrentServer();
|
|
786
|
-
(0,
|
|
786
|
+
(0, Ir.isIP)(e.hostname) || (this.tlsName = e.hostname, this.servers.forEach((r) => {
|
|
787
787
|
r.gossiped && (r.tlsName = this.tlsName);
|
|
788
788
|
}));
|
|
789
789
|
}
|
|
@@ -793,8 +793,8 @@ class Hi {
|
|
|
793
793
|
addServer(e, r = !1) {
|
|
794
794
|
const i = (0, Yt.getUrlParseFn)();
|
|
795
795
|
e = i ? i(e) : e;
|
|
796
|
-
const
|
|
797
|
-
(0,
|
|
796
|
+
const o = new dt(e, r);
|
|
797
|
+
(0, Ir.isIP)(o.hostname) && (o.tlsName = this.tlsName), this.servers.push(o);
|
|
798
798
|
}
|
|
799
799
|
selectServer() {
|
|
800
800
|
if (this.firstSelect)
|
|
@@ -822,52 +822,52 @@ class Hi {
|
|
|
822
822
|
}
|
|
823
823
|
update(e, r) {
|
|
824
824
|
const i = [];
|
|
825
|
-
let
|
|
826
|
-
const u = (0, Yt.getUrlParseFn)(),
|
|
825
|
+
let o = [];
|
|
826
|
+
const u = (0, Yt.getUrlParseFn)(), l = /* @__PURE__ */ new Map();
|
|
827
827
|
e.connect_urls && e.connect_urls.length > 0 && e.connect_urls.forEach((P) => {
|
|
828
828
|
P = u ? u(P, r) : P;
|
|
829
829
|
const g = new dt(P, !0);
|
|
830
|
-
|
|
830
|
+
l.set(P, g);
|
|
831
831
|
});
|
|
832
832
|
const m = [];
|
|
833
833
|
return this.servers.forEach((P, g) => {
|
|
834
|
-
const
|
|
835
|
-
P.gossiped && this.currentServer.listen !==
|
|
834
|
+
const E = P.listen;
|
|
835
|
+
P.gossiped && this.currentServer.listen !== E && l.get(E) === void 0 && m.push(g), l.delete(E);
|
|
836
836
|
}), m.reverse(), m.forEach((P) => {
|
|
837
837
|
const g = this.servers.splice(P, 1);
|
|
838
|
-
|
|
839
|
-
}),
|
|
838
|
+
o = o.concat(g[0].listen);
|
|
839
|
+
}), l.forEach((P, g) => {
|
|
840
840
|
this.servers.push(P), i.push(g);
|
|
841
|
-
}), { added: i, deleted:
|
|
841
|
+
}), { added: i, deleted: o };
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
844
|
We.Servers = Hi;
|
|
845
845
|
var mt = {};
|
|
846
846
|
Object.defineProperty(mt, "__esModule", { value: !0 });
|
|
847
847
|
mt.QueuedIteratorImpl = void 0;
|
|
848
|
-
const
|
|
849
|
-
class
|
|
848
|
+
const Er = be, hn = re;
|
|
849
|
+
class Ji {
|
|
850
850
|
constructor() {
|
|
851
|
-
|
|
852
|
-
|
|
851
|
+
d(this, "inflight");
|
|
852
|
+
d(this, "processed");
|
|
853
853
|
// this is updated by the protocol
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
854
|
+
d(this, "received");
|
|
855
|
+
d(this, "noIterator");
|
|
856
|
+
d(this, "iterClosed");
|
|
857
|
+
d(this, "done");
|
|
858
|
+
d(this, "signal");
|
|
859
|
+
d(this, "yields");
|
|
860
|
+
d(this, "filtered");
|
|
861
|
+
d(this, "pendingFiltered");
|
|
862
|
+
d(this, "ctx");
|
|
863
|
+
d(this, "_data");
|
|
864
864
|
//data is for use by extenders in any way they like
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
this.inflight = 0, this.filtered = 0, this.pendingFiltered = 0, this.processed = 0, this.received = 0, this.noIterator = !1, this.done = !1, this.signal = (0,
|
|
865
|
+
d(this, "err");
|
|
866
|
+
d(this, "time");
|
|
867
|
+
d(this, "profile");
|
|
868
|
+
d(this, "yielding");
|
|
869
|
+
d(this, "didBreak");
|
|
870
|
+
this.inflight = 0, this.filtered = 0, this.pendingFiltered = 0, this.processed = 0, this.received = 0, this.noIterator = !1, this.done = !1, this.signal = (0, Er.deferred)(), this.yields = [], this.iterClosed = (0, Er.deferred)(), this.time = 0, this.yielding = !1, this.didBreak = !1, this.profile = !1;
|
|
871
871
|
}
|
|
872
872
|
[Symbol.asyncIterator]() {
|
|
873
873
|
return this.iterate();
|
|
@@ -902,9 +902,9 @@ class Vi {
|
|
|
902
902
|
for (let r = 0; r < e.length; r++) {
|
|
903
903
|
if (typeof e[r] == "function") {
|
|
904
904
|
this.pendingFiltered--;
|
|
905
|
-
const
|
|
905
|
+
const o = e[r];
|
|
906
906
|
try {
|
|
907
|
-
|
|
907
|
+
o();
|
|
908
908
|
} catch (u) {
|
|
909
909
|
throw u;
|
|
910
910
|
}
|
|
@@ -918,7 +918,7 @@ class Vi {
|
|
|
918
918
|
}
|
|
919
919
|
if (this.done)
|
|
920
920
|
break;
|
|
921
|
-
this.yields.length === 0 && (e.length = 0, this.yields = e, this.signal = (0,
|
|
921
|
+
this.yields.length === 0 && (e.length = 0, this.yields = e, this.signal = (0, Er.deferred)());
|
|
922
922
|
}
|
|
923
923
|
} finally {
|
|
924
924
|
this.didBreak = !0, this.stop();
|
|
@@ -937,22 +937,22 @@ class Vi {
|
|
|
937
937
|
return this.received - this.filtered;
|
|
938
938
|
}
|
|
939
939
|
}
|
|
940
|
-
mt.QueuedIteratorImpl =
|
|
941
|
-
var
|
|
942
|
-
Object.defineProperty(
|
|
943
|
-
|
|
944
|
-
const
|
|
940
|
+
mt.QueuedIteratorImpl = Ji;
|
|
941
|
+
var Tt = {};
|
|
942
|
+
Object.defineProperty(Tt, "__esModule", { value: !0 });
|
|
943
|
+
Tt.MuxSubscription = void 0;
|
|
944
|
+
const Vi = Ie, ln = re;
|
|
945
945
|
class Yi {
|
|
946
946
|
constructor() {
|
|
947
|
-
|
|
948
|
-
|
|
947
|
+
d(this, "baseInbox");
|
|
948
|
+
d(this, "reqs");
|
|
949
949
|
this.reqs = /* @__PURE__ */ new Map();
|
|
950
950
|
}
|
|
951
951
|
size() {
|
|
952
952
|
return this.reqs.size;
|
|
953
953
|
}
|
|
954
954
|
init(e) {
|
|
955
|
-
return this.baseInbox = `${(0,
|
|
955
|
+
return this.baseInbox = `${(0, Vi.createInbox)(e)}.`, this.baseInbox;
|
|
956
956
|
}
|
|
957
957
|
add(e) {
|
|
958
958
|
isNaN(e.received) || (e.received = 0), this.reqs.set(e.token, e);
|
|
@@ -976,7 +976,7 @@ class Yi {
|
|
|
976
976
|
i.resolver(r, {});
|
|
977
977
|
}), !0;
|
|
978
978
|
if (r.operation === "publish") {
|
|
979
|
-
const i = this.all().find((
|
|
979
|
+
const i = this.all().find((o) => o.requestSubject === r.subject);
|
|
980
980
|
if (i)
|
|
981
981
|
return i.resolver(r, {}), !0;
|
|
982
982
|
}
|
|
@@ -984,11 +984,11 @@ class Yi {
|
|
|
984
984
|
}
|
|
985
985
|
dispatcher() {
|
|
986
986
|
return (e, r) => {
|
|
987
|
-
var
|
|
987
|
+
var o, u;
|
|
988
988
|
const i = this.getToken(r);
|
|
989
989
|
if (i) {
|
|
990
|
-
const
|
|
991
|
-
|
|
990
|
+
const l = this.get(i);
|
|
991
|
+
l && (e === null && (e = ((o = r == null ? void 0 : r.data) == null ? void 0 : o.length) === 0 && ((u = r.headers) == null ? void 0 : u.code) === 503 ? new ln.NoRespondersError(l.requestSubject) : null), l.resolver(e, r));
|
|
992
992
|
}
|
|
993
993
|
};
|
|
994
994
|
}
|
|
@@ -999,18 +999,18 @@ class Yi {
|
|
|
999
999
|
});
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
|
|
1002
|
+
Tt.MuxSubscription = Yi;
|
|
1003
1003
|
var Rt = {};
|
|
1004
1004
|
Object.defineProperty(Rt, "__esModule", { value: !0 });
|
|
1005
1005
|
Rt.Heartbeat = void 0;
|
|
1006
1006
|
const Wi = be;
|
|
1007
1007
|
class Xi {
|
|
1008
1008
|
constructor(e, r, i) {
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1009
|
+
d(this, "ph");
|
|
1010
|
+
d(this, "interval");
|
|
1011
|
+
d(this, "maxOut");
|
|
1012
|
+
d(this, "timer");
|
|
1013
|
+
d(this, "pendings");
|
|
1014
1014
|
this.ph = e, this.interval = r, this.maxOut = i, this.pendings = [];
|
|
1015
1015
|
}
|
|
1016
1016
|
// api to start the heartbeats, since this can be
|
|
@@ -1045,7 +1045,7 @@ class Xi {
|
|
|
1045
1045
|
Rt.Heartbeat = Xi;
|
|
1046
1046
|
var Lr = {}, Fr = {};
|
|
1047
1047
|
(function(t) {
|
|
1048
|
-
Object.defineProperty(t, "__esModule", { value: !0 }), t.DenoBuffer = t.MAX_SIZE = t.AssertionError = void 0, t.assert = i, t.concat =
|
|
1048
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), t.DenoBuffer = t.MAX_SIZE = t.AssertionError = void 0, t.assert = i, t.concat = l, t.append = m, t.readAll = g, t.writeAll = E;
|
|
1049
1049
|
const e = Ue;
|
|
1050
1050
|
class r extends Error {
|
|
1051
1051
|
constructor(b) {
|
|
@@ -1057,13 +1057,13 @@ var Lr = {}, Fr = {};
|
|
|
1057
1057
|
if (!w)
|
|
1058
1058
|
throw new r(b);
|
|
1059
1059
|
}
|
|
1060
|
-
const
|
|
1060
|
+
const o = 32 * 1024;
|
|
1061
1061
|
t.MAX_SIZE = 2 ** 32 - 2;
|
|
1062
1062
|
function u(w, b, x = 0) {
|
|
1063
1063
|
const R = b.byteLength - x;
|
|
1064
1064
|
return w.byteLength > R && (w = w.subarray(0, R)), b.set(w, x), w.byteLength;
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1066
|
+
function l(w, b) {
|
|
1067
1067
|
if (w === void 0 && b === void 0)
|
|
1068
1068
|
return new Uint8Array(0);
|
|
1069
1069
|
if (w === void 0)
|
|
@@ -1074,14 +1074,14 @@ var Lr = {}, Fr = {};
|
|
|
1074
1074
|
return x.set(w, 0), x.set(b, w.length), x;
|
|
1075
1075
|
}
|
|
1076
1076
|
function m(w, b) {
|
|
1077
|
-
return
|
|
1077
|
+
return l(w, Uint8Array.of(b));
|
|
1078
1078
|
}
|
|
1079
1079
|
class P {
|
|
1080
1080
|
// read at _buf[off], write at _buf[_buf.byteLength]
|
|
1081
1081
|
constructor(b) {
|
|
1082
|
-
|
|
1082
|
+
d(this, "_buf");
|
|
1083
1083
|
// contents are the bytes _buf[off : len(_buf)]
|
|
1084
|
-
|
|
1084
|
+
d(this, "_off");
|
|
1085
1085
|
if (this._off = 0, b == null) {
|
|
1086
1086
|
this._buf = new Uint8Array(0);
|
|
1087
1087
|
return;
|
|
@@ -1166,9 +1166,9 @@ var Lr = {}, Fr = {};
|
|
|
1166
1166
|
}
|
|
1167
1167
|
readFrom(b) {
|
|
1168
1168
|
let x = 0;
|
|
1169
|
-
const R = new Uint8Array(
|
|
1169
|
+
const R = new Uint8Array(o);
|
|
1170
1170
|
for (; ; ) {
|
|
1171
|
-
const j = this.capacity - this.length <
|
|
1171
|
+
const j = this.capacity - this.length < o, U = j ? R : new Uint8Array(this._buf.buffer, this.length), ie = b.read(U);
|
|
1172
1172
|
if (ie === null)
|
|
1173
1173
|
return x;
|
|
1174
1174
|
j ? this.write(U.subarray(0, ie)) : this._reslice(this.length + ie), x += ie;
|
|
@@ -1180,7 +1180,7 @@ var Lr = {}, Fr = {};
|
|
|
1180
1180
|
const b = new P();
|
|
1181
1181
|
return b.readFrom(w), b.bytes();
|
|
1182
1182
|
}
|
|
1183
|
-
function
|
|
1183
|
+
function E(w, b) {
|
|
1184
1184
|
let x = 0;
|
|
1185
1185
|
for (; x < b.length; )
|
|
1186
1186
|
x += w.write(b.subarray(x));
|
|
@@ -1198,7 +1198,7 @@ var Lr = {}, Fr = {};
|
|
|
1198
1198
|
PONG: 5
|
|
1199
1199
|
};
|
|
1200
1200
|
function i(P) {
|
|
1201
|
-
let g,
|
|
1201
|
+
let g, E = "";
|
|
1202
1202
|
switch (P.kind) {
|
|
1203
1203
|
case t.Kind.MSG:
|
|
1204
1204
|
g = "MSG";
|
|
@@ -1207,7 +1207,7 @@ var Lr = {}, Fr = {};
|
|
|
1207
1207
|
g = "OK";
|
|
1208
1208
|
break;
|
|
1209
1209
|
case t.Kind.ERR:
|
|
1210
|
-
g = "ERR",
|
|
1210
|
+
g = "ERR", E = r.TD.decode(P.data);
|
|
1211
1211
|
break;
|
|
1212
1212
|
case t.Kind.PING:
|
|
1213
1213
|
g = "PING";
|
|
@@ -1216,41 +1216,41 @@ var Lr = {}, Fr = {};
|
|
|
1216
1216
|
g = "PONG";
|
|
1217
1217
|
break;
|
|
1218
1218
|
case t.Kind.INFO:
|
|
1219
|
-
g = "INFO",
|
|
1219
|
+
g = "INFO", E = r.TD.decode(P.data);
|
|
1220
1220
|
}
|
|
1221
|
-
return `${g}: ${
|
|
1221
|
+
return `${g}: ${E}`;
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1223
|
+
function o() {
|
|
1224
1224
|
const P = {};
|
|
1225
1225
|
return P.sid = -1, P.hdr = -1, P.size = -1, P;
|
|
1226
1226
|
}
|
|
1227
|
-
const u = 48,
|
|
1227
|
+
const u = 48, l = 57;
|
|
1228
1228
|
class m {
|
|
1229
1229
|
constructor(g) {
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1230
|
+
d(this, "dispatcher");
|
|
1231
|
+
d(this, "state");
|
|
1232
|
+
d(this, "as");
|
|
1233
|
+
d(this, "drop");
|
|
1234
|
+
d(this, "hdr");
|
|
1235
|
+
d(this, "ma");
|
|
1236
|
+
d(this, "argBuf");
|
|
1237
|
+
d(this, "msgBuf");
|
|
1238
1238
|
this.dispatcher = g, this.state = t.State.OP_START, this.as = 0, this.drop = 0, this.hdr = 0;
|
|
1239
1239
|
}
|
|
1240
1240
|
parse(g) {
|
|
1241
|
-
let
|
|
1242
|
-
for (
|
|
1243
|
-
const w = g[
|
|
1241
|
+
let E;
|
|
1242
|
+
for (E = 0; E < g.length; E++) {
|
|
1243
|
+
const w = g[E];
|
|
1244
1244
|
switch (this.state) {
|
|
1245
1245
|
case t.State.OP_START:
|
|
1246
1246
|
switch (w) {
|
|
1247
1247
|
case t.cc.M:
|
|
1248
1248
|
case t.cc.m:
|
|
1249
|
-
this.state = t.State.OP_M, this.hdr = -1, this.ma =
|
|
1249
|
+
this.state = t.State.OP_M, this.hdr = -1, this.ma = o();
|
|
1250
1250
|
break;
|
|
1251
1251
|
case t.cc.H:
|
|
1252
1252
|
case t.cc.h:
|
|
1253
|
-
this.state = t.State.OP_H, this.hdr = 0, this.ma =
|
|
1253
|
+
this.state = t.State.OP_H, this.hdr = 0, this.ma = o();
|
|
1254
1254
|
break;
|
|
1255
1255
|
case t.cc.P:
|
|
1256
1256
|
case t.cc.p:
|
|
@@ -1267,7 +1267,7 @@ var Lr = {}, Fr = {};
|
|
|
1267
1267
|
this.state = t.State.OP_I;
|
|
1268
1268
|
break;
|
|
1269
1269
|
default:
|
|
1270
|
-
throw this.fail(g.subarray(
|
|
1270
|
+
throw this.fail(g.subarray(E));
|
|
1271
1271
|
}
|
|
1272
1272
|
break;
|
|
1273
1273
|
case t.State.OP_H:
|
|
@@ -1277,7 +1277,7 @@ var Lr = {}, Fr = {};
|
|
|
1277
1277
|
this.state = t.State.OP_M;
|
|
1278
1278
|
break;
|
|
1279
1279
|
default:
|
|
1280
|
-
throw this.fail(g.subarray(
|
|
1280
|
+
throw this.fail(g.subarray(E));
|
|
1281
1281
|
}
|
|
1282
1282
|
break;
|
|
1283
1283
|
case t.State.OP_M:
|
|
@@ -1287,7 +1287,7 @@ var Lr = {}, Fr = {};
|
|
|
1287
1287
|
this.state = t.State.OP_MS;
|
|
1288
1288
|
break;
|
|
1289
1289
|
default:
|
|
1290
|
-
throw this.fail(g.subarray(
|
|
1290
|
+
throw this.fail(g.subarray(E));
|
|
1291
1291
|
}
|
|
1292
1292
|
break;
|
|
1293
1293
|
case t.State.OP_MS:
|
|
@@ -1297,7 +1297,7 @@ var Lr = {}, Fr = {};
|
|
|
1297
1297
|
this.state = t.State.OP_MSG;
|
|
1298
1298
|
break;
|
|
1299
1299
|
default:
|
|
1300
|
-
throw this.fail(g.subarray(
|
|
1300
|
+
throw this.fail(g.subarray(E));
|
|
1301
1301
|
}
|
|
1302
1302
|
break;
|
|
1303
1303
|
case t.State.OP_MSG:
|
|
@@ -1307,7 +1307,7 @@ var Lr = {}, Fr = {};
|
|
|
1307
1307
|
this.state = t.State.OP_MSG_SPC;
|
|
1308
1308
|
break;
|
|
1309
1309
|
default:
|
|
1310
|
-
throw this.fail(g.subarray(
|
|
1310
|
+
throw this.fail(g.subarray(E));
|
|
1311
1311
|
}
|
|
1312
1312
|
break;
|
|
1313
1313
|
case t.State.OP_MSG_SPC:
|
|
@@ -1316,7 +1316,7 @@ var Lr = {}, Fr = {};
|
|
|
1316
1316
|
case t.cc.TAB:
|
|
1317
1317
|
continue;
|
|
1318
1318
|
default:
|
|
1319
|
-
this.state = t.State.MSG_ARG, this.as =
|
|
1319
|
+
this.state = t.State.MSG_ARG, this.as = E;
|
|
1320
1320
|
}
|
|
1321
1321
|
break;
|
|
1322
1322
|
case t.State.MSG_ARG:
|
|
@@ -1325,8 +1325,8 @@ var Lr = {}, Fr = {};
|
|
|
1325
1325
|
this.drop = 1;
|
|
1326
1326
|
break;
|
|
1327
1327
|
case t.cc.NL: {
|
|
1328
|
-
const b = this.argBuf ? this.argBuf.bytes() : g.subarray(this.as,
|
|
1329
|
-
this.processMsgArgs(b), this.drop = 0, this.as =
|
|
1328
|
+
const b = this.argBuf ? this.argBuf.bytes() : g.subarray(this.as, E - this.drop);
|
|
1329
|
+
this.processMsgArgs(b), this.drop = 0, this.as = E + 1, this.state = t.State.MSG_PAYLOAD, E = this.as + this.ma.size - 1;
|
|
1330
1330
|
break;
|
|
1331
1331
|
}
|
|
1332
1332
|
default:
|
|
@@ -1340,16 +1340,16 @@ var Lr = {}, Fr = {};
|
|
|
1340
1340
|
this.dispatcher.push({ kind: t.Kind.MSG, msg: this.ma, data: b }), this.argBuf = void 0, this.msgBuf = void 0, this.state = t.State.MSG_END;
|
|
1341
1341
|
} else {
|
|
1342
1342
|
let b = this.ma.size - this.msgBuf.length;
|
|
1343
|
-
const x = g.length -
|
|
1344
|
-
x < b && (b = x), b > 0 ? (this.msgBuf.write(g.subarray(
|
|
1343
|
+
const x = g.length - E;
|
|
1344
|
+
x < b && (b = x), b > 0 ? (this.msgBuf.write(g.subarray(E, E + b)), E = E + b - 1) : this.msgBuf.writeByte(w);
|
|
1345
1345
|
}
|
|
1346
1346
|
else
|
|
1347
|
-
|
|
1347
|
+
E - this.as >= this.ma.size && (this.dispatcher.push({ kind: t.Kind.MSG, msg: this.ma, data: g.subarray(this.as, E) }), this.argBuf = void 0, this.msgBuf = void 0, this.state = t.State.MSG_END);
|
|
1348
1348
|
break;
|
|
1349
1349
|
case t.State.MSG_END:
|
|
1350
1350
|
switch (w) {
|
|
1351
1351
|
case t.cc.NL:
|
|
1352
|
-
this.drop = 0, this.as =
|
|
1352
|
+
this.drop = 0, this.as = E + 1, this.state = t.State.OP_START;
|
|
1353
1353
|
break;
|
|
1354
1354
|
default:
|
|
1355
1355
|
continue;
|
|
@@ -1362,7 +1362,7 @@ var Lr = {}, Fr = {};
|
|
|
1362
1362
|
this.state = t.State.OP_PLUS_O;
|
|
1363
1363
|
break;
|
|
1364
1364
|
default:
|
|
1365
|
-
throw this.fail(g.subarray(
|
|
1365
|
+
throw this.fail(g.subarray(E));
|
|
1366
1366
|
}
|
|
1367
1367
|
break;
|
|
1368
1368
|
case t.State.OP_PLUS_O:
|
|
@@ -1372,7 +1372,7 @@ var Lr = {}, Fr = {};
|
|
|
1372
1372
|
this.state = t.State.OP_PLUS_OK;
|
|
1373
1373
|
break;
|
|
1374
1374
|
default:
|
|
1375
|
-
throw this.fail(g.subarray(
|
|
1375
|
+
throw this.fail(g.subarray(E));
|
|
1376
1376
|
}
|
|
1377
1377
|
break;
|
|
1378
1378
|
case t.State.OP_PLUS_OK:
|
|
@@ -1389,7 +1389,7 @@ var Lr = {}, Fr = {};
|
|
|
1389
1389
|
this.state = t.State.OP_MINUS_E;
|
|
1390
1390
|
break;
|
|
1391
1391
|
default:
|
|
1392
|
-
throw this.fail(g.subarray(
|
|
1392
|
+
throw this.fail(g.subarray(E));
|
|
1393
1393
|
}
|
|
1394
1394
|
break;
|
|
1395
1395
|
case t.State.OP_MINUS_E:
|
|
@@ -1399,7 +1399,7 @@ var Lr = {}, Fr = {};
|
|
|
1399
1399
|
this.state = t.State.OP_MINUS_ER;
|
|
1400
1400
|
break;
|
|
1401
1401
|
default:
|
|
1402
|
-
throw this.fail(g.subarray(
|
|
1402
|
+
throw this.fail(g.subarray(E));
|
|
1403
1403
|
}
|
|
1404
1404
|
break;
|
|
1405
1405
|
case t.State.OP_MINUS_ER:
|
|
@@ -1409,7 +1409,7 @@ var Lr = {}, Fr = {};
|
|
|
1409
1409
|
this.state = t.State.OP_MINUS_ERR;
|
|
1410
1410
|
break;
|
|
1411
1411
|
default:
|
|
1412
|
-
throw this.fail(g.subarray(
|
|
1412
|
+
throw this.fail(g.subarray(E));
|
|
1413
1413
|
}
|
|
1414
1414
|
break;
|
|
1415
1415
|
case t.State.OP_MINUS_ERR:
|
|
@@ -1419,7 +1419,7 @@ var Lr = {}, Fr = {};
|
|
|
1419
1419
|
this.state = t.State.OP_MINUS_ERR_SPC;
|
|
1420
1420
|
break;
|
|
1421
1421
|
default:
|
|
1422
|
-
throw this.fail(g.subarray(
|
|
1422
|
+
throw this.fail(g.subarray(E));
|
|
1423
1423
|
}
|
|
1424
1424
|
break;
|
|
1425
1425
|
case t.State.OP_MINUS_ERR_SPC:
|
|
@@ -1428,7 +1428,7 @@ var Lr = {}, Fr = {};
|
|
|
1428
1428
|
case t.cc.TAB:
|
|
1429
1429
|
continue;
|
|
1430
1430
|
default:
|
|
1431
|
-
this.state = t.State.MINUS_ERR_ARG, this.as =
|
|
1431
|
+
this.state = t.State.MINUS_ERR_ARG, this.as = E;
|
|
1432
1432
|
}
|
|
1433
1433
|
break;
|
|
1434
1434
|
case t.State.MINUS_ERR_ARG:
|
|
@@ -1438,7 +1438,7 @@ var Lr = {}, Fr = {};
|
|
|
1438
1438
|
break;
|
|
1439
1439
|
case t.cc.NL: {
|
|
1440
1440
|
let b;
|
|
1441
|
-
this.argBuf ? (b = this.argBuf.bytes(), this.argBuf = void 0) : b = g.subarray(this.as,
|
|
1441
|
+
this.argBuf ? (b = this.argBuf.bytes(), this.argBuf = void 0) : b = g.subarray(this.as, E - this.drop), this.dispatcher.push({ kind: t.Kind.ERR, data: b }), this.drop = 0, this.as = E + 1, this.state = t.State.OP_START;
|
|
1442
1442
|
break;
|
|
1443
1443
|
}
|
|
1444
1444
|
default:
|
|
@@ -1456,7 +1456,7 @@ var Lr = {}, Fr = {};
|
|
|
1456
1456
|
this.state = t.State.OP_PO;
|
|
1457
1457
|
break;
|
|
1458
1458
|
default:
|
|
1459
|
-
throw this.fail(g.subarray(
|
|
1459
|
+
throw this.fail(g.subarray(E));
|
|
1460
1460
|
}
|
|
1461
1461
|
break;
|
|
1462
1462
|
case t.State.OP_PO:
|
|
@@ -1466,7 +1466,7 @@ var Lr = {}, Fr = {};
|
|
|
1466
1466
|
this.state = t.State.OP_PON;
|
|
1467
1467
|
break;
|
|
1468
1468
|
default:
|
|
1469
|
-
throw this.fail(g.subarray(
|
|
1469
|
+
throw this.fail(g.subarray(E));
|
|
1470
1470
|
}
|
|
1471
1471
|
break;
|
|
1472
1472
|
case t.State.OP_PON:
|
|
@@ -1476,7 +1476,7 @@ var Lr = {}, Fr = {};
|
|
|
1476
1476
|
this.state = t.State.OP_PONG;
|
|
1477
1477
|
break;
|
|
1478
1478
|
default:
|
|
1479
|
-
throw this.fail(g.subarray(
|
|
1479
|
+
throw this.fail(g.subarray(E));
|
|
1480
1480
|
}
|
|
1481
1481
|
break;
|
|
1482
1482
|
case t.State.OP_PONG:
|
|
@@ -1493,7 +1493,7 @@ var Lr = {}, Fr = {};
|
|
|
1493
1493
|
this.state = t.State.OP_PIN;
|
|
1494
1494
|
break;
|
|
1495
1495
|
default:
|
|
1496
|
-
throw this.fail(g.subarray(
|
|
1496
|
+
throw this.fail(g.subarray(E));
|
|
1497
1497
|
}
|
|
1498
1498
|
break;
|
|
1499
1499
|
case t.State.OP_PIN:
|
|
@@ -1503,7 +1503,7 @@ var Lr = {}, Fr = {};
|
|
|
1503
1503
|
this.state = t.State.OP_PING;
|
|
1504
1504
|
break;
|
|
1505
1505
|
default:
|
|
1506
|
-
throw this.fail(g.subarray(
|
|
1506
|
+
throw this.fail(g.subarray(E));
|
|
1507
1507
|
}
|
|
1508
1508
|
break;
|
|
1509
1509
|
case t.State.OP_PING:
|
|
@@ -1520,7 +1520,7 @@ var Lr = {}, Fr = {};
|
|
|
1520
1520
|
this.state = t.State.OP_IN;
|
|
1521
1521
|
break;
|
|
1522
1522
|
default:
|
|
1523
|
-
throw this.fail(g.subarray(
|
|
1523
|
+
throw this.fail(g.subarray(E));
|
|
1524
1524
|
}
|
|
1525
1525
|
break;
|
|
1526
1526
|
case t.State.OP_IN:
|
|
@@ -1530,7 +1530,7 @@ var Lr = {}, Fr = {};
|
|
|
1530
1530
|
this.state = t.State.OP_INF;
|
|
1531
1531
|
break;
|
|
1532
1532
|
default:
|
|
1533
|
-
throw this.fail(g.subarray(
|
|
1533
|
+
throw this.fail(g.subarray(E));
|
|
1534
1534
|
}
|
|
1535
1535
|
break;
|
|
1536
1536
|
case t.State.OP_INF:
|
|
@@ -1540,7 +1540,7 @@ var Lr = {}, Fr = {};
|
|
|
1540
1540
|
this.state = t.State.OP_INFO;
|
|
1541
1541
|
break;
|
|
1542
1542
|
default:
|
|
1543
|
-
throw this.fail(g.subarray(
|
|
1543
|
+
throw this.fail(g.subarray(E));
|
|
1544
1544
|
}
|
|
1545
1545
|
break;
|
|
1546
1546
|
case t.State.OP_INFO:
|
|
@@ -1550,7 +1550,7 @@ var Lr = {}, Fr = {};
|
|
|
1550
1550
|
this.state = t.State.OP_INFO_SPC;
|
|
1551
1551
|
break;
|
|
1552
1552
|
default:
|
|
1553
|
-
throw this.fail(g.subarray(
|
|
1553
|
+
throw this.fail(g.subarray(E));
|
|
1554
1554
|
}
|
|
1555
1555
|
break;
|
|
1556
1556
|
case t.State.OP_INFO_SPC:
|
|
@@ -1559,7 +1559,7 @@ var Lr = {}, Fr = {};
|
|
|
1559
1559
|
case t.cc.TAB:
|
|
1560
1560
|
continue;
|
|
1561
1561
|
default:
|
|
1562
|
-
this.state = t.State.INFO_ARG, this.as =
|
|
1562
|
+
this.state = t.State.INFO_ARG, this.as = E;
|
|
1563
1563
|
}
|
|
1564
1564
|
break;
|
|
1565
1565
|
case t.State.INFO_ARG:
|
|
@@ -1569,7 +1569,7 @@ var Lr = {}, Fr = {};
|
|
|
1569
1569
|
break;
|
|
1570
1570
|
case t.cc.NL: {
|
|
1571
1571
|
let b;
|
|
1572
|
-
this.argBuf ? (b = this.argBuf.bytes(), this.argBuf = void 0) : b = g.subarray(this.as,
|
|
1572
|
+
this.argBuf ? (b = this.argBuf.bytes(), this.argBuf = void 0) : b = g.subarray(this.as, E - this.drop), this.dispatcher.push({ kind: t.Kind.INFO, data: b }), this.drop = 0, this.as = E + 1, this.state = t.State.OP_START;
|
|
1573
1573
|
break;
|
|
1574
1574
|
}
|
|
1575
1575
|
default:
|
|
@@ -1577,19 +1577,19 @@ var Lr = {}, Fr = {};
|
|
|
1577
1577
|
}
|
|
1578
1578
|
break;
|
|
1579
1579
|
default:
|
|
1580
|
-
throw this.fail(g.subarray(
|
|
1580
|
+
throw this.fail(g.subarray(E));
|
|
1581
1581
|
}
|
|
1582
1582
|
}
|
|
1583
|
-
(this.state === t.State.MSG_ARG || this.state === t.State.MINUS_ERR_ARG || this.state === t.State.INFO_ARG) && !this.argBuf && (this.argBuf = new e.DenoBuffer(g.subarray(this.as,
|
|
1583
|
+
(this.state === t.State.MSG_ARG || this.state === t.State.MINUS_ERR_ARG || this.state === t.State.INFO_ARG) && !this.argBuf && (this.argBuf = new e.DenoBuffer(g.subarray(this.as, E - this.drop))), this.state === t.State.MSG_PAYLOAD && !this.msgBuf && (this.argBuf || this.cloneMsgArg(), this.msgBuf = new e.DenoBuffer(g.subarray(this.as)));
|
|
1584
1584
|
}
|
|
1585
1585
|
cloneMsgArg() {
|
|
1586
|
-
const g = this.ma.subject.length,
|
|
1586
|
+
const g = this.ma.subject.length, E = this.ma.reply ? this.ma.reply.length : 0, w = new Uint8Array(g + E);
|
|
1587
1587
|
w.set(this.ma.subject), this.ma.reply && w.set(this.ma.reply, g), this.argBuf = new e.DenoBuffer(w), this.ma.subject = w.subarray(0, g), this.ma.reply && (this.ma.reply = w.subarray(g));
|
|
1588
1588
|
}
|
|
1589
1589
|
processMsgArgs(g) {
|
|
1590
1590
|
if (this.hdr >= 0)
|
|
1591
1591
|
return this.processHeaderMsgArgs(g);
|
|
1592
|
-
const
|
|
1592
|
+
const E = [];
|
|
1593
1593
|
let w = -1;
|
|
1594
1594
|
for (let b = 0; b < g.length; b++)
|
|
1595
1595
|
switch (g[b]) {
|
|
@@ -1597,17 +1597,17 @@ var Lr = {}, Fr = {};
|
|
|
1597
1597
|
case t.cc.TAB:
|
|
1598
1598
|
case t.cc.CR:
|
|
1599
1599
|
case t.cc.NL:
|
|
1600
|
-
w >= 0 && (
|
|
1600
|
+
w >= 0 && (E.push(g.subarray(w, b)), w = -1);
|
|
1601
1601
|
break;
|
|
1602
1602
|
default:
|
|
1603
1603
|
w < 0 && (w = b);
|
|
1604
1604
|
}
|
|
1605
|
-
switch (w >= 0 &&
|
|
1605
|
+
switch (w >= 0 && E.push(g.subarray(w)), E.length) {
|
|
1606
1606
|
case 3:
|
|
1607
|
-
this.ma.subject =
|
|
1607
|
+
this.ma.subject = E[0], this.ma.sid = this.protoParseInt(E[1]), this.ma.reply = void 0, this.ma.size = this.protoParseInt(E[2]);
|
|
1608
1608
|
break;
|
|
1609
1609
|
case 4:
|
|
1610
|
-
this.ma.subject =
|
|
1610
|
+
this.ma.subject = E[0], this.ma.sid = this.protoParseInt(E[1]), this.ma.reply = E[2], this.ma.size = this.protoParseInt(E[3]);
|
|
1611
1611
|
break;
|
|
1612
1612
|
default:
|
|
1613
1613
|
throw this.fail(g, "processMsgArgs Parse Error");
|
|
@@ -1617,11 +1617,11 @@ var Lr = {}, Fr = {};
|
|
|
1617
1617
|
if (this.ma.size < 0)
|
|
1618
1618
|
throw this.fail(g, "processMsgArgs Bad or Missing Size Error");
|
|
1619
1619
|
}
|
|
1620
|
-
fail(g,
|
|
1621
|
-
return
|
|
1620
|
+
fail(g, E = "") {
|
|
1621
|
+
return E ? E = `${E} [${this.state}]` : E = `parse error [${this.state}]`, new Error(`${E}: ${r.TD.decode(g)}`);
|
|
1622
1622
|
}
|
|
1623
1623
|
processHeaderMsgArgs(g) {
|
|
1624
|
-
const
|
|
1624
|
+
const E = [];
|
|
1625
1625
|
let w = -1;
|
|
1626
1626
|
for (let b = 0; b < g.length; b++)
|
|
1627
1627
|
switch (g[b]) {
|
|
@@ -1629,17 +1629,17 @@ var Lr = {}, Fr = {};
|
|
|
1629
1629
|
case t.cc.TAB:
|
|
1630
1630
|
case t.cc.CR:
|
|
1631
1631
|
case t.cc.NL:
|
|
1632
|
-
w >= 0 && (
|
|
1632
|
+
w >= 0 && (E.push(g.subarray(w, b)), w = -1);
|
|
1633
1633
|
break;
|
|
1634
1634
|
default:
|
|
1635
1635
|
w < 0 && (w = b);
|
|
1636
1636
|
}
|
|
1637
|
-
switch (w >= 0 &&
|
|
1637
|
+
switch (w >= 0 && E.push(g.subarray(w)), E.length) {
|
|
1638
1638
|
case 4:
|
|
1639
|
-
this.ma.subject =
|
|
1639
|
+
this.ma.subject = E[0], this.ma.sid = this.protoParseInt(E[1]), this.ma.reply = void 0, this.ma.hdr = this.protoParseInt(E[2]), this.ma.size = this.protoParseInt(E[3]);
|
|
1640
1640
|
break;
|
|
1641
1641
|
case 5:
|
|
1642
|
-
this.ma.subject =
|
|
1642
|
+
this.ma.subject = E[0], this.ma.sid = this.protoParseInt(E[1]), this.ma.reply = E[2], this.ma.hdr = this.protoParseInt(E[3]), this.ma.size = this.protoParseInt(E[4]);
|
|
1643
1643
|
break;
|
|
1644
1644
|
default:
|
|
1645
1645
|
throw this.fail(g, "processHeaderMsgArgs Parse Error");
|
|
@@ -1654,13 +1654,13 @@ var Lr = {}, Fr = {};
|
|
|
1654
1654
|
protoParseInt(g) {
|
|
1655
1655
|
if (g.length === 0)
|
|
1656
1656
|
return -1;
|
|
1657
|
-
let
|
|
1657
|
+
let E = 0;
|
|
1658
1658
|
for (let w = 0; w < g.length; w++) {
|
|
1659
|
-
if (g[w] < u || g[w] >
|
|
1659
|
+
if (g[w] < u || g[w] > l)
|
|
1660
1660
|
return -1;
|
|
1661
|
-
|
|
1661
|
+
E = E * 10 + (g[w] - u);
|
|
1662
1662
|
}
|
|
1663
|
-
return
|
|
1663
|
+
return E;
|
|
1664
1664
|
}
|
|
1665
1665
|
}
|
|
1666
1666
|
t.Parser = m, t.State = {
|
|
@@ -1731,17 +1731,17 @@ var Lr = {}, Fr = {};
|
|
|
1731
1731
|
var kt = {}, Qe = {};
|
|
1732
1732
|
Object.defineProperty(Qe, "__esModule", { value: !0 });
|
|
1733
1733
|
Qe.MsgHdrsImpl = void 0;
|
|
1734
|
-
Qe.canonicalMIMEHeaderKey =
|
|
1734
|
+
Qe.canonicalMIMEHeaderKey = Nr;
|
|
1735
1735
|
Qe.headers = Zi;
|
|
1736
|
-
const dn = Ue, De =
|
|
1737
|
-
function
|
|
1738
|
-
let
|
|
1736
|
+
const dn = Ue, De = Ie, Kr = re;
|
|
1737
|
+
function Nr(t) {
|
|
1738
|
+
let E = !0;
|
|
1739
1739
|
const w = new Array(t.length);
|
|
1740
1740
|
for (let b = 0; b < t.length; b++) {
|
|
1741
1741
|
let x = t.charCodeAt(b);
|
|
1742
1742
|
if (x === 58 || x < 33 || x > 126)
|
|
1743
1743
|
throw Kr.InvalidArgumentError.format("header", `'${t[b]}' is not a valid character in a header name`);
|
|
1744
|
-
|
|
1744
|
+
E && 97 <= x && x <= 122 ? x -= 32 : !E && 65 <= x && x <= 90 && (x += 32), w[b] = x, E = x == 45;
|
|
1745
1745
|
}
|
|
1746
1746
|
return String.fromCharCode(...w);
|
|
1747
1747
|
}
|
|
@@ -1753,9 +1753,9 @@ function Zi(t = 0, e = "") {
|
|
|
1753
1753
|
const wr = "NATS/1.0";
|
|
1754
1754
|
class bt {
|
|
1755
1755
|
constructor(e = 0, r = "") {
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1756
|
+
d(this, "_code");
|
|
1757
|
+
d(this, "headers");
|
|
1758
|
+
d(this, "_description");
|
|
1759
1759
|
this._code = e, this._description = r, this.headers = /* @__PURE__ */ new Map();
|
|
1760
1760
|
}
|
|
1761
1761
|
[Symbol.iterator]() {
|
|
@@ -1767,12 +1767,12 @@ class bt {
|
|
|
1767
1767
|
equals(e) {
|
|
1768
1768
|
if (e && this.headers.size === e.headers.size && this._code === e._code) {
|
|
1769
1769
|
for (const [r, i] of this.headers) {
|
|
1770
|
-
const
|
|
1771
|
-
if (i.length !==
|
|
1770
|
+
const o = e.values(r);
|
|
1771
|
+
if (i.length !== o.length)
|
|
1772
1772
|
return !1;
|
|
1773
|
-
const u = [...i].sort(),
|
|
1773
|
+
const u = [...i].sort(), l = [...o].sort();
|
|
1774
1774
|
for (let m = 0; m < u.length; m++)
|
|
1775
|
-
if (u[m] !==
|
|
1775
|
+
if (u[m] !== l[m])
|
|
1776
1776
|
return !1;
|
|
1777
1777
|
}
|
|
1778
1778
|
return !0;
|
|
@@ -1780,21 +1780,21 @@ class bt {
|
|
|
1780
1780
|
return !1;
|
|
1781
1781
|
}
|
|
1782
1782
|
static decode(e) {
|
|
1783
|
-
const r = new bt(),
|
|
1784
|
-
`), u =
|
|
1783
|
+
const r = new bt(), o = dn.TD.decode(e).split(`\r
|
|
1784
|
+
`), u = o[0];
|
|
1785
1785
|
if (u !== wr) {
|
|
1786
|
-
let
|
|
1787
|
-
if (
|
|
1788
|
-
r._code = parseInt(
|
|
1786
|
+
let l = u.replace(wr, "").trim();
|
|
1787
|
+
if (l.length > 0) {
|
|
1788
|
+
r._code = parseInt(l, 10), isNaN(r._code) && (r._code = 0);
|
|
1789
1789
|
const m = r._code.toString();
|
|
1790
|
-
|
|
1790
|
+
l = l.replace(m, ""), r._description = l.trim();
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
1793
|
-
return
|
|
1794
|
-
if (
|
|
1795
|
-
const m =
|
|
1793
|
+
return o.length >= 1 && o.slice(1).map((l) => {
|
|
1794
|
+
if (l) {
|
|
1795
|
+
const m = l.indexOf(":");
|
|
1796
1796
|
if (m > -1) {
|
|
1797
|
-
const P =
|
|
1797
|
+
const P = l.slice(0, m), g = l.slice(m + 1).trim();
|
|
1798
1798
|
r.append(P, g);
|
|
1799
1799
|
}
|
|
1800
1800
|
}
|
|
@@ -1806,9 +1806,9 @@ class bt {
|
|
|
1806
1806
|
let e = wr;
|
|
1807
1807
|
this._code > 0 && this._description !== "" && (e += ` ${this._code} ${this._description}`);
|
|
1808
1808
|
for (const [r, i] of this.headers)
|
|
1809
|
-
for (let
|
|
1809
|
+
for (let o = 0; o < i.length; o++)
|
|
1810
1810
|
e = `${e}\r
|
|
1811
|
-
${r}: ${i[
|
|
1811
|
+
${r}: ${i[o]}`;
|
|
1812
1812
|
return `${e}\r
|
|
1813
1813
|
\r
|
|
1814
1814
|
`;
|
|
@@ -1831,30 +1831,30 @@ ${r}: ${i[a]}`;
|
|
|
1831
1831
|
const i = this.keys();
|
|
1832
1832
|
switch (r) {
|
|
1833
1833
|
case De.Match.Exact:
|
|
1834
|
-
return i.filter((
|
|
1834
|
+
return i.filter((o) => o === e);
|
|
1835
1835
|
case De.Match.CanonicalMIME:
|
|
1836
|
-
return e =
|
|
1836
|
+
return e = Nr(e), i.filter((o) => o === e);
|
|
1837
1837
|
default: {
|
|
1838
|
-
const
|
|
1839
|
-
return i.filter((u) =>
|
|
1838
|
+
const o = e.toLowerCase();
|
|
1839
|
+
return i.filter((u) => o === u.toLowerCase());
|
|
1840
1840
|
}
|
|
1841
1841
|
}
|
|
1842
1842
|
}
|
|
1843
1843
|
get(e, r = De.Match.Exact) {
|
|
1844
1844
|
const i = this.findKeys(e, r);
|
|
1845
1845
|
if (i.length) {
|
|
1846
|
-
const
|
|
1847
|
-
if (
|
|
1848
|
-
return Array.isArray(
|
|
1846
|
+
const o = this.headers.get(i[0]);
|
|
1847
|
+
if (o)
|
|
1848
|
+
return Array.isArray(o) ? o[0] : o;
|
|
1849
1849
|
}
|
|
1850
1850
|
return "";
|
|
1851
1851
|
}
|
|
1852
1852
|
last(e, r = De.Match.Exact) {
|
|
1853
1853
|
const i = this.findKeys(e, r);
|
|
1854
1854
|
if (i.length) {
|
|
1855
|
-
const
|
|
1856
|
-
if (
|
|
1857
|
-
return Array.isArray(
|
|
1855
|
+
const o = this.headers.get(i[0]);
|
|
1856
|
+
if (o)
|
|
1857
|
+
return Array.isArray(o) ? o[o.length - 1] : o;
|
|
1858
1858
|
}
|
|
1859
1859
|
return "";
|
|
1860
1860
|
}
|
|
@@ -1865,24 +1865,24 @@ ${r}: ${i[a]}`;
|
|
|
1865
1865
|
this.delete(e, i), this.append(e, r, i);
|
|
1866
1866
|
}
|
|
1867
1867
|
append(e, r, i = De.Match.Exact) {
|
|
1868
|
-
const
|
|
1869
|
-
i === De.Match.CanonicalMIME && (e =
|
|
1868
|
+
const o = Nr(e);
|
|
1869
|
+
i === De.Match.CanonicalMIME && (e = o);
|
|
1870
1870
|
const u = this.findKeys(e, i);
|
|
1871
1871
|
e = u.length > 0 ? u[0] : e;
|
|
1872
|
-
const
|
|
1872
|
+
const l = bt.validHeaderValue(r);
|
|
1873
1873
|
let m = this.headers.get(e);
|
|
1874
|
-
m || (m = [], this.headers.set(e, m)), m.push(
|
|
1874
|
+
m || (m = [], this.headers.set(e, m)), m.push(l);
|
|
1875
1875
|
}
|
|
1876
1876
|
values(e, r = De.Match.Exact) {
|
|
1877
1877
|
const i = [];
|
|
1878
1878
|
return this.findKeys(e, r).forEach((u) => {
|
|
1879
|
-
const
|
|
1880
|
-
|
|
1879
|
+
const l = this.headers.get(u);
|
|
1880
|
+
l && i.push(...l);
|
|
1881
1881
|
}), i;
|
|
1882
1882
|
}
|
|
1883
1883
|
delete(e, r = De.Match.Exact) {
|
|
1884
|
-
this.findKeys(e, r).forEach((
|
|
1885
|
-
this.headers.delete(
|
|
1884
|
+
this.findKeys(e, r).forEach((o) => {
|
|
1885
|
+
this.headers.delete(o);
|
|
1886
1886
|
});
|
|
1887
1887
|
}
|
|
1888
1888
|
get hasError() {
|
|
@@ -1916,12 +1916,12 @@ kt.MsgImpl = void 0;
|
|
|
1916
1916
|
const Qi = Qe, Wt = Ue;
|
|
1917
1917
|
class es {
|
|
1918
1918
|
constructor(e, r, i) {
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1919
|
+
d(this, "_headers");
|
|
1920
|
+
d(this, "_msg");
|
|
1921
|
+
d(this, "_rdata");
|
|
1922
|
+
d(this, "_reply");
|
|
1923
|
+
d(this, "_subject");
|
|
1924
|
+
d(this, "publisher");
|
|
1925
1925
|
this._msg = e, this._rdata = r, this.publisher = i;
|
|
1926
1926
|
}
|
|
1927
1927
|
get subject() {
|
|
@@ -1948,8 +1948,8 @@ class es {
|
|
|
1948
1948
|
return this.reply ? (this.publisher.publish(this.reply, e, r), !0) : !1;
|
|
1949
1949
|
}
|
|
1950
1950
|
size() {
|
|
1951
|
-
var
|
|
1952
|
-
const e = this._msg.subject.length, r = ((
|
|
1951
|
+
var o;
|
|
1952
|
+
const e = this._msg.subject.length, r = ((o = this._msg.reply) == null ? void 0 : o.length) || 0, i = this._msg.size === -1 ? 0 : this._msg.size;
|
|
1953
1953
|
return e + r + i;
|
|
1954
1954
|
}
|
|
1955
1955
|
json(e) {
|
|
@@ -1961,8 +1961,8 @@ class es {
|
|
|
1961
1961
|
requestInfo() {
|
|
1962
1962
|
var r;
|
|
1963
1963
|
const e = (r = this.headers) == null ? void 0 : r.get("Nats-Request-Info");
|
|
1964
|
-
return e ? JSON.parse(e, function(i,
|
|
1965
|
-
return (i === "start" || i === "stop") &&
|
|
1964
|
+
return e ? JSON.parse(e, function(i, o) {
|
|
1965
|
+
return (i === "start" || i === "stop") && o !== "" ? new Date(Date.parse(o)) : o;
|
|
1966
1966
|
}) : null;
|
|
1967
1967
|
}
|
|
1968
1968
|
}
|
|
@@ -1970,18 +1970,18 @@ kt.MsgImpl = es;
|
|
|
1970
1970
|
var sr = {};
|
|
1971
1971
|
(function(t) {
|
|
1972
1972
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.Features = t.Feature = void 0, t.parseSemVer = e, t.compare = r;
|
|
1973
|
-
function e(
|
|
1974
|
-
const u =
|
|
1973
|
+
function e(o = "") {
|
|
1974
|
+
const u = o.match(/(\d+).(\d+).(\d+)/);
|
|
1975
1975
|
if (u)
|
|
1976
1976
|
return {
|
|
1977
1977
|
major: parseInt(u[1]),
|
|
1978
1978
|
minor: parseInt(u[2]),
|
|
1979
1979
|
micro: parseInt(u[3])
|
|
1980
1980
|
};
|
|
1981
|
-
throw new Error(`'${
|
|
1981
|
+
throw new Error(`'${o}' is not a semver value`);
|
|
1982
1982
|
}
|
|
1983
|
-
function r(
|
|
1984
|
-
return
|
|
1983
|
+
function r(o, u) {
|
|
1984
|
+
return o.major < u.major ? -1 : o.major > u.major ? 1 : o.minor < u.minor ? -1 : o.minor > u.minor ? 1 : o.micro < u.micro ? -1 : o.micro > u.micro ? 1 : 0;
|
|
1985
1985
|
}
|
|
1986
1986
|
t.Feature = {
|
|
1987
1987
|
JS_KV: "js_kv",
|
|
@@ -2003,9 +2003,9 @@ var sr = {};
|
|
|
2003
2003
|
};
|
|
2004
2004
|
class i {
|
|
2005
2005
|
constructor(u) {
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2006
|
+
d(this, "server");
|
|
2007
|
+
d(this, "features");
|
|
2008
|
+
d(this, "disabled");
|
|
2009
2009
|
this.features = /* @__PURE__ */ new Map(), this.disabled = [], this.update(u);
|
|
2010
2010
|
}
|
|
2011
2011
|
/**
|
|
@@ -2025,8 +2025,8 @@ var sr = {};
|
|
|
2025
2025
|
return this.disabled.indexOf(u) !== -1;
|
|
2026
2026
|
}
|
|
2027
2027
|
update(u) {
|
|
2028
|
-
typeof u == "string" && (u = e(u)), this.server = u, this.set(t.Feature.JS_KV, "2.6.2"), this.set(t.Feature.JS_OBJECTSTORE, "2.6.3"), this.set(t.Feature.JS_PULL_MAX_BYTES, "2.8.3"), this.set(t.Feature.JS_NEW_CONSUMER_CREATE_API, "2.9.0"), this.set(t.Feature.JS_ALLOW_DIRECT, "2.9.0"), this.set(t.Feature.JS_MULTIPLE_CONSUMER_FILTER, "2.10.0"), this.set(t.Feature.JS_SIMPLIFICATION, "2.9.4"), this.set(t.Feature.JS_STREAM_CONSUMER_METADATA, "2.10.0"), this.set(t.Feature.JS_CONSUMER_FILTER_SUBJECTS, "2.10.0"), this.set(t.Feature.JS_STREAM_FIRST_SEQ, "2.10.0"), this.set(t.Feature.JS_STREAM_SUBJECT_TRANSFORM, "2.10.0"), this.set(t.Feature.JS_STREAM_SOURCE_SUBJECT_TRANSFORM, "2.10.0"), this.set(t.Feature.JS_STREAM_COMPRESSION, "2.10.0"), this.set(t.Feature.JS_DEFAULT_CONSUMER_LIMITS, "2.10.0"), this.set(t.Feature.JS_BATCH_DIRECT_GET, "2.11.0"), this.set(t.Feature.JS_PRIORITY_GROUPS, "2.11.0"), this.disabled.forEach((
|
|
2029
|
-
this.features.delete(
|
|
2028
|
+
typeof u == "string" && (u = e(u)), this.server = u, this.set(t.Feature.JS_KV, "2.6.2"), this.set(t.Feature.JS_OBJECTSTORE, "2.6.3"), this.set(t.Feature.JS_PULL_MAX_BYTES, "2.8.3"), this.set(t.Feature.JS_NEW_CONSUMER_CREATE_API, "2.9.0"), this.set(t.Feature.JS_ALLOW_DIRECT, "2.9.0"), this.set(t.Feature.JS_MULTIPLE_CONSUMER_FILTER, "2.10.0"), this.set(t.Feature.JS_SIMPLIFICATION, "2.9.4"), this.set(t.Feature.JS_STREAM_CONSUMER_METADATA, "2.10.0"), this.set(t.Feature.JS_CONSUMER_FILTER_SUBJECTS, "2.10.0"), this.set(t.Feature.JS_STREAM_FIRST_SEQ, "2.10.0"), this.set(t.Feature.JS_STREAM_SUBJECT_TRANSFORM, "2.10.0"), this.set(t.Feature.JS_STREAM_SOURCE_SUBJECT_TRANSFORM, "2.10.0"), this.set(t.Feature.JS_STREAM_COMPRESSION, "2.10.0"), this.set(t.Feature.JS_DEFAULT_CONSUMER_LIMITS, "2.10.0"), this.set(t.Feature.JS_BATCH_DIRECT_GET, "2.11.0"), this.set(t.Feature.JS_PRIORITY_GROUPS, "2.11.0"), this.disabled.forEach((l) => {
|
|
2029
|
+
this.features.delete(l);
|
|
2030
2030
|
});
|
|
2031
2031
|
}
|
|
2032
2032
|
/**
|
|
@@ -2034,10 +2034,10 @@ var sr = {};
|
|
|
2034
2034
|
* @param f
|
|
2035
2035
|
* @param requires
|
|
2036
2036
|
*/
|
|
2037
|
-
set(u,
|
|
2037
|
+
set(u, l) {
|
|
2038
2038
|
this.features.set(u, {
|
|
2039
|
-
min:
|
|
2040
|
-
ok: r(this.server, e(
|
|
2039
|
+
min: l,
|
|
2040
|
+
ok: r(this.server, e(l)) >= 0
|
|
2041
2041
|
});
|
|
2042
2042
|
}
|
|
2043
2043
|
/**
|
|
@@ -2053,8 +2053,8 @@ var sr = {};
|
|
|
2053
2053
|
* @param f
|
|
2054
2054
|
*/
|
|
2055
2055
|
supports(u) {
|
|
2056
|
-
var
|
|
2057
|
-
return ((
|
|
2056
|
+
var l;
|
|
2057
|
+
return ((l = this.get(u)) == null ? void 0 : l.ok) || !1;
|
|
2058
2058
|
}
|
|
2059
2059
|
/**
|
|
2060
2060
|
* Returns true if the server is at least the specified version
|
|
@@ -2066,7 +2066,7 @@ var sr = {};
|
|
|
2066
2066
|
}
|
|
2067
2067
|
t.Features = i;
|
|
2068
2068
|
})(sr);
|
|
2069
|
-
var Ut = {}, He = {}, Lt = {},
|
|
2069
|
+
var Ut = {}, He = {}, Lt = {}, Jn = {}, xe = {}, At = {}, Ct = {}, Ft = {};
|
|
2070
2070
|
Object.defineProperty(Ft, "__esModule", { value: !0 });
|
|
2071
2071
|
Ft.crc16 = void 0;
|
|
2072
2072
|
const ts = new Uint16Array([
|
|
@@ -2332,8 +2332,8 @@ class Br {
|
|
|
2332
2332
|
static checksum(e) {
|
|
2333
2333
|
let r = 0;
|
|
2334
2334
|
for (let i = 0; i < e.byteLength; i++) {
|
|
2335
|
-
const
|
|
2336
|
-
r = r << 8 & 65535 ^ ts[(r >> 8 ^
|
|
2335
|
+
const o = e[i];
|
|
2336
|
+
r = r << 8 & 65535 ^ ts[(r >> 8 ^ o) & 255];
|
|
2337
2337
|
}
|
|
2338
2338
|
return r;
|
|
2339
2339
|
}
|
|
@@ -2350,79 +2350,79 @@ const Pr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
|
2350
2350
|
class rs {
|
|
2351
2351
|
static encode(e) {
|
|
2352
2352
|
let r = 0, i = 0;
|
|
2353
|
-
const
|
|
2354
|
-
let
|
|
2355
|
-
for (let m = 0; m <
|
|
2356
|
-
for (i = i << 8 |
|
|
2353
|
+
const o = new Uint8Array(e), u = new Uint8Array(e.byteLength * 2);
|
|
2354
|
+
let l = 0;
|
|
2355
|
+
for (let m = 0; m < o.byteLength; m++)
|
|
2356
|
+
for (i = i << 8 | o[m], r += 8; r >= 5; ) {
|
|
2357
2357
|
const P = i >>> r - 5 & 31;
|
|
2358
|
-
u[
|
|
2358
|
+
u[l++] = Pr.charAt(P).charCodeAt(0), r -= 5;
|
|
2359
2359
|
}
|
|
2360
2360
|
if (r > 0) {
|
|
2361
2361
|
const m = i << 5 - r & 31;
|
|
2362
|
-
u[
|
|
2362
|
+
u[l++] = Pr.charAt(m).charCodeAt(0);
|
|
2363
2363
|
}
|
|
2364
|
-
return u.slice(0,
|
|
2364
|
+
return u.slice(0, l);
|
|
2365
2365
|
}
|
|
2366
2366
|
static decode(e) {
|
|
2367
|
-
let r = 0, i = 0,
|
|
2368
|
-
const u = new Uint8Array(e),
|
|
2367
|
+
let r = 0, i = 0, o = 0;
|
|
2368
|
+
const u = new Uint8Array(e), l = new Uint8Array(u.byteLength * 5 / 8 | 0);
|
|
2369
2369
|
for (let m = 0; m < u.byteLength; m++) {
|
|
2370
2370
|
const P = String.fromCharCode(u[m]), g = Pr.indexOf(P);
|
|
2371
2371
|
if (g === -1)
|
|
2372
2372
|
throw new Error("Illegal Base32 character: " + u[m]);
|
|
2373
|
-
i = i << 5 | g, r += 5, r >= 8 && (
|
|
2373
|
+
i = i << 5 | g, r += 5, r >= 8 && (l[o++] = i >>> r - 8 & 255, r -= 8);
|
|
2374
2374
|
}
|
|
2375
|
-
return
|
|
2375
|
+
return l.slice(0, o);
|
|
2376
2376
|
}
|
|
2377
2377
|
}
|
|
2378
2378
|
Kt.base32 = rs;
|
|
2379
2379
|
var bn;
|
|
2380
|
-
function
|
|
2380
|
+
function or() {
|
|
2381
2381
|
if (bn)
|
|
2382
2382
|
return Ct;
|
|
2383
2383
|
bn = 1, Object.defineProperty(Ct, "__esModule", { value: !0 }), Ct.Codec = void 0;
|
|
2384
2384
|
const t = Ft, e = _t(), r = Kt;
|
|
2385
2385
|
class i {
|
|
2386
|
-
static encode(u,
|
|
2387
|
-
if (!
|
|
2386
|
+
static encode(u, l) {
|
|
2387
|
+
if (!l || !(l instanceof Uint8Array))
|
|
2388
2388
|
throw new e.NKeysError(e.NKeysErrorCode.SerializationError);
|
|
2389
2389
|
if (!e.Prefixes.isValidPrefix(u))
|
|
2390
2390
|
throw new e.NKeysError(e.NKeysErrorCode.InvalidPrefixByte);
|
|
2391
|
-
return i._encode(!1, u,
|
|
2391
|
+
return i._encode(!1, u, l);
|
|
2392
2392
|
}
|
|
2393
|
-
static encodeSeed(u,
|
|
2394
|
-
if (!
|
|
2393
|
+
static encodeSeed(u, l) {
|
|
2394
|
+
if (!l)
|
|
2395
2395
|
throw new e.NKeysError(e.NKeysErrorCode.ApiError);
|
|
2396
2396
|
if (!e.Prefixes.isValidPublicPrefix(u))
|
|
2397
2397
|
throw new e.NKeysError(e.NKeysErrorCode.InvalidPrefixByte);
|
|
2398
|
-
if (
|
|
2398
|
+
if (l.byteLength !== 32)
|
|
2399
2399
|
throw new e.NKeysError(e.NKeysErrorCode.InvalidSeedLen);
|
|
2400
|
-
return i._encode(!0, u,
|
|
2400
|
+
return i._encode(!0, u, l);
|
|
2401
2401
|
}
|
|
2402
|
-
static decode(u,
|
|
2402
|
+
static decode(u, l) {
|
|
2403
2403
|
if (!e.Prefixes.isValidPrefix(u))
|
|
2404
2404
|
throw new e.NKeysError(e.NKeysErrorCode.InvalidPrefixByte);
|
|
2405
|
-
const m = i._decode(
|
|
2405
|
+
const m = i._decode(l);
|
|
2406
2406
|
if (m[0] !== u)
|
|
2407
2407
|
throw new e.NKeysError(e.NKeysErrorCode.InvalidPrefixByte);
|
|
2408
2408
|
return m.slice(1);
|
|
2409
2409
|
}
|
|
2410
2410
|
static decodeSeed(u) {
|
|
2411
|
-
const
|
|
2411
|
+
const l = i._decode(u), m = i._decodePrefix(l);
|
|
2412
2412
|
if (m[0] != e.Prefix.Seed)
|
|
2413
2413
|
throw new e.NKeysError(e.NKeysErrorCode.InvalidSeed);
|
|
2414
2414
|
if (!e.Prefixes.isValidPublicPrefix(m[1]))
|
|
2415
2415
|
throw new e.NKeysError(e.NKeysErrorCode.InvalidPrefixByte);
|
|
2416
|
-
return { buf:
|
|
2416
|
+
return { buf: l.slice(2), prefix: m[1] };
|
|
2417
2417
|
}
|
|
2418
2418
|
// unsafe encode no prefix/role validation
|
|
2419
|
-
static _encode(u,
|
|
2419
|
+
static _encode(u, l, m) {
|
|
2420
2420
|
const P = u ? 2 : 1, g = m.byteLength, w = P + g + 2, b = P + g, x = new Uint8Array(w);
|
|
2421
2421
|
if (u) {
|
|
2422
|
-
const U = i._encodePrefix(e.Prefix.Seed,
|
|
2422
|
+
const U = i._encodePrefix(e.Prefix.Seed, l);
|
|
2423
2423
|
x.set(U);
|
|
2424
2424
|
} else
|
|
2425
|
-
x[0] =
|
|
2425
|
+
x[0] = l;
|
|
2426
2426
|
x.set(m, P);
|
|
2427
2427
|
const R = t.crc16.checksum(x.slice(0, b));
|
|
2428
2428
|
return new DataView(x.buffer).setUint16(b, R, !0), r.base32.encode(x);
|
|
@@ -2431,24 +2431,24 @@ function ar() {
|
|
|
2431
2431
|
static _decode(u) {
|
|
2432
2432
|
if (u.byteLength < 4)
|
|
2433
2433
|
throw new e.NKeysError(e.NKeysErrorCode.InvalidEncoding);
|
|
2434
|
-
let
|
|
2434
|
+
let l;
|
|
2435
2435
|
try {
|
|
2436
|
-
|
|
2436
|
+
l = r.base32.decode(u);
|
|
2437
2437
|
} catch (w) {
|
|
2438
2438
|
throw new e.NKeysError(e.NKeysErrorCode.InvalidEncoding, { cause: w });
|
|
2439
2439
|
}
|
|
2440
|
-
const m =
|
|
2441
|
-
if (!t.crc16.validate(
|
|
2440
|
+
const m = l.byteLength - 2, g = new DataView(l.buffer).getUint16(m, !0), E = l.slice(0, m);
|
|
2441
|
+
if (!t.crc16.validate(E, g))
|
|
2442
2442
|
throw new e.NKeysError(e.NKeysErrorCode.InvalidChecksum);
|
|
2443
|
-
return
|
|
2443
|
+
return E;
|
|
2444
2444
|
}
|
|
2445
|
-
static _encodePrefix(u,
|
|
2446
|
-
const m = u |
|
|
2445
|
+
static _encodePrefix(u, l) {
|
|
2446
|
+
const m = u | l >> 5, P = (l & 31) << 3;
|
|
2447
2447
|
return new Uint8Array([m, P]);
|
|
2448
2448
|
}
|
|
2449
2449
|
static _decodePrefix(u) {
|
|
2450
|
-
const
|
|
2451
|
-
return new Uint8Array([
|
|
2450
|
+
const l = u[0] & 248, m = (u[0] & 7) << 5 | (u[1] & 248) >> 3;
|
|
2451
|
+
return new Uint8Array([l, m]);
|
|
2452
2452
|
}
|
|
2453
2453
|
}
|
|
2454
2454
|
return Ct.Codec = i, Ct;
|
|
@@ -2457,117 +2457,117 @@ var vt = {};
|
|
|
2457
2457
|
function ns(t) {
|
|
2458
2458
|
throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
2459
2459
|
}
|
|
2460
|
-
var
|
|
2460
|
+
var Vn = { exports: {} };
|
|
2461
2461
|
const is = {}, ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2462
2462
|
__proto__: null,
|
|
2463
2463
|
default: is
|
|
2464
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2464
|
+
}, Symbol.toStringTag, { value: "Module" })), os = /* @__PURE__ */ yi(ss);
|
|
2465
2465
|
(function(t) {
|
|
2466
2466
|
(function(e) {
|
|
2467
2467
|
var r = function(s) {
|
|
2468
|
-
var c,
|
|
2468
|
+
var c, a = new Float64Array(16);
|
|
2469
2469
|
if (s)
|
|
2470
2470
|
for (c = 0; c < s.length; c++)
|
|
2471
|
-
|
|
2472
|
-
return
|
|
2471
|
+
a[c] = s[c];
|
|
2472
|
+
return a;
|
|
2473
2473
|
}, i = function() {
|
|
2474
2474
|
throw new Error("no PRNG");
|
|
2475
|
-
},
|
|
2475
|
+
}, o = new Uint8Array(16), u = new Uint8Array(32);
|
|
2476
2476
|
u[0] = 9;
|
|
2477
|
-
var
|
|
2478
|
-
function R(s, c,
|
|
2479
|
-
s[c] =
|
|
2477
|
+
var l = r(), m = r([1]), P = r([56129, 1]), g = r([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), E = r([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), w = r([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), b = r([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), x = r([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]);
|
|
2478
|
+
function R(s, c, a, n) {
|
|
2479
|
+
s[c] = a >> 24 & 255, s[c + 1] = a >> 16 & 255, s[c + 2] = a >> 8 & 255, s[c + 3] = a & 255, s[c + 4] = n >> 24 & 255, s[c + 5] = n >> 16 & 255, s[c + 6] = n >> 8 & 255, s[c + 7] = n & 255;
|
|
2480
2480
|
}
|
|
2481
|
-
function j(s, c,
|
|
2481
|
+
function j(s, c, a, n, f) {
|
|
2482
2482
|
var y, _ = 0;
|
|
2483
2483
|
for (y = 0; y < f; y++)
|
|
2484
|
-
_ |= s[c + y] ^
|
|
2484
|
+
_ |= s[c + y] ^ a[n + y];
|
|
2485
2485
|
return (1 & _ - 1 >>> 8) - 1;
|
|
2486
2486
|
}
|
|
2487
|
-
function U(s, c,
|
|
2488
|
-
return j(s, c,
|
|
2487
|
+
function U(s, c, a, n) {
|
|
2488
|
+
return j(s, c, a, n, 16);
|
|
2489
2489
|
}
|
|
2490
|
-
function ie(s, c,
|
|
2491
|
-
return j(s, c,
|
|
2490
|
+
function ie(s, c, a, n) {
|
|
2491
|
+
return j(s, c, a, n, 32);
|
|
2492
2492
|
}
|
|
2493
|
-
function ye(s, c,
|
|
2494
|
-
for (var f = n[0] & 255 | (n[1] & 255) << 8 | (n[2] & 255) << 16 | (n[3] & 255) << 24, y =
|
|
2495
|
-
h = K + z | 0, D ^= h << 7 | h >>> 25, h = D + K | 0, C ^= h << 9 | h >>> 23, h = C + D | 0, z ^= h << 13 | h >>> 19, h = z + C | 0, K ^= h << 18 | h >>> 14, h =
|
|
2496
|
-
K = K + f | 0, q = q + y | 0, k = k + _ | 0, B = B + O | 0, D = D +
|
|
2493
|
+
function ye(s, c, a, n) {
|
|
2494
|
+
for (var f = n[0] & 255 | (n[1] & 255) << 8 | (n[2] & 255) << 16 | (n[3] & 255) << 24, y = a[0] & 255 | (a[1] & 255) << 8 | (a[2] & 255) << 16 | (a[3] & 255) << 24, _ = a[4] & 255 | (a[5] & 255) << 8 | (a[6] & 255) << 16 | (a[7] & 255) << 24, O = a[8] & 255 | (a[9] & 255) << 8 | (a[10] & 255) << 16 | (a[11] & 255) << 24, I = a[12] & 255 | (a[13] & 255) << 8 | (a[14] & 255) << 16 | (a[15] & 255) << 24, $ = n[4] & 255 | (n[5] & 255) << 8 | (n[6] & 255) << 16 | (n[7] & 255) << 24, T = c[0] & 255 | (c[1] & 255) << 8 | (c[2] & 255) << 16 | (c[3] & 255) << 24, ce = c[4] & 255 | (c[5] & 255) << 8 | (c[6] & 255) << 16 | (c[7] & 255) << 24, F = c[8] & 255 | (c[9] & 255) << 8 | (c[10] & 255) << 16 | (c[11] & 255) << 24, G = c[12] & 255 | (c[13] & 255) << 8 | (c[14] & 255) << 16 | (c[15] & 255) << 24, H = n[8] & 255 | (n[9] & 255) << 8 | (n[10] & 255) << 16 | (n[11] & 255) << 24, X = a[16] & 255 | (a[17] & 255) << 8 | (a[18] & 255) << 16 | (a[19] & 255) << 24, W = a[20] & 255 | (a[21] & 255) << 8 | (a[22] & 255) << 16 | (a[23] & 255) << 24, J = a[24] & 255 | (a[25] & 255) << 8 | (a[26] & 255) << 16 | (a[27] & 255) << 24, Y = a[28] & 255 | (a[29] & 255) << 8 | (a[30] & 255) << 16 | (a[31] & 255) << 24, V = n[12] & 255 | (n[13] & 255) << 8 | (n[14] & 255) << 16 | (n[15] & 255) << 24, K = f, q = y, k = _, B = O, D = I, N = $, v = T, p = ce, C = F, S = G, A = H, M = X, z = W, Z = J, ee = Y, Q = V, h, ne = 0; ne < 20; ne += 2)
|
|
2495
|
+
h = K + z | 0, D ^= h << 7 | h >>> 25, h = D + K | 0, C ^= h << 9 | h >>> 23, h = C + D | 0, z ^= h << 13 | h >>> 19, h = z + C | 0, K ^= h << 18 | h >>> 14, h = N + q | 0, S ^= h << 7 | h >>> 25, h = S + N | 0, Z ^= h << 9 | h >>> 23, h = Z + S | 0, q ^= h << 13 | h >>> 19, h = q + Z | 0, N ^= h << 18 | h >>> 14, h = A + v | 0, ee ^= h << 7 | h >>> 25, h = ee + A | 0, k ^= h << 9 | h >>> 23, h = k + ee | 0, v ^= h << 13 | h >>> 19, h = v + k | 0, A ^= h << 18 | h >>> 14, h = Q + M | 0, B ^= h << 7 | h >>> 25, h = B + Q | 0, p ^= h << 9 | h >>> 23, h = p + B | 0, M ^= h << 13 | h >>> 19, h = M + p | 0, Q ^= h << 18 | h >>> 14, h = K + B | 0, q ^= h << 7 | h >>> 25, h = q + K | 0, k ^= h << 9 | h >>> 23, h = k + q | 0, B ^= h << 13 | h >>> 19, h = B + k | 0, K ^= h << 18 | h >>> 14, h = N + D | 0, v ^= h << 7 | h >>> 25, h = v + N | 0, p ^= h << 9 | h >>> 23, h = p + v | 0, D ^= h << 13 | h >>> 19, h = D + p | 0, N ^= h << 18 | h >>> 14, h = A + S | 0, M ^= h << 7 | h >>> 25, h = M + A | 0, C ^= h << 9 | h >>> 23, h = C + M | 0, S ^= h << 13 | h >>> 19, h = S + C | 0, A ^= h << 18 | h >>> 14, h = Q + ee | 0, z ^= h << 7 | h >>> 25, h = z + Q | 0, Z ^= h << 9 | h >>> 23, h = Z + z | 0, ee ^= h << 13 | h >>> 19, h = ee + Z | 0, Q ^= h << 18 | h >>> 14;
|
|
2496
|
+
K = K + f | 0, q = q + y | 0, k = k + _ | 0, B = B + O | 0, D = D + I | 0, N = N + $ | 0, v = v + T | 0, p = p + ce | 0, C = C + F | 0, S = S + G | 0, A = A + H | 0, M = M + X | 0, z = z + W | 0, Z = Z + J | 0, ee = ee + Y | 0, Q = Q + V | 0, s[0] = K >>> 0 & 255, s[1] = K >>> 8 & 255, s[2] = K >>> 16 & 255, s[3] = K >>> 24 & 255, s[4] = q >>> 0 & 255, s[5] = q >>> 8 & 255, s[6] = q >>> 16 & 255, s[7] = q >>> 24 & 255, s[8] = k >>> 0 & 255, s[9] = k >>> 8 & 255, s[10] = k >>> 16 & 255, s[11] = k >>> 24 & 255, s[12] = B >>> 0 & 255, s[13] = B >>> 8 & 255, s[14] = B >>> 16 & 255, s[15] = B >>> 24 & 255, s[16] = D >>> 0 & 255, s[17] = D >>> 8 & 255, s[18] = D >>> 16 & 255, s[19] = D >>> 24 & 255, s[20] = N >>> 0 & 255, s[21] = N >>> 8 & 255, s[22] = N >>> 16 & 255, s[23] = N >>> 24 & 255, s[24] = v >>> 0 & 255, s[25] = v >>> 8 & 255, s[26] = v >>> 16 & 255, s[27] = v >>> 24 & 255, s[28] = p >>> 0 & 255, s[29] = p >>> 8 & 255, s[30] = p >>> 16 & 255, s[31] = p >>> 24 & 255, s[32] = C >>> 0 & 255, s[33] = C >>> 8 & 255, s[34] = C >>> 16 & 255, s[35] = C >>> 24 & 255, s[36] = S >>> 0 & 255, s[37] = S >>> 8 & 255, s[38] = S >>> 16 & 255, s[39] = S >>> 24 & 255, s[40] = A >>> 0 & 255, s[41] = A >>> 8 & 255, s[42] = A >>> 16 & 255, s[43] = A >>> 24 & 255, s[44] = M >>> 0 & 255, s[45] = M >>> 8 & 255, s[46] = M >>> 16 & 255, s[47] = M >>> 24 & 255, s[48] = z >>> 0 & 255, s[49] = z >>> 8 & 255, s[50] = z >>> 16 & 255, s[51] = z >>> 24 & 255, s[52] = Z >>> 0 & 255, s[53] = Z >>> 8 & 255, s[54] = Z >>> 16 & 255, s[55] = Z >>> 24 & 255, s[56] = ee >>> 0 & 255, s[57] = ee >>> 8 & 255, s[58] = ee >>> 16 & 255, s[59] = ee >>> 24 & 255, s[60] = Q >>> 0 & 255, s[61] = Q >>> 8 & 255, s[62] = Q >>> 16 & 255, s[63] = Q >>> 24 & 255;
|
|
2497
2497
|
}
|
|
2498
|
-
function Le(s, c,
|
|
2499
|
-
for (var f = n[0] & 255 | (n[1] & 255) << 8 | (n[2] & 255) << 16 | (n[3] & 255) << 24, y =
|
|
2500
|
-
h = K + z | 0, D ^= h << 7 | h >>> 25, h = D + K | 0, C ^= h << 9 | h >>> 23, h = C + D | 0, z ^= h << 13 | h >>> 19, h = z + C | 0, K ^= h << 18 | h >>> 14, h =
|
|
2501
|
-
s[0] = K >>> 0 & 255, s[1] = K >>> 8 & 255, s[2] = K >>> 16 & 255, s[3] = K >>> 24 & 255, s[4] =
|
|
2498
|
+
function Le(s, c, a, n) {
|
|
2499
|
+
for (var f = n[0] & 255 | (n[1] & 255) << 8 | (n[2] & 255) << 16 | (n[3] & 255) << 24, y = a[0] & 255 | (a[1] & 255) << 8 | (a[2] & 255) << 16 | (a[3] & 255) << 24, _ = a[4] & 255 | (a[5] & 255) << 8 | (a[6] & 255) << 16 | (a[7] & 255) << 24, O = a[8] & 255 | (a[9] & 255) << 8 | (a[10] & 255) << 16 | (a[11] & 255) << 24, I = a[12] & 255 | (a[13] & 255) << 8 | (a[14] & 255) << 16 | (a[15] & 255) << 24, $ = n[4] & 255 | (n[5] & 255) << 8 | (n[6] & 255) << 16 | (n[7] & 255) << 24, T = c[0] & 255 | (c[1] & 255) << 8 | (c[2] & 255) << 16 | (c[3] & 255) << 24, ce = c[4] & 255 | (c[5] & 255) << 8 | (c[6] & 255) << 16 | (c[7] & 255) << 24, F = c[8] & 255 | (c[9] & 255) << 8 | (c[10] & 255) << 16 | (c[11] & 255) << 24, G = c[12] & 255 | (c[13] & 255) << 8 | (c[14] & 255) << 16 | (c[15] & 255) << 24, H = n[8] & 255 | (n[9] & 255) << 8 | (n[10] & 255) << 16 | (n[11] & 255) << 24, X = a[16] & 255 | (a[17] & 255) << 8 | (a[18] & 255) << 16 | (a[19] & 255) << 24, W = a[20] & 255 | (a[21] & 255) << 8 | (a[22] & 255) << 16 | (a[23] & 255) << 24, J = a[24] & 255 | (a[25] & 255) << 8 | (a[26] & 255) << 16 | (a[27] & 255) << 24, Y = a[28] & 255 | (a[29] & 255) << 8 | (a[30] & 255) << 16 | (a[31] & 255) << 24, V = n[12] & 255 | (n[13] & 255) << 8 | (n[14] & 255) << 16 | (n[15] & 255) << 24, K = f, q = y, k = _, B = O, D = I, N = $, v = T, p = ce, C = F, S = G, A = H, M = X, z = W, Z = J, ee = Y, Q = V, h, ne = 0; ne < 20; ne += 2)
|
|
2500
|
+
h = K + z | 0, D ^= h << 7 | h >>> 25, h = D + K | 0, C ^= h << 9 | h >>> 23, h = C + D | 0, z ^= h << 13 | h >>> 19, h = z + C | 0, K ^= h << 18 | h >>> 14, h = N + q | 0, S ^= h << 7 | h >>> 25, h = S + N | 0, Z ^= h << 9 | h >>> 23, h = Z + S | 0, q ^= h << 13 | h >>> 19, h = q + Z | 0, N ^= h << 18 | h >>> 14, h = A + v | 0, ee ^= h << 7 | h >>> 25, h = ee + A | 0, k ^= h << 9 | h >>> 23, h = k + ee | 0, v ^= h << 13 | h >>> 19, h = v + k | 0, A ^= h << 18 | h >>> 14, h = Q + M | 0, B ^= h << 7 | h >>> 25, h = B + Q | 0, p ^= h << 9 | h >>> 23, h = p + B | 0, M ^= h << 13 | h >>> 19, h = M + p | 0, Q ^= h << 18 | h >>> 14, h = K + B | 0, q ^= h << 7 | h >>> 25, h = q + K | 0, k ^= h << 9 | h >>> 23, h = k + q | 0, B ^= h << 13 | h >>> 19, h = B + k | 0, K ^= h << 18 | h >>> 14, h = N + D | 0, v ^= h << 7 | h >>> 25, h = v + N | 0, p ^= h << 9 | h >>> 23, h = p + v | 0, D ^= h << 13 | h >>> 19, h = D + p | 0, N ^= h << 18 | h >>> 14, h = A + S | 0, M ^= h << 7 | h >>> 25, h = M + A | 0, C ^= h << 9 | h >>> 23, h = C + M | 0, S ^= h << 13 | h >>> 19, h = S + C | 0, A ^= h << 18 | h >>> 14, h = Q + ee | 0, z ^= h << 7 | h >>> 25, h = z + Q | 0, Z ^= h << 9 | h >>> 23, h = Z + z | 0, ee ^= h << 13 | h >>> 19, h = ee + Z | 0, Q ^= h << 18 | h >>> 14;
|
|
2501
|
+
s[0] = K >>> 0 & 255, s[1] = K >>> 8 & 255, s[2] = K >>> 16 & 255, s[3] = K >>> 24 & 255, s[4] = N >>> 0 & 255, s[5] = N >>> 8 & 255, s[6] = N >>> 16 & 255, s[7] = N >>> 24 & 255, s[8] = A >>> 0 & 255, s[9] = A >>> 8 & 255, s[10] = A >>> 16 & 255, s[11] = A >>> 24 & 255, s[12] = Q >>> 0 & 255, s[13] = Q >>> 8 & 255, s[14] = Q >>> 16 & 255, s[15] = Q >>> 24 & 255, s[16] = v >>> 0 & 255, s[17] = v >>> 8 & 255, s[18] = v >>> 16 & 255, s[19] = v >>> 24 & 255, s[20] = p >>> 0 & 255, s[21] = p >>> 8 & 255, s[22] = p >>> 16 & 255, s[23] = p >>> 24 & 255, s[24] = C >>> 0 & 255, s[25] = C >>> 8 & 255, s[26] = C >>> 16 & 255, s[27] = C >>> 24 & 255, s[28] = S >>> 0 & 255, s[29] = S >>> 8 & 255, s[30] = S >>> 16 & 255, s[31] = S >>> 24 & 255;
|
|
2502
2502
|
}
|
|
2503
|
-
function L(s, c,
|
|
2504
|
-
ye(s, c,
|
|
2503
|
+
function L(s, c, a, n) {
|
|
2504
|
+
ye(s, c, a, n);
|
|
2505
2505
|
}
|
|
2506
|
-
function he(s, c,
|
|
2507
|
-
Le(s, c,
|
|
2506
|
+
function he(s, c, a, n) {
|
|
2507
|
+
Le(s, c, a, n);
|
|
2508
2508
|
}
|
|
2509
2509
|
var le = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
|
|
2510
|
-
function $e(s, c,
|
|
2511
|
-
var O = new Uint8Array(16),
|
|
2512
|
-
for (
|
|
2513
|
-
O[
|
|
2514
|
-
for (
|
|
2515
|
-
O[
|
|
2510
|
+
function $e(s, c, a, n, f, y, _) {
|
|
2511
|
+
var O = new Uint8Array(16), I = new Uint8Array(64), $, T;
|
|
2512
|
+
for (T = 0; T < 16; T++)
|
|
2513
|
+
O[T] = 0;
|
|
2514
|
+
for (T = 0; T < 8; T++)
|
|
2515
|
+
O[T] = y[T];
|
|
2516
2516
|
for (; f >= 64; ) {
|
|
2517
|
-
for (L(
|
|
2518
|
-
s[c +
|
|
2519
|
-
for ($ = 1,
|
|
2520
|
-
$ = $ + (O[
|
|
2517
|
+
for (L(I, O, _, le), T = 0; T < 64; T++)
|
|
2518
|
+
s[c + T] = a[n + T] ^ I[T];
|
|
2519
|
+
for ($ = 1, T = 8; T < 16; T++)
|
|
2520
|
+
$ = $ + (O[T] & 255) | 0, O[T] = $ & 255, $ >>>= 8;
|
|
2521
2521
|
f -= 64, c += 64, n += 64;
|
|
2522
2522
|
}
|
|
2523
2523
|
if (f > 0)
|
|
2524
|
-
for (L(
|
|
2525
|
-
s[c +
|
|
2524
|
+
for (L(I, O, _, le), T = 0; T < f; T++)
|
|
2525
|
+
s[c + T] = a[n + T] ^ I[T];
|
|
2526
2526
|
return 0;
|
|
2527
2527
|
}
|
|
2528
|
-
function
|
|
2529
|
-
var y = new Uint8Array(16), _ = new Uint8Array(64), O,
|
|
2530
|
-
for (
|
|
2531
|
-
y[
|
|
2532
|
-
for (
|
|
2533
|
-
y[
|
|
2534
|
-
for (;
|
|
2535
|
-
for (L(_, y, f, le),
|
|
2536
|
-
s[c +
|
|
2537
|
-
for (O = 1,
|
|
2538
|
-
O = O + (y[
|
|
2539
|
-
|
|
2528
|
+
function pt(s, c, a, n, f) {
|
|
2529
|
+
var y = new Uint8Array(16), _ = new Uint8Array(64), O, I;
|
|
2530
|
+
for (I = 0; I < 16; I++)
|
|
2531
|
+
y[I] = 0;
|
|
2532
|
+
for (I = 0; I < 8; I++)
|
|
2533
|
+
y[I] = n[I];
|
|
2534
|
+
for (; a >= 64; ) {
|
|
2535
|
+
for (L(_, y, f, le), I = 0; I < 64; I++)
|
|
2536
|
+
s[c + I] = _[I];
|
|
2537
|
+
for (O = 1, I = 8; I < 16; I++)
|
|
2538
|
+
O = O + (y[I] & 255) | 0, y[I] = O & 255, O >>>= 8;
|
|
2539
|
+
a -= 64, c += 64;
|
|
2540
2540
|
}
|
|
2541
|
-
if (
|
|
2542
|
-
for (L(_, y, f, le),
|
|
2543
|
-
s[c +
|
|
2541
|
+
if (a > 0)
|
|
2542
|
+
for (L(_, y, f, le), I = 0; I < a; I++)
|
|
2543
|
+
s[c + I] = _[I];
|
|
2544
2544
|
return 0;
|
|
2545
2545
|
}
|
|
2546
|
-
function
|
|
2546
|
+
function at(s, c, a, n, f) {
|
|
2547
2547
|
var y = new Uint8Array(32);
|
|
2548
2548
|
he(y, n, f, le);
|
|
2549
2549
|
for (var _ = new Uint8Array(8), O = 0; O < 8; O++)
|
|
2550
2550
|
_[O] = n[O + 16];
|
|
2551
|
-
return
|
|
2551
|
+
return pt(s, c, a, _, y);
|
|
2552
2552
|
}
|
|
2553
|
-
function ct(s, c,
|
|
2553
|
+
function ct(s, c, a, n, f, y, _) {
|
|
2554
2554
|
var O = new Uint8Array(32);
|
|
2555
2555
|
he(O, y, _, le);
|
|
2556
|
-
for (var
|
|
2557
|
-
|
|
2558
|
-
return $e(s, c,
|
|
2556
|
+
for (var I = new Uint8Array(8), $ = 0; $ < 8; $++)
|
|
2557
|
+
I[$] = y[$ + 16];
|
|
2558
|
+
return $e(s, c, a, n, f, I, O);
|
|
2559
2559
|
}
|
|
2560
2560
|
var ft = function(s) {
|
|
2561
2561
|
this.buffer = new Uint8Array(16), this.r = new Uint16Array(10), this.h = new Uint16Array(10), this.pad = new Uint16Array(8), this.leftover = 0, this.fin = 0;
|
|
2562
|
-
var c,
|
|
2563
|
-
c = s[0] & 255 | (s[1] & 255) << 8, this.r[0] = c & 8191,
|
|
2562
|
+
var c, a, n, f, y, _, O, I;
|
|
2563
|
+
c = s[0] & 255 | (s[1] & 255) << 8, this.r[0] = c & 8191, a = s[2] & 255 | (s[3] & 255) << 8, this.r[1] = (c >>> 13 | a << 3) & 8191, n = s[4] & 255 | (s[5] & 255) << 8, this.r[2] = (a >>> 10 | n << 6) & 7939, f = s[6] & 255 | (s[7] & 255) << 8, this.r[3] = (n >>> 7 | f << 9) & 8191, y = s[8] & 255 | (s[9] & 255) << 8, this.r[4] = (f >>> 4 | y << 12) & 255, this.r[5] = y >>> 1 & 8190, _ = s[10] & 255 | (s[11] & 255) << 8, this.r[6] = (y >>> 14 | _ << 2) & 8191, O = s[12] & 255 | (s[13] & 255) << 8, this.r[7] = (_ >>> 11 | O << 5) & 8065, I = s[14] & 255 | (s[15] & 255) << 8, this.r[8] = (O >>> 8 | I << 8) & 8191, this.r[9] = I >>> 5 & 127, this.pad[0] = s[16] & 255 | (s[17] & 255) << 8, this.pad[1] = s[18] & 255 | (s[19] & 255) << 8, this.pad[2] = s[20] & 255 | (s[21] & 255) << 8, this.pad[3] = s[22] & 255 | (s[23] & 255) << 8, this.pad[4] = s[24] & 255 | (s[25] & 255) << 8, this.pad[5] = s[26] & 255 | (s[27] & 255) << 8, this.pad[6] = s[28] & 255 | (s[29] & 255) << 8, this.pad[7] = s[30] & 255 | (s[31] & 255) << 8;
|
|
2564
2564
|
};
|
|
2565
|
-
ft.prototype.blocks = function(s, c,
|
|
2566
|
-
for (var n = this.fin ? 0 : 2048, f, y, _, O,
|
|
2567
|
-
f = s[c + 0] & 255 | (s[c + 1] & 255) << 8, B += f & 8191, y = s[c + 2] & 255 | (s[c + 3] & 255) << 8, D += (f >>> 13 | y << 3) & 8191, _ = s[c + 4] & 255 | (s[c + 5] & 255) << 8,
|
|
2568
|
-
this.h[0] = B, this.h[1] = D, this.h[2] =
|
|
2565
|
+
ft.prototype.blocks = function(s, c, a) {
|
|
2566
|
+
for (var n = this.fin ? 0 : 2048, f, y, _, O, I, $, T, ce, F, G, H, X, W, J, Y, V, K, q, k, B = this.h[0], D = this.h[1], N = this.h[2], v = this.h[3], p = this.h[4], C = this.h[5], S = this.h[6], A = this.h[7], M = this.h[8], z = this.h[9], Z = this.r[0], ee = this.r[1], Q = this.r[2], h = this.r[3], ne = this.r[4], fe = this.r[5], ue = this.r[6], te = this.r[7], oe = this.r[8], ae = this.r[9]; a >= 16; )
|
|
2567
|
+
f = s[c + 0] & 255 | (s[c + 1] & 255) << 8, B += f & 8191, y = s[c + 2] & 255 | (s[c + 3] & 255) << 8, D += (f >>> 13 | y << 3) & 8191, _ = s[c + 4] & 255 | (s[c + 5] & 255) << 8, N += (y >>> 10 | _ << 6) & 8191, O = s[c + 6] & 255 | (s[c + 7] & 255) << 8, v += (_ >>> 7 | O << 9) & 8191, I = s[c + 8] & 255 | (s[c + 9] & 255) << 8, p += (O >>> 4 | I << 12) & 8191, C += I >>> 1 & 8191, $ = s[c + 10] & 255 | (s[c + 11] & 255) << 8, S += (I >>> 14 | $ << 2) & 8191, T = s[c + 12] & 255 | (s[c + 13] & 255) << 8, A += ($ >>> 11 | T << 5) & 8191, ce = s[c + 14] & 255 | (s[c + 15] & 255) << 8, M += (T >>> 8 | ce << 8) & 8191, z += ce >>> 5 | n, F = 0, G = F, G += B * Z, G += D * (5 * ae), G += N * (5 * oe), G += v * (5 * te), G += p * (5 * ue), F = G >>> 13, G &= 8191, G += C * (5 * fe), G += S * (5 * ne), G += A * (5 * h), G += M * (5 * Q), G += z * (5 * ee), F += G >>> 13, G &= 8191, H = F, H += B * ee, H += D * Z, H += N * (5 * ae), H += v * (5 * oe), H += p * (5 * te), F = H >>> 13, H &= 8191, H += C * (5 * ue), H += S * (5 * fe), H += A * (5 * ne), H += M * (5 * h), H += z * (5 * Q), F += H >>> 13, H &= 8191, X = F, X += B * Q, X += D * ee, X += N * Z, X += v * (5 * ae), X += p * (5 * oe), F = X >>> 13, X &= 8191, X += C * (5 * te), X += S * (5 * ue), X += A * (5 * fe), X += M * (5 * ne), X += z * (5 * h), F += X >>> 13, X &= 8191, W = F, W += B * h, W += D * Q, W += N * ee, W += v * Z, W += p * (5 * ae), F = W >>> 13, W &= 8191, W += C * (5 * oe), W += S * (5 * te), W += A * (5 * ue), W += M * (5 * fe), W += z * (5 * ne), F += W >>> 13, W &= 8191, J = F, J += B * ne, J += D * h, J += N * Q, J += v * ee, J += p * Z, F = J >>> 13, J &= 8191, J += C * (5 * ae), J += S * (5 * oe), J += A * (5 * te), J += M * (5 * ue), J += z * (5 * fe), F += J >>> 13, J &= 8191, Y = F, Y += B * fe, Y += D * ne, Y += N * h, Y += v * Q, Y += p * ee, F = Y >>> 13, Y &= 8191, Y += C * Z, Y += S * (5 * ae), Y += A * (5 * oe), Y += M * (5 * te), Y += z * (5 * ue), F += Y >>> 13, Y &= 8191, V = F, V += B * ue, V += D * fe, V += N * ne, V += v * h, V += p * Q, F = V >>> 13, V &= 8191, V += C * ee, V += S * Z, V += A * (5 * ae), V += M * (5 * oe), V += z * (5 * te), F += V >>> 13, V &= 8191, K = F, K += B * te, K += D * ue, K += N * fe, K += v * ne, K += p * h, F = K >>> 13, K &= 8191, K += C * Q, K += S * ee, K += A * Z, K += M * (5 * ae), K += z * (5 * oe), F += K >>> 13, K &= 8191, q = F, q += B * oe, q += D * te, q += N * ue, q += v * fe, q += p * ne, F = q >>> 13, q &= 8191, q += C * h, q += S * Q, q += A * ee, q += M * Z, q += z * (5 * ae), F += q >>> 13, q &= 8191, k = F, k += B * ae, k += D * oe, k += N * te, k += v * ue, k += p * fe, F = k >>> 13, k &= 8191, k += C * ne, k += S * h, k += A * Q, k += M * ee, k += z * Z, F += k >>> 13, k &= 8191, F = (F << 2) + F | 0, F = F + G | 0, G = F & 8191, F = F >>> 13, H += F, B = G, D = H, N = X, v = W, p = J, C = Y, S = V, A = K, M = q, z = k, c += 16, a -= 16;
|
|
2568
|
+
this.h[0] = B, this.h[1] = D, this.h[2] = N, this.h[3] = v, this.h[4] = p, this.h[5] = C, this.h[6] = S, this.h[7] = A, this.h[8] = M, this.h[9] = z;
|
|
2569
2569
|
}, ft.prototype.finish = function(s, c) {
|
|
2570
|
-
var
|
|
2570
|
+
var a = new Uint16Array(10), n, f, y, _;
|
|
2571
2571
|
if (this.leftover) {
|
|
2572
2572
|
for (_ = this.leftover, this.buffer[_++] = 1; _ < 16; _++)
|
|
2573
2573
|
this.buffer[_] = 0;
|
|
@@ -2575,159 +2575,159 @@ const is = {}, ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
2575
2575
|
}
|
|
2576
2576
|
for (n = this.h[1] >>> 13, this.h[1] &= 8191, _ = 2; _ < 10; _++)
|
|
2577
2577
|
this.h[_] += n, n = this.h[_] >>> 13, this.h[_] &= 8191;
|
|
2578
|
-
for (this.h[0] += n * 5, n = this.h[0] >>> 13, this.h[0] &= 8191, this.h[1] += n, n = this.h[1] >>> 13, this.h[1] &= 8191, this.h[2] += n,
|
|
2579
|
-
|
|
2580
|
-
for (
|
|
2581
|
-
|
|
2578
|
+
for (this.h[0] += n * 5, n = this.h[0] >>> 13, this.h[0] &= 8191, this.h[1] += n, n = this.h[1] >>> 13, this.h[1] &= 8191, this.h[2] += n, a[0] = this.h[0] + 5, n = a[0] >>> 13, a[0] &= 8191, _ = 1; _ < 10; _++)
|
|
2579
|
+
a[_] = this.h[_] + n, n = a[_] >>> 13, a[_] &= 8191;
|
|
2580
|
+
for (a[9] -= 8192, f = (n ^ 1) - 1, _ = 0; _ < 10; _++)
|
|
2581
|
+
a[_] &= f;
|
|
2582
2582
|
for (f = ~f, _ = 0; _ < 10; _++)
|
|
2583
|
-
this.h[_] = this.h[_] & f |
|
|
2583
|
+
this.h[_] = this.h[_] & f | a[_];
|
|
2584
2584
|
for (this.h[0] = (this.h[0] | this.h[1] << 13) & 65535, this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535, this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535, this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535, this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535, this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535, this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535, this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535, y = this.h[0] + this.pad[0], this.h[0] = y & 65535, _ = 1; _ < 8; _++)
|
|
2585
2585
|
y = (this.h[_] + this.pad[_] | 0) + (y >>> 16) | 0, this.h[_] = y & 65535;
|
|
2586
2586
|
s[c + 0] = this.h[0] >>> 0 & 255, s[c + 1] = this.h[0] >>> 8 & 255, s[c + 2] = this.h[1] >>> 0 & 255, s[c + 3] = this.h[1] >>> 8 & 255, s[c + 4] = this.h[2] >>> 0 & 255, s[c + 5] = this.h[2] >>> 8 & 255, s[c + 6] = this.h[3] >>> 0 & 255, s[c + 7] = this.h[3] >>> 8 & 255, s[c + 8] = this.h[4] >>> 0 & 255, s[c + 9] = this.h[4] >>> 8 & 255, s[c + 10] = this.h[5] >>> 0 & 255, s[c + 11] = this.h[5] >>> 8 & 255, s[c + 12] = this.h[6] >>> 0 & 255, s[c + 13] = this.h[6] >>> 8 & 255, s[c + 14] = this.h[7] >>> 0 & 255, s[c + 15] = this.h[7] >>> 8 & 255;
|
|
2587
|
-
}, ft.prototype.update = function(s, c,
|
|
2587
|
+
}, ft.prototype.update = function(s, c, a) {
|
|
2588
2588
|
var n, f;
|
|
2589
2589
|
if (this.leftover) {
|
|
2590
|
-
for (f = 16 - this.leftover, f >
|
|
2590
|
+
for (f = 16 - this.leftover, f > a && (f = a), n = 0; n < f; n++)
|
|
2591
2591
|
this.buffer[this.leftover + n] = s[c + n];
|
|
2592
|
-
if (
|
|
2592
|
+
if (a -= f, c += f, this.leftover += f, this.leftover < 16)
|
|
2593
2593
|
return;
|
|
2594
2594
|
this.blocks(this.buffer, 0, 16), this.leftover = 0;
|
|
2595
2595
|
}
|
|
2596
|
-
if (
|
|
2597
|
-
for (n = 0; n <
|
|
2596
|
+
if (a >= 16 && (f = a - a % 16, this.blocks(s, c, f), c += f, a -= f), a) {
|
|
2597
|
+
for (n = 0; n < a; n++)
|
|
2598
2598
|
this.buffer[this.leftover + n] = s[c + n];
|
|
2599
|
-
this.leftover +=
|
|
2599
|
+
this.leftover += a;
|
|
2600
2600
|
}
|
|
2601
2601
|
};
|
|
2602
|
-
function ut(s, c,
|
|
2602
|
+
function ut(s, c, a, n, f, y) {
|
|
2603
2603
|
var _ = new ft(y);
|
|
2604
|
-
return _.update(
|
|
2604
|
+
return _.update(a, n, f), _.finish(s, c), 0;
|
|
2605
2605
|
}
|
|
2606
|
-
function
|
|
2606
|
+
function Et(s, c, a, n, f, y) {
|
|
2607
2607
|
var _ = new Uint8Array(16);
|
|
2608
|
-
return ut(_, 0,
|
|
2608
|
+
return ut(_, 0, a, n, f, y), U(s, c, _, 0);
|
|
2609
2609
|
}
|
|
2610
|
-
function Pe(s, c,
|
|
2610
|
+
function Pe(s, c, a, n, f) {
|
|
2611
2611
|
var y;
|
|
2612
|
-
if (
|
|
2612
|
+
if (a < 32)
|
|
2613
2613
|
return -1;
|
|
2614
|
-
for (ct(s, 0, c, 0,
|
|
2614
|
+
for (ct(s, 0, c, 0, a, n, f), ut(s, 16, s, 32, a - 32, s), y = 0; y < 16; y++)
|
|
2615
2615
|
s[y] = 0;
|
|
2616
2616
|
return 0;
|
|
2617
2617
|
}
|
|
2618
|
-
function qe(s, c,
|
|
2618
|
+
function qe(s, c, a, n, f) {
|
|
2619
2619
|
var y, _ = new Uint8Array(32);
|
|
2620
|
-
if (
|
|
2620
|
+
if (a < 32 || (at(_, 0, 32, n, f), Et(c, 16, c, 32, a - 32, _) !== 0))
|
|
2621
2621
|
return -1;
|
|
2622
|
-
for (ct(s, 0, c, 0,
|
|
2622
|
+
for (ct(s, 0, c, 0, a, n, f), y = 0; y < 32; y++)
|
|
2623
2623
|
s[y] = 0;
|
|
2624
2624
|
return 0;
|
|
2625
2625
|
}
|
|
2626
2626
|
function Se(s, c) {
|
|
2627
|
-
var
|
|
2628
|
-
for (
|
|
2629
|
-
s[
|
|
2627
|
+
var a;
|
|
2628
|
+
for (a = 0; a < 16; a++)
|
|
2629
|
+
s[a] = c[a] | 0;
|
|
2630
2630
|
}
|
|
2631
|
-
function
|
|
2632
|
-
var c,
|
|
2631
|
+
function Ne(s) {
|
|
2632
|
+
var c, a, n = 1;
|
|
2633
2633
|
for (c = 0; c < 16; c++)
|
|
2634
|
-
|
|
2634
|
+
a = s[c] + n + 65535, n = Math.floor(a / 65536), s[c] = a - n * 65536;
|
|
2635
2635
|
s[0] += n - 1 + 37 * (n - 1);
|
|
2636
2636
|
}
|
|
2637
|
-
function
|
|
2638
|
-
for (var n, f = ~(
|
|
2637
|
+
function Te(s, c, a) {
|
|
2638
|
+
for (var n, f = ~(a - 1), y = 0; y < 16; y++)
|
|
2639
2639
|
n = f & (s[y] ^ c[y]), s[y] ^= n, c[y] ^= n;
|
|
2640
2640
|
}
|
|
2641
2641
|
function Re(s, c) {
|
|
2642
|
-
var
|
|
2643
|
-
for (
|
|
2644
|
-
_[
|
|
2645
|
-
for (
|
|
2646
|
-
for (y[0] = _[0] - 65517,
|
|
2647
|
-
y[
|
|
2648
|
-
y[15] = _[15] - 32767 - (y[14] >> 16 & 1), f = y[15] >> 16 & 1, y[14] &= 65535,
|
|
2642
|
+
var a, n, f, y = r(), _ = r();
|
|
2643
|
+
for (a = 0; a < 16; a++)
|
|
2644
|
+
_[a] = c[a];
|
|
2645
|
+
for (Ne(_), Ne(_), Ne(_), n = 0; n < 2; n++) {
|
|
2646
|
+
for (y[0] = _[0] - 65517, a = 1; a < 15; a++)
|
|
2647
|
+
y[a] = _[a] - 65535 - (y[a - 1] >> 16 & 1), y[a - 1] &= 65535;
|
|
2648
|
+
y[15] = _[15] - 32767 - (y[14] >> 16 & 1), f = y[15] >> 16 & 1, y[14] &= 65535, Te(_, y, 1 - f);
|
|
2649
2649
|
}
|
|
2650
|
-
for (
|
|
2651
|
-
s[2 *
|
|
2650
|
+
for (a = 0; a < 16; a++)
|
|
2651
|
+
s[2 * a] = _[a] & 255, s[2 * a + 1] = _[a] >> 8;
|
|
2652
2652
|
}
|
|
2653
2653
|
function zr(s, c) {
|
|
2654
|
-
var
|
|
2655
|
-
return Re(
|
|
2654
|
+
var a = new Uint8Array(32), n = new Uint8Array(32);
|
|
2655
|
+
return Re(a, s), Re(n, c), ie(a, 0, n, 0);
|
|
2656
2656
|
}
|
|
2657
2657
|
function Gr(s) {
|
|
2658
2658
|
var c = new Uint8Array(32);
|
|
2659
2659
|
return Re(c, s), c[0] & 1;
|
|
2660
2660
|
}
|
|
2661
2661
|
function ur(s, c) {
|
|
2662
|
-
var
|
|
2663
|
-
for (
|
|
2664
|
-
s[
|
|
2662
|
+
var a;
|
|
2663
|
+
for (a = 0; a < 16; a++)
|
|
2664
|
+
s[a] = c[2 * a] + (c[2 * a + 1] << 8);
|
|
2665
2665
|
s[15] &= 32767;
|
|
2666
2666
|
}
|
|
2667
|
-
function Ke(s, c,
|
|
2667
|
+
function Ke(s, c, a) {
|
|
2668
2668
|
for (var n = 0; n < 16; n++)
|
|
2669
|
-
s[n] = c[n] +
|
|
2669
|
+
s[n] = c[n] + a[n];
|
|
2670
2670
|
}
|
|
2671
|
-
function Be(s, c,
|
|
2671
|
+
function Be(s, c, a) {
|
|
2672
2672
|
for (var n = 0; n < 16; n++)
|
|
2673
|
-
s[n] = c[n] -
|
|
2673
|
+
s[n] = c[n] - a[n];
|
|
2674
2674
|
}
|
|
2675
|
-
function se(s, c,
|
|
2676
|
-
var n, f, y = 0, _ = 0, O = 0,
|
|
2677
|
-
n = c[0], y += n * h, _ += n * ne, O += n * fe,
|
|
2675
|
+
function se(s, c, a) {
|
|
2676
|
+
var n, f, y = 0, _ = 0, O = 0, I = 0, $ = 0, T = 0, ce = 0, F = 0, G = 0, H = 0, X = 0, W = 0, J = 0, Y = 0, V = 0, K = 0, q = 0, k = 0, B = 0, D = 0, N = 0, v = 0, p = 0, C = 0, S = 0, A = 0, M = 0, z = 0, Z = 0, ee = 0, Q = 0, h = a[0], ne = a[1], fe = a[2], ue = a[3], te = a[4], oe = a[5], ae = a[6], ve = a[7], de = a[8], _e = a[9], ge = a[10], me = a[11], Ee = a[12], Ae = a[13], Ce = a[14], Me = a[15];
|
|
2677
|
+
n = c[0], y += n * h, _ += n * ne, O += n * fe, I += n * ue, $ += n * te, T += n * oe, ce += n * ae, F += n * ve, G += n * de, H += n * _e, X += n * ge, W += n * me, J += n * Ee, Y += n * Ae, V += n * Ce, K += n * Me, n = c[1], _ += n * h, O += n * ne, I += n * fe, $ += n * ue, T += n * te, ce += n * oe, F += n * ae, G += n * ve, H += n * de, X += n * _e, W += n * ge, J += n * me, Y += n * Ee, V += n * Ae, K += n * Ce, q += n * Me, n = c[2], O += n * h, I += n * ne, $ += n * fe, T += n * ue, ce += n * te, F += n * oe, G += n * ae, H += n * ve, X += n * de, W += n * _e, J += n * ge, Y += n * me, V += n * Ee, K += n * Ae, q += n * Ce, k += n * Me, n = c[3], I += n * h, $ += n * ne, T += n * fe, ce += n * ue, F += n * te, G += n * oe, H += n * ae, X += n * ve, W += n * de, J += n * _e, Y += n * ge, V += n * me, K += n * Ee, q += n * Ae, k += n * Ce, B += n * Me, n = c[4], $ += n * h, T += n * ne, ce += n * fe, F += n * ue, G += n * te, H += n * oe, X += n * ae, W += n * ve, J += n * de, Y += n * _e, V += n * ge, K += n * me, q += n * Ee, k += n * Ae, B += n * Ce, D += n * Me, n = c[5], T += n * h, ce += n * ne, F += n * fe, G += n * ue, H += n * te, X += n * oe, W += n * ae, J += n * ve, Y += n * de, V += n * _e, K += n * ge, q += n * me, k += n * Ee, B += n * Ae, D += n * Ce, N += n * Me, n = c[6], ce += n * h, F += n * ne, G += n * fe, H += n * ue, X += n * te, W += n * oe, J += n * ae, Y += n * ve, V += n * de, K += n * _e, q += n * ge, k += n * me, B += n * Ee, D += n * Ae, N += n * Ce, v += n * Me, n = c[7], F += n * h, G += n * ne, H += n * fe, X += n * ue, W += n * te, J += n * oe, Y += n * ae, V += n * ve, K += n * de, q += n * _e, k += n * ge, B += n * me, D += n * Ee, N += n * Ae, v += n * Ce, p += n * Me, n = c[8], G += n * h, H += n * ne, X += n * fe, W += n * ue, J += n * te, Y += n * oe, V += n * ae, K += n * ve, q += n * de, k += n * _e, B += n * ge, D += n * me, N += n * Ee, v += n * Ae, p += n * Ce, C += n * Me, n = c[9], H += n * h, X += n * ne, W += n * fe, J += n * ue, Y += n * te, V += n * oe, K += n * ae, q += n * ve, k += n * de, B += n * _e, D += n * ge, N += n * me, v += n * Ee, p += n * Ae, C += n * Ce, S += n * Me, n = c[10], X += n * h, W += n * ne, J += n * fe, Y += n * ue, V += n * te, K += n * oe, q += n * ae, k += n * ve, B += n * de, D += n * _e, N += n * ge, v += n * me, p += n * Ee, C += n * Ae, S += n * Ce, A += n * Me, n = c[11], W += n * h, J += n * ne, Y += n * fe, V += n * ue, K += n * te, q += n * oe, k += n * ae, B += n * ve, D += n * de, N += n * _e, v += n * ge, p += n * me, C += n * Ee, S += n * Ae, A += n * Ce, M += n * Me, n = c[12], J += n * h, Y += n * ne, V += n * fe, K += n * ue, q += n * te, k += n * oe, B += n * ae, D += n * ve, N += n * de, v += n * _e, p += n * ge, C += n * me, S += n * Ee, A += n * Ae, M += n * Ce, z += n * Me, n = c[13], Y += n * h, V += n * ne, K += n * fe, q += n * ue, k += n * te, B += n * oe, D += n * ae, N += n * ve, v += n * de, p += n * _e, C += n * ge, S += n * me, A += n * Ee, M += n * Ae, z += n * Ce, Z += n * Me, n = c[14], V += n * h, K += n * ne, q += n * fe, k += n * ue, B += n * te, D += n * oe, N += n * ae, v += n * ve, p += n * de, C += n * _e, S += n * ge, A += n * me, M += n * Ee, z += n * Ae, Z += n * Ce, ee += n * Me, n = c[15], K += n * h, q += n * ne, k += n * fe, B += n * ue, D += n * te, N += n * oe, v += n * ae, p += n * ve, C += n * de, S += n * _e, A += n * ge, M += n * me, z += n * Ee, Z += n * Ae, ee += n * Ce, Q += n * Me, y += 38 * q, _ += 38 * k, O += 38 * B, I += 38 * D, $ += 38 * N, T += 38 * v, ce += 38 * p, F += 38 * C, G += 38 * S, H += 38 * A, X += 38 * M, W += 38 * z, J += 38 * Z, Y += 38 * ee, V += 38 * Q, f = 1, n = y + f + 65535, f = Math.floor(n / 65536), y = n - f * 65536, n = _ + f + 65535, f = Math.floor(n / 65536), _ = n - f * 65536, n = O + f + 65535, f = Math.floor(n / 65536), O = n - f * 65536, n = I + f + 65535, f = Math.floor(n / 65536), I = n - f * 65536, n = $ + f + 65535, f = Math.floor(n / 65536), $ = n - f * 65536, n = T + f + 65535, f = Math.floor(n / 65536), T = n - f * 65536, n = ce + f + 65535, f = Math.floor(n / 65536), ce = n - f * 65536, n = F + f + 65535, f = Math.floor(n / 65536), F = n - f * 65536, n = G + f + 65535, f = Math.floor(n / 65536), G = n - f * 65536, n = H + f + 65535, f = Math.floor(n / 65536), H = n - f * 65536, n = X + f + 65535, f = Math.floor(n / 65536), X = n - f * 65536, n = W + f + 65535, f = Math.floor(n / 65536), W = n - f * 65536, n = J + f + 65535, f = Math.floor(n / 65536), J = n - f * 65536, n = Y + f + 65535, f = Math.floor(n / 65536), Y = n - f * 65536, n = V + f + 65535, f = Math.floor(n / 65536), V = n - f * 65536, n = K + f + 65535, f = Math.floor(n / 65536), K = n - f * 65536, y += f - 1 + 37 * (f - 1), f = 1, n = y + f + 65535, f = Math.floor(n / 65536), y = n - f * 65536, n = _ + f + 65535, f = Math.floor(n / 65536), _ = n - f * 65536, n = O + f + 65535, f = Math.floor(n / 65536), O = n - f * 65536, n = I + f + 65535, f = Math.floor(n / 65536), I = n - f * 65536, n = $ + f + 65535, f = Math.floor(n / 65536), $ = n - f * 65536, n = T + f + 65535, f = Math.floor(n / 65536), T = n - f * 65536, n = ce + f + 65535, f = Math.floor(n / 65536), ce = n - f * 65536, n = F + f + 65535, f = Math.floor(n / 65536), F = n - f * 65536, n = G + f + 65535, f = Math.floor(n / 65536), G = n - f * 65536, n = H + f + 65535, f = Math.floor(n / 65536), H = n - f * 65536, n = X + f + 65535, f = Math.floor(n / 65536), X = n - f * 65536, n = W + f + 65535, f = Math.floor(n / 65536), W = n - f * 65536, n = J + f + 65535, f = Math.floor(n / 65536), J = n - f * 65536, n = Y + f + 65535, f = Math.floor(n / 65536), Y = n - f * 65536, n = V + f + 65535, f = Math.floor(n / 65536), V = n - f * 65536, n = K + f + 65535, f = Math.floor(n / 65536), K = n - f * 65536, y += f - 1 + 37 * (f - 1), s[0] = y, s[1] = _, s[2] = O, s[3] = I, s[4] = $, s[5] = T, s[6] = ce, s[7] = F, s[8] = G, s[9] = H, s[10] = X, s[11] = W, s[12] = J, s[13] = Y, s[14] = V, s[15] = K;
|
|
2678
2678
|
}
|
|
2679
2679
|
function Fe(s, c) {
|
|
2680
2680
|
se(s, c, c);
|
|
2681
2681
|
}
|
|
2682
2682
|
function Hr(s, c) {
|
|
2683
|
-
var
|
|
2683
|
+
var a = r(), n;
|
|
2684
2684
|
for (n = 0; n < 16; n++)
|
|
2685
|
-
|
|
2685
|
+
a[n] = c[n];
|
|
2686
2686
|
for (n = 253; n >= 0; n--)
|
|
2687
|
-
Fe(
|
|
2687
|
+
Fe(a, a), n !== 2 && n !== 4 && se(a, a, c);
|
|
2688
2688
|
for (n = 0; n < 16; n++)
|
|
2689
|
-
s[n] =
|
|
2689
|
+
s[n] = a[n];
|
|
2690
2690
|
}
|
|
2691
|
-
function
|
|
2692
|
-
var
|
|
2691
|
+
function Jr(s, c) {
|
|
2692
|
+
var a = r(), n;
|
|
2693
2693
|
for (n = 0; n < 16; n++)
|
|
2694
|
-
|
|
2694
|
+
a[n] = c[n];
|
|
2695
2695
|
for (n = 250; n >= 0; n--)
|
|
2696
|
-
Fe(
|
|
2696
|
+
Fe(a, a), n !== 1 && se(a, a, c);
|
|
2697
2697
|
for (n = 0; n < 16; n++)
|
|
2698
|
-
s[n] =
|
|
2698
|
+
s[n] = a[n];
|
|
2699
2699
|
}
|
|
2700
|
-
function Dt(s, c,
|
|
2701
|
-
var n = new Uint8Array(32), f = new Float64Array(80), y, _, O = r(),
|
|
2700
|
+
function Dt(s, c, a) {
|
|
2701
|
+
var n = new Uint8Array(32), f = new Float64Array(80), y, _, O = r(), I = r(), $ = r(), T = r(), ce = r(), F = r();
|
|
2702
2702
|
for (_ = 0; _ < 31; _++)
|
|
2703
2703
|
n[_] = c[_];
|
|
2704
|
-
for (n[31] = c[31] & 127 | 64, n[0] &= 248, ur(f,
|
|
2705
|
-
|
|
2706
|
-
for (O[0] =
|
|
2707
|
-
y = n[_ >>> 3] >>> (_ & 7) & 1,
|
|
2704
|
+
for (n[31] = c[31] & 127 | 64, n[0] &= 248, ur(f, a), _ = 0; _ < 16; _++)
|
|
2705
|
+
I[_] = f[_], T[_] = O[_] = $[_] = 0;
|
|
2706
|
+
for (O[0] = T[0] = 1, _ = 254; _ >= 0; --_)
|
|
2707
|
+
y = n[_ >>> 3] >>> (_ & 7) & 1, Te(O, I, y), Te($, T, y), Ke(ce, O, $), Be(O, O, $), Ke($, I, T), Be(I, I, T), Fe(T, ce), Fe(F, O), se(O, $, O), se($, I, ce), Ke(ce, O, $), Be(O, O, $), Fe(I, O), Be($, T, F), se(O, $, P), Ke(O, O, T), se($, $, O), se(O, T, F), se(T, I, f), Fe(I, ce), Te(O, I, y), Te($, T, y);
|
|
2708
2708
|
for (_ = 0; _ < 16; _++)
|
|
2709
|
-
f[_ + 16] = O[_], f[_ + 32] = $[_], f[_ + 48] =
|
|
2709
|
+
f[_ + 16] = O[_], f[_ + 32] = $[_], f[_ + 48] = I[_], f[_ + 64] = T[_];
|
|
2710
2710
|
var G = f.subarray(32), H = f.subarray(16);
|
|
2711
2711
|
return Hr(G, G), se(H, H, G), Re(s, H), 0;
|
|
2712
2712
|
}
|
|
2713
2713
|
function $t(s, c) {
|
|
2714
2714
|
return Dt(s, c, u);
|
|
2715
2715
|
}
|
|
2716
|
-
function
|
|
2716
|
+
function Vr(s, c) {
|
|
2717
2717
|
return i(c, 32), $t(s, c);
|
|
2718
2718
|
}
|
|
2719
|
-
function qt(s, c,
|
|
2719
|
+
function qt(s, c, a) {
|
|
2720
2720
|
var n = new Uint8Array(32);
|
|
2721
|
-
return Dt(n,
|
|
2721
|
+
return Dt(n, a, c), he(s, o, n, le);
|
|
2722
2722
|
}
|
|
2723
|
-
var Yr = Pe,
|
|
2724
|
-
function
|
|
2723
|
+
var Yr = Pe, oi = qe;
|
|
2724
|
+
function ai(s, c, a, n, f, y) {
|
|
2725
2725
|
var _ = new Uint8Array(32);
|
|
2726
|
-
return qt(_, f, y), Yr(s, c,
|
|
2726
|
+
return qt(_, f, y), Yr(s, c, a, n, _);
|
|
2727
2727
|
}
|
|
2728
|
-
function ci(s, c,
|
|
2728
|
+
function ci(s, c, a, n, f, y) {
|
|
2729
2729
|
var _ = new Uint8Array(32);
|
|
2730
|
-
return qt(_, f, y),
|
|
2730
|
+
return qt(_, f, y), oi(s, c, a, n, _);
|
|
2731
2731
|
}
|
|
2732
2732
|
var Wr = [
|
|
2733
2733
|
1116352408,
|
|
@@ -2891,126 +2891,126 @@ const is = {}, ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
2891
2891
|
1816402316,
|
|
2892
2892
|
1246189591
|
|
2893
2893
|
];
|
|
2894
|
-
function Xr(s, c,
|
|
2895
|
-
for (var f = new Int32Array(16), y = new Int32Array(16), _, O,
|
|
2894
|
+
function Xr(s, c, a, n) {
|
|
2895
|
+
for (var f = new Int32Array(16), y = new Int32Array(16), _, O, I, $, T, ce, F, G, H, X, W, J, Y, V, K, q, k, B, D, N, v, p, C, S, A, M, z = s[0], Z = s[1], ee = s[2], Q = s[3], h = s[4], ne = s[5], fe = s[6], ue = s[7], te = c[0], oe = c[1], ae = c[2], ve = c[3], de = c[4], _e = c[5], ge = c[6], me = c[7], Ee = 0; n >= 128; ) {
|
|
2896
2896
|
for (D = 0; D < 16; D++)
|
|
2897
|
-
|
|
2897
|
+
N = 8 * D + Ee, f[D] = a[N + 0] << 24 | a[N + 1] << 16 | a[N + 2] << 8 | a[N + 3], y[D] = a[N + 4] << 24 | a[N + 5] << 16 | a[N + 6] << 8 | a[N + 7];
|
|
2898
2898
|
for (D = 0; D < 80; D++)
|
|
2899
|
-
if (_ = z, O = Z,
|
|
2900
|
-
for (
|
|
2901
|
-
v = f[
|
|
2902
|
-
v = z,
|
|
2899
|
+
if (_ = z, O = Z, I = ee, $ = Q, T = h, ce = ne, F = fe, G = ue, H = te, X = oe, W = ae, J = ve, Y = de, V = _e, K = ge, q = me, v = ue, p = me, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = (h >>> 14 | de << 18) ^ (h >>> 18 | de << 14) ^ (de >>> 9 | h << 23), p = (de >>> 14 | h << 18) ^ (de >>> 18 | h << 14) ^ (h >>> 9 | de << 23), C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, v = h & ne ^ ~h & fe, p = de & _e ^ ~de & ge, C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, v = Wr[D * 2], p = Wr[D * 2 + 1], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, v = f[D % 16], p = y[D % 16], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, k = A & 65535 | M << 16, B = C & 65535 | S << 16, v = k, p = B, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = (z >>> 28 | te << 4) ^ (te >>> 2 | z << 30) ^ (te >>> 7 | z << 25), p = (te >>> 28 | z << 4) ^ (z >>> 2 | te << 30) ^ (z >>> 7 | te << 25), C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, v = z & Z ^ z & ee ^ Z & ee, p = te & oe ^ te & ae ^ oe & ae, C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, G = A & 65535 | M << 16, q = C & 65535 | S << 16, v = $, p = J, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = k, p = B, C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, $ = A & 65535 | M << 16, J = C & 65535 | S << 16, Z = _, ee = O, Q = I, h = $, ne = T, fe = ce, ue = F, z = G, oe = H, ae = X, ve = W, de = J, _e = Y, ge = V, me = K, te = q, D % 16 === 15)
|
|
2900
|
+
for (N = 0; N < 16; N++)
|
|
2901
|
+
v = f[N], p = y[N], C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = f[(N + 9) % 16], p = y[(N + 9) % 16], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, k = f[(N + 1) % 16], B = y[(N + 1) % 16], v = (k >>> 1 | B << 31) ^ (k >>> 8 | B << 24) ^ k >>> 7, p = (B >>> 1 | k << 31) ^ (B >>> 8 | k << 24) ^ (B >>> 7 | k << 25), C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, k = f[(N + 14) % 16], B = y[(N + 14) % 16], v = (k >>> 19 | B << 13) ^ (B >>> 29 | k << 3) ^ k >>> 6, p = (B >>> 19 | k << 13) ^ (k >>> 29 | B << 3) ^ (B >>> 6 | k << 26), C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, f[N] = A & 65535 | M << 16, y[N] = C & 65535 | S << 16;
|
|
2902
|
+
v = z, p = te, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = s[0], p = c[0], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, s[0] = z = A & 65535 | M << 16, c[0] = te = C & 65535 | S << 16, v = Z, p = oe, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = s[1], p = c[1], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, s[1] = Z = A & 65535 | M << 16, c[1] = oe = C & 65535 | S << 16, v = ee, p = ae, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = s[2], p = c[2], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, s[2] = ee = A & 65535 | M << 16, c[2] = ae = C & 65535 | S << 16, v = Q, p = ve, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = s[3], p = c[3], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, s[3] = Q = A & 65535 | M << 16, c[3] = ve = C & 65535 | S << 16, v = h, p = de, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = s[4], p = c[4], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, s[4] = h = A & 65535 | M << 16, c[4] = de = C & 65535 | S << 16, v = ne, p = _e, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = s[5], p = c[5], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, s[5] = ne = A & 65535 | M << 16, c[5] = _e = C & 65535 | S << 16, v = fe, p = ge, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = s[6], p = c[6], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, s[6] = fe = A & 65535 | M << 16, c[6] = ge = C & 65535 | S << 16, v = ue, p = me, C = p & 65535, S = p >>> 16, A = v & 65535, M = v >>> 16, v = s[7], p = c[7], C += p & 65535, S += p >>> 16, A += v & 65535, M += v >>> 16, S += C >>> 16, A += S >>> 16, M += A >>> 16, s[7] = ue = A & 65535 | M << 16, c[7] = me = C & 65535 | S << 16, Ee += 128, n -= 128;
|
|
2903
2903
|
}
|
|
2904
2904
|
return n;
|
|
2905
2905
|
}
|
|
2906
|
-
function et(s, c,
|
|
2907
|
-
var n = new Int32Array(8), f = new Int32Array(8), y = new Uint8Array(256), _, O =
|
|
2908
|
-
for (n[0] = 1779033703, n[1] = 3144134277, n[2] = 1013904242, n[3] = 2773480762, n[4] = 1359893119, n[5] = 2600822924, n[6] = 528734635, n[7] = 1541459225, f[0] = 4089235720, f[1] = 2227873595, f[2] = 4271175723, f[3] = 1595750129, f[4] = 2917565137, f[5] = 725511199, f[6] = 4215389547, f[7] = 327033209, Xr(n, f, c,
|
|
2909
|
-
y[_] = c[O -
|
|
2910
|
-
for (y[
|
|
2906
|
+
function et(s, c, a) {
|
|
2907
|
+
var n = new Int32Array(8), f = new Int32Array(8), y = new Uint8Array(256), _, O = a;
|
|
2908
|
+
for (n[0] = 1779033703, n[1] = 3144134277, n[2] = 1013904242, n[3] = 2773480762, n[4] = 1359893119, n[5] = 2600822924, n[6] = 528734635, n[7] = 1541459225, f[0] = 4089235720, f[1] = 2227873595, f[2] = 4271175723, f[3] = 1595750129, f[4] = 2917565137, f[5] = 725511199, f[6] = 4215389547, f[7] = 327033209, Xr(n, f, c, a), a %= 128, _ = 0; _ < a; _++)
|
|
2909
|
+
y[_] = c[O - a + _];
|
|
2910
|
+
for (y[a] = 128, a = 256 - 128 * (a < 112 ? 1 : 0), y[a - 9] = 0, R(y, a - 8, O / 536870912 | 0, O << 3), Xr(n, f, y, a), _ = 0; _ < 8; _++)
|
|
2911
2911
|
R(s, 8 * _, n[_], f[_]);
|
|
2912
2912
|
return 0;
|
|
2913
2913
|
}
|
|
2914
2914
|
function zt(s, c) {
|
|
2915
|
-
var
|
|
2916
|
-
Be(
|
|
2915
|
+
var a = r(), n = r(), f = r(), y = r(), _ = r(), O = r(), I = r(), $ = r(), T = r();
|
|
2916
|
+
Be(a, s[1], s[0]), Be(T, c[1], c[0]), se(a, a, T), Ke(n, s[0], s[1]), Ke(T, c[0], c[1]), se(n, n, T), se(f, s[3], c[3]), se(f, f, E), se(y, s[2], c[2]), Ke(y, y, y), Be(_, n, a), Be(O, y, f), Ke(I, y, f), Ke($, n, a), se(s[0], _, O), se(s[1], $, I), se(s[2], I, O), se(s[3], _, $);
|
|
2917
2917
|
}
|
|
2918
|
-
function Zr(s, c,
|
|
2918
|
+
function Zr(s, c, a) {
|
|
2919
2919
|
var n;
|
|
2920
2920
|
for (n = 0; n < 4; n++)
|
|
2921
|
-
|
|
2921
|
+
Te(s[n], c[n], a);
|
|
2922
2922
|
}
|
|
2923
2923
|
function hr(s, c) {
|
|
2924
|
-
var
|
|
2925
|
-
Hr(f, c[2]), se(
|
|
2924
|
+
var a = r(), n = r(), f = r();
|
|
2925
|
+
Hr(f, c[2]), se(a, c[0], f), se(n, c[1], f), Re(s, n), s[31] ^= Gr(a) << 7;
|
|
2926
2926
|
}
|
|
2927
|
-
function lr(s, c,
|
|
2927
|
+
function lr(s, c, a) {
|
|
2928
2928
|
var n, f;
|
|
2929
|
-
for (Se(s[0],
|
|
2930
|
-
n =
|
|
2929
|
+
for (Se(s[0], l), Se(s[1], m), Se(s[2], m), Se(s[3], l), f = 255; f >= 0; --f)
|
|
2930
|
+
n = a[f / 8 | 0] >> (f & 7) & 1, Zr(s, c, n), zt(c, s), zt(s, s), Zr(s, c, n);
|
|
2931
2931
|
}
|
|
2932
2932
|
function Gt(s, c) {
|
|
2933
|
-
var
|
|
2934
|
-
Se(
|
|
2933
|
+
var a = [r(), r(), r(), r()];
|
|
2934
|
+
Se(a[0], w), Se(a[1], b), Se(a[2], m), se(a[3], w, b), lr(s, a, c);
|
|
2935
2935
|
}
|
|
2936
|
-
function dr(s, c,
|
|
2936
|
+
function dr(s, c, a) {
|
|
2937
2937
|
var n = new Uint8Array(64), f = [r(), r(), r(), r()], y;
|
|
2938
|
-
for (
|
|
2938
|
+
for (a || i(c, 32), et(n, c, 32), n[0] &= 248, n[31] &= 127, n[31] |= 64, Gt(f, n), hr(s, f), y = 0; y < 32; y++)
|
|
2939
2939
|
c[y + 32] = s[y];
|
|
2940
2940
|
return 0;
|
|
2941
2941
|
}
|
|
2942
2942
|
var Ht = new Float64Array([237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]);
|
|
2943
2943
|
function br(s, c) {
|
|
2944
|
-
var
|
|
2944
|
+
var a, n, f, y;
|
|
2945
2945
|
for (n = 63; n >= 32; --n) {
|
|
2946
|
-
for (
|
|
2947
|
-
c[f] +=
|
|
2948
|
-
c[f] +=
|
|
2946
|
+
for (a = 0, f = n - 32, y = n - 12; f < y; ++f)
|
|
2947
|
+
c[f] += a - 16 * c[n] * Ht[f - (n - 32)], a = Math.floor((c[f] + 128) / 256), c[f] -= a * 256;
|
|
2948
|
+
c[f] += a, c[n] = 0;
|
|
2949
2949
|
}
|
|
2950
|
-
for (
|
|
2951
|
-
c[f] +=
|
|
2950
|
+
for (a = 0, f = 0; f < 32; f++)
|
|
2951
|
+
c[f] += a - (c[31] >> 4) * Ht[f], a = c[f] >> 8, c[f] &= 255;
|
|
2952
2952
|
for (f = 0; f < 32; f++)
|
|
2953
|
-
c[f] -=
|
|
2953
|
+
c[f] -= a * Ht[f];
|
|
2954
2954
|
for (n = 0; n < 32; n++)
|
|
2955
2955
|
c[n + 1] += c[n] >> 8, s[n] = c[n] & 255;
|
|
2956
2956
|
}
|
|
2957
2957
|
function yr(s) {
|
|
2958
|
-
var c = new Float64Array(64),
|
|
2959
|
-
for (
|
|
2960
|
-
c[
|
|
2961
|
-
for (
|
|
2962
|
-
s[
|
|
2958
|
+
var c = new Float64Array(64), a;
|
|
2959
|
+
for (a = 0; a < 64; a++)
|
|
2960
|
+
c[a] = s[a];
|
|
2961
|
+
for (a = 0; a < 64; a++)
|
|
2962
|
+
s[a] = 0;
|
|
2963
2963
|
br(s, c);
|
|
2964
2964
|
}
|
|
2965
|
-
function Qr(s, c,
|
|
2966
|
-
var f = new Uint8Array(64), y = new Uint8Array(64), _ = new Uint8Array(64), O,
|
|
2965
|
+
function Qr(s, c, a, n) {
|
|
2966
|
+
var f = new Uint8Array(64), y = new Uint8Array(64), _ = new Uint8Array(64), O, I, $ = new Float64Array(64), T = [r(), r(), r(), r()];
|
|
2967
2967
|
et(f, n, 32), f[0] &= 248, f[31] &= 127, f[31] |= 64;
|
|
2968
|
-
var ce =
|
|
2969
|
-
for (O = 0; O <
|
|
2968
|
+
var ce = a + 64;
|
|
2969
|
+
for (O = 0; O < a; O++)
|
|
2970
2970
|
s[64 + O] = c[O];
|
|
2971
2971
|
for (O = 0; O < 32; O++)
|
|
2972
2972
|
s[32 + O] = f[32 + O];
|
|
2973
|
-
for (et(_, s.subarray(32),
|
|
2973
|
+
for (et(_, s.subarray(32), a + 32), yr(_), Gt(T, _), hr(s, T), O = 32; O < 64; O++)
|
|
2974
2974
|
s[O] = n[O];
|
|
2975
|
-
for (et(y, s,
|
|
2975
|
+
for (et(y, s, a + 64), yr(y), O = 0; O < 64; O++)
|
|
2976
2976
|
$[O] = 0;
|
|
2977
2977
|
for (O = 0; O < 32; O++)
|
|
2978
2978
|
$[O] = _[O];
|
|
2979
2979
|
for (O = 0; O < 32; O++)
|
|
2980
|
-
for (
|
|
2981
|
-
$[O +
|
|
2980
|
+
for (I = 0; I < 32; I++)
|
|
2981
|
+
$[O + I] += y[O] * f[I];
|
|
2982
2982
|
return br(s.subarray(32), $), ce;
|
|
2983
2983
|
}
|
|
2984
2984
|
function fi(s, c) {
|
|
2985
|
-
var
|
|
2986
|
-
return Se(s[2], m), ur(s[1], c), Fe(f, s[1]), se(y, f, g), Be(f, f, s[2]), Ke(y, s[2], y), Fe(_, y), Fe(O, _), se(
|
|
2985
|
+
var a = r(), n = r(), f = r(), y = r(), _ = r(), O = r(), I = r();
|
|
2986
|
+
return Se(s[2], m), ur(s[1], c), Fe(f, s[1]), se(y, f, g), Be(f, f, s[2]), Ke(y, s[2], y), Fe(_, y), Fe(O, _), se(I, O, _), se(a, I, f), se(a, a, y), Jr(a, a), se(a, a, f), se(a, a, y), se(a, a, y), se(s[0], a, y), Fe(n, s[0]), se(n, n, y), zr(n, f) && se(s[0], s[0], x), Fe(n, s[0]), se(n, n, y), zr(n, f) ? -1 : (Gr(s[0]) === c[31] >> 7 && Be(s[0], l, s[0]), se(s[3], s[0], s[1]), 0);
|
|
2987
2987
|
}
|
|
2988
|
-
function _r(s, c,
|
|
2989
|
-
var f, y = new Uint8Array(32), _ = new Uint8Array(64), O = [r(), r(), r(), r()],
|
|
2990
|
-
if (
|
|
2988
|
+
function _r(s, c, a, n) {
|
|
2989
|
+
var f, y = new Uint8Array(32), _ = new Uint8Array(64), O = [r(), r(), r(), r()], I = [r(), r(), r(), r()];
|
|
2990
|
+
if (a < 64 || fi(I, n))
|
|
2991
2991
|
return -1;
|
|
2992
|
-
for (f = 0; f <
|
|
2992
|
+
for (f = 0; f < a; f++)
|
|
2993
2993
|
s[f] = c[f];
|
|
2994
2994
|
for (f = 0; f < 32; f++)
|
|
2995
2995
|
s[f + 32] = n[f];
|
|
2996
|
-
if (et(_, s,
|
|
2997
|
-
for (f = 0; f <
|
|
2996
|
+
if (et(_, s, a), yr(_), lr(O, I, _), Gt(I, c.subarray(32)), zt(O, I), hr(y, O), a -= 64, ie(c, 0, y, 0)) {
|
|
2997
|
+
for (f = 0; f < a; f++)
|
|
2998
2998
|
s[f] = 0;
|
|
2999
2999
|
return -1;
|
|
3000
3000
|
}
|
|
3001
|
-
for (f = 0; f <
|
|
3001
|
+
for (f = 0; f < a; f++)
|
|
3002
3002
|
s[f] = c[f + 64];
|
|
3003
|
-
return
|
|
3003
|
+
return a;
|
|
3004
3004
|
}
|
|
3005
|
-
var gr = 32,
|
|
3005
|
+
var gr = 32, Jt = 24, wt = 32, ht = 16, Pt = 32, Vt = 32, St = 32, Ot = 32, mr = 32, en = Jt, ui = wt, hi = ht, Je = 64, tt = 32, lt = 64, vr = 32, xr = 64;
|
|
3006
3006
|
e.lowlevel = {
|
|
3007
3007
|
crypto_core_hsalsa20: he,
|
|
3008
3008
|
crypto_stream_xor: ct,
|
|
3009
|
-
crypto_stream:
|
|
3009
|
+
crypto_stream: at,
|
|
3010
3010
|
crypto_stream_salsa20_xor: $e,
|
|
3011
|
-
crypto_stream_salsa20:
|
|
3011
|
+
crypto_stream_salsa20: pt,
|
|
3012
3012
|
crypto_onetimeauth: ut,
|
|
3013
|
-
crypto_onetimeauth_verify:
|
|
3013
|
+
crypto_onetimeauth_verify: Et,
|
|
3014
3014
|
crypto_verify_16: U,
|
|
3015
3015
|
crypto_verify_32: ie,
|
|
3016
3016
|
crypto_secretbox: Pe,
|
|
@@ -3019,26 +3019,26 @@ const is = {}, ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
3019
3019
|
crypto_scalarmult_base: $t,
|
|
3020
3020
|
crypto_box_beforenm: qt,
|
|
3021
3021
|
crypto_box_afternm: Yr,
|
|
3022
|
-
crypto_box:
|
|
3022
|
+
crypto_box: ai,
|
|
3023
3023
|
crypto_box_open: ci,
|
|
3024
|
-
crypto_box_keypair:
|
|
3024
|
+
crypto_box_keypair: Vr,
|
|
3025
3025
|
crypto_hash: et,
|
|
3026
3026
|
crypto_sign: Qr,
|
|
3027
3027
|
crypto_sign_keypair: dr,
|
|
3028
3028
|
crypto_sign_open: _r,
|
|
3029
3029
|
crypto_secretbox_KEYBYTES: gr,
|
|
3030
|
-
crypto_secretbox_NONCEBYTES:
|
|
3030
|
+
crypto_secretbox_NONCEBYTES: Jt,
|
|
3031
3031
|
crypto_secretbox_ZEROBYTES: wt,
|
|
3032
3032
|
crypto_secretbox_BOXZEROBYTES: ht,
|
|
3033
3033
|
crypto_scalarmult_BYTES: Pt,
|
|
3034
|
-
crypto_scalarmult_SCALARBYTES:
|
|
3034
|
+
crypto_scalarmult_SCALARBYTES: Vt,
|
|
3035
3035
|
crypto_box_PUBLICKEYBYTES: St,
|
|
3036
3036
|
crypto_box_SECRETKEYBYTES: Ot,
|
|
3037
3037
|
crypto_box_BEFORENMBYTES: mr,
|
|
3038
3038
|
crypto_box_NONCEBYTES: en,
|
|
3039
3039
|
crypto_box_ZEROBYTES: ui,
|
|
3040
3040
|
crypto_box_BOXZEROBYTES: hi,
|
|
3041
|
-
crypto_sign_BYTES:
|
|
3041
|
+
crypto_sign_BYTES: Je,
|
|
3042
3042
|
crypto_sign_PUBLICKEYBYTES: tt,
|
|
3043
3043
|
crypto_sign_SECRETKEYBYTES: lt,
|
|
3044
3044
|
crypto_sign_SEEDBYTES: vr,
|
|
@@ -3052,7 +3052,7 @@ const is = {}, ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
3052
3052
|
A: Ke,
|
|
3053
3053
|
S: Fe,
|
|
3054
3054
|
Z: Be,
|
|
3055
|
-
pow2523:
|
|
3055
|
+
pow2523: Jr,
|
|
3056
3056
|
add: zt,
|
|
3057
3057
|
set25519: Se,
|
|
3058
3058
|
modL: br,
|
|
@@ -3062,7 +3062,7 @@ const is = {}, ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
3062
3062
|
function tn(s, c) {
|
|
3063
3063
|
if (s.length !== gr)
|
|
3064
3064
|
throw new Error("bad key size");
|
|
3065
|
-
if (c.length !==
|
|
3065
|
+
if (c.length !== Jt)
|
|
3066
3066
|
throw new Error("bad nonce size");
|
|
3067
3067
|
}
|
|
3068
3068
|
function li(s, c) {
|
|
@@ -3083,41 +3083,41 @@ const is = {}, ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
3083
3083
|
e.randomBytes = function(s) {
|
|
3084
3084
|
var c = new Uint8Array(s);
|
|
3085
3085
|
return i(c, s), c;
|
|
3086
|
-
}, e.secretbox = function(s, c,
|
|
3087
|
-
ke(s, c,
|
|
3086
|
+
}, e.secretbox = function(s, c, a) {
|
|
3087
|
+
ke(s, c, a), tn(a, c);
|
|
3088
3088
|
for (var n = new Uint8Array(wt + s.length), f = new Uint8Array(n.length), y = 0; y < s.length; y++)
|
|
3089
3089
|
n[y + wt] = s[y];
|
|
3090
|
-
return Pe(f, n, n.length, c,
|
|
3091
|
-
}, e.secretbox.open = function(s, c,
|
|
3092
|
-
ke(s, c,
|
|
3090
|
+
return Pe(f, n, n.length, c, a), f.subarray(ht);
|
|
3091
|
+
}, e.secretbox.open = function(s, c, a) {
|
|
3092
|
+
ke(s, c, a), tn(a, c);
|
|
3093
3093
|
for (var n = new Uint8Array(ht + s.length), f = new Uint8Array(n.length), y = 0; y < s.length; y++)
|
|
3094
3094
|
n[y + ht] = s[y];
|
|
3095
|
-
return n.length < 32 || qe(f, n, n.length, c,
|
|
3096
|
-
}, e.secretbox.keyLength = gr, e.secretbox.nonceLength =
|
|
3097
|
-
if (ke(s, c), s.length !==
|
|
3095
|
+
return n.length < 32 || qe(f, n, n.length, c, a) !== 0 ? null : f.subarray(wt);
|
|
3096
|
+
}, e.secretbox.keyLength = gr, e.secretbox.nonceLength = Jt, e.secretbox.overheadLength = ht, e.scalarMult = function(s, c) {
|
|
3097
|
+
if (ke(s, c), s.length !== Vt)
|
|
3098
3098
|
throw new Error("bad n size");
|
|
3099
3099
|
if (c.length !== Pt)
|
|
3100
3100
|
throw new Error("bad p size");
|
|
3101
|
-
var
|
|
3102
|
-
return Dt(
|
|
3101
|
+
var a = new Uint8Array(Pt);
|
|
3102
|
+
return Dt(a, s, c), a;
|
|
3103
3103
|
}, e.scalarMult.base = function(s) {
|
|
3104
|
-
if (ke(s), s.length !==
|
|
3104
|
+
if (ke(s), s.length !== Vt)
|
|
3105
3105
|
throw new Error("bad n size");
|
|
3106
3106
|
var c = new Uint8Array(Pt);
|
|
3107
3107
|
return $t(c, s), c;
|
|
3108
|
-
}, e.scalarMult.scalarLength =
|
|
3109
|
-
var f = e.box.before(
|
|
3108
|
+
}, e.scalarMult.scalarLength = Vt, e.scalarMult.groupElementLength = Pt, e.box = function(s, c, a, n) {
|
|
3109
|
+
var f = e.box.before(a, n);
|
|
3110
3110
|
return e.secretbox(s, c, f);
|
|
3111
3111
|
}, e.box.before = function(s, c) {
|
|
3112
3112
|
ke(s, c), li(s, c);
|
|
3113
|
-
var
|
|
3114
|
-
return qt(
|
|
3115
|
-
}, e.box.after = e.secretbox, e.box.open = function(s, c,
|
|
3116
|
-
var f = e.box.before(
|
|
3113
|
+
var a = new Uint8Array(mr);
|
|
3114
|
+
return qt(a, s, c), a;
|
|
3115
|
+
}, e.box.after = e.secretbox, e.box.open = function(s, c, a, n) {
|
|
3116
|
+
var f = e.box.before(a, n);
|
|
3117
3117
|
return e.secretbox.open(s, c, f);
|
|
3118
3118
|
}, e.box.open.after = e.secretbox.open, e.box.keyPair = function() {
|
|
3119
3119
|
var s = new Uint8Array(St), c = new Uint8Array(Ot);
|
|
3120
|
-
return
|
|
3120
|
+
return Vr(s, c), { publicKey: s, secretKey: c };
|
|
3121
3121
|
}, e.box.keyPair.fromSecretKey = function(s) {
|
|
3122
3122
|
if (ke(s), s.length !== Ot)
|
|
3123
3123
|
throw new Error("bad secret key size");
|
|
@@ -3126,48 +3126,48 @@ const is = {}, ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
3126
3126
|
}, e.box.publicKeyLength = St, e.box.secretKeyLength = Ot, e.box.sharedKeyLength = mr, e.box.nonceLength = en, e.box.overheadLength = e.secretbox.overheadLength, e.sign = function(s, c) {
|
|
3127
3127
|
if (ke(s, c), c.length !== lt)
|
|
3128
3128
|
throw new Error("bad secret key size");
|
|
3129
|
-
var
|
|
3130
|
-
return Qr(
|
|
3129
|
+
var a = new Uint8Array(Je + s.length);
|
|
3130
|
+
return Qr(a, s, s.length, c), a;
|
|
3131
3131
|
}, e.sign.open = function(s, c) {
|
|
3132
3132
|
if (ke(s, c), c.length !== tt)
|
|
3133
3133
|
throw new Error("bad public key size");
|
|
3134
|
-
var
|
|
3134
|
+
var a = new Uint8Array(s.length), n = _r(a, s, s.length, c);
|
|
3135
3135
|
if (n < 0)
|
|
3136
3136
|
return null;
|
|
3137
3137
|
for (var f = new Uint8Array(n), y = 0; y < f.length; y++)
|
|
3138
|
-
f[y] =
|
|
3138
|
+
f[y] = a[y];
|
|
3139
3139
|
return f;
|
|
3140
3140
|
}, e.sign.detached = function(s, c) {
|
|
3141
|
-
for (var
|
|
3142
|
-
n[f] =
|
|
3141
|
+
for (var a = e.sign(s, c), n = new Uint8Array(Je), f = 0; f < n.length; f++)
|
|
3142
|
+
n[f] = a[f];
|
|
3143
3143
|
return n;
|
|
3144
|
-
}, e.sign.detached.verify = function(s, c,
|
|
3145
|
-
if (ke(s, c,
|
|
3144
|
+
}, e.sign.detached.verify = function(s, c, a) {
|
|
3145
|
+
if (ke(s, c, a), c.length !== Je)
|
|
3146
3146
|
throw new Error("bad signature size");
|
|
3147
|
-
if (
|
|
3147
|
+
if (a.length !== tt)
|
|
3148
3148
|
throw new Error("bad public key size");
|
|
3149
|
-
var n = new Uint8Array(
|
|
3150
|
-
for (y = 0; y <
|
|
3149
|
+
var n = new Uint8Array(Je + s.length), f = new Uint8Array(Je + s.length), y;
|
|
3150
|
+
for (y = 0; y < Je; y++)
|
|
3151
3151
|
n[y] = c[y];
|
|
3152
3152
|
for (y = 0; y < s.length; y++)
|
|
3153
|
-
n[y +
|
|
3154
|
-
return _r(f, n, n.length,
|
|
3153
|
+
n[y + Je] = s[y];
|
|
3154
|
+
return _r(f, n, n.length, a) >= 0;
|
|
3155
3155
|
}, e.sign.keyPair = function() {
|
|
3156
3156
|
var s = new Uint8Array(tt), c = new Uint8Array(lt);
|
|
3157
3157
|
return dr(s, c), { publicKey: s, secretKey: c };
|
|
3158
3158
|
}, e.sign.keyPair.fromSecretKey = function(s) {
|
|
3159
3159
|
if (ke(s), s.length !== lt)
|
|
3160
3160
|
throw new Error("bad secret key size");
|
|
3161
|
-
for (var c = new Uint8Array(tt),
|
|
3162
|
-
c[
|
|
3161
|
+
for (var c = new Uint8Array(tt), a = 0; a < c.length; a++)
|
|
3162
|
+
c[a] = s[32 + a];
|
|
3163
3163
|
return { publicKey: c, secretKey: new Uint8Array(s) };
|
|
3164
3164
|
}, e.sign.keyPair.fromSeed = function(s) {
|
|
3165
3165
|
if (ke(s), s.length !== vr)
|
|
3166
3166
|
throw new Error("bad seed size");
|
|
3167
|
-
for (var c = new Uint8Array(tt),
|
|
3168
|
-
|
|
3169
|
-
return dr(c,
|
|
3170
|
-
}, e.sign.publicKeyLength = tt, e.sign.secretKeyLength = lt, e.sign.seedLength = vr, e.sign.signatureLength =
|
|
3167
|
+
for (var c = new Uint8Array(tt), a = new Uint8Array(lt), n = 0; n < 32; n++)
|
|
3168
|
+
a[n] = s[n];
|
|
3169
|
+
return dr(c, a, !0), { publicKey: c, secretKey: a };
|
|
3170
|
+
}, e.sign.publicKeyLength = tt, e.sign.secretKeyLength = lt, e.sign.seedLength = vr, e.sign.signatureLength = Je, e.hash = function(s) {
|
|
3171
3171
|
ke(s);
|
|
3172
3172
|
var c = new Uint8Array(xr);
|
|
3173
3173
|
return et(c, s, s.length), c;
|
|
@@ -3179,44 +3179,44 @@ const is = {}, ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
3179
3179
|
var s = typeof self < "u" ? self.crypto || self.msCrypto : null;
|
|
3180
3180
|
if (s && s.getRandomValues) {
|
|
3181
3181
|
var c = 65536;
|
|
3182
|
-
e.setPRNG(function(
|
|
3182
|
+
e.setPRNG(function(a, n) {
|
|
3183
3183
|
var f, y = new Uint8Array(n);
|
|
3184
3184
|
for (f = 0; f < n; f += c)
|
|
3185
3185
|
s.getRandomValues(y.subarray(f, f + Math.min(n - f, c)));
|
|
3186
3186
|
for (f = 0; f < n; f++)
|
|
3187
|
-
|
|
3187
|
+
a[f] = y[f];
|
|
3188
3188
|
rn(y);
|
|
3189
3189
|
});
|
|
3190
3190
|
} else
|
|
3191
|
-
typeof ns < "u" && (s =
|
|
3191
|
+
typeof ns < "u" && (s = os, s && s.randomBytes && e.setPRNG(function(a, n) {
|
|
3192
3192
|
var f, y = s.randomBytes(n);
|
|
3193
3193
|
for (f = 0; f < n; f++)
|
|
3194
|
-
|
|
3194
|
+
a[f] = y[f];
|
|
3195
3195
|
rn(y);
|
|
3196
3196
|
}));
|
|
3197
3197
|
}();
|
|
3198
3198
|
})(t.exports ? t.exports : self.nacl = self.nacl || {});
|
|
3199
|
-
})(
|
|
3200
|
-
var
|
|
3199
|
+
})(Vn);
|
|
3200
|
+
var as = Vn.exports, cs = pe && pe.__importDefault || function(t) {
|
|
3201
3201
|
return t && t.__esModule ? t : { default: t };
|
|
3202
3202
|
};
|
|
3203
3203
|
Object.defineProperty(vt, "__esModule", { value: !0 });
|
|
3204
|
-
const fs = cs(
|
|
3204
|
+
const fs = cs(as);
|
|
3205
3205
|
vt.default = fs.default;
|
|
3206
3206
|
var yn;
|
|
3207
3207
|
function us() {
|
|
3208
3208
|
if (yn)
|
|
3209
3209
|
return At;
|
|
3210
3210
|
yn = 1;
|
|
3211
|
-
var t =
|
|
3211
|
+
var t = pe && pe.__importDefault || function(u) {
|
|
3212
3212
|
return u && u.__esModule ? u : { default: u };
|
|
3213
3213
|
};
|
|
3214
3214
|
Object.defineProperty(At, "__esModule", { value: !0 }), At.KP = void 0;
|
|
3215
|
-
const e =
|
|
3216
|
-
class
|
|
3217
|
-
constructor(
|
|
3218
|
-
|
|
3219
|
-
this.seed =
|
|
3215
|
+
const e = or(), r = _t(), i = t(vt);
|
|
3216
|
+
class o {
|
|
3217
|
+
constructor(l) {
|
|
3218
|
+
d(this, "seed");
|
|
3219
|
+
this.seed = l;
|
|
3220
3220
|
}
|
|
3221
3221
|
getRawSeed() {
|
|
3222
3222
|
if (!this.seed)
|
|
@@ -3231,53 +3231,53 @@ function us() {
|
|
|
3231
3231
|
getPublicKey() {
|
|
3232
3232
|
if (!this.seed)
|
|
3233
3233
|
throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);
|
|
3234
|
-
const
|
|
3234
|
+
const l = e.Codec.decodeSeed(this.seed), m = i.default.sign.keyPair.fromSeed(this.getRawSeed()), P = e.Codec.encode(l.prefix, m.publicKey);
|
|
3235
3235
|
return new TextDecoder().decode(P);
|
|
3236
3236
|
}
|
|
3237
3237
|
getPrivateKey() {
|
|
3238
3238
|
if (!this.seed)
|
|
3239
3239
|
throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);
|
|
3240
|
-
const
|
|
3241
|
-
return e.Codec.encode(r.Prefix.Private,
|
|
3240
|
+
const l = i.default.sign.keyPair.fromSeed(this.getRawSeed());
|
|
3241
|
+
return e.Codec.encode(r.Prefix.Private, l.secretKey);
|
|
3242
3242
|
}
|
|
3243
|
-
sign(
|
|
3243
|
+
sign(l) {
|
|
3244
3244
|
if (!this.seed)
|
|
3245
3245
|
throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);
|
|
3246
3246
|
const m = i.default.sign.keyPair.fromSeed(this.getRawSeed());
|
|
3247
|
-
return i.default.sign.detached(
|
|
3247
|
+
return i.default.sign.detached(l, m.secretKey);
|
|
3248
3248
|
}
|
|
3249
|
-
verify(
|
|
3249
|
+
verify(l, m) {
|
|
3250
3250
|
if (!this.seed)
|
|
3251
3251
|
throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);
|
|
3252
3252
|
const P = i.default.sign.keyPair.fromSeed(this.getRawSeed());
|
|
3253
|
-
return i.default.sign.detached.verify(
|
|
3253
|
+
return i.default.sign.detached.verify(l, m, P.publicKey);
|
|
3254
3254
|
}
|
|
3255
3255
|
clear() {
|
|
3256
3256
|
this.seed && (this.seed.fill(0), this.seed = void 0);
|
|
3257
3257
|
}
|
|
3258
|
-
seal(
|
|
3258
|
+
seal(l, m, P) {
|
|
3259
3259
|
throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation);
|
|
3260
3260
|
}
|
|
3261
|
-
open(
|
|
3261
|
+
open(l, m) {
|
|
3262
3262
|
throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation);
|
|
3263
3263
|
}
|
|
3264
3264
|
}
|
|
3265
|
-
return At.KP =
|
|
3265
|
+
return At.KP = o, At;
|
|
3266
3266
|
}
|
|
3267
|
-
var
|
|
3267
|
+
var Mt = {}, _n;
|
|
3268
3268
|
function hs() {
|
|
3269
3269
|
if (_n)
|
|
3270
|
-
return
|
|
3270
|
+
return Mt;
|
|
3271
3271
|
_n = 1;
|
|
3272
|
-
var t =
|
|
3272
|
+
var t = pe && pe.__importDefault || function(u) {
|
|
3273
3273
|
return u && u.__esModule ? u : { default: u };
|
|
3274
3274
|
};
|
|
3275
|
-
Object.defineProperty(
|
|
3276
|
-
const e =
|
|
3277
|
-
class
|
|
3278
|
-
constructor(
|
|
3279
|
-
|
|
3280
|
-
this.publicKey =
|
|
3275
|
+
Object.defineProperty(Mt, "__esModule", { value: !0 }), Mt.PublicKey = void 0;
|
|
3276
|
+
const e = or(), r = _t(), i = t(vt);
|
|
3277
|
+
class o {
|
|
3278
|
+
constructor(l) {
|
|
3279
|
+
d(this, "publicKey");
|
|
3280
|
+
this.publicKey = l;
|
|
3281
3281
|
}
|
|
3282
3282
|
getPublicKey() {
|
|
3283
3283
|
if (!this.publicKey)
|
|
@@ -3290,42 +3290,42 @@ function hs() {
|
|
|
3290
3290
|
getSeed() {
|
|
3291
3291
|
throw this.publicKey ? new r.NKeysError(r.NKeysErrorCode.PublicKeyOnly) : new r.NKeysError(r.NKeysErrorCode.ClearedPair);
|
|
3292
3292
|
}
|
|
3293
|
-
sign(
|
|
3293
|
+
sign(l) {
|
|
3294
3294
|
throw this.publicKey ? new r.NKeysError(r.NKeysErrorCode.CannotSign) : new r.NKeysError(r.NKeysErrorCode.ClearedPair);
|
|
3295
3295
|
}
|
|
3296
|
-
verify(
|
|
3296
|
+
verify(l, m) {
|
|
3297
3297
|
if (!this.publicKey)
|
|
3298
3298
|
throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);
|
|
3299
3299
|
const P = e.Codec._decode(this.publicKey);
|
|
3300
|
-
return i.default.sign.detached.verify(
|
|
3300
|
+
return i.default.sign.detached.verify(l, m, P.slice(1));
|
|
3301
3301
|
}
|
|
3302
3302
|
clear() {
|
|
3303
3303
|
this.publicKey && (this.publicKey.fill(0), this.publicKey = void 0);
|
|
3304
3304
|
}
|
|
3305
|
-
seal(
|
|
3305
|
+
seal(l, m, P) {
|
|
3306
3306
|
throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation);
|
|
3307
3307
|
}
|
|
3308
|
-
open(
|
|
3308
|
+
open(l, m) {
|
|
3309
3309
|
throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation);
|
|
3310
3310
|
}
|
|
3311
3311
|
}
|
|
3312
|
-
return
|
|
3312
|
+
return Mt.PublicKey = o, Mt;
|
|
3313
3313
|
}
|
|
3314
3314
|
var Sr = {}, gn;
|
|
3315
3315
|
function ls() {
|
|
3316
3316
|
return gn || (gn = 1, function(t) {
|
|
3317
|
-
var e =
|
|
3317
|
+
var e = pe && pe.__importDefault || function(w) {
|
|
3318
3318
|
return w && w.__esModule ? w : { default: w };
|
|
3319
3319
|
};
|
|
3320
3320
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.CurveKP = t.curveNonceLen = t.curveKeyLen = void 0;
|
|
3321
|
-
const r = _t(), i = e(vt),
|
|
3321
|
+
const r = _t(), i = e(vt), o = or(), u = _t(), l = Kt, m = Ft;
|
|
3322
3322
|
t.curveKeyLen = 32;
|
|
3323
3323
|
const P = 35;
|
|
3324
3324
|
t.curveNonceLen = 24;
|
|
3325
3325
|
const g = [120, 107, 118, 49];
|
|
3326
|
-
class
|
|
3326
|
+
class E {
|
|
3327
3327
|
constructor(b) {
|
|
3328
|
-
|
|
3328
|
+
d(this, "seed");
|
|
3329
3329
|
this.seed = b;
|
|
3330
3330
|
}
|
|
3331
3331
|
clear() {
|
|
@@ -3334,18 +3334,18 @@ function ls() {
|
|
|
3334
3334
|
getPrivateKey() {
|
|
3335
3335
|
if (!this.seed)
|
|
3336
3336
|
throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);
|
|
3337
|
-
return
|
|
3337
|
+
return o.Codec.encode(u.Prefix.Private, this.seed);
|
|
3338
3338
|
}
|
|
3339
3339
|
getPublicKey() {
|
|
3340
3340
|
if (!this.seed)
|
|
3341
3341
|
throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);
|
|
3342
|
-
const b = i.default.scalarMult.base(this.seed), x =
|
|
3342
|
+
const b = i.default.scalarMult.base(this.seed), x = o.Codec.encode(u.Prefix.Curve, b);
|
|
3343
3343
|
return new TextDecoder().decode(x);
|
|
3344
3344
|
}
|
|
3345
3345
|
getSeed() {
|
|
3346
3346
|
if (!this.seed)
|
|
3347
3347
|
throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);
|
|
3348
|
-
return
|
|
3348
|
+
return o.Codec.encodeSeed(u.Prefix.Curve, this.seed);
|
|
3349
3349
|
}
|
|
3350
3350
|
sign() {
|
|
3351
3351
|
throw new r.NKeysError(r.NKeysErrorCode.InvalidCurveOperation);
|
|
@@ -3355,7 +3355,7 @@ function ls() {
|
|
|
3355
3355
|
}
|
|
3356
3356
|
decodePubCurveKey(b) {
|
|
3357
3357
|
try {
|
|
3358
|
-
const x =
|
|
3358
|
+
const x = l.base32.decode(new TextEncoder().encode(b));
|
|
3359
3359
|
if (x.byteLength !== P)
|
|
3360
3360
|
throw new r.NKeysError(r.NKeysErrorCode.InvalidCurveKey);
|
|
3361
3361
|
if (x[0] !== u.Prefix.Curve)
|
|
@@ -3391,7 +3391,7 @@ function ls() {
|
|
|
3391
3391
|
return b = b.slice(t.curveNonceLen), i.default.box.open(b, j, R, this.seed);
|
|
3392
3392
|
}
|
|
3393
3393
|
}
|
|
3394
|
-
t.CurveKP =
|
|
3394
|
+
t.CurveKP = E;
|
|
3395
3395
|
}(Sr)), Sr;
|
|
3396
3396
|
}
|
|
3397
3397
|
var mn;
|
|
@@ -3399,32 +3399,32 @@ function _t() {
|
|
|
3399
3399
|
if (mn)
|
|
3400
3400
|
return xe;
|
|
3401
3401
|
mn = 1;
|
|
3402
|
-
var t =
|
|
3402
|
+
var t = pe && pe.__importDefault || function(L) {
|
|
3403
3403
|
return L && L.__esModule ? L : { default: L };
|
|
3404
3404
|
};
|
|
3405
|
-
Object.defineProperty(xe, "__esModule", { value: !0 }), xe.NKeysError = xe.NKeysErrorCode = xe.Prefixes = xe.Prefix = void 0, xe.createPair =
|
|
3406
|
-
const e = us(), r = hs(), i =
|
|
3407
|
-
function
|
|
3408
|
-
const he = L === U.Curve ?
|
|
3409
|
-
return L === U.Curve ? new
|
|
3405
|
+
Object.defineProperty(xe, "__esModule", { value: !0 }), xe.NKeysError = xe.NKeysErrorCode = xe.Prefixes = xe.Prefix = void 0, xe.createPair = l, xe.createOperator = m, xe.createAccount = P, xe.createUser = g, xe.createCluster = E, xe.createServer = w, xe.createCurve = b, xe.fromPublic = x, xe.fromCurveSeed = R, xe.fromSeed = j;
|
|
3406
|
+
const e = us(), r = hs(), i = or(), o = ls(), u = t(vt);
|
|
3407
|
+
function l(L) {
|
|
3408
|
+
const he = L === U.Curve ? o.curveKeyLen : 32, le = u.default.randomBytes(he), $e = i.Codec.encodeSeed(L, new Uint8Array(le));
|
|
3409
|
+
return L === U.Curve ? new o.CurveKP(new Uint8Array(le)) : new e.KP($e);
|
|
3410
3410
|
}
|
|
3411
3411
|
function m() {
|
|
3412
|
-
return
|
|
3412
|
+
return l(U.Operator);
|
|
3413
3413
|
}
|
|
3414
3414
|
function P() {
|
|
3415
|
-
return
|
|
3415
|
+
return l(U.Account);
|
|
3416
3416
|
}
|
|
3417
3417
|
function g() {
|
|
3418
|
-
return
|
|
3418
|
+
return l(U.User);
|
|
3419
3419
|
}
|
|
3420
|
-
function
|
|
3421
|
-
return
|
|
3420
|
+
function E() {
|
|
3421
|
+
return l(U.Cluster);
|
|
3422
3422
|
}
|
|
3423
3423
|
function w() {
|
|
3424
|
-
return
|
|
3424
|
+
return l(U.Server);
|
|
3425
3425
|
}
|
|
3426
3426
|
function b() {
|
|
3427
|
-
return
|
|
3427
|
+
return l(U.Curve);
|
|
3428
3428
|
}
|
|
3429
3429
|
function x(L) {
|
|
3430
3430
|
const he = new TextEncoder().encode(L), le = i.Codec._decode(he), $e = ie.parsePrefix(le[0]);
|
|
@@ -3436,9 +3436,9 @@ function _t() {
|
|
|
3436
3436
|
const he = i.Codec.decodeSeed(L);
|
|
3437
3437
|
if (he.prefix !== U.Curve)
|
|
3438
3438
|
throw new Le(ye.InvalidCurveSeed);
|
|
3439
|
-
if (he.buf.byteLength !==
|
|
3439
|
+
if (he.buf.byteLength !== o.curveKeyLen)
|
|
3440
3440
|
throw new Le(ye.InvalidSeedLen);
|
|
3441
|
-
return new
|
|
3441
|
+
return new o.CurveKP(he.buf);
|
|
3442
3442
|
}
|
|
3443
3443
|
function j(L) {
|
|
3444
3444
|
return i.Codec.decodeSeed(L).prefix === U.Curve ? R(L) : new e.KP(L);
|
|
@@ -3489,7 +3489,7 @@ function _t() {
|
|
|
3489
3489
|
class Le extends Error {
|
|
3490
3490
|
constructor(le, $e) {
|
|
3491
3491
|
super(le, $e);
|
|
3492
|
-
|
|
3492
|
+
d(this, "code");
|
|
3493
3493
|
this.code = le;
|
|
3494
3494
|
}
|
|
3495
3495
|
}
|
|
@@ -3515,15 +3515,15 @@ function ys(t, e) {
|
|
|
3515
3515
|
for (let i = 0; i < t.byteLength; i++) {
|
|
3516
3516
|
i % 8 === 0 && r.push(`
|
|
3517
3517
|
`);
|
|
3518
|
-
let
|
|
3519
|
-
|
|
3518
|
+
let o = t[i].toString(16);
|
|
3519
|
+
o.length === 1 && (o = "0" + o), r.push(o);
|
|
3520
3520
|
}
|
|
3521
3521
|
console.log(r.join(" "));
|
|
3522
3522
|
}
|
|
3523
|
-
var
|
|
3524
|
-
Object.defineProperty(
|
|
3525
|
-
|
|
3526
|
-
|
|
3523
|
+
var ar = {};
|
|
3524
|
+
Object.defineProperty(ar, "__esModule", { value: !0 });
|
|
3525
|
+
ar.version = void 0;
|
|
3526
|
+
ar.version = "2.0.3";
|
|
3527
3527
|
(function(t) {
|
|
3528
3528
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.version = t.encode = t.decode = t.Prefixes = t.Prefix = t.NKeysErrorCode = t.NKeysError = t.fromSeed = t.fromPublic = t.fromCurveSeed = t.createUser = t.createServer = t.createPair = t.createOperator = t.createCurve = t.createCluster = t.createAccount = void 0;
|
|
3529
3529
|
var e = _t();
|
|
@@ -3562,29 +3562,29 @@ or.version = "2.0.3";
|
|
|
3562
3562
|
} }), Object.defineProperty(t, "encode", { enumerable: !0, get: function() {
|
|
3563
3563
|
return r.encode;
|
|
3564
3564
|
} });
|
|
3565
|
-
var i =
|
|
3565
|
+
var i = ar;
|
|
3566
3566
|
Object.defineProperty(t, "version", { enumerable: !0, get: function() {
|
|
3567
3567
|
return i.version;
|
|
3568
3568
|
} });
|
|
3569
|
-
})(
|
|
3570
|
-
var _s =
|
|
3569
|
+
})(Jn);
|
|
3570
|
+
var _s = pe && pe.__createBinding || (Object.create ? function(t, e, r, i) {
|
|
3571
3571
|
i === void 0 && (i = r);
|
|
3572
|
-
var
|
|
3573
|
-
(!
|
|
3572
|
+
var o = Object.getOwnPropertyDescriptor(e, r);
|
|
3573
|
+
(!o || ("get" in o ? !e.__esModule : o.writable || o.configurable)) && (o = { enumerable: !0, get: function() {
|
|
3574
3574
|
return e[r];
|
|
3575
|
-
} }), Object.defineProperty(t, i,
|
|
3575
|
+
} }), Object.defineProperty(t, i, o);
|
|
3576
3576
|
} : function(t, e, r, i) {
|
|
3577
3577
|
i === void 0 && (i = r), t[i] = e[r];
|
|
3578
|
-
}), gs =
|
|
3578
|
+
}), gs = pe && pe.__setModuleDefault || (Object.create ? function(t, e) {
|
|
3579
3579
|
Object.defineProperty(t, "default", { enumerable: !0, value: e });
|
|
3580
3580
|
} : function(t, e) {
|
|
3581
3581
|
t.default = e;
|
|
3582
|
-
}), ms =
|
|
3582
|
+
}), ms = pe && pe.__importStar || /* @__PURE__ */ function() {
|
|
3583
3583
|
var t = function(e) {
|
|
3584
3584
|
return t = Object.getOwnPropertyNames || function(r) {
|
|
3585
3585
|
var i = [];
|
|
3586
|
-
for (var
|
|
3587
|
-
Object.prototype.hasOwnProperty.call(r,
|
|
3586
|
+
for (var o in r)
|
|
3587
|
+
Object.prototype.hasOwnProperty.call(r, o) && (i[i.length] = o);
|
|
3588
3588
|
return i;
|
|
3589
3589
|
}, t(e);
|
|
3590
3590
|
};
|
|
@@ -3593,29 +3593,29 @@ var _s = Ee && Ee.__createBinding || (Object.create ? function(t, e, r, i) {
|
|
|
3593
3593
|
return e;
|
|
3594
3594
|
var r = {};
|
|
3595
3595
|
if (e != null)
|
|
3596
|
-
for (var i = t(e),
|
|
3597
|
-
i[
|
|
3596
|
+
for (var i = t(e), o = 0; o < i.length; o++)
|
|
3597
|
+
i[o] !== "default" && _s(r, e, i[o]);
|
|
3598
3598
|
return gs(r, e), r;
|
|
3599
3599
|
};
|
|
3600
3600
|
}();
|
|
3601
3601
|
Object.defineProperty(Lt, "__esModule", { value: !0 });
|
|
3602
3602
|
Lt.nkeys = void 0;
|
|
3603
|
-
Lt.nkeys = ms(
|
|
3603
|
+
Lt.nkeys = ms(Jn);
|
|
3604
3604
|
Object.defineProperty(He, "__esModule", { value: !0 });
|
|
3605
3605
|
He.multiAuthenticator = vs;
|
|
3606
3606
|
He.noAuthFn = xs;
|
|
3607
|
-
He.usernamePasswordAuthenticator =
|
|
3608
|
-
He.tokenAuthenticator =
|
|
3607
|
+
He.usernamePasswordAuthenticator = ps;
|
|
3608
|
+
He.tokenAuthenticator = Es;
|
|
3609
3609
|
He.nkeyAuthenticator = Yn;
|
|
3610
3610
|
He.jwtAuthenticator = Wn;
|
|
3611
3611
|
He.credsAuthenticator = ws;
|
|
3612
|
-
const vn = Lt,
|
|
3612
|
+
const vn = Lt, Tr = Ue;
|
|
3613
3613
|
function vs(t) {
|
|
3614
3614
|
return (e) => {
|
|
3615
3615
|
let r = {};
|
|
3616
3616
|
return t.forEach((i) => {
|
|
3617
|
-
const
|
|
3618
|
-
r = Object.assign(r,
|
|
3617
|
+
const o = i(e) || {};
|
|
3618
|
+
r = Object.assign(r, o);
|
|
3619
3619
|
}), r;
|
|
3620
3620
|
};
|
|
3621
3621
|
}
|
|
@@ -3623,37 +3623,37 @@ function xs() {
|
|
|
3623
3623
|
return () => {
|
|
3624
3624
|
};
|
|
3625
3625
|
}
|
|
3626
|
-
function
|
|
3626
|
+
function ps(t, e) {
|
|
3627
3627
|
return () => {
|
|
3628
3628
|
const r = typeof t == "function" ? t() : t, i = typeof e == "function" ? e() : e;
|
|
3629
3629
|
return { user: r, pass: i };
|
|
3630
3630
|
};
|
|
3631
3631
|
}
|
|
3632
|
-
function
|
|
3632
|
+
function Es(t) {
|
|
3633
3633
|
return () => ({ auth_token: typeof t == "function" ? t() : t });
|
|
3634
3634
|
}
|
|
3635
3635
|
function Yn(t) {
|
|
3636
3636
|
return (e) => {
|
|
3637
|
-
const r = typeof t == "function" ? t() : t, i = r ? vn.nkeys.fromSeed(r) : void 0,
|
|
3638
|
-
return { nkey:
|
|
3637
|
+
const r = typeof t == "function" ? t() : t, i = r ? vn.nkeys.fromSeed(r) : void 0, o = i ? i.getPublicKey() : "", u = Tr.TE.encode(e || ""), l = i !== void 0 && e ? i.sign(u) : void 0, m = l ? vn.nkeys.encode(l) : "";
|
|
3638
|
+
return { nkey: o, sig: m };
|
|
3639
3639
|
};
|
|
3640
3640
|
}
|
|
3641
3641
|
function Wn(t, e) {
|
|
3642
3642
|
return (r) => {
|
|
3643
|
-
const i = typeof t == "function" ? t() : t,
|
|
3644
|
-
return { jwt: i, nkey: u, sig:
|
|
3643
|
+
const i = typeof t == "function" ? t() : t, o = Yn(e), { nkey: u, sig: l } = o(r);
|
|
3644
|
+
return { jwt: i, nkey: u, sig: l };
|
|
3645
3645
|
};
|
|
3646
3646
|
}
|
|
3647
3647
|
function ws(t) {
|
|
3648
3648
|
const e = typeof t != "function" ? () => t : t, r = () => {
|
|
3649
|
-
const u = /\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/ig,
|
|
3650
|
-
let m = u.exec(
|
|
3649
|
+
const u = /\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/ig, l = Tr.TD.decode(e());
|
|
3650
|
+
let m = u.exec(l);
|
|
3651
3651
|
if (!m)
|
|
3652
3652
|
throw new Error("unable to parse credentials");
|
|
3653
3653
|
const P = m[1].trim();
|
|
3654
|
-
if (m = u.exec(
|
|
3654
|
+
if (m = u.exec(l), !m)
|
|
3655
3655
|
throw new Error("unable to parse credentials");
|
|
3656
|
-
const g =
|
|
3656
|
+
const g = Tr.TE.encode(m[1].trim());
|
|
3657
3657
|
return { jwt: P, seed: g };
|
|
3658
3658
|
};
|
|
3659
3659
|
return Wn(() => {
|
|
@@ -3665,10 +3665,10 @@ function ws(t) {
|
|
|
3665
3665
|
});
|
|
3666
3666
|
}
|
|
3667
3667
|
(function(t) {
|
|
3668
|
-
Object.defineProperty(t, "__esModule", { value: !0 }), t.DEFAULT_RECONNECT_TIME_WAIT = t.DEFAULT_MAX_PING_OUT = t.DEFAULT_PING_INTERVAL = t.DEFAULT_JITTER_TLS = t.DEFAULT_JITTER = t.DEFAULT_MAX_RECONNECT_ATTEMPTS = void 0, t.defaultOptions =
|
|
3669
|
-
const e = be, r = st, i =
|
|
3668
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), t.DEFAULT_RECONNECT_TIME_WAIT = t.DEFAULT_MAX_PING_OUT = t.DEFAULT_PING_INTERVAL = t.DEFAULT_JITTER_TLS = t.DEFAULT_JITTER = t.DEFAULT_MAX_RECONNECT_ATTEMPTS = void 0, t.defaultOptions = l, t.hasWsProtocol = m, t.buildAuthenticator = P, t.parseOptions = g, t.checkOptions = E, t.checkUnsupportedOption = w;
|
|
3669
|
+
const e = be, r = st, i = Ie, o = He, u = re;
|
|
3670
3670
|
t.DEFAULT_MAX_RECONNECT_ATTEMPTS = 10, t.DEFAULT_JITTER = 100, t.DEFAULT_JITTER_TLS = 1e3, t.DEFAULT_PING_INTERVAL = 2 * 60 * 1e3, t.DEFAULT_MAX_PING_OUT = 2, t.DEFAULT_RECONNECT_TIME_WAIT = 2 * 1e3;
|
|
3671
|
-
function
|
|
3671
|
+
function l() {
|
|
3672
3672
|
return {
|
|
3673
3673
|
maxPingOut: t.DEFAULT_MAX_PING_OUT,
|
|
3674
3674
|
maxReconnectAttempts: t.DEFAULT_MAX_RECONNECT_ATTEMPTS,
|
|
@@ -3699,14 +3699,14 @@ function ws(t) {
|
|
|
3699
3699
|
}
|
|
3700
3700
|
function P(b) {
|
|
3701
3701
|
const x = [];
|
|
3702
|
-
return typeof b.authenticator == "function" && x.push(b.authenticator), Array.isArray(b.authenticator) && x.push(...b.authenticator), b.token && x.push((0,
|
|
3702
|
+
return typeof b.authenticator == "function" && x.push(b.authenticator), Array.isArray(b.authenticator) && x.push(...b.authenticator), b.token && x.push((0, o.tokenAuthenticator)(b.token)), b.user && x.push((0, o.usernamePasswordAuthenticator)(b.user, b.pass)), x.length === 0 ? (0, o.noAuthFn)() : (0, o.multiAuthenticator)(x);
|
|
3703
3703
|
}
|
|
3704
3704
|
function g(b) {
|
|
3705
3705
|
const x = `${i.DEFAULT_HOST}:${(0, r.defaultPort)()}`;
|
|
3706
3706
|
if (b = b || { servers: [x] }, b.servers = b.servers || [], typeof b.servers == "string" && (b.servers = [b.servers]), b.servers.length > 0 && b.port)
|
|
3707
3707
|
throw u.InvalidArgumentError.format(["servers", "port"], "are mutually exclusive");
|
|
3708
3708
|
b.servers.length === 0 && b.port && (b.servers = [`${i.DEFAULT_HOST}:${b.port}`]), b.servers && b.servers.length === 0 && (b.servers = [x]);
|
|
3709
|
-
const R = (0, e.extend)(
|
|
3709
|
+
const R = (0, e.extend)(l(), b);
|
|
3710
3710
|
if (R.authenticator = P(R), ["reconnectDelayHandler", "authenticator"].forEach((j) => {
|
|
3711
3711
|
if (R[j] && typeof R[j] != "function")
|
|
3712
3712
|
throw TypeError(`'${j}' must be a function`);
|
|
@@ -3717,7 +3717,7 @@ function ws(t) {
|
|
|
3717
3717
|
throw u.InvalidArgumentError.format("resolve", "is not supported in the current runtime");
|
|
3718
3718
|
return R;
|
|
3719
3719
|
}
|
|
3720
|
-
function
|
|
3720
|
+
function E(b, x) {
|
|
3721
3721
|
const { proto: R, tls_required: j, tls_available: U } = b;
|
|
3722
3722
|
if ((R === void 0 || R < 1) && x.noEcho)
|
|
3723
3723
|
throw new u.errors.ConnectionError("server does not support 'noEcho'");
|
|
@@ -3732,40 +3732,40 @@ function ws(t) {
|
|
|
3732
3732
|
})(Ut);
|
|
3733
3733
|
Object.defineProperty(je, "__esModule", { value: !0 });
|
|
3734
3734
|
je.ProtocolHandler = je.Subscriptions = je.SubscriptionImpl = je.Connect = je.INFO = void 0;
|
|
3735
|
-
const ze = Ue, rt = st, Ge = be, Ps =
|
|
3735
|
+
const ze = Ue, rt = st, Ge = be, Ps = ot, Ss = We, Os = mt, As = Tt, Cs = Rt, Ze = Lr, Ms = kt, xn = sr, Or = Ut, Oe = re, Is = 1024 * 32;
|
|
3736
3736
|
je.INFO = /^INFO\s+([^\r\n]+)\r\n/i;
|
|
3737
3737
|
const js = (0, ze.encode)(`PONG\r
|
|
3738
|
-
`),
|
|
3738
|
+
`), pn = (0, ze.encode)(`PING\r
|
|
3739
3739
|
`);
|
|
3740
3740
|
class Xn {
|
|
3741
3741
|
constructor(e, r, i) {
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3742
|
+
d(this, "echo");
|
|
3743
|
+
d(this, "no_responders");
|
|
3744
|
+
d(this, "protocol");
|
|
3745
|
+
d(this, "verbose");
|
|
3746
|
+
d(this, "pedantic");
|
|
3747
|
+
d(this, "jwt");
|
|
3748
|
+
d(this, "nkey");
|
|
3749
|
+
d(this, "sig");
|
|
3750
|
+
d(this, "user");
|
|
3751
|
+
d(this, "pass");
|
|
3752
|
+
d(this, "auth_token");
|
|
3753
|
+
d(this, "tls_required");
|
|
3754
|
+
d(this, "name");
|
|
3755
|
+
d(this, "lang");
|
|
3756
|
+
d(this, "version");
|
|
3757
|
+
d(this, "headers");
|
|
3758
3758
|
this.protocol = 1, this.version = e.version, this.lang = e.lang, this.echo = r.noEcho ? !1 : void 0, this.verbose = r.verbose, this.pedantic = r.pedantic, this.tls_required = r.tls ? !0 : void 0, this.name = r.name;
|
|
3759
|
-
const
|
|
3760
|
-
(0, Ge.extend)(this,
|
|
3759
|
+
const o = (r && typeof r.authenticator == "function" ? r.authenticator(i) : {}) || {};
|
|
3760
|
+
(0, Ge.extend)(this, o);
|
|
3761
3761
|
}
|
|
3762
3762
|
}
|
|
3763
3763
|
je.Connect = Xn;
|
|
3764
|
-
class
|
|
3764
|
+
class Ns {
|
|
3765
3765
|
constructor(e, r) {
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3766
|
+
d(this, "slow");
|
|
3767
|
+
d(this, "cb");
|
|
3768
|
+
d(this, "notified");
|
|
3769
3769
|
this.slow = e, this.cb = r, this.notified = !1;
|
|
3770
3770
|
}
|
|
3771
3771
|
maybeNotify(e) {
|
|
@@ -3773,25 +3773,25 @@ class Ts {
|
|
|
3773
3773
|
}
|
|
3774
3774
|
}
|
|
3775
3775
|
class Zn extends Os.QueuedIteratorImpl {
|
|
3776
|
-
constructor(r, i,
|
|
3777
|
-
var
|
|
3776
|
+
constructor(r, i, o = {}) {
|
|
3777
|
+
var l;
|
|
3778
3778
|
super();
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
(0, Ge.extend)(this,
|
|
3793
|
-
const u = !((
|
|
3794
|
-
|
|
3779
|
+
d(this, "sid");
|
|
3780
|
+
d(this, "queue");
|
|
3781
|
+
d(this, "draining");
|
|
3782
|
+
d(this, "max");
|
|
3783
|
+
d(this, "subject");
|
|
3784
|
+
d(this, "drained");
|
|
3785
|
+
d(this, "protocol");
|
|
3786
|
+
d(this, "timer");
|
|
3787
|
+
d(this, "info");
|
|
3788
|
+
d(this, "cleanupFn");
|
|
3789
|
+
d(this, "closed");
|
|
3790
|
+
d(this, "requestSubject");
|
|
3791
|
+
d(this, "slow");
|
|
3792
|
+
(0, Ge.extend)(this, o), this.protocol = r, this.subject = i, this.draining = !1, this.noIterator = typeof o.callback == "function", this.closed = (0, Ge.deferred)();
|
|
3793
|
+
const u = !((l = r.options) != null && l.noAsyncTraces);
|
|
3794
|
+
o.timeout && (this.timer = (0, Ge.timeout)(o.timeout, u), this.timer.then(() => {
|
|
3795
3795
|
this.timer = void 0;
|
|
3796
3796
|
}).catch((m) => {
|
|
3797
3797
|
this.stop(m), this.noIterator && this.callback(m, {});
|
|
@@ -3803,7 +3803,7 @@ class Zn extends Os.QueuedIteratorImpl {
|
|
|
3803
3803
|
if (this.slow = void 0, i) {
|
|
3804
3804
|
if (this.noIterator)
|
|
3805
3805
|
throw new Error("callbacks don't support slow notifications");
|
|
3806
|
-
this.slow = new
|
|
3806
|
+
this.slow = new Ns(r, i);
|
|
3807
3807
|
}
|
|
3808
3808
|
}
|
|
3809
3809
|
callback(r, i) {
|
|
@@ -3855,9 +3855,9 @@ class Zn extends Os.QueuedIteratorImpl {
|
|
|
3855
3855
|
je.SubscriptionImpl = Zn;
|
|
3856
3856
|
class Qn {
|
|
3857
3857
|
constructor() {
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3858
|
+
d(this, "mux");
|
|
3859
|
+
d(this, "subs");
|
|
3860
|
+
d(this, "sidCounter");
|
|
3861
3861
|
this.sidCounter = 0, this.mux = null, this.subs = /* @__PURE__ */ new Map();
|
|
3862
3862
|
}
|
|
3863
3863
|
size() {
|
|
@@ -3887,7 +3887,7 @@ class Qn {
|
|
|
3887
3887
|
handleError(e) {
|
|
3888
3888
|
const r = this.all();
|
|
3889
3889
|
let i;
|
|
3890
|
-
return e.operation === "subscription" ? i = r.find((
|
|
3890
|
+
return e.operation === "subscription" ? i = r.find((o) => o.subject === e.subject && o.queue === e.queue) : e.operation === "publish" && (i = r.find((o) => o.requestSubject === e.subject)), i ? (i.callback(e, {}), i.close(e), this.subs.delete(i.sid), i !== this.mux) : !1;
|
|
3891
3891
|
}
|
|
3892
3892
|
close() {
|
|
3893
3893
|
this.subs.forEach((e) => {
|
|
@@ -3898,39 +3898,39 @@ class Qn {
|
|
|
3898
3898
|
je.Subscriptions = Qn;
|
|
3899
3899
|
class er {
|
|
3900
3900
|
constructor(e, r) {
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
this._closed = !1, this.connected = !1, this.connectedOnce = !1, this.infoReceived = !1, this.noMorePublishing = !1, this.abortReconnect = !1, this.listeners = [], this.pendingLimit =
|
|
3901
|
+
d(this, "connected");
|
|
3902
|
+
d(this, "connectedOnce");
|
|
3903
|
+
d(this, "infoReceived");
|
|
3904
|
+
d(this, "info");
|
|
3905
|
+
d(this, "muxSubscriptions");
|
|
3906
|
+
d(this, "options");
|
|
3907
|
+
d(this, "outbound");
|
|
3908
|
+
d(this, "pongs");
|
|
3909
|
+
d(this, "subscriptions");
|
|
3910
|
+
d(this, "transport");
|
|
3911
|
+
d(this, "noMorePublishing");
|
|
3912
|
+
d(this, "connectError");
|
|
3913
|
+
d(this, "publisher");
|
|
3914
|
+
d(this, "_closed");
|
|
3915
|
+
d(this, "closed");
|
|
3916
|
+
d(this, "listeners");
|
|
3917
|
+
d(this, "heartbeats");
|
|
3918
|
+
d(this, "parser");
|
|
3919
|
+
d(this, "outMsgs");
|
|
3920
|
+
d(this, "inMsgs");
|
|
3921
|
+
d(this, "outBytes");
|
|
3922
|
+
d(this, "inBytes");
|
|
3923
|
+
d(this, "pendingLimit");
|
|
3924
|
+
d(this, "lastError");
|
|
3925
|
+
d(this, "abortReconnect");
|
|
3926
|
+
d(this, "whyClosed");
|
|
3927
|
+
d(this, "servers");
|
|
3928
|
+
d(this, "server");
|
|
3929
|
+
d(this, "features");
|
|
3930
|
+
d(this, "connectPromise");
|
|
3931
|
+
d(this, "dialDelay");
|
|
3932
|
+
d(this, "raceTimer");
|
|
3933
|
+
this._closed = !1, this.connected = !1, this.connectedOnce = !1, this.infoReceived = !1, this.noMorePublishing = !1, this.abortReconnect = !1, this.listeners = [], this.pendingLimit = Is, this.outMsgs = 0, this.inMsgs = 0, this.outBytes = 0, this.inBytes = 0, this.options = e, this.publisher = r, this.subscriptions = new Qn(), this.muxSubscriptions = new As.MuxSubscription(), this.outbound = new Ps.DataBuffer(), this.pongs = [], this.whyClosed = "", this.pendingLimit = e.pendingLimit || this.pendingLimit, this.features = new xn.Features({ major: 0, minor: 0, micro: 0 }), this.connectPromise = null, this.dialDelay = null;
|
|
3934
3934
|
const i = typeof e.servers == "string" ? [e.servers] : e.servers;
|
|
3935
3935
|
this.servers = new Ss.Servers(i, {
|
|
3936
3936
|
randomize: !e.noRandomize
|
|
@@ -3985,17 +3985,17 @@ class er {
|
|
|
3985
3985
|
}) : await this.close(e).catch();
|
|
3986
3986
|
}
|
|
3987
3987
|
async dial(e) {
|
|
3988
|
-
var i,
|
|
3988
|
+
var i, o;
|
|
3989
3989
|
const r = this.prepare();
|
|
3990
3990
|
try {
|
|
3991
3991
|
this.raceTimer = (0, Ge.timeout)(this.options.timeout || 2e4);
|
|
3992
3992
|
const u = this.transport.connect(e, this.options);
|
|
3993
3993
|
await Promise.race([u, this.raceTimer]), (async () => {
|
|
3994
3994
|
try {
|
|
3995
|
-
for await (const
|
|
3996
|
-
this.parser.parse(
|
|
3997
|
-
} catch (
|
|
3998
|
-
console.log("reader closed",
|
|
3995
|
+
for await (const l of this.transport)
|
|
3996
|
+
this.parser.parse(l);
|
|
3997
|
+
} catch (l) {
|
|
3998
|
+
console.log("reader closed", l);
|
|
3999
3999
|
}
|
|
4000
4000
|
})().then();
|
|
4001
4001
|
} catch (u) {
|
|
@@ -4004,7 +4004,7 @@ class er {
|
|
|
4004
4004
|
try {
|
|
4005
4005
|
await Promise.race([this.raceTimer, r]), (i = this.raceTimer) == null || i.cancel(), this.connected = !0, this.connectError = void 0, this.sendSubscriptions(), this.connectedOnce = !0, this.server.didConnect = !0, this.server.reconnects = 0, this.flushPending(), this.heartbeats.start();
|
|
4006
4006
|
} catch (u) {
|
|
4007
|
-
throw (
|
|
4007
|
+
throw (o = this.raceTimer) == null || o.cancel(), await this.transport.close(u), u;
|
|
4008
4008
|
}
|
|
4009
4009
|
}
|
|
4010
4010
|
async _doDial(e) {
|
|
@@ -4014,15 +4014,15 @@ class er {
|
|
|
4014
4014
|
randomize: !this.options.noRandomize,
|
|
4015
4015
|
resolve: r
|
|
4016
4016
|
});
|
|
4017
|
-
let
|
|
4017
|
+
let o = null;
|
|
4018
4018
|
for (const u of i)
|
|
4019
4019
|
try {
|
|
4020
|
-
|
|
4020
|
+
o = null, this.dispatchStatus({ type: "reconnecting" }), await this.dial(u);
|
|
4021
4021
|
return;
|
|
4022
|
-
} catch (
|
|
4023
|
-
|
|
4022
|
+
} catch (l) {
|
|
4023
|
+
o = l;
|
|
4024
4024
|
}
|
|
4025
|
-
throw
|
|
4025
|
+
throw o;
|
|
4026
4026
|
}
|
|
4027
4027
|
dialLoop() {
|
|
4028
4028
|
return this.connectPromise === null && (this.connectPromise = this.dodialLoop(), this.connectPromise.then(() => {
|
|
@@ -4037,27 +4037,27 @@ class er {
|
|
|
4037
4037
|
this._closed && this.servers.clear();
|
|
4038
4038
|
const r = this.options.reconnectDelayHandler ? this.options.reconnectDelayHandler() : Or.DEFAULT_RECONNECT_TIME_WAIT;
|
|
4039
4039
|
let i = r;
|
|
4040
|
-
const
|
|
4041
|
-
if (!
|
|
4040
|
+
const o = this.selectServer();
|
|
4041
|
+
if (!o || this.abortReconnect)
|
|
4042
4042
|
throw e || (this.lastError ? this.lastError : new Oe.errors.ConnectionError("connection refused"));
|
|
4043
4043
|
const u = Date.now();
|
|
4044
|
-
if (
|
|
4045
|
-
|
|
4044
|
+
if (o.lastConnect === 0 || o.lastConnect + r <= u) {
|
|
4045
|
+
o.lastConnect = Date.now();
|
|
4046
4046
|
try {
|
|
4047
|
-
await this._doDial(
|
|
4047
|
+
await this._doDial(o);
|
|
4048
4048
|
break;
|
|
4049
|
-
} catch (
|
|
4050
|
-
if (e =
|
|
4049
|
+
} catch (l) {
|
|
4050
|
+
if (e = l, !this.connectedOnce) {
|
|
4051
4051
|
if (this.options.waitOnFirstConnect)
|
|
4052
4052
|
continue;
|
|
4053
4053
|
this.servers.removeCurrentServer();
|
|
4054
4054
|
}
|
|
4055
|
-
|
|
4055
|
+
o.reconnects++;
|
|
4056
4056
|
const m = this.options.maxReconnectAttempts || 0;
|
|
4057
|
-
m !== -1 &&
|
|
4057
|
+
m !== -1 && o.reconnects >= m && this.servers.removeCurrentServer();
|
|
4058
4058
|
}
|
|
4059
4059
|
} else
|
|
4060
|
-
i = Math.min(i,
|
|
4060
|
+
i = Math.min(i, o.lastConnect + r - u), this.dialDelay = (0, Ge.delay)(i), await this.dialDelay;
|
|
4061
4061
|
}
|
|
4062
4062
|
}
|
|
4063
4063
|
static async connect(e, r) {
|
|
@@ -4072,7 +4072,7 @@ class er {
|
|
|
4072
4072
|
if (this.inMsgs++, this.inBytes += r.length, !this.subscriptions.sidCounter)
|
|
4073
4073
|
return;
|
|
4074
4074
|
const i = this.subscriptions.get(e.sid);
|
|
4075
|
-
i && (i.received += 1, i.callback && i.callback(null, new
|
|
4075
|
+
i && (i.received += 1, i.callback && i.callback(null, new Ms.MsgImpl(e, r, this)), i.max !== void 0 && i.received >= i.max && i.unsubscribe());
|
|
4076
4076
|
}
|
|
4077
4077
|
processError(e) {
|
|
4078
4078
|
let r = (0, ze.decode)(e);
|
|
@@ -4080,8 +4080,8 @@ class er {
|
|
|
4080
4080
|
const i = er.toError(r);
|
|
4081
4081
|
switch (i.constructor) {
|
|
4082
4082
|
case Oe.errors.PermissionViolationError: {
|
|
4083
|
-
const
|
|
4084
|
-
this.subscriptions.handleError(
|
|
4083
|
+
const o = i, u = this.subscriptions.getMux(), l = u ? o.subject === u.subject : !1;
|
|
4084
|
+
this.subscriptions.handleError(o), this.muxSubscriptions.handleError(l, o), l && this.subscriptions.setMux(null);
|
|
4085
4085
|
}
|
|
4086
4086
|
}
|
|
4087
4087
|
this.dispatchStatus({ type: "error", error: i }), this.handleError(i);
|
|
@@ -4105,19 +4105,19 @@ class er {
|
|
|
4105
4105
|
const i = this.options && this.options.ignoreClusterUpdates ? void 0 : this.servers.update(r, this.transport.isEncrypted());
|
|
4106
4106
|
if (!this.infoReceived) {
|
|
4107
4107
|
this.features.update((0, xn.parseSemVer)(r.version)), this.infoReceived = !0, this.transport.isEncrypted() && this.servers.updateTLSName();
|
|
4108
|
-
const { version: u, lang:
|
|
4108
|
+
const { version: u, lang: l } = this.transport;
|
|
4109
4109
|
try {
|
|
4110
|
-
const m = new Xn({ version: u, lang:
|
|
4110
|
+
const m = new Xn({ version: u, lang: l }, this.options, r.nonce);
|
|
4111
4111
|
r.headers && (m.headers = !0, m.no_responders = !0);
|
|
4112
4112
|
const P = JSON.stringify(m);
|
|
4113
|
-
this.transport.send((0, ze.encode)(`CONNECT ${P}${rt.CR_LF}`)), this.transport.send(
|
|
4113
|
+
this.transport.send((0, ze.encode)(`CONNECT ${P}${rt.CR_LF}`)), this.transport.send(pn);
|
|
4114
4114
|
} catch (m) {
|
|
4115
4115
|
this.close(m).catch();
|
|
4116
4116
|
}
|
|
4117
4117
|
}
|
|
4118
4118
|
if (i) {
|
|
4119
|
-
const { added: u, deleted:
|
|
4120
|
-
this.dispatchStatus({ type: "update", added: u, deleted:
|
|
4119
|
+
const { added: u, deleted: l } = i;
|
|
4120
|
+
this.dispatchStatus({ type: "update", added: u, deleted: l });
|
|
4121
4121
|
}
|
|
4122
4122
|
(r.ldm !== void 0 ? r.ldm : !1) && this.dispatchStatus({
|
|
4123
4123
|
type: "ldm",
|
|
@@ -4149,31 +4149,31 @@ class er {
|
|
|
4149
4149
|
}
|
|
4150
4150
|
sendCommand(e, ...r) {
|
|
4151
4151
|
const i = this.outbound.length();
|
|
4152
|
-
let
|
|
4153
|
-
typeof e == "string" ?
|
|
4152
|
+
let o;
|
|
4153
|
+
typeof e == "string" ? o = (0, ze.encode)(e) : o = e, this.outbound.fill(o, ...r), i === 0 ? queueMicrotask(() => {
|
|
4154
4154
|
this.flushPending();
|
|
4155
4155
|
}) : this.outbound.size() >= this.pendingLimit && this.flushPending();
|
|
4156
4156
|
}
|
|
4157
4157
|
publish(e, r = ze.Empty, i) {
|
|
4158
|
-
let
|
|
4158
|
+
let o;
|
|
4159
4159
|
if (r instanceof Uint8Array)
|
|
4160
|
-
|
|
4160
|
+
o = r;
|
|
4161
4161
|
else if (typeof r == "string")
|
|
4162
|
-
|
|
4162
|
+
o = ze.TE.encode(r);
|
|
4163
4163
|
else
|
|
4164
4164
|
throw new TypeError("payload types can be strings or Uint8Array");
|
|
4165
|
-
let u =
|
|
4165
|
+
let u = o.length;
|
|
4166
4166
|
i = i || {}, i.reply = i.reply || "";
|
|
4167
|
-
let
|
|
4168
|
-
if (i.headers && (this.info && !this.info.headers && Oe.InvalidArgumentError.format("headers", "are not available on this server"),
|
|
4167
|
+
let l = ze.Empty, m = 0;
|
|
4168
|
+
if (i.headers && (this.info && !this.info.headers && Oe.InvalidArgumentError.format("headers", "are not available on this server"), l = i.headers.encode(), m = l.length, u = o.length + m), this.info && u > this.info.max_payload)
|
|
4169
4169
|
throw Oe.InvalidArgumentError.format("payload", "max_payload size exceeded");
|
|
4170
4170
|
this.outBytes += u, this.outMsgs++;
|
|
4171
4171
|
let P;
|
|
4172
4172
|
i.headers ? (i.reply ? P = `HPUB ${e} ${i.reply} ${m} ${u}\r
|
|
4173
4173
|
` : P = `HPUB ${e} ${m} ${u}\r
|
|
4174
|
-
`, this.sendCommand(P,
|
|
4174
|
+
`, this.sendCommand(P, l, o, rt.CRLF)) : (i.reply ? P = `PUB ${e} ${i.reply} ${u}\r
|
|
4175
4175
|
` : P = `PUB ${e} ${u}\r
|
|
4176
|
-
`, this.sendCommand(P,
|
|
4176
|
+
`, this.sendCommand(P, o, rt.CRLF));
|
|
4177
4177
|
}
|
|
4178
4178
|
request(e) {
|
|
4179
4179
|
return this.initMux(), this.muxSubscriptions.add(e), e;
|
|
@@ -4201,7 +4201,7 @@ class er {
|
|
|
4201
4201
|
!e || this.isClosed() || (this.unsub(e), e.subject = r, this.subscriptions.resub(e), this._sub(e));
|
|
4202
4202
|
}
|
|
4203
4203
|
flush(e) {
|
|
4204
|
-
return e || (e = (0, Ge.deferred)()), this.pongs.push(e), this.outbound.fill(
|
|
4204
|
+
return e || (e = (0, Ge.deferred)()), this.pongs.push(e), this.outbound.fill(pn), this.flushPending(), e;
|
|
4205
4205
|
}
|
|
4206
4206
|
sendSubscriptions() {
|
|
4207
4207
|
const e = [];
|
|
@@ -4211,16 +4211,16 @@ class er {
|
|
|
4211
4211
|
}), e.length && this.transport.send((0, ze.encode)(e.join("")));
|
|
4212
4212
|
}
|
|
4213
4213
|
async close(e) {
|
|
4214
|
-
var i,
|
|
4214
|
+
var i, o;
|
|
4215
4215
|
if (this._closed)
|
|
4216
4216
|
return;
|
|
4217
4217
|
this.whyClosed = new Error("close trace").stack || "", this.heartbeats.cancel(), this.connectError && (this.connectError(e), this.connectError = void 0), this.muxSubscriptions.close(), this.subscriptions.close();
|
|
4218
4218
|
const r = [];
|
|
4219
4219
|
for (let u = 0; u < this.listeners.length; u++) {
|
|
4220
|
-
const
|
|
4221
|
-
|
|
4220
|
+
const l = this.listeners[u];
|
|
4221
|
+
l && (l.push({ type: "close" }), l.stop(), r.push(l.iterClosed));
|
|
4222
4222
|
}
|
|
4223
|
-
r.length && await Promise.all(r), this._closed = !0, await this.transport.close(e), (i = this.raceTimer) == null || i.cancel(), (
|
|
4223
|
+
r.length && await Promise.all(r), this._closed = !0, await this.transport.close(e), (i = this.raceTimer) == null || i.cancel(), (o = this.dialDelay) == null || o.cancel(), this.closed.resolve(e);
|
|
4224
4224
|
}
|
|
4225
4225
|
isClosed() {
|
|
4226
4226
|
return this._closed;
|
|
@@ -4263,33 +4263,33 @@ je.ProtocolHandler = er;
|
|
|
4263
4263
|
var Ye = {};
|
|
4264
4264
|
Object.defineProperty(Ye, "__esModule", { value: !0 });
|
|
4265
4265
|
Ye.RequestOne = Ye.RequestMany = Ye.BaseRequest = void 0;
|
|
4266
|
-
const Rr = be,
|
|
4266
|
+
const Rr = be, Ts = Nt, Zt = re;
|
|
4267
4267
|
class Dr {
|
|
4268
4268
|
constructor(e, r, i = !0) {
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
this.mux = e, this.requestSubject = r, this.received = 0, this.token =
|
|
4269
|
+
d(this, "token");
|
|
4270
|
+
d(this, "received");
|
|
4271
|
+
d(this, "ctx");
|
|
4272
|
+
d(this, "requestSubject");
|
|
4273
|
+
d(this, "mux");
|
|
4274
|
+
this.mux = e, this.requestSubject = r, this.received = 0, this.token = Ts.nuid.next(), i && (this.ctx = new Zt.RequestError());
|
|
4275
4275
|
}
|
|
4276
4276
|
}
|
|
4277
4277
|
Ye.BaseRequest = Dr;
|
|
4278
4278
|
class Rs extends Dr {
|
|
4279
|
-
constructor(r, i,
|
|
4279
|
+
constructor(r, i, o = { maxWait: 1e3 }) {
|
|
4280
4280
|
super(r, i);
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
if (this.opts =
|
|
4281
|
+
d(this, "callback");
|
|
4282
|
+
d(this, "done");
|
|
4283
|
+
d(this, "timer");
|
|
4284
|
+
d(this, "max");
|
|
4285
|
+
d(this, "opts");
|
|
4286
|
+
if (this.opts = o, typeof this.opts.callback != "function")
|
|
4287
4287
|
throw new TypeError("callback must be a function");
|
|
4288
|
-
this.callback = this.opts.callback, this.max = typeof
|
|
4288
|
+
this.callback = this.opts.callback, this.max = typeof o.maxMessages == "number" && o.maxMessages > 0 ? o.maxMessages : -1, this.done = (0, Rr.deferred)(), this.done.then(() => {
|
|
4289
4289
|
this.callback(null, null);
|
|
4290
4290
|
}), this.timer = setTimeout(() => {
|
|
4291
4291
|
this.cancel();
|
|
4292
|
-
},
|
|
4292
|
+
}, o.maxWait);
|
|
4293
4293
|
}
|
|
4294
4294
|
cancel(r) {
|
|
4295
4295
|
r && this.callback(r, null), clearTimeout(this.timer), this.mux.cancel(this), this.done.resolve();
|
|
@@ -4304,11 +4304,11 @@ ${this.ctx.stack}`), this.cancel(r)) : (this.callback(null, i), this.opts.strate
|
|
|
4304
4304
|
}
|
|
4305
4305
|
Ye.RequestMany = Rs;
|
|
4306
4306
|
class ks extends Dr {
|
|
4307
|
-
constructor(r, i,
|
|
4307
|
+
constructor(r, i, o = { timeout: 1e3 }, u = !0) {
|
|
4308
4308
|
super(r, i, u);
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
this.deferred = (0, Rr.deferred)(), this.timer = (0, Rr.timeout)(
|
|
4309
|
+
d(this, "deferred");
|
|
4310
|
+
d(this, "timer");
|
|
4311
|
+
this.deferred = (0, Rr.deferred)(), this.timer = (0, Rr.timeout)(o.timeout, u);
|
|
4312
4312
|
}
|
|
4313
4313
|
resolver(r, i) {
|
|
4314
4314
|
this.timer && this.timer.cancel(), r ? (r instanceof Zt.TimeoutError || (this.ctx ? (this.ctx.message = r.message, this.ctx.cause = r, r = this.ctx) : r = new Zt.errors.RequestError(r.message, { cause: r })), this.deferred.reject(r)) : this.deferred.resolve(i), this.cancel();
|
|
@@ -4320,20 +4320,20 @@ class ks extends Dr {
|
|
|
4320
4320
|
Ye.RequestOne = ks;
|
|
4321
4321
|
Object.defineProperty(jt, "__esModule", { value: !0 });
|
|
4322
4322
|
jt.NatsConnectionImpl = void 0;
|
|
4323
|
-
const Us = be,
|
|
4323
|
+
const Us = be, En = je, Ls = Ue, wn = Qe, Fs = sr, Ks = Ut, Pn = mt, Sn = Ye, On = Ie, we = re;
|
|
4324
4324
|
class $r {
|
|
4325
4325
|
constructor(e) {
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4326
|
+
d(this, "options");
|
|
4327
|
+
d(this, "protocol");
|
|
4328
|
+
d(this, "draining");
|
|
4329
|
+
d(this, "closeListeners");
|
|
4330
4330
|
this.draining = !1, this.options = (0, Ks.parseOptions)(e);
|
|
4331
4331
|
}
|
|
4332
4332
|
static connect(e = {}) {
|
|
4333
4333
|
return new Promise((r, i) => {
|
|
4334
|
-
const
|
|
4335
|
-
|
|
4336
|
-
|
|
4334
|
+
const o = new $r(e);
|
|
4335
|
+
En.ProtocolHandler.connect(o.options, o).then((u) => {
|
|
4336
|
+
o.protocol = u, r(o);
|
|
4337
4337
|
}).catch((u) => {
|
|
4338
4338
|
i(u);
|
|
4339
4339
|
});
|
|
@@ -4357,12 +4357,12 @@ class $r {
|
|
|
4357
4357
|
}
|
|
4358
4358
|
publish(e, r, i) {
|
|
4359
4359
|
if (this._check(e, !1, !0), i != null && i.reply && this._check(i.reply, !1, !0), typeof (i == null ? void 0 : i.traceOnly) == "boolean") {
|
|
4360
|
-
const
|
|
4361
|
-
|
|
4360
|
+
const o = i.headers || (0, wn.headers)();
|
|
4361
|
+
o.set("Nats-Trace-Only", "true"), i.headers = o;
|
|
4362
4362
|
}
|
|
4363
4363
|
if (typeof (i == null ? void 0 : i.traceDestination) == "string") {
|
|
4364
|
-
const
|
|
4365
|
-
|
|
4364
|
+
const o = i.headers || (0, wn.headers)();
|
|
4365
|
+
o.set("Nats-Trace-Dest", i.traceDestination), i.headers = o;
|
|
4366
4366
|
}
|
|
4367
4367
|
this.protocol.publish(e, r, i);
|
|
4368
4368
|
}
|
|
@@ -4380,19 +4380,19 @@ class $r {
|
|
|
4380
4380
|
}
|
|
4381
4381
|
subscribe(e, r = {}) {
|
|
4382
4382
|
this._check(e, !0, !1);
|
|
4383
|
-
const i = new
|
|
4384
|
-
return typeof r.callback != "function" && typeof r.slow == "number" && i.setSlowNotificationFn(r.slow, (
|
|
4383
|
+
const i = new En.SubscriptionImpl(this.protocol, e, r);
|
|
4384
|
+
return typeof r.callback != "function" && typeof r.slow == "number" && i.setSlowNotificationFn(r.slow, (o) => {
|
|
4385
4385
|
this.protocol.dispatchStatus({
|
|
4386
4386
|
type: "slowConsumer",
|
|
4387
4387
|
sub: i,
|
|
4388
|
-
pending:
|
|
4388
|
+
pending: o
|
|
4389
4389
|
});
|
|
4390
4390
|
}), this.protocol.subscribe(i), i;
|
|
4391
4391
|
}
|
|
4392
4392
|
_resub(e, r, i) {
|
|
4393
4393
|
this._check(r, !0, !1);
|
|
4394
|
-
const
|
|
4395
|
-
|
|
4394
|
+
const o = e;
|
|
4395
|
+
o.max = i, i && (o.max = i + o.received), this.protocol.resub(o, r);
|
|
4396
4396
|
}
|
|
4397
4397
|
// possibilities are:
|
|
4398
4398
|
// stop on error or any non-100 status
|
|
@@ -4402,7 +4402,7 @@ class $r {
|
|
|
4402
4402
|
// - wait for unknown messages, done when empty or reset timer expires (with possible alt wait)
|
|
4403
4403
|
// - wait for unknown messages, done when an empty payload is received or timer expires (with possible alt wait)
|
|
4404
4404
|
requestMany(e, r = Ls.Empty, i = { maxWait: 1e3, maxMessages: -1 }) {
|
|
4405
|
-
const
|
|
4405
|
+
const o = !this.protocol.options.noAsyncTraces;
|
|
4406
4406
|
try {
|
|
4407
4407
|
this._check(e, !0, !0);
|
|
4408
4408
|
} catch (P) {
|
|
@@ -4411,18 +4411,18 @@ class $r {
|
|
|
4411
4411
|
if (i.strategy = i.strategy || "timer", i.maxWait = i.maxWait || 1e3, i.maxWait < 1)
|
|
4412
4412
|
return Promise.reject(we.InvalidArgumentError.format("timeout", "must be greater than 0"));
|
|
4413
4413
|
const u = new Pn.QueuedIteratorImpl();
|
|
4414
|
-
function
|
|
4414
|
+
function l(P) {
|
|
4415
4415
|
u.push(() => {
|
|
4416
4416
|
u.stop(P);
|
|
4417
4417
|
});
|
|
4418
4418
|
}
|
|
4419
4419
|
function m(P, g) {
|
|
4420
|
-
P || g === null ?
|
|
4420
|
+
P || g === null ? l(P === null ? void 0 : P) : u.push(g);
|
|
4421
4421
|
}
|
|
4422
4422
|
if (i.noMux) {
|
|
4423
|
-
const P =
|
|
4423
|
+
const P = o ? new Error().stack : null;
|
|
4424
4424
|
let g = typeof i.maxMessages == "number" && i.maxMessages > 0 ? i.maxMessages : -1;
|
|
4425
|
-
const
|
|
4425
|
+
const E = this.subscribe((0, On.createInbox)(this.options.inboxPrefix), {
|
|
4426
4426
|
callback: (ie, ye) => {
|
|
4427
4427
|
var Le, L;
|
|
4428
4428
|
if (((Le = ye == null ? void 0 : ye.data) == null ? void 0 : Le.length) === 0 && ((L = ye == null ? void 0 : ye.headers) == null ? void 0 : L.status) === "503" && (ie = new we.errors.NoRespondersError(e)), ie) {
|
|
@@ -4436,29 +4436,29 @@ ${P}`), w(ie);
|
|
|
4436
4436
|
}, 300)), i.strategy === "sentinel" && ye && ye.data.length === 0 && w();
|
|
4437
4437
|
}
|
|
4438
4438
|
});
|
|
4439
|
-
|
|
4440
|
-
|
|
4439
|
+
E.requestSubject = e, E.closed.then(() => {
|
|
4440
|
+
l();
|
|
4441
4441
|
}).catch((ie) => {
|
|
4442
4442
|
u.stop(ie);
|
|
4443
4443
|
});
|
|
4444
4444
|
const w = (ie) => {
|
|
4445
4445
|
ie && u.push(() => {
|
|
4446
4446
|
throw ie;
|
|
4447
|
-
}), U(),
|
|
4448
|
-
|
|
4447
|
+
}), U(), E.drain().then(() => {
|
|
4448
|
+
l();
|
|
4449
4449
|
}).catch((ye) => {
|
|
4450
|
-
|
|
4450
|
+
l();
|
|
4451
4451
|
});
|
|
4452
4452
|
};
|
|
4453
4453
|
u.iterClosed.then(() => {
|
|
4454
|
-
U(),
|
|
4454
|
+
U(), E == null || E.unsubscribe();
|
|
4455
4455
|
}).catch((ie) => {
|
|
4456
|
-
U(),
|
|
4456
|
+
U(), E == null || E.unsubscribe();
|
|
4457
4457
|
});
|
|
4458
4458
|
const { headers: b, traceDestination: x, traceOnly: R } = i;
|
|
4459
4459
|
try {
|
|
4460
4460
|
this.publish(e, r, {
|
|
4461
|
-
reply:
|
|
4461
|
+
reply: E.getSubject(),
|
|
4462
4462
|
headers: b,
|
|
4463
4463
|
traceDestination: x,
|
|
4464
4464
|
traceOnly: R
|
|
@@ -4481,11 +4481,11 @@ ${P}`), w(ie);
|
|
|
4481
4481
|
});
|
|
4482
4482
|
const g = new Sn.RequestMany(this.protocol.muxSubscriptions, e, P);
|
|
4483
4483
|
this.protocol.request(g);
|
|
4484
|
-
const { headers:
|
|
4484
|
+
const { headers: E, traceDestination: w, traceOnly: b } = i;
|
|
4485
4485
|
try {
|
|
4486
4486
|
this.publish(e, r, {
|
|
4487
4487
|
reply: `${this.protocol.muxSubscriptions.baseInbox}${g.token}`,
|
|
4488
|
-
headers:
|
|
4488
|
+
headers: E,
|
|
4489
4489
|
traceDestination: w,
|
|
4490
4490
|
traceOnly: b
|
|
4491
4491
|
});
|
|
@@ -4501,37 +4501,37 @@ ${P}`), w(ie);
|
|
|
4501
4501
|
} catch (u) {
|
|
4502
4502
|
return Promise.reject(u);
|
|
4503
4503
|
}
|
|
4504
|
-
const
|
|
4504
|
+
const o = !this.protocol.options.noAsyncTraces;
|
|
4505
4505
|
if (i.timeout = i.timeout || 1e3, i.timeout < 1)
|
|
4506
4506
|
return Promise.reject(we.InvalidArgumentError.format("timeout", "must be greater than 0"));
|
|
4507
4507
|
if (!i.noMux && i.reply)
|
|
4508
4508
|
return Promise.reject(we.InvalidArgumentError.format(["reply", "noMux"], "are mutually exclusive"));
|
|
4509
4509
|
if (i.noMux) {
|
|
4510
|
-
const u = i.reply ? i.reply : (0, On.createInbox)(this.options.inboxPrefix),
|
|
4510
|
+
const u = i.reply ? i.reply : (0, On.createInbox)(this.options.inboxPrefix), l = (0, Us.deferred)(), m = o ? new we.errors.RequestError("") : null, P = this.subscribe(u, {
|
|
4511
4511
|
max: 1,
|
|
4512
4512
|
timeout: i.timeout,
|
|
4513
|
-
callback: (g,
|
|
4513
|
+
callback: (g, E) => {
|
|
4514
4514
|
var w, b;
|
|
4515
|
-
|
|
4515
|
+
E && ((w = E.data) == null ? void 0 : w.length) === 0 && ((b = E.headers) == null ? void 0 : b.code) === 503 && (g = new we.errors.NoRespondersError(e)), g ? (g instanceof we.TimeoutError || (m ? (m.message = g.message, m.cause = g, g = m) : g = new we.errors.RequestError(g.message, { cause: g })), l.reject(g), P.unsubscribe()) : l.resolve(E);
|
|
4516
4516
|
}
|
|
4517
4517
|
});
|
|
4518
4518
|
return P.requestSubject = e, this.protocol.publish(e, r, {
|
|
4519
4519
|
reply: u,
|
|
4520
4520
|
headers: i.headers
|
|
4521
|
-
}),
|
|
4521
|
+
}), l;
|
|
4522
4522
|
} else {
|
|
4523
|
-
const u = new Sn.RequestOne(this.protocol.muxSubscriptions, e, i,
|
|
4523
|
+
const u = new Sn.RequestOne(this.protocol.muxSubscriptions, e, i, o);
|
|
4524
4524
|
this.protocol.request(u);
|
|
4525
|
-
const { headers:
|
|
4525
|
+
const { headers: l, traceDestination: m, traceOnly: P } = i;
|
|
4526
4526
|
try {
|
|
4527
4527
|
this.publish(e, r, {
|
|
4528
4528
|
reply: `${this.protocol.muxSubscriptions.baseInbox}${u.token}`,
|
|
4529
|
-
headers:
|
|
4529
|
+
headers: l,
|
|
4530
4530
|
traceDestination: m,
|
|
4531
4531
|
traceOnly: P
|
|
4532
4532
|
});
|
|
4533
|
-
} catch (
|
|
4534
|
-
u.cancel(
|
|
4533
|
+
} catch (E) {
|
|
4534
|
+
u.cancel(E);
|
|
4535
4535
|
}
|
|
4536
4536
|
const g = Promise.race([u.timer, u.deferred]);
|
|
4537
4537
|
return g.catch(() => {
|
|
@@ -4610,7 +4610,7 @@ ${P}`), w(ie);
|
|
|
4610
4610
|
jt.NatsConnectionImpl = $r;
|
|
4611
4611
|
class Bs {
|
|
4612
4612
|
constructor(e) {
|
|
4613
|
-
|
|
4613
|
+
d(this, "listeners");
|
|
4614
4614
|
this.listeners = [], e.then((r) => {
|
|
4615
4615
|
this.notify(r);
|
|
4616
4616
|
});
|
|
@@ -4644,26 +4644,26 @@ Xe.Bench = Xe.Metric = void 0;
|
|
|
4644
4644
|
Xe.throughput = ei;
|
|
4645
4645
|
Xe.msgThroughput = zs;
|
|
4646
4646
|
Xe.humanizeBytes = ti;
|
|
4647
|
-
const Ds = qr, $s =
|
|
4647
|
+
const Ds = qr, $s = Nt, Ar = be;
|
|
4648
4648
|
class it {
|
|
4649
4649
|
constructor(e, r) {
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4650
|
+
d(this, "name");
|
|
4651
|
+
d(this, "duration");
|
|
4652
|
+
d(this, "date");
|
|
4653
|
+
d(this, "payload");
|
|
4654
|
+
d(this, "msgs");
|
|
4655
|
+
d(this, "lang");
|
|
4656
|
+
d(this, "version");
|
|
4657
|
+
d(this, "bytes");
|
|
4658
|
+
d(this, "asyncRequests");
|
|
4659
|
+
d(this, "min");
|
|
4660
|
+
d(this, "max");
|
|
4661
4661
|
this.name = e, this.duration = r, this.date = Date.now(), this.payload = 0, this.msgs = 0, this.bytes = 0;
|
|
4662
4662
|
}
|
|
4663
4663
|
toString() {
|
|
4664
4664
|
const e = this.duration / 1e3, r = Math.round(this.msgs / e), i = this.asyncRequests ? "asyncRequests" : "";
|
|
4665
|
-
let
|
|
4666
|
-
return this.max && (
|
|
4665
|
+
let o = "";
|
|
4666
|
+
return this.max && (o = `${this.min}/${this.max}`), `${this.name}${i ? " [asyncRequests]" : ""} ${Gs(r)} msgs/sec - [${e.toFixed(2)} secs] ~ ${ei(this.bytes, e)} ${o}`;
|
|
4667
4667
|
}
|
|
4668
4668
|
toCsv() {
|
|
4669
4669
|
return `"${this.name}",${new Date(this.date).toISOString()},${this.lang},${this.version},${this.msgs},${this.payload},${this.bytes},${this.duration},${this.asyncRequests ? this.asyncRequests : !1}
|
|
@@ -4686,18 +4686,18 @@ class qs {
|
|
|
4686
4686
|
req: !1,
|
|
4687
4687
|
rep: !1
|
|
4688
4688
|
}) {
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4689
|
+
d(this, "nc");
|
|
4690
|
+
d(this, "callbacks");
|
|
4691
|
+
d(this, "msgs");
|
|
4692
|
+
d(this, "size");
|
|
4693
|
+
d(this, "subject");
|
|
4694
|
+
d(this, "asyncRequests");
|
|
4695
|
+
d(this, "pub");
|
|
4696
|
+
d(this, "sub");
|
|
4697
|
+
d(this, "req");
|
|
4698
|
+
d(this, "rep");
|
|
4699
|
+
d(this, "perf");
|
|
4700
|
+
d(this, "payload");
|
|
4701
4701
|
if (this.nc = e, this.callbacks = r.callbacks || !1, this.msgs = r.msgs || 0, this.size = r.size || 0, this.subject = r.subject || $s.nuid.next(), this.asyncRequests = r.asyncRequests || !1, this.pub = r.pub || !1, this.sub = r.sub || !1, this.req = r.req || !1, this.rep = r.rep || !1, this.perf = new Ar.Perf(), this.payload = this.size ? new Uint8Array(this.size) : Ds.Empty, !this.pub && !this.sub && !this.req && !this.rep)
|
|
4702
4702
|
throw new Error("no options selected");
|
|
4703
4703
|
}
|
|
@@ -4710,21 +4710,21 @@ class qs {
|
|
|
4710
4710
|
processMetrics() {
|
|
4711
4711
|
const e = this.nc, { lang: r, version: i } = e.protocol.transport;
|
|
4712
4712
|
this.pub && this.sub && this.perf.measure("pubsub", "pubStart", "subStop"), this.req && this.rep && this.perf.measure("reqrep", "reqStart", "reqStop");
|
|
4713
|
-
const
|
|
4713
|
+
const o = this.perf.getEntries(), u = o.find((x) => x.name === "pubsub"), l = o.find((x) => x.name === "reqrep"), m = o.find((x) => x.name === "req"), P = o.find((x) => x.name === "rep"), g = o.find((x) => x.name === "pub"), E = o.find((x) => x.name === "sub"), w = this.nc.stats(), b = [];
|
|
4714
4714
|
if (u) {
|
|
4715
4715
|
const { name: x, duration: R } = u, j = new it(x, R);
|
|
4716
4716
|
j.msgs = this.msgs * 2, j.bytes = w.inBytes + w.outBytes, j.lang = r, j.version = i, j.payload = this.payload.length, b.push(j);
|
|
4717
4717
|
}
|
|
4718
|
-
if (
|
|
4719
|
-
const { name: x, duration: R } =
|
|
4718
|
+
if (l) {
|
|
4719
|
+
const { name: x, duration: R } = l, j = new it(x, R);
|
|
4720
4720
|
j.msgs = this.msgs * 2, j.bytes = w.inBytes + w.outBytes, j.lang = r, j.version = i, j.payload = this.payload.length, b.push(j);
|
|
4721
4721
|
}
|
|
4722
4722
|
if (g) {
|
|
4723
4723
|
const { name: x, duration: R } = g, j = new it(x, R);
|
|
4724
4724
|
j.msgs = this.msgs, j.bytes = w.outBytes, j.lang = r, j.version = i, j.payload = this.payload.length, b.push(j);
|
|
4725
4725
|
}
|
|
4726
|
-
if (
|
|
4727
|
-
const { name: x, duration: R } =
|
|
4726
|
+
if (E) {
|
|
4727
|
+
const { name: x, duration: R } = E, j = new it(x, R);
|
|
4728
4728
|
j.msgs = this.msgs, j.bytes = w.inBytes, j.lang = r, j.version = i, j.payload = this.payload.length, b.push(j);
|
|
4729
4729
|
}
|
|
4730
4730
|
if (P) {
|
|
@@ -4756,7 +4756,7 @@ class qs {
|
|
|
4756
4756
|
let i = 0;
|
|
4757
4757
|
this.nc.subscribe(this.subject, {
|
|
4758
4758
|
max: this.msgs,
|
|
4759
|
-
callback: (
|
|
4759
|
+
callback: (o, u) => {
|
|
4760
4760
|
u.respond(this.payload), i++, i === 1 && this.perf.mark("repStart"), i === this.msgs && (this.perf.mark("repStop"), this.perf.measure("rep", "repStart", "repStop"), r.resolve());
|
|
4761
4761
|
}
|
|
4762
4762
|
});
|
|
@@ -4775,7 +4775,7 @@ class qs {
|
|
|
4775
4775
|
if (this.asyncRequests) {
|
|
4776
4776
|
this.perf.mark("reqStart");
|
|
4777
4777
|
const i = [];
|
|
4778
|
-
for (let
|
|
4778
|
+
for (let o = 0; o < this.msgs; o++)
|
|
4779
4779
|
i.push(this.nc.request(this.subject, this.payload, { timeout: 2e4 }));
|
|
4780
4780
|
await Promise.all(i), this.perf.mark("reqStop"), this.perf.measure("req", "reqStart", "reqStop");
|
|
4781
4781
|
} else {
|
|
@@ -4793,21 +4793,21 @@ class qs {
|
|
|
4793
4793
|
const e = [];
|
|
4794
4794
|
if (this.rep) {
|
|
4795
4795
|
let r = !1;
|
|
4796
|
-
const i = this.nc.subscribe(this.subject, { max: this.msgs }),
|
|
4796
|
+
const i = this.nc.subscribe(this.subject, { max: this.msgs }), o = (async () => {
|
|
4797
4797
|
for await (const u of i)
|
|
4798
4798
|
r || (this.perf.mark("repStart"), r = !0), u.respond(this.payload);
|
|
4799
4799
|
await this.nc.flush(), this.perf.mark("repStop"), this.perf.measure("rep", "repStart", "repStop");
|
|
4800
4800
|
})();
|
|
4801
|
-
e.push(
|
|
4801
|
+
e.push(o);
|
|
4802
4802
|
}
|
|
4803
4803
|
if (this.sub) {
|
|
4804
4804
|
let r = !1;
|
|
4805
|
-
const i = this.nc.subscribe(this.subject, { max: this.msgs }),
|
|
4805
|
+
const i = this.nc.subscribe(this.subject, { max: this.msgs }), o = (async () => {
|
|
4806
4806
|
for await (const u of i)
|
|
4807
4807
|
r || (this.perf.mark("subStart"), r = !0);
|
|
4808
4808
|
this.perf.mark("subStop"), this.perf.measure("sub", "subStart", "subStop");
|
|
4809
4809
|
})();
|
|
4810
|
-
e.push(
|
|
4810
|
+
e.push(o);
|
|
4811
4811
|
}
|
|
4812
4812
|
if (this.pub) {
|
|
4813
4813
|
const r = (async () => {
|
|
@@ -4823,7 +4823,7 @@ class qs {
|
|
|
4823
4823
|
if (this.asyncRequests) {
|
|
4824
4824
|
this.perf.mark("reqStart");
|
|
4825
4825
|
const i = [];
|
|
4826
|
-
for (let
|
|
4826
|
+
for (let o = 0; o < this.msgs; o++)
|
|
4827
4827
|
i.push(this.nc.request(this.subject, this.payload, { timeout: 2e4 }));
|
|
4828
4828
|
await Promise.all(i), this.perf.mark("reqStop"), this.perf.measure("req", "reqStart", "reqStop");
|
|
4829
4829
|
} else {
|
|
@@ -4846,11 +4846,11 @@ function zs(t, e) {
|
|
|
4846
4846
|
return `${Math.floor(t / e)} msgs/sec`;
|
|
4847
4847
|
}
|
|
4848
4848
|
function ti(t, e = !1) {
|
|
4849
|
-
const r = e ? 1e3 : 1024, i = e ? ["k", "M", "G", "T", "P", "E"] : ["K", "M", "G", "T", "P", "E"],
|
|
4849
|
+
const r = e ? 1e3 : 1024, i = e ? ["k", "M", "G", "T", "P", "E"] : ["K", "M", "G", "T", "P", "E"], o = e ? "iB" : "B";
|
|
4850
4850
|
if (t < r)
|
|
4851
|
-
return `${t.toFixed(2)} ${
|
|
4852
|
-
const u = parseInt(Math.log(t) / Math.log(r) + ""),
|
|
4853
|
-
return `${(t / Math.pow(r, u)).toFixed(2)} ${i[
|
|
4851
|
+
return `${t.toFixed(2)} ${o}`;
|
|
4852
|
+
const u = parseInt(Math.log(t) / Math.log(r) + ""), l = parseInt(u - 1 + "");
|
|
4853
|
+
return `${(t / Math.pow(r, u)).toFixed(2)} ${i[l]}${o}`;
|
|
4854
4854
|
}
|
|
4855
4855
|
function Gs(t) {
|
|
4856
4856
|
return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
@@ -4866,15 +4866,15 @@ class Hs {
|
|
|
4866
4866
|
* @param opts monitor options @see IdleHeartbeatOptions
|
|
4867
4867
|
*/
|
|
4868
4868
|
constructor(e, r, i = { maxOut: 2 }) {
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4869
|
+
d(this, "interval");
|
|
4870
|
+
d(this, "maxOut");
|
|
4871
|
+
d(this, "cancelAfter");
|
|
4872
|
+
d(this, "timer");
|
|
4873
|
+
d(this, "autoCancelTimer");
|
|
4874
|
+
d(this, "last");
|
|
4875
|
+
d(this, "missed");
|
|
4876
|
+
d(this, "count");
|
|
4877
|
+
d(this, "callback");
|
|
4878
4878
|
this.interval = e, this.maxOut = (i == null ? void 0 : i.maxOut) || 2, this.cancelAfter = (i == null ? void 0 : i.cancelAfter) || 0, this.last = Date.now(), this.missed = 0, this.count = 0, this.callback = r, this._schedule();
|
|
4879
4879
|
}
|
|
4880
4880
|
/**
|
|
@@ -4928,35 +4928,35 @@ fr.version = "3.2.0";
|
|
|
4928
4928
|
Object.defineProperty(xt, "__esModule", { value: !0 });
|
|
4929
4929
|
xt.WsTransport = void 0;
|
|
4930
4930
|
xt.wsUrlParseFn = si;
|
|
4931
|
-
xt.wsconnect =
|
|
4932
|
-
const
|
|
4931
|
+
xt.wsconnect = eo;
|
|
4932
|
+
const Ve = be, ri = st, Js = Ut, Vs = ot, Ys = je, Ws = jt, Xs = fr, ni = re, Zs = Xs.version, Qs = "nats.ws";
|
|
4933
4933
|
class ii {
|
|
4934
4934
|
constructor() {
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4935
|
+
d(this, "version");
|
|
4936
|
+
d(this, "lang");
|
|
4937
|
+
d(this, "closeError");
|
|
4938
|
+
d(this, "connected");
|
|
4939
|
+
d(this, "done");
|
|
4940
4940
|
// @ts-ignore: expecting global WebSocket
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
this.version = Zs, this.lang = Qs, this.connected = !1, this.done = !1, this.socketClosed = !1, this.encrypted = !1, this.peeked = !1, this.yields = [], this.signal = (0,
|
|
4941
|
+
d(this, "socket");
|
|
4942
|
+
d(this, "options");
|
|
4943
|
+
d(this, "socketClosed");
|
|
4944
|
+
d(this, "encrypted");
|
|
4945
|
+
d(this, "peeked");
|
|
4946
|
+
d(this, "yields");
|
|
4947
|
+
d(this, "signal");
|
|
4948
|
+
d(this, "closedNotification");
|
|
4949
|
+
this.version = Zs, this.lang = Qs, this.connected = !1, this.done = !1, this.socketClosed = !1, this.encrypted = !1, this.peeked = !1, this.yields = [], this.signal = (0, Ve.deferred)(), this.closedNotification = (0, Ve.deferred)();
|
|
4950
4950
|
}
|
|
4951
4951
|
async connect(e, r) {
|
|
4952
|
-
const i = (0,
|
|
4952
|
+
const i = (0, Ve.deferred)();
|
|
4953
4953
|
this.options = r;
|
|
4954
|
-
const
|
|
4954
|
+
const o = e.src;
|
|
4955
4955
|
if (r.wsFactory) {
|
|
4956
|
-
const { socket: u, encrypted:
|
|
4957
|
-
this.socket = u, this.encrypted =
|
|
4956
|
+
const { socket: u, encrypted: l } = await r.wsFactory(e.src, r);
|
|
4957
|
+
this.socket = u, this.encrypted = l;
|
|
4958
4958
|
} else
|
|
4959
|
-
this.encrypted =
|
|
4959
|
+
this.encrypted = o.indexOf("wss://") === 0, this.socket = new WebSocket(o);
|
|
4960
4960
|
return this.socket.binaryType = "arraybuffer", this.socket.onopen = () => {
|
|
4961
4961
|
this.done && this._closed(new Error("aborted"));
|
|
4962
4962
|
}, this.socket.onmessage = (u) => {
|
|
@@ -4966,28 +4966,28 @@ class ii {
|
|
|
4966
4966
|
this.signal.resolve();
|
|
4967
4967
|
return;
|
|
4968
4968
|
}
|
|
4969
|
-
const
|
|
4969
|
+
const l = Vs.DataBuffer.concat(...this.yields), m = (0, ri.extractProtocolMessage)(l);
|
|
4970
4970
|
if (m !== "") {
|
|
4971
4971
|
const P = Ys.INFO.exec(m);
|
|
4972
4972
|
if (!P) {
|
|
4973
|
-
r.debug && console.error("!!!", (0,
|
|
4973
|
+
r.debug && console.error("!!!", (0, Ve.render)(l)), i.reject(new Error("unexpected response from server"));
|
|
4974
4974
|
return;
|
|
4975
4975
|
}
|
|
4976
4976
|
try {
|
|
4977
4977
|
const g = JSON.parse(P[1]);
|
|
4978
|
-
(0,
|
|
4978
|
+
(0, Js.checkOptions)(g, this.options), this.peeked = !0, this.connected = !0, this.signal.resolve(), i.resolve();
|
|
4979
4979
|
} catch (g) {
|
|
4980
4980
|
i.reject(g);
|
|
4981
4981
|
return;
|
|
4982
4982
|
}
|
|
4983
4983
|
}
|
|
4984
4984
|
}, this.socket.onclose = (u) => {
|
|
4985
|
-
let
|
|
4986
|
-
!u.wasClean && u.reason !== "" && (
|
|
4985
|
+
let l;
|
|
4986
|
+
!u.wasClean && u.reason !== "" && (l = new Error(u.reason)), this._closed(l), this._cleanup();
|
|
4987
4987
|
}, this.socket.onerror = (u) => {
|
|
4988
4988
|
if (this.done)
|
|
4989
4989
|
return;
|
|
4990
|
-
const
|
|
4990
|
+
const l = u, m = new ni.errors.ConnectionError(l.message);
|
|
4991
4991
|
i.reject(m), this._cleanup();
|
|
4992
4992
|
}, i;
|
|
4993
4993
|
}
|
|
@@ -5007,7 +5007,7 @@ class ii {
|
|
|
5007
5007
|
}
|
|
5008
5008
|
if (this.closeError = e, !e)
|
|
5009
5009
|
for (; !this.socketClosed && this.socket.bufferedAmount > 0; )
|
|
5010
|
-
await (0,
|
|
5010
|
+
await (0, Ve.delay)(100);
|
|
5011
5011
|
this.done = !0;
|
|
5012
5012
|
try {
|
|
5013
5013
|
this.socket.close();
|
|
@@ -5029,10 +5029,10 @@ class ii {
|
|
|
5029
5029
|
const e = this.yields;
|
|
5030
5030
|
this.yields = [];
|
|
5031
5031
|
for (let r = 0; r < e.length; r++)
|
|
5032
|
-
this.options.debug && console.info(`> ${(0,
|
|
5032
|
+
this.options.debug && console.info(`> ${(0, Ve.render)(e[r])}`), yield e[r];
|
|
5033
5033
|
if (this.done)
|
|
5034
5034
|
break;
|
|
5035
|
-
this.yields.length === 0 && (e.length = 0, this.yields = e, this.signal = (0,
|
|
5035
|
+
this.yields.length === 0 && (e.length = 0, this.yields = e, this.signal = (0, Ve.deferred)());
|
|
5036
5036
|
}
|
|
5037
5037
|
}
|
|
5038
5038
|
isEncrypted() {
|
|
@@ -5041,10 +5041,10 @@ class ii {
|
|
|
5041
5041
|
send(e) {
|
|
5042
5042
|
if (!this.done)
|
|
5043
5043
|
try {
|
|
5044
|
-
this.socket.send(e.buffer), this.options.debug && console.info(`< ${(0,
|
|
5044
|
+
this.socket.send(e.buffer), this.options.debug && console.info(`< ${(0, Ve.render)(e)}`);
|
|
5045
5045
|
return;
|
|
5046
5046
|
} catch (r) {
|
|
5047
|
-
this.options.debug && console.error(`!!! ${(0,
|
|
5047
|
+
this.options.debug && console.error(`!!! ${(0, Ve.render)(e)}: ${r}`);
|
|
5048
5048
|
}
|
|
5049
5049
|
}
|
|
5050
5050
|
close(e) {
|
|
@@ -5067,28 +5067,28 @@ xt.WsTransport = ii;
|
|
|
5067
5067
|
function si(t, e) {
|
|
5068
5068
|
/^(.*:\/\/)(.*)/.test(t) || (typeof e == "boolean" ? t = `${e === !0 ? "https" : "http"}://${t}` : t = `https://${t}`);
|
|
5069
5069
|
let i = new URL(t);
|
|
5070
|
-
const
|
|
5071
|
-
|
|
5072
|
-
let u,
|
|
5070
|
+
const o = i.protocol.toLowerCase();
|
|
5071
|
+
o === "ws:" && (e = !1), o === "wss:" && (e = !0), o !== "https:" && o !== "http" && (t = t.replace(/^(.*:\/\/)(.*)/gm, "$2"), i = new URL(`http://${t}`));
|
|
5072
|
+
let u, l;
|
|
5073
5073
|
const m = i.hostname, P = i.pathname, g = i.search || "";
|
|
5074
|
-
switch (
|
|
5074
|
+
switch (o) {
|
|
5075
5075
|
case "http:":
|
|
5076
5076
|
case "ws:":
|
|
5077
5077
|
case "nats:":
|
|
5078
|
-
|
|
5078
|
+
l = i.port || "80", u = "ws:";
|
|
5079
5079
|
break;
|
|
5080
5080
|
case "https:":
|
|
5081
5081
|
case "wss:":
|
|
5082
5082
|
case "tls:":
|
|
5083
|
-
|
|
5083
|
+
l = i.port || "443", u = "wss:";
|
|
5084
5084
|
break;
|
|
5085
5085
|
default:
|
|
5086
|
-
|
|
5086
|
+
l = i.port || e === !0 ? "443" : "80", u = e === !0 ? "wss:" : "ws:";
|
|
5087
5087
|
break;
|
|
5088
5088
|
}
|
|
5089
|
-
return `${u}//${m}:${
|
|
5089
|
+
return `${u}//${m}:${l}${P}${g}`;
|
|
5090
5090
|
}
|
|
5091
|
-
function
|
|
5091
|
+
function eo(t = {}) {
|
|
5092
5092
|
return (0, ri.setTransportFactory)({
|
|
5093
5093
|
defaultPort: 443,
|
|
5094
5094
|
urlParseFn: si,
|
|
@@ -5100,38 +5100,38 @@ function ea(t = {}) {
|
|
|
5100
5100
|
}), Ws.NatsConnectionImpl.connect(t);
|
|
5101
5101
|
}
|
|
5102
5102
|
(function(t) {
|
|
5103
|
-
var e =
|
|
5104
|
-
|
|
5105
|
-
var Re = Object.getOwnPropertyDescriptor(Se,
|
|
5103
|
+
var e = pe && pe.__createBinding || (Object.create ? function(qe, Se, Ne, Te) {
|
|
5104
|
+
Te === void 0 && (Te = Ne);
|
|
5105
|
+
var Re = Object.getOwnPropertyDescriptor(Se, Ne);
|
|
5106
5106
|
(!Re || ("get" in Re ? !Se.__esModule : Re.writable || Re.configurable)) && (Re = { enumerable: !0, get: function() {
|
|
5107
|
-
return Se[
|
|
5108
|
-
} }), Object.defineProperty(qe,
|
|
5109
|
-
} : function(qe, Se,
|
|
5110
|
-
|
|
5111
|
-
}), r =
|
|
5112
|
-
for (var
|
|
5113
|
-
|
|
5107
|
+
return Se[Ne];
|
|
5108
|
+
} }), Object.defineProperty(qe, Te, Re);
|
|
5109
|
+
} : function(qe, Se, Ne, Te) {
|
|
5110
|
+
Te === void 0 && (Te = Ne), qe[Te] = Se[Ne];
|
|
5111
|
+
}), r = pe && pe.__exportStar || function(qe, Se) {
|
|
5112
|
+
for (var Ne in qe)
|
|
5113
|
+
Ne !== "default" && !Object.prototype.hasOwnProperty.call(Se, Ne) && e(Se, qe, Ne);
|
|
5114
5114
|
};
|
|
5115
5115
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.TD = t.Metric = t.Bench = t.writeAll = t.readAll = t.MAX_SIZE = t.DenoBuffer = t.State = t.Parser = t.Kind = t.QueuedIteratorImpl = t.usernamePasswordAuthenticator = t.tokenAuthenticator = t.nkeyAuthenticator = t.jwtAuthenticator = t.credsAuthenticator = t.RequestOne = t.parseOptions = t.hasWsProtocol = t.defaultOptions = t.DEFAULT_MAX_RECONNECT_ATTEMPTS = t.checkUnsupportedOption = t.checkOptions = t.buildAuthenticator = t.DataBuffer = t.MuxSubscription = t.Heartbeat = t.MsgHdrsImpl = t.headers = t.canonicalMIMEHeaderKey = t.timeout = t.SimpleMutex = t.render = t.nanos = t.millis = t.extend = t.delay = t.deferred = t.deadline = t.collect = t.backoff = t.ProtocolHandler = t.INFO = t.Connect = t.setTransportFactory = t.getResolveFn = t.MsgImpl = t.nuid = t.Nuid = t.NatsConnectionImpl = void 0, t.UserAuthenticationExpiredError = t.TimeoutError = t.RequestError = t.ProtocolError = t.PermissionViolationError = t.NoRespondersError = t.InvalidSubjectError = t.InvalidOperationError = t.InvalidArgumentError = t.errors = t.DrainingConnectionError = t.ConnectionError = t.ClosedConnectionError = t.AuthorizationError = t.wsUrlParseFn = t.wsconnect = t.Servers = t.isIPV4OrHostname = t.IdleHeartbeatMonitor = t.Subscriptions = t.SubscriptionImpl = t.syncIterator = t.Match = t.createInbox = t.protoLen = t.extractProtocolMessage = t.Empty = t.parseSemVer = t.Features = t.Feature = t.compare = t.parseIP = t.isIP = t.ipV4 = t.TE = void 0;
|
|
5116
5116
|
var i = jt;
|
|
5117
5117
|
Object.defineProperty(t, "NatsConnectionImpl", { enumerable: !0, get: function() {
|
|
5118
5118
|
return i.NatsConnectionImpl;
|
|
5119
5119
|
} });
|
|
5120
|
-
var
|
|
5120
|
+
var o = Nt;
|
|
5121
5121
|
Object.defineProperty(t, "Nuid", { enumerable: !0, get: function() {
|
|
5122
|
-
return
|
|
5122
|
+
return o.Nuid;
|
|
5123
5123
|
} }), Object.defineProperty(t, "nuid", { enumerable: !0, get: function() {
|
|
5124
|
-
return
|
|
5124
|
+
return o.nuid;
|
|
5125
5125
|
} });
|
|
5126
5126
|
var u = kt;
|
|
5127
5127
|
Object.defineProperty(t, "MsgImpl", { enumerable: !0, get: function() {
|
|
5128
5128
|
return u.MsgImpl;
|
|
5129
5129
|
} });
|
|
5130
|
-
var
|
|
5130
|
+
var l = st;
|
|
5131
5131
|
Object.defineProperty(t, "getResolveFn", { enumerable: !0, get: function() {
|
|
5132
|
-
return
|
|
5132
|
+
return l.getResolveFn;
|
|
5133
5133
|
} }), Object.defineProperty(t, "setTransportFactory", { enumerable: !0, get: function() {
|
|
5134
|
-
return
|
|
5134
|
+
return l.setTransportFactory;
|
|
5135
5135
|
} });
|
|
5136
5136
|
var m = je;
|
|
5137
5137
|
Object.defineProperty(t, "Connect", { enumerable: !0, get: function() {
|
|
@@ -5173,15 +5173,15 @@ function ea(t = {}) {
|
|
|
5173
5173
|
} }), Object.defineProperty(t, "MsgHdrsImpl", { enumerable: !0, get: function() {
|
|
5174
5174
|
return g.MsgHdrsImpl;
|
|
5175
5175
|
} });
|
|
5176
|
-
var
|
|
5176
|
+
var E = Rt;
|
|
5177
5177
|
Object.defineProperty(t, "Heartbeat", { enumerable: !0, get: function() {
|
|
5178
|
-
return
|
|
5178
|
+
return E.Heartbeat;
|
|
5179
5179
|
} });
|
|
5180
|
-
var w =
|
|
5180
|
+
var w = Tt;
|
|
5181
5181
|
Object.defineProperty(t, "MuxSubscription", { enumerable: !0, get: function() {
|
|
5182
5182
|
return w.MuxSubscription;
|
|
5183
5183
|
} });
|
|
5184
|
-
var b =
|
|
5184
|
+
var b = ot;
|
|
5185
5185
|
Object.defineProperty(t, "DataBuffer", { enumerable: !0, get: function() {
|
|
5186
5186
|
return b.DataBuffer;
|
|
5187
5187
|
} });
|
|
@@ -5273,19 +5273,19 @@ function ea(t = {}) {
|
|
|
5273
5273
|
Object.defineProperty(t, "Empty", { enumerable: !0, get: function() {
|
|
5274
5274
|
return $e.Empty;
|
|
5275
5275
|
} });
|
|
5276
|
-
var
|
|
5276
|
+
var pt = st;
|
|
5277
5277
|
Object.defineProperty(t, "extractProtocolMessage", { enumerable: !0, get: function() {
|
|
5278
|
-
return
|
|
5278
|
+
return pt.extractProtocolMessage;
|
|
5279
5279
|
} }), Object.defineProperty(t, "protoLen", { enumerable: !0, get: function() {
|
|
5280
|
-
return
|
|
5280
|
+
return pt.protoLen;
|
|
5281
5281
|
} });
|
|
5282
|
-
var
|
|
5282
|
+
var at = Ie;
|
|
5283
5283
|
Object.defineProperty(t, "createInbox", { enumerable: !0, get: function() {
|
|
5284
|
-
return
|
|
5284
|
+
return at.createInbox;
|
|
5285
5285
|
} }), Object.defineProperty(t, "Match", { enumerable: !0, get: function() {
|
|
5286
|
-
return
|
|
5286
|
+
return at.Match;
|
|
5287
5287
|
} }), Object.defineProperty(t, "syncIterator", { enumerable: !0, get: function() {
|
|
5288
|
-
return
|
|
5288
|
+
return at.syncIterator;
|
|
5289
5289
|
} });
|
|
5290
5290
|
var ct = je;
|
|
5291
5291
|
Object.defineProperty(t, "SubscriptionImpl", { enumerable: !0, get: function() {
|
|
@@ -5303,11 +5303,11 @@ function ea(t = {}) {
|
|
|
5303
5303
|
} }), Object.defineProperty(t, "Servers", { enumerable: !0, get: function() {
|
|
5304
5304
|
return ut.Servers;
|
|
5305
5305
|
} });
|
|
5306
|
-
var
|
|
5306
|
+
var Et = xt;
|
|
5307
5307
|
Object.defineProperty(t, "wsconnect", { enumerable: !0, get: function() {
|
|
5308
|
-
return
|
|
5308
|
+
return Et.wsconnect;
|
|
5309
5309
|
} }), Object.defineProperty(t, "wsUrlParseFn", { enumerable: !0, get: function() {
|
|
5310
|
-
return
|
|
5310
|
+
return Et.wsUrlParseFn;
|
|
5311
5311
|
} });
|
|
5312
5312
|
var Pe = re;
|
|
5313
5313
|
Object.defineProperty(t, "AuthorizationError", { enumerable: !0, get: function() {
|
|
@@ -5425,41 +5425,81 @@ function ea(t = {}) {
|
|
|
5425
5425
|
return e.wsconnect;
|
|
5426
5426
|
} });
|
|
5427
5427
|
})(An);
|
|
5428
|
-
class
|
|
5428
|
+
class ro {
|
|
5429
5429
|
constructor(e) {
|
|
5430
|
-
|
|
5430
|
+
d(this, "defaultTimeout");
|
|
5431
5431
|
this.natsConnection = e, this.defaultTimeout = parseInt(process.env.NATS_REQUEST_TIMEOUT || "5000", 10);
|
|
5432
5432
|
}
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5433
|
+
/**
|
|
5434
|
+
* Tells whether a PDF can be turned into a wiki, before any generation.
|
|
5435
|
+
*/
|
|
5436
|
+
async checkFile(e, r = "", i) {
|
|
5437
|
+
let o = "ia.wiki.transform.check";
|
|
5438
|
+
r && (o = `${r}.${o}`), console.debug("Sending request to NATS subject", { messageAddress: o });
|
|
5439
|
+
const u = await this.natsConnection.request(o, JSON.stringify(e), this.toNatsOptions(i));
|
|
5437
5440
|
if (!u)
|
|
5438
|
-
throw console.warn("No reply received for subject", { messageAddress:
|
|
5441
|
+
throw console.warn("No reply received for subject", { messageAddress: o }), new Error("No reply received");
|
|
5439
5442
|
return this.extractResponse(u.json());
|
|
5440
5443
|
}
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5444
|
+
/**
|
|
5445
|
+
* Starts the generation of a wiki from a description of its subject.
|
|
5446
|
+
*/
|
|
5447
|
+
async createWiki(e, r = "", i) {
|
|
5448
|
+
let o = "ia.wiki.create";
|
|
5449
|
+
r && (o = `${r}.${o}`), console.debug("Sending request to NATS subject", { messageAddress: o });
|
|
5450
|
+
const u = await this.natsConnection.request(o, JSON.stringify(e), this.toNatsOptions(i));
|
|
5445
5451
|
if (!u)
|
|
5446
|
-
throw console.warn("No reply received for subject", { messageAddress:
|
|
5452
|
+
throw console.warn("No reply received for subject", { messageAddress: o }), new Error("No reply received");
|
|
5447
5453
|
return this.extractResponse(u.json());
|
|
5448
5454
|
}
|
|
5455
|
+
/**
|
|
5456
|
+
* Starts the generation of a wiki from a PDF. The PDF is checked first : the job is refused, with a reason, when it
|
|
5457
|
+
* cannot be used.
|
|
5458
|
+
*/
|
|
5459
|
+
async transformWiki(e, r = "", i) {
|
|
5460
|
+
let o = "ia.wiki.transform";
|
|
5461
|
+
r && (o = `${r}.${o}`), console.debug("Sending request to NATS subject", { messageAddress: o });
|
|
5462
|
+
const u = await this.natsConnection.request(o, JSON.stringify(e), this.toNatsOptions(i));
|
|
5463
|
+
if (!u)
|
|
5464
|
+
throw console.warn("No reply received for subject", { messageAddress: o }), new Error("No reply received");
|
|
5465
|
+
return this.extractResponse(u.json());
|
|
5466
|
+
}
|
|
5467
|
+
/**
|
|
5468
|
+
* Receives the content of one generated page of a wiki.
|
|
5469
|
+
*/
|
|
5470
|
+
async updateWikiContent(e, r, i = "", o) {
|
|
5471
|
+
let u = "ia.wiki." + r + ".content.updated";
|
|
5472
|
+
i && (u = `${i}.${u}`), console.debug("Sending request to NATS subject", { messageAddress: u });
|
|
5473
|
+
const l = await this.natsConnection.request(u, JSON.stringify(e), this.toNatsOptions(o));
|
|
5474
|
+
if (!l)
|
|
5475
|
+
throw console.warn("No reply received for subject", { messageAddress: u }), new Error("No reply received");
|
|
5476
|
+
return this.extractResponse(l.json());
|
|
5477
|
+
}
|
|
5478
|
+
/**
|
|
5479
|
+
* Receives the structure of a generated wiki : its pages, without their content.
|
|
5480
|
+
*/
|
|
5481
|
+
async updateWikiStructure(e, r, i = "", o) {
|
|
5482
|
+
let u = "ia.wiki." + r + ".structure.updated";
|
|
5483
|
+
i && (u = `${i}.${u}`), console.debug("Sending request to NATS subject", { messageAddress: u });
|
|
5484
|
+
const l = await this.natsConnection.request(u, JSON.stringify(e), this.toNatsOptions(o));
|
|
5485
|
+
if (!l)
|
|
5486
|
+
throw console.warn("No reply received for subject", { messageAddress: u }), new Error("No reply received");
|
|
5487
|
+
return this.extractResponse(l.json());
|
|
5488
|
+
}
|
|
5449
5489
|
extractResponse(e) {
|
|
5450
5490
|
return e.response || e;
|
|
5451
5491
|
}
|
|
5452
5492
|
toNatsOptions(e) {
|
|
5453
5493
|
const i = { timeout: (e == null ? void 0 : e.timeout) ?? this.defaultTimeout };
|
|
5454
5494
|
if (e != null && e.headers) {
|
|
5455
|
-
const
|
|
5456
|
-
for (const [u,
|
|
5457
|
-
Array.isArray(
|
|
5458
|
-
i.headers =
|
|
5495
|
+
const o = An.headers();
|
|
5496
|
+
for (const [u, l] of Object.entries(e.headers))
|
|
5497
|
+
Array.isArray(l) ? l.forEach((m) => o.append(u, m)) : o.set(u, l);
|
|
5498
|
+
i.headers = o;
|
|
5459
5499
|
}
|
|
5460
5500
|
return i;
|
|
5461
5501
|
}
|
|
5462
5502
|
}
|
|
5463
5503
|
export {
|
|
5464
|
-
|
|
5504
|
+
ro as AiwikiNatsServiceClient
|
|
5465
5505
|
};
|