authhero 0.84.0 → 0.86.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/authhero.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  var am = Object.defineProperty;
2
2
  var cm = (t, e, n) => e in t ? am(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var ne = (t, e, n) => cm(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { z as a, OpenAPIHono as le, createRoute as q } from "@hono/zod-openapi";
4
+ import { z as a, OpenAPIHono as ue, createRoute as q } from "@hono/zod-openapi";
5
5
  const re = (t) => typeof t == "string", kr = () => {
6
6
  let t, e;
7
7
  const n = new Promise((r, i) => {
@@ -361,8 +361,8 @@ class Qi extends Ms {
361
361
  }
362
362
  const h = this.resolve(e, n);
363
363
  let m = h == null ? void 0 : h.res;
364
- const v = (h == null ? void 0 : h.usedKey) || o, f = (h == null ? void 0 : h.exactUsedKey) || o, _ = Object.prototype.toString.apply(m), w = ["[object Number]", "[object Function]", "[object RegExp]"], S = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, N = !this.i18nFormat || this.i18nFormat.handleAsObject, T = !re(m) && typeof m != "boolean" && typeof m != "number";
365
- if (N && m && T && w.indexOf(_) < 0 && !(re(S) && Array.isArray(m))) {
364
+ const v = (h == null ? void 0 : h.usedKey) || o, f = (h == null ? void 0 : h.exactUsedKey) || o, _ = Object.prototype.toString.apply(m), w = ["[object Number]", "[object Function]", "[object RegExp]"], S = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, N = !this.i18nFormat || this.i18nFormat.handleAsObject, B = !re(m) && typeof m != "boolean" && typeof m != "number";
365
+ if (N && m && B && w.indexOf(_) < 0 && !(re(S) && Array.isArray(m))) {
366
366
  if (!n.returnObjects && !this.options.returnObjects) {
367
367
  this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
368
368
  const V = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(v, m, {
@@ -372,54 +372,54 @@ class Qi extends Ms {
372
372
  return i ? (h.res = V, h.usedParams = this.getUsedParamsDetails(n), h) : V;
373
373
  }
374
374
  if (s) {
375
- const V = Array.isArray(m), te = V ? [] : {}, pe = V ? f : v;
376
- for (const ue in m)
377
- if (Object.prototype.hasOwnProperty.call(m, ue)) {
378
- const Me = `${pe}${s}${ue}`;
379
- te[ue] = this.translate(Me, {
375
+ const V = Array.isArray(m), Q = V ? [] : {}, ce = V ? f : v;
376
+ for (const de in m)
377
+ if (Object.prototype.hasOwnProperty.call(m, de)) {
378
+ const Me = `${ce}${s}${de}`;
379
+ Q[de] = this.translate(Me, {
380
380
  ...n,
381
381
  joinArrays: !1,
382
382
  ns: c
383
- }), te[ue] === Me && (te[ue] = m[ue]);
383
+ }), Q[de] === Me && (Q[de] = m[de]);
384
384
  }
385
- m = te;
385
+ m = Q;
386
386
  }
387
387
  } else if (N && re(S) && Array.isArray(m))
388
388
  m = m.join(S), m && (m = this.extendTranslation(m, e, n, r));
389
389
  else {
390
- let V = !1, te = !1;
391
- const pe = n.count !== void 0 && !re(n.count), ue = Qi.hasDefaultValue(n), Me = pe ? this.pluralResolver.getSuffix(u, n.count, n) : "", ze = n.ordinal && pe ? this.pluralResolver.getSuffix(u, n.count, {
390
+ let V = !1, Q = !1;
391
+ const ce = n.count !== void 0 && !re(n.count), de = Qi.hasDefaultValue(n), Me = ce ? this.pluralResolver.getSuffix(u, n.count, n) : "", ze = n.ordinal && ce ? this.pluralResolver.getSuffix(u, n.count, {
392
392
  ordinal: !1
393
- }) : "", Ye = pe && !n.ordinal && n.count === 0, $ = Ye && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${Me}`] || n[`defaultValue${ze}`] || n.defaultValue;
394
- !this.isValidLookup(m) && ue && (V = !0, m = $), this.isValidLookup(m) || (te = !0, m = o);
395
- const E = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && te ? void 0 : m, x = ue && $ !== m && this.options.updateMissing;
396
- if (te || V || x) {
393
+ }) : "", Ye = ce && !n.ordinal && n.count === 0, $ = Ye && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${Me}`] || n[`defaultValue${ze}`] || n.defaultValue;
394
+ !this.isValidLookup(m) && de && (V = !0, m = $), this.isValidLookup(m) || (Q = !0, m = o);
395
+ const E = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && Q ? void 0 : m, x = de && $ !== m && this.options.updateMissing;
396
+ if (Q || V || x) {
397
397
  if (this.logger.log(x ? "updateKey" : "missingKey", u, l, o, x ? $ : m), s) {
398
- const Q = this.resolve(o, {
398
+ const ee = this.resolve(o, {
399
399
  ...n,
400
400
  keySeparator: !1
401
401
  });
402
- Q && Q.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
402
+ ee && ee.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
403
403
  }
404
404
  let k = [];
405
405
  const O = this.languageUtils.getFallbackCodes(this.options.fallbackLng, n.lng || this.language);
406
406
  if (this.options.saveMissingTo === "fallback" && O && O[0])
407
- for (let Q = 0; Q < O.length; Q++)
408
- k.push(O[Q]);
407
+ for (let ee = 0; ee < O.length; ee++)
408
+ k.push(O[ee]);
409
409
  else this.options.saveMissingTo === "all" ? k = this.languageUtils.toResolveHierarchy(n.lng || this.language) : k.push(n.lng || this.language);
410
- const L = (Q, J, se) => {
410
+ const L = (ee, J, se) => {
411
411
  var H;
412
- const de = ue && se !== m ? se : E;
413
- this.options.missingKeyHandler ? this.options.missingKeyHandler(Q, l, J, de, x, n) : (H = this.backendConnector) != null && H.saveMissing && this.backendConnector.saveMissing(Q, l, J, de, x, n), this.emit("missingKey", Q, l, J, m);
412
+ const pe = de && se !== m ? se : E;
413
+ this.options.missingKeyHandler ? this.options.missingKeyHandler(ee, l, J, pe, x, n) : (H = this.backendConnector) != null && H.saveMissing && this.backendConnector.saveMissing(ee, l, J, pe, x, n), this.emit("missingKey", ee, l, J, m);
414
414
  };
415
- this.options.saveMissing && (this.options.saveMissingPlurals && pe ? k.forEach((Q) => {
416
- const J = this.pluralResolver.getSuffixes(Q, n);
415
+ this.options.saveMissing && (this.options.saveMissingPlurals && ce ? k.forEach((ee) => {
416
+ const J = this.pluralResolver.getSuffixes(ee, n);
417
417
  Ye && n[`defaultValue${this.options.pluralSeparator}zero`] && J.indexOf(`${this.options.pluralSeparator}zero`) < 0 && J.push(`${this.options.pluralSeparator}zero`), J.forEach((se) => {
418
- L([Q], o + se, n[`defaultValue${se}`] || $);
418
+ L([ee], o + se, n[`defaultValue${se}`] || $);
419
419
  });
420
420
  }) : L(k, o, $));
421
421
  }
422
- m = this.extendTranslation(m, e, n, h, r), te && m === o && this.options.appendNamespaceToMissingKey && (m = `${l}:${o}`), (te || V) && this.options.parseMissingKeyHandler && (m = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}:${o}` : o, V ? m : void 0));
422
+ m = this.extendTranslation(m, e, n, h, r), Q && m === o && this.options.appendNamespaceToMissingKey && (m = `${l}:${o}`), (Q || V) && this.options.parseMissingKeyHandler && (m = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}:${o}` : o, V ? m : void 0));
423
423
  }
424
424
  return i ? (h.res = m, h.usedParams = this.getUsedParamsDetails(n), h) : m;
425
425
  }
@@ -481,25 +481,25 @@ class Qi extends Ms {
481
481
  const m = n.count !== void 0 && !re(n.count), v = m && !n.ordinal && n.count === 0, f = n.context !== void 0 && (re(n.context) || typeof n.context == "number") && n.context !== "", _ = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng);
482
482
  h.forEach((w) => {
483
483
  var S, N;
484
- this.isValidLookup(r) || (c = w, !xu[`${_[0]}-${w}`] && ((S = this.utils) != null && S.hasLoadedNamespace) && !((N = this.utils) != null && N.hasLoadedNamespace(c)) && (xu[`${_[0]}-${w}`] = !0, this.logger.warn(`key "${i}" for languages "${_.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), _.forEach((T) => {
485
- var pe;
484
+ this.isValidLookup(r) || (c = w, !xu[`${_[0]}-${w}`] && ((S = this.utils) != null && S.hasLoadedNamespace) && !((N = this.utils) != null && N.hasLoadedNamespace(c)) && (xu[`${_[0]}-${w}`] = !0, this.logger.warn(`key "${i}" for languages "${_.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), _.forEach((B) => {
485
+ var ce;
486
486
  if (this.isValidLookup(r)) return;
487
- o = T;
487
+ o = B;
488
488
  const V = [p];
489
- if ((pe = this.i18nFormat) != null && pe.addLookupKeys)
490
- this.i18nFormat.addLookupKeys(V, p, T, w, n);
489
+ if ((ce = this.i18nFormat) != null && ce.addLookupKeys)
490
+ this.i18nFormat.addLookupKeys(V, p, B, w, n);
491
491
  else {
492
- let ue;
493
- m && (ue = this.pluralResolver.getSuffix(T, n.count, n));
492
+ let de;
493
+ m && (de = this.pluralResolver.getSuffix(B, n.count, n));
494
494
  const Me = `${this.options.pluralSeparator}zero`, ze = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
495
- if (m && (V.push(p + ue), n.ordinal && ue.indexOf(ze) === 0 && V.push(p + ue.replace(ze, this.options.pluralSeparator)), v && V.push(p + Me)), f) {
495
+ if (m && (V.push(p + de), n.ordinal && de.indexOf(ze) === 0 && V.push(p + de.replace(ze, this.options.pluralSeparator)), v && V.push(p + Me)), f) {
496
496
  const Ye = `${p}${this.options.contextSeparator}${n.context}`;
497
- V.push(Ye), m && (V.push(Ye + ue), n.ordinal && ue.indexOf(ze) === 0 && V.push(Ye + ue.replace(ze, this.options.pluralSeparator)), v && V.push(Ye + Me));
497
+ V.push(Ye), m && (V.push(Ye + de), n.ordinal && de.indexOf(ze) === 0 && V.push(Ye + de.replace(ze, this.options.pluralSeparator)), v && V.push(Ye + Me));
498
498
  }
499
499
  }
500
- let te;
501
- for (; te = V.pop(); )
502
- this.isValidLookup(r) || (s = te, r = this.getResource(T, w, te, n));
500
+ let Q;
501
+ for (; Q = V.pop(); )
502
+ this.isValidLookup(r) || (s = Q, r = this.getResource(B, w, Q, n));
503
503
  }));
504
504
  });
505
505
  }), {
@@ -2004,7 +2004,7 @@ function o5(t) {
2004
2004
  throw new Error(`Invalid user_id: ${t}`);
2005
2005
  return { connection: e, id: n };
2006
2006
  }
2007
- const Gm = new le().openapi(
2007
+ const Gm = new ue().openapi(
2008
2008
  q({
2009
2009
  tags: ["branding"],
2010
2010
  method: "get",
@@ -2171,12 +2171,12 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2171
2171
  x(E);
2172
2172
  } else
2173
2173
  return new Promise(function(k, O) {
2174
- x(function(L, Q) {
2174
+ x(function(L, ee) {
2175
2175
  if (L) {
2176
2176
  O(L);
2177
2177
  return;
2178
2178
  }
2179
- k(Q);
2179
+ k(ee);
2180
2180
  });
2181
2181
  });
2182
2182
  }, e.hashSync = function($, C) {
@@ -2185,8 +2185,8 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2185
2185
  return Ye($, C);
2186
2186
  }, e.hash = function($, C, E, x) {
2187
2187
  function k(O) {
2188
- typeof $ == "string" && typeof C == "number" ? e.genSalt(C, function(L, Q) {
2189
- Ye($, Q, O, x);
2188
+ typeof $ == "string" && typeof C == "number" ? e.genSalt(C, function(L, ee) {
2189
+ Ye($, ee, O, x);
2190
2190
  }) : typeof $ == "string" && typeof C == "string" ? Ye($, C, O, x) : o(O.bind(this, Error("Illegal arguments: " + typeof $ + ", " + typeof C)));
2191
2191
  }
2192
2192
  if (E) {
@@ -2195,9 +2195,9 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2195
2195
  k(E);
2196
2196
  } else
2197
2197
  return new Promise(function(O, L) {
2198
- k(function(Q, J) {
2199
- if (Q) {
2200
- L(Q);
2198
+ k(function(ee, J) {
2199
+ if (ee) {
2200
+ L(ee);
2201
2201
  return;
2202
2202
  }
2203
2203
  O(J);
@@ -2223,8 +2223,8 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2223
2223
  o(O.bind(this, null, !1));
2224
2224
  return;
2225
2225
  }
2226
- e.hash($, C.substr(0, 29), function(L, Q) {
2227
- L ? O(L) : O(null, s(Q, C));
2226
+ e.hash($, C.substr(0, 29), function(L, ee) {
2227
+ L ? O(L) : O(null, s(ee, C));
2228
2228
  }, x);
2229
2229
  }
2230
2230
  if (E) {
@@ -2233,9 +2233,9 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2233
2233
  k(E);
2234
2234
  } else
2235
2235
  return new Promise(function(O, L) {
2236
- k(function(Q, J) {
2237
- if (Q) {
2238
- L(Q);
2236
+ k(function(ee, J) {
2237
+ if (ee) {
2238
+ L(ee);
2239
2239
  return;
2240
2240
  }
2241
2241
  O(J);
@@ -2409,11 +2409,11 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2409
2409
  return x.join("");
2410
2410
  }
2411
2411
  function m($, C) {
2412
- var E = 0, x = $.length, k = 0, O = [], L, Q, J, se, de, H;
2412
+ var E = 0, x = $.length, k = 0, O = [], L, ee, J, se, pe, H;
2413
2413
  if (C <= 0)
2414
2414
  throw Error("Illegal len: " + C);
2415
- for (; E < x - 1 && k < C && (H = $.charCodeAt(E++), L = H < u.length ? u[H] : -1, H = $.charCodeAt(E++), Q = H < u.length ? u[H] : -1, !(L == -1 || Q == -1 || (de = L << 2 >>> 0, de |= (Q & 48) >> 4, O.push(p(de)), ++k >= C || E >= x) || (H = $.charCodeAt(E++), J = H < u.length ? u[H] : -1, J == -1) || (de = (Q & 15) << 4 >>> 0, de |= (J & 60) >> 2, O.push(p(de)), ++k >= C || E >= x))); )
2416
- H = $.charCodeAt(E++), se = H < u.length ? u[H] : -1, de = (J & 3) << 6 >>> 0, de |= se, O.push(p(de)), ++k;
2415
+ for (; E < x - 1 && k < C && (H = $.charCodeAt(E++), L = H < u.length ? u[H] : -1, H = $.charCodeAt(E++), ee = H < u.length ? u[H] : -1, !(L == -1 || ee == -1 || (pe = L << 2 >>> 0, pe |= (ee & 48) >> 4, O.push(p(pe)), ++k >= C || E >= x) || (H = $.charCodeAt(E++), J = H < u.length ? u[H] : -1, J == -1) || (pe = (ee & 15) << 4 >>> 0, pe |= (J & 60) >> 2, O.push(p(pe)), ++k >= C || E >= x))); )
2416
+ H = $.charCodeAt(E++), se = H < u.length ? u[H] : -1, pe = (J & 3) << 6 >>> 0, pe |= se, O.push(p(pe)), ++k;
2417
2417
  var Ne = [];
2418
2418
  for (E = 0; E < k; E++)
2419
2419
  Ne.push(O[E].charCodeAt(0));
@@ -2428,7 +2428,7 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2428
2428
  }); x !== null || (x = C()) !== null; )
2429
2429
  x < 128 ? E(x & 127) : x < 2048 ? (E(x >> 6 & 31 | 192), E(x & 63 | 128)) : x < 65536 ? (E(x >> 12 & 15 | 224), E(x >> 6 & 63 | 128), E(x & 63 | 128)) : (E(x >> 18 & 7 | 240), E(x >> 12 & 63 | 128), E(x >> 6 & 63 | 128), E(x & 63 | 128)), x = null;
2430
2430
  }, $.decodeUTF8 = function(C, E) {
2431
- for (var x, k, O, L, Q = function(J) {
2431
+ for (var x, k, O, L, ee = function(J) {
2432
2432
  J = J.slice(0, J.indexOf(null));
2433
2433
  var se = Error(J.toString());
2434
2434
  throw se.name = "TruncatedError", se.bytes = J, se;
@@ -2436,11 +2436,11 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2436
2436
  if (!(x & 128))
2437
2437
  E(x);
2438
2438
  else if ((x & 224) === 192)
2439
- (k = C()) === null && Q([x, k]), E((x & 31) << 6 | k & 63);
2439
+ (k = C()) === null && ee([x, k]), E((x & 31) << 6 | k & 63);
2440
2440
  else if ((x & 240) === 224)
2441
- ((k = C()) === null || (O = C()) === null) && Q([x, k, O]), E((x & 15) << 12 | (k & 63) << 6 | O & 63);
2441
+ ((k = C()) === null || (O = C()) === null) && ee([x, k, O]), E((x & 15) << 12 | (k & 63) << 6 | O & 63);
2442
2442
  else if ((x & 248) === 240)
2443
- ((k = C()) === null || (O = C()) === null || (L = C()) === null) && Q([x, k, O, L]), E((x & 7) << 18 | (k & 63) << 12 | (O & 63) << 6 | L & 63);
2443
+ ((k = C()) === null || (O = C()) === null || (L = C()) === null) && ee([x, k, O, L]), E((x & 7) << 18 | (k & 63) << 12 | (O & 63) << 6 | L & 63);
2444
2444
  else throw RangeError("Illegal starting byte: " + x);
2445
2445
  }, $.UTF16toUTF8 = function(C, E) {
2446
2446
  for (var x, k = null; (x = k !== null ? k : C()) !== null; ) {
@@ -2500,7 +2500,7 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2500
2500
  3041331479,
2501
2501
  2450970073,
2502
2502
  2306472731
2503
- ], T = [
2503
+ ], B = [
2504
2504
  3509652390,
2505
2505
  2564797868,
2506
2506
  805139163,
@@ -3533,59 +3533,59 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
3533
3533
  1668446532,
3534
3534
  1869963892
3535
3535
  ];
3536
- function te($, C, E, x) {
3536
+ function Q($, C, E, x) {
3537
3537
  var k, O = $[C], L = $[C + 1];
3538
3538
  return O ^= E[0], k = x[O >>> 24], k += x[256 | O >> 16 & 255], k ^= x[512 | O >> 8 & 255], k += x[768 | O & 255], L ^= k ^ E[1], k = x[L >>> 24], k += x[256 | L >> 16 & 255], k ^= x[512 | L >> 8 & 255], k += x[768 | L & 255], O ^= k ^ E[2], k = x[O >>> 24], k += x[256 | O >> 16 & 255], k ^= x[512 | O >> 8 & 255], k += x[768 | O & 255], L ^= k ^ E[3], k = x[L >>> 24], k += x[256 | L >> 16 & 255], k ^= x[512 | L >> 8 & 255], k += x[768 | L & 255], O ^= k ^ E[4], k = x[O >>> 24], k += x[256 | O >> 16 & 255], k ^= x[512 | O >> 8 & 255], k += x[768 | O & 255], L ^= k ^ E[5], k = x[L >>> 24], k += x[256 | L >> 16 & 255], k ^= x[512 | L >> 8 & 255], k += x[768 | L & 255], O ^= k ^ E[6], k = x[O >>> 24], k += x[256 | O >> 16 & 255], k ^= x[512 | O >> 8 & 255], k += x[768 | O & 255], L ^= k ^ E[7], k = x[L >>> 24], k += x[256 | L >> 16 & 255], k ^= x[512 | L >> 8 & 255], k += x[768 | L & 255], O ^= k ^ E[8], k = x[O >>> 24], k += x[256 | O >> 16 & 255], k ^= x[512 | O >> 8 & 255], k += x[768 | O & 255], L ^= k ^ E[9], k = x[L >>> 24], k += x[256 | L >> 16 & 255], k ^= x[512 | L >> 8 & 255], k += x[768 | L & 255], O ^= k ^ E[10], k = x[O >>> 24], k += x[256 | O >> 16 & 255], k ^= x[512 | O >> 8 & 255], k += x[768 | O & 255], L ^= k ^ E[11], k = x[L >>> 24], k += x[256 | L >> 16 & 255], k ^= x[512 | L >> 8 & 255], k += x[768 | L & 255], O ^= k ^ E[12], k = x[O >>> 24], k += x[256 | O >> 16 & 255], k ^= x[512 | O >> 8 & 255], k += x[768 | O & 255], L ^= k ^ E[13], k = x[L >>> 24], k += x[256 | L >> 16 & 255], k ^= x[512 | L >> 8 & 255], k += x[768 | L & 255], O ^= k ^ E[14], k = x[O >>> 24], k += x[256 | O >> 16 & 255], k ^= x[512 | O >> 8 & 255], k += x[768 | O & 255], L ^= k ^ E[15], k = x[L >>> 24], k += x[256 | L >> 16 & 255], k ^= x[512 | L >> 8 & 255], k += x[768 | L & 255], O ^= k ^ E[16], $[C] = L ^ E[w + 1], $[C + 1] = O, $;
3539
3539
  }
3540
- function pe($, C) {
3540
+ function ce($, C) {
3541
3541
  for (var E = 0, x = 0; E < 4; ++E)
3542
3542
  x = x << 8 | $[C] & 255, C = (C + 1) % $.length;
3543
3543
  return { key: x, offp: C };
3544
3544
  }
3545
- function ue($, C, E) {
3546
- for (var x = 0, k = [0, 0], O = C.length, L = E.length, Q, J = 0; J < O; J++)
3547
- Q = pe($, x), x = Q.offp, C[J] = C[J] ^ Q.key;
3545
+ function de($, C, E) {
3546
+ for (var x = 0, k = [0, 0], O = C.length, L = E.length, ee, J = 0; J < O; J++)
3547
+ ee = ce($, x), x = ee.offp, C[J] = C[J] ^ ee.key;
3548
3548
  for (J = 0; J < O; J += 2)
3549
- k = te(k, 0, C, E), C[J] = k[0], C[J + 1] = k[1];
3549
+ k = Q(k, 0, C, E), C[J] = k[0], C[J + 1] = k[1];
3550
3550
  for (J = 0; J < L; J += 2)
3551
- k = te(k, 0, C, E), E[J] = k[0], E[J + 1] = k[1];
3551
+ k = Q(k, 0, C, E), E[J] = k[0], E[J + 1] = k[1];
3552
3552
  }
3553
3553
  function Me($, C, E, x) {
3554
- for (var k = 0, O = [0, 0], L = E.length, Q = x.length, J, se = 0; se < L; se++)
3555
- J = pe(C, k), k = J.offp, E[se] = E[se] ^ J.key;
3554
+ for (var k = 0, O = [0, 0], L = E.length, ee = x.length, J, se = 0; se < L; se++)
3555
+ J = ce(C, k), k = J.offp, E[se] = E[se] ^ J.key;
3556
3556
  for (k = 0, se = 0; se < L; se += 2)
3557
- J = pe($, k), k = J.offp, O[0] ^= J.key, J = pe($, k), k = J.offp, O[1] ^= J.key, O = te(O, 0, E, x), E[se] = O[0], E[se + 1] = O[1];
3558
- for (se = 0; se < Q; se += 2)
3559
- J = pe($, k), k = J.offp, O[0] ^= J.key, J = pe($, k), k = J.offp, O[1] ^= J.key, O = te(O, 0, E, x), x[se] = O[0], x[se + 1] = O[1];
3557
+ J = ce($, k), k = J.offp, O[0] ^= J.key, J = ce($, k), k = J.offp, O[1] ^= J.key, O = Q(O, 0, E, x), E[se] = O[0], E[se + 1] = O[1];
3558
+ for (se = 0; se < ee; se += 2)
3559
+ J = ce($, k), k = J.offp, O[0] ^= J.key, J = ce($, k), k = J.offp, O[1] ^= J.key, O = Q(O, 0, E, x), x[se] = O[0], x[se + 1] = O[1];
3560
3560
  }
3561
3561
  function ze($, C, E, x, k) {
3562
- var O = V.slice(), L = O.length, Q;
3562
+ var O = V.slice(), L = O.length, ee;
3563
3563
  if (E < 4 || E > 31)
3564
- if (Q = Error("Illegal number of rounds (4-31): " + E), x) {
3565
- o(x.bind(this, Q));
3564
+ if (ee = Error("Illegal number of rounds (4-31): " + E), x) {
3565
+ o(x.bind(this, ee));
3566
3566
  return;
3567
3567
  } else
3568
- throw Q;
3568
+ throw ee;
3569
3569
  if (C.length !== f)
3570
- if (Q = Error("Illegal salt length: " + C.length + " != " + f), x) {
3571
- o(x.bind(this, Q));
3570
+ if (ee = Error("Illegal salt length: " + C.length + " != " + f), x) {
3571
+ o(x.bind(this, ee));
3572
3572
  return;
3573
3573
  } else
3574
- throw Q;
3574
+ throw ee;
3575
3575
  E = 1 << E >>> 0;
3576
- var J, se, de = 0, H;
3577
- Int32Array ? (J = new Int32Array(N), se = new Int32Array(T)) : (J = N.slice(), se = T.slice()), Me(C, $, J, se);
3576
+ var J, se, pe = 0, H;
3577
+ Int32Array ? (J = new Int32Array(N), se = new Int32Array(B)) : (J = N.slice(), se = B.slice()), Me(C, $, J, se);
3578
3578
  function Ne() {
3579
- if (k && k(de / E), de < E)
3580
- for (var me = Date.now(); de < E && (de = de + 1, ue($, J, se), ue(C, J, se), !(Date.now() - me > S)); )
3579
+ if (k && k(pe / E), pe < E)
3580
+ for (var me = Date.now(); pe < E && (pe = pe + 1, de($, J, se), de(C, J, se), !(Date.now() - me > S)); )
3581
3581
  ;
3582
3582
  else {
3583
- for (de = 0; de < 64; de++)
3583
+ for (pe = 0; pe < 64; pe++)
3584
3584
  for (H = 0; H < L >> 1; H++)
3585
- te(O, H << 1, J, se);
3585
+ Q(O, H << 1, J, se);
3586
3586
  var Ae = [];
3587
- for (de = 0; de < L; de++)
3588
- Ae.push((O[de] >> 24 & 255) >>> 0), Ae.push((O[de] >> 16 & 255) >>> 0), Ae.push((O[de] >> 8 & 255) >>> 0), Ae.push((O[de] & 255) >>> 0);
3587
+ for (pe = 0; pe < L; pe++)
3588
+ Ae.push((O[pe] >> 24 & 255) >>> 0), Ae.push((O[pe] >> 16 & 255) >>> 0), Ae.push((O[pe] >> 8 & 255) >>> 0), Ae.push((O[pe] & 255) >>> 0);
3589
3589
  if (x) {
3590
3590
  x(null, Ae);
3591
3591
  return;
@@ -3633,9 +3633,9 @@ const Ym = {}, Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
3633
3633
  return;
3634
3634
  } else
3635
3635
  throw k;
3636
- var Q = parseInt(C.substring(L, L + 1), 10) * 10, J = parseInt(C.substring(L + 1, L + 2), 10), se = Q + J, de = C.substring(L + 3, L + 25);
3636
+ var ee = parseInt(C.substring(L, L + 1), 10) * 10, J = parseInt(C.substring(L + 1, L + 2), 10), se = ee + J, pe = C.substring(L + 3, L + 25);
3637
3637
  $ += O >= "a" ? "\0" : "";
3638
- var H = c($), Ne = m(de, f);
3638
+ var H = c($), Ne = m(pe, f);
3639
3639
  function an(me) {
3640
3640
  var Ae = [];
3641
3641
  return Ae.push("$2"), O >= "a" && Ae.push(O), Ae.push("$"), se < 10 && Ae.push("0"), Ae.push(se.toString()), Ae.push("$"), Ae.push(h(Ne, Ne.length)), Ae.push(h(me, V.length * 4 - 1)), Ae.join("");
@@ -6009,7 +6009,7 @@ const zu = jn.extend({
6009
6009
  users: a.array(Ot)
6010
6010
  }), ty = jn.extend({
6011
6011
  sessions: a.array(Xc)
6012
- }), ny = new le().openapi(
6012
+ }), ny = new ue().openapi(
6013
6013
  q({
6014
6014
  tags: ["users"],
6015
6015
  method: "get",
@@ -6265,44 +6265,48 @@ const zu = jn.extend({
6265
6265
  }
6266
6266
  }),
6267
6267
  async (t) => {
6268
- var u;
6269
- const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), { user_id: r } = t.req.valid("param"), { verify_email: i, password: s, ...o } = n, c = await t.env.data.users.get(e, r);
6270
- if (!c)
6268
+ var p;
6269
+ const { data: e } = t.env, { "tenant-id": n } = t.req.valid("header"), r = t.req.valid("json"), { user_id: i } = t.req.valid("param"), { verify_email: s, password: o, ...c } = r, l = await e.users.get(n, i);
6270
+ if (!l)
6271
6271
  throw new j(404);
6272
- if (o.email && o.email !== c.email) {
6273
- const p = await kf(
6272
+ if (c.email && c.email !== l.email) {
6273
+ const h = await kf(
6274
6274
  t.env.data.users,
6275
- e,
6276
- o.email
6275
+ n,
6276
+ c.email
6277
6277
  );
6278
- if (p.length && p.some((h) => h.user_id !== r))
6278
+ if (h.length && h.some((m) => m.user_id !== i))
6279
6279
  throw new j(409, {
6280
6280
  message: "Another user with the same email address already exists."
6281
6281
  });
6282
6282
  }
6283
- if (c.linked_to)
6283
+ if (l.linked_to)
6284
6284
  throw new j(404, {
6285
6285
  // not the auth0 error message but I'd rather deviate here
6286
6286
  message: "User is linked to another user"
6287
6287
  });
6288
- if (await t.env.data.users.update(e, r, o), s) {
6289
- const p = (u = c.identities) == null ? void 0 : u.find(
6290
- (h) => h.connection === "Username-Password-Authentication"
6288
+ if (await t.env.data.users.update(n, i, c), o) {
6289
+ const h = (p = l.identities) == null ? void 0 : p.find(
6290
+ (f) => f.connection === "Username-Password-Authentication"
6291
6291
  );
6292
- if (!p)
6292
+ if (!h)
6293
6293
  throw new j(400, {
6294
6294
  message: "User does not have a password identity"
6295
6295
  });
6296
- await t.env.data.passwords.update(e, {
6297
- user_id: `${p.provider}|${p.user_id}`,
6298
- password: si.hashSync(s, 10),
6296
+ const m = {
6297
+ user_id: h.user_id,
6298
+ password: await si.hash(o, 10),
6299
6299
  algorithm: "bcrypt"
6300
- });
6300
+ };
6301
+ await e.passwords.get(
6302
+ n,
6303
+ h.user_id
6304
+ ) ? await e.passwords.update(n, m) : await e.passwords.create(n, m);
6301
6305
  }
6302
- const l = await t.env.data.users.get(e, r);
6303
- if (!l)
6306
+ const u = await t.env.data.users.get(n, i);
6307
+ if (!u)
6304
6308
  throw new j(500);
6305
- return t.json(l);
6309
+ return t.json(u);
6306
6310
  }
6307
6311
  ).openapi(
6308
6312
  q({
@@ -6523,8 +6527,8 @@ var Du;
6523
6527
  return A[I];
6524
6528
  }
6525
6529
  }, h = Object.getPrototypeOf(Function), m = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : nm(), v = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : rm(), f = typeof WeakMap == "function" ? WeakMap : im(), _ = i ? Symbol.for("@reflect-metadata:registry") : void 0, w = Qg(), S = em(w);
6526
- function N(A, I, B, M) {
6527
- if (H(B)) {
6530
+ function N(A, I, T, M) {
6531
+ if (H(T)) {
6528
6532
  if (!uu(A))
6529
6533
  throw new TypeError();
6530
6534
  if (!du(I))
@@ -6537,49 +6541,49 @@ var Du;
6537
6541
  throw new TypeError();
6538
6542
  if (!me(M) && !H(M) && !Ne(M))
6539
6543
  throw new TypeError();
6540
- return Ne(M) && (M = void 0), B = wt(B), E(A, I, B, M);
6544
+ return Ne(M) && (M = void 0), T = wt(T), E(A, I, T, M);
6541
6545
  }
6542
6546
  }
6543
6547
  e("decorate", N);
6544
- function T(A, I) {
6545
- function B(M, ee) {
6548
+ function B(A, I) {
6549
+ function T(M, te) {
6546
6550
  if (!me(M))
6547
6551
  throw new TypeError();
6548
- if (!H(ee) && !Yg(ee))
6552
+ if (!H(te) && !Yg(te))
6549
6553
  throw new TypeError();
6550
- Q(A, I, M, ee);
6554
+ ee(A, I, M, te);
6551
6555
  }
6552
- return B;
6556
+ return T;
6553
6557
  }
6554
- e("metadata", T);
6555
- function V(A, I, B, M) {
6556
- if (!me(B))
6558
+ e("metadata", B);
6559
+ function V(A, I, T, M) {
6560
+ if (!me(T))
6557
6561
  throw new TypeError();
6558
- return H(M) || (M = wt(M)), Q(A, I, B, M);
6562
+ return H(M) || (M = wt(M)), ee(A, I, T, M);
6559
6563
  }
6560
6564
  e("defineMetadata", V);
6561
- function te(A, I, B) {
6565
+ function Q(A, I, T) {
6562
6566
  if (!me(I))
6563
6567
  throw new TypeError();
6564
- return H(B) || (B = wt(B)), x(A, I, B);
6568
+ return H(T) || (T = wt(T)), x(A, I, T);
6565
6569
  }
6566
- e("hasMetadata", te);
6567
- function pe(A, I, B) {
6570
+ e("hasMetadata", Q);
6571
+ function ce(A, I, T) {
6568
6572
  if (!me(I))
6569
6573
  throw new TypeError();
6570
- return H(B) || (B = wt(B)), k(A, I, B);
6574
+ return H(T) || (T = wt(T)), k(A, I, T);
6571
6575
  }
6572
- e("hasOwnMetadata", pe);
6573
- function ue(A, I, B) {
6576
+ e("hasOwnMetadata", ce);
6577
+ function de(A, I, T) {
6574
6578
  if (!me(I))
6575
6579
  throw new TypeError();
6576
- return H(B) || (B = wt(B)), O(A, I, B);
6580
+ return H(T) || (T = wt(T)), O(A, I, T);
6577
6581
  }
6578
- e("getMetadata", ue);
6579
- function Me(A, I, B) {
6582
+ e("getMetadata", de);
6583
+ function Me(A, I, T) {
6580
6584
  if (!me(I))
6581
6585
  throw new TypeError();
6582
- return H(B) || (B = wt(B)), L(A, I, B);
6586
+ return H(T) || (T = wt(T)), L(A, I, T);
6583
6587
  }
6584
6588
  e("getOwnMetadata", Me);
6585
6589
  function ze(A, I) {
@@ -6594,35 +6598,35 @@ var Du;
6594
6598
  return H(I) || (I = wt(I)), se(A, I);
6595
6599
  }
6596
6600
  e("getOwnMetadataKeys", Ye);
6597
- function $(A, I, B) {
6601
+ function $(A, I, T) {
6598
6602
  if (!me(I))
6599
6603
  throw new TypeError();
6600
- if (H(B) || (B = wt(B)), !me(I))
6604
+ if (H(T) || (T = wt(T)), !me(I))
6601
6605
  throw new TypeError();
6602
- H(B) || (B = wt(B));
6606
+ H(T) || (T = wt(T));
6603
6607
  var M = br(
6604
6608
  I,
6605
- B,
6609
+ T,
6606
6610
  /*Create*/
6607
6611
  !1
6608
6612
  );
6609
- return H(M) ? !1 : M.OrdinaryDeleteMetadata(A, I, B);
6613
+ return H(M) ? !1 : M.OrdinaryDeleteMetadata(A, I, T);
6610
6614
  }
6611
6615
  e("deleteMetadata", $);
6612
6616
  function C(A, I) {
6613
- for (var B = A.length - 1; B >= 0; --B) {
6614
- var M = A[B], ee = M(I);
6615
- if (!H(ee) && !Ne(ee)) {
6616
- if (!du(ee))
6617
+ for (var T = A.length - 1; T >= 0; --T) {
6618
+ var M = A[T], te = M(I);
6619
+ if (!H(te) && !Ne(te)) {
6620
+ if (!du(te))
6617
6621
  throw new TypeError();
6618
- I = ee;
6622
+ I = te;
6619
6623
  }
6620
6624
  }
6621
6625
  return I;
6622
6626
  }
6623
- function E(A, I, B, M) {
6624
- for (var ee = A.length - 1; ee >= 0; --ee) {
6625
- var je = A[ee], Ie = je(I, B, M);
6627
+ function E(A, I, T, M) {
6628
+ for (var te = A.length - 1; te >= 0; --te) {
6629
+ var je = A[te], Ie = je(I, T, M);
6626
6630
  if (!H(Ie) && !Ne(Ie)) {
6627
6631
  if (!me(Ie))
6628
6632
  throw new TypeError();
@@ -6631,78 +6635,78 @@ var Du;
6631
6635
  }
6632
6636
  return M;
6633
6637
  }
6634
- function x(A, I, B) {
6635
- var M = k(A, I, B);
6638
+ function x(A, I, T) {
6639
+ var M = k(A, I, T);
6636
6640
  if (M)
6637
6641
  return !0;
6638
- var ee = Fo(I);
6639
- return Ne(ee) ? !1 : x(A, ee, B);
6642
+ var te = Fo(I);
6643
+ return Ne(te) ? !1 : x(A, te, T);
6640
6644
  }
6641
- function k(A, I, B) {
6645
+ function k(A, I, T) {
6642
6646
  var M = br(
6643
6647
  I,
6644
- B,
6648
+ T,
6645
6649
  /*Create*/
6646
6650
  !1
6647
6651
  );
6648
- return H(M) ? !1 : lu(M.OrdinaryHasOwnMetadata(A, I, B));
6652
+ return H(M) ? !1 : lu(M.OrdinaryHasOwnMetadata(A, I, T));
6649
6653
  }
6650
- function O(A, I, B) {
6651
- var M = k(A, I, B);
6654
+ function O(A, I, T) {
6655
+ var M = k(A, I, T);
6652
6656
  if (M)
6653
- return L(A, I, B);
6654
- var ee = Fo(I);
6655
- if (!Ne(ee))
6656
- return O(A, ee, B);
6657
+ return L(A, I, T);
6658
+ var te = Fo(I);
6659
+ if (!Ne(te))
6660
+ return O(A, te, T);
6657
6661
  }
6658
- function L(A, I, B) {
6662
+ function L(A, I, T) {
6659
6663
  var M = br(
6660
6664
  I,
6661
- B,
6665
+ T,
6662
6666
  /*Create*/
6663
6667
  !1
6664
6668
  );
6665
6669
  if (!H(M))
6666
- return M.OrdinaryGetOwnMetadata(A, I, B);
6670
+ return M.OrdinaryGetOwnMetadata(A, I, T);
6667
6671
  }
6668
- function Q(A, I, B, M) {
6669
- var ee = br(
6670
- B,
6672
+ function ee(A, I, T, M) {
6673
+ var te = br(
6674
+ T,
6671
6675
  M,
6672
6676
  /*Create*/
6673
6677
  !0
6674
6678
  );
6675
- ee.OrdinaryDefineOwnMetadata(A, I, B, M);
6679
+ te.OrdinaryDefineOwnMetadata(A, I, T, M);
6676
6680
  }
6677
6681
  function J(A, I) {
6678
- var B = se(A, I), M = Fo(A);
6682
+ var T = se(A, I), M = Fo(A);
6679
6683
  if (M === null)
6680
- return B;
6681
- var ee = J(M, I);
6682
- if (ee.length <= 0)
6683
- return B;
6684
- if (B.length <= 0)
6685
- return ee;
6686
- for (var je = new v(), Ie = [], oe = 0, F = B; oe < F.length; oe++) {
6684
+ return T;
6685
+ var te = J(M, I);
6686
+ if (te.length <= 0)
6687
+ return T;
6688
+ if (T.length <= 0)
6689
+ return te;
6690
+ for (var je = new v(), Ie = [], oe = 0, F = T; oe < F.length; oe++) {
6687
6691
  var G = F[oe], Y = je.has(G);
6688
6692
  Y || (je.add(G), Ie.push(G));
6689
6693
  }
6690
- for (var X = 0, ae = ee; X < ae.length; X++) {
6694
+ for (var X = 0, ae = te; X < ae.length; X++) {
6691
6695
  var G = ae[X], Y = je.has(G);
6692
6696
  Y || (je.add(G), Ie.push(G));
6693
6697
  }
6694
6698
  return Ie;
6695
6699
  }
6696
6700
  function se(A, I) {
6697
- var B = br(
6701
+ var T = br(
6698
6702
  A,
6699
6703
  I,
6700
6704
  /*create*/
6701
6705
  !1
6702
6706
  );
6703
- return B ? B.OrdinaryOwnMetadataKeys(A, I) : [];
6707
+ return T ? T.OrdinaryOwnMetadataKeys(A, I) : [];
6704
6708
  }
6705
- function de(A) {
6709
+ function pe(A) {
6706
6710
  if (A === null)
6707
6711
  return 1;
6708
6712
  switch (typeof A) {
@@ -6735,7 +6739,7 @@ var Du;
6735
6739
  return typeof A == "object" ? A !== null : typeof A == "function";
6736
6740
  }
6737
6741
  function Ae(A, I) {
6738
- switch (de(A)) {
6742
+ switch (pe(A)) {
6739
6743
  case 0:
6740
6744
  return A;
6741
6745
  case 1:
@@ -6749,27 +6753,27 @@ var Du;
6749
6753
  case 5:
6750
6754
  return A;
6751
6755
  }
6752
- var B = "string", M = pu(A, s);
6756
+ var T = "string", M = pu(A, s);
6753
6757
  if (M !== void 0) {
6754
- var ee = M.call(A, B);
6755
- if (me(ee))
6758
+ var te = M.call(A, T);
6759
+ if (me(te))
6756
6760
  throw new TypeError();
6757
- return ee;
6761
+ return te;
6758
6762
  }
6759
6763
  return Jg(A);
6760
6764
  }
6761
6765
  function Jg(A, I) {
6762
- var B, M;
6766
+ var T, M;
6763
6767
  {
6764
- var ee = A.toString;
6765
- if (Ni(ee)) {
6766
- var M = ee.call(A);
6768
+ var te = A.toString;
6769
+ if (Ni(te)) {
6770
+ var M = te.call(A);
6767
6771
  if (!me(M))
6768
6772
  return M;
6769
6773
  }
6770
- var B = A.valueOf;
6771
- if (Ni(B)) {
6772
- var M = B.call(A);
6774
+ var T = A.valueOf;
6775
+ if (Ni(T)) {
6776
+ var M = T.call(A);
6773
6777
  if (!me(M))
6774
6778
  return M;
6775
6779
  }
@@ -6796,7 +6800,7 @@ var Du;
6796
6800
  return typeof A == "function";
6797
6801
  }
6798
6802
  function Yg(A) {
6799
- switch (de(A)) {
6803
+ switch (pe(A)) {
6800
6804
  case 3:
6801
6805
  return !0;
6802
6806
  case 4:
@@ -6809,21 +6813,21 @@ var Du;
6809
6813
  return A === I || A !== A && I !== I;
6810
6814
  }
6811
6815
  function pu(A, I) {
6812
- var B = A[I];
6813
- if (B != null) {
6814
- if (!Ni(B))
6816
+ var T = A[I];
6817
+ if (T != null) {
6818
+ if (!Ni(T))
6815
6819
  throw new TypeError();
6816
- return B;
6820
+ return T;
6817
6821
  }
6818
6822
  }
6819
6823
  function fu(A) {
6820
6824
  var I = pu(A, o);
6821
6825
  if (!Ni(I))
6822
6826
  throw new TypeError();
6823
- var B = I.call(A);
6824
- if (!me(B))
6827
+ var T = I.call(A);
6828
+ if (!me(T))
6825
6829
  throw new TypeError();
6826
- return B;
6830
+ return T;
6827
6831
  }
6828
6832
  function hu(A) {
6829
6833
  return A.value;
@@ -6840,16 +6844,16 @@ var Du;
6840
6844
  var I = Object.getPrototypeOf(A);
6841
6845
  if (typeof A != "function" || A === h || I !== h)
6842
6846
  return I;
6843
- var B = A.prototype, M = B && Object.getPrototypeOf(B);
6847
+ var T = A.prototype, M = T && Object.getPrototypeOf(T);
6844
6848
  if (M == null || M === Object.prototype)
6845
6849
  return I;
6846
- var ee = M.constructor;
6847
- return typeof ee != "function" || ee === A ? I : ee;
6850
+ var te = M.constructor;
6851
+ return typeof te != "function" || te === A ? I : te;
6848
6852
  }
6849
6853
  function Xg() {
6850
6854
  var A;
6851
6855
  !H(_) && typeof n.Reflect < "u" && !(_ in n.Reflect) && typeof n.Reflect.defineMetadata == "function" && (A = tm(n.Reflect));
6852
- var I, B, M, ee = new f(), je = {
6856
+ var I, T, M, te = new f(), je = {
6853
6857
  registerProvider: Ie,
6854
6858
  getProvider: F,
6855
6859
  setProvider: Y
@@ -6866,10 +6870,10 @@ var Du;
6866
6870
  break;
6867
6871
  case I === X:
6868
6872
  break;
6869
- case H(B):
6870
- B = X;
6873
+ case H(T):
6874
+ T = X;
6871
6875
  break;
6872
- case B === X:
6876
+ case T === X:
6873
6877
  break;
6874
6878
  default:
6875
6879
  M === void 0 && (M = new v()), M.add(X);
@@ -6880,8 +6884,8 @@ var Du;
6880
6884
  if (!H(I)) {
6881
6885
  if (I.isProviderFor(X, ae))
6882
6886
  return I;
6883
- if (!H(B)) {
6884
- if (B.isProviderFor(X, ae))
6887
+ if (!H(T)) {
6888
+ if (T.isProviderFor(X, ae))
6885
6889
  return I;
6886
6890
  if (!H(M))
6887
6891
  for (var ye = fu(M); ; ) {
@@ -6898,13 +6902,13 @@ var Du;
6898
6902
  return A;
6899
6903
  }
6900
6904
  function F(X, ae) {
6901
- var ye = ee.get(X), ke;
6902
- return H(ye) || (ke = ye.get(ae)), H(ke) && (ke = oe(X, ae), H(ke) || (H(ye) && (ye = new m(), ee.set(X, ye)), ye.set(ae, ke))), ke;
6905
+ var ye = te.get(X), ke;
6906
+ return H(ye) || (ke = ye.get(ae)), H(ke) && (ke = oe(X, ae), H(ke) || (H(ye) && (ye = new m(), te.set(X, ye)), ye.set(ae, ke))), ke;
6903
6907
  }
6904
6908
  function G(X) {
6905
6909
  if (H(X))
6906
6910
  throw new TypeError();
6907
- return I === X || B === X || !H(M) && M.has(X);
6911
+ return I === X || T === X || !H(M) && M.has(X);
6908
6912
  }
6909
6913
  function Y(X, ae, ye) {
6910
6914
  if (!G(ye))
@@ -6913,8 +6917,8 @@ var Du;
6913
6917
  if (ke !== ye) {
6914
6918
  if (!H(ke))
6915
6919
  return !1;
6916
- var ut = ee.get(X);
6917
- H(ut) && (ut = new m(), ee.set(X, ut)), ut.set(ae, ye);
6920
+ var ut = te.get(X);
6921
+ H(ut) && (ut = new m(), te.set(X, ut)), ut.set(ae, ye);
6918
6922
  }
6919
6923
  return !0;
6920
6924
  }
@@ -6929,18 +6933,18 @@ var Du;
6929
6933
  }), A;
6930
6934
  }
6931
6935
  function em(A) {
6932
- var I = new f(), B = {
6936
+ var I = new f(), T = {
6933
6937
  isProviderFor: function(G, Y) {
6934
6938
  var X = I.get(G);
6935
6939
  return H(X) ? !1 : X.has(Y);
6936
6940
  },
6937
6941
  OrdinaryDefineOwnMetadata: Ie,
6938
- OrdinaryHasOwnMetadata: ee,
6942
+ OrdinaryHasOwnMetadata: te,
6939
6943
  OrdinaryGetOwnMetadata: je,
6940
6944
  OrdinaryOwnMetadataKeys: oe,
6941
6945
  OrdinaryDeleteMetadata: F
6942
6946
  };
6943
- return w.registerProvider(B), B;
6947
+ return w.registerProvider(T), T;
6944
6948
  function M(G, Y, X) {
6945
6949
  var ae = I.get(G), ye = !1;
6946
6950
  if (H(ae)) {
@@ -6952,12 +6956,12 @@ var Du;
6952
6956
  if (H(ke)) {
6953
6957
  if (!X)
6954
6958
  return;
6955
- if (ke = new m(), ae.set(Y, ke), !A.setProvider(G, Y, B))
6959
+ if (ke = new m(), ae.set(Y, ke), !A.setProvider(G, Y, T))
6956
6960
  throw ae.delete(Y), ye && I.delete(G), new Error("Wrong provider for target.");
6957
6961
  }
6958
6962
  return ke;
6959
6963
  }
6960
- function ee(G, Y, X) {
6964
+ function te(G, Y, X) {
6961
6965
  var ae = M(
6962
6966
  Y,
6963
6967
  X,
@@ -7028,31 +7032,31 @@ var Du;
7028
7032
  }
7029
7033
  }
7030
7034
  function tm(A) {
7031
- var I = A.defineMetadata, B = A.hasOwnMetadata, M = A.getOwnMetadata, ee = A.getOwnMetadataKeys, je = A.deleteMetadata, Ie = new f(), oe = {
7035
+ var I = A.defineMetadata, T = A.hasOwnMetadata, M = A.getOwnMetadata, te = A.getOwnMetadataKeys, je = A.deleteMetadata, Ie = new f(), oe = {
7032
7036
  isProviderFor: function(F, G) {
7033
7037
  var Y = Ie.get(F);
7034
- return !H(Y) && Y.has(G) ? !0 : ee(F, G).length ? (H(Y) && (Y = new v(), Ie.set(F, Y)), Y.add(G), !0) : !1;
7038
+ return !H(Y) && Y.has(G) ? !0 : te(F, G).length ? (H(Y) && (Y = new v(), Ie.set(F, Y)), Y.add(G), !0) : !1;
7035
7039
  },
7036
7040
  OrdinaryDefineOwnMetadata: I,
7037
- OrdinaryHasOwnMetadata: B,
7041
+ OrdinaryHasOwnMetadata: T,
7038
7042
  OrdinaryGetOwnMetadata: M,
7039
- OrdinaryOwnMetadataKeys: ee,
7043
+ OrdinaryOwnMetadataKeys: te,
7040
7044
  OrdinaryDeleteMetadata: je
7041
7045
  };
7042
7046
  return oe;
7043
7047
  }
7044
- function br(A, I, B) {
7048
+ function br(A, I, T) {
7045
7049
  var M = w.getProvider(A, I);
7046
7050
  if (!H(M))
7047
7051
  return M;
7048
- if (B) {
7052
+ if (T) {
7049
7053
  if (w.setProvider(A, I, S))
7050
7054
  return S;
7051
7055
  throw new Error("Illegal state.");
7052
7056
  }
7053
7057
  }
7054
7058
  function nm() {
7055
- var A = {}, I = [], B = (
7059
+ var A = {}, I = [], T = (
7056
7060
  /** @class */
7057
7061
  function() {
7058
7062
  function oe(F, G, Y) {
@@ -7122,11 +7126,11 @@ var Du;
7122
7126
  }, oe.prototype.clear = function() {
7123
7127
  this._keys.length = 0, this._values.length = 0, this._cacheKey = A, this._cacheIndex = -2;
7124
7128
  }, oe.prototype.keys = function() {
7125
- return new B(this._keys, this._values, ee);
7129
+ return new T(this._keys, this._values, te);
7126
7130
  }, oe.prototype.values = function() {
7127
- return new B(this._keys, this._values, je);
7131
+ return new T(this._keys, this._values, je);
7128
7132
  }, oe.prototype.entries = function() {
7129
- return new B(this._keys, this._values, Ie);
7133
+ return new T(this._keys, this._values, Ie);
7130
7134
  }, oe.prototype["@@iterator"] = function() {
7131
7135
  return this.entries();
7132
7136
  }, oe.prototype[o] = function() {
@@ -7145,7 +7149,7 @@ var Du;
7145
7149
  }()
7146
7150
  );
7147
7151
  return M;
7148
- function ee(oe, F) {
7152
+ function te(oe, F) {
7149
7153
  return oe;
7150
7154
  }
7151
7155
  function je(oe, F) {
@@ -7168,12 +7172,12 @@ var Du;
7168
7172
  },
7169
7173
  enumerable: !0,
7170
7174
  configurable: !0
7171
- }), I.prototype.has = function(B) {
7172
- return this._map.has(B);
7173
- }, I.prototype.add = function(B) {
7174
- return this._map.set(B, B), this;
7175
- }, I.prototype.delete = function(B) {
7176
- return this._map.delete(B);
7175
+ }), I.prototype.has = function(T) {
7176
+ return this._map.has(T);
7177
+ }, I.prototype.add = function(T) {
7178
+ return this._map.set(T, T), this;
7179
+ }, I.prototype.delete = function(T) {
7180
+ return this._map.delete(T);
7177
7181
  }, I.prototype.clear = function() {
7178
7182
  this._map.clear();
7179
7183
  }, I.prototype.keys = function() {
@@ -7192,7 +7196,7 @@ var Du;
7192
7196
  return A;
7193
7197
  }
7194
7198
  function im() {
7195
- var A = 16, I = p.create(), B = M();
7199
+ var A = 16, I = p.create(), T = M();
7196
7200
  return (
7197
7201
  /** @class */
7198
7202
  function() {
@@ -7200,28 +7204,28 @@ var Du;
7200
7204
  this._key = M();
7201
7205
  }
7202
7206
  return F.prototype.has = function(G) {
7203
- var Y = ee(
7207
+ var Y = te(
7204
7208
  G,
7205
7209
  /*create*/
7206
7210
  !1
7207
7211
  );
7208
7212
  return Y !== void 0 ? p.has(Y, this._key) : !1;
7209
7213
  }, F.prototype.get = function(G) {
7210
- var Y = ee(
7214
+ var Y = te(
7211
7215
  G,
7212
7216
  /*create*/
7213
7217
  !1
7214
7218
  );
7215
7219
  return Y !== void 0 ? p.get(Y, this._key) : void 0;
7216
7220
  }, F.prototype.set = function(G, Y) {
7217
- var X = ee(
7221
+ var X = te(
7218
7222
  G,
7219
7223
  /*create*/
7220
7224
  !0
7221
7225
  );
7222
7226
  return X[this._key] = Y, this;
7223
7227
  }, F.prototype.delete = function(G) {
7224
- var Y = ee(
7228
+ var Y = te(
7225
7229
  G,
7226
7230
  /*create*/
7227
7231
  !1
@@ -7239,13 +7243,13 @@ var Du;
7239
7243
  while (p.has(I, F));
7240
7244
  return I[F] = !0, F;
7241
7245
  }
7242
- function ee(F, G) {
7243
- if (!r.call(F, B)) {
7246
+ function te(F, G) {
7247
+ if (!r.call(F, T)) {
7244
7248
  if (!G)
7245
7249
  return;
7246
- Object.defineProperty(F, B, { value: p.create() });
7250
+ Object.defineProperty(F, T, { value: p.create() });
7247
7251
  }
7248
- return F[B];
7252
+ return F[T];
7249
7253
  }
7250
7254
  function je(F, G) {
7251
7255
  for (var Y = 0; Y < G; ++Y)
@@ -9835,7 +9839,7 @@ class po {
9835
9839
  this.value = i.buffer;
9836
9840
  }
9837
9841
  }
9838
- class ce {
9842
+ class le {
9839
9843
  get byteLength() {
9840
9844
  return this.buffer.byteLength;
9841
9845
  }
@@ -9889,7 +9893,7 @@ const Sy = {
9889
9893
  fromASN: (t) => t.valueBlock.valueHexView,
9890
9894
  toASN: (t) => new hn({ valueHex: t })
9891
9895
  }, jy = {
9892
- fromASN: (t) => new ce(t.getValue()),
9896
+ fromASN: (t) => new le(t.getValue()),
9893
9897
  toASN: (t) => t.toASN()
9894
9898
  };
9895
9899
  function at(t) {
@@ -10350,18 +10354,18 @@ var Ah = { exports: {} };
10350
10354
  function u(f, _) {
10351
10355
  if (f.indexOf("::") !== f.lastIndexOf("::"))
10352
10356
  return null;
10353
- let w = 0, S = -1, N = (f.match(l.zoneIndex) || [])[0], T, V;
10357
+ let w = 0, S = -1, N = (f.match(l.zoneIndex) || [])[0], B, V;
10354
10358
  for (N && (N = N.substring(1), f = f.replace(/%.+$/, "")); (S = f.indexOf(":", S + 1)) >= 0; )
10355
10359
  w++;
10356
10360
  if (f.substr(0, 2) === "::" && w--, f.substr(-2, 2) === "::" && w--, w > _)
10357
10361
  return null;
10358
- for (V = _ - w, T = ":"; V--; )
10359
- T += "0:";
10360
- return f = f.replace("::", T), f[0] === ":" && (f = f.slice(1)), f[f.length - 1] === ":" && (f = f.slice(0, -1)), _ = function() {
10361
- const te = f.split(":"), pe = [];
10362
- for (let ue = 0; ue < te.length; ue++)
10363
- pe.push(parseInt(te[ue], 16));
10364
- return pe;
10362
+ for (V = _ - w, B = ":"; V--; )
10363
+ B += "0:";
10364
+ return f = f.replace("::", B), f[0] === ":" && (f = f.slice(1)), f[f.length - 1] === ":" && (f = f.slice(0, -1)), _ = function() {
10365
+ const Q = f.split(":"), ce = [];
10366
+ for (let de = 0; de < Q.length; de++)
10367
+ ce.push(parseInt(Q[de], 16));
10368
+ return ce;
10365
10369
  }(), {
10366
10370
  parts: _,
10367
10371
  zoneId: N
@@ -10370,9 +10374,9 @@ var Ah = { exports: {} };
10370
10374
  function p(f, _, w, S) {
10371
10375
  if (f.length !== _.length)
10372
10376
  throw new Error("ipaddr: cannot match CIDR for objects with different lengths");
10373
- let N = 0, T;
10377
+ let N = 0, B;
10374
10378
  for (; S > 0; ) {
10375
- if (T = w - S, T < 0 && (T = 0), f[N] >> T !== _[N] >> T)
10379
+ if (B = w - S, B < 0 && (B = 0), f[N] >> B !== _[N] >> B)
10376
10380
  return !1;
10377
10381
  S -= w, N += 1;
10378
10382
  }
@@ -10460,10 +10464,10 @@ var Ah = { exports: {} };
10460
10464
  254: 1,
10461
10465
  255: 0
10462
10466
  };
10463
- let N, T, V;
10467
+ let N, B, V;
10464
10468
  for (N = 3; N >= 0; N -= 1)
10465
- if (T = this.octets[N], T in S) {
10466
- if (V = S[T], w && V !== 0)
10469
+ if (B = this.octets[N], B in S) {
10470
+ if (V = S[B], w && V !== 0)
10467
10471
  return null;
10468
10472
  V !== 8 && (w = !0), _ += V;
10469
10473
  } else
@@ -10483,9 +10487,9 @@ var Ah = { exports: {} };
10483
10487
  }(), v.IPv4.broadcastAddressFromCIDR = function(f) {
10484
10488
  try {
10485
10489
  const _ = this.parseCIDR(f), w = _[0].toByteArray(), S = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), N = [];
10486
- let T = 0;
10487
- for (; T < 4; )
10488
- N.push(parseInt(w[T], 10) | parseInt(S[T], 10) ^ 255), T++;
10490
+ let B = 0;
10491
+ for (; B < 4; )
10492
+ N.push(parseInt(w[B], 10) | parseInt(S[B], 10) ^ 255), B++;
10489
10493
  return new this(N);
10490
10494
  } catch {
10491
10495
  throw new Error("ipaddr: the address does not have IPv4 CIDR format");
@@ -10507,10 +10511,10 @@ var Ah = { exports: {} };
10507
10511
  }, v.IPv4.isValidFourPartDecimal = function(f) {
10508
10512
  return !!(v.IPv4.isValid(f) && f.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/));
10509
10513
  }, v.IPv4.networkAddressFromCIDR = function(f) {
10510
- let _, w, S, N, T;
10514
+ let _, w, S, N, B;
10511
10515
  try {
10512
- for (_ = this.parseCIDR(f), S = _[0].toByteArray(), T = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), N = [], w = 0; w < 4; )
10513
- N.push(parseInt(S[w], 10) & parseInt(T[w], 10)), w++;
10516
+ for (_ = this.parseCIDR(f), S = _[0].toByteArray(), B = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), N = [], w = 0; w < 4; )
10517
+ N.push(parseInt(S[w], 10) & parseInt(B[w], 10)), w++;
10514
10518
  return new this(N);
10515
10519
  } catch {
10516
10520
  throw new Error("ipaddr: the address does not have IPv4 CIDR format");
@@ -10538,31 +10542,31 @@ var Ah = { exports: {} };
10538
10542
  let _, w, S;
10539
10543
  if (_ = f.match(r.fourOctet))
10540
10544
  return function() {
10541
- const N = _.slice(1, 6), T = [];
10545
+ const N = _.slice(1, 6), B = [];
10542
10546
  for (let V = 0; V < N.length; V++)
10543
- w = N[V], T.push(h(w));
10544
- return T;
10547
+ w = N[V], B.push(h(w));
10548
+ return B;
10545
10549
  }();
10546
10550
  if (_ = f.match(r.longValue)) {
10547
10551
  if (S = h(_[1]), S > 4294967295 || S < 0)
10548
10552
  throw new Error("ipaddr: address outside defined range");
10549
10553
  return function() {
10550
10554
  const N = [];
10551
- let T;
10552
- for (T = 0; T <= 24; T += 8)
10553
- N.push(S >> T & 255);
10555
+ let B;
10556
+ for (B = 0; B <= 24; B += 8)
10557
+ N.push(S >> B & 255);
10554
10558
  return N;
10555
10559
  }().reverse();
10556
10560
  } else return (_ = f.match(r.twoOctet)) ? function() {
10557
- const N = _.slice(1, 4), T = [];
10561
+ const N = _.slice(1, 4), B = [];
10558
10562
  if (S = h(N[1]), S > 16777215 || S < 0)
10559
10563
  throw new Error("ipaddr: address outside defined range");
10560
- return T.push(h(N[0])), T.push(S >> 16 & 255), T.push(S >> 8 & 255), T.push(S & 255), T;
10564
+ return B.push(h(N[0])), B.push(S >> 16 & 255), B.push(S >> 8 & 255), B.push(S & 255), B;
10561
10565
  }() : (_ = f.match(r.threeOctet)) ? function() {
10562
- const N = _.slice(1, 5), T = [];
10566
+ const N = _.slice(1, 5), B = [];
10563
10567
  if (S = h(N[2]), S > 65535 || S < 0)
10564
10568
  throw new Error("ipaddr: address outside defined range");
10565
- return T.push(h(N[0])), T.push(h(N[1])), T.push(S >> 8 & 255), T.push(S & 255), T;
10569
+ return B.push(h(N[0])), B.push(h(N[1])), B.push(S >> 8 & 255), B.push(S & 255), B;
10566
10570
  }() : null;
10567
10571
  }, v.IPv4.subnetMaskFromPrefixLength = function(f) {
10568
10572
  if (f = parseInt(f), f < 0 || f > 32)
@@ -10653,12 +10657,12 @@ var Ah = { exports: {} };
10653
10657
  65534: 1,
10654
10658
  65535: 0
10655
10659
  };
10656
- let N, T;
10660
+ let N, B;
10657
10661
  for (let V = 7; V >= 0; V -= 1)
10658
10662
  if (N = this.parts[V], N in S) {
10659
- if (T = S[N], w && T !== 0)
10663
+ if (B = S[N], w && B !== 0)
10660
10664
  return null;
10661
- T !== 16 && (w = !0), _ += T;
10665
+ B !== 16 && (w = !0), _ += B;
10662
10666
  } else
10663
10667
  return null;
10664
10668
  return 128 - _;
@@ -10695,9 +10699,9 @@ var Ah = { exports: {} };
10695
10699
  return this.zoneId && (w = `%${this.zoneId}`), _ + w;
10696
10700
  }, f.prototype.toRFC5952String = function() {
10697
10701
  const _ = /((^|:)(0(:|$)){2,})/g, w = this.toNormalizedString();
10698
- let S = 0, N = -1, T;
10699
- for (; T = _.exec(w); )
10700
- T[0].length > N && (S = T.index, N = T[0].length);
10702
+ let S = 0, N = -1, B;
10703
+ for (; B = _.exec(w); )
10704
+ B[0].length > N && (S = B.index, N = B[0].length);
10701
10705
  return N < 0 ? w : `${w.substring(0, S)}::${w.substring(S + N)}`;
10702
10706
  }, f.prototype.toString = function() {
10703
10707
  return this.toRFC5952String();
@@ -10705,9 +10709,9 @@ var Ah = { exports: {} };
10705
10709
  }(), v.IPv6.broadcastAddressFromCIDR = function(f) {
10706
10710
  try {
10707
10711
  const _ = this.parseCIDR(f), w = _[0].toByteArray(), S = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), N = [];
10708
- let T = 0;
10709
- for (; T < 16; )
10710
- N.push(parseInt(w[T], 10) | parseInt(S[T], 10) ^ 255), T++;
10712
+ let B = 0;
10713
+ for (; B < 16; )
10714
+ N.push(parseInt(w[B], 10) | parseInt(S[B], 10) ^ 255), B++;
10711
10715
  return new this(N);
10712
10716
  } catch (_) {
10713
10717
  throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${_})`);
@@ -10732,10 +10736,10 @@ var Ah = { exports: {} };
10732
10736
  return !1;
10733
10737
  }
10734
10738
  }, v.IPv6.networkAddressFromCIDR = function(f) {
10735
- let _, w, S, N, T;
10739
+ let _, w, S, N, B;
10736
10740
  try {
10737
- for (_ = this.parseCIDR(f), S = _[0].toByteArray(), T = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), N = [], w = 0; w < 16; )
10738
- N.push(parseInt(S[w], 10) & parseInt(T[w], 10)), w++;
10741
+ for (_ = this.parseCIDR(f), S = _[0].toByteArray(), B = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), N = [], w = 0; w < 16; )
10742
+ N.push(parseInt(S[w], 10) & parseInt(B[w], 10)), w++;
10739
10743
  return new this(N);
10740
10744
  } catch (V) {
10741
10745
  throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${V})`);
@@ -10755,21 +10759,21 @@ var Ah = { exports: {} };
10755
10759
  }), S;
10756
10760
  throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range");
10757
10761
  }, v.IPv6.parser = function(f) {
10758
- let _, w, S, N, T, V;
10762
+ let _, w, S, N, B, V;
10759
10763
  if (S = f.match(l.deprecatedTransitional))
10760
10764
  return this.parser(`::ffff:${S[1]}`);
10761
10765
  if (l.native.test(f))
10762
10766
  return u(f, 8);
10763
10767
  if ((S = f.match(l.transitional)) && (V = S[6] || "", _ = S[1], S[1].endsWith("::") || (_ = _.slice(0, -1)), _ = u(_ + V, 6), _.parts)) {
10764
- for (T = [
10768
+ for (B = [
10765
10769
  parseInt(S[2]),
10766
10770
  parseInt(S[3]),
10767
10771
  parseInt(S[4]),
10768
10772
  parseInt(S[5])
10769
- ], w = 0; w < T.length; w++)
10770
- if (N = T[w], !(0 <= N && N <= 255))
10773
+ ], w = 0; w < B.length; w++)
10774
+ if (N = B[w], !(0 <= N && N <= 255))
10771
10775
  return null;
10772
- return _.parts.push(T[0] << 8 | T[1]), _.parts.push(T[2] << 8 | T[3]), {
10776
+ return _.parts.push(B[0] << 8 | B[1]), _.parts.push(B[2] << 8 | B[3]), {
10773
10777
  parts: _.parts,
10774
10778
  zoneId: _.zoneId
10775
10779
  };
@@ -10815,12 +10819,12 @@ var Ah = { exports: {} };
10815
10819
  const _ = this.parse(f);
10816
10820
  return _.kind() === "ipv6" && _.isIPv4MappedAddress() ? _.toIPv4Address() : _;
10817
10821
  }, v.subnetMatch = function(f, _, w) {
10818
- let S, N, T, V;
10822
+ let S, N, B, V;
10819
10823
  w == null && (w = "unicast");
10820
10824
  for (N in _)
10821
10825
  if (Object.prototype.hasOwnProperty.call(_, N)) {
10822
- for (T = _[N], T[0] && !(T[0] instanceof Array) && (T = [T]), S = 0; S < T.length; S++)
10823
- if (V = T[S], f.kind() === V[0].kind() && f.match.apply(f, V))
10826
+ for (B = _[N], B[0] && !(B[0] instanceof Array) && (B = [B]), S = 0; S < B.length; S++)
10827
+ if (V = B[S], f.kind() === V[0].kind() && f.match.apply(f, V))
10824
10828
  return N;
10825
10829
  }
10826
10830
  return w;
@@ -11013,7 +11017,7 @@ Fn = Pa = d([
11013
11017
  R({ type: P.Sequence, itemType: ui })
11014
11018
  ], Fn);
11015
11019
  const La = `${rn}.35`;
11016
- class bl extends ce {
11020
+ class bl extends le {
11017
11021
  }
11018
11022
  class pn {
11019
11023
  constructor(e = {}) {
@@ -11560,7 +11564,7 @@ d([
11560
11564
  var tc;
11561
11565
  let ot = class Uh {
11562
11566
  constructor(e = {}) {
11563
- this.extnID = "", this.critical = Uh.CRITICAL, this.extnValue = new ce(), Object.assign(this, e);
11567
+ this.extnID = "", this.critical = Uh.CRITICAL, this.extnValue = new le(), Object.assign(this, e);
11564
11568
  }
11565
11569
  };
11566
11570
  ot.CRITICAL = !1;
@@ -11574,7 +11578,7 @@ d([
11574
11578
  })
11575
11579
  ], ot.prototype, "critical", void 0);
11576
11580
  d([
11577
- g({ type: ce })
11581
+ g({ type: le })
11578
11582
  ], ot.prototype, "extnValue", void 0);
11579
11583
  let Yt = tc = class extends ge {
11580
11584
  constructor(e) {
@@ -11776,7 +11780,7 @@ d([
11776
11780
  var rc;
11777
11781
  class Nt {
11778
11782
  constructor(e = {}) {
11779
- this.version = Vt.v0, this.sid = new Yn(), this.digestAlgorithm = new Dr(), this.signatureAlgorithm = new ps(), this.signature = new ce(), Object.assign(this, e);
11783
+ this.version = Vt.v0, this.sid = new Yn(), this.digestAlgorithm = new Dr(), this.signatureAlgorithm = new ps(), this.signature = new le(), Object.assign(this, e);
11780
11784
  }
11781
11785
  }
11782
11786
  d([
@@ -11795,7 +11799,7 @@ d([
11795
11799
  g({ type: ps })
11796
11800
  ], Nt.prototype, "signatureAlgorithm", void 0);
11797
11801
  d([
11798
- g({ type: ce })
11802
+ g({ type: le })
11799
11803
  ], Nt.prototype, "signature", void 0);
11800
11804
  d([
11801
11805
  g({ type: fr, repeated: "set", context: 1, implicit: !0, optional: !0 })
@@ -12033,7 +12037,7 @@ class ko {
12033
12037
  }
12034
12038
  }
12035
12039
  d([
12036
- g({ type: ce })
12040
+ g({ type: le })
12037
12041
  ], ko.prototype, "cotets", void 0);
12038
12042
  d([
12039
12043
  g({ type: b.ObjectIdentifier })
@@ -12124,7 +12128,7 @@ d([
12124
12128
  g({ type: ie })
12125
12129
  ], jl.prototype, "ident", void 0);
12126
12130
  d([
12127
- g({ type: ce, optional: !0 })
12131
+ g({ type: le, optional: !0 })
12128
12132
  ], jl.prototype, "authInfo", void 0);
12129
12133
  var dc;
12130
12134
  class $l {
@@ -12180,7 +12184,7 @@ let Fr = class {
12180
12184
  }
12181
12185
  };
12182
12186
  d([
12183
- g({ type: ce })
12187
+ g({ type: le })
12184
12188
  ], Fr.prototype, "single", void 0);
12185
12189
  d([
12186
12190
  g({ type: b.Any })
@@ -12205,10 +12209,10 @@ let Hr = class {
12205
12209
  }
12206
12210
  };
12207
12211
  d([
12208
- g({ type: ce, context: 0, implicit: !0, optional: !0 })
12212
+ g({ type: le, context: 0, implicit: !0, optional: !0 })
12209
12213
  ], Hr.prototype, "value", void 0);
12210
12214
  d([
12211
- g({ type: ce, converter: jy, context: 0, implicit: !0, optional: !0, repeated: "sequence" })
12215
+ g({ type: le, converter: jy, context: 0, implicit: !0, optional: !0, repeated: "sequence" })
12212
12216
  ], Hr.prototype, "constructedValue", void 0);
12213
12217
  Hr = d([
12214
12218
  R({ type: P.Choice })
@@ -12269,14 +12273,14 @@ tr = d([
12269
12273
  ], tr);
12270
12274
  class Ol {
12271
12275
  constructor(e = {}) {
12272
- this.rid = new tr(), this.encryptedKey = new ce(), Object.assign(this, e);
12276
+ this.rid = new tr(), this.encryptedKey = new le(), Object.assign(this, e);
12273
12277
  }
12274
12278
  }
12275
12279
  d([
12276
12280
  g({ type: tr })
12277
12281
  ], Ol.prototype, "rid", void 0);
12278
12282
  d([
12279
- g({ type: ce })
12283
+ g({ type: le })
12280
12284
  ], Ol.prototype, "encryptedKey", void 0);
12281
12285
  let ys = pc = class extends ge {
12282
12286
  constructor(e) {
@@ -12326,7 +12330,7 @@ d([
12326
12330
  g({ type: Sn, context: 0 })
12327
12331
  ], gr.prototype, "originator", void 0);
12328
12332
  d([
12329
- g({ type: ce, context: 1, optional: !0 })
12333
+ g({ type: le, context: 1, optional: !0 })
12330
12334
  ], gr.prototype, "ukm", void 0);
12331
12335
  d([
12332
12336
  g({ type: At })
@@ -12350,7 +12354,7 @@ nr = d([
12350
12354
  ], nr);
12351
12355
  class hi {
12352
12356
  constructor(e = {}) {
12353
- this.version = Vt.v0, this.rid = new nr(), this.keyEncryptionAlgorithm = new At(), this.encryptedKey = new ce(), Object.assign(this, e);
12357
+ this.version = Vt.v0, this.rid = new nr(), this.keyEncryptionAlgorithm = new At(), this.encryptedKey = new le(), Object.assign(this, e);
12354
12358
  }
12355
12359
  }
12356
12360
  d([
@@ -12363,15 +12367,15 @@ d([
12363
12367
  g({ type: At })
12364
12368
  ], hi.prototype, "keyEncryptionAlgorithm", void 0);
12365
12369
  d([
12366
- g({ type: ce })
12370
+ g({ type: le })
12367
12371
  ], hi.prototype, "encryptedKey", void 0);
12368
12372
  class gi {
12369
12373
  constructor(e = {}) {
12370
- this.keyIdentifier = new ce(), Object.assign(this, e);
12374
+ this.keyIdentifier = new le(), Object.assign(this, e);
12371
12375
  }
12372
12376
  }
12373
12377
  d([
12374
- g({ type: ce })
12378
+ g({ type: le })
12375
12379
  ], gi.prototype, "keyIdentifier", void 0);
12376
12380
  d([
12377
12381
  g({ type: b.GeneralizedTime, optional: !0 })
@@ -12381,7 +12385,7 @@ d([
12381
12385
  ], gi.prototype, "other", void 0);
12382
12386
  class mi {
12383
12387
  constructor(e = {}) {
12384
- this.version = Vt.v4, this.kekid = new gi(), this.keyEncryptionAlgorithm = new At(), this.encryptedKey = new ce(), Object.assign(this, e);
12388
+ this.version = Vt.v4, this.kekid = new gi(), this.keyEncryptionAlgorithm = new At(), this.encryptedKey = new le(), Object.assign(this, e);
12385
12389
  }
12386
12390
  }
12387
12391
  d([
@@ -12394,11 +12398,11 @@ d([
12394
12398
  g({ type: At })
12395
12399
  ], mi.prototype, "keyEncryptionAlgorithm", void 0);
12396
12400
  d([
12397
- g({ type: ce })
12401
+ g({ type: le })
12398
12402
  ], mi.prototype, "encryptedKey", void 0);
12399
12403
  class _i {
12400
12404
  constructor(e = {}) {
12401
- this.version = Vt.v0, this.keyEncryptionAlgorithm = new At(), this.encryptedKey = new ce(), Object.assign(this, e);
12405
+ this.version = Vt.v0, this.keyEncryptionAlgorithm = new At(), this.encryptedKey = new le(), Object.assign(this, e);
12402
12406
  }
12403
12407
  }
12404
12408
  d([
@@ -12411,7 +12415,7 @@ d([
12411
12415
  g({ type: At })
12412
12416
  ], _i.prototype, "keyEncryptionAlgorithm", void 0);
12413
12417
  d([
12414
- g({ type: ce })
12418
+ g({ type: le })
12415
12419
  ], _i.prototype, "encryptedKey", void 0);
12416
12420
  class Tl {
12417
12421
  constructor(e = {}) {
@@ -12581,7 +12585,7 @@ d([
12581
12585
  Wr = d([
12582
12586
  R({ type: P.Sequence })
12583
12587
  ], Wr);
12584
- class av extends ce {
12588
+ class av extends le {
12585
12589
  }
12586
12590
  let rr = class {
12587
12591
  constructor(e = {}) {
@@ -12649,14 +12653,14 @@ Qt = d([
12649
12653
  ], Qt);
12650
12654
  class Co {
12651
12655
  constructor(e = {}) {
12652
- this.version = 1, this.privateKey = new ce(), Object.assign(this, e);
12656
+ this.version = 1, this.privateKey = new le(), Object.assign(this, e);
12653
12657
  }
12654
12658
  }
12655
12659
  d([
12656
12660
  g({ type: b.Integer })
12657
12661
  ], Co.prototype, "version", void 0);
12658
12662
  d([
12659
- g({ type: ce })
12663
+ g({ type: le })
12660
12664
  ], Co.prototype, "privateKey", void 0);
12661
12665
  d([
12662
12666
  g({ type: Qt, context: 0, optional: !0 })
@@ -12752,14 +12756,14 @@ new K({
12752
12756
  });
12753
12757
  class $o {
12754
12758
  constructor(e = {}) {
12755
- this.digestAlgorithm = new K(), this.digest = new ce(), Object.assign(this, e);
12759
+ this.digestAlgorithm = new K(), this.digest = new le(), Object.assign(this, e);
12756
12760
  }
12757
12761
  }
12758
12762
  d([
12759
12763
  g({ type: K })
12760
12764
  ], $o.prototype, "digestAlgorithm", void 0);
12761
12765
  d([
12762
- g({ type: ce })
12766
+ g({ type: le })
12763
12767
  ], $o.prototype, "digest", void 0);
12764
12768
  var wc;
12765
12769
  class Oo {
@@ -13414,7 +13418,7 @@ d([
13414
13418
  d([
13415
13419
  g({ type: b.Any, context: 0 })
13416
13420
  ], Yh.prototype, "crltValue", void 0);
13417
- class Xh extends ce {
13421
+ class Xh extends le {
13418
13422
  }
13419
13423
  let Po = class {
13420
13424
  constructor(e = {}) {
@@ -13431,7 +13435,7 @@ var Ic, Cc;
13431
13435
  (function(t) {
13432
13436
  t[t.v1 = 0] = "v1";
13433
13437
  })(Cc || (Cc = {}));
13434
- class Qh extends ce {
13438
+ class Qh extends le {
13435
13439
  }
13436
13440
  let Nc = Ic = class extends ge {
13437
13441
  constructor(e) {
@@ -13481,14 +13485,14 @@ d([
13481
13485
  ], eg.prototype, "secretValue", void 0);
13482
13486
  class bi {
13483
13487
  constructor(e = {}) {
13484
- this.mac = new $o(), this.macSalt = new ce(), this.iterations = 1, Object.assign(this, e);
13488
+ this.mac = new $o(), this.macSalt = new le(), this.iterations = 1, Object.assign(this, e);
13485
13489
  }
13486
13490
  }
13487
13491
  d([
13488
13492
  g({ type: $o })
13489
13493
  ], bi.prototype, "mac", void 0);
13490
13494
  d([
13491
- g({ type: ce })
13495
+ g({ type: le })
13492
13496
  ], bi.prototype, "macSalt", void 0);
13493
13497
  d([
13494
13498
  g({ type: b.Integer, defaultValue: 1 })
@@ -14132,7 +14136,7 @@ class ct extends on {
14132
14136
  D.isBufferSource(e[0]) ? n = D.toArrayBuffer(e[0]) : n = z.serialize(new ot({
14133
14137
  extnID: e[0],
14134
14138
  critical: e[1],
14135
- extnValue: new ce(D.toArrayBuffer(e[2]))
14139
+ extnValue: new le(D.toArrayBuffer(e[2]))
14136
14140
  })), super(n, ot);
14137
14141
  }
14138
14142
  onInit(e) {
@@ -14392,7 +14396,7 @@ class Kt extends on {
14392
14396
  n = new ie({
14393
14397
  otherName: new zr({
14394
14398
  typeId: dp,
14395
- value: z.serialize(new ce(Z.FromHex(i)))
14399
+ value: z.serialize(new le(Z.FromHex(i)))
14396
14400
  })
14397
14401
  });
14398
14402
  break;
@@ -14437,7 +14441,7 @@ class Kt extends on {
14437
14441
  else if (e.otherName != null)
14438
14442
  if (e.otherName.typeId === dp) {
14439
14443
  this.type = ra;
14440
- const n = z.parse(e.otherName.value, ce), r = new RegExp(up, "i").exec(Z.ToHex(n));
14444
+ const n = z.parse(e.otherName.value, le), r = new RegExp(up, "i").exec(Z.ToHex(n));
14441
14445
  if (!r)
14442
14446
  throw new Error(Vv);
14443
14447
  this.value = r.slice(1).map((i, s) => s < 3 ? Z.ToHex(new Uint8Array(Z.FromHex(i)).reverse()) : i).join("-");
@@ -15554,7 +15558,7 @@ async function Xv(t) {
15554
15558
  const e = await t.publicKey.export(), n = await crypto.subtle.exportKey("jwk", e), r = JSON.stringify(n, Object.keys(n).sort()), s = new TextEncoder().encode(r);
15555
15559
  return Sa(await cf(s));
15556
15560
  }
15557
- const Qv = 1e3 * 60 * 60 * 24, ew = new le().openapi(
15561
+ const Qv = 1e3 * 60 * 60 * 24, ew = new ue().openapi(
15558
15562
  q({
15559
15563
  tags: ["keys"],
15560
15564
  method: "get",
@@ -15686,7 +15690,7 @@ const Qv = 1e3 * 60 * 60 * 24, ew = new le().openapi(
15686
15690
  });
15687
15691
  return await t.env.data.keys.create(r), t.text("OK");
15688
15692
  }
15689
- ), tw = new le().openapi(
15693
+ ), tw = new ue().openapi(
15690
15694
  q({
15691
15695
  tags: ["users"],
15692
15696
  method: "get",
@@ -15721,7 +15725,7 @@ const Qv = 1e3 * 60 * 60 * 24, ew = new le().openapi(
15721
15725
  }
15722
15726
  ), nw = jn.extend({
15723
15727
  clients: a.array(Dn)
15724
- }), rw = new le().openapi(
15728
+ }), rw = new ue().openapi(
15725
15729
  q({
15726
15730
  tags: ["clients"],
15727
15731
  method: "get",
@@ -15939,7 +15943,7 @@ Zc.extend({
15939
15943
  }).catchall(a.any());
15940
15944
  const iw = jn.extend({
15941
15945
  tenants: a.array(Or)
15942
- }), sw = new le().openapi(
15946
+ }), sw = new ue().openapi(
15943
15947
  q({
15944
15948
  tags: ["tenants"],
15945
15949
  method: "get",
@@ -16098,7 +16102,7 @@ const iw = jn.extend({
16098
16102
  }
16099
16103
  ), ow = jn.extend({
16100
16104
  logs: a.array(xa)
16101
- }), aw = new le().openapi(
16105
+ }), aw = new ue().openapi(
16102
16106
  q({
16103
16107
  tags: ["logs"],
16104
16108
  method: "get",
@@ -16172,7 +16176,7 @@ const iw = jn.extend({
16172
16176
  }
16173
16177
  ), cw = jn.extend({
16174
16178
  hooks: a.array(Nr)
16175
- }), lw = new le().openapi(
16179
+ }), lw = new ue().openapi(
16176
16180
  q({
16177
16181
  tags: ["hooks"],
16178
16182
  method: "get",
@@ -16363,7 +16367,7 @@ const iw = jn.extend({
16363
16367
  }
16364
16368
  ), uw = jn.extend({
16365
16369
  connections: a.array(ln)
16366
- }), dw = new le().openapi(
16370
+ }), dw = new ue().openapi(
16367
16371
  q({
16368
16372
  tags: ["connections"],
16369
16373
  method: "get",
@@ -16562,7 +16566,7 @@ const iw = jn.extend({
16562
16566
  const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), r = await t.env.data.connections.create(e, n);
16563
16567
  return t.json(r, { status: 201 });
16564
16568
  }
16565
- ), pw = new le().openapi(
16569
+ ), pw = new ue().openapi(
16566
16570
  q({
16567
16571
  tags: ["prompts"],
16568
16572
  method: "get",
@@ -16718,7 +16722,7 @@ function hg(t) {
16718
16722
  return await n();
16719
16723
  };
16720
16724
  }
16721
- const mw = new le().openapi(
16725
+ const mw = new ue().openapi(
16722
16726
  q({
16723
16727
  tags: ["emails"],
16724
16728
  method: "get",
@@ -16814,7 +16818,7 @@ const mw = new le().openapi(
16814
16818
  const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json");
16815
16819
  return await t.env.data.emailProviders.update(e, n), t.text("OK");
16816
16820
  }
16817
- ), _w = new le().openapi(
16821
+ ), _w = new ue().openapi(
16818
16822
  q({
16819
16823
  tags: ["sessions"],
16820
16824
  method: "get",
@@ -16915,7 +16919,7 @@ const mw = new le().openapi(
16915
16919
  });
16916
16920
  return t.text("Session deletion request accepted.", { status: 202 });
16917
16921
  }
16918
- ), yw = new le().openapi(
16922
+ ), yw = new ue().openapi(
16919
16923
  q({
16920
16924
  tags: ["refresh_tokens"],
16921
16925
  method: "get",
@@ -16982,7 +16986,7 @@ const mw = new le().openapi(
16982
16986
  });
16983
16987
  return t.text("OK");
16984
16988
  }
16985
- ), vw = new le().openapi(
16989
+ ), vw = new ue().openapi(
16986
16990
  q({
16987
16991
  tags: ["custom-domains"],
16988
16992
  method: "get",
@@ -17205,7 +17209,7 @@ const mw = new le().openapi(
17205
17209
  }
17206
17210
  );
17207
17211
  function ww(t) {
17208
- const e = new le();
17212
+ const e = new ue();
17209
17213
  fg(e), e.use(async (r, i) => (r.env.data = Ks(r, t.dataAdapter), i())), e.use(hg(e));
17210
17214
  const n = e.route("/branding", Gm).route("/custom-domains", vw).route("/email/providers", mw).route("/users", ny).route("/keys", ew).route("/users-by-email", tw).route("/clients", rw).route("/tenants", sw).route("/logs", aw).route("/hooks", lw).route("/connections", dw).route("/prompts", pw).route("/sessions", _w).route("/refresh_tokens", yw);
17211
17215
  return n.doc("/spec", {
@@ -18387,7 +18391,7 @@ async function Cp(t, e, n, r, i, s) {
18387
18391
  `${Et(t.env)}enter-email?state=${c.login_id}&error=${n}`
18388
18392
  );
18389
18393
  }
18390
- const sb = new le().openapi(
18394
+ const sb = new ue().openapi(
18391
18395
  q({
18392
18396
  tags: ["oauth2"],
18393
18397
  method: "get",
@@ -18489,7 +18493,7 @@ const sb = new le().openapi(
18489
18493
  state: e
18490
18494
  });
18491
18495
  }
18492
- ), ob = new le().openapi(
18496
+ ), ob = new ue().openapi(
18493
18497
  q({
18494
18498
  tags: ["oauth2"],
18495
18499
  method: "get",
@@ -18565,7 +18569,7 @@ const sb = new le().openapi(
18565
18569
  family_name: a.string().optional(),
18566
18570
  given_name: a.string().optional(),
18567
18571
  email_verified: a.boolean()
18568
- }), ab = new le().openapi(
18572
+ }), ab = new ue().openapi(
18569
18573
  q({
18570
18574
  tags: ["oauth2"],
18571
18575
  method: "get",
@@ -18600,7 +18604,7 @@ const sb = new le().openapi(
18600
18604
  });
18601
18605
  return t.json(Np.parse({ ...e, sub: e.user_id }));
18602
18606
  }
18603
- ), cb = new le().openapi(
18607
+ ), cb = new ue().openapi(
18604
18608
  q({
18605
18609
  tags: ["well known"],
18606
18610
  method: "get",
@@ -18927,7 +18931,7 @@ function gb(t) {
18927
18931
  }
18928
18932
  return {};
18929
18933
  }
18930
- const mb = new le().openapi(
18934
+ const mb = new ue().openapi(
18931
18935
  q({
18932
18936
  tags: ["oauth2"],
18933
18937
  method: "post",
@@ -19190,7 +19194,7 @@ async function eu(t, e) {
19190
19194
  }
19191
19195
  });
19192
19196
  }
19193
- const yb = new le().openapi(
19197
+ const yb = new ue().openapi(
19194
19198
  q({
19195
19199
  tags: ["dbconnections"],
19196
19200
  method: "post",
@@ -19392,7 +19396,7 @@ async function tu(t, e, n, r, i, s, o) {
19392
19396
  ticketAuth: s
19393
19397
  });
19394
19398
  }
19395
- const vb = new le().openapi(
19399
+ const vb = new ue().openapi(
19396
19400
  q({
19397
19401
  tags: ["passwordless"],
19398
19402
  method: "post",
@@ -19629,7 +19633,7 @@ async function wb(t, e, n, r) {
19629
19633
  });
19630
19634
  await Eg(t, n, c.code_id, r);
19631
19635
  }
19632
- const bb = new le().openapi(
19636
+ const bb = new ue().openapi(
19633
19637
  q({
19634
19638
  tags: ["oauth"],
19635
19639
  method: "post",
@@ -19892,66 +19896,70 @@ async function Eb({
19892
19896
  scope: u,
19893
19897
  response_type: p
19894
19898
  }) {
19895
- const { env: h } = t, m = new URL(r);
19896
- if (n != null && n.expires_at && new Date(n.expires_at) > /* @__PURE__ */ new Date()) {
19897
- t.set("user_id", n.user_id);
19898
- const f = new Headers(), _ = pf(e.tenant.id, n.id);
19899
- f.set("set-cookie", _);
19900
- const w = await h.data.users.get(e.tenant.id, n.user_id);
19901
- if (w) {
19902
- t.set("username", w.email), t.set("connection", w.connection);
19903
- const S = await Hs(t, {
19904
- client: e,
19905
- authParams: {
19906
- client_id: e.id,
19907
- audience: l,
19908
- code_challenge_method: o,
19909
- code_challenge: c,
19910
- scope: u,
19911
- state: i,
19912
- nonce: s,
19913
- response_type: p
19914
- },
19915
- user: w,
19916
- session_id: n.id
19917
- });
19918
- await h.data.sessions.update(e.tenant.id, n.id, {
19919
- used_at: (/* @__PURE__ */ new Date()).toISOString(),
19920
- expires_at: new Date(
19921
- Date.now() + Ds * 1e3
19922
- ).toISOString()
19923
- });
19924
- const N = be(t, {
19925
- type: _e.SUCCESS_SILENT_AUTH,
19926
- description: "Successful silent authentication"
19927
- });
19928
- return await t.env.data.logs.create(e.tenant.id, N), t.html(
19929
- $p(
19930
- `${m.protocol}//${m.host}`,
19931
- JSON.stringify(S)
19932
- ),
19933
- {
19934
- headers: f
19935
- }
19936
- );
19937
- }
19899
+ const { env: h } = t, m = new URL(r), v = `${m.protocol}//${m.host}`;
19900
+ async function f(Q = "Login required") {
19901
+ const ce = be(t, {
19902
+ type: _e.FAILED_SILENT_AUTH,
19903
+ description: Q
19904
+ });
19905
+ return await t.env.data.logs.create(e.tenant.id, ce), t.html(
19906
+ $p(
19907
+ v,
19908
+ JSON.stringify({
19909
+ error: "login_required",
19910
+ error_description: Q,
19911
+ state: i
19912
+ })
19913
+ )
19914
+ );
19938
19915
  }
19939
- const v = be(t, {
19940
- type: _e.FAILED_SILENT_AUTH,
19941
- description: "Login required"
19916
+ if (!n || (n == null ? void 0 : n.expires_at) && new Date(n.expires_at) < /* @__PURE__ */ new Date() || (n == null ? void 0 : n.idle_expires_at) && new Date(n.idle_expires_at) < /* @__PURE__ */ new Date())
19917
+ return f();
19918
+ t.set("user_id", n.user_id);
19919
+ const w = await h.data.users.get(e.tenant.id, n.user_id);
19920
+ if (!w)
19921
+ return f("User not found");
19922
+ t.set("username", w.email), t.set("connection", w.connection);
19923
+ const S = await Hs(t, {
19924
+ client: e,
19925
+ authParams: {
19926
+ client_id: e.id,
19927
+ audience: l,
19928
+ code_challenge_method: o,
19929
+ code_challenge: c,
19930
+ scope: u,
19931
+ state: i,
19932
+ nonce: s,
19933
+ response_type: p
19934
+ },
19935
+ user: w,
19936
+ session_id: n.id
19937
+ });
19938
+ await h.data.sessions.update(e.tenant.id, n.id, {
19939
+ used_at: (/* @__PURE__ */ new Date()).toISOString(),
19940
+ last_interaction_at: (/* @__PURE__ */ new Date()).toISOString(),
19941
+ device: {
19942
+ ...n.device,
19943
+ last_ip: t.req.header("x-real-ip") || "",
19944
+ last_user_agent: t.req.header("user-agent") || ""
19945
+ },
19946
+ idle_expires_at: n.idle_expires_at ? new Date(
19947
+ Date.now() + Ds * 1e3
19948
+ ).toISOString() : void 0
19949
+ });
19950
+ const N = be(t, {
19951
+ type: _e.SUCCESS_SILENT_AUTH,
19952
+ description: "Successful silent authentication"
19953
+ });
19954
+ await t.env.data.logs.create(e.tenant.id, N);
19955
+ const B = new Headers();
19956
+ B.set("Server-Timing", "cf-nel=0; no-cloudflare-insights=1");
19957
+ const V = pf(e.tenant.id, n.id);
19958
+ return B.set("set-cookie", V), t.html($p(v, JSON.stringify(S)), {
19959
+ headers: B
19942
19960
  });
19943
- return await t.env.data.logs.create(e.tenant.id, v), t.html(
19944
- $p(
19945
- `${m.protocol}//${m.host}`,
19946
- JSON.stringify({
19947
- error: "login_required",
19948
- error_description: "Login required",
19949
- state: i
19950
- })
19951
- )
19952
- );
19953
19961
  }
19954
- const Ib = new le().openapi(
19962
+ const Ib = new ue().openapi(
19955
19963
  q({
19956
19964
  tags: ["oauth"],
19957
19965
  method: "get",
@@ -20008,13 +20016,13 @@ const Ib = new le().openapi(
20008
20016
  realm: w,
20009
20017
  auth0Client: S,
20010
20018
  login_hint: N,
20011
- ui_locales: T,
20019
+ ui_locales: B,
20012
20020
  organization: V
20013
20021
  } = t.req.valid("query");
20014
20022
  t.set("log", "authorize");
20015
- const te = await qo(e, n);
20016
- t.set("client_id", te.id), t.set("tenant_id", te.tenant.id);
20017
- const pe = {
20023
+ const Q = await qo(e, n);
20024
+ t.set("client_id", Q.id), t.set("tenant_id", Q.tenant.id);
20025
+ const ce = {
20018
20026
  redirect_uri: i,
20019
20027
  scope: s,
20020
20028
  state: o,
@@ -20028,23 +20036,23 @@ const Ib = new le().openapi(
20028
20036
  code_challenge: m,
20029
20037
  code_challenge_method: v,
20030
20038
  username: N,
20031
- ui_locales: T,
20039
+ ui_locales: B,
20032
20040
  organization: V
20033
- }, ue = t.req.header("origin");
20034
- if (ue && !kb(ue, te.web_origins || []))
20041
+ }, de = t.req.header("origin");
20042
+ if (de && !kb(de, Q.web_origins || []))
20035
20043
  throw new j(403, {
20036
- message: `Origin ${ue} not allowed`
20044
+ message: `Origin ${de} not allowed`
20037
20045
  });
20038
- if (pe.redirect_uri && !Mo(pe.redirect_uri, te.callbacks || [], {
20046
+ if (ce.redirect_uri && !Mo(ce.redirect_uri, Q.callbacks || [], {
20039
20047
  allowPathWildcards: !0
20040
20048
  }))
20041
20049
  throw new j(400, {
20042
- message: `Invalid redirect URI - ${pe.redirect_uri}`
20050
+ message: `Invalid redirect URI - ${ce.redirect_uri}`
20043
20051
  });
20044
20052
  const Me = ts(
20045
- te.tenant.id,
20053
+ Q.tenant.id,
20046
20054
  t.req.header("cookie")
20047
- ), ze = Me ? await e.data.sessions.get(te.tenant.id, Me) : void 0;
20055
+ ), ze = Me ? await e.data.sessions.get(Q.tenant.id, Me) : void 0;
20048
20056
  if (f == "none") {
20049
20057
  if (!p)
20050
20058
  throw new j(400, {
@@ -20056,7 +20064,7 @@ const Ib = new le().openapi(
20056
20064
  redirect_uri: i,
20057
20065
  state: o,
20058
20066
  response_type: p,
20059
- client: te,
20067
+ client: Q,
20060
20068
  nonce: l,
20061
20069
  code_challenge_method: v,
20062
20070
  code_challenge: m,
@@ -20064,17 +20072,17 @@ const Ib = new le().openapi(
20064
20072
  scope: s
20065
20073
  });
20066
20074
  }
20067
- return u && u !== "email" ? ib(t, te, u, pe) : _ ? Ab(
20075
+ return u && u !== "email" ? ib(t, Q, u, ce) : _ ? Ab(
20068
20076
  t,
20069
- te.tenant.id,
20077
+ Q.tenant.id,
20070
20078
  _,
20071
- pe,
20079
+ ce,
20072
20080
  w
20073
20081
  ) : xb({
20074
20082
  ctx: t,
20075
- client: te,
20083
+ client: Q,
20076
20084
  auth0Client: S,
20077
- authParams: pe,
20085
+ authParams: ce,
20078
20086
  session: ze || void 0,
20079
20087
  connection: u,
20080
20088
  login_hint: N
@@ -20082,7 +20090,7 @@ const Ib = new le().openapi(
20082
20090
  }
20083
20091
  );
20084
20092
  function Cb(t) {
20085
- const e = new le();
20093
+ const e = new ue();
20086
20094
  e.use(async (r, i) => (r.env.data = Ks(r, t.dataAdapter), i())), e.use(hg(e));
20087
20095
  const n = e.route("/v2/logout", ob).route("/userinfo", ab).route("/.well-known", cb).route("/oauth/token", mb).route("/dbconnections", yb).route("/passwordless", vb).route("/co/authenticate", bb).route("/authorize", Ib).route("/callback", sb);
20088
20096
  return n.doc("/spec", {
@@ -21115,7 +21123,7 @@ function c1(t) {
21115
21123
  const e = atob(t), n = JSON.parse(e);
21116
21124
  return a1.includes(n.name) ? "code" : "link";
21117
21125
  }
21118
- const l1 = new le().openapi(
21126
+ const l1 = new ue().openapi(
21119
21127
  q({
21120
21128
  tags: ["login"],
21121
21129
  method: "get",
@@ -21463,9 +21471,9 @@ var ri = "_hp", u1 = {
21463
21471
  const S = v(h, () => {
21464
21472
  const N = Gi.get(f);
21465
21473
  if (N) {
21466
- const T = N.indexOf(_);
21467
- if (T !== -1)
21468
- return N.splice(T, 1), _();
21474
+ const B = N.indexOf(_);
21475
+ if (B !== -1)
21476
+ return N.splice(B, 1), _();
21469
21477
  }
21470
21478
  });
21471
21479
  if (S) {
@@ -21648,21 +21656,21 @@ var ri = "_hp", u1 = {
21648
21656
  if (v.length > 0) {
21649
21657
  const N = s.querySelectorAll(t);
21650
21658
  e:
21651
- for (const T of N)
21659
+ for (const B of N)
21652
21660
  for (const V of Hi[t])
21653
- if (T.getAttribute(V) === e[V]) {
21654
- h = T;
21661
+ if (B.getAttribute(V) === e[V]) {
21662
+ h = B;
21655
21663
  break e;
21656
21664
  }
21657
21665
  if (!h) {
21658
- const T = v.reduce(
21659
- (V, te) => e[te] === void 0 ? V : `${V}-${te}-${e[te]}`,
21666
+ const B = v.reduce(
21667
+ (V, Q) => e[Q] === void 0 ? V : `${V}-${Q}-${e[Q]}`,
21660
21668
  t
21661
21669
  );
21662
- m = !Li[T], h = Li[T] || (Li[T] = (() => {
21670
+ m = !Li[B], h = Li[B] || (Li[B] = (() => {
21663
21671
  const V = document.createElement(t);
21664
- for (const te of v)
21665
- e[te] !== void 0 && V.setAttribute(te, e[te]), e.rel && V.setAttribute("rel", e.rel);
21672
+ for (const Q of v)
21673
+ e[Q] !== void 0 && V.setAttribute(Q, e[Q]), e.rel && V.setAttribute("rel", e.rel);
21666
21674
  return V;
21667
21675
  })());
21668
21676
  }
@@ -21672,23 +21680,23 @@ var ri = "_hp", u1 = {
21672
21680
  const _ = au(
21673
21681
  (N) => {
21674
21682
  if (v.length > 0) {
21675
- let T = !1;
21683
+ let B = !1;
21676
21684
  for (const V of s.querySelectorAll(t)) {
21677
- if (T && V.getAttribute(Ki) !== l) {
21685
+ if (B && V.getAttribute(Ki) !== l) {
21678
21686
  s.insertBefore(N, V);
21679
21687
  return;
21680
21688
  }
21681
- V.getAttribute(Ki) === l && (T = !0);
21689
+ V.getAttribute(Ki) === l && (B = !0);
21682
21690
  }
21683
21691
  s.appendChild(N);
21684
21692
  } else if (f) {
21685
- let T = !1;
21693
+ let B = !1;
21686
21694
  for (const V of f)
21687
21695
  if (V === N) {
21688
- T = !0;
21696
+ B = !0;
21689
21697
  break;
21690
21698
  }
21691
- T || s.insertBefore(
21699
+ B || s.insertBefore(
21692
21700
  N,
21693
21701
  s.contains(f[0]) ? f[0] : s.querySelector(t)
21694
21702
  ), f = void 0;
@@ -21696,13 +21704,13 @@ var ri = "_hp", u1 = {
21696
21704
  },
21697
21705
  [l]
21698
21706
  ), w = cu(e.ref, (N) => {
21699
- var te;
21700
- const T = v[0];
21707
+ var Q;
21708
+ const B = v[0];
21701
21709
  if (n === 2 && (N.innerHTML = ""), (m || f) && _(N), !c && !o)
21702
21710
  return;
21703
- let V = zn[te = N.getAttribute(T)] || (zn[te] = new Promise(
21704
- (pe, ue) => {
21705
- N.addEventListener("load", pe), N.addEventListener("error", ue);
21711
+ let V = zn[Q = N.getAttribute(B)] || (zn[Q] = new Promise(
21712
+ (ce, de) => {
21713
+ N.addEventListener("load", ce), N.addEventListener("error", de);
21706
21714
  }
21707
21715
  ));
21708
21716
  o && (V = V.then(o)), c && (V = V.catch(c)), V.catch(() => {
@@ -21711,8 +21719,8 @@ var ri = "_hp", u1 = {
21711
21719
  if (i && u === "render") {
21712
21720
  const N = Hi[t][0];
21713
21721
  if (e[N]) {
21714
- const T = e[N], V = zn[T] || (zn[T] = new Promise((te, pe) => {
21715
- _(h), h.addEventListener("load", te), h.addEventListener("error", pe);
21722
+ const B = e[N], V = zn[B] || (zn[B] = new Promise((Q, ce) => {
21723
+ _(h), h.addEventListener("load", Q), h.addEventListener("error", ce);
21716
21724
  }));
21717
21725
  w1(V);
21718
21726
  }
@@ -21917,7 +21925,7 @@ const Wg = (t) => {
21917
21925
  ]
21918
21926
  }
21919
21927
  );
21920
- }, O1 = new le().openapi(
21928
+ }, O1 = new ue().openapi(
21921
21929
  q({
21922
21930
  tags: ["login"],
21923
21931
  method: "get",
@@ -22114,7 +22122,7 @@ const Wg = (t) => {
22114
22122
  /* @__PURE__ */ y(en, { state: i })
22115
22123
  ] })
22116
22124
  ] });
22117
- }, T1 = new le().openapi(
22125
+ }, T1 = new ue().openapi(
22118
22126
  q({
22119
22127
  tags: ["login"],
22120
22128
  method: "get",
@@ -22291,7 +22299,7 @@ const Wg = (t) => {
22291
22299
  /* @__PURE__ */ y("div", { className: "flex flex-1 flex-col justify-center", children: e }),
22292
22300
  i ? /* @__PURE__ */ y(en, { state: i }) : ""
22293
22301
  ] });
22294
- }, P1 = new le().openapi(
22302
+ }, P1 = new ue().openapi(
22295
22303
  q({
22296
22304
  tags: ["login"],
22297
22305
  method: "get",
@@ -22509,7 +22517,7 @@ const Wg = (t) => {
22509
22517
  ]
22510
22518
  }
22511
22519
  );
22512
- }, R1 = new le().openapi(
22520
+ }, R1 = new ue().openapi(
22513
22521
  q({
22514
22522
  tags: ["login"],
22515
22523
  method: "get",
@@ -22709,7 +22717,7 @@ const Wg = (t) => {
22709
22717
  ] }),
22710
22718
  /* @__PURE__ */ y(en, { state: n })
22711
22719
  ] });
22712
- }, V1 = new le().openapi(
22720
+ }, V1 = new ue().openapi(
22713
22721
  q({
22714
22722
  tags: ["login"],
22715
22723
  method: "get",
@@ -22810,7 +22818,7 @@ const Wg = (t) => {
22810
22818
  }
22811
22819
  )
22812
22820
  ] })
22813
- ] }) }), M1 = new le().openapi(
22821
+ ] }) }), M1 = new ue().openapi(
22814
22822
  q({
22815
22823
  tags: ["login"],
22816
22824
  method: "get",
@@ -22888,7 +22896,7 @@ const Wg = (t) => {
22888
22896
  }
22889
22897
  );
22890
22898
  function z1(t) {
22891
- const e = new le();
22899
+ const e = new ue();
22892
22900
  e.use(async (r, i) => (r.env.data = Ks(r, t.dataAdapter), i()));
22893
22901
  const n = e.route("/check-account", M1).route("/enter-email", l1).route("/enter-code", O1).route("/enter-password", T1).route("/reset-password", R1).route("/forgot-password", V1).route("/signup", P1);
22894
22902
  return n.doc("/u/spec", {
@@ -23803,7 +23811,7 @@ U.init({
23803
23811
  }
23804
23812
  });
23805
23813
  function sB(t) {
23806
- const e = new le();
23814
+ const e = new ue();
23807
23815
  e.get("/", (s) => s.json({
23808
23816
  name: "authhero"
23809
23817
  }));