@versini/auth-provider 5.1.0 → 5.1.1

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 (2) hide show
  1. package/dist/index.js +535 -924
  2. package/package.json +2 -3
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- var St = Object.defineProperty;
2
- var wt = (e, t, r) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var B = (e, t, r) => (wt(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { jsx as gt } from "react/jsx-runtime";
5
- import * as K from "react";
6
- import { useContext as Ve, useState as ze, useLayoutEffect as At, useMemo as Ee, createContext as vt, useRef as _t, useCallback as Re, useEffect as Tt } from "react";
1
+ var Ve = Object.defineProperty;
2
+ var Ye = (e, t, r) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var N = (e, t, r) => (Ye(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ import { jsx as Be } from "react/jsx-runtime";
5
+ import * as U from "react";
6
+ import { createContext as Fe, useRef as Ge, useState as qe, useCallback as le, useEffect as ze, useContext as Xe } from "react";
7
7
  /*!
8
- @versini/auth-provider v5.1.0
8
+ @versini/auth-provider v5.1.1
9
9
  © 2024 gizmette.com
10
10
  */
11
11
  try {
12
12
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
13
- version: "5.1.0",
14
- buildTime: "07/07/2024 10:25 AM EDT",
13
+ version: "5.1.1",
14
+ buildTime: "07/07/2024 10:59 AM EDT",
15
15
  homepage: "https://github.com/aversini/auth-client",
16
16
  license: "MIT"
17
17
  });
@@ -24,28 +24,28 @@ try {
24
24
  try {
25
25
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
26
26
  version: "2.11.0",
27
- buildTime: "07/07/2024 10:25 AM EDT",
27
+ buildTime: "07/07/2024 10:59 AM EDT",
28
28
  homepage: "https://github.com/aversini/auth-client",
29
29
  license: "MIT"
30
30
  });
31
31
  } catch {
32
32
  }
33
- const ie = {
33
+ const G = {
34
34
  ID_TOKEN: "id_token",
35
35
  ACCESS_TOKEN: "token",
36
36
  ID_AND_ACCESS_TOKEN: "id_token token",
37
37
  CODE: "code",
38
38
  REFRESH_TOKEN: "refresh_token"
39
- }, bt = {
39
+ }, Qe = {
40
40
  CLIENT_ID: "X-Auth-ClientId"
41
- }, k = {
41
+ }, w = {
42
42
  ALG: "RS256",
43
43
  USER_ID_KEY: "sub",
44
44
  TOKEN_ID_KEY: "__raw",
45
45
  NONCE_KEY: "_nonce",
46
46
  USERNAME_KEY: "username",
47
47
  ISSUER: "gizmette.com"
48
- }, kt = `-----BEGIN PUBLIC KEY-----
48
+ }, Ze = `-----BEGIN PUBLIC KEY-----
49
49
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
50
50
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
51
51
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -53,33 +53,33 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
53
53
  l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
54
54
  sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
55
55
  awIDAQAB
56
- -----END PUBLIC KEY-----`, ce = {
56
+ -----END PUBLIC KEY-----`, q = {
57
57
  AUTHENTICATE: "authenticate",
58
58
  CODE: "code",
59
59
  LOGOUT: "logout"
60
- }, ue = crypto, Be = (e) => e instanceof CryptoKey, G = new TextEncoder(), le = new TextDecoder();
61
- function Ct(...e) {
60
+ }, z = crypto, ve = (e) => e instanceof CryptoKey, L = new TextEncoder(), X = new TextDecoder();
61
+ function et(...e) {
62
62
  const t = e.reduce((n, { length: s }) => n + s, 0), r = new Uint8Array(t);
63
- let o = 0;
63
+ let a = 0;
64
64
  for (const n of e)
65
- r.set(n, o), o += n.length;
65
+ r.set(n, a), a += n.length;
66
66
  return r;
67
67
  }
68
- const Rt = (e) => {
68
+ const tt = (e) => {
69
69
  const t = atob(e), r = new Uint8Array(t.length);
70
- for (let o = 0; o < t.length; o++)
71
- r[o] = t.charCodeAt(o);
70
+ for (let a = 0; a < t.length; a++)
71
+ r[a] = t.charCodeAt(a);
72
72
  return r;
73
- }, ne = (e) => {
73
+ }, Y = (e) => {
74
74
  let t = e;
75
- t instanceof Uint8Array && (t = le.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
75
+ t instanceof Uint8Array && (t = X.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
76
76
  try {
77
- return Rt(t);
77
+ return tt(t);
78
78
  } catch {
79
79
  throw new TypeError("The input to be decoded is not correctly encoded.");
80
80
  }
81
81
  };
82
- class H extends Error {
82
+ class C extends Error {
83
83
  static get code() {
84
84
  return "ERR_JOSE_GENERIC";
85
85
  }
@@ -88,23 +88,23 @@ class H extends Error {
88
88
  super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
89
89
  }
90
90
  }
91
- class O extends H {
91
+ class A extends C {
92
92
  static get code() {
93
93
  return "ERR_JWT_CLAIM_VALIDATION_FAILED";
94
94
  }
95
- constructor(t, r, o = "unspecified", n = "unspecified") {
96
- super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = o, this.reason = n, this.payload = r;
95
+ constructor(t, r, a = "unspecified", n = "unspecified") {
96
+ super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = a, this.reason = n, this.payload = r;
97
97
  }
98
98
  }
99
- class Oe extends H {
99
+ class he extends C {
100
100
  static get code() {
101
101
  return "ERR_JWT_EXPIRED";
102
102
  }
103
- constructor(t, r, o = "unspecified", n = "unspecified") {
104
- super(t), this.code = "ERR_JWT_EXPIRED", this.claim = o, this.reason = n, this.payload = r;
103
+ constructor(t, r, a = "unspecified", n = "unspecified") {
104
+ super(t), this.code = "ERR_JWT_EXPIRED", this.claim = a, this.reason = n, this.payload = r;
105
105
  }
106
106
  }
107
- class Ot extends H {
107
+ class rt extends C {
108
108
  constructor() {
109
109
  super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
110
110
  }
@@ -112,14 +112,14 @@ class Ot extends H {
112
112
  return "ERR_JOSE_ALG_NOT_ALLOWED";
113
113
  }
114
114
  }
115
- let x = class extends H {
115
+ let _ = class extends C {
116
116
  constructor() {
117
117
  super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
118
118
  }
119
119
  static get code() {
120
120
  return "ERR_JOSE_NOT_SUPPORTED";
121
121
  }
122
- }, _ = class extends H {
122
+ }, f = class extends C {
123
123
  constructor() {
124
124
  super(...arguments), this.code = "ERR_JWS_INVALID";
125
125
  }
@@ -127,7 +127,7 @@ let x = class extends H {
127
127
  return "ERR_JWS_INVALID";
128
128
  }
129
129
  };
130
- class Ge extends H {
130
+ class Re extends C {
131
131
  constructor() {
132
132
  super(...arguments), this.code = "ERR_JWT_INVALID";
133
133
  }
@@ -135,7 +135,7 @@ class Ge extends H {
135
135
  return "ERR_JWT_INVALID";
136
136
  }
137
137
  }
138
- class Pt extends H {
138
+ class at extends C {
139
139
  constructor() {
140
140
  super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
141
141
  }
@@ -143,16 +143,16 @@ class Pt extends H {
143
143
  return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
144
144
  }
145
145
  }
146
- function $(e, t = "algorithm.name") {
146
+ function T(e, t = "algorithm.name") {
147
147
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
148
148
  }
149
- function q(e, t) {
149
+ function $(e, t) {
150
150
  return e.name === t;
151
151
  }
152
- function Se(e) {
152
+ function te(e) {
153
153
  return parseInt(e.name.slice(4), 10);
154
154
  }
155
- function It(e) {
155
+ function nt(e) {
156
156
  switch (e) {
157
157
  case "ES256":
158
158
  return "P-256";
@@ -164,89 +164,89 @@ function It(e) {
164
164
  throw new Error("unreachable");
165
165
  }
166
166
  }
167
- function Dt(e, t) {
167
+ function st(e, t) {
168
168
  if (t.length && !t.some((r) => e.usages.includes(r))) {
169
169
  let r = "CryptoKey does not support this operation, its usages must include ";
170
170
  if (t.length > 2) {
171
- const o = t.pop();
172
- r += `one of ${t.join(", ")}, or ${o}.`;
171
+ const a = t.pop();
172
+ r += `one of ${t.join(", ")}, or ${a}.`;
173
173
  } else
174
174
  t.length === 2 ? r += `one of ${t[0]} or ${t[1]}.` : r += `${t[0]}.`;
175
175
  throw new TypeError(r);
176
176
  }
177
177
  }
178
- function Nt(e, t, ...r) {
178
+ function ot(e, t, ...r) {
179
179
  switch (t) {
180
180
  case "HS256":
181
181
  case "HS384":
182
182
  case "HS512": {
183
- if (!q(e.algorithm, "HMAC"))
184
- throw $("HMAC");
185
- const o = parseInt(t.slice(2), 10);
186
- if (Se(e.algorithm.hash) !== o)
187
- throw $(`SHA-${o}`, "algorithm.hash");
183
+ if (!$(e.algorithm, "HMAC"))
184
+ throw T("HMAC");
185
+ const a = parseInt(t.slice(2), 10);
186
+ if (te(e.algorithm.hash) !== a)
187
+ throw T(`SHA-${a}`, "algorithm.hash");
188
188
  break;
189
189
  }
190
190
  case "RS256":
191
191
  case "RS384":
192
192
  case "RS512": {
193
- if (!q(e.algorithm, "RSASSA-PKCS1-v1_5"))
194
- throw $("RSASSA-PKCS1-v1_5");
195
- const o = parseInt(t.slice(2), 10);
196
- if (Se(e.algorithm.hash) !== o)
197
- throw $(`SHA-${o}`, "algorithm.hash");
193
+ if (!$(e.algorithm, "RSASSA-PKCS1-v1_5"))
194
+ throw T("RSASSA-PKCS1-v1_5");
195
+ const a = parseInt(t.slice(2), 10);
196
+ if (te(e.algorithm.hash) !== a)
197
+ throw T(`SHA-${a}`, "algorithm.hash");
198
198
  break;
199
199
  }
200
200
  case "PS256":
201
201
  case "PS384":
202
202
  case "PS512": {
203
- if (!q(e.algorithm, "RSA-PSS"))
204
- throw $("RSA-PSS");
205
- const o = parseInt(t.slice(2), 10);
206
- if (Se(e.algorithm.hash) !== o)
207
- throw $(`SHA-${o}`, "algorithm.hash");
203
+ if (!$(e.algorithm, "RSA-PSS"))
204
+ throw T("RSA-PSS");
205
+ const a = parseInt(t.slice(2), 10);
206
+ if (te(e.algorithm.hash) !== a)
207
+ throw T(`SHA-${a}`, "algorithm.hash");
208
208
  break;
209
209
  }
210
210
  case "EdDSA": {
211
211
  if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
212
- throw $("Ed25519 or Ed448");
212
+ throw T("Ed25519 or Ed448");
213
213
  break;
214
214
  }
215
215
  case "ES256":
216
216
  case "ES384":
217
217
  case "ES512": {
218
- if (!q(e.algorithm, "ECDSA"))
219
- throw $("ECDSA");
220
- const o = It(t);
221
- if (e.algorithm.namedCurve !== o)
222
- throw $(o, "algorithm.namedCurve");
218
+ if (!$(e.algorithm, "ECDSA"))
219
+ throw T("ECDSA");
220
+ const a = nt(t);
221
+ if (e.algorithm.namedCurve !== a)
222
+ throw T(a, "algorithm.namedCurve");
223
223
  break;
224
224
  }
225
225
  default:
226
226
  throw new TypeError("CryptoKey does not support this operation");
227
227
  }
228
- Dt(e, r);
228
+ st(e, r);
229
229
  }
230
- function qe(e, t, ...r) {
231
- var o;
230
+ function Ie(e, t, ...r) {
231
+ var a;
232
232
  if (r.length > 2) {
233
233
  const n = r.pop();
234
234
  e += `one of type ${r.join(", ")}, or ${n}.`;
235
235
  } else
236
236
  r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
237
- return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (o = t.constructor) != null && o.name && (e += ` Received an instance of ${t.constructor.name}`), e;
237
+ return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (a = t.constructor) != null && a.name && (e += ` Received an instance of ${t.constructor.name}`), e;
238
238
  }
239
- const Pe = (e, ...t) => qe("Key must be ", e, ...t);
240
- function Xe(e, t, ...r) {
241
- return qe(`Key for the ${e} algorithm must be `, t, ...r);
239
+ const fe = (e, ...t) => Ie("Key must be ", e, ...t);
240
+ function Ce(e, t, ...r) {
241
+ return Ie(`Key for the ${e} algorithm must be `, t, ...r);
242
242
  }
243
- const Qe = (e) => Be(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", se = ["CryptoKey"], $t = (...e) => {
243
+ const Pe = (e) => ve(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", F = ["CryptoKey"], it = (...e) => {
244
244
  const t = e.filter(Boolean);
245
245
  if (t.length === 0 || t.length === 1)
246
246
  return !0;
247
247
  let r;
248
- for (const o of t) {
249
- const n = Object.keys(o);
248
+ for (const a of t) {
249
+ const n = Object.keys(a);
250
250
  if (!r || r.size === 0) {
251
251
  r = new Set(n);
252
252
  continue;
@@ -259,11 +259,11 @@ const Qe = (e) => Be(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) ===
259
259
  }
260
260
  return !0;
261
261
  };
262
- function Ut(e) {
262
+ function ct(e) {
263
263
  return typeof e == "object" && e !== null;
264
264
  }
265
- function be(e) {
266
- if (!Ut(e) || Object.prototype.toString.call(e) !== "[object Object]")
265
+ function ie(e) {
266
+ if (!ct(e) || Object.prototype.toString.call(e) !== "[object Object]")
267
267
  return !1;
268
268
  if (Object.getPrototypeOf(e) === null)
269
269
  return !0;
@@ -272,14 +272,14 @@ function be(e) {
272
272
  t = Object.getPrototypeOf(t);
273
273
  return Object.getPrototypeOf(e) === t;
274
274
  }
275
- const Lt = (e, t) => {
275
+ const ut = (e, t) => {
276
276
  if (e.startsWith("RS") || e.startsWith("PS")) {
277
277
  const { modulusLength: r } = t.algorithm;
278
278
  if (typeof r != "number" || r < 2048)
279
279
  throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
280
280
  }
281
281
  };
282
- function xt(e) {
282
+ function dt(e) {
283
283
  let t, r;
284
284
  switch (e.kty) {
285
285
  case "RSA": {
@@ -304,7 +304,7 @@ function xt(e) {
304
304
  }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
305
305
  break;
306
306
  default:
307
- throw new x('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
307
+ throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
308
308
  }
309
309
  break;
310
310
  }
@@ -326,7 +326,7 @@ function xt(e) {
326
326
  t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
327
327
  break;
328
328
  default:
329
- throw new x('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
329
+ throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
330
330
  }
331
331
  break;
332
332
  }
@@ -342,83 +342,83 @@ function xt(e) {
342
342
  t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
343
343
  break;
344
344
  default:
345
- throw new x('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
345
+ throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
346
346
  }
347
347
  break;
348
348
  }
349
349
  default:
350
- throw new x('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
350
+ throw new _('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
351
351
  }
352
352
  return { algorithm: t, keyUsages: r };
353
353
  }
354
- const Ht = async (e) => {
354
+ const lt = async (e) => {
355
355
  if (!e.alg)
356
356
  throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
357
- const { algorithm: t, keyUsages: r } = xt(e), o = [
357
+ const { algorithm: t, keyUsages: r } = dt(e), a = [
358
358
  t,
359
359
  e.ext ?? !1,
360
360
  e.key_ops ?? r
361
361
  ], n = { ...e };
362
- return delete n.alg, delete n.use, ue.subtle.importKey("jwk", n, ...o);
363
- }, Ze = (e) => ne(e);
364
- let we, ge;
365
- const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", tt = async (e, t, r, o) => {
362
+ return delete n.alg, delete n.use, z.subtle.importKey("jwk", n, ...a);
363
+ }, Oe = (e) => Y(e);
364
+ let re, ae;
365
+ const De = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", Ue = async (e, t, r, a) => {
366
366
  let n = e.get(t);
367
- if (n != null && n[o])
368
- return n[o];
369
- const s = await Ht({ ...r, alg: o });
370
- return n ? n[o] = s : e.set(t, { [o]: s }), s;
371
- }, Mt = (e, t) => {
372
- if (et(e)) {
367
+ if (n != null && n[a])
368
+ return n[a];
369
+ const s = await lt({ ...r, alg: a });
370
+ return n ? n[a] = s : e.set(t, { [a]: s }), s;
371
+ }, ht = (e, t) => {
372
+ if (De(e)) {
373
373
  let r = e.export({ format: "jwk" });
374
- return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Ze(r.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), tt(ge, e, r, t));
374
+ return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Oe(r.k) : (ae || (ae = /* @__PURE__ */ new WeakMap()), Ue(ae, e, r, t));
375
375
  }
376
376
  return e;
377
- }, Kt = (e, t) => {
378
- if (et(e)) {
377
+ }, ft = (e, t) => {
378
+ if (De(e)) {
379
379
  let r = e.export({ format: "jwk" });
380
- return r.k ? Ze(r.k) : (we || (we = /* @__PURE__ */ new WeakMap()), tt(we, e, r, t));
380
+ return r.k ? Oe(r.k) : (re || (re = /* @__PURE__ */ new WeakMap()), Ue(re, e, r, t));
381
381
  }
382
382
  return e;
383
- }, jt = { normalizePublicKey: Mt, normalizePrivateKey: Kt }, L = (e, t, r = 0) => {
383
+ }, pt = { normalizePublicKey: ht, normalizePrivateKey: ft }, b = (e, t, r = 0) => {
384
384
  r === 0 && (t.unshift(t.length), t.unshift(6));
385
- const o = e.indexOf(t[0], r);
386
- if (o === -1)
385
+ const a = e.indexOf(t[0], r);
386
+ if (a === -1)
387
387
  return !1;
388
- const n = e.subarray(o, o + t.length);
389
- return n.length !== t.length ? !1 : n.every((s, a) => s === t[a]) || L(e, t, o + 1);
390
- }, Ie = (e) => {
388
+ const n = e.subarray(a, a + t.length);
389
+ return n.length !== t.length ? !1 : n.every((s, o) => s === t[o]) || b(e, t, a + 1);
390
+ }, pe = (e) => {
391
391
  switch (!0) {
392
- case L(e, [42, 134, 72, 206, 61, 3, 1, 7]):
392
+ case b(e, [42, 134, 72, 206, 61, 3, 1, 7]):
393
393
  return "P-256";
394
- case L(e, [43, 129, 4, 0, 34]):
394
+ case b(e, [43, 129, 4, 0, 34]):
395
395
  return "P-384";
396
- case L(e, [43, 129, 4, 0, 35]):
396
+ case b(e, [43, 129, 4, 0, 35]):
397
397
  return "P-521";
398
- case L(e, [43, 101, 110]):
398
+ case b(e, [43, 101, 110]):
399
399
  return "X25519";
400
- case L(e, [43, 101, 111]):
400
+ case b(e, [43, 101, 111]):
401
401
  return "X448";
402
- case L(e, [43, 101, 112]):
402
+ case b(e, [43, 101, 112]):
403
403
  return "Ed25519";
404
- case L(e, [43, 101, 113]):
404
+ case b(e, [43, 101, 113]):
405
405
  return "Ed448";
406
406
  default:
407
- throw new x("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
407
+ throw new _("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
408
408
  }
409
- }, Wt = async (e, t, r, o, n) => {
410
- let s, a;
411
- const c = new Uint8Array(atob(r.replace(e, "")).split("").map((l) => l.charCodeAt(0)));
412
- switch (o) {
409
+ }, yt = async (e, t, r, a, n) => {
410
+ let s, o;
411
+ const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
412
+ switch (a) {
413
413
  case "PS256":
414
414
  case "PS384":
415
415
  case "PS512":
416
- s = { name: "RSA-PSS", hash: `SHA-${o.slice(-3)}` }, a = ["verify"];
416
+ s = { name: "RSA-PSS", hash: `SHA-${a.slice(-3)}` }, o = ["verify"];
417
417
  break;
418
418
  case "RS256":
419
419
  case "RS384":
420
420
  case "RS512":
421
- s = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${o.slice(-3)}` }, a = ["verify"];
421
+ s = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${a.slice(-3)}` }, o = ["verify"];
422
422
  break;
423
423
  case "RSA-OAEP":
424
424
  case "RSA-OAEP-256":
@@ -426,84 +426,84 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
426
426
  case "RSA-OAEP-512":
427
427
  s = {
428
428
  name: "RSA-OAEP",
429
- hash: `SHA-${parseInt(o.slice(-3), 10) || 1}`
430
- }, a = ["encrypt", "wrapKey"];
429
+ hash: `SHA-${parseInt(a.slice(-3), 10) || 1}`
430
+ }, o = ["encrypt", "wrapKey"];
431
431
  break;
432
432
  case "ES256":
433
- s = { name: "ECDSA", namedCurve: "P-256" }, a = ["verify"];
433
+ s = { name: "ECDSA", namedCurve: "P-256" }, o = ["verify"];
434
434
  break;
435
435
  case "ES384":
436
- s = { name: "ECDSA", namedCurve: "P-384" }, a = ["verify"];
436
+ s = { name: "ECDSA", namedCurve: "P-384" }, o = ["verify"];
437
437
  break;
438
438
  case "ES512":
439
- s = { name: "ECDSA", namedCurve: "P-521" }, a = ["verify"];
439
+ s = { name: "ECDSA", namedCurve: "P-521" }, o = ["verify"];
440
440
  break;
441
441
  case "ECDH-ES":
442
442
  case "ECDH-ES+A128KW":
443
443
  case "ECDH-ES+A192KW":
444
444
  case "ECDH-ES+A256KW": {
445
- const l = Ie(c);
446
- s = l.startsWith("P-") ? { name: "ECDH", namedCurve: l } : { name: l }, a = [];
445
+ const c = pe(i);
446
+ s = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, o = [];
447
447
  break;
448
448
  }
449
449
  case "EdDSA":
450
- s = { name: Ie(c) }, a = ["verify"];
450
+ s = { name: pe(i) }, o = ["verify"];
451
451
  break;
452
452
  default:
453
- throw new x('Invalid or unsupported "alg" (Algorithm) value');
453
+ throw new _('Invalid or unsupported "alg" (Algorithm) value');
454
454
  }
455
- return ue.subtle.importKey(t, c, s, !1, a);
456
- }, Jt = (e, t, r) => Wt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
457
- async function Yt(e, t, r) {
455
+ return z.subtle.importKey(t, i, s, !1, o);
456
+ }, wt = (e, t, r) => yt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
457
+ async function mt(e, t, r) {
458
458
  if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
459
459
  throw new TypeError('"spki" must be SPKI formatted string');
460
- return Jt(e, t);
460
+ return wt(e, t);
461
461
  }
462
- const ae = (e) => e == null ? void 0 : e[Symbol.toStringTag], Ft = (e, t) => {
462
+ const B = (e) => e == null ? void 0 : e[Symbol.toStringTag], Et = (e, t) => {
463
463
  if (!(t instanceof Uint8Array)) {
464
- if (!Qe(t))
465
- throw new TypeError(Xe(e, t, ...se, "Uint8Array"));
464
+ if (!Pe(t))
465
+ throw new TypeError(Ce(e, t, ...F, "Uint8Array"));
466
466
  if (t.type !== "secret")
467
- throw new TypeError(`${ae(t)} instances for symmetric algorithms must be of type "secret"`);
467
+ throw new TypeError(`${B(t)} instances for symmetric algorithms must be of type "secret"`);
468
468
  }
469
- }, Vt = (e, t, r) => {
470
- if (!Qe(t))
471
- throw new TypeError(Xe(e, t, ...se));
469
+ }, St = (e, t, r) => {
470
+ if (!Pe(t))
471
+ throw new TypeError(Ce(e, t, ...F));
472
472
  if (t.type === "secret")
473
- throw new TypeError(`${ae(t)} instances for asymmetric algorithms must not be of type "secret"`);
473
+ throw new TypeError(`${B(t)} instances for asymmetric algorithms must not be of type "secret"`);
474
474
  if (t.algorithm && r === "verify" && t.type === "private")
475
- throw new TypeError(`${ae(t)} instances for asymmetric algorithm verifying must be of type "public"`);
475
+ throw new TypeError(`${B(t)} instances for asymmetric algorithm verifying must be of type "public"`);
476
476
  if (t.algorithm && r === "encrypt" && t.type === "private")
477
- throw new TypeError(`${ae(t)} instances for asymmetric algorithm encryption must be of type "public"`);
478
- }, zt = (e, t, r) => {
479
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? Ft(e, t) : Vt(e, t, r);
477
+ throw new TypeError(`${B(t)} instances for asymmetric algorithm encryption must be of type "public"`);
478
+ }, gt = (e, t, r) => {
479
+ e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? Et(e, t) : St(e, t, r);
480
480
  };
481
- function Bt(e, t, r, o, n) {
482
- if (n.crit !== void 0 && (o == null ? void 0 : o.crit) === void 0)
481
+ function At(e, t, r, a, n) {
482
+ if (n.crit !== void 0 && (a == null ? void 0 : a.crit) === void 0)
483
483
  throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
484
- if (!o || o.crit === void 0)
484
+ if (!a || a.crit === void 0)
485
485
  return /* @__PURE__ */ new Set();
486
- if (!Array.isArray(o.crit) || o.crit.length === 0 || o.crit.some((a) => typeof a != "string" || a.length === 0))
486
+ if (!Array.isArray(a.crit) || a.crit.length === 0 || a.crit.some((o) => typeof o != "string" || o.length === 0))
487
487
  throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
488
488
  let s;
489
489
  r !== void 0 ? s = new Map([...Object.entries(r), ...t.entries()]) : s = t;
490
- for (const a of o.crit) {
491
- if (!s.has(a))
492
- throw new x(`Extension Header Parameter "${a}" is not recognized`);
493
- if (n[a] === void 0)
494
- throw new e(`Extension Header Parameter "${a}" is missing`);
495
- if (s.get(a) && o[a] === void 0)
496
- throw new e(`Extension Header Parameter "${a}" MUST be integrity protected`);
497
- }
498
- return new Set(o.crit);
490
+ for (const o of a.crit) {
491
+ if (!s.has(o))
492
+ throw new _(`Extension Header Parameter "${o}" is not recognized`);
493
+ if (n[o] === void 0)
494
+ throw new e(`Extension Header Parameter "${o}" is missing`);
495
+ if (s.get(o) && a[o] === void 0)
496
+ throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`);
497
+ }
498
+ return new Set(a.crit);
499
499
  }
500
- const Gt = (e, t) => {
500
+ const Tt = (e, t) => {
501
501
  if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
502
502
  throw new TypeError(`"${e}" option must be an array of strings`);
503
503
  if (t)
504
504
  return new Set(t);
505
505
  };
506
- function qt(e, t) {
506
+ function kt(e, t) {
507
507
  const r = `SHA-${e.slice(-3)}`;
508
508
  switch (e) {
509
509
  case "HS256":
@@ -525,109 +525,109 @@ function qt(e, t) {
525
525
  case "EdDSA":
526
526
  return { name: t.name };
527
527
  default:
528
- throw new x(`alg ${e} is not supported either by JOSE or your javascript runtime`);
528
+ throw new _(`alg ${e} is not supported either by JOSE or your javascript runtime`);
529
529
  }
530
530
  }
531
- async function Xt(e, t, r) {
532
- if (t = await jt.normalizePublicKey(t, e), Be(t))
533
- return Nt(t, e, r), t;
531
+ async function bt(e, t, r) {
532
+ if (t = await pt.normalizePublicKey(t, e), ve(t))
533
+ return ot(t, e, r), t;
534
534
  if (t instanceof Uint8Array) {
535
535
  if (!e.startsWith("HS"))
536
- throw new TypeError(Pe(t, ...se));
537
- return ue.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
536
+ throw new TypeError(fe(t, ...F));
537
+ return z.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
538
538
  }
539
- throw new TypeError(Pe(t, ...se, "Uint8Array"));
539
+ throw new TypeError(fe(t, ...F, "Uint8Array"));
540
540
  }
541
- const Qt = async (e, t, r, o) => {
542
- const n = await Xt(e, t, "verify");
543
- Lt(e, n);
544
- const s = qt(e, n.algorithm);
541
+ const _t = async (e, t, r, a) => {
542
+ const n = await bt(e, t, "verify");
543
+ ut(e, n);
544
+ const s = kt(e, n.algorithm);
545
545
  try {
546
- return await ue.subtle.verify(s, n, r, o);
546
+ return await z.subtle.verify(s, n, r, a);
547
547
  } catch {
548
548
  return !1;
549
549
  }
550
550
  };
551
- async function Zt(e, t, r) {
552
- if (!be(e))
553
- throw new _("Flattened JWS must be an object");
551
+ async function vt(e, t, r) {
552
+ if (!ie(e))
553
+ throw new f("Flattened JWS must be an object");
554
554
  if (e.protected === void 0 && e.header === void 0)
555
- throw new _('Flattened JWS must have either of the "protected" or "header" members');
555
+ throw new f('Flattened JWS must have either of the "protected" or "header" members');
556
556
  if (e.protected !== void 0 && typeof e.protected != "string")
557
- throw new _("JWS Protected Header incorrect type");
557
+ throw new f("JWS Protected Header incorrect type");
558
558
  if (e.payload === void 0)
559
- throw new _("JWS Payload missing");
559
+ throw new f("JWS Payload missing");
560
560
  if (typeof e.signature != "string")
561
- throw new _("JWS Signature missing or incorrect type");
562
- if (e.header !== void 0 && !be(e.header))
563
- throw new _("JWS Unprotected Header incorrect type");
564
- let o = {};
561
+ throw new f("JWS Signature missing or incorrect type");
562
+ if (e.header !== void 0 && !ie(e.header))
563
+ throw new f("JWS Unprotected Header incorrect type");
564
+ let a = {};
565
565
  if (e.protected)
566
566
  try {
567
- const S = ne(e.protected);
568
- o = JSON.parse(le.decode(S));
567
+ const S = Y(e.protected);
568
+ a = JSON.parse(X.decode(S));
569
569
  } catch {
570
- throw new _("JWS Protected Header is invalid");
570
+ throw new f("JWS Protected Header is invalid");
571
571
  }
572
- if (!$t(o, e.header))
573
- throw new _("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
572
+ if (!it(a, e.header))
573
+ throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
574
574
  const n = {
575
- ...o,
575
+ ...a,
576
576
  ...e.header
577
- }, s = Bt(_, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, o, n);
578
- let a = !0;
579
- if (s.has("b64") && (a = o.b64, typeof a != "boolean"))
580
- throw new _('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
581
- const { alg: c } = n;
582
- if (typeof c != "string" || !c)
583
- throw new _('JWS "alg" (Algorithm) Header Parameter missing or invalid');
584
- const l = r && Gt("algorithms", r.algorithms);
585
- if (l && !l.has(c))
586
- throw new Ot('"alg" (Algorithm) Header Parameter value not allowed');
587
- if (a) {
577
+ }, s = At(f, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, a, n);
578
+ let o = !0;
579
+ if (s.has("b64") && (o = a.b64, typeof o != "boolean"))
580
+ throw new f('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
581
+ const { alg: i } = n;
582
+ if (typeof i != "string" || !i)
583
+ throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');
584
+ const c = r && Tt("algorithms", r.algorithms);
585
+ if (c && !c.has(i))
586
+ throw new rt('"alg" (Algorithm) Header Parameter value not allowed');
587
+ if (o) {
588
588
  if (typeof e.payload != "string")
589
- throw new _("JWS Payload must be a string");
589
+ throw new f("JWS Payload must be a string");
590
590
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
591
- throw new _("JWS Payload must be a string or an Uint8Array instance");
591
+ throw new f("JWS Payload must be a string or an Uint8Array instance");
592
592
  let d = !1;
593
- typeof t == "function" && (t = await t(o, e), d = !0), zt(c, t, "verify");
594
- const p = Ct(G.encode(e.protected ?? ""), G.encode("."), typeof e.payload == "string" ? G.encode(e.payload) : e.payload);
595
- let m;
593
+ typeof t == "function" && (t = await t(a, e), d = !0), gt(i, t, "verify");
594
+ const p = et(L.encode(e.protected ?? ""), L.encode("."), typeof e.payload == "string" ? L.encode(e.payload) : e.payload);
595
+ let y;
596
596
  try {
597
- m = ne(e.signature);
597
+ y = Y(e.signature);
598
598
  } catch {
599
- throw new _("Failed to base64url decode the signature");
599
+ throw new f("Failed to base64url decode the signature");
600
600
  }
601
- if (!await Qt(c, t, m, p))
602
- throw new Pt();
603
- let T;
604
- if (a)
601
+ if (!await _t(i, t, y, p))
602
+ throw new at();
603
+ let E;
604
+ if (o)
605
605
  try {
606
- T = ne(e.payload);
606
+ E = Y(e.payload);
607
607
  } catch {
608
- throw new _("Failed to base64url decode the payload");
608
+ throw new f("Failed to base64url decode the payload");
609
609
  }
610
610
  else
611
- typeof e.payload == "string" ? T = G.encode(e.payload) : T = e.payload;
612
- const E = { payload: T };
613
- return e.protected !== void 0 && (E.protectedHeader = o), e.header !== void 0 && (E.unprotectedHeader = e.header), d ? { ...E, key: t } : E;
611
+ typeof e.payload == "string" ? E = L.encode(e.payload) : E = e.payload;
612
+ const m = { payload: E };
613
+ return e.protected !== void 0 && (m.protectedHeader = a), e.header !== void 0 && (m.unprotectedHeader = e.header), d ? { ...m, key: t } : m;
614
614
  }
615
- async function er(e, t, r) {
616
- if (e instanceof Uint8Array && (e = le.decode(e)), typeof e != "string")
617
- throw new _("Compact JWS must be a string or Uint8Array");
618
- const { 0: o, 1: n, 2: s, length: a } = e.split(".");
619
- if (a !== 3)
620
- throw new _("Invalid Compact JWS");
621
- const c = await Zt({ payload: n, protected: o, signature: s }, t, r), l = { payload: c.payload, protectedHeader: c.protectedHeader };
622
- return typeof t == "function" ? { ...l, key: c.key } : l;
615
+ async function Rt(e, t, r) {
616
+ if (e instanceof Uint8Array && (e = X.decode(e)), typeof e != "string")
617
+ throw new f("Compact JWS must be a string or Uint8Array");
618
+ const { 0: a, 1: n, 2: s, length: o } = e.split(".");
619
+ if (o !== 3)
620
+ throw new f("Invalid Compact JWS");
621
+ const i = await vt({ payload: n, protected: a, signature: s }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
622
+ return typeof t == "function" ? { ...c, key: i.key } : c;
623
623
  }
624
- const tr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, ot = rt * 60, ke = ot * 24, rr = ke * 7, or = ke * 365.25, nr = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, De = (e) => {
625
- const t = nr.exec(e);
624
+ const It = (e) => Math.floor(e.getTime() / 1e3), He = 60, Ke = He * 60, ce = Ke * 24, Ct = ce * 7, Pt = ce * 365.25, Ot = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, ye = (e) => {
625
+ const t = Ot.exec(e);
626
626
  if (!t || t[4] && t[1])
627
627
  throw new TypeError("Invalid time period format");
628
- const r = parseFloat(t[2]), o = t[3].toLowerCase();
628
+ const r = parseFloat(t[2]), a = t[3].toLowerCase();
629
629
  let n;
630
- switch (o) {
630
+ switch (a) {
631
631
  case "sec":
632
632
  case "secs":
633
633
  case "second":
@@ -640,650 +640,262 @@ const tr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, ot = rt * 60, ke = ot
640
640
  case "min":
641
641
  case "mins":
642
642
  case "m":
643
- n = Math.round(r * rt);
643
+ n = Math.round(r * He);
644
644
  break;
645
645
  case "hour":
646
646
  case "hours":
647
647
  case "hr":
648
648
  case "hrs":
649
649
  case "h":
650
- n = Math.round(r * ot);
650
+ n = Math.round(r * Ke);
651
651
  break;
652
652
  case "day":
653
653
  case "days":
654
654
  case "d":
655
- n = Math.round(r * ke);
655
+ n = Math.round(r * ce);
656
656
  break;
657
657
  case "week":
658
658
  case "weeks":
659
659
  case "w":
660
- n = Math.round(r * rr);
660
+ n = Math.round(r * Ct);
661
661
  break;
662
662
  default:
663
- n = Math.round(r * or);
663
+ n = Math.round(r * Pt);
664
664
  break;
665
665
  }
666
666
  return t[1] === "-" || t[4] === "ago" ? -n : n;
667
- }, Ne = (e) => e.toLowerCase().replace(/^application\//, ""), ar = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, sr = (e, t, r = {}) => {
668
- let o;
667
+ }, we = (e) => e.toLowerCase().replace(/^application\//, ""), Dt = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Ut = (e, t, r = {}) => {
668
+ let a;
669
669
  try {
670
- o = JSON.parse(le.decode(t));
670
+ a = JSON.parse(X.decode(t));
671
671
  } catch {
672
672
  }
673
- if (!be(o))
674
- throw new Ge("JWT Claims Set must be a top-level JSON object");
673
+ if (!ie(a))
674
+ throw new Re("JWT Claims Set must be a top-level JSON object");
675
675
  const { typ: n } = r;
676
- if (n && (typeof e.typ != "string" || Ne(e.typ) !== Ne(n)))
677
- throw new O('unexpected "typ" JWT header value', o, "typ", "check_failed");
678
- const { requiredClaims: s = [], issuer: a, subject: c, audience: l, maxTokenAge: d } = r, p = [...s];
679
- d !== void 0 && p.push("iat"), l !== void 0 && p.push("aud"), c !== void 0 && p.push("sub"), a !== void 0 && p.push("iss");
676
+ if (n && (typeof e.typ != "string" || we(e.typ) !== we(n)))
677
+ throw new A('unexpected "typ" JWT header value', a, "typ", "check_failed");
678
+ const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: d } = r, p = [...s];
679
+ d !== void 0 && p.push("iat"), c !== void 0 && p.push("aud"), i !== void 0 && p.push("sub"), o !== void 0 && p.push("iss");
680
680
  for (const S of new Set(p.reverse()))
681
- if (!(S in o))
682
- throw new O(`missing required "${S}" claim`, o, S, "missing");
683
- if (a && !(Array.isArray(a) ? a : [a]).includes(o.iss))
684
- throw new O('unexpected "iss" claim value', o, "iss", "check_failed");
685
- if (c && o.sub !== c)
686
- throw new O('unexpected "sub" claim value', o, "sub", "check_failed");
687
- if (l && !ar(o.aud, typeof l == "string" ? [l] : l))
688
- throw new O('unexpected "aud" claim value', o, "aud", "check_failed");
689
- let m;
681
+ if (!(S in a))
682
+ throw new A(`missing required "${S}" claim`, a, S, "missing");
683
+ if (o && !(Array.isArray(o) ? o : [o]).includes(a.iss))
684
+ throw new A('unexpected "iss" claim value', a, "iss", "check_failed");
685
+ if (i && a.sub !== i)
686
+ throw new A('unexpected "sub" claim value', a, "sub", "check_failed");
687
+ if (c && !Dt(a.aud, typeof c == "string" ? [c] : c))
688
+ throw new A('unexpected "aud" claim value', a, "aud", "check_failed");
689
+ let y;
690
690
  switch (typeof r.clockTolerance) {
691
691
  case "string":
692
- m = De(r.clockTolerance);
692
+ y = ye(r.clockTolerance);
693
693
  break;
694
694
  case "number":
695
- m = r.clockTolerance;
695
+ y = r.clockTolerance;
696
696
  break;
697
697
  case "undefined":
698
- m = 0;
698
+ y = 0;
699
699
  break;
700
700
  default:
701
701
  throw new TypeError("Invalid clockTolerance option type");
702
702
  }
703
- const { currentDate: T } = r, E = tr(T || /* @__PURE__ */ new Date());
704
- if ((o.iat !== void 0 || d) && typeof o.iat != "number")
705
- throw new O('"iat" claim must be a number', o, "iat", "invalid");
706
- if (o.nbf !== void 0) {
707
- if (typeof o.nbf != "number")
708
- throw new O('"nbf" claim must be a number', o, "nbf", "invalid");
709
- if (o.nbf > E + m)
710
- throw new O('"nbf" claim timestamp check failed', o, "nbf", "check_failed");
711
- }
712
- if (o.exp !== void 0) {
713
- if (typeof o.exp != "number")
714
- throw new O('"exp" claim must be a number', o, "exp", "invalid");
715
- if (o.exp <= E - m)
716
- throw new Oe('"exp" claim timestamp check failed', o, "exp", "check_failed");
703
+ const { currentDate: E } = r, m = It(E || /* @__PURE__ */ new Date());
704
+ if ((a.iat !== void 0 || d) && typeof a.iat != "number")
705
+ throw new A('"iat" claim must be a number', a, "iat", "invalid");
706
+ if (a.nbf !== void 0) {
707
+ if (typeof a.nbf != "number")
708
+ throw new A('"nbf" claim must be a number', a, "nbf", "invalid");
709
+ if (a.nbf > m + y)
710
+ throw new A('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
711
+ }
712
+ if (a.exp !== void 0) {
713
+ if (typeof a.exp != "number")
714
+ throw new A('"exp" claim must be a number', a, "exp", "invalid");
715
+ if (a.exp <= m - y)
716
+ throw new he('"exp" claim timestamp check failed', a, "exp", "check_failed");
717
717
  }
718
718
  if (d) {
719
- const S = E - o.iat, P = typeof d == "number" ? d : De(d);
720
- if (S - m > P)
721
- throw new Oe('"iat" claim timestamp check failed (too far in the past)', o, "iat", "check_failed");
722
- if (S < 0 - m)
723
- throw new O('"iat" claim timestamp check failed (it should be in the past)', o, "iat", "check_failed");
719
+ const S = m - a.iat, Z = typeof d == "number" ? d : ye(d);
720
+ if (S - y > Z)
721
+ throw new he('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
722
+ if (S < 0 - y)
723
+ throw new A('"iat" claim timestamp check failed (it should be in the past)', a, "iat", "check_failed");
724
724
  }
725
- return o;
725
+ return a;
726
726
  };
727
- async function ir(e, t, r) {
728
- var o;
729
- const n = await er(e, t, r);
730
- if ((o = n.protectedHeader.crit) != null && o.includes("b64") && n.protectedHeader.b64 === !1)
731
- throw new Ge("JWTs MUST NOT use unencoded payload");
732
- const s = { payload: sr(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
727
+ async function Ht(e, t, r) {
728
+ var a;
729
+ const n = await Rt(e, t, r);
730
+ if ((a = n.protectedHeader.crit) != null && a.includes("b64") && n.protectedHeader.b64 === !1)
731
+ throw new Re("JWTs MUST NOT use unencoded payload");
732
+ const s = { payload: Ut(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
733
733
  return typeof t == "function" ? { ...s, key: n.key } : s;
734
734
  }
735
- const Y = async (e) => {
735
+ const H = async (e) => {
736
736
  try {
737
- const t = k.ALG, r = await Yt(kt, t);
738
- return await ir(e, r, {
739
- issuer: k.ISSUER
737
+ const t = w.ALG, r = await mt(Ze, t);
738
+ return await Ht(e, r, {
739
+ issuer: w.ISSUER
740
740
  });
741
741
  } catch {
742
742
  return;
743
743
  }
744
744
  };
745
- var A = [];
746
- for (var Ae = 0; Ae < 256; ++Ae)
747
- A.push((Ae + 256).toString(16).slice(1));
748
- function cr(e, t = 0) {
749
- return (A[e[t + 0]] + A[e[t + 1]] + A[e[t + 2]] + A[e[t + 3]] + "-" + A[e[t + 4]] + A[e[t + 5]] + "-" + A[e[t + 6]] + A[e[t + 7]] + "-" + A[e[t + 8]] + A[e[t + 9]] + "-" + A[e[t + 10]] + A[e[t + 11]] + A[e[t + 12]] + A[e[t + 13]] + A[e[t + 14]] + A[e[t + 15]]).toLowerCase();
745
+ var l = [];
746
+ for (var ne = 0; ne < 256; ++ne)
747
+ l.push((ne + 256).toString(16).slice(1));
748
+ function Kt(e, t = 0) {
749
+ return (l[e[t + 0]] + l[e[t + 1]] + l[e[t + 2]] + l[e[t + 3]] + "-" + l[e[t + 4]] + l[e[t + 5]] + "-" + l[e[t + 6]] + l[e[t + 7]] + "-" + l[e[t + 8]] + l[e[t + 9]] + "-" + l[e[t + 10]] + l[e[t + 11]] + l[e[t + 12]] + l[e[t + 13]] + l[e[t + 14]] + l[e[t + 15]]).toLowerCase();
750
750
  }
751
- var X, ur = new Uint8Array(16);
752
- function lr() {
753
- if (!X && (X = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !X))
751
+ var W, Nt = new Uint8Array(16);
752
+ function Lt() {
753
+ if (!W && (W = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !W))
754
754
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
755
- return X(ur);
755
+ return W(Nt);
756
756
  }
757
- var dr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
758
- const $e = {
759
- randomUUID: dr
757
+ var $t = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
758
+ const me = {
759
+ randomUUID: $t
760
760
  };
761
- function Ue(e, t, r) {
762
- if ($e.randomUUID && !t && !e)
763
- return $e.randomUUID();
761
+ function Ee(e, t, r) {
762
+ if (me.randomUUID && !t && !e)
763
+ return me.randomUUID();
764
764
  e = e || {};
765
- var o = e.random || (e.rng || lr)();
766
- return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, cr(o);
765
+ var a = e.random || (e.rng || Lt)();
766
+ return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Kt(a);
767
767
  }
768
- const Le = globalThis.crypto, fr = (e) => `${Ue()}${Ue()}`.slice(0, e), hr = (e) => btoa(
768
+ const Se = globalThis.crypto, Wt = (e) => `${Ee()}${Ee()}`.slice(0, e), Jt = (e) => btoa(
769
769
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
770
770
  );
771
- async function pr(e) {
772
- if (!Le.subtle)
771
+ async function xt(e) {
772
+ if (!Se.subtle)
773
773
  throw new Error(
774
774
  "crypto.subtle is available only in secure contexts (HTTPS)."
775
775
  );
776
- const t = new TextEncoder().encode(e), r = await Le.subtle.digest("SHA-256", t);
777
- return hr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
776
+ const t = new TextEncoder().encode(e), r = await Se.subtle.digest("SHA-256", t);
777
+ return Jt(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
778
778
  }
779
- async function yr(e) {
780
- const r = fr(43), o = await pr(r);
779
+ async function jt(e) {
780
+ const r = Wt(43), a = await xt(r);
781
781
  return {
782
782
  code_verifier: r,
783
- code_challenge: o
783
+ code_challenge: a
784
784
  };
785
785
  }
786
- function nt(e, t) {
786
+ function Ne(e, t) {
787
787
  window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
788
788
  }
789
- const xe = (e, t) => {
789
+ const ge = (e, t) => {
790
790
  const r = JSON.stringify(
791
791
  typeof t == "function" ? t() : t
792
792
  );
793
- window.localStorage.setItem(e, r), nt(e, r);
794
- }, mr = (e) => {
795
- window.localStorage.removeItem(e), nt(e, null);
796
- }, He = (e) => window.localStorage.getItem(e), Er = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
797
- function Q({
793
+ window.localStorage.setItem(e, r), Ne(e, r);
794
+ }, Mt = (e) => {
795
+ window.localStorage.removeItem(e), Ne(e, null);
796
+ }, Ae = (e) => window.localStorage.getItem(e), Vt = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
797
+ function J({
798
798
  key: e,
799
799
  initialValue: t
800
800
  }) {
801
- const r = () => He(e), o = K.useSyncExternalStore(
802
- Er,
801
+ const r = () => Ae(e), a = U.useSyncExternalStore(
802
+ Vt,
803
803
  r
804
- ), n = K.useCallback(
805
- (c) => {
804
+ ), n = U.useCallback(
805
+ (i) => {
806
806
  try {
807
- const l = typeof c == "function" ? c(JSON.parse(o)) : c;
808
- l == null ? mr(e) : xe(e, l);
809
- } catch (l) {
810
- console.warn(l);
807
+ const c = typeof i == "function" ? i(JSON.parse(a)) : i;
808
+ c == null ? Mt(e) : ge(e, c);
809
+ } catch (c) {
810
+ console.warn(c);
811
811
  }
812
812
  },
813
- [e, o]
814
- ), s = K.useCallback(() => {
813
+ [e, a]
814
+ ), s = U.useCallback(() => {
815
815
  n(t);
816
- }, [t, n]), a = K.useCallback(() => {
816
+ }, [t, n]), o = U.useCallback(() => {
817
817
  n(null);
818
818
  }, [n]);
819
- return K.useEffect(() => {
819
+ return U.useEffect(() => {
820
820
  try {
821
- He(e) === null && typeof t < "u" && xe(e, t);
822
- } catch (c) {
823
- console.warn(c);
824
- }
825
- }, [e, t]), [o ? JSON.parse(o) : null, n, s, a];
826
- }
827
- /*!
828
- * cookie
829
- * Copyright(c) 2012-2014 Roman Shtylman
830
- * Copyright(c) 2015 Douglas Christopher Wilson
831
- * MIT Licensed
832
- */
833
- var at = wr, Me = gr, Sr = Object.prototype.toString, Z = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
834
- function wr(e, t) {
835
- if (typeof e != "string")
836
- throw new TypeError("argument str must be a string");
837
- for (var r = {}, o = t || {}, n = o.decode || Ar, s = 0; s < e.length; ) {
838
- var a = e.indexOf("=", s);
839
- if (a === -1)
840
- break;
841
- var c = e.indexOf(";", s);
842
- if (c === -1)
843
- c = e.length;
844
- else if (c < a) {
845
- s = e.lastIndexOf(";", a - 1) + 1;
846
- continue;
847
- }
848
- var l = e.slice(s, a).trim();
849
- if (r[l] === void 0) {
850
- var d = e.slice(a + 1, c).trim();
851
- d.charCodeAt(0) === 34 && (d = d.slice(1, -1)), r[l] = Tr(d, n);
852
- }
853
- s = c + 1;
854
- }
855
- return r;
856
- }
857
- function gr(e, t, r) {
858
- var o = r || {}, n = o.encode || vr;
859
- if (typeof n != "function")
860
- throw new TypeError("option encode is invalid");
861
- if (!Z.test(e))
862
- throw new TypeError("argument name is invalid");
863
- var s = n(t);
864
- if (s && !Z.test(s))
865
- throw new TypeError("argument val is invalid");
866
- var a = e + "=" + s;
867
- if (o.maxAge != null) {
868
- var c = o.maxAge - 0;
869
- if (isNaN(c) || !isFinite(c))
870
- throw new TypeError("option maxAge is invalid");
871
- a += "; Max-Age=" + Math.floor(c);
872
- }
873
- if (o.domain) {
874
- if (!Z.test(o.domain))
875
- throw new TypeError("option domain is invalid");
876
- a += "; Domain=" + o.domain;
877
- }
878
- if (o.path) {
879
- if (!Z.test(o.path))
880
- throw new TypeError("option path is invalid");
881
- a += "; Path=" + o.path;
882
- }
883
- if (o.expires) {
884
- var l = o.expires;
885
- if (!_r(l) || isNaN(l.valueOf()))
886
- throw new TypeError("option expires is invalid");
887
- a += "; Expires=" + l.toUTCString();
888
- }
889
- if (o.httpOnly && (a += "; HttpOnly"), o.secure && (a += "; Secure"), o.partitioned && (a += "; Partitioned"), o.priority) {
890
- var d = typeof o.priority == "string" ? o.priority.toLowerCase() : o.priority;
891
- switch (d) {
892
- case "low":
893
- a += "; Priority=Low";
894
- break;
895
- case "medium":
896
- a += "; Priority=Medium";
897
- break;
898
- case "high":
899
- a += "; Priority=High";
900
- break;
901
- default:
902
- throw new TypeError("option priority is invalid");
903
- }
904
- }
905
- if (o.sameSite) {
906
- var p = typeof o.sameSite == "string" ? o.sameSite.toLowerCase() : o.sameSite;
907
- switch (p) {
908
- case !0:
909
- a += "; SameSite=Strict";
910
- break;
911
- case "lax":
912
- a += "; SameSite=Lax";
913
- break;
914
- case "strict":
915
- a += "; SameSite=Strict";
916
- break;
917
- case "none":
918
- a += "; SameSite=None";
919
- break;
920
- default:
921
- throw new TypeError("option sameSite is invalid");
922
- }
923
- }
924
- return a;
925
- }
926
- function Ar(e) {
927
- return e.indexOf("%") !== -1 ? decodeURIComponent(e) : e;
928
- }
929
- function vr(e) {
930
- return encodeURIComponent(e);
931
- }
932
- function _r(e) {
933
- return Sr.call(e) === "[object Date]" || e instanceof Date;
934
- }
935
- function Tr(e, t) {
936
- try {
937
- return t(e);
938
- } catch {
939
- return e;
940
- }
941
- }
942
- function br() {
943
- const e = typeof global > "u" ? void 0 : global.TEST_HAS_DOCUMENT_COOKIE;
944
- return typeof e == "boolean" ? e : typeof document == "object" && typeof document.cookie == "string";
945
- }
946
- function kr(e) {
947
- return typeof e == "string" ? at(e) : typeof e == "object" && e !== null ? e : {};
948
- }
949
- function ve(e, t = {}) {
950
- const r = Cr(e);
951
- if (!t.doNotParse)
952
- try {
953
- return JSON.parse(r);
954
- } catch {
955
- }
956
- return e;
957
- }
958
- function Cr(e) {
959
- return e && e[0] === "j" && e[1] === ":" ? e.substr(2) : e;
960
- }
961
- class Rr {
962
- constructor(t, r = {}) {
963
- this.changeListeners = [], this.HAS_DOCUMENT_COOKIE = !1, this.update = () => {
964
- if (!this.HAS_DOCUMENT_COOKIE)
965
- return;
966
- const n = this.cookies;
967
- this.cookies = at(document.cookie), this._checkChanges(n);
968
- };
969
- const o = typeof document > "u" ? "" : document.cookie;
970
- this.cookies = kr(t || o), this.defaultSetOptions = r, this.HAS_DOCUMENT_COOKIE = br();
971
- }
972
- _emitChange(t) {
973
- for (let r = 0; r < this.changeListeners.length; ++r)
974
- this.changeListeners[r](t);
975
- }
976
- _checkChanges(t) {
977
- new Set(Object.keys(t).concat(Object.keys(this.cookies))).forEach((o) => {
978
- t[o] !== this.cookies[o] && this._emitChange({
979
- name: o,
980
- value: ve(this.cookies[o])
981
- });
982
- });
983
- }
984
- _startPolling() {
985
- this.pollingInterval = setInterval(this.update, 300);
986
- }
987
- _stopPolling() {
988
- this.pollingInterval && clearInterval(this.pollingInterval);
989
- }
990
- get(t, r = {}) {
991
- return r.doNotUpdate || this.update(), ve(this.cookies[t], r);
992
- }
993
- getAll(t = {}) {
994
- t.doNotUpdate || this.update();
995
- const r = {};
996
- for (let o in this.cookies)
997
- r[o] = ve(this.cookies[o], t);
998
- return r;
999
- }
1000
- set(t, r, o) {
1001
- o ? o = Object.assign(Object.assign({}, this.defaultSetOptions), o) : o = this.defaultSetOptions;
1002
- const n = typeof r == "string" ? r : JSON.stringify(r);
1003
- this.cookies = Object.assign(Object.assign({}, this.cookies), { [t]: n }), this.HAS_DOCUMENT_COOKIE && (document.cookie = Me(t, n, o)), this._emitChange({ name: t, value: r, options: o });
1004
- }
1005
- remove(t, r) {
1006
- const o = r = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), r), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 });
1007
- this.cookies = Object.assign({}, this.cookies), delete this.cookies[t], this.HAS_DOCUMENT_COOKIE && (document.cookie = Me(t, "", o)), this._emitChange({ name: t, value: void 0, options: r });
1008
- }
1009
- addChangeListener(t) {
1010
- this.changeListeners.push(t), this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1 && (typeof window == "object" && "cookieStore" in window ? window.cookieStore.addEventListener("change", this.update) : this._startPolling());
1011
- }
1012
- removeChangeListener(t) {
1013
- const r = this.changeListeners.indexOf(t);
1014
- r >= 0 && this.changeListeners.splice(r, 1), this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0 && (typeof window == "object" && "cookieStore" in window ? window.cookieStore.removeEventListener("change", this.update) : this._stopPolling());
1015
- }
1016
- }
1017
- const Or = K.createContext(new Rr());
1018
- var f = {};
1019
- /** @license React v16.13.1
1020
- * react-is.production.min.js
1021
- *
1022
- * Copyright (c) Facebook, Inc. and its affiliates.
1023
- *
1024
- * This source code is licensed under the MIT license found in the
1025
- * LICENSE file in the root directory of this source tree.
1026
- */
1027
- var Ke;
1028
- function Pr() {
1029
- if (Ke)
1030
- return f;
1031
- Ke = 1;
1032
- var e = typeof Symbol == "function" && Symbol.for, t = e ? Symbol.for("react.element") : 60103, r = e ? Symbol.for("react.portal") : 60106, o = e ? Symbol.for("react.fragment") : 60107, n = e ? Symbol.for("react.strict_mode") : 60108, s = e ? Symbol.for("react.profiler") : 60114, a = e ? Symbol.for("react.provider") : 60109, c = e ? Symbol.for("react.context") : 60110, l = e ? Symbol.for("react.async_mode") : 60111, d = e ? Symbol.for("react.concurrent_mode") : 60111, p = e ? Symbol.for("react.forward_ref") : 60112, m = e ? Symbol.for("react.suspense") : 60113, T = e ? Symbol.for("react.suspense_list") : 60120, E = e ? Symbol.for("react.memo") : 60115, S = e ? Symbol.for("react.lazy") : 60116, P = e ? Symbol.for("react.block") : 60121, j = e ? Symbol.for("react.fundamental") : 60117, W = e ? Symbol.for("react.responder") : 60118, M = e ? Symbol.for("react.scope") : 60119;
1033
- function g(i) {
1034
- if (typeof i == "object" && i !== null) {
1035
- var C = i.$$typeof;
1036
- switch (C) {
1037
- case t:
1038
- switch (i = i.type, i) {
1039
- case l:
1040
- case d:
1041
- case o:
1042
- case s:
1043
- case n:
1044
- case m:
1045
- return i;
1046
- default:
1047
- switch (i = i && i.$$typeof, i) {
1048
- case c:
1049
- case p:
1050
- case S:
1051
- case E:
1052
- case a:
1053
- return i;
1054
- default:
1055
- return C;
1056
- }
1057
- }
1058
- case r:
1059
- return C;
1060
- }
821
+ Ae(e) === null && typeof t < "u" && ge(e, t);
822
+ } catch (i) {
823
+ console.warn(i);
1061
824
  }
1062
- }
1063
- function w(i) {
1064
- return g(i) === d;
1065
- }
1066
- return f.AsyncMode = l, f.ConcurrentMode = d, f.ContextConsumer = c, f.ContextProvider = a, f.Element = t, f.ForwardRef = p, f.Fragment = o, f.Lazy = S, f.Memo = E, f.Portal = r, f.Profiler = s, f.StrictMode = n, f.Suspense = m, f.isAsyncMode = function(i) {
1067
- return w(i) || g(i) === l;
1068
- }, f.isConcurrentMode = w, f.isContextConsumer = function(i) {
1069
- return g(i) === c;
1070
- }, f.isContextProvider = function(i) {
1071
- return g(i) === a;
1072
- }, f.isElement = function(i) {
1073
- return typeof i == "object" && i !== null && i.$$typeof === t;
1074
- }, f.isForwardRef = function(i) {
1075
- return g(i) === p;
1076
- }, f.isFragment = function(i) {
1077
- return g(i) === o;
1078
- }, f.isLazy = function(i) {
1079
- return g(i) === S;
1080
- }, f.isMemo = function(i) {
1081
- return g(i) === E;
1082
- }, f.isPortal = function(i) {
1083
- return g(i) === r;
1084
- }, f.isProfiler = function(i) {
1085
- return g(i) === s;
1086
- }, f.isStrictMode = function(i) {
1087
- return g(i) === n;
1088
- }, f.isSuspense = function(i) {
1089
- return g(i) === m;
1090
- }, f.isValidElementType = function(i) {
1091
- return typeof i == "string" || typeof i == "function" || i === o || i === d || i === s || i === n || i === m || i === T || typeof i == "object" && i !== null && (i.$$typeof === S || i.$$typeof === E || i.$$typeof === a || i.$$typeof === c || i.$$typeof === p || i.$$typeof === j || i.$$typeof === W || i.$$typeof === M || i.$$typeof === P);
1092
- }, f.typeOf = g, f;
825
+ }, [e, t]), [a ? JSON.parse(a) : null, n, s, o];
1093
826
  }
1094
- var h = {};
1095
- /** @license React v16.13.1
1096
- * react-is.development.js
1097
- *
1098
- * Copyright (c) Facebook, Inc. and its affiliates.
1099
- *
1100
- * This source code is licensed under the MIT license found in the
1101
- * LICENSE file in the root directory of this source tree.
1102
- */
1103
- var je;
1104
- function Ir() {
1105
- return je || (je = 1, process.env.NODE_ENV !== "production" && function() {
1106
- var e = typeof Symbol == "function" && Symbol.for, t = e ? Symbol.for("react.element") : 60103, r = e ? Symbol.for("react.portal") : 60106, o = e ? Symbol.for("react.fragment") : 60107, n = e ? Symbol.for("react.strict_mode") : 60108, s = e ? Symbol.for("react.profiler") : 60114, a = e ? Symbol.for("react.provider") : 60109, c = e ? Symbol.for("react.context") : 60110, l = e ? Symbol.for("react.async_mode") : 60111, d = e ? Symbol.for("react.concurrent_mode") : 60111, p = e ? Symbol.for("react.forward_ref") : 60112, m = e ? Symbol.for("react.suspense") : 60113, T = e ? Symbol.for("react.suspense_list") : 60120, E = e ? Symbol.for("react.memo") : 60115, S = e ? Symbol.for("react.lazy") : 60116, P = e ? Symbol.for("react.block") : 60121, j = e ? Symbol.for("react.fundamental") : 60117, W = e ? Symbol.for("react.responder") : 60118, M = e ? Symbol.for("react.scope") : 60119;
1107
- function g(u) {
1108
- return typeof u == "string" || typeof u == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1109
- u === o || u === d || u === s || u === n || u === m || u === T || typeof u == "object" && u !== null && (u.$$typeof === S || u.$$typeof === E || u.$$typeof === a || u.$$typeof === c || u.$$typeof === p || u.$$typeof === j || u.$$typeof === W || u.$$typeof === M || u.$$typeof === P);
1110
- }
1111
- function w(u) {
1112
- if (typeof u == "object" && u !== null) {
1113
- var me = u.$$typeof;
1114
- switch (me) {
1115
- case t:
1116
- var z = u.type;
1117
- switch (z) {
1118
- case l:
1119
- case d:
1120
- case o:
1121
- case s:
1122
- case n:
1123
- case m:
1124
- return z;
1125
- default:
1126
- var Ce = z && z.$$typeof;
1127
- switch (Ce) {
1128
- case c:
1129
- case p:
1130
- case S:
1131
- case E:
1132
- case a:
1133
- return Ce;
1134
- default:
1135
- return me;
1136
- }
1137
- }
1138
- case r:
1139
- return me;
1140
- }
1141
- }
1142
- }
1143
- var i = l, C = d, I = c, fe = a, he = t, pe = p, ye = o, y = S, R = E, b = r, D = s, U = n, J = m, F = !1;
1144
- function V(u) {
1145
- return F || (F = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), N(u) || w(u) === l;
1146
- }
1147
- function N(u) {
1148
- return w(u) === d;
1149
- }
1150
- function it(u) {
1151
- return w(u) === c;
1152
- }
1153
- function ct(u) {
1154
- return w(u) === a;
1155
- }
1156
- function ut(u) {
1157
- return typeof u == "object" && u !== null && u.$$typeof === t;
1158
- }
1159
- function lt(u) {
1160
- return w(u) === p;
1161
- }
1162
- function dt(u) {
1163
- return w(u) === o;
1164
- }
1165
- function ft(u) {
1166
- return w(u) === S;
1167
- }
1168
- function ht(u) {
1169
- return w(u) === E;
1170
- }
1171
- function pt(u) {
1172
- return w(u) === r;
1173
- }
1174
- function yt(u) {
1175
- return w(u) === s;
1176
- }
1177
- function mt(u) {
1178
- return w(u) === n;
1179
- }
1180
- function Et(u) {
1181
- return w(u) === m;
1182
- }
1183
- h.AsyncMode = i, h.ConcurrentMode = C, h.ContextConsumer = I, h.ContextProvider = fe, h.Element = he, h.ForwardRef = pe, h.Fragment = ye, h.Lazy = y, h.Memo = R, h.Portal = b, h.Profiler = D, h.StrictMode = U, h.Suspense = J, h.isAsyncMode = V, h.isConcurrentMode = N, h.isContextConsumer = it, h.isContextProvider = ct, h.isElement = ut, h.isForwardRef = lt, h.isFragment = dt, h.isLazy = ft, h.isMemo = ht, h.isPortal = pt, h.isProfiler = yt, h.isStrictMode = mt, h.isSuspense = Et, h.isValidElementType = g, h.typeOf = w;
1184
- }()), h;
1185
- }
1186
- process.env.NODE_ENV === "production" ? Pr() : Ir();
1187
- function Dr() {
1188
- return typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
1189
- }
1190
- function Nr(e) {
1191
- const t = Ve(Or);
1192
- if (!t)
1193
- throw new Error("Missing <CookiesProvider>");
1194
- const [r, o] = ze(() => t.getAll({ doNotUpdate: !0 }));
1195
- Dr() && At(() => {
1196
- function c() {
1197
- const l = t.getAll({
1198
- doNotUpdate: !0
1199
- });
1200
- $r(e || null, l, r) && o(l);
1201
- }
1202
- return t.addChangeListener(c), () => {
1203
- t.removeChangeListener(c);
1204
- };
1205
- }, [t, r]);
1206
- const n = Ee(() => t.set.bind(t), [t]), s = Ee(() => t.remove.bind(t), [t]), a = Ee(() => t.update.bind(t), [t]);
1207
- return [r, n, s, a];
827
+ var h = [];
828
+ for (var se = 0; se < 256; ++se)
829
+ h.push((se + 256).toString(16).slice(1));
830
+ function Yt(e, t = 0) {
831
+ return (h[e[t + 0]] + h[e[t + 1]] + h[e[t + 2]] + h[e[t + 3]] + "-" + h[e[t + 4]] + h[e[t + 5]] + "-" + h[e[t + 6]] + h[e[t + 7]] + "-" + h[e[t + 8]] + h[e[t + 9]] + "-" + h[e[t + 10]] + h[e[t + 11]] + h[e[t + 12]] + h[e[t + 13]] + h[e[t + 14]] + h[e[t + 15]]).toLowerCase();
1208
832
  }
1209
- function $r(e, t, r) {
1210
- if (!e)
1211
- return !0;
1212
- for (let o of e)
1213
- if (t[o] !== r[o])
1214
- return !0;
1215
- return !1;
1216
- }
1217
- var v = [];
1218
- for (var _e = 0; _e < 256; ++_e)
1219
- v.push((_e + 256).toString(16).slice(1));
1220
- function Ur(e, t = 0) {
1221
- return (v[e[t + 0]] + v[e[t + 1]] + v[e[t + 2]] + v[e[t + 3]] + "-" + v[e[t + 4]] + v[e[t + 5]] + "-" + v[e[t + 6]] + v[e[t + 7]] + "-" + v[e[t + 8]] + v[e[t + 9]] + "-" + v[e[t + 10]] + v[e[t + 11]] + v[e[t + 12]] + v[e[t + 13]] + v[e[t + 14]] + v[e[t + 15]]).toLowerCase();
1222
- }
1223
- var ee, Lr = new Uint8Array(16);
1224
- function xr() {
1225
- if (!ee && (ee = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ee))
833
+ var x, Bt = new Uint8Array(16);
834
+ function Ft() {
835
+ if (!x && (x = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !x))
1226
836
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1227
- return ee(Lr);
837
+ return x(Bt);
1228
838
  }
1229
- var Hr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1230
- const We = {
1231
- randomUUID: Hr
839
+ var Gt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
840
+ const Te = {
841
+ randomUUID: Gt
1232
842
  };
1233
- function Mr(e, t, r) {
1234
- if (We.randomUUID && !t && !e)
1235
- return We.randomUUID();
843
+ function qt(e, t, r) {
844
+ if (Te.randomUUID && !t && !e)
845
+ return Te.randomUUID();
1236
846
  e = e || {};
1237
- var o = e.random || (e.rng || xr)();
1238
- return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Ur(o);
847
+ var a = e.random || (e.rng || Ft)();
848
+ return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Yt(a);
1239
849
  }
1240
- const te = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Kr = "Your session has been successfully terminated.", Je = "Login failed. Please try again.", Te = "Error getting access token, please re-authenticate.", jr = "You forgot to wrap your component in <AuthProvider>.", Ye = {
850
+ const j = "Oops! It looks like your session has expired. For your security, please log in again to continue.", zt = "Your session has been successfully terminated.", ke = "Login failed. Please try again.", oe = "Error getting access token, please re-authenticate.", Xt = "You forgot to wrap your component in <AuthProvider>.", be = {
1241
851
  dev: "https://auth.gizmette.local.com:3003",
1242
852
  prod: "https://mylogin.gizmette.com"
1243
- }, re = "@@auth@@", Wr = process.env.NODE_ENV === "production", Jr = !Wr, de = async ({
853
+ }, M = "@@auth@@", Qt = process.env.NODE_ENV === "production", Zt = !Qt, Q = async ({
1244
854
  type: e,
1245
855
  clientId: t,
1246
856
  params: r = {}
1247
857
  }) => {
1248
858
  try {
1249
- const o = await fetch(
1250
- Jr ? `${Ye.dev}/${e}` : `${Ye.prod}/${e}`,
859
+ const a = await fetch(
860
+ Zt ? `${be.dev}/${e}` : `${be.prod}/${e}`,
1251
861
  {
1252
862
  credentials: "include",
1253
863
  method: "POST",
1254
864
  headers: {
1255
865
  "Content-Type": "application/json",
1256
- [bt.CLIENT_ID]: `${t}`
866
+ [Qe.CLIENT_ID]: `${t}`
1257
867
  },
1258
868
  body: JSON.stringify(r)
1259
869
  }
1260
870
  );
1261
- if (o.status !== 200)
1262
- return { status: o.status, data: [] };
1263
- const { data: n, errors: s } = await o.json();
871
+ if (a.status !== 200)
872
+ return { status: a.status, data: [] };
873
+ const { data: n, errors: s } = await a.json();
1264
874
  return {
1265
- status: o.status,
875
+ status: a.status,
1266
876
  data: n,
1267
877
  errors: s
1268
878
  };
1269
- } catch (o) {
1270
- return console.error(o), { status: 500, data: [] };
879
+ } catch (a) {
880
+ return console.error(a), { status: 500, data: [] };
1271
881
  }
1272
- }, Yr = async ({
882
+ }, er = async ({
1273
883
  idToken: e,
1274
884
  accessToken: t,
1275
885
  refreshToken: r,
1276
- clientId: o
886
+ clientId: a,
887
+ domain: n
1277
888
  }) => {
1278
889
  try {
1279
890
  return {
1280
- status: (await de({
1281
- type: ce.LOGOUT,
1282
- clientId: o,
891
+ status: (await Q({
892
+ type: q.LOGOUT,
893
+ clientId: a,
1283
894
  params: {
1284
895
  idToken: e,
1285
896
  accessToken: t,
1286
- refreshToken: r
897
+ refreshToken: r,
898
+ domain: n
1287
899
  }
1288
900
  })).status === 200
1289
901
  };
@@ -1292,35 +904,37 @@ const te = "Oops! It looks like your session has expired. For your security, ple
1292
904
  status: !1
1293
905
  };
1294
906
  }
1295
- }, Fe = async ({
907
+ }, _e = async ({
1296
908
  username: e,
1297
909
  password: t,
1298
910
  clientId: r,
1299
- nonce: o,
911
+ nonce: a,
1300
912
  type: n,
1301
913
  sessionExpiration: s,
1302
- code: a,
1303
- code_verifier: c
914
+ code: o,
915
+ code_verifier: i,
916
+ domain: c
1304
917
  }) => {
1305
918
  try {
1306
- const l = await de({
1307
- type: ce.AUTHENTICATE,
919
+ const d = await Q({
920
+ type: q.AUTHENTICATE,
1308
921
  clientId: r,
1309
922
  params: {
1310
- type: n || ie.ID_AND_ACCESS_TOKEN,
923
+ type: n || G.ID_AND_ACCESS_TOKEN,
1311
924
  username: e,
1312
925
  password: t,
1313
926
  sessionExpiration: s,
1314
- nonce: o,
1315
- code: a,
1316
- code_verifier: c
927
+ nonce: a,
928
+ code: o,
929
+ code_verifier: i,
930
+ domain: c
1317
931
  }
1318
- }), d = await Y(l.data.idToken);
1319
- return d && d.payload[k.USER_ID_KEY] !== "" && d.payload[k.NONCE_KEY] === o ? {
1320
- idToken: l.data.idToken,
1321
- accessToken: l.data.accessToken,
1322
- refreshToken: l.data.refreshToken,
1323
- userId: d.payload[k.USER_ID_KEY],
932
+ }), p = await H(d.data.idToken);
933
+ return p && p.payload[w.USER_ID_KEY] !== "" && p.payload[w.NONCE_KEY] === a ? {
934
+ idToken: d.data.idToken,
935
+ accessToken: d.data.accessToken,
936
+ refreshToken: d.data.refreshToken,
937
+ userId: p.payload[w.USER_ID_KEY],
1324
938
  status: !0
1325
939
  } : {
1326
940
  status: !1
@@ -1330,24 +944,24 @@ const te = "Oops! It looks like your session has expired. For your security, ple
1330
944
  status: !1
1331
945
  };
1332
946
  }
1333
- }, Fr = async ({
947
+ }, tr = async ({
1334
948
  nonce: e,
1335
949
  clientId: t,
1336
950
  code_challenge: r
1337
951
  }) => {
1338
952
  try {
1339
- const o = await de({
1340
- type: ce.CODE,
953
+ const a = await Q({
954
+ type: q.CODE,
1341
955
  clientId: t,
1342
956
  params: {
1343
- type: ie.CODE,
957
+ type: G.CODE,
1344
958
  nonce: e,
1345
959
  code_challenge: r
1346
960
  }
1347
961
  });
1348
- return o.data.code ? {
962
+ return a.data.code ? {
1349
963
  status: !0,
1350
- code: o.data.code
964
+ code: a.data.code
1351
965
  } : {
1352
966
  status: !1
1353
967
  };
@@ -1356,29 +970,31 @@ const te = "Oops! It looks like your session has expired. For your security, ple
1356
970
  status: !1
1357
971
  };
1358
972
  }
1359
- }, Vr = async ({
973
+ }, rr = async ({
1360
974
  clientId: e,
1361
975
  userId: t,
1362
976
  nonce: r,
1363
- refreshToken: o,
1364
- accessToken: n
977
+ refreshToken: a,
978
+ accessToken: n,
979
+ domain: s
1365
980
  }) => {
1366
981
  try {
1367
- const s = await de({
1368
- type: ce.AUTHENTICATE,
982
+ const o = await Q({
983
+ type: q.AUTHENTICATE,
1369
984
  clientId: e,
1370
985
  params: {
1371
- type: ie.REFRESH_TOKEN,
986
+ type: G.REFRESH_TOKEN,
1372
987
  userId: t,
1373
988
  nonce: r,
1374
- refreshToken: o,
1375
- accessToken: n
989
+ refreshToken: a,
990
+ accessToken: n,
991
+ domain: s
1376
992
  }
1377
- }), a = await Y(s.data.accessToken);
1378
- return a && a.payload[k.USER_ID_KEY] !== "" && a.payload[k.NONCE_KEY] === r ? {
1379
- accessToken: s.data.accessToken,
1380
- refreshToken: s.data.refreshToken,
1381
- userId: a.payload[k.USER_ID_KEY],
993
+ }), i = await H(o.data.accessToken);
994
+ return i && i.payload[w.USER_ID_KEY] !== "" && i.payload[w.NONCE_KEY] === r ? {
995
+ accessToken: o.data.accessToken,
996
+ refreshToken: o.data.refreshToken,
997
+ userId: i.payload[w.USER_ID_KEY],
1382
998
  status: !0
1383
999
  } : {
1384
1000
  status: !1
@@ -1389,22 +1005,24 @@ const te = "Oops! It looks like your session has expired. For your security, ple
1389
1005
  };
1390
1006
  }
1391
1007
  };
1392
- class zr {
1008
+ class ar {
1393
1009
  constructor(t = null, r = null) {
1394
- B(this, "refreshTokenPromise", null);
1395
- B(this, "accessToken");
1396
- B(this, "refreshToken");
1010
+ N(this, "refreshTokenPromise", null);
1011
+ N(this, "accessToken");
1012
+ N(this, "refreshToken");
1397
1013
  this.accessToken = t || "", this.refreshToken = r || "";
1398
1014
  }
1399
1015
  async refreshtoken({
1400
1016
  clientId: t,
1401
1017
  userId: r,
1402
- nonce: o
1018
+ nonce: a,
1019
+ domain: n
1403
1020
  }) {
1404
1021
  this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
1405
1022
  clientId: t,
1406
1023
  userId: r,
1407
- nonce: o
1024
+ nonce: a,
1025
+ domain: n
1408
1026
  }));
1409
1027
  try {
1410
1028
  return await this.refreshTokenPromise;
@@ -1415,21 +1033,23 @@ class zr {
1415
1033
  async _refreshToken({
1416
1034
  clientId: t,
1417
1035
  userId: r,
1418
- nonce: o
1036
+ nonce: a,
1037
+ domain: n
1419
1038
  }) {
1420
- const n = await Y(this.refreshToken);
1421
- if (n && n.payload[k.USER_ID_KEY] !== "") {
1422
- const s = await Vr({
1039
+ const s = await H(this.refreshToken);
1040
+ if (s && s.payload[w.USER_ID_KEY] !== "") {
1041
+ const o = await rr({
1423
1042
  clientId: t,
1424
1043
  userId: r,
1425
- nonce: o,
1044
+ nonce: a,
1426
1045
  refreshToken: this.refreshToken,
1427
- accessToken: this.accessToken
1046
+ accessToken: this.accessToken,
1047
+ domain: n
1428
1048
  });
1429
- return s.status ? (this.accessToken = s.accessToken, this.refreshToken = s.refreshToken, {
1049
+ return o.status ? (this.accessToken = o.accessToken, this.refreshToken = o.refreshToken, {
1430
1050
  status: "success",
1431
- newAccessToken: s.accessToken,
1432
- newRefreshToken: s.refreshToken
1051
+ newAccessToken: o.accessToken,
1052
+ newRefreshToken: o.refreshToken
1433
1053
  }) : {
1434
1054
  status: "failure"
1435
1055
  };
@@ -1439,191 +1059,182 @@ class zr {
1439
1059
  };
1440
1060
  }
1441
1061
  }
1442
- const oe = () => {
1443
- throw new Error(jr);
1444
- }, st = vt({
1062
+ const V = () => {
1063
+ throw new Error(Xt);
1064
+ }, Le = Fe({
1445
1065
  isAuthenticated: !1,
1446
1066
  isLoading: !1,
1447
- login: oe,
1448
- logout: oe,
1449
- getAccessToken: oe,
1450
- getIdToken: oe,
1067
+ login: V,
1068
+ logout: V,
1069
+ getAccessToken: V,
1070
+ getIdToken: V,
1451
1071
  logoutReason: ""
1452
- }), Zr = ({
1072
+ }), ur = ({
1453
1073
  children: e,
1454
1074
  sessionExpiration: t,
1455
1075
  clientId: r,
1456
- domain: o
1076
+ domain: a = ""
1457
1077
  }) => {
1458
- const n = _t(!1), [, s, a] = Nr([`auth.${r}`]), [c, l, , d] = Q({
1459
- key: `${re}::${r}::@@user@@`
1460
- }), [p, m, , T] = Q({
1461
- key: `${re}::${r}::@@access@@`
1462
- }), [E, S, , P] = Q(
1078
+ const n = Ge(!1), [s, o, , i] = J({
1079
+ key: `${M}::${r}::@@user@@`
1080
+ }), [c, d, , p] = J({
1081
+ key: `${M}::${r}::@@access@@`
1082
+ }), [y, E, , m] = J(
1463
1083
  {
1464
- key: `${re}::${r}::@@refresh@@`
1084
+ key: `${M}::${r}::@@refresh@@`
1465
1085
  }
1466
- ), [j, W, , M] = Q({
1467
- key: `${re}::${r}::@@nonce@@`
1468
- }), g = new zr(p, E), [w, i] = ze({
1086
+ ), [S, Z, , ue] = J({
1087
+ key: `${M}::${r}::@@nonce@@`
1088
+ }), $e = new ar(c, y), [P, v] = qe({
1469
1089
  isLoading: !0,
1470
1090
  isAuthenticated: !1,
1471
1091
  user: void 0,
1472
1092
  logoutReason: ""
1473
- }), C = Re(
1474
- (y) => {
1475
- console.warn(y), i({
1093
+ }), K = le(
1094
+ (u) => {
1095
+ console.warn(u), v({
1476
1096
  isLoading: !0,
1477
1097
  isAuthenticated: !1,
1478
1098
  user: void 0,
1479
- logoutReason: y || te
1480
- }), d(), T(), P(), M(), o && a(`auth.${r}`, {
1481
- secure: !0,
1482
- domain: o
1483
- });
1099
+ logoutReason: u || j
1100
+ }), i(), p(), m(), ue();
1101
+ },
1102
+ [p, i, ue, m]
1103
+ ), R = le(
1104
+ async (u) => {
1105
+ K(u || j), await er({
1106
+ idToken: s,
1107
+ accessToken: c,
1108
+ refreshToken: y,
1109
+ clientId: r,
1110
+ domain: a
1111
+ }), v((k) => ({
1112
+ ...k,
1113
+ isLoading: !1
1114
+ }));
1484
1115
  },
1485
1116
  [
1117
+ c,
1486
1118
  r,
1487
- o,
1488
- T,
1489
1119
  a,
1490
- d,
1491
- M,
1492
- P
1120
+ s,
1121
+ y,
1122
+ K
1493
1123
  ]
1494
- ), I = Re(
1495
- async (y) => {
1496
- C(y || te), await Yr({
1497
- idToken: c,
1498
- accessToken: p,
1499
- refreshToken: E,
1500
- clientId: r
1501
- }), i((R) => ({
1502
- ...R,
1503
- isLoading: !1
1504
- }));
1505
- },
1506
- [p, r, c, C, E]
1507
1124
  );
1508
- Tt(() => {
1125
+ ze(() => {
1509
1126
  if (!n.current)
1510
- return w.isLoading && c !== null ? (async () => {
1127
+ return P.isLoading && s !== null ? (async () => {
1511
1128
  try {
1512
- const y = await Y(c);
1513
- y && y.payload[k.USER_ID_KEY] !== "" ? i({
1129
+ const u = await H(s);
1130
+ u && u.payload[w.USER_ID_KEY] !== "" ? v({
1514
1131
  isLoading: !1,
1515
1132
  isAuthenticated: !0,
1516
1133
  user: {
1517
- userId: y.payload[k.USER_ID_KEY],
1518
- username: y.payload[k.USERNAME_KEY]
1134
+ userId: u.payload[w.USER_ID_KEY],
1135
+ username: u.payload[w.USERNAME_KEY]
1519
1136
  },
1520
1137
  logoutReason: ""
1521
- }) : await I(te);
1138
+ }) : await R(j);
1522
1139
  } catch {
1523
- await I(te);
1140
+ await R(j);
1524
1141
  }
1525
- })() : i((y) => ({
1526
- ...y,
1142
+ })() : v((u) => ({
1143
+ ...u,
1527
1144
  isLoading: !1
1528
1145
  })), () => {
1529
1146
  n.current = !0;
1530
1147
  };
1531
- }, [w.isLoading, c, I]);
1532
- const fe = async (y, R, b) => {
1533
- const D = Mr();
1534
- if (W(D), i((J) => ({
1535
- ...J,
1148
+ }, [P.isLoading, s, R]);
1149
+ const We = async (u, k, g) => {
1150
+ const I = qt();
1151
+ if (Z(I), v((ee) => ({
1152
+ ...ee,
1536
1153
  isLoading: !0
1537
- })), d(), T(), P(), b === ie.CODE) {
1538
- const { code_verifier: J, code_challenge: F } = await yr(), V = await Fr({
1539
- nonce: D,
1154
+ })), i(), p(), m(), g === G.CODE) {
1155
+ const { code_verifier: ee, code_challenge: Me } = await jt(), de = await tr({
1156
+ nonce: I,
1540
1157
  clientId: r,
1541
- code_challenge: F
1158
+ code_challenge: Me
1542
1159
  });
1543
- if (V.status) {
1544
- const N = await Fe({
1545
- username: y,
1546
- password: R,
1160
+ if (de.status) {
1161
+ const D = await _e({
1162
+ username: u,
1163
+ password: k,
1547
1164
  clientId: r,
1548
1165
  sessionExpiration: t,
1549
- nonce: D,
1550
- type: b,
1551
- code: V.code,
1552
- code_verifier: J
1166
+ nonce: I,
1167
+ type: g,
1168
+ code: de.code,
1169
+ code_verifier: ee,
1170
+ domain: a
1553
1171
  });
1554
- return N.status ? (o && s(`auth.${r}`, N.accessToken, {
1555
- secure: !0,
1556
- domain: o
1557
- }), l(N.idToken), m(N.accessToken), S(N.refreshToken), i({
1172
+ return D.status ? (o(D.idToken), d(D.accessToken), E(D.refreshToken), v({
1558
1173
  isLoading: !1,
1559
1174
  isAuthenticated: !0,
1560
1175
  user: {
1561
- userId: N.userId,
1562
- username: y
1176
+ userId: D.userId,
1177
+ username: u
1563
1178
  },
1564
1179
  logoutReason: ""
1565
- }), !0) : (C(Je), !1);
1180
+ }), !0) : (K(ke), !1);
1566
1181
  }
1567
1182
  return !1;
1568
1183
  }
1569
- const U = await Fe({
1570
- username: y,
1571
- password: R,
1184
+ const O = await _e({
1185
+ username: u,
1186
+ password: k,
1572
1187
  clientId: r,
1573
1188
  sessionExpiration: t,
1574
- nonce: D,
1575
- type: b
1189
+ nonce: I,
1190
+ type: g,
1191
+ domain: a
1576
1192
  });
1577
- return U.status ? (o && s(`auth.${r}`, U.accessToken, {
1578
- secure: !0,
1579
- domain: o
1580
- }), l(U.idToken), m(U.accessToken), S(U.refreshToken), i({
1193
+ return O.status ? (o(O.idToken), d(O.accessToken), E(O.refreshToken), v({
1581
1194
  isLoading: !1,
1582
1195
  isAuthenticated: !0,
1583
1196
  user: {
1584
- userId: U.userId,
1585
- username: y
1197
+ userId: O.userId,
1198
+ username: u
1586
1199
  }
1587
- }), !0) : (C(Je), !1);
1588
- }, he = async (y) => {
1589
- y == null || y.preventDefault(), await I(Kr);
1590
- }, pe = async () => {
1591
- const { isAuthenticated: y, user: R } = w;
1200
+ }), !0) : (K(ke), !1);
1201
+ }, Je = async (u) => {
1202
+ u == null || u.preventDefault(), await R(zt);
1203
+ }, xe = async () => {
1204
+ const { isAuthenticated: u, user: k } = P;
1592
1205
  try {
1593
- if (y && R && R.userId) {
1594
- if (p) {
1595
- const D = await Y(p);
1596
- if (D && D.payload[k.USER_ID_KEY] !== "")
1597
- return p;
1206
+ if (u && k && k.userId) {
1207
+ if (c) {
1208
+ const I = await H(c);
1209
+ if (I && I.payload[w.USER_ID_KEY] !== "")
1210
+ return c;
1598
1211
  }
1599
- const b = await g.refreshtoken({
1212
+ const g = await $e.refreshtoken({
1600
1213
  clientId: r,
1601
- userId: R.userId,
1602
- nonce: j
1214
+ userId: k.userId,
1215
+ nonce: S,
1216
+ domain: a
1603
1217
  });
1604
- return b.status && b.status === "success" ? (o && s(`auth.${r}`, b.newAccessToken, {
1605
- secure: !0,
1606
- domain: o
1607
- }), m(b.newAccessToken), S(b.newRefreshToken), b.newAccessToken) : (await I(Te), "");
1218
+ return g.status && g.status === "success" ? (d(g.newAccessToken), E(g.newRefreshToken), g.newAccessToken) : (await R(oe), "");
1608
1219
  }
1609
- return await I(Te), "";
1220
+ return await R(oe), "";
1610
1221
  } catch {
1611
- return await I(Te), "";
1222
+ return await R(oe), "";
1612
1223
  }
1613
- }, ye = () => {
1614
- if (w.isAuthenticated && c)
1615
- return c;
1224
+ }, je = () => {
1225
+ if (P.isAuthenticated && s)
1226
+ return s;
1616
1227
  };
1617
- return /* @__PURE__ */ gt(
1618
- st.Provider,
1228
+ return /* @__PURE__ */ Be(
1229
+ Le.Provider,
1619
1230
  {
1620
- value: { ...w, login: fe, logout: he, getAccessToken: pe, getIdToken: ye },
1231
+ value: { ...P, login: We, logout: Je, getAccessToken: xe, getIdToken: je },
1621
1232
  children: e
1622
1233
  }
1623
1234
  );
1624
- }, eo = (e = st) => Ve(e);
1235
+ }, dr = (e = Le) => Xe(e);
1625
1236
  export {
1626
- ie as AUTH_TYPES,
1627
- Zr as AuthProvider,
1628
- eo as useAuth
1237
+ G as AUTH_TYPES,
1238
+ ur as AuthProvider,
1239
+ dr as useAuth
1629
1240
  };