zudoku 0.7.2-dev.2 → 0.8.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.
Files changed (94) hide show
  1. package/dist/cli/dev/handler.js +5 -0
  2. package/dist/cli/dev/handler.js.map +1 -1
  3. package/dist/vite/config.d.ts +2 -2
  4. package/dist/vite/config.js +21 -20
  5. package/dist/vite/config.js.map +1 -1
  6. package/dist/vite/config.test.js +1 -4
  7. package/dist/vite/config.test.js.map +1 -1
  8. package/dist/vite/dev-server.js +1 -4
  9. package/dist/vite/dev-server.js.map +1 -1
  10. package/lib/AuthenticationPlugin-Bx9FK124.js +55 -0
  11. package/lib/{AuthenticationPlugin-BMjOjKqE.js.map → AuthenticationPlugin-Bx9FK124.js.map} +1 -1
  12. package/lib/CategoryHeading-XnFqN2lJ.js +10 -0
  13. package/lib/{CategoryHeading-BE8e6QdS.js.map → CategoryHeading-XnFqN2lJ.js.map} +1 -1
  14. package/lib/DeveloperHint-FBb2uXJe.js +16 -0
  15. package/lib/{DeveloperHint-Bl9gIdNI.js.map → DeveloperHint-FBb2uXJe.js.map} +1 -1
  16. package/lib/ErrorPage-knunPbKI.js +18 -0
  17. package/lib/{ErrorPage-CPR1XVKW.js.map → ErrorPage-knunPbKI.js.map} +1 -1
  18. package/lib/Input-BEDZAKw0.js +2198 -0
  19. package/lib/{Input-BBlyeDuG.js.map → Input-BEDZAKw0.js.map} +1 -1
  20. package/lib/{Markdown-CCNihH_N.js → Markdown-B4aR03g6.js} +2650 -2641
  21. package/lib/{Markdown-CCNihH_N.js.map → Markdown-B4aR03g6.js.map} +1 -1
  22. package/lib/MdxPage-BZyQsH8Z.js +172 -0
  23. package/lib/{MdxPage-BavkYqzi.js.map → MdxPage-BZyQsH8Z.js.map} +1 -1
  24. package/lib/OperationList-2NeWEM0u.js +560 -0
  25. package/lib/{OperationList-C6Ps2keZ.js.map → OperationList-2NeWEM0u.js.map} +1 -1
  26. package/lib/Route-BZPewmrN.js +14 -0
  27. package/lib/{Route-xRJ9mJgH.js.map → Route-BZPewmrN.js.map} +1 -1
  28. package/lib/{SidebarBadge-2JcxswKF.js → SidebarBadge-COz0hgfa.js} +41 -41
  29. package/lib/{SidebarBadge-2JcxswKF.js.map → SidebarBadge-COz0hgfa.js.map} +1 -1
  30. package/lib/SlotletProvider-DJMaOUDs.js +238 -0
  31. package/lib/{SlotletProvider-CuB3Ts8r.js.map → SlotletProvider-DJMaOUDs.js.map} +1 -1
  32. package/lib/Spinner-3cQDBVGr.js +7 -0
  33. package/lib/Spinner-3cQDBVGr.js.map +1 -0
  34. package/lib/{ZudokuContext-JoyeA9dT.js → ZudokuContext-cr-pTRY1.js} +66 -65
  35. package/lib/{ZudokuContext-JoyeA9dT.js.map → ZudokuContext-cr-pTRY1.js.map} +1 -1
  36. package/lib/{index-G1-TGLO1.js → index-1EDgIO6b.js} +4 -4
  37. package/lib/{index-G1-TGLO1.js.map → index-1EDgIO6b.js.map} +1 -1
  38. package/lib/index-BG0g4WW0.js +1771 -0
  39. package/lib/index-BG0g4WW0.js.map +1 -0
  40. package/lib/{index-BF4cn28H.js → index-Dv2KZuEw.js} +1991 -1804
  41. package/lib/{index-BF4cn28H.js.map → index-Dv2KZuEw.js.map} +1 -1
  42. package/lib/{index-BLvMkqjO.js → index-Zezcv0xb.js} +5 -5
  43. package/lib/{index-BLvMkqjO.js.map → index-Zezcv0xb.js.map} +1 -1
  44. package/lib/jsx-runtime-B6kdoens.js +635 -0
  45. package/lib/jsx-runtime-B6kdoens.js.map +1 -0
  46. package/lib/{utils-B8R4grFM.js → utils-ByIc_KIM.js} +98 -97
  47. package/lib/{utils-B8R4grFM.js.map → utils-ByIc_KIM.js.map} +1 -1
  48. package/lib/zudoku.auth-auth0.js +21 -16
  49. package/lib/zudoku.auth-auth0.js.map +1 -1
  50. package/lib/zudoku.auth-clerk.js +37 -32
  51. package/lib/zudoku.auth-clerk.js.map +1 -1
  52. package/lib/zudoku.auth-openid.js +505 -485
  53. package/lib/zudoku.auth-openid.js.map +1 -1
  54. package/lib/zudoku.components.js +1659 -1531
  55. package/lib/zudoku.components.js.map +1 -1
  56. package/lib/zudoku.plugin-api-keys.js +214 -150
  57. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  58. package/lib/zudoku.plugin-custom-page.js +6 -5
  59. package/lib/zudoku.plugin-custom-page.js.map +1 -1
  60. package/lib/zudoku.plugin-markdown.js +13 -12
  61. package/lib/zudoku.plugin-markdown.js.map +1 -1
  62. package/lib/zudoku.plugin-openapi.js +8 -7
  63. package/lib/zudoku.plugin-openapi.js.map +1 -1
  64. package/lib/zudoku.plugin-search-inkeep.js +21 -20
  65. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  66. package/package.json +2 -2
  67. package/dist/lib/util/fetchTimeout.d.ts +0 -1
  68. package/dist/lib/util/fetchTimeout.js +0 -14
  69. package/dist/lib/util/fetchTimeout.js.map +0 -1
  70. package/dist/vite/esbuild-yaml.d.ts +0 -2
  71. package/dist/vite/esbuild-yaml.js +0 -50
  72. package/dist/vite/esbuild-yaml.js.map +0 -1
  73. package/dist/vite/plugin-vercel.d.ts +0 -3
  74. package/dist/vite/plugin-vercel.js +0 -8
  75. package/dist/vite/plugin-vercel.js.map +0 -1
  76. package/dist/vite/plugin-yaml.d.ts +0 -3
  77. package/dist/vite/plugin-yaml.js +0 -24
  78. package/dist/vite/plugin-yaml.js.map +0 -1
  79. package/dist/vite/sitemap.d.ts +0 -19
  80. package/dist/vite/sitemap.js +0 -36
  81. package/dist/vite/sitemap.js.map +0 -1
  82. package/lib/AuthenticationPlugin-BMjOjKqE.js +0 -54
  83. package/lib/CategoryHeading-BE8e6QdS.js +0 -9
  84. package/lib/DeveloperHint-Bl9gIdNI.js +0 -12
  85. package/lib/ErrorPage-CPR1XVKW.js +0 -12
  86. package/lib/Input-BBlyeDuG.js +0 -2192
  87. package/lib/MdxPage-BavkYqzi.js +0 -140
  88. package/lib/OperationList-C6Ps2keZ.js +0 -460
  89. package/lib/Route-xRJ9mJgH.js +0 -13
  90. package/lib/SlotletProvider-CuB3Ts8r.js +0 -213
  91. package/lib/Spinner-BlxzaFFF.js +0 -6
  92. package/lib/Spinner-BlxzaFFF.js.map +0 -1
  93. package/lib/jsx-runtime-lNnQYwFN.js +0 -2403
  94. package/lib/jsx-runtime-lNnQYwFN.js.map +0 -1
@@ -1,27 +1,31 @@
1
- import { c as Pe, g as Ue } from "./_commonjsHelpers-BkfeUUK-.js";
2
- import { A as Le } from "./AuthenticationPlugin-BMjOjKqE.js";
3
- import { useState as Ce, useRef as xe, useEffect as Ie } from "react";
4
- import { D as Je } from "./DeveloperHint-Bl9gIdNI.js";
5
- import { E as je } from "./ErrorPage-CPR1XVKW.js";
6
- import { S as Oe } from "./Spinner-BlxzaFFF.js";
7
- import { S as Ne } from "./Markdown-CCNihH_N.js";
8
- import { a as ze } from "./jsx-runtime-lNnQYwFN.js";
9
- import { u as N } from "./state-lIwt9isb.js";
10
- var he = { exports: {} };
1
+ var Ue = Object.defineProperty;
2
+ var Le = (t, e, r) => e in t ? Ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var _ = (t, e, r) => Le(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import { j as E } from "./jsx-runtime-B6kdoens.js";
5
+ import { c as Ce, g as Ie } from "./_commonjsHelpers-BkfeUUK-.js";
6
+ import { A as je } from "./AuthenticationPlugin-Bx9FK124.js";
7
+ import { useState as Je, useRef as Oe, useEffect as Ne } from "react";
8
+ import { D as ze } from "./DeveloperHint-FBb2uXJe.js";
9
+ import { E as De } from "./ErrorPage-knunPbKI.js";
10
+ import { S as Ke } from "./Spinner-3cQDBVGr.js";
11
+ import { S as We } from "./Markdown-B4aR03g6.js";
12
+ import { a as He } from "./index-BG0g4WW0.js";
13
+ import { u as z } from "./state-lIwt9isb.js";
14
+ var fe = { exports: {} };
11
15
  (function(t) {
12
- (function(e, n) {
13
- t.exports ? t.exports = n() : e.log = n();
14
- })(Pe, function() {
16
+ (function(e, r) {
17
+ t.exports ? t.exports = r() : e.log = r();
18
+ })(Ce, function() {
15
19
  var e = function() {
16
- }, n = "undefined", o = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
20
+ }, r = "undefined", o = typeof window !== r && typeof window.navigator !== r && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
17
21
  "trace",
18
22
  "debug",
19
23
  "info",
20
24
  "warn",
21
25
  "error"
22
- ], r = {}, i = null;
23
- function u(l, m) {
24
- var c = l[m];
26
+ ], n = {}, i = null;
27
+ function u(l, w) {
28
+ var c = l[w];
25
29
  if (typeof c.bind == "function")
26
30
  return c.bind(l);
27
31
  try {
@@ -32,80 +36,80 @@ var he = { exports: {} };
32
36
  };
33
37
  }
34
38
  }
35
- function d() {
39
+ function f() {
36
40
  console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
37
41
  }
38
- function p(l) {
39
- return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && o ? d : console[l] !== void 0 ? u(console, l) : console.log !== void 0 ? u(console, "log") : e;
42
+ function m(l) {
43
+ return l === "debug" && (l = "log"), typeof console === r ? !1 : l === "trace" && o ? f : console[l] !== void 0 ? u(console, l) : console.log !== void 0 ? u(console, "log") : e;
40
44
  }
41
- function w() {
42
- for (var l = this.getLevel(), m = 0; m < s.length; m++) {
43
- var c = s[m];
44
- this[c] = m < l ? e : this.methodFactory(c, l, this.name);
45
+ function y() {
46
+ for (var l = this.getLevel(), w = 0; w < s.length; w++) {
47
+ var c = s[w];
48
+ this[c] = w < l ? e : this.methodFactory(c, l, this.name);
45
49
  }
46
- if (this.log = this.debug, typeof console === n && l < this.levels.SILENT)
50
+ if (this.log = this.debug, typeof console === r && l < this.levels.SILENT)
47
51
  return "No console available for logging";
48
52
  }
49
53
  function b(l) {
50
54
  return function() {
51
- typeof console !== n && (w.call(this), this[l].apply(this, arguments));
55
+ typeof console !== r && (y.call(this), this[l].apply(this, arguments));
52
56
  };
53
57
  }
54
- function f(l, m, c) {
55
- return p(l) || b.apply(this, arguments);
58
+ function h(l, w, c) {
59
+ return m(l) || b.apply(this, arguments);
56
60
  }
57
- function A(l, m) {
58
- var c = this, R, L, P, _ = "loglevel";
59
- typeof l == "string" ? _ += ":" + l : typeof l == "symbol" && (_ = void 0);
60
- function ke(h) {
61
- var y = (s[h] || "silent").toUpperCase();
62
- if (!(typeof window === n || !_)) {
61
+ function R(l, w) {
62
+ var c = this, O, B, x, v = "loglevel";
63
+ typeof l == "string" ? v += ":" + l : typeof l == "symbol" && (v = void 0);
64
+ function Re(d) {
65
+ var g = (s[d] || "silent").toUpperCase();
66
+ if (!(typeof window === r || !v)) {
63
67
  try {
64
- window.localStorage[_] = y;
68
+ window.localStorage[v] = g;
65
69
  return;
66
70
  } catch {
67
71
  }
68
72
  try {
69
- window.document.cookie = encodeURIComponent(_) + "=" + y + ";";
73
+ window.document.cookie = encodeURIComponent(v) + "=" + g + ";";
70
74
  } catch {
71
75
  }
72
76
  }
73
77
  }
74
- function te() {
75
- var h;
76
- if (!(typeof window === n || !_)) {
78
+ function ne() {
79
+ var d;
80
+ if (!(typeof window === r || !v)) {
77
81
  try {
78
- h = window.localStorage[_];
82
+ d = window.localStorage[v];
79
83
  } catch {
80
84
  }
81
- if (typeof h === n)
85
+ if (typeof d === r)
82
86
  try {
83
- var y = window.document.cookie, O = encodeURIComponent(_), re = y.indexOf(O + "=");
84
- re !== -1 && (h = /^([^;]+)/.exec(
85
- y.slice(re + O.length + 1)
87
+ var g = window.document.cookie, N = encodeURIComponent(v), ie = g.indexOf(N + "=");
88
+ ie !== -1 && (d = /^([^;]+)/.exec(
89
+ g.slice(ie + N.length + 1)
86
90
  )[1]);
87
91
  } catch {
88
92
  }
89
- return c.levels[h] === void 0 && (h = void 0), h;
93
+ return c.levels[d] === void 0 && (d = void 0), d;
90
94
  }
91
95
  }
92
- function Ae() {
93
- if (!(typeof window === n || !_)) {
96
+ function Pe() {
97
+ if (!(typeof window === r || !v)) {
94
98
  try {
95
- window.localStorage.removeItem(_);
99
+ window.localStorage.removeItem(v);
96
100
  } catch {
97
101
  }
98
102
  try {
99
- window.document.cookie = encodeURIComponent(_) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
103
+ window.document.cookie = encodeURIComponent(v) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
100
104
  } catch {
101
105
  }
102
106
  }
103
107
  }
104
- function C(h) {
105
- var y = h;
106
- if (typeof y == "string" && c.levels[y.toUpperCase()] !== void 0 && (y = c.levels[y.toUpperCase()]), typeof y == "number" && y >= 0 && y <= c.levels.SILENT)
107
- return y;
108
- throw new TypeError("log.setLevel() called with invalid level: " + h);
108
+ function L(d) {
109
+ var g = d;
110
+ if (typeof g == "string" && c.levels[g.toUpperCase()] !== void 0 && (g = c.levels[g.toUpperCase()]), typeof g == "number" && g >= 0 && g <= c.levels.SILENT)
111
+ return g;
112
+ throw new TypeError("log.setLevel() called with invalid level: " + d);
109
113
  }
110
114
  c.name = l, c.levels = {
111
115
  TRACE: 0,
@@ -114,51 +118,51 @@ var he = { exports: {} };
114
118
  WARN: 3,
115
119
  ERROR: 4,
116
120
  SILENT: 5
117
- }, c.methodFactory = m || f, c.getLevel = function() {
118
- return P ?? L ?? R;
119
- }, c.setLevel = function(h, y) {
120
- return P = C(h), y !== !1 && ke(P), w.call(c);
121
- }, c.setDefaultLevel = function(h) {
122
- L = C(h), te() || c.setLevel(h, !1);
121
+ }, c.methodFactory = w || h, c.getLevel = function() {
122
+ return x ?? B ?? O;
123
+ }, c.setLevel = function(d, g) {
124
+ return x = L(d), g !== !1 && Re(x), y.call(c);
125
+ }, c.setDefaultLevel = function(d) {
126
+ B = L(d), ne() || c.setLevel(d, !1);
123
127
  }, c.resetLevel = function() {
124
- P = null, Ae(), w.call(c);
125
- }, c.enableAll = function(h) {
126
- c.setLevel(c.levels.TRACE, h);
127
- }, c.disableAll = function(h) {
128
- c.setLevel(c.levels.SILENT, h);
128
+ x = null, Pe(), y.call(c);
129
+ }, c.enableAll = function(d) {
130
+ c.setLevel(c.levels.TRACE, d);
131
+ }, c.disableAll = function(d) {
132
+ c.setLevel(c.levels.SILENT, d);
129
133
  }, c.rebuild = function() {
130
- if (i !== c && (R = C(i.getLevel())), w.call(c), i === c)
131
- for (var h in r)
132
- r[h].rebuild();
133
- }, R = C(
134
+ if (i !== c && (O = L(i.getLevel())), y.call(c), i === c)
135
+ for (var d in n)
136
+ n[d].rebuild();
137
+ }, O = L(
134
138
  i ? i.getLevel() : "WARN"
135
139
  );
136
- var ne = te();
137
- ne != null && (P = C(ne)), w.call(c);
140
+ var oe = ne();
141
+ oe != null && (x = L(oe)), y.call(c);
138
142
  }
139
- i = new A(), i.getLogger = function(m) {
140
- if (typeof m != "symbol" && typeof m != "string" || m === "")
143
+ i = new R(), i.getLogger = function(w) {
144
+ if (typeof w != "symbol" && typeof w != "string" || w === "")
141
145
  throw new TypeError("You must supply a name when creating a logger.");
142
- var c = r[m];
143
- return c || (c = r[m] = new A(
144
- m,
146
+ var c = n[w];
147
+ return c || (c = n[w] = new R(
148
+ w,
145
149
  i.methodFactory
146
150
  )), c;
147
151
  };
148
- var S = typeof window !== n ? window.log : void 0;
152
+ var P = typeof window !== r ? window.log : void 0;
149
153
  return i.noConflict = function() {
150
- return typeof window !== n && window.log === i && (window.log = S), i;
154
+ return typeof window !== r && window.log === i && (window.log = P), i;
151
155
  }, i.getLoggers = function() {
152
- return r;
156
+ return n;
153
157
  }, i.default = i, i;
154
158
  });
155
- })(he);
156
- var De = he.exports;
157
- const D = /* @__PURE__ */ Ue(De);
158
- let G;
159
- var z, le;
160
- (typeof navigator > "u" || !((le = (z = navigator.userAgent) == null ? void 0 : z.startsWith) != null && le.call(z, "Mozilla/5.0 "))) && (G = "oauth4webapi/v2.11.1");
161
- function Y(t, e) {
159
+ })(fe);
160
+ var $e = fe.exports;
161
+ const K = /* @__PURE__ */ Ie($e);
162
+ let Y;
163
+ var D, he;
164
+ (typeof navigator > "u" || !((he = (D = navigator.userAgent) == null ? void 0 : D.startsWith) != null && he.call(D, "Mozilla/5.0 "))) && (Y = "oauth4webapi/v2.11.1");
165
+ function Q(t, e) {
162
166
  if (t == null)
163
167
  return !1;
164
168
  try {
@@ -167,183 +171,183 @@ function Y(t, e) {
167
171
  return !1;
168
172
  }
169
173
  }
170
- const W = Symbol(), Ke = Symbol(), Z = Symbol(), We = new TextEncoder(), He = new TextDecoder();
171
- function k(t) {
172
- return typeof t == "string" ? We.encode(t) : He.decode(t);
174
+ const H = Symbol(), Fe = Symbol(), X = Symbol(), Me = new TextEncoder(), Be = new TextDecoder();
175
+ function A(t) {
176
+ return typeof t == "string" ? Me.encode(t) : Be.decode(t);
173
177
  }
174
- const oe = 32768;
175
- function $e(t) {
178
+ const se = 32768;
179
+ function qe(t) {
176
180
  t instanceof ArrayBuffer && (t = new Uint8Array(t));
177
181
  const e = [];
178
- for (let n = 0; n < t.byteLength; n += oe)
179
- e.push(String.fromCharCode.apply(null, t.subarray(n, n + oe)));
182
+ for (let r = 0; r < t.byteLength; r += se)
183
+ e.push(String.fromCharCode.apply(null, t.subarray(r, r + se)));
180
184
  return btoa(e.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
181
185
  }
182
- function Fe(t) {
186
+ function Ge(t) {
183
187
  try {
184
- const e = atob(t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), n = new Uint8Array(e.length);
188
+ const e = atob(t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), r = new Uint8Array(e.length);
185
189
  for (let o = 0; o < e.length; o++)
186
- n[o] = e.charCodeAt(o);
187
- return n;
190
+ r[o] = e.charCodeAt(o);
191
+ return r;
188
192
  } catch (e) {
189
193
  throw new a("The input to be decoded is not correctly encoded.", { cause: e });
190
194
  }
191
195
  }
192
- function E(t) {
193
- return typeof t == "string" ? Fe(t) : $e(t);
196
+ function k(t) {
197
+ return typeof t == "string" ? Ge(t) : qe(t);
194
198
  }
195
- class Me {
199
+ class Ve {
196
200
  constructor(e) {
197
201
  this.cache = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this.maxSize = e;
198
202
  }
199
203
  get(e) {
200
- let n = this.cache.get(e);
201
- if (n)
202
- return n;
203
- if (n = this._cache.get(e))
204
- return this.update(e, n), n;
204
+ let r = this.cache.get(e);
205
+ if (r)
206
+ return r;
207
+ if (r = this._cache.get(e))
208
+ return this.update(e, r), r;
205
209
  }
206
210
  has(e) {
207
211
  return this.cache.has(e) || this._cache.has(e);
208
212
  }
209
- set(e, n) {
210
- return this.cache.has(e) ? this.cache.set(e, n) : this.update(e, n), this;
213
+ set(e, r) {
214
+ return this.cache.has(e) ? this.cache.set(e, r) : this.update(e, r), this;
211
215
  }
212
216
  delete(e) {
213
217
  return this.cache.has(e) ? this.cache.delete(e) : this._cache.has(e) ? this._cache.delete(e) : !1;
214
218
  }
215
- update(e, n) {
216
- this.cache.set(e, n), this.cache.size >= this.maxSize && (this._cache = this.cache, this.cache = /* @__PURE__ */ new Map());
219
+ update(e, r) {
220
+ this.cache.set(e, r), this.cache.size >= this.maxSize && (this._cache = this.cache, this.cache = /* @__PURE__ */ new Map());
217
221
  }
218
222
  }
219
- class v extends Error {
223
+ class S extends Error {
220
224
  constructor(e) {
221
- var n;
222
- super(e ?? "operation not supported"), this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
225
+ var r;
226
+ super(e ?? "operation not supported"), this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
223
227
  }
224
228
  }
225
- class Be extends Error {
226
- constructor(e, n) {
229
+ class Ye extends Error {
230
+ constructor(e, r) {
227
231
  var o;
228
- super(e, n), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
232
+ super(e, r), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
229
233
  }
230
234
  }
231
- const a = Be, de = new Me(100);
232
- function fe(t) {
235
+ const a = Ye, pe = new Ve(100);
236
+ function we(t) {
233
237
  return t instanceof CryptoKey;
234
238
  }
235
- function pe(t) {
236
- return fe(t) && t.type === "private";
239
+ function ge(t) {
240
+ return we(t) && t.type === "private";
237
241
  }
238
- function qe(t) {
239
- return fe(t) && t.type === "public";
242
+ function Ze(t) {
243
+ return we(t) && t.type === "public";
240
244
  }
241
- function Q(t) {
245
+ function ee(t) {
242
246
  try {
243
247
  const e = t.headers.get("dpop-nonce");
244
- e && de.set(new URL(t.url).origin, e);
248
+ e && pe.set(new URL(t.url).origin, e);
245
249
  } catch {
246
250
  }
247
251
  return t;
248
252
  }
249
- function x(t) {
253
+ function C(t) {
250
254
  return !(t === null || typeof t != "object" || Array.isArray(t));
251
255
  }
252
- function H(t) {
253
- Y(t, Headers) && (t = Object.fromEntries(t.entries()));
256
+ function $(t) {
257
+ Q(t, Headers) && (t = Object.fromEntries(t.entries()));
254
258
  const e = new Headers(t);
255
- if (G && !e.has("user-agent") && e.set("user-agent", G), e.has("authorization"))
259
+ if (Y && !e.has("user-agent") && e.set("user-agent", Y), e.has("authorization"))
256
260
  throw new TypeError('"options.headers" must not include the "authorization" header name');
257
261
  if (e.has("dpop"))
258
262
  throw new TypeError('"options.headers" must not include the "dpop" header name');
259
263
  return e;
260
264
  }
261
- function X(t) {
265
+ function te(t) {
262
266
  if (typeof t == "function" && (t = t()), !(t instanceof AbortSignal))
263
267
  throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
264
268
  return t;
265
269
  }
266
- async function Ge(t, e) {
270
+ async function Qe(t, e) {
267
271
  if (!(t instanceof URL))
268
272
  throw new TypeError('"issuerIdentifier" must be an instance of URL');
269
273
  if (t.protocol !== "https:" && t.protocol !== "http:")
270
274
  throw new TypeError('"issuer.protocol" must be "https:" or "http:"');
271
- const n = new URL(t.href);
275
+ const r = new URL(t.href);
272
276
  switch (e == null ? void 0 : e.algorithm) {
273
277
  case void 0:
274
278
  case "oidc":
275
- n.pathname = `${n.pathname}/.well-known/openid-configuration`.replace("//", "/");
279
+ r.pathname = `${r.pathname}/.well-known/openid-configuration`.replace("//", "/");
276
280
  break;
277
281
  case "oauth2":
278
- n.pathname === "/" ? n.pathname = ".well-known/oauth-authorization-server" : n.pathname = `.well-known/oauth-authorization-server/${n.pathname}`.replace("//", "/");
282
+ r.pathname === "/" ? r.pathname = ".well-known/oauth-authorization-server" : r.pathname = `.well-known/oauth-authorization-server/${r.pathname}`.replace("//", "/");
279
283
  break;
280
284
  default:
281
285
  throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
282
286
  }
283
- const o = H(e == null ? void 0 : e.headers);
284
- return o.set("accept", "application/json"), ((e == null ? void 0 : e[Z]) || fetch)(n.href, {
287
+ const o = $(e == null ? void 0 : e.headers);
288
+ return o.set("accept", "application/json"), ((e == null ? void 0 : e[X]) || fetch)(r.href, {
285
289
  headers: Object.fromEntries(o.entries()),
286
290
  method: "GET",
287
291
  redirect: "manual",
288
- signal: e != null && e.signal ? X(e.signal) : null
289
- }).then(Q);
292
+ signal: e != null && e.signal ? te(e.signal) : null
293
+ }).then(ee);
290
294
  }
291
- function g(t) {
295
+ function p(t) {
292
296
  return typeof t == "string" && t.length !== 0;
293
297
  }
294
- async function Ve(t, e) {
298
+ async function Xe(t, e) {
295
299
  if (!(t instanceof URL))
296
300
  throw new TypeError('"expectedIssuer" must be an instance of URL');
297
- if (!Y(e, Response))
301
+ if (!Q(e, Response))
298
302
  throw new TypeError('"response" must be an instance of Response');
299
303
  if (e.status !== 200)
300
304
  throw new a('"response" is not a conform Authorization Server Metadata response');
301
- ee(e);
302
- let n;
305
+ re(e);
306
+ let r;
303
307
  try {
304
- n = await e.json();
308
+ r = await e.json();
305
309
  } catch (o) {
306
310
  throw new a('failed to parse "response" body as JSON', { cause: o });
307
311
  }
308
- if (!x(n))
312
+ if (!C(r))
309
313
  throw new a('"response" body must be a top level object');
310
- if (!g(n.issuer))
314
+ if (!p(r.issuer))
311
315
  throw new a('"response" body "issuer" property must be a non-empty string');
312
- if (new URL(n.issuer).href !== t.href)
316
+ if (new URL(r.issuer).href !== t.href)
313
317
  throw new a('"response" body "issuer" does not match "expectedIssuer"');
314
- return n;
318
+ return r;
315
319
  }
316
- function $() {
317
- return E(crypto.getRandomValues(new Uint8Array(32)));
320
+ function F() {
321
+ return k(crypto.getRandomValues(new Uint8Array(32)));
318
322
  }
319
- function Ye() {
320
- return $();
323
+ function et() {
324
+ return F();
321
325
  }
322
- function Ze() {
323
- return $();
326
+ function tt() {
327
+ return F();
324
328
  }
325
- async function Qe(t) {
326
- if (!g(t))
329
+ async function rt(t) {
330
+ if (!p(t))
327
331
  throw new TypeError('"codeVerifier" must be a non-empty string');
328
- return E(await crypto.subtle.digest("SHA-256", k(t)));
332
+ return k(await crypto.subtle.digest("SHA-256", A(t)));
329
333
  }
330
- function Xe(t) {
334
+ function nt(t) {
331
335
  if (t instanceof CryptoKey)
332
336
  return { key: t };
333
337
  if (!((t == null ? void 0 : t.key) instanceof CryptoKey))
334
338
  return {};
335
- if (t.kid !== void 0 && !g(t.kid))
339
+ if (t.kid !== void 0 && !p(t.kid))
336
340
  throw new TypeError('"kid" must be a non-empty string');
337
341
  return { key: t.key, kid: t.kid };
338
342
  }
339
- function ie(t) {
343
+ function ae(t) {
340
344
  return encodeURIComponent(t).replace(/%20/g, "+");
341
345
  }
342
- function et(t, e) {
343
- const n = ie(t), o = ie(e);
344
- return `Basic ${btoa(`${n}:${o}`)}`;
346
+ function ot(t, e) {
347
+ const r = ae(t), o = ae(e);
348
+ return `Basic ${btoa(`${r}:${o}`)}`;
345
349
  }
346
- function tt(t) {
350
+ function it(t) {
347
351
  switch (t.algorithm.hash.name) {
348
352
  case "SHA-256":
349
353
  return "PS256";
@@ -352,10 +356,10 @@ function tt(t) {
352
356
  case "SHA-512":
353
357
  return "PS512";
354
358
  default:
355
- throw new v("unsupported RsaHashedKeyAlgorithm hash name");
359
+ throw new S("unsupported RsaHashedKeyAlgorithm hash name");
356
360
  }
357
361
  }
358
- function nt(t) {
362
+ function st(t) {
359
363
  switch (t.algorithm.hash.name) {
360
364
  case "SHA-256":
361
365
  return "RS256";
@@ -364,10 +368,10 @@ function nt(t) {
364
368
  case "SHA-512":
365
369
  return "RS512";
366
370
  default:
367
- throw new v("unsupported RsaHashedKeyAlgorithm hash name");
371
+ throw new S("unsupported RsaHashedKeyAlgorithm hash name");
368
372
  }
369
373
  }
370
- function rt(t) {
374
+ function at(t) {
371
375
  switch (t.algorithm.namedCurve) {
372
376
  case "P-256":
373
377
  return "ES256";
@@ -376,259 +380,259 @@ function rt(t) {
376
380
  case "P-521":
377
381
  return "ES512";
378
382
  default:
379
- throw new v("unsupported EcKeyAlgorithm namedCurve");
383
+ throw new S("unsupported EcKeyAlgorithm namedCurve");
380
384
  }
381
385
  }
382
- function we(t) {
386
+ function me(t) {
383
387
  switch (t.algorithm.name) {
384
388
  case "RSA-PSS":
385
- return tt(t);
389
+ return it(t);
386
390
  case "RSASSA-PKCS1-v1_5":
387
- return nt(t);
391
+ return st(t);
388
392
  case "ECDSA":
389
- return rt(t);
393
+ return at(t);
390
394
  case "Ed25519":
391
395
  case "Ed448":
392
396
  return "EdDSA";
393
397
  default:
394
- throw new v("unsupported CryptoKey algorithm name");
398
+ throw new S("unsupported CryptoKey algorithm name");
395
399
  }
396
400
  }
397
401
  function I(t) {
398
- const e = t == null ? void 0 : t[W];
402
+ const e = t == null ? void 0 : t[H];
399
403
  return typeof e == "number" && Number.isFinite(e) ? e : 0;
400
404
  }
401
- function ge(t) {
402
- const e = t == null ? void 0 : t[Ke];
405
+ function ye(t) {
406
+ const e = t == null ? void 0 : t[Fe];
403
407
  return typeof e == "number" && Number.isFinite(e) && Math.sign(e) !== -1 ? e : 30;
404
408
  }
405
- function F() {
409
+ function M() {
406
410
  return Math.floor(Date.now() / 1e3);
407
411
  }
408
- function ot(t, e) {
409
- const n = F() + I(e);
412
+ function ct(t, e) {
413
+ const r = M() + I(e);
410
414
  return {
411
- jti: $(),
415
+ jti: F(),
412
416
  aud: [t.issuer, t.token_endpoint],
413
- exp: n + 60,
414
- iat: n,
415
- nbf: n,
417
+ exp: r + 60,
418
+ iat: r,
419
+ nbf: r,
416
420
  iss: e.client_id,
417
421
  sub: e.client_id
418
422
  };
419
423
  }
420
- async function it(t, e, n, o) {
421
- return me({
422
- alg: we(n),
424
+ async function ut(t, e, r, o) {
425
+ return be({
426
+ alg: me(r),
423
427
  kid: o
424
- }, ot(t, e), n);
428
+ }, ct(t, e), r);
425
429
  }
426
- function J(t) {
430
+ function j(t) {
427
431
  if (typeof t != "object" || t === null)
428
432
  throw new TypeError('"as" must be an object');
429
- if (!g(t.issuer))
433
+ if (!p(t.issuer))
430
434
  throw new TypeError('"as.issuer" property must be a non-empty string');
431
435
  return !0;
432
436
  }
433
- function j(t) {
437
+ function J(t) {
434
438
  if (typeof t != "object" || t === null)
435
439
  throw new TypeError('"client" must be an object');
436
- if (!g(t.client_id))
440
+ if (!p(t.client_id))
437
441
  throw new TypeError('"client.client_id" property must be a non-empty string');
438
442
  return !0;
439
443
  }
440
- function se(t) {
441
- if (!g(t))
444
+ function ce(t) {
445
+ if (!p(t))
442
446
  throw new TypeError('"client.client_secret" property must be a non-empty string');
443
447
  return t;
444
448
  }
445
- function M(t, e) {
449
+ function q(t, e) {
446
450
  if (e !== void 0)
447
451
  throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${t} client authentication method is used.`);
448
452
  }
449
- function ae(t, e) {
453
+ function ue(t, e) {
450
454
  if (e !== void 0)
451
455
  throw new TypeError(`"client.client_secret" property must not be provided when ${t} client authentication method is used.`);
452
456
  }
453
- async function st(t, e, n, o, s) {
454
- switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), e.token_endpoint_auth_method) {
457
+ async function lt(t, e, r, o, s) {
458
+ switch (r.delete("client_secret"), r.delete("client_assertion_type"), r.delete("client_assertion"), e.token_endpoint_auth_method) {
455
459
  case void 0:
456
460
  case "client_secret_basic": {
457
- M("client_secret_basic", s), o.set("authorization", et(e.client_id, se(e.client_secret)));
461
+ q("client_secret_basic", s), o.set("authorization", ot(e.client_id, ce(e.client_secret)));
458
462
  break;
459
463
  }
460
464
  case "client_secret_post": {
461
- M("client_secret_post", s), n.set("client_id", e.client_id), n.set("client_secret", se(e.client_secret));
465
+ q("client_secret_post", s), r.set("client_id", e.client_id), r.set("client_secret", ce(e.client_secret));
462
466
  break;
463
467
  }
464
468
  case "private_key_jwt": {
465
- if (ae("private_key_jwt", e.client_secret), s === void 0)
469
+ if (ue("private_key_jwt", e.client_secret), s === void 0)
466
470
  throw new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
467
- const { key: r, kid: i } = Xe(s);
468
- if (!pe(r))
471
+ const { key: n, kid: i } = nt(s);
472
+ if (!ge(n))
469
473
  throw new TypeError('"options.clientPrivateKey.key" must be a private CryptoKey');
470
- n.set("client_id", e.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await it(t, e, r, i));
474
+ r.set("client_id", e.client_id), r.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), r.set("client_assertion", await ut(t, e, n, i));
471
475
  break;
472
476
  }
473
477
  case "tls_client_auth":
474
478
  case "self_signed_tls_client_auth":
475
479
  case "none": {
476
- ae(e.token_endpoint_auth_method, e.client_secret), M(e.token_endpoint_auth_method, s), n.set("client_id", e.client_id);
480
+ ue(e.token_endpoint_auth_method, e.client_secret), q(e.token_endpoint_auth_method, s), r.set("client_id", e.client_id);
477
481
  break;
478
482
  }
479
483
  default:
480
- throw new v("unsupported client token_endpoint_auth_method");
484
+ throw new S("unsupported client token_endpoint_auth_method");
481
485
  }
482
486
  }
483
- async function me(t, e, n) {
484
- if (!n.usages.includes("sign"))
487
+ async function be(t, e, r) {
488
+ if (!r.usages.includes("sign"))
485
489
  throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
486
- const o = `${E(k(JSON.stringify(t)))}.${E(k(JSON.stringify(e)))}`, s = E(await crypto.subtle.sign(Te(n), n, k(o)));
490
+ const o = `${k(A(JSON.stringify(t)))}.${k(A(JSON.stringify(e)))}`, s = k(await crypto.subtle.sign(Ee(r), r, A(o)));
487
491
  return `${o}.${s}`;
488
492
  }
489
- async function at(t, e, n, o, s, r) {
490
- const { privateKey: i, publicKey: u, nonce: d = de.get(n.origin) } = e;
491
- if (!pe(i))
493
+ async function dt(t, e, r, o, s, n) {
494
+ const { privateKey: i, publicKey: u, nonce: f = pe.get(r.origin) } = e;
495
+ if (!ge(i))
492
496
  throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
493
- if (!qe(u))
497
+ if (!Ze(u))
494
498
  throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
495
- if (d !== void 0 && !g(d))
499
+ if (f !== void 0 && !p(f))
496
500
  throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
497
501
  if (!u.extractable)
498
502
  throw new TypeError('"DPoP.publicKey.extractable" must be true');
499
- const p = F() + s, w = await me({
500
- alg: we(i),
503
+ const m = M() + s, y = await be({
504
+ alg: me(i),
501
505
  typ: "dpop+jwt",
502
- jwk: await ut(u)
506
+ jwk: await ft(u)
503
507
  }, {
504
- iat: p,
505
- jti: $(),
508
+ iat: m,
509
+ jti: F(),
506
510
  htm: o,
507
- nonce: d,
508
- htu: `${n.origin}${n.pathname}`,
509
- ath: r ? E(await crypto.subtle.digest("SHA-256", k(r))) : void 0
511
+ nonce: f,
512
+ htu: `${r.origin}${r.pathname}`,
513
+ ath: n ? k(await crypto.subtle.digest("SHA-256", A(n))) : void 0
510
514
  }, i);
511
- t.set("dpop", w);
515
+ t.set("dpop", y);
512
516
  }
513
- let K;
514
- async function ct(t) {
515
- const { kty: e, e: n, n: o, x: s, y: r, crv: i } = await crypto.subtle.exportKey("jwk", t), u = { kty: e, e: n, n: o, x: s, y: r, crv: i };
516
- return K.set(t, u), u;
517
+ let W;
518
+ async function ht(t) {
519
+ const { kty: e, e: r, n: o, x: s, y: n, crv: i } = await crypto.subtle.exportKey("jwk", t), u = { kty: e, e: r, n: o, x: s, y: n, crv: i };
520
+ return W.set(t, u), u;
517
521
  }
518
- async function ut(t) {
519
- return K || (K = /* @__PURE__ */ new WeakMap()), K.get(t) || ct(t);
522
+ async function ft(t) {
523
+ return W || (W = /* @__PURE__ */ new WeakMap()), W.get(t) || ht(t);
520
524
  }
521
- function lt(t, e, n) {
525
+ function pt(t, e, r) {
522
526
  if (typeof t != "string")
523
527
  throw new TypeError(`"as.${e}" must be a string`);
524
528
  return new URL(t);
525
529
  }
526
- function ye(t, e, n) {
527
- return lt(t[e], e);
530
+ function _e(t, e, r) {
531
+ return pt(t[e], e);
528
532
  }
529
- function V(t) {
533
+ function Z(t) {
530
534
  const e = t;
531
535
  return typeof e != "object" || Array.isArray(e) || e === null ? !1 : e.error !== void 0;
532
536
  }
533
- async function ht(t, e, n, o, s, r) {
534
- if (!g(t))
537
+ async function wt(t, e, r, o, s, n) {
538
+ if (!p(t))
535
539
  throw new TypeError('"accessToken" must be a non-empty string');
536
- if (!(n instanceof URL))
540
+ if (!(r instanceof URL))
537
541
  throw new TypeError('"url" must be an instance of URL');
538
- return o = H(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await at(o, r.DPoP, n, "GET", I({ [W]: r == null ? void 0 : r[W] }), t), o.set("authorization", `DPoP ${t}`)), ((r == null ? void 0 : r[Z]) || fetch)(n.href, {
542
+ return o = $(o), (n == null ? void 0 : n.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await dt(o, n.DPoP, r, "GET", I({ [H]: n == null ? void 0 : n[H] }), t), o.set("authorization", `DPoP ${t}`)), ((n == null ? void 0 : n[X]) || fetch)(r.href, {
539
543
  body: s,
540
544
  headers: Object.fromEntries(o.entries()),
541
545
  method: e,
542
546
  redirect: "manual",
543
- signal: r != null && r.signal ? X(r.signal) : null
544
- }).then(Q);
547
+ signal: n != null && n.signal ? te(n.signal) : null
548
+ }).then(ee);
545
549
  }
546
- async function dt(t, e, n, o) {
547
- J(t), j(e);
548
- const s = ye(t, "userinfo_endpoint"), r = H(o == null ? void 0 : o.headers);
549
- return e.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), ht(n, "GET", s, r, null, {
550
+ async function gt(t, e, r, o) {
551
+ j(t), J(e);
552
+ const s = _e(t, "userinfo_endpoint"), n = $(o == null ? void 0 : o.headers);
553
+ return e.userinfo_signed_response_alg ? n.set("accept", "application/jwt") : (n.set("accept", "application/json"), n.append("accept", "application/jwt")), wt(r, "GET", s, n, null, {
550
554
  ...o,
551
- [W]: I(e)
555
+ [H]: I(e)
552
556
  });
553
557
  }
554
- async function ft(t, e, n, o, s, r, i) {
555
- return await st(t, e, s, r, i == null ? void 0 : i.clientPrivateKey), r.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[Z]) || fetch)(o.href, {
558
+ async function mt(t, e, r, o, s, n, i) {
559
+ return await lt(t, e, s, n, i == null ? void 0 : i.clientPrivateKey), n.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[X]) || fetch)(o.href, {
556
560
  body: s,
557
- headers: Object.fromEntries(r.entries()),
558
- method: n,
561
+ headers: Object.fromEntries(n.entries()),
562
+ method: r,
559
563
  redirect: "manual",
560
- signal: i != null && i.signal ? X(i.signal) : null
561
- }).then(Q);
564
+ signal: i != null && i.signal ? te(i.signal) : null
565
+ }).then(ee);
562
566
  }
563
- async function be(t, e, n, o, s) {
564
- const r = ye(t, "token_endpoint");
565
- o.set("grant_type", n);
566
- const i = H(s == null ? void 0 : s.headers);
567
- return i.set("accept", "application/json"), ft(t, e, "POST", r, o, i, s);
567
+ async function ve(t, e, r, o, s) {
568
+ const n = _e(t, "token_endpoint");
569
+ o.set("grant_type", r);
570
+ const i = $(s == null ? void 0 : s.headers);
571
+ return i.set("accept", "application/json"), mt(t, e, "POST", n, o, i, s);
568
572
  }
569
- async function pt(t, e, n, o) {
570
- if (J(t), j(e), !g(n))
573
+ async function yt(t, e, r, o) {
574
+ if (j(t), J(e), !p(r))
571
575
  throw new TypeError('"refreshToken" must be a non-empty string');
572
576
  const s = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
573
- return s.set("refresh_token", n), be(t, e, "refresh_token", s, o);
577
+ return s.set("refresh_token", r), ve(t, e, "refresh_token", s, o);
574
578
  }
575
- const _e = /* @__PURE__ */ new WeakMap();
576
- function wt(t) {
579
+ const Se = /* @__PURE__ */ new WeakMap();
580
+ function bt(t) {
577
581
  if (!t.id_token)
578
582
  return;
579
- const e = _e.get(t);
583
+ const e = Se.get(t);
580
584
  if (!e)
581
585
  throw new TypeError('"ref" was already garbage collected or did not resolve from the proper sources');
582
586
  return e;
583
587
  }
584
- async function ve(t, e, n, o = !1, s = !1) {
585
- if (J(t), j(e), !Y(n, Response))
588
+ async function Te(t, e, r, o = !1, s = !1) {
589
+ if (j(t), J(e), !Q(r, Response))
586
590
  throw new TypeError('"response" must be an instance of Response');
587
- if (n.status !== 200) {
591
+ if (r.status !== 200) {
588
592
  let i;
589
- if (i = await kt(n))
593
+ if (i = await xt(r))
590
594
  return i;
591
595
  throw new a('"response" is not a conform Token Endpoint response');
592
596
  }
593
- ee(n);
594
- let r;
597
+ re(r);
598
+ let n;
595
599
  try {
596
- r = await n.json();
600
+ n = await r.json();
597
601
  } catch (i) {
598
602
  throw new a('failed to parse "response" body as JSON', { cause: i });
599
603
  }
600
- if (!x(r))
604
+ if (!C(n))
601
605
  throw new a('"response" body must be a top level object');
602
- if (!g(r.access_token))
606
+ if (!p(n.access_token))
603
607
  throw new a('"response" body "access_token" property must be a non-empty string');
604
- if (!g(r.token_type))
608
+ if (!p(n.token_type))
605
609
  throw new a('"response" body "token_type" property must be a non-empty string');
606
- if (r.token_type = r.token_type.toLowerCase(), r.token_type !== "dpop" && r.token_type !== "bearer")
607
- throw new v("unsupported `token_type` value");
608
- if (r.expires_in !== void 0 && (typeof r.expires_in != "number" || r.expires_in <= 0))
610
+ if (n.token_type = n.token_type.toLowerCase(), n.token_type !== "dpop" && n.token_type !== "bearer")
611
+ throw new S("unsupported `token_type` value");
612
+ if (n.expires_in !== void 0 && (typeof n.expires_in != "number" || n.expires_in <= 0))
609
613
  throw new a('"response" body "expires_in" property must be a positive number');
610
- if (!s && r.refresh_token !== void 0 && !g(r.refresh_token))
614
+ if (!s && n.refresh_token !== void 0 && !p(n.refresh_token))
611
615
  throw new a('"response" body "refresh_token" property must be a non-empty string');
612
- if (r.scope !== void 0 && typeof r.scope != "string")
616
+ if (n.scope !== void 0 && typeof n.scope != "string")
613
617
  throw new a('"response" body "scope" property must be a string');
614
618
  if (!o) {
615
- if (r.id_token !== void 0 && !g(r.id_token))
619
+ if (n.id_token !== void 0 && !p(n.id_token))
616
620
  throw new a('"response" body "id_token" property must be a non-empty string');
617
- if (r.id_token) {
618
- const { claims: i } = await Rt(r.id_token, Pt.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ee, I(e), ge(e)).then(St.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(yt.bind(void 0, t.issuer)).then(mt.bind(void 0, e.client_id));
621
+ if (n.id_token) {
622
+ const { claims: i } = await Lt(n.id_token, Ct.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ae, I(e), ye(e)).then(At.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(St.bind(void 0, t.issuer)).then(vt.bind(void 0, e.client_id));
619
623
  if (Array.isArray(i.aud) && i.aud.length !== 1 && i.azp !== e.client_id)
620
624
  throw new a('unexpected ID Token "azp" (authorized party) claim value');
621
625
  if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
622
626
  throw new a('ID Token "auth_time" (authentication time) must be a positive number');
623
- _e.set(r, i);
627
+ Se.set(n, i);
624
628
  }
625
629
  }
626
- return r;
630
+ return n;
627
631
  }
628
- async function gt(t, e, n) {
629
- return ve(t, e, n);
632
+ async function _t(t, e, r) {
633
+ return Te(t, e, r);
630
634
  }
631
- function mt(t, e) {
635
+ function vt(t, e) {
632
636
  if (Array.isArray(e.claims.aud)) {
633
637
  if (!e.claims.aud.includes(t))
634
638
  throw new a('unexpected JWT "aud" (audience) claim value');
@@ -636,29 +640,29 @@ function mt(t, e) {
636
640
  throw new a('unexpected JWT "aud" (audience) claim value');
637
641
  return e;
638
642
  }
639
- function yt(t, e) {
643
+ function St(t, e) {
640
644
  if (e.claims.iss !== t)
641
645
  throw new a('unexpected JWT "iss" (issuer) claim value');
642
646
  return e;
643
647
  }
644
- const Se = /* @__PURE__ */ new WeakSet();
645
- function bt(t) {
646
- return Se.add(t), t;
648
+ const ke = /* @__PURE__ */ new WeakSet();
649
+ function Tt(t) {
650
+ return ke.add(t), t;
647
651
  }
648
- async function _t(t, e, n, o, s, r) {
649
- if (J(t), j(e), !Se.has(n))
652
+ async function kt(t, e, r, o, s, n) {
653
+ if (j(t), J(e), !ke.has(r))
650
654
  throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
651
- if (!g(o))
655
+ if (!p(o))
652
656
  throw new TypeError('"redirectUri" must be a non-empty string');
653
- if (!g(s))
657
+ if (!p(s))
654
658
  throw new TypeError('"codeVerifier" must be a non-empty string');
655
- const i = T(n, "code");
659
+ const i = T(r, "code");
656
660
  if (!i)
657
661
  throw new a('no authorization code in "callbackParameters"');
658
- const u = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
659
- return u.set("redirect_uri", o), u.set("code_verifier", s), u.set("code", i), be(t, e, "authorization_code", u, r);
662
+ const u = new URLSearchParams(n == null ? void 0 : n.additionalParameters);
663
+ return u.set("redirect_uri", o), u.set("code_verifier", s), u.set("code", i), ve(t, e, "authorization_code", u, n);
660
664
  }
661
- const vt = {
665
+ const Et = {
662
666
  aud: "audience",
663
667
  c_hash: "code hash",
664
668
  client_id: "client id",
@@ -674,66 +678,66 @@ const vt = {
674
678
  htu: "http uri",
675
679
  cnf: "confirmation"
676
680
  };
677
- function St(t, e) {
678
- for (const n of t)
679
- if (e.claims[n] === void 0)
680
- throw new a(`JWT "${n}" (${vt[n]}) claim missing`);
681
+ function At(t, e) {
682
+ for (const r of t)
683
+ if (e.claims[r] === void 0)
684
+ throw new a(`JWT "${r}" (${Et[r]}) claim missing`);
681
685
  return e;
682
686
  }
683
- const Tt = Symbol(), B = Symbol();
684
- async function Et(t, e, n, o, s) {
685
- const r = await ve(t, e, n);
686
- if (V(r))
687
- return r;
688
- if (!g(r.id_token))
687
+ const Rt = Symbol(), G = Symbol();
688
+ async function Pt(t, e, r, o, s) {
689
+ const n = await Te(t, e, r);
690
+ if (Z(n))
691
+ return n;
692
+ if (!p(n.id_token))
689
693
  throw new a('"response" body "id_token" property must be a non-empty string');
690
- s ?? (s = e.default_max_age ?? B);
691
- const i = wt(r);
692
- if ((e.require_auth_time || s !== B) && i.auth_time === void 0)
694
+ s ?? (s = e.default_max_age ?? G);
695
+ const i = bt(n);
696
+ if ((e.require_auth_time || s !== G) && i.auth_time === void 0)
693
697
  throw new a('ID Token "auth_time" (authentication time) claim missing');
694
- if (s !== B) {
698
+ if (s !== G) {
695
699
  if (typeof s != "number" || s < 0)
696
700
  throw new TypeError('"maxAge" must be a non-negative number');
697
- const u = F() + I(e), d = ge(e);
698
- if (i.auth_time + s < u - d)
701
+ const u = M() + I(e), f = ye(e);
702
+ if (i.auth_time + s < u - f)
699
703
  throw new a("too much time has elapsed since the last End-User authentication");
700
704
  }
701
705
  switch (o) {
702
706
  case void 0:
703
- case Tt:
707
+ case Rt:
704
708
  if (i.nonce !== void 0)
705
709
  throw new a('unexpected ID Token "nonce" claim value');
706
710
  break;
707
711
  default:
708
- if (!g(o))
712
+ if (!p(o))
709
713
  throw new TypeError('"expectedNonce" must be a non-empty string');
710
714
  if (i.nonce === void 0)
711
715
  throw new a('ID Token "nonce" claim missing');
712
716
  if (i.nonce !== o)
713
717
  throw new a('unexpected ID Token "nonce" claim value');
714
718
  }
715
- return r;
719
+ return n;
716
720
  }
717
- function ee(t) {
721
+ function re(t) {
718
722
  if (t.bodyUsed)
719
723
  throw new TypeError('"response" body has been used already');
720
724
  }
721
- async function kt(t) {
725
+ async function xt(t) {
722
726
  if (t.status > 399 && t.status < 500) {
723
- ee(t);
727
+ re(t);
724
728
  try {
725
729
  const e = await t.json();
726
- if (x(e) && typeof e.error == "string" && e.error.length)
730
+ if (C(e) && typeof e.error == "string" && e.error.length)
727
731
  return e.error_description !== void 0 && typeof e.error_description != "string" && delete e.error_description, e.error_uri !== void 0 && typeof e.error_uri != "string" && delete e.error_uri, e.algs !== void 0 && typeof e.algs != "string" && delete e.algs, e.scope !== void 0 && typeof e.scope != "string" && delete e.scope, e;
728
732
  } catch {
729
733
  }
730
734
  }
731
735
  }
732
- function ce(t) {
736
+ function le(t) {
733
737
  if (typeof t.modulusLength != "number" || t.modulusLength < 2048)
734
738
  throw new a(`${t.name} modulusLength must be at least 2048 bits`);
735
739
  }
736
- function At(t) {
740
+ function Ut(t) {
737
741
  switch (t) {
738
742
  case "P-256":
739
743
  return "SHA-256";
@@ -742,18 +746,18 @@ function At(t) {
742
746
  case "P-521":
743
747
  return "SHA-512";
744
748
  default:
745
- throw new v();
749
+ throw new S();
746
750
  }
747
751
  }
748
- function Te(t) {
752
+ function Ee(t) {
749
753
  switch (t.algorithm.name) {
750
754
  case "ECDSA":
751
755
  return {
752
756
  name: t.algorithm.name,
753
- hash: At(t.algorithm.namedCurve)
757
+ hash: Ut(t.algorithm.namedCurve)
754
758
  };
755
759
  case "RSA-PSS":
756
- switch (ce(t.algorithm), t.algorithm.hash.name) {
760
+ switch (le(t.algorithm), t.algorithm.hash.name) {
757
761
  case "SHA-256":
758
762
  case "SHA-384":
759
763
  case "SHA-512":
@@ -762,255 +766,271 @@ function Te(t) {
762
766
  saltLength: parseInt(t.algorithm.hash.name.slice(-3), 10) >> 3
763
767
  };
764
768
  default:
765
- throw new v();
769
+ throw new S();
766
770
  }
767
771
  case "RSASSA-PKCS1-v1_5":
768
- return ce(t.algorithm), t.algorithm.name;
772
+ return le(t.algorithm), t.algorithm.name;
769
773
  case "Ed448":
770
774
  case "Ed25519":
771
775
  return t.algorithm.name;
772
776
  }
773
- throw new v();
774
- }
775
- const Ee = Symbol();
776
- async function Rt(t, e, n, o, s) {
777
- const { 0: r, 1: i, 2: u, length: d } = t.split(".");
778
- if (d === 5)
779
- throw new v("JWE structure JWTs are not supported");
780
- if (d !== 3)
777
+ throw new S();
778
+ }
779
+ const Ae = Symbol();
780
+ async function Lt(t, e, r, o, s) {
781
+ const { 0: n, 1: i, 2: u, length: f } = t.split(".");
782
+ if (f === 5)
783
+ throw new S("JWE structure JWTs are not supported");
784
+ if (f !== 3)
781
785
  throw new a("Invalid JWT");
782
- let p;
786
+ let m;
783
787
  try {
784
- p = JSON.parse(k(E(r)));
785
- } catch (S) {
786
- throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: S });
788
+ m = JSON.parse(A(k(n)));
789
+ } catch (P) {
790
+ throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: P });
787
791
  }
788
- if (!x(p))
792
+ if (!C(m))
789
793
  throw new a("JWT Header must be a top level object");
790
- if (e(p), p.crit !== void 0)
794
+ if (e(m), m.crit !== void 0)
791
795
  throw new a('unexpected JWT "crit" header parameter');
792
- const w = E(u);
796
+ const y = k(u);
793
797
  let b;
794
- if (n !== Ee) {
795
- b = await n(p);
796
- const S = `${r}.${i}`;
797
- if (!await crypto.subtle.verify(Te(b), b, w, k(S)))
798
+ if (r !== Ae) {
799
+ b = await r(m);
800
+ const P = `${n}.${i}`;
801
+ if (!await crypto.subtle.verify(Ee(b), b, y, A(P)))
798
802
  throw new a("JWT signature verification failed");
799
803
  }
800
- let f;
804
+ let h;
801
805
  try {
802
- f = JSON.parse(k(E(i)));
803
- } catch (S) {
804
- throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: S });
806
+ h = JSON.parse(A(k(i)));
807
+ } catch (P) {
808
+ throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: P });
805
809
  }
806
- if (!x(f))
810
+ if (!C(h))
807
811
  throw new a("JWT Payload must be a top level object");
808
- const A = F() + o;
809
- if (f.exp !== void 0) {
810
- if (typeof f.exp != "number")
812
+ const R = M() + o;
813
+ if (h.exp !== void 0) {
814
+ if (typeof h.exp != "number")
811
815
  throw new a('unexpected JWT "exp" (expiration time) claim type');
812
- if (f.exp <= A - s)
816
+ if (h.exp <= R - s)
813
817
  throw new a('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
814
818
  }
815
- if (f.iat !== void 0 && typeof f.iat != "number")
819
+ if (h.iat !== void 0 && typeof h.iat != "number")
816
820
  throw new a('unexpected JWT "iat" (issued at) claim type');
817
- if (f.iss !== void 0 && typeof f.iss != "string")
821
+ if (h.iss !== void 0 && typeof h.iss != "string")
818
822
  throw new a('unexpected JWT "iss" (issuer) claim type');
819
- if (f.nbf !== void 0) {
820
- if (typeof f.nbf != "number")
823
+ if (h.nbf !== void 0) {
824
+ if (typeof h.nbf != "number")
821
825
  throw new a('unexpected JWT "nbf" (not before) claim type');
822
- if (f.nbf > A + s)
826
+ if (h.nbf > R + s)
823
827
  throw new a('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
824
828
  }
825
- if (f.aud !== void 0 && typeof f.aud != "string" && !Array.isArray(f.aud))
829
+ if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
826
830
  throw new a('unexpected JWT "aud" (audience) claim type');
827
- return { header: p, claims: f, signature: w, key: b };
831
+ return { header: m, claims: h, signature: y, key: b };
828
832
  }
829
- function Pt(t, e, n) {
833
+ function Ct(t, e, r) {
830
834
  if (t !== void 0) {
831
- if (n.alg !== t)
835
+ if (r.alg !== t)
832
836
  throw new a('unexpected JWT "alg" header parameter');
833
837
  return;
834
838
  }
835
839
  if (Array.isArray(e)) {
836
- if (!e.includes(n.alg))
840
+ if (!e.includes(r.alg))
837
841
  throw new a('unexpected JWT "alg" header parameter');
838
842
  return;
839
843
  }
840
- if (n.alg !== "RS256")
844
+ if (r.alg !== "RS256")
841
845
  throw new a('unexpected JWT "alg" header parameter');
842
846
  }
843
847
  function T(t, e) {
844
- const { 0: n, length: o } = t.getAll(e);
848
+ const { 0: r, length: o } = t.getAll(e);
845
849
  if (o > 1)
846
850
  throw new a(`"${e}" parameter must be provided only once`);
847
- return n;
851
+ return r;
848
852
  }
849
- const Ut = Symbol(), Lt = Symbol();
850
- function Ct(t, e, n, o) {
851
- if (J(t), j(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
853
+ const It = Symbol(), jt = Symbol();
854
+ function Jt(t, e, r, o) {
855
+ if (j(t), J(e), r instanceof URL && (r = r.searchParams), !(r instanceof URLSearchParams))
852
856
  throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
853
- if (T(n, "response"))
857
+ if (T(r, "response"))
854
858
  throw new a('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
855
- const s = T(n, "iss"), r = T(n, "state");
859
+ const s = T(r, "iss"), n = T(r, "state");
856
860
  if (!s && t.authorization_response_iss_parameter_supported)
857
861
  throw new a('response parameter "iss" (issuer) missing');
858
862
  if (s && s !== t.issuer)
859
863
  throw new a('unexpected "iss" (issuer) response parameter value');
860
864
  switch (o) {
861
865
  case void 0:
862
- case Lt:
863
- if (r !== void 0)
866
+ case jt:
867
+ if (n !== void 0)
864
868
  throw new a('unexpected "state" response parameter encountered');
865
869
  break;
866
- case Ut:
870
+ case It:
867
871
  break;
868
872
  default:
869
- if (!g(o))
873
+ if (!p(o))
870
874
  throw new a('"expectedState" must be a non-empty string');
871
- if (r === void 0)
875
+ if (n === void 0)
872
876
  throw new a('response parameter "state" missing');
873
- if (r !== o)
877
+ if (n !== o)
874
878
  throw new a('unexpected "state" response parameter value');
875
879
  }
876
- const i = T(n, "error");
880
+ const i = T(r, "error");
877
881
  if (i)
878
882
  return {
879
883
  error: i,
880
- error_description: T(n, "error_description"),
881
- error_uri: T(n, "error_uri")
884
+ error_description: T(r, "error_description"),
885
+ error_uri: T(r, "error_uri")
882
886
  };
883
- const u = T(n, "id_token"), d = T(n, "token");
884
- if (u !== void 0 || d !== void 0)
885
- throw new v("implicit and hybrid flows are not supported");
886
- return bt(new URLSearchParams(n));
887
+ const u = T(r, "id_token"), f = T(r, "token");
888
+ if (u !== void 0 || f !== void 0)
889
+ throw new S("implicit and hybrid flows are not supported");
890
+ return Tt(new URLSearchParams(r));
887
891
  }
888
- function xt({
892
+ function Ot({
889
893
  handleCallback: t
890
894
  }) {
891
- const [e, n] = Ce(null), o = ze(), s = xe(!1);
892
- return Ie(() => {
893
- s.current || (s.current = !0, t().then((r) => {
894
- o(r);
895
- }).catch((r) => {
896
- D.error(r), n(r);
895
+ const [e, r] = Je(null), o = He(), s = Oe(!1);
896
+ return Ne(() => {
897
+ s.current || (s.current = !0, t().then((n) => {
898
+ o(n);
899
+ }).catch((n) => {
900
+ K.error(n), r(n);
897
901
  }));
898
- }, [o, t]), e ? /* @__PURE__ */ React.createElement(
899
- je,
902
+ }, [o, t]), e ? /* @__PURE__ */ E.jsx(
903
+ De,
900
904
  {
901
905
  category: "Error",
902
906
  title: "Authentication Error",
903
- message: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Je, { className: "mb-4" }, "Check the configuration of your authorization provider and ensure all settings such as the callback URL are configured correctly."), "An error occurred while authorizing the user.", /* @__PURE__ */ React.createElement(Ne, { code: e.toString(), language: "plain" }))
907
+ message: /* @__PURE__ */ E.jsxs(E.Fragment, { children: [
908
+ /* @__PURE__ */ E.jsx(ze, { className: "mb-4", children: "Check the configuration of your authorization provider and ensure all settings such as the callback URL are configured correctly." }),
909
+ "An error occurred while authorizing the user.",
910
+ /* @__PURE__ */ E.jsx(We, { code: e.toString(), language: "plain" })
911
+ ] })
904
912
  }
905
- ) : /* @__PURE__ */ React.createElement("div", { className: "grid h-full place-items-center" }, /* @__PURE__ */ React.createElement(Oe, null));
913
+ ) : /* @__PURE__ */ E.jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ E.jsx(Ke, {}) });
906
914
  }
907
915
  class U extends Error {
908
916
  }
909
- class ue extends U {
910
- constructor(e, n, o) {
911
- super(e, o), this.error = n;
917
+ class de extends U {
918
+ constructor(e, r, o) {
919
+ super(e, o), this.error = r;
912
920
  }
913
921
  }
914
- const q = "code-verifier";
915
- class It extends Le {
916
- constructor(e, n) {
917
- super(), this.callbackUrlPath = e, this.handleCallback = n;
922
+ const V = "code-verifier";
923
+ class Nt extends je {
924
+ constructor(e, r) {
925
+ super(), this.callbackUrlPath = e, this.handleCallback = r;
918
926
  }
919
927
  getRoutes() {
920
928
  return [
921
929
  ...super.getRoutes(),
922
930
  {
923
931
  path: this.callbackUrlPath,
924
- element: /* @__PURE__ */ React.createElement(xt, { handleCallback: this.handleCallback })
932
+ element: /* @__PURE__ */ E.jsx(Ot, { handleCallback: this.handleCallback })
925
933
  }
926
934
  ];
927
935
  }
928
936
  }
929
- class Jt {
937
+ class zt {
930
938
  constructor({
931
939
  issuer: e,
932
- audience: n,
940
+ audience: r,
933
941
  clientId: o,
934
942
  redirectToAfterSignUp: s,
935
- redirectToAfterSignIn: r,
943
+ redirectToAfterSignIn: n,
936
944
  redirectToAfterSignOut: i
937
945
  }) {
938
- this.callbackUrlPath = "/oauth/callback", this.logoutRedirectUrlPath = "/", this.signOut = async () => {
939
- N.setState({
946
+ _(this, "client");
947
+ _(this, "issuer");
948
+ _(this, "authorizationServer");
949
+ _(this, "callbackUrlPath", "/oauth/callback");
950
+ _(this, "logoutRedirectUrlPath", "/");
951
+ _(this, "onAuthorizationUrl");
952
+ _(this, "redirectToAfterSignUp");
953
+ _(this, "redirectToAfterSignIn");
954
+ _(this, "redirectToAfterSignOut");
955
+ _(this, "audience");
956
+ _(this, "signOut", async () => {
957
+ z.setState({
940
958
  isAuthenticated: !1,
941
959
  isPending: !1,
942
960
  profile: void 0
943
961
  }), sessionStorage.clear();
944
- const u = await this.getAuthServer(), d = new URL(
962
+ const e = await this.getAuthServer(), r = new URL(
945
963
  window.location.origin + this.redirectToAfterSignOut
946
964
  );
947
- d.pathname = this.logoutRedirectUrlPath;
948
- let p;
949
- u.end_session_endpoint ? (p = new URL(u.end_session_endpoint), p.searchParams.set(
965
+ r.pathname = this.logoutRedirectUrlPath;
966
+ let o;
967
+ e.end_session_endpoint ? (o = new URL(e.end_session_endpoint), o.searchParams.set(
950
968
  "post_logout_redirect_uri",
951
- d.toString()
952
- )) : p = d;
953
- }, this.handleCallback = async () => {
954
- const u = new URL(window.location.href), d = u.searchParams.get("state"), p = sessionStorage.getItem(q);
955
- if (sessionStorage.removeItem(q), !p)
969
+ r.toString()
970
+ )) : o = r;
971
+ });
972
+ _(this, "handleCallback", async () => {
973
+ const e = new URL(window.location.href), r = e.searchParams.get("state"), o = sessionStorage.getItem(V);
974
+ if (sessionStorage.removeItem(V), !o)
956
975
  throw new U("No code verifier found in state.");
957
- const w = await this.getAuthServer(), b = Ct(
958
- w,
976
+ const s = await this.getAuthServer(), n = Jt(
977
+ s,
959
978
  this.client,
960
- u.searchParams,
961
- d ?? void 0
979
+ e.searchParams,
980
+ r ?? void 0
962
981
  );
963
- if (V(b))
964
- throw D.error("Error validating OAuth response", b), new ue(
982
+ if (Z(n))
983
+ throw K.error("Error validating OAuth response", n), new de(
965
984
  "Error validating OAuth response",
966
- b
985
+ n
967
986
  );
968
- const f = new URL(u);
969
- f.pathname = this.redirectToAfterSignIn, f.search = "";
970
- const A = await _t(
971
- w,
987
+ const i = new URL(e);
988
+ i.pathname = this.redirectToAfterSignIn, i.search = "";
989
+ const u = await kt(
990
+ s,
972
991
  this.client,
973
- b,
974
- f.toString(),
975
- p
976
- ), S = await Et(
977
- w,
992
+ n,
993
+ i.toString(),
994
+ o
995
+ ), f = await Pt(
996
+ s,
978
997
  this.client,
979
- A
998
+ u
980
999
  );
981
- this.setTokensFromResponse(S);
982
- const l = await this.getAccessToken(), c = await (await dt(
983
- w,
1000
+ this.setTokensFromResponse(f);
1001
+ const m = await this.getAccessToken(), b = await (await gt(
1002
+ s,
984
1003
  this.client,
985
- l
986
- )).json(), R = {
987
- sub: c.sub,
988
- email: c.email,
989
- name: c.name,
990
- emailVerified: c.email_verified ?? !1,
991
- pictureUrl: c.picture
1004
+ m
1005
+ )).json(), h = {
1006
+ sub: b.sub,
1007
+ email: b.email,
1008
+ name: b.name,
1009
+ emailVerified: b.email_verified ?? !1,
1010
+ pictureUrl: b.picture
992
1011
  };
993
- N.setState({
1012
+ z.setState({
994
1013
  isAuthenticated: !0,
995
1014
  isPending: !1,
996
- profile: R
1015
+ profile: h
997
1016
  }), sessionStorage.setItem(
998
1017
  "profile-state",
999
- JSON.stringify(N.getState().profile)
1018
+ JSON.stringify(z.getState().profile)
1000
1019
  );
1001
- const L = sessionStorage.getItem("redirect-to") ?? "/";
1002
- return sessionStorage.removeItem("redirect-to"), L;
1003
- }, this.client = {
1020
+ const R = sessionStorage.getItem("redirect-to") ?? "/";
1021
+ return sessionStorage.removeItem("redirect-to"), R;
1022
+ });
1023
+ this.client = {
1004
1024
  client_id: o,
1005
1025
  token_endpoint_auth_method: "none"
1006
- }, this.audience = n, this.issuer = e, this.redirectToAfterSignUp = s ?? "/", this.redirectToAfterSignIn = r ?? "/", this.redirectToAfterSignOut = i ?? "/";
1026
+ }, this.audience = r, this.issuer = e, this.redirectToAfterSignUp = s ?? "/", this.redirectToAfterSignIn = n ?? "/", this.redirectToAfterSignOut = i ?? "/";
1007
1027
  }
1008
1028
  async getAuthServer() {
1009
1029
  if (!this.authorizationServer) {
1010
- const e = new URL(this.issuer), n = await Ge(e);
1011
- this.authorizationServer = await Ve(
1030
+ const e = new URL(this.issuer), r = await Qe(e);
1031
+ this.authorizationServer = await Xe(
1012
1032
  e,
1013
- n
1033
+ r
1014
1034
  );
1015
1035
  }
1016
1036
  return this.authorizationServer;
@@ -1020,17 +1040,17 @@ class Jt {
1020
1040
  * @param response
1021
1041
  */
1022
1042
  setTokensFromResponse(e) {
1023
- if (V(e))
1024
- throw D.error("Bad Token Response", e), new ue("Bad Token Response", e);
1043
+ if (Z(e))
1044
+ throw K.error("Bad Token Response", e), new de("Bad Token Response", e);
1025
1045
  if (!e.expires_in)
1026
1046
  throw new U("No expires_in in response");
1027
- const n = {
1047
+ const r = {
1028
1048
  accessToken: e.access_token,
1029
1049
  refreshToken: e.refresh_token,
1030
1050
  expiresOn: new Date(Date.now() + e.expires_in * 1e3),
1031
1051
  tokenType: e.token_type
1032
1052
  };
1033
- sessionStorage.setItem("token-state", JSON.stringify(n));
1053
+ sessionStorage.setItem("token-state", JSON.stringify(r));
1034
1054
  }
1035
1055
  async signUp({ redirectTo: e } = {}) {
1036
1056
  return this.authorize({
@@ -1045,51 +1065,51 @@ class Jt {
1045
1065
  }
1046
1066
  async authorize({
1047
1067
  redirectTo: e,
1048
- isSignUp: n = !1
1068
+ isSignUp: r = !1
1049
1069
  }) {
1050
- var p, w;
1070
+ var m, y;
1051
1071
  const o = "S256", s = await this.getAuthServer();
1052
1072
  if (!s.authorization_endpoint)
1053
1073
  throw new U("No authorization endpoint");
1054
- const r = Ye(), i = await Qe(r);
1055
- sessionStorage.setItem(q, r);
1074
+ const n = et(), i = await rt(n);
1075
+ sessionStorage.setItem(V, n);
1056
1076
  const u = new URL(
1057
1077
  s.authorization_endpoint
1058
1078
  );
1059
1079
  sessionStorage.setItem("redirect-to", e);
1060
- const d = new URL(window.location.origin);
1061
- if (d.pathname = this.callbackUrlPath, d.search = "", u.searchParams.set("client_id", this.client.client_id), u.searchParams.set("redirect_uri", d.toString()), u.searchParams.set("response_type", "code"), u.searchParams.set("scope", "openid profile email"), u.searchParams.set("code_challenge", i), u.searchParams.set(
1080
+ const f = new URL(window.location.origin);
1081
+ if (f.pathname = this.callbackUrlPath, f.search = "", u.searchParams.set("client_id", this.client.client_id), u.searchParams.set("redirect_uri", f.toString()), u.searchParams.set("response_type", "code"), u.searchParams.set("scope", "openid profile email"), u.searchParams.set("code_challenge", i), u.searchParams.set(
1062
1082
  "code_challenge_method",
1063
1083
  o
1064
- ), this.audience && u.searchParams.set("audience", this.audience), (p = this.onAuthorizationUrl) == null || p.call(this, u, {
1065
- isSignIn: !n,
1066
- isSignUp: n
1067
- }), ((w = s.code_challenge_methods_supported) == null ? void 0 : w.includes("S256")) !== !0) {
1068
- const b = Ze();
1084
+ ), this.audience && u.searchParams.set("audience", this.audience), (m = this.onAuthorizationUrl) == null || m.call(this, u, {
1085
+ isSignIn: !r,
1086
+ isSignUp: r
1087
+ }), ((y = s.code_challenge_methods_supported) == null ? void 0 : y.includes("S256")) !== !0) {
1088
+ const b = tt();
1069
1089
  u.searchParams.set("state", b);
1070
1090
  }
1071
1091
  location.href = u.href;
1072
1092
  }
1073
1093
  async getAccessToken() {
1074
- const e = await this.getAuthServer(), n = sessionStorage.getItem("token-state");
1075
- if (!n)
1094
+ const e = await this.getAuthServer(), r = sessionStorage.getItem("token-state");
1095
+ if (!r)
1076
1096
  throw new U("User is not authenticated");
1077
- const o = JSON.parse(n);
1097
+ const o = JSON.parse(r);
1078
1098
  if (o.expiresOn < /* @__PURE__ */ new Date()) {
1079
1099
  if (!o.refreshToken)
1080
1100
  return await this.signIn(), "";
1081
- const s = await pt(
1101
+ const s = await yt(
1082
1102
  e,
1083
1103
  this.client,
1084
1104
  o.refreshToken
1085
- ), r = await gt(
1105
+ ), n = await _t(
1086
1106
  e,
1087
1107
  this.client,
1088
1108
  s
1089
1109
  );
1090
- if (!r.access_token)
1110
+ if (!n.access_token)
1091
1111
  throw new U("No access token in response");
1092
- return this.setTokensFromResponse(r), r.access_token.toString();
1112
+ return this.setTokensFromResponse(n), n.access_token.toString();
1093
1113
  } else
1094
1114
  return o.accessToken;
1095
1115
  }
@@ -1097,23 +1117,23 @@ class Jt {
1097
1117
  const e = sessionStorage.getItem("profile-state");
1098
1118
  if (e)
1099
1119
  try {
1100
- const n = JSON.parse(e);
1101
- N.setState({
1120
+ const r = JSON.parse(e);
1121
+ z.setState({
1102
1122
  isAuthenticated: !0,
1103
1123
  isPending: !1,
1104
- profile: n
1124
+ profile: r
1105
1125
  });
1106
- } catch (n) {
1107
- D.error("Error parsing auth state", n);
1126
+ } catch (r) {
1127
+ K.error("Error parsing auth state", r);
1108
1128
  }
1109
1129
  }
1110
1130
  getAuthenticationPlugin() {
1111
- return new It(this.callbackUrlPath, this.handleCallback);
1131
+ return new Nt(this.callbackUrlPath, this.handleCallback);
1112
1132
  }
1113
1133
  }
1114
- const Ft = (t) => new Jt(t);
1134
+ const Yt = (t) => new zt(t);
1115
1135
  export {
1116
- Jt as OpenIDAuthenticationProvider,
1117
- Ft as default
1136
+ zt as OpenIDAuthenticationProvider,
1137
+ Yt as default
1118
1138
  };
1119
1139
  //# sourceMappingURL=zudoku.auth-openid.js.map