@jokio/sdk 0.2.4 → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  var Si = Object.defineProperty;
2
- var Ei = (r, e, t) => e in r ? Si(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var h = (r, e, t) => Ei(r, typeof e != "symbol" ? e + "" : e, t);
2
+ var vi = (r, e, t) => e in r ? Si(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var h = (r, e, t) => vi(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  function je(r) {
5
5
  const e = new Uint8Array(r);
6
6
  let t = "";
@@ -15,12 +15,12 @@ function zt(r) {
15
15
  return n;
16
16
  }
17
17
  function qs() {
18
- return vi.stubThis((globalThis == null ? void 0 : globalThis.PublicKeyCredential) !== void 0 && typeof globalThis.PublicKeyCredential == "function");
18
+ return Ei.stubThis((globalThis == null ? void 0 : globalThis.PublicKeyCredential) !== void 0 && typeof globalThis.PublicKeyCredential == "function");
19
19
  }
20
- const vi = {
20
+ const Ei = {
21
21
  stubThis: (r) => r
22
22
  };
23
- function $r(r) {
23
+ function Ur(r) {
24
24
  const { id: e } = r;
25
25
  return {
26
26
  ...r,
@@ -33,7 +33,7 @@ function $r(r) {
33
33
  transports: r.transports
34
34
  };
35
35
  }
36
- function Ur(r) {
36
+ function $r(r) {
37
37
  return (
38
38
  // Consider localhost valid as well since it's okay wrt Secure Contexts
39
39
  r === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(r)
@@ -108,7 +108,7 @@ function Ai({ error: r, options: e }) {
108
108
  });
109
109
  if (r.name === "SecurityError") {
110
110
  const o = globalThis.location.hostname;
111
- if (Ur(o)) {
111
+ if ($r(o)) {
112
112
  if (t.rp.id !== o)
113
113
  return new he({
114
114
  message: `The RP ID "${t.rp.id}" is invalid for this domain`,
@@ -178,7 +178,7 @@ async function ki(r) {
178
178
  ...e.user,
179
179
  id: zt(e.user.id)
180
180
  },
181
- excludeCredentials: (I = e.excludeCredentials) == null ? void 0 : I.map($r)
181
+ excludeCredentials: (I = e.excludeCredentials) == null ? void 0 : I.map(Ur)
182
182
  }, i = {};
183
183
  t && (i.mediation = "conditional"), i.publicKey = s, i.signal = Lr.createNewAbortSignal();
184
184
  let n;
@@ -190,8 +190,8 @@ async function ki(r) {
190
190
  if (!n)
191
191
  throw new Error("Registration was not completed");
192
192
  const { id: o, rawId: a, response: d, type: p } = n;
193
- let _;
194
- typeof d.getTransports == "function" && (_ = d.getTransports());
193
+ let g;
194
+ typeof d.getTransports == "function" && (g = d.getTransports());
195
195
  let y;
196
196
  if (typeof d.getPublicKeyAlgorithm == "function")
197
197
  try {
@@ -220,7 +220,7 @@ async function ki(r) {
220
220
  response: {
221
221
  attestationObject: je(d.attestationObject),
222
222
  clientDataJSON: je(d.clientDataJSON),
223
- transports: _,
223
+ transports: g,
224
224
  publicKeyAlgorithm: y,
225
225
  publicKey: x,
226
226
  authenticatorData: P
@@ -263,7 +263,7 @@ function Ii({ error: r, options: e }) {
263
263
  });
264
264
  if (r.name === "SecurityError") {
265
265
  const s = globalThis.location.hostname;
266
- if (Ur(s)) {
266
+ if ($r(s)) {
267
267
  if (t.rpId !== s)
268
268
  return new he({
269
269
  message: `The RP ID "${t.rpId}" is invalid for this domain`,
@@ -291,7 +291,7 @@ async function ji(r) {
291
291
  if (!qs())
292
292
  throw new Error("WebAuthn is not supported in this browser");
293
293
  let i;
294
- ((P = e.allowCredentials) == null ? void 0 : P.length) !== 0 && (i = (I = e.allowCredentials) == null ? void 0 : I.map($r));
294
+ ((P = e.allowCredentials) == null ? void 0 : P.length) !== 0 && (i = (I = e.allowCredentials) == null ? void 0 : I.map(Ur));
295
295
  const n = {
296
296
  ...e,
297
297
  challenge: zt(e.challenge),
@@ -313,15 +313,15 @@ async function ji(r) {
313
313
  }
314
314
  if (!a)
315
315
  throw new Error("Authentication was not completed");
316
- const { id: d, rawId: p, response: _, type: y } = a;
316
+ const { id: d, rawId: p, response: g, type: y } = a;
317
317
  let x;
318
- return _.userHandle && (x = je(_.userHandle)), {
318
+ return g.userHandle && (x = je(g.userHandle)), {
319
319
  id: d,
320
320
  rawId: je(p),
321
321
  response: {
322
- authenticatorData: je(_.authenticatorData),
323
- clientDataJSON: je(_.clientDataJSON),
324
- signature: je(_.signature),
322
+ authenticatorData: je(g.authenticatorData),
323
+ clientDataJSON: je(g.clientDataJSON),
324
+ signature: je(g.signature),
325
325
  userHandle: x
326
326
  },
327
327
  type: y,
@@ -332,11 +332,36 @@ async function ji(r) {
332
332
  const dt = "LAST_AUTH_DATA";
333
333
  class Fr {
334
334
  constructor(e) {
335
- this.options = e;
335
+ h(this, "onUserDataUpdate");
336
+ h(this, "isAuthenticated");
337
+ h(this, "isAuthenticatedResolver", () => {
338
+ });
339
+ this.options = e, this.isAuthenticated = new Promise(
340
+ (t) => this.isAuthenticatedResolver = t
341
+ );
336
342
  }
337
343
  get url() {
338
344
  return this.options.authUrl;
339
345
  }
346
+ async init() {
347
+ var t, s;
348
+ const e = localStorage.getItem(dt);
349
+ if (e)
350
+ try {
351
+ const i = JSON.parse(e);
352
+ (t = this.onUserDataUpdate) == null || t.call(this, i), this.isAuthenticatedResolver();
353
+ } catch {
354
+ }
355
+ else {
356
+ const i = await this.me();
357
+ (s = this.onUserDataUpdate) == null || s.call(this, i), this.isAuthenticatedResolver();
358
+ }
359
+ }
360
+ async me() {
361
+ return await fetch(this.options.authUrl + "/me", {
362
+ credentials: "include"
363
+ }).then((t) => t.json());
364
+ }
340
365
  async requestEmailLogin(e, t = location.href) {
341
366
  return await fetch(
342
367
  this.options.authUrl + `/email-verification-request/${e}?returnUrl=${t}`,
@@ -344,14 +369,15 @@ class Fr {
344
369
  ).then(pt);
345
370
  }
346
371
  async completeEmailLogin(e, t) {
372
+ var i;
347
373
  const s = await fetch(
348
374
  this.options.authUrl + `/email-verification-complete/${e}/${t}`,
349
375
  { credentials: "include" }
350
376
  ).then(pt);
351
- return await this.options.storage.setItem(dt, s), s;
377
+ return await this.options.storage.setItem(dt, s), (i = this.onUserDataUpdate) == null || i.call(this, s), s;
352
378
  }
353
379
  async requestPasskeyLogin(e = {}) {
354
- var d;
380
+ var d, p;
355
381
  const {
356
382
  displayName: t = "",
357
383
  isRegistration: s = !1,
@@ -367,10 +393,10 @@ class Fr {
367
393
  }) : o = await ji({
368
394
  optionsJSON: n
369
395
  });
370
- } catch (p) {
371
- throw p.name === "InvalidStateError" ? alert(
396
+ } catch (g) {
397
+ throw g.name === "InvalidStateError" ? alert(
372
398
  "Error: Authenticator was probably already registered by user"
373
- ) : alert(p.message), p;
399
+ ) : alert(g.message), g;
374
400
  }
375
401
  const a = await fetch(
376
402
  this.options.authUrl + `/webauth-challenge-complete?displayName=${t}&addAsAdditionalDevice=${i ? "true" : ""}`,
@@ -383,16 +409,14 @@ class Fr {
383
409
  credentials: "include"
384
410
  }
385
411
  ).then(pt);
386
- return await this.options.storage.setItem(dt, a), a;
412
+ return await this.options.storage.setItem(dt, a), (p = this.onUserDataUpdate) == null || p.call(this, a), a;
387
413
  }
388
414
  async guestLogin() {
415
+ var t;
389
416
  const e = await fetch(this.options.authUrl + "/sign-out", {
390
417
  credentials: "include"
391
418
  }).then(pt);
392
- return await this.options.storage.setItem(dt, e), e;
393
- }
394
- async clearLoginData() {
395
- await this.options.storage.removeItem(dt);
419
+ return await this.options.storage.setItem(dt, e), (t = this.onUserDataUpdate) == null || t.call(this, e), e;
396
420
  }
397
421
  getLastLoginData() {
398
422
  return this.options.storage.getItem(
@@ -469,7 +493,7 @@ class Mi {
469
493
  }
470
494
  }
471
495
  const ye = new Uint8Array(0), Ke = new TextEncoder(), ge = new TextDecoder();
472
- function $i(...r) {
496
+ function Ui(...r) {
473
497
  let e = 0;
474
498
  for (let i = 0; i < r.length; i++)
475
499
  e += r[i].length;
@@ -483,12 +507,12 @@ function yt(...r) {
483
507
  const e = [];
484
508
  for (let t = 0; t < r.length; t++)
485
509
  e.push(Ke.encode(r[t]));
486
- return e.length === 0 ? ye : e.length === 1 ? e[0] : $i(...e);
510
+ return e.length === 0 ? ye : e.length === 1 ? e[0] : Ui(...e);
487
511
  }
488
512
  function hr(r) {
489
513
  return !r || r.length === 0 ? "" : ge.decode(r);
490
514
  }
491
- const ur = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", lr = 36, Ui = 3656158440062976, fr = 33, Li = 333, dr = 22;
515
+ const ur = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", lr = 36, $i = 3656158440062976, fr = 33, Li = 333, dr = 22;
492
516
  function qi(r) {
493
517
  for (let e = 0; e < r.length; e++)
494
518
  r[e] = Math.floor(Math.random() * 255);
@@ -509,7 +533,7 @@ class Bi {
509
533
  this.inited = !0, this.setPre(), this.initSeqAndInc(), this.fillSeq();
510
534
  }
511
535
  initSeqAndInc() {
512
- this.seq = Math.floor(Math.random() * Ui), this.inc = Math.floor(Math.random() * (Li - fr) + fr);
536
+ this.seq = Math.floor(Math.random() * $i), this.inc = Math.floor(Math.random() * (Li - fr) + fr);
513
537
  }
514
538
  setPre() {
515
539
  const e = new Uint8Array(12);
@@ -532,10 +556,10 @@ class Bi {
532
556
  }
533
557
  }
534
558
  const De = new Bi();
535
- var Ee;
559
+ var ve;
536
560
  (function(r) {
537
561
  r.Disconnect = "disconnect", r.Reconnect = "reconnect", r.Update = "update", r.LDM = "ldm", r.Error = "error";
538
- })(Ee || (Ee = {}));
562
+ })(ve || (ve = {}));
539
563
  var Le;
540
564
  (function(r) {
541
565
  r.Reconnecting = "reconnecting", r.PingTimer = "pingTimer", r.StaleConnection = "staleConnection", r.ClientInitiatedReconnect = "client initiated reconnect";
@@ -744,7 +768,7 @@ function pr(r) {
744
768
  }
745
769
  return String.fromCharCode(...i);
746
770
  }
747
- function $e(r = 0, e = "") {
771
+ function Ue(r = 0, e = "") {
748
772
  if (r === 0 && e !== "" || r > 0 && e === "")
749
773
  throw new Error("setting status requires both code and description");
750
774
  return new Fe(r, e);
@@ -923,7 +947,7 @@ function mr() {
923
947
  }
924
948
  };
925
949
  }
926
- function ve(r) {
950
+ function Ee(r) {
927
951
  return {
928
952
  encode(e) {
929
953
  try {
@@ -983,7 +1007,7 @@ class Ds {
983
1007
  return e + t + s;
984
1008
  }
985
1009
  json(e) {
986
- return ve(e).decode(this.data);
1010
+ return Ee(e).decode(this.data);
987
1011
  }
988
1012
  string() {
989
1013
  return ge.decode(this.data);
@@ -1064,7 +1088,7 @@ function Os(r) {
1064
1088
  return Ps(r) && ((e = r.headers) == null ? void 0 : e.description) === "Idle Heartbeat";
1065
1089
  }
1066
1090
  function Gi(r, e, t) {
1067
- const s = $e(r, e), i = {
1091
+ const s = Ue(r, e), i = {
1068
1092
  hdr: 1,
1069
1093
  sid: 0,
1070
1094
  size: 0
@@ -1245,10 +1269,10 @@ var ks;
1245
1269
  (function(r) {
1246
1270
  r.Limits = "limits", r.Interest = "interest", r.Workqueue = "workqueue";
1247
1271
  })(ks || (ks = {}));
1248
- var Et;
1272
+ var vt;
1249
1273
  (function(r) {
1250
1274
  r.Old = "old", r.New = "new";
1251
- })(Et || (Et = {}));
1275
+ })(vt || (vt = {}));
1252
1276
  var Cs;
1253
1277
  (function(r) {
1254
1278
  r.File = "file", r.Memory = "memory";
@@ -1615,7 +1639,7 @@ ys = ss, function() {
1615
1639
  16,
1616
1640
  8,
1617
1641
  0
1618
- ], _ = [
1642
+ ], g = [
1619
1643
  1116352408,
1620
1644
  1899447441,
1621
1645
  3049323471,
@@ -1708,13 +1732,13 @@ ys = ss, function() {
1708
1732
  }
1709
1733
  return j;
1710
1734
  }, T = function(w, j) {
1711
- var F, R = xr, A = xr.Buffer, $ = j ? "sha224" : "sha256";
1735
+ var F, R = xr, A = xr.Buffer, U = j ? "sha224" : "sha256";
1712
1736
  return F = A.from && !t.JS_SHA256_NO_BUFFER_FROM ? A.from : function(q) {
1713
1737
  return new A(q);
1714
1738
  }, function(q) {
1715
- if (typeof q == "string") return R.createHash($).update(q, "utf8").digest("hex");
1739
+ if (typeof q == "string") return R.createHash(U).update(q, "utf8").digest("hex");
1716
1740
  if (q == null) throw new Error(r);
1717
- return q.constructor === ArrayBuffer && (q = new Uint8Array(q)), Array.isArray(q) || ArrayBuffer.isView(q) || q.constructor === A ? R.createHash($).update(F(q)).digest("hex") : w(q);
1741
+ return q.constructor === ArrayBuffer && (q = new Uint8Array(q)), Array.isArray(q) || ArrayBuffer.isView(q) || q.constructor === A ? R.createHash(U).update(F(q)).digest("hex") : w(q);
1718
1742
  };
1719
1743
  }, J = function(w, j) {
1720
1744
  return function(F, R) {
@@ -1724,8 +1748,8 @@ ys = ss, function() {
1724
1748
  var j = J("hex", w);
1725
1749
  j.create = function(A) {
1726
1750
  return new Y(A, w);
1727
- }, j.update = function(A, $) {
1728
- return j.create(A).update($);
1751
+ }, j.update = function(A, U) {
1752
+ return j.create(A).update(U);
1729
1753
  };
1730
1754
  for (var F = 0; F < y.length; ++F) {
1731
1755
  var R = y[F];
@@ -1757,8 +1781,8 @@ ys = ss, function() {
1757
1781
  function Y(w, j, F) {
1758
1782
  var R, A = typeof w;
1759
1783
  if (A === "string") {
1760
- var $, q = [], U = w.length, z = 0;
1761
- for (R = 0; R < U; ++R) ($ = w.charCodeAt(R)) < 128 ? q[z++] = $ : $ < 2048 ? (q[z++] = 192 | $ >>> 6, q[z++] = 128 | 63 & $) : $ < 55296 || $ >= 57344 ? (q[z++] = 224 | $ >>> 12, q[z++] = 128 | $ >>> 6 & 63, q[z++] = 128 | 63 & $) : ($ = 65536 + ((1023 & $) << 10 | 1023 & w.charCodeAt(++R)), q[z++] = 240 | $ >>> 18, q[z++] = 128 | $ >>> 12 & 63, q[z++] = 128 | $ >>> 6 & 63, q[z++] = 128 | 63 & $);
1784
+ var U, q = [], $ = w.length, z = 0;
1785
+ for (R = 0; R < $; ++R) (U = w.charCodeAt(R)) < 128 ? q[z++] = U : U < 2048 ? (q[z++] = 192 | U >>> 6, q[z++] = 128 | 63 & U) : U < 55296 || U >= 57344 ? (q[z++] = 224 | U >>> 12, q[z++] = 128 | U >>> 6 & 63, q[z++] = 128 | 63 & U) : (U = 65536 + ((1023 & U) << 10 | 1023 & w.charCodeAt(++R)), q[z++] = 240 | U >>> 18, q[z++] = 128 | U >>> 12 & 63, q[z++] = 128 | U >>> 6 & 63, q[z++] = 128 | 63 & U);
1762
1786
  w = q;
1763
1787
  } else {
1764
1788
  if (A !== "object") throw new Error(r);
@@ -1784,10 +1808,10 @@ ys = ss, function() {
1784
1808
  else if (!(Array.isArray(w) || o && ArrayBuffer.isView(w))) throw new Error(r);
1785
1809
  j = !0;
1786
1810
  }
1787
- for (var R, A, $ = 0, q = w.length, U = this.blocks; $ < q; ) {
1788
- if (this.hashed && (this.hashed = !1, U[0] = this.block, this.block = U[16] = U[1] = U[2] = U[3] = U[4] = U[5] = U[6] = U[7] = U[8] = U[9] = U[10] = U[11] = U[12] = U[13] = U[14] = U[15] = 0), j) for (A = this.start; $ < q && A < 64; ++$) U[A >>> 2] |= w[$] << p[3 & A++];
1789
- else for (A = this.start; $ < q && A < 64; ++$) (R = w.charCodeAt($)) < 128 ? U[A >>> 2] |= R << p[3 & A++] : R < 2048 ? (U[A >>> 2] |= (192 | R >>> 6) << p[3 & A++], U[A >>> 2] |= (128 | 63 & R) << p[3 & A++]) : R < 55296 || R >= 57344 ? (U[A >>> 2] |= (224 | R >>> 12) << p[3 & A++], U[A >>> 2] |= (128 | R >>> 6 & 63) << p[3 & A++], U[A >>> 2] |= (128 | 63 & R) << p[3 & A++]) : (R = 65536 + ((1023 & R) << 10 | 1023 & w.charCodeAt(++$)), U[A >>> 2] |= (240 | R >>> 18) << p[3 & A++], U[A >>> 2] |= (128 | R >>> 12 & 63) << p[3 & A++], U[A >>> 2] |= (128 | R >>> 6 & 63) << p[3 & A++], U[A >>> 2] |= (128 | 63 & R) << p[3 & A++]);
1790
- this.lastByteIndex = A, this.bytes += A - this.start, A >= 64 ? (this.block = U[16], this.start = A - 64, this.hash(), this.hashed = !0) : this.start = A;
1811
+ for (var R, A, U = 0, q = w.length, $ = this.blocks; U < q; ) {
1812
+ if (this.hashed && (this.hashed = !1, $[0] = this.block, this.block = $[16] = $[1] = $[2] = $[3] = $[4] = $[5] = $[6] = $[7] = $[8] = $[9] = $[10] = $[11] = $[12] = $[13] = $[14] = $[15] = 0), j) for (A = this.start; U < q && A < 64; ++U) $[A >>> 2] |= w[U] << p[3 & A++];
1813
+ else for (A = this.start; U < q && A < 64; ++U) (R = w.charCodeAt(U)) < 128 ? $[A >>> 2] |= R << p[3 & A++] : R < 2048 ? ($[A >>> 2] |= (192 | R >>> 6) << p[3 & A++], $[A >>> 2] |= (128 | 63 & R) << p[3 & A++]) : R < 55296 || R >= 57344 ? ($[A >>> 2] |= (224 | R >>> 12) << p[3 & A++], $[A >>> 2] |= (128 | R >>> 6 & 63) << p[3 & A++], $[A >>> 2] |= (128 | 63 & R) << p[3 & A++]) : (R = 65536 + ((1023 & R) << 10 | 1023 & w.charCodeAt(++U)), $[A >>> 2] |= (240 | R >>> 18) << p[3 & A++], $[A >>> 2] |= (128 | R >>> 12 & 63) << p[3 & A++], $[A >>> 2] |= (128 | R >>> 6 & 63) << p[3 & A++], $[A >>> 2] |= (128 | 63 & R) << p[3 & A++]);
1814
+ this.lastByteIndex = A, this.bytes += A - this.start, A >= 64 ? (this.block = $[16], this.start = A - 64, this.hash(), this.hashed = !0) : this.start = A;
1791
1815
  }
1792
1816
  return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 | 0, this.bytes = this.bytes % 4294967296), this;
1793
1817
  }
@@ -1798,17 +1822,17 @@ ys = ss, function() {
1798
1822
  w[16] = this.block, w[j >>> 2] |= d[3 & j], this.block = w[16], j >= 56 && (this.hashed || this.hash(), w[0] = this.block, w[16] = w[1] = w[2] = w[3] = w[4] = w[5] = w[6] = w[7] = w[8] = w[9] = w[10] = w[11] = w[12] = w[13] = w[14] = w[15] = 0), w[14] = this.hBytes << 3 | this.bytes >>> 29, w[15] = this.bytes << 3, this.hash();
1799
1823
  }
1800
1824
  }, L.prototype.hash = function() {
1801
- var w, j, F, R, A, $, q, U, z, ee = this.h0, se = this.h1, te = this.h2, re = this.h3, ae = this.h4, ce = this.h5, V = this.h6, Z = this.h7, ie = this.blocks;
1825
+ var w, j, F, R, A, U, q, $, z, ee = this.h0, se = this.h1, te = this.h2, re = this.h3, ae = this.h4, ce = this.h5, V = this.h6, Z = this.h7, ie = this.blocks;
1802
1826
  for (w = 16; w < 64; ++w) j = ((A = ie[w - 15]) >>> 7 | A << 25) ^ (A >>> 18 | A << 14) ^ A >>> 3, F = ((A = ie[w - 2]) >>> 17 | A << 15) ^ (A >>> 19 | A << 13) ^ A >>> 10, ie[w] = ie[w - 16] + j + ie[w - 7] + F | 0;
1803
- for (z = se & te, w = 0; w < 64; w += 4) this.first ? (this.is224 ? ($ = 300032, Z = (A = ie[0] - 1413257819) - 150054599 | 0, re = A + 24177077 | 0) : ($ = 704751109, Z = (A = ie[0] - 210244248) - 1521486534 | 0, re = A + 143694565 | 0), this.first = !1) : (j = (ee >>> 2 | ee << 30) ^ (ee >>> 13 | ee << 19) ^ (ee >>> 22 | ee << 10), R = ($ = ee & se) ^ ee & te ^ z, Z = re + (A = Z + (F = (ae >>> 6 | ae << 26) ^ (ae >>> 11 | ae << 21) ^ (ae >>> 25 | ae << 7)) + (ae & ce ^ ~ae & V) + _[w] + ie[w]) | 0, re = A + (j + R) | 0), j = (re >>> 2 | re << 30) ^ (re >>> 13 | re << 19) ^ (re >>> 22 | re << 10), R = (q = re & ee) ^ re & se ^ $, V = te + (A = V + (F = (Z >>> 6 | Z << 26) ^ (Z >>> 11 | Z << 21) ^ (Z >>> 25 | Z << 7)) + (Z & ae ^ ~Z & ce) + _[w + 1] + ie[w + 1]) | 0, j = ((te = A + (j + R) | 0) >>> 2 | te << 30) ^ (te >>> 13 | te << 19) ^ (te >>> 22 | te << 10), R = (U = te & re) ^ te & ee ^ q, ce = se + (A = ce + (F = (V >>> 6 | V << 26) ^ (V >>> 11 | V << 21) ^ (V >>> 25 | V << 7)) + (V & Z ^ ~V & ae) + _[w + 2] + ie[w + 2]) | 0, j = ((se = A + (j + R) | 0) >>> 2 | se << 30) ^ (se >>> 13 | se << 19) ^ (se >>> 22 | se << 10), R = (z = se & te) ^ se & re ^ U, ae = ee + (A = ae + (F = (ce >>> 6 | ce << 26) ^ (ce >>> 11 | ce << 21) ^ (ce >>> 25 | ce << 7)) + (ce & V ^ ~ce & Z) + _[w + 3] + ie[w + 3]) | 0, ee = A + (j + R) | 0, this.chromeBugWorkAround = !0;
1827
+ for (z = se & te, w = 0; w < 64; w += 4) this.first ? (this.is224 ? (U = 300032, Z = (A = ie[0] - 1413257819) - 150054599 | 0, re = A + 24177077 | 0) : (U = 704751109, Z = (A = ie[0] - 210244248) - 1521486534 | 0, re = A + 143694565 | 0), this.first = !1) : (j = (ee >>> 2 | ee << 30) ^ (ee >>> 13 | ee << 19) ^ (ee >>> 22 | ee << 10), R = (U = ee & se) ^ ee & te ^ z, Z = re + (A = Z + (F = (ae >>> 6 | ae << 26) ^ (ae >>> 11 | ae << 21) ^ (ae >>> 25 | ae << 7)) + (ae & ce ^ ~ae & V) + g[w] + ie[w]) | 0, re = A + (j + R) | 0), j = (re >>> 2 | re << 30) ^ (re >>> 13 | re << 19) ^ (re >>> 22 | re << 10), R = (q = re & ee) ^ re & se ^ U, V = te + (A = V + (F = (Z >>> 6 | Z << 26) ^ (Z >>> 11 | Z << 21) ^ (Z >>> 25 | Z << 7)) + (Z & ae ^ ~Z & ce) + g[w + 1] + ie[w + 1]) | 0, j = ((te = A + (j + R) | 0) >>> 2 | te << 30) ^ (te >>> 13 | te << 19) ^ (te >>> 22 | te << 10), R = ($ = te & re) ^ te & ee ^ q, ce = se + (A = ce + (F = (V >>> 6 | V << 26) ^ (V >>> 11 | V << 21) ^ (V >>> 25 | V << 7)) + (V & Z ^ ~V & ae) + g[w + 2] + ie[w + 2]) | 0, j = ((se = A + (j + R) | 0) >>> 2 | se << 30) ^ (se >>> 13 | se << 19) ^ (se >>> 22 | se << 10), R = (z = se & te) ^ se & re ^ $, ae = ee + (A = ae + (F = (ce >>> 6 | ce << 26) ^ (ce >>> 11 | ce << 21) ^ (ce >>> 25 | ce << 7)) + (ce & V ^ ~ce & Z) + g[w + 3] + ie[w + 3]) | 0, ee = A + (j + R) | 0, this.chromeBugWorkAround = !0;
1804
1828
  this.h0 = this.h0 + ee | 0, this.h1 = this.h1 + se | 0, this.h2 = this.h2 + te | 0, this.h3 = this.h3 + re | 0, this.h4 = this.h4 + ae | 0, this.h5 = this.h5 + ce | 0, this.h6 = this.h6 + V | 0, this.h7 = this.h7 + Z | 0;
1805
1829
  }, L.prototype.hex = function() {
1806
1830
  this.finalize();
1807
- var w = this.h0, j = this.h1, F = this.h2, R = this.h3, A = this.h4, $ = this.h5, q = this.h6, U = this.h7, z = a[w >>> 28 & 15] + a[w >>> 24 & 15] + a[w >>> 20 & 15] + a[w >>> 16 & 15] + a[w >>> 12 & 15] + a[w >>> 8 & 15] + a[w >>> 4 & 15] + a[15 & w] + a[j >>> 28 & 15] + a[j >>> 24 & 15] + a[j >>> 20 & 15] + a[j >>> 16 & 15] + a[j >>> 12 & 15] + a[j >>> 8 & 15] + a[j >>> 4 & 15] + a[15 & j] + a[F >>> 28 & 15] + a[F >>> 24 & 15] + a[F >>> 20 & 15] + a[F >>> 16 & 15] + a[F >>> 12 & 15] + a[F >>> 8 & 15] + a[F >>> 4 & 15] + a[15 & F] + a[R >>> 28 & 15] + a[R >>> 24 & 15] + a[R >>> 20 & 15] + a[R >>> 16 & 15] + a[R >>> 12 & 15] + a[R >>> 8 & 15] + a[R >>> 4 & 15] + a[15 & R] + a[A >>> 28 & 15] + a[A >>> 24 & 15] + a[A >>> 20 & 15] + a[A >>> 16 & 15] + a[A >>> 12 & 15] + a[A >>> 8 & 15] + a[A >>> 4 & 15] + a[15 & A] + a[$ >>> 28 & 15] + a[$ >>> 24 & 15] + a[$ >>> 20 & 15] + a[$ >>> 16 & 15] + a[$ >>> 12 & 15] + a[$ >>> 8 & 15] + a[$ >>> 4 & 15] + a[15 & $] + a[q >>> 28 & 15] + a[q >>> 24 & 15] + a[q >>> 20 & 15] + a[q >>> 16 & 15] + a[q >>> 12 & 15] + a[q >>> 8 & 15] + a[q >>> 4 & 15] + a[15 & q];
1808
- return this.is224 || (z += a[U >>> 28 & 15] + a[U >>> 24 & 15] + a[U >>> 20 & 15] + a[U >>> 16 & 15] + a[U >>> 12 & 15] + a[U >>> 8 & 15] + a[U >>> 4 & 15] + a[15 & U]), z;
1831
+ var w = this.h0, j = this.h1, F = this.h2, R = this.h3, A = this.h4, U = this.h5, q = this.h6, $ = this.h7, z = a[w >>> 28 & 15] + a[w >>> 24 & 15] + a[w >>> 20 & 15] + a[w >>> 16 & 15] + a[w >>> 12 & 15] + a[w >>> 8 & 15] + a[w >>> 4 & 15] + a[15 & w] + a[j >>> 28 & 15] + a[j >>> 24 & 15] + a[j >>> 20 & 15] + a[j >>> 16 & 15] + a[j >>> 12 & 15] + a[j >>> 8 & 15] + a[j >>> 4 & 15] + a[15 & j] + a[F >>> 28 & 15] + a[F >>> 24 & 15] + a[F >>> 20 & 15] + a[F >>> 16 & 15] + a[F >>> 12 & 15] + a[F >>> 8 & 15] + a[F >>> 4 & 15] + a[15 & F] + a[R >>> 28 & 15] + a[R >>> 24 & 15] + a[R >>> 20 & 15] + a[R >>> 16 & 15] + a[R >>> 12 & 15] + a[R >>> 8 & 15] + a[R >>> 4 & 15] + a[15 & R] + a[A >>> 28 & 15] + a[A >>> 24 & 15] + a[A >>> 20 & 15] + a[A >>> 16 & 15] + a[A >>> 12 & 15] + a[A >>> 8 & 15] + a[A >>> 4 & 15] + a[15 & A] + a[U >>> 28 & 15] + a[U >>> 24 & 15] + a[U >>> 20 & 15] + a[U >>> 16 & 15] + a[U >>> 12 & 15] + a[U >>> 8 & 15] + a[U >>> 4 & 15] + a[15 & U] + a[q >>> 28 & 15] + a[q >>> 24 & 15] + a[q >>> 20 & 15] + a[q >>> 16 & 15] + a[q >>> 12 & 15] + a[q >>> 8 & 15] + a[q >>> 4 & 15] + a[15 & q];
1832
+ return this.is224 || (z += a[$ >>> 28 & 15] + a[$ >>> 24 & 15] + a[$ >>> 20 & 15] + a[$ >>> 16 & 15] + a[$ >>> 12 & 15] + a[$ >>> 8 & 15] + a[$ >>> 4 & 15] + a[15 & $]), z;
1809
1833
  }, L.prototype.toString = L.prototype.hex, L.prototype.digest = function() {
1810
1834
  this.finalize();
1811
- var w = this.h0, j = this.h1, F = this.h2, R = this.h3, A = this.h4, $ = this.h5, q = this.h6, U = this.h7, z = [
1835
+ var w = this.h0, j = this.h1, F = this.h2, R = this.h3, A = this.h4, U = this.h5, q = this.h6, $ = this.h7, z = [
1812
1836
  w >>> 24 & 255,
1813
1837
  w >>> 16 & 255,
1814
1838
  w >>> 8 & 255,
@@ -1829,16 +1853,16 @@ ys = ss, function() {
1829
1853
  A >>> 16 & 255,
1830
1854
  A >>> 8 & 255,
1831
1855
  255 & A,
1832
- $ >>> 24 & 255,
1833
- $ >>> 16 & 255,
1834
- $ >>> 8 & 255,
1835
- 255 & $,
1856
+ U >>> 24 & 255,
1857
+ U >>> 16 & 255,
1858
+ U >>> 8 & 255,
1859
+ 255 & U,
1836
1860
  q >>> 24 & 255,
1837
1861
  q >>> 16 & 255,
1838
1862
  q >>> 8 & 255,
1839
1863
  255 & q
1840
1864
  ];
1841
- return this.is224 || z.push(U >>> 24 & 255, U >>> 16 & 255, U >>> 8 & 255, 255 & U), z;
1865
+ return this.is224 || z.push($ >>> 24 & 255, $ >>> 16 & 255, $ >>> 8 & 255, 255 & $), z;
1842
1866
  }, L.prototype.array = L.prototype.digest, L.prototype.arrayBuffer = function() {
1843
1867
  this.finalize();
1844
1868
  var w = new ArrayBuffer(this.is224 ? 28 : 32), j = new DataView(w);
@@ -1973,7 +1997,7 @@ class Ot {
1973
1997
  h(this, "prefix");
1974
1998
  h(this, "timeout");
1975
1999
  h(this, "jc");
1976
- this.nc = e, this.opts = ln(t), this._parseOpts(), this.prefix = this.opts.apiPrefix, this.timeout = this.opts.timeout, this.jc = ve();
2000
+ this.nc = e, this.opts = ln(t), this._parseOpts(), this.prefix = this.opts.apiPrefix, this.timeout = this.opts.timeout, this.jc = Ee();
1977
2001
  }
1978
2002
  getOptions() {
1979
2003
  return Object.assign({}, this.opts);
@@ -2160,7 +2184,7 @@ class Yt extends Ot {
2160
2184
  const P = x.message, I = P.indexOf("cannot contain");
2161
2185
  throw I !== -1 ? new Error(`consumer 'name' ${P.substring(I)}`) : x;
2162
2186
  }
2163
- let p, _ = "";
2187
+ let p, g = "";
2164
2188
  if (Array.isArray(t.filter_subjects)) {
2165
2189
  const { min: x, ok: P } = n.features.get(H.JS_MULTIPLE_CONSUMER_FILTER);
2166
2190
  if (!P)
@@ -2172,9 +2196,9 @@ class Yt extends Ot {
2172
2196
  if (!P)
2173
2197
  throw new Error(`consumer 'metadata' requires server ${x}`);
2174
2198
  }
2175
- if (a && (_ = t.name ?? t.durable_name ?? ""), _ !== "") {
2199
+ if (a && (g = t.name ?? t.durable_name ?? ""), g !== "") {
2176
2200
  let x = t.filter_subject ?? void 0;
2177
- x === ">" && (x = void 0), p = x !== void 0 ? `${this.prefix}.CONSUMER.CREATE.${e}.${_}.${x}` : `${this.prefix}.CONSUMER.CREATE.${e}.${_}`;
2201
+ x === ">" && (x = void 0), p = x !== void 0 ? `${this.prefix}.CONSUMER.CREATE.${e}.${g}.${x}` : `${this.prefix}.CONSUMER.CREATE.${e}.${g}`;
2178
2202
  } else
2179
2203
  p = t.durable_name ? `${this.prefix}.CONSUMER.DURABLE.CREATE.${e}.${t.durable_name}` : `${this.prefix}.CONSUMER.CREATE.${e}`;
2180
2204
  return await this._request(p, i);
@@ -2217,21 +2241,21 @@ class dn extends oe {
2217
2241
  h(this, "adapter");
2218
2242
  h(this, "subIterDone");
2219
2243
  Ze(i.adapter, "adapter", !0), this.adapter = i.adapter, i.callback && Ze(i.callback, "callback"), this.noIterator = typeof i.callback == "function", i.ingestionFilterFn && (Ze(i.ingestionFilterFn, "ingestionFilterFn"), this.ingestionFilterFn = i.ingestionFilterFn), i.protocolFilterFn && (Ze(i.protocolFilterFn, "protocolFilterFn"), this.protocolFilterFn = i.protocolFilterFn), i.dispatchedFn && (Ze(i.dispatchedFn, "dispatchedFn"), this.dispatchedFn = i.dispatchedFn), i.cleanupFn && Ze(i.cleanupFn, "cleanupFn");
2220
- let n = (_, y) => {
2221
- this.callback(_, y);
2244
+ let n = (g, y) => {
2245
+ this.callback(g, y);
2222
2246
  };
2223
2247
  if (i.callback) {
2224
- const _ = i.callback;
2248
+ const g = i.callback;
2225
2249
  n = (y, x) => {
2226
2250
  const [P, I] = this.adapter(y, x);
2227
2251
  if (P) {
2228
- _(P, null);
2252
+ g(P, null);
2229
2253
  return;
2230
2254
  }
2231
2255
  const { ingest: T } = this.ingestionFilterFn ? this.ingestionFilterFn(I, this) : {
2232
2256
  ingest: !0
2233
2257
  };
2234
- T && (!this.protocolFilterFn || this.protocolFilterFn(I)) && (_(P, I), this.dispatchedFn && I && this.dispatchedFn(I));
2258
+ T && (!this.protocolFilterFn || this.protocolFilterFn(I)) && (g(P, I), this.dispatchedFn && I && this.dispatchedFn(I));
2235
2259
  };
2236
2260
  }
2237
2261
  const { max: o, queue: a, timeout: d } = i, p = {
@@ -2248,8 +2272,8 @@ class dn extends oe {
2248
2272
  this.subIterDone.resolve();
2249
2273
  }).catch(() => {
2250
2274
  this.subIterDone.resolve();
2251
- }), (async (_) => {
2252
- await _.closed, this.stop();
2275
+ }), (async (g) => {
2276
+ await g.closed, this.stop();
2253
2277
  })(this.sub).then().catch();
2254
2278
  }
2255
2279
  unsubscribe(t) {
@@ -2328,7 +2352,7 @@ function yn(r) {
2328
2352
  return "";
2329
2353
  }
2330
2354
  const wn = 4, Vr = 48, xn = 65, Sn = 97;
2331
- function En(r, e, t, s) {
2355
+ function vn(r, e, t, s) {
2332
2356
  const i = new Uint8Array(16);
2333
2357
  return [
2334
2358
  0,
@@ -2348,9 +2372,9 @@ function En(r, e, t, s) {
2348
2372
  }), i[12] = r, i[13] = e, i[14] = t, i[15] = s, i;
2349
2373
  }
2350
2374
  function Ns(r) {
2351
- return vn(r) !== void 0;
2375
+ return En(r) !== void 0;
2352
2376
  }
2353
- function vn(r) {
2377
+ function En(r) {
2354
2378
  for (let e = 0; e < r.length; e++)
2355
2379
  switch (r[e]) {
2356
2380
  case ".":
@@ -2374,7 +2398,7 @@ function Wr(r) {
2374
2398
  return;
2375
2399
  r = r.substring(i), e[t] = s;
2376
2400
  }
2377
- return En(e[0], e[1], e[2], e[3]);
2401
+ return vn(e[0], e[1], e[2], e[3]);
2378
2402
  }
2379
2403
  function An(r) {
2380
2404
  const e = new Uint8Array(16);
@@ -2600,8 +2624,8 @@ class jn {
2600
2624
  });
2601
2625
  const a = [];
2602
2626
  return this.servers.forEach((d, p) => {
2603
- const _ = d.listen;
2604
- d.gossiped && this.currentServer.listen !== _ && o.get(_) === void 0 && a.push(p), o.delete(_);
2627
+ const g = d.listen;
2628
+ d.gossiped && this.currentServer.listen !== g && o.get(g) === void 0 && a.push(p), o.delete(g);
2605
2629
  }), a.reverse(), a.forEach((d) => {
2606
2630
  const p = this.servers.splice(d, 1);
2607
2631
  i = i.concat(p[0].listen);
@@ -2717,7 +2741,7 @@ function Mn(r, e = "Assertion failed.") {
2717
2741
  if (!r)
2718
2742
  throw new Tn(e);
2719
2743
  }
2720
- const Er = 32 * 1024, xs = 2 ** 32 - 2;
2744
+ const vr = 32 * 1024, xs = 2 ** 32 - 2;
2721
2745
  function qt(r, e, t = 0) {
2722
2746
  const s = e.byteLength - t;
2723
2747
  return r.byteLength > s && (r = r.subarray(0, s)), e.set(r, t), r.byteLength;
@@ -2812,9 +2836,9 @@ class Ss {
2812
2836
  }
2813
2837
  readFrom(e) {
2814
2838
  let t = 0;
2815
- const s = new Uint8Array(Er);
2839
+ const s = new Uint8Array(vr);
2816
2840
  for (; ; ) {
2817
- const i = this.capacity - this.length < Er, n = i ? s : new Uint8Array(this._buf.buffer, this.length), o = e.read(n);
2841
+ const i = this.capacity - this.length < vr, n = i ? s : new Uint8Array(this._buf.buffer, this.length), o = e.read(n);
2818
2842
  if (o === null)
2819
2843
  return t;
2820
2844
  i ? this.write(n.subarray(0, o)) : this._reslice(this.length + o), t += o;
@@ -2825,11 +2849,11 @@ var fe;
2825
2849
  (function(r) {
2826
2850
  r[r.OK = 0] = "OK", r[r.ERR = 1] = "ERR", r[r.MSG = 2] = "MSG", r[r.INFO = 3] = "INFO", r[r.PING = 4] = "PING", r[r.PONG = 5] = "PONG";
2827
2851
  })(fe || (fe = {}));
2828
- function vr() {
2852
+ function Er() {
2829
2853
  const r = {};
2830
2854
  return r.sid = -1, r.hdr = -1, r.size = -1, r;
2831
2855
  }
2832
- const $n = 48;
2856
+ const Un = 48;
2833
2857
  class Ar {
2834
2858
  constructor(e) {
2835
2859
  h(this, "dispatcher");
@@ -2851,11 +2875,11 @@ class Ar {
2851
2875
  switch (s) {
2852
2876
  case C.M:
2853
2877
  case C.m:
2854
- this.state = k.OP_M, this.hdr = -1, this.ma = vr();
2878
+ this.state = k.OP_M, this.hdr = -1, this.ma = Er();
2855
2879
  break;
2856
2880
  case C.H:
2857
2881
  case C.h:
2858
- this.state = k.OP_H, this.hdr = 0, this.ma = vr();
2882
+ this.state = k.OP_H, this.hdr = 0, this.ma = Er();
2859
2883
  break;
2860
2884
  case C.P:
2861
2885
  case C.p:
@@ -3284,7 +3308,7 @@ class Ar {
3284
3308
  for (let s = 0; s < e.length; s++) {
3285
3309
  if (e[s] < 48 || e[s] > 57)
3286
3310
  return -1;
3287
- t = t * 10 + (e[s] - $n);
3311
+ t = t * 10 + (e[s] - Un);
3288
3312
  }
3289
3313
  return t;
3290
3314
  }
@@ -3330,7 +3354,7 @@ var C;
3330
3354
  11119,
3331
3355
  27886,
3332
3356
  20995
3333
- ]), _ = t([
3357
+ ]), g = t([
3334
3358
  61785,
3335
3359
  9906,
3336
3360
  39828,
@@ -3419,9 +3443,9 @@ var C;
3419
3443
  c[l] = u.hi >> 24 & 255, c[l + 1] = u.hi >> 16 & 255, c[l + 2] = u.hi >> 8 & 255, c[l + 3] = u.hi & 255, c[l + 4] = u.lo >> 24 & 255, c[l + 5] = u.lo >> 16 & 255, c[l + 6] = u.lo >> 8 & 255, c[l + 7] = u.lo & 255;
3420
3444
  }
3421
3445
  function Y(c, l, u, f, m) {
3422
- var b, E = 0;
3423
- for (b = 0; b < m; b++) E |= c[l + b] ^ u[f + b];
3424
- return (1 & E - 1 >>> 8) - 1;
3446
+ var b, v = 0;
3447
+ for (b = 0; b < m; b++) v |= c[l + b] ^ u[f + b];
3448
+ return (1 & v - 1 >>> 8) - 1;
3425
3449
  }
3426
3450
  function ue(c, l, u, f) {
3427
3451
  return Y(c, l, u, f, 16);
@@ -3430,25 +3454,25 @@ var C;
3430
3454
  return Y(c, l, u, f, 32);
3431
3455
  }
3432
3456
  function j(c, l, u, f, m) {
3433
- var b = new Uint32Array(16), E = new Uint32Array(16), v = new Uint32Array(16), g = new Uint32Array(4), S, M, D;
3457
+ var b = new Uint32Array(16), v = new Uint32Array(16), E = new Uint32Array(16), _ = new Uint32Array(4), S, M, D;
3434
3458
  for (S = 0; S < 4; S++)
3435
- E[5 * S] = T(f, 4 * S), E[1 + S] = T(u, 4 * S), E[6 + S] = T(l, 4 * S), E[11 + S] = T(u, 16 + 4 * S);
3436
- for (S = 0; S < 16; S++) v[S] = E[S];
3459
+ v[5 * S] = T(f, 4 * S), v[1 + S] = T(u, 4 * S), v[6 + S] = T(l, 4 * S), v[11 + S] = T(u, 16 + 4 * S);
3460
+ for (S = 0; S < 16; S++) E[S] = v[S];
3437
3461
  for (S = 0; S < 20; S++) {
3438
3462
  for (M = 0; M < 4; M++) {
3439
- for (D = 0; D < 4; D++) g[D] = E[(5 * M + 4 * D) % 16];
3440
- for (g[1] ^= I(g[0] + g[3] | 0, 7), g[2] ^= I(g[1] + g[0] | 0, 9), g[3] ^= I(g[2] + g[1] | 0, 13), g[0] ^= I(g[3] + g[2] | 0, 18), D = 0; D < 4; D++) b[4 * M + (M + D) % 4] = g[D];
3463
+ for (D = 0; D < 4; D++) _[D] = v[(5 * M + 4 * D) % 16];
3464
+ for (_[1] ^= I(_[0] + _[3] | 0, 7), _[2] ^= I(_[1] + _[0] | 0, 9), _[3] ^= I(_[2] + _[1] | 0, 13), _[0] ^= I(_[3] + _[2] | 0, 18), D = 0; D < 4; D++) b[4 * M + (M + D) % 4] = _[D];
3441
3465
  }
3442
- for (D = 0; D < 16; D++) E[D] = b[D];
3466
+ for (D = 0; D < 16; D++) v[D] = b[D];
3443
3467
  }
3444
3468
  if (m) {
3445
- for (S = 0; S < 16; S++) E[S] = E[S] + v[S] | 0;
3469
+ for (S = 0; S < 16; S++) v[S] = v[S] + E[S] | 0;
3446
3470
  for (S = 0; S < 4; S++)
3447
- E[5 * S] = E[5 * S] - T(f, 4 * S) | 0, E[6 + S] = E[6 + S] - T(l, 4 * S) | 0;
3471
+ v[5 * S] = v[5 * S] - T(f, 4 * S) | 0, v[6 + S] = v[6 + S] - T(l, 4 * S) | 0;
3448
3472
  for (S = 0; S < 4; S++)
3449
- X(c, 4 * S, E[5 * S]), X(c, 16 + 4 * S, E[6 + S]);
3473
+ X(c, 4 * S, v[5 * S]), X(c, 16 + 4 * S, v[6 + S]);
3450
3474
  } else
3451
- for (S = 0; S < 16; S++) X(c, 4 * S, E[S] + v[S] | 0);
3475
+ for (S = 0; S < 16; S++) X(c, 4 * S, v[S] + E[S] | 0);
3452
3476
  }
3453
3477
  function F(c, l, u, f) {
3454
3478
  return j(c, l, u, f, !1), 0;
@@ -3474,31 +3498,31 @@ var C;
3474
3498
  32,
3475
3499
  107
3476
3500
  ]);
3477
- function $(c, l, u, f, m, b, E) {
3478
- var v = new Uint8Array(16), g = new Uint8Array(64), S, M;
3501
+ function U(c, l, u, f, m, b, v) {
3502
+ var E = new Uint8Array(16), _ = new Uint8Array(64), S, M;
3479
3503
  if (!m) return 0;
3480
- for (M = 0; M < 16; M++) v[M] = 0;
3481
- for (M = 0; M < 8; M++) v[M] = b[M];
3504
+ for (M = 0; M < 16; M++) E[M] = 0;
3505
+ for (M = 0; M < 8; M++) E[M] = b[M];
3482
3506
  for (; m >= 64; ) {
3483
- for (F(g, v, E, A), M = 0; M < 64; M++) c[l + M] = (u ? u[f + M] : 0) ^ g[M];
3507
+ for (F(_, E, v, A), M = 0; M < 64; M++) c[l + M] = (u ? u[f + M] : 0) ^ _[M];
3484
3508
  for (S = 1, M = 8; M < 16; M++)
3485
- S = S + (v[M] & 255) | 0, v[M] = S & 255, S >>>= 8;
3509
+ S = S + (E[M] & 255) | 0, E[M] = S & 255, S >>>= 8;
3486
3510
  m -= 64, l += 64, u && (f += 64);
3487
3511
  }
3488
3512
  if (m > 0)
3489
- for (F(g, v, E, A), M = 0; M < m; M++) c[l + M] = (u ? u[f + M] : 0) ^ g[M];
3513
+ for (F(_, E, v, A), M = 0; M < m; M++) c[l + M] = (u ? u[f + M] : 0) ^ _[M];
3490
3514
  return 0;
3491
3515
  }
3492
3516
  function q(c, l, u, f, m) {
3493
- return $(c, l, null, 0, u, f, m);
3517
+ return U(c, l, null, 0, u, f, m);
3494
3518
  }
3495
- function U(c, l, u, f, m) {
3519
+ function $(c, l, u, f, m) {
3496
3520
  var b = new Uint8Array(32);
3497
3521
  return R(b, f, m, A), q(c, l, u, f.subarray(16), b);
3498
3522
  }
3499
- function z(c, l, u, f, m, b, E) {
3500
- var v = new Uint8Array(32);
3501
- return R(v, b, E, A), $(c, l, u, f, m, b.subarray(16), v);
3523
+ function z(c, l, u, f, m, b, v) {
3524
+ var E = new Uint8Array(32);
3525
+ return R(E, b, v, A), U(c, l, u, f, m, b.subarray(16), E);
3502
3526
  }
3503
3527
  function ee(c, l) {
3504
3528
  var u, f = 0;
@@ -3525,30 +3549,30 @@ var C;
3525
3549
  252
3526
3550
  ]);
3527
3551
  function te(c, l, u, f, m, b) {
3528
- var E, v, g, S, M = new Uint32Array(17), D = new Uint32Array(17), W = new Uint32Array(17), Oe = new Uint32Array(17), Xe = new Uint32Array(17);
3529
- for (g = 0; g < 17; g++) D[g] = W[g] = 0;
3530
- for (g = 0; g < 16; g++) D[g] = b[g];
3552
+ var v, E, _, S, M = new Uint32Array(17), D = new Uint32Array(17), W = new Uint32Array(17), Oe = new Uint32Array(17), Xe = new Uint32Array(17);
3553
+ for (_ = 0; _ < 17; _++) D[_] = W[_] = 0;
3554
+ for (_ = 0; _ < 16; _++) D[_] = b[_];
3531
3555
  for (D[3] &= 15, D[4] &= 252, D[7] &= 15, D[8] &= 252, D[11] &= 15, D[12] &= 252, D[15] &= 15; m > 0; ) {
3532
- for (g = 0; g < 17; g++) Oe[g] = 0;
3533
- for (g = 0; g < 16 && g < m; ++g) Oe[g] = u[f + g];
3534
- for (Oe[g] = 1, f += g, m -= g, ee(W, Oe), v = 0; v < 17; v++)
3535
- for (M[v] = 0, g = 0; g < 17; g++) M[v] = M[v] + W[g] * (g <= v ? D[v - g] : 320 * D[v + 17 - g] | 0) | 0 | 0;
3536
- for (v = 0; v < 17; v++) W[v] = M[v];
3537
- for (S = 0, g = 0; g < 16; g++)
3538
- S = S + W[g] | 0, W[g] = S & 255, S >>>= 8;
3539
- for (S = S + W[16] | 0, W[16] = S & 3, S = 5 * (S >>> 2) | 0, g = 0; g < 16; g++)
3540
- S = S + W[g] | 0, W[g] = S & 255, S >>>= 8;
3556
+ for (_ = 0; _ < 17; _++) Oe[_] = 0;
3557
+ for (_ = 0; _ < 16 && _ < m; ++_) Oe[_] = u[f + _];
3558
+ for (Oe[_] = 1, f += _, m -= _, ee(W, Oe), E = 0; E < 17; E++)
3559
+ for (M[E] = 0, _ = 0; _ < 17; _++) M[E] = M[E] + W[_] * (_ <= E ? D[E - _] : 320 * D[E + 17 - _] | 0) | 0 | 0;
3560
+ for (E = 0; E < 17; E++) W[E] = M[E];
3561
+ for (S = 0, _ = 0; _ < 16; _++)
3562
+ S = S + W[_] | 0, W[_] = S & 255, S >>>= 8;
3563
+ for (S = S + W[16] | 0, W[16] = S & 3, S = 5 * (S >>> 2) | 0, _ = 0; _ < 16; _++)
3564
+ S = S + W[_] | 0, W[_] = S & 255, S >>>= 8;
3541
3565
  S = S + W[16] | 0, W[16] = S;
3542
3566
  }
3543
- for (g = 0; g < 17; g++) Xe[g] = W[g];
3544
- for (ee(W, se), E = -(W[16] >>> 7) | 0, g = 0; g < 17; g++) W[g] ^= E & (Xe[g] ^ W[g]);
3545
- for (g = 0; g < 16; g++) Oe[g] = b[g + 16];
3546
- for (Oe[16] = 0, ee(W, Oe), g = 0; g < 16; g++) c[l + g] = W[g];
3567
+ for (_ = 0; _ < 17; _++) Xe[_] = W[_];
3568
+ for (ee(W, se), v = -(W[16] >>> 7) | 0, _ = 0; _ < 17; _++) W[_] ^= v & (Xe[_] ^ W[_]);
3569
+ for (_ = 0; _ < 16; _++) Oe[_] = b[_ + 16];
3570
+ for (Oe[16] = 0, ee(W, Oe), _ = 0; _ < 16; _++) c[l + _] = W[_];
3547
3571
  return 0;
3548
3572
  }
3549
3573
  function re(c, l, u, f, m, b) {
3550
- var E = new Uint8Array(16);
3551
- return te(E, 0, u, f, m, b), ue(c, l, E, 0);
3574
+ var v = new Uint8Array(16);
3575
+ return te(v, 0, u, f, m, b), ue(c, l, v, 0);
3552
3576
  }
3553
3577
  function ae(c, l, u, f, m) {
3554
3578
  var b;
@@ -3557,8 +3581,8 @@ var C;
3557
3581
  return 0;
3558
3582
  }
3559
3583
  function ce(c, l, u, f, m) {
3560
- var b, E = new Uint8Array(32);
3561
- if (u < 32 || (U(E, 0, 32, f, m), re(l, 16, l, 32, u - 32, E) !== 0)) return -1;
3584
+ var b, v = new Uint8Array(32);
3585
+ if (u < 32 || ($(v, 0, 32, f, m), re(l, 16, l, 32, u - 32, v) !== 0)) return -1;
3562
3586
  for (z(c, 0, l, 0, u, f, m), b = 0; b < 32; b++) c[b] = 0;
3563
3587
  return 0;
3564
3588
  }
@@ -3576,15 +3600,15 @@ var C;
3576
3600
  f = m & (c[b] ^ l[b]), c[b] ^= f, l[b] ^= f;
3577
3601
  }
3578
3602
  function Ve(c, l) {
3579
- var u, f, m, b = t(), E = t();
3580
- for (u = 0; u < 16; u++) E[u] = l[u];
3581
- for (Z(E), Z(E), Z(E), f = 0; f < 2; f++) {
3582
- for (b[0] = E[0] - 65517, u = 1; u < 15; u++)
3583
- b[u] = E[u] - 65535 - (b[u - 1] >> 16 & 1), b[u - 1] &= 65535;
3584
- b[15] = E[15] - 32767 - (b[14] >> 16 & 1), m = b[15] >> 16 & 1, b[14] &= 65535, ie(E, b, 1 - m);
3603
+ var u, f, m, b = t(), v = t();
3604
+ for (u = 0; u < 16; u++) v[u] = l[u];
3605
+ for (Z(v), Z(v), Z(v), f = 0; f < 2; f++) {
3606
+ for (b[0] = v[0] - 65517, u = 1; u < 15; u++)
3607
+ b[u] = v[u] - 65535 - (b[u - 1] >> 16 & 1), b[u - 1] &= 65535;
3608
+ b[15] = v[15] - 32767 - (b[14] >> 16 & 1), m = b[15] >> 16 & 1, b[14] &= 65535, ie(v, b, 1 - m);
3585
3609
  }
3586
3610
  for (u = 0; u < 16; u++)
3587
- c[2 * u] = E[u] & 255, c[2 * u + 1] = E[u] >> 8;
3611
+ c[2 * u] = v[u] & 255, c[2 * u + 1] = v[u] >> 8;
3588
3612
  }
3589
3613
  function Vs(c, l) {
3590
3614
  var u = new Uint8Array(32), f = new Uint8Array(32);
@@ -3636,14 +3660,14 @@ var C;
3636
3660
  for (f = 0; f < 16; f++) c[f] = u[f];
3637
3661
  }
3638
3662
  function Ct(c, l, u) {
3639
- var f = new Uint8Array(32), m = new Float64Array(80), b, E, v = t(), g = t(), S = t(), M = t(), D = t(), W = t();
3640
- for (E = 0; E < 31; E++) f[E] = l[E];
3641
- for (f[31] = l[31] & 127 | 64, f[0] &= 248, is(m, u), E = 0; E < 16; E++)
3642
- g[E] = m[E], M[E] = v[E] = S[E] = 0;
3643
- for (v[0] = M[0] = 1, E = 254; E >= 0; --E)
3644
- b = f[E >>> 3] >>> (E & 7) & 1, ie(v, g, b), ie(S, M, b), Ae(D, v, S), Pe(v, v, S), Ae(S, g, M), Pe(g, g, M), we(M, D), we(W, v), B(v, S, v), B(S, g, D), Ae(D, v, S), Pe(v, v, S), we(g, v), Pe(S, M, W), B(v, S, d), Ae(v, v, M), B(S, S, v), B(v, M, W), B(M, g, m), we(g, D), ie(v, g, b), ie(S, M, b);
3645
- for (E = 0; E < 16; E++)
3646
- m[E + 16] = v[E], m[E + 32] = S[E], m[E + 48] = g[E], m[E + 64] = M[E];
3663
+ var f = new Uint8Array(32), m = new Float64Array(80), b, v, E = t(), _ = t(), S = t(), M = t(), D = t(), W = t();
3664
+ for (v = 0; v < 31; v++) f[v] = l[v];
3665
+ for (f[31] = l[31] & 127 | 64, f[0] &= 248, is(m, u), v = 0; v < 16; v++)
3666
+ _[v] = m[v], M[v] = E[v] = S[v] = 0;
3667
+ for (E[0] = M[0] = 1, v = 254; v >= 0; --v)
3668
+ b = f[v >>> 3] >>> (v & 7) & 1, ie(E, _, b), ie(S, M, b), Ae(D, E, S), Pe(E, E, S), Ae(S, _, M), Pe(_, _, M), we(M, D), we(W, E), B(E, S, E), B(S, _, D), Ae(D, E, S), Pe(E, E, S), we(_, E), Pe(S, M, W), B(E, S, d), Ae(E, E, M), B(S, S, E), B(E, M, W), B(M, _, m), we(_, D), ie(E, _, b), ie(S, M, b);
3669
+ for (v = 0; v < 16; v++)
3670
+ m[v + 16] = E[v], m[v + 32] = S[v], m[v + 48] = _[v], m[v + 64] = M[v];
3647
3671
  var Oe = m.subarray(32), Xe = m.subarray(16);
3648
3672
  return Ys(Oe, Oe), B(Xe, Xe, Oe), Ve(c, Xe), 0;
3649
3673
  }
@@ -3659,17 +3683,17 @@ var C;
3659
3683
  }
3660
3684
  var Qs = ae, ai = ce;
3661
3685
  function ci(c, l, u, f, m, b) {
3662
- var E = new Uint8Array(32);
3663
- return jt(E, m, b), Qs(c, l, u, f, E);
3686
+ var v = new Uint8Array(32);
3687
+ return jt(v, m, b), Qs(c, l, u, f, v);
3664
3688
  }
3665
3689
  function hi(c, l, u, f, m, b) {
3666
- var E = new Uint8Array(32);
3667
- return jt(E, m, b), ai(c, l, u, f, E);
3690
+ var v = new Uint8Array(32);
3691
+ return jt(v, m, b), ai(c, l, u, f, v);
3668
3692
  }
3669
3693
  function ct() {
3670
- var c = 0, l = 0, u = 0, f = 0, m = 65535, b, E, v;
3671
- for (v = 0; v < arguments.length; v++)
3672
- b = arguments[v].lo, E = arguments[v].hi, c += b & m, l += b >>> 16, u += E & m, f += E >>> 16;
3694
+ var c = 0, l = 0, u = 0, f = 0, m = 65535, b, v, E;
3695
+ for (E = 0; E < arguments.length; E++)
3696
+ b = arguments[E].lo, v = arguments[E].hi, c += b & m, l += b >>> 16, u += v & m, f += v >>> 16;
3673
3697
  return l += c >>> 16, u += l >>> 16, f += u >>> 16, new e(u & m | f << 16, c & m | l << 16);
3674
3698
  }
3675
3699
  function er(c, l) {
@@ -3788,22 +3812,22 @@ var C;
3788
3812
  new e(1816402316, 1246189591)
3789
3813
  ];
3790
3814
  function tr(c, l, u) {
3791
- var f = [], m = [], b = [], E = [], v, g, S;
3792
- for (g = 0; g < 8; g++) f[g] = b[g] = J(c, 8 * g);
3815
+ var f = [], m = [], b = [], v = [], E, _, S;
3816
+ for (_ = 0; _ < 8; _++) f[_] = b[_] = J(c, 8 * _);
3793
3817
  for (var M = 0; u >= 128; ) {
3794
- for (g = 0; g < 16; g++) E[g] = J(l, 8 * g + M);
3795
- for (g = 0; g < 80; g++) {
3818
+ for (_ = 0; _ < 16; _++) v[_] = J(l, 8 * _ + M);
3819
+ for (_ = 0; _ < 80; _++) {
3796
3820
  for (S = 0; S < 8; S++) m[S] = b[S];
3797
- for (v = ct(b[7], di(b[4]), ui(b[4], b[5], b[6]), bi[g], E[g % 16]), m[7] = ct(v, fi(b[0]), li(b[0], b[1], b[2])), m[3] = ct(m[3], v), S = 0; S < 8; S++) b[(S + 1) % 8] = m[S];
3798
- if (g % 16 === 15)
3821
+ for (E = ct(b[7], di(b[4]), ui(b[4], b[5], b[6]), bi[_], v[_ % 16]), m[7] = ct(E, fi(b[0]), li(b[0], b[1], b[2])), m[3] = ct(m[3], E), S = 0; S < 8; S++) b[(S + 1) % 8] = m[S];
3822
+ if (_ % 16 === 15)
3799
3823
  for (S = 0; S < 16; S++)
3800
- E[S] = ct(E[S], E[(S + 9) % 16], pi(E[(S + 1) % 16]), mi(E[(S + 14) % 16]));
3824
+ v[S] = ct(v[S], v[(S + 9) % 16], pi(v[(S + 1) % 16]), mi(v[(S + 14) % 16]));
3801
3825
  }
3802
- for (g = 0; g < 8; g++)
3803
- b[g] = ct(b[g], f[g]), f[g] = b[g];
3826
+ for (_ = 0; _ < 8; _++)
3827
+ b[_] = ct(b[_], f[_]), f[_] = b[_];
3804
3828
  M += 128, u -= 128;
3805
3829
  }
3806
- for (g = 0; g < 8; g++) L(c, 8 * g, f[g]);
3830
+ for (_ = 0; _ < 8; _++) L(c, 8 * _, f[_]);
3807
3831
  return u;
3808
3832
  }
3809
3833
  var gi = new Uint8Array([
@@ -3873,16 +3897,16 @@ var C;
3873
3897
  121
3874
3898
  ]);
3875
3899
  function Je(c, l, u) {
3876
- var f = new Uint8Array(64), m = new Uint8Array(256), b, E = u;
3900
+ var f = new Uint8Array(64), m = new Uint8Array(256), b, v = u;
3877
3901
  for (b = 0; b < 64; b++) f[b] = gi[b];
3878
3902
  for (tr(f, l, u), u %= 128, b = 0; b < 256; b++) m[b] = 0;
3879
- for (b = 0; b < u; b++) m[b] = l[E - u + b];
3880
- for (m[u] = 128, u = 256 - 128 * (u < 112 ? 1 : 0), m[u - 9] = 0, L(m, u - 8, new e(E / 536870912 | 0, E << 3)), tr(f, m, u), b = 0; b < 64; b++) c[b] = f[b];
3903
+ for (b = 0; b < u; b++) m[b] = l[v - u + b];
3904
+ for (m[u] = 128, u = 256 - 128 * (u < 112 ? 1 : 0), m[u - 9] = 0, L(m, u - 8, new e(v / 536870912 | 0, v << 3)), tr(f, m, u), b = 0; b < 64; b++) c[b] = f[b];
3881
3905
  return 0;
3882
3906
  }
3883
3907
  function Nt(c, l) {
3884
- var u = t(), f = t(), m = t(), b = t(), E = t(), v = t(), g = t(), S = t(), M = t();
3885
- Pe(u, c[1], c[0]), Pe(M, l[1], l[0]), B(u, u, M), Ae(f, c[0], c[1]), Ae(M, l[0], l[1]), B(f, f, M), B(m, c[3], l[3]), B(m, m, _), B(b, c[2], l[2]), Ae(b, b, b), Pe(E, f, u), Pe(v, b, m), Ae(g, b, m), Ae(S, f, u), B(c[0], E, v), B(c[1], S, g), B(c[2], g, v), B(c[3], E, S);
3908
+ var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), _ = t(), S = t(), M = t();
3909
+ Pe(u, c[1], c[0]), Pe(M, l[1], l[0]), B(u, u, M), Ae(f, c[0], c[1]), Ae(M, l[0], l[1]), B(f, f, M), B(m, c[3], l[3]), B(m, m, g), B(b, c[2], l[2]), Ae(b, b, b), Pe(v, f, u), Pe(E, b, m), Ae(_, b, m), Ae(S, f, u), B(c[0], v, E), B(c[1], S, _), B(c[2], _, E), B(c[3], v, S);
3886
3910
  }
3887
3911
  function sr(c, l, u) {
3888
3912
  var f;
@@ -3971,7 +3995,7 @@ var C;
3971
3995
  cs(c, l);
3972
3996
  }
3973
3997
  function rr(c, l, u, f) {
3974
- var m = new Uint8Array(64), b = new Uint8Array(64), E = new Uint8Array(64), v, g, S = new Float64Array(64), M = [
3998
+ var m = new Uint8Array(64), b = new Uint8Array(64), v = new Uint8Array(64), E, _, S = new Float64Array(64), M = [
3975
3999
  t(),
3976
4000
  t(),
3977
4001
  t(),
@@ -3979,48 +4003,48 @@ var C;
3979
4003
  ];
3980
4004
  Je(m, f, 32), m[0] &= 248, m[31] &= 127, m[31] |= 64;
3981
4005
  var D = u + 64;
3982
- for (v = 0; v < u; v++) c[64 + v] = l[v];
3983
- for (v = 0; v < 32; v++) c[32 + v] = m[32 + v];
3984
- for (Je(E, c.subarray(32), u + 32), hs(E), Tt(M, E), ns(c, M), v = 32; v < 64; v++) c[v] = f[v];
3985
- for (Je(b, c, u + 64), hs(b), v = 0; v < 64; v++) S[v] = 0;
3986
- for (v = 0; v < 32; v++) S[v] = E[v];
3987
- for (v = 0; v < 32; v++)
3988
- for (g = 0; g < 32; g++)
3989
- S[v + g] += b[v] * m[g];
4006
+ for (E = 0; E < u; E++) c[64 + E] = l[E];
4007
+ for (E = 0; E < 32; E++) c[32 + E] = m[32 + E];
4008
+ for (Je(v, c.subarray(32), u + 32), hs(v), Tt(M, v), ns(c, M), E = 32; E < 64; E++) c[E] = f[E];
4009
+ for (Je(b, c, u + 64), hs(b), E = 0; E < 64; E++) S[E] = 0;
4010
+ for (E = 0; E < 32; E++) S[E] = v[E];
4011
+ for (E = 0; E < 32; E++)
4012
+ for (_ = 0; _ < 32; _++)
4013
+ S[E + _] += b[E] * m[_];
3990
4014
  return cs(c.subarray(32), S), D;
3991
4015
  }
3992
4016
  function _i(c, l) {
3993
- var u = t(), f = t(), m = t(), b = t(), E = t(), v = t(), g = t();
3994
- return V(c[2], a), is(c[1], l), we(m, c[1]), B(b, m, p), Pe(m, m, c[2]), Ae(b, c[2], b), we(E, b), we(v, E), B(g, v, E), B(u, g, m), B(u, u, b), Xs(u, u), B(u, u, m), B(u, u, b), B(u, u, b), B(c[0], u, b), we(f, c[0]), B(f, f, b), Vs(f, m) && B(c[0], c[0], P), we(f, c[0]), B(f, f, b), Vs(f, m) ? -1 : (Ws(c[0]) === l[31] >> 7 && Pe(c[0], o, c[0]), B(c[3], c[0], c[1]), 0);
4017
+ var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), _ = t();
4018
+ return V(c[2], a), is(c[1], l), we(m, c[1]), B(b, m, p), Pe(m, m, c[2]), Ae(b, c[2], b), we(v, b), we(E, v), B(_, E, v), B(u, _, m), B(u, u, b), Xs(u, u), B(u, u, m), B(u, u, b), B(u, u, b), B(c[0], u, b), we(f, c[0]), B(f, f, b), Vs(f, m) && B(c[0], c[0], P), we(f, c[0]), B(f, f, b), Vs(f, m) ? -1 : (Ws(c[0]) === l[31] >> 7 && Pe(c[0], o, c[0]), B(c[3], c[0], c[1]), 0);
3995
4019
  }
3996
4020
  function us(c, l, u, f) {
3997
- var m, b = new Uint8Array(32), E = new Uint8Array(64), v = [
4021
+ var m, b = new Uint8Array(32), v = new Uint8Array(64), E = [
3998
4022
  t(),
3999
4023
  t(),
4000
4024
  t(),
4001
4025
  t()
4002
- ], g = [
4026
+ ], _ = [
4003
4027
  t(),
4004
4028
  t(),
4005
4029
  t(),
4006
4030
  t()
4007
4031
  ];
4008
- if (u < 64 || _i(g, f)) return -1;
4032
+ if (u < 64 || _i(_, f)) return -1;
4009
4033
  for (m = 0; m < u; m++) c[m] = l[m];
4010
4034
  for (m = 0; m < 32; m++) c[m + 32] = f[m];
4011
- if (Je(E, c, u), hs(E), os(v, g, E), Tt(g, l.subarray(32)), Nt(v, g), ns(b, v), u -= 64, w(l, 0, b, 0)) {
4035
+ if (Je(v, c, u), hs(v), os(E, _, v), Tt(_, l.subarray(32)), Nt(E, _), ns(b, E), u -= 64, w(l, 0, b, 0)) {
4012
4036
  for (m = 0; m < u; m++) c[m] = 0;
4013
4037
  return -1;
4014
4038
  }
4015
4039
  for (m = 0; m < u; m++) c[m] = l[m + 64];
4016
4040
  return u;
4017
4041
  }
4018
- var ls = 32, $t = 24, ht = 32, We = 16, ut = 32, Ut = 32, lt = 32, ft = 32, fs = 32, ir = $t, yi = ht, wi = We, Te = 64, ze = 32, Ye = 64, ds = 32, ps = 64;
4042
+ var ls = 32, Ut = 24, ht = 32, We = 16, ut = 32, $t = 32, lt = 32, ft = 32, fs = 32, ir = Ut, yi = ht, wi = We, Te = 64, ze = 32, Ye = 64, ds = 32, ps = 64;
4019
4043
  r.lowlevel = {
4020
4044
  crypto_core_hsalsa20: R,
4021
4045
  crypto_stream_xor: z,
4022
- crypto_stream: U,
4023
- crypto_stream_salsa20_xor: $,
4046
+ crypto_stream: $,
4047
+ crypto_stream_salsa20_xor: U,
4024
4048
  crypto_stream_salsa20: q,
4025
4049
  crypto_onetimeauth: te,
4026
4050
  crypto_onetimeauth_verify: re,
@@ -4040,11 +4064,11 @@ var C;
4040
4064
  crypto_sign_keypair: as,
4041
4065
  crypto_sign_open: us,
4042
4066
  crypto_secretbox_KEYBYTES: ls,
4043
- crypto_secretbox_NONCEBYTES: $t,
4067
+ crypto_secretbox_NONCEBYTES: Ut,
4044
4068
  crypto_secretbox_ZEROBYTES: ht,
4045
4069
  crypto_secretbox_BOXZEROBYTES: We,
4046
4070
  crypto_scalarmult_BYTES: ut,
4047
- crypto_scalarmult_SCALARBYTES: Ut,
4071
+ crypto_scalarmult_SCALARBYTES: $t,
4048
4072
  crypto_box_PUBLICKEYBYTES: lt,
4049
4073
  crypto_box_SECRETKEYBYTES: ft,
4050
4074
  crypto_box_BEFORENMBYTES: fs,
@@ -4074,7 +4098,7 @@ var C;
4074
4098
  };
4075
4099
  function nr(c, l) {
4076
4100
  if (c.length !== ls) throw new Error("bad key size");
4077
- if (l.length !== $t) throw new Error("bad nonce size");
4101
+ if (l.length !== Ut) throw new Error("bad nonce size");
4078
4102
  }
4079
4103
  function xi(c, l) {
4080
4104
  if (c.length !== lt) throw new Error("bad public key size");
@@ -4098,16 +4122,16 @@ var C;
4098
4122
  pe(c, l, u), nr(u, l);
4099
4123
  for (var f = new Uint8Array(We + c.length), m = new Uint8Array(f.length), b = 0; b < c.length; b++) f[b + We] = c[b];
4100
4124
  return f.length < 32 || ce(m, f, f.length, l, u) !== 0 ? null : m.subarray(ht);
4101
- }, r.secretbox.keyLength = ls, r.secretbox.nonceLength = $t, r.secretbox.overheadLength = We, r.scalarMult = function(c, l) {
4102
- if (pe(c, l), c.length !== Ut) throw new Error("bad n size");
4125
+ }, r.secretbox.keyLength = ls, r.secretbox.nonceLength = Ut, r.secretbox.overheadLength = We, r.scalarMult = function(c, l) {
4126
+ if (pe(c, l), c.length !== $t) throw new Error("bad n size");
4103
4127
  if (l.length !== ut) throw new Error("bad p size");
4104
4128
  var u = new Uint8Array(ut);
4105
4129
  return Ct(u, c, l), u;
4106
4130
  }, r.scalarMult.base = function(c) {
4107
- if (pe(c), c.length !== Ut) throw new Error("bad n size");
4131
+ if (pe(c), c.length !== $t) throw new Error("bad n size");
4108
4132
  var l = new Uint8Array(ut);
4109
4133
  return It(l, c), l;
4110
- }, r.scalarMult.scalarLength = Ut, r.scalarMult.groupElementLength = ut, r.box = function(c, l, u, f) {
4134
+ }, r.scalarMult.scalarLength = $t, r.scalarMult.groupElementLength = ut, r.box = function(c, l, u, f) {
4111
4135
  var m = r.box.before(u, f);
4112
4136
  return r.secretbox(c, l, m);
4113
4137
  }, r.box.before = function(c, l) {
@@ -4206,7 +4230,7 @@ var Or;
4206
4230
  (function(r) {
4207
4231
  r[r.Seed = 144] = "Seed", r[r.Private = 120] = "Private", r[r.Operator = 112] = "Operator", r[r.Server = 104] = "Server", r[r.Cluster = 16] = "Cluster", r[r.Account = 0] = "Account", r[r.User = 160] = "User";
4208
4232
  })(Or || (Or = {}));
4209
- function Un(r) {
4233
+ function $n(r) {
4210
4234
  return (e) => {
4211
4235
  let t = {};
4212
4236
  return r.forEach((s) => {
@@ -4253,7 +4277,7 @@ function Dn() {
4253
4277
  }
4254
4278
  function Hn(r) {
4255
4279
  const e = [];
4256
- return typeof r.authenticator == "function" && e.push(r.authenticator), Array.isArray(r.authenticator) && e.push(...r.authenticator), r.token && e.push(Fn(r.token)), r.user && e.push(qn(r.user, r.pass)), e.length === 0 ? Ln() : Un(e);
4280
+ return typeof r.authenticator == "function" && e.push(r.authenticator), Array.isArray(r.authenticator) && e.push(...r.authenticator), r.token && e.push(Fn(r.token)), r.user && e.push(qn(r.user, r.pass)), e.length === 0 ? Ln() : $n(e);
4257
4281
  }
4258
4282
  function Jn(r) {
4259
4283
  const e = `${As}:${Kr()}`;
@@ -4545,12 +4569,12 @@ class Zt {
4545
4569
  }
4546
4570
  async disconnected(e) {
4547
4571
  this.dispatchStatus({
4548
- type: Ee.Disconnect,
4572
+ type: ve.Disconnect,
4549
4573
  data: this.servers.getCurrentServer().toString()
4550
4574
  }), this.options.reconnect ? await this.dialLoop().then(() => {
4551
4575
  var t;
4552
4576
  this.dispatchStatus({
4553
- type: Ee.Reconnect,
4577
+ type: ve.Reconnect,
4554
4578
  data: this.servers.getCurrentServer().toString()
4555
4579
  }), ((t = this.lastError) == null ? void 0 : t.code) === O.AuthenticationExpired && (this.lastError = void 0);
4556
4580
  }).catch((t) => {
@@ -4670,7 +4694,7 @@ class Zt {
4670
4694
  }
4671
4695
  processError(e) {
4672
4696
  const t = hr(e), s = Zt.toError(t), i = {
4673
- type: Ee.Error,
4697
+ type: ve.Error,
4674
4698
  data: s.code
4675
4699
  };
4676
4700
  if (s.isPermissionError()) {
@@ -4717,10 +4741,10 @@ class Zt {
4717
4741
  }
4718
4742
  }
4719
4743
  s && this.dispatchStatus({
4720
- type: Ee.Update,
4744
+ type: ve.Update,
4721
4745
  data: s
4722
4746
  }), (t.ldm !== void 0 ? t.ldm : !1) && this.dispatchStatus({
4723
- type: Ee.LDM,
4747
+ type: ve.LDM,
4724
4748
  data: this.servers.getCurrentServer().toString()
4725
4749
  });
4726
4750
  }
@@ -4880,7 +4904,7 @@ class Cr {
4880
4904
  }
4881
4905
  respondError(e, t, s, i) {
4882
4906
  var n, o;
4883
- return i = i || {}, i.headers = i.headers || $e(), (n = i.headers) == null || n.set(Kt, `${e}`), (o = i.headers) == null || o.set(Gt, t), this.msg.respond(s, i);
4907
+ return i = i || {}, i.headers = i.headers || Ue(), (n = i.headers) == null || n.set(Kt, `${e}`), (o = i.headers) == null || o.set(Gt, t), this.msg.respond(s, i);
4884
4908
  }
4885
4909
  json(e) {
4886
4910
  return this.msg.json(e);
@@ -4889,7 +4913,7 @@ class Cr {
4889
4913
  return this.msg.string();
4890
4914
  }
4891
4915
  }
4892
- class vt {
4916
+ class Et {
4893
4917
  constructor(e, t = "", s = "") {
4894
4918
  h(this, "subject");
4895
4919
  h(this, "queue");
@@ -4898,7 +4922,7 @@ class vt {
4898
4922
  let i = "";
4899
4923
  if (e instanceof kt)
4900
4924
  this.srv = e, i = "";
4901
- else if (e instanceof vt) {
4925
+ else if (e instanceof Et) {
4902
4926
  const n = e;
4903
4927
  this.srv = n.srv, s === "" && n.queue !== "" && (s = n.queue), i = n.subject;
4904
4928
  } else
@@ -4929,7 +4953,7 @@ class vt {
4929
4953
  return this.srv._addEndpoint(d);
4930
4954
  }
4931
4955
  addGroup(e = "", t = "") {
4932
- return new vt(this, e, t);
4956
+ return new Et(this, e, t);
4933
4957
  }
4934
4958
  }
4935
4959
  function Zn(r, e) {
@@ -4993,7 +5017,7 @@ class kt {
4993
5017
  return this.config.metadata;
4994
5018
  }
4995
5019
  errorToHeader(e) {
4996
- const t = $e();
5020
+ const t = Ue();
4997
5021
  if (e instanceof Vt) {
4998
5022
  const s = e;
4999
5023
  t.set(Gt, s.message), t.set(Kt, `${s.code}`);
@@ -5004,16 +5028,16 @@ class kt {
5004
5028
  setupHandler(e, t = !1) {
5005
5029
  const s = t ? "" : e.queue ? e.queue : this.config.queue, { name: i, subject: n, handler: o } = e, a = e;
5006
5030
  a.internal = t, t && this.internal.push(a), a.stats = new eo(i, n, s), a.queue = s;
5007
- const d = o ? (p, _) => {
5031
+ const d = o ? (p, g) => {
5008
5032
  if (p) {
5009
5033
  this.close(p);
5010
5034
  return;
5011
5035
  }
5012
5036
  const y = Date.now();
5013
5037
  try {
5014
- o(p, new Cr(_));
5038
+ o(p, new Cr(g));
5015
5039
  } catch (x) {
5016
- a.stats.countError(x), _ == null || _.respond(ye, {
5040
+ a.stats.countError(x), g == null || g.respond(ye, {
5017
5041
  headers: this.errorToHeader(x)
5018
5042
  });
5019
5043
  } finally {
@@ -5027,8 +5051,8 @@ class kt {
5027
5051
  this._stopped || this.close(new Error(`required subscription ${e.subject} stopped`)).catch();
5028
5052
  }).catch((p) => {
5029
5053
  if (!this._stopped) {
5030
- const _ = new Error(`required subscription ${e.subject} errored: ${p.message}`);
5031
- _.stack = p.stack, this.close(_).catch();
5054
+ const g = new Error(`required subscription ${e.subject} errored: ${p.message}`);
5055
+ g.stack = p.stack, this.close(g).catch();
5032
5056
  }
5033
5057
  }), a;
5034
5058
  }
@@ -5084,7 +5108,7 @@ class kt {
5084
5108
  o.name = e, o.subject = kt.controlSubject(t, i, n), o.handler = s, this.setupHandler(o, !0);
5085
5109
  }
5086
5110
  start() {
5087
- const e = ve(), t = (o, a) => o ? (this.close(o), Promise.reject(o)) : this.stats().then((d) => (a == null || a.respond(e.encode(d)), Promise.resolve())), s = (o, a) => o ? (this.close(o), Promise.reject(o)) : (a == null || a.respond(e.encode(this.info())), Promise.resolve()), i = e.encode(this.ping()), n = (o, a) => o ? (this.close(o).then().catch(), Promise.reject(o)) : (a.respond(i), Promise.resolve());
5111
+ const e = Ee(), t = (o, a) => o ? (this.close(o), Promise.reject(o)) : this.stats().then((d) => (a == null || a.respond(e.encode(d)), Promise.resolve())), s = (o, a) => o ? (this.close(o), Promise.reject(o)) : (a == null || a.respond(e.encode(this.info())), Promise.resolve()), i = e.encode(this.ping()), n = (o, a) => o ? (this.close(o).then().catch(), Promise.reject(o)) : (a.respond(i), Promise.resolve());
5088
5112
  return this.addInternalHandler(qe.PING, n), this.addInternalHandler(qe.STATS, t), this.addInternalHandler(qe.INFO, s), this.handlers.forEach((o) => {
5089
5113
  const { subject: a } = o;
5090
5114
  typeof a == "string" && o.handler !== null && this.setupHandler(o);
@@ -5123,10 +5147,10 @@ class kt {
5123
5147
  e.stats.reset(e.qi);
5124
5148
  }
5125
5149
  addGroup(e, t) {
5126
- return new vt(this, e, t);
5150
+ return new Et(this, e, t);
5127
5151
  }
5128
5152
  addEndpoint(e, t) {
5129
- return new vt(this).addEndpoint(e, t);
5153
+ return new Et(this).addEndpoint(e, t);
5130
5154
  }
5131
5155
  _addEndpoint(e) {
5132
5156
  const t = new oe();
@@ -5203,7 +5227,7 @@ class to {
5203
5227
  return this.q(qe.INFO, e, t);
5204
5228
  }
5205
5229
  async q(e, t = "", s = "") {
5206
- const i = new oe(), n = ve(), o = kt.controlSubject(e, t, s, this.prefix), a = await this.nc.requestMany(o, ye, this.opts);
5230
+ const i = new oe(), n = Ee(), o = kt.controlSubject(e, t, s, this.prefix), a = await this.nc.requestMany(o, ye, this.opts);
5207
5231
  return (async () => {
5208
5232
  for await (const d of a)
5209
5233
  try {
@@ -5348,23 +5372,23 @@ class At {
5348
5372
  ];
5349
5373
  e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? He.S2 : He.None);
5350
5374
  const n = this.js.nc, o = n.getServerVersion(), a = o ? js(o, Ge("2.7.2")) >= 0 : !1;
5351
- s.discard = a ? Et.New : Et.Old;
5375
+ s.discard = a ? vt.New : vt.Old;
5352
5376
  const { ok: d, min: p } = n.features.get(H.JS_ALLOW_DIRECT);
5353
5377
  if (!d && e.allow_direct === !0) {
5354
5378
  const y = o ? `${o.major}.${o.minor}.${o.micro}` : "unknown";
5355
5379
  return Promise.reject(new Error(`allow_direct is not available on server version ${y} - requires ${p}`));
5356
5380
  }
5357
5381
  e.allow_direct = typeof e.allow_direct == "boolean" ? e.allow_direct : d, s.allow_direct = e.allow_direct, this.direct = s.allow_direct, s.num_replicas = t.replicas, t.ttl && (s.max_age = G(t.ttl)), s.allow_rollup_hdrs = !0;
5358
- let _;
5382
+ let g;
5359
5383
  try {
5360
- _ = await this.jsm.streams.info(s.name), !_.config.allow_direct && this.direct === !0 && (this.direct = !1);
5384
+ g = await this.jsm.streams.info(s.name), !g.config.allow_direct && this.direct === !0 && (this.direct = !1);
5361
5385
  } catch (y) {
5362
5386
  if (y.message === "stream not found")
5363
- _ = await this.jsm.streams.add(s);
5387
+ g = await this.jsm.streams.add(s);
5364
5388
  else
5365
5389
  throw y;
5366
5390
  }
5367
- this.initializePrefixes(_);
5391
+ this.initializePrefixes(g);
5368
5392
  }
5369
5393
  initializePrefixes(e) {
5370
5394
  this._prefixLen = 0, this.prefix = `$KV.${this.bucket}`, this.useJsPrefix = this.js.apiPrefix !== "$JS.API";
@@ -5430,7 +5454,7 @@ class At {
5430
5454
  return s !== "" ? parseInt(s, 10) : e.length;
5431
5455
  }
5432
5456
  smToEntry(e) {
5433
- return new vo(this.bucket, this.prefixLen, e);
5457
+ return new Eo(this.bucket, this.prefixLen, e);
5434
5458
  }
5435
5459
  jmToEntry(e) {
5436
5460
  const t = this.decodeKey(e.subject.substring(this.prefixLen));
@@ -5469,7 +5493,7 @@ class At {
5469
5493
  this.validateKey(i);
5470
5494
  const n = {};
5471
5495
  if (s.previousSeq !== void 0) {
5472
- const d = $e();
5496
+ const d = Ue();
5473
5497
  n.headers = d, d.set(Re.ExpectedLastSubjectSequenceHdr, `${s.previousSeq}`);
5474
5498
  }
5475
5499
  try {
@@ -5542,7 +5566,7 @@ class At {
5542
5566
  async _doDeleteOrPurge(e, t, s) {
5543
5567
  const i = this.encodeKey(e);
5544
5568
  this.validateKey(i);
5545
- const n = $e();
5569
+ const n = Ue();
5546
5570
  n.set(Qt, t), t === "PURGE" && n.set(de.RollupHdr, de.RollupValueSubject), s != null && s.previousSeq && n.set(Re.ExpectedLastSubjectSequenceHdr, `${s.previousSeq}`), await this.js.publish(this.subjectForKey(i, !0), ye, {
5547
5571
  headers: n
5548
5572
  });
@@ -5587,9 +5611,9 @@ class At {
5587
5611
  s.push(P), s.received++, (n && o > 0 && s.received >= o || x.info.pending === 0) && (s.push(n), n = void 0);
5588
5612
  }
5589
5613
  });
5590
- const _ = await this.js.subscribe(d, p);
5614
+ const g = await this.js.subscribe(d, p);
5591
5615
  if (n) {
5592
- const { info: { last: y } } = _, x = y.num_pending + y.delivered.consumer_seq;
5616
+ const { info: { last: y } } = g, x = y.num_pending + y.delivered.consumer_seq;
5593
5617
  if (x === 0 || s.received >= x)
5594
5618
  try {
5595
5619
  n();
@@ -5601,9 +5625,9 @@ class At {
5601
5625
  else
5602
5626
  o = x;
5603
5627
  }
5604
- return s._data = _, s.iterClosed.then(() => {
5605
- _.unsubscribe();
5606
- }), _.closed.then(() => {
5628
+ return s._data = g, s.iterClosed.then(() => {
5629
+ g.unsubscribe();
5630
+ }), g.closed.then(() => {
5607
5631
  s.stop();
5608
5632
  }).catch((y) => {
5609
5633
  s.stop(y);
@@ -5620,7 +5644,7 @@ class At {
5620
5644
  e.include === ke.AllHistory ? n = ke.AllHistory : e.include === ke.UpdatesOnly && (n = ke.UpdatesOnly);
5621
5645
  const o = e.ignoreDeletes === !0;
5622
5646
  let a = e.initializedFn, d = 0;
5623
- const p = this._buildCC(t, n, i), _ = p.filter_subject, y = Be(p);
5647
+ const p = this._buildCC(t, n, i), g = p.filter_subject, y = Be(p);
5624
5648
  this.canSetWatcherName() && y.consumerName(De.next()), y.bindStream(this.stream), e.resumeFromRevision && e.resumeFromRevision > 0 && y.startSequence(e.resumeFromRevision), y.orderedConsumer(), y.callback((P, I) => {
5625
5649
  if (P) {
5626
5650
  s.stop(P);
@@ -5633,7 +5657,7 @@ class At {
5633
5657
  s.push(T), s.received++, a && (d > 0 && s.received >= d || I.info.pending === 0) && (s.push(a), a = void 0);
5634
5658
  }
5635
5659
  });
5636
- const x = await this.js.subscribe(_, y);
5660
+ const x = await this.js.subscribe(g, y);
5637
5661
  if (a) {
5638
5662
  const { info: { last: P } } = x, I = P.num_pending + P.delivered.consumer_seq;
5639
5663
  if (I === 0 || s.received >= I)
@@ -5664,8 +5688,8 @@ class At {
5664
5688
  return (async () => {
5665
5689
  var d;
5666
5690
  for await (const p of o) {
5667
- const _ = (d = p.headers) == null ? void 0 : d.get(Qt);
5668
- if (_ !== "DEL" && _ !== "PURGE") {
5691
+ const g = (d = p.headers) == null ? void 0 : d.get(Qt);
5692
+ if (g !== "DEL" && g !== "PURGE") {
5669
5693
  const y = this.decodeKey(p.subject.substring(this.prefixLen));
5670
5694
  t.push(y);
5671
5695
  }
@@ -5835,7 +5859,7 @@ const Rr = Uint8Array.of(43, 65, 67, 75), lo = Uint8Array.of(45, 78, 65, 75), bt
5835
5859
  function Pt(r, e = 5e3) {
5836
5860
  return new Ro(r, e);
5837
5861
  }
5838
- class Es extends oe {
5862
+ class vs extends oe {
5839
5863
  constructor(t, s, i = !1) {
5840
5864
  super();
5841
5865
  h(this, "consumer");
@@ -5930,12 +5954,12 @@ class Es extends oe {
5930
5954
  var p;
5931
5955
  const d = this.consumer.api.nc.status();
5932
5956
  this.statusIterator = d;
5933
- for await (const _ of d)
5934
- switch (_.type) {
5935
- case Ee.Disconnect:
5957
+ for await (const g of d)
5958
+ switch (g.type) {
5959
+ case ve.Disconnect:
5936
5960
  (p = this.monitor) == null || p.cancel();
5937
5961
  break;
5938
- case Ee.Reconnect:
5962
+ case ve.Reconnect:
5939
5963
  this.resetPending().then((y) => {
5940
5964
  var x;
5941
5965
  y && ((x = this.monitor) == null || x.restart());
@@ -6123,7 +6147,7 @@ class bo extends oe {
6123
6147
  return this.listeners.push(t), Promise.resolve(t);
6124
6148
  }
6125
6149
  }
6126
- class $s {
6150
+ class Us {
6127
6151
  constructor(e, t) {
6128
6152
  h(this, "api");
6129
6153
  h(this, "_info");
@@ -6135,13 +6159,13 @@ class $s {
6135
6159
  max_messages: 100,
6136
6160
  expires: 3e4
6137
6161
  }) {
6138
- return Promise.resolve(new Es(this, e, !0));
6162
+ return Promise.resolve(new vs(this, e, !0));
6139
6163
  }
6140
6164
  fetch(e = {
6141
6165
  max_messages: 100,
6142
6166
  expires: 3e4
6143
6167
  }) {
6144
- const t = new Es(this, e, !1), s = Math.round(t.opts.expires * 1.05), i = it(s);
6168
+ const t = new vs(this, e, !1), s = Math.round(t.opts.expires * 1.05), i = it(s);
6145
6169
  return t.closed().catch(() => {
6146
6170
  }).finally(() => {
6147
6171
  i.cancel();
@@ -6154,7 +6178,7 @@ class $s {
6154
6178
  }) {
6155
6179
  const t = K(), s = e;
6156
6180
  s.max_messages = 1;
6157
- const i = new Es(this, s, !1), n = Math.round(i.opts.expires * 1.05);
6181
+ const i = new vs(this, s, !1), n = Math.round(i.opts.expires * 1.05);
6158
6182
  n >= 6e4 && (async () => {
6159
6183
  for await (const a of await i.status())
6160
6184
  if (a.type === Ne.HeartbeatsMissed && a.data >= 2) {
@@ -6226,7 +6250,7 @@ class go {
6226
6250
  return this.consumerOpts.headers_only === !0 && (s.headers_only = !0), Array.isArray(this.consumerOpts.filterSubjects) && (s.filter_subjects = this.consumerOpts.filterSubjects), typeof this.consumerOpts.filterSubjects == "string" && (s.filter_subject = this.consumerOpts.filterSubjects), this.consumerOpts.replay_policy && (s.replay_policy = this.consumerOpts.replay_policy), e === this.startSeq + 1 && (s.deliver_policy = this.consumerOpts.deliver_policy || Q.StartSequence, (this.consumerOpts.deliver_policy === Q.LastPerSubject || this.consumerOpts.deliver_policy === Q.New || this.consumerOpts.deliver_policy === Q.Last) && (delete s.opt_start_seq, s.deliver_policy = this.consumerOpts.deliver_policy), s.deliver_policy === Q.LastPerSubject && typeof s.filter_subjects > "u" && typeof s.filter_subject > "u" && (s.filter_subject = ">"), this.consumerOpts.opt_start_time && (delete s.opt_start_seq, s.deliver_policy = Q.StartTime, s.opt_start_time = this.consumerOpts.opt_start_time), this.consumerOpts.inactive_threshold && (s.inactive_threshold = G(this.consumerOpts.inactive_threshold))), s;
6227
6251
  }
6228
6252
  async resetConsumer(e = 0) {
6229
- var o, a, d, p, _;
6253
+ var o, a, d, p, g;
6230
6254
  De.next();
6231
6255
  const t = this.serial === 0;
6232
6256
  (o = this.consumer) == null || o.delete().catch(() => {
@@ -6243,7 +6267,7 @@ class go {
6243
6267
  break;
6244
6268
  } catch (x) {
6245
6269
  if (x.message === "stream not found" && ((p = this.iter) == null || p.notify(Ne.StreamNotFound, y), this.type === xe.Fetch || this.opts.abort_on_missing_resource === !0))
6246
- return (_ = this.iter) == null || _.stop(x), Promise.reject(x);
6270
+ return (g = this.iter) == null || g.stop(x), Promise.reject(x);
6247
6271
  if (t && y >= this.maxInitialReset)
6248
6272
  throw x;
6249
6273
  await at(i.backoff(y + 1));
@@ -6274,7 +6298,7 @@ class go {
6274
6298
  (d = this.iter) == null || d.src.stop(), await ((p = this.iter) == null ? void 0 : p.closed()), this.currentConsumer = null;
6275
6299
  return;
6276
6300
  }
6277
- (this.currentConsumer === null || i) && (this.currentConsumer = await this.resetConsumer(this.cursor.stream_seq + 1)), (this.iter === null || s) && (this.iter = new bo()), this.consumer = new $s(this.api, this.currentConsumer);
6301
+ (this.currentConsumer === null || i) && (this.currentConsumer = await this.resetConsumer(this.cursor.stream_seq + 1)), (this.iter === null || s) && (this.iter = new bo()), this.consumer = new Us(this.api, this.currentConsumer);
6278
6302
  const n = e;
6279
6303
  n.callback = this.internalHandler(this.serial);
6280
6304
  let o = null;
@@ -6344,7 +6368,7 @@ class go {
6344
6368
  return this.currentConsumer == null ? (this.currentConsumer = await this.resetConsumer(this.startSeq), Promise.resolve(this.currentConsumer)) : e && this.currentConsumer ? Promise.resolve(this.currentConsumer) : this.api.info(this.stream, this.currentConsumer.name);
6345
6369
  }
6346
6370
  }
6347
- class Us {
6371
+ class $s {
6348
6372
  constructor(e) {
6349
6373
  h(this, "api");
6350
6374
  h(this, "notified");
@@ -6357,10 +6381,10 @@ class Us {
6357
6381
  getPullConsumerFor(e) {
6358
6382
  if (e.config.deliver_subject !== void 0)
6359
6383
  throw new Error("push consumer not supported");
6360
- return new $s(this.api, e);
6384
+ return new Us(this.api, e);
6361
6385
  }
6362
6386
  async get(e, t = {}) {
6363
- return typeof t == "object" ? this.ordered(e, t) : (await this.checkVersion(), this.api.info(e, t).then((s) => s.config.deliver_subject !== void 0 ? Promise.reject(new Error("push consumer not supported")) : new $s(this.api, s)).catch((s) => Promise.reject(s)));
6387
+ return typeof t == "object" ? this.ordered(e, t) : (await this.checkVersion(), this.api.info(e, t).then((s) => s.config.deliver_subject !== void 0 ? Promise.reject(new Error("push consumer not supported")) : new Us(this.api, s)).catch((s) => Promise.reject(s)));
6364
6388
  }
6365
6389
  async ordered(e, t) {
6366
6390
  await this.checkVersion();
@@ -6391,10 +6415,10 @@ class rs {
6391
6415
  return e ? Promise.resolve(this._info) : this.api.info(this.name, t).then((s) => (this._info = s, this._info));
6392
6416
  }
6393
6417
  getConsumerFromInfo(e) {
6394
- return new Us(new Yt(this.api.nc, this.api.opts)).getPullConsumerFor(e);
6418
+ return new $s(new Yt(this.api.nc, this.api.opts)).getPullConsumerFor(e);
6395
6419
  }
6396
6420
  getConsumer(e) {
6397
- return new Us(new Yt(this.api.nc, this.api.opts)).get(this.name, e);
6421
+ return new $s(new Yt(this.api.nc, this.api.opts)).get(this.name, e);
6398
6422
  }
6399
6423
  getMessage(e) {
6400
6424
  return this.api.getMessage(this.name, e);
@@ -6474,11 +6498,11 @@ class zs extends Ot {
6474
6498
  if (o && o > d) {
6475
6499
  const p = [
6476
6500
  n
6477
- ], _ = t || {};
6501
+ ], g = t || {};
6478
6502
  let y = 0;
6479
6503
  for (; o > d; ) {
6480
- y++, _.offset = a * y;
6481
- const P = await this._request(s, _);
6504
+ y++, g.offset = a * y;
6505
+ const P = await this._request(s, g);
6482
6506
  o = P.total, p.push(P);
6483
6507
  const I = Object.getOwnPropertyNames(P.state.subjects).length;
6484
6508
  if (d += I, I < a)
@@ -6574,8 +6598,8 @@ class _o extends Ot {
6574
6598
  }), p = tt(d);
6575
6599
  if (p)
6576
6600
  return Promise.reject(p);
6577
- const _ = new Ls(d);
6578
- return Promise.resolve(_);
6601
+ const g = new Ls(d);
6602
+ return Promise.resolve(g);
6579
6603
  }
6580
6604
  async getBatch(e, t) {
6581
6605
  le(e);
@@ -6587,13 +6611,13 @@ class _o extends Ot {
6587
6611
  });
6588
6612
  return (async () => {
6589
6613
  var y, x, P;
6590
- let d = !1, p = !1, _;
6614
+ let d = !1, p = !1, g;
6591
6615
  for await (const I of a) {
6592
6616
  if (!d) {
6593
6617
  d = !0;
6594
6618
  const T = ((y = I.headers) == null ? void 0 : y.code) || 0;
6595
6619
  if (T !== 0 && T < 200 || T > 299) {
6596
- _ = (x = I.headers) == null ? void 0 : x.description.toLowerCase();
6620
+ g = (x = I.headers) == null ? void 0 : x.description.toLowerCase();
6597
6621
  break;
6598
6622
  }
6599
6623
  if (((P = I.headers) == null ? void 0 : P.get("Nats-Num-Pending")) === "") {
@@ -6608,8 +6632,8 @@ class _o extends Ot {
6608
6632
  o.push(() => {
6609
6633
  if (p)
6610
6634
  throw new Error("batch direct get not supported by the server");
6611
- if (_)
6612
- throw new Error(`bad request: ${_}`);
6635
+ if (g)
6636
+ throw new Error(`bad request: ${g}`);
6613
6637
  o.stop();
6614
6638
  });
6615
6639
  })(), Promise.resolve(o);
@@ -6640,7 +6664,7 @@ class Ls {
6640
6664
  return this.header.last(Qe.Stream);
6641
6665
  }
6642
6666
  json(e) {
6643
- return ve(e).decode(this.data);
6667
+ return Ee(e).decode(this.data);
6644
6668
  }
6645
6669
  string() {
6646
6670
  return ge.decode(this.data);
@@ -6707,7 +6731,7 @@ class ti {
6707
6731
  const e = this._parse(this.smr.message.hdrs);
6708
6732
  this._header = Fe.decode(e);
6709
6733
  } else
6710
- this._header = $e();
6734
+ this._header = Ue();
6711
6735
  return this._header;
6712
6736
  }
6713
6737
  _parse(e) {
@@ -6717,7 +6741,7 @@ class ti {
6717
6741
  return i;
6718
6742
  }
6719
6743
  json(e) {
6720
- return ve(e).decode(this.data);
6744
+ return Ee(e).decode(this.data);
6721
6745
  }
6722
6746
  string() {
6723
6747
  return ge.decode(this.data);
@@ -6733,7 +6757,7 @@ class wo {
6733
6757
  return this.api.info(e).then((t) => new rs(this.api, t));
6734
6758
  }
6735
6759
  }
6736
- class vs {
6760
+ class Es {
6737
6761
  constructor(e) {
6738
6762
  h(this, "info");
6739
6763
  h(this, "hdrs");
@@ -6821,7 +6845,7 @@ class St {
6821
6845
  }
6822
6846
  async info(e) {
6823
6847
  const t = await this.rawInfo(e);
6824
- return t ? new vs(t) : null;
6848
+ return t ? new Es(t) : null;
6825
6849
  }
6826
6850
  async list() {
6827
6851
  const e = [], t = await this.watch({
@@ -6843,7 +6867,7 @@ class St {
6843
6867
  try {
6844
6868
  const n = await this.jsm.streams.getMessage(this.stream, {
6845
6869
  last_by_subj: i
6846
- }), a = ve().decode(n.data);
6870
+ }), a = Ee().decode(n.data);
6847
6871
  return a.revision = n.seq, a;
6848
6872
  } catch (n) {
6849
6873
  return n.code === "404" ? null : Promise.reject(n);
@@ -6877,7 +6901,7 @@ class St {
6877
6901
  e = e || {}, e.options = e.options || {};
6878
6902
  let p = ((ue = e.options) == null ? void 0 : ue.max_chunk_size) || 128 * 1024;
6879
6903
  p = p > d ? d : p, e.options.max_chunk_size = p;
6880
- const _ = await this.info(e.name), { name: y, error: x } = this._checkNotEmpty(e.name);
6904
+ const g = await this.info(e.name), { name: y, error: x } = this._checkNotEmpty(e.name);
6881
6905
  if (x)
6882
6906
  return Promise.reject(x);
6883
6907
  const P = De.next(), I = this._chunkSubject(P), T = this._metaSubject(y), J = Object.assign({
@@ -6895,28 +6919,28 @@ class St {
6895
6919
  };
6896
6920
  if (F) {
6897
6921
  if (Y.size() > 0) {
6898
- const U = Y.drain();
6899
- j.update(U), J.chunks++, J.size += U.length, L.push(this.js.publish(I, U, {
6922
+ const $ = Y.drain();
6923
+ j.update($), J.chunks++, J.size += $.length, L.push(this.js.publish(I, $, {
6900
6924
  timeout: n
6901
6925
  }));
6902
6926
  }
6903
6927
  await Promise.all(L), L.length = 0, J.mtime = (/* @__PURE__ */ new Date()).toISOString();
6904
6928
  const A = st.encode(j.digest());
6905
6929
  J.digest = `${jr}${A}`, J.deleted = !1;
6906
- const $ = $e();
6907
- typeof o == "number" && $.set(Re.ExpectedLastSubjectSequenceHdr, `${o}`), $.set(de.RollupHdr, de.RollupValueSubject);
6908
- const q = await this.js.publish(T, ve().encode(J), {
6909
- headers: $,
6930
+ const U = Ue();
6931
+ typeof o == "number" && U.set(Re.ExpectedLastSubjectSequenceHdr, `${o}`), U.set(de.RollupHdr, de.RollupValueSubject);
6932
+ const q = await this.js.publish(T, Ee().encode(J), {
6933
+ headers: U,
6910
6934
  timeout: n
6911
6935
  });
6912
- if (J.revision = q.seq, _)
6936
+ if (J.revision = q.seq, g)
6913
6937
  try {
6914
6938
  await this.jsm.streams.purge(this.stream, {
6915
- filter: `$O.${this.name}.C.${_.nuid}`
6939
+ filter: `$O.${this.name}.C.${g.nuid}`
6916
6940
  });
6917
6941
  } catch {
6918
6942
  }
6919
- X.resolve(new vs(J));
6943
+ X.resolve(new Es(J));
6920
6944
  break;
6921
6945
  }
6922
6946
  if (R)
@@ -6984,7 +7008,7 @@ class St {
6984
7008
  if (s === null)
6985
7009
  return Promise.reject(new Error(`unable to parse digest: ${t.digest}`));
6986
7010
  const i = K(), n = {
6987
- info: new vs(t),
7011
+ info: new Es(t),
6988
7012
  error: i
6989
7013
  };
6990
7014
  if (t.size === 0)
@@ -6992,10 +7016,10 @@ class St {
6992
7016
  let o;
6993
7017
  const a = Be();
6994
7018
  a.orderedConsumer();
6995
- const d = Sr.create(), p = `$O.${this.name}.C.${t.nuid}`, _ = await this.js.subscribe(p, a);
7019
+ const d = Sr.create(), p = `$O.${this.name}.C.${t.nuid}`, g = await this.js.subscribe(p, a);
6996
7020
  return (async () => {
6997
- for await (const y of _)
6998
- y.data.length > 0 && (d.update(y.data), o.enqueue(y.data)), y.info.pending === 0 && (cn(s, d.digest()) ? o.close() : o.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${s}`)), _.unsubscribe());
7021
+ for await (const y of g)
7022
+ y.data.length > 0 && (d.update(y.data), o.enqueue(y.data)), y.info.pending === 0 && (cn(s, d.digest()) ? o.close() : o.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${s}`)), g.unsubscribe());
6999
7023
  })().then(() => {
7000
7024
  i.resolve();
7001
7025
  }).catch((y) => {
@@ -7005,7 +7029,7 @@ class St {
7005
7029
  o = y;
7006
7030
  },
7007
7031
  cancel() {
7008
- _.unsubscribe();
7032
+ g.unsubscribe();
7009
7033
  }
7010
7034
  }), n;
7011
7035
  }
@@ -7058,7 +7082,7 @@ class St {
7058
7082
  success: !1
7059
7083
  });
7060
7084
  t.deleted = !0, t.size = 0, t.chunks = 0, t.digest = "";
7061
- const s = ve(), i = $e();
7085
+ const s = Ee(), i = Ue();
7062
7086
  return i.set(de.RollupHdr, de.RollupValueSubject), await this.js.publish(this._metaSubject(t.name), s.encode(t), {
7063
7087
  headers: i
7064
7088
  }), this.jsm.streams.purge(this.stream, {
@@ -7097,16 +7121,16 @@ class St {
7097
7121
  } catch (d) {
7098
7122
  d.code === "404" ? (s.push(null), t = !0) : s.stop(d);
7099
7123
  }
7100
- const n = ve(), o = Be();
7124
+ const n = Ee(), o = Be();
7101
7125
  o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((d, p) => {
7102
- var _;
7126
+ var g;
7103
7127
  if (d) {
7104
7128
  s.stop(d);
7105
7129
  return;
7106
7130
  }
7107
7131
  if (p !== null) {
7108
7132
  const y = n.decode(p.data);
7109
- y.deleted && e.ignoreDeletes === !0 || s.push(y), ((_ = p.info) == null ? void 0 : _.pending) === 0 && !t && (t = !0, s.push(null));
7133
+ y.deleted && e.ignoreDeletes === !0 || s.push(y), ((g = p.info) == null ? void 0 : g.pending) === 0 && !t && (t = !0, s.push(null));
7110
7134
  }
7111
7135
  });
7112
7136
  const a = await this.js.subscribe(i, o);
@@ -7138,7 +7162,7 @@ class St {
7138
7162
  const s = Object.assign({
7139
7163
  max_age: t
7140
7164
  }, e);
7141
- s.name = this.stream, s.num_replicas = e.replicas ?? 1, s.allow_direct = !0, s.allow_rollup_hdrs = !0, s.discard = Et.New, s.subjects = [
7165
+ s.name = this.stream, s.num_replicas = e.replicas ?? 1, s.allow_direct = !0, s.allow_rollup_hdrs = !0, s.discard = vt.New, s.subjects = [
7142
7166
  `$O.${this.name}.C.>`,
7143
7167
  `$O.${this.name}.M.>`
7144
7168
  ], e.placement && (s.placement = e.placement), e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? He.S2 : He.None);
@@ -7177,7 +7201,7 @@ class Gs extends Ot {
7177
7201
  h(this, "streams");
7178
7202
  h(this, "consumerAPI");
7179
7203
  h(this, "streamAPI");
7180
- this.consumerAPI = new Yt(t, s), this.streamAPI = new zs(t, s), this.consumers = new Us(this.consumerAPI), this.streams = new wo(this.streamAPI);
7204
+ this.consumerAPI = new Yt(t, s), this.streamAPI = new zs(t, s), this.consumers = new $s(this.consumerAPI), this.streams = new wo(this.streamAPI);
7181
7205
  }
7182
7206
  jetstreamManager(t) {
7183
7207
  t === void 0 && (t = this.opts.checkAPI);
@@ -7194,16 +7218,16 @@ class Gs extends Ot {
7194
7218
  }
7195
7219
  async publish(t, s = ye, i) {
7196
7220
  i = i || {}, i.expect = i.expect || {};
7197
- const n = (i == null ? void 0 : i.headers) || $e();
7221
+ const n = (i == null ? void 0 : i.headers) || Ue();
7198
7222
  i && (i.msgID && n.set(Re.MsgIdHdr, i.msgID), i.expect.lastMsgID && n.set(Re.ExpectedLastMsgIdHdr, i.expect.lastMsgID), i.expect.streamName && n.set(Re.ExpectedStreamHdr, i.expect.streamName), typeof i.expect.lastSequence == "number" && n.set(Re.ExpectedLastSeqHdr, `${i.expect.lastSequence}`), typeof i.expect.lastSubjectSequence == "number" && n.set(Re.ExpectedLastSubjectSequenceHdr, `${i.expect.lastSubjectSequence}`));
7199
7223
  const o = i.timeout || this.timeout, a = {};
7200
7224
  o && (a.timeout = o), i && (a.headers = n);
7201
7225
  let { retries: d, retry_delay: p } = i;
7202
7226
  d = d || 1, p = p || 250;
7203
- let _;
7227
+ let g;
7204
7228
  for (let x = 0; x < d; x++)
7205
7229
  try {
7206
- _ = await this.nc.request(t, s, a);
7230
+ g = await this.nc.request(t, s, a);
7207
7231
  break;
7208
7232
  } catch (P) {
7209
7233
  if (P.code === "503" && x + 1 < d)
@@ -7211,7 +7235,7 @@ class Gs extends Ot {
7211
7235
  else
7212
7236
  throw P;
7213
7237
  }
7214
- const y = this.parseJsResponse(_);
7238
+ const y = this.parseJsResponse(g);
7215
7239
  if (y.stream === "")
7216
7240
  throw N.errorForCode(O.JetStreamInvalidAck);
7217
7241
  return y.duplicate = y.duplicate ? y.duplicate : !1, y;
@@ -7239,20 +7263,20 @@ class Gs extends Ot {
7239
7263
  let a = 0;
7240
7264
  const d = o ? i.max_bytes : 0;
7241
7265
  let p = null;
7242
- const _ = {};
7243
- if (_.batch = i.batch || 1, d) {
7266
+ const g = {};
7267
+ if (g.batch = i.batch || 1, d) {
7244
7268
  const L = this.nc.features.get(H.JS_PULL_MAX_BYTES);
7245
7269
  if (!L.ok)
7246
7270
  throw new Error(`max_bytes is only supported on servers ${L.min} or better`);
7247
- _.max_bytes = d;
7271
+ g.max_bytes = d;
7248
7272
  }
7249
- _.no_wait = i.no_wait || !1, _.no_wait && _.expires && (_.expires = 0);
7273
+ g.no_wait = i.no_wait || !1, g.no_wait && g.expires && (g.expires = 0);
7250
7274
  const y = i.expires || 0;
7251
- if (y && (_.expires = G(y)), y === 0 && _.no_wait === !1)
7275
+ if (y && (g.expires = G(y)), y === 0 && g.no_wait === !1)
7252
7276
  throw new Error("expires or no_wait is required");
7253
7277
  const x = i.idle_heartbeat || 0;
7254
- x && (_.idle_heartbeat = G(x), i.delay_heartbeat === !0 && (_.idle_heartbeat = G(x * 4)));
7255
- const P = new oe(), I = _.batch;
7278
+ x && (g.idle_heartbeat = G(x), i.delay_heartbeat === !0 && (g.idle_heartbeat = G(x * 4)));
7279
+ const P = new oe(), I = g.batch;
7256
7280
  let T = 0;
7257
7281
  P.protocolFilterFn = (L, Y = !1) => Os(L.msg) ? (p == null || p.work(), !1) : !0, P.dispatchedFn = (L) => {
7258
7282
  if (L) {
@@ -7278,7 +7302,7 @@ class Gs extends Ot {
7278
7302
  } catch {
7279
7303
  }
7280
7304
  await X.closed, n !== null && (n.cancel(), n = null), p && p.cancel(), P.stop();
7281
- })().catch(), this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(_), {
7305
+ })().catch(), this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(g), {
7282
7306
  reply: J
7283
7307
  }), P;
7284
7308
  }
@@ -7492,7 +7516,7 @@ class Ks {
7492
7516
  if (s.noMux) {
7493
7517
  const d = i ? new Error().stack : null;
7494
7518
  let p = typeof s.maxMessages == "number" && s.maxMessages > 0 ? s.maxMessages : -1;
7495
- const _ = this.subscribe(Me(this.options.inboxPrefix), {
7519
+ const g = this.subscribe(Me(this.options.inboxPrefix), {
7496
7520
  callback: (I, T) => {
7497
7521
  var J, X;
7498
7522
  if (((J = T == null ? void 0 : T.data) == null ? void 0 : J.length) === 0 && ((X = T == null ? void 0 : T.headers) == null ? void 0 : X.status) === O.NoResponders && (I = N.errorForCode(O.NoResponders)), I) {
@@ -7506,7 +7530,7 @@ ${d}`), y(I);
7506
7530
  }, 300)), s.strategy === Ce.SentinelMsg && T && T.data.length === 0 && y();
7507
7531
  }
7508
7532
  });
7509
- _.requestSubject = e, _.closed.then(() => {
7533
+ g.requestSubject = e, g.closed.then(() => {
7510
7534
  o();
7511
7535
  }).catch((I) => {
7512
7536
  n.stop(I);
@@ -7514,20 +7538,20 @@ ${d}`), y(I);
7514
7538
  const y = (I) => {
7515
7539
  I && n.push(() => {
7516
7540
  throw I;
7517
- }), P(), _.drain().then(() => {
7541
+ }), P(), g.drain().then(() => {
7518
7542
  o();
7519
7543
  }).catch((T) => {
7520
7544
  o();
7521
7545
  });
7522
7546
  };
7523
7547
  n.iterClosed.then(() => {
7524
- P(), _ == null || _.unsubscribe();
7548
+ P(), g == null || g.unsubscribe();
7525
7549
  }).catch((I) => {
7526
- P(), _ == null || _.unsubscribe();
7550
+ P(), g == null || g.unsubscribe();
7527
7551
  });
7528
7552
  try {
7529
7553
  this.publish(e, t, {
7530
- reply: _.getSubject()
7554
+ reply: g.getSubject()
7531
7555
  });
7532
7556
  } catch (I) {
7533
7557
  y(I);
@@ -7542,8 +7566,8 @@ ${d}`), y(I);
7542
7566
  const d = s;
7543
7567
  d.callback = a, n.iterClosed.then(() => {
7544
7568
  p.cancel();
7545
- }).catch((_) => {
7546
- p.cancel(_);
7569
+ }).catch((g) => {
7570
+ p.cancel(g);
7547
7571
  });
7548
7572
  const p = new hn(this.protocol.muxSubscriptions, e, d);
7549
7573
  this.protocol.request(p);
@@ -7552,8 +7576,8 @@ ${d}`), y(I);
7552
7576
  reply: `${this.protocol.muxSubscriptions.baseInbox}${p.token}`,
7553
7577
  headers: s.headers
7554
7578
  });
7555
- } catch (_) {
7556
- p.cancel(_);
7579
+ } catch (g) {
7580
+ p.cancel(g);
7557
7581
  }
7558
7582
  }
7559
7583
  return Promise.resolve(n);
@@ -7576,12 +7600,12 @@ ${d}`), y(I);
7576
7600
  const n = s.reply ? s.reply : Me(this.options.inboxPrefix), o = K(), a = i ? new Error() : null, d = this.subscribe(n, {
7577
7601
  max: 1,
7578
7602
  timeout: s.timeout,
7579
- callback: (p, _) => {
7603
+ callback: (p, g) => {
7580
7604
  p ? (a && p.code !== O.Timeout && (p.stack += `
7581
7605
 
7582
- ${a.stack}`), d.unsubscribe(), o.reject(p)) : (p = Hr(_), p ? (a && (p.stack += `
7606
+ ${a.stack}`), d.unsubscribe(), o.reject(p)) : (p = Hr(g), p ? (a && (p.stack += `
7583
7607
 
7584
- ${a.stack}`), o.reject(p)) : o.resolve(_));
7608
+ ${a.stack}`), o.reject(p)) : o.resolve(g));
7585
7609
  }
7586
7610
  });
7587
7611
  return d.requestSubject = e, this.protocol.publish(e, t, {
@@ -7673,13 +7697,13 @@ ${a.stack}`), o.reject(p)) : o.resolve(_));
7673
7697
  return this.protocol.features;
7674
7698
  }
7675
7699
  get services() {
7676
- return this._services || (this._services = new Eo(this)), this._services;
7700
+ return this._services || (this._services = new vo(this)), this._services;
7677
7701
  }
7678
7702
  reconnect() {
7679
7703
  return this.isClosed() ? Promise.reject(N.errorForCode(O.ConnectionClosed)) : this.isDraining() ? Promise.reject(N.errorForCode(O.ConnectionDraining)) : this.protocol.reconnect();
7680
7704
  }
7681
7705
  }
7682
- class Eo {
7706
+ class vo {
7683
7707
  constructor(e) {
7684
7708
  h(this, "nc");
7685
7709
  this.nc = e;
@@ -7695,7 +7719,7 @@ class Eo {
7695
7719
  return new to(this.nc, e, t);
7696
7720
  }
7697
7721
  }
7698
- class vo {
7722
+ class Eo {
7699
7723
  constructor(e, t, s) {
7700
7724
  h(this, "bucket");
7701
7725
  h(this, "sm");
@@ -7794,8 +7818,8 @@ class si extends dn {
7794
7818
  this.js._request(a, o, {
7795
7819
  retries: -1
7796
7820
  }).then((d) => {
7797
- const p = d, _ = this.sub.info;
7798
- _.last = p, this.info.config = p.config, this.info.name = p.name;
7821
+ const p = d, g = this.sub.info;
7822
+ g.last = p, this.info.config = p.config, this.info.name = p.name;
7799
7823
  }).catch((d) => {
7800
7824
  const p = new N(`unable to recreate ordered consumer ${n.stream} at seq ${t}`, O.RequestError, d);
7801
7825
  this.sub.callback(p, {});
@@ -7813,9 +7837,9 @@ class si extends dn {
7813
7837
  };
7814
7838
  s && (i.cancelAfter = s);
7815
7839
  const n = this.sub, o = (a) => {
7816
- var _, y, x, P;
7840
+ var g, y, x, P;
7817
7841
  const d = Gi(409, `${Se.IdleHeartbeatMissed}: ${a}`, this.sub.subject);
7818
- if (!((_ = this.info) == null ? void 0 : _.ordered))
7842
+ if (!((g = this.info) == null ? void 0 : g.ordered))
7819
7843
  this.sub.callback(null, d);
7820
7844
  else {
7821
7845
  if (!this.js.nc.protocol.connected)
@@ -7870,8 +7894,8 @@ class Po extends si {
7870
7894
  throw new Error("expires must be greater than idle_heartbeat");
7871
7895
  if (this.info) {
7872
7896
  this.monitor && this.monitor.cancel(), a && d && (this.monitor ? this.monitor._change(d, a) : this._setupHbMonitoring(d, a));
7873
- const p = this.info.api, _ = `${p.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`, y = this.sub.subject;
7874
- p.nc.publish(_, p.jc.encode(o), {
7897
+ const p = this.info.api, g = `${p.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`, y = this.sub.subject;
7898
+ p.nc.publish(g, p.jc.encode(o), {
7875
7899
  reply: y
7876
7900
  });
7877
7901
  }
@@ -8017,7 +8041,7 @@ class Ro {
8017
8041
  }) {
8018
8042
  const s = {};
8019
8043
  s.batch = t.batch || 1, s.no_wait = t.no_wait || !1, t.expires && t.expires > 0 && (s.expires = G(t.expires));
8020
- const i = ve().encode(s), n = ot.concat(fo, mo, i), o = e ? {
8044
+ const i = Ee().encode(s), n = ot.concat(fo, mo, i), o = e ? {
8021
8045
  reply: e
8022
8046
  } : void 0;
8023
8047
  this.msg.respond(n, o);
@@ -8165,7 +8189,7 @@ class Mo {
8165
8189
  }
8166
8190
  }
8167
8191
  }
8168
- function $o(r, e) {
8192
+ function Uo(r, e) {
8169
8193
  /^(.*:\/\/)(.*)/.test(r) || (typeof e == "boolean" ? r = `${e === !0 ? "https" : "http"}://${r}` : r = `https://${r}`);
8170
8194
  let s = new URL(r);
8171
8195
  const i = s.protocol.toLowerCase();
@@ -8189,14 +8213,14 @@ function $o(r, e) {
8189
8213
  }
8190
8214
  return `${n}//${a}:${o}${d}${p}`;
8191
8215
  }
8192
- function Uo(r = {}) {
8216
+ function $o(r = {}) {
8193
8217
  return pn({
8194
8218
  defaultPort: 443,
8195
- urlParseFn: $o,
8219
+ urlParseFn: Uo,
8196
8220
  factory: () => new Mo()
8197
8221
  }), Ks.connect(r);
8198
8222
  }
8199
- const Ue = ve();
8223
+ const $e = Ee();
8200
8224
  class Tr {
8201
8225
  constructor(e) {
8202
8226
  h(this, "onStatusChange");
@@ -8219,7 +8243,7 @@ class Tr {
8219
8243
  const { natsWsServerUrls: t, user: s, prefix: i } = e, n = t ?? [
8220
8244
  this.config.natsUrl
8221
8245
  ];
8222
- this.nc = await Uo({
8246
+ this.nc = await $o({
8223
8247
  servers: n
8224
8248
  });
8225
8249
  const o = s ?? await this.config.auth.getLastLoginData();
@@ -8232,13 +8256,13 @@ class Tr {
8232
8256
  this.globalPrefix ? `(prefix: ${this.globalPrefix})` : ""
8233
8257
  ), (async () => {
8234
8258
  var d, p;
8235
- for await (const _ of this.nc.status())
8236
- switch (_.type !== Le.PingTimer && console.log("[nats] connection status:", _.type), _.type) {
8237
- case Ee.Reconnect:
8259
+ for await (const g of this.nc.status())
8260
+ switch (g.type !== Le.PingTimer && console.log("[nats] connection status:", g.type), g.type) {
8261
+ case ve.Reconnect:
8238
8262
  (d = this.onStatusChange) == null || d.call(this, !0);
8239
8263
  break;
8240
- case Ee.Disconnect:
8241
- case Ee.Error:
8264
+ case ve.Disconnect:
8265
+ case ve.Error:
8242
8266
  case Le.Reconnecting:
8243
8267
  (p = this.onStatusChange) == null || p.call(this, !1);
8244
8268
  break;
@@ -8254,7 +8278,7 @@ class Tr {
8254
8278
  throw new Error("[nats] not connected");
8255
8279
  try {
8256
8280
  const s = this.buildSubject(e);
8257
- console.debug("[nats]>>", s), this.nc.publish(s, Ue.encode(t));
8281
+ console.debug("[nats]>>", s), this.nc.publish(s, $e.encode(t));
8258
8282
  } catch (s) {
8259
8283
  throw console.error("[nats] publish failed:", s), s;
8260
8284
  }
@@ -8267,9 +8291,9 @@ class Tr {
8267
8291
  console.debug("[nats]>>", i);
8268
8292
  const n = await this.nc.request(
8269
8293
  i,
8270
- Ue.encode(t),
8294
+ $e.encode(t),
8271
8295
  { timeout: (s == null ? void 0 : s.timeoutInMs) ?? 5e3 }
8272
- ), o = Ue.decode(
8296
+ ), o = $e.decode(
8273
8297
  n.data
8274
8298
  );
8275
8299
  if (!o.ok)
@@ -8293,11 +8317,11 @@ class Tr {
8293
8317
  continue;
8294
8318
  }
8295
8319
  a[0] === "dev" && a.shift();
8296
- const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], _ = a[a.length - 1], y = Ue.decode(o.data);
8320
+ const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = $e.decode(o.data);
8297
8321
  t(y, {
8298
8322
  subject: d,
8299
8323
  userId: p,
8300
- sessionId: _
8324
+ sessionId: g
8301
8325
  });
8302
8326
  } catch (a) {
8303
8327
  console.error("[nats] subscribe error", a);
@@ -8321,22 +8345,22 @@ class Tr {
8321
8345
  continue;
8322
8346
  }
8323
8347
  a[0] === "dev" && a.shift();
8324
- const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], _ = a[a.length - 1], y = Ue.decode(o.data);
8348
+ const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = $e.decode(o.data);
8325
8349
  try {
8326
8350
  const x = await t(y, {
8327
8351
  subject: d,
8328
8352
  userId: p,
8329
- sessionId: _
8353
+ sessionId: g
8330
8354
  });
8331
8355
  o.reply && o.respond(
8332
- Ue.encode({
8356
+ $e.encode({
8333
8357
  ok: !0,
8334
8358
  data: x
8335
8359
  })
8336
8360
  );
8337
8361
  } catch (x) {
8338
8362
  console.error("[nats] handle", x), o.reply && o.respond(
8339
- Ue.encode({
8363
+ $e.encode({
8340
8364
  ok: !1,
8341
8365
  message: x.message
8342
8366
  })
@@ -8344,7 +8368,7 @@ class Tr {
8344
8368
  }
8345
8369
  } catch (a) {
8346
8370
  console.error("[nats] handle", a), o.reply && o.respond(
8347
- Ue.encode({
8371
+ $e.encode({
8348
8372
  ok: !1,
8349
8373
  message: a.message
8350
8374
  })
@@ -8392,8 +8416,8 @@ class Lo {
8392
8416
  d.binaryType = "arraybuffer";
8393
8417
  const p = Fo(e, t, s);
8394
8418
  d.addEventListener("open", () => {
8395
- const _ = qo();
8396
- d.send(_);
8419
+ const g = qo();
8420
+ d.send(g);
8397
8421
  const y = `X-RequestId:${n}\r
8398
8422
  Content-Type:application/ssml+xml\r
8399
8423
  X-Timestamp:${(/* @__PURE__ */ new Date()).toISOString()}Z\r
@@ -8401,8 +8425,8 @@ Path:ssml\r
8401
8425
  \r
8402
8426
  ` + p;
8403
8427
  d.send(y);
8404
- }), d.addEventListener("message", (_) => {
8405
- const y = _.data;
8428
+ }), d.addEventListener("message", (g) => {
8429
+ const y = g.data;
8406
8430
  if (y instanceof ArrayBuffer) {
8407
8431
  const x = new Uint8Array(y), P = new TextEncoder().encode(`Path:audio\r
8408
8432
  `), I = Bo(x, P);
@@ -8418,16 +8442,16 @@ Path:ssml\r
8418
8442
  a("No audio data available to save.");
8419
8443
  return;
8420
8444
  }
8421
- const _ = i.reduce(
8445
+ const g = i.reduce(
8422
8446
  (P, I) => P + I.length,
8423
8447
  0
8424
- ), y = new Uint8Array(_);
8448
+ ), y = new Uint8Array(g);
8425
8449
  let x = 0;
8426
8450
  for (const P of i)
8427
8451
  y.set(P, x), x += P.length;
8428
8452
  o(y.buffer);
8429
- }), d.addEventListener("error", (_) => {
8430
- a(_);
8453
+ }), d.addEventListener("error", (g) => {
8454
+ a(g);
8431
8455
  });
8432
8456
  });
8433
8457
  }
@@ -8513,9 +8537,9 @@ class Ho {
8513
8537
  (y, x) => y + x.length,
8514
8538
  0
8515
8539
  ), p = new Uint8Array(d);
8516
- let _ = 0;
8540
+ let g = 0;
8517
8541
  for (const y of a)
8518
- p.set(y, _), _ += y.length;
8542
+ p.set(y, g), g += y.length;
8519
8543
  return p.buffer;
8520
8544
  }
8521
8545
  async getAudio(e, t) {