authhero 0.106.0 → 0.107.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
@@ -361,8 +361,8 @@ class es extends zs {
361
361
  }
362
362
  const f = this.resolve(e, n);
363
363
  let m = f == null ? void 0 : f.res;
364
- const v = (f == null ? void 0 : f.usedKey) || o, h = (f == null ? void 0 : f.exactUsedKey) || o, _ = Object.prototype.toString.apply(m), w = ["[object Number]", "[object Function]", "[object RegExp]"], S = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, j = !this.i18nFormat || this.i18nFormat.handleAsObject, T = !re(m) && typeof m != "boolean" && typeof m != "number";
365
- if (j && m && T && w.indexOf(_) < 0 && !(re(S) && Array.isArray(m))) {
364
+ const v = (f == null ? void 0 : f.usedKey) || o, h = (f == null ? void 0 : f.exactUsedKey) || o, _ = Object.prototype.toString.apply(m), w = ["[object Number]", "[object Function]", "[object RegExp]"], A = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, C = !this.i18nFormat || this.i18nFormat.handleAsObject, B = !re(m) && typeof m != "boolean" && typeof m != "number";
365
+ if (C && m && B && w.indexOf(_) < 0 && !(re(A) && 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, {
@@ -384,8 +384,8 @@ class es extends zs {
384
384
  }
385
385
  m = ee;
386
386
  }
387
- } else if (j && re(S) && Array.isArray(m))
388
- m = m.join(S), m && (m = this.extendTranslation(m, e, n, r));
387
+ } else if (C && re(A) && Array.isArray(m))
388
+ m = m.join(A), m && (m = this.extendTranslation(m, e, n, r));
389
389
  else {
390
390
  let V = !1, ee = !1;
391
391
  const ue = n.count !== void 0 && !re(n.count), de = es.hasDefaultValue(n), He = ue ? this.pluralResolver.getSuffix(u, n.count, n) : "", Me = n.ordinal && ue ? this.pluralResolver.getSuffix(u, n.count, {
@@ -480,17 +480,17 @@ class es extends zs {
480
480
  this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
481
481
  const m = n.count !== void 0 && !re(n.count), v = m && !n.ordinal && n.count === 0, h = 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
  f.forEach((w) => {
483
- var S, j;
484
- this.isValidLookup(r) || (c = w, !Cu[`${_[0]}-${w}`] && ((S = this.utils) != null && S.hasLoadedNamespace) && !((j = this.utils) != null && j.hasLoadedNamespace(c)) && (Cu[`${_[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) => {
483
+ var A, C;
484
+ this.isValidLookup(r) || (c = w, !Cu[`${_[0]}-${w}`] && ((A = this.utils) != null && A.hasLoadedNamespace) && !((C = this.utils) != null && C.hasLoadedNamespace(c)) && (Cu[`${_[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
485
  var ue;
486
486
  if (this.isValidLookup(r)) return;
487
- o = T;
487
+ o = B;
488
488
  const V = [p];
489
489
  if ((ue = this.i18nFormat) != null && ue.addLookupKeys)
490
- this.i18nFormat.addLookupKeys(V, p, T, w, n);
490
+ this.i18nFormat.addLookupKeys(V, p, B, w, n);
491
491
  else {
492
492
  let de;
493
- m && (de = this.pluralResolver.getSuffix(T, n.count, n));
493
+ m && (de = this.pluralResolver.getSuffix(B, n.count, n));
494
494
  const He = `${this.options.pluralSeparator}zero`, Me = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
495
495
  if (m && (V.push(p + de), n.ordinal && de.indexOf(Me) === 0 && V.push(p + de.replace(Me, this.options.pluralSeparator)), v && V.push(p + He)), h) {
496
496
  const Ve = `${p}${this.options.contextSeparator}${n.context}`;
@@ -499,7 +499,7 @@ class es extends zs {
499
499
  }
500
500
  let ee;
501
501
  for (; ee = V.pop(); )
502
- this.isValidLookup(r) || (s = ee, r = this.getResource(T, w, ee, n));
502
+ this.isValidLookup(r) || (s = ee, r = this.getResource(B, w, ee, n));
503
503
  }));
504
504
  });
505
505
  }), {
@@ -699,10 +699,10 @@ class Am {
699
699
  nestingSuffix: h,
700
700
  nestingSuffixEscaped: _,
701
701
  nestingOptionsSeparator: w,
702
- maxReplaces: S,
703
- alwaysFormat: j
702
+ maxReplaces: A,
703
+ alwaysFormat: C
704
704
  } = e.interpolation;
705
- this.escape = n !== void 0 ? n : ym, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? Vn(s) : o || "{{", this.suffix = c ? Vn(c) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = p ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : p || "", this.nestingPrefix = m ? Vn(m) : v || Vn("$t("), this.nestingSuffix = h ? Vn(h) : _ || Vn(")"), this.nestingOptionsSeparator = w || ",", this.maxReplaces = S || 1e3, this.alwaysFormat = j !== void 0 ? j : !1, this.resetRegExp();
705
+ this.escape = n !== void 0 ? n : ym, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? Vn(s) : o || "{{", this.suffix = c ? Vn(c) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = p ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : p || "", this.nestingPrefix = m ? Vn(m) : v || Vn("$t("), this.nestingSuffix = h ? Vn(h) : _ || Vn(")"), this.nestingOptionsSeparator = w || ",", this.maxReplaces = A || 1e3, this.alwaysFormat = C !== void 0 ? C : !1, this.resetRegExp();
706
706
  }
707
707
  reset() {
708
708
  this.options && this.init(this.options);
@@ -716,15 +716,15 @@ class Am {
716
716
  let s, o, c;
717
717
  const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (h) => {
718
718
  if (h.indexOf(this.formatSeparator) < 0) {
719
- const j = Ou(n, l, h, this.options.keySeparator, this.options.ignoreJSONStructure);
720
- return this.alwaysFormat ? this.format(j, void 0, r, {
719
+ const C = Ou(n, l, h, this.options.keySeparator, this.options.ignoreJSONStructure);
720
+ return this.alwaysFormat ? this.format(C, void 0, r, {
721
721
  ...i,
722
722
  ...n,
723
723
  interpolationkey: h
724
- }) : j;
724
+ }) : C;
725
725
  }
726
- const _ = h.split(this.formatSeparator), w = _.shift().trim(), S = _.join(this.formatSeparator).trim();
727
- return this.format(Ou(n, l, w, this.options.keySeparator, this.options.ignoreJSONStructure), S, r, {
726
+ const _ = h.split(this.formatSeparator), w = _.shift().trim(), A = _.join(this.formatSeparator).trim();
727
+ return this.format(Ou(n, l, w, this.options.keySeparator, this.options.ignoreJSONStructure), A, r, {
728
728
  ...i,
729
729
  ...n,
730
730
  interpolationkey: w
@@ -743,8 +743,8 @@ class Am {
743
743
  const _ = s[1].trim();
744
744
  if (o = u(_), o === void 0)
745
745
  if (typeof p == "function") {
746
- const S = p(e, s, i);
747
- o = re(S) ? S : "";
746
+ const A = p(e, s, i);
747
+ o = re(A) ? A : "";
748
748
  } else if (i && Object.prototype.hasOwnProperty.call(i, _))
749
749
  o = "";
750
750
  else if (f) {
@@ -2114,7 +2114,7 @@ const Qm = new ae().openapi(
2114
2114
  return await t.env.data.branding.set(e, n), t.text("OK");
2115
2115
  }
2116
2116
  );
2117
- var C = class extends Error {
2117
+ var N = class extends Error {
2118
2118
  constructor(e = 500, n) {
2119
2119
  super(n == null ? void 0 : n.message, { cause: n == null ? void 0 : n.cause });
2120
2120
  ne(this, "res");
@@ -2177,8 +2177,8 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2177
2177
  } catch {
2178
2178
  }
2179
2179
  try {
2180
- var N;
2181
- return (self.crypto || self.msCrypto).getRandomValues(N = new Uint32Array($)), Array.prototype.slice.call(N);
2180
+ var j;
2181
+ return (self.crypto || self.msCrypto).getRandomValues(j = new Uint32Array($)), Array.prototype.slice.call(j);
2182
2182
  } catch {
2183
2183
  }
2184
2184
  if (!n)
@@ -2192,14 +2192,14 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2192
2192
  }
2193
2193
  n = null, e.setRandomFallback = function($) {
2194
2194
  n = $;
2195
- }, e.genSaltSync = function($, N) {
2195
+ }, e.genSaltSync = function($, j) {
2196
2196
  if ($ = $ || _, typeof $ != "number")
2197
- throw Error("Illegal arguments: " + typeof $ + ", " + typeof N);
2197
+ throw Error("Illegal arguments: " + typeof $ + ", " + typeof j);
2198
2198
  $ < 4 ? $ = 4 : $ > 31 && ($ = 31);
2199
2199
  var E = [];
2200
2200
  return E.push("$2a$"), $ < 10 && E.push("0"), E.push($.toString()), E.push("$"), E.push(f(r(h), h)), E.join("");
2201
- }, e.genSalt = function($, N, E) {
2202
- if (typeof N == "function" && (E = N, N = void 0), typeof $ == "function" && (E = $, $ = void 0), typeof $ > "u")
2201
+ }, e.genSalt = function($, j, E) {
2202
+ if (typeof j == "function" && (E = j, j = void 0), typeof $ == "function" && (E = $, $ = void 0), typeof $ > "u")
2203
2203
  $ = _;
2204
2204
  else if (typeof $ != "number")
2205
2205
  throw Error("illegal arguments: " + typeof $);
@@ -2226,15 +2226,15 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2226
2226
  k(Q);
2227
2227
  });
2228
2228
  });
2229
- }, e.hashSync = function($, N) {
2230
- if (typeof N > "u" && (N = _), typeof N == "number" && (N = e.genSaltSync(N)), typeof $ != "string" || typeof N != "string")
2231
- throw Error("Illegal arguments: " + typeof $ + ", " + typeof N);
2232
- return Ve($, N);
2233
- }, e.hash = function($, N, E, x) {
2229
+ }, e.hashSync = function($, j) {
2230
+ if (typeof j > "u" && (j = _), typeof j == "number" && (j = e.genSaltSync(j)), typeof $ != "string" || typeof j != "string")
2231
+ throw Error("Illegal arguments: " + typeof $ + ", " + typeof j);
2232
+ return Ve($, j);
2233
+ }, e.hash = function($, j, E, x) {
2234
2234
  function k(O) {
2235
- typeof $ == "string" && typeof N == "number" ? e.genSalt(N, function(q, Q) {
2235
+ typeof $ == "string" && typeof j == "number" ? e.genSalt(j, function(q, Q) {
2236
2236
  Ve($, Q, O, x);
2237
- }) : typeof $ == "string" && typeof N == "string" ? Ve($, N, O, x) : o(O.bind(this, Error("Illegal arguments: " + typeof $ + ", " + typeof N)));
2237
+ }) : typeof $ == "string" && typeof j == "string" ? Ve($, j, O, x) : o(O.bind(this, Error("Illegal arguments: " + typeof $ + ", " + typeof j)));
2238
2238
  }
2239
2239
  if (E) {
2240
2240
  if (typeof E != "function")
@@ -2251,27 +2251,27 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2251
2251
  });
2252
2252
  });
2253
2253
  };
2254
- function s($, N) {
2254
+ function s($, j) {
2255
2255
  for (var E = 0, x = 0, k = 0, O = $.length; k < O; ++k)
2256
- $.charCodeAt(k) === N.charCodeAt(k) ? ++E : ++x;
2256
+ $.charCodeAt(k) === j.charCodeAt(k) ? ++E : ++x;
2257
2257
  return E < 0 ? !1 : x === 0;
2258
2258
  }
2259
- e.compareSync = function($, N) {
2260
- if (typeof $ != "string" || typeof N != "string")
2261
- throw Error("Illegal arguments: " + typeof $ + ", " + typeof N);
2262
- return N.length !== 60 ? !1 : s(e.hashSync($, N.substr(0, N.length - 31)), N);
2263
- }, e.compare = function($, N, E, x) {
2259
+ e.compareSync = function($, j) {
2260
+ if (typeof $ != "string" || typeof j != "string")
2261
+ throw Error("Illegal arguments: " + typeof $ + ", " + typeof j);
2262
+ return j.length !== 60 ? !1 : s(e.hashSync($, j.substr(0, j.length - 31)), j);
2263
+ }, e.compare = function($, j, E, x) {
2264
2264
  function k(O) {
2265
- if (typeof $ != "string" || typeof N != "string") {
2266
- o(O.bind(this, Error("Illegal arguments: " + typeof $ + ", " + typeof N)));
2265
+ if (typeof $ != "string" || typeof j != "string") {
2266
+ o(O.bind(this, Error("Illegal arguments: " + typeof $ + ", " + typeof j)));
2267
2267
  return;
2268
2268
  }
2269
- if (N.length !== 60) {
2269
+ if (j.length !== 60) {
2270
2270
  o(O.bind(this, null, !1));
2271
2271
  return;
2272
2272
  }
2273
- e.hash($, N.substr(0, 29), function(q, Q) {
2274
- q ? O(q) : O(null, s(Q, N));
2273
+ e.hash($, j.substr(0, 29), function(q, Q) {
2274
+ q ? O(q) : O(null, s(Q, j));
2275
2275
  }, x);
2276
2276
  }
2277
2277
  if (E) {
@@ -2301,12 +2301,12 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2301
2301
  };
2302
2302
  var o = typeof process < "u" && process && typeof process.nextTick == "function" ? typeof setImmediate == "function" ? setImmediate : process.nextTick : setTimeout;
2303
2303
  function c($) {
2304
- var N = [], E = 0;
2304
+ var j = [], E = 0;
2305
2305
  return v.encodeUTF16toUTF8(function() {
2306
2306
  return E >= $.length ? null : $.charCodeAt(E++);
2307
2307
  }, function(x) {
2308
- N.push(x);
2309
- }), N;
2308
+ j.push(x);
2309
+ }), j;
2310
2310
  }
2311
2311
  var l = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""), u = [
2312
2312
  -1,
@@ -2438,16 +2438,16 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2438
2438
  -1,
2439
2439
  -1
2440
2440
  ], p = String.fromCharCode;
2441
- function f($, N) {
2441
+ function f($, j) {
2442
2442
  var E = 0, x = [], k, O;
2443
- if (N <= 0 || N > $.length)
2444
- throw Error("Illegal len: " + N);
2445
- for (; E < N; ) {
2446
- if (k = $[E++] & 255, x.push(l[k >> 2 & 63]), k = (k & 3) << 4, E >= N) {
2443
+ if (j <= 0 || j > $.length)
2444
+ throw Error("Illegal len: " + j);
2445
+ for (; E < j; ) {
2446
+ if (k = $[E++] & 255, x.push(l[k >> 2 & 63]), k = (k & 3) << 4, E >= j) {
2447
2447
  x.push(l[k & 63]);
2448
2448
  break;
2449
2449
  }
2450
- if (O = $[E++] & 255, k |= O >> 4 & 15, x.push(l[k & 63]), k = (O & 15) << 2, E >= N) {
2450
+ if (O = $[E++] & 255, k |= O >> 4 & 15, x.push(l[k & 63]), k = (O & 15) << 2, E >= j) {
2451
2451
  x.push(l[k & 63]);
2452
2452
  break;
2453
2453
  }
@@ -2455,11 +2455,11 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2455
2455
  }
2456
2456
  return x.join("");
2457
2457
  }
2458
- function m($, N) {
2458
+ function m($, j) {
2459
2459
  var E = 0, x = $.length, k = 0, O = [], q, Q, J, se, fe, H;
2460
- if (N <= 0)
2461
- throw Error("Illegal len: " + N);
2462
- for (; E < x - 1 && k < N && (H = $.charCodeAt(E++), q = H < u.length ? u[H] : -1, H = $.charCodeAt(E++), Q = H < u.length ? u[H] : -1, !(q == -1 || Q == -1 || (fe = q << 2 >>> 0, fe |= (Q & 48) >> 4, O.push(p(fe)), ++k >= N || E >= x) || (H = $.charCodeAt(E++), J = H < u.length ? u[H] : -1, J == -1) || (fe = (Q & 15) << 4 >>> 0, fe |= (J & 60) >> 2, O.push(p(fe)), ++k >= N || E >= x))); )
2460
+ if (j <= 0)
2461
+ throw Error("Illegal len: " + j);
2462
+ for (; E < x - 1 && k < j && (H = $.charCodeAt(E++), q = H < u.length ? u[H] : -1, H = $.charCodeAt(E++), Q = H < u.length ? u[H] : -1, !(q == -1 || Q == -1 || (fe = q << 2 >>> 0, fe |= (Q & 48) >> 4, O.push(p(fe)), ++k >= j || E >= x) || (H = $.charCodeAt(E++), J = H < u.length ? u[H] : -1, J == -1) || (fe = (Q & 15) << 4 >>> 0, fe |= (J & 60) >> 2, O.push(p(fe)), ++k >= j || E >= x))); )
2463
2463
  H = $.charCodeAt(E++), se = H < u.length ? u[H] : -1, fe = (J & 3) << 6 >>> 0, fe |= se, O.push(p(fe)), ++k;
2464
2464
  var $e = [];
2465
2465
  for (E = 0; E < k; E++)
@@ -2468,59 +2468,59 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2468
2468
  }
2469
2469
  var v = function() {
2470
2470
  var $ = {};
2471
- return $.MAX_CODEPOINT = 1114111, $.encodeUTF8 = function(N, E) {
2471
+ return $.MAX_CODEPOINT = 1114111, $.encodeUTF8 = function(j, E) {
2472
2472
  var x = null;
2473
- for (typeof N == "number" && (x = N, N = function() {
2473
+ for (typeof j == "number" && (x = j, j = function() {
2474
2474
  return null;
2475
- }); x !== null || (x = N()) !== null; )
2475
+ }); x !== null || (x = j()) !== null; )
2476
2476
  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;
2477
- }, $.decodeUTF8 = function(N, E) {
2477
+ }, $.decodeUTF8 = function(j, E) {
2478
2478
  for (var x, k, O, q, Q = function(J) {
2479
2479
  J = J.slice(0, J.indexOf(null));
2480
2480
  var se = Error(J.toString());
2481
2481
  throw se.name = "TruncatedError", se.bytes = J, se;
2482
- }; (x = N()) !== null; )
2482
+ }; (x = j()) !== null; )
2483
2483
  if (!(x & 128))
2484
2484
  E(x);
2485
2485
  else if ((x & 224) === 192)
2486
- (k = N()) === null && Q([x, k]), E((x & 31) << 6 | k & 63);
2486
+ (k = j()) === null && Q([x, k]), E((x & 31) << 6 | k & 63);
2487
2487
  else if ((x & 240) === 224)
2488
- ((k = N()) === null || (O = N()) === null) && Q([x, k, O]), E((x & 15) << 12 | (k & 63) << 6 | O & 63);
2488
+ ((k = j()) === null || (O = j()) === null) && Q([x, k, O]), E((x & 15) << 12 | (k & 63) << 6 | O & 63);
2489
2489
  else if ((x & 248) === 240)
2490
- ((k = N()) === null || (O = N()) === null || (q = N()) === null) && Q([x, k, O, q]), E((x & 7) << 18 | (k & 63) << 12 | (O & 63) << 6 | q & 63);
2490
+ ((k = j()) === null || (O = j()) === null || (q = j()) === null) && Q([x, k, O, q]), E((x & 7) << 18 | (k & 63) << 12 | (O & 63) << 6 | q & 63);
2491
2491
  else throw RangeError("Illegal starting byte: " + x);
2492
- }, $.UTF16toUTF8 = function(N, E) {
2493
- for (var x, k = null; (x = k !== null ? k : N()) !== null; ) {
2494
- if (x >= 55296 && x <= 57343 && (k = N()) !== null && k >= 56320 && k <= 57343) {
2492
+ }, $.UTF16toUTF8 = function(j, E) {
2493
+ for (var x, k = null; (x = k !== null ? k : j()) !== null; ) {
2494
+ if (x >= 55296 && x <= 57343 && (k = j()) !== null && k >= 56320 && k <= 57343) {
2495
2495
  E((x - 55296) * 1024 + k - 56320 + 65536), k = null;
2496
2496
  continue;
2497
2497
  }
2498
2498
  E(x);
2499
2499
  }
2500
2500
  k !== null && E(k);
2501
- }, $.UTF8toUTF16 = function(N, E) {
2501
+ }, $.UTF8toUTF16 = function(j, E) {
2502
2502
  var x = null;
2503
- for (typeof N == "number" && (x = N, N = function() {
2503
+ for (typeof j == "number" && (x = j, j = function() {
2504
2504
  return null;
2505
- }); x !== null || (x = N()) !== null; )
2505
+ }); x !== null || (x = j()) !== null; )
2506
2506
  x <= 65535 ? E(x) : (x -= 65536, E((x >> 10) + 55296), E(x % 1024 + 56320)), x = null;
2507
- }, $.encodeUTF16toUTF8 = function(N, E) {
2508
- $.UTF16toUTF8(N, function(x) {
2507
+ }, $.encodeUTF16toUTF8 = function(j, E) {
2508
+ $.UTF16toUTF8(j, function(x) {
2509
2509
  $.encodeUTF8(x, E);
2510
2510
  });
2511
- }, $.decodeUTF8toUTF16 = function(N, E) {
2512
- $.decodeUTF8(N, function(x) {
2511
+ }, $.decodeUTF8toUTF16 = function(j, E) {
2512
+ $.decodeUTF8(j, function(x) {
2513
2513
  $.UTF8toUTF16(x, E);
2514
2514
  });
2515
- }, $.calculateCodePoint = function(N) {
2516
- return N < 128 ? 1 : N < 2048 ? 2 : N < 65536 ? 3 : 4;
2517
- }, $.calculateUTF8 = function(N) {
2518
- for (var E, x = 0; (E = N()) !== null; )
2515
+ }, $.calculateCodePoint = function(j) {
2516
+ return j < 128 ? 1 : j < 2048 ? 2 : j < 65536 ? 3 : 4;
2517
+ }, $.calculateUTF8 = function(j) {
2518
+ for (var E, x = 0; (E = j()) !== null; )
2519
2519
  x += $.calculateCodePoint(E);
2520
2520
  return x;
2521
- }, $.calculateUTF16asUTF8 = function(N) {
2521
+ }, $.calculateUTF16asUTF8 = function(j) {
2522
2522
  var E = 0, x = 0;
2523
- return $.UTF16toUTF8(N, function(k) {
2523
+ return $.UTF16toUTF8(j, function(k) {
2524
2524
  ++E, x += $.calculateCodePoint(k);
2525
2525
  }), [E, x];
2526
2526
  }, $;
@@ -2528,7 +2528,7 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2528
2528
  Date.now = Date.now || function() {
2529
2529
  return +/* @__PURE__ */ new Date();
2530
2530
  };
2531
- var h = 16, _ = 10, w = 16, S = 100, j = [
2531
+ var h = 16, _ = 10, w = 16, A = 100, C = [
2532
2532
  608135816,
2533
2533
  2242054355,
2534
2534
  320440878,
@@ -2547,7 +2547,7 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2547
2547
  3041331479,
2548
2548
  2450970073,
2549
2549
  2306472731
2550
- ], T = [
2550
+ ], B = [
2551
2551
  3509652390,
2552
2552
  2564797868,
2553
2553
  805139163,
@@ -3580,32 +3580,32 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
3580
3580
  1668446532,
3581
3581
  1869963892
3582
3582
  ];
3583
- function ee($, N, E, x) {
3584
- var k, O = $[N], q = $[N + 1];
3585
- 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], q ^= k ^ E[1], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[3], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[5], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[7], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[9], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[11], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[13], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[15], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 255], O ^= k ^ E[16], $[N] = q ^ E[w + 1], $[N + 1] = O, $;
3583
+ function ee($, j, E, x) {
3584
+ var k, O = $[j], q = $[j + 1];
3585
+ 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], q ^= k ^ E[1], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[3], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[5], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[7], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[9], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[11], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[13], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 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], q ^= k ^ E[15], k = x[q >>> 24], k += x[256 | q >> 16 & 255], k ^= x[512 | q >> 8 & 255], k += x[768 | q & 255], O ^= k ^ E[16], $[j] = q ^ E[w + 1], $[j + 1] = O, $;
3586
3586
  }
3587
- function ue($, N) {
3587
+ function ue($, j) {
3588
3588
  for (var E = 0, x = 0; E < 4; ++E)
3589
- x = x << 8 | $[N] & 255, N = (N + 1) % $.length;
3590
- return { key: x, offp: N };
3589
+ x = x << 8 | $[j] & 255, j = (j + 1) % $.length;
3590
+ return { key: x, offp: j };
3591
3591
  }
3592
- function de($, N, E) {
3593
- for (var x = 0, k = [0, 0], O = N.length, q = E.length, Q, J = 0; J < O; J++)
3594
- Q = ue($, x), x = Q.offp, N[J] = N[J] ^ Q.key;
3592
+ function de($, j, E) {
3593
+ for (var x = 0, k = [0, 0], O = j.length, q = E.length, Q, J = 0; J < O; J++)
3594
+ Q = ue($, x), x = Q.offp, j[J] = j[J] ^ Q.key;
3595
3595
  for (J = 0; J < O; J += 2)
3596
- k = ee(k, 0, N, E), N[J] = k[0], N[J + 1] = k[1];
3596
+ k = ee(k, 0, j, E), j[J] = k[0], j[J + 1] = k[1];
3597
3597
  for (J = 0; J < q; J += 2)
3598
- k = ee(k, 0, N, E), E[J] = k[0], E[J + 1] = k[1];
3598
+ k = ee(k, 0, j, E), E[J] = k[0], E[J + 1] = k[1];
3599
3599
  }
3600
- function He($, N, E, x) {
3600
+ function He($, j, E, x) {
3601
3601
  for (var k = 0, O = [0, 0], q = E.length, Q = x.length, J, se = 0; se < q; se++)
3602
- J = ue(N, k), k = J.offp, E[se] = E[se] ^ J.key;
3602
+ J = ue(j, k), k = J.offp, E[se] = E[se] ^ J.key;
3603
3603
  for (k = 0, se = 0; se < q; se += 2)
3604
3604
  J = ue($, k), k = J.offp, O[0] ^= J.key, J = ue($, k), k = J.offp, O[1] ^= J.key, O = ee(O, 0, E, x), E[se] = O[0], E[se + 1] = O[1];
3605
3605
  for (se = 0; se < Q; se += 2)
3606
3606
  J = ue($, k), k = J.offp, O[0] ^= J.key, J = ue($, k), k = J.offp, O[1] ^= J.key, O = ee(O, 0, E, x), x[se] = O[0], x[se + 1] = O[1];
3607
3607
  }
3608
- function Me($, N, E, x, k) {
3608
+ function Me($, j, E, x, k) {
3609
3609
  var O = V.slice(), q = O.length, Q;
3610
3610
  if (E < 4 || E > 31)
3611
3611
  if (Q = Error("Illegal number of rounds (4-31): " + E), x) {
@@ -3613,18 +3613,18 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
3613
3613
  return;
3614
3614
  } else
3615
3615
  throw Q;
3616
- if (N.length !== h)
3617
- if (Q = Error("Illegal salt length: " + N.length + " != " + h), x) {
3616
+ if (j.length !== h)
3617
+ if (Q = Error("Illegal salt length: " + j.length + " != " + h), x) {
3618
3618
  o(x.bind(this, Q));
3619
3619
  return;
3620
3620
  } else
3621
3621
  throw Q;
3622
3622
  E = 1 << E >>> 0;
3623
3623
  var J, se, fe = 0, H;
3624
- Int32Array ? (J = new Int32Array(j), se = new Int32Array(T)) : (J = j.slice(), se = T.slice()), He(N, $, J, se);
3624
+ Int32Array ? (J = new Int32Array(C), se = new Int32Array(B)) : (J = C.slice(), se = B.slice()), He(j, $, J, se);
3625
3625
  function $e() {
3626
3626
  if (k && k(fe / E), fe < E)
3627
- for (var me = Date.now(); fe < E && (fe = fe + 1, de($, J, se), de(N, J, se), !(Date.now() - me > S)); )
3627
+ for (var me = Date.now(); fe < E && (fe = fe + 1, de($, J, se), de(j, J, se), !(Date.now() - me > A)); )
3628
3628
  ;
3629
3629
  else {
3630
3630
  for (fe = 0; fe < 64; fe++)
@@ -3648,39 +3648,39 @@ const n_ = {}, r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
3648
3648
  if (typeof (dn = $e()) < "u")
3649
3649
  return dn || [];
3650
3650
  }
3651
- function Ve($, N, E, x) {
3651
+ function Ve($, j, E, x) {
3652
3652
  var k;
3653
- if (typeof $ != "string" || typeof N != "string")
3653
+ if (typeof $ != "string" || typeof j != "string")
3654
3654
  if (k = Error("Invalid string / salt: Not a string"), E) {
3655
3655
  o(E.bind(this, k));
3656
3656
  return;
3657
3657
  } else
3658
3658
  throw k;
3659
3659
  var O, q;
3660
- if (N.charAt(0) !== "$" || N.charAt(1) !== "2")
3661
- if (k = Error("Invalid salt version: " + N.substring(0, 2)), E) {
3660
+ if (j.charAt(0) !== "$" || j.charAt(1) !== "2")
3661
+ if (k = Error("Invalid salt version: " + j.substring(0, 2)), E) {
3662
3662
  o(E.bind(this, k));
3663
3663
  return;
3664
3664
  } else
3665
3665
  throw k;
3666
- if (N.charAt(2) === "$")
3666
+ if (j.charAt(2) === "$")
3667
3667
  O = "\0", q = 3;
3668
3668
  else {
3669
- if (O = N.charAt(2), O !== "a" && O !== "b" && O !== "y" || N.charAt(3) !== "$")
3670
- if (k = Error("Invalid salt revision: " + N.substring(2, 4)), E) {
3669
+ if (O = j.charAt(2), O !== "a" && O !== "b" && O !== "y" || j.charAt(3) !== "$")
3670
+ if (k = Error("Invalid salt revision: " + j.substring(2, 4)), E) {
3671
3671
  o(E.bind(this, k));
3672
3672
  return;
3673
3673
  } else
3674
3674
  throw k;
3675
3675
  q = 4;
3676
3676
  }
3677
- if (N.charAt(q + 2) > "$")
3677
+ if (j.charAt(q + 2) > "$")
3678
3678
  if (k = Error("Missing salt rounds"), E) {
3679
3679
  o(E.bind(this, k));
3680
3680
  return;
3681
3681
  } else
3682
3682
  throw k;
3683
- var Q = parseInt(N.substring(q, q + 1), 10) * 10, J = parseInt(N.substring(q + 1, q + 2), 10), se = Q + J, fe = N.substring(q + 3, q + 25);
3683
+ var Q = parseInt(j.substring(q, q + 1), 10) * 10, J = parseInt(j.substring(q + 1, q + 2), 10), se = Q + J, fe = j.substring(q + 3, q + 25);
3684
3684
  $ += O >= "a" ? "\0" : "";
3685
3685
  var H = c($), $e = m(fe, h);
3686
3686
  function dn(me) {
@@ -5203,21 +5203,21 @@ function G0(t, e, n) {
5203
5203
  async function J0(t, e, n, r, i) {
5204
5204
  var m, v, h;
5205
5205
  if (!n.redirect_uri)
5206
- throw new C(400, {
5206
+ throw new N(400, {
5207
5207
  message: "Missing redirect_uri in authParams"
5208
5208
  });
5209
5209
  const [s] = await t.env.data.keys.list();
5210
5210
  if (!s)
5211
- throw new C(500, {
5211
+ throw new N(500, {
5212
5212
  message: "No signing key found"
5213
5213
  });
5214
5214
  if (!((m = e.addons) != null && m.samlp))
5215
- throw new C(400, {
5215
+ throw new N(400, {
5216
5216
  message: `SAML Addon is not enabled for client ${e.id}`
5217
5217
  });
5218
5218
  const { recipient: o, audience: c } = e.addons.samlp, l = n.state || "";
5219
5219
  if (!o || !l || !r || !n.state)
5220
- throw new C(400, {
5220
+ throw new N(400, {
5221
5221
  message: "Missing recipient or inResponseTo"
5222
5222
  });
5223
5223
  const u = JSON.parse(n.state), p = new URL(n.redirect_uri), f = await Z0(t, {
@@ -5538,25 +5538,25 @@ function rn(t) {
5538
5538
  }
5539
5539
  const Ku = ["sub", "iss", "aud", "exp", "nbf", "iat", "jti"];
5540
5540
  async function Ks(t, e) {
5541
- var _, w;
5541
+ var w, A;
5542
5542
  const { authParams: n, user: r, client: i, session_id: s } = e, c = (await t.env.data.keys.list()).filter(
5543
- (S) => !S.revoked_at || new Date(S.revoked_at) > /* @__PURE__ */ new Date()
5543
+ (C) => !C.revoked_at || new Date(C.revoked_at) > /* @__PURE__ */ new Date()
5544
5544
  ), l = c[c.length - 1];
5545
5545
  if (!(l != null && l.pkcs7))
5546
- throw new C(500, { message: "No signing key available" });
5547
- const u = v_(l.pkcs7), p = {
5546
+ throw new N(500, { message: "No signing key available" });
5547
+ const u = v_(l.pkcs7), p = t.var.custom_domain ? `https://${t.var.custom_domain}/` : t.env.ISSUER, f = {
5548
5548
  // TODO: consider if the dafault should be removed
5549
5549
  aud: n.audience || "default",
5550
5550
  scope: n.scope || "",
5551
5551
  sub: (r == null ? void 0 : r.user_id) || n.client_id,
5552
- iss: t.var.custom_domain ? `https://${t.var.custom_domain}/` : t.env.ISSUER,
5552
+ iss: p,
5553
5553
  tenant_id: t.var.tenant_id,
5554
5554
  sid: s
5555
- }, f = r && ((_ = n.scope) != null && _.split(" ").includes("openid")) ? {
5555
+ }, m = r && ((w = n.scope) != null && w.split(" ").includes("openid")) ? {
5556
5556
  // The audience for an id token is the client id
5557
5557
  aud: n.client_id,
5558
5558
  sub: r.user_id,
5559
- iss: t.var.custom_domain ? `https://${t.var.custom_domain}` : t.env.ISSUER,
5559
+ iss: p,
5560
5560
  sid: s,
5561
5561
  nonce: n.nonce,
5562
5562
  given_name: r.given_name,
@@ -5568,7 +5568,7 @@ async function Ks(t, e) {
5568
5568
  email: r.email,
5569
5569
  email_verified: r.email_verified
5570
5570
  } : void 0;
5571
- (w = t.env.hooks) != null && w.onExecuteCredentialsExchange && await t.env.hooks.onExecuteCredentialsExchange(
5571
+ (A = t.env.hooks) != null && A.onExecuteCredentialsExchange && await t.env.hooks.onExecuteCredentialsExchange(
5572
5572
  {
5573
5573
  client: i,
5574
5574
  user: r,
@@ -5583,44 +5583,44 @@ async function Ks(t, e) {
5583
5583
  },
5584
5584
  {
5585
5585
  accessToken: {
5586
- setCustomClaim: (S, j) => {
5587
- if (Ku.includes(S))
5588
- throw new Error(`Cannot overwrite reserved claim '${S}'`);
5589
- p[S] = j;
5586
+ setCustomClaim: (C, B) => {
5587
+ if (Ku.includes(C))
5588
+ throw new Error(`Cannot overwrite reserved claim '${C}'`);
5589
+ f[C] = B;
5590
5590
  }
5591
5591
  },
5592
5592
  idToken: {
5593
- setCustomClaim: (S, j) => {
5594
- if (Ku.includes(S))
5595
- throw new Error(`Cannot overwrite reserved claim '${S}'`);
5596
- f && (f[S] = j);
5593
+ setCustomClaim: (C, B) => {
5594
+ if (Ku.includes(C))
5595
+ throw new Error(`Cannot overwrite reserved claim '${C}'`);
5596
+ m && (m[C] = B);
5597
5597
  }
5598
5598
  },
5599
5599
  access: {
5600
- deny: (S) => {
5601
- throw new C(400, {
5602
- message: `Access denied: ${S}`
5600
+ deny: (C) => {
5601
+ throw new N(400, {
5602
+ message: `Access denied: ${C}`
5603
5603
  });
5604
5604
  }
5605
5605
  }
5606
5606
  }
5607
5607
  );
5608
- const m = {
5608
+ const v = {
5609
5609
  includeIssuedTimestamp: !0,
5610
5610
  expiresIn: new Qc(1, "d"),
5611
5611
  headers: {
5612
5612
  kid: l.kid
5613
5613
  }
5614
- }, v = await qu(
5614
+ }, h = await qu(
5615
5615
  "RS256",
5616
5616
  u,
5617
- p,
5618
- m
5619
- ), h = f ? await qu("RS256", u, f, m) : void 0;
5617
+ f,
5618
+ v
5619
+ ), _ = m ? await qu("RS256", u, m, v) : void 0;
5620
5620
  return {
5621
- access_token: v,
5621
+ access_token: h,
5622
5622
  refresh_token: e.refresh_token,
5623
- id_token: h,
5623
+ id_token: _,
5624
5624
  token_type: "Bearer",
5625
5625
  expires_in: 86400
5626
5626
  };
@@ -5733,7 +5733,7 @@ async function sn(t, e) {
5733
5733
  })
5734
5734
  ), s) {
5735
5735
  if (!e.loginSession)
5736
- throw new C(500, {
5736
+ throw new N(500, {
5737
5737
  message: "Login session not found"
5738
5738
  });
5739
5739
  const h = y_(), _ = Ae(12), w = await t.env.data.codes.create(i.tenant.id, {
@@ -5753,7 +5753,7 @@ async function sn(t, e) {
5753
5753
  let c = e.refreshToken, l = e.sessionId, u = r;
5754
5754
  if (!l) {
5755
5755
  if (!e.loginSession)
5756
- throw new C(500, {
5756
+ throw new N(500, {
5757
5757
  message: "Login session not found"
5758
5758
  });
5759
5759
  u = await iy(t, t.env.data)(
@@ -5795,7 +5795,7 @@ async function sn(t, e) {
5795
5795
  if ((n.response_type || Yt.CODE) === Yt.CODE) {
5796
5796
  const h = await If(t, e);
5797
5797
  if (!n.redirect_uri)
5798
- throw new C(400, {
5798
+ throw new N(400, {
5799
5799
  message: "Redirect uri not found"
5800
5800
  });
5801
5801
  const _ = new URL(n.redirect_uri);
@@ -5949,7 +5949,7 @@ async function oy(t, e, n, r) {
5949
5949
  type: _e.FAILED_SIGNUP,
5950
5950
  description: "Public signup is disabled"
5951
5951
  });
5952
- throw await n.logs.create(e.tenant.id, l), new C(400, {
5952
+ throw await n.logs.create(e.tenant.id, l), new N(400, {
5953
5953
  message: "Signups are disabled for this client"
5954
5954
  });
5955
5955
  }
@@ -6142,7 +6142,7 @@ const Wu = Pn.extend({
6142
6142
  v.linked_to
6143
6143
  );
6144
6144
  if (!h)
6145
- throw new C(500, {
6145
+ throw new N(500, {
6146
6146
  message: "Primary account not found"
6147
6147
  });
6148
6148
  return t.json([Bt.parse(h)]);
@@ -6197,9 +6197,9 @@ const Wu = Pn.extend({
6197
6197
  async (t) => {
6198
6198
  const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), r = await t.env.data.users.get(n, e);
6199
6199
  if (!r)
6200
- throw new C(404);
6200
+ throw new N(404);
6201
6201
  if (r.linked_to)
6202
- throw new C(404, {
6202
+ throw new N(404, {
6203
6203
  message: "User is linked to another user"
6204
6204
  });
6205
6205
  return t.json(r);
@@ -6231,7 +6231,7 @@ const Wu = Pn.extend({
6231
6231
  async (t) => {
6232
6232
  const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header");
6233
6233
  if (!await t.env.data.users.remove(n, e))
6234
- throw new C(404);
6234
+ throw new N(404);
6235
6235
  return t.text("OK");
6236
6236
  }
6237
6237
  ).openapi(
@@ -6272,7 +6272,7 @@ const Wu = Pn.extend({
6272
6272
  t.set("body", n);
6273
6273
  const { email: r } = n;
6274
6274
  if (!r)
6275
- throw new C(400, { message: "Email is required" });
6275
+ throw new N(400, { message: "Email is required" });
6276
6276
  const i = r.toLowerCase(), s = `${n.provider}|${n.user_id || Ds()}`;
6277
6277
  try {
6278
6278
  const o = await t.env.data.users.create(e, {
@@ -6309,7 +6309,7 @@ const Wu = Pn.extend({
6309
6309
  status: 201
6310
6310
  });
6311
6311
  } catch (o) {
6312
- throw o.message === "User already exists" ? new C(409, {
6312
+ throw o.message === "User already exists" ? new N(409, {
6313
6313
  message: "User already exists"
6314
6314
  }) : o;
6315
6315
  }
@@ -6353,7 +6353,7 @@ const Wu = Pn.extend({
6353
6353
  var p;
6354
6354
  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);
6355
6355
  if (!l)
6356
- throw new C(404);
6356
+ throw new N(404);
6357
6357
  if (c.email && c.email !== l.email) {
6358
6358
  const f = await ol(
6359
6359
  t.env.data.users,
@@ -6361,12 +6361,12 @@ const Wu = Pn.extend({
6361
6361
  c.email
6362
6362
  );
6363
6363
  if (f.length && f.some((m) => m.user_id !== i))
6364
- throw new C(409, {
6364
+ throw new N(409, {
6365
6365
  message: "Another user with the same email address already exists."
6366
6366
  });
6367
6367
  }
6368
6368
  if (l.linked_to)
6369
- throw new C(404, {
6369
+ throw new N(404, {
6370
6370
  // not the auth0 error message but I'd rather deviate here
6371
6371
  message: "User is linked to another user"
6372
6372
  });
@@ -6375,7 +6375,7 @@ const Wu = Pn.extend({
6375
6375
  (h) => h.connection === "Username-Password-Authentication"
6376
6376
  );
6377
6377
  if (!f)
6378
- throw new C(400, {
6378
+ throw new N(400, {
6379
6379
  message: "User does not have a password identity"
6380
6380
  });
6381
6381
  const m = {
@@ -6390,7 +6390,7 @@ const Wu = Pn.extend({
6390
6390
  }
6391
6391
  const u = await t.env.data.users.get(n, i);
6392
6392
  if (!u)
6393
- throw new C(500);
6393
+ throw new N(500);
6394
6394
  return t.json(u);
6395
6395
  }
6396
6396
  ).openapi(
@@ -6446,7 +6446,7 @@ const Wu = Pn.extend({
6446
6446
  async (t) => {
6447
6447
  const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), { user_id: r } = t.req.valid("param"), i = "link_with" in n ? n.link_with : n.user_id, s = await t.env.data.users.get(e, r);
6448
6448
  if (!s)
6449
- throw new C(400, {
6449
+ throw new N(400, {
6450
6450
  message: "Linking an inexistent identity is not allowed."
6451
6451
  });
6452
6452
  await t.env.data.users.update(e, i, {
@@ -6506,7 +6506,7 @@ const Wu = Pn.extend({
6506
6506
  );
6507
6507
  const s = await t.env.data.users.get(e, n);
6508
6508
  if (!s)
6509
- throw new C(404);
6509
+ throw new N(404);
6510
6510
  return t.json([Bt.parse(s)]);
6511
6511
  }
6512
6512
  ).openapi(
@@ -6601,106 +6601,106 @@ var Gu;
6601
6601
  } : function() {
6602
6602
  return Ho({});
6603
6603
  },
6604
- has: u ? function(A, I) {
6605
- return r.call(A, I);
6606
- } : function(A, I) {
6607
- return I in A;
6604
+ has: u ? function(S, I) {
6605
+ return r.call(S, I);
6606
+ } : function(S, I) {
6607
+ return I in S;
6608
6608
  },
6609
- get: u ? function(A, I) {
6610
- return r.call(A, I) ? A[I] : void 0;
6611
- } : function(A, I) {
6612
- return A[I];
6613
- }
6614
- }, f = Object.getPrototypeOf(Function), m = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : om(), v = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : am(), h = typeof WeakMap == "function" ? WeakMap : cm(), _ = i ? Symbol.for("@reflect-metadata:registry") : void 0, w = rm(), S = im(w);
6615
- function j(A, I, B, M) {
6616
- if (H(B)) {
6617
- if (!gu(A))
6609
+ get: u ? function(S, I) {
6610
+ return r.call(S, I) ? S[I] : void 0;
6611
+ } : function(S, I) {
6612
+ return S[I];
6613
+ }
6614
+ }, f = Object.getPrototypeOf(Function), m = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : om(), v = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : am(), h = typeof WeakMap == "function" ? WeakMap : cm(), _ = i ? Symbol.for("@reflect-metadata:registry") : void 0, w = rm(), A = im(w);
6615
+ function C(S, I, T, M) {
6616
+ if (H(T)) {
6617
+ if (!gu(S))
6618
6618
  throw new TypeError();
6619
6619
  if (!mu(I))
6620
6620
  throw new TypeError();
6621
- return N(A, I);
6621
+ return j(S, I);
6622
6622
  } else {
6623
- if (!gu(A))
6623
+ if (!gu(S))
6624
6624
  throw new TypeError();
6625
6625
  if (!me(I))
6626
6626
  throw new TypeError();
6627
6627
  if (!me(M) && !H(M) && !$e(M))
6628
6628
  throw new TypeError();
6629
- return $e(M) && (M = void 0), B = kt(B), E(A, I, B, M);
6629
+ return $e(M) && (M = void 0), T = kt(T), E(S, I, T, M);
6630
6630
  }
6631
6631
  }
6632
- e("decorate", j);
6633
- function T(A, I) {
6634
- function B(M, te) {
6632
+ e("decorate", C);
6633
+ function B(S, I) {
6634
+ function T(M, te) {
6635
6635
  if (!me(M))
6636
6636
  throw new TypeError();
6637
6637
  if (!H(te) && !tm(te))
6638
6638
  throw new TypeError();
6639
- Q(A, I, M, te);
6639
+ Q(S, I, M, te);
6640
6640
  }
6641
- return B;
6641
+ return T;
6642
6642
  }
6643
- e("metadata", T);
6644
- function V(A, I, B, M) {
6645
- if (!me(B))
6643
+ e("metadata", B);
6644
+ function V(S, I, T, M) {
6645
+ if (!me(T))
6646
6646
  throw new TypeError();
6647
- return H(M) || (M = kt(M)), Q(A, I, B, M);
6647
+ return H(M) || (M = kt(M)), Q(S, I, T, M);
6648
6648
  }
6649
6649
  e("defineMetadata", V);
6650
- function ee(A, I, B) {
6650
+ function ee(S, I, T) {
6651
6651
  if (!me(I))
6652
6652
  throw new TypeError();
6653
- return H(B) || (B = kt(B)), x(A, I, B);
6653
+ return H(T) || (T = kt(T)), x(S, I, T);
6654
6654
  }
6655
6655
  e("hasMetadata", ee);
6656
- function ue(A, I, B) {
6656
+ function ue(S, I, T) {
6657
6657
  if (!me(I))
6658
6658
  throw new TypeError();
6659
- return H(B) || (B = kt(B)), k(A, I, B);
6659
+ return H(T) || (T = kt(T)), k(S, I, T);
6660
6660
  }
6661
6661
  e("hasOwnMetadata", ue);
6662
- function de(A, I, B) {
6662
+ function de(S, I, T) {
6663
6663
  if (!me(I))
6664
6664
  throw new TypeError();
6665
- return H(B) || (B = kt(B)), O(A, I, B);
6665
+ return H(T) || (T = kt(T)), O(S, I, T);
6666
6666
  }
6667
6667
  e("getMetadata", de);
6668
- function He(A, I, B) {
6668
+ function He(S, I, T) {
6669
6669
  if (!me(I))
6670
6670
  throw new TypeError();
6671
- return H(B) || (B = kt(B)), q(A, I, B);
6671
+ return H(T) || (T = kt(T)), q(S, I, T);
6672
6672
  }
6673
6673
  e("getOwnMetadata", He);
6674
- function Me(A, I) {
6675
- if (!me(A))
6674
+ function Me(S, I) {
6675
+ if (!me(S))
6676
6676
  throw new TypeError();
6677
- return H(I) || (I = kt(I)), J(A, I);
6677
+ return H(I) || (I = kt(I)), J(S, I);
6678
6678
  }
6679
6679
  e("getMetadataKeys", Me);
6680
- function Ve(A, I) {
6681
- if (!me(A))
6680
+ function Ve(S, I) {
6681
+ if (!me(S))
6682
6682
  throw new TypeError();
6683
- return H(I) || (I = kt(I)), se(A, I);
6683
+ return H(I) || (I = kt(I)), se(S, I);
6684
6684
  }
6685
6685
  e("getOwnMetadataKeys", Ve);
6686
- function $(A, I, B) {
6686
+ function $(S, I, T) {
6687
6687
  if (!me(I))
6688
6688
  throw new TypeError();
6689
- if (H(B) || (B = kt(B)), !me(I))
6689
+ if (H(T) || (T = kt(T)), !me(I))
6690
6690
  throw new TypeError();
6691
- H(B) || (B = kt(B));
6691
+ H(T) || (T = kt(T));
6692
6692
  var M = Sr(
6693
6693
  I,
6694
- B,
6694
+ T,
6695
6695
  /*Create*/
6696
6696
  !1
6697
6697
  );
6698
- return H(M) ? !1 : M.OrdinaryDeleteMetadata(A, I, B);
6698
+ return H(M) ? !1 : M.OrdinaryDeleteMetadata(S, I, T);
6699
6699
  }
6700
6700
  e("deleteMetadata", $);
6701
- function N(A, I) {
6702
- for (var B = A.length - 1; B >= 0; --B) {
6703
- var M = A[B], te = M(I);
6701
+ function j(S, I) {
6702
+ for (var T = S.length - 1; T >= 0; --T) {
6703
+ var M = S[T], te = M(I);
6704
6704
  if (!H(te) && !$e(te)) {
6705
6705
  if (!mu(te))
6706
6706
  throw new TypeError();
@@ -6709,9 +6709,9 @@ var Gu;
6709
6709
  }
6710
6710
  return I;
6711
6711
  }
6712
- function E(A, I, B, M) {
6713
- for (var te = A.length - 1; te >= 0; --te) {
6714
- var Oe = A[te], Ce = Oe(I, B, M);
6712
+ function E(S, I, T, M) {
6713
+ for (var te = S.length - 1; te >= 0; --te) {
6714
+ var Oe = S[te], Ce = Oe(I, T, M);
6715
6715
  if (!H(Ce) && !$e(Ce)) {
6716
6716
  if (!me(Ce))
6717
6717
  throw new TypeError();
@@ -6720,59 +6720,59 @@ var Gu;
6720
6720
  }
6721
6721
  return M;
6722
6722
  }
6723
- function x(A, I, B) {
6724
- var M = k(A, I, B);
6723
+ function x(S, I, T) {
6724
+ var M = k(S, I, T);
6725
6725
  if (M)
6726
6726
  return !0;
6727
6727
  var te = Fo(I);
6728
- return $e(te) ? !1 : x(A, te, B);
6728
+ return $e(te) ? !1 : x(S, te, T);
6729
6729
  }
6730
- function k(A, I, B) {
6730
+ function k(S, I, T) {
6731
6731
  var M = Sr(
6732
6732
  I,
6733
- B,
6733
+ T,
6734
6734
  /*Create*/
6735
6735
  !1
6736
6736
  );
6737
- return H(M) ? !1 : hu(M.OrdinaryHasOwnMetadata(A, I, B));
6737
+ return H(M) ? !1 : hu(M.OrdinaryHasOwnMetadata(S, I, T));
6738
6738
  }
6739
- function O(A, I, B) {
6740
- var M = k(A, I, B);
6739
+ function O(S, I, T) {
6740
+ var M = k(S, I, T);
6741
6741
  if (M)
6742
- return q(A, I, B);
6742
+ return q(S, I, T);
6743
6743
  var te = Fo(I);
6744
6744
  if (!$e(te))
6745
- return O(A, te, B);
6745
+ return O(S, te, T);
6746
6746
  }
6747
- function q(A, I, B) {
6747
+ function q(S, I, T) {
6748
6748
  var M = Sr(
6749
6749
  I,
6750
- B,
6750
+ T,
6751
6751
  /*Create*/
6752
6752
  !1
6753
6753
  );
6754
6754
  if (!H(M))
6755
- return M.OrdinaryGetOwnMetadata(A, I, B);
6755
+ return M.OrdinaryGetOwnMetadata(S, I, T);
6756
6756
  }
6757
- function Q(A, I, B, M) {
6757
+ function Q(S, I, T, M) {
6758
6758
  var te = Sr(
6759
- B,
6759
+ T,
6760
6760
  M,
6761
6761
  /*Create*/
6762
6762
  !0
6763
6763
  );
6764
- te.OrdinaryDefineOwnMetadata(A, I, B, M);
6764
+ te.OrdinaryDefineOwnMetadata(S, I, T, M);
6765
6765
  }
6766
- function J(A, I) {
6767
- var B = se(A, I), M = Fo(A);
6766
+ function J(S, I) {
6767
+ var T = se(S, I), M = Fo(S);
6768
6768
  if (M === null)
6769
- return B;
6769
+ return T;
6770
6770
  var te = J(M, I);
6771
6771
  if (te.length <= 0)
6772
- return B;
6773
- if (B.length <= 0)
6772
+ return T;
6773
+ if (T.length <= 0)
6774
6774
  return te;
6775
- for (var Oe = new v(), Ce = [], ce = 0, F = B; ce < F.length; ce++) {
6775
+ for (var Oe = new v(), Ce = [], ce = 0, F = T; ce < F.length; ce++) {
6776
6776
  var G = F[ce], Y = Oe.has(G);
6777
6777
  Y || (Oe.add(G), Ce.push(G));
6778
6778
  }
@@ -6782,19 +6782,19 @@ var Gu;
6782
6782
  }
6783
6783
  return Ce;
6784
6784
  }
6785
- function se(A, I) {
6786
- var B = Sr(
6787
- A,
6785
+ function se(S, I) {
6786
+ var T = Sr(
6787
+ S,
6788
6788
  I,
6789
6789
  /*create*/
6790
6790
  !1
6791
6791
  );
6792
- return B ? B.OrdinaryOwnMetadataKeys(A, I) : [];
6792
+ return T ? T.OrdinaryOwnMetadataKeys(S, I) : [];
6793
6793
  }
6794
- function fe(A) {
6795
- if (A === null)
6794
+ function fe(S) {
6795
+ if (S === null)
6796
6796
  return 1;
6797
- switch (typeof A) {
6797
+ switch (typeof S) {
6798
6798
  case "undefined":
6799
6799
  return 0;
6800
6800
  case "boolean":
@@ -6806,86 +6806,86 @@ var Gu;
6806
6806
  case "number":
6807
6807
  return 5;
6808
6808
  case "object":
6809
- return A === null ? 1 : 6;
6809
+ return S === null ? 1 : 6;
6810
6810
  default:
6811
6811
  return 6;
6812
6812
  }
6813
6813
  }
6814
- function H(A) {
6815
- return A === void 0;
6814
+ function H(S) {
6815
+ return S === void 0;
6816
6816
  }
6817
- function $e(A) {
6818
- return A === null;
6817
+ function $e(S) {
6818
+ return S === null;
6819
6819
  }
6820
- function dn(A) {
6821
- return typeof A == "symbol";
6820
+ function dn(S) {
6821
+ return typeof S == "symbol";
6822
6822
  }
6823
- function me(A) {
6824
- return typeof A == "object" ? A !== null : typeof A == "function";
6823
+ function me(S) {
6824
+ return typeof S == "object" ? S !== null : typeof S == "function";
6825
6825
  }
6826
- function Ee(A, I) {
6827
- switch (fe(A)) {
6826
+ function Ee(S, I) {
6827
+ switch (fe(S)) {
6828
6828
  case 0:
6829
- return A;
6829
+ return S;
6830
6830
  case 1:
6831
- return A;
6831
+ return S;
6832
6832
  case 2:
6833
- return A;
6833
+ return S;
6834
6834
  case 3:
6835
- return A;
6835
+ return S;
6836
6836
  case 4:
6837
- return A;
6837
+ return S;
6838
6838
  case 5:
6839
- return A;
6839
+ return S;
6840
6840
  }
6841
- var B = "string", M = _u(A, s);
6841
+ var T = "string", M = _u(S, s);
6842
6842
  if (M !== void 0) {
6843
- var te = M.call(A, B);
6843
+ var te = M.call(S, T);
6844
6844
  if (me(te))
6845
6845
  throw new TypeError();
6846
6846
  return te;
6847
6847
  }
6848
- return Qg(A);
6848
+ return Qg(S);
6849
6849
  }
6850
- function Qg(A, I) {
6851
- var B, M;
6850
+ function Qg(S, I) {
6851
+ var T, M;
6852
6852
  {
6853
- var te = A.toString;
6853
+ var te = S.toString;
6854
6854
  if (ji(te)) {
6855
- var M = te.call(A);
6855
+ var M = te.call(S);
6856
6856
  if (!me(M))
6857
6857
  return M;
6858
6858
  }
6859
- var B = A.valueOf;
6860
- if (ji(B)) {
6861
- var M = B.call(A);
6859
+ var T = S.valueOf;
6860
+ if (ji(T)) {
6861
+ var M = T.call(S);
6862
6862
  if (!me(M))
6863
6863
  return M;
6864
6864
  }
6865
6865
  }
6866
6866
  throw new TypeError();
6867
6867
  }
6868
- function hu(A) {
6869
- return !!A;
6868
+ function hu(S) {
6869
+ return !!S;
6870
6870
  }
6871
- function em(A) {
6872
- return "" + A;
6871
+ function em(S) {
6872
+ return "" + S;
6873
6873
  }
6874
- function kt(A) {
6875
- var I = Ee(A);
6874
+ function kt(S) {
6875
+ var I = Ee(S);
6876
6876
  return dn(I) ? I : em(I);
6877
6877
  }
6878
- function gu(A) {
6879
- return Array.isArray ? Array.isArray(A) : A instanceof Object ? A instanceof Array : Object.prototype.toString.call(A) === "[object Array]";
6878
+ function gu(S) {
6879
+ return Array.isArray ? Array.isArray(S) : S instanceof Object ? S instanceof Array : Object.prototype.toString.call(S) === "[object Array]";
6880
6880
  }
6881
- function ji(A) {
6882
- return typeof A == "function";
6881
+ function ji(S) {
6882
+ return typeof S == "function";
6883
6883
  }
6884
- function mu(A) {
6885
- return typeof A == "function";
6884
+ function mu(S) {
6885
+ return typeof S == "function";
6886
6886
  }
6887
- function tm(A) {
6888
- switch (fe(A)) {
6887
+ function tm(S) {
6888
+ switch (fe(S)) {
6889
6889
  case 3:
6890
6890
  return !0;
6891
6891
  case 4:
@@ -6894,51 +6894,51 @@ var Gu;
6894
6894
  return !1;
6895
6895
  }
6896
6896
  }
6897
- function Do(A, I) {
6898
- return A === I || A !== A && I !== I;
6897
+ function Do(S, I) {
6898
+ return S === I || S !== S && I !== I;
6899
6899
  }
6900
- function _u(A, I) {
6901
- var B = A[I];
6902
- if (B != null) {
6903
- if (!ji(B))
6900
+ function _u(S, I) {
6901
+ var T = S[I];
6902
+ if (T != null) {
6903
+ if (!ji(T))
6904
6904
  throw new TypeError();
6905
- return B;
6905
+ return T;
6906
6906
  }
6907
6907
  }
6908
- function yu(A) {
6909
- var I = _u(A, o);
6908
+ function yu(S) {
6909
+ var I = _u(S, o);
6910
6910
  if (!ji(I))
6911
6911
  throw new TypeError();
6912
- var B = I.call(A);
6913
- if (!me(B))
6912
+ var T = I.call(S);
6913
+ if (!me(T))
6914
6914
  throw new TypeError();
6915
- return B;
6915
+ return T;
6916
6916
  }
6917
- function vu(A) {
6918
- return A.value;
6917
+ function vu(S) {
6918
+ return S.value;
6919
6919
  }
6920
- function wu(A) {
6921
- var I = A.next();
6920
+ function wu(S) {
6921
+ var I = S.next();
6922
6922
  return I.done ? !1 : I;
6923
6923
  }
6924
- function bu(A) {
6925
- var I = A.return;
6926
- I && I.call(A);
6924
+ function bu(S) {
6925
+ var I = S.return;
6926
+ I && I.call(S);
6927
6927
  }
6928
- function Fo(A) {
6929
- var I = Object.getPrototypeOf(A);
6930
- if (typeof A != "function" || A === f || I !== f)
6928
+ function Fo(S) {
6929
+ var I = Object.getPrototypeOf(S);
6930
+ if (typeof S != "function" || S === f || I !== f)
6931
6931
  return I;
6932
- var B = A.prototype, M = B && Object.getPrototypeOf(B);
6932
+ var T = S.prototype, M = T && Object.getPrototypeOf(T);
6933
6933
  if (M == null || M === Object.prototype)
6934
6934
  return I;
6935
6935
  var te = M.constructor;
6936
- return typeof te != "function" || te === A ? I : te;
6936
+ return typeof te != "function" || te === S ? I : te;
6937
6937
  }
6938
6938
  function nm() {
6939
- var A;
6940
- !H(_) && typeof n.Reflect < "u" && !(_ in n.Reflect) && typeof n.Reflect.defineMetadata == "function" && (A = sm(n.Reflect));
6941
- var I, B, M, te = new h(), Oe = {
6939
+ var S;
6940
+ !H(_) && typeof n.Reflect < "u" && !(_ in n.Reflect) && typeof n.Reflect.defineMetadata == "function" && (S = sm(n.Reflect));
6941
+ var I, T, M, te = new h(), Oe = {
6942
6942
  registerProvider: Ce,
6943
6943
  getProvider: F,
6944
6944
  setProvider: Y
@@ -6948,17 +6948,17 @@ var Gu;
6948
6948
  if (!Object.isExtensible(Oe))
6949
6949
  throw new Error("Cannot add provider to a frozen registry.");
6950
6950
  switch (!0) {
6951
- case A === X:
6951
+ case S === X:
6952
6952
  break;
6953
6953
  case H(I):
6954
6954
  I = X;
6955
6955
  break;
6956
6956
  case I === X:
6957
6957
  break;
6958
- case H(B):
6959
- B = X;
6958
+ case H(T):
6959
+ T = X;
6960
6960
  break;
6961
- case B === X:
6961
+ case T === X:
6962
6962
  break;
6963
6963
  default:
6964
6964
  M === void 0 && (M = new v()), M.add(X);
@@ -6969,8 +6969,8 @@ var Gu;
6969
6969
  if (!H(I)) {
6970
6970
  if (I.isProviderFor(X, le))
6971
6971
  return I;
6972
- if (!H(B)) {
6973
- if (B.isProviderFor(X, le))
6972
+ if (!H(T)) {
6973
+ if (T.isProviderFor(X, le))
6974
6974
  return I;
6975
6975
  if (!H(M))
6976
6976
  for (var ye = yu(M); ; ) {
@@ -6983,8 +6983,8 @@ var Gu;
6983
6983
  }
6984
6984
  }
6985
6985
  }
6986
- if (!H(A) && A.isProviderFor(X, le))
6987
- return A;
6986
+ if (!H(S) && S.isProviderFor(X, le))
6987
+ return S;
6988
6988
  }
6989
6989
  function F(X, le) {
6990
6990
  var ye = te.get(X), ke;
@@ -6993,7 +6993,7 @@ var Gu;
6993
6993
  function G(X) {
6994
6994
  if (H(X))
6995
6995
  throw new TypeError();
6996
- return I === X || B === X || !H(M) && M.has(X);
6996
+ return I === X || T === X || !H(M) && M.has(X);
6997
6997
  }
6998
6998
  function Y(X, le, ye) {
6999
6999
  if (!G(ye))
@@ -7009,16 +7009,16 @@ var Gu;
7009
7009
  }
7010
7010
  }
7011
7011
  function rm() {
7012
- var A;
7013
- return !H(_) && me(n.Reflect) && Object.isExtensible(n.Reflect) && (A = n.Reflect[_]), H(A) && (A = nm()), !H(_) && me(n.Reflect) && Object.isExtensible(n.Reflect) && Object.defineProperty(n.Reflect, _, {
7012
+ var S;
7013
+ return !H(_) && me(n.Reflect) && Object.isExtensible(n.Reflect) && (S = n.Reflect[_]), H(S) && (S = nm()), !H(_) && me(n.Reflect) && Object.isExtensible(n.Reflect) && Object.defineProperty(n.Reflect, _, {
7014
7014
  enumerable: !1,
7015
7015
  configurable: !1,
7016
7016
  writable: !1,
7017
- value: A
7018
- }), A;
7017
+ value: S
7018
+ }), S;
7019
7019
  }
7020
- function im(A) {
7021
- var I = new h(), B = {
7020
+ function im(S) {
7021
+ var I = new h(), T = {
7022
7022
  isProviderFor: function(G, Y) {
7023
7023
  var X = I.get(G);
7024
7024
  return H(X) ? !1 : X.has(Y);
@@ -7029,7 +7029,7 @@ var Gu;
7029
7029
  OrdinaryOwnMetadataKeys: ce,
7030
7030
  OrdinaryDeleteMetadata: F
7031
7031
  };
7032
- return w.registerProvider(B), B;
7032
+ return w.registerProvider(T), T;
7033
7033
  function M(G, Y, X) {
7034
7034
  var le = I.get(G), ye = !1;
7035
7035
  if (H(le)) {
@@ -7041,7 +7041,7 @@ var Gu;
7041
7041
  if (H(ke)) {
7042
7042
  if (!X)
7043
7043
  return;
7044
- if (ke = new m(), le.set(Y, ke), !A.setProvider(G, Y, B))
7044
+ if (ke = new m(), le.set(Y, ke), !S.setProvider(G, Y, T))
7045
7045
  throw le.delete(Y), ye && I.delete(G), new Error("Wrong provider for target.");
7046
7046
  }
7047
7047
  return ke;
@@ -7116,32 +7116,32 @@ var Gu;
7116
7116
  return !0;
7117
7117
  }
7118
7118
  }
7119
- function sm(A) {
7120
- var I = A.defineMetadata, B = A.hasOwnMetadata, M = A.getOwnMetadata, te = A.getOwnMetadataKeys, Oe = A.deleteMetadata, Ce = new h(), ce = {
7119
+ function sm(S) {
7120
+ var I = S.defineMetadata, T = S.hasOwnMetadata, M = S.getOwnMetadata, te = S.getOwnMetadataKeys, Oe = S.deleteMetadata, Ce = new h(), ce = {
7121
7121
  isProviderFor: function(F, G) {
7122
7122
  var Y = Ce.get(F);
7123
7123
  return !H(Y) && Y.has(G) ? !0 : te(F, G).length ? (H(Y) && (Y = new v(), Ce.set(F, Y)), Y.add(G), !0) : !1;
7124
7124
  },
7125
7125
  OrdinaryDefineOwnMetadata: I,
7126
- OrdinaryHasOwnMetadata: B,
7126
+ OrdinaryHasOwnMetadata: T,
7127
7127
  OrdinaryGetOwnMetadata: M,
7128
7128
  OrdinaryOwnMetadataKeys: te,
7129
7129
  OrdinaryDeleteMetadata: Oe
7130
7130
  };
7131
7131
  return ce;
7132
7132
  }
7133
- function Sr(A, I, B) {
7134
- var M = w.getProvider(A, I);
7133
+ function Sr(S, I, T) {
7134
+ var M = w.getProvider(S, I);
7135
7135
  if (!H(M))
7136
7136
  return M;
7137
- if (B) {
7138
- if (w.setProvider(A, I, S))
7139
- return S;
7137
+ if (T) {
7138
+ if (w.setProvider(S, I, A))
7139
+ return A;
7140
7140
  throw new Error("Illegal state.");
7141
7141
  }
7142
7142
  }
7143
7143
  function om() {
7144
- var A = {}, I = [], B = (
7144
+ var S = {}, I = [], T = (
7145
7145
  /** @class */
7146
7146
  function() {
7147
7147
  function ce(F, G, Y) {
@@ -7168,7 +7168,7 @@ var Gu;
7168
7168
  /** @class */
7169
7169
  function() {
7170
7170
  function ce() {
7171
- this._keys = [], this._values = [], this._cacheKey = A, this._cacheIndex = -2;
7171
+ this._keys = [], this._values = [], this._cacheKey = S, this._cacheIndex = -2;
7172
7172
  }
7173
7173
  return Object.defineProperty(ce.prototype, "size", {
7174
7174
  get: function() {
@@ -7205,17 +7205,17 @@ var Gu;
7205
7205
  if (G >= 0) {
7206
7206
  for (var Y = this._keys.length, X = G + 1; X < Y; X++)
7207
7207
  this._keys[X - 1] = this._keys[X], this._values[X - 1] = this._values[X];
7208
- return this._keys.length--, this._values.length--, Do(F, this._cacheKey) && (this._cacheKey = A, this._cacheIndex = -2), !0;
7208
+ return this._keys.length--, this._values.length--, Do(F, this._cacheKey) && (this._cacheKey = S, this._cacheIndex = -2), !0;
7209
7209
  }
7210
7210
  return !1;
7211
7211
  }, ce.prototype.clear = function() {
7212
- this._keys.length = 0, this._values.length = 0, this._cacheKey = A, this._cacheIndex = -2;
7212
+ this._keys.length = 0, this._values.length = 0, this._cacheKey = S, this._cacheIndex = -2;
7213
7213
  }, ce.prototype.keys = function() {
7214
- return new B(this._keys, this._values, te);
7214
+ return new T(this._keys, this._values, te);
7215
7215
  }, ce.prototype.values = function() {
7216
- return new B(this._keys, this._values, Oe);
7216
+ return new T(this._keys, this._values, Oe);
7217
7217
  }, ce.prototype.entries = function() {
7218
- return new B(this._keys, this._values, Ce);
7218
+ return new T(this._keys, this._values, Ce);
7219
7219
  }, ce.prototype["@@iterator"] = function() {
7220
7220
  return this.entries();
7221
7221
  }, ce.prototype[o] = function() {
@@ -7245,7 +7245,7 @@ var Gu;
7245
7245
  }
7246
7246
  }
7247
7247
  function am() {
7248
- var A = (
7248
+ var S = (
7249
7249
  /** @class */
7250
7250
  function() {
7251
7251
  function I() {
@@ -7257,12 +7257,12 @@ var Gu;
7257
7257
  },
7258
7258
  enumerable: !0,
7259
7259
  configurable: !0
7260
- }), I.prototype.has = function(B) {
7261
- return this._map.has(B);
7262
- }, I.prototype.add = function(B) {
7263
- return this._map.set(B, B), this;
7264
- }, I.prototype.delete = function(B) {
7265
- return this._map.delete(B);
7260
+ }), I.prototype.has = function(T) {
7261
+ return this._map.has(T);
7262
+ }, I.prototype.add = function(T) {
7263
+ return this._map.set(T, T), this;
7264
+ }, I.prototype.delete = function(T) {
7265
+ return this._map.delete(T);
7266
7266
  }, I.prototype.clear = function() {
7267
7267
  this._map.clear();
7268
7268
  }, I.prototype.keys = function() {
@@ -7278,10 +7278,10 @@ var Gu;
7278
7278
  }, I;
7279
7279
  }()
7280
7280
  );
7281
- return A;
7281
+ return S;
7282
7282
  }
7283
7283
  function cm() {
7284
- var A = 16, I = p.create(), B = M();
7284
+ var S = 16, I = p.create(), T = M();
7285
7285
  return (
7286
7286
  /** @class */
7287
7287
  function() {
@@ -7329,12 +7329,12 @@ var Gu;
7329
7329
  return I[F] = !0, F;
7330
7330
  }
7331
7331
  function te(F, G) {
7332
- if (!r.call(F, B)) {
7332
+ if (!r.call(F, T)) {
7333
7333
  if (!G)
7334
7334
  return;
7335
- Object.defineProperty(F, B, { value: p.create() });
7335
+ Object.defineProperty(F, T, { value: p.create() });
7336
7336
  }
7337
- return F[B];
7337
+ return F[T];
7338
7338
  }
7339
7339
  function Oe(F, G) {
7340
7340
  for (var Y = 0; Y < G; ++Y)
@@ -7349,17 +7349,17 @@ var Gu;
7349
7349
  return Oe(new Array(F), F);
7350
7350
  }
7351
7351
  function ce() {
7352
- var F = Ce(A);
7352
+ var F = Ce(S);
7353
7353
  F[6] = F[6] & 79 | 64, F[8] = F[8] & 191 | 128;
7354
- for (var G = "", Y = 0; Y < A; ++Y) {
7354
+ for (var G = "", Y = 0; Y < S; ++Y) {
7355
7355
  var X = F[Y];
7356
7356
  (Y === 4 || Y === 6 || Y === 8) && (G += "-"), X < 16 && (G += "0"), G += X.toString(16).toLowerCase();
7357
7357
  }
7358
7358
  return G;
7359
7359
  }
7360
7360
  }
7361
- function Ho(A) {
7362
- return A.__ = void 0, delete A.__, A;
7361
+ function Ho(S) {
7362
+ return S.__ = void 0, delete S.__, S;
7363
7363
  }
7364
7364
  });
7365
7365
  })(Gu || (Gu = {}));
@@ -10256,7 +10256,7 @@ class Qy {
10256
10256
  if (!("value" in _.result.valueBlock && Array.isArray(_.result.valueBlock.value)))
10257
10257
  throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");
10258
10258
  const w = _.result.valueBlock.value;
10259
- c[l] = Array.from(w, (S) => m.fromASN(S));
10259
+ c[l] = Array.from(w, (A) => m.fromASN(A));
10260
10260
  } else
10261
10261
  c[l] = Array.from(u, (v) => m.fromASN(v));
10262
10262
  else {
@@ -10439,31 +10439,31 @@ var Oh = { exports: {} };
10439
10439
  function u(h, _) {
10440
10440
  if (h.indexOf("::") !== h.lastIndexOf("::"))
10441
10441
  return null;
10442
- let w = 0, S = -1, j = (h.match(l.zoneIndex) || [])[0], T, V;
10443
- for (j && (j = j.substring(1), h = h.replace(/%.+$/, "")); (S = h.indexOf(":", S + 1)) >= 0; )
10442
+ let w = 0, A = -1, C = (h.match(l.zoneIndex) || [])[0], B, V;
10443
+ for (C && (C = C.substring(1), h = h.replace(/%.+$/, "")); (A = h.indexOf(":", A + 1)) >= 0; )
10444
10444
  w++;
10445
10445
  if (h.substr(0, 2) === "::" && w--, h.substr(-2, 2) === "::" && w--, w > _)
10446
10446
  return null;
10447
- for (V = _ - w, T = ":"; V--; )
10448
- T += "0:";
10449
- return h = h.replace("::", T), h[0] === ":" && (h = h.slice(1)), h[h.length - 1] === ":" && (h = h.slice(0, -1)), _ = function() {
10447
+ for (V = _ - w, B = ":"; V--; )
10448
+ B += "0:";
10449
+ return h = h.replace("::", B), h[0] === ":" && (h = h.slice(1)), h[h.length - 1] === ":" && (h = h.slice(0, -1)), _ = function() {
10450
10450
  const ee = h.split(":"), ue = [];
10451
10451
  for (let de = 0; de < ee.length; de++)
10452
10452
  ue.push(parseInt(ee[de], 16));
10453
10453
  return ue;
10454
10454
  }(), {
10455
10455
  parts: _,
10456
- zoneId: j
10456
+ zoneId: C
10457
10457
  };
10458
10458
  }
10459
- function p(h, _, w, S) {
10459
+ function p(h, _, w, A) {
10460
10460
  if (h.length !== _.length)
10461
10461
  throw new Error("ipaddr: cannot match CIDR for objects with different lengths");
10462
- let j = 0, T;
10463
- for (; S > 0; ) {
10464
- if (T = w - S, T < 0 && (T = 0), h[j] >> T !== _[j] >> T)
10462
+ let C = 0, B;
10463
+ for (; A > 0; ) {
10464
+ if (B = w - A, B < 0 && (B = 0), h[C] >> B !== _[C] >> B)
10465
10465
  return !1;
10466
- S -= w, j += 1;
10466
+ A -= w, C += 1;
10467
10467
  }
10468
10468
  return !0;
10469
10469
  }
@@ -10487,9 +10487,9 @@ var Oh = { exports: {} };
10487
10487
  function h(_) {
10488
10488
  if (_.length !== 4)
10489
10489
  throw new Error("ipaddr: ipv4 octet count should be 4");
10490
- let w, S;
10490
+ let w, A;
10491
10491
  for (w = 0; w < _.length; w++)
10492
- if (S = _[w], !(0 <= S && S <= 255))
10492
+ if (A = _[w], !(0 <= A && A <= 255))
10493
10493
  throw new Error("ipaddr: ipv4 octet should fit in 8 bits");
10494
10494
  this.octets = _;
10495
10495
  }
@@ -10532,13 +10532,13 @@ var Oh = { exports: {} };
10532
10532
  }, h.prototype.kind = function() {
10533
10533
  return "ipv4";
10534
10534
  }, h.prototype.match = function(_, w) {
10535
- let S;
10536
- if (w === void 0 && (S = _, _ = S[0], w = S[1]), _.kind() !== "ipv4")
10535
+ let A;
10536
+ if (w === void 0 && (A = _, _ = A[0], w = A[1]), _.kind() !== "ipv4")
10537
10537
  throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");
10538
10538
  return p(this.octets, _.octets, 8, w);
10539
10539
  }, h.prototype.prefixLengthFromSubnetMask = function() {
10540
10540
  let _ = 0, w = !1;
10541
- const S = {
10541
+ const A = {
10542
10542
  0: 8,
10543
10543
  128: 7,
10544
10544
  192: 6,
@@ -10549,10 +10549,10 @@ var Oh = { exports: {} };
10549
10549
  254: 1,
10550
10550
  255: 0
10551
10551
  };
10552
- let j, T, V;
10553
- for (j = 3; j >= 0; j -= 1)
10554
- if (T = this.octets[j], T in S) {
10555
- if (V = S[T], w && V !== 0)
10552
+ let C, B, V;
10553
+ for (C = 3; C >= 0; C -= 1)
10554
+ if (B = this.octets[C], B in A) {
10555
+ if (V = A[B], w && V !== 0)
10556
10556
  return null;
10557
10557
  V !== 8 && (w = !0), _ += V;
10558
10558
  } else
@@ -10571,11 +10571,11 @@ var Oh = { exports: {} };
10571
10571
  }, h;
10572
10572
  }(), v.IPv4.broadcastAddressFromCIDR = function(h) {
10573
10573
  try {
10574
- const _ = this.parseCIDR(h), w = _[0].toByteArray(), S = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), j = [];
10575
- let T = 0;
10576
- for (; T < 4; )
10577
- j.push(parseInt(w[T], 10) | parseInt(S[T], 10) ^ 255), T++;
10578
- return new this(j);
10574
+ const _ = this.parseCIDR(h), w = _[0].toByteArray(), A = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), C = [];
10575
+ let B = 0;
10576
+ for (; B < 4; )
10577
+ C.push(parseInt(w[B], 10) | parseInt(A[B], 10) ^ 255), B++;
10578
+ return new this(C);
10579
10579
  } catch {
10580
10580
  throw new Error("ipaddr: the address does not have IPv4 CIDR format");
10581
10581
  }
@@ -10596,11 +10596,11 @@ var Oh = { exports: {} };
10596
10596
  }, v.IPv4.isValidFourPartDecimal = function(h) {
10597
10597
  return !!(v.IPv4.isValid(h) && h.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/));
10598
10598
  }, v.IPv4.networkAddressFromCIDR = function(h) {
10599
- let _, w, S, j, T;
10599
+ let _, w, A, C, B;
10600
10600
  try {
10601
- for (_ = this.parseCIDR(h), S = _[0].toByteArray(), T = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), j = [], w = 0; w < 4; )
10602
- j.push(parseInt(S[w], 10) & parseInt(T[w], 10)), w++;
10603
- return new this(j);
10601
+ for (_ = this.parseCIDR(h), A = _[0].toByteArray(), B = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), C = [], w = 0; w < 4; )
10602
+ C.push(parseInt(A[w], 10) & parseInt(B[w], 10)), w++;
10603
+ return new this(C);
10604
10604
  } catch {
10605
10605
  throw new Error("ipaddr: the address does not have IPv4 CIDR format");
10606
10606
  }
@@ -10614,66 +10614,66 @@ var Oh = { exports: {} };
10614
10614
  if (_ = h.match(/^(.+)\/(\d+)$/)) {
10615
10615
  const w = parseInt(_[2]);
10616
10616
  if (w >= 0 && w <= 32) {
10617
- const S = [this.parse(_[1]), w];
10618
- return Object.defineProperty(S, "toString", {
10617
+ const A = [this.parse(_[1]), w];
10618
+ return Object.defineProperty(A, "toString", {
10619
10619
  value: function() {
10620
10620
  return this.join("/");
10621
10621
  }
10622
- }), S;
10622
+ }), A;
10623
10623
  }
10624
10624
  }
10625
10625
  throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range");
10626
10626
  }, v.IPv4.parser = function(h) {
10627
- let _, w, S;
10627
+ let _, w, A;
10628
10628
  if (_ = h.match(r.fourOctet))
10629
10629
  return function() {
10630
- const j = _.slice(1, 6), T = [];
10631
- for (let V = 0; V < j.length; V++)
10632
- w = j[V], T.push(f(w));
10633
- return T;
10630
+ const C = _.slice(1, 6), B = [];
10631
+ for (let V = 0; V < C.length; V++)
10632
+ w = C[V], B.push(f(w));
10633
+ return B;
10634
10634
  }();
10635
10635
  if (_ = h.match(r.longValue)) {
10636
- if (S = f(_[1]), S > 4294967295 || S < 0)
10636
+ if (A = f(_[1]), A > 4294967295 || A < 0)
10637
10637
  throw new Error("ipaddr: address outside defined range");
10638
10638
  return function() {
10639
- const j = [];
10640
- let T;
10641
- for (T = 0; T <= 24; T += 8)
10642
- j.push(S >> T & 255);
10643
- return j;
10639
+ const C = [];
10640
+ let B;
10641
+ for (B = 0; B <= 24; B += 8)
10642
+ C.push(A >> B & 255);
10643
+ return C;
10644
10644
  }().reverse();
10645
10645
  } else return (_ = h.match(r.twoOctet)) ? function() {
10646
- const j = _.slice(1, 4), T = [];
10647
- if (S = f(j[1]), S > 16777215 || S < 0)
10646
+ const C = _.slice(1, 4), B = [];
10647
+ if (A = f(C[1]), A > 16777215 || A < 0)
10648
10648
  throw new Error("ipaddr: address outside defined range");
10649
- return T.push(f(j[0])), T.push(S >> 16 & 255), T.push(S >> 8 & 255), T.push(S & 255), T;
10649
+ return B.push(f(C[0])), B.push(A >> 16 & 255), B.push(A >> 8 & 255), B.push(A & 255), B;
10650
10650
  }() : (_ = h.match(r.threeOctet)) ? function() {
10651
- const j = _.slice(1, 5), T = [];
10652
- if (S = f(j[2]), S > 65535 || S < 0)
10651
+ const C = _.slice(1, 5), B = [];
10652
+ if (A = f(C[2]), A > 65535 || A < 0)
10653
10653
  throw new Error("ipaddr: address outside defined range");
10654
- return T.push(f(j[0])), T.push(f(j[1])), T.push(S >> 8 & 255), T.push(S & 255), T;
10654
+ return B.push(f(C[0])), B.push(f(C[1])), B.push(A >> 8 & 255), B.push(A & 255), B;
10655
10655
  }() : null;
10656
10656
  }, v.IPv4.subnetMaskFromPrefixLength = function(h) {
10657
10657
  if (h = parseInt(h), h < 0 || h > 32)
10658
10658
  throw new Error("ipaddr: invalid IPv4 prefix length");
10659
10659
  const _ = [0, 0, 0, 0];
10660
10660
  let w = 0;
10661
- const S = Math.floor(h / 8);
10662
- for (; w < S; )
10661
+ const A = Math.floor(h / 8);
10662
+ for (; w < A; )
10663
10663
  _[w] = 255, w++;
10664
- return S < 4 && (_[S] = Math.pow(2, h % 8) - 1 << 8 - h % 8), new this(_);
10664
+ return A < 4 && (_[A] = Math.pow(2, h % 8) - 1 << 8 - h % 8), new this(_);
10665
10665
  }, v.IPv6 = function() {
10666
10666
  function h(_, w) {
10667
- let S, j;
10667
+ let A, C;
10668
10668
  if (_.length === 16)
10669
- for (this.parts = [], S = 0; S <= 14; S += 2)
10670
- this.parts.push(_[S] << 8 | _[S + 1]);
10669
+ for (this.parts = [], A = 0; A <= 14; A += 2)
10670
+ this.parts.push(_[A] << 8 | _[A + 1]);
10671
10671
  else if (_.length === 8)
10672
10672
  this.parts = _;
10673
10673
  else
10674
10674
  throw new Error("ipaddr: ipv6 part count should be 8 or 16");
10675
- for (S = 0; S < this.parts.length; S++)
10676
- if (j = this.parts[S], !(0 <= j && j <= 65535))
10675
+ for (A = 0; A < this.parts.length; A++)
10676
+ if (C = this.parts[A], !(0 <= C && C <= 65535))
10677
10677
  throw new Error("ipaddr: ipv6 part should fit in 16 bits");
10678
10678
  w && (this.zoneId = w);
10679
10679
  }
@@ -10717,13 +10717,13 @@ var Oh = { exports: {} };
10717
10717
  }, h.prototype.kind = function() {
10718
10718
  return "ipv6";
10719
10719
  }, h.prototype.match = function(_, w) {
10720
- let S;
10721
- if (w === void 0 && (S = _, _ = S[0], w = S[1]), _.kind() !== "ipv6")
10720
+ let A;
10721
+ if (w === void 0 && (A = _, _ = A[0], w = A[1]), _.kind() !== "ipv6")
10722
10722
  throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");
10723
10723
  return p(this.parts, _.parts, 16, w);
10724
10724
  }, h.prototype.prefixLengthFromSubnetMask = function() {
10725
10725
  let _ = 0, w = !1;
10726
- const S = {
10726
+ const A = {
10727
10727
  0: 16,
10728
10728
  32768: 15,
10729
10729
  49152: 14,
@@ -10742,12 +10742,12 @@ var Oh = { exports: {} };
10742
10742
  65534: 1,
10743
10743
  65535: 0
10744
10744
  };
10745
- let j, T;
10745
+ let C, B;
10746
10746
  for (let V = 7; V >= 0; V -= 1)
10747
- if (j = this.parts[V], j in S) {
10748
- if (T = S[j], w && T !== 0)
10747
+ if (C = this.parts[V], C in A) {
10748
+ if (B = A[C], w && B !== 0)
10749
10749
  return null;
10750
- T !== 16 && (w = !0), _ += T;
10750
+ B !== 16 && (w = !0), _ += B;
10751
10751
  } else
10752
10752
  return null;
10753
10753
  return 128 - _;
@@ -10755,49 +10755,49 @@ var Oh = { exports: {} };
10755
10755
  return v.subnetMatch(this, this.SpecialRanges);
10756
10756
  }, h.prototype.toByteArray = function() {
10757
10757
  let _;
10758
- const w = [], S = this.parts;
10759
- for (let j = 0; j < S.length; j++)
10760
- _ = S[j], w.push(_ >> 8), w.push(_ & 255);
10758
+ const w = [], A = this.parts;
10759
+ for (let C = 0; C < A.length; C++)
10760
+ _ = A[C], w.push(_ >> 8), w.push(_ & 255);
10761
10761
  return w;
10762
10762
  }, h.prototype.toFixedLengthString = function() {
10763
10763
  const _ = (function() {
10764
- const S = [];
10765
- for (let j = 0; j < this.parts.length; j++)
10766
- S.push(m(this.parts[j].toString(16), 4));
10767
- return S;
10764
+ const A = [];
10765
+ for (let C = 0; C < this.parts.length; C++)
10766
+ A.push(m(this.parts[C].toString(16), 4));
10767
+ return A;
10768
10768
  }).call(this).join(":");
10769
10769
  let w = "";
10770
10770
  return this.zoneId && (w = `%${this.zoneId}`), _ + w;
10771
10771
  }, h.prototype.toIPv4Address = function() {
10772
10772
  if (!this.isIPv4MappedAddress())
10773
10773
  throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");
10774
- const _ = this.parts.slice(-2), w = _[0], S = _[1];
10775
- return new v.IPv4([w >> 8, w & 255, S >> 8, S & 255]);
10774
+ const _ = this.parts.slice(-2), w = _[0], A = _[1];
10775
+ return new v.IPv4([w >> 8, w & 255, A >> 8, A & 255]);
10776
10776
  }, h.prototype.toNormalizedString = function() {
10777
10777
  const _ = (function() {
10778
- const S = [];
10779
- for (let j = 0; j < this.parts.length; j++)
10780
- S.push(this.parts[j].toString(16));
10781
- return S;
10778
+ const A = [];
10779
+ for (let C = 0; C < this.parts.length; C++)
10780
+ A.push(this.parts[C].toString(16));
10781
+ return A;
10782
10782
  }).call(this).join(":");
10783
10783
  let w = "";
10784
10784
  return this.zoneId && (w = `%${this.zoneId}`), _ + w;
10785
10785
  }, h.prototype.toRFC5952String = function() {
10786
10786
  const _ = /((^|:)(0(:|$)){2,})/g, w = this.toNormalizedString();
10787
- let S = 0, j = -1, T;
10788
- for (; T = _.exec(w); )
10789
- T[0].length > j && (S = T.index, j = T[0].length);
10790
- return j < 0 ? w : `${w.substring(0, S)}::${w.substring(S + j)}`;
10787
+ let A = 0, C = -1, B;
10788
+ for (; B = _.exec(w); )
10789
+ B[0].length > C && (A = B.index, C = B[0].length);
10790
+ return C < 0 ? w : `${w.substring(0, A)}::${w.substring(A + C)}`;
10791
10791
  }, h.prototype.toString = function() {
10792
10792
  return this.toRFC5952String();
10793
10793
  }, h;
10794
10794
  }(), v.IPv6.broadcastAddressFromCIDR = function(h) {
10795
10795
  try {
10796
- const _ = this.parseCIDR(h), w = _[0].toByteArray(), S = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), j = [];
10797
- let T = 0;
10798
- for (; T < 16; )
10799
- j.push(parseInt(w[T], 10) | parseInt(S[T], 10) ^ 255), T++;
10800
- return new this(j);
10796
+ const _ = this.parseCIDR(h), w = _[0].toByteArray(), A = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), C = [];
10797
+ let B = 0;
10798
+ for (; B < 16; )
10799
+ C.push(parseInt(w[B], 10) | parseInt(A[B], 10) ^ 255), B++;
10800
+ return new this(C);
10801
10801
  } catch (_) {
10802
10802
  throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${_})`);
10803
10803
  }
@@ -10821,11 +10821,11 @@ var Oh = { exports: {} };
10821
10821
  return !1;
10822
10822
  }
10823
10823
  }, v.IPv6.networkAddressFromCIDR = function(h) {
10824
- let _, w, S, j, T;
10824
+ let _, w, A, C, B;
10825
10825
  try {
10826
- for (_ = this.parseCIDR(h), S = _[0].toByteArray(), T = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), j = [], w = 0; w < 16; )
10827
- j.push(parseInt(S[w], 10) & parseInt(T[w], 10)), w++;
10828
- return new this(j);
10826
+ for (_ = this.parseCIDR(h), A = _[0].toByteArray(), B = this.subnetMaskFromPrefixLength(_[1]).toByteArray(), C = [], w = 0; w < 16; )
10827
+ C.push(parseInt(A[w], 10) & parseInt(B[w], 10)), w++;
10828
+ return new this(C);
10829
10829
  } catch (V) {
10830
10830
  throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${V})`);
10831
10831
  }
@@ -10835,30 +10835,30 @@ var Oh = { exports: {} };
10835
10835
  throw new Error("ipaddr: string is not formatted like an IPv6 Address");
10836
10836
  return new this(_.parts, _.zoneId);
10837
10837
  }, v.IPv6.parseCIDR = function(h) {
10838
- let _, w, S;
10838
+ let _, w, A;
10839
10839
  if ((w = h.match(/^(.+)\/(\d+)$/)) && (_ = parseInt(w[2]), _ >= 0 && _ <= 128))
10840
- return S = [this.parse(w[1]), _], Object.defineProperty(S, "toString", {
10840
+ return A = [this.parse(w[1]), _], Object.defineProperty(A, "toString", {
10841
10841
  value: function() {
10842
10842
  return this.join("/");
10843
10843
  }
10844
- }), S;
10844
+ }), A;
10845
10845
  throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range");
10846
10846
  }, v.IPv6.parser = function(h) {
10847
- let _, w, S, j, T, V;
10848
- if (S = h.match(l.deprecatedTransitional))
10849
- return this.parser(`::ffff:${S[1]}`);
10847
+ let _, w, A, C, B, V;
10848
+ if (A = h.match(l.deprecatedTransitional))
10849
+ return this.parser(`::ffff:${A[1]}`);
10850
10850
  if (l.native.test(h))
10851
10851
  return u(h, 8);
10852
- if ((S = h.match(l.transitional)) && (V = S[6] || "", _ = S[1], S[1].endsWith("::") || (_ = _.slice(0, -1)), _ = u(_ + V, 6), _.parts)) {
10853
- for (T = [
10854
- parseInt(S[2]),
10855
- parseInt(S[3]),
10856
- parseInt(S[4]),
10857
- parseInt(S[5])
10858
- ], w = 0; w < T.length; w++)
10859
- if (j = T[w], !(0 <= j && j <= 255))
10852
+ if ((A = h.match(l.transitional)) && (V = A[6] || "", _ = A[1], A[1].endsWith("::") || (_ = _.slice(0, -1)), _ = u(_ + V, 6), _.parts)) {
10853
+ for (B = [
10854
+ parseInt(A[2]),
10855
+ parseInt(A[3]),
10856
+ parseInt(A[4]),
10857
+ parseInt(A[5])
10858
+ ], w = 0; w < B.length; w++)
10859
+ if (C = B[w], !(0 <= C && C <= 255))
10860
10860
  return null;
10861
- return _.parts.push(T[0] << 8 | T[1]), _.parts.push(T[2] << 8 | T[3]), {
10861
+ return _.parts.push(B[0] << 8 | B[1]), _.parts.push(B[2] << 8 | B[3]), {
10862
10862
  parts: _.parts,
10863
10863
  zoneId: _.zoneId
10864
10864
  };
@@ -10869,10 +10869,10 @@ var Oh = { exports: {} };
10869
10869
  throw new Error("ipaddr: invalid IPv6 prefix length");
10870
10870
  const _ = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
10871
10871
  let w = 0;
10872
- const S = Math.floor(h / 8);
10873
- for (; w < S; )
10872
+ const A = Math.floor(h / 8);
10873
+ for (; w < A; )
10874
10874
  _[w] = 255, w++;
10875
- return S < 16 && (_[S] = Math.pow(2, h % 8) - 1 << 8 - h % 8), new this(_);
10875
+ return A < 16 && (_[A] = Math.pow(2, h % 8) - 1 << 8 - h % 8), new this(_);
10876
10876
  }, v.fromByteArray = function(h) {
10877
10877
  const _ = h.length;
10878
10878
  if (_ === 4)
@@ -10904,13 +10904,13 @@ var Oh = { exports: {} };
10904
10904
  const _ = this.parse(h);
10905
10905
  return _.kind() === "ipv6" && _.isIPv4MappedAddress() ? _.toIPv4Address() : _;
10906
10906
  }, v.subnetMatch = function(h, _, w) {
10907
- let S, j, T, V;
10907
+ let A, C, B, V;
10908
10908
  w == null && (w = "unicast");
10909
- for (j in _)
10910
- if (Object.prototype.hasOwnProperty.call(_, j)) {
10911
- for (T = _[j], T[0] && !(T[0] instanceof Array) && (T = [T]), S = 0; S < T.length; S++)
10912
- if (V = T[S], h.kind() === V[0].kind() && h.match.apply(h, V))
10913
- return j;
10909
+ for (C in _)
10910
+ if (Object.prototype.hasOwnProperty.call(_, C)) {
10911
+ for (B = _[C], B[0] && !(B[0] instanceof Array) && (B = [B]), A = 0; A < B.length; A++)
10912
+ if (V = B[A], h.kind() === V[0].kind() && h.match.apply(h, V))
10913
+ return C;
10914
10914
  }
10915
10915
  return w;
10916
10916
  }, t.exports ? t.exports = v : e.ipaddr = v;
@@ -15705,7 +15705,7 @@ const sw = 1e3 * 60 * 60 * 24, ow = new ae().openapi(
15705
15705
  async (t) => {
15706
15706
  const { kid: e } = t.req.valid("param"), r = (await t.env.data.keys.list()).find((i) => i.kid === e);
15707
15707
  if (!r)
15708
- throw new C(404, { message: "Key not found" });
15708
+ throw new N(404, { message: "Key not found" });
15709
15709
  return t.json(r);
15710
15710
  }
15711
15711
  ).openapi(
@@ -15769,7 +15769,7 @@ const sw = 1e3 * 60 * 60 * 24, ow = new ae().openapi(
15769
15769
  if (!await t.env.data.keys.update(e, {
15770
15770
  revoked_at: (/* @__PURE__ */ new Date()).toISOString()
15771
15771
  }))
15772
- throw new C(404, { message: "Key not found" });
15772
+ throw new N(404, { message: "Key not found" });
15773
15773
  const r = await Hc({
15774
15774
  name: `CN=${t.env.ORGANIZATION_NAME}`
15775
15775
  });
@@ -15891,7 +15891,7 @@ const sw = 1e3 * 60 * 60 * 24, ow = new ae().openapi(
15891
15891
  include_totals: !1
15892
15892
  })).applications.find((s) => s.id === n);
15893
15893
  if (!i)
15894
- throw new C(404);
15894
+ throw new N(404);
15895
15895
  return t.json(i);
15896
15896
  }
15897
15897
  ).openapi(
@@ -15921,7 +15921,7 @@ const sw = 1e3 * 60 * 60 * 24, ow = new ae().openapi(
15921
15921
  async (t) => {
15922
15922
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
15923
15923
  if (!await t.env.data.applications.remove(e, n))
15924
- throw new C(404, { message: "Application not found" });
15924
+ throw new N(404, { message: "Application not found" });
15925
15925
  return t.text("OK");
15926
15926
  }
15927
15927
  ).openapi(
@@ -15965,7 +15965,7 @@ const sw = 1e3 * 60 * 60 * 24, ow = new ae().openapi(
15965
15965
  await t.env.data.applications.update(e, n, i);
15966
15966
  const s = await t.env.data.applications.get(e, n);
15967
15967
  if (!s)
15968
- throw new C(404, { message: "Application not found" });
15968
+ throw new N(404, { message: "Application not found" });
15969
15969
  return t.json(s);
15970
15970
  }
15971
15971
  ).openapi(
@@ -16091,7 +16091,7 @@ const uw = Pn.extend({
16091
16091
  async (t) => {
16092
16092
  const { id: e } = t.req.valid("param"), n = await t.env.data.tenants.get(e);
16093
16093
  if (!n)
16094
- throw new C(404);
16094
+ throw new N(404);
16095
16095
  return t.json(n);
16096
16096
  }
16097
16097
  ).openapi(
@@ -16256,7 +16256,7 @@ const uw = Pn.extend({
16256
16256
  async (t) => {
16257
16257
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.logs.get(e, n);
16258
16258
  if (!r)
16259
- throw new C(404);
16259
+ throw new N(404);
16260
16260
  return t.json(r);
16261
16261
  }
16262
16262
  ), hw = Pn.extend({
@@ -16379,7 +16379,7 @@ const uw = Pn.extend({
16379
16379
  await t.env.data.hooks.update(e, n, r);
16380
16380
  const i = await t.env.data.hooks.get(e, n);
16381
16381
  if (!i)
16382
- throw new C(404, { message: "Hook not found" });
16382
+ throw new N(404, { message: "Hook not found" });
16383
16383
  return t.json(i);
16384
16384
  }
16385
16385
  ).openapi(
@@ -16417,7 +16417,7 @@ const uw = Pn.extend({
16417
16417
  async (t) => {
16418
16418
  const { "tenant-id": e } = t.req.valid("header"), { hook_id: n } = t.req.valid("param"), r = await t.env.data.hooks.get(e, n);
16419
16419
  if (!r)
16420
- throw new C(404, { message: "Hook not found" });
16420
+ throw new N(404, { message: "Hook not found" });
16421
16421
  return t.json(r);
16422
16422
  }
16423
16423
  ).openapi(
@@ -16447,7 +16447,7 @@ const uw = Pn.extend({
16447
16447
  async (t) => {
16448
16448
  const { "tenant-id": e } = t.req.valid("header"), { hook_id: n } = t.req.valid("param");
16449
16449
  if (!await t.env.data.hooks.remove(e, n))
16450
- throw new C(404, { message: "Hook not found" });
16450
+ throw new N(404, { message: "Hook not found" });
16451
16451
  return t.text("OK");
16452
16452
  }
16453
16453
  ), mw = Pn.extend({
@@ -16530,7 +16530,7 @@ const uw = Pn.extend({
16530
16530
  async (t) => {
16531
16531
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.connections.get(e, n);
16532
16532
  if (!r)
16533
- throw new C(404);
16533
+ throw new N(404);
16534
16534
  return t.json(r);
16535
16535
  }
16536
16536
  ).openapi(
@@ -16560,7 +16560,7 @@ const uw = Pn.extend({
16560
16560
  async (t) => {
16561
16561
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
16562
16562
  if (!await t.env.data.connections.remove(e, n))
16563
- throw new C(404, {
16563
+ throw new N(404, {
16564
16564
  message: "Connection not found"
16565
16565
  });
16566
16566
  return t.text("OK");
@@ -16604,12 +16604,12 @@ const uw = Pn.extend({
16604
16604
  async (t) => {
16605
16605
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = t.req.valid("json");
16606
16606
  if (!await t.env.data.connections.update(e, n, r))
16607
- throw new C(404, {
16607
+ throw new N(404, {
16608
16608
  message: "Connection not found"
16609
16609
  });
16610
16610
  const s = await t.env.data.connections.get(e, n);
16611
16611
  if (!s)
16612
- throw new C(404, {
16612
+ throw new N(404, {
16613
16613
  message: "Connection not found"
16614
16614
  });
16615
16615
  return t.json(s);
@@ -16748,7 +16748,7 @@ async function vw(t) {
16748
16748
  throw new Error("Failed to fetch jwks");
16749
16749
  return (await e.json()).keys;
16750
16750
  } catch (e) {
16751
- throw new C(500, {
16751
+ throw new N(500, {
16752
16752
  message: `Failed to fetch jwks: ${e.message}`
16753
16753
  });
16754
16754
  }
@@ -16792,17 +16792,17 @@ function bg(t) {
16792
16792
  return await n();
16793
16793
  const l = e.req.header("authorization") || "", [u, p] = l.split(" ");
16794
16794
  if ((u == null ? void 0 : u.toLowerCase()) !== "bearer" || !p)
16795
- throw new C(401, {
16795
+ throw new N(401, {
16796
16796
  message: "Missing bearer token"
16797
16797
  });
16798
16798
  const f = bw(p);
16799
16799
  if (!f || !await ww(e, f))
16800
- throw new C(403, { message: "Invalid JWT signature" });
16800
+ throw new N(403, { message: "Invalid JWT signature" });
16801
16801
  e.set("user_id", f.payload.sub), e.set("user", f.payload);
16802
16802
  const m = f.payload.permissions || [], v = ((o = f.payload.scope) == null ? void 0 : o.split(" ")) || [];
16803
16803
  if (c.length && !// Should we check both?
16804
16804
  (c.some((h) => m.includes(h)) || c.some((h) => v.includes(h))))
16805
- throw new C(403, { message: "Unauthorized" });
16805
+ throw new N(403, { message: "Unauthorized" });
16806
16806
  }
16807
16807
  return await n();
16808
16808
  };
@@ -16836,7 +16836,7 @@ const kw = new ae().openapi(
16836
16836
  async (t) => {
16837
16837
  const { "tenant-id": e } = t.req.valid("header"), n = await t.env.data.emailProviders.get(e);
16838
16838
  if (!n)
16839
- throw new C(404, { message: "Email provider not found" });
16839
+ throw new N(404, { message: "Email provider not found" });
16840
16840
  return t.json(n);
16841
16841
  }
16842
16842
  ).openapi(
@@ -16935,7 +16935,7 @@ const kw = new ae().openapi(
16935
16935
  async (t) => {
16936
16936
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.sessions.get(e, n);
16937
16937
  if (!r)
16938
- throw new C(404);
16938
+ throw new N(404);
16939
16939
  return t.json(r);
16940
16940
  }
16941
16941
  ).openapi(
@@ -16965,7 +16965,7 @@ const kw = new ae().openapi(
16965
16965
  async (t) => {
16966
16966
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
16967
16967
  if (!await t.env.data.sessions.remove(e, n))
16968
- throw new C(404, {
16968
+ throw new N(404, {
16969
16969
  message: "Session not found"
16970
16970
  });
16971
16971
  return t.text("OK");
@@ -16999,7 +16999,7 @@ const kw = new ae().openapi(
16999
16999
  if (!await t.env.data.sessions.update(e, n, {
17000
17000
  revoked_at: (/* @__PURE__ */ new Date()).toDateString()
17001
17001
  }))
17002
- throw new C(404, {
17002
+ throw new N(404, {
17003
17003
  message: "Session not found"
17004
17004
  });
17005
17005
  return t.text("Session deletion request accepted.", { status: 202 });
@@ -17036,7 +17036,7 @@ const kw = new ae().openapi(
17036
17036
  async (t) => {
17037
17037
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.refreshTokens.get(e, n);
17038
17038
  if (!r)
17039
- throw new C(404);
17039
+ throw new N(404);
17040
17040
  return t.json(r);
17041
17041
  }
17042
17042
  ).openapi(
@@ -17066,7 +17066,7 @@ const kw = new ae().openapi(
17066
17066
  async (t) => {
17067
17067
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
17068
17068
  if (!await t.env.data.refreshTokens.remove(e, n))
17069
- throw new C(404, {
17069
+ throw new N(404, {
17070
17070
  message: "Session not found"
17071
17071
  });
17072
17072
  return t.text("OK");
@@ -17134,7 +17134,7 @@ const kw = new ae().openapi(
17134
17134
  async (t) => {
17135
17135
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.customDomains.get(e, n);
17136
17136
  if (!r)
17137
- throw new C(404);
17137
+ throw new N(404);
17138
17138
  return t.json(r);
17139
17139
  }
17140
17140
  ).openapi(
@@ -17164,7 +17164,7 @@ const kw = new ae().openapi(
17164
17164
  async (t) => {
17165
17165
  const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
17166
17166
  if (!await t.env.data.customDomains.remove(e, n))
17167
- throw new C(404, {
17167
+ throw new N(404, {
17168
17168
  message: "Custom domain not found"
17169
17169
  });
17170
17170
  return t.text("OK");
@@ -17212,10 +17212,10 @@ const kw = new ae().openapi(
17212
17212
  n,
17213
17213
  r
17214
17214
  ))
17215
- throw new C(404);
17215
+ throw new N(404);
17216
17216
  const s = await t.env.data.customDomains.get(e, n);
17217
17217
  if (!s)
17218
- throw new C(404);
17218
+ throw new N(404);
17219
17219
  return t.json(s);
17220
17220
  }
17221
17221
  ).openapi(
@@ -17288,7 +17288,7 @@ const kw = new ae().openapi(
17288
17288
  }
17289
17289
  }),
17290
17290
  async () => {
17291
- throw new C(501, {
17291
+ throw new N(501, {
17292
17292
  message: "Not implemented"
17293
17293
  });
17294
17294
  }
@@ -18266,7 +18266,7 @@ async function ab(t, e, n) {
18266
18266
  }
18267
18267
  );
18268
18268
  if (!l.ok)
18269
- throw new C(400, { message: "Failed to get user from vipps" });
18269
+ throw new N(400, { message: "Failed to get user from vipps" });
18270
18270
  return await l.json();
18271
18271
  }
18272
18272
  const cb = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -18289,7 +18289,7 @@ function jg(t, e) {
18289
18289
  async function Mo(t, e) {
18290
18290
  const n = await t.data.clients.get(e);
18291
18291
  if (!n)
18292
- throw new C(403, { message: "Client not found" });
18292
+ throw new N(403, { message: "Client not found" });
18293
18293
  const r = t.DEFAULT_CLIENT_ID ? await t.data.clients.get(t.DEFAULT_CLIENT_ID) : void 0, i = await t.data.connections.list(n.tenant.id), s = t.DEFAULT_TENANT_ID ? await t.data.connections.list(t.DEFAULT_TENANT_ID) : { connections: [] }, o = i.connections.map((c) => {
18294
18294
  var p;
18295
18295
  const l = (p = s.connections) == null ? void 0 : p.find(
@@ -18363,7 +18363,7 @@ function lb(t, e, n) {
18363
18363
  }
18364
18364
  async function ub(t, e, n, r) {
18365
18365
  if (!r.state)
18366
- throw new C(400, { message: "State not found" });
18366
+ throw new N(400, { message: "State not found" });
18367
18367
  const i = e.connections.find((l) => l.name === n);
18368
18368
  if (!i) {
18369
18369
  t.set("client_id", e.id);
@@ -18371,7 +18371,7 @@ async function ub(t, e, n, r) {
18371
18371
  type: _e.FAILED_LOGIN,
18372
18372
  description: "Connection not found"
18373
18373
  });
18374
- throw await t.env.data.logs.create(e.tenant.id, l), new C(403, { message: "Connection Not Found" });
18374
+ throw await t.env.data.logs.create(e.tenant.id, l), new N(403, { message: "Connection Not Found" });
18375
18375
  }
18376
18376
  let s = await t.env.data.loginSessions.get(
18377
18377
  e.tenant.id,
@@ -18405,13 +18405,13 @@ async function Op(t, { code: e, state: n }) {
18405
18405
  "oauth2_state"
18406
18406
  );
18407
18407
  if (!i || !i.connection_id)
18408
- throw new C(403, { message: "State not found" });
18408
+ throw new N(403, { message: "State not found" });
18409
18409
  const s = await r.data.loginSessions.get(
18410
18410
  t.var.tenant_id || "",
18411
18411
  i.login_id
18412
18412
  );
18413
18413
  if (!s)
18414
- throw new C(403, { message: "Session not found" });
18414
+ throw new N(403, { message: "Session not found" });
18415
18415
  const o = await Mo(
18416
18416
  r,
18417
18417
  s.authParams.client_id
@@ -18425,14 +18425,14 @@ async function Op(t, { code: e, state: n }) {
18425
18425
  type: _e.FAILED_LOGIN,
18426
18426
  description: "Connection not found"
18427
18427
  });
18428
- throw await r.data.logs.create(o.tenant.id, _), new C(403, { message: "Connection not found" });
18428
+ throw await r.data.logs.create(o.tenant.id, _), new N(403, { message: "Connection not found" });
18429
18429
  }
18430
18430
  if (t.set("connection", c.name), !s.authParams.redirect_uri) {
18431
18431
  const _ = be(t, {
18432
18432
  type: _e.FAILED_LOGIN,
18433
18433
  description: "Redirect URI not defined"
18434
18434
  });
18435
- throw await r.data.logs.create(o.tenant.id, _), new C(403, { message: "Redirect URI not defined" });
18435
+ throw await r.data.logs.create(o.tenant.id, _), new N(403, { message: "Redirect URI not defined" });
18436
18436
  }
18437
18437
  if (!zo(
18438
18438
  s.authParams.redirect_uri,
@@ -18443,7 +18443,7 @@ async function Op(t, { code: e, state: n }) {
18443
18443
  type: _e.FAILED_LOGIN,
18444
18444
  description: _
18445
18445
  });
18446
- throw await r.data.logs.create(o.tenant.id, w), new C(403, {
18446
+ throw await r.data.logs.create(o.tenant.id, w), new N(403, {
18447
18447
  message: _
18448
18448
  });
18449
18449
  }
@@ -18480,16 +18480,16 @@ async function Bp(t, e, n, r, i, s) {
18480
18480
  "oauth2_state"
18481
18481
  );
18482
18482
  if (!o)
18483
- throw new C(400, { message: "State not found" });
18483
+ throw new N(400, { message: "State not found" });
18484
18484
  const c = await t.env.data.loginSessions.get(
18485
18485
  t.var.tenant_id,
18486
18486
  o.login_id
18487
18487
  );
18488
18488
  if (!c)
18489
- throw new C(400, { message: "Login not found" });
18489
+ throw new N(400, { message: "Login not found" });
18490
18490
  const { redirect_uri: l } = c.authParams;
18491
18491
  if (!l)
18492
- throw new C(400, { message: "Redirect uri not found" });
18492
+ throw new N(400, { message: "Redirect uri not found" });
18493
18493
  const u = be(t, {
18494
18494
  type: _e.FAILED_LOGIN,
18495
18495
  description: `Failed connection login: ${i} ${n}, ${r}`
@@ -18548,7 +18548,7 @@ const db = new ae().openapi(
18548
18548
  o
18549
18549
  );
18550
18550
  if (!n)
18551
- throw new C(400, { message: "Code is required" });
18551
+ throw new N(400, { message: "Code is required" });
18552
18552
  return Op(t, {
18553
18553
  code: n,
18554
18554
  state: e
@@ -18602,7 +18602,7 @@ const db = new ae().openapi(
18602
18602
  o
18603
18603
  );
18604
18604
  if (!n)
18605
- throw new C(400, { message: "Code is required" });
18605
+ throw new N(400, { message: "Code is required" });
18606
18606
  return Op(t, {
18607
18607
  code: n,
18608
18608
  state: e
@@ -18645,7 +18645,7 @@ const db = new ae().openapi(
18645
18645
  ],
18646
18646
  { allowPathWildcards: !0 }
18647
18647
  ))
18648
- throw new C(400, {
18648
+ throw new N(400, {
18649
18649
  message: "Invalid redirect uri"
18650
18650
  });
18651
18651
  const o = t.req.header("cookie");
@@ -18729,13 +18729,13 @@ const db = new ae().openapi(
18729
18729
  }),
18730
18730
  async (t) => {
18731
18731
  if (!t.var.user)
18732
- throw new C(404, { message: "User not found" });
18732
+ throw new N(404, { message: "User not found" });
18733
18733
  const e = await t.env.data.users.get(
18734
18734
  t.var.user.tenant_id,
18735
18735
  t.var.user.sub
18736
18736
  );
18737
18737
  if (!e)
18738
- throw new C(404, {
18738
+ throw new N(404, {
18739
18739
  message: "User not found"
18740
18740
  });
18741
18741
  return t.json(Tp.parse({ ...e, sub: e.user_id }));
@@ -18894,9 +18894,9 @@ const $g = a.object({
18894
18894
  async function gb(t, e) {
18895
18895
  const n = await t.env.data.clients.get(e.client_id);
18896
18896
  if (!n)
18897
- throw new C(403, { message: "Invalid client credentials" });
18897
+ throw new N(403, { message: "Invalid client credentials" });
18898
18898
  if (n.client_secret && !Hi(n.client_secret, e.client_secret))
18899
- throw new C(403, { message: "Invalid client credentials" });
18899
+ throw new N(403, { message: "Invalid client credentials" });
18900
18900
  const r = {
18901
18901
  client_id: n.id,
18902
18902
  scope: e.scope,
@@ -18920,41 +18920,41 @@ const mb = a.object({
18920
18920
  async function _b(t, e) {
18921
18921
  const n = await t.env.data.clients.get(e.client_id);
18922
18922
  if (!n)
18923
- throw new C(403, { message: "Client not found" });
18923
+ throw new N(403, { message: "Client not found" });
18924
18924
  const r = await t.env.data.codes.get(
18925
18925
  n.tenant.id,
18926
18926
  e.code,
18927
18927
  "authorization_code"
18928
18928
  );
18929
18929
  if (!r || !r.user_id)
18930
- throw new C(403, { message: "Invalid client credentials" });
18930
+ throw new N(403, { message: "Invalid client credentials" });
18931
18931
  if (new Date(r.expires_at) < /* @__PURE__ */ new Date())
18932
- throw new C(403, { message: "Code expired" });
18932
+ throw new N(403, { message: "Code expired" });
18933
18933
  if (r.used_at)
18934
- throw new C(403, { message: "Code already used" });
18934
+ throw new N(403, { message: "Code already used" });
18935
18935
  const i = await t.env.data.loginSessions.get(
18936
18936
  n.tenant.id,
18937
18937
  r.login_id
18938
18938
  );
18939
18939
  if (!i)
18940
- throw new C(403, { message: "Invalid login" });
18940
+ throw new N(403, { message: "Invalid login" });
18941
18941
  if ("client_secret" in e) {
18942
18942
  const o = await t.env.data.clients.get("DEFAULT_CLIENT");
18943
18943
  if (!Hi(n.client_secret, e.client_secret) && !Hi(o == null ? void 0 : o.client_secret, e.client_secret))
18944
- throw new C(403, { message: "Invalid client credentials" });
18944
+ throw new N(403, { message: "Invalid client credentials" });
18945
18945
  } else if ("code_verifier" in e && typeof e.code_verifier == "string" && "code_challenge_method" in i.authParams && typeof i.authParams.code_challenge_method == "string") {
18946
18946
  const o = await w_(
18947
18947
  e.code_verifier,
18948
18948
  i.authParams.code_challenge_method
18949
18949
  );
18950
18950
  if (!Hi(o, i.authParams.code_challenge || ""))
18951
- throw new C(403, { message: "Invalid client credentials" });
18951
+ throw new N(403, { message: "Invalid client credentials" });
18952
18952
  }
18953
18953
  if (i.authParams.redirect_uri && i.authParams.redirect_uri !== e.redirect_uri)
18954
- throw new C(403, { message: "Invalid redirect uri" });
18954
+ throw new N(403, { message: "Invalid redirect uri" });
18955
18955
  const s = await t.env.data.users.get(n.tenant.id, r.user_id);
18956
18956
  if (!s)
18957
- throw new C(403, { message: "User not found" });
18957
+ throw new N(403, { message: "User not found" });
18958
18958
  return await t.env.data.codes.used(n.tenant.id, e.code), sn(t, {
18959
18959
  user: s,
18960
18960
  client: n,
@@ -18974,20 +18974,20 @@ const yb = a.object({
18974
18974
  async function vb(t, e) {
18975
18975
  const n = await t.env.data.clients.get(e.client_id);
18976
18976
  if (!n)
18977
- throw new C(403, { message: "Client not found" });
18977
+ throw new N(403, { message: "Client not found" });
18978
18978
  const r = await t.env.data.refreshTokens.get(
18979
18979
  n.tenant.id,
18980
18980
  e.refresh_token
18981
18981
  );
18982
18982
  if (r) {
18983
18983
  if (r.expires_at && new Date(r.expires_at) < /* @__PURE__ */ new Date() || r.idle_expires_at && new Date(r.idle_expires_at) < /* @__PURE__ */ new Date())
18984
- throw new C(403, {
18984
+ throw new N(403, {
18985
18985
  message: JSON.stringify({
18986
18986
  error: "invalid_grant",
18987
18987
  error_description: "Refresh token has expired"
18988
18988
  })
18989
18989
  });
18990
- } else throw new C(403, {
18990
+ } else throw new N(403, {
18991
18991
  message: JSON.stringify({
18992
18992
  error: "invalid_grant",
18993
18993
  error_description: "Invalid refresh token"
@@ -18998,7 +18998,7 @@ async function vb(t, e) {
18998
18998
  r.user_id
18999
18999
  );
19000
19000
  if (!i)
19001
- throw new C(403, { message: "User not found" });
19001
+ throw new N(403, { message: "User not found" });
19002
19002
  const s = r.resource_servers[0];
19003
19003
  if (r.idle_expires_at) {
19004
19004
  const o = new Date(
@@ -19096,7 +19096,7 @@ const kb = new ae().openapi(
19096
19096
  async (t) => {
19097
19097
  const e = t.req.valid("form"), n = bb(t.req.header("Authorization")), r = { ...e, ...n };
19098
19098
  if (!r.client_id)
19099
- throw new C(400, { message: "client_id is required" });
19099
+ throw new N(400, { message: "client_id is required" });
19100
19100
  switch (t.set("client_id", r.client_id), e.grant_type) {
19101
19101
  case Vi.AuthorizationCode:
19102
19102
  return _b(
@@ -19111,7 +19111,7 @@ const kb = new ae().openapi(
19111
19111
  case Vi.RefreshToken:
19112
19112
  return vb(t, yb.parse(r));
19113
19113
  default:
19114
- throw new C(400, { message: "Not implemented" });
19114
+ throw new N(400, { message: "Not implemented" });
19115
19115
  }
19116
19116
  }
19117
19117
  );
@@ -19182,10 +19182,10 @@ async function Ai(t, e) {
19182
19182
  const n = await t.env.data.emailProviders.get(t.var.tenant_id) || // Fallback to default tenant
19183
19183
  (t.env.DEFAULT_TENANT_ID ? await t.env.data.emailProviders.get(t.env.DEFAULT_TENANT_ID) : null);
19184
19184
  if (!n)
19185
- throw new C(500, { message: "Email provider not found" });
19185
+ throw new N(500, { message: "Email provider not found" });
19186
19186
  const r = (i = t.env.emailProviders) == null ? void 0 : i[n.name];
19187
19187
  if (!r)
19188
- throw new C(500, { message: "Email provider not found" });
19188
+ throw new N(500, { message: "Email provider not found" });
19189
19189
  await r({
19190
19190
  emailProvider: n,
19191
19191
  ...e,
@@ -19195,7 +19195,7 @@ async function Ai(t, e) {
19195
19195
  async function Bg(t, e, n, r) {
19196
19196
  const i = await t.env.data.tenants.get(t.var.tenant_id);
19197
19197
  if (!i)
19198
- throw new C(500, { message: "Tenant not found" });
19198
+ throw new N(500, { message: "Tenant not found" });
19199
19199
  const s = `${vt(t.env)}reset-password?state=${r}&code=${n}`, o = {
19200
19200
  vendorName: i.name,
19201
19201
  lng: i.language || "en"
@@ -19226,7 +19226,7 @@ async function Bg(t, e, n, r) {
19226
19226
  async function Tg(t, e, n) {
19227
19227
  const r = await t.env.data.tenants.get(t.var.tenant_id);
19228
19228
  if (!r)
19229
- throw new C(500, { message: "Tenant not found" });
19229
+ throw new N(500, { message: "Tenant not found" });
19230
19230
  const i = {
19231
19231
  vendorName: r.name,
19232
19232
  code: n,
@@ -19262,9 +19262,9 @@ async function Tg(t, e, n) {
19262
19262
  async function tu(t, e, n, r) {
19263
19263
  const i = await t.env.data.tenants.get(t.var.tenant_id);
19264
19264
  if (!i)
19265
- throw new C(500, { message: "Tenant not found" });
19265
+ throw new N(500, { message: "Tenant not found" });
19266
19266
  if (!r.redirect_uri)
19267
- throw new C(400, { message: "redirect_uri is required" });
19267
+ throw new N(400, { message: "redirect_uri is required" });
19268
19268
  const s = new URL(Be(t.env));
19269
19269
  s.pathname = "passwordless/verify_redirect", s.searchParams.set("verification_code", n), s.searchParams.set("connection", "email"), s.searchParams.set("client_id", r.client_id), s.searchParams.set("redirect_uri", r.redirect_uri), s.searchParams.set("email", e), r.response_type && s.searchParams.set("response_type", r.response_type), r.scope && s.searchParams.set("scope", r.scope), r.state && s.searchParams.set("state", r.state), r.nonce && s.searchParams.set("nonce", r.nonce), r.code_challenge && s.searchParams.set("code_challenge", r.code_challenge), r.code_challenge_method && s.searchParams.set(
19270
19270
  "code_challenge_method",
@@ -19306,7 +19306,7 @@ async function tu(t, e, n, r) {
19306
19306
  async function nu(t, e) {
19307
19307
  const n = await t.env.data.tenants.get(t.var.tenant_id);
19308
19308
  if (!n)
19309
- throw new C(500, { message: "Tenant not found" });
19309
+ throw new N(500, { message: "Tenant not found" });
19310
19310
  const r = {
19311
19311
  vendorName: n.name,
19312
19312
  lng: n.language || "en"
@@ -19333,7 +19333,7 @@ async function nu(t, e) {
19333
19333
  async function Sb(t, e, n, r) {
19334
19334
  const i = await t.env.data.tenants.get(t.var.tenant_id);
19335
19335
  if (!i)
19336
- throw new C(500, { message: "Tenant not found" });
19336
+ throw new N(500, { message: "Tenant not found" });
19337
19337
  const s = {
19338
19338
  vendorName: i.name,
19339
19339
  lng: i.language || "en"
@@ -19399,11 +19399,11 @@ const Ab = new ae().openapi(
19399
19399
  async (t) => {
19400
19400
  const { email: e, password: n, client_id: r } = t.req.valid("json"), i = await t.env.data.clients.get(r);
19401
19401
  if (!i)
19402
- throw new C(400, {
19402
+ throw new N(400, {
19403
19403
  message: "Client not found"
19404
19404
  });
19405
19405
  if (t.set("client_id", i.id), t.set("tenant_id", i.tenant.id), !eu(n))
19406
- throw new C(400, {
19406
+ throw new N(400, {
19407
19407
  message: "Password does not meet the requirements"
19408
19408
  });
19409
19409
  if (await rs({
@@ -19412,7 +19412,7 @@ const Ab = new ae().openapi(
19412
19412
  email: e,
19413
19413
  provider: "auth2"
19414
19414
  }))
19415
- throw new C(400, { message: "Invalid sign up" });
19415
+ throw new N(400, { message: "Invalid sign up" });
19416
19416
  const o = await t.env.data.users.create(i.tenant.id, {
19417
19417
  user_id: `auth2|${Ds()}`,
19418
19418
  email: e,
@@ -19467,7 +19467,7 @@ const Ab = new ae().openapi(
19467
19467
  async (t) => {
19468
19468
  const { email: e, client_id: n } = t.req.valid("json"), r = await t.env.data.clients.get(n);
19469
19469
  if (!r)
19470
- throw new C(400, {
19470
+ throw new N(400, {
19471
19471
  message: "Client not found"
19472
19472
  });
19473
19473
  if (t.set("client_id", r.id), t.set("tenant_id", r.tenant.id), !await ur({
@@ -19517,15 +19517,15 @@ async function ru(t, e, n, r, i, s, o) {
19517
19517
  "otp"
19518
19518
  );
19519
19519
  if (!l)
19520
- throw new C(400, {
19520
+ throw new N(400, {
19521
19521
  message: "Code not found or expired"
19522
19522
  });
19523
19523
  if (l.expires_at < (/* @__PURE__ */ new Date()).toISOString())
19524
- throw new C(400, {
19524
+ throw new N(400, {
19525
19525
  message: "Code expired"
19526
19526
  });
19527
19527
  if (l.used_at)
19528
- throw new C(400, {
19528
+ throw new N(400, {
19529
19529
  message: "Code already used"
19530
19530
  });
19531
19531
  const u = await c.data.loginSessions.get(
@@ -19533,7 +19533,7 @@ async function ru(t, e, n, r, i, s, o) {
19533
19533
  l.login_id
19534
19534
  );
19535
19535
  if (!u || u.authParams.username !== r)
19536
- throw new C(400, {
19536
+ throw new N(400, {
19537
19537
  message: "Code not found or expired"
19538
19538
  });
19539
19539
  const p = rn(t.req);
@@ -19544,7 +19544,7 @@ async function ru(t, e, n, r, i, s, o) {
19544
19544
  if (n.redirect_uri && !zo(n.redirect_uri, e.callbacks, {
19545
19545
  allowPathWildcards: !0
19546
19546
  }))
19547
- throw new C(400, {
19547
+ throw new N(400, {
19548
19548
  message: `Invalid redirect URI - ${n.redirect_uri}`
19549
19549
  });
19550
19550
  const f = await Js(t, {
@@ -19592,7 +19592,7 @@ const Eb = new ae().openapi(
19592
19592
  async (t) => {
19593
19593
  const e = t.req.valid("json"), { env: n } = t, { client_id: r, email: i, send: s, authParams: o } = e, c = await t.env.data.clients.get(r);
19594
19594
  if (!c)
19595
- throw new C(400, {
19595
+ throw new N(400, {
19596
19596
  message: "Client not found"
19597
19597
  });
19598
19598
  t.set("client_id", c.id), t.set("tenant_id", c.tenant.id);
@@ -19668,7 +19668,7 @@ const Eb = new ae().openapi(
19668
19668
  );
19669
19669
  }
19670
19670
  );
19671
- class Nr extends C {
19671
+ class Nr extends N {
19672
19672
  constructor(n, r) {
19673
19673
  super(n, r);
19674
19674
  ne(this, "_code");
@@ -19681,7 +19681,7 @@ class Nr extends C {
19681
19681
  async function iu(t, e, n, r, i) {
19682
19682
  const { env: s } = t, o = n.username;
19683
19683
  if (t.set("username", o), !o)
19684
- throw new C(400, { message: "Username is required" });
19684
+ throw new N(400, { message: "Username is required" });
19685
19685
  const c = await ur({
19686
19686
  userAdapter: t.env.data.users,
19687
19687
  tenant_id: e.tenant.id,
@@ -19848,7 +19848,7 @@ const Cb = new ae().openapi(
19848
19848
  t.set("username", r);
19849
19849
  const i = await t.env.data.clients.get(n);
19850
19850
  if (!i)
19851
- throw new C(400, {
19851
+ throw new N(400, {
19852
19852
  message: "Client not found"
19853
19853
  });
19854
19854
  t.set("client_id", n), t.set("tenant_id", i.tenant.id);
@@ -19889,7 +19889,7 @@ const Cb = new ae().openapi(
19889
19889
  !0
19890
19890
  );
19891
19891
  } else
19892
- throw new C(400, { message: "Code or password required" });
19892
+ throw new N(400, { message: "Code or password required" });
19893
19893
  }
19894
19894
  );
19895
19895
  function Nb(t, e) {
@@ -19965,7 +19965,7 @@ function $b(t) {
19965
19965
  return "auth2";
19966
19966
  if (t === "email")
19967
19967
  return "email";
19968
- throw new C(403, { message: "Invalid realm" });
19968
+ throw new N(403, { message: "Invalid realm" });
19969
19969
  }
19970
19970
  async function Ob(t, e, n, r, i) {
19971
19971
  var m;
@@ -19973,16 +19973,16 @@ async function Ob(t, e, n, r, i) {
19973
19973
  t.set("connection", i);
19974
19974
  const o = await s.data.codes.get(e, n, "ticket");
19975
19975
  if (!o || o.used_at)
19976
- throw new C(403, { message: "Ticket not found" });
19976
+ throw new N(403, { message: "Ticket not found" });
19977
19977
  const c = await s.data.loginSessions.get(
19978
19978
  e,
19979
19979
  o.login_id
19980
19980
  );
19981
19981
  if (!c || !c.authParams.username)
19982
- throw new C(403, { message: "Session not found" });
19982
+ throw new N(403, { message: "Session not found" });
19983
19983
  const l = await s.data.clients.get(c.authParams.client_id);
19984
19984
  if (!l)
19985
- throw new C(403, { message: "Client not found" });
19985
+ throw new N(403, { message: "Client not found" });
19986
19986
  t.set("client_id", c.authParams.client_id), await s.data.codes.used(e, n);
19987
19987
  const u = $b(i);
19988
19988
  let p = await Js(t, {
@@ -20093,7 +20093,7 @@ async function Bb({
20093
20093
  if (!w)
20094
20094
  return console.error("User not found", n.user_id), h("User not found");
20095
20095
  t.set("username", w.email), t.set("connection", w.connection);
20096
- const S = {
20096
+ const A = {
20097
20097
  client: e,
20098
20098
  authParams: {
20099
20099
  client_id: e.id,
@@ -20107,7 +20107,7 @@ async function Bb({
20107
20107
  },
20108
20108
  user: w,
20109
20109
  session_id: n.id
20110
- }, j = p === Yt.CODE ? await If(t, S) : await Ks(t, S);
20110
+ }, C = p === Yt.CODE ? await If(t, A) : await Ks(t, A);
20111
20111
  await f.data.sessions.update(e.tenant.id, n.id, {
20112
20112
  used_at: (/* @__PURE__ */ new Date()).toISOString(),
20113
20113
  last_interaction_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -20120,11 +20120,11 @@ async function Bb({
20120
20120
  Date.now() + Fs * 1e3
20121
20121
  ).toISOString() : void 0
20122
20122
  });
20123
- const T = be(t, {
20123
+ const B = be(t, {
20124
20124
  type: _e.SUCCESS_SILENT_AUTH,
20125
20125
  description: "Successful silent authentication"
20126
20126
  });
20127
- await t.env.data.logs.create(e.tenant.id, T);
20127
+ await t.env.data.logs.create(e.tenant.id, B);
20128
20128
  const V = new Headers();
20129
20129
  V.set("Server-Timing", "cf-nel=0; no-cloudflare-insights=1");
20130
20130
  const ee = vf(
@@ -20132,7 +20132,7 @@ async function Bb({
20132
20132
  n.id,
20133
20133
  t.req.header("host")
20134
20134
  );
20135
- return V.set("set-cookie", ee), t.html(Rp(v, JSON.stringify(j)), {
20135
+ return V.set("set-cookie", ee), t.html(Rp(v, JSON.stringify(C)), {
20136
20136
  headers: V
20137
20137
  });
20138
20138
  }
@@ -20191,9 +20191,9 @@ const Tb = new ae().openapi(
20191
20191
  prompt: h,
20192
20192
  login_ticket: _,
20193
20193
  realm: w,
20194
- auth0Client: S,
20195
- login_hint: j,
20196
- ui_locales: T,
20194
+ auth0Client: A,
20195
+ login_hint: C,
20196
+ ui_locales: B,
20197
20197
  organization: V
20198
20198
  } = t.req.valid("query");
20199
20199
  t.set("log", "authorize");
@@ -20212,18 +20212,18 @@ const Tb = new ae().openapi(
20212
20212
  response_mode: f,
20213
20213
  code_challenge: m,
20214
20214
  code_challenge_method: v,
20215
- username: j,
20216
- ui_locales: T,
20215
+ username: C,
20216
+ ui_locales: B,
20217
20217
  organization: V
20218
20218
  }, de = t.req.header("origin");
20219
20219
  if (de && !Nb(de, ee.web_origins || []))
20220
- throw new C(403, {
20220
+ throw new N(403, {
20221
20221
  message: `Origin ${de} not allowed`
20222
20222
  });
20223
20223
  if (ue.redirect_uri && !zo(ue.redirect_uri, ee.callbacks || [], {
20224
20224
  allowPathWildcards: !0
20225
20225
  }))
20226
- throw new C(400, {
20226
+ throw new N(400, {
20227
20227
  message: `Invalid redirect URI - ${ue.redirect_uri}`
20228
20228
  });
20229
20229
  const He = ns(
@@ -20232,7 +20232,7 @@ const Tb = new ae().openapi(
20232
20232
  ), Me = He ? await e.data.sessions.get(ee.tenant.id, He) : void 0, Ve = Me && !Me.revoked_at ? Me : void 0;
20233
20233
  if (h == "none") {
20234
20234
  if (!p)
20235
- throw new C(400, {
20235
+ throw new N(400, {
20236
20236
  message: "Missing response_type"
20237
20237
  });
20238
20238
  return Bb({
@@ -20258,11 +20258,11 @@ const Tb = new ae().openapi(
20258
20258
  ) : jb({
20259
20259
  ctx: t,
20260
20260
  client: ee,
20261
- auth0Client: S,
20261
+ auth0Client: A,
20262
20262
  authParams: ue,
20263
20263
  session: Ve || void 0,
20264
20264
  connection: u,
20265
- login_hint: j
20265
+ login_hint: C
20266
20266
  });
20267
20267
  }
20268
20268
  );
@@ -20758,7 +20758,7 @@ async function Ne(t, e, n = !1) {
20758
20758
  );
20759
20759
  if (i)
20760
20760
  i.session_id;
20761
- else throw new C(400, { message: "Login session not found" });
20761
+ else throw new N(400, { message: "Login session not found" });
20762
20762
  t.set("loginSession", i);
20763
20763
  const s = await Mo(
20764
20764
  r,
@@ -20768,8 +20768,8 @@ async function Ne(t, e, n = !1) {
20768
20768
  const o = await r.data.tenants.get(s.tenant.id);
20769
20769
  if (o) {
20770
20770
  if (i.session_id && !n)
20771
- throw new C(400, { message: "Login session closed" });
20772
- } else throw new C(400, { message: "Tenant not found" });
20771
+ throw new N(400, { message: "Login session closed" });
20772
+ } else throw new N(400, { message: "Tenant not found" });
20773
20773
  const c = await lu(
20774
20774
  r,
20775
20775
  s.id,
@@ -21627,28 +21627,28 @@ var ii = "_hp", _1 = {
21627
21627
  Array.isArray(n[h]) && n.splice(h, 1, ...n[h].flat());
21628
21628
  let _ = x1(n[h]);
21629
21629
  if (_) {
21630
- typeof _.tag == "function" && !_.tag[Lg] && (ar.length > 0 && (_[Ie][2] = ar.map((S) => [S, S.values.at(-1)])), (o = t[5]) != null && o.length && (_[Ie][3] = t[5].at(-1)));
21630
+ typeof _.tag == "function" && !_.tag[Lg] && (ar.length > 0 && (_[Ie][2] = ar.map((A) => [A, A.values.at(-1)])), (o = t[5]) != null && o.length && (_[Ie][3] = t[5].at(-1)));
21631
21631
  let w;
21632
21632
  if (f && f.length) {
21633
- const S = f.findIndex(
21634
- Tt(_) ? (j) => Tt(j) : _.key !== void 0 ? (j) => j.key === _.key && j.tag === _.tag : (j) => j.tag === _.tag
21633
+ const A = f.findIndex(
21634
+ Tt(_) ? (C) => Tt(C) : _.key !== void 0 ? (C) => C.key === _.key && C.tag === _.tag : (C) => C.tag === _.tag
21635
21635
  );
21636
- S !== -1 && (w = f[S], f.splice(S, 1));
21636
+ A !== -1 && (w = f[A], f.splice(A, 1));
21637
21637
  }
21638
21638
  if (w)
21639
21639
  if (Tt(_))
21640
21640
  w.t !== _.t && (w.t = _.t, w.d = !0), _ = w;
21641
21641
  else {
21642
- const S = w.pP = w.props;
21643
- w.props = _.props, w.f || (w.f = _.f || e.f), typeof _.tag == "function" && (w[Ie][2] = _[Ie][2] || [], w[Ie][3] = _[Ie][3], !w.f && ((w.o || w) === _.o || (l = (c = w.tag)[Vb]) != null && l.call(c, S, w.props)) && (w.s = !0)), _ = w;
21642
+ const A = w.pP = w.props;
21643
+ w.props = _.props, w.f || (w.f = _.f || e.f), typeof _.tag == "function" && (w[Ie][2] = _[Ie][2] || [], w[Ie][3] = _[Ie][3], !w.f && ((w.o || w) === _.o || (l = (c = w.tag)[Vb]) != null && l.call(c, A, w.props)) && (w.s = !0)), _ = w;
21644
21644
  }
21645
21645
  else if (!Tt(_) && lr) {
21646
- const S = kr(lr);
21647
- S && (_.n = S);
21646
+ const A = kr(lr);
21647
+ A && (_.n = A);
21648
21648
  }
21649
21649
  if (!Tt(_) && !_.s && (Jc(t, _), delete _.f), m.push(_), v && !v.s && !_.s)
21650
- for (let S = v; S && !Tt(S); S = (u = S.vC) == null ? void 0 : u.at(-1))
21651
- S.nN = _;
21650
+ for (let A = v; A && !Tt(A); A = (u = A.vC) == null ? void 0 : u.at(-1))
21651
+ A.nN = _;
21652
21652
  v = _;
21653
21653
  }
21654
21654
  }
@@ -21663,18 +21663,18 @@ var ii = "_hp", _1 = {
21663
21663
  if (v) {
21664
21664
  const _ = () => Zi([0, !1, t[2]], h), w = Ji.get(h) || [];
21665
21665
  w.push(_), Ji.set(h, w);
21666
- const S = v(f, () => {
21667
- const j = Ji.get(h);
21668
- if (j) {
21669
- const T = j.indexOf(_);
21670
- if (T !== -1)
21671
- return j.splice(T, 1), _();
21666
+ const A = v(f, () => {
21667
+ const C = Ji.get(h);
21668
+ if (C) {
21669
+ const B = C.indexOf(_);
21670
+ if (B !== -1)
21671
+ return C.splice(B, 1), _();
21672
21672
  }
21673
21673
  });
21674
- if (S) {
21674
+ if (A) {
21675
21675
  if (t[0] === 1)
21676
21676
  t[1] = !0;
21677
- else if (Jc(t, h, [S]), (v.length === 1 || t !== m) && h.c) {
21677
+ else if (Jc(t, h, [A]), (v.length === 1 || t !== m) && h.c) {
21678
21678
  Wg(h, h.c, !1);
21679
21679
  return;
21680
21680
  }
@@ -21849,20 +21849,20 @@ var ii = "_hp", _1 = {
21849
21849
  const v = Ki[t];
21850
21850
  let h;
21851
21851
  if (v.length > 0) {
21852
- const j = s.querySelectorAll(t);
21852
+ const C = s.querySelectorAll(t);
21853
21853
  e:
21854
- for (const T of j)
21854
+ for (const B of C)
21855
21855
  for (const V of Ki[t])
21856
- if (T.getAttribute(V) === e[V]) {
21857
- f = T;
21856
+ if (B.getAttribute(V) === e[V]) {
21857
+ f = B;
21858
21858
  break e;
21859
21859
  }
21860
21860
  if (!f) {
21861
- const T = v.reduce(
21861
+ const B = v.reduce(
21862
21862
  (V, ee) => e[ee] === void 0 ? V : `${V}-${ee}-${e[ee]}`,
21863
21863
  t
21864
21864
  );
21865
- m = !Ui[T], f = Ui[T] || (Ui[T] = (() => {
21865
+ m = !Ui[B], f = Ui[B] || (Ui[B] = (() => {
21866
21866
  const V = document.createElement(t);
21867
21867
  for (const ee of v)
21868
21868
  e[ee] !== void 0 && V.setAttribute(ee, e[ee]), e.rel && V.setAttribute("rel", e.rel);
@@ -21873,54 +21873,54 @@ var ii = "_hp", _1 = {
21873
21873
  h = s.querySelectorAll(t);
21874
21874
  l = r ? l ?? "" : void 0, r && (p[Wi] = l);
21875
21875
  const _ = uu(
21876
- (j) => {
21876
+ (C) => {
21877
21877
  if (v.length > 0) {
21878
- let T = !1;
21878
+ let B = !1;
21879
21879
  for (const V of s.querySelectorAll(t)) {
21880
- if (T && V.getAttribute(Wi) !== l) {
21881
- s.insertBefore(j, V);
21880
+ if (B && V.getAttribute(Wi) !== l) {
21881
+ s.insertBefore(C, V);
21882
21882
  return;
21883
21883
  }
21884
- V.getAttribute(Wi) === l && (T = !0);
21884
+ V.getAttribute(Wi) === l && (B = !0);
21885
21885
  }
21886
- s.appendChild(j);
21886
+ s.appendChild(C);
21887
21887
  } else if (h) {
21888
- let T = !1;
21888
+ let B = !1;
21889
21889
  for (const V of h)
21890
- if (V === j) {
21891
- T = !0;
21890
+ if (V === C) {
21891
+ B = !0;
21892
21892
  break;
21893
21893
  }
21894
- T || s.insertBefore(
21895
- j,
21894
+ B || s.insertBefore(
21895
+ C,
21896
21896
  s.contains(h[0]) ? h[0] : s.querySelector(t)
21897
21897
  ), h = void 0;
21898
21898
  }
21899
21899
  },
21900
21900
  [l]
21901
- ), w = du(e.ref, (j) => {
21901
+ ), w = du(e.ref, (C) => {
21902
21902
  var ee;
21903
- const T = v[0];
21904
- if (n === 2 && (j.innerHTML = ""), (m || h) && _(j), !c && !o)
21903
+ const B = v[0];
21904
+ if (n === 2 && (C.innerHTML = ""), (m || h) && _(C), !c && !o)
21905
21905
  return;
21906
- let V = Dn[ee = j.getAttribute(T)] || (Dn[ee] = new Promise(
21906
+ let V = Dn[ee = C.getAttribute(B)] || (Dn[ee] = new Promise(
21907
21907
  (ue, de) => {
21908
- j.addEventListener("load", ue), j.addEventListener("error", de);
21908
+ C.addEventListener("load", ue), C.addEventListener("error", de);
21909
21909
  }
21910
21910
  ));
21911
21911
  o && (V = V.then(o)), c && (V = V.catch(c)), V.catch(() => {
21912
21912
  });
21913
21913
  });
21914
21914
  if (i && u === "render") {
21915
- const j = Ki[t][0];
21916
- if (e[j]) {
21917
- const T = e[j], V = Dn[T] || (Dn[T] = new Promise((ee, ue) => {
21915
+ const C = Ki[t][0];
21916
+ if (e[C]) {
21917
+ const B = e[C], V = Dn[B] || (Dn[B] = new Promise((ee, ue) => {
21918
21918
  _(f), f.addEventListener("load", ee), f.addEventListener("error", ue);
21919
21919
  }));
21920
21920
  I1(V);
21921
21921
  }
21922
21922
  }
21923
- const S = {
21923
+ const A = {
21924
21924
  tag: t,
21925
21925
  type: t,
21926
21926
  props: {
@@ -21929,8 +21929,8 @@ var ii = "_hp", _1 = {
21929
21929
  },
21930
21930
  ref: w
21931
21931
  };
21932
- return S.p = n, f && (S.e = f), S1(
21933
- S,
21932
+ return A.p = n, f && (A.e = f), S1(
21933
+ A,
21934
21934
  s
21935
21935
  );
21936
21936
  }, $1 = (t) => {
@@ -22144,7 +22144,7 @@ const pu = (t) => {
22144
22144
  e
22145
22145
  );
22146
22146
  if (!r.authParams.username)
22147
- throw new C(400, {
22147
+ throw new N(400, {
22148
22148
  message: "Username not found in state"
22149
22149
  });
22150
22150
  const s = await rs({
@@ -22199,7 +22199,7 @@ const pu = (t) => {
22199
22199
  e
22200
22200
  );
22201
22201
  if (t.set("client_id", i.id), !r.authParams.username)
22202
- throw new C(400, {
22202
+ throw new N(400, {
22203
22203
  message: "Username not found in state"
22204
22204
  });
22205
22205
  try {
@@ -22341,7 +22341,7 @@ const pu = (t) => {
22341
22341
  e
22342
22342
  );
22343
22343
  if (!i.authParams.username)
22344
- throw new C(400, { message: "Username required" });
22344
+ throw new N(400, { message: "Username required" });
22345
22345
  return t.html(
22346
22346
  /* @__PURE__ */ y(
22347
22347
  ma,
@@ -22387,7 +22387,7 @@ const pu = (t) => {
22387
22387
  e
22388
22388
  ), { username: c } = o.authParams;
22389
22389
  if (!c)
22390
- throw new C(400, { message: "Username required" });
22390
+ throw new N(400, { message: "Username required" });
22391
22391
  try {
22392
22392
  return await iu(
22393
22393
  t,
@@ -22518,7 +22518,7 @@ const pu = (t) => {
22518
22518
  async (t) => {
22519
22519
  const { state: e, code: n } = t.req.valid("query"), { vendorSettings: r, loginSession: i } = await Ne(t, e), { username: s } = i.authParams;
22520
22520
  if (!s)
22521
- throw new C(400, { message: "Username required" });
22521
+ throw new N(400, { message: "Username required" });
22522
22522
  return n ? t.html(
22523
22523
  /* @__PURE__ */ y(
22524
22524
  jr,
@@ -22578,7 +22578,7 @@ const pu = (t) => {
22578
22578
  t.set("client_id", s.id), t.set("connection", c);
22579
22579
  const l = o.authParams.username;
22580
22580
  if (!l)
22581
- throw new C(400, { message: "Username required" });
22581
+ throw new N(400, { message: "Username required" });
22582
22582
  if (n.password !== n["re-enter-password"])
22583
22583
  return t.html(
22584
22584
  /* @__PURE__ */ y(
@@ -22622,7 +22622,7 @@ const pu = (t) => {
22622
22622
  email: l,
22623
22623
  provider: "auth2"
22624
22624
  }))
22625
- throw new C(400, { message: "Invalid sign up" });
22625
+ throw new N(400, { message: "Invalid sign up" });
22626
22626
  const m = (p == null ? void 0 : p.authParams.username) === l, v = await Nf(t).users.create(
22627
22627
  s.tenant.id,
22628
22628
  {
@@ -22736,7 +22736,7 @@ const pu = (t) => {
22736
22736
  async (t) => {
22737
22737
  const { state: e } = t.req.valid("query"), { vendorSettings: n, loginSession: r } = await Ne(t, e);
22738
22738
  if (!r.authParams.username)
22739
- throw new C(400, { message: "Username required" });
22739
+ throw new N(400, { message: "Username required" });
22740
22740
  return t.html(
22741
22741
  /* @__PURE__ */ y(
22742
22742
  $r,
@@ -22784,7 +22784,7 @@ const pu = (t) => {
22784
22784
  e
22785
22785
  );
22786
22786
  if (!l.authParams.username)
22787
- throw new C(400, { message: "Username required" });
22787
+ throw new N(400, { message: "Username required" });
22788
22788
  if (r !== i)
22789
22789
  return t.html(
22790
22790
  /* @__PURE__ */ y(
@@ -22816,7 +22816,7 @@ const pu = (t) => {
22816
22816
  provider: "auth2"
22817
22817
  });
22818
22818
  if (!u)
22819
- throw new C(400, { message: "User not found" });
22819
+ throw new N(400, { message: "User not found" });
22820
22820
  try {
22821
22821
  if (!await s.data.codes.get(
22822
22822
  c.tenant.id,
@@ -23139,7 +23139,7 @@ const pu = (t) => {
23139
23139
  async (t) => {
23140
23140
  const { state: e } = t.req.valid("query"), { vendorSettings: n, loginSession: r } = await Ne(t, e), { username: i } = r.authParams;
23141
23141
  if (!i)
23142
- throw new C(400, { message: "Username required" });
23142
+ throw new N(400, { message: "Username required" });
23143
23143
  return t.html(
23144
23144
  /* @__PURE__ */ y(
23145
23145
  J1,
@@ -23172,7 +23172,7 @@ const pu = (t) => {
23172
23172
  async (t) => {
23173
23173
  const { state: e } = t.req.valid("query"), { loginSession: n, client: r } = await Ne(t, e), { username: i } = n.authParams;
23174
23174
  if (!i)
23175
- throw new C(400, { message: "Username required" });
23175
+ throw new N(400, { message: "Username required" });
23176
23176
  const s = await t.env.data.codes.create(r.tenant.id, {
23177
23177
  code_id: Tn(),
23178
23178
  code_type: "email_verification",
@@ -23329,7 +23329,7 @@ const pu = (t) => {
23329
23329
  e
23330
23330
  ), c = s.authParams.username;
23331
23331
  if (!c)
23332
- throw new C(400, {
23332
+ throw new N(400, {
23333
23333
  message: "Username not found in state"
23334
23334
  });
23335
23335
  const l = await ur({
@@ -23339,13 +23339,13 @@ const pu = (t) => {
23339
23339
  provider: "auth2"
23340
23340
  });
23341
23341
  if (!l)
23342
- throw new C(500, { message: "No user found" });
23342
+ throw new N(500, { message: "No user found" });
23343
23343
  if (!await r.data.codes.get(
23344
23344
  i.tenant.id,
23345
23345
  n,
23346
23346
  "email_verification"
23347
23347
  ))
23348
- throw new C(400, { message: "Code not found or expired" });
23348
+ throw new N(400, { message: "Code not found or expired" });
23349
23349
  await r.data.users.update(i.tenant.id, l.user_id, {
23350
23350
  email_verified: !0
23351
23351
  });
@@ -23416,7 +23416,7 @@ const pu = (t) => {
23416
23416
  async (t) => {
23417
23417
  const { state: e } = t.req.valid("query"), { vendorSettings: n, loginSession: r } = await Ne(t, e), { username: i } = r.authParams;
23418
23418
  if (!i)
23419
- throw new C(400, { message: "Username required" });
23419
+ throw new N(400, { message: "Username required" });
23420
23420
  return t.html(
23421
23421
  /* @__PURE__ */ y(
23422
23422
  nk,