zudoku 0.3.1-dev.16 → 0.3.1-dev.18

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.
@@ -1,7 +1,7 @@
1
1
  var xe = Object.defineProperty;
2
2
  var Le = (t, e, n) => e in t ? xe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var m = (t, e, n) => Le(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { j as R } from "./jsx-runtime-B6kdoens.js";
3
+ var y = (t, e, n) => Le(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { j as P } from "./jsx-runtime-B6kdoens.js";
5
5
  import { c as Ce, a as Ie } from "./_commonjsHelpers-BVfed4GL.js";
6
6
  import { A as je } from "./AuthenticationPlugin-owbEUimP.js";
7
7
  import { useState as ze, useRef as Je, useEffect as Oe } from "react";
@@ -9,7 +9,7 @@ import { D as Ne } from "./DeveloperHint-BQSFXH01.js";
9
9
  import { E as De } from "./ErrorPage-PUg985n_.js";
10
10
  import { S as Ke } from "./Markdown-Chb9VIBv.js";
11
11
  import { e as We } from "./index-Yjb2PyPF.js";
12
- import { u as ie } from "./state-DsXXkBLH.js";
12
+ import { u as N } from "./state-DsXXkBLH.js";
13
13
  var fe = { exports: {} };
14
14
  (function(t) {
15
15
  (function(e, n) {
@@ -35,11 +35,11 @@ var fe = { exports: {} };
35
35
  };
36
36
  }
37
37
  }
38
- function d() {
38
+ function h() {
39
39
  console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
40
40
  }
41
- function y(l) {
42
- 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;
41
+ function m(l) {
42
+ return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && o ? h : console[l] !== void 0 ? u(console, l) : console.log !== void 0 ? u(console, "log") : e;
43
43
  }
44
44
  function b() {
45
45
  for (var l = this.getLevel(), w = 0; w < s.length; w++) {
@@ -55,13 +55,13 @@ var fe = { exports: {} };
55
55
  };
56
56
  }
57
57
  function f(l, w, c) {
58
- return y(l) || _.apply(this, arguments);
58
+ return m(l) || _.apply(this, arguments);
59
59
  }
60
- function U(l, w) {
61
- var c = this, J, M, P, v = "loglevel";
60
+ function A(l, w) {
61
+ var c = this, J, B, U, v = "loglevel";
62
62
  typeof l == "string" ? v += ":" + l : typeof l == "symbol" && (v = void 0);
63
- function Re(h) {
64
- var g = (s[h] || "silent").toUpperCase();
63
+ function Re(d) {
64
+ var g = (s[d] || "silent").toUpperCase();
65
65
  if (!(typeof window === n || !v)) {
66
66
  try {
67
67
  window.localStorage[v] = g;
@@ -74,22 +74,22 @@ var fe = { exports: {} };
74
74
  }
75
75
  }
76
76
  }
77
- function ne() {
78
- var h;
77
+ function re() {
78
+ var d;
79
79
  if (!(typeof window === n || !v)) {
80
80
  try {
81
- h = window.localStorage[v];
81
+ d = window.localStorage[v];
82
82
  } catch {
83
83
  }
84
- if (typeof h === n)
84
+ if (typeof d === n)
85
85
  try {
86
- var g = window.document.cookie, O = encodeURIComponent(v), oe = g.indexOf(O + "=");
87
- oe !== -1 && (h = /^([^;]+)/.exec(
88
- g.slice(oe + O.length + 1)
86
+ var g = window.document.cookie, O = encodeURIComponent(v), ie = g.indexOf(O + "=");
87
+ ie !== -1 && (d = /^([^;]+)/.exec(
88
+ g.slice(ie + O.length + 1)
89
89
  )[1]);
90
90
  } catch {
91
91
  }
92
- return c.levels[h] === void 0 && (h = void 0), h;
92
+ return c.levels[d] === void 0 && (d = void 0), d;
93
93
  }
94
94
  }
95
95
  function Pe() {
@@ -104,11 +104,11 @@ var fe = { exports: {} };
104
104
  }
105
105
  }
106
106
  }
107
- function x(h) {
108
- var g = h;
107
+ function L(d) {
108
+ var g = d;
109
109
  if (typeof g == "string" && c.levels[g.toUpperCase()] !== void 0 && (g = c.levels[g.toUpperCase()]), typeof g == "number" && g >= 0 && g <= c.levels.SILENT)
110
110
  return g;
111
- throw new TypeError("log.setLevel() called with invalid level: " + h);
111
+ throw new TypeError("log.setLevel() called with invalid level: " + d);
112
112
  }
113
113
  c.name = l, c.levels = {
114
114
  TRACE: 0,
@@ -118,50 +118,50 @@ var fe = { exports: {} };
118
118
  ERROR: 4,
119
119
  SILENT: 5
120
120
  }, c.methodFactory = w || f, c.getLevel = function() {
121
- return P ?? M ?? J;
122
- }, c.setLevel = function(h, g) {
123
- return P = x(h), g !== !1 && Re(P), b.call(c);
124
- }, c.setDefaultLevel = function(h) {
125
- M = x(h), ne() || c.setLevel(h, !1);
121
+ return U ?? B ?? J;
122
+ }, c.setLevel = function(d, g) {
123
+ return U = L(d), g !== !1 && Re(U), b.call(c);
124
+ }, c.setDefaultLevel = function(d) {
125
+ B = L(d), re() || c.setLevel(d, !1);
126
126
  }, c.resetLevel = function() {
127
- P = null, Pe(), b.call(c);
128
- }, c.enableAll = function(h) {
129
- c.setLevel(c.levels.TRACE, h);
130
- }, c.disableAll = function(h) {
131
- c.setLevel(c.levels.SILENT, h);
127
+ U = null, Pe(), b.call(c);
128
+ }, c.enableAll = function(d) {
129
+ c.setLevel(c.levels.TRACE, d);
130
+ }, c.disableAll = function(d) {
131
+ c.setLevel(c.levels.SILENT, d);
132
132
  }, c.rebuild = function() {
133
- if (i !== c && (J = x(i.getLevel())), b.call(c), i === c)
134
- for (var h in r)
135
- r[h].rebuild();
136
- }, J = x(
133
+ if (i !== c && (J = L(i.getLevel())), b.call(c), i === c)
134
+ for (var d in r)
135
+ r[d].rebuild();
136
+ }, J = L(
137
137
  i ? i.getLevel() : "WARN"
138
138
  );
139
- var re = ne();
140
- re != null && (P = x(re)), b.call(c);
139
+ var oe = re();
140
+ oe != null && (U = L(oe)), b.call(c);
141
141
  }
142
- i = new U(), i.getLogger = function(w) {
142
+ i = new A(), i.getLogger = function(w) {
143
143
  if (typeof w != "symbol" && typeof w != "string" || w === "")
144
144
  throw new TypeError("You must supply a name when creating a logger.");
145
145
  var c = r[w];
146
- return c || (c = r[w] = new U(
146
+ return c || (c = r[w] = new A(
147
147
  w,
148
148
  i.methodFactory
149
149
  )), c;
150
150
  };
151
- var A = typeof window !== n ? window.log : void 0;
151
+ var R = typeof window !== n ? window.log : void 0;
152
152
  return i.noConflict = function() {
153
- return typeof window !== n && window.log === i && (window.log = A), i;
153
+ return typeof window !== n && window.log === i && (window.log = R), i;
154
154
  }, i.getLoggers = function() {
155
155
  return r;
156
156
  }, i.default = i, i;
157
157
  });
158
158
  })(fe);
159
159
  var He = fe.exports;
160
- const D = /* @__PURE__ */ Ie(He);
161
- let V;
162
- var N, de;
163
- (typeof navigator > "u" || !((de = (N = navigator.userAgent) == null ? void 0 : N.startsWith) != null && de.call(N, "Mozilla/5.0 "))) && (V = "oauth4webapi/v2.11.1");
164
- function Z(t, e) {
160
+ const K = /* @__PURE__ */ Ie(He);
161
+ let Y;
162
+ var D, he;
163
+ (typeof navigator > "u" || !((he = (D = navigator.userAgent) == null ? void 0 : D.startsWith) != null && he.call(D, "Mozilla/5.0 "))) && (Y = "oauth4webapi/v2.11.1");
164
+ function Q(t, e) {
165
165
  if (t == null)
166
166
  return !1;
167
167
  try {
@@ -170,8 +170,8 @@ function Z(t, e) {
170
170
  return !1;
171
171
  }
172
172
  }
173
- const W = Symbol(), $e = Symbol(), Q = Symbol(), Fe = new TextEncoder(), Me = new TextDecoder();
174
- function E(t) {
173
+ const H = Symbol(), $e = Symbol(), X = Symbol(), Fe = new TextEncoder(), Me = new TextDecoder();
174
+ function k(t) {
175
175
  return typeof t == "string" ? Fe.encode(t) : Me.decode(t);
176
176
  }
177
177
  const se = 32768;
@@ -192,7 +192,7 @@ function qe(t) {
192
192
  throw new a("The input to be decoded is not correctly encoded.", { cause: e });
193
193
  }
194
194
  }
195
- function k(t) {
195
+ function E(t) {
196
196
  return typeof t == "string" ? qe(t) : Be(t);
197
197
  }
198
198
  class Ge {
@@ -241,7 +241,7 @@ function ge(t) {
241
241
  function Ye(t) {
242
242
  return we(t) && t.type === "public";
243
243
  }
244
- function X(t) {
244
+ function ee(t) {
245
245
  try {
246
246
  const e = t.headers.get("dpop-nonce");
247
247
  e && pe.set(new URL(t.url).origin, e);
@@ -252,16 +252,16 @@ function X(t) {
252
252
  function C(t) {
253
253
  return !(t === null || typeof t != "object" || Array.isArray(t));
254
254
  }
255
- function H(t) {
256
- Z(t, Headers) && (t = Object.fromEntries(t.entries()));
255
+ function $(t) {
256
+ Q(t, Headers) && (t = Object.fromEntries(t.entries()));
257
257
  const e = new Headers(t);
258
- if (V && !e.has("user-agent") && e.set("user-agent", V), e.has("authorization"))
258
+ if (Y && !e.has("user-agent") && e.set("user-agent", Y), e.has("authorization"))
259
259
  throw new TypeError('"options.headers" must not include the "authorization" header name');
260
260
  if (e.has("dpop"))
261
261
  throw new TypeError('"options.headers" must not include the "dpop" header name');
262
262
  return e;
263
263
  }
264
- function ee(t) {
264
+ function te(t) {
265
265
  if (typeof t == "function" && (t = t()), !(t instanceof AbortSignal))
266
266
  throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
267
267
  return t;
@@ -283,13 +283,13 @@ async function Ze(t, e) {
283
283
  default:
284
284
  throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
285
285
  }
286
- const o = H(e == null ? void 0 : e.headers);
287
- return o.set("accept", "application/json"), ((e == null ? void 0 : e[Q]) || fetch)(n.href, {
286
+ const o = $(e == null ? void 0 : e.headers);
287
+ return o.set("accept", "application/json"), ((e == null ? void 0 : e[X]) || fetch)(n.href, {
288
288
  headers: Object.fromEntries(o.entries()),
289
289
  method: "GET",
290
290
  redirect: "manual",
291
- signal: e != null && e.signal ? ee(e.signal) : null
292
- }).then(X);
291
+ signal: e != null && e.signal ? te(e.signal) : null
292
+ }).then(ee);
293
293
  }
294
294
  function p(t) {
295
295
  return typeof t == "string" && t.length !== 0;
@@ -297,11 +297,11 @@ function p(t) {
297
297
  async function Qe(t, e) {
298
298
  if (!(t instanceof URL))
299
299
  throw new TypeError('"expectedIssuer" must be an instance of URL');
300
- if (!Z(e, Response))
300
+ if (!Q(e, Response))
301
301
  throw new TypeError('"response" must be an instance of Response');
302
302
  if (e.status !== 200)
303
303
  throw new a('"response" is not a conform Authorization Server Metadata response');
304
- te(e);
304
+ ne(e);
305
305
  let n;
306
306
  try {
307
307
  n = await e.json();
@@ -316,19 +316,19 @@ async function Qe(t, e) {
316
316
  throw new a('"response" body "issuer" does not match "expectedIssuer"');
317
317
  return n;
318
318
  }
319
- function $() {
320
- return k(crypto.getRandomValues(new Uint8Array(32)));
319
+ function F() {
320
+ return E(crypto.getRandomValues(new Uint8Array(32)));
321
321
  }
322
322
  function Xe() {
323
- return $();
323
+ return F();
324
324
  }
325
325
  function et() {
326
- return $();
326
+ return F();
327
327
  }
328
328
  async function tt(t) {
329
329
  if (!p(t))
330
330
  throw new TypeError('"codeVerifier" must be a non-empty string');
331
- return k(await crypto.subtle.digest("SHA-256", E(t)));
331
+ return E(await crypto.subtle.digest("SHA-256", k(t)));
332
332
  }
333
333
  function nt(t) {
334
334
  if (t instanceof CryptoKey)
@@ -398,20 +398,20 @@ function me(t) {
398
398
  }
399
399
  }
400
400
  function I(t) {
401
- const e = t == null ? void 0 : t[W];
401
+ const e = t == null ? void 0 : t[H];
402
402
  return typeof e == "number" && Number.isFinite(e) ? e : 0;
403
403
  }
404
404
  function ye(t) {
405
405
  const e = t == null ? void 0 : t[$e];
406
406
  return typeof e == "number" && Number.isFinite(e) && Math.sign(e) !== -1 ? e : 30;
407
407
  }
408
- function F() {
408
+ function M() {
409
409
  return Math.floor(Date.now() / 1e3);
410
410
  }
411
411
  function at(t, e) {
412
- const n = F() + I(e);
412
+ const n = M() + I(e);
413
413
  return {
414
- jti: $(),
414
+ jti: F(),
415
415
  aud: [t.issuer, t.token_endpoint],
416
416
  exp: n + 60,
417
417
  iat: n,
@@ -445,7 +445,7 @@ function ce(t) {
445
445
  throw new TypeError('"client.client_secret" property must be a non-empty string');
446
446
  return t;
447
447
  }
448
- function B(t, e) {
448
+ function q(t, e) {
449
449
  if (e !== void 0)
450
450
  throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${t} client authentication method is used.`);
451
451
  }
@@ -457,11 +457,11 @@ async function ut(t, e, n, o, s) {
457
457
  switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), e.token_endpoint_auth_method) {
458
458
  case void 0:
459
459
  case "client_secret_basic": {
460
- B("client_secret_basic", s), o.set("authorization", rt(e.client_id, ce(e.client_secret)));
460
+ q("client_secret_basic", s), o.set("authorization", rt(e.client_id, ce(e.client_secret)));
461
461
  break;
462
462
  }
463
463
  case "client_secret_post": {
464
- B("client_secret_post", s), n.set("client_id", e.client_id), n.set("client_secret", ce(e.client_secret));
464
+ q("client_secret_post", s), n.set("client_id", e.client_id), n.set("client_secret", ce(e.client_secret));
465
465
  break;
466
466
  }
467
467
  case "private_key_jwt": {
@@ -476,7 +476,7 @@ async function ut(t, e, n, o, s) {
476
476
  case "tls_client_auth":
477
477
  case "self_signed_tls_client_auth":
478
478
  case "none": {
479
- ue(e.token_endpoint_auth_method, e.client_secret), B(e.token_endpoint_auth_method, s), n.set("client_id", e.client_id);
479
+ ue(e.token_endpoint_auth_method, e.client_secret), q(e.token_endpoint_auth_method, s), n.set("client_id", e.client_id);
480
480
  break;
481
481
  }
482
482
  default:
@@ -486,40 +486,40 @@ async function ut(t, e, n, o, s) {
486
486
  async function be(t, e, n) {
487
487
  if (!n.usages.includes("sign"))
488
488
  throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
489
- const o = `${k(E(JSON.stringify(t)))}.${k(E(JSON.stringify(e)))}`, s = k(await crypto.subtle.sign(Ee(n), n, E(o)));
489
+ const o = `${E(k(JSON.stringify(t)))}.${E(k(JSON.stringify(e)))}`, s = E(await crypto.subtle.sign(ke(n), n, k(o)));
490
490
  return `${o}.${s}`;
491
491
  }
492
492
  async function lt(t, e, n, o, s, r) {
493
- const { privateKey: i, publicKey: u, nonce: d = pe.get(n.origin) } = e;
493
+ const { privateKey: i, publicKey: u, nonce: h = pe.get(n.origin) } = e;
494
494
  if (!ge(i))
495
495
  throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
496
496
  if (!Ye(u))
497
497
  throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
498
- if (d !== void 0 && !p(d))
498
+ if (h !== void 0 && !p(h))
499
499
  throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
500
500
  if (!u.extractable)
501
501
  throw new TypeError('"DPoP.publicKey.extractable" must be true');
502
- const y = F() + s, b = await be({
502
+ const m = M() + s, b = await be({
503
503
  alg: me(i),
504
504
  typ: "dpop+jwt",
505
- jwk: await dt(u)
505
+ jwk: await ht(u)
506
506
  }, {
507
- iat: y,
508
- jti: $(),
507
+ iat: m,
508
+ jti: F(),
509
509
  htm: o,
510
- nonce: d,
510
+ nonce: h,
511
511
  htu: `${n.origin}${n.pathname}`,
512
- ath: r ? k(await crypto.subtle.digest("SHA-256", E(r))) : void 0
512
+ ath: r ? E(await crypto.subtle.digest("SHA-256", k(r))) : void 0
513
513
  }, i);
514
514
  t.set("dpop", b);
515
515
  }
516
- let K;
517
- async function ht(t) {
516
+ let W;
517
+ async function dt(t) {
518
518
  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 };
519
- return K.set(t, u), u;
519
+ return W.set(t, u), u;
520
520
  }
521
- async function dt(t) {
522
- return K || (K = /* @__PURE__ */ new WeakMap()), K.get(t) || ht(t);
521
+ async function ht(t) {
522
+ return W || (W = /* @__PURE__ */ new WeakMap()), W.get(t) || dt(t);
523
523
  }
524
524
  function ft(t, e, n) {
525
525
  if (typeof t != "string")
@@ -529,7 +529,7 @@ function ft(t, e, n) {
529
529
  function _e(t, e, n) {
530
530
  return ft(t[e], e);
531
531
  }
532
- function Y(t) {
532
+ function Z(t) {
533
533
  const e = t;
534
534
  return typeof e != "object" || Array.isArray(e) || e === null ? !1 : e.error !== void 0;
535
535
  }
@@ -538,35 +538,35 @@ async function pt(t, e, n, o, s, r) {
538
538
  throw new TypeError('"accessToken" must be a non-empty string');
539
539
  if (!(n instanceof URL))
540
540
  throw new TypeError('"url" must be an instance of URL');
541
- return o = H(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await lt(o, r.DPoP, n, "GET", I({ [W]: r == null ? void 0 : r[W] }), t), o.set("authorization", `DPoP ${t}`)), ((r == null ? void 0 : r[Q]) || fetch)(n.href, {
541
+ return o = $(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await lt(o, r.DPoP, n, "GET", I({ [H]: r == null ? void 0 : r[H] }), t), o.set("authorization", `DPoP ${t}`)), ((r == null ? void 0 : r[X]) || fetch)(n.href, {
542
542
  body: s,
543
543
  headers: Object.fromEntries(o.entries()),
544
544
  method: e,
545
545
  redirect: "manual",
546
- signal: r != null && r.signal ? ee(r.signal) : null
547
- }).then(X);
546
+ signal: r != null && r.signal ? te(r.signal) : null
547
+ }).then(ee);
548
548
  }
549
549
  async function wt(t, e, n, o) {
550
550
  j(t), z(e);
551
- const s = _e(t, "userinfo_endpoint"), r = H(o == null ? void 0 : o.headers);
551
+ const s = _e(t, "userinfo_endpoint"), r = $(o == null ? void 0 : o.headers);
552
552
  return e.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), pt(n, "GET", s, r, null, {
553
553
  ...o,
554
- [W]: I(e)
554
+ [H]: I(e)
555
555
  });
556
556
  }
557
557
  async function gt(t, e, n, o, s, r, i) {
558
- return await ut(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[Q]) || fetch)(o.href, {
558
+ return await ut(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[X]) || fetch)(o.href, {
559
559
  body: s,
560
560
  headers: Object.fromEntries(r.entries()),
561
561
  method: n,
562
562
  redirect: "manual",
563
- signal: i != null && i.signal ? ee(i.signal) : null
564
- }).then(X);
563
+ signal: i != null && i.signal ? te(i.signal) : null
564
+ }).then(ee);
565
565
  }
566
566
  async function ve(t, e, n, o, s) {
567
567
  const r = _e(t, "token_endpoint");
568
568
  o.set("grant_type", n);
569
- const i = H(s == null ? void 0 : s.headers);
569
+ const i = $(s == null ? void 0 : s.headers);
570
570
  return i.set("accept", "application/json"), gt(t, e, "POST", r, o, i, s);
571
571
  }
572
572
  async function mt(t, e, n, o) {
@@ -585,7 +585,7 @@ function yt(t) {
585
585
  return e;
586
586
  }
587
587
  async function Te(t, e, n, o = !1, s = !1) {
588
- if (j(t), z(e), !Z(n, Response))
588
+ if (j(t), z(e), !Q(n, Response))
589
589
  throw new TypeError('"response" must be an instance of Response');
590
590
  if (n.status !== 200) {
591
591
  let i;
@@ -593,7 +593,7 @@ async function Te(t, e, n, o = !1, s = !1) {
593
593
  return i;
594
594
  throw new a('"response" is not a conform Token Endpoint response');
595
595
  }
596
- te(n);
596
+ ne(n);
597
597
  let r;
598
598
  try {
599
599
  r = await n.json();
@@ -618,7 +618,7 @@ async function Te(t, e, n, o = !1, s = !1) {
618
618
  if (r.id_token !== void 0 && !p(r.id_token))
619
619
  throw new a('"response" body "id_token" property must be a non-empty string');
620
620
  if (r.id_token) {
621
- const { claims: i } = await xt(r.id_token, Lt.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ae, I(e), ye(e)).then(Et.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(vt.bind(void 0, t.issuer)).then(_t.bind(void 0, e.client_id));
621
+ const { claims: i } = await xt(r.id_token, Lt.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ae, I(e), ye(e)).then(kt.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(vt.bind(void 0, t.issuer)).then(_t.bind(void 0, e.client_id));
622
622
  if (Array.isArray(i.aud) && i.aud.length !== 1 && i.azp !== e.client_id)
623
623
  throw new a('unexpected ID Token "azp" (authorized party) claim value');
624
624
  if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
@@ -644,12 +644,12 @@ function vt(t, e) {
644
644
  throw new a('unexpected JWT "iss" (issuer) claim value');
645
645
  return e;
646
646
  }
647
- const ke = /* @__PURE__ */ new WeakSet();
647
+ const Ee = /* @__PURE__ */ new WeakSet();
648
648
  function St(t) {
649
- return ke.add(t), t;
649
+ return Ee.add(t), t;
650
650
  }
651
651
  async function Tt(t, e, n, o, s, r) {
652
- if (j(t), z(e), !ke.has(n))
652
+ if (j(t), z(e), !Ee.has(n))
653
653
  throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
654
654
  if (!p(o))
655
655
  throw new TypeError('"redirectUri" must be a non-empty string');
@@ -661,7 +661,7 @@ async function Tt(t, e, n, o, s, r) {
661
661
  const u = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
662
662
  return u.set("redirect_uri", o), u.set("code_verifier", s), u.set("code", i), ve(t, e, "authorization_code", u, r);
663
663
  }
664
- const kt = {
664
+ const Et = {
665
665
  aud: "audience",
666
666
  c_hash: "code hash",
667
667
  client_id: "client id",
@@ -677,28 +677,28 @@ const kt = {
677
677
  htu: "http uri",
678
678
  cnf: "confirmation"
679
679
  };
680
- function Et(t, e) {
680
+ function kt(t, e) {
681
681
  for (const n of t)
682
682
  if (e.claims[n] === void 0)
683
- throw new a(`JWT "${n}" (${kt[n]}) claim missing`);
683
+ throw new a(`JWT "${n}" (${Et[n]}) claim missing`);
684
684
  return e;
685
685
  }
686
- const At = Symbol(), q = Symbol();
686
+ const At = Symbol(), G = Symbol();
687
687
  async function Rt(t, e, n, o, s) {
688
688
  const r = await Te(t, e, n);
689
- if (Y(r))
689
+ if (Z(r))
690
690
  return r;
691
691
  if (!p(r.id_token))
692
692
  throw new a('"response" body "id_token" property must be a non-empty string');
693
- s ?? (s = e.default_max_age ?? q);
693
+ s ?? (s = e.default_max_age ?? G);
694
694
  const i = yt(r);
695
- if ((e.require_auth_time || s !== q) && i.auth_time === void 0)
695
+ if ((e.require_auth_time || s !== G) && i.auth_time === void 0)
696
696
  throw new a('ID Token "auth_time" (authentication time) claim missing');
697
- if (s !== q) {
697
+ if (s !== G) {
698
698
  if (typeof s != "number" || s < 0)
699
699
  throw new TypeError('"maxAge" must be a non-negative number');
700
- const u = F() + I(e), d = ye(e);
701
- if (i.auth_time + s < u - d)
700
+ const u = M() + I(e), h = ye(e);
701
+ if (i.auth_time + s < u - h)
702
702
  throw new a("too much time has elapsed since the last End-User authentication");
703
703
  }
704
704
  switch (o) {
@@ -717,13 +717,13 @@ async function Rt(t, e, n, o, s) {
717
717
  }
718
718
  return r;
719
719
  }
720
- function te(t) {
720
+ function ne(t) {
721
721
  if (t.bodyUsed)
722
722
  throw new TypeError('"response" body has been used already');
723
723
  }
724
724
  async function Pt(t) {
725
725
  if (t.status > 399 && t.status < 500) {
726
- te(t);
726
+ ne(t);
727
727
  try {
728
728
  const e = await t.json();
729
729
  if (C(e) && typeof e.error == "string" && e.error.length)
@@ -748,7 +748,7 @@ function Ut(t) {
748
748
  throw new S();
749
749
  }
750
750
  }
751
- function Ee(t) {
751
+ function ke(t) {
752
752
  switch (t.algorithm.name) {
753
753
  case "ECDSA":
754
754
  return {
@@ -777,42 +777,42 @@ function Ee(t) {
777
777
  }
778
778
  const Ae = Symbol();
779
779
  async function xt(t, e, n, o, s) {
780
- const { 0: r, 1: i, 2: u, length: d } = t.split(".");
781
- if (d === 5)
780
+ const { 0: r, 1: i, 2: u, length: h } = t.split(".");
781
+ if (h === 5)
782
782
  throw new S("JWE structure JWTs are not supported");
783
- if (d !== 3)
783
+ if (h !== 3)
784
784
  throw new a("Invalid JWT");
785
- let y;
785
+ let m;
786
786
  try {
787
- y = JSON.parse(E(k(r)));
788
- } catch (A) {
789
- throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: A });
787
+ m = JSON.parse(k(E(r)));
788
+ } catch (R) {
789
+ throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: R });
790
790
  }
791
- if (!C(y))
791
+ if (!C(m))
792
792
  throw new a("JWT Header must be a top level object");
793
- if (e(y), y.crit !== void 0)
793
+ if (e(m), m.crit !== void 0)
794
794
  throw new a('unexpected JWT "crit" header parameter');
795
- const b = k(u);
795
+ const b = E(u);
796
796
  let _;
797
797
  if (n !== Ae) {
798
- _ = await n(y);
799
- const A = `${r}.${i}`;
800
- if (!await crypto.subtle.verify(Ee(_), _, b, E(A)))
798
+ _ = await n(m);
799
+ const R = `${r}.${i}`;
800
+ if (!await crypto.subtle.verify(ke(_), _, b, k(R)))
801
801
  throw new a("JWT signature verification failed");
802
802
  }
803
803
  let f;
804
804
  try {
805
- f = JSON.parse(E(k(i)));
806
- } catch (A) {
807
- throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: A });
805
+ f = JSON.parse(k(E(i)));
806
+ } catch (R) {
807
+ throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: R });
808
808
  }
809
809
  if (!C(f))
810
810
  throw new a("JWT Payload must be a top level object");
811
- const U = F() + o;
811
+ const A = M() + o;
812
812
  if (f.exp !== void 0) {
813
813
  if (typeof f.exp != "number")
814
814
  throw new a('unexpected JWT "exp" (expiration time) claim type');
815
- if (f.exp <= U - s)
815
+ if (f.exp <= A - s)
816
816
  throw new a('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
817
817
  }
818
818
  if (f.iat !== void 0 && typeof f.iat != "number")
@@ -822,12 +822,12 @@ async function xt(t, e, n, o, s) {
822
822
  if (f.nbf !== void 0) {
823
823
  if (typeof f.nbf != "number")
824
824
  throw new a('unexpected JWT "nbf" (not before) claim type');
825
- if (f.nbf > U + s)
825
+ if (f.nbf > A + s)
826
826
  throw new a('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
827
827
  }
828
828
  if (f.aud !== void 0 && typeof f.aud != "string" && !Array.isArray(f.aud))
829
829
  throw new a('unexpected JWT "aud" (audience) claim type');
830
- return { header: y, claims: f, signature: b, key: _ };
830
+ return { header: m, claims: f, signature: b, key: _ };
831
831
  }
832
832
  function Lt(t, e, n) {
833
833
  if (t !== void 0) {
@@ -883,8 +883,8 @@ function jt(t, e, n, o) {
883
883
  error_description: T(n, "error_description"),
884
884
  error_uri: T(n, "error_uri")
885
885
  };
886
- const u = T(n, "id_token"), d = T(n, "token");
887
- if (u !== void 0 || d !== void 0)
886
+ const u = T(n, "id_token"), h = T(n, "token");
887
+ if (u !== void 0 || h !== void 0)
888
888
  throw new S("implicit and hybrid flows are not supported");
889
889
  return St(new URLSearchParams(n));
890
890
  }
@@ -896,29 +896,29 @@ function zt({
896
896
  s.current || (s.current = !0, t().then((r) => {
897
897
  o(r);
898
898
  }).catch((r) => {
899
- D.error(r), n(r);
899
+ K.error(r), n(r);
900
900
  }));
901
- }, [o, t]), e ? /* @__PURE__ */ R.jsx(
901
+ }, [o, t]), e ? /* @__PURE__ */ P.jsx(
902
902
  De,
903
903
  {
904
904
  category: "Error",
905
905
  title: "Authentication Error",
906
- message: /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
907
- /* @__PURE__ */ R.jsx(Ne, { className: "mb-4", children: "Check the configuration of your authorization provider and ensure all settings such as the callback URL are configured correctly." }),
906
+ message: /* @__PURE__ */ P.jsxs(P.Fragment, { children: [
907
+ /* @__PURE__ */ P.jsx(Ne, { className: "mb-4", children: "Check the configuration of your authorization provider and ensure all settings such as the callback URL are configured correctly." }),
908
908
  "An error occurred while authorizing the user.",
909
- /* @__PURE__ */ R.jsx(Ke, { code: e.toString(), language: "plain" })
909
+ /* @__PURE__ */ P.jsx(Ke, { code: e.toString(), language: "plain" })
910
910
  ] })
911
911
  }
912
- ) : /* @__PURE__ */ R.jsx("p", { children: "Loading..." });
912
+ ) : /* @__PURE__ */ P.jsx("p", { children: "Loading..." });
913
913
  }
914
- class L extends Error {
914
+ class x extends Error {
915
915
  }
916
- class he extends L {
916
+ class de extends x {
917
917
  constructor(e, n, o) {
918
918
  super(e, o), this.error = n;
919
919
  }
920
920
  }
921
- const G = "code-verifier";
921
+ const V = "code-verifier";
922
922
  class Jt extends je {
923
923
  constructor(e, n) {
924
924
  super(), this.callbackUrlPath = e, this.handleCallback = n;
@@ -928,7 +928,7 @@ class Jt extends je {
928
928
  ...super.getRoutes(),
929
929
  {
930
930
  path: this.callbackUrlPath,
931
- element: /* @__PURE__ */ R.jsx(zt, { handleCallback: this.handleCallback })
931
+ element: /* @__PURE__ */ P.jsx(zt, { handleCallback: this.handleCallback })
932
932
  }
933
933
  ];
934
934
  }
@@ -942,27 +942,26 @@ class Ot {
942
942
  clientId: r,
943
943
  redirectToAfterSignUp: i,
944
944
  redirectToAfterSignIn: u,
945
- redirectToAfterSignOut: d
945
+ redirectToAfterSignOut: h
946
946
  }) {
947
- m(this, "client");
948
- m(this, "issuer");
949
- m(this, "authorizationEndpoint");
950
- m(this, "tokenEndpoint");
951
- m(this, "authorizationServer");
952
- m(this, "tokens");
953
- m(this, "callbackUrlPath", "/oauth/callback");
954
- m(this, "logoutRedirectUrlPath", "/");
955
- m(this, "onAuthorizationUrl");
956
- m(this, "redirectToAfterSignUp");
957
- m(this, "redirectToAfterSignIn");
958
- m(this, "redirectToAfterSignOut");
959
- m(this, "audience");
960
- m(this, "signOut", async () => {
961
- ie.setState({
947
+ y(this, "client");
948
+ y(this, "issuer");
949
+ y(this, "authorizationEndpoint");
950
+ y(this, "tokenEndpoint");
951
+ y(this, "authorizationServer");
952
+ y(this, "callbackUrlPath", "/oauth/callback");
953
+ y(this, "logoutRedirectUrlPath", "/");
954
+ y(this, "onAuthorizationUrl");
955
+ y(this, "redirectToAfterSignUp");
956
+ y(this, "redirectToAfterSignIn");
957
+ y(this, "redirectToAfterSignOut");
958
+ y(this, "audience");
959
+ y(this, "signOut", async () => {
960
+ N.setState({
962
961
  isAuthenticated: !1,
963
962
  isPending: !1,
964
963
  profile: void 0
965
- }), localStorage.removeItem("auto-login");
964
+ }), sessionStorage.clear();
966
965
  const e = await this.getAuthServer(), n = new URL(
967
966
  window.location.origin + this.redirectToAfterSignOut
968
967
  );
@@ -973,18 +972,18 @@ class Ot {
973
972
  n.toString()
974
973
  )) : o = n;
975
974
  });
976
- m(this, "handleCallback", async () => {
977
- const e = new URL(window.location.href), n = e.searchParams.get("state"), o = sessionStorage.getItem(G);
978
- if (sessionStorage.removeItem(G), !o)
979
- throw new L("No code verifier found in state.");
975
+ y(this, "handleCallback", async () => {
976
+ const e = new URL(window.location.href), n = e.searchParams.get("state"), o = sessionStorage.getItem(V);
977
+ if (sessionStorage.removeItem(V), !o)
978
+ throw new x("No code verifier found in state.");
980
979
  const s = await this.getAuthServer(), r = jt(
981
980
  s,
982
981
  this.client,
983
982
  e.searchParams,
984
983
  n ?? void 0
985
984
  );
986
- if (Y(r))
987
- throw D.error("Error validating OAuth response", r), new he(
985
+ if (Z(r))
986
+ throw K.error("Error validating OAuth response", r), new de(
988
987
  "Error validating OAuth response",
989
988
  r
990
989
  );
@@ -996,16 +995,16 @@ class Ot {
996
995
  r,
997
996
  i.toString(),
998
997
  o
999
- ), d = await Rt(
998
+ ), h = await Rt(
1000
999
  s,
1001
1000
  this.client,
1002
1001
  u
1003
1002
  );
1004
- this.setTokensFromResponse(d);
1005
- const y = await this.getAccessToken(), _ = await (await wt(
1003
+ this.setTokensFromResponse(h);
1004
+ const m = await this.getAccessToken(), _ = await (await wt(
1006
1005
  s,
1007
1006
  this.client,
1008
- y
1007
+ m
1009
1008
  )).json(), f = {
1010
1009
  sub: _.sub,
1011
1010
  email: _.email,
@@ -1013,16 +1012,21 @@ class Ot {
1013
1012
  emailVerified: _.email_verified ?? !1,
1014
1013
  pictureUrl: _.picture
1015
1014
  };
1016
- return ie.setState({
1015
+ N.setState({
1017
1016
  isAuthenticated: !0,
1018
1017
  isPending: !1,
1019
1018
  profile: f
1020
- }), localStorage.setItem("auto-login", "1"), sessionStorage.getItem("redirect-to") ?? "/";
1019
+ }), sessionStorage.setItem(
1020
+ "profile-state",
1021
+ JSON.stringify(N.getState().profile)
1022
+ );
1023
+ const A = sessionStorage.getItem("redirect-to") ?? "/";
1024
+ return sessionStorage.removeItem("redirect-to"), A;
1021
1025
  });
1022
1026
  this.client = {
1023
1027
  client_id: r,
1024
1028
  token_endpoint_auth_method: "none"
1025
- }, this.audience = n, this.issuer = e, this.authorizationEndpoint = o, this.tokenEndpoint = s, this.redirectToAfterSignUp = i ?? "/", this.redirectToAfterSignIn = u ?? "/", this.redirectToAfterSignOut = d ?? "/";
1029
+ }, this.audience = n, this.issuer = e, this.authorizationEndpoint = o, this.tokenEndpoint = s, this.redirectToAfterSignUp = i ?? "/", this.redirectToAfterSignIn = u ?? "/", this.redirectToAfterSignOut = h ?? "/";
1026
1030
  }
1027
1031
  async getAuthServer() {
1028
1032
  if (!this.authorizationServer)
@@ -1047,16 +1051,17 @@ class Ot {
1047
1051
  * @param response
1048
1052
  */
1049
1053
  setTokensFromResponse(e) {
1050
- if (Y(e))
1051
- throw D.error("Bad Token Response", e), new he("Bad Token Response", e);
1054
+ if (Z(e))
1055
+ throw K.error("Bad Token Response", e), new de("Bad Token Response", e);
1052
1056
  if (!e.expires_in)
1053
- throw new L("No expires_in in response");
1054
- this.tokens = {
1057
+ throw new x("No expires_in in response");
1058
+ const n = {
1055
1059
  accessToken: e.access_token,
1056
1060
  refreshToken: e.refresh_token,
1057
1061
  expiresOn: new Date(Date.now() + e.expires_in * 1e3),
1058
1062
  tokenType: e.token_type
1059
- }, sessionStorage.setItem("openid-token", JSON.stringify(this.tokens));
1063
+ };
1064
+ sessionStorage.setItem("token-state", JSON.stringify(n));
1060
1065
  }
1061
1066
  async signUp({ redirectTo: e } = {}) {
1062
1067
  return this.authorize({
@@ -1073,21 +1078,21 @@ class Ot {
1073
1078
  redirectTo: e,
1074
1079
  isSignUp: n = !1
1075
1080
  }) {
1076
- var y, b;
1081
+ var m, b;
1077
1082
  const o = "S256", s = await this.getAuthServer();
1078
1083
  if (!s.authorization_endpoint)
1079
- throw new L("No authorization endpoint");
1084
+ throw new x("No authorization endpoint");
1080
1085
  const r = Xe(), i = await tt(r);
1081
- sessionStorage.setItem(G, r);
1086
+ sessionStorage.setItem(V, r);
1082
1087
  const u = new URL(
1083
1088
  s.authorization_endpoint
1084
1089
  );
1085
1090
  sessionStorage.setItem("redirect-to", e);
1086
- const d = new URL(window.location.origin);
1087
- 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(
1091
+ const h = new URL(window.location.origin);
1092
+ if (h.pathname = this.callbackUrlPath, h.search = "", u.searchParams.set("client_id", this.client.client_id), u.searchParams.set("redirect_uri", h.toString()), u.searchParams.set("response_type", "code"), u.searchParams.set("scope", "openid profile email"), u.searchParams.set("code_challenge", i), u.searchParams.set(
1088
1093
  "code_challenge_method",
1089
1094
  o
1090
- ), this.audience && u.searchParams.set("audience", this.audience), (y = this.onAuthorizationUrl) == null || y.call(this, u, {
1095
+ ), this.audience && u.searchParams.set("audience", this.audience), (m = this.onAuthorizationUrl) == null || m.call(this, u, {
1091
1096
  isSignIn: !n,
1092
1097
  isSignUp: n
1093
1098
  }), ((b = s.code_challenge_methods_supported) == null ? void 0 : b.includes("S256")) !== !0) {
@@ -1097,29 +1102,41 @@ class Ot {
1097
1102
  location.href = u.href;
1098
1103
  }
1099
1104
  async getAccessToken() {
1100
- const e = await this.getAuthServer();
1101
- if (!this.tokens)
1102
- throw new L("User is not authenticated");
1103
- if (this.tokens.expiresOn < /* @__PURE__ */ new Date()) {
1104
- if (!this.tokens.refreshToken)
1105
+ const e = await this.getAuthServer(), n = sessionStorage.getItem("token-state");
1106
+ if (!n)
1107
+ throw new x("User is not authenticated");
1108
+ const o = JSON.parse(n);
1109
+ if (o.expiresOn < /* @__PURE__ */ new Date()) {
1110
+ if (!o.refreshToken)
1105
1111
  return await this.signIn(), "";
1106
- const n = await mt(
1112
+ const s = await mt(
1107
1113
  e,
1108
1114
  this.client,
1109
- this.tokens.refreshToken
1110
- ), o = await bt(
1115
+ o.refreshToken
1116
+ ), r = await bt(
1111
1117
  e,
1112
1118
  this.client,
1113
- n
1119
+ s
1114
1120
  );
1115
- this.setTokensFromResponse(o);
1116
- }
1117
- return this.tokens.accessToken;
1121
+ if (!r.access_token)
1122
+ throw new x("No access token in response");
1123
+ return this.setTokensFromResponse(r), r.access_token.toString();
1124
+ } else
1125
+ return o.accessToken;
1118
1126
  }
1119
1127
  pageLoad() {
1120
- localStorage.getItem("auto-login") && (localStorage.removeItem("auto-login"), this.authorize({ redirectTo: window.location.pathname }).catch((e) => {
1121
- D.error(e);
1122
- }));
1128
+ const e = sessionStorage.getItem("profile-state");
1129
+ if (e)
1130
+ try {
1131
+ const n = JSON.parse(e);
1132
+ N.setState({
1133
+ isAuthenticated: !0,
1134
+ isPending: !1,
1135
+ profile: n
1136
+ });
1137
+ } catch (n) {
1138
+ K.error("Error parsing auth state", n);
1139
+ }
1123
1140
  }
1124
1141
  getAuthenticationPlugin() {
1125
1142
  return new Jt(this.callbackUrlPath, this.handleCallback);