@axa-fr/react-oidc 7.22.5 → 7.22.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,994 +1,351 @@
1
- import Ee, { useCallback as Ot, useState as A, useEffect as F } from "react";
2
- import { OidcClient as d, getParseQueryStringFromLocation as Rt, getPath as X, OidcLocation as Ve, getFetchDefault as Ct } from "@axa-fr/oidc-client";
3
- import { OidcClient as cr, OidcLocation as lr, TokenAutomaticRenewMode as ur, TokenRenewMode as dr } from "@axa-fr/oidc-client";
4
- var me = { exports: {} }, H = {};
5
- /**
6
- * @license React
7
- * react-jsx-runtime.production.min.js
8
- *
9
- * Copyright (c) Facebook, Inc. and its affiliates.
10
- *
11
- * This source code is licensed under the MIT license found in the
12
- * LICENSE file in the root directory of this source tree.
13
- */
14
- var qe;
15
- function jt() {
16
- if (qe)
17
- return H;
18
- qe = 1;
19
- var o = Ee, a = Symbol.for("react.element"), r = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, c = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
20
- function _(u, v, y) {
21
- var b, m = {}, R = null, j = null;
22
- y !== void 0 && (R = "" + y), v.key !== void 0 && (R = "" + v.key), v.ref !== void 0 && (j = v.ref);
23
- for (b in v)
24
- s.call(v, b) && !l.hasOwnProperty(b) && (m[b] = v[b]);
25
- if (u && u.defaultProps)
26
- for (b in v = u.defaultProps, v)
27
- m[b] === void 0 && (m[b] = v[b]);
28
- return { $$typeof: a, type: u, key: R, ref: j, props: m, _owner: c.current };
29
- }
30
- return H.Fragment = r, H.jsx = _, H.jsxs = _, H;
31
- }
32
- var Q = {};
33
- /**
34
- * @license React
35
- * react-jsx-runtime.development.js
36
- *
37
- * Copyright (c) Facebook, Inc. and its affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */
42
- var Be;
43
- function xt() {
44
- return Be || (Be = 1, process.env.NODE_ENV !== "production" && function() {
45
- var o = Ee, a = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), _ = Symbol.for("react.provider"), u = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), I = Symbol.iterator, q = "@@iterator";
46
- function Y(e) {
47
- if (e === null || typeof e != "object")
48
- return null;
49
- var t = I && e[I] || e[q];
50
- return typeof t == "function" ? t : null;
51
- }
52
- var U = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
53
- function O(e) {
54
- {
55
- for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), f = 1; f < t; f++)
56
- n[f - 1] = arguments[f];
57
- oe("error", e, n);
58
- }
59
- }
60
- function oe(e, t, n) {
61
- {
62
- var f = U.ReactDebugCurrentFrame, g = f.getStackAddendum();
63
- g !== "" && (t += "%s", n = n.concat([g]));
64
- var k = n.map(function(h) {
65
- return String(h);
66
- });
67
- k.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, k);
68
- }
69
- }
70
- var $ = !1, se = !1, ae = !1, ie = !1, ce = !1, D;
71
- D = Symbol.for("react.module.reference");
72
- function le(e) {
73
- return !!(typeof e == "string" || typeof e == "function" || e === s || e === l || ce || e === c || e === y || e === b || ie || e === j || $ || se || ae || typeof e == "object" && e !== null && (e.$$typeof === R || e.$$typeof === m || e.$$typeof === _ || e.$$typeof === u || e.$$typeof === v || // This needs to include all possible module reference object
74
- // types supported by any Flight configuration anywhere since
75
- // we don't know which Flight build this will end up being used
76
- // with.
77
- e.$$typeof === D || e.getModuleId !== void 0));
78
- }
79
- function ue(e, t, n) {
80
- var f = e.displayName;
81
- if (f)
82
- return f;
83
- var g = t.displayName || t.name || "";
84
- return g !== "" ? n + "(" + g + ")" : n;
85
- }
86
- function W(e) {
87
- return e.displayName || "Context";
88
- }
89
- function x(e) {
90
- if (e == null)
91
- return null;
92
- if (typeof e.tag == "number" && O("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
93
- return e.displayName || e.name || null;
94
- if (typeof e == "string")
95
- return e;
96
- switch (e) {
97
- case s:
98
- return "Fragment";
99
- case r:
100
- return "Portal";
101
- case l:
102
- return "Profiler";
103
- case c:
104
- return "StrictMode";
105
- case y:
106
- return "Suspense";
107
- case b:
108
- return "SuspenseList";
109
- }
110
- if (typeof e == "object")
111
- switch (e.$$typeof) {
112
- case u:
113
- var t = e;
114
- return W(t) + ".Consumer";
115
- case _:
116
- var n = e;
117
- return W(n._context) + ".Provider";
118
- case v:
119
- return ue(e, e.render, "ForwardRef");
120
- case m:
121
- var f = e.displayName || null;
122
- return f !== null ? f : x(e.type) || "Memo";
123
- case R: {
124
- var g = e, k = g._payload, h = g._init;
125
- try {
126
- return x(h(k));
127
- } catch {
128
- return null;
129
- }
130
- }
131
- }
132
- return null;
133
- }
134
- var M = Object.assign, L = 0, B, T, N, we, Oe, Re, Ce;
135
- function je() {
136
- }
137
- je.__reactDisabledLog = !0;
138
- function Qe() {
139
- {
140
- if (L === 0) {
141
- B = console.log, T = console.info, N = console.warn, we = console.error, Oe = console.group, Re = console.groupCollapsed, Ce = console.groupEnd;
142
- var e = {
143
- configurable: !0,
144
- enumerable: !0,
145
- value: je,
146
- writable: !0
147
- };
148
- Object.defineProperties(console, {
149
- info: e,
150
- log: e,
151
- warn: e,
152
- error: e,
153
- group: e,
154
- groupCollapsed: e,
155
- groupEnd: e
156
- });
157
- }
158
- L++;
159
- }
160
- }
161
- function Ze() {
162
- {
163
- if (L--, L === 0) {
164
- var e = {
165
- configurable: !0,
166
- enumerable: !0,
167
- writable: !0
168
- };
169
- Object.defineProperties(console, {
170
- log: M({}, e, {
171
- value: B
172
- }),
173
- info: M({}, e, {
174
- value: T
175
- }),
176
- warn: M({}, e, {
177
- value: N
178
- }),
179
- error: M({}, e, {
180
- value: we
181
- }),
182
- group: M({}, e, {
183
- value: Oe
184
- }),
185
- groupCollapsed: M({}, e, {
186
- value: Re
187
- }),
188
- groupEnd: M({}, e, {
189
- value: Ce
190
- })
191
- });
192
- }
193
- L < 0 && O("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
194
- }
195
- }
196
- var de = U.ReactCurrentDispatcher, fe;
197
- function ee(e, t, n) {
198
- {
199
- if (fe === void 0)
200
- try {
201
- throw Error();
202
- } catch (g) {
203
- var f = g.stack.trim().match(/\n( *(at )?)/);
204
- fe = f && f[1] || "";
205
- }
206
- return `
207
- ` + fe + e;
208
- }
209
- }
210
- var ve = !1, te;
211
- {
212
- var et = typeof WeakMap == "function" ? WeakMap : Map;
213
- te = new et();
214
- }
215
- function xe(e, t) {
216
- if (!e || ve)
217
- return "";
218
- {
219
- var n = te.get(e);
220
- if (n !== void 0)
221
- return n;
222
- }
223
- var f;
224
- ve = !0;
225
- var g = Error.prepareStackTrace;
226
- Error.prepareStackTrace = void 0;
227
- var k;
228
- k = de.current, de.current = null, Qe();
229
- try {
230
- if (t) {
231
- var h = function() {
232
- throw Error();
233
- };
234
- if (Object.defineProperty(h.prototype, "props", {
235
- set: function() {
236
- throw Error();
237
- }
238
- }), typeof Reflect == "object" && Reflect.construct) {
239
- try {
240
- Reflect.construct(h, []);
241
- } catch (P) {
242
- f = P;
243
- }
244
- Reflect.construct(e, [], h);
245
- } else {
246
- try {
247
- h.call();
248
- } catch (P) {
249
- f = P;
250
- }
251
- e.call(h.prototype);
252
- }
253
- } else {
254
- try {
255
- throw Error();
256
- } catch (P) {
257
- f = P;
258
- }
259
- e();
260
- }
261
- } catch (P) {
262
- if (P && f && typeof P.stack == "string") {
263
- for (var p = P.stack.split(`
264
- `), C = f.stack.split(`
265
- `), E = p.length - 1, w = C.length - 1; E >= 1 && w >= 0 && p[E] !== C[w]; )
266
- w--;
267
- for (; E >= 1 && w >= 0; E--, w--)
268
- if (p[E] !== C[w]) {
269
- if (E !== 1 || w !== 1)
270
- do
271
- if (E--, w--, w < 0 || p[E] !== C[w]) {
272
- var S = `
273
- ` + p[E].replace(" at new ", " at ");
274
- return e.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", e.displayName)), typeof e == "function" && te.set(e, S), S;
275
- }
276
- while (E >= 1 && w >= 0);
277
- break;
278
- }
279
- }
280
- } finally {
281
- ve = !1, de.current = k, Ze(), Error.prepareStackTrace = g;
282
- }
283
- var J = e ? e.displayName || e.name : "", V = J ? ee(J) : "";
284
- return typeof e == "function" && te.set(e, V), V;
285
- }
286
- function tt(e, t, n) {
287
- return xe(e, !1);
288
- }
289
- function rt(e) {
290
- var t = e.prototype;
291
- return !!(t && t.isReactComponent);
292
- }
293
- function re(e, t, n) {
294
- if (e == null)
295
- return "";
296
- if (typeof e == "function")
297
- return xe(e, rt(e));
298
- if (typeof e == "string")
299
- return ee(e);
300
- switch (e) {
301
- case y:
302
- return ee("Suspense");
303
- case b:
304
- return ee("SuspenseList");
305
- }
306
- if (typeof e == "object")
307
- switch (e.$$typeof) {
308
- case v:
309
- return tt(e.render);
310
- case m:
311
- return re(e.type, t, n);
312
- case R: {
313
- var f = e, g = f._payload, k = f._init;
314
- try {
315
- return re(k(g), t, n);
316
- } catch {
317
- }
318
- }
319
- }
320
- return "";
321
- }
322
- var z = Object.prototype.hasOwnProperty, Pe = {}, Se = U.ReactDebugCurrentFrame;
323
- function ne(e) {
324
- if (e) {
325
- var t = e._owner, n = re(e.type, e._source, t ? t.type : null);
326
- Se.setExtraStackFrame(n);
327
- } else
328
- Se.setExtraStackFrame(null);
329
- }
330
- function nt(e, t, n, f, g) {
331
- {
332
- var k = Function.call.bind(z);
333
- for (var h in e)
334
- if (k(e, h)) {
335
- var p = void 0;
336
- try {
337
- if (typeof e[h] != "function") {
338
- var C = Error((f || "React class") + ": " + n + " type `" + h + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[h] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
339
- throw C.name = "Invariant Violation", C;
340
- }
341
- p = e[h](t, h, f, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
342
- } catch (E) {
343
- p = E;
344
- }
345
- p && !(p instanceof Error) && (ne(g), O("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", f || "React class", n, h, typeof p), ne(null)), p instanceof Error && !(p.message in Pe) && (Pe[p.message] = !0, ne(g), O("Failed %s type: %s", n, p.message), ne(null));
346
- }
347
- }
348
- }
349
- var ot = Array.isArray;
350
- function pe(e) {
351
- return ot(e);
352
- }
353
- function st(e) {
354
- {
355
- var t = typeof Symbol == "function" && Symbol.toStringTag, n = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
356
- return n;
357
- }
358
- }
359
- function at(e) {
360
- try {
361
- return Ae(e), !1;
362
- } catch {
363
- return !0;
364
- }
365
- }
366
- function Ae(e) {
367
- return "" + e;
368
- }
369
- function Fe(e) {
370
- if (at(e))
371
- return O("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", st(e)), Ae(e);
372
- }
373
- var G = U.ReactCurrentOwner, it = {
374
- key: !0,
375
- ref: !0,
376
- __self: !0,
377
- __source: !0
378
- }, Ie, De, he;
379
- he = {};
380
- function ct(e) {
381
- if (z.call(e, "ref")) {
382
- var t = Object.getOwnPropertyDescriptor(e, "ref").get;
383
- if (t && t.isReactWarning)
384
- return !1;
385
- }
386
- return e.ref !== void 0;
387
- }
388
- function lt(e) {
389
- if (z.call(e, "key")) {
390
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
391
- if (t && t.isReactWarning)
392
- return !1;
393
- }
394
- return e.key !== void 0;
395
- }
396
- function ut(e, t) {
397
- if (typeof e.ref == "string" && G.current && t && G.current.stateNode !== t) {
398
- var n = x(G.current.type);
399
- he[n] || (O('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', x(G.current.type), e.ref), he[n] = !0);
400
- }
401
- }
402
- function dt(e, t) {
403
- {
404
- var n = function() {
405
- Ie || (Ie = !0, O("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
406
- };
407
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
408
- get: n,
409
- configurable: !0
410
- });
411
- }
412
- }
413
- function ft(e, t) {
414
- {
415
- var n = function() {
416
- De || (De = !0, O("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
417
- };
418
- n.isReactWarning = !0, Object.defineProperty(e, "ref", {
419
- get: n,
420
- configurable: !0
421
- });
422
- }
423
- }
424
- var vt = function(e, t, n, f, g, k, h) {
425
- var p = {
426
- // This tag allows us to uniquely identify this as a React Element
427
- $$typeof: a,
428
- // Built-in properties that belong on the element
429
- type: e,
430
- key: t,
431
- ref: n,
432
- props: h,
433
- // Record the component responsible for creating this element.
434
- _owner: k
435
- };
436
- return p._store = {}, Object.defineProperty(p._store, "validated", {
437
- configurable: !1,
438
- enumerable: !1,
439
- writable: !0,
440
- value: !1
441
- }), Object.defineProperty(p, "_self", {
442
- configurable: !1,
443
- enumerable: !1,
444
- writable: !1,
445
- value: f
446
- }), Object.defineProperty(p, "_source", {
447
- configurable: !1,
448
- enumerable: !1,
449
- writable: !1,
450
- value: g
451
- }), Object.freeze && (Object.freeze(p.props), Object.freeze(p)), p;
452
- };
453
- function pt(e, t, n, f, g) {
454
- {
455
- var k, h = {}, p = null, C = null;
456
- n !== void 0 && (Fe(n), p = "" + n), lt(t) && (Fe(t.key), p = "" + t.key), ct(t) && (C = t.ref, ut(t, g));
457
- for (k in t)
458
- z.call(t, k) && !it.hasOwnProperty(k) && (h[k] = t[k]);
459
- if (e && e.defaultProps) {
460
- var E = e.defaultProps;
461
- for (k in E)
462
- h[k] === void 0 && (h[k] = E[k]);
463
- }
464
- if (p || C) {
465
- var w = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
466
- p && dt(h, w), C && ft(h, w);
467
- }
468
- return vt(e, p, C, g, f, G.current, h);
469
- }
470
- }
471
- var _e = U.ReactCurrentOwner, Le = U.ReactDebugCurrentFrame;
472
- function K(e) {
473
- if (e) {
474
- var t = e._owner, n = re(e.type, e._source, t ? t.type : null);
475
- Le.setExtraStackFrame(n);
476
- } else
477
- Le.setExtraStackFrame(null);
478
- }
479
- var ge;
480
- ge = !1;
481
- function ye(e) {
482
- return typeof e == "object" && e !== null && e.$$typeof === a;
483
- }
484
- function Ne() {
485
- {
486
- if (_e.current) {
487
- var e = x(_e.current.type);
488
- if (e)
489
- return `
490
-
491
- Check the render method of \`` + e + "`.";
492
- }
493
- return "";
494
- }
495
- }
496
- function ht(e) {
497
- {
498
- if (e !== void 0) {
499
- var t = e.fileName.replace(/^.*[\\\/]/, ""), n = e.lineNumber;
500
- return `
501
-
502
- Check your code at ` + t + ":" + n + ".";
503
- }
504
- return "";
505
- }
506
- }
507
- var Ue = {};
508
- function _t(e) {
509
- {
510
- var t = Ne();
511
- if (!t) {
512
- var n = typeof e == "string" ? e : e.displayName || e.name;
513
- n && (t = `
514
-
515
- Check the top-level render call using <` + n + ">.");
516
- }
517
- return t;
518
- }
519
- }
520
- function We(e, t) {
521
- {
522
- if (!e._store || e._store.validated || e.key != null)
523
- return;
524
- e._store.validated = !0;
525
- var n = _t(t);
526
- if (Ue[n])
527
- return;
528
- Ue[n] = !0;
529
- var f = "";
530
- e && e._owner && e._owner !== _e.current && (f = " It was passed a child from " + x(e._owner.type) + "."), K(e), O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, f), K(null);
531
- }
532
- }
533
- function Me(e, t) {
534
- {
535
- if (typeof e != "object")
536
- return;
537
- if (pe(e))
538
- for (var n = 0; n < e.length; n++) {
539
- var f = e[n];
540
- ye(f) && We(f, t);
541
- }
542
- else if (ye(e))
543
- e._store && (e._store.validated = !0);
544
- else if (e) {
545
- var g = Y(e);
546
- if (typeof g == "function" && g !== e.entries)
547
- for (var k = g.call(e), h; !(h = k.next()).done; )
548
- ye(h.value) && We(h.value, t);
549
- }
550
- }
551
- }
552
- function gt(e) {
553
- {
554
- var t = e.type;
555
- if (t == null || typeof t == "string")
556
- return;
557
- var n;
558
- if (typeof t == "function")
559
- n = t.propTypes;
560
- else if (typeof t == "object" && (t.$$typeof === v || // Note: Memo only checks outer props here.
561
- // Inner props are checked in the reconciler.
562
- t.$$typeof === m))
563
- n = t.propTypes;
564
- else
565
- return;
566
- if (n) {
567
- var f = x(t);
568
- nt(n, e.props, "prop", f, e);
569
- } else if (t.PropTypes !== void 0 && !ge) {
570
- ge = !0;
571
- var g = x(t);
572
- O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", g || "Unknown");
573
- }
574
- typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
575
- }
576
- }
577
- function yt(e) {
578
- {
579
- for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
580
- var f = t[n];
581
- if (f !== "children" && f !== "key") {
582
- K(e), O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", f), K(null);
583
- break;
584
- }
585
- }
586
- e.ref !== null && (K(e), O("Invalid attribute `ref` supplied to `React.Fragment`."), K(null));
587
- }
588
- }
589
- var Ye = {};
590
- function $e(e, t, n, f, g, k) {
591
- {
592
- var h = le(e);
593
- if (!h) {
594
- var p = "";
595
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (p += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
596
- var C = ht(g);
597
- C ? p += C : p += Ne();
598
- var E;
599
- e === null ? E = "null" : pe(e) ? E = "array" : e !== void 0 && e.$$typeof === a ? (E = "<" + (x(e.type) || "Unknown") + " />", p = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e, O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", E, p);
600
- }
601
- var w = pt(e, t, n, g, k);
602
- if (w == null)
603
- return w;
604
- if (h) {
605
- var S = t.children;
606
- if (S !== void 0)
607
- if (f)
608
- if (pe(S)) {
609
- for (var J = 0; J < S.length; J++)
610
- Me(S[J], e);
611
- Object.freeze && Object.freeze(S);
612
- } else
613
- O("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
614
- else
615
- Me(S, e);
616
- }
617
- if (z.call(t, "key")) {
618
- var V = x(e), P = Object.keys(t).filter(function(wt) {
619
- return wt !== "key";
620
- }), be = P.length > 0 ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}";
621
- if (!Ye[V + be]) {
622
- var Tt = P.length > 0 ? "{" + P.join(": ..., ") + ": ...}" : "{}";
623
- O(`A props object containing a "key" prop is being spread into JSX:
624
- let props = %s;
625
- <%s {...props} />
626
- React keys must be passed directly to JSX without using spread:
627
- let props = %s;
628
- <%s key={someKey} {...props} />`, be, V, Tt, V), Ye[V + be] = !0;
629
- }
630
- }
631
- return e === s ? yt(w) : gt(w), w;
632
- }
633
- }
634
- function bt(e, t, n) {
635
- return $e(e, t, n, !0);
636
- }
637
- function kt(e, t, n) {
638
- return $e(e, t, n, !1);
639
- }
640
- var mt = kt, Et = bt;
641
- Q.Fragment = s, Q.jsx = mt, Q.jsxs = Et;
642
- }()), Q;
643
- }
644
- process.env.NODE_ENV === "production" ? me.exports = jt() : me.exports = xt();
645
- var i = me.exports;
646
- const Je = "default", Pt = (o, a, r = !1) => async (...s) => await a().fetchWithTokens(o, r)(...s), Zt = (o = null, a = Je, r = !1) => (s) => (c) => {
647
- const { fetch: l } = St(o || c.fetch, a, r);
648
- return /* @__PURE__ */ i.jsx(s, { ...c, fetch: l });
649
- }, St = (o = null, a = Je, r = !1) => {
650
- const s = o || window.fetch, c = d.get;
651
- return { fetch: Ot(
652
- (_, u) => Pt(s, () => c(a), r)(_, u),
653
- [s, a]
1
+ import { jsx as i, jsxs as E, Fragment as b } from "react/jsx-runtime";
2
+ import { OidcClient as r, getParseQueryStringFromLocation as V, getPath as O, OidcLocation as M, getFetchDefault as X } from "@axa-fr/oidc-client";
3
+ import { OidcClient as Me, OidcLocation as De, TokenAutomaticRenewMode as xe, TokenRenewMode as We } from "@axa-fr/oidc-client";
4
+ import Z, { useCallback as ee, useState as f, useEffect as v } from "react";
5
+ const x = "default", te = (t, s, e = !1) => async (...n) => await s().fetchWithTokens(t, e)(...n), Oe = (t = null, s = x, e = !1) => (n) => (o) => {
6
+ const { fetch: c } = ne(t || o.fetch, s, e);
7
+ return /* @__PURE__ */ i(n, { ...o, fetch: c });
8
+ }, ne = (t = null, s = x, e = !1) => {
9
+ const n = t || window.fetch, o = r.get;
10
+ return { fetch: ee(
11
+ (l, a) => te(n, () => o(s), e)(l, a),
12
+ [n, s]
654
13
  ) };
655
- }, ze = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-authenticating__container", children: [
656
- /* @__PURE__ */ i.jsx("h1", { className: "oidc-authenticating__title", children: "Error authentication" }),
657
- /* @__PURE__ */ i.jsx("p", { className: "oidc-authenticating__content", children: "An error occurred during authentication." })
658
- ] }) }), At = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-authenticating__container", children: [
659
- /* @__PURE__ */ i.jsx("h1", { className: "oidc-authenticating__title", children: "Authentication in progress" }),
660
- /* @__PURE__ */ i.jsx("p", { className: "oidc-authenticating__content", children: "You will be redirected to the login page." })
661
- ] }) }), Ft = () => Math.random().toString(36).substr(2, 6), It = (o, a) => (r, s) => {
662
- if (typeof o.CustomEvent == "function")
663
- return new o.CustomEvent(r, s);
664
- const c = s || { bubbles: !1, cancelable: !1, detail: void 0 }, l = a.createEvent("CustomEvent");
665
- return l.initCustomEvent(r, c.bubbles, c.cancelable, c.detail), l.prototype = o.Event.prototype, l;
666
- }, Dt = (o, a, r) => ({
667
- replaceState: (s, c) => {
668
- const l = r(), _ = c || o.history.state;
669
- o.history.replaceState({ key: l, state: _ }, null, s), o.dispatchEvent(a("popstate"));
14
+ }, W = () => /* @__PURE__ */ i("div", { className: "oidc-authenticating", children: /* @__PURE__ */ E("div", { className: "oidc-authenticating__container", children: [
15
+ /* @__PURE__ */ i("h1", { className: "oidc-authenticating__title", children: "Error authentication" }),
16
+ /* @__PURE__ */ i("p", { className: "oidc-authenticating__content", children: "An error occurred during authentication." })
17
+ ] }) }), se = () => /* @__PURE__ */ i("div", { className: "oidc-authenticating", children: /* @__PURE__ */ E("div", { className: "oidc-authenticating__container", children: [
18
+ /* @__PURE__ */ i("h1", { className: "oidc-authenticating__title", children: "Authentication in progress" }),
19
+ /* @__PURE__ */ i("p", { className: "oidc-authenticating__content", children: "You will be redirected to the login page." })
20
+ ] }) }), oe = () => Math.random().toString(36).substr(2, 6), ce = (t, s) => (e, n) => {
21
+ if (typeof t.CustomEvent == "function")
22
+ return new t.CustomEvent(e, n);
23
+ const o = n || { bubbles: !1, cancelable: !1, detail: void 0 }, c = s.createEvent("CustomEvent");
24
+ return c.initCustomEvent(e, o.bubbles, o.cancelable, o.detail), c.prototype = t.Event.prototype, c;
25
+ }, re = (t, s, e) => ({
26
+ replaceState: (n, o) => {
27
+ const c = e(), l = o || t.history.state;
28
+ t.history.replaceState({ key: c, state: l }, null, n), t.dispatchEvent(s("popstate"));
670
29
  }
671
- }), Lt = () => Dt(window, It(window, document), Ft), Ge = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-callback", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-callback__container", children: [
672
- /* @__PURE__ */ i.jsx("h1", { className: "oidc-callback__title", children: "Authentication complete" }),
673
- /* @__PURE__ */ i.jsx("p", { className: "oidc-callback__content", children: "You will be redirected to your application." })
674
- ] }) }), Nt = ({ callBackError: o, callBackSuccess: a, configurationName: r, withCustomHistory: s }) => {
675
- const [c, l] = A(!1);
676
- F(() => {
677
- let v = !0;
30
+ }), ie = () => re(window, ce(window, document), oe), R = () => /* @__PURE__ */ i("div", { className: "oidc-callback", children: /* @__PURE__ */ E("div", { className: "oidc-callback__container", children: [
31
+ /* @__PURE__ */ i("h1", { className: "oidc-callback__title", children: "Authentication complete" }),
32
+ /* @__PURE__ */ i("p", { className: "oidc-callback__content", children: "You will be redirected to your application." })
33
+ ] }) }), ae = ({ callBackError: t, callBackSuccess: s, configurationName: e, withCustomHistory: n }) => {
34
+ const [o, c] = f(!1);
35
+ v(() => {
36
+ let d = !0;
678
37
  return (async () => {
679
- const b = d.get;
38
+ const _ = r.get;
680
39
  try {
681
- const { callbackPath: m } = await b(r).loginCallbackAsync();
682
- (s ? s() : Lt()).replaceState(m || "/");
683
- } catch (m) {
684
- v && (console.warn(m), l(!0));
40
+ const { callbackPath: h } = await _(e).loginCallbackAsync();
41
+ (n ? n() : ie()).replaceState(h || "/");
42
+ } catch (h) {
43
+ d && (console.warn(h), c(!0));
685
44
  }
686
45
  })(), () => {
687
- v = !1;
46
+ d = !1;
688
47
  };
689
48
  }, []);
690
- const _ = o || ze, u = a || Ge;
691
- return c ? /* @__PURE__ */ i.jsx(_, { configurationName: r }) : /* @__PURE__ */ i.jsx(u, { configurationName: r });
692
- }, Ut = () => /* @__PURE__ */ i.jsx("span", { className: "oidc-loading", children: "Loading" }), Wt = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-serviceworker", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-serviceworker__container", children: [
693
- /* @__PURE__ */ i.jsx("h1", { className: "oidc-serviceworker__title", children: "Unable to authenticate on this browser" }),
694
- /* @__PURE__ */ i.jsx("p", { className: "oidc-serviceworker__content", children: "Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser." })
695
- ] }) }), Mt = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-session-lost", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-session-lost__container", children: [
696
- /* @__PURE__ */ i.jsx("h1", { className: "oidc-session-lost__title", children: "Session timed out" }),
697
- /* @__PURE__ */ i.jsx("p", { className: "oidc-session-lost__content", children: "Your session has expired. Please re-authenticate." })
698
- ] }) }), Yt = ({ configurationName: o }) => (F(() => {
49
+ const l = t || W, a = s || R;
50
+ return o ? /* @__PURE__ */ i(l, { configurationName: e }) : /* @__PURE__ */ i(a, { configurationName: e });
51
+ }, le = () => /* @__PURE__ */ i("span", { className: "oidc-loading", children: "Loading" }), de = () => /* @__PURE__ */ i("div", { className: "oidc-serviceworker", children: /* @__PURE__ */ E("div", { className: "oidc-serviceworker__container", children: [
52
+ /* @__PURE__ */ i("h1", { className: "oidc-serviceworker__title", children: "Unable to authenticate on this browser" }),
53
+ /* @__PURE__ */ i("p", { className: "oidc-serviceworker__content", children: "Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser." })
54
+ ] }) }), ue = () => /* @__PURE__ */ i("div", { className: "oidc-session-lost", children: /* @__PURE__ */ E("div", { className: "oidc-session-lost__container", children: [
55
+ /* @__PURE__ */ i("h1", { className: "oidc-session-lost__title", children: "Session timed out" }),
56
+ /* @__PURE__ */ i("p", { className: "oidc-session-lost__content", children: "Your session has expired. Please re-authenticate." })
57
+ ] }) }), ke = ({ configurationName: t }) => (v(() => {
699
58
  (async () => {
700
- const r = d.get;
701
- r(o).silentLoginCallbackAsync();
59
+ const e = r.get;
60
+ e(t).silentLoginCallbackAsync();
702
61
  })();
703
- }, []), /* @__PURE__ */ i.jsx(i.Fragment, {})), $t = ({ configurationName: o }) => {
704
- const a = Rt(window.location.href), r = d.get, s = r(o);
705
- let c = null;
706
- for (const [l, _] of Object.entries(a))
707
- l === "state" || l === "scope" || (c === null && (c = {}), c[l] = _);
708
- return F(() => {
709
- s.tokens || s.loginAsync(null, c, !0, a.scope);
710
- }, []), /* @__PURE__ */ i.jsx(i.Fragment, {});
711
- }, Vt = ({
712
- callbackErrorComponent: o,
713
- callbackSuccessComponent: a,
714
- redirect_uri: r,
715
- silent_redirect_uri: s,
716
- silent_login_uri: c,
717
- children: l,
718
- configurationName: _,
719
- withCustomHistory: u = null,
720
- location: v
62
+ }, []), /* @__PURE__ */ i(b, {})), he = ({ configurationName: t }) => {
63
+ const s = V(window.location.href), e = r.get, n = e(t);
64
+ let o = null;
65
+ for (const [c, l] of Object.entries(s))
66
+ c === "state" || c === "scope" || (o === null && (o = {}), o[c] = l);
67
+ return v(() => {
68
+ n.tokens || n.loginAsync(null, o, !0, s.scope);
69
+ }, []), /* @__PURE__ */ i(b, {});
70
+ }, _e = ({
71
+ callbackErrorComponent: t,
72
+ callbackSuccessComponent: s,
73
+ redirect_uri: e,
74
+ silent_redirect_uri: n,
75
+ silent_login_uri: o,
76
+ children: c,
77
+ configurationName: l,
78
+ withCustomHistory: a = null,
79
+ location: d
721
80
  }) => {
722
- const y = window ? X(window.location.href) : "", [b, m] = A(y);
723
- F(() => {
724
- const j = () => m(X(window.location.href));
725
- return j(), window.addEventListener("popstate", j, !1), () => window.removeEventListener("popstate", j, !1);
81
+ const u = window ? O(window.location.href) : "", [_, h] = f(u);
82
+ v(() => {
83
+ const g = () => h(O(window.location.href));
84
+ return g(), window.addEventListener("popstate", g, !1), () => window.removeEventListener("popstate", g, !1);
726
85
  }, []);
727
- const R = X(r);
728
- if (s && b === X(s))
729
- return /* @__PURE__ */ i.jsx(Yt, { configurationName: _ });
730
- if (c && b === X(c))
731
- return /* @__PURE__ */ i.jsx($t, { configurationName: _ });
732
- switch (b) {
733
- case R:
734
- return /* @__PURE__ */ i.jsx(Nt, { callBackError: o, callBackSuccess: a, configurationName: _, withCustomHistory: u });
86
+ const p = O(e);
87
+ if (n && _ === O(n))
88
+ return /* @__PURE__ */ i(ke, { configurationName: l });
89
+ if (o && _ === O(o))
90
+ return /* @__PURE__ */ i(he, { configurationName: l });
91
+ switch (_) {
92
+ case p:
93
+ return /* @__PURE__ */ i(ae, { callBackError: t, callBackSuccess: s, configurationName: l, withCustomHistory: a });
735
94
  default:
736
- return /* @__PURE__ */ i.jsx(i.Fragment, { children: l });
95
+ return /* @__PURE__ */ i(b, { children: c });
737
96
  }
738
- }, qt = Ee.memo(Vt), Ke = { name: "", data: null }, Bt = ({ loadingComponent: o, children: a, configurationName: r }) => {
739
- const [s, c] = A(!0), l = d.get, _ = l(r);
740
- F(() => {
741
- let v = !0;
742
- return _ && _.tryKeepExistingSessionAsync().then(() => {
743
- v && c(!1);
97
+ }, fe = Z.memo(_e), D = { name: "", data: null }, ve = ({ loadingComponent: t, children: s, configurationName: e }) => {
98
+ const [n, o] = f(!0), c = r.get, l = c(e);
99
+ return v(() => {
100
+ let d = !0;
101
+ return l && l.tryKeepExistingSessionAsync().then(() => {
102
+ d && o(!1);
744
103
  }), () => {
745
- v = !1;
104
+ d = !1;
746
105
  };
747
- }, [r]);
748
- const u = o;
749
- return /* @__PURE__ */ i.jsx(i.Fragment, { children: s ? /* @__PURE__ */ i.jsx(u, { configurationName: r }) : /* @__PURE__ */ i.jsx(i.Fragment, { children: a }) });
750
- }, Z = ({ isLoading: o, loadingComponent: a, children: r, configurationName: s }) => {
751
- const c = a;
752
- return o ? /* @__PURE__ */ i.jsx(c, { configurationName: s, children: r }) : /* @__PURE__ */ i.jsx(i.Fragment, { children: r });
753
- }, er = ({
754
- children: o,
755
- configuration: a,
756
- configurationName: r = "default",
757
- callbackSuccessComponent: s = Ge,
758
- authenticatingComponent: c = At,
759
- loadingComponent: l = Ut,
760
- serviceWorkerNotSupportedComponent: _ = Wt,
761
- authenticatingErrorComponent: u = ze,
762
- sessionLostComponent: v = Mt,
763
- onSessionLost: y = null,
764
- onLogoutFromAnotherTab: b = null,
765
- onLogoutFromSameTab: m = null,
766
- withCustomHistory: R = null,
767
- onEvent: j = null,
768
- getFetch: I = null,
769
- location: q = null
106
+ }, [e]), /* @__PURE__ */ i(b, { children: n ? /* @__PURE__ */ i(t, { configurationName: e }) : /* @__PURE__ */ i(b, { children: s }) });
107
+ }, P = ({ isLoading: t, loadingComponent: s, children: e, configurationName: n }) => {
108
+ const o = s;
109
+ return t ? /* @__PURE__ */ i(o, { configurationName: n, children: e }) : /* @__PURE__ */ i(b, { children: e });
110
+ }, Pe = ({
111
+ children: t,
112
+ configuration: s,
113
+ configurationName: e = "default",
114
+ callbackSuccessComponent: n = R,
115
+ authenticatingComponent: o = se,
116
+ loadingComponent: c = le,
117
+ serviceWorkerNotSupportedComponent: l = de,
118
+ authenticatingErrorComponent: a = W,
119
+ sessionLostComponent: d = ue,
120
+ onSessionLost: u = null,
121
+ onLogoutFromAnotherTab: _ = null,
122
+ onLogoutFromSameTab: h = null,
123
+ withCustomHistory: p = null,
124
+ onEvent: g = null,
125
+ getFetch: y = null,
126
+ location: S = null
770
127
  }) => {
771
- const Y = (L = "default") => d.getOrCreate(I ?? Ct, q ?? new Ve())(a, L), [U, O] = A(!0), [oe, $] = A(Ke), [se, ae] = A("default");
772
- F(() => {
773
- const B = Y(r).subscribeEvents((T, N) => {
774
- j && j(r, T, N);
128
+ const w = (L = "default") => r.getOrCreate(y ?? X, S ?? new M())(s, L), [j, B] = f(!0), [z, C] = f(D), [K, $] = f("default");
129
+ v(() => {
130
+ const I = w(e).subscribeEvents((k, T) => {
131
+ g && g(e, k, T);
775
132
  });
776
133
  return () => {
777
- Y(r).removeEventSubscription(B);
134
+ w(e).removeEventSubscription(I);
778
135
  };
779
- }, [r, j]), F(() => {
780
- const B = Y(r).subscribeEvents((T, N) => {
781
- if (T === d.eventNames.refreshTokensAsync_error || T === d.eventNames.syncTokensAsync_error) {
782
- if (y != null) {
783
- y();
136
+ }, [e, g]), v(() => {
137
+ const I = w(e).subscribeEvents((k, T) => {
138
+ if (k === r.eventNames.refreshTokensAsync_error || k === r.eventNames.syncTokensAsync_error) {
139
+ if (u != null) {
140
+ u();
784
141
  return;
785
142
  }
786
- $({ name: T, data: N });
787
- } else if (T === d.eventNames.logout_from_another_tab) {
788
- if (b != null) {
789
- b();
143
+ C({ name: k, data: T });
144
+ } else if (k === r.eventNames.logout_from_another_tab) {
145
+ if (_ != null) {
146
+ _();
790
147
  return;
791
148
  }
792
- $({ name: T, data: N });
149
+ C({ name: k, data: T });
793
150
  } else
794
- T === d.eventNames.logout_from_same_tab ? m != null && m() : T === d.eventNames.loginAsync_begin || T === d.eventNames.loginCallbackAsync_end || T === d.eventNames.loginAsync_error || T === d.eventNames.loginCallbackAsync_error ? $({ name: T, data: N }) : T === d.eventNames.service_worker_not_supported_by_browser && a.service_worker_only === !0 && $({ name: T, data: N });
151
+ k === r.eventNames.logout_from_same_tab ? h != null && h() : k === r.eventNames.loginAsync_begin || k === r.eventNames.loginCallbackAsync_end || k === r.eventNames.loginAsync_error || k === r.eventNames.loginCallbackAsync_error ? C({ name: k, data: T }) : k === r.eventNames.service_worker_not_supported_by_browser && s.service_worker_only === !0 && C({ name: k, data: T });
795
152
  });
796
- return ae(r), O(!1), () => {
797
- Y(r).removeEventSubscription(B), $(Ke);
153
+ return $(e), B(!1), () => {
154
+ w(e).removeEventSubscription(I), C(D);
798
155
  };
799
- }, [a, r]);
800
- const ie = v, ce = c, D = l, le = _, ue = u, W = U || se !== r, x = Y(r);
801
- switch (oe.name) {
802
- case d.eventNames.service_worker_not_supported_by_browser:
803
- return /* @__PURE__ */ i.jsx(Z, { loadingComponent: D, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(le, { configurationName: r }) });
804
- case d.eventNames.loginAsync_begin:
805
- return /* @__PURE__ */ i.jsx(Z, { loadingComponent: D, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(ce, { configurationName: r }) });
806
- case d.eventNames.loginAsync_error:
807
- case d.eventNames.loginCallbackAsync_error:
808
- return /* @__PURE__ */ i.jsx(Z, { loadingComponent: D, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(ue, { configurationName: r }) });
809
- case d.eventNames.refreshTokensAsync_error:
810
- case d.eventNames.syncTokensAsync_error:
811
- case d.eventNames.logout_from_another_tab:
812
- return /* @__PURE__ */ i.jsx(Z, { loadingComponent: D, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(ie, { configurationName: r }) });
156
+ }, [s, e]);
157
+ const G = d, H = o, m = c, Q = l, J = a, A = j || K !== e, N = w(e);
158
+ switch (z.name) {
159
+ case r.eventNames.service_worker_not_supported_by_browser:
160
+ return /* @__PURE__ */ i(P, { loadingComponent: m, isLoading: A, configurationName: e, children: /* @__PURE__ */ i(Q, { configurationName: e }) });
161
+ case r.eventNames.loginAsync_begin:
162
+ return /* @__PURE__ */ i(P, { loadingComponent: m, isLoading: A, configurationName: e, children: /* @__PURE__ */ i(H, { configurationName: e }) });
163
+ case r.eventNames.loginAsync_error:
164
+ case r.eventNames.loginCallbackAsync_error:
165
+ return /* @__PURE__ */ i(P, { loadingComponent: m, isLoading: A, configurationName: e, children: /* @__PURE__ */ i(J, { configurationName: e }) });
166
+ case r.eventNames.refreshTokensAsync_error:
167
+ case r.eventNames.syncTokensAsync_error:
168
+ case r.eventNames.logout_from_another_tab:
169
+ return /* @__PURE__ */ i(P, { loadingComponent: m, isLoading: A, configurationName: e, children: /* @__PURE__ */ i(G, { configurationName: e }) });
813
170
  default:
814
- return /* @__PURE__ */ i.jsx(Z, { loadingComponent: D, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(
815
- qt,
171
+ return /* @__PURE__ */ i(P, { loadingComponent: m, isLoading: A, configurationName: e, children: /* @__PURE__ */ i(
172
+ fe,
816
173
  {
817
- redirect_uri: x.configuration.redirect_uri,
818
- silent_redirect_uri: x.configuration.silent_redirect_uri,
819
- silent_login_uri: x.configuration.silent_login_uri,
820
- callbackSuccessComponent: s,
821
- callbackErrorComponent: u,
822
- authenticatingComponent: c,
823
- configurationName: r,
824
- withCustomHistory: R,
825
- location: q ?? new Ve(),
826
- children: /* @__PURE__ */ i.jsx(Bt, { loadingComponent: D, configurationName: r, children: o })
174
+ redirect_uri: N.configuration.redirect_uri,
175
+ silent_redirect_uri: N.configuration.silent_redirect_uri,
176
+ silent_login_uri: N.configuration.silent_login_uri,
177
+ callbackSuccessComponent: n,
178
+ callbackErrorComponent: a,
179
+ authenticatingComponent: o,
180
+ configurationName: e,
181
+ withCustomHistory: p,
182
+ location: S ?? new M(),
183
+ children: /* @__PURE__ */ i(ve, { loadingComponent: m, configurationName: e, children: t })
827
184
  }
828
185
  ) });
829
186
  }
830
- }, Kt = ({ children: o, callbackPath: a = null, extras: r = null, configurationName: s = "default" }) => {
831
- const c = d.get, l = c(s);
832
- return F(() => {
833
- l.tokens || l.loginAsync(a, r);
834
- }, [s, a, r]), l.tokens ? /* @__PURE__ */ i.jsx(i.Fragment, { children: o }) : null;
835
- }, tr = (o, a = null, r = null, s = "default") => (c) => /* @__PURE__ */ i.jsx(Kt, { callbackPath: a, extras: r, configurationName: s, children: /* @__PURE__ */ i.jsx(o, { ...c }) }), Te = "default", ke = (o, a) => {
836
- let r = !1;
837
- return o(a) && (r = o(a).tokens != null), r;
838
- }, rr = (o = Te) => {
839
- const a = d.get, [r, s] = A(ke(a, o));
840
- return F(() => {
841
- let u = !0;
842
- const v = a(o);
843
- s(ke(a, o));
844
- const y = v.subscribeEvents((b, m) => {
845
- (b === d.eventNames.logout_from_another_tab || b === d.eventNames.logout_from_same_tab || b === d.eventNames.token_aquired) && u && s(ke(a, o));
187
+ }, ge = ({ children: t, callbackPath: s = null, extras: e = null, configurationName: n = "default" }) => {
188
+ const o = r.get, c = o(n);
189
+ return v(() => {
190
+ c.tokens || c.loginAsync(s, e);
191
+ }, [n, s, e]), c.tokens ? /* @__PURE__ */ i(b, { children: t }) : null;
192
+ }, Ee = (t, s = null, e = null, n = "default") => (o) => /* @__PURE__ */ i(ge, { callbackPath: s, extras: e, configurationName: n, children: /* @__PURE__ */ i(t, { ...o }) }), F = "default", U = (t, s) => {
193
+ let e = !1;
194
+ return t(s) && (e = t(s).tokens != null), e;
195
+ }, Se = (t = F) => {
196
+ const s = r.get, [e, n] = f(U(s, t));
197
+ return v(() => {
198
+ let a = !0;
199
+ const d = s(t);
200
+ n(U(s, t));
201
+ const u = d.subscribeEvents((_, h) => {
202
+ (_ === r.eventNames.logout_from_another_tab || _ === r.eventNames.logout_from_same_tab || _ === r.eventNames.token_aquired) && a && n(U(s, t));
846
203
  });
847
204
  return () => {
848
- u = !1, v.removeEventSubscription(y);
205
+ a = !1, d.removeEventSubscription(u);
849
206
  };
850
- }, [o]), { login: (u = void 0, v = null, y = !1) => a(o).loginAsync(u, v, !1, void 0, y), logout: (u = void 0, v = null) => a(o).logoutAsync(u, v), renewTokens: async (u = null) => {
851
- const v = await a(o).renewTokensAsync(u);
207
+ }, [t]), { login: (a = void 0, d = null, u = !1) => s(t).loginAsync(a, d, !1, void 0, u), logout: (a = void 0, d = null) => s(t).logoutAsync(a, d), renewTokens: async (a = null) => {
208
+ const d = await s(t).renewTokensAsync(a);
852
209
  return {
853
210
  // @ts-ignore
854
- accessToken: v.accessToken,
211
+ accessToken: d.accessToken,
855
212
  // @ts-ignore
856
- accessTokenPayload: v.accessTokenPayload,
213
+ accessTokenPayload: d.accessTokenPayload,
857
214
  // @ts-ignore
858
- idToken: v.idToken,
215
+ idToken: d.idToken,
859
216
  // @ts-ignore
860
- idTokenPayload: v.idTokenPayload
217
+ idTokenPayload: d.idTokenPayload
861
218
  };
862
- }, isAuthenticated: r };
863
- }, Xe = { accessToken: null, accessTokenPayload: null }, Jt = (o) => {
864
- const a = d.get, r = a(o);
865
- if (r.tokens) {
866
- const s = r.tokens;
219
+ }, isAuthenticated: e };
220
+ }, q = { accessToken: null, accessTokenPayload: null }, pe = (t) => {
221
+ const s = r.get, e = s(t);
222
+ if (e.tokens) {
223
+ const n = e.tokens;
867
224
  return {
868
- accessToken: s.accessToken,
869
- accessTokenPayload: s.accessTokenPayload,
870
- generateDemonstrationOfProofOfPossessionAsync: r.configuration.demonstrating_proof_of_possession ? (c, l) => r.generateDemonstrationOfProofOfPossessionAsync(s.accessToken, c, l) : null
225
+ accessToken: n.accessToken,
226
+ accessTokenPayload: n.accessTokenPayload,
227
+ generateDemonstrationOfProofOfPossessionAsync: e.configuration.demonstrating_proof_of_possession ? (o, c) => e.generateDemonstrationOfProofOfPossessionAsync(n.accessToken, o, c) : null
871
228
  };
872
229
  }
873
- return Xe;
230
+ return q;
874
231
  };
875
- function zt(o, a) {
876
- return o.configuration.demonstrating_proof_of_possession ? (r, s, c = {}) => o.generateDemonstrationOfProofOfPossessionAsync(a.accessToken, r, s, c) : null;
232
+ function ye(t, s) {
233
+ return t.configuration.demonstrating_proof_of_possession ? (e, n, o = {}) => t.generateDemonstrationOfProofOfPossessionAsync(s.accessToken, e, n, o) : null;
877
234
  }
878
- const nr = (o = Te) => {
879
- const a = d.get, [r, s] = A(Jt(o));
880
- return F(() => {
881
- let c = !0;
882
- const l = a(o);
883
- if (l.tokens) {
884
- const u = l.tokens;
885
- s({ accessToken: u.accessToken, accessTokenPayload: u.accessTokenPayload });
886
- }
887
- const _ = l.subscribeEvents((u, v) => {
888
- if ((u === d.eventNames.token_renewed || u === d.eventNames.token_aquired || u === d.eventNames.logout_from_another_tab || u === d.eventNames.logout_from_same_tab || u === d.eventNames.refreshTokensAsync_error || u === d.eventNames.syncTokensAsync_error) && c) {
889
- const y = l.tokens;
890
- s(y != null ? {
891
- accessToken: y.accessToken,
892
- accessTokenPayload: y.accessTokenPayload,
893
- generateDemonstrationOfProofOfPossessionAsync: zt(l, y)
894
- } : Xe);
235
+ const Ne = (t = F) => {
236
+ const s = r.get, [e, n] = f(pe(t));
237
+ return v(() => {
238
+ let o = !0;
239
+ const c = s(t);
240
+ if (c.tokens) {
241
+ const a = c.tokens;
242
+ n({ accessToken: a.accessToken, accessTokenPayload: a.accessTokenPayload });
243
+ }
244
+ const l = c.subscribeEvents((a, d) => {
245
+ if ((a === r.eventNames.token_renewed || a === r.eventNames.token_aquired || a === r.eventNames.logout_from_another_tab || a === r.eventNames.logout_from_same_tab || a === r.eventNames.refreshTokensAsync_error || a === r.eventNames.syncTokensAsync_error) && o) {
246
+ const u = c.tokens;
247
+ n(u != null ? {
248
+ accessToken: u.accessToken,
249
+ accessTokenPayload: u.accessTokenPayload,
250
+ generateDemonstrationOfProofOfPossessionAsync: ye(c, u)
251
+ } : q);
895
252
  }
896
253
  });
897
254
  return () => {
898
- c = !1, l.removeEventSubscription(_);
255
+ o = !1, c.removeEventSubscription(l);
899
256
  };
900
- }, [o]), r;
901
- }, He = { idToken: null, idTokenPayload: null }, Gt = (o) => {
902
- const a = d.get, r = a(o);
903
- if (r.tokens) {
904
- const s = r.tokens;
905
- return { idToken: s.idToken, idTokenPayload: s.idTokenPayload };
257
+ }, [t]), e;
258
+ }, Y = { idToken: null, idTokenPayload: null }, be = (t) => {
259
+ const s = r.get, e = s(t);
260
+ if (e.tokens) {
261
+ const n = e.tokens;
262
+ return { idToken: n.idToken, idTokenPayload: n.idTokenPayload };
906
263
  }
907
- return He;
908
- }, or = (o = Te) => {
909
- const a = d.get, [r, s] = A(Gt(o));
910
- return F(() => {
911
- let c = !0;
912
- const l = a(o);
913
- if (l.tokens) {
914
- const u = l.tokens;
915
- s({ idToken: u.idToken, idTokenPayload: u.idTokenPayload });
916
- }
917
- const _ = l.subscribeEvents((u, v) => {
918
- if ((u === d.eventNames.token_renewed || u === d.eventNames.token_aquired || u === d.eventNames.logout_from_another_tab || u === d.eventNames.logout_from_same_tab || u === d.eventNames.refreshTokensAsync_error || u === d.eventNames.syncTokensAsync_error) && c) {
919
- const y = l.tokens;
920
- s(y != null ? { idToken: y.idToken, idTokenPayload: y.idTokenPayload } : He);
264
+ return Y;
265
+ }, Le = (t = F) => {
266
+ const s = r.get, [e, n] = f(be(t));
267
+ return v(() => {
268
+ let o = !0;
269
+ const c = s(t);
270
+ if (c.tokens) {
271
+ const a = c.tokens;
272
+ n({ idToken: a.idToken, idTokenPayload: a.idTokenPayload });
273
+ }
274
+ const l = c.subscribeEvents((a, d) => {
275
+ if ((a === r.eventNames.token_renewed || a === r.eventNames.token_aquired || a === r.eventNames.logout_from_another_tab || a === r.eventNames.logout_from_same_tab || a === r.eventNames.refreshTokensAsync_error || a === r.eventNames.syncTokensAsync_error) && o) {
276
+ const u = c.tokens;
277
+ n(u != null ? { idToken: u.idToken, idTokenPayload: u.idTokenPayload } : Y);
921
278
  }
922
279
  });
923
280
  return () => {
924
- c = !1, l.removeEventSubscription(_);
281
+ o = !1, c.removeEventSubscription(l);
925
282
  };
926
- }, [o]), r;
283
+ }, [t]), e;
927
284
  };
928
- var Xt = /* @__PURE__ */ ((o) => (o.Unauthenticated = "Unauthenticated", o.Loading = "Loading user", o.Loaded = "User loaded", o.LoadingError = "Error loading user", o))(Xt || {});
929
- const sr = (o = "default", a = !1) => {
930
- const s = d.get(o).userInfo(), [c, l] = A({
931
- user: s,
932
- status: s ? "User loaded" : "Unauthenticated"
285
+ var me = /* @__PURE__ */ ((t) => (t.Unauthenticated = "Unauthenticated", t.Loading = "Loading user", t.Loaded = "User loaded", t.LoadingError = "Error loading user", t))(me || {});
286
+ const Ie = (t = "default", s = !1) => {
287
+ const n = r.get(t).userInfo(), [o, c] = f({
288
+ user: n,
289
+ status: n ? "User loaded" : "Unauthenticated"
933
290
  /* Unauthenticated */
934
- }), [_, u] = A(s ? 1 : 0), [v, y] = A(s ? 1 : 0);
935
- F(() => {
936
- const m = d.get(o);
937
- let R = !0;
938
- if (m && m.tokens) {
939
- const I = _ === v;
940
- if (I && m.userInfo())
291
+ }), [l, a] = f(n ? 1 : 0), [d, u] = f(n ? 1 : 0);
292
+ v(() => {
293
+ const h = r.get(t);
294
+ let p = !0;
295
+ if (h && h.tokens) {
296
+ const y = l === d;
297
+ if (y && h.userInfo())
941
298
  return;
942
- l({
943
- ...c,
299
+ c({
300
+ ...o,
944
301
  status: "Loading user"
945
302
  /* Loading */
946
- }), m.userInfoAsync(!I, a).then((q) => {
947
- R && l({
948
- user: q,
303
+ }), h.userInfoAsync(!y, s).then((S) => {
304
+ p && c({
305
+ user: S,
949
306
  status: "User loaded"
950
307
  /* Loaded */
951
308
  });
952
- }).catch(() => l({
953
- ...c,
309
+ }).catch(() => c({
310
+ ...o,
954
311
  status: "Error loading user"
955
312
  /* LoadingError */
956
- })), y(_);
313
+ })), u(l);
957
314
  } else
958
- l({
315
+ c({
959
316
  user: null,
960
317
  status: "Unauthenticated"
961
318
  /* Unauthenticated */
962
319
  });
963
- const j = m.subscribeEvents((I) => {
964
- (I === d.eventNames.logout_from_another_tab || I === d.eventNames.logout_from_same_tab) && R && l({
320
+ const g = h.subscribeEvents((y) => {
321
+ (y === r.eventNames.logout_from_another_tab || y === r.eventNames.logout_from_same_tab) && p && c({
965
322
  user: null,
966
323
  status: "Unauthenticated"
967
324
  /* Unauthenticated */
968
325
  });
969
326
  });
970
327
  return () => {
971
- R = !1, m.removeEventSubscription(j);
328
+ p = !1, h.removeEventSubscription(g);
972
329
  };
973
- }, [_]);
974
- const b = () => {
975
- u(_ + 1);
330
+ }, [l]);
331
+ const _ = () => {
332
+ a(l + 1);
976
333
  };
977
- return { oidcUser: c.user, oidcUserLoadingState: c.status, reloadOidcUser: b };
334
+ return { oidcUser: o.user, oidcUserLoadingState: o.status, reloadOidcUser: _ };
978
335
  };
979
336
  export {
980
- cr as OidcClient,
981
- lr as OidcLocation,
982
- er as OidcProvider,
983
- Kt as OidcSecure,
984
- Xt as OidcUserStatus,
985
- ur as TokenAutomaticRenewMode,
986
- dr as TokenRenewMode,
987
- rr as useOidc,
988
- nr as useOidcAccessToken,
989
- St as useOidcFetch,
990
- or as useOidcIdToken,
991
- sr as useOidcUser,
992
- Zt as withOidcFetch,
993
- tr as withOidcSecure
337
+ Me as OidcClient,
338
+ De as OidcLocation,
339
+ Pe as OidcProvider,
340
+ ge as OidcSecure,
341
+ me as OidcUserStatus,
342
+ xe as TokenAutomaticRenewMode,
343
+ We as TokenRenewMode,
344
+ Se as useOidc,
345
+ Ne as useOidcAccessToken,
346
+ ne as useOidcFetch,
347
+ Le as useOidcIdToken,
348
+ Ie as useOidcUser,
349
+ Oe as withOidcFetch,
350
+ Ee as withOidcSecure
994
351
  };