@jokio/sdk 0.5.0 → 0.6.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.
@@ -190,8 +190,8 @@ async function Bi(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 g;
194
- typeof d.getTransports == "function" && (g = d.getTransports());
193
+ let _;
194
+ typeof d.getTransports == "function" && (_ = d.getTransports());
195
195
  let y;
196
196
  if (typeof d.getPublicKeyAlgorithm == "function")
197
197
  try {
@@ -220,7 +220,7 @@ async function Bi(r) {
220
220
  response: {
221
221
  attestationObject: Me(d.attestationObject),
222
222
  clientDataJSON: Me(d.clientDataJSON),
223
- transports: g,
223
+ transports: _,
224
224
  publicKeyAlgorithm: y,
225
225
  publicKey: x,
226
226
  authenticatorData: A
@@ -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: g, type: y } = a;
316
+ const { id: d, rawId: p, response: _, type: y } = a;
317
317
  let x;
318
- return g.userHandle && (x = Me(g.userHandle)), {
318
+ return _.userHandle && (x = Me(_.userHandle)), {
319
319
  id: d,
320
320
  rawId: Me(p),
321
321
  response: {
322
- authenticatorData: Me(g.authenticatorData),
323
- clientDataJSON: Me(g.clientDataJSON),
324
- signature: Me(g.signature),
322
+ authenticatorData: Me(_.authenticatorData),
323
+ clientDataJSON: Me(_.clientDataJSON),
324
+ signature: Me(_.signature),
325
325
  userHandle: x
326
326
  },
327
327
  type: y,
@@ -364,35 +364,47 @@ class Xr {
364
364
  s.accessToken
365
365
  ), await this.options.storage.setItem(wt, s.jwtData), (i = this.onUserDataUpdate) == null || i.call(this, s.jwtData), s.jwtData;
366
366
  }
367
- async requestPasskeyLogin(e = {}) {
368
- var d, p;
369
- const {
370
- displayName: t = "",
371
- isRegistration: s = !1,
372
- addAsAdditionalDevice: i = !1
373
- } = e, n = await fetch(
367
+ /**
368
+ * Fetch WebAuthn challenge options ahead of the user gesture
369
+ * (e.g. on page load or pointerdown). Pass the result to
370
+ * completePasskeyLogin() inside the click handler so
371
+ * navigator.credentials.get() runs while the user activation is
372
+ * still fresh — iOS Safari rejects it otherwise.
373
+ */
374
+ async requestPasskeyChallenge(e = {}) {
375
+ const { displayName: t = "", isRegistration: s = !1 } = e;
376
+ return await fetch(
374
377
  this.options.authUrl + `/webauth-challenge-request?registration=${s ? "true" : ""}&displayName=${t}`,
375
378
  {
376
379
  headers: await this.getAuthHeader()
377
380
  }
378
381
  ).then(xt);
379
- let o;
382
+ }
383
+ /**
384
+ * Prompt for the passkey and verify it. Call synchronously from
385
+ * the click handler with a challenge obtained earlier via
386
+ * requestPasskeyChallenge().
387
+ */
388
+ async completePasskeyLogin(e, t = {}) {
389
+ var a, d;
390
+ const { displayName: s = "", addAsAdditionalDevice: i = !1 } = t;
391
+ let n;
380
392
  try {
381
- (d = n.user) != null && d.id ? o = await Bi({
382
- optionsJSON: n
383
- }) : o = await Ji({
384
- optionsJSON: n
393
+ !("user" in e) || !((a = e.user) != null && a.id) ? n = await Ji({
394
+ optionsJSON: e
395
+ }) : n = await Bi({
396
+ optionsJSON: e
385
397
  });
386
- } catch (g) {
387
- throw g.name === "InvalidStateError" ? alert(
398
+ } catch (p) {
399
+ throw p.name === "InvalidStateError" ? alert(
388
400
  "Error: Authenticator was probably already registered by user"
389
- ) : alert(g.message), g;
401
+ ) : alert(p.message), p;
390
402
  }
391
- const a = await fetch(
392
- this.options.authUrl + `/webauth-challenge-complete?displayName=${t}&addAsAdditionalDevice=${i ? "true" : ""}`,
403
+ const o = await fetch(
404
+ this.options.authUrl + `/webauth-challenge-complete?displayName=${s}&addAsAdditionalDevice=${i ? "true" : ""}`,
393
405
  {
394
406
  method: "POST",
395
- body: JSON.stringify(o),
407
+ body: JSON.stringify(n),
396
408
  headers: {
397
409
  "Content-Type": "application/json",
398
410
  ...await this.getAuthHeader()
@@ -401,8 +413,18 @@ class Xr {
401
413
  ).then(xt);
402
414
  return await this.options.storage.setItem(
403
415
  yt,
404
- a.accessToken
405
- ), await this.options.storage.setItem(wt, a.jwtData), (p = this.onUserDataUpdate) == null || p.call(this, a.jwtData), a.jwtData;
416
+ o.accessToken
417
+ ), await this.options.storage.setItem(wt, o.jwtData), (d = this.onUserDataUpdate) == null || d.call(this, o.jwtData), o.jwtData;
418
+ }
419
+ /**
420
+ * Fetches the challenge and prompts for the passkey in one call.
421
+ * Note: on iOS Safari the fetch may consume the user activation,
422
+ * causing credentials.get() to be blocked. Prefer
423
+ * requestPasskeyChallenge() + completePasskeyLogin().
424
+ */
425
+ async requestPasskeyLogin(e = {}) {
426
+ const t = await this.requestPasskeyChallenge(e);
427
+ return this.completePasskeyLogin(t, e);
406
428
  }
407
429
  async guestLogin() {
408
430
  var t;
@@ -1655,7 +1677,7 @@ Os = us, function() {
1655
1677
  16,
1656
1678
  8,
1657
1679
  0
1658
- ], g = [
1680
+ ], _ = [
1659
1681
  1116352408,
1660
1682
  1899447441,
1661
1683
  3049323471,
@@ -1840,7 +1862,7 @@ Os = us, function() {
1840
1862
  }, L.prototype.hash = function() {
1841
1863
  var w, R, F, N, P, U, q, $, V, re = this.h0, ne = this.h1, ie = this.h2, oe = this.h3, ue = this.h4, le = this.h5, X = this.h6, te = this.h7, ae = this.blocks;
1842
1864
  for (w = 16; w < 64; ++w) R = ((P = ae[w - 15]) >>> 7 | P << 25) ^ (P >>> 18 | P << 14) ^ P >>> 3, F = ((P = ae[w - 2]) >>> 17 | P << 15) ^ (P >>> 19 | P << 13) ^ P >>> 10, ae[w] = ae[w - 16] + R + ae[w - 7] + F | 0;
1843
- for (V = ne & ie, w = 0; w < 64; w += 4) this.first ? (this.is224 ? (U = 300032, te = (P = ae[0] - 1413257819) - 150054599 | 0, oe = P + 24177077 | 0) : (U = 704751109, te = (P = ae[0] - 210244248) - 1521486534 | 0, oe = P + 143694565 | 0), this.first = !1) : (R = (re >>> 2 | re << 30) ^ (re >>> 13 | re << 19) ^ (re >>> 22 | re << 10), N = (U = re & ne) ^ re & ie ^ V, te = oe + (P = te + (F = (ue >>> 6 | ue << 26) ^ (ue >>> 11 | ue << 21) ^ (ue >>> 25 | ue << 7)) + (ue & le ^ ~ue & X) + g[w] + ae[w]) | 0, oe = P + (R + N) | 0), R = (oe >>> 2 | oe << 30) ^ (oe >>> 13 | oe << 19) ^ (oe >>> 22 | oe << 10), N = (q = oe & re) ^ oe & ne ^ U, X = ie + (P = X + (F = (te >>> 6 | te << 26) ^ (te >>> 11 | te << 21) ^ (te >>> 25 | te << 7)) + (te & ue ^ ~te & le) + g[w + 1] + ae[w + 1]) | 0, R = ((ie = P + (R + N) | 0) >>> 2 | ie << 30) ^ (ie >>> 13 | ie << 19) ^ (ie >>> 22 | ie << 10), N = ($ = ie & oe) ^ ie & re ^ q, le = ne + (P = le + (F = (X >>> 6 | X << 26) ^ (X >>> 11 | X << 21) ^ (X >>> 25 | X << 7)) + (X & te ^ ~X & ue) + g[w + 2] + ae[w + 2]) | 0, R = ((ne = P + (R + N) | 0) >>> 2 | ne << 30) ^ (ne >>> 13 | ne << 19) ^ (ne >>> 22 | ne << 10), N = (V = ne & ie) ^ ne & oe ^ $, ue = re + (P = ue + (F = (le >>> 6 | le << 26) ^ (le >>> 11 | le << 21) ^ (le >>> 25 | le << 7)) + (le & X ^ ~le & te) + g[w + 3] + ae[w + 3]) | 0, re = P + (R + N) | 0, this.chromeBugWorkAround = !0;
1865
+ for (V = ne & ie, w = 0; w < 64; w += 4) this.first ? (this.is224 ? (U = 300032, te = (P = ae[0] - 1413257819) - 150054599 | 0, oe = P + 24177077 | 0) : (U = 704751109, te = (P = ae[0] - 210244248) - 1521486534 | 0, oe = P + 143694565 | 0), this.first = !1) : (R = (re >>> 2 | re << 30) ^ (re >>> 13 | re << 19) ^ (re >>> 22 | re << 10), N = (U = re & ne) ^ re & ie ^ V, te = oe + (P = te + (F = (ue >>> 6 | ue << 26) ^ (ue >>> 11 | ue << 21) ^ (ue >>> 25 | ue << 7)) + (ue & le ^ ~ue & X) + _[w] + ae[w]) | 0, oe = P + (R + N) | 0), R = (oe >>> 2 | oe << 30) ^ (oe >>> 13 | oe << 19) ^ (oe >>> 22 | oe << 10), N = (q = oe & re) ^ oe & ne ^ U, X = ie + (P = X + (F = (te >>> 6 | te << 26) ^ (te >>> 11 | te << 21) ^ (te >>> 25 | te << 7)) + (te & ue ^ ~te & le) + _[w + 1] + ae[w + 1]) | 0, R = ((ie = P + (R + N) | 0) >>> 2 | ie << 30) ^ (ie >>> 13 | ie << 19) ^ (ie >>> 22 | ie << 10), N = ($ = ie & oe) ^ ie & re ^ q, le = ne + (P = le + (F = (X >>> 6 | X << 26) ^ (X >>> 11 | X << 21) ^ (X >>> 25 | X << 7)) + (X & te ^ ~X & ue) + _[w + 2] + ae[w + 2]) | 0, R = ((ne = P + (R + N) | 0) >>> 2 | ne << 30) ^ (ne >>> 13 | ne << 19) ^ (ne >>> 22 | ne << 10), N = (V = ne & ie) ^ ne & oe ^ $, ue = re + (P = ue + (F = (le >>> 6 | le << 26) ^ (le >>> 11 | le << 21) ^ (le >>> 25 | le << 7)) + (le & X ^ ~le & te) + _[w + 3] + ae[w + 3]) | 0, re = P + (R + N) | 0, this.chromeBugWorkAround = !0;
1844
1866
  this.h0 = this.h0 + re | 0, this.h1 = this.h1 + ne | 0, this.h2 = this.h2 + ie | 0, this.h3 = this.h3 + oe | 0, this.h4 = this.h4 + ue | 0, this.h5 = this.h5 + le | 0, this.h6 = this.h6 + X | 0, this.h7 = this.h7 + te | 0;
1845
1867
  }, L.prototype.hex = function() {
1846
1868
  this.finalize();
@@ -2200,7 +2222,7 @@ class rs extends Mt {
2200
2222
  const A = x.message, O = A.indexOf("cannot contain");
2201
2223
  throw O !== -1 ? new Error(`consumer 'name' ${A.substring(O)}`) : x;
2202
2224
  }
2203
- let p, g = "";
2225
+ let p, _ = "";
2204
2226
  if (Array.isArray(t.filter_subjects)) {
2205
2227
  const { min: x, ok: A } = n.features.get(J.JS_MULTIPLE_CONSUMER_FILTER);
2206
2228
  if (!A)
@@ -2212,9 +2234,9 @@ class rs extends Mt {
2212
2234
  if (!A)
2213
2235
  throw new Error(`consumer 'metadata' requires server ${x}`);
2214
2236
  }
2215
- if (a && (g = t.name ?? t.durable_name ?? ""), g !== "") {
2237
+ if (a && (_ = t.name ?? t.durable_name ?? ""), _ !== "") {
2216
2238
  let x = t.filter_subject ?? void 0;
2217
- x === ">" && (x = void 0), p = x !== void 0 ? `${this.prefix}.CONSUMER.CREATE.${e}.${g}.${x}` : `${this.prefix}.CONSUMER.CREATE.${e}.${g}`;
2239
+ x === ">" && (x = void 0), p = x !== void 0 ? `${this.prefix}.CONSUMER.CREATE.${e}.${_}.${x}` : `${this.prefix}.CONSUMER.CREATE.${e}.${_}`;
2218
2240
  } else
2219
2241
  p = t.durable_name ? `${this.prefix}.CONSUMER.DURABLE.CREATE.${e}.${t.durable_name}` : `${this.prefix}.CONSUMER.CREATE.${e}`;
2220
2242
  return await this._request(p, i);
@@ -2257,21 +2279,21 @@ class Pn extends he {
2257
2279
  h(this, "adapter");
2258
2280
  h(this, "subIterDone");
2259
2281
  rt(i.adapter, "adapter", !0), this.adapter = i.adapter, i.callback && rt(i.callback, "callback"), this.noIterator = typeof i.callback == "function", i.ingestionFilterFn && (rt(i.ingestionFilterFn, "ingestionFilterFn"), this.ingestionFilterFn = i.ingestionFilterFn), i.protocolFilterFn && (rt(i.protocolFilterFn, "protocolFilterFn"), this.protocolFilterFn = i.protocolFilterFn), i.dispatchedFn && (rt(i.dispatchedFn, "dispatchedFn"), this.dispatchedFn = i.dispatchedFn), i.cleanupFn && rt(i.cleanupFn, "cleanupFn");
2260
- let n = (g, y) => {
2261
- this.callback(g, y);
2282
+ let n = (_, y) => {
2283
+ this.callback(_, y);
2262
2284
  };
2263
2285
  if (i.callback) {
2264
- const g = i.callback;
2286
+ const _ = i.callback;
2265
2287
  n = (y, x) => {
2266
2288
  const [A, O] = this.adapter(y, x);
2267
2289
  if (A) {
2268
- g(A, null);
2290
+ _(A, null);
2269
2291
  return;
2270
2292
  }
2271
2293
  const { ingest: j } = this.ingestionFilterFn ? this.ingestionFilterFn(O, this) : {
2272
2294
  ingest: !0
2273
2295
  };
2274
- j && (!this.protocolFilterFn || this.protocolFilterFn(O)) && (g(A, O), this.dispatchedFn && O && this.dispatchedFn(O));
2296
+ j && (!this.protocolFilterFn || this.protocolFilterFn(O)) && (_(A, O), this.dispatchedFn && O && this.dispatchedFn(O));
2275
2297
  };
2276
2298
  }
2277
2299
  const { max: o, queue: a, timeout: d } = i, p = {
@@ -2288,8 +2310,8 @@ class Pn extends he {
2288
2310
  this.subIterDone.resolve();
2289
2311
  }).catch(() => {
2290
2312
  this.subIterDone.resolve();
2291
- }), (async (g) => {
2292
- await g.closed, this.stop();
2313
+ }), (async (_) => {
2314
+ await _.closed, this.stop();
2293
2315
  })(this.sub).then().catch();
2294
2316
  }
2295
2317
  unsubscribe(t) {
@@ -2640,8 +2662,8 @@ class Jn {
2640
2662
  });
2641
2663
  const a = [];
2642
2664
  return this.servers.forEach((d, p) => {
2643
- const g = d.listen;
2644
- d.gossiped && this.currentServer.listen !== g && o.get(g) === void 0 && a.push(p), o.delete(g);
2665
+ const _ = d.listen;
2666
+ d.gossiped && this.currentServer.listen !== _ && o.get(_) === void 0 && a.push(p), o.delete(_);
2645
2667
  }), a.reverse(), a.forEach((d) => {
2646
2668
  const p = this.servers.splice(d, 1);
2647
2669
  i = i.concat(p[0].listen);
@@ -3370,7 +3392,7 @@ var I;
3370
3392
  11119,
3371
3393
  27886,
3372
3394
  20995
3373
- ]), g = t([
3395
+ ]), _ = t([
3374
3396
  61785,
3375
3397
  9906,
3376
3398
  39828,
@@ -3470,14 +3492,14 @@ var I;
3470
3492
  return ee(c, l, u, f, 32);
3471
3493
  }
3472
3494
  function R(c, l, u, f, m) {
3473
- var b = new Uint32Array(16), v = new Uint32Array(16), E = new Uint32Array(16), _ = new Uint32Array(4), S, M, H;
3495
+ var b = new Uint32Array(16), v = new Uint32Array(16), E = new Uint32Array(16), g = new Uint32Array(4), S, M, H;
3474
3496
  for (S = 0; S < 4; S++)
3475
3497
  v[5 * S] = j(f, 4 * S), v[1 + S] = j(u, 4 * S), v[6 + S] = j(l, 4 * S), v[11 + S] = j(u, 16 + 4 * S);
3476
3498
  for (S = 0; S < 16; S++) E[S] = v[S];
3477
3499
  for (S = 0; S < 20; S++) {
3478
3500
  for (M = 0; M < 4; M++) {
3479
- for (H = 0; H < 4; H++) _[H] = v[(5 * M + 4 * H) % 16];
3480
- for (_[1] ^= O(_[0] + _[3] | 0, 7), _[2] ^= O(_[1] + _[0] | 0, 9), _[3] ^= O(_[2] + _[1] | 0, 13), _[0] ^= O(_[3] + _[2] | 0, 18), H = 0; H < 4; H++) b[4 * M + (M + H) % 4] = _[H];
3501
+ for (H = 0; H < 4; H++) g[H] = v[(5 * M + 4 * H) % 16];
3502
+ for (g[1] ^= O(g[0] + g[3] | 0, 7), g[2] ^= O(g[1] + g[0] | 0, 9), g[3] ^= O(g[2] + g[1] | 0, 13), g[0] ^= O(g[3] + g[2] | 0, 18), H = 0; H < 4; H++) b[4 * M + (M + H) % 4] = g[H];
3481
3503
  }
3482
3504
  for (H = 0; H < 16; H++) v[H] = b[H];
3483
3505
  }
@@ -3515,18 +3537,18 @@ var I;
3515
3537
  107
3516
3538
  ]);
3517
3539
  function U(c, l, u, f, m, b, v) {
3518
- var E = new Uint8Array(16), _ = new Uint8Array(64), S, M;
3540
+ var E = new Uint8Array(16), g = new Uint8Array(64), S, M;
3519
3541
  if (!m) return 0;
3520
3542
  for (M = 0; M < 16; M++) E[M] = 0;
3521
3543
  for (M = 0; M < 8; M++) E[M] = b[M];
3522
3544
  for (; m >= 64; ) {
3523
- for (F(_, E, v, P), M = 0; M < 64; M++) c[l + M] = (u ? u[f + M] : 0) ^ _[M];
3545
+ for (F(g, E, v, P), M = 0; M < 64; M++) c[l + M] = (u ? u[f + M] : 0) ^ g[M];
3524
3546
  for (S = 1, M = 8; M < 16; M++)
3525
3547
  S = S + (E[M] & 255) | 0, E[M] = S & 255, S >>>= 8;
3526
3548
  m -= 64, l += 64, u && (f += 64);
3527
3549
  }
3528
3550
  if (m > 0)
3529
- for (F(_, E, v, P), M = 0; M < m; M++) c[l + M] = (u ? u[f + M] : 0) ^ _[M];
3551
+ for (F(g, E, v, P), M = 0; M < m; M++) c[l + M] = (u ? u[f + M] : 0) ^ g[M];
3530
3552
  return 0;
3531
3553
  }
3532
3554
  function q(c, l, u, f, m) {
@@ -3565,25 +3587,25 @@ var I;
3565
3587
  252
3566
3588
  ]);
3567
3589
  function ie(c, l, u, f, m, b) {
3568
- var v, E, _, S, M = new Uint32Array(17), H = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17), st = new Uint32Array(17);
3569
- for (_ = 0; _ < 17; _++) H[_] = Z[_] = 0;
3570
- for (_ = 0; _ < 16; _++) H[_] = b[_];
3590
+ var v, E, g, S, M = new Uint32Array(17), H = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17), st = new Uint32Array(17);
3591
+ for (g = 0; g < 17; g++) H[g] = Z[g] = 0;
3592
+ for (g = 0; g < 16; g++) H[g] = b[g];
3571
3593
  for (H[3] &= 15, H[4] &= 252, H[7] &= 15, H[8] &= 252, H[11] &= 15, H[12] &= 252, H[15] &= 15; m > 0; ) {
3572
- for (_ = 0; _ < 17; _++) je[_] = 0;
3573
- for (_ = 0; _ < 16 && _ < m; ++_) je[_] = u[f + _];
3574
- for (je[_] = 1, f += _, m -= _, re(Z, je), E = 0; E < 17; E++)
3575
- for (M[E] = 0, _ = 0; _ < 17; _++) M[E] = M[E] + Z[_] * (_ <= E ? H[E - _] : 320 * H[E + 17 - _] | 0) | 0 | 0;
3594
+ for (g = 0; g < 17; g++) je[g] = 0;
3595
+ for (g = 0; g < 16 && g < m; ++g) je[g] = u[f + g];
3596
+ for (je[g] = 1, f += g, m -= g, re(Z, je), E = 0; E < 17; E++)
3597
+ for (M[E] = 0, g = 0; g < 17; g++) M[E] = M[E] + Z[g] * (g <= E ? H[E - g] : 320 * H[E + 17 - g] | 0) | 0 | 0;
3576
3598
  for (E = 0; E < 17; E++) Z[E] = M[E];
3577
- for (S = 0, _ = 0; _ < 16; _++)
3578
- S = S + Z[_] | 0, Z[_] = S & 255, S >>>= 8;
3579
- for (S = S + Z[16] | 0, Z[16] = S & 3, S = 5 * (S >>> 2) | 0, _ = 0; _ < 16; _++)
3580
- S = S + Z[_] | 0, Z[_] = S & 255, S >>>= 8;
3599
+ for (S = 0, g = 0; g < 16; g++)
3600
+ S = S + Z[g] | 0, Z[g] = S & 255, S >>>= 8;
3601
+ for (S = S + Z[16] | 0, Z[16] = S & 3, S = 5 * (S >>> 2) | 0, g = 0; g < 16; g++)
3602
+ S = S + Z[g] | 0, Z[g] = S & 255, S >>>= 8;
3581
3603
  S = S + Z[16] | 0, Z[16] = S;
3582
3604
  }
3583
- for (_ = 0; _ < 17; _++) st[_] = Z[_];
3584
- for (re(Z, ne), v = -(Z[16] >>> 7) | 0, _ = 0; _ < 17; _++) Z[_] ^= v & (st[_] ^ Z[_]);
3585
- for (_ = 0; _ < 16; _++) je[_] = b[_ + 16];
3586
- for (je[16] = 0, re(Z, je), _ = 0; _ < 16; _++) c[l + _] = Z[_];
3605
+ for (g = 0; g < 17; g++) st[g] = Z[g];
3606
+ for (re(Z, ne), v = -(Z[16] >>> 7) | 0, g = 0; g < 17; g++) Z[g] ^= v & (st[g] ^ Z[g]);
3607
+ for (g = 0; g < 16; g++) je[g] = b[g + 16];
3608
+ for (je[16] = 0, re(Z, je), g = 0; g < 16; g++) c[l + g] = Z[g];
3587
3609
  return 0;
3588
3610
  }
3589
3611
  function oe(c, l, u, f, m, b) {
@@ -3676,14 +3698,14 @@ var I;
3676
3698
  for (f = 0; f < 16; f++) c[f] = u[f];
3677
3699
  }
3678
3700
  function $t(c, l, u) {
3679
- var f = new Uint8Array(32), m = new Float64Array(80), b, v, E = t(), _ = t(), S = t(), M = t(), H = t(), Z = t();
3701
+ var f = new Uint8Array(32), m = new Float64Array(80), b, v, E = t(), g = t(), S = t(), M = t(), H = t(), Z = t();
3680
3702
  for (v = 0; v < 31; v++) f[v] = l[v];
3681
3703
  for (f[31] = l[31] & 127 | 64, f[0] &= 248, ds(m, u), v = 0; v < 16; v++)
3682
- _[v] = m[v], M[v] = E[v] = S[v] = 0;
3704
+ g[v] = m[v], M[v] = E[v] = S[v] = 0;
3683
3705
  for (E[0] = M[0] = 1, v = 254; v >= 0; --v)
3684
- b = f[v >>> 3] >>> (v & 7) & 1, ae(E, _, b), ae(S, M, b), Ce(H, E, S), Ie(E, E, S), Ce(S, _, M), Ie(_, _, M), Ee(M, H), Ee(Z, E), D(E, S, E), D(S, _, H), Ce(H, E, S), Ie(E, E, S), Ee(_, E), Ie(S, M, Z), D(E, S, d), Ce(E, E, M), D(S, S, E), D(E, M, Z), D(M, _, m), Ee(_, H), ae(E, _, b), ae(S, M, b);
3706
+ b = f[v >>> 3] >>> (v & 7) & 1, ae(E, g, b), ae(S, M, b), Ce(H, E, S), Ie(E, E, S), Ce(S, g, M), Ie(g, g, M), Ee(M, H), Ee(Z, E), D(E, S, E), D(S, g, H), Ce(H, E, S), Ie(E, E, S), Ee(g, E), Ie(S, M, Z), D(E, S, d), Ce(E, E, M), D(S, S, E), D(E, M, Z), D(M, g, m), Ee(g, H), ae(E, g, b), ae(S, M, b);
3685
3707
  for (v = 0; v < 16; v++)
3686
- m[v + 16] = E[v], m[v + 32] = S[v], m[v + 48] = _[v], m[v + 64] = M[v];
3708
+ m[v + 16] = E[v], m[v + 32] = S[v], m[v + 48] = g[v], m[v + 64] = M[v];
3687
3709
  var je = m.subarray(32), st = m.subarray(16);
3688
3710
  return ar(je, je), D(st, st, je), Qe(c, st), 0;
3689
3711
  }
@@ -3828,22 +3850,22 @@ var I;
3828
3850
  new e(1816402316, 1246189591)
3829
3851
  ];
3830
3852
  function fr(c, l, u) {
3831
- var f = [], m = [], b = [], v = [], E, _, S;
3832
- for (_ = 0; _ < 8; _++) f[_] = b[_] = B(c, 8 * _);
3853
+ var f = [], m = [], b = [], v = [], E, g, S;
3854
+ for (g = 0; g < 8; g++) f[g] = b[g] = B(c, 8 * g);
3833
3855
  for (var M = 0; u >= 128; ) {
3834
- for (_ = 0; _ < 16; _++) v[_] = B(l, 8 * _ + M);
3835
- for (_ = 0; _ < 80; _++) {
3856
+ for (g = 0; g < 16; g++) v[g] = B(l, 8 * g + M);
3857
+ for (g = 0; g < 80; g++) {
3836
3858
  for (S = 0; S < 8; S++) m[S] = b[S];
3837
- for (E = pt(b[7], Pi(b[4]), vi(b[4], b[5], b[6]), Ci[_], v[_ % 16]), m[7] = pt(E, Ai(b[0]), Ei(b[0], b[1], b[2])), m[3] = pt(m[3], E), S = 0; S < 8; S++) b[(S + 1) % 8] = m[S];
3838
- if (_ % 16 === 15)
3859
+ for (E = pt(b[7], Pi(b[4]), vi(b[4], b[5], b[6]), Ci[g], v[g % 16]), m[7] = pt(E, Ai(b[0]), Ei(b[0], b[1], b[2])), m[3] = pt(m[3], E), S = 0; S < 8; S++) b[(S + 1) % 8] = m[S];
3860
+ if (g % 16 === 15)
3839
3861
  for (S = 0; S < 16; S++)
3840
3862
  v[S] = pt(v[S], v[(S + 9) % 16], ki(v[(S + 1) % 16]), Oi(v[(S + 14) % 16]));
3841
3863
  }
3842
- for (_ = 0; _ < 8; _++)
3843
- b[_] = pt(b[_], f[_]), f[_] = b[_];
3864
+ for (g = 0; g < 8; g++)
3865
+ b[g] = pt(b[g], f[g]), f[g] = b[g];
3844
3866
  M += 128, u -= 128;
3845
3867
  }
3846
- for (_ = 0; _ < 8; _++) L(c, 8 * _, f[_]);
3868
+ for (g = 0; g < 8; g++) L(c, 8 * g, f[g]);
3847
3869
  return u;
3848
3870
  }
3849
3871
  var Ii = new Uint8Array([
@@ -3921,8 +3943,8 @@ var I;
3921
3943
  return 0;
3922
3944
  }
3923
3945
  function Bt(c, l) {
3924
- var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), _ = t(), S = t(), M = t();
3925
- Ie(u, c[1], c[0]), Ie(M, l[1], l[0]), D(u, u, M), Ce(f, c[0], c[1]), Ce(M, l[0], l[1]), D(f, f, M), D(m, c[3], l[3]), D(m, m, g), D(b, c[2], l[2]), Ce(b, b, b), Ie(v, f, u), Ie(E, b, m), Ce(_, b, m), Ce(S, f, u), D(c[0], v, E), D(c[1], S, _), D(c[2], _, E), D(c[3], v, S);
3946
+ var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), g = t(), S = t(), M = t();
3947
+ Ie(u, c[1], c[0]), Ie(M, l[1], l[0]), D(u, u, M), Ce(f, c[0], c[1]), Ce(M, l[0], l[1]), D(f, f, M), D(m, c[3], l[3]), D(m, m, _), D(b, c[2], l[2]), Ce(b, b, b), Ie(v, f, u), Ie(E, b, m), Ce(g, b, m), Ce(S, f, u), D(c[0], v, E), D(c[1], S, g), D(c[2], g, E), D(c[3], v, S);
3926
3948
  }
3927
3949
  function dr(c, l, u) {
3928
3950
  var f;
@@ -4011,7 +4033,7 @@ var I;
4011
4033
  gs(c, l);
4012
4034
  }
4013
4035
  function pr(c, l, u, f) {
4014
- var m = new Uint8Array(64), b = new Uint8Array(64), v = new Uint8Array(64), E, _, S = new Float64Array(64), M = [
4036
+ var m = new Uint8Array(64), b = new Uint8Array(64), v = new Uint8Array(64), E, g, S = new Float64Array(64), M = [
4015
4037
  t(),
4016
4038
  t(),
4017
4039
  t(),
@@ -4025,13 +4047,13 @@ var I;
4025
4047
  for (Ye(b, c, u + 64), _s(b), E = 0; E < 64; E++) S[E] = 0;
4026
4048
  for (E = 0; E < 32; E++) S[E] = v[E];
4027
4049
  for (E = 0; E < 32; E++)
4028
- for (_ = 0; _ < 32; _++)
4029
- S[E + _] += b[E] * m[_];
4050
+ for (g = 0; g < 32; g++)
4051
+ S[E + g] += b[E] * m[g];
4030
4052
  return gs(c.subarray(32), S), H;
4031
4053
  }
4032
4054
  function ji(c, l) {
4033
- var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), _ = t();
4034
- return X(c[2], a), ds(c[1], l), Ee(m, c[1]), D(b, m, p), Ie(m, m, c[2]), Ce(b, c[2], b), Ee(v, b), Ee(E, v), D(_, E, v), D(u, _, m), D(u, u, b), cr(u, u), D(u, u, m), D(u, u, b), D(u, u, b), D(c[0], u, b), Ee(f, c[0]), D(f, f, b), nr(f, m) && D(c[0], c[0], A), Ee(f, c[0]), D(f, f, b), nr(f, m) ? -1 : (or(c[0]) === l[31] >> 7 && Ie(c[0], o, c[0]), D(c[3], c[0], c[1]), 0);
4055
+ var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), g = t();
4056
+ return X(c[2], a), ds(c[1], l), Ee(m, c[1]), D(b, m, p), Ie(m, m, c[2]), Ce(b, c[2], b), Ee(v, b), Ee(E, v), D(g, E, v), D(u, g, m), D(u, u, b), cr(u, u), D(u, u, m), D(u, u, b), D(u, u, b), D(c[0], u, b), Ee(f, c[0]), D(f, f, b), nr(f, m) && D(c[0], c[0], A), Ee(f, c[0]), D(f, f, b), nr(f, m) ? -1 : (or(c[0]) === l[31] >> 7 && Ie(c[0], o, c[0]), D(c[3], c[0], c[1]), 0);
4035
4057
  }
4036
4058
  function ys(c, l, u, f) {
4037
4059
  var m, b = new Uint8Array(32), v = new Uint8Array(64), E = [
@@ -4039,16 +4061,16 @@ var I;
4039
4061
  t(),
4040
4062
  t(),
4041
4063
  t()
4042
- ], _ = [
4064
+ ], g = [
4043
4065
  t(),
4044
4066
  t(),
4045
4067
  t(),
4046
4068
  t()
4047
4069
  ];
4048
- if (u < 64 || ji(_, f)) return -1;
4070
+ if (u < 64 || ji(g, f)) return -1;
4049
4071
  for (m = 0; m < u; m++) c[m] = l[m];
4050
4072
  for (m = 0; m < 32; m++) c[m + 32] = f[m];
4051
- if (Ye(v, c, u), _s(v), ms(E, _, v), Dt(_, l.subarray(32)), Bt(E, _), ps(b, E), u -= 64, w(l, 0, b, 0)) {
4073
+ if (Ye(v, c, u), _s(v), ms(E, g, v), Dt(g, l.subarray(32)), Bt(E, g), ps(b, E), u -= 64, w(l, 0, b, 0)) {
4052
4074
  for (m = 0; m < u; m++) c[m] = 0;
4053
4075
  return -1;
4054
4076
  }
@@ -5606,16 +5628,16 @@ class Ut {
5606
5628
  setupHandler(e, t = !1) {
5607
5629
  const s = t ? "" : e.queue ? e.queue : this.config.queue, { name: i, subject: n, handler: o } = e, a = e;
5608
5630
  a.internal = t, t && this.internal.push(a), a.stats = new ko(i, n, s), a.queue = s;
5609
- const d = o ? (p, g) => {
5631
+ const d = o ? (p, _) => {
5610
5632
  if (p) {
5611
5633
  this.close(p);
5612
5634
  return;
5613
5635
  }
5614
5636
  const y = Date.now();
5615
5637
  try {
5616
- o(p, new Fr(g));
5638
+ o(p, new Fr(_));
5617
5639
  } catch (x) {
5618
- a.stats.countError(x), g == null || g.respond(ve, {
5640
+ a.stats.countError(x), _ == null || _.respond(ve, {
5619
5641
  headers: this.errorToHeader(x)
5620
5642
  });
5621
5643
  } finally {
@@ -5629,8 +5651,8 @@ class Ut {
5629
5651
  this._stopped || this.close(new Error(`required subscription ${e.subject} stopped`)).catch();
5630
5652
  }).catch((p) => {
5631
5653
  if (!this._stopped) {
5632
- const g = new Error(`required subscription ${e.subject} errored: ${p.message}`);
5633
- g.stack = p.stack, this.close(g).catch();
5654
+ const _ = new Error(`required subscription ${e.subject} errored: ${p.message}`);
5655
+ _.stack = p.stack, this.close(_).catch();
5634
5656
  }
5635
5657
  }), a;
5636
5658
  }
@@ -5957,16 +5979,16 @@ class Nt {
5957
5979
  return Promise.reject(new Error(`allow_direct is not available on server version ${y} - requires ${p}`));
5958
5980
  }
5959
5981
  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 = W(t.ttl)), s.allow_rollup_hdrs = !0;
5960
- let g;
5982
+ let _;
5961
5983
  try {
5962
- g = await this.jsm.streams.info(s.name), !g.config.allow_direct && this.direct === !0 && (this.direct = !1);
5984
+ _ = await this.jsm.streams.info(s.name), !_.config.allow_direct && this.direct === !0 && (this.direct = !1);
5963
5985
  } catch (y) {
5964
5986
  if (y.message === "stream not found")
5965
- g = await this.jsm.streams.add(s);
5987
+ _ = await this.jsm.streams.add(s);
5966
5988
  else
5967
5989
  throw y;
5968
5990
  }
5969
- this.initializePrefixes(g);
5991
+ this.initializePrefixes(_);
5970
5992
  }
5971
5993
  initializePrefixes(e) {
5972
5994
  this._prefixLen = 0, this.prefix = `$KV.${this.bucket}`, this.useJsPrefix = this.js.apiPrefix !== "$JS.API";
@@ -6189,9 +6211,9 @@ class Nt {
6189
6211
  s.push(A), s.received++, (n && o > 0 && s.received >= o || x.info.pending === 0) && (s.push(n), n = void 0);
6190
6212
  }
6191
6213
  });
6192
- const g = await this.js.subscribe(d, p);
6214
+ const _ = await this.js.subscribe(d, p);
6193
6215
  if (n) {
6194
- const { info: { last: y } } = g, x = y.num_pending + y.delivered.consumer_seq;
6216
+ const { info: { last: y } } = _, x = y.num_pending + y.delivered.consumer_seq;
6195
6217
  if (x === 0 || s.received >= x)
6196
6218
  try {
6197
6219
  n();
@@ -6203,9 +6225,9 @@ class Nt {
6203
6225
  else
6204
6226
  o = x;
6205
6227
  }
6206
- return s._data = g, s.iterClosed.then(() => {
6207
- g.unsubscribe();
6208
- }), g.closed.then(() => {
6228
+ return s._data = _, s.iterClosed.then(() => {
6229
+ _.unsubscribe();
6230
+ }), _.closed.then(() => {
6209
6231
  s.stop();
6210
6232
  }).catch((y) => {
6211
6233
  s.stop(y);
@@ -6222,7 +6244,7 @@ class Nt {
6222
6244
  e.include === Re.AllHistory ? n = Re.AllHistory : e.include === Re.UpdatesOnly && (n = Re.UpdatesOnly);
6223
6245
  const o = e.ignoreDeletes === !0;
6224
6246
  let a = e.initializedFn, d = 0;
6225
- const p = this._buildCC(t, n, i), g = p.filter_subject, y = ze(p);
6247
+ const p = this._buildCC(t, n, i), _ = p.filter_subject, y = ze(p);
6226
6248
  this.canSetWatcherName() && y.consumerName(Ge.next()), y.bindStream(this.stream), e.resumeFromRevision && e.resumeFromRevision > 0 && y.startSequence(e.resumeFromRevision), y.orderedConsumer(), y.callback((A, O) => {
6227
6249
  if (A) {
6228
6250
  s.stop(A);
@@ -6235,7 +6257,7 @@ class Nt {
6235
6257
  s.push(j), s.received++, a && (d > 0 && s.received >= d || O.info.pending === 0) && (s.push(a), a = void 0);
6236
6258
  }
6237
6259
  });
6238
- const x = await this.js.subscribe(g, y);
6260
+ const x = await this.js.subscribe(_, y);
6239
6261
  if (a) {
6240
6262
  const { info: { last: A } } = x, O = A.num_pending + A.delivered.consumer_seq;
6241
6263
  if (O === 0 || s.received >= O)
@@ -6266,8 +6288,8 @@ class Nt {
6266
6288
  return (async () => {
6267
6289
  var d;
6268
6290
  for await (const p of o) {
6269
- const g = (d = p.headers) == null ? void 0 : d.get(as);
6270
- if (g !== "DEL" && g !== "PURGE") {
6291
+ const _ = (d = p.headers) == null ? void 0 : d.get(as);
6292
+ if (_ !== "DEL" && _ !== "PURGE") {
6271
6293
  const y = this.decodeKey(p.subject.substring(this.prefixLen));
6272
6294
  t.push(y);
6273
6295
  }
@@ -6532,8 +6554,8 @@ class Ns extends he {
6532
6554
  var p;
6533
6555
  const d = this.consumer.api.nc.status();
6534
6556
  this.statusIterator = d;
6535
- for await (const g of d)
6536
- switch (g.type) {
6557
+ for await (const _ of d)
6558
+ switch (_.type) {
6537
6559
  case ke.Disconnect:
6538
6560
  (p = this.monitor) == null || p.cancel();
6539
6561
  break;
@@ -6828,7 +6850,7 @@ class Ho {
6828
6850
  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 || se.StartSequence, (this.consumerOpts.deliver_policy === se.LastPerSubject || this.consumerOpts.deliver_policy === se.New || this.consumerOpts.deliver_policy === se.Last) && (delete s.opt_start_seq, s.deliver_policy = this.consumerOpts.deliver_policy), s.deliver_policy === se.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 = se.StartTime, s.opt_start_time = this.consumerOpts.opt_start_time), this.consumerOpts.inactive_threshold && (s.inactive_threshold = W(this.consumerOpts.inactive_threshold))), s;
6829
6851
  }
6830
6852
  async resetConsumer(e = 0) {
6831
- var o, a, d, p, g;
6853
+ var o, a, d, p, _;
6832
6854
  Ge.next();
6833
6855
  const t = this.serial === 0;
6834
6856
  (o = this.consumer) == null || o.delete().catch(() => {
@@ -6845,7 +6867,7 @@ class Ho {
6845
6867
  break;
6846
6868
  } catch (x) {
6847
6869
  if (x.message === "stream not found" && ((p = this.iter) == null || p.notify($e.StreamNotFound, y), this.type === Ae.Fetch || this.opts.abort_on_missing_resource === !0))
6848
- return (g = this.iter) == null || g.stop(x), Promise.reject(x);
6870
+ return (_ = this.iter) == null || _.stop(x), Promise.reject(x);
6849
6871
  if (t && y >= this.maxInitialReset)
6850
6872
  throw x;
6851
6873
  await dt(i.backoff(y + 1));
@@ -7076,11 +7098,11 @@ class sr extends Mt {
7076
7098
  if (o && o > d) {
7077
7099
  const p = [
7078
7100
  n
7079
- ], g = t || {};
7101
+ ], _ = t || {};
7080
7102
  let y = 0;
7081
7103
  for (; o > d; ) {
7082
- y++, g.offset = a * y;
7083
- const A = await this._request(s, g);
7104
+ y++, _.offset = a * y;
7105
+ const A = await this._request(s, _);
7084
7106
  o = A.total, p.push(A);
7085
7107
  const O = Object.getOwnPropertyNames(A.state.subjects).length;
7086
7108
  if (d += O, O < a)
@@ -7176,8 +7198,8 @@ class Jo extends Mt {
7176
7198
  }), p = at(d);
7177
7199
  if (p)
7178
7200
  return Promise.reject(p);
7179
- const g = new Ws(d);
7180
- return Promise.resolve(g);
7201
+ const _ = new Ws(d);
7202
+ return Promise.resolve(_);
7181
7203
  }
7182
7204
  async getBatch(e, t) {
7183
7205
  pe(e);
@@ -7189,13 +7211,13 @@ class Jo extends Mt {
7189
7211
  });
7190
7212
  return (async () => {
7191
7213
  var y, x, A;
7192
- let d = !1, p = !1, g;
7214
+ let d = !1, p = !1, _;
7193
7215
  for await (const O of a) {
7194
7216
  if (!d) {
7195
7217
  d = !0;
7196
7218
  const j = ((y = O.headers) == null ? void 0 : y.code) || 0;
7197
7219
  if (j !== 0 && j < 200 || j > 299) {
7198
- g = (x = O.headers) == null ? void 0 : x.description.toLowerCase();
7220
+ _ = (x = O.headers) == null ? void 0 : x.description.toLowerCase();
7199
7221
  break;
7200
7222
  }
7201
7223
  if (((A = O.headers) == null ? void 0 : A.get("Nats-Num-Pending")) === "") {
@@ -7210,8 +7232,8 @@ class Jo extends Mt {
7210
7232
  o.push(() => {
7211
7233
  if (p)
7212
7234
  throw new Error("batch direct get not supported by the server");
7213
- if (g)
7214
- throw new Error(`bad request: ${g}`);
7235
+ if (_)
7236
+ throw new Error(`bad request: ${_}`);
7215
7237
  o.stop();
7216
7238
  });
7217
7239
  })(), Promise.resolve(o);
@@ -7479,7 +7501,7 @@ class It {
7479
7501
  e = e || {}, e.options = e.options || {};
7480
7502
  let p = ((de = e.options) == null ? void 0 : de.max_chunk_size) || 128 * 1024;
7481
7503
  p = p > d ? d : p, e.options.max_chunk_size = p;
7482
- const g = await this.info(e.name), { name: y, error: x } = this._checkNotEmpty(e.name);
7504
+ const _ = await this.info(e.name), { name: y, error: x } = this._checkNotEmpty(e.name);
7483
7505
  if (x)
7484
7506
  return Promise.reject(x);
7485
7507
  const A = Ge.next(), O = this._chunkSubject(A), j = this._metaSubject(y), B = Object.assign({
@@ -7511,10 +7533,10 @@ class It {
7511
7533
  headers: U,
7512
7534
  timeout: n
7513
7535
  });
7514
- if (B.revision = q.seq, g)
7536
+ if (B.revision = q.seq, _)
7515
7537
  try {
7516
7538
  await this.jsm.streams.purge(this.stream, {
7517
- filter: `$O.${this.name}.C.${g.nuid}`
7539
+ filter: `$O.${this.name}.C.${_.nuid}`
7518
7540
  });
7519
7541
  } catch {
7520
7542
  }
@@ -7594,10 +7616,10 @@ class It {
7594
7616
  let o;
7595
7617
  const a = ze();
7596
7618
  a.orderedConsumer();
7597
- const d = Nr.create(), p = `$O.${this.name}.C.${t.nuid}`, g = await this.js.subscribe(p, a);
7619
+ const d = Nr.create(), p = `$O.${this.name}.C.${t.nuid}`, _ = await this.js.subscribe(p, a);
7598
7620
  return (async () => {
7599
- for await (const y of g)
7600
- y.data.length > 0 && (d.update(y.data), o.enqueue(y.data)), y.info.pending === 0 && (xn(s, d.digest()) ? o.close() : o.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${s}`)), g.unsubscribe());
7621
+ for await (const y of _)
7622
+ y.data.length > 0 && (d.update(y.data), o.enqueue(y.data)), y.info.pending === 0 && (xn(s, d.digest()) ? o.close() : o.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${s}`)), _.unsubscribe());
7601
7623
  })().then(() => {
7602
7624
  i.resolve();
7603
7625
  }).catch((y) => {
@@ -7607,7 +7629,7 @@ class It {
7607
7629
  o = y;
7608
7630
  },
7609
7631
  cancel() {
7610
- g.unsubscribe();
7632
+ _.unsubscribe();
7611
7633
  }
7612
7634
  }), n;
7613
7635
  }
@@ -7701,14 +7723,14 @@ class It {
7701
7723
  }
7702
7724
  const n = Oe(), o = ze();
7703
7725
  o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((d, p) => {
7704
- var g;
7726
+ var _;
7705
7727
  if (d) {
7706
7728
  s.stop(d);
7707
7729
  return;
7708
7730
  }
7709
7731
  if (p !== null) {
7710
7732
  const y = n.decode(p.data);
7711
- y.deleted && e.ignoreDeletes === !0 || s.push(y), ((g = p.info) == null ? void 0 : g.pending) === 0 && !t && (t = !0, s.push(null));
7733
+ y.deleted && e.ignoreDeletes === !0 || s.push(y), ((_ = p.info) == null ? void 0 : _.pending) === 0 && !t && (t = !0, s.push(null));
7712
7734
  }
7713
7735
  });
7714
7736
  const a = await this.js.subscribe(i, o);
@@ -7802,10 +7824,10 @@ class rr extends Mt {
7802
7824
  o && (a.timeout = o), i && (a.headers = n);
7803
7825
  let { retries: d, retry_delay: p } = i;
7804
7826
  d = d || 1, p = p || 250;
7805
- let g;
7827
+ let _;
7806
7828
  for (let x = 0; x < d; x++)
7807
7829
  try {
7808
- g = await this.nc.request(t, s, a);
7830
+ _ = await this.nc.request(t, s, a);
7809
7831
  break;
7810
7832
  } catch (A) {
7811
7833
  if (A.code === "503" && x + 1 < d)
@@ -7813,7 +7835,7 @@ class rr extends Mt {
7813
7835
  else
7814
7836
  throw A;
7815
7837
  }
7816
- const y = this.parseJsResponse(g);
7838
+ const y = this.parseJsResponse(_);
7817
7839
  if (y.stream === "")
7818
7840
  throw T.errorForCode(k.JetStreamInvalidAck);
7819
7841
  return y.duplicate = y.duplicate ? y.duplicate : !1, y;
@@ -7841,20 +7863,20 @@ class rr extends Mt {
7841
7863
  let a = 0;
7842
7864
  const d = o ? i.max_bytes : 0;
7843
7865
  let p = null;
7844
- const g = {};
7845
- if (g.batch = i.batch || 1, d) {
7866
+ const _ = {};
7867
+ if (_.batch = i.batch || 1, d) {
7846
7868
  const L = this.nc.features.get(J.JS_PULL_MAX_BYTES);
7847
7869
  if (!L.ok)
7848
7870
  throw new Error(`max_bytes is only supported on servers ${L.min} or better`);
7849
- g.max_bytes = d;
7871
+ _.max_bytes = d;
7850
7872
  }
7851
- g.no_wait = i.no_wait || !1, g.no_wait && g.expires && (g.expires = 0);
7873
+ _.no_wait = i.no_wait || !1, _.no_wait && _.expires && (_.expires = 0);
7852
7874
  const y = i.expires || 0;
7853
- if (y && (g.expires = W(y)), y === 0 && g.no_wait === !1)
7875
+ if (y && (_.expires = W(y)), y === 0 && _.no_wait === !1)
7854
7876
  throw new Error("expires or no_wait is required");
7855
7877
  const x = i.idle_heartbeat || 0;
7856
- x && (g.idle_heartbeat = W(x), i.delay_heartbeat === !0 && (g.idle_heartbeat = W(x * 4)));
7857
- const A = new he(), O = g.batch;
7878
+ x && (_.idle_heartbeat = W(x), i.delay_heartbeat === !0 && (_.idle_heartbeat = W(x * 4)));
7879
+ const A = new he(), O = _.batch;
7858
7880
  let j = 0;
7859
7881
  A.protocolFilterFn = (L, ee = !1) => Ls(L.msg) ? (p == null || p.work(), !1) : !0, A.dispatchedFn = (L) => {
7860
7882
  if (L) {
@@ -7880,7 +7902,7 @@ class rr extends Mt {
7880
7902
  } catch {
7881
7903
  }
7882
7904
  await Q.closed, n !== null && (n.cancel(), n = null), p && p.cancel(), A.stop();
7883
- })().catch(), this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(g), {
7905
+ })().catch(), this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(_), {
7884
7906
  reply: B
7885
7907
  }), A;
7886
7908
  }
@@ -8094,7 +8116,7 @@ class ir {
8094
8116
  if (s.noMux) {
8095
8117
  const d = i ? new Error().stack : null;
8096
8118
  let p = typeof s.maxMessages == "number" && s.maxMessages > 0 ? s.maxMessages : -1;
8097
- const g = this.subscribe(qe(this.options.inboxPrefix), {
8119
+ const _ = this.subscribe(qe(this.options.inboxPrefix), {
8098
8120
  callback: (O, j) => {
8099
8121
  var B, Q;
8100
8122
  if (((B = j == null ? void 0 : j.data) == null ? void 0 : B.length) === 0 && ((Q = j == null ? void 0 : j.headers) == null ? void 0 : Q.status) === k.NoResponders && (O = T.errorForCode(k.NoResponders)), O) {
@@ -8108,7 +8130,7 @@ ${d}`), y(O);
8108
8130
  }, 300)), s.strategy === Ne.SentinelMsg && j && j.data.length === 0 && y();
8109
8131
  }
8110
8132
  });
8111
- g.requestSubject = e, g.closed.then(() => {
8133
+ _.requestSubject = e, _.closed.then(() => {
8112
8134
  o();
8113
8135
  }).catch((O) => {
8114
8136
  n.stop(O);
@@ -8116,20 +8138,20 @@ ${d}`), y(O);
8116
8138
  const y = (O) => {
8117
8139
  O && n.push(() => {
8118
8140
  throw O;
8119
- }), A(), g.drain().then(() => {
8141
+ }), A(), _.drain().then(() => {
8120
8142
  o();
8121
8143
  }).catch((j) => {
8122
8144
  o();
8123
8145
  });
8124
8146
  };
8125
8147
  n.iterClosed.then(() => {
8126
- A(), g == null || g.unsubscribe();
8148
+ A(), _ == null || _.unsubscribe();
8127
8149
  }).catch((O) => {
8128
- A(), g == null || g.unsubscribe();
8150
+ A(), _ == null || _.unsubscribe();
8129
8151
  });
8130
8152
  try {
8131
8153
  this.publish(e, t, {
8132
- reply: g.getSubject()
8154
+ reply: _.getSubject()
8133
8155
  });
8134
8156
  } catch (O) {
8135
8157
  y(O);
@@ -8144,8 +8166,8 @@ ${d}`), y(O);
8144
8166
  const d = s;
8145
8167
  d.callback = a, n.iterClosed.then(() => {
8146
8168
  p.cancel();
8147
- }).catch((g) => {
8148
- p.cancel(g);
8169
+ }).catch((_) => {
8170
+ p.cancel(_);
8149
8171
  });
8150
8172
  const p = new Sn(this.protocol.muxSubscriptions, e, d);
8151
8173
  this.protocol.request(p);
@@ -8154,8 +8176,8 @@ ${d}`), y(O);
8154
8176
  reply: `${this.protocol.muxSubscriptions.baseInbox}${p.token}`,
8155
8177
  headers: s.headers
8156
8178
  });
8157
- } catch (g) {
8158
- p.cancel(g);
8179
+ } catch (_) {
8180
+ p.cancel(_);
8159
8181
  }
8160
8182
  }
8161
8183
  return Promise.resolve(n);
@@ -8178,12 +8200,12 @@ ${d}`), y(O);
8178
8200
  const n = s.reply ? s.reply : qe(this.options.inboxPrefix), o = Y(), a = i ? new Error() : null, d = this.subscribe(n, {
8179
8201
  max: 1,
8180
8202
  timeout: s.timeout,
8181
- callback: (p, g) => {
8203
+ callback: (p, _) => {
8182
8204
  p ? (a && p.code !== k.Timeout && (p.stack += `
8183
8205
 
8184
- ${a.stack}`), d.unsubscribe(), o.reject(p)) : (p = ei(g), p ? (a && (p.stack += `
8206
+ ${a.stack}`), d.unsubscribe(), o.reject(p)) : (p = ei(_), p ? (a && (p.stack += `
8185
8207
 
8186
- ${a.stack}`), o.reject(p)) : o.resolve(g));
8208
+ ${a.stack}`), o.reject(p)) : o.resolve(_));
8187
8209
  }
8188
8210
  });
8189
8211
  return d.requestSubject = e, this.protocol.publish(e, t, {
@@ -8396,8 +8418,8 @@ class mi extends Pn {
8396
8418
  this.js._request(a, o, {
8397
8419
  retries: -1
8398
8420
  }).then((d) => {
8399
- const p = d, g = this.sub.info;
8400
- g.last = p, this.info.config = p.config, this.info.name = p.name;
8421
+ const p = d, _ = this.sub.info;
8422
+ _.last = p, this.info.config = p.config, this.info.name = p.name;
8401
8423
  }).catch((d) => {
8402
8424
  const p = new T(`unable to recreate ordered consumer ${n.stream} at seq ${t}`, k.RequestError, d);
8403
8425
  this.sub.callback(p, {});
@@ -8415,9 +8437,9 @@ class mi extends Pn {
8415
8437
  };
8416
8438
  s && (i.cancelAfter = s);
8417
8439
  const n = this.sub, o = (a) => {
8418
- var g, y, x, A;
8440
+ var _, y, x, A;
8419
8441
  const d = on(409, `${Pe.IdleHeartbeatMissed}: ${a}`, this.sub.subject);
8420
- if (!((g = this.info) == null ? void 0 : g.ordered))
8442
+ if (!((_ = this.info) == null ? void 0 : _.ordered))
8421
8443
  this.sub.callback(null, d);
8422
8444
  else {
8423
8445
  if (!this.js.nc.protocol.connected)
@@ -8472,8 +8494,8 @@ class Zo extends mi {
8472
8494
  throw new Error("expires must be greater than idle_heartbeat");
8473
8495
  if (this.info) {
8474
8496
  this.monitor && this.monitor.cancel(), a && d && (this.monitor ? this.monitor._change(d, a) : this._setupHbMonitoring(d, a));
8475
- const p = this.info.api, g = `${p.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`, y = this.sub.subject;
8476
- p.nc.publish(g, p.jc.encode(o), {
8497
+ const p = this.info.api, _ = `${p.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`, y = this.sub.subject;
8498
+ p.nc.publish(_, p.jc.encode(o), {
8477
8499
  reply: y
8478
8500
  });
8479
8501
  }
@@ -8824,12 +8846,12 @@ class Kr {
8824
8846
  const p = o ?? await this.config.auth.getSessionSeed();
8825
8847
  if (!p)
8826
8848
  throw new Error("Please provide session seed");
8827
- const g = Us();
8849
+ const _ = Us();
8828
8850
  this.nc = await ha({
8829
8851
  servers: a,
8830
8852
  authenticator: fo(
8831
8853
  d,
8832
- g.encode(p)
8854
+ _.encode(p)
8833
8855
  )
8834
8856
  });
8835
8857
  const y = s ?? await this.config.auth.getLastLoginData();
@@ -8900,11 +8922,11 @@ class Kr {
8900
8922
  continue;
8901
8923
  }
8902
8924
  a[0] === "dev" && a.shift();
8903
- const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = Be.decode(o.data);
8925
+ const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], _ = a[a.length - 1], y = Be.decode(o.data);
8904
8926
  t(y, {
8905
8927
  subject: d,
8906
8928
  userId: p,
8907
- sessionId: g
8929
+ sessionId: _
8908
8930
  });
8909
8931
  } catch (a) {
8910
8932
  console.error("[nats] subscribe error", a);
@@ -8928,12 +8950,12 @@ class Kr {
8928
8950
  continue;
8929
8951
  }
8930
8952
  a[0] === "dev" && a.shift();
8931
- const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = Be.decode(o.data);
8953
+ const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], _ = a[a.length - 1], y = Be.decode(o.data);
8932
8954
  try {
8933
8955
  const x = await t(y, {
8934
8956
  subject: d,
8935
8957
  userId: p,
8936
- sessionId: g
8958
+ sessionId: _
8937
8959
  });
8938
8960
  o.reply && o.respond(
8939
8961
  Be.encode({
@@ -8996,20 +9018,20 @@ class ua {
8996
9018
  Et.TRUSTED_CLIENT_TOKEN
8997
9019
  );
8998
9020
  return new Promise((a, d) => {
8999
- const p = `${Et.WSS_URL}?TrustedClientToken=${Et.TRUSTED_CLIENT_TOKEN}&Sec-MS-GEC=${o}&Sec-MS-GEC-Version=1-130.0.2849.68&ConnectionId=${n}`, g = new WebSocket(p);
9000
- g.binaryType = "arraybuffer";
9021
+ const p = `${Et.WSS_URL}?TrustedClientToken=${Et.TRUSTED_CLIENT_TOKEN}&Sec-MS-GEC=${o}&Sec-MS-GEC-Version=1-130.0.2849.68&ConnectionId=${n}`, _ = new WebSocket(p);
9022
+ _.binaryType = "arraybuffer";
9001
9023
  const y = fa(e, t, s);
9002
- g.addEventListener("open", () => {
9024
+ _.addEventListener("open", () => {
9003
9025
  const x = la();
9004
- g.send(x);
9026
+ _.send(x);
9005
9027
  const A = `X-RequestId:${n}\r
9006
9028
  Content-Type:application/ssml+xml\r
9007
9029
  X-Timestamp:${(/* @__PURE__ */ new Date()).toISOString()}Z\r
9008
9030
  Path:ssml\r
9009
9031
  \r
9010
9032
  ` + y;
9011
- g.send(A);
9012
- }), g.addEventListener("message", (x) => {
9033
+ _.send(A);
9034
+ }), _.addEventListener("message", (x) => {
9013
9035
  const A = x.data;
9014
9036
  if (A instanceof ArrayBuffer) {
9015
9037
  const O = new Uint8Array(A), j = new TextEncoder().encode(`Path:audio\r
@@ -9018,10 +9040,10 @@ Path:ssml\r
9018
9040
  const L = O.subarray(B + j.length);
9019
9041
  i.push(L);
9020
9042
  }
9021
- new TextDecoder().decode(O).includes("Path:turn.end") && g.close();
9043
+ new TextDecoder().decode(O).includes("Path:turn.end") && _.close();
9022
9044
  } else
9023
- A.includes("Path:turn.end") && g.close();
9024
- }), g.addEventListener("close", () => {
9045
+ A.includes("Path:turn.end") && _.close();
9046
+ }), _.addEventListener("close", () => {
9025
9047
  if (!i.length) {
9026
9048
  d("No audio data available to save.");
9027
9049
  return;
@@ -9034,7 +9056,7 @@ Path:ssml\r
9034
9056
  for (const j of i)
9035
9057
  A.set(j, O), O += j.length;
9036
9058
  a(A.buffer);
9037
- }), g.addEventListener("error", (x) => {
9059
+ }), _.addEventListener("error", (x) => {
9038
9060
  d(x);
9039
9061
  });
9040
9062
  });
@@ -9125,9 +9147,9 @@ class ba {
9125
9147
  (y, x) => y + x.length,
9126
9148
  0
9127
9149
  ), p = new Uint8Array(d);
9128
- let g = 0;
9150
+ let _ = 0;
9129
9151
  for (const y of a)
9130
- p.set(y, g), g += y.length;
9152
+ p.set(y, _), _ += y.length;
9131
9153
  return p.buffer;
9132
9154
  }
9133
9155
  async getAudio(e, t) {