authhero 0.226.0 → 0.228.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 _a extends dc {
361
361
  }
362
362
  const h = this.resolve(e, n);
363
363
  let g = h == null ? void 0 : h.res;
364
- const b = (h == null ? void 0 : h.usedKey) || a, x = (h == null ? void 0 : h.exactUsedKey) || a, C = Object.prototype.toString.apply(g), O = ["[object Number]", "[object Function]", "[object RegExp]"], D = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, A = !this.i18nFormat || this.i18nFormat.handleAsObject, z = !Ne(g) && typeof g != "boolean" && typeof g != "number";
365
- if (A && g && z && O.indexOf(C) < 0 && !(Ne(D) && Array.isArray(g))) {
364
+ const b = (h == null ? void 0 : h.usedKey) || a, A = (h == null ? void 0 : h.exactUsedKey) || a, C = Object.prototype.toString.apply(g), D = ["[object Number]", "[object Function]", "[object RegExp]"], O = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, x = !this.i18nFormat || this.i18nFormat.handleAsObject, z = !Ne(g) && typeof g != "boolean" && typeof g != "number";
365
+ if (x && g && z && D.indexOf(C) < 0 && !(Ne(O) && Array.isArray(g))) {
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 q = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(b, g, {
@@ -372,25 +372,25 @@ class _a extends dc {
372
372
  return i ? (h.res = q, h.usedParams = this.getUsedParamsDetails(n), h) : q;
373
373
  }
374
374
  if (s) {
375
- const q = Array.isArray(g), M = q ? [] : {}, K = q ? x : b;
375
+ const q = Array.isArray(g), M = q ? [] : {}, K = q ? A : b;
376
376
  for (const W in g)
377
377
  if (Object.prototype.hasOwnProperty.call(g, W)) {
378
- const Z = `${K}${s}${W}`;
379
- M[W] = this.translate(Z, {
378
+ const Y = `${K}${s}${W}`;
379
+ M[W] = this.translate(Y, {
380
380
  ...n,
381
381
  joinArrays: !1,
382
382
  ns: l
383
- }), M[W] === Z && (M[W] = g[W]);
383
+ }), M[W] === Y && (M[W] = g[W]);
384
384
  }
385
385
  g = M;
386
386
  }
387
- } else if (A && Ne(D) && Array.isArray(g))
388
- g = g.join(D), g && (g = this.extendTranslation(g, e, n, r));
387
+ } else if (x && Ne(O) && Array.isArray(g))
388
+ g = g.join(O), g && (g = this.extendTranslation(g, e, n, r));
389
389
  else {
390
390
  let q = !1, M = !1;
391
- const K = n.count !== void 0 && !Ne(n.count), W = _a.hasDefaultValue(n), Z = K ? this.pluralResolver.getSuffix(d, n.count, n) : "", Y = n.ordinal && K ? this.pluralResolver.getSuffix(d, n.count, {
391
+ const K = n.count !== void 0 && !Ne(n.count), W = _a.hasDefaultValue(n), Y = K ? this.pluralResolver.getSuffix(d, n.count, n) : "", Z = n.ordinal && K ? this.pluralResolver.getSuffix(d, n.count, {
392
392
  ordinal: !1
393
- }) : "", Se = K && !n.ordinal && n.count === 0, j = Se && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${Z}`] || n[`defaultValue${Y}`] || n.defaultValue;
393
+ }) : "", Se = K && !n.ordinal && n.count === 0, j = Se && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${Y}`] || n[`defaultValue${Z}`] || n.defaultValue;
394
394
  !this.isValidLookup(g) && W && (q = !0, g = j), this.isValidLookup(g) || (M = !0, g = a);
395
395
  const P = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && M ? void 0 : g, N = W && j !== g && this.options.updateMissing;
396
396
  if (M || q || N) {
@@ -444,20 +444,20 @@ class _a extends dc {
444
444
  const h = Ne(e) && (((p = r == null ? void 0 : r.interpolation) == null ? void 0 : p.skipOnVariables) !== void 0 ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
445
445
  let g;
446
446
  if (h) {
447
- const x = e.match(this.interpolator.nestingRegexp);
448
- g = x && x.length;
447
+ const A = e.match(this.interpolator.nestingRegexp);
448
+ g = A && A.length;
449
449
  }
450
450
  let b = r.replace && !Ne(r.replace) ? r.replace : r;
451
451
  if (this.options.interpolation.defaultVariables && (b = {
452
452
  ...this.options.interpolation.defaultVariables,
453
453
  ...b
454
454
  }), e = this.interpolator.interpolate(e, b, r.lng || this.language || i.usedLng, r), h) {
455
- const x = e.match(this.interpolator.nestingRegexp), C = x && x.length;
455
+ const A = e.match(this.interpolator.nestingRegexp), C = A && A.length;
456
456
  g < C && (r.nest = !1);
457
457
  }
458
458
  !r.lng && i && i.res && (r.lng = this.language || i.usedLng), r.nest !== !1 && (e = this.interpolator.nest(e, function() {
459
- for (var x = arguments.length, C = new Array(x), O = 0; O < x; O++)
460
- C[O] = arguments[O];
459
+ for (var A = arguments.length, C = new Array(A), D = 0; D < A; D++)
460
+ C[D] = arguments[D];
461
461
  return (s == null ? void 0 : s[0]) === C[0] && !r.context ? (a.logger.warn(`It seems you are nesting recursively key: ${C[0]} in key: ${n[0]}`), null) : a.translate(...C, n);
462
462
  }, r)), r.interpolation && this.interpolator.reset();
463
463
  }
@@ -478,28 +478,28 @@ class _a extends dc {
478
478
  i = p;
479
479
  let h = d.namespaces;
480
480
  this.options.fallbackNS && (h = h.concat(this.options.fallbackNS));
481
- const g = n.count !== void 0 && !Ne(n.count), b = g && !n.ordinal && n.count === 0, x = n.context !== void 0 && (Ne(n.context) || typeof n.context == "number") && n.context !== "", C = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng);
482
- h.forEach((O) => {
483
- var D, A;
484
- this.isValidLookup(r) || (l = O, !rh[`${C[0]}-${O}`] && ((D = this.utils) != null && D.hasLoadedNamespace) && !((A = this.utils) != null && A.hasLoadedNamespace(l)) && (rh[`${C[0]}-${O}`] = !0, this.logger.warn(`key "${i}" for languages "${C.join(", ")}" won't get resolved as namespace "${l}" 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!!!")), C.forEach((z) => {
481
+ const g = n.count !== void 0 && !Ne(n.count), b = g && !n.ordinal && n.count === 0, A = n.context !== void 0 && (Ne(n.context) || typeof n.context == "number") && n.context !== "", C = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng);
482
+ h.forEach((D) => {
483
+ var O, x;
484
+ this.isValidLookup(r) || (l = D, !rh[`${C[0]}-${D}`] && ((O = this.utils) != null && O.hasLoadedNamespace) && !((x = this.utils) != null && x.hasLoadedNamespace(l)) && (rh[`${C[0]}-${D}`] = !0, this.logger.warn(`key "${i}" for languages "${C.join(", ")}" won't get resolved as namespace "${l}" 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!!!")), C.forEach((z) => {
485
485
  var K;
486
486
  if (this.isValidLookup(r)) return;
487
487
  a = z;
488
488
  const q = [p];
489
489
  if ((K = this.i18nFormat) != null && K.addLookupKeys)
490
- this.i18nFormat.addLookupKeys(q, p, z, O, n);
490
+ this.i18nFormat.addLookupKeys(q, p, z, D, n);
491
491
  else {
492
492
  let W;
493
493
  g && (W = this.pluralResolver.getSuffix(z, n.count, n));
494
- const Z = `${this.options.pluralSeparator}zero`, Y = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
495
- if (g && (q.push(p + W), n.ordinal && W.indexOf(Y) === 0 && q.push(p + W.replace(Y, this.options.pluralSeparator)), b && q.push(p + Z)), x) {
494
+ const Y = `${this.options.pluralSeparator}zero`, Z = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
495
+ if (g && (q.push(p + W), n.ordinal && W.indexOf(Z) === 0 && q.push(p + W.replace(Z, this.options.pluralSeparator)), b && q.push(p + Y)), A) {
496
496
  const Se = `${p}${this.options.contextSeparator}${n.context}`;
497
- q.push(Se), g && (q.push(Se + W), n.ordinal && W.indexOf(Y) === 0 && q.push(Se + W.replace(Y, this.options.pluralSeparator)), b && q.push(Se + Z));
497
+ q.push(Se), g && (q.push(Se + W), n.ordinal && W.indexOf(Z) === 0 && q.push(Se + W.replace(Z, this.options.pluralSeparator)), b && q.push(Se + Y));
498
498
  }
499
499
  }
500
500
  let M;
501
501
  for (; M = q.pop(); )
502
- this.isValidLookup(r) || (s = M, r = this.getResource(z, O, M, n));
502
+ this.isValidLookup(r) || (s = M, r = this.getResource(z, D, M, n));
503
503
  }));
504
504
  });
505
505
  }), {
@@ -696,13 +696,13 @@ class Yy {
696
696
  unescapePrefix: h,
697
697
  nestingPrefix: g,
698
698
  nestingPrefixEscaped: b,
699
- nestingSuffix: x,
699
+ nestingSuffix: A,
700
700
  nestingSuffixEscaped: C,
701
- nestingOptionsSeparator: O,
702
- maxReplaces: D,
703
- alwaysFormat: A
701
+ nestingOptionsSeparator: D,
702
+ maxReplaces: O,
703
+ alwaysFormat: x
704
704
  } = e.interpolation;
705
- this.escape = n !== void 0 ? n : Vy, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? li(s) : a || "{{", this.suffix = l ? li(l) : u || "}}", this.formatSeparator = d || ",", this.unescapePrefix = p ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : p || "", this.nestingPrefix = g ? li(g) : b || li("$t("), this.nestingSuffix = x ? li(x) : C || li(")"), this.nestingOptionsSeparator = O || ",", this.maxReplaces = D || 1e3, this.alwaysFormat = A !== void 0 ? A : !1, this.resetRegExp();
705
+ this.escape = n !== void 0 ? n : Vy, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? li(s) : a || "{{", this.suffix = l ? li(l) : u || "}}", this.formatSeparator = d || ",", this.unescapePrefix = p ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : p || "", this.nestingPrefix = g ? li(g) : b || li("$t("), this.nestingSuffix = A ? li(A) : C || li(")"), this.nestingOptionsSeparator = D || ",", this.maxReplaces = O || 1e3, this.alwaysFormat = x !== void 0 ? x : !1, this.resetRegExp();
706
706
  }
707
707
  reset() {
708
708
  this.options && this.init(this.options);
@@ -714,37 +714,37 @@ class Yy {
714
714
  interpolate(e, n, r, i) {
715
715
  var b;
716
716
  let s, a, l;
717
- const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, d = (x) => {
718
- if (x.indexOf(this.formatSeparator) < 0) {
719
- const A = ah(n, u, x, this.options.keySeparator, this.options.ignoreJSONStructure);
720
- return this.alwaysFormat ? this.format(A, void 0, r, {
717
+ const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, d = (A) => {
718
+ if (A.indexOf(this.formatSeparator) < 0) {
719
+ const x = ah(n, u, A, this.options.keySeparator, this.options.ignoreJSONStructure);
720
+ return this.alwaysFormat ? this.format(x, void 0, r, {
721
721
  ...i,
722
722
  ...n,
723
- interpolationkey: x
724
- }) : A;
723
+ interpolationkey: A
724
+ }) : x;
725
725
  }
726
- const C = x.split(this.formatSeparator), O = C.shift().trim(), D = C.join(this.formatSeparator).trim();
727
- return this.format(ah(n, u, O, this.options.keySeparator, this.options.ignoreJSONStructure), D, r, {
726
+ const C = A.split(this.formatSeparator), D = C.shift().trim(), O = C.join(this.formatSeparator).trim();
727
+ return this.format(ah(n, u, D, this.options.keySeparator, this.options.ignoreJSONStructure), O, r, {
728
728
  ...i,
729
729
  ...n,
730
- interpolationkey: O
730
+ interpolationkey: D
731
731
  });
732
732
  };
733
733
  this.resetRegExp();
734
734
  const p = (i == null ? void 0 : i.missingInterpolationHandler) || this.options.missingInterpolationHandler, h = ((b = i == null ? void 0 : i.interpolation) == null ? void 0 : b.skipOnVariables) !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
735
735
  return [{
736
736
  regex: this.regexpUnescape,
737
- safeValue: (x) => Cl(x)
737
+ safeValue: (A) => Cl(A)
738
738
  }, {
739
739
  regex: this.regexp,
740
- safeValue: (x) => this.escapeValue ? Cl(this.escape(x)) : Cl(x)
741
- }].forEach((x) => {
742
- for (l = 0; s = x.regex.exec(e); ) {
740
+ safeValue: (A) => this.escapeValue ? Cl(this.escape(A)) : Cl(A)
741
+ }].forEach((A) => {
742
+ for (l = 0; s = A.regex.exec(e); ) {
743
743
  const C = s[1].trim();
744
744
  if (a = d(C), a === void 0)
745
745
  if (typeof p == "function") {
746
- const D = p(e, s, i);
747
- a = Ne(D) ? D : "";
746
+ const O = p(e, s, i);
747
+ a = Ne(O) ? O : "";
748
748
  } else if (i && Object.prototype.hasOwnProperty.call(i, C))
749
749
  a = "";
750
750
  else if (h) {
@@ -753,8 +753,8 @@ class Yy {
753
753
  } else
754
754
  this.logger.warn(`missed to pass in variable ${C} for interpolating ${e}`), a = "";
755
755
  else !Ne(a) && !this.useRawValueToEscape && (a = Zf(a));
756
- const O = x.safeValue(a);
757
- if (e = e.replace(s[0], O), h ? (x.regex.lastIndex += a.length, x.regex.lastIndex -= s[0].length) : x.regex.lastIndex = 0, l++, l >= this.maxReplaces)
756
+ const D = A.safeValue(a);
757
+ if (e = e.replace(s[0], D), h ? (A.regex.lastIndex += a.length, A.regex.lastIndex -= s[0].length) : A.regex.lastIndex = 0, l++, l >= this.maxReplaces)
758
758
  break;
759
759
  }
760
760
  }), e;
@@ -767,8 +767,8 @@ class Yy {
767
767
  const h = u.split(new RegExp(`${p}[ ]*{`));
768
768
  let g = `{${h[1]}`;
769
769
  u = h[0], g = this.interpolate(g, a);
770
- const b = g.match(/'/g), x = g.match(/"/g);
771
- (((b == null ? void 0 : b.length) ?? 0) % 2 === 0 && !x || x.length % 2 !== 0) && (g = g.replace(/'/g, '"'));
770
+ const b = g.match(/'/g), A = g.match(/"/g);
771
+ (((b == null ? void 0 : b.length) ?? 0) % 2 === 0 && !A || A.length % 2 !== 0) && (g = g.replace(/'/g, '"'));
772
772
  try {
773
773
  a = JSON.parse(g), d && (a = {
774
774
  ...d,
@@ -894,8 +894,8 @@ class Qy {
894
894
  if (this.formats[d]) {
895
895
  let g = l;
896
896
  try {
897
- const b = ((h = i == null ? void 0 : i.formatParams) == null ? void 0 : h[i.interpolationkey]) || {}, x = b.locale || b.lng || i.locale || i.lng || r;
898
- g = this.formats[d](l, x, {
897
+ const b = ((h = i == null ? void 0 : i.formatParams) == null ? void 0 : h[i.interpolationkey]) || {}, A = b.locale || b.lng || i.locale || i.lng || r;
898
+ g = this.formats[d](l, A, {
899
899
  ...p,
900
900
  ...i,
901
901
  ...b
@@ -1035,16 +1035,16 @@ class tw extends dc {
1035
1035
  const b = {
1036
1036
  ...a,
1037
1037
  isUpdate: s
1038
- }, x = this.backend.create.bind(this.backend);
1039
- if (x.length < 6)
1038
+ }, A = this.backend.create.bind(this.backend);
1039
+ if (A.length < 6)
1040
1040
  try {
1041
1041
  let C;
1042
- x.length === 5 ? C = x(e, n, r, i, b) : C = x(e, n, r, i), C && typeof C.then == "function" ? C.then((O) => l(null, O)).catch(l) : l(null, C);
1042
+ A.length === 5 ? C = A(e, n, r, i, b) : C = A(e, n, r, i), C && typeof C.then == "function" ? C.then((D) => l(null, D)).catch(l) : l(null, C);
1043
1043
  } catch (C) {
1044
1044
  l(C);
1045
1045
  }
1046
1046
  else
1047
- x(e, n, r, i, l, b);
1047
+ A(e, n, r, i, l, b);
1048
1048
  }
1049
1049
  !e || !e[0] || this.store.addResource(e[0], n, r, i);
1050
1050
  }
@@ -1155,12 +1155,12 @@ class Rs extends dc {
1155
1155
  }), p && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (g.formatter = s(p), g.formatter.init(g, this.options), this.options.interpolation.format = g.formatter.format.bind(g.formatter)), g.interpolator = new Yy(this.options), g.utils = {
1156
1156
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1157
1157
  }, g.backendConnector = new tw(s(this.modules.backend), g.resourceStore, g, this.options), g.backendConnector.on("*", function(b) {
1158
- for (var x = arguments.length, C = new Array(x > 1 ? x - 1 : 0), O = 1; O < x; O++)
1159
- C[O - 1] = arguments[O];
1158
+ for (var A = arguments.length, C = new Array(A > 1 ? A - 1 : 0), D = 1; D < A; D++)
1159
+ C[D - 1] = arguments[D];
1160
1160
  e.emit(b, ...C);
1161
1161
  }), this.modules.languageDetector && (g.languageDetector = s(this.modules.languageDetector), g.languageDetector.init && g.languageDetector.init(g, this.options.detection, this.options)), this.modules.i18nFormat && (g.i18nFormat = s(this.modules.i18nFormat), g.i18nFormat.init && g.i18nFormat.init(this)), this.translator = new _a(this.services, this.options), this.translator.on("*", function(b) {
1162
- for (var x = arguments.length, C = new Array(x > 1 ? x - 1 : 0), O = 1; O < x; O++)
1163
- C[O - 1] = arguments[O];
1162
+ for (var A = arguments.length, C = new Array(A > 1 ? A - 1 : 0), D = 1; D < A; D++)
1163
+ C[D - 1] = arguments[D];
1164
1164
  e.emit(b, ...C);
1165
1165
  }), this.modules.external.forEach((b) => {
1166
1166
  b.init && b.init(this);
@@ -1265,7 +1265,7 @@ class Rs extends dc {
1265
1265
  u.lng = u.lng || s.lng, u.lngs = u.lngs || s.lngs, u.ns = u.ns || s.ns, u.keyPrefix !== "" && (u.keyPrefix = u.keyPrefix || r || s.keyPrefix);
1266
1266
  const g = i.options.keySeparator || ".";
1267
1267
  let b;
1268
- return u.keyPrefix && Array.isArray(a) ? b = a.map((x) => `${u.keyPrefix}${g}${x}`) : b = u.keyPrefix ? `${u.keyPrefix}${g}${a}` : a, i.t(b, u);
1268
+ return u.keyPrefix && Array.isArray(a) ? b = a.map((A) => `${u.keyPrefix}${g}${A}`) : b = u.keyPrefix ? `${u.keyPrefix}${g}${a}` : a, i.t(b, u);
1269
1269
  };
1270
1270
  return Ne(e) ? s.lng = e : s.lngs = e, s.ns = n, s.keyPrefix = r, s;
1271
1271
  }
@@ -3047,8 +3047,8 @@ const rv = new be().openapi(
3047
3047
  }
3048
3048
  }),
3049
3049
  async (t) => {
3050
- const { "tenant-id": e } = t.req.valid("header"), n = await t.env.data.branding.get(e);
3051
- return n ? t.json(n) : t.json(iv);
3050
+ const e = await t.env.data.branding.get(t.var.tenant_id);
3051
+ return e ? t.json(e) : t.json(iv);
3052
3052
  }
3053
3053
  ).openapi(
3054
3054
  U({
@@ -3079,8 +3079,8 @@ const rv = new be().openapi(
3079
3079
  }
3080
3080
  }),
3081
3081
  async (t) => {
3082
- const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json");
3083
- return await t.env.data.branding.set(e, n), t.text("OK");
3082
+ const e = t.req.valid("json");
3083
+ return await t.env.data.branding.set(t.var.tenant_id, e), t.text("OK");
3084
3084
  }
3085
3085
  ).route("/themes", rv);
3086
3086
  var E = class extends Error {
@@ -3166,7 +3166,7 @@ const cv = {}, lv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
3166
3166
  throw Error("Illegal arguments: " + typeof j + ", " + typeof F);
3167
3167
  j < 4 ? j = 4 : j > 31 && (j = 31);
3168
3168
  var P = [];
3169
- return P.push("$2a$"), j < 10 && P.push("0"), P.push(j.toString()), P.push("$"), P.push(h(r(x), x)), P.join("");
3169
+ return P.push("$2a$"), j < 10 && P.push("0"), P.push(j.toString()), P.push("$"), P.push(h(r(A), A)), P.join("");
3170
3170
  }, e.genSalt = function(j, F, P) {
3171
3171
  if (typeof F == "function" && (P = F, F = void 0), typeof j == "function" && (P = j, j = void 0), typeof j > "u")
3172
3172
  j = C;
@@ -3497,7 +3497,7 @@ const cv = {}, lv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
3497
3497
  Date.now = Date.now || function() {
3498
3498
  return +/* @__PURE__ */ new Date();
3499
3499
  };
3500
- var x = 16, C = 10, O = 16, D = 100, A = [
3500
+ var A = 16, C = 10, D = 16, O = 100, x = [
3501
3501
  608135816,
3502
3502
  2242054355,
3503
3503
  320440878,
@@ -4551,7 +4551,7 @@ const cv = {}, lv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
4551
4551
  ];
4552
4552
  function M(j, F, P, N) {
4553
4553
  var k, L = j[F], G = j[F + 1];
4554
- return L ^= P[0], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[1], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[2], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[3], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[4], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[5], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[6], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[7], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[8], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[9], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[10], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[11], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[12], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[13], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[14], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[15], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[16], j[F] = G ^ P[O + 1], j[F + 1] = L, j;
4554
+ return L ^= P[0], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[1], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[2], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[3], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[4], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[5], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[6], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[7], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[8], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[9], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[10], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[11], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[12], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[13], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[14], k = N[L >>> 24], k += N[256 | L >> 16 & 255], k ^= N[512 | L >> 8 & 255], k += N[768 | L & 255], G ^= k ^ P[15], k = N[G >>> 24], k += N[256 | G >> 16 & 255], k ^= N[512 | G >> 8 & 255], k += N[768 | G & 255], L ^= k ^ P[16], j[F] = G ^ P[D + 1], j[F + 1] = L, j;
4555
4555
  }
4556
4556
  function K(j, F) {
4557
4557
  for (var P = 0, N = 0; P < 4; ++P)
@@ -4566,7 +4566,7 @@ const cv = {}, lv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
4566
4566
  for (se = 0; se < G; se += 2)
4567
4567
  k = M(k, 0, F, P), P[se] = k[0], P[se + 1] = k[1];
4568
4568
  }
4569
- function Z(j, F, P, N) {
4569
+ function Y(j, F, P, N) {
4570
4570
  for (var k = 0, L = [0, 0], G = P.length, pe = N.length, se, $e = 0; $e < G; $e++)
4571
4571
  se = K(F, k), k = se.offp, P[$e] = P[$e] ^ se.key;
4572
4572
  for (k = 0, $e = 0; $e < G; $e += 2)
@@ -4574,7 +4574,7 @@ const cv = {}, lv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
4574
4574
  for ($e = 0; $e < pe; $e += 2)
4575
4575
  se = K(j, k), k = se.offp, L[0] ^= se.key, se = K(j, k), k = se.offp, L[1] ^= se.key, L = M(L, 0, P, N), N[$e] = L[0], N[$e + 1] = L[1];
4576
4576
  }
4577
- function Y(j, F, P, N, k) {
4577
+ function Z(j, F, P, N, k) {
4578
4578
  var L = q.slice(), G = L.length, pe;
4579
4579
  if (P < 4 || P > 31)
4580
4580
  if (pe = Error("Illegal number of rounds (4-31): " + P), N) {
@@ -4582,18 +4582,18 @@ const cv = {}, lv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
4582
4582
  return;
4583
4583
  } else
4584
4584
  throw pe;
4585
- if (F.length !== x)
4586
- if (pe = Error("Illegal salt length: " + F.length + " != " + x), N) {
4585
+ if (F.length !== A)
4586
+ if (pe = Error("Illegal salt length: " + F.length + " != " + A), N) {
4587
4587
  a(N.bind(this, pe));
4588
4588
  return;
4589
4589
  } else
4590
4590
  throw pe;
4591
4591
  P = 1 << P >>> 0;
4592
4592
  var se, $e, Ce = 0, ee;
4593
- Int32Array ? (se = new Int32Array(A), $e = new Int32Array(z)) : (se = A.slice(), $e = z.slice()), Z(F, j, se, $e);
4593
+ Int32Array ? (se = new Int32Array(x), $e = new Int32Array(z)) : (se = x.slice(), $e = z.slice()), Y(F, j, se, $e);
4594
4594
  function we() {
4595
4595
  if (k && k(Ce / P), Ce < P)
4596
- for (var Fe = Date.now(); Ce < P && (Ce = Ce + 1, W(j, se, $e), W(F, se, $e), !(Date.now() - Fe > D)); )
4596
+ for (var Fe = Date.now(); Ce < P && (Ce = Ce + 1, W(j, se, $e), W(F, se, $e), !(Date.now() - Fe > O)); )
4597
4597
  ;
4598
4598
  else {
4599
4599
  for (Ce = 0; Ce < 64; Ce++)
@@ -4651,14 +4651,14 @@ const cv = {}, lv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
4651
4651
  throw k;
4652
4652
  var pe = parseInt(F.substring(G, G + 1), 10) * 10, se = parseInt(F.substring(G + 1, G + 2), 10), $e = pe + se, Ce = F.substring(G + 3, G + 25);
4653
4653
  j += L >= "a" ? "\0" : "";
4654
- var ee = l(j), we = g(Ce, x);
4654
+ var ee = l(j), we = g(Ce, A);
4655
4655
  function Un(Fe) {
4656
4656
  var Xe = [];
4657
4657
  return Xe.push("$2"), L >= "a" && Xe.push(L), Xe.push("$"), $e < 10 && Xe.push("0"), Xe.push($e.toString()), Xe.push("$"), Xe.push(h(we, we.length)), Xe.push(h(Fe, q.length * 4 - 1)), Xe.join("");
4658
4658
  }
4659
4659
  if (typeof P > "u")
4660
- return Un(Y(ee, we, $e));
4661
- Y(ee, we, $e, function(Fe, Xe) {
4660
+ return Un(Z(ee, we, $e));
4661
+ Z(ee, we, $e, function(Fe, Xe) {
4662
4662
  Fe ? P(Fe, null) : P(null, Un(Xe));
4663
4663
  }, N);
4664
4664
  }
@@ -4677,7 +4677,7 @@ let pv = (t) => crypto.getRandomValues(new Uint8Array(t)), fv = (t, e, n) => {
4677
4677
  if (a += t[l[u] & r] || "", a.length === s) return a;
4678
4678
  }
4679
4679
  };
4680
- }, qm = (t, e = 21) => fv(t, e, pv), We = (t = 21) => {
4680
+ }, qm = (t, e = 21) => fv(t, e, pv), Ke = (t = 21) => {
4681
4681
  let e = "", n = crypto.getRandomValues(new Uint8Array(t));
4682
4682
  for (; t--; )
4683
4683
  e += dv[n[t] & 63];
@@ -5689,26 +5689,26 @@ const mb = function(t) {
5689
5689
  this.options.transformTagName && (u = this.options.transformTagName(u)), n && r && n.tagname !== "!xml" && (r = this.saveTextToParentTag(r, n, i, !1));
5690
5690
  const b = n;
5691
5691
  if (b && this.options.unpairedTags.indexOf(b.tagname) !== -1 && (n = this.tagsNodeStack.pop(), i = i.substring(0, i.lastIndexOf("."))), u !== e.tagname && (i += i ? "." + u : u), this.isItStopNode(this.options.stopNodes, i, u)) {
5692
- let x = "";
5692
+ let A = "";
5693
5693
  if (p.length > 0 && p.lastIndexOf("/") === p.length - 1)
5694
5694
  u[u.length - 1] === "/" ? (u = u.substr(0, u.length - 1), i = i.substr(0, i.length - 1), p = u) : p = p.substr(0, p.length - 1), s = l.closeIndex;
5695
5695
  else if (this.options.unpairedTags.indexOf(u) !== -1)
5696
5696
  s = l.closeIndex;
5697
5697
  else {
5698
- const O = this.readStopNodeData(t, d, g + 1);
5699
- if (!O) throw new Error(`Unexpected end of ${d}`);
5700
- s = O.i, x = O.tagContent;
5698
+ const D = this.readStopNodeData(t, d, g + 1);
5699
+ if (!D) throw new Error(`Unexpected end of ${d}`);
5700
+ s = D.i, A = D.tagContent;
5701
5701
  }
5702
5702
  const C = new fs(u);
5703
- u !== p && h && (C[":@"] = this.buildAttributesMap(p, i, u)), x && (x = this.parseTextData(x, u, i, !0, h, !0, !0)), i = i.substr(0, i.lastIndexOf(".")), C.add(this.options.textNodeName, x), this.addChild(n, C, i);
5703
+ u !== p && h && (C[":@"] = this.buildAttributesMap(p, i, u)), A && (A = this.parseTextData(A, u, i, !0, h, !0, !0)), i = i.substr(0, i.lastIndexOf(".")), C.add(this.options.textNodeName, A), this.addChild(n, C, i);
5704
5704
  } else {
5705
5705
  if (p.length > 0 && p.lastIndexOf("/") === p.length - 1) {
5706
5706
  u[u.length - 1] === "/" ? (u = u.substr(0, u.length - 1), i = i.substr(0, i.length - 1), p = u) : p = p.substr(0, p.length - 1), this.options.transformTagName && (u = this.options.transformTagName(u));
5707
- const x = new fs(u);
5708
- u !== p && h && (x[":@"] = this.buildAttributesMap(p, i, u)), this.addChild(n, x, i), i = i.substr(0, i.lastIndexOf("."));
5707
+ const A = new fs(u);
5708
+ u !== p && h && (A[":@"] = this.buildAttributesMap(p, i, u)), this.addChild(n, A, i), i = i.substr(0, i.lastIndexOf("."));
5709
5709
  } else {
5710
- const x = new fs(u);
5711
- this.tagsNodeStack.push(n), u !== p && h && (x[":@"] = this.buildAttributesMap(p, i, u)), this.addChild(n, x, i), n = x;
5710
+ const A = new fs(u);
5711
+ this.tagsNodeStack.push(n), u !== p && h && (A[":@"] = this.buildAttributesMap(p, i, u)), this.addChild(n, A, i), n = A;
5712
5712
  }
5713
5713
  r = "", s = g;
5714
5714
  }
@@ -5939,8 +5939,8 @@ function e_(t, e, n, r) {
5939
5939
  if (u === void 0) continue;
5940
5940
  let d = "";
5941
5941
  if (n.length === 0 ? d = u : d = `${n}.${u}`, u === e.textNodeName) {
5942
- let x = l[u];
5943
- Bb(d, e) || (x = e.tagValueProcessor(u, x), x = t_(x, e)), s && (i += r), i += x, s = !1;
5942
+ let A = l[u];
5943
+ Bb(d, e) || (A = e.tagValueProcessor(u, A), A = t_(A, e)), s && (i += r), i += A, s = !1;
5944
5944
  continue;
5945
5945
  } else if (u === e.cdataPropName) {
5946
5946
  s && (i += r), i += `<![CDATA[${l[u][0][e.textNodeName]}]]>`, s = !1;
@@ -5949,9 +5949,9 @@ function e_(t, e, n, r) {
5949
5949
  i += r + `<!--${l[u][0][e.textNodeName]}-->`, s = !0;
5950
5950
  continue;
5951
5951
  } else if (u[0] === "?") {
5952
- const x = $h(l[":@"], e), C = u === "?xml" ? "" : r;
5953
- let O = l[u][0][e.textNodeName];
5954
- O = O.length !== 0 ? " " + O : "", i += C + `<${u}${O}${x}?>`, s = !0;
5952
+ const A = $h(l[":@"], e), C = u === "?xml" ? "" : r;
5953
+ let D = l[u][0][e.textNodeName];
5954
+ D = D.length !== 0 ? " " + D : "", i += C + `<${u}${D}${A}?>`, s = !0;
5955
5955
  continue;
5956
5956
  }
5957
5957
  let p = r;
@@ -6171,7 +6171,7 @@ function Xb(t, e, n) {
6171
6171
  });
6172
6172
  }
6173
6173
  async function Jb(t, e, n, r, i) {
6174
- var b, x, C;
6174
+ var b, A, C;
6175
6175
  if (!n.redirect_uri)
6176
6176
  throw new E(400, {
6177
6177
  message: "Missing redirect_uri in authParams"
@@ -6201,7 +6201,7 @@ async function Jb(t, e, n, r, i) {
6201
6201
  audience: u || n.client_id,
6202
6202
  destination: h.toString(),
6203
6203
  inResponseTo: p.requestId,
6204
- userId: ((C = (x = r.app_metadata) == null ? void 0 : x.vimeo) == null ? void 0 : C.user_id) || r.user_id,
6204
+ userId: ((C = (A = r.app_metadata) == null ? void 0 : A.vimeo) == null ? void 0 : C.user_id) || r.user_id,
6205
6205
  email: r.email,
6206
6206
  sessionIndex: i,
6207
6207
  signature: {
@@ -6217,7 +6217,7 @@ async function Jb(t, e, n, r, i) {
6217
6217
  );
6218
6218
  }
6219
6219
  async function Yb(t, e) {
6220
- const n = e.notBefore || (/* @__PURE__ */ new Date()).toISOString(), r = e.notAfter || new Date(new Date(n).getTime() + 10 * 60 * 1e3).toISOString(), i = e.issueInstant || n, s = e.sessionNotOnOrAfter || r, a = e.responseId || `_${We()}`, l = e.assertionId || `_${We()}`, u = [
6220
+ const n = e.notBefore || (/* @__PURE__ */ new Date()).toISOString(), r = e.notAfter || new Date(new Date(n).getTime() + 10 * 60 * 1e3).toISOString(), i = e.issueInstant || n, s = e.sessionNotOnOrAfter || r, a = e.responseId || `_${Ke()}`, l = e.assertionId || `_${Ke()}`, u = [
6221
6221
  {
6222
6222
  "samlp:Response": [
6223
6223
  {
@@ -6574,7 +6574,7 @@ const r_ = [
6574
6574
  // Returns phone_number and phone_number_verified
6575
6575
  ];
6576
6576
  async function e3(t, e) {
6577
- var A, z;
6577
+ var x, z;
6578
6578
  const { tenantId: n, clientId: r, audience: i, requestedScopes: s } = e, a = s.filter(
6579
6579
  (q) => r_.includes(q)
6580
6580
  ), u = (await t.env.data.resourceServers.list(n)).resource_servers.filter(
@@ -6585,43 +6585,43 @@ async function e3(t, e) {
6585
6585
  const d = u[0];
6586
6586
  if (!d)
6587
6587
  return { scopes: a, permissions: [] };
6588
- const p = ((A = d.options) == null ? void 0 : A.enforce_policies) === !0, h = ((z = d.options) == null ? void 0 : z.token_dialect) || "access_token", b = (await t.env.data.clientGrants.list(n, {
6588
+ const p = ((x = d.options) == null ? void 0 : x.enforce_policies) === !0, h = ((z = d.options) == null ? void 0 : z.token_dialect) || "access_token", b = (await t.env.data.clientGrants.list(n, {
6589
6589
  q: `client_id:"${r}"`
6590
6590
  })).client_grants.find(
6591
6591
  (q) => q.audience === i
6592
6592
  );
6593
6593
  if (!b)
6594
6594
  return { scopes: a, permissions: [] };
6595
- const x = b.scope || [], C = (d.scopes || []).map(
6595
+ const A = b.scope || [], C = (d.scopes || []).map(
6596
6596
  (q) => q.value
6597
6597
  );
6598
6598
  if (!p) {
6599
6599
  let q;
6600
- return s.length === 0 ? q = x.filter(
6600
+ return s.length === 0 ? q = A.filter(
6601
6601
  (K) => C.includes(K)
6602
6602
  ) : q = s.filter(
6603
- (K) => C.includes(K) && x.includes(K)
6603
+ (K) => C.includes(K) && A.includes(K)
6604
6604
  ), { scopes: [
6605
6605
  .../* @__PURE__ */ new Set([...a, ...q])
6606
6606
  ], permissions: [] };
6607
6607
  }
6608
6608
  if (h === "access_token_authz") {
6609
- const q = x.filter(
6609
+ const q = A.filter(
6610
6610
  (M) => C.includes(M)
6611
6611
  );
6612
6612
  return { scopes: a, permissions: q };
6613
6613
  }
6614
- let O;
6615
- return s.length === 0 ? O = x.filter(
6614
+ let D;
6615
+ return s.length === 0 ? D = A.filter(
6616
6616
  (q) => C.includes(q)
6617
- ) : O = s.filter(
6618
- (q) => C.includes(q) && x.includes(q)
6617
+ ) : D = s.filter(
6618
+ (q) => C.includes(q) && A.includes(q)
6619
6619
  ), { scopes: [
6620
- .../* @__PURE__ */ new Set([...a, ...O])
6620
+ .../* @__PURE__ */ new Set([...a, ...D])
6621
6621
  ], permissions: [] };
6622
6622
  }
6623
6623
  async function va(t, e) {
6624
- var W, Z;
6624
+ var W, Y;
6625
6625
  if (e.grantType === En.ClientCredential)
6626
6626
  return await e3(t, {
6627
6627
  tenantId: e.tenantId,
@@ -6642,9 +6642,9 @@ async function va(t, e) {
6642
6642
  error_description: "User is not a member of the specified organization"
6643
6643
  });
6644
6644
  const l = s.filter(
6645
- (Y) => r_.includes(Y)
6645
+ (Z) => r_.includes(Z)
6646
6646
  ), d = (await t.env.data.resourceServers.list(n)).resource_servers.filter(
6647
- (Y) => Y.identifier === i
6647
+ (Z) => Z.identifier === i
6648
6648
  );
6649
6649
  if (d.length === 0)
6650
6650
  return { scopes: l, permissions: [] };
@@ -6652,17 +6652,17 @@ async function va(t, e) {
6652
6652
  if (!p)
6653
6653
  return { scopes: l, permissions: [] };
6654
6654
  const h = (p.scopes || []).map(
6655
- (Y) => Y.value
6656
- ), g = ((W = p.options) == null ? void 0 : W.enforce_policies) === !0, b = ((Z = p.options) == null ? void 0 : Z.token_dialect) || "access_token";
6655
+ (Z) => Z.value
6656
+ ), g = ((W = p.options) == null ? void 0 : W.enforce_policies) === !0, b = ((Y = p.options) == null ? void 0 : Y.token_dialect) || "access_token";
6657
6657
  if (!g) {
6658
- const Y = s.filter(
6658
+ const Z = s.filter(
6659
6659
  (j) => h.includes(j)
6660
6660
  );
6661
6661
  return { scopes: [
6662
- .../* @__PURE__ */ new Set([...l, ...Y])
6662
+ .../* @__PURE__ */ new Set([...l, ...Z])
6663
6663
  ], permissions: [] };
6664
6664
  }
6665
- const x = await t.env.data.userPermissions.list(
6665
+ const A = await t.env.data.userPermissions.list(
6666
6666
  n,
6667
6667
  r,
6668
6668
  void 0,
@@ -6673,34 +6673,34 @@ async function va(t, e) {
6673
6673
  r,
6674
6674
  void 0,
6675
6675
  ""
6676
- ), O = a ? await t.env.data.userRoles.list(
6676
+ ), D = a ? await t.env.data.userRoles.list(
6677
6677
  n,
6678
6678
  r,
6679
6679
  void 0,
6680
6680
  a
6681
- ) : [], D = [...C, ...O], A = [];
6682
- for (const Y of D)
6681
+ ) : [], O = [...C, ...D], x = [];
6682
+ for (const Z of O)
6683
6683
  (await t.env.data.rolePermissions.list(
6684
6684
  n,
6685
- Y.id
6685
+ Z.id
6686
6686
  )).forEach((j) => {
6687
- j.resource_server_identifier === i && A.push(j.permission_name);
6687
+ j.resource_server_identifier === i && x.push(j.permission_name);
6688
6688
  });
6689
6689
  const z = /* @__PURE__ */ new Set();
6690
- x.forEach((Y) => {
6691
- Y.resource_server_identifier === i && z.add(Y.permission_name);
6692
- }), A.forEach((Y) => {
6693
- z.add(Y);
6690
+ A.forEach((Z) => {
6691
+ Z.resource_server_identifier === i && z.add(Z.permission_name);
6692
+ }), x.forEach((Z) => {
6693
+ z.add(Z);
6694
6694
  });
6695
6695
  const q = Array.from(z);
6696
6696
  if (b === "access_token_authz") {
6697
- const Y = q.filter(
6697
+ const Z = q.filter(
6698
6698
  (Se) => h.includes(Se)
6699
6699
  );
6700
- return { scopes: l, permissions: Y };
6700
+ return { scopes: l, permissions: Z };
6701
6701
  }
6702
6702
  const M = s.filter(
6703
- (Y) => h.includes(Y) && q.includes(Y)
6703
+ (Z) => h.includes(Z) && q.includes(Z)
6704
6704
  );
6705
6705
  return { scopes: [
6706
6706
  .../* @__PURE__ */ new Set([...l, ...M])
@@ -6708,7 +6708,7 @@ async function va(t, e) {
6708
6708
  }
6709
6709
  const xh = ["sub", "iss", "aud", "exp", "nbf", "iat", "jti"];
6710
6710
  async function yc(t, e) {
6711
- var A, z;
6711
+ var x, z;
6712
6712
  const { authParams: n, user: r, client: i, session_id: s, organization: a, permissions: l } = e, { signingKeys: u } = await t.env.data.keys.list({
6713
6713
  q: "type:jwt_signing"
6714
6714
  }), d = u.filter(
@@ -6726,7 +6726,7 @@ async function yc(t, e) {
6726
6726
  sid: s,
6727
6727
  ...a && { org_id: a.id },
6728
6728
  ...l && l.length > 0 && { permissions: l }
6729
- }, x = r && ((A = n.scope) != null && A.split(" ").includes("openid")) ? {
6729
+ }, A = r && ((x = n.scope) != null && x.split(" ").includes("openid")) ? {
6730
6730
  // The audience for an id token is the client id
6731
6731
  aud: n.client_id,
6732
6732
  sub: r.user_id,
@@ -6772,7 +6772,7 @@ async function yc(t, e) {
6772
6772
  setCustomClaim: (q, M) => {
6773
6773
  if (xh.includes(q))
6774
6774
  throw new Error(`Cannot overwrite reserved claim '${q}'`);
6775
- x && (x[q] = M);
6775
+ A && (A[q] = M);
6776
6776
  }
6777
6777
  },
6778
6778
  access: {
@@ -6790,16 +6790,16 @@ async function yc(t, e) {
6790
6790
  headers: {
6791
6791
  kid: p.kid
6792
6792
  }
6793
- }, O = await _h(
6793
+ }, D = await _h(
6794
6794
  "RS256",
6795
6795
  h,
6796
6796
  b,
6797
6797
  C
6798
- ), D = x ? await _h("RS256", h, x, C) : void 0;
6798
+ ), O = A ? await _h("RS256", h, A, C) : void 0;
6799
6799
  return {
6800
- access_token: O,
6800
+ access_token: D,
6801
6801
  refresh_token: e.refresh_token,
6802
- id_token: D,
6802
+ id_token: O,
6803
6803
  token_type: "Bearer",
6804
6804
  expires_in: 86400
6805
6805
  };
@@ -6807,7 +6807,7 @@ async function yc(t, e) {
6807
6807
  async function i_(t, e) {
6808
6808
  return {
6809
6809
  code: (await t.env.data.codes.create(e.client.tenant.id, {
6810
- code_id: We(),
6810
+ code_id: Ke(),
6811
6811
  user_id: e.user.user_id,
6812
6812
  code_type: "authorization_code",
6813
6813
  login_id: e.login_id,
@@ -6834,7 +6834,7 @@ async function s_(t, e) {
6834
6834
  return await t.env.data.refreshTokens.create(
6835
6835
  n.tenant.id,
6836
6836
  {
6837
- id: We(),
6837
+ id: Ke(),
6838
6838
  session_id: s,
6839
6839
  client_id: n.client_id,
6840
6840
  idle_expires_at: new Date(
@@ -6862,7 +6862,7 @@ async function s_(t, e) {
6862
6862
  }
6863
6863
  async function o_(t, { user: e, client: n, loginSession: r }) {
6864
6864
  const i = await t.env.data.sessions.create(n.tenant.id, {
6865
- id: We(),
6865
+ id: Ke(),
6866
6866
  user_id: e.user_id,
6867
6867
  login_session_id: r.id,
6868
6868
  idle_expires_at: new Date(
@@ -6884,7 +6884,7 @@ async function o_(t, { user: e, client: n, loginSession: r }) {
6884
6884
  }), i;
6885
6885
  }
6886
6886
  async function On(t, e) {
6887
- var x, C;
6887
+ var A, C;
6888
6888
  const { authParams: n, client: r, ticketAuth: i } = e;
6889
6889
  let { user: s } = e;
6890
6890
  const a = n.response_type || cn.CODE, l = n.response_mode || Kn.QUERY, u = Ve(t, {
@@ -6904,31 +6904,31 @@ async function On(t, e) {
6904
6904
  throw new E(500, {
6905
6905
  message: "Login session not found for ticket auth."
6906
6906
  });
6907
- const O = bv(), D = We(12), A = await t.env.data.codes.create(r.tenant.id, {
6908
- code_id: We(),
6907
+ const D = bv(), O = Ke(12), x = await t.env.data.codes.create(r.tenant.id, {
6908
+ code_id: Ke(),
6909
6909
  code_type: "ticket",
6910
6910
  login_id: e.loginSession.id,
6911
6911
  expires_at: new Date(Date.now() + kv).toISOString(),
6912
- code_verifier: [D, O].join("|"),
6912
+ code_verifier: [O, D].join("|"),
6913
6913
  redirect_uri: n.redirect_uri,
6914
6914
  state: n.state,
6915
6915
  nonce: n.nonce
6916
6916
  });
6917
6917
  return t.json({
6918
- login_ticket: A.code_id,
6919
- co_verifier: O,
6920
- co_id: D
6918
+ login_ticket: x.code_id,
6919
+ co_verifier: D,
6920
+ co_id: O
6921
6921
  });
6922
6922
  }
6923
6923
  let d = e.refreshToken, p = e.sessionId;
6924
- if (!p && ((x = e.loginSession) != null && x.session_id)) {
6924
+ if (!p && ((A = e.loginSession) != null && A.session_id)) {
6925
6925
  p = e.loginSession.session_id;
6926
- const O = await t.env.data.sessions.get(
6926
+ const D = await t.env.data.sessions.get(
6927
6927
  r.tenant.id,
6928
6928
  p
6929
6929
  );
6930
- O && !O.clients.includes(r.client_id) && await t.env.data.sessions.update(r.tenant.id, p, {
6931
- clients: [...O.clients, r.client_id]
6930
+ D && !D.clients.includes(r.client_id) && await t.env.data.sessions.update(r.tenant.id, p, {
6931
+ clients: [...D.clients, r.client_id]
6932
6932
  });
6933
6933
  } else if (!p) {
6934
6934
  if (!e.loginSession)
@@ -6981,26 +6981,26 @@ async function On(t, e) {
6981
6981
  throw new E(400, {
6982
6982
  message: "Redirect URI not allowed for WEB_MESSAGE response mode."
6983
6983
  });
6984
- const O = new Headers();
6984
+ const D = new Headers();
6985
6985
  if (p) {
6986
6986
  const z = wa(
6987
6987
  r.tenant.id,
6988
6988
  p,
6989
6989
  t.var.host || ""
6990
6990
  );
6991
- z && O.set("set-cookie", z);
6991
+ z && D.set("set-cookie", z);
6992
6992
  } else
6993
6993
  console.warn(
6994
6994
  "Session ID not available for WEB_MESSAGE, cookie will not be set."
6995
6995
  );
6996
- const D = new URL(n.redirect_uri), A = `${D.protocol}//${D.host}`;
6996
+ const O = new URL(n.redirect_uri), x = `${O.protocol}//${O.host}`;
6997
6997
  return t.html(
6998
6998
  Tu(
6999
- A,
6999
+ x,
7000
7000
  JSON.stringify({ ...h, state: n.state })
7001
7001
  ),
7002
7002
  {
7003
- headers: O
7003
+ headers: D
7004
7004
  }
7005
7005
  );
7006
7006
  }
@@ -7010,12 +7010,12 @@ async function On(t, e) {
7010
7010
  });
7011
7011
  const g = new Headers();
7012
7012
  if (p) {
7013
- const O = wa(
7013
+ const D = wa(
7014
7014
  r.tenant.id,
7015
7015
  p,
7016
7016
  t.var.custom_domain || t.req.header("host") || ""
7017
7017
  );
7018
- O && g.set("set-cookie", O);
7018
+ D && g.set("set-cookie", D);
7019
7019
  }
7020
7020
  const b = new URL(n.redirect_uri);
7021
7021
  if ("code" in h)
@@ -7070,8 +7070,8 @@ async function t3(t, e) {
7070
7070
  organizationId: (u = e.organization) == null ? void 0 : u.id
7071
7071
  });
7072
7072
  else {
7073
- const x = (n == null ? void 0 : n.user_id) || ((d = e.user) == null ? void 0 : d.user_id);
7074
- if (!x)
7073
+ const A = (n == null ? void 0 : n.user_id) || ((d = e.user) == null ? void 0 : d.user_id);
7074
+ if (!A)
7075
7075
  throw new Oi(400, {
7076
7076
  error: "invalid_request",
7077
7077
  error_description: "User ID is required for user-based grants"
@@ -7079,7 +7079,7 @@ async function t3(t, e) {
7079
7079
  b = await va(t, {
7080
7080
  grantType: e.grantType,
7081
7081
  tenantId: e.client.tenant.id,
7082
- userId: x,
7082
+ userId: A,
7083
7083
  clientId: e.client.client_id,
7084
7084
  audience: e.authParams.audience,
7085
7085
  requestedScopes: ((p = e.authParams.scope) == null ? void 0 : p.split(" ")) || [],
@@ -7637,45 +7637,45 @@ const kh = qt.extend({
7637
7637
  }
7638
7638
  }),
7639
7639
  async (t) => {
7640
- const { page: e, per_page: n, include_totals: r, sort: i, q: s } = t.req.valid("query"), { "tenant-id": a } = t.req.valid("header");
7640
+ const { page: e, per_page: n, include_totals: r, sort: i, q: s } = t.req.valid("query");
7641
7641
  if (s != null && s.includes("identities.profileData.email")) {
7642
- const p = s.split("=")[1], g = (await t.env.data.users.list(a, {
7642
+ const d = s.split("=")[1], h = (await t.env.data.users.list(t.var.tenant_id, {
7643
7643
  page: e,
7644
7644
  per_page: n,
7645
7645
  include_totals: r,
7646
- q: `email:${p}`
7647
- })).users.filter((C) => C.linked_to), [b] = g;
7648
- if (!b)
7646
+ q: `email:${d}`
7647
+ })).users.filter((A) => A.linked_to), [g] = h;
7648
+ if (!g)
7649
7649
  return t.json([]);
7650
- const x = await t.env.data.users.get(
7651
- a,
7650
+ const b = await t.env.data.users.get(
7651
+ t.var.tenant_id,
7652
7652
  // we know linked_to is truthy here but typescript cannot read .filter() logic above
7653
7653
  // possible to fix!
7654
- b.linked_to
7654
+ g.linked_to
7655
7655
  );
7656
- if (!x)
7656
+ if (!b)
7657
7657
  throw new E(500, {
7658
7658
  message: "Primary account not found"
7659
7659
  });
7660
- return t.json([Mn.parse(x)]);
7660
+ return t.json([Mn.parse(b)]);
7661
7661
  }
7662
- const l = ["-_exists_:linked_to"];
7663
- s && l.push(s);
7664
- const u = await t.env.data.users.list(a, {
7662
+ const a = ["-_exists_:linked_to"];
7663
+ s && a.push(s);
7664
+ const l = await t.env.data.users.list(t.var.tenant_id, {
7665
7665
  page: e,
7666
7666
  per_page: n,
7667
7667
  include_totals: r,
7668
7668
  sort: bt(i),
7669
- q: l.join(" ")
7670
- }), d = u.users.filter((p) => !p.linked_to);
7669
+ q: a.join(" ")
7670
+ }), u = l.users.filter((d) => !d.linked_to);
7671
7671
  return r ? t.json(
7672
7672
  kh.parse({
7673
- users: d,
7674
- length: u.length,
7675
- start: u.start,
7676
- limit: u.limit
7673
+ users: u,
7674
+ length: l.length,
7675
+ start: l.start,
7676
+ limit: l.limit
7677
7677
  })
7678
- ) : t.json(o.array(Mn).parse(d));
7678
+ ) : t.json(o.array(Mn).parse(u));
7679
7679
  }
7680
7680
  ).openapi(
7681
7681
  U({
@@ -7707,14 +7707,14 @@ const kh = qt.extend({
7707
7707
  }
7708
7708
  }),
7709
7709
  async (t) => {
7710
- const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), r = await t.env.data.users.get(n, e);
7711
- if (!r)
7710
+ const { user_id: e } = t.req.valid("param"), n = await t.env.data.users.get(t.var.tenant_id, e);
7711
+ if (!n)
7712
7712
  throw new E(404);
7713
- if (r.linked_to)
7713
+ if (n.linked_to)
7714
7714
  throw new E(404, {
7715
7715
  message: "User is linked to another user"
7716
7716
  });
7717
- return t.json(r);
7717
+ return t.json(n);
7718
7718
  }
7719
7719
  ).openapi(
7720
7720
  U({
@@ -7741,8 +7741,11 @@ const kh = qt.extend({
7741
7741
  }
7742
7742
  }),
7743
7743
  async (t) => {
7744
- const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header");
7745
- if (!await t.env.data.users.remove(n, e))
7744
+ const { user_id: e } = t.req.valid("param");
7745
+ if (!await t.env.data.users.remove(
7746
+ t.var.tenant_id,
7747
+ e
7748
+ ))
7746
7749
  throw new E(404);
7747
7750
  return t.text("OK");
7748
7751
  }
@@ -7780,55 +7783,55 @@ const kh = qt.extend({
7780
7783
  }
7781
7784
  }),
7782
7785
  async (t) => {
7783
- const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json");
7784
- t.set("body", n);
7786
+ const e = t.req.valid("json");
7787
+ t.set("body", e);
7785
7788
  const {
7786
- email: r,
7787
- phone_number: i,
7788
- name: s,
7789
- linked_to: a,
7790
- email_verified: l,
7791
- provider: u,
7792
- connection: d
7793
- } = n, p = `${n.provider}|${n.user_id || gc()}`;
7789
+ email: n,
7790
+ phone_number: r,
7791
+ name: i,
7792
+ linked_to: s,
7793
+ email_verified: a,
7794
+ provider: l,
7795
+ connection: u
7796
+ } = e, d = `${e.provider}|${e.user_id || gc()}`;
7794
7797
  try {
7795
- const h = await t.env.data.users.create(e, {
7796
- email: r,
7797
- user_id: p,
7798
- name: s || r || i,
7799
- phone_number: i,
7800
- provider: u,
7801
- connection: d,
7802
- linked_to: a ?? void 0,
7803
- email_verified: l || !1,
7798
+ const p = await t.env.data.users.create(t.var.tenant_id, {
7799
+ email: n,
7800
+ user_id: d,
7801
+ name: i || n || r,
7802
+ phone_number: r,
7803
+ provider: l,
7804
+ connection: u,
7805
+ linked_to: s ?? void 0,
7806
+ email_verified: a || !1,
7804
7807
  last_ip: "",
7805
7808
  is_social: !1,
7806
7809
  last_login: (/* @__PURE__ */ new Date()).toISOString()
7807
7810
  });
7808
- t.set("user_id", h.user_id);
7809
- const g = Ve(t, {
7811
+ t.set("user_id", p.user_id);
7812
+ const h = Ve(t, {
7810
7813
  type: qe.SUCCESS_API_OPERATION,
7811
7814
  description: "User created"
7812
7815
  });
7813
- on(t, t.env.data.logs.create(e, g));
7814
- const b = {
7815
- ...h,
7816
+ on(t, t.env.data.logs.create(t.var.tenant_id, h));
7817
+ const g = {
7818
+ ...p,
7816
7819
  identities: [
7817
7820
  {
7818
- connection: h.connection,
7819
- provider: h.provider,
7820
- user_id: gh(h.user_id),
7821
- isSocial: h.is_social
7821
+ connection: p.connection,
7822
+ provider: p.provider,
7823
+ user_id: gh(p.user_id),
7824
+ isSocial: p.is_social
7822
7825
  }
7823
7826
  ]
7824
7827
  };
7825
- return t.json(Mn.parse(b), {
7828
+ return t.json(Mn.parse(g), {
7826
7829
  status: 201
7827
7830
  });
7828
- } catch (h) {
7829
- throw h.message === "User already exists" ? new E(409, {
7831
+ } catch (p) {
7832
+ throw p.message === "User already exists" ? new E(409, {
7830
7833
  message: "User already exists"
7831
- }) : h;
7834
+ }) : p;
7832
7835
  }
7833
7836
  }
7834
7837
  ).openapi(
@@ -7867,48 +7870,51 @@ const kh = qt.extend({
7867
7870
  }
7868
7871
  }),
7869
7872
  async (t) => {
7870
- var p;
7871
- 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: a, ...l } = r, u = await e.users.get(n, i);
7872
- if (!u)
7873
+ var d;
7874
+ const { data: e } = t.env, n = t.req.valid("json"), { user_id: r } = t.req.valid("param"), { verify_email: i, password: s, ...a } = n, l = await e.users.get(t.var.tenant_id, r);
7875
+ if (!l)
7873
7876
  throw new E(404);
7874
- if (l.email && l.email !== u.email) {
7875
- const h = await xp(
7877
+ if (a.email && a.email !== l.email) {
7878
+ const p = await xp(
7876
7879
  t.env.data.users,
7877
- n,
7878
- l.email
7880
+ t.var.tenant_id,
7881
+ a.email
7879
7882
  );
7880
- if (h.length && h.some((g) => g.user_id !== i))
7883
+ if (p.length && p.some((h) => h.user_id !== r))
7881
7884
  throw new E(409, {
7882
7885
  message: "Another user with the same email address already exists."
7883
7886
  });
7884
7887
  }
7885
- if (u.linked_to)
7888
+ if (l.linked_to)
7886
7889
  throw new E(404, {
7887
7890
  // not the auth0 error message but I'd rather deviate here
7888
7891
  message: "User is linked to another user"
7889
7892
  });
7890
- if (await t.env.data.users.update(n, i, l), a) {
7891
- const h = (p = u.identities) == null ? void 0 : p.find(
7892
- (x) => x.connection === "Username-Password-Authentication"
7893
+ if (await t.env.data.users.update(t.var.tenant_id, r, a), s) {
7894
+ const p = (d = l.identities) == null ? void 0 : d.find(
7895
+ (b) => b.connection === "Username-Password-Authentication"
7893
7896
  );
7894
- if (!h)
7897
+ if (!p)
7895
7898
  throw new E(400, {
7896
7899
  message: "User does not have a password identity"
7897
7900
  });
7898
- const g = {
7899
- user_id: h.user_id,
7900
- password: await oo.hash(a, 10),
7901
+ const h = {
7902
+ user_id: p.user_id,
7903
+ password: await oo.hash(s, 10),
7901
7904
  algorithm: "bcrypt"
7902
7905
  };
7903
7906
  await e.passwords.get(
7904
- n,
7905
- h.user_id
7906
- ) ? await e.passwords.update(n, g) : await e.passwords.create(n, g);
7907
+ t.var.tenant_id,
7908
+ p.user_id
7909
+ ) ? await e.passwords.update(t.var.tenant_id, h) : await e.passwords.create(t.var.tenant_id, h);
7907
7910
  }
7908
- const d = await t.env.data.users.get(n, i);
7909
- if (!d)
7911
+ const u = await t.env.data.users.get(
7912
+ t.var.tenant_id,
7913
+ r
7914
+ );
7915
+ if (!u)
7910
7916
  throw new E(500);
7911
- return t.json(d);
7917
+ return t.json(u);
7912
7918
  }
7913
7919
  ).openapi(
7914
7920
  U({
@@ -7961,26 +7967,26 @@ const kh = qt.extend({
7961
7967
  }
7962
7968
  }),
7963
7969
  async (t) => {
7964
- 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);
7965
- if (!s)
7970
+ const e = t.req.valid("json"), { user_id: n } = t.req.valid("param"), r = "link_with" in e ? e.link_with : e.user_id, i = await t.env.data.users.get(t.var.tenant_id, n);
7971
+ if (!i)
7966
7972
  throw new E(400, {
7967
7973
  message: "Linking an inexistent identity is not allowed."
7968
7974
  });
7969
- await t.env.data.users.update(e, i, {
7970
- linked_to: r
7975
+ await t.env.data.users.update(t.var.tenant_id, r, {
7976
+ linked_to: n
7971
7977
  });
7972
- const a = await t.env.data.users.list(e, {
7978
+ const s = await t.env.data.users.list(t.var.tenant_id, {
7973
7979
  page: 0,
7974
7980
  per_page: 10,
7975
7981
  include_totals: !1,
7976
- q: `linked_to:${r}`
7977
- }), l = [s, ...a.users].map((u) => ({
7978
- connection: u.connection,
7979
- provider: u.provider,
7980
- user_id: gh(u.user_id),
7981
- isSocial: u.is_social
7982
+ q: `linked_to:${n}`
7983
+ }), a = [i, ...s.users].map((l) => ({
7984
+ connection: l.connection,
7985
+ provider: l.provider,
7986
+ user_id: gh(l.user_id),
7987
+ isSocial: l.is_social
7982
7988
  }));
7983
- return t.json(l, { status: 201 });
7989
+ return t.json(a, { status: 201 });
7984
7990
  }
7985
7991
  ).openapi(
7986
7992
  U({
@@ -8014,17 +8020,17 @@ const kh = qt.extend({
8014
8020
  }
8015
8021
  }),
8016
8022
  async (t) => {
8017
- const { "tenant-id": e } = t.req.valid("header"), { user_id: n, provider: r, linked_user_id: i } = t.req.valid("param");
8023
+ const { user_id: e, provider: n, linked_user_id: r } = t.req.valid("param");
8018
8024
  await t.env.data.users.unlink(
8025
+ t.var.tenant_id,
8019
8026
  e,
8020
8027
  n,
8021
- r,
8022
- i
8028
+ r
8023
8029
  );
8024
- const s = await t.env.data.users.get(e, n);
8025
- if (!s)
8030
+ const i = await t.env.data.users.get(t.var.tenant_id, e);
8031
+ if (!i)
8026
8032
  throw new E(404);
8027
- return t.json([Mn.parse(s)]);
8033
+ return t.json([Mn.parse(i)]);
8028
8034
  }
8029
8035
  ).openapi(
8030
8036
  U({
@@ -8060,13 +8066,13 @@ const kh = qt.extend({
8060
8066
  }
8061
8067
  }),
8062
8068
  async (t) => {
8063
- const { user_id: e } = t.req.valid("param"), { include_totals: n, page: r, per_page: i } = t.req.valid("query"), { "tenant-id": s } = t.req.valid("header"), a = await t.env.data.sessions.list(s, {
8069
+ const { user_id: e } = t.req.valid("param"), { include_totals: n, page: r, per_page: i } = t.req.valid("query"), s = await t.env.data.sessions.list(t.var.tenant_id, {
8064
8070
  page: r,
8065
8071
  per_page: i,
8066
8072
  include_totals: n,
8067
8073
  q: `user_id:${e}`
8068
8074
  });
8069
- return n ? t.json(a) : t.json(a.sessions);
8075
+ return n ? t.json(s) : t.json(s.sessions);
8070
8076
  }
8071
8077
  ).openapi(
8072
8078
  U({
@@ -8099,23 +8105,23 @@ const kh = qt.extend({
8099
8105
  }
8100
8106
  }),
8101
8107
  async (t) => {
8102
- const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), { page: r, per_page: i, sort: s, q: a } = t.req.valid("query");
8103
- if (!await t.env.data.users.get(n, e))
8108
+ const { user_id: e } = t.req.valid("param"), { page: n, per_page: r, sort: i, q: s } = t.req.valid("query");
8109
+ if (!await t.env.data.users.get(t.var.tenant_id, e))
8104
8110
  throw new E(404, {
8105
8111
  message: "User not found"
8106
8112
  });
8107
- const u = await t.env.data.userPermissions.list(
8108
- n,
8113
+ const l = await t.env.data.userPermissions.list(
8114
+ t.var.tenant_id,
8109
8115
  e,
8110
8116
  {
8111
- page: r,
8112
- per_page: i,
8117
+ page: n,
8118
+ per_page: r,
8113
8119
  include_totals: !1,
8114
- sort: bt(s),
8115
- q: a
8120
+ sort: bt(i),
8121
+ q: s
8116
8122
  }
8117
8123
  );
8118
- return t.json(u);
8124
+ return t.json(l);
8119
8125
  }
8120
8126
  ).openapi(
8121
8127
  U({
@@ -8156,19 +8162,19 @@ const kh = qt.extend({
8156
8162
  }
8157
8163
  }),
8158
8164
  async (t) => {
8159
- const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), { permissions: r } = t.req.valid("json");
8160
- if (!await t.env.data.users.get(n, e))
8165
+ const { user_id: e } = t.req.valid("param"), { permissions: n } = t.req.valid("json");
8166
+ if (!await t.env.data.users.get(t.var.tenant_id, e))
8161
8167
  throw new E(404, {
8162
8168
  message: "User not found"
8163
8169
  });
8164
- for (const s of r)
8170
+ for (const i of n)
8165
8171
  if (!await t.env.data.userPermissions.create(
8166
- n,
8172
+ t.var.tenant_id,
8167
8173
  e,
8168
8174
  {
8169
8175
  user_id: e,
8170
- resource_server_identifier: s.resource_server_identifier,
8171
- permission_name: s.permission_name
8176
+ resource_server_identifier: i.resource_server_identifier,
8177
+ permission_name: i.permission_name
8172
8178
  }
8173
8179
  ))
8174
8180
  throw new E(500, {
@@ -8218,16 +8224,16 @@ const kh = qt.extend({
8218
8224
  }
8219
8225
  }),
8220
8226
  async (t) => {
8221
- const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), { permissions: r } = t.req.valid("json");
8222
- if (!await t.env.data.users.get(n, e))
8227
+ const { user_id: e } = t.req.valid("param"), { permissions: n } = t.req.valid("json");
8228
+ if (!await t.env.data.users.get(t.var.tenant_id, e))
8223
8229
  throw new E(404, {
8224
8230
  message: "User not found"
8225
8231
  });
8226
- for (const s of r)
8232
+ for (const i of n)
8227
8233
  if (!await t.env.data.userPermissions.remove(
8228
- n,
8234
+ t.var.tenant_id,
8229
8235
  e,
8230
- s
8236
+ i
8231
8237
  ))
8232
8238
  throw new E(500, {
8233
8239
  message: "Failed to remove permissions from user"
@@ -8252,16 +8258,16 @@ const kh = qt.extend({
8252
8258
  }
8253
8259
  }),
8254
8260
  async (t) => {
8255
- const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header");
8256
- if (!await t.env.data.users.get(n, e)) throw new E(404, { message: "User not found" });
8257
- const i = await t.env.data.userRoles.list(
8258
- n,
8261
+ const { user_id: e } = t.req.valid("param");
8262
+ if (!await t.env.data.users.get(t.var.tenant_id, e)) throw new E(404, { message: "User not found" });
8263
+ const r = await t.env.data.userRoles.list(
8264
+ t.var.tenant_id,
8259
8265
  e,
8260
8266
  void 0,
8261
8267
  ""
8262
8268
  // Global roles should have empty string organization_id
8263
8269
  );
8264
- return t.json(i);
8270
+ return t.json(r);
8265
8271
  }
8266
8272
  ).openapi(
8267
8273
  U({
@@ -8283,13 +8289,13 @@ const kh = qt.extend({
8283
8289
  responses: { 201: { description: "Roles assigned to user" } }
8284
8290
  }),
8285
8291
  async (t) => {
8286
- const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), { roles: r } = t.req.valid("json");
8287
- if (!await t.env.data.users.get(n, e)) throw new E(404, { message: "User not found" });
8288
- for (const s of r)
8292
+ const { user_id: e } = t.req.valid("param"), { roles: n } = t.req.valid("json");
8293
+ if (!await t.env.data.users.get(t.var.tenant_id, e)) throw new E(404, { message: "User not found" });
8294
+ for (const i of n)
8289
8295
  if (!await t.env.data.userRoles.create(
8290
- n,
8296
+ t.var.tenant_id,
8291
8297
  e,
8292
- s,
8298
+ i,
8293
8299
  ""
8294
8300
  // Global roles should have empty string organization_id
8295
8301
  ))
@@ -8321,13 +8327,13 @@ const kh = qt.extend({
8321
8327
  responses: { 200: { description: "Roles removed from user" } }
8322
8328
  }),
8323
8329
  async (t) => {
8324
- const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), { roles: r } = t.req.valid("json");
8325
- if (!await t.env.data.users.get(n, e)) throw new E(404, { message: "User not found" });
8326
- for (const s of r)
8330
+ const { user_id: e } = t.req.valid("param"), { roles: n } = t.req.valid("json");
8331
+ if (!await t.env.data.users.get(t.var.tenant_id, e)) throw new E(404, { message: "User not found" });
8332
+ for (const i of n)
8327
8333
  if (!await t.env.data.userRoles.remove(
8328
- n,
8334
+ t.var.tenant_id,
8329
8335
  e,
8330
- s,
8336
+ i,
8331
8337
  ""
8332
8338
  // Global roles should have empty string organization_id
8333
8339
  ))
@@ -8366,24 +8372,24 @@ const kh = qt.extend({
8366
8372
  }
8367
8373
  }),
8368
8374
  async (t) => {
8369
- const { user_id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), { page: r, per_page: i, include_totals: s, sort: a } = t.req.valid("query");
8370
- if (!await t.env.data.users.get(n, e))
8375
+ const { user_id: e } = t.req.valid("param"), { page: n, per_page: r, include_totals: i, sort: s } = t.req.valid("query");
8376
+ if (!await t.env.data.users.get(t.var.tenant_id, e))
8371
8377
  throw new E(404, { message: "User not found" });
8372
- const u = await t.env.data.userOrganizations.listUserOrganizations(
8373
- n,
8378
+ const l = await t.env.data.userOrganizations.listUserOrganizations(
8379
+ t.var.tenant_id,
8374
8380
  e,
8375
8381
  {
8376
- page: r,
8377
- per_page: i,
8378
- sort: bt(a)
8382
+ page: n,
8383
+ per_page: r,
8384
+ sort: bt(s)
8379
8385
  }
8380
8386
  );
8381
- return s ? t.json({
8382
- organizations: u.organizations,
8383
- start: u.start,
8384
- limit: u.limit,
8385
- length: u.length
8386
- }) : t.json(u.organizations);
8387
+ return i ? t.json({
8388
+ organizations: l.organizations,
8389
+ start: l.start,
8390
+ limit: l.limit,
8391
+ length: l.length
8392
+ }) : t.json(l.organizations);
8387
8393
  }
8388
8394
  ).openapi(
8389
8395
  U({
@@ -8407,23 +8413,26 @@ const kh = qt.extend({
8407
8413
  }
8408
8414
  }),
8409
8415
  async (t) => {
8410
- const { user_id: e, organization_id: n } = t.req.valid("param"), { "tenant-id": r } = t.req.valid("header");
8411
- if (!await t.env.data.users.get(r, e))
8416
+ const { user_id: e, organization_id: n } = t.req.valid("param");
8417
+ if (!await t.env.data.users.get(t.var.tenant_id, e))
8412
8418
  throw new E(404, { message: "User not found" });
8413
- const a = (await t.env.data.userOrganizations.list(r, {
8414
- q: `user_id:${e}`,
8415
- per_page: 100
8416
- // Should be enough for most cases
8417
- })).userOrganizations.find(
8418
- (l) => l.organization_id === n
8419
+ const s = (await t.env.data.userOrganizations.list(
8420
+ t.var.tenant_id,
8421
+ {
8422
+ q: `user_id:${e}`,
8423
+ per_page: 100
8424
+ // Should be enough for most cases
8425
+ }
8426
+ )).userOrganizations.find(
8427
+ (a) => a.organization_id === n
8419
8428
  );
8420
- if (!a)
8429
+ if (!s)
8421
8430
  throw new E(404, {
8422
8431
  message: "User is not a member of this organization"
8423
8432
  });
8424
8433
  return await t.env.data.userOrganizations.remove(
8425
- r,
8426
- a.id
8434
+ t.var.tenant_id,
8435
+ s.id
8427
8436
  ), t.json({
8428
8437
  message: "User removed from organization successfully"
8429
8438
  });
@@ -8488,8 +8497,8 @@ var Nh;
8488
8497
  } : function(R, I) {
8489
8498
  return R[I];
8490
8499
  }
8491
- }, h = Object.getPrototypeOf(Function), g = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : le(), b = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : Wt(), x = typeof WeakMap == "function" ? WeakMap : Lt(), C = i ? Symbol.for("@reflect-metadata:registry") : void 0, O = bn(), D = Et(O);
8492
- function A(R, I, V, ne) {
8500
+ }, h = Object.getPrototypeOf(Function), g = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : le(), b = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : Wt(), A = typeof WeakMap == "function" ? WeakMap : Lt(), C = i ? Symbol.for("@reflect-metadata:registry") : void 0, D = bn(), O = Et(D);
8501
+ function x(R, I, V, ne) {
8493
8502
  if (ee(V)) {
8494
8503
  if (!Pt(R))
8495
8504
  throw new TypeError();
@@ -8506,7 +8515,7 @@ var Nh;
8506
8515
  return we(ne) && (ne = void 0), V = rt(V), P(R, I, V, ne);
8507
8516
  }
8508
8517
  }
8509
- e("decorate", A);
8518
+ e("decorate", x);
8510
8519
  function z(R, I) {
8511
8520
  function V(ne, ve) {
8512
8521
  if (!Fe(ne))
@@ -8542,18 +8551,18 @@ var Nh;
8542
8551
  return ee(V) || (V = rt(V)), L(R, I, V);
8543
8552
  }
8544
8553
  e("getMetadata", W);
8545
- function Z(R, I, V) {
8554
+ function Y(R, I, V) {
8546
8555
  if (!Fe(I))
8547
8556
  throw new TypeError();
8548
8557
  return ee(V) || (V = rt(V)), G(R, I, V);
8549
8558
  }
8550
- e("getOwnMetadata", Z);
8551
- function Y(R, I) {
8559
+ e("getOwnMetadata", Y);
8560
+ function Z(R, I) {
8552
8561
  if (!Fe(R))
8553
8562
  throw new TypeError();
8554
8563
  return ee(I) || (I = rt(I)), se(R, I);
8555
8564
  }
8556
- e("getMetadataKeys", Y);
8565
+ e("getMetadataKeys", Z);
8557
8566
  function Se(R, I) {
8558
8567
  if (!Fe(R))
8559
8568
  throw new TypeError();
@@ -8815,7 +8824,7 @@ var Nh;
8815
8824
  function Gt() {
8816
8825
  var R;
8817
8826
  !ee(C) && typeof n.Reflect < "u" && !(C in n.Reflect) && typeof n.Reflect.defineMetadata == "function" && (R = nn(n.Reflect));
8818
- var I, V, ne, ve = new x(), it = {
8827
+ var I, V, ne, ve = new A(), it = {
8819
8828
  registerProvider: Be,
8820
8829
  getProvider: f,
8821
8830
  setProvider: $
@@ -8895,7 +8904,7 @@ var Nh;
8895
8904
  }), R;
8896
8905
  }
8897
8906
  function Et(R) {
8898
- var I = new x(), V = {
8907
+ var I = new A(), V = {
8899
8908
  isProviderFor: function(y, $) {
8900
8909
  var v = I.get(y);
8901
8910
  return ee(v) ? !1 : v.has($);
@@ -8906,7 +8915,7 @@ var Nh;
8906
8915
  OrdinaryOwnMetadataKeys: c,
8907
8916
  OrdinaryDeleteMetadata: f
8908
8917
  };
8909
- return O.registerProvider(V), V;
8918
+ return D.registerProvider(V), V;
8910
8919
  function ne(y, $, v) {
8911
8920
  var S = I.get(y), X = !1;
8912
8921
  if (ee(S)) {
@@ -8994,7 +9003,7 @@ var Nh;
8994
9003
  }
8995
9004
  }
8996
9005
  function nn(R) {
8997
- var I = R.defineMetadata, V = R.hasOwnMetadata, ne = R.getOwnMetadata, ve = R.getOwnMetadataKeys, it = R.deleteMetadata, Be = new x(), c = {
9006
+ var I = R.defineMetadata, V = R.hasOwnMetadata, ne = R.getOwnMetadata, ve = R.getOwnMetadataKeys, it = R.deleteMetadata, Be = new A(), c = {
8998
9007
  isProviderFor: function(f, y) {
8999
9008
  var $ = Be.get(f);
9000
9009
  return !ee($) && $.has(y) ? !0 : ve(f, y).length ? (ee($) && ($ = new b(), Be.set(f, $)), $.add(y), !0) : !1;
@@ -9008,12 +9017,12 @@ var Nh;
9008
9017
  return c;
9009
9018
  }
9010
9019
  function _e(R, I, V) {
9011
- var ne = O.getProvider(R, I);
9020
+ var ne = D.getProvider(R, I);
9012
9021
  if (!ee(ne))
9013
9022
  return ne;
9014
9023
  if (V) {
9015
- if (O.setProvider(R, I, D))
9016
- return D;
9024
+ if (D.setProvider(R, I, O))
9025
+ return O;
9017
9026
  throw new Error("Illegal state.");
9018
9027
  }
9019
9028
  }
@@ -11329,13 +11338,13 @@ class jc extends uo {
11329
11338
  if (g === -1 && (g = r.indexOf("-"), h = -1), g !== -1) {
11330
11339
  if (b = r.substring(g + 1), r = r.substring(0, g), b.length !== 2 && b.length !== 4)
11331
11340
  throw new Error("Wrong input string for conversion");
11332
- let x = parseInt(b.substring(0, 2), 10);
11333
- if (isNaN(x.valueOf()))
11341
+ let A = parseInt(b.substring(0, 2), 10);
11342
+ if (isNaN(A.valueOf()))
11334
11343
  throw new Error("Wrong input string for conversion");
11335
- if (l = h * x, b.length === 4) {
11336
- if (x = parseInt(b.substring(2, 4), 10), isNaN(x.valueOf()))
11344
+ if (l = h * A, b.length === 4) {
11345
+ if (A = parseInt(b.substring(2, 4), 10), isNaN(A.valueOf()))
11337
11346
  throw new Error("Wrong input string for conversion");
11338
- u = h * x;
11347
+ u = h * A;
11339
11348
  }
11340
11349
  }
11341
11350
  }
@@ -15558,11 +15567,11 @@ class H4 {
15558
15567
  const Zr = "crypto.algorithmProvider";
15559
15568
  mt.registerSingleton(Zr, H4);
15560
15569
  var ia;
15561
- const Dt = "1.3.36.3.3.2.8.1.1", _0 = `${Dt}.1`, y0 = `${Dt}.2`, w0 = `${Dt}.3`, v0 = `${Dt}.4`, b0 = `${Dt}.5`, $0 = `${Dt}.6`, x0 = `${Dt}.7`, A0 = `${Dt}.8`, E0 = `${Dt}.9`, S0 = `${Dt}.10`, k0 = `${Dt}.11`, N0 = `${Dt}.12`, C0 = `${Dt}.13`, T0 = `${Dt}.14`, I0 = "brainpoolP160r1", O0 = "brainpoolP160t1", D0 = "brainpoolP192r1", R0 = "brainpoolP192t1", j0 = "brainpoolP224r1", P0 = "brainpoolP224t1", B0 = "brainpoolP256r1", L0 = "brainpoolP256t1", F0 = "brainpoolP320r1", U0 = "brainpoolP320t1", M0 = "brainpoolP384r1", q0 = "brainpoolP384t1", z0 = "brainpoolP512r1", V0 = "brainpoolP512t1", Ke = "ECDSA";
15570
+ const Dt = "1.3.36.3.3.2.8.1.1", _0 = `${Dt}.1`, y0 = `${Dt}.2`, w0 = `${Dt}.3`, v0 = `${Dt}.4`, b0 = `${Dt}.5`, $0 = `${Dt}.6`, x0 = `${Dt}.7`, A0 = `${Dt}.8`, E0 = `${Dt}.9`, S0 = `${Dt}.10`, k0 = `${Dt}.11`, N0 = `${Dt}.12`, C0 = `${Dt}.13`, T0 = `${Dt}.14`, I0 = "brainpoolP160r1", O0 = "brainpoolP160t1", D0 = "brainpoolP192r1", R0 = "brainpoolP192t1", j0 = "brainpoolP224r1", P0 = "brainpoolP224t1", B0 = "brainpoolP256r1", L0 = "brainpoolP256t1", F0 = "brainpoolP320r1", U0 = "brainpoolP320t1", M0 = "brainpoolP384r1", q0 = "brainpoolP384t1", z0 = "brainpoolP512r1", V0 = "brainpoolP512t1", Ge = "ECDSA";
15562
15571
  let Vs = ia = class {
15563
15572
  toAsnAlgorithm(e) {
15564
15573
  switch (e.name.toLowerCase()) {
15565
- case Ke.toLowerCase():
15574
+ case Ge.toLowerCase():
15566
15575
  if ("hash" in e)
15567
15576
  switch ((typeof e.hash == "string" ? e.hash : e.hash.name).toLowerCase()) {
15568
15577
  case "sha-1":
@@ -15644,53 +15653,53 @@ let Vs = ia = class {
15644
15653
  toWebAlgorithm(e) {
15645
15654
  switch (e.algorithm) {
15646
15655
  case tf:
15647
- return { name: Ke, hash: { name: "SHA-1" } };
15656
+ return { name: Ge, hash: { name: "SHA-1" } };
15648
15657
  case nf:
15649
- return { name: Ke, hash: { name: "SHA-256" } };
15658
+ return { name: Ge, hash: { name: "SHA-256" } };
15650
15659
  case rf:
15651
- return { name: Ke, hash: { name: "SHA-384" } };
15660
+ return { name: Ge, hash: { name: "SHA-384" } };
15652
15661
  case sf:
15653
- return { name: Ke, hash: { name: "SHA-512" } };
15662
+ return { name: Ge, hash: { name: "SHA-512" } };
15654
15663
  case Ms: {
15655
15664
  if (!e.parameters)
15656
15665
  throw new TypeError("Cannot get required parameters from EC algorithm");
15657
15666
  switch (re.parse(e.parameters, xr).namedCurve) {
15658
15667
  case Xh:
15659
- return { name: Ke, namedCurve: "P-256" };
15668
+ return { name: Ge, namedCurve: "P-256" };
15660
15669
  case ia.SECP256K1:
15661
- return { name: Ke, namedCurve: "K-256" };
15670
+ return { name: Ge, namedCurve: "K-256" };
15662
15671
  case Jh:
15663
- return { name: Ke, namedCurve: "P-384" };
15672
+ return { name: Ge, namedCurve: "P-384" };
15664
15673
  case Yh:
15665
- return { name: Ke, namedCurve: "P-521" };
15674
+ return { name: Ge, namedCurve: "P-521" };
15666
15675
  case _0:
15667
- return { name: Ke, namedCurve: I0 };
15676
+ return { name: Ge, namedCurve: I0 };
15668
15677
  case y0:
15669
- return { name: Ke, namedCurve: O0 };
15678
+ return { name: Ge, namedCurve: O0 };
15670
15679
  case w0:
15671
- return { name: Ke, namedCurve: D0 };
15680
+ return { name: Ge, namedCurve: D0 };
15672
15681
  case v0:
15673
- return { name: Ke, namedCurve: R0 };
15682
+ return { name: Ge, namedCurve: R0 };
15674
15683
  case b0:
15675
- return { name: Ke, namedCurve: j0 };
15684
+ return { name: Ge, namedCurve: j0 };
15676
15685
  case $0:
15677
- return { name: Ke, namedCurve: P0 };
15686
+ return { name: Ge, namedCurve: P0 };
15678
15687
  case x0:
15679
- return { name: Ke, namedCurve: B0 };
15688
+ return { name: Ge, namedCurve: B0 };
15680
15689
  case A0:
15681
- return { name: Ke, namedCurve: L0 };
15690
+ return { name: Ge, namedCurve: L0 };
15682
15691
  case E0:
15683
- return { name: Ke, namedCurve: F0 };
15692
+ return { name: Ge, namedCurve: F0 };
15684
15693
  case S0:
15685
- return { name: Ke, namedCurve: U0 };
15694
+ return { name: Ge, namedCurve: U0 };
15686
15695
  case k0:
15687
- return { name: Ke, namedCurve: M0 };
15696
+ return { name: Ge, namedCurve: M0 };
15688
15697
  case N0:
15689
- return { name: Ke, namedCurve: q0 };
15698
+ return { name: Ge, namedCurve: q0 };
15690
15699
  case C0:
15691
- return { name: Ke, namedCurve: z0 };
15700
+ return { name: Ge, namedCurve: z0 };
15692
15701
  case T0:
15693
- return { name: Ke, namedCurve: V0 };
15702
+ return { name: Ge, namedCurve: V0 };
15694
15703
  }
15695
15704
  }
15696
15705
  }
@@ -17209,26 +17218,26 @@ class c$ {
17209
17218
  notBefore: a,
17210
17219
  notAfter: l
17211
17220
  }),
17212
- extensions: new br(((r = e.extensions) === null || r === void 0 ? void 0 : r.map((O) => re.parse(O.rawData, Qt))) || []),
17221
+ extensions: new br(((r = e.extensions) === null || r === void 0 ? void 0 : r.map((D) => re.parse(D.rawData, Qt))) || []),
17213
17222
  subjectPublicKeyInfo: re.parse(i, an)
17214
17223
  })
17215
17224
  });
17216
17225
  if (e.subject) {
17217
- const O = e.subject instanceof Yt ? e.subject : new Yt(e.subject);
17218
- u.tbsCertificate.subject = re.parse(O.toArrayBuffer(), et);
17226
+ const D = e.subject instanceof Yt ? e.subject : new Yt(e.subject);
17227
+ u.tbsCertificate.subject = re.parse(D.toArrayBuffer(), et);
17219
17228
  }
17220
17229
  if (e.issuer) {
17221
- const O = e.issuer instanceof Yt ? e.issuer : new Yt(e.issuer);
17222
- u.tbsCertificate.issuer = re.parse(O.toArrayBuffer(), et);
17230
+ const D = e.issuer instanceof Yt ? e.issuer : new Yt(e.issuer);
17231
+ u.tbsCertificate.issuer = re.parse(D.toArrayBuffer(), et);
17223
17232
  }
17224
17233
  const d = {
17225
17234
  hash: "SHA-256"
17226
17235
  }, p = "signingKey" in e ? { ...d, ...e.signingAlgorithm, ...e.signingKey.algorithm } : { ...d, ...e.signingAlgorithm }, h = mt.resolve(Zr);
17227
17236
  u.tbsCertificate.signature = u.signatureAlgorithm = h.toAsnAlgorithm(p);
17228
- const g = re.serialize(u.tbsCertificate), b = "signingKey" in e ? await n.subtle.sign(p, e.signingKey, g) : e.signature, x = mt.resolveAll(So).reverse();
17237
+ const g = re.serialize(u.tbsCertificate), b = "signingKey" in e ? await n.subtle.sign(p, e.signingKey, g) : e.signature, A = mt.resolveAll(So).reverse();
17229
17238
  let C = null;
17230
- for (const O of x)
17231
- if (C = O.toAsnSignature(p, b), C)
17239
+ for (const D of A)
17240
+ if (C = D.toAsnSignature(p, b), C)
17232
17241
  break;
17233
17242
  if (!C)
17234
17243
  throw Error("Cannot convert ASN.1 signature value to WebCrypto format");
@@ -17274,7 +17283,7 @@ async function Wd(t) {
17274
17283
  hash: "SHA-256",
17275
17284
  publicExponent: new Uint8Array([1, 0, 1]),
17276
17285
  modulusLength: 2048
17277
- }, n = await crypto.subtle.generateKey(e, !0, ["sign", "verify"]), r = We(), i = Su(new TextEncoder().encode(r)), s = await c$.createSelfSigned({
17286
+ }, n = await crypto.subtle.generateKey(e, !0, ["sign", "verify"]), r = Ke(), i = Su(new TextEncoder().encode(r)), s = await c$.createSelfSigned({
17278
17287
  serialNumber: i,
17279
17288
  name: t.name,
17280
17289
  notBefore: /* @__PURE__ */ new Date(),
@@ -17677,7 +17686,7 @@ const d$ = 1e3 * 60 * 60 * 24, p$ = new be().openapi(
17677
17686
  async (t) => {
17678
17687
  const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), r = {
17679
17688
  ...n,
17680
- client_secret: n.client_secret || We()
17689
+ client_secret: n.client_secret || Ke()
17681
17690
  }, i = await t.env.data.clients.create(e, r);
17682
17691
  return t.json(i, { status: 201 });
17683
17692
  }
@@ -17884,14 +17893,14 @@ const m$ = qt.extend({
17884
17893
  }
17885
17894
  }),
17886
17895
  async (t) => {
17887
- const { page: e, per_page: n, include_totals: r, sort: i, q: s } = t.req.valid("query"), { "tenant-id": a } = t.req.valid("header"), l = await t.env.data.logs.list(a, {
17896
+ const { page: e, per_page: n, include_totals: r, sort: i, q: s } = t.req.valid("query"), a = await t.env.data.logs.list(t.var.tenant_id, {
17888
17897
  page: e,
17889
17898
  per_page: n,
17890
17899
  include_totals: r,
17891
17900
  sort: bt(i),
17892
17901
  q: s
17893
17902
  });
17894
- return r ? t.json(l) : t.json(l.logs);
17903
+ return r ? t.json(a) : t.json(a.logs);
17895
17904
  }
17896
17905
  ).openapi(
17897
17906
  U({
@@ -17923,10 +17932,10 @@ const m$ = qt.extend({
17923
17932
  }
17924
17933
  }),
17925
17934
  async (t) => {
17926
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.logs.get(e, n);
17927
- if (!r)
17935
+ const { id: e } = t.req.valid("param"), n = await t.env.data.logs.get(t.var.tenant_id, e);
17936
+ if (!n)
17928
17937
  throw new E(404);
17929
- return t.json(r);
17938
+ return t.json(n);
17930
17939
  }
17931
17940
  ), v$ = 17, b$ = {
17932
17941
  organization: "org_",
@@ -17980,14 +17989,14 @@ const E$ = qt.extend({
17980
17989
  }
17981
17990
  }),
17982
17991
  async (t) => {
17983
- const { "tenant-id": e } = t.req.valid("header"), { page: n, per_page: r, include_totals: i, sort: s, q: a } = t.req.valid("query"), l = await t.env.data.hooks.list(e, {
17984
- page: n,
17985
- per_page: r,
17986
- include_totals: i,
17987
- sort: bt(s),
17988
- q: a
17992
+ const { page: e, per_page: n, include_totals: r, sort: i, q: s } = t.req.valid("query"), a = await t.env.data.hooks.list(t.var.tenant_id, {
17993
+ page: e,
17994
+ per_page: n,
17995
+ include_totals: r,
17996
+ sort: bt(i),
17997
+ q: s
17989
17998
  });
17990
- return i ? t.json(l) : t.json(l.hooks);
17999
+ return r ? t.json(a) : t.json(a.hooks);
17991
18000
  }
17992
18001
  ).openapi(
17993
18002
  U({
@@ -18024,11 +18033,14 @@ const E$ = qt.extend({
18024
18033
  }
18025
18034
  }),
18026
18035
  async (t) => {
18027
- const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), r = {
18028
- ...n,
18029
- hook_id: n.hook_id || A$()
18030
- }, i = await t.env.data.hooks.create(e, r);
18031
- return t.json(i, { status: 201 });
18036
+ const e = t.req.valid("json"), n = {
18037
+ ...e,
18038
+ hook_id: e.hook_id || A$()
18039
+ }, r = await t.env.data.hooks.create(
18040
+ t.var.tenant_id,
18041
+ n
18042
+ );
18043
+ return t.json(r, { status: 201 });
18032
18044
  }
18033
18045
  ).openapi(
18034
18046
  U({
@@ -18075,12 +18087,12 @@ const E$ = qt.extend({
18075
18087
  }
18076
18088
  }),
18077
18089
  async (t) => {
18078
- const { "tenant-id": e } = t.req.valid("header"), { hook_id: n } = t.req.valid("param"), r = t.req.valid("json");
18079
- await t.env.data.hooks.update(e, n, r);
18080
- const i = await t.env.data.hooks.get(e, n);
18081
- if (!i)
18090
+ const { hook_id: e } = t.req.valid("param"), n = t.req.valid("json");
18091
+ await t.env.data.hooks.update(t.var.tenant_id, e, n);
18092
+ const r = await t.env.data.hooks.get(t.var.tenant_id, e);
18093
+ if (!r)
18082
18094
  throw new E(404, { message: "Hook not found" });
18083
- return t.json(i);
18095
+ return t.json(r);
18084
18096
  }
18085
18097
  ).openapi(
18086
18098
  U({
@@ -18115,10 +18127,10 @@ const E$ = qt.extend({
18115
18127
  }
18116
18128
  }),
18117
18129
  async (t) => {
18118
- const { "tenant-id": e } = t.req.valid("header"), { hook_id: n } = t.req.valid("param"), r = await t.env.data.hooks.get(e, n);
18119
- if (!r)
18130
+ const { hook_id: e } = t.req.valid("param"), n = await t.env.data.hooks.get(t.var.tenant_id, e);
18131
+ if (!n)
18120
18132
  throw new E(404, { message: "Hook not found" });
18121
- return t.json(r);
18133
+ return t.json(n);
18122
18134
  }
18123
18135
  ).openapi(
18124
18136
  U({
@@ -18145,8 +18157,11 @@ const E$ = qt.extend({
18145
18157
  }
18146
18158
  }),
18147
18159
  async (t) => {
18148
- const { "tenant-id": e } = t.req.valid("header"), { hook_id: n } = t.req.valid("param");
18149
- if (!await t.env.data.hooks.remove(e, n))
18160
+ const { hook_id: e } = t.req.valid("param");
18161
+ if (!await t.env.data.hooks.remove(
18162
+ t.var.tenant_id,
18163
+ e
18164
+ ))
18150
18165
  throw new E(404, { message: "Hook not found" });
18151
18166
  return t.text("OK");
18152
18167
  }
@@ -18183,20 +18198,20 @@ const E$ = qt.extend({
18183
18198
  }
18184
18199
  }),
18185
18200
  async (t) => {
18186
- const { "tenant-id": e } = t.req.valid("header"), {
18187
- page: n,
18188
- per_page: r,
18189
- include_totals: i = !1,
18190
- sort: s,
18191
- q: a
18192
- } = t.req.valid("query"), l = await t.env.data.connections.list(e, {
18193
- page: n,
18194
- per_page: r,
18195
- include_totals: i,
18196
- sort: bt(s),
18197
- q: a
18201
+ const {
18202
+ page: e,
18203
+ per_page: n,
18204
+ include_totals: r = !1,
18205
+ sort: i,
18206
+ q: s
18207
+ } = t.req.valid("query"), a = await t.env.data.connections.list(t.var.tenant_id, {
18208
+ page: e,
18209
+ per_page: n,
18210
+ include_totals: r,
18211
+ sort: bt(i),
18212
+ q: s
18198
18213
  });
18199
- return i ? t.json(l) : t.json(l.connections);
18214
+ return r ? t.json(a) : t.json(a.connections);
18200
18215
  }
18201
18216
  ).openapi(
18202
18217
  U({
@@ -18228,10 +18243,13 @@ const E$ = qt.extend({
18228
18243
  }
18229
18244
  }),
18230
18245
  async (t) => {
18231
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.connections.get(e, n);
18232
- if (!r)
18246
+ const { id: e } = t.req.valid("param"), n = await t.env.data.connections.get(
18247
+ t.var.tenant_id,
18248
+ e
18249
+ );
18250
+ if (!n)
18233
18251
  throw new E(404);
18234
- return t.json(r);
18252
+ return t.json(n);
18235
18253
  }
18236
18254
  ).openapi(
18237
18255
  U({
@@ -18258,8 +18276,11 @@ const E$ = qt.extend({
18258
18276
  }
18259
18277
  }),
18260
18278
  async (t) => {
18261
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
18262
- if (!await t.env.data.connections.remove(e, n))
18279
+ const { id: e } = t.req.valid("param");
18280
+ if (!await t.env.data.connections.remove(
18281
+ t.var.tenant_id,
18282
+ e
18283
+ ))
18263
18284
  throw new E(404, {
18264
18285
  message: "Connection not found"
18265
18286
  });
@@ -18302,17 +18323,24 @@ const E$ = qt.extend({
18302
18323
  }
18303
18324
  }),
18304
18325
  async (t) => {
18305
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = t.req.valid("json");
18306
- if (!await t.env.data.connections.update(e, n, r))
18326
+ const { id: e } = t.req.valid("param"), n = t.req.valid("json");
18327
+ if (!await t.env.data.connections.update(
18328
+ t.var.tenant_id,
18329
+ e,
18330
+ n
18331
+ ))
18307
18332
  throw new E(404, {
18308
18333
  message: "Connection not found"
18309
18334
  });
18310
- const s = await t.env.data.connections.get(e, n);
18311
- if (!s)
18335
+ const i = await t.env.data.connections.get(
18336
+ t.var.tenant_id,
18337
+ e
18338
+ );
18339
+ if (!i)
18312
18340
  throw new E(404, {
18313
18341
  message: "Connection not found"
18314
18342
  });
18315
- return t.json(s);
18343
+ return t.json(i);
18316
18344
  }
18317
18345
  ).openapi(
18318
18346
  U({
@@ -18348,14 +18376,14 @@ const E$ = qt.extend({
18348
18376
  }
18349
18377
  }),
18350
18378
  async (t) => {
18351
- const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), r = {
18352
- ...n,
18353
- id: n.id || x$()
18354
- }, i = await t.env.data.connections.create(
18355
- e,
18356
- r
18379
+ const e = t.req.valid("json"), n = {
18380
+ ...e,
18381
+ id: e.id || x$()
18382
+ }, r = await t.env.data.connections.create(
18383
+ t.var.tenant_id,
18384
+ n
18357
18385
  );
18358
- return t.json(i, { status: 201 });
18386
+ return t.json(r, { status: 201 });
18359
18387
  }
18360
18388
  ), C$ = new be().openapi(
18361
18389
  U({
@@ -18384,8 +18412,10 @@ const E$ = qt.extend({
18384
18412
  }
18385
18413
  }),
18386
18414
  async (t) => {
18387
- const { "tenant-id": e } = t.req.valid("header"), n = await t.env.data.promptSettings.get(e);
18388
- return n ? t.json(n) : t.json(Ol.parse({}));
18415
+ const e = await t.env.data.promptSettings.get(
18416
+ t.var.tenant_id
18417
+ );
18418
+ return e ? t.json(e) : t.json(Ol.parse({}));
18389
18419
  }
18390
18420
  ).openapi(
18391
18421
  U({
@@ -18416,8 +18446,13 @@ const E$ = qt.extend({
18416
18446
  }
18417
18447
  }),
18418
18448
  async (t) => {
18419
- const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), r = await t.env.data.promptSettings.get(e);
18420
- return Object.assign(r, n), await t.env.data.promptSettings.set(e, r), t.json(r);
18449
+ const e = t.req.valid("json"), n = await t.env.data.promptSettings.get(
18450
+ t.var.tenant_id
18451
+ );
18452
+ return Object.assign(n, e), await t.env.data.promptSettings.set(
18453
+ t.var.tenant_id,
18454
+ n
18455
+ ), t.json(n);
18421
18456
  }
18422
18457
  );
18423
18458
  let eg = !1;
@@ -18870,16 +18905,16 @@ function mf(t) {
18870
18905
  message: "Missing bearer token"
18871
18906
  });
18872
18907
  try {
18873
- const x = await Y$(e, b);
18874
- e.set("user_id", x.sub), e.set("user", x);
18875
- const C = x.permissions || [], O = ((d = x.scope) == null ? void 0 : d.split(" ")) || [];
18908
+ const A = await Y$(e, b);
18909
+ e.set("user_id", A.sub), e.set("user", A);
18910
+ const C = A.permissions || [], D = ((d = A.scope) == null ? void 0 : d.split(" ")) || [];
18876
18911
  if (p.length && !// Should we check both?
18877
18912
  (p.some(
18878
- (D) => C.includes(D)
18879
- ) || p.some((D) => O.includes(D))))
18913
+ (O) => C.includes(O)
18914
+ ) || p.some((O) => D.includes(O))))
18880
18915
  throw new E(403, { message: "Unauthorized" });
18881
- } catch (x) {
18882
- throw x instanceof E ? x : new E(403, { message: "Invalid token" });
18916
+ } catch (A) {
18917
+ throw A instanceof E ? A : new E(403, { message: "Invalid token" });
18883
18918
  }
18884
18919
  }
18885
18920
  return await n();
@@ -18912,10 +18947,12 @@ const ex = new be().openapi(
18912
18947
  }
18913
18948
  }),
18914
18949
  async (t) => {
18915
- const { "tenant-id": e } = t.req.valid("header"), n = await t.env.data.emailProviders.get(e);
18916
- if (!n)
18950
+ const e = await t.env.data.emailProviders.get(
18951
+ t.var.tenant_id
18952
+ );
18953
+ if (!e)
18917
18954
  throw new E(404, { message: "Email provider not found" });
18918
- return t.json(n);
18955
+ return t.json(e);
18919
18956
  }
18920
18957
  ).openapi(
18921
18958
  U({
@@ -18946,8 +18983,11 @@ const ex = new be().openapi(
18946
18983
  }
18947
18984
  }),
18948
18985
  async (t) => {
18949
- const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json");
18950
- return await t.env.data.emailProviders.create(e, n), t.text("OK", { status: 201 });
18986
+ const e = t.req.valid("json");
18987
+ return await t.env.data.emailProviders.create(
18988
+ t.var.tenant_id,
18989
+ e
18990
+ ), t.text("OK", { status: 201 });
18951
18991
  }
18952
18992
  ).openapi(
18953
18993
  U({
@@ -18978,8 +19018,8 @@ const ex = new be().openapi(
18978
19018
  }
18979
19019
  }),
18980
19020
  async (t) => {
18981
- const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json");
18982
- return await t.env.data.emailProviders.update(e, n), t.text("OK");
19021
+ const e = t.req.valid("json");
19022
+ return await t.env.data.emailProviders.update(t.var.tenant_id, e), t.text("OK");
18983
19023
  }
18984
19024
  ), tx = new be().openapi(
18985
19025
  U({
@@ -19011,10 +19051,10 @@ const ex = new be().openapi(
19011
19051
  }
19012
19052
  }),
19013
19053
  async (t) => {
19014
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.sessions.get(e, n);
19015
- if (!r)
19054
+ const { id: e } = t.req.valid("param"), n = await t.env.data.sessions.get(t.var.tenant_id, e);
19055
+ if (!n)
19016
19056
  throw new E(404);
19017
- return t.json(r);
19057
+ return t.json(n);
19018
19058
  }
19019
19059
  ).openapi(
19020
19060
  U({
@@ -19041,8 +19081,8 @@ const ex = new be().openapi(
19041
19081
  }
19042
19082
  }),
19043
19083
  async (t) => {
19044
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
19045
- if (!await t.env.data.sessions.remove(e, n))
19084
+ const { id: e } = t.req.valid("param");
19085
+ if (!await t.env.data.sessions.remove(t.var.tenant_id, e))
19046
19086
  throw new E(404, {
19047
19087
  message: "Session not found"
19048
19088
  });
@@ -19073,8 +19113,8 @@ const ex = new be().openapi(
19073
19113
  }
19074
19114
  }),
19075
19115
  async (t) => {
19076
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
19077
- if (!await t.env.data.sessions.update(e, n, {
19116
+ const { id: e } = t.req.valid("param");
19117
+ if (!await t.env.data.sessions.update(t.var.tenant_id, e, {
19078
19118
  revoked_at: (/* @__PURE__ */ new Date()).toDateString()
19079
19119
  }))
19080
19120
  throw new E(404, {
@@ -19112,10 +19152,13 @@ const ex = new be().openapi(
19112
19152
  }
19113
19153
  }),
19114
19154
  async (t) => {
19115
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.refreshTokens.get(e, n);
19116
- if (!r)
19155
+ const { id: e } = t.req.valid("param"), n = await t.env.data.refreshTokens.get(
19156
+ t.var.tenant_id,
19157
+ e
19158
+ );
19159
+ if (!n)
19117
19160
  throw new E(404);
19118
- return t.json(r);
19161
+ return t.json(n);
19119
19162
  }
19120
19163
  ).openapi(
19121
19164
  U({
@@ -19142,8 +19185,11 @@ const ex = new be().openapi(
19142
19185
  }
19143
19186
  }),
19144
19187
  async (t) => {
19145
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
19146
- if (!await t.env.data.refreshTokens.remove(e, n))
19188
+ const { id: e } = t.req.valid("param");
19189
+ if (!await t.env.data.refreshTokens.remove(
19190
+ t.var.tenant_id,
19191
+ e
19192
+ ))
19147
19193
  throw new E(404, {
19148
19194
  message: "Session not found"
19149
19195
  });
@@ -19177,8 +19223,8 @@ const ex = new be().openapi(
19177
19223
  }
19178
19224
  }),
19179
19225
  async (t) => {
19180
- const { "tenant-id": e } = t.req.valid("header"), n = await t.env.data.customDomains.list(e);
19181
- return t.json(n);
19226
+ const e = await t.env.data.customDomains.list(t.var.tenant_id);
19227
+ return t.json(e);
19182
19228
  }
19183
19229
  ).openapi(
19184
19230
  U({
@@ -19205,15 +19251,18 @@ const ex = new be().openapi(
19205
19251
  schema: Or
19206
19252
  }
19207
19253
  },
19208
- description: "A connection"
19254
+ description: "A customDomain"
19209
19255
  }
19210
19256
  }
19211
19257
  }),
19212
19258
  async (t) => {
19213
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = await t.env.data.customDomains.get(e, n);
19214
- if (!r)
19259
+ const { id: e } = t.req.valid("param"), n = await t.env.data.customDomains.get(
19260
+ t.var.tenant_id,
19261
+ e
19262
+ );
19263
+ if (!n)
19215
19264
  throw new E(404);
19216
- return t.json(r);
19265
+ return t.json(n);
19217
19266
  }
19218
19267
  ).openapi(
19219
19268
  U({
@@ -19240,8 +19289,11 @@ const ex = new be().openapi(
19240
19289
  }
19241
19290
  }),
19242
19291
  async (t) => {
19243
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param");
19244
- if (!await t.env.data.customDomains.remove(e, n))
19292
+ const { id: e } = t.req.valid("param");
19293
+ if (!await t.env.data.customDomains.remove(
19294
+ t.var.tenant_id,
19295
+ e
19296
+ ))
19245
19297
  throw new E(404, {
19246
19298
  message: "Custom domain not found"
19247
19299
  });
@@ -19284,17 +19336,20 @@ const ex = new be().openapi(
19284
19336
  }
19285
19337
  }),
19286
19338
  async (t) => {
19287
- const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), r = t.req.valid("json");
19339
+ const { id: e } = t.req.valid("param"), n = t.req.valid("json");
19288
19340
  if (!await t.env.data.customDomains.update(
19341
+ t.var.tenant_id,
19289
19342
  e,
19290
- n,
19291
- r
19343
+ n
19292
19344
  ))
19293
19345
  throw new E(404);
19294
- const s = await t.env.data.customDomains.get(e, n);
19295
- if (!s)
19346
+ const i = await t.env.data.customDomains.get(
19347
+ t.var.tenant_id,
19348
+ e
19349
+ );
19350
+ if (!i)
19296
19351
  throw new E(404);
19297
- return t.json(s);
19352
+ return t.json(i);
19298
19353
  }
19299
19354
  ).openapi(
19300
19355
  U({
@@ -19330,11 +19385,11 @@ const ex = new be().openapi(
19330
19385
  }
19331
19386
  }),
19332
19387
  async (t) => {
19333
- const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), r = await t.env.data.customDomains.create(
19334
- e,
19335
- n
19388
+ const e = t.req.valid("json"), n = await t.env.data.customDomains.create(
19389
+ t.var.tenant_id,
19390
+ e
19336
19391
  );
19337
- return t.json(r, { status: 201 });
19392
+ return t.json(n, { status: 201 });
19338
19393
  }
19339
19394
  ).openapi(
19340
19395
  U({
@@ -19381,11 +19436,11 @@ function dl(t, e) {
19381
19436
  typeof l == "function" ? s[a] = async (...u) => {
19382
19437
  const d = performance.now();
19383
19438
  try {
19384
- const p = await l(...u), g = performance.now() - d, b = t.res.headers.get("Server-Timing") || "", x = b ? `${b}, ${r}-${a};dur=${g.toFixed(2)}` : `${r}-${a};dur=${g.toFixed(2)}`;
19385
- return t.res.headers.set("Server-Timing", x), p;
19439
+ const p = await l(...u), g = performance.now() - d, b = t.res.headers.get("Server-Timing") || "", A = b ? `${b}, ${r}-${a};dur=${g.toFixed(2)}` : `${r}-${a};dur=${g.toFixed(2)}`;
19440
+ return t.res.headers.set("Server-Timing", A), p;
19386
19441
  } catch (p) {
19387
- const g = performance.now() - d, b = t.res.headers.get("Server-Timing") || "", x = b ? `${b}, ${r}-${a}-error;dur=${g.toFixed(2)}` : `${r}-${a}-error;dur=${g.toFixed(2)}`;
19388
- throw t.res.headers.set("Server-Timing", x), p;
19442
+ const g = performance.now() - d, b = t.res.headers.get("Server-Timing") || "", A = b ? `${b}, ${r}-${a}-error;dur=${g.toFixed(2)}` : `${r}-${a}-error;dur=${g.toFixed(2)}`;
19443
+ throw t.res.headers.set("Server-Timing", A), p;
19389
19444
  }
19390
19445
  } : s[a] = l;
19391
19446
  n[r] = s;
@@ -19479,58 +19534,58 @@ function gl(t, e) {
19479
19534
  keyPrefix: l
19480
19535
  } = e, u = new Set(s), d = a.length === 0, p = new Set(a), h = {};
19481
19536
  for (const [g, b] of Object.entries(t)) {
19482
- const x = d || p.has(g), C = {};
19483
- for (const [O, D] of Object.entries(
19537
+ const A = d || p.has(g), C = {};
19538
+ for (const [D, O] of Object.entries(
19484
19539
  b
19485
19540
  ))
19486
- if (typeof D == "function") {
19487
- if (!x) {
19488
- C[O] = D;
19541
+ if (typeof O == "function") {
19542
+ if (!A) {
19543
+ C[D] = O;
19489
19544
  continue;
19490
19545
  }
19491
- const A = `${g}:${O}`;
19492
- if (u.has(A)) {
19493
- C[O] = D;
19546
+ const x = `${g}:${D}`;
19547
+ if (u.has(x)) {
19548
+ C[D] = O;
19494
19549
  continue;
19495
19550
  }
19496
- const z = i[A] ?? r, q = [
19551
+ const z = i[x] ?? r, q = [
19497
19552
  "create",
19498
19553
  "update",
19499
19554
  "remove",
19500
19555
  "delete",
19501
19556
  "set",
19502
19557
  "used"
19503
- ].includes(O);
19504
- C[O] = async (...M) => {
19558
+ ].includes(D);
19559
+ C[D] = async (...M) => {
19505
19560
  if (q)
19506
- return await D.apply(b, M);
19561
+ return await O.apply(b, M);
19507
19562
  const K = ox(
19508
19563
  g,
19509
- O,
19564
+ D,
19510
19565
  M,
19511
19566
  l
19512
19567
  ), W = await n.get(K);
19513
19568
  if (W !== null)
19514
19569
  if (W && typeof W == "object" && "isCachedNull" in W) {
19515
- const Y = W;
19516
- return Y.isCachedNull ? null : Y.value;
19570
+ const Z = W;
19571
+ return Z.isCachedNull ? null : Z.value;
19517
19572
  } else
19518
19573
  return W;
19519
- const Z = await D.apply(b, M);
19574
+ const Y = await O.apply(b, M);
19520
19575
  if (z >= 0)
19521
- if (Z !== null)
19522
- await n.set(K, Z, z);
19576
+ if (Y !== null)
19577
+ await n.set(K, Y, z);
19523
19578
  else {
19524
- const Y = {
19579
+ const Z = {
19525
19580
  value: null,
19526
19581
  isCachedNull: !0
19527
19582
  };
19528
- await n.set(K, Y, z);
19583
+ await n.set(K, Z, z);
19529
19584
  }
19530
- return Z;
19585
+ return Y;
19531
19586
  };
19532
19587
  } else
19533
- C[O] = D;
19588
+ C[D] = O;
19534
19589
  h[g] = C;
19535
19590
  }
19536
19591
  return h;
@@ -19833,14 +19888,14 @@ const cx = qt.extend({
19833
19888
  }
19834
19889
  }),
19835
19890
  async (t) => {
19836
- const { page: e, per_page: n, include_totals: r, sort: i, q: s } = t.req.valid("query"), { "tenant-id": a } = t.req.valid("header"), l = await t.env.data.roles.list(a, {
19891
+ const { page: e, per_page: n, include_totals: r, sort: i, q: s } = t.req.valid("query"), a = await t.env.data.roles.list(t.var.tenant_id, {
19837
19892
  page: e,
19838
19893
  per_page: n,
19839
19894
  include_totals: r,
19840
19895
  sort: bt(i),
19841
19896
  q: s
19842
19897
  });
19843
- return r ? t.json(l) : t.json(l.roles);
19898
+ return r ? t.json(a) : t.json(a.roles);
19844
19899
  }
19845
19900
  ).openapi(
19846
19901
  U({
@@ -19872,10 +19927,10 @@ const cx = qt.extend({
19872
19927
  }
19873
19928
  }),
19874
19929
  async (t) => {
19875
- const { id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), r = await t.env.data.roles.get(n, e);
19876
- if (!r)
19930
+ const { id: e } = t.req.valid("param"), n = await t.env.data.roles.get(t.var.tenant_id, e);
19931
+ if (!n)
19877
19932
  throw new E(404);
19878
- return t.json(r);
19933
+ return t.json(n);
19879
19934
  }
19880
19935
  ).openapi(
19881
19936
  U({
@@ -19911,8 +19966,8 @@ const cx = qt.extend({
19911
19966
  }
19912
19967
  }),
19913
19968
  async (t) => {
19914
- const { "tenant-id": e } = t.req.valid("header"), n = t.req.valid("json"), r = await t.env.data.roles.create(e, n);
19915
- return t.json(r, { status: 201 });
19969
+ const e = t.req.valid("json"), n = await t.env.data.roles.create(t.var.tenant_id, e);
19970
+ return t.json(n, { status: 201 });
19916
19971
  }
19917
19972
  ).openapi(
19918
19973
  U({
@@ -19951,11 +20006,15 @@ const cx = qt.extend({
19951
20006
  }
19952
20007
  }),
19953
20008
  async (t) => {
19954
- const { id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), r = t.req.valid("json");
19955
- if (!await t.env.data.roles.update(n, e, r))
20009
+ const { id: e } = t.req.valid("param"), n = t.req.valid("json");
20010
+ if (!await t.env.data.roles.update(
20011
+ t.var.tenant_id,
20012
+ e,
20013
+ n
20014
+ ))
19956
20015
  throw new E(404);
19957
- const s = await t.env.data.roles.get(n, e);
19958
- return t.json(s);
20016
+ const i = await t.env.data.roles.get(t.var.tenant_id, e);
20017
+ return t.json(i);
19959
20018
  }
19960
20019
  ).openapi(
19961
20020
  U({
@@ -19982,8 +20041,8 @@ const cx = qt.extend({
19982
20041
  }
19983
20042
  }),
19984
20043
  async (t) => {
19985
- const { id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header");
19986
- if (!await t.env.data.roles.remove(n, e))
20044
+ const { id: e } = t.req.valid("param");
20045
+ if (!await t.env.data.roles.remove(t.var.tenant_id, e))
19987
20046
  throw new E(404);
19988
20047
  return t.text("OK");
19989
20048
  }
@@ -20018,23 +20077,23 @@ const cx = qt.extend({
20018
20077
  }
20019
20078
  }),
20020
20079
  async (t) => {
20021
- const { id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), { page: r, per_page: i, sort: s, q: a } = t.req.valid("query");
20022
- if (!await t.env.data.roles.get(n, e))
20080
+ const { id: e } = t.req.valid("param"), { page: n, per_page: r, sort: i, q: s } = t.req.valid("query");
20081
+ if (!await t.env.data.roles.get(t.var.tenant_id, e))
20023
20082
  throw new E(404, {
20024
20083
  message: "Role not found"
20025
20084
  });
20026
- const u = await t.env.data.rolePermissions.list(
20027
- n,
20085
+ const l = await t.env.data.rolePermissions.list(
20086
+ t.var.tenant_id,
20028
20087
  e,
20029
20088
  {
20030
- page: r,
20031
- per_page: i,
20089
+ page: n,
20090
+ per_page: r,
20032
20091
  include_totals: !1,
20033
- sort: bt(s),
20034
- q: a
20092
+ sort: bt(i),
20093
+ q: s
20035
20094
  }
20036
20095
  );
20037
- return t.json(u);
20096
+ return t.json(l);
20038
20097
  }
20039
20098
  ).openapi(
20040
20099
  U({
@@ -20075,18 +20134,18 @@ const cx = qt.extend({
20075
20134
  }
20076
20135
  }),
20077
20136
  async (t) => {
20078
- const { id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), { permissions: r } = t.req.valid("json");
20079
- if (!await t.env.data.roles.get(n, e))
20137
+ const { id: e } = t.req.valid("param"), { permissions: n } = t.req.valid("json");
20138
+ if (!await t.env.data.roles.get(t.var.tenant_id, e))
20080
20139
  throw new E(404, {
20081
20140
  message: "Role not found"
20082
20141
  });
20083
20142
  if (!await t.env.data.rolePermissions.assign(
20084
- n,
20143
+ t.var.tenant_id,
20085
20144
  e,
20086
- r.map((a) => ({
20145
+ n.map((s) => ({
20087
20146
  role_id: e,
20088
- resource_server_identifier: a.resource_server_identifier,
20089
- permission_name: a.permission_name
20147
+ resource_server_identifier: s.resource_server_identifier,
20148
+ permission_name: s.permission_name
20090
20149
  }))
20091
20150
  ))
20092
20151
  throw new E(500, {
@@ -20136,15 +20195,15 @@ const cx = qt.extend({
20136
20195
  }
20137
20196
  }),
20138
20197
  async (t) => {
20139
- const { id: e } = t.req.valid("param"), { "tenant-id": n } = t.req.valid("header"), { permissions: r } = t.req.valid("json");
20140
- if (!await t.env.data.roles.get(n, e))
20198
+ const { id: e } = t.req.valid("param"), { permissions: n } = t.req.valid("json");
20199
+ if (!await t.env.data.roles.get(t.var.tenant_id, e))
20141
20200
  throw new E(404, {
20142
20201
  message: "Role not found"
20143
20202
  });
20144
20203
  if (!await t.env.data.rolePermissions.remove(
20145
- n,
20204
+ t.var.tenant_id,
20146
20205
  e,
20147
- r
20206
+ n
20148
20207
  ))
20149
20208
  throw new E(500, {
20150
20209
  message: "Failed to remove permissions from role"
@@ -20440,13 +20499,13 @@ const cx = qt.extend({
20440
20499
  subject_type: p
20441
20500
  } = t.req.valid("query"), h = [];
20442
20501
  u && h.push(`client_id:"${u}"`), l && h.push(`audience:"${l}"`), d !== void 0 && h.push(`allow_any_organization:${d}`), p && h.push(`subject_type:"${p}"`), s && h.push(`id:>${s}`);
20443
- const g = h.length > 0 ? h.join(" AND ") : void 0, b = a ?? r, x = await t.env.data.clientGrants.list(e, {
20502
+ const g = h.length > 0 ? h.join(" AND ") : void 0, b = a ?? r, A = await t.env.data.clientGrants.list(e, {
20444
20503
  page: n,
20445
20504
  per_page: b,
20446
20505
  include_totals: i,
20447
20506
  q: g
20448
20507
  });
20449
- return i ? t.json(x) : t.json(x.client_grants);
20508
+ return i ? t.json(A) : t.json(A.client_grants);
20450
20509
  }
20451
20510
  ).openapi(
20452
20511
  U({
@@ -21463,7 +21522,7 @@ class Tx {
21463
21522
  }
21464
21523
  let e = this.H[0], n = this.H[1], r = this.H[2], i = this.H[3], s = this.H[4], a = this.H[5], l = this.H[6], u = this.H[7];
21465
21524
  for (let d = 0; d < 64; d++) {
21466
- const p = (An(s, 6) ^ An(s, 11) ^ An(s, 25)) >>> 0, h = (s & a ^ ~s & l) >>> 0, g = u + p + h + Ix[d] + this.w[d] | 0, b = (An(e, 2) ^ An(e, 13) ^ An(e, 22)) >>> 0, x = (e & n ^ e & r ^ n & r) >>> 0, C = b + x | 0;
21525
+ const p = (An(s, 6) ^ An(s, 11) ^ An(s, 25)) >>> 0, h = (s & a ^ ~s & l) >>> 0, g = u + p + h + Ix[d] + this.w[d] | 0, b = (An(e, 2) ^ An(e, 13) ^ An(e, 22)) >>> 0, A = (e & n ^ e & r ^ n & r) >>> 0, C = b + A | 0;
21467
21526
  u = l, l = a, a = s, s = i + g | 0, i = r, r = n, n = e, e = g + C | 0;
21468
21527
  }
21469
21528
  this.H[0] = e + this.H[0] | 0, this.H[1] = n + this.H[1] | 0, this.H[2] = r + this.H[2] | 0, this.H[3] = i + this.H[3] | 0, this.H[4] = s + this.H[4] | 0, this.H[5] = a + this.H[5] | 0, this.H[6] = l + this.H[6] | 0, this.H[7] = u + this.H[7] | 0;
@@ -22029,7 +22088,7 @@ async function Gx(t, e) {
22029
22088
  n.kid,
22030
22089
  r,
22031
22090
  i
22032
- ), a = We(), l = await s.createAuthorizationURL(
22091
+ ), a = Ke(), l = await s.createAuthorizationURL(
22033
22092
  a,
22034
22093
  ((d = n.scope) == null ? void 0 : d.split(" ")) || ["name", "email"]
22035
22094
  );
@@ -22073,7 +22132,7 @@ async function Jx(t, e) {
22073
22132
  n.client_id,
22074
22133
  n.client_secret,
22075
22134
  r
22076
- ), s = We();
22135
+ ), s = Ke();
22077
22136
  return {
22078
22137
  redirectUrl: i.createAuthorizationURL(
22079
22138
  s,
@@ -22121,7 +22180,7 @@ async function Qx(t, e) {
22121
22180
  n.client_id,
22122
22181
  n.client_secret,
22123
22182
  r
22124
- ), s = We(), a = Rx();
22183
+ ), s = Ke(), a = Rx();
22125
22184
  return {
22126
22185
  redirectUrl: i.createAuthorizationURL(
22127
22186
  s,
@@ -22168,7 +22227,7 @@ async function n5(t, e) {
22168
22227
  n.client_id,
22169
22228
  n.client_secret,
22170
22229
  `${ut(t.env)}callback`
22171
- ), i = We(), s = r.createAuthorizationURL(
22230
+ ), i = Ke(), s = r.createAuthorizationURL(
22172
22231
  "https://api.vipps.no/access-management-1.0/access/oauth2/auth",
22173
22232
  i,
22174
22233
  ((a = n.scope) == null ? void 0 : a.split(" ")) || [
@@ -22315,7 +22374,7 @@ async function ug(t, e, n, r) {
22315
22374
  Date.now() + Mr * 1e3
22316
22375
  ).toISOString(),
22317
22376
  authParams: r,
22318
- csrf_token: We(),
22377
+ csrf_token: Ke(),
22319
22378
  ip: u,
22320
22379
  useragent: d,
22321
22380
  auth0Client: Qn(p)
@@ -22339,7 +22398,7 @@ async function ug(t, e, n, r) {
22339
22398
  });
22340
22399
  }
22341
22400
  async function dg(t, { code: e, state: n }) {
22342
- var x;
22401
+ var A;
22343
22402
  const { env: r } = t, i = await r.data.codes.get(
22344
22403
  t.var.tenant_id || "",
22345
22404
  n,
@@ -22354,14 +22413,14 @@ async function dg(t, { code: e, state: n }) {
22354
22413
  if (!s)
22355
22414
  throw new E(403, { message: "Session not found" });
22356
22415
  if (s.authorization_url) {
22357
- const C = new URL(s.authorization_url).hostname, O = t.var.host || "";
22358
- if (C !== O && C) {
22359
- const D = new URL(`https://${C}/callback`);
22360
- return D.searchParams.set("state", n), D.searchParams.set("code", e), new Response("Redirecting", {
22416
+ const C = new URL(s.authorization_url).hostname, D = t.var.host || "";
22417
+ if (C !== D && C) {
22418
+ const O = new URL(`https://${C}/callback`);
22419
+ return O.searchParams.set("state", n), O.searchParams.set("code", e), new Response("Redirecting", {
22361
22420
  status: 307,
22362
22421
  // Temporary Redirect - preserves the HTTP method
22363
22422
  headers: {
22364
- location: D.toString()
22423
+ location: O.toString()
22365
22424
  }
22366
22425
  });
22367
22426
  }
@@ -22395,7 +22454,7 @@ async function dg(t, { code: e, state: n }) {
22395
22454
  i.code_verifier
22396
22455
  ), { sub: p, ...h } = d;
22397
22456
  t.set("user_id", p);
22398
- const g = ((x = d.email) == null ? void 0 : x.toLocaleLowerCase()) || `${l.name}.${p}@${new URL(t.env.ISSUER).hostname}`;
22457
+ const g = ((A = d.email) == null ? void 0 : A.toLocaleLowerCase()) || `${l.name}.${p}@${new URL(t.env.ISSUER).hostname}`;
22399
22458
  t.set("username", g);
22400
22459
  const b = await wc(t, {
22401
22460
  client: a,
@@ -23832,8 +23891,8 @@ var eA = ";ext=", fi = function(e) {
23832
23891
  return "([".concat(gn, "]{1,").concat(e, "})");
23833
23892
  };
23834
23893
  function x1(t) {
23835
- var e = "20", n = "15", r = "9", i = "6", s = "[  \\t,]*", a = "[:\\..]?[  \\t,-]*", l = "#?", u = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)", d = "(?:[xx##~~]|int|int)", p = "[- ]+", h = "[  \\t]*", g = "(?:,{2}|;)", b = eA + fi(e), x = s + u + a + fi(e) + l, C = s + d + a + fi(r) + l, O = p + fi(i) + "#", D = h + g + a + fi(n) + l, A = h + "(?:,)+" + a + fi(r) + l;
23836
- return b + "|" + x + "|" + C + "|" + O + "|" + D + "|" + A;
23894
+ var e = "20", n = "15", r = "9", i = "6", s = "[  \\t,]*", a = "[:\\..]?[  \\t,-]*", l = "#?", u = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)", d = "(?:[xx##~~]|int|int)", p = "[- ]+", h = "[  \\t]*", g = "(?:,{2}|;)", b = eA + fi(e), A = s + u + a + fi(e) + l, C = s + d + a + fi(r) + l, D = p + fi(i) + "#", O = h + g + a + fi(n) + l, x = h + "(?:,)+" + a + fi(r) + l;
23895
+ return b + "|" + A + "|" + C + "|" + D + "|" + O + "|" + x;
23837
23896
  }
23838
23897
  var tA = "[" + gn + "]{" + xf + "}", nA = "[" + Af + "]{0,1}(?:[" + rc + "]*[" + gn + "]){3,}[" + rc + gn + "]*", rA = new RegExp("^[" + Af + "]{0,1}(?:[" + rc + "]*[" + gn + "]){1,2}$", "i"), iA = nA + // Phone number extensions
23839
23898
  "(?:" + x1() + ")?", sA = new RegExp(
@@ -24471,16 +24530,16 @@ function eE(t, e, n) {
24471
24530
  var b = new wA(p, d, n.metadata);
24472
24531
  return u && (b.country = u), g && (b.carrierCode = g), s && (b.ext = s), b.__countryCallingCodeSource = h, b;
24473
24532
  }
24474
- var x = (e.extended ? n.hasSelectedNumberingPlan() : u) ? er(d, n.nationalNumberPattern()) : !1;
24533
+ var A = (e.extended ? n.hasSelectedNumberingPlan() : u) ? er(d, n.nationalNumberPattern()) : !1;
24475
24534
  return e.extended ? {
24476
24535
  country: u,
24477
24536
  countryCallingCode: p,
24478
24537
  carrierCode: g,
24479
- valid: x,
24480
- possible: x ? !0 : !!(e.extended === !0 && n.possibleLengths() && b1(d, n)),
24538
+ valid: A,
24539
+ possible: A ? !0 : !!(e.extended === !0 && n.possibleLengths() && b1(d, n)),
24481
24540
  phone: d,
24482
24541
  ext: s
24483
- } : x ? rE(u, d, s) : {};
24542
+ } : A ? rE(u, d, s) : {};
24484
24543
  }
24485
24544
  function tE(t, e, n) {
24486
24545
  if (t) {
@@ -24844,7 +24903,7 @@ async function k1(t, {
24844
24903
  throw new ti(
24845
24904
  `${ft(t.env)}invalid-session?state=${b.id}`
24846
24905
  );
24847
- const x = await wc(t, {
24906
+ const A = await wc(t, {
24848
24907
  client: p,
24849
24908
  username: d,
24850
24909
  provider: u,
@@ -24853,7 +24912,7 @@ async function k1(t, {
24853
24912
  ip: t.var.ip
24854
24913
  });
24855
24914
  return await h.data.codes.used(p.tenant.id, r), {
24856
- user: x,
24915
+ user: A,
24857
24916
  client: p,
24858
24917
  loginSession: b,
24859
24918
  session_id: b.session_id,
@@ -25500,7 +25559,7 @@ const CE = new be().openapi(
25500
25559
  Date.now() + Mr * 1e3
25501
25560
  ).toISOString(),
25502
25561
  authParams: s,
25503
- csrf_token: We(),
25562
+ csrf_token: Ke(),
25504
25563
  ip: t.get("ip"),
25505
25564
  useragent: t.get("useragent"),
25506
25565
  auth0Client: Qn(t.get("auth0_client"))
@@ -25570,12 +25629,12 @@ const TE = new be().openapi(
25570
25629
  {
25571
25630
  authParams: { ...s, client_id: r, username: u },
25572
25631
  expires_at: new Date(Date.now() + ta).toISOString(),
25573
- csrf_token: We(),
25632
+ csrf_token: Ke(),
25574
25633
  ip: d,
25575
25634
  useragent: p,
25576
25635
  auth0Client: g
25577
25636
  }
25578
- ), x = await n.data.codes.create(l.tenant.id, {
25637
+ ), A = await n.data.codes.create(l.tenant.id, {
25579
25638
  code_id: Ar(),
25580
25639
  code_type: "otp",
25581
25640
  login_id: b.id,
@@ -25584,14 +25643,14 @@ const TE = new be().openapi(
25584
25643
  });
25585
25644
  return i === "link" ? await If(t, {
25586
25645
  to: u,
25587
- code: x.code_id,
25646
+ code: A.code_id,
25588
25647
  authParams: {
25589
25648
  ...s,
25590
25649
  client_id: r
25591
25650
  }
25592
25651
  }) : await Tf(t, {
25593
25652
  to: u,
25594
- code: x.code_id
25653
+ code: A.code_id
25595
25654
  }), t.html("OK");
25596
25655
  }
25597
25656
  ).openapi(
@@ -25682,7 +25741,7 @@ const TE = new be().openapi(
25682
25741
  const q = z;
25683
25742
  "message" in q && typeof q.message == "string" && (b = q.message);
25684
25743
  }
25685
- const x = t.get("ip"), C = t.get("useragent"), O = t.get("auth0_client"), D = Qn(O), A = await e.data.loginSessions.create(
25744
+ const A = t.get("ip"), C = t.get("useragent"), D = t.get("auth0_client"), O = Qn(D), x = await e.data.loginSessions.create(
25686
25745
  h.tenant.id,
25687
25746
  {
25688
25747
  authParams: {
@@ -25690,14 +25749,14 @@ const TE = new be().openapi(
25690
25749
  username: r
25691
25750
  },
25692
25751
  expires_at: new Date(Date.now() + ta).toISOString(),
25693
- csrf_token: We(),
25694
- ip: x,
25752
+ csrf_token: Ke(),
25753
+ ip: A,
25695
25754
  useragent: C,
25696
- auth0Client: D
25755
+ auth0Client: O
25697
25756
  }
25698
25757
  );
25699
25758
  return t.redirect(
25700
- `${ft(t.env)}invalid-session?state=${A.id}&error=${encodeURIComponent(b)}`,
25759
+ `${ft(t.env)}invalid-session?state=${x.id}&error=${encodeURIComponent(b)}`,
25701
25760
  302
25702
25761
  );
25703
25762
  }
@@ -25830,7 +25889,7 @@ async function IE(t, e, n, r) {
25830
25889
  client_id: e.client_id,
25831
25890
  username: n
25832
25891
  },
25833
- csrf_token: We(),
25892
+ csrf_token: Ke(),
25834
25893
  ip: a,
25835
25894
  useragent: l,
25836
25895
  auth0Client: d
@@ -25914,7 +25973,7 @@ const OE = new be().openapi(
25914
25973
  client_id: n,
25915
25974
  username: s
25916
25975
  },
25917
- csrf_token: We(),
25976
+ csrf_token: Ke(),
25918
25977
  ip: a,
25919
25978
  useragent: l,
25920
25979
  auth0Client: Qn(u)
@@ -25978,7 +26037,7 @@ async function DE({
25978
26037
  Date.now() + Mr * 1e3
25979
26038
  ).toISOString(),
25980
26039
  authParams: r,
25981
- csrf_token: We(),
26040
+ csrf_token: Ke(),
25982
26041
  authorization_url: a.toString(),
25983
26042
  ip: l,
25984
26043
  useragent: d,
@@ -26082,33 +26141,51 @@ async function PE({
26082
26141
  code_challenge: l,
26083
26142
  audience: u,
26084
26143
  scope: d,
26085
- response_type: p
26144
+ response_type: p,
26145
+ organization: h
26086
26146
  }) {
26087
- const { env: h } = t, g = new URL(r), b = `${g.protocol}//${g.host}`;
26088
- async function x(K = "Login required") {
26089
- const W = Ve(t, {
26147
+ const { env: g } = t, b = new URL(r), A = `${b.protocol}//${b.host}`;
26148
+ async function C(Y = "Login required") {
26149
+ const Z = Ve(t, {
26090
26150
  type: qe.FAILED_SILENT_AUTH,
26091
- description: K
26151
+ description: Y
26092
26152
  });
26093
- return await t.env.data.logs.create(e.tenant.id, W), t.html(
26153
+ return await t.env.data.logs.create(e.tenant.id, Z), t.html(
26094
26154
  Tu(
26095
- b,
26155
+ A,
26096
26156
  JSON.stringify({
26097
26157
  error: "login_required",
26098
- error_description: K,
26158
+ error_description: Y,
26099
26159
  state: i
26100
26160
  })
26101
26161
  )
26102
26162
  );
26103
26163
  }
26104
26164
  if (!n || (n == null ? void 0 : n.expires_at) && new Date(n.expires_at) < /* @__PURE__ */ new Date() || (n == null ? void 0 : n.idle_expires_at) && new Date(n.idle_expires_at) < /* @__PURE__ */ new Date())
26105
- return x();
26165
+ return C();
26106
26166
  t.set("user_id", n.user_id);
26107
- const O = await h.data.users.get(e.tenant.id, n.user_id);
26167
+ const O = await g.data.users.get(e.tenant.id, n.user_id);
26108
26168
  if (!O)
26109
- return console.error("User not found", n.user_id), x("User not found");
26169
+ return console.error("User not found", n.user_id), C("User not found");
26110
26170
  t.set("username", O.email), t.set("connection", O.connection);
26111
- const D = {
26171
+ const x = await g.data.loginSessions.create(e.tenant.id, {
26172
+ csrf_token: Ke(),
26173
+ authParams: {
26174
+ client_id: e.client_id,
26175
+ audience: u,
26176
+ scope: d,
26177
+ state: i,
26178
+ nonce: s,
26179
+ response_type: p,
26180
+ redirect_uri: r,
26181
+ organization: h
26182
+ },
26183
+ expires_at: new Date(Date.now() + 5 * 60 * 1e3).toISOString(),
26184
+ // 5 minutes
26185
+ session_id: n.id,
26186
+ ip: t.var.ip,
26187
+ useragent: t.var.useragent
26188
+ }), z = {
26112
26189
  client: e,
26113
26190
  authParams: {
26114
26191
  client_id: e.client_id,
@@ -26123,15 +26200,16 @@ async function PE({
26123
26200
  },
26124
26201
  user: O,
26125
26202
  session_id: n.id
26126
- }, A = p === cn.CODE ? await i_(t, {
26203
+ }, q = p === cn.CODE ? await i_(t, {
26127
26204
  user: O,
26128
26205
  client: e,
26129
- authParams: D.authParams,
26130
- login_id: n.login_session_id
26131
- }) : await yc(t, D);
26132
- await h.data.sessions.update(e.tenant.id, n.id, {
26206
+ authParams: z.authParams,
26207
+ login_id: x.id
26208
+ }) : await yc(t, z);
26209
+ await g.data.sessions.update(e.tenant.id, n.id, {
26133
26210
  used_at: (/* @__PURE__ */ new Date()).toISOString(),
26134
26211
  last_interaction_at: (/* @__PURE__ */ new Date()).toISOString(),
26212
+ login_session_id: x.id,
26135
26213
  device: {
26136
26214
  ...n.device,
26137
26215
  last_ip: t.var.ip || "",
@@ -26141,28 +26219,28 @@ async function PE({
26141
26219
  Date.now() + mc * 1e3
26142
26220
  ).toISOString() : void 0
26143
26221
  });
26144
- const z = Ve(t, {
26222
+ const M = Ve(t, {
26145
26223
  type: qe.SUCCESS_SILENT_AUTH,
26146
26224
  description: "Successful silent authentication"
26147
26225
  });
26148
- await t.env.data.logs.create(e.tenant.id, z);
26149
- const q = new Headers();
26150
- q.set("Server-Timing", "cf-nel=0; no-cloudflare-insights=1");
26151
- const M = wa(
26226
+ await t.env.data.logs.create(e.tenant.id, M);
26227
+ const K = new Headers();
26228
+ K.set("Server-Timing", "cf-nel=0; no-cloudflare-insights=1");
26229
+ const W = wa(
26152
26230
  e.tenant.id,
26153
26231
  n.id,
26154
26232
  t.req.header("host")
26155
26233
  );
26156
- return q.set("set-cookie", M), t.html(
26234
+ return K.set("set-cookie", W), t.html(
26157
26235
  Tu(
26158
- b,
26236
+ A,
26159
26237
  JSON.stringify({
26160
- ...A,
26238
+ ...q,
26161
26239
  state: i
26162
26240
  })
26163
26241
  ),
26164
26242
  {
26165
- headers: q
26243
+ headers: K
26166
26244
  }
26167
26245
  );
26168
26246
  }
@@ -26253,11 +26331,11 @@ const BE = ["email", "sms", "Username-Password-Authentication"], LE = new be().o
26253
26331
  response_mode: h,
26254
26332
  code_challenge: g,
26255
26333
  code_challenge_method: b,
26256
- prompt: x,
26334
+ prompt: A,
26257
26335
  login_ticket: C,
26258
- realm: O,
26259
- auth0Client: D,
26260
- login_hint: A,
26336
+ realm: D,
26337
+ auth0Client: O,
26338
+ login_hint: x,
26261
26339
  ui_locales: z,
26262
26340
  organization: q
26263
26341
  } = t.req.valid("query");
@@ -26273,12 +26351,12 @@ const BE = ["email", "sms", "Username-Password-Authentication"], LE = new be().o
26273
26351
  vendor_id: r,
26274
26352
  audience: l,
26275
26353
  nonce: u,
26276
- prompt: x,
26354
+ prompt: A,
26277
26355
  response_type: p,
26278
26356
  response_mode: h,
26279
26357
  code_challenge: g,
26280
26358
  code_challenge_method: b,
26281
- username: A,
26359
+ username: x,
26282
26360
  ui_locales: z,
26283
26361
  organization: q
26284
26362
  }, W = t.req.header("origin");
@@ -26295,11 +26373,11 @@ const BE = ["email", "sms", "Username-Password-Authentication"], LE = new be().o
26295
26373
  message: `Invalid redirect URI - ${K.redirect_uri}`
26296
26374
  });
26297
26375
  }
26298
- const Z = Ii(
26376
+ const Y = Ii(
26299
26377
  M.tenant.id,
26300
26378
  t.req.header("cookie")
26301
- ), Y = Z ? await e.data.sessions.get(M.tenant.id, Z) : void 0, Se = Y && !Y.revoked_at ? Y : void 0;
26302
- if (x == "none") {
26379
+ ), Z = Y ? await e.data.sessions.get(M.tenant.id, Y) : void 0, Se = Z && !Z.revoked_at ? Z : void 0;
26380
+ if (A == "none") {
26303
26381
  if (!p)
26304
26382
  throw new E(400, {
26305
26383
  message: "Missing response_type"
@@ -26315,7 +26393,8 @@ const BE = ["email", "sms", "Username-Password-Authentication"], LE = new be().o
26315
26393
  code_challenge_method: b,
26316
26394
  code_challenge: g,
26317
26395
  audience: l,
26318
- scope: s
26396
+ scope: s,
26397
+ organization: q
26319
26398
  });
26320
26399
  }
26321
26400
  if (M.connections.length === 1 && M.connections[0] && !BE.includes(M.connections[0].strategy || ""))
@@ -26333,18 +26412,18 @@ const BE = ["email", "sms", "Username-Password-Authentication"], LE = new be().o
26333
26412
  M.tenant.id,
26334
26413
  C,
26335
26414
  K,
26336
- O
26415
+ D
26337
26416
  );
26338
26417
  return F instanceof Response ? F : t.json(F);
26339
26418
  }
26340
26419
  const j = await DE({
26341
26420
  ctx: t,
26342
26421
  client: M,
26343
- auth0Client: D,
26422
+ auth0Client: O,
26344
26423
  authParams: K,
26345
26424
  session: Se || void 0,
26346
26425
  connection: d,
26347
- login_hint: A
26426
+ login_hint: x
26348
26427
  });
26349
26428
  return j instanceof Response ? j : t.json(j);
26350
26429
  }
@@ -26400,8 +26479,8 @@ const BE = ["email", "sms", "Username-Password-Authentication"], LE = new be().o
26400
26479
  message: `Origin ${u} not allowed`
26401
26480
  });
26402
26481
  if (l.redirect_uri) {
26403
- const A = a.callbacks || [];
26404
- if (t.var.host && (A.push(`${pl(t.env)}/*`), A.push(`${ft(t.env)}/*`)), !wf(l.redirect_uri, A, {
26482
+ const x = a.callbacks || [];
26483
+ if (t.var.host && (x.push(`${pl(t.env)}/*`), x.push(`${ft(t.env)}/*`)), !wf(l.redirect_uri, x, {
26405
26484
  allowPathWildcards: !0
26406
26485
  }))
26407
26486
  throw new E(400, {
@@ -26413,18 +26492,18 @@ const BE = ["email", "sms", "Username-Password-Authentication"], LE = new be().o
26413
26492
  t.req.header("cookie")
26414
26493
  ), p = d ? await e.data.sessions.get(a.tenant.id, d) : void 0, h = p && !p.revoked_at ? p : void 0, g = new URL(t.req.url);
26415
26494
  t.var.custom_domain && (g.hostname = t.var.custom_domain);
26416
- const { ip: b, auth0_client: x, useragent: C } = t.var, O = Qn(x), D = await e.data.loginSessions.create(
26495
+ const { ip: b, auth0_client: A, useragent: C } = t.var, D = Qn(A), O = await e.data.loginSessions.create(
26417
26496
  a.tenant.id,
26418
26497
  {
26419
26498
  expires_at: new Date(
26420
26499
  Date.now() + Mr * 1e3
26421
26500
  ).toISOString(),
26422
26501
  authParams: l,
26423
- csrf_token: We(),
26502
+ csrf_token: Ke(),
26424
26503
  authorization_url: g.toString(),
26425
26504
  ip: b,
26426
26505
  useragent: C,
26427
- auth0Client: O
26506
+ auth0Client: D
26428
26507
  }
26429
26508
  );
26430
26509
  if (h) {
@@ -26435,23 +26514,23 @@ const BE = ["email", "sms", "Username-Password-Authentication"], LE = new be().o
26435
26514
  );
26436
26515
  if ((z == null ? void 0 : z.email) !== i)
26437
26516
  return t.redirect(
26438
- `${ft(t.env)}login/identifier?state=${encodeURIComponent(D.id)}`
26517
+ `${ft(t.env)}login/identifier?state=${encodeURIComponent(O.id)}`
26439
26518
  );
26440
26519
  }
26441
- if (await e.data.loginSessions.update(a.tenant.id, D.id, {
26520
+ if (await e.data.loginSessions.update(a.tenant.id, O.id, {
26442
26521
  session_id: h.id
26443
26522
  }), s === "change-email") {
26444
26523
  const z = new URL(
26445
26524
  "/u/account/change-email",
26446
26525
  t.req.url
26447
26526
  );
26448
- return z.searchParams.set("state", D.id), t.redirect(z.toString());
26527
+ return z.searchParams.set("state", O.id), t.redirect(z.toString());
26449
26528
  }
26450
- const A = new URL("/u/account", t.req.url);
26451
- return A.searchParams.set("state", D.id), t.redirect(A.toString());
26529
+ const x = new URL("/u/account", t.req.url);
26530
+ return x.searchParams.set("state", O.id), t.redirect(x.toString());
26452
26531
  }
26453
26532
  return t.redirect(
26454
- `${ft(t.env)}login/identifier?state=${encodeURIComponent(D.id)}`
26533
+ `${ft(t.env)}login/identifier?state=${encodeURIComponent(O.id)}`
26455
26534
  );
26456
26535
  }
26457
26536
  );
@@ -26608,8 +26687,8 @@ var Df = (t, ...e) => {
26608
26687
  else {
26609
26688
  const h = [];
26610
26689
  p = l.map(([g, , b]) => {
26611
- let x = h.indexOf(b);
26612
- return x === -1 && (h.push(b), x = h.length - 1), [g, x];
26690
+ let A = h.indexOf(b);
26691
+ return A === -1 && (h.push(b), A = h.length - 1), [g, A];
26613
26692
  }).sort((g, b) => g[1] - b[1]).map(([g]) => g);
26614
26693
  }
26615
26694
  p.forEach((h) => {
@@ -27024,7 +27103,7 @@ var q1 = { exports: {} };
27024
27103
  })();
27025
27104
  })(q1);
27026
27105
  var s8 = q1.exports;
27027
- const mn = /* @__PURE__ */ Um(s8), o8 = (t) => t === "small" ? "text-base" : t === "medium" ? "text-2xl" : t === "large" ? "text-3xl" : "", Ge = ({ name: t, size: e, className: n = "" }) => {
27106
+ const mn = /* @__PURE__ */ Um(s8), o8 = (t) => t === "small" ? "text-base" : t === "medium" ? "text-2xl" : t === "large" ? "text-3xl" : "", We = ({ name: t, size: e, className: n = "" }) => {
27028
27107
  const r = o8(e);
27029
27108
  return /* @__PURE__ */ _("span", { className: mn(`uicon-${t}`, n, r) });
27030
27109
  }, a8 = (t, e) => {
@@ -27113,7 +27192,7 @@ const u8 = (t, e) => {
27113
27192
  ] })
27114
27193
  ] }),
27115
27194
  /* @__PURE__ */ _("div", { className: "flex w-full items-center px-6 pb-8 pt-4 justify-between", children: [
27116
- /* @__PURE__ */ _("div", { className: "flex justify-center leading-[0]", children: /* @__PURE__ */ _("a", { href: "https://sesamy.com", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ _(Ge, { name: "sesamy", className: "text-xl text-white" }) }) }),
27195
+ /* @__PURE__ */ _("div", { className: "flex justify-center leading-[0]", children: /* @__PURE__ */ _("a", { href: "https://sesamy.com", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ _(We, { name: "sesamy", className: "text-xl text-white" }) }) }),
27117
27196
  /* @__PURE__ */ _("div", { className: "flex justify-center space-x-2 text-xs text-white sm:justify-normal md:text-xs" })
27118
27197
  ] })
27119
27198
  ] }) })
@@ -27146,7 +27225,7 @@ const u8 = (t, e) => {
27146
27225
  const e = p8(t);
27147
27226
  return /* @__PURE__ */ _("div", { className: "relative inline-block leading-[0]", children: [
27148
27227
  /* @__PURE__ */ _(
27149
- Ge,
27228
+ We,
27150
27229
  {
27151
27230
  className: mn("text-gray-200 dark:text-[#201a41]", {
27152
27231
  [e]: e
@@ -27155,7 +27234,7 @@ const u8 = (t, e) => {
27155
27234
  }
27156
27235
  ),
27157
27236
  /* @__PURE__ */ _(
27158
- Ge,
27237
+ We,
27159
27238
  {
27160
27239
  className: mn("absolute inset-0 animate-spin text-primary", {
27161
27240
  [e]: e
@@ -27325,11 +27404,11 @@ const u8 = (t, e) => {
27325
27404
  email: i,
27326
27405
  client: s
27327
27406
  }) => {
27328
- const a = s.connections.map(({ strategy: q }) => q), l = a.includes("email") || a.includes("Username-Password-Authentication"), u = a.includes("sms"), d = a.includes("facebook"), p = a.includes("google-oauth2"), h = a.includes("apple"), g = a.includes("vipps"), b = d || p || h || g, x = l || u;
27329
- let C = "text", O = "username";
27330
- const D = l && u ? "email_or_phone_placeholder" : l ? "email_placeholder" : "phone_placeholder";
27331
- let A = B.t(
27332
- D,
27407
+ const a = s.connections.map(({ strategy: q }) => q), l = a.includes("email") || a.includes("Username-Password-Authentication"), u = a.includes("sms"), d = a.includes("facebook"), p = a.includes("google-oauth2"), h = a.includes("apple"), g = a.includes("vipps"), b = d || p || h || g, A = l || u;
27408
+ let C = "text", D = "username";
27409
+ const O = l && u ? "email_or_phone_placeholder" : l ? "email_placeholder" : "phone_placeholder";
27410
+ let x = B.t(
27411
+ O,
27333
27412
  l && u ? "Email or Phone Number" : l ? "Email Address" : "Phone Number"
27334
27413
  );
27335
27414
  return /* @__PURE__ */ _(
@@ -27342,19 +27421,19 @@ const u8 = (t, e) => {
27342
27421
  children: [
27343
27422
  /* @__PURE__ */ _("div", { className: "mb-4 text-lg font-medium sm:text-2xl", children: B.t("welcome") }),
27344
27423
  /* @__PURE__ */ _("div", { className: "mb-8 text-gray-300", children: B.t("login_description_template", {
27345
- authMethod: B.t(D, {
27424
+ authMethod: B.t(O, {
27346
27425
  defaultValue: l && u ? "email or phone number" : l ? "email address" : "phone number"
27347
27426
  }).toLocaleLowerCase(),
27348
27427
  defaultValue: "Sign in with your {{authMethod}}"
27349
27428
  }) }),
27350
27429
  /* @__PURE__ */ _("div", { className: "flex flex-1 flex-col justify-center", children: [
27351
- x && /* @__PURE__ */ _(Ln, { className: "mb-7", children: [
27430
+ A && /* @__PURE__ */ _(Ln, { className: "mb-7", children: [
27352
27431
  /* @__PURE__ */ _(
27353
27432
  "input",
27354
27433
  {
27355
27434
  type: C,
27356
- name: O,
27357
- placeholder: A,
27435
+ name: D,
27436
+ placeholder: x,
27358
27437
  className: mn(
27359
27438
  "mb-2 w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",
27360
27439
  {
@@ -27369,10 +27448,10 @@ const u8 = (t, e) => {
27369
27448
  t && /* @__PURE__ */ _(Bn, { children: t }),
27370
27449
  /* @__PURE__ */ _(tt, { className: "sm:mt-4 !text-base", children: [
27371
27450
  /* @__PURE__ */ _("span", { children: B.t("continue") }),
27372
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
27451
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
27373
27452
  ] })
27374
27453
  ] }),
27375
- x && b && /* @__PURE__ */ _("div", { className: "relative mb-5 block text-center text-gray-300 dark:text-gray-300", children: [
27454
+ A && b && /* @__PURE__ */ _("div", { className: "relative mb-5 block text-center text-gray-300 dark:text-gray-300", children: [
27376
27455
  /* @__PURE__ */ _("div", { className: "absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600" }),
27377
27456
  /* @__PURE__ */ _("div", { className: "relative inline-block bg-white px-2 dark:bg-gray-800", children: B.t("continue_social_login") })
27378
27457
  ] }),
@@ -27384,7 +27463,7 @@ const u8 = (t, e) => {
27384
27463
  text: B.t("continue_with", { provider: "Facebook" }),
27385
27464
  canResize: !0,
27386
27465
  icon: /* @__PURE__ */ _(
27387
- Ge,
27466
+ We,
27388
27467
  {
27389
27468
  className: "text-xl text-[#1196F5] sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",
27390
27469
  name: "facebook"
@@ -27410,7 +27489,7 @@ const u8 = (t, e) => {
27410
27489
  text: B.t("continue_with", { provider: "Apple" }),
27411
27490
  canResize: !0,
27412
27491
  icon: /* @__PURE__ */ _(
27413
- Ge,
27492
+ We,
27414
27493
  {
27415
27494
  className: "text-xl text-black dark:text-white sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",
27416
27495
  name: "apple"
@@ -27514,7 +27593,7 @@ const u8 = (t, e) => {
27514
27593
  r.username,
27515
27594
  u
27516
27595
  );
27517
- if (!i.connections.find((O) => O.strategy === p) || !d)
27596
+ if (!i.connections.find((D) => D.strategy === p) || !d)
27518
27597
  return t.html(
27519
27598
  /* @__PURE__ */ _(
27520
27599
  eu,
@@ -27539,11 +27618,11 @@ const u8 = (t, e) => {
27539
27618
  try {
27540
27619
  await l3(t, i, t.env.data, d);
27541
27620
  } catch {
27542
- const O = Ve(t, {
27621
+ const D = Ve(t, {
27543
27622
  type: qe.FAILED_SIGNUP,
27544
27623
  description: "Public signup is disabled"
27545
27624
  });
27546
- return on(t, t.env.data.logs.create(i.tenant.id, O)), t.html(
27625
+ return on(t, t.env.data.logs.create(i.tenant.id, D)), t.html(
27547
27626
  /* @__PURE__ */ _(
27548
27627
  eu,
27549
27628
  {
@@ -27580,14 +27659,14 @@ const u8 = (t, e) => {
27580
27659
  g,
27581
27660
  "otp"
27582
27661
  );
27583
- const x = await t.env.data.codes.create(i.tenant.id, {
27662
+ const A = await t.env.data.codes.create(i.tenant.id, {
27584
27663
  code_id: g,
27585
27664
  code_type: "otp",
27586
27665
  login_id: s.id,
27587
27666
  expires_at: new Date(Date.now() + ta).toISOString(),
27588
27667
  redirect_uri: s.authParams.redirect_uri
27589
27668
  }), C = i.connections.find(
27590
- (O) => O.strategy === p
27669
+ (D) => D.strategy === p
27591
27670
  );
27592
27671
  if (!C)
27593
27672
  throw new E(400, {
@@ -27598,11 +27677,11 @@ const u8 = (t, e) => {
27598
27677
  return p === "email" && // This is different to how it works in auth0
27599
27678
  C.options.authentication_method === "magic_link" ? await If(t, {
27600
27679
  to: d,
27601
- code: x.code_id,
27680
+ code: A.code_id,
27602
27681
  authParams: s.authParams
27603
27682
  }) : await Tf(t, {
27604
27683
  to: d,
27605
- code: x.code_id
27684
+ code: A.code_id
27606
27685
  }), t.redirect(`/u/enter-code?state=${n}`);
27607
27686
  }
27608
27687
  ), _n = (t) => /* @__PURE__ */ _(
@@ -27749,15 +27828,15 @@ var Qs = "_hp", _8 = {
27749
27828
  if (g.s && g.e)
27750
27829
  b = g.e, g.s = !1;
27751
27830
  else {
27752
- const x = n || !g.e;
27753
- zn(g) ? (g.e && g.d && (g.e.textContent = g.t), g.d = !1, b = g.e || (g.e = document.createTextNode(g.t))) : (b = g.e || (g.e = g.n ? document.createElementNS(g.n, g.tag) : document.createElement(g.tag)), v8(b, g.props, g.pP), K1(g, b, x));
27831
+ const A = n || !g.e;
27832
+ zn(g) ? (g.e && g.d && (g.e.textContent = g.t), g.d = !1, b = g.e || (g.e = document.createTextNode(g.t))) : (b = g.e || (g.e = g.n ? document.createElementNS(g.n, g.tag) : document.createElement(g.tag)), v8(b, g.props, g.pP), K1(g, b, A));
27754
27833
  }
27755
27834
  g.tag === Qs ? l-- : n ? b.parentNode || e.appendChild(b) : a[l] !== b && a[l - 1] !== b && (a[l + 1] === b ? e.appendChild(a[l]) : e.insertBefore(b, u || a[l] || null));
27756
27835
  }
27757
27836
  if (t.pP && delete t.pP, s.length) {
27758
27837
  const p = [], h = [];
27759
- s.forEach(([, g, , b, x]) => {
27760
- g && p.push(g), b && h.push(b), x == null || x();
27838
+ s.forEach(([, g, , b, A]) => {
27839
+ g && p.push(g), b && h.push(b), A == null || A();
27761
27840
  }), p.forEach((g) => g()), h.length && requestAnimationFrame(() => {
27762
27841
  h.forEach((g) => g());
27763
27842
  });
@@ -27771,36 +27850,36 @@ var Qs = "_hp", _8 = {
27771
27850
  n || (n = typeof e.tag == "function" ? b8(t, e) : Co(e.props.children)), ((s = n[0]) == null ? void 0 : s.tag) === "" && n[0][ip] && (i = n[0][ip], t[5].push([t, i, e]));
27772
27851
  const h = r ? [...e.pC] : e.vC ? [...e.vC] : void 0, g = [];
27773
27852
  let b;
27774
- for (let x = 0; x < n.length; x++) {
27775
- Array.isArray(n[x]) && n.splice(x, 1, ...n[x].flat());
27776
- let C = A8(n[x]);
27853
+ for (let A = 0; A < n.length; A++) {
27854
+ Array.isArray(n[A]) && n.splice(A, 1, ...n[A].flat());
27855
+ let C = A8(n[A]);
27777
27856
  if (C) {
27778
- typeof C.tag == "function" && !C.tag[R1] && (Vi.length > 0 && (C[Je][2] = Vi.map((D) => [D, D.values.at(-1)])), (a = t[5]) != null && a.length && (C[Je][3] = t[5].at(-1)));
27779
- let O;
27857
+ typeof C.tag == "function" && !C.tag[R1] && (Vi.length > 0 && (C[Je][2] = Vi.map((O) => [O, O.values.at(-1)])), (a = t[5]) != null && a.length && (C[Je][3] = t[5].at(-1)));
27858
+ let D;
27780
27859
  if (h && h.length) {
27781
- const D = h.findIndex(
27782
- zn(C) ? (A) => zn(A) : C.key !== void 0 ? (A) => A.key === C.key && A.tag === C.tag : (A) => A.tag === C.tag
27860
+ const O = h.findIndex(
27861
+ zn(C) ? (x) => zn(x) : C.key !== void 0 ? (x) => x.key === C.key && x.tag === C.tag : (x) => x.tag === C.tag
27783
27862
  );
27784
- D !== -1 && (O = h[D], h.splice(D, 1));
27863
+ O !== -1 && (D = h[O], h.splice(O, 1));
27785
27864
  }
27786
- if (O)
27865
+ if (D)
27787
27866
  if (zn(C))
27788
- O.t !== C.t && (O.t = C.t, O.d = !0), C = O;
27867
+ D.t !== C.t && (D.t = C.t, D.d = !0), C = D;
27789
27868
  else {
27790
- const D = O.pP = O.props;
27791
- if (O.props = C.props, O.f || (O.f = C.f || e.f), typeof C.tag == "function") {
27792
- const A = O[Je][2];
27793
- O[Je][2] = C[Je][2] || [], O[Je][3] = C[Je][3], !O.f && ((O.o || O) === C.o || (u = (l = O.tag)[ME]) != null && u.call(l, D, O.props)) && x8(A, O[Je][2]) && (O.s = !0);
27869
+ const O = D.pP = D.props;
27870
+ if (D.props = C.props, D.f || (D.f = C.f || e.f), typeof C.tag == "function") {
27871
+ const x = D[Je][2];
27872
+ D[Je][2] = C[Je][2] || [], D[Je][3] = C[Je][3], !D.f && ((D.o || D) === C.o || (u = (l = D.tag)[ME]) != null && u.call(l, O, D.props)) && x8(x, D[Je][2]) && (D.s = !0);
27794
27873
  }
27795
- C = O;
27874
+ C = D;
27796
27875
  }
27797
27876
  else if (!zn(C) && Hi) {
27798
- const D = ls(Hi);
27799
- D && (C.n = D);
27877
+ const O = ls(Hi);
27878
+ O && (C.n = O);
27800
27879
  }
27801
27880
  if (!zn(C) && !C.s && (ap(t, C), delete C.f), g.push(C), b && !b.s && !C.s)
27802
- for (let D = b; D && !zn(D); D = (d = D.vC) == null ? void 0 : d.at(-1))
27803
- D.nN = C;
27881
+ for (let O = b; O && !zn(O); O = (d = O.vC) == null ? void 0 : d.at(-1))
27882
+ O.nN = C;
27804
27883
  b = C;
27805
27884
  }
27806
27885
  }
@@ -27811,23 +27890,23 @@ var Qs = "_hp", _8 = {
27811
27890
  return;
27812
27891
  throw h;
27813
27892
  }
27814
- const [g, b, x] = ((p = e[Je]) == null ? void 0 : p[3]) || [];
27893
+ const [g, b, A] = ((p = e[Je]) == null ? void 0 : p[3]) || [];
27815
27894
  if (b) {
27816
- const C = () => fa([0, !1, t[2]], x), O = pa.get(x) || [];
27817
- O.push(C), pa.set(x, O);
27818
- const D = b(h, () => {
27819
- const A = pa.get(x);
27820
- if (A) {
27821
- const z = A.indexOf(C);
27895
+ const C = () => fa([0, !1, t[2]], A), D = pa.get(A) || [];
27896
+ D.push(C), pa.set(A, D);
27897
+ const O = b(h, () => {
27898
+ const x = pa.get(A);
27899
+ if (x) {
27900
+ const z = x.indexOf(C);
27822
27901
  if (z !== -1)
27823
- return A.splice(z, 1), C();
27902
+ return x.splice(z, 1), C();
27824
27903
  }
27825
27904
  });
27826
- if (D) {
27905
+ if (O) {
27827
27906
  if (t[0] === 1)
27828
27907
  t[1] = !0;
27829
- else if (ap(t, x, [D]), (b.length === 1 || t !== g) && x.c) {
27830
- H1(x, x.c, !1);
27908
+ else if (ap(t, A, [O]), (b.length === 1 || t !== g) && A.c) {
27909
+ H1(A, A.c, !1);
27831
27910
  return;
27832
27911
  }
27833
27912
  throw Xg;
@@ -27999,11 +28078,11 @@ var Qs = "_hp", _8 = {
27999
28078
  const s = document.head;
28000
28079
  let { onLoad: a, onError: l, precedence: u, blocking: d, ...p } = e, h = null, g = !1;
28001
28080
  const b = la[t];
28002
- let x;
28081
+ let A;
28003
28082
  if (b.length > 0) {
28004
- const A = s.querySelectorAll(t);
28083
+ const x = s.querySelectorAll(t);
28005
28084
  e:
28006
- for (const z of A)
28085
+ for (const z of x)
28007
28086
  for (const q of la[t])
28008
28087
  if (z.getAttribute(q) === e[q]) {
28009
28088
  h = z;
@@ -28022,67 +28101,67 @@ var Qs = "_hp", _8 = {
28022
28101
  })());
28023
28102
  }
28024
28103
  } else
28025
- x = s.querySelectorAll(t);
28104
+ A = s.querySelectorAll(t);
28026
28105
  u = r ? u ?? "" : void 0, r && (p[ua] = u);
28027
28106
  const C = Lf(
28028
- (A) => {
28107
+ (x) => {
28029
28108
  if (b.length > 0) {
28030
28109
  let z = !1;
28031
28110
  for (const q of s.querySelectorAll(t)) {
28032
28111
  if (z && q.getAttribute(ua) !== u) {
28033
- s.insertBefore(A, q);
28112
+ s.insertBefore(x, q);
28034
28113
  return;
28035
28114
  }
28036
28115
  q.getAttribute(ua) === u && (z = !0);
28037
28116
  }
28038
- s.appendChild(A);
28039
- } else if (x) {
28117
+ s.appendChild(x);
28118
+ } else if (A) {
28040
28119
  let z = !1;
28041
- for (const q of x)
28042
- if (q === A) {
28120
+ for (const q of A)
28121
+ if (q === x) {
28043
28122
  z = !0;
28044
28123
  break;
28045
28124
  }
28046
28125
  z || s.insertBefore(
28047
- A,
28048
- s.contains(x[0]) ? x[0] : s.querySelector(t)
28049
- ), x = void 0;
28126
+ x,
28127
+ s.contains(A[0]) ? A[0] : s.querySelector(t)
28128
+ ), A = void 0;
28050
28129
  }
28051
28130
  },
28052
28131
  [u]
28053
- ), O = Ff(e.ref, (A) => {
28132
+ ), D = Ff(e.ref, (x) => {
28054
28133
  var M;
28055
28134
  const z = b[0];
28056
- if (n === 2 && (A.innerHTML = ""), (g || x) && C(A), !l && !a)
28135
+ if (n === 2 && (x.innerHTML = ""), (g || A) && C(x), !l && !a)
28057
28136
  return;
28058
- let q = hi[M = A.getAttribute(z)] || (hi[M] = new Promise(
28137
+ let q = hi[M = x.getAttribute(z)] || (hi[M] = new Promise(
28059
28138
  (K, W) => {
28060
- A.addEventListener("load", K), A.addEventListener("error", W);
28139
+ x.addEventListener("load", K), x.addEventListener("error", W);
28061
28140
  }
28062
28141
  ));
28063
28142
  a && (q = q.then(a)), l && (q = q.catch(l)), q.catch(() => {
28064
28143
  });
28065
28144
  });
28066
28145
  if (i && d === "render") {
28067
- const A = la[t][0];
28068
- if (e[A]) {
28069
- const z = e[A], q = hi[z] || (hi[z] = new Promise((M, K) => {
28146
+ const x = la[t][0];
28147
+ if (e[x]) {
28148
+ const z = e[x], q = hi[z] || (hi[z] = new Promise((M, K) => {
28070
28149
  C(h), h.addEventListener("load", M), h.addEventListener("error", K);
28071
28150
  }));
28072
28151
  N8(q);
28073
28152
  }
28074
28153
  }
28075
- const D = {
28154
+ const O = {
28076
28155
  tag: t,
28077
28156
  type: t,
28078
28157
  props: {
28079
28158
  ...p,
28080
- ref: O
28159
+ ref: D
28081
28160
  },
28082
- ref: O
28161
+ ref: D
28083
28162
  };
28084
- return D.p = n, h && (D.e = h), E8(
28085
- D,
28163
+ return O.p = n, h && (O.e = h), E8(
28164
+ O,
28086
28165
  s
28087
28166
  );
28088
28167
  }, O8 = (t) => {
@@ -28250,10 +28329,10 @@ const to = (t) => {
28250
28329
  t && /* @__PURE__ */ _(Bn, { children: t }),
28251
28330
  /* @__PURE__ */ _(tt, { className: "sm:mt-4 !text-base", children: [
28252
28331
  /* @__PURE__ */ _("span", { children: B.t("login") }),
28253
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
28332
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
28254
28333
  ] }),
28255
28334
  /* @__PURE__ */ _("div", { className: "my-4 flex space-x-2 text-sm text-[#B2B2B2]", children: [
28256
- /* @__PURE__ */ _(Ge, { className: "text-base", name: "info-bubble" }),
28335
+ /* @__PURE__ */ _(We, { className: "text-base", name: "info-bubble" }),
28257
28336
  /* @__PURE__ */ _("div", { className: "text-sm text-gray-300 md:text-sm", children: B.t("sent_code_spam") })
28258
28337
  ] }),
28259
28338
  d && /* @__PURE__ */ _("div", { className: "text-center mb-12", children: [
@@ -28471,7 +28550,7 @@ const to = (t) => {
28471
28550
  /* @__PURE__ */ _("div", { className: "flex flex-1 flex-col justify-center", children: [
28472
28551
  /* @__PURE__ */ _("p", { className: "mb-8 text-gray-300 text-lg", children: B.t("unverified_email") }),
28473
28552
  /* @__PURE__ */ _("div", { className: "my-4 flex space-x-2 text-sm text-[#B2B2B2]", children: [
28474
- /* @__PURE__ */ _(Ge, { className: "text-base", name: "info-bubble" }),
28553
+ /* @__PURE__ */ _(We, { className: "text-base", name: "info-bubble" }),
28475
28554
  /* @__PURE__ */ _("div", { className: "text-sm text-gray-300 md:text-sm", children: B.t("sent_code_spam") })
28476
28555
  ] }),
28477
28556
  /* @__PURE__ */ _(_n, { state: i })
@@ -28576,7 +28655,7 @@ const ou = (t) => {
28576
28655
  e && /* @__PURE__ */ _(Bn, { children: e }),
28577
28656
  /* @__PURE__ */ _(tt, { className: "sm:mt-4 !text-base", children: [
28578
28657
  /* @__PURE__ */ _("span", { children: B.t("login") }),
28579
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
28658
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
28580
28659
  ] })
28581
28660
  ] }),
28582
28661
  /* @__PURE__ */ _(
@@ -28991,7 +29070,7 @@ const ou = (t) => {
28991
29070
  ),
28992
29071
  400
28993
29072
  );
28994
- const g = (p == null ? void 0 : p.authParams.username) === l.authParams.username, b = `auth2|${gc()}`, x = await r.data.users.create(a.tenant.id, {
29073
+ const g = (p == null ? void 0 : p.authParams.username) === l.authParams.username, b = `auth2|${gc()}`, A = await r.data.users.create(a.tenant.id, {
28995
29074
  user_id: b,
28996
29075
  email: l.authParams.username,
28997
29076
  email_verified: g,
@@ -29004,7 +29083,7 @@ const ou = (t) => {
29004
29083
  password: await oo.hash(n.password, 10),
29005
29084
  algorithm: "bcrypt"
29006
29085
  }), !g)
29007
- return await Of(t, x), t.html(
29086
+ return await Of(t, A), t.html(
29008
29087
  /* @__PURE__ */ _(
29009
29088
  yn,
29010
29089
  {
@@ -29290,7 +29369,7 @@ const ou = (t) => {
29290
29369
  /* @__PURE__ */ _("div", { className: "flex flex-1 flex-col justify-center", children: [
29291
29370
  /* @__PURE__ */ _("div", { children: B.t("forgot_password_email_sent") }),
29292
29371
  /* @__PURE__ */ _("div", { className: "my-4 flex space-x-2 text-sm text-[#B2B2B2]", children: [
29293
- /* @__PURE__ */ _(Ge, { className: "text-base", name: "info-bubble" }),
29372
+ /* @__PURE__ */ _(We, { className: "text-base", name: "info-bubble" }),
29294
29373
  /* @__PURE__ */ _("div", { className: "text-sm text-gray-300 md:text-sm", children: B.t("sent_code_spam") })
29295
29374
  ] })
29296
29375
  ] }),
@@ -29802,7 +29881,7 @@ const ou = (t) => {
29802
29881
  a && /* @__PURE__ */ _(Bn, { children: a }),
29803
29882
  /* @__PURE__ */ _(tt, { className: "sm:mt-4 !text-base", children: [
29804
29883
  /* @__PURE__ */ _("span", { children: B.t("continue") }),
29805
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
29884
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
29806
29885
  ] }),
29807
29886
  /* @__PURE__ */ _("div", { className: "my-4 flex space-x-2 text-sm text-[#B2B2B2]", children: [
29808
29887
  /* @__PURE__ */ _("span", { className: "uicon-info-bubble text-base" }),
@@ -29935,7 +30014,7 @@ const ou = (t) => {
29935
30014
  }
29936
30015
  )
29937
30016
  );
29938
- const d = Ar(), p = We();
30017
+ const d = Ar(), p = Ke();
29939
30018
  return await e.data.codes.create(a.tenant.id, {
29940
30019
  code_id: p,
29941
30020
  login_id: "",
@@ -29999,7 +30078,7 @@ const ou = (t) => {
29999
30078
  className: "sm:mt-4 !text-base",
30000
30079
  children: [
30001
30080
  /* @__PURE__ */ _("span", { children: B.t("continue") }),
30002
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
30081
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
30003
30082
  ]
30004
30083
  }
30005
30084
  ) })
@@ -30053,10 +30132,10 @@ const ou = (t) => {
30053
30132
  t && /* @__PURE__ */ _(Bn, { children: t }),
30054
30133
  /* @__PURE__ */ _(tt, { className: "sm:mt-4 !text-base", children: [
30055
30134
  /* @__PURE__ */ _("span", { children: B.t("continue") }),
30056
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
30135
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
30057
30136
  ] }),
30058
30137
  /* @__PURE__ */ _("div", { className: "my-4 flex space-x-2 text-sm text-[#B2B2B2]", children: [
30059
- /* @__PURE__ */ _(Ge, { className: "text-base", name: "info-bubble" }),
30138
+ /* @__PURE__ */ _(We, { className: "text-base", name: "info-bubble" }),
30060
30139
  /* @__PURE__ */ _("div", { className: "text-sm text-gray-300 md:text-sm", children: B.t("sent_code_spam") })
30061
30140
  ] })
30062
30141
  ] }),
@@ -30518,7 +30597,7 @@ const ou = (t) => {
30518
30597
  className: "text-base sm:mt-4 md:text-base",
30519
30598
  children: /* @__PURE__ */ _("div", { className: "flex items-center space-x-2", children: [
30520
30599
  /* @__PURE__ */ _("span", { children: B.t("email_validated_cta") }),
30521
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
30600
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
30522
30601
  ] })
30523
30602
  }
30524
30603
  ) })
@@ -30577,13 +30656,13 @@ const ou = (t) => {
30577
30656
  r.data.users,
30578
30657
  i.tenant.id,
30579
30658
  u
30580
- )).filter((x) => x.provider !== "auth2");
30659
+ )).filter((A) => A.provider !== "auth2");
30581
30660
  if (g.length > 0) {
30582
- const x = g.filter(
30661
+ const A = g.filter(
30583
30662
  (C) => !C.linked_to
30584
30663
  );
30585
- x.length > 1 && console.error("More than one primary user found for email", u), x.length === 0 && console.error("No primary user found for email", u), x.length === 1 && await r.data.users.update(i.tenant.id, d.user_id, {
30586
- linked_to: (b = x[0]) == null ? void 0 : b.user_id
30664
+ A.length > 1 && console.error("More than one primary user found for email", u), A.length === 0 && console.error("No primary user found for email", u), A.length === 1 && await r.data.users.update(i.tenant.id, d.user_id, {
30665
+ linked_to: (b = A[0]) == null ? void 0 : b.user_id
30587
30666
  });
30588
30667
  }
30589
30668
  return t.html(
@@ -30621,7 +30700,7 @@ const ou = (t) => {
30621
30700
  }
30622
30701
  ) }),
30623
30702
  /* @__PURE__ */ _("div", { className: "my-4 flex space-x-2 text-sm text-[#B2B2B2]", children: [
30624
- /* @__PURE__ */ _(Ge, { className: "text-base", name: "info-bubble" }),
30703
+ /* @__PURE__ */ _(We, { className: "text-base", name: "info-bubble" }),
30625
30704
  /* @__PURE__ */ _("div", { className: "text-sm text-gray-300 md:text-sm", children: B.t("sent_code_spam") })
30626
30705
  ] })
30627
30706
  ] }),
@@ -30778,7 +30857,7 @@ const au = ({
30778
30857
  className: "sm:mt-4 !text-base w-full",
30779
30858
  children: [
30780
30859
  /* @__PURE__ */ _("span", { children: u.config.text || "Continue" }),
30781
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
30860
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
30782
30861
  ]
30783
30862
  }
30784
30863
  ),
@@ -30790,13 +30869,13 @@ const au = ({
30790
30869
  disabled: !0,
30791
30870
  children: [
30792
30871
  /* @__PURE__ */ _("span", { children: u.config.text || "Continue" }),
30793
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
30872
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
30794
30873
  ]
30795
30874
  }
30796
30875
  )
30797
30876
  ] }) : /* @__PURE__ */ _(tt, { className: "sm:mt-4 !text-base w-full", children: [
30798
30877
  /* @__PURE__ */ _("span", { children: u.config.text || "Continue" }),
30799
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
30878
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
30800
30879
  ] }) })
30801
30880
  ] })
30802
30881
  ] }) })
@@ -30878,17 +30957,17 @@ const au = ({
30878
30957
  try {
30879
30958
  if (l = await t.env.data.forms.get(a.tenant.id, e), !l) throw new E(404, { message: "Form not found" });
30880
30959
  if (u = (l.nodes || []).find(
30881
- (D) => D.id === n && D.type === "STEP"
30960
+ (O) => O.id === n && O.type === "STEP"
30882
30961
  ), !u)
30883
30962
  throw new E(404, {
30884
30963
  message: "Node not found or not a STEP node"
30885
30964
  });
30886
30965
  d = "components" in u.config ? u.config.components : [];
30887
30966
  const p = await t.req.parseBody(), h = [], g = {};
30888
- for (const D of d)
30889
- if (D.type === "LEGAL") {
30890
- const A = D.id, z = !!D.required, q = p[A];
30891
- z && (!q || q === "") ? h.push(A) : typeof q == "string" && (g[A] = q);
30967
+ for (const O of d)
30968
+ if (O.type === "LEGAL") {
30969
+ const x = O.id, z = !!O.required, q = p[x];
30970
+ z && (!q || q === "") ? h.push(x) : typeof q == "string" && (g[x] = q);
30892
30971
  }
30893
30972
  if (h.length > 0)
30894
30973
  return t.html(
@@ -30912,15 +30991,15 @@ const au = ({
30912
30991
  );
30913
30992
  if (!b || !b.session_id || !b.authParams)
30914
30993
  throw new Error("Session expired");
30915
- const x = await t.env.data.sessions.get(
30994
+ const A = await t.env.data.sessions.get(
30916
30995
  a.tenant.id,
30917
30996
  b.session_id
30918
30997
  );
30919
- if (!x || !x.user_id)
30998
+ if (!A || !A.user_id)
30920
30999
  throw new Error("Session expired");
30921
31000
  const C = await t.env.data.users.get(
30922
31001
  t.var.tenant_id,
30923
- x.user_id
31002
+ A.user_id
30924
31003
  );
30925
31004
  if (!C)
30926
31005
  throw new Error("Session expired");
@@ -30980,13 +31059,13 @@ const lm = (t) => {
30980
31059
  "Continue as ",
30981
31060
  i.email
30982
31061
  ] }),
30983
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
31062
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
30984
31063
  ] })
30985
31064
  }
30986
31065
  ),
30987
31066
  /* @__PURE__ */ _("details", { className: "mb-4", children: [
30988
31067
  /* @__PURE__ */ _("summary", { className: "cursor-pointer text-primary hover:underline mb-4 select-none", children: [
30989
- /* @__PURE__ */ _(Ge, { className: "text-xs inline mr-1", name: "arrow-right" }),
31068
+ /* @__PURE__ */ _(We, { className: "text-xs inline mr-1", name: "arrow-right" }),
30990
31069
  "Advanced Options"
30991
31070
  ] }),
30992
31071
  /* @__PURE__ */ _("div", { className: "mt-4 p-4 border border-gray-200 dark:border-gray-600 rounded-lg bg-gray-50 dark:bg-gray-700", children: /* @__PURE__ */ _(
@@ -31017,7 +31096,7 @@ const lm = (t) => {
31017
31096
  e && /* @__PURE__ */ _(Bn, { children: e }),
31018
31097
  /* @__PURE__ */ _(tt, { variant: "secondary", className: "w-full !text-base", children: [
31019
31098
  /* @__PURE__ */ _("span", { children: "Impersonate User" }),
31020
- /* @__PURE__ */ _(Ge, { className: "text-xs", name: "arrow-right" })
31099
+ /* @__PURE__ */ _(We, { className: "text-xs", name: "arrow-right" })
31021
31100
  ] })
31022
31101
  ]
31023
31102
  }
@@ -31656,15 +31735,15 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
31656
31735
  return f.join(c);
31657
31736
  }, g = function(c, f, y) {
31658
31737
  return c + y + f;
31659
- }, b = Array.prototype.concat, x = 32767;
31738
+ }, b = Array.prototype.concat, A = 32767;
31660
31739
  function C(c) {
31661
- for (var f = [], y = 0; y < c.length; y += x) {
31662
- var $ = c.slice(y, y + x);
31740
+ for (var f = [], y = 0; y < c.length; y += A) {
31741
+ var $ = c.slice(y, y + A);
31663
31742
  f = b.apply(f, $);
31664
31743
  }
31665
31744
  return f;
31666
31745
  }
31667
- function O(c, f) {
31746
+ function D(c, f) {
31668
31747
  for (var y = Object(c), $ = 1; $ < arguments.length; $++) {
31669
31748
  var v = arguments[$];
31670
31749
  if (v != null)
@@ -31673,7 +31752,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
31673
31752
  }
31674
31753
  return y;
31675
31754
  }
31676
- var D = {
31755
+ var O = {
31677
31756
  ELEMENT_NODE: 1,
31678
31757
  ATTRIBUTE_NODE: 2,
31679
31758
  TEXT_NODE: 3,
@@ -31684,13 +31763,13 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
31684
31763
  DOCUMENT_TYPE_NODE: 10,
31685
31764
  DOCUMENT_FRAGMENT_NODE: 11
31686
31765
  };
31687
- A.prototype = new Object(), A.prototype.constructor = A, A.superclass = Object.prototype;
31688
- function A() {
31766
+ x.prototype = new Object(), x.prototype.constructor = x, x.superclass = Object.prototype;
31767
+ function x() {
31689
31768
  this.init();
31690
31769
  }
31691
- A.prototype.init = function() {
31770
+ x.prototype.init = function() {
31692
31771
  this.reduceActions = [], this.reduceActions[3] = function(c) {
31693
- return new Y(c[0], c[2]);
31772
+ return new Z(c[0], c[2]);
31694
31773
  }, this.reduceActions[5] = function(c) {
31695
31774
  return new Se(c[0], c[2]);
31696
31775
  }, this.reduceActions[7] = function(c) {
@@ -31790,7 +31869,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
31790
31869
  }, this.reduceActions[70] = function(c) {
31791
31870
  return new ae.NameTestQName(c[0]);
31792
31871
  };
31793
- }, A.actionTable = [
31872
+ }, x.actionTable = [
31794
31873
  " s s sssssssss s ss s ss",
31795
31874
  " s ",
31796
31875
  "r rrrrrrrrr rrrrrrr rr r ",
@@ -31899,7 +31978,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
31899
31978
  " s s sssssssss s ss s ss",
31900
31979
  "r rrrrrrrrr rrrrrrr rr rr ",
31901
31980
  " r "
31902
- ], A.actionTableNumber = [
31981
+ ], x.actionTableNumber = [
31903
31982
  ` 1 0 /.-,+*)(' & %$ # "!`,
31904
31983
  " J ",
31905
31984
  "a aaaaaaaaa aaaaaaa aa a ",
@@ -32008,7 +32087,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32008
32087
  ` 1 0 /.-,+*)(' & %$ # "!`,
32009
32088
  "] ]]]]]]]]] ]]]]]]] ]] ]] ",
32010
32089
  " G "
32011
- ], A.gotoTable = [
32090
+ ], x.gotoTable = [
32012
32091
  "3456789:;<=>?@ AB CDEFGH IJ ",
32013
32092
  " ",
32014
32093
  " ",
@@ -32117,7 +32196,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32117
32196
  "o456789:;<=>?@ ABŒqCDEFGH IJ ",
32118
32197
  " ",
32119
32198
  " "
32120
- ], A.productions = [
32199
+ ], x.productions = [
32121
32200
  [1, 1, 2],
32122
32201
  [2, 1, 3],
32123
32202
  [3, 1, 4],
@@ -32189,7 +32268,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32189
32268
  [29, 1, -17],
32190
32269
  [29, 1, -19],
32191
32270
  [29, 1, -18]
32192
- ], A.DOUBLEDOT = 2, A.DOUBLECOLON = 3, A.DOUBLESLASH = 4, A.NOTEQUAL = 5, A.LESSTHANOREQUAL = 6, A.GREATERTHANOREQUAL = 7, A.AND = 8, A.OR = 9, A.MOD = 10, A.DIV = 11, A.MULTIPLYOPERATOR = 12, A.FUNCTIONNAME = 13, A.AXISNAME = 14, A.LITERAL = 15, A.NUMBER = 16, A.ASTERISKNAMETEST = 17, A.QNAME = 18, A.NCNAMECOLONASTERISK = 19, A.NODETYPE = 20, A.PROCESSINGINSTRUCTIONWITHLITERAL = 21, A.EQUALS = 22, A.LESSTHAN = 23, A.GREATERTHAN = 24, A.PLUS = 25, A.MINUS = 26, A.BAR = 27, A.SLASH = 28, A.LEFTPARENTHESIS = 29, A.RIGHTPARENTHESIS = 30, A.COMMA = 31, A.AT = 32, A.LEFTBRACKET = 33, A.RIGHTBRACKET = 34, A.DOT = 35, A.DOLLAR = 36, A.prototype.tokenize = function(c) {
32271
+ ], x.DOUBLEDOT = 2, x.DOUBLECOLON = 3, x.DOUBLESLASH = 4, x.NOTEQUAL = 5, x.LESSTHANOREQUAL = 6, x.GREATERTHANOREQUAL = 7, x.AND = 8, x.OR = 9, x.MOD = 10, x.DIV = 11, x.MULTIPLYOPERATOR = 12, x.FUNCTIONNAME = 13, x.AXISNAME = 14, x.LITERAL = 15, x.NUMBER = 16, x.ASTERISKNAMETEST = 17, x.QNAME = 18, x.NCNAMECOLONASTERISK = 19, x.NODETYPE = 20, x.PROCESSINGINSTRUCTIONWITHLITERAL = 21, x.EQUALS = 22, x.LESSTHAN = 23, x.GREATERTHAN = 24, x.PLUS = 25, x.MINUS = 26, x.BAR = 27, x.SLASH = 28, x.LEFTPARENTHESIS = 29, x.RIGHTPARENTHESIS = 30, x.COMMA = 31, x.AT = 32, x.LEFTBRACKET = 33, x.RIGHTBRACKET = 34, x.DOT = 35, x.DOLLAR = 36, x.prototype.tokenize = function(c) {
32193
32272
  for (var f = [], y = [], $ = c + "\0", v = 0, S = $.charAt(v++); ; ) {
32194
32273
  for (; S == " " || S == " " || S == "\r" || S == `
32195
32274
  `; )
@@ -32197,62 +32276,62 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32197
32276
  if (S == "\0" || v >= $.length)
32198
32277
  break;
32199
32278
  if (S == "(") {
32200
- f.push(A.LEFTPARENTHESIS), y.push(S), S = $.charAt(v++);
32279
+ f.push(x.LEFTPARENTHESIS), y.push(S), S = $.charAt(v++);
32201
32280
  continue;
32202
32281
  }
32203
32282
  if (S == ")") {
32204
- f.push(A.RIGHTPARENTHESIS), y.push(S), S = $.charAt(v++);
32283
+ f.push(x.RIGHTPARENTHESIS), y.push(S), S = $.charAt(v++);
32205
32284
  continue;
32206
32285
  }
32207
32286
  if (S == "[") {
32208
- f.push(A.LEFTBRACKET), y.push(S), S = $.charAt(v++);
32287
+ f.push(x.LEFTBRACKET), y.push(S), S = $.charAt(v++);
32209
32288
  continue;
32210
32289
  }
32211
32290
  if (S == "]") {
32212
- f.push(A.RIGHTBRACKET), y.push(S), S = $.charAt(v++);
32291
+ f.push(x.RIGHTBRACKET), y.push(S), S = $.charAt(v++);
32213
32292
  continue;
32214
32293
  }
32215
32294
  if (S == "@") {
32216
- f.push(A.AT), y.push(S), S = $.charAt(v++);
32295
+ f.push(x.AT), y.push(S), S = $.charAt(v++);
32217
32296
  continue;
32218
32297
  }
32219
32298
  if (S == ",") {
32220
- f.push(A.COMMA), y.push(S), S = $.charAt(v++);
32299
+ f.push(x.COMMA), y.push(S), S = $.charAt(v++);
32221
32300
  continue;
32222
32301
  }
32223
32302
  if (S == "|") {
32224
- f.push(A.BAR), y.push(S), S = $.charAt(v++);
32303
+ f.push(x.BAR), y.push(S), S = $.charAt(v++);
32225
32304
  continue;
32226
32305
  }
32227
32306
  if (S == "+") {
32228
- f.push(A.PLUS), y.push(S), S = $.charAt(v++);
32307
+ f.push(x.PLUS), y.push(S), S = $.charAt(v++);
32229
32308
  continue;
32230
32309
  }
32231
32310
  if (S == "-") {
32232
- f.push(A.MINUS), y.push(S), S = $.charAt(v++);
32311
+ f.push(x.MINUS), y.push(S), S = $.charAt(v++);
32233
32312
  continue;
32234
32313
  }
32235
32314
  if (S == "=") {
32236
- f.push(A.EQUALS), y.push(S), S = $.charAt(v++);
32315
+ f.push(x.EQUALS), y.push(S), S = $.charAt(v++);
32237
32316
  continue;
32238
32317
  }
32239
32318
  if (S == "$") {
32240
- f.push(A.DOLLAR), y.push(S), S = $.charAt(v++);
32319
+ f.push(x.DOLLAR), y.push(S), S = $.charAt(v++);
32241
32320
  continue;
32242
32321
  }
32243
32322
  if (S == ".") {
32244
32323
  if (S = $.charAt(v++), S == ".") {
32245
- f.push(A.DOUBLEDOT), y.push(".."), S = $.charAt(v++);
32324
+ f.push(x.DOUBLEDOT), y.push(".."), S = $.charAt(v++);
32246
32325
  continue;
32247
32326
  }
32248
32327
  if (S >= "0" && S <= "9") {
32249
32328
  var X = "." + S;
32250
32329
  for (S = $.charAt(v++); S >= "0" && S <= "9"; )
32251
32330
  X += S, S = $.charAt(v++);
32252
- f.push(A.NUMBER), y.push(X);
32331
+ f.push(x.NUMBER), y.push(X);
32253
32332
  continue;
32254
32333
  }
32255
- f.push(A.DOT), y.push(".");
32334
+ f.push(x.DOT), y.push(".");
32256
32335
  continue;
32257
32336
  }
32258
32337
  if (S == "'" || S == '"') {
@@ -32260,7 +32339,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32260
32339
  Ie += S, v += 1;
32261
32340
  if (S !== ye)
32262
32341
  throw Wt.fromMessage("Unterminated string literal: " + ye + Ie);
32263
- v += 1, f.push(A.LITERAL), y.push(Ie), S = $.charAt(v++);
32342
+ v += 1, f.push(x.LITERAL), y.push(Ie), S = $.charAt(v++);
32264
32343
  continue;
32265
32344
  }
32266
32345
  if (S >= "0" && S <= "9") {
@@ -32270,50 +32349,50 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32270
32349
  if (S == "." && $.charAt(v) >= "0" && $.charAt(v) <= "9")
32271
32350
  for (X += S, X += $.charAt(v++), S = $.charAt(v++); S >= "0" && S <= "9"; )
32272
32351
  X += S, S = $.charAt(v++);
32273
- f.push(A.NUMBER), y.push(X);
32352
+ f.push(x.NUMBER), y.push(X);
32274
32353
  continue;
32275
32354
  }
32276
32355
  if (S == "*") {
32277
32356
  if (f.length > 0) {
32278
32357
  var oe = f[f.length - 1];
32279
- if (oe != A.AT && oe != A.DOUBLECOLON && oe != A.LEFTPARENTHESIS && oe != A.LEFTBRACKET && oe != A.AND && oe != A.OR && oe != A.MOD && oe != A.DIV && oe != A.MULTIPLYOPERATOR && oe != A.SLASH && oe != A.DOUBLESLASH && oe != A.BAR && oe != A.PLUS && oe != A.MINUS && oe != A.EQUALS && oe != A.NOTEQUAL && oe != A.LESSTHAN && oe != A.LESSTHANOREQUAL && oe != A.GREATERTHAN && oe != A.GREATERTHANOREQUAL) {
32280
- f.push(A.MULTIPLYOPERATOR), y.push(S), S = $.charAt(v++);
32358
+ if (oe != x.AT && oe != x.DOUBLECOLON && oe != x.LEFTPARENTHESIS && oe != x.LEFTBRACKET && oe != x.AND && oe != x.OR && oe != x.MOD && oe != x.DIV && oe != x.MULTIPLYOPERATOR && oe != x.SLASH && oe != x.DOUBLESLASH && oe != x.BAR && oe != x.PLUS && oe != x.MINUS && oe != x.EQUALS && oe != x.NOTEQUAL && oe != x.LESSTHAN && oe != x.LESSTHANOREQUAL && oe != x.GREATERTHAN && oe != x.GREATERTHANOREQUAL) {
32359
+ f.push(x.MULTIPLYOPERATOR), y.push(S), S = $.charAt(v++);
32281
32360
  continue;
32282
32361
  }
32283
32362
  }
32284
- f.push(A.ASTERISKNAMETEST), y.push(S), S = $.charAt(v++);
32363
+ f.push(x.ASTERISKNAMETEST), y.push(S), S = $.charAt(v++);
32285
32364
  continue;
32286
32365
  }
32287
32366
  if (S == ":" && $.charAt(v) == ":") {
32288
- f.push(A.DOUBLECOLON), y.push("::"), v++, S = $.charAt(v++);
32367
+ f.push(x.DOUBLECOLON), y.push("::"), v++, S = $.charAt(v++);
32289
32368
  continue;
32290
32369
  }
32291
32370
  if (S == "/") {
32292
32371
  if (S = $.charAt(v++), S == "/") {
32293
- f.push(A.DOUBLESLASH), y.push("//"), S = $.charAt(v++);
32372
+ f.push(x.DOUBLESLASH), y.push("//"), S = $.charAt(v++);
32294
32373
  continue;
32295
32374
  }
32296
- f.push(A.SLASH), y.push("/");
32375
+ f.push(x.SLASH), y.push("/");
32297
32376
  continue;
32298
32377
  }
32299
32378
  if (S == "!" && $.charAt(v) == "=") {
32300
- f.push(A.NOTEQUAL), y.push("!="), v++, S = $.charAt(v++);
32379
+ f.push(x.NOTEQUAL), y.push("!="), v++, S = $.charAt(v++);
32301
32380
  continue;
32302
32381
  }
32303
32382
  if (S == "<") {
32304
32383
  if ($.charAt(v) == "=") {
32305
- f.push(A.LESSTHANOREQUAL), y.push("<="), v++, S = $.charAt(v++);
32384
+ f.push(x.LESSTHANOREQUAL), y.push("<="), v++, S = $.charAt(v++);
32306
32385
  continue;
32307
32386
  }
32308
- f.push(A.LESSTHAN), y.push("<"), S = $.charAt(v++);
32387
+ f.push(x.LESSTHAN), y.push("<"), S = $.charAt(v++);
32309
32388
  continue;
32310
32389
  }
32311
32390
  if (S == ">") {
32312
32391
  if ($.charAt(v) == "=") {
32313
- f.push(A.GREATERTHANOREQUAL), y.push(">="), v++, S = $.charAt(v++);
32392
+ f.push(x.GREATERTHANOREQUAL), y.push(">="), v++, S = $.charAt(v++);
32314
32393
  continue;
32315
32394
  }
32316
- f.push(A.GREATERTHAN), y.push(">"), S = $.charAt(v++);
32395
+ f.push(x.GREATERTHAN), y.push(">"), S = $.charAt(v++);
32317
32396
  continue;
32318
32397
  }
32319
32398
  if (S == "_" || le.isLetter(S.charCodeAt(0))) {
@@ -32322,80 +32401,80 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32322
32401
  ke += S, S = $.charAt(v++);
32323
32402
  if (f.length > 0) {
32324
32403
  var oe = f[f.length - 1];
32325
- if (oe != A.AT && oe != A.DOUBLECOLON && oe != A.LEFTPARENTHESIS && oe != A.LEFTBRACKET && oe != A.AND && oe != A.OR && oe != A.MOD && oe != A.DIV && oe != A.MULTIPLYOPERATOR && oe != A.SLASH && oe != A.DOUBLESLASH && oe != A.BAR && oe != A.PLUS && oe != A.MINUS && oe != A.EQUALS && oe != A.NOTEQUAL && oe != A.LESSTHAN && oe != A.LESSTHANOREQUAL && oe != A.GREATERTHAN && oe != A.GREATERTHANOREQUAL) {
32404
+ if (oe != x.AT && oe != x.DOUBLECOLON && oe != x.LEFTPARENTHESIS && oe != x.LEFTBRACKET && oe != x.AND && oe != x.OR && oe != x.MOD && oe != x.DIV && oe != x.MULTIPLYOPERATOR && oe != x.SLASH && oe != x.DOUBLESLASH && oe != x.BAR && oe != x.PLUS && oe != x.MINUS && oe != x.EQUALS && oe != x.NOTEQUAL && oe != x.LESSTHAN && oe != x.LESSTHANOREQUAL && oe != x.GREATERTHAN && oe != x.GREATERTHANOREQUAL) {
32326
32405
  if (ke == "and") {
32327
- f.push(A.AND), y.push(ke);
32406
+ f.push(x.AND), y.push(ke);
32328
32407
  continue;
32329
32408
  }
32330
32409
  if (ke == "or") {
32331
- f.push(A.OR), y.push(ke);
32410
+ f.push(x.OR), y.push(ke);
32332
32411
  continue;
32333
32412
  }
32334
32413
  if (ke == "mod") {
32335
- f.push(A.MOD), y.push(ke);
32414
+ f.push(x.MOD), y.push(ke);
32336
32415
  continue;
32337
32416
  }
32338
32417
  if (ke == "div") {
32339
- f.push(A.DIV), y.push(ke);
32418
+ f.push(x.DIV), y.push(ke);
32340
32419
  continue;
32341
32420
  }
32342
32421
  }
32343
32422
  }
32344
32423
  if (S == ":") {
32345
32424
  if ($.charAt(v) == "*") {
32346
- f.push(A.NCNAMECOLONASTERISK), y.push(ke + ":*"), v++, S = $.charAt(v++);
32425
+ f.push(x.NCNAMECOLONASTERISK), y.push(ke + ":*"), v++, S = $.charAt(v++);
32347
32426
  continue;
32348
32427
  }
32349
32428
  if ($.charAt(v) == "_" || le.isLetter($.charCodeAt(v))) {
32350
32429
  for (ke += ":", S = $.charAt(v++); le.isNCNameChar(S.charCodeAt(0)); )
32351
32430
  ke += S, S = $.charAt(v++);
32352
32431
  if (S == "(") {
32353
- f.push(A.FUNCTIONNAME), y.push(ke);
32432
+ f.push(x.FUNCTIONNAME), y.push(ke);
32354
32433
  continue;
32355
32434
  }
32356
- f.push(A.QNAME), y.push(ke);
32435
+ f.push(x.QNAME), y.push(ke);
32357
32436
  continue;
32358
32437
  }
32359
32438
  if ($.charAt(v) == ":") {
32360
- f.push(A.AXISNAME), y.push(ke);
32439
+ f.push(x.AXISNAME), y.push(ke);
32361
32440
  continue;
32362
32441
  }
32363
32442
  }
32364
32443
  if (S == "(") {
32365
32444
  if (ke == "comment" || ke == "text" || ke == "node") {
32366
- f.push(A.NODETYPE), y.push(ke);
32445
+ f.push(x.NODETYPE), y.push(ke);
32367
32446
  continue;
32368
32447
  }
32369
32448
  if (ke == "processing-instruction") {
32370
- $.charAt(v) == ")" ? f.push(A.NODETYPE) : f.push(A.PROCESSINGINSTRUCTIONWITHLITERAL), y.push(ke);
32449
+ $.charAt(v) == ")" ? f.push(x.NODETYPE) : f.push(x.PROCESSINGINSTRUCTIONWITHLITERAL), y.push(ke);
32371
32450
  continue;
32372
32451
  }
32373
- f.push(A.FUNCTIONNAME), y.push(ke);
32452
+ f.push(x.FUNCTIONNAME), y.push(ke);
32374
32453
  continue;
32375
32454
  }
32376
- f.push(A.QNAME), y.push(ke);
32455
+ f.push(x.QNAME), y.push(ke);
32377
32456
  continue;
32378
32457
  }
32379
32458
  throw new Error("Unexpected character " + S);
32380
32459
  }
32381
32460
  return f.push(1), y.push("[EOF]"), [f, y];
32382
- }, A.SHIFT = "s", A.REDUCE = "r", A.ACCEPT = "a", A.prototype.parse = function(Ie) {
32461
+ }, x.SHIFT = "s", x.REDUCE = "r", x.ACCEPT = "a", x.prototype.parse = function(Ie) {
32383
32462
  var f, y, $ = this.tokenize(Ie);
32384
32463
  if ($ != null) {
32385
32464
  f = $[0], y = $[1];
32386
32465
  var v = 0, S = [], X = [], ye = [], Ie, oe, ke;
32387
32466
  for (S.push(0), X.push(1), ye.push("_S"), oe = f[v], ke = y[v++]; ; )
32388
- switch (Ie = S[S.length - 1], A.actionTable[Ie].charAt(oe - 1)) {
32389
- case A.SHIFT:
32390
- X.push(-oe), ye.push(ke), S.push(A.actionTableNumber[Ie].charCodeAt(oe - 1) - 32), oe = f[v], ke = y[v++];
32467
+ switch (Ie = S[S.length - 1], x.actionTable[Ie].charAt(oe - 1)) {
32468
+ case x.SHIFT:
32469
+ X.push(-oe), ye.push(ke), S.push(x.actionTableNumber[Ie].charCodeAt(oe - 1) - 32), oe = f[v], ke = y[v++];
32391
32470
  break;
32392
- case A.REDUCE:
32393
- for (var St = A.productions[A.actionTableNumber[Ie].charCodeAt(oe - 1) - 32][1], Ue = [], ur = 0; ur < St; ur++)
32471
+ case x.REDUCE:
32472
+ for (var St = x.productions[x.actionTableNumber[Ie].charCodeAt(oe - 1) - 32][1], Ue = [], ur = 0; ur < St; ur++)
32394
32473
  X.pop(), Ue.unshift(ye.pop()), S.pop();
32395
32474
  var dr = S[S.length - 1];
32396
- X.push(A.productions[A.actionTableNumber[Ie].charCodeAt(oe - 1) - 32][0]), this.reduceActions[A.actionTableNumber[Ie].charCodeAt(oe - 1) - 32] == null ? ye.push(Ue[0]) : ye.push(this.reduceActions[A.actionTableNumber[Ie].charCodeAt(oe - 1) - 32](Ue)), S.push(A.gotoTable[dr].charCodeAt(A.productions[A.actionTableNumber[Ie].charCodeAt(oe - 1) - 32][0] - 2) - 33);
32475
+ X.push(x.productions[x.actionTableNumber[Ie].charCodeAt(oe - 1) - 32][0]), this.reduceActions[x.actionTableNumber[Ie].charCodeAt(oe - 1) - 32] == null ? ye.push(Ue[0]) : ye.push(this.reduceActions[x.actionTableNumber[Ie].charCodeAt(oe - 1) - 32](Ue)), S.push(x.gotoTable[dr].charCodeAt(x.productions[x.actionTableNumber[Ie].charCodeAt(oe - 1) - 32][0] - 2) - 33);
32397
32476
  break;
32398
- case A.ACCEPT:
32477
+ case x.ACCEPT:
32399
32478
  return new z(ye.pop());
32400
32479
  default:
32401
32480
  throw new Error("XPath parse error");
@@ -32437,24 +32516,24 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32437
32516
  return this.rhs.evaluate(c).number().negate();
32438
32517
  }, W.prototype.toString = function() {
32439
32518
  return "-" + this.rhs.toString();
32440
- }, Z.prototype = new M(), Z.prototype.constructor = Z, Z.superclass = M.prototype;
32441
- function Z(c, f) {
32519
+ }, Y.prototype = new M(), Y.prototype.constructor = Y, Y.superclass = M.prototype;
32520
+ function Y(c, f) {
32442
32521
  arguments.length > 0 && this.init(c, f);
32443
32522
  }
32444
- Z.prototype.init = function(c, f) {
32523
+ Y.prototype.init = function(c, f) {
32445
32524
  this.lhs = c, this.rhs = f;
32446
- }, Y.prototype = new Z(), Y.prototype.constructor = Y, Y.superclass = Z.prototype;
32447
- function Y(c, f) {
32525
+ }, Z.prototype = new Y(), Z.prototype.constructor = Z, Z.superclass = Y.prototype;
32526
+ function Z(c, f) {
32448
32527
  arguments.length > 0 && this.init(c, f);
32449
32528
  }
32450
- Y.prototype.init = function(c, f) {
32451
- Y.superclass.init.call(this, c, f);
32452
- }, Y.prototype.toString = function() {
32529
+ Z.prototype.init = function(c, f) {
32530
+ Z.superclass.init.call(this, c, f);
32531
+ }, Z.prototype.toString = function() {
32453
32532
  return "(" + this.lhs.toString() + " or " + this.rhs.toString() + ")";
32454
- }, Y.prototype.evaluate = function(c) {
32533
+ }, Z.prototype.evaluate = function(c) {
32455
32534
  var f = this.lhs.evaluate(c).bool();
32456
32535
  return f.booleanValue() ? f : this.rhs.evaluate(c).bool();
32457
- }, Se.prototype = new Z(), Se.prototype.constructor = Se, Se.superclass = Z.prototype;
32536
+ }, Se.prototype = new Y(), Se.prototype.constructor = Se, Se.superclass = Y.prototype;
32458
32537
  function Se(c, f) {
32459
32538
  arguments.length > 0 && this.init(c, f);
32460
32539
  }
@@ -32465,7 +32544,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32465
32544
  }, Se.prototype.evaluate = function(c) {
32466
32545
  var f = this.lhs.evaluate(c).bool();
32467
32546
  return f.booleanValue() ? this.rhs.evaluate(c).bool() : f;
32468
- }, j.prototype = new Z(), j.prototype.constructor = j, j.superclass = Z.prototype;
32547
+ }, j.prototype = new Y(), j.prototype.constructor = j, j.superclass = Y.prototype;
32469
32548
  function j(c, f) {
32470
32549
  arguments.length > 0 && this.init(c, f);
32471
32550
  }
@@ -32475,7 +32554,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32475
32554
  return "(" + this.lhs.toString() + " = " + this.rhs.toString() + ")";
32476
32555
  }, j.prototype.evaluate = function(c) {
32477
32556
  return this.lhs.evaluate(c).equals(this.rhs.evaluate(c));
32478
- }, F.prototype = new Z(), F.prototype.constructor = F, F.superclass = Z.prototype;
32557
+ }, F.prototype = new Y(), F.prototype.constructor = F, F.superclass = Y.prototype;
32479
32558
  function F(c, f) {
32480
32559
  arguments.length > 0 && this.init(c, f);
32481
32560
  }
@@ -32485,7 +32564,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32485
32564
  return "(" + this.lhs.toString() + " != " + this.rhs.toString() + ")";
32486
32565
  }, F.prototype.evaluate = function(c) {
32487
32566
  return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c));
32488
- }, P.prototype = new Z(), P.prototype.constructor = P, P.superclass = Z.prototype;
32567
+ }, P.prototype = new Y(), P.prototype.constructor = P, P.superclass = Y.prototype;
32489
32568
  function P(c, f) {
32490
32569
  arguments.length > 0 && this.init(c, f);
32491
32570
  }
@@ -32495,7 +32574,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32495
32574
  return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c));
32496
32575
  }, P.prototype.toString = function() {
32497
32576
  return "(" + this.lhs.toString() + " < " + this.rhs.toString() + ")";
32498
- }, N.prototype = new Z(), N.prototype.constructor = N, N.superclass = Z.prototype;
32577
+ }, N.prototype = new Y(), N.prototype.constructor = N, N.superclass = Y.prototype;
32499
32578
  function N(c, f) {
32500
32579
  arguments.length > 0 && this.init(c, f);
32501
32580
  }
@@ -32505,7 +32584,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32505
32584
  return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c));
32506
32585
  }, N.prototype.toString = function() {
32507
32586
  return "(" + this.lhs.toString() + " > " + this.rhs.toString() + ")";
32508
- }, k.prototype = new Z(), k.prototype.constructor = k, k.superclass = Z.prototype;
32587
+ }, k.prototype = new Y(), k.prototype.constructor = k, k.superclass = Y.prototype;
32509
32588
  function k(c, f) {
32510
32589
  arguments.length > 0 && this.init(c, f);
32511
32590
  }
@@ -32515,7 +32594,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32515
32594
  return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c));
32516
32595
  }, k.prototype.toString = function() {
32517
32596
  return "(" + this.lhs.toString() + " <= " + this.rhs.toString() + ")";
32518
- }, L.prototype = new Z(), L.prototype.constructor = L, L.superclass = Z.prototype;
32597
+ }, L.prototype = new Y(), L.prototype.constructor = L, L.superclass = Y.prototype;
32519
32598
  function L(c, f) {
32520
32599
  arguments.length > 0 && this.init(c, f);
32521
32600
  }
@@ -32525,7 +32604,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32525
32604
  return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c));
32526
32605
  }, L.prototype.toString = function() {
32527
32606
  return "(" + this.lhs.toString() + " >= " + this.rhs.toString() + ")";
32528
- }, G.prototype = new Z(), G.prototype.constructor = G, G.superclass = Z.prototype;
32607
+ }, G.prototype = new Y(), G.prototype.constructor = G, G.superclass = Y.prototype;
32529
32608
  function G(c, f) {
32530
32609
  arguments.length > 0 && this.init(c, f);
32531
32610
  }
@@ -32535,7 +32614,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32535
32614
  return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number());
32536
32615
  }, G.prototype.toString = function() {
32537
32616
  return "(" + this.lhs.toString() + " + " + this.rhs.toString() + ")";
32538
- }, pe.prototype = new Z(), pe.prototype.constructor = pe, pe.superclass = Z.prototype;
32617
+ }, pe.prototype = new Y(), pe.prototype.constructor = pe, pe.superclass = Y.prototype;
32539
32618
  function pe(c, f) {
32540
32619
  arguments.length > 0 && this.init(c, f);
32541
32620
  }
@@ -32545,7 +32624,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32545
32624
  return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number());
32546
32625
  }, pe.prototype.toString = function() {
32547
32626
  return "(" + this.lhs.toString() + " - " + this.rhs.toString() + ")";
32548
- }, se.prototype = new Z(), se.prototype.constructor = se, se.superclass = Z.prototype;
32627
+ }, se.prototype = new Y(), se.prototype.constructor = se, se.superclass = Y.prototype;
32549
32628
  function se(c, f) {
32550
32629
  arguments.length > 0 && this.init(c, f);
32551
32630
  }
@@ -32555,7 +32634,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32555
32634
  return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number());
32556
32635
  }, se.prototype.toString = function() {
32557
32636
  return "(" + this.lhs.toString() + " * " + this.rhs.toString() + ")";
32558
- }, $e.prototype = new Z(), $e.prototype.constructor = $e, $e.superclass = Z.prototype;
32637
+ }, $e.prototype = new Y(), $e.prototype.constructor = $e, $e.superclass = Y.prototype;
32559
32638
  function $e(c, f) {
32560
32639
  arguments.length > 0 && this.init(c, f);
32561
32640
  }
@@ -32565,7 +32644,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32565
32644
  return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number());
32566
32645
  }, $e.prototype.toString = function() {
32567
32646
  return "(" + this.lhs.toString() + " div " + this.rhs.toString() + ")";
32568
- }, Ce.prototype = new Z(), Ce.prototype.constructor = Ce, Ce.superclass = Z.prototype;
32647
+ }, Ce.prototype = new Y(), Ce.prototype.constructor = Ce, Ce.superclass = Y.prototype;
32569
32648
  function Ce(c, f) {
32570
32649
  arguments.length > 0 && this.init(c, f);
32571
32650
  }
@@ -32575,7 +32654,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32575
32654
  return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number());
32576
32655
  }, Ce.prototype.toString = function() {
32577
32656
  return "(" + this.lhs.toString() + " mod " + this.rhs.toString() + ")";
32578
- }, ee.prototype = new Z(), ee.prototype.constructor = ee, ee.superclass = Z.prototype;
32657
+ }, ee.prototype = new Y(), ee.prototype.constructor = ee, ee.superclass = Y.prototype;
32579
32658
  function ee(c, f) {
32580
32659
  arguments.length > 0 && this.init(c, f);
32581
32660
  }
@@ -32615,7 +32694,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32615
32694
  );
32616
32695
  }, we.getRoot = function(c, f) {
32617
32696
  var y = f[0];
32618
- if (y.nodeType === D.DOCUMENT_NODE)
32697
+ if (y.nodeType === O.DOCUMENT_NODE)
32619
32698
  return y;
32620
32699
  if (c.virtualRoot)
32621
32700
  return c.virtualRoot;
@@ -32632,11 +32711,11 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32632
32711
  if (f.contextNode === f.virtualRoot)
32633
32712
  break;
32634
32713
  var v;
32635
- for (f.contextNode.nodeType == D.ATTRIBUTE_NODE ? v = we.getOwnerElement(f.contextNode) : v = f.contextNode.parentNode; v != null && (c.nodeTest.matches(v, f) && $.push(v), v !== f.virtualRoot); )
32714
+ for (f.contextNode.nodeType == O.ATTRIBUTE_NODE ? v = we.getOwnerElement(f.contextNode) : v = f.contextNode.parentNode; v != null && (c.nodeTest.matches(v, f) && $.push(v), v !== f.virtualRoot); )
32636
32715
  v = v.parentNode;
32637
32716
  break;
32638
32717
  case te.ANCESTORORSELF:
32639
- for (var v = f.contextNode; v != null && (c.nodeTest.matches(v, f) && $.push(v), v !== f.virtualRoot); v = v.nodeType == D.ATTRIBUTE_NODE ? we.getOwnerElement(v) : v.parentNode)
32718
+ for (var v = f.contextNode; v != null && (c.nodeTest.matches(v, f) && $.push(v), v !== f.virtualRoot); v = v.nodeType == O.ATTRIBUTE_NODE ? we.getOwnerElement(v) : v.parentNode)
32640
32719
  ;
32641
32720
  break;
32642
32721
  case te.ATTRIBUTE:
@@ -32667,7 +32746,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32667
32746
  break;
32668
32747
  var Ue = [];
32669
32748
  f.contextNode.firstChild != null ? Ue.unshift(f.contextNode.firstChild) : Ue.unshift(f.contextNode.nextSibling);
32670
- for (var v = f.contextNode.parentNode; v != null && v.nodeType != D.DOCUMENT_NODE && v !== f.virtualRoot; v = v.parentNode)
32749
+ for (var v = f.contextNode.parentNode; v != null && v.nodeType != O.DOCUMENT_NODE && v !== f.virtualRoot; v = v.parentNode)
32671
32750
  Ue.unshift(v.nextSibling);
32672
32751
  do
32673
32752
  for (var v = Ue.pop(); v != null; )
@@ -32682,9 +32761,9 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32682
32761
  break;
32683
32762
  case te.NAMESPACE:
32684
32763
  var ye = {};
32685
- if (f.contextNode.nodeType == D.ELEMENT_NODE) {
32764
+ if (f.contextNode.nodeType == O.ELEMENT_NODE) {
32686
32765
  ye.xml = z.XML_NAMESPACE_URI, ye.xmlns = z.XMLNS_NAMESPACE_URI;
32687
- for (var v = f.contextNode; v != null && v.nodeType == D.ELEMENT_NODE; v = v.parentNode)
32766
+ for (var v = f.contextNode; v != null && v.nodeType == O.ELEMENT_NODE; v = v.parentNode)
32688
32767
  for (var X = 0; X < v.attributes.length; X++) {
32689
32768
  var Ie = v.attributes.item(X), oe = String(Ie.name);
32690
32769
  if (oe == "xmlns")
@@ -32701,7 +32780,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32701
32780
  }
32702
32781
  break;
32703
32782
  case te.PARENT:
32704
- v = null, f.contextNode !== f.virtualRoot && (f.contextNode.nodeType == D.ATTRIBUTE_NODE ? v = we.getOwnerElement(f.contextNode) : v = f.contextNode.parentNode), v != null && c.nodeTest.matches(v, f) && $.push(v);
32783
+ v = null, f.contextNode !== f.virtualRoot && (f.contextNode.nodeType == O.ATTRIBUTE_NODE ? v = we.getOwnerElement(f.contextNode) : v = f.contextNode.parentNode), v != null && c.nodeTest.matches(v, f) && $.push(v);
32705
32784
  break;
32706
32785
  case te.PRECEDING:
32707
32786
  var Ue;
@@ -32764,7 +32843,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32764
32843
  var $ = c.absolute ? [we.getRoot(f, y)] : y;
32765
32844
  return we.applySteps(c.steps, f, $);
32766
32845
  }, we.prototype.evaluate = function(c) {
32767
- var f = O(new Gt(), c), y = this.applyFilter(c, f);
32846
+ var f = D(new Gt(), c), y = this.applyFilter(c, f);
32768
32847
  if ("nonNodes" in y)
32769
32848
  return y.nonNodes;
32770
32849
  var $ = new ce();
@@ -32793,7 +32872,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32793
32872
  return c.selectSingleNode("..");
32794
32873
  } catch {
32795
32874
  }
32796
- for (var f = c.nodeType == D.DOCUMENT_NODE ? c : c.ownerDocument, y = f.getElementsByTagName("*"), $ = 0; $ < y.length; $++)
32875
+ for (var f = c.nodeType == O.DOCUMENT_NODE ? c : c.ownerDocument, y = f.getElementsByTagName("*"), $ = 0; $ < y.length; $++)
32797
32876
  for (var v = y.item($), S = v.attributes, X = 0; X < S.length; X++) {
32798
32877
  var ye = S.item(X);
32799
32878
  if (ye === c)
@@ -32849,7 +32928,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32849
32928
  }, ae.makeNodeTestType = function(c, f, y) {
32850
32929
  var $ = y || function() {
32851
32930
  };
32852
- return $.prototype = new ae(c), $.prototype.constructor = $, O($.prototype, f), $;
32931
+ return $.prototype = new ae(c), $.prototype.constructor = $, D($.prototype, f), $;
32853
32932
  }, ae.makeNodeTypeTest = function(c, f, y) {
32854
32933
  return new (ae.makeNodeTestType(c, {
32855
32934
  matches: ae.isNodeType(f),
@@ -32887,8 +32966,8 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32887
32966
  matches: function(c, f) {
32888
32967
  return ae.isNodeType(
32889
32968
  [
32890
- D.ELEMENT_NODE,
32891
- D.ATTRIBUTE_NODE,
32969
+ O.ELEMENT_NODE,
32970
+ O.ATTRIBUTE_NODE,
32892
32971
  Bt.XPATH_NAMESPACE_NODE
32893
32972
  ]
32894
32973
  )(c) && ae.nameSpaceMatches(this.prefix, f, c) && ae.localNameMatches(this.localName, f, c);
@@ -32904,7 +32983,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32904
32983
  ), ae.PITest = ae.makeNodeTestType(ae.PI, {
32905
32984
  matches: function(c, f) {
32906
32985
  return ae.isNodeType(
32907
- [D.PROCESSING_INSTRUCTION_NODE]
32986
+ [O.PROCESSING_INSTRUCTION_NODE]
32908
32987
  )(c) && (c.target || c.nodeName) === this.name;
32909
32988
  },
32910
32989
  toString: function() {
@@ -32915,37 +32994,37 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
32915
32994
  }), ae.nameTestAny = ae.makeNodeTypeTest(
32916
32995
  ae.NAMETESTANY,
32917
32996
  [
32918
- D.ELEMENT_NODE,
32919
- D.ATTRIBUTE_NODE,
32997
+ O.ELEMENT_NODE,
32998
+ O.ATTRIBUTE_NODE,
32920
32999
  Bt.XPATH_NAMESPACE_NODE
32921
33000
  ],
32922
33001
  "*"
32923
33002
  ), ae.textTest = ae.makeNodeTypeTest(
32924
33003
  ae.TEXT,
32925
33004
  [
32926
- D.TEXT_NODE,
32927
- D.CDATA_SECTION_NODE
33005
+ O.TEXT_NODE,
33006
+ O.CDATA_SECTION_NODE
32928
33007
  ],
32929
33008
  "text()"
32930
33009
  ), ae.commentTest = ae.makeNodeTypeTest(
32931
33010
  ae.COMMENT,
32932
- [D.COMMENT_NODE],
33011
+ [O.COMMENT_NODE],
32933
33012
  "comment()"
32934
33013
  ), ae.nodeTest = ae.makeNodeTypeTest(
32935
33014
  ae.NODE,
32936
33015
  [
32937
- D.ELEMENT_NODE,
32938
- D.ATTRIBUTE_NODE,
32939
- D.TEXT_NODE,
32940
- D.CDATA_SECTION_NODE,
32941
- D.PROCESSING_INSTRUCTION_NODE,
32942
- D.COMMENT_NODE,
32943
- D.DOCUMENT_NODE
33016
+ O.ELEMENT_NODE,
33017
+ O.ATTRIBUTE_NODE,
33018
+ O.TEXT_NODE,
33019
+ O.CDATA_SECTION_NODE,
33020
+ O.PROCESSING_INSTRUCTION_NODE,
33021
+ O.COMMENT_NODE,
33022
+ O.DOCUMENT_NODE
32944
33023
  ],
32945
33024
  "node()"
32946
33025
  ), ae.anyPiTest = ae.makeNodeTypeTest(
32947
33026
  ae.PI,
32948
- [D.PROCESSING_INSTRUCTION_NODE],
33027
+ [O.PROCESSING_INSTRUCTION_NODE],
32949
33028
  "processing-instruction()"
32950
33029
  ), rt.prototype = new M(), rt.prototype.constructor = rt, rt.superclass = M.prototype;
32951
33030
  function rt(c) {
@@ -33225,7 +33304,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33225
33304
  }, ce.prototype.nodeset = function() {
33226
33305
  return this;
33227
33306
  }, ce.prototype.stringForNode = function(c) {
33228
- return c.nodeType == D.DOCUMENT_NODE || c.nodeType == D.ELEMENT_NODE || c.nodeType === D.DOCUMENT_FRAGMENT_NODE ? this.stringForContainerNode(c) : c.nodeType === D.ATTRIBUTE_NODE ? c.value || c.nodeValue : c.isNamespaceNode ? c.namespace : c.nodeValue;
33307
+ return c.nodeType == O.DOCUMENT_NODE || c.nodeType == O.ELEMENT_NODE || c.nodeType === O.DOCUMENT_FRAGMENT_NODE ? this.stringForContainerNode(c) : c.nodeType === O.ATTRIBUTE_NODE ? c.value || c.nodeValue : c.isNamespaceNode ? c.namespace : c.nodeValue;
33229
33308
  }, ce.prototype.stringForContainerNode = function(c) {
33230
33309
  for (var f = "", y = c.firstChild; y != null; y = y.nextSibling) {
33231
33310
  var $ = y.nodeType;
@@ -33304,7 +33383,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33304
33383
  this.variableResolver = c ?? new bn(), this.namespaceResolver = f ?? new nn(), this.functionResolver = y ?? new Et();
33305
33384
  }
33306
33385
  Gt.prototype.extend = function(c) {
33307
- return O(new Gt(), this, c);
33386
+ return D(new Gt(), this, c);
33308
33387
  }, bn.prototype = new Object(), bn.prototype.constructor = bn, bn.superclass = Object.prototype;
33309
33388
  function bn() {
33310
33389
  }
@@ -33333,7 +33412,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33333
33412
  return z.XML_NAMESPACE_URI;
33334
33413
  if (c == "xmlns")
33335
33414
  return z.XMLNS_NAMESPACE_URI;
33336
- for (f.nodeType == D.DOCUMENT_NODE ? f = f.documentElement : f.nodeType == D.ATTRIBUTE_NODE ? f = we.getOwnerElement(f) : f.nodeType != D.ELEMENT_NODE && (f = f.parentNode); f != null && f.nodeType == D.ELEMENT_NODE; ) {
33415
+ for (f.nodeType == O.DOCUMENT_NODE ? f = f.documentElement : f.nodeType == O.ATTRIBUTE_NODE ? f = we.getOwnerElement(f) : f.nodeType != O.ELEMENT_NODE && (f = f.parentNode); f != null && f.nodeType == O.ELEMENT_NODE; ) {
33337
33416
  for (var y = f.attributes, $ = 0; $ < y.length; $++) {
33338
33417
  var v = y.item($), S = v.name || v.nodeName;
33339
33418
  if (S === "xmlns" && c === "" || S === "xmlns:" + c)
@@ -33362,7 +33441,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33362
33441
  if (arguments.length != 2)
33363
33442
  throw new Error("Function id expects (object)");
33364
33443
  f = arguments[1].evaluate(c), le.instance_of(f, ce) ? f = f.toArray().join(" ") : f = f.stringValue();
33365
- for (var y = f.split(/[\x0d\x0a\x09\x20]+/), $ = new ce(), v = c.contextNode.nodeType == D.DOCUMENT_NODE ? c.contextNode : c.contextNode.ownerDocument, S = 0; S < y.length; S++) {
33444
+ for (var y = f.split(/[\x0d\x0a\x09\x20]+/), $ = new ce(), v = c.contextNode.nodeType == O.DOCUMENT_NODE ? c.contextNode : c.contextNode.ownerDocument, S = 0; S < y.length; S++) {
33366
33445
  var X;
33367
33446
  v.getElementById ? X = v.getElementById(y[S]) : X = le.getElementById(v, y[S]), X != null && $.add(X);
33368
33447
  }
@@ -33400,7 +33479,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33400
33479
  f = arguments[1].evaluate(c).first();
33401
33480
  else
33402
33481
  throw new Error("Function name expects (node-set?)");
33403
- return f == null ? new ge("") : f.nodeType == D.ELEMENT_NODE ? new ge(f.nodeName) : f.nodeType == D.ATTRIBUTE_NODE ? new ge(f.name || f.nodeName) : f.nodeType === D.PROCESSING_INSTRUCTION_NODE ? new ge(f.target || f.nodeName) : f.localName == null ? new ge("") : new ge(f.localName);
33482
+ return f == null ? new ge("") : f.nodeType == O.ELEMENT_NODE ? new ge(f.nodeName) : f.nodeType == O.ATTRIBUTE_NODE ? new ge(f.name || f.nodeName) : f.nodeType === O.PROCESSING_INSTRUCTION_NODE ? new ge(f.target || f.nodeName) : f.localName == null ? new ge("") : new ge(f.localName);
33404
33483
  }, _e.string = function() {
33405
33484
  var c = arguments[0];
33406
33485
  if (arguments.length == 1)
@@ -33508,7 +33587,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33508
33587
  var c = arguments[0];
33509
33588
  if (arguments.length != 2)
33510
33589
  throw new Error("Function lang expects (string)");
33511
- for (var f, y = c.contextNode; y != null && y.nodeType != D.DOCUMENT_NODE; y = y.parentNode) {
33590
+ for (var f, y = c.contextNode; y != null && y.nodeType != O.DOCUMENT_NODE; y = y.parentNode) {
33512
33591
  var $ = y.getAttributeNS(z.XML_NAMESPACE_URI, "lang");
33513
33592
  if ($ != null) {
33514
33593
  f = String($);
@@ -33550,7 +33629,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33550
33629
  };
33551
33630
  var le = new Object();
33552
33631
  le.isAttribute = function(c) {
33553
- return c && (c.nodeType === D.ATTRIBUTE_NODE || c.ownerElement);
33632
+ return c && (c.nodeType === O.ATTRIBUTE_NODE || c.ownerElement);
33554
33633
  }, le.splitQName = function(c) {
33555
33634
  var f = c.indexOf(":");
33556
33635
  return f == -1 ? [null, c] : [c.substring(0, f), c.substring(f + 1)];
@@ -33565,14 +33644,14 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33565
33644
  return c >= 48 && c <= 57 || c >= 1632 && c <= 1641 || c >= 1776 && c <= 1785 || c >= 2406 && c <= 2415 || c >= 2534 && c <= 2543 || c >= 2662 && c <= 2671 || c >= 2790 && c <= 2799 || c >= 2918 && c <= 2927 || c >= 3047 && c <= 3055 || c >= 3174 && c <= 3183 || c >= 3302 && c <= 3311 || c >= 3430 && c <= 3439 || c >= 3664 && c <= 3673 || c >= 3792 && c <= 3801 || c >= 3872 && c <= 3881 || c == 46 || c == 45 || c == 95 || le.isLetter(c) || c >= 768 && c <= 837 || c >= 864 && c <= 865 || c >= 1155 && c <= 1158 || c >= 1425 && c <= 1441 || c >= 1443 && c <= 1465 || c >= 1467 && c <= 1469 || c == 1471 || c >= 1473 && c <= 1474 || c == 1476 || c >= 1611 && c <= 1618 || c == 1648 || c >= 1750 && c <= 1756 || c >= 1757 && c <= 1759 || c >= 1760 && c <= 1764 || c >= 1767 && c <= 1768 || c >= 1770 && c <= 1773 || c >= 2305 && c <= 2307 || c == 2364 || c >= 2366 && c <= 2380 || c == 2381 || c >= 2385 && c <= 2388 || c >= 2402 && c <= 2403 || c >= 2433 && c <= 2435 || c == 2492 || c == 2494 || c == 2495 || c >= 2496 && c <= 2500 || c >= 2503 && c <= 2504 || c >= 2507 && c <= 2509 || c == 2519 || c >= 2530 && c <= 2531 || c == 2562 || c == 2620 || c == 2622 || c == 2623 || c >= 2624 && c <= 2626 || c >= 2631 && c <= 2632 || c >= 2635 && c <= 2637 || c >= 2672 && c <= 2673 || c >= 2689 && c <= 2691 || c == 2748 || c >= 2750 && c <= 2757 || c >= 2759 && c <= 2761 || c >= 2763 && c <= 2765 || c >= 2817 && c <= 2819 || c == 2876 || c >= 2878 && c <= 2883 || c >= 2887 && c <= 2888 || c >= 2891 && c <= 2893 || c >= 2902 && c <= 2903 || c >= 2946 && c <= 2947 || c >= 3006 && c <= 3010 || c >= 3014 && c <= 3016 || c >= 3018 && c <= 3021 || c == 3031 || c >= 3073 && c <= 3075 || c >= 3134 && c <= 3140 || c >= 3142 && c <= 3144 || c >= 3146 && c <= 3149 || c >= 3157 && c <= 3158 || c >= 3202 && c <= 3203 || c >= 3262 && c <= 3268 || c >= 3270 && c <= 3272 || c >= 3274 && c <= 3277 || c >= 3285 && c <= 3286 || c >= 3330 && c <= 3331 || c >= 3390 && c <= 3395 || c >= 3398 && c <= 3400 || c >= 3402 && c <= 3405 || c == 3415 || c == 3633 || c >= 3636 && c <= 3642 || c >= 3655 && c <= 3662 || c == 3761 || c >= 3764 && c <= 3769 || c >= 3771 && c <= 3772 || c >= 3784 && c <= 3789 || c >= 3864 && c <= 3865 || c == 3893 || c == 3895 || c == 3897 || c == 3902 || c == 3903 || c >= 3953 && c <= 3972 || c >= 3974 && c <= 3979 || c >= 3984 && c <= 3989 || c == 3991 || c >= 3993 && c <= 4013 || c >= 4017 && c <= 4023 || c == 4025 || c >= 8400 && c <= 8412 || c == 8417 || c >= 12330 && c <= 12335 || c == 12441 || c == 12442 || c == 183 || c == 720 || c == 721 || c == 903 || c == 1600 || c == 3654 || c == 3782 || c == 12293 || c >= 12337 && c <= 12341 || c >= 12445 && c <= 12446 || c >= 12540 && c <= 12542;
33566
33645
  }, le.coalesceText = function(c) {
33567
33646
  for (var f = c.firstChild; f != null; f = f.nextSibling)
33568
- if (f.nodeType == D.TEXT_NODE || f.nodeType == D.CDATA_SECTION_NODE) {
33647
+ if (f.nodeType == O.TEXT_NODE || f.nodeType == O.CDATA_SECTION_NODE) {
33569
33648
  var y = f.nodeValue, $ = f;
33570
- for (f = f.nextSibling; f != null && (f.nodeType == D.TEXT_NODE || f.nodeType == D.CDATA_SECTION_NODE); ) {
33649
+ for (f = f.nextSibling; f != null && (f.nodeType == O.TEXT_NODE || f.nodeType == O.CDATA_SECTION_NODE); ) {
33571
33650
  y += f.nodeValue;
33572
33651
  var v = f;
33573
33652
  f = f.nextSibling, v.parentNode.removeChild(v);
33574
33653
  }
33575
- if ($.nodeType == D.CDATA_SECTION_NODE) {
33654
+ if ($.nodeType == O.CDATA_SECTION_NODE) {
33576
33655
  var S = $.parentNode;
33577
33656
  if ($.nextSibling == null)
33578
33657
  S.removeChild($), S.appendChild(S.ownerDocument.createTextNode(y));
@@ -33584,7 +33663,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33584
33663
  $.nodeValue = y;
33585
33664
  if (f == null)
33586
33665
  break;
33587
- } else f.nodeType == D.ELEMENT_NODE && le.coalesceText(f);
33666
+ } else f.nodeType == O.ELEMENT_NODE && le.coalesceText(f);
33588
33667
  }, le.instance_of = function(c, f) {
33589
33668
  for (; c != null; ) {
33590
33669
  if (c.constructor === f)
@@ -33595,7 +33674,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33595
33674
  }
33596
33675
  return !1;
33597
33676
  }, le.getElementById = function(c, f) {
33598
- if (c.nodeType == D.ELEMENT_NODE && (c.getAttribute("id") == f || c.getAttributeNS(null, "id") == f))
33677
+ if (c.nodeType == O.ELEMENT_NODE && (c.getAttribute("id") == f || c.getAttributeNS(null, "id") == f))
33599
33678
  return c;
33600
33679
  for (var y = c.firstChild; y != null; y = y.nextSibling) {
33601
33680
  var $ = le.getElementById(y, f);
@@ -33630,7 +33709,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33630
33709
  this.xpath = y.parse(c), this.context = new Gt(), this.context.namespaceResolver = new $n(f);
33631
33710
  }
33632
33711
  Lt.getOwnerDocument = function(c) {
33633
- return c.nodeType === D.DOCUMENT_NODE ? c : c.ownerDocument;
33712
+ return c.nodeType === O.DOCUMENT_NODE ? c : c.ownerDocument;
33634
33713
  }, Lt.detectHtmlDom = function(c) {
33635
33714
  if (!c)
33636
33715
  return !1;
@@ -33724,11 +33803,11 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33724
33803
  document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("XPath", null) && (ne = !1);
33725
33804
  } catch {
33726
33805
  }
33727
- ne && V(document, new A());
33806
+ ne && V(document, new x());
33728
33807
  } catch {
33729
33808
  }
33730
- V(n, new A()), function() {
33731
- var c = new A(), f = new nn(), y = new Et(), $ = new bn();
33809
+ V(n, new x()), function() {
33810
+ var c = new x(), f = new nn(), y = new Et(), $ = new bn();
33732
33811
  function v(Q) {
33733
33812
  return {
33734
33813
  getNamespace: function(Oe, kt) {
@@ -33853,17 +33932,17 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33853
33932
  });
33854
33933
  }
33855
33934
  n.parse = jy;
33856
- }(), O(
33935
+ }(), D(
33857
33936
  n,
33858
33937
  {
33859
33938
  XPath: z,
33860
- XPathParser: A,
33939
+ XPathParser: x,
33861
33940
  XPathResult: I,
33862
33941
  Step: te,
33863
33942
  PathExpr: we,
33864
33943
  NodeTest: ae,
33865
33944
  LocationPath: tn,
33866
- OrOperation: Y,
33945
+ OrOperation: Z,
33867
33946
  AndOperation: Se,
33868
33947
  BarOperation: ee,
33869
33948
  EqualsOperation: j,
@@ -33903,7 +33982,7 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33903
33982
  return n.selectWithResolver(y, $, f, v);
33904
33983
  };
33905
33984
  }, n.selectWithResolver = function(c, f, y, $) {
33906
- var v = new Lt(c, y, new A()), S = I.ANY_TYPE, X = v.evaluate(f, S, null);
33985
+ var v = new Lt(c, y, new x()), S = I.ANY_TYPE, X = v.evaluate(f, S, null);
33907
33986
  return X.resultType == I.STRING_TYPE ? X = X.stringValue : X.resultType == I.NUMBER_TYPE ? X = X.numberValue : X.resultType == I.BOOLEAN_TYPE ? X = X.booleanValue : (X = X.nodes, $ && (X = X[0])), X;
33908
33987
  }, n.select1 = function(c, f) {
33909
33988
  return n.select(c, f, !0);
@@ -33917,20 +33996,20 @@ var N6 = {}, ri = {}, Do = {}, bl = {};
33917
33996
  return ve(f) && f.nodeType === c;
33918
33997
  };
33919
33998
  };
33920
- O(
33999
+ D(
33921
34000
  n,
33922
34001
  {
33923
34002
  isNodeLike: ve,
33924
34003
  isArrayOfNodes: it,
33925
- isElement: Be(D.ELEMENT_NODE),
33926
- isAttribute: Be(D.ATTRIBUTE_NODE),
33927
- isTextNode: Be(D.TEXT_NODE),
33928
- isCDATASection: Be(D.CDATA_SECTION_NODE),
33929
- isProcessingInstruction: Be(D.PROCESSING_INSTRUCTION_NODE),
33930
- isComment: Be(D.COMMENT_NODE),
33931
- isDocumentNode: Be(D.DOCUMENT_NODE),
33932
- isDocumentTypeNode: Be(D.DOCUMENT_TYPE_NODE),
33933
- isDocumentFragment: Be(D.DOCUMENT_FRAGMENT_NODE)
34004
+ isElement: Be(O.ELEMENT_NODE),
34005
+ isAttribute: Be(O.ATTRIBUTE_NODE),
34006
+ isTextNode: Be(O.TEXT_NODE),
34007
+ isCDATASection: Be(O.CDATA_SECTION_NODE),
34008
+ isProcessingInstruction: Be(O.PROCESSING_INSTRUCTION_NODE),
34009
+ isComment: Be(O.COMMENT_NODE),
34010
+ isDocumentNode: Be(O.DOCUMENT_NODE),
34011
+ isDocumentTypeNode: Be(O.DOCUMENT_TYPE_NODE),
34012
+ isDocumentFragment: Be(O.DOCUMENT_FRAGMENT_NODE)
33934
34013
  }
33935
34014
  );
33936
34015
  })(e);
@@ -34016,25 +34095,25 @@ Ae.assertIsDocumentFragmentNode = W6;
34016
34095
  function i(M, K, W) {
34017
34096
  return M.localName === K && (M.namespaceURI === W || W == null);
34018
34097
  }
34019
- function s(M, K, W, Z) {
34020
- return M.localName === K && (!M.namespaceURI && (Z == null ? void 0 : Z.namespaceURI) === W || W == null);
34098
+ function s(M, K, W, Y) {
34099
+ return M.localName === K && (!M.namespaceURI && (Y == null ? void 0 : Y.namespaceURI) === W || W == null);
34021
34100
  }
34022
34101
  function a(M, K, W) {
34023
- for (let Z = 0; Z < M.attributes.length; Z++) {
34024
- const Y = M.attributes[Z];
34025
- if (i(Y, K, W) || s(Y, K, W, M))
34026
- return Y;
34102
+ for (let Y = 0; Y < M.attributes.length; Y++) {
34103
+ const Z = M.attributes[Y];
34104
+ if (i(Z, K, W) || s(Z, K, W, M))
34105
+ return Z;
34027
34106
  }
34028
34107
  return null;
34029
34108
  }
34030
34109
  t.findAttr = a;
34031
34110
  function l(M, K, W) {
34032
- const Z = M.documentElement ?? M, Y = [];
34033
- for (let Se = 0; Se < Z.childNodes.length; Se++) {
34034
- const j = Z.childNodes[Se];
34035
- n.isElementNode(j) && j.localName === K && (j.namespaceURI === W || W == null) && Y.push(j);
34111
+ const Y = M.documentElement ?? M, Z = [];
34112
+ for (let Se = 0; Se < Y.childNodes.length; Se++) {
34113
+ const j = Y.childNodes[Se];
34114
+ n.isElementNode(j) && j.localName === K && (j.namespaceURI === W || W == null) && Z.push(j);
34036
34115
  }
34037
- return Y;
34116
+ return Z;
34038
34117
  }
34039
34118
  t.findChildren = l;
34040
34119
  function u(M, K, W) {
@@ -34073,12 +34152,12 @@ Ae.assertIsDocumentFragmentNode = W6;
34073
34152
  `;
34074
34153
  }
34075
34154
  t.normalizePem = b;
34076
- function x(M) {
34155
+ function A(M) {
34077
34156
  if (!t.PEM_FORMAT_REGEX.test(M.trim()))
34078
34157
  throw new Error("Invalid PEM format.");
34079
34158
  return Buffer.from(M.replace(/(\r\n|\r)/g, "").replace(/-----BEGIN [A-Z\x20]{1,48}-----\n?/, "").replace(/-----END [A-Z\x20]{1,48}-----\n?/, ""), "base64");
34080
34159
  }
34081
- t.pemToDer = x;
34160
+ t.pemToDer = A;
34082
34161
  function C(M, K) {
34083
34162
  const W = Buffer.isBuffer(M) ? M.toString("base64").trim() : M.replace(/(\r\n|\r)/g, "").trim();
34084
34163
  if (t.PEM_FORMAT_REGEX.test(W))
@@ -34086,74 +34165,74 @@ Ae.assertIsDocumentFragmentNode = W6;
34086
34165
  if (t.BASE64_REGEX.test(W.replace(/ /g, ""))) {
34087
34166
  if (K == null)
34088
34167
  throw new Error("PEM label is required when DER is given.");
34089
- const Z = `-----BEGIN ${K}-----
34168
+ const Y = `-----BEGIN ${K}-----
34090
34169
  ${W.replace(/ /g, "")}
34091
34170
  -----END ${K}-----`;
34092
- return b(Z);
34171
+ return b(Y);
34093
34172
  }
34094
34173
  throw new Error("Unknown DER format.");
34095
34174
  }
34096
34175
  t.derToPem = C;
34097
- function O(M, K = []) {
34176
+ function D(M, K = []) {
34098
34177
  if (!n.isElementNode(M.parentNode))
34099
34178
  return K;
34100
34179
  const W = M.parentNode;
34101
34180
  if (!W)
34102
34181
  return K;
34103
34182
  if (W.attributes && W.attributes.length > 0)
34104
- for (let Z = 0; Z < W.attributes.length; Z++) {
34105
- const Y = W.attributes[Z];
34106
- Y && Y.nodeName && Y.nodeName.search(/^xmlns:?/) !== -1 && K.push({
34107
- prefix: Y.nodeName.replace(/^xmlns:?/, ""),
34108
- namespaceURI: Y.nodeValue || ""
34183
+ for (let Y = 0; Y < W.attributes.length; Y++) {
34184
+ const Z = W.attributes[Y];
34185
+ Z && Z.nodeName && Z.nodeName.search(/^xmlns:?/) !== -1 && K.push({
34186
+ prefix: Z.nodeName.replace(/^xmlns:?/, ""),
34187
+ namespaceURI: Z.nodeValue || ""
34109
34188
  });
34110
34189
  }
34111
- return O(W, K);
34190
+ return D(W, K);
34112
34191
  }
34113
- function D(M) {
34192
+ function O(M) {
34114
34193
  const K = M.attributes;
34115
34194
  for (let W = 0; W < K.length; W++) {
34116
- const Z = K[W].nodeName;
34117
- if (Z.search(/^xmlns:?/) !== -1)
34118
- return Z.replace(/^xmlns:?/, "");
34195
+ const Y = K[W].nodeName;
34196
+ if (Y.search(/^xmlns:?/) !== -1)
34197
+ return Y.replace(/^xmlns:?/, "");
34119
34198
  }
34120
34199
  return M.prefix || "";
34121
34200
  }
34122
- function A(M) {
34201
+ function x(M) {
34123
34202
  return M.every((K) => n.isElementNode(K));
34124
34203
  }
34125
34204
  function z(M, K, W) {
34126
34205
  if (K == null)
34127
34206
  return [];
34128
- const Z = e.selectWithResolver(K, M, W);
34129
- if (!r(Z))
34207
+ const Y = e.selectWithResolver(K, M, W);
34208
+ if (!r(Y))
34130
34209
  return [];
34131
- if (!A(Z))
34210
+ if (!x(Y))
34132
34211
  throw new Error("Document subset must be list of elements");
34133
- const Y = O(Z[0]), Se = [];
34134
- for (let P = 0; P < Y.length; P++) {
34212
+ const Z = D(Y[0]), Se = [];
34213
+ for (let P = 0; P < Z.length; P++) {
34135
34214
  let N = !0;
34136
34215
  for (const k in Se)
34137
- if (Se[k].prefix === Y[P].prefix) {
34216
+ if (Se[k].prefix === Z[P].prefix) {
34138
34217
  N = !1;
34139
34218
  break;
34140
34219
  }
34141
- N && Se.push(Y[P]);
34220
+ N && Se.push(Z[P]);
34142
34221
  }
34143
- const j = [], F = D(Z[0]);
34222
+ const j = [], F = O(Y[0]);
34144
34223
  for (const P of Se)
34145
34224
  P.prefix !== F && j.push(P);
34146
34225
  return j;
34147
34226
  }
34148
34227
  t.findAncestorNs = z;
34149
34228
  function q(M, K) {
34150
- const W = Buffer.from(M, "base64"), Z = Buffer.from(K, "base64");
34229
+ const W = Buffer.from(M, "base64"), Y = Buffer.from(K, "base64");
34151
34230
  if (typeof W.equals == "function")
34152
- return W.equals(Z);
34153
- if (W.length !== Z.length)
34231
+ return W.equals(Y);
34232
+ if (W.length !== Y.length)
34154
34233
  return !1;
34155
- for (let Y = 0; Y < W.length; Y++)
34156
- if (W[Y] !== Z[Y])
34234
+ for (let Z = 0; Z < W.length; Z++)
34235
+ if (W[Z] !== Y[Z])
34157
34236
  return !1;
34158
34237
  return !0;
34159
34238
  }
@@ -34212,8 +34291,8 @@ class Q1 {
34212
34291
  if (Jo.isArrayHasLength(s))
34213
34292
  for (const g of s) {
34214
34293
  let b = !1;
34215
- for (const x of p)
34216
- x.prefix === g.prefix && x.namespaceURI === g.namespaceURI && (b = !0);
34294
+ for (const A of p)
34295
+ A.prefix === g.prefix && A.namespaceURI === g.namespaceURI && (b = !0);
34217
34296
  b || p.push(g);
34218
34297
  }
34219
34298
  return p.sort(this.nsCompare), u.push(...p.map((g) => g.prefix ? ` xmlns:${g.prefix}="${g.namespaceURI}"` : ` xmlns="${g.namespaceURI}"`)), { rendered: u.join(""), newDefaultNs: d };
@@ -35391,7 +35470,7 @@ function Si(t, e, n, r, i) {
35391
35470
  return;
35392
35471
  switch (t.nodeType) {
35393
35472
  case hn:
35394
- var s = t.attributes, a = s.length, D = t.firstChild, l = t.tagName;
35473
+ var s = t.attributes, a = s.length, O = t.firstChild, l = t.tagName;
35395
35474
  n = no.isHTML(t.namespaceURI) || n;
35396
35475
  var u = l;
35397
35476
  if (!n && !t.prefix && t.namespaceURI) {
@@ -35419,36 +35498,36 @@ function Si(t, e, n, r, i) {
35419
35498
  }
35420
35499
  e.push("<", u);
35421
35500
  for (var b = 0; b < a; b++) {
35422
- var x = s.item(b);
35423
- x.prefix == "xmlns" ? i.push({ prefix: x.localName, namespace: x.value }) : x.nodeName == "xmlns" && i.push({ prefix: "", namespace: x.value });
35501
+ var A = s.item(b);
35502
+ A.prefix == "xmlns" ? i.push({ prefix: A.localName, namespace: A.value }) : A.nodeName == "xmlns" && i.push({ prefix: "", namespace: A.value });
35424
35503
  }
35425
35504
  for (var b = 0; b < a; b++) {
35426
- var x = s.item(b);
35427
- if (_m(x, n, i)) {
35428
- var C = x.prefix || "", O = x.namespaceURI;
35429
- du(e, C ? "xmlns:" + C : "xmlns", O), i.push({ prefix: C, namespace: O });
35505
+ var A = s.item(b);
35506
+ if (_m(A, n, i)) {
35507
+ var C = A.prefix || "", D = A.namespaceURI;
35508
+ du(e, C ? "xmlns:" + C : "xmlns", D), i.push({ prefix: C, namespace: D });
35430
35509
  }
35431
- Si(x, e, n, r, i);
35510
+ Si(A, e, n, r, i);
35432
35511
  }
35433
35512
  if (l === u && _m(t, n, i)) {
35434
- var C = t.prefix || "", O = t.namespaceURI;
35435
- du(e, C ? "xmlns:" + C : "xmlns", O), i.push({ prefix: C, namespace: O });
35513
+ var C = t.prefix || "", D = t.namespaceURI;
35514
+ du(e, C ? "xmlns:" + C : "xmlns", D), i.push({ prefix: C, namespace: D });
35436
35515
  }
35437
- if (D || n && !/^(?:meta|link|img|br|hr|input)$/i.test(l)) {
35516
+ if (O || n && !/^(?:meta|link|img|br|hr|input)$/i.test(l)) {
35438
35517
  if (e.push(">"), n && /^script$/i.test(l))
35439
- for (; D; )
35440
- D.data ? e.push(D.data) : Si(D, e, n, r, i.slice()), D = D.nextSibling;
35518
+ for (; O; )
35519
+ O.data ? e.push(O.data) : Si(O, e, n, r, i.slice()), O = O.nextSibling;
35441
35520
  else
35442
- for (; D; )
35443
- Si(D, e, n, r, i.slice()), D = D.nextSibling;
35521
+ for (; O; )
35522
+ Si(O, e, n, r, i.slice()), O = O.nextSibling;
35444
35523
  e.push("</", u, ">");
35445
35524
  } else
35446
35525
  e.push("/>");
35447
35526
  return;
35448
35527
  case cy:
35449
35528
  case tr:
35450
- for (var D = t.firstChild; D; )
35451
- Si(D, e, n, r, i.slice()), D = D.nextSibling;
35529
+ for (var O = t.firstChild; O; )
35530
+ Si(O, e, n, r, i.slice()), O = O.nextSibling;
35452
35531
  return;
35453
35532
  case Ki:
35454
35533
  return du(e, t.name, t.value);
@@ -35461,9 +35540,9 @@ function Si(t, e, n, r, i) {
35461
35540
  case ay:
35462
35541
  return e.push("<!--", t.data, "-->");
35463
35542
  case ly:
35464
- var A = t.publicId, z = t.systemId;
35465
- if (e.push("<!DOCTYPE ", t.name), A)
35466
- e.push(" PUBLIC ", A), z && z != "." && e.push(" ", z), e.push(">");
35543
+ var x = t.publicId, z = t.systemId;
35544
+ if (e.push("<!DOCTYPE ", t.name), x)
35545
+ e.push(" PUBLIC ", x), z && z != "." && e.push(" ", z), e.push(">");
35467
35546
  else if (z && z != ".")
35468
35547
  e.push(" SYSTEM ", z, ">");
35469
35548
  else {
@@ -37749,62 +37828,62 @@ function dS(t, e, n, r, i) {
37749
37828
  d = G.index, p = d + G[0].length, g.lineNumber++;
37750
37829
  g.columnNumber = L - d + 1;
37751
37830
  }
37752
- for (var d = 0, p = 0, h = /.*(?:\r\n?|\n)|.*$/g, g = r.locator, b = [{ currentNSMap: e }], x = {}, C = 0; ; ) {
37831
+ for (var d = 0, p = 0, h = /.*(?:\r\n?|\n)|.*$/g, g = r.locator, b = [{ currentNSMap: e }], A = {}, C = 0; ; ) {
37753
37832
  try {
37754
- var O = t.indexOf("<", C);
37755
- if (O < 0) {
37833
+ var D = t.indexOf("<", C);
37834
+ if (D < 0) {
37756
37835
  if (!t.substr(C).match(/^\s*$/)) {
37757
- var D = r.doc, A = D.createTextNode(t.substr(C));
37758
- D.appendChild(A), r.currentElement = A;
37836
+ var O = r.doc, x = O.createTextNode(t.substr(C));
37837
+ O.appendChild(x), r.currentElement = x;
37759
37838
  }
37760
37839
  return;
37761
37840
  }
37762
- switch (O > C && l(O), t.charAt(O + 1)) {
37841
+ switch (D > C && l(D), t.charAt(D + 1)) {
37763
37842
  case "/":
37764
- var j = t.indexOf(">", O + 3), z = t.substring(O + 2, j).replace(/[ \t\n\r]+$/g, ""), q = b.pop();
37765
- j < 0 ? (z = t.substring(O + 2).replace(/[\s<].*/, ""), i.error("end tag name: " + z + " is not complete:" + q.tagName), j = O + 1 + z.length) : z.match(/\s</) && (z = z.replace(/[\s<].*/, ""), i.error("end tag name: " + z + " maybe not complete"), j = O + 1 + z.length);
37843
+ var j = t.indexOf(">", D + 3), z = t.substring(D + 2, j).replace(/[ \t\n\r]+$/g, ""), q = b.pop();
37844
+ j < 0 ? (z = t.substring(D + 2).replace(/[\s<].*/, ""), i.error("end tag name: " + z + " is not complete:" + q.tagName), j = D + 1 + z.length) : z.match(/\s</) && (z = z.replace(/[\s<].*/, ""), i.error("end tag name: " + z + " maybe not complete"), j = D + 1 + z.length);
37766
37845
  var M = q.localNSMap, K = q.tagName == z, W = K || q.tagName && q.tagName.toLowerCase() == z.toLowerCase();
37767
37846
  if (W) {
37768
37847
  if (r.endElement(q.uri, q.localName, z), M)
37769
- for (var Z in M)
37770
- Object.prototype.hasOwnProperty.call(M, Z) && r.endPrefixMapping(Z);
37848
+ for (var Y in M)
37849
+ Object.prototype.hasOwnProperty.call(M, Y) && r.endPrefixMapping(Y);
37771
37850
  K || i.fatalError("end tag name: " + z + " is not match the current start tagName:" + q.tagName);
37772
37851
  } else
37773
37852
  b.push(q);
37774
37853
  j++;
37775
37854
  break;
37776
37855
  case "?":
37777
- g && u(O), j = mS(t, O, r);
37856
+ g && u(D), j = mS(t, D, r);
37778
37857
  break;
37779
37858
  case "!":
37780
- g && u(O), j = gS(t, O, r, i);
37859
+ g && u(D), j = gS(t, D, r, i);
37781
37860
  break;
37782
37861
  default:
37783
- g && u(O);
37784
- var Y = new Sy(), Se = b[b.length - 1].currentNSMap, j = pS(t, O, Y, Se, a, i), F = Y.length;
37785
- if (!Y.closed && hS(t, j, Y.tagName, x) && (Y.closed = !0, n.nbsp || i.warning("unclosed xml attribute")), g && F) {
37862
+ g && u(D);
37863
+ var Z = new Sy(), Se = b[b.length - 1].currentNSMap, j = pS(t, D, Z, Se, a, i), F = Z.length;
37864
+ if (!Z.closed && hS(t, j, Z.tagName, A) && (Z.closed = !0, n.nbsp || i.warning("unclosed xml attribute")), g && F) {
37786
37865
  for (var P = vm(g, {}), N = 0; N < F; N++) {
37787
- var k = Y[N];
37866
+ var k = Z[N];
37788
37867
  u(k.offset), k.locator = vm(g, {});
37789
37868
  }
37790
- r.locator = P, bm(Y, r, Se) && b.push(Y), r.locator = g;
37869
+ r.locator = P, bm(Z, r, Se) && b.push(Z), r.locator = g;
37791
37870
  } else
37792
- bm(Y, r, Se) && b.push(Y);
37793
- io.isHTML(Y.uri) && !Y.closed ? j = fS(t, j, Y.tagName, a, r) : j++;
37871
+ bm(Z, r, Se) && b.push(Z);
37872
+ io.isHTML(Z.uri) && !Z.closed ? j = fS(t, j, Z.tagName, a, r) : j++;
37794
37873
  }
37795
37874
  } catch (L) {
37796
37875
  if (L instanceof Wi)
37797
37876
  throw L;
37798
37877
  i.error("element parse error: " + L), j = -1;
37799
37878
  }
37800
- j > C ? C = j : l(Math.max(O, C) + 1);
37879
+ j > C ? C = j : l(Math.max(D, C) + 1);
37801
37880
  }
37802
37881
  }
37803
37882
  function vm(t, e) {
37804
37883
  return e.lineNumber = t.lineNumber, e.columnNumber = t.columnNumber, e;
37805
37884
  }
37806
37885
  function pS(t, e, n, r, i, s) {
37807
- function a(g, b, x) {
37886
+ function a(g, b, A) {
37808
37887
  n.attributeNames.hasOwnProperty(g) && s.fatalError("Attribute " + g + " redefined"), n.addValue(
37809
37888
  g,
37810
37889
  // @see https://www.w3.org/TR/xml/#AVNormalize
@@ -37812,7 +37891,7 @@ function pS(t, e, n, r, i, s) {
37812
37891
  // - recursive replacement of (DTD) entity references
37813
37892
  // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA
37814
37893
  b.replace(/[\t\n\r]/g, " ").replace(/&#?\w+;/g, i),
37815
- x
37894
+ A
37816
37895
  );
37817
37896
  }
37818
37897
  for (var l, u, d = ++e, p = _s; ; ) {
@@ -38622,8 +38701,8 @@ class Vn {
38622
38701
  if (n = Re.findChildren(e, "Transforms"), n.length !== 0) {
38623
38702
  const p = n[0], h = Re.findChildren(p, "Transform");
38624
38703
  for (const b of h) {
38625
- const x = Re.findAttr(b, "Algorithm");
38626
- x && l.push(x.value);
38704
+ const A = Re.findAttr(b, "Algorithm");
38705
+ A && l.push(A.value);
38627
38706
  }
38628
38707
  const g = Re.findChildren(h[h.length - 1], "InclusiveNamespaces");
38629
38708
  Re.isArrayHasLength(g) && (u = g.flatMap((b) => (b.getAttribute("PrefixList") ?? "").split(" ")).filter((b) => b.length > 0));
@@ -38702,13 +38781,13 @@ class Vn {
38702
38781
  p ? (a += `:${p}`, u = `${p}:`) : u = "", Object.keys(h).forEach(function(K) {
38703
38782
  K !== "xmlns" && K !== a && l.push(`${K}="${h[K]}"`);
38704
38783
  }), l.push(`${a}="http://www.w3.org/2000/09/xmldsig#"`);
38705
- let x = `<${u}Signature ${l.join(" ")}>`;
38706
- x += this.createSignedInfo(s, p), x += this.getKeyInfo(p), x += `</${u}Signature>`, this.originalXmlWithIds = s.toString();
38784
+ let A = `<${u}Signature ${l.join(" ")}>`;
38785
+ A += this.createSignedInfo(s, p), A += this.getKeyInfo(p), A += `</${u}Signature>`, this.originalXmlWithIds = s.toString();
38707
38786
  let C = "";
38708
38787
  Object.keys(b).forEach(function(K) {
38709
38788
  C += `xmlns:${K}="${b[K]}" `;
38710
38789
  });
38711
- const O = `<Dummy ${C}>${x}</Dummy>`, A = new Ir.DOMParser().parseFromString(O).documentElement.firstChild, z = Xt.select1(g.reference, s);
38790
+ const D = `<Dummy ${C}>${A}</Dummy>`, x = new Ir.DOMParser().parseFromString(D).documentElement.firstChild, z = Xt.select1(g.reference, s);
38712
38791
  if (!Ft.isNodeLike(z)) {
38713
38792
  const K = new Error(`the following xpath cannot be used because it was not found: ${g.reference}`);
38714
38793
  if (i) {
@@ -38718,19 +38797,19 @@ class Vn {
38718
38797
  throw K;
38719
38798
  }
38720
38799
  if (g.action === "append")
38721
- z.appendChild(A);
38800
+ z.appendChild(x);
38722
38801
  else if (g.action === "prepend")
38723
- z.insertBefore(A, z.firstChild);
38802
+ z.insertBefore(x, z.firstChild);
38724
38803
  else if (g.action === "before") {
38725
38804
  if (z.parentNode == null)
38726
38805
  throw new Error("`location.reference` refers to the root node (by default), so we can't insert `before`");
38727
- z.parentNode.insertBefore(A, z);
38806
+ z.parentNode.insertBefore(x, z);
38728
38807
  } else if (g.action === "after") {
38729
38808
  if (z.parentNode == null)
38730
38809
  throw new Error("`location.reference` refers to the root node (by default), so we can't insert `after`");
38731
- z.parentNode.insertBefore(A, z.nextSibling);
38810
+ z.parentNode.insertBefore(x, z.nextSibling);
38732
38811
  }
38733
- this.signatureNode = A;
38812
+ this.signatureNode = x;
38734
38813
  const q = Re.findChildren(this.signatureNode, "SignedInfo");
38735
38814
  if (q.length === 0) {
38736
38815
  const K = new Error("could not find SignedInfo element in the message");
@@ -38742,8 +38821,8 @@ class Vn {
38742
38821
  }
38743
38822
  const M = q[0];
38744
38823
  typeof i == "function" ? this.calculateSignatureValue(s, (K, W) => {
38745
- K ? i(K) : (this.signatureValue = W || "", A.insertBefore(this.createSignature(p), M.nextSibling), this.signatureXml = A.toString(), this.signedXml = s.toString(), i(null, this));
38746
- }) : (this.calculateSignatureValue(s), A.insertBefore(this.createSignature(p), M.nextSibling), this.signatureXml = A.toString(), this.signedXml = s.toString());
38824
+ K ? i(K) : (this.signatureValue = W || "", x.insertBefore(this.createSignature(p), M.nextSibling), this.signatureXml = x.toString(), this.signedXml = s.toString(), i(null, this));
38825
+ }) : (this.calculateSignatureValue(s), x.insertBefore(this.createSignature(p), M.nextSibling), this.signatureXml = x.toString(), this.signedXml = s.toString());
38747
38826
  }
38748
38827
  getKeyInfo(e) {
38749
38828
  const n = e ? `${e}:` : "";
@@ -39143,7 +39222,7 @@ const US = new be().openapi(
39143
39222
  const s = await LS(n), a = s["samlp:AuthnRequest"]["saml:Issuer"]["#text"], l = await t.env.data.loginSessions.create(
39144
39223
  t.var.tenant_id,
39145
39224
  {
39146
- csrf_token: We(),
39225
+ csrf_token: Ke(),
39147
39226
  authParams: {
39148
39227
  client_id: e,
39149
39228
  state: JSON.stringify({
@@ -40507,7 +40586,7 @@ function mG(t, e) {
40507
40586
  ), u = n ? await t.connections.list(n) : { connections: [] }, d = l.connections.map((p) => {
40508
40587
  var b;
40509
40588
  const h = (b = u.connections) == null ? void 0 : b.find(
40510
- (x) => x.name === p.name
40589
+ (A) => A.name === p.name
40511
40590
  );
40512
40591
  if (!(h != null && h.options))
40513
40592
  return p;
@@ -40658,7 +40737,7 @@ export {
40658
40737
  _n as GoBack,
40659
40738
  h8 as GoogleLogo,
40660
40739
  En as GrantType,
40661
- Ge as Icon,
40740
+ We as Icon,
40662
40741
  eu as IdentifierPage,
40663
40742
  c6 as InvalidSession,
40664
40743
  nt as Layout,