@wandelbots/wandelbots-js-react-components 3.4.0-pr.feat-yaskawa-gp200s.437.5d50e5b → 3.4.0-pr.feat-add-yaskawa-gp200s.438.0503e4b
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/README.md +10 -61
- package/dist/auth0-spa-js.production.esm-1QXzndwB.js +950 -0
- package/dist/auth0-spa-js.production.esm-1QXzndwB.js.map +1 -0
- package/dist/auth0-spa-js.production.esm-BLRAk7Yh.cjs +5 -0
- package/dist/auth0-spa-js.production.esm-BLRAk7Yh.cjs.map +1 -0
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +1 -1
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts.map +1 -1
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/ColliderCollection.d.ts +1 -1
- package/dist/components/3d-viewport/collider/ColliderCollection.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/ColliderElement.d.ts +1 -1
- package/dist/components/3d-viewport/collider/ColliderElement.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts +1 -1
- package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts +1 -1
- package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts.map +1 -1
- package/dist/components/ProgramStateIndicator.d.ts +3 -3
- package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
- package/dist/components/RobotCard.d.ts +3 -4
- package/dist/components/RobotCard.d.ts.map +1 -1
- package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
- package/dist/components/jogging/JoggingStore.d.ts +5 -10
- package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
- package/dist/components/jogging/PoseCartesianValues.d.ts +2 -2
- package/dist/components/jogging/PoseCartesianValues.d.ts.map +1 -1
- package/dist/components/jogging/PoseJointValues.d.ts +2 -1
- package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
- package/dist/components/robots/DHRobot.d.ts.map +1 -1
- package/dist/components/robots/Robot.d.ts +1 -1
- package/dist/components/robots/Robot.d.ts.map +1 -1
- package/dist/components/robots/RobotAnimator.d.ts +2 -2
- package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
- package/dist/components/robots/SupportedRobot.d.ts +3 -3
- package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
- package/dist/components/robots/manufacturerHomePositions.d.ts +1 -1
- package/dist/components/robots/manufacturerHomePositions.d.ts.map +1 -1
- package/dist/components/safetyBar/ControllerTypeIndicator.d.ts.map +1 -1
- package/dist/components/safetyBar/OperationModeIndicator.d.ts +2 -2
- package/dist/components/safetyBar/OperationModeIndicator.d.ts.map +1 -1
- package/dist/components/safetyBar/SafetyBar.d.ts +3 -3
- package/dist/components/safetyBar/SafetyBar.d.ts.map +1 -1
- package/dist/components/safetyBar/SafetyStateIndicator.d.ts +2 -2
- package/dist/components/safetyBar/SafetyStateIndicator.d.ts.map +1 -1
- package/dist/components/utils/errorHandling.d.ts.map +1 -1
- package/dist/index.cjs +155 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +39 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34927 -0
- package/dist/index.js.map +1 -0
- package/package.json +21 -49
- package/src/components/3d-viewport/CoordinateSystemTransform.tsx +1 -1
- package/src/components/3d-viewport/SafetyZonesRenderer.tsx +2 -1
- package/src/components/3d-viewport/collider/ColliderCollection.tsx +1 -1
- package/src/components/3d-viewport/collider/ColliderElement.tsx +1 -1
- package/src/components/3d-viewport/collider/CollisionSceneRenderer.tsx +1 -1
- package/src/components/3d-viewport/collider/colliderShapeToBufferGeometry.ts +1 -1
- package/src/components/AppHeader.md +1 -1
- package/src/components/ProgramStateIndicator.tsx +6 -3
- package/src/components/RobotCard.tsx +7 -4
- package/src/components/jogging/JoggingCartesianTab.tsx +11 -13
- package/src/components/jogging/JoggingJointLimitDetector.tsx +2 -2
- package/src/components/jogging/JoggingJointTab.tsx +4 -4
- package/src/components/jogging/JoggingOptions.tsx +5 -6
- package/src/components/jogging/JoggingPanel.tsx +3 -6
- package/src/components/jogging/JoggingStore.ts +39 -66
- package/src/components/jogging/PoseCartesianValues.tsx +4 -3
- package/src/components/jogging/PoseJointValues.tsx +4 -3
- package/src/components/robots/DHRobot.tsx +3 -2
- package/src/components/robots/Robot.tsx +1 -1
- package/src/components/robots/RobotAnimator.test.tsx +22 -7
- package/src/components/robots/RobotAnimator.tsx +13 -8
- package/src/components/robots/SupportedRobot.tsx +6 -3
- package/src/components/robots/manufacturerHomePositions.ts +1 -1
- package/src/components/safetyBar/ControllerTypeIndicator.tsx +2 -4
- package/src/components/safetyBar/OperationModeIndicator.tsx +5 -7
- package/src/components/safetyBar/SafetyBar.tsx +6 -3
- package/src/components/safetyBar/SafetyStateIndicator.tsx +7 -9
- package/src/components/utils/errorHandling.ts +0 -4
- package/src/i18n/locales/de/translations.json +0 -3
- package/src/i18n/locales/en/translations.json +0 -3
- package/src/index.ts +43 -4
- package/dist/3d.cjs.js +0 -2
- package/dist/3d.cjs.js.map +0 -1
- package/dist/3d.d.ts +0 -11
- package/dist/3d.d.ts.map +0 -1
- package/dist/3d.es.js +0 -16
- package/dist/3d.es.js.map +0 -1
- package/dist/LoadingCover-Dr9hDTku.js +0 -87
- package/dist/LoadingCover-Dr9hDTku.js.map +0 -1
- package/dist/LoadingCover-r2yhJZF9.cjs +0 -2
- package/dist/LoadingCover-r2yhJZF9.cjs.map +0 -1
- package/dist/WandelscriptEditor-Dj7TBCkF.cjs +0 -2
- package/dist/WandelscriptEditor-Dj7TBCkF.cjs.map +0 -1
- package/dist/WandelscriptEditor-DnJvITTA.js +0 -140
- package/dist/WandelscriptEditor-DnJvITTA.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-9WdmjTxR.js +0 -1429
- package/dist/auth0-spa-js.production.esm-9WdmjTxR.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-BcLLh1tx.cjs +0 -5
- package/dist/auth0-spa-js.production.esm-BcLLh1tx.cjs.map +0 -1
- package/dist/components/jogging/JoggingBlocked.d.ts +0 -7
- package/dist/components/jogging/JoggingBlocked.d.ts.map +0 -1
- package/dist/components/utils/errorHandling.test.d.ts +0 -2
- package/dist/components/utils/errorHandling.test.d.ts.map +0 -1
- package/dist/core.cjs.js +0 -2
- package/dist/core.cjs.js.map +0 -1
- package/dist/core.d.ts +0 -33
- package/dist/core.d.ts.map +0 -1
- package/dist/core.es.js +0 -54
- package/dist/core.es.js.map +0 -1
- package/dist/index-CAib4NKw.js +0 -2261
- package/dist/index-CAib4NKw.js.map +0 -1
- package/dist/index-CqMZL0FV.cjs +0 -2
- package/dist/index-CqMZL0FV.cjs.map +0 -1
- package/dist/index-CxasuX80.js +0 -5212
- package/dist/index-CxasuX80.js.map +0 -1
- package/dist/index-DxwppshT.cjs +0 -29
- package/dist/index-DxwppshT.cjs.map +0 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -69
- package/dist/index.es.js.map +0 -1
- package/dist/lib/ConnectedMotionGroup.d.ts +0 -90
- package/dist/lib/ConnectedMotionGroup.d.ts.map +0 -1
- package/dist/lib/JoggerConnection.d.ts +0 -113
- package/dist/lib/JoggerConnection.d.ts.map +0 -1
- package/dist/lib/JoggerConnection.test.d.ts +0 -2
- package/dist/lib/JoggerConnection.test.d.ts.map +0 -1
- package/dist/lib/MotionStreamConnection.d.ts +0 -24
- package/dist/lib/MotionStreamConnection.d.ts.map +0 -1
- package/dist/lib/MotionStreamConnection.test.d.ts +0 -2
- package/dist/lib/MotionStreamConnection.test.d.ts.map +0 -1
- package/dist/lib/motionStateUpdate.d.ts +0 -7
- package/dist/lib/motionStateUpdate.d.ts.map +0 -1
- package/dist/lib/motionStateUpdate.test.d.ts +0 -2
- package/dist/lib/motionStateUpdate.test.d.ts.map +0 -1
- package/dist/manufacturerHomePositions-Ca80ycLi.cjs +0 -2
- package/dist/manufacturerHomePositions-Ca80ycLi.cjs.map +0 -1
- package/dist/manufacturerHomePositions-CgaG5vaK.js +0 -976
- package/dist/manufacturerHomePositions-CgaG5vaK.js.map +0 -1
- package/dist/theming-BQcKj8Gp.cjs +0 -133
- package/dist/theming-BQcKj8Gp.cjs.map +0 -1
- package/dist/theming-Bafjg0Wg.js +0 -23460
- package/dist/theming-Bafjg0Wg.js.map +0 -1
- package/dist/wandelscript.cjs.js +0 -2
- package/dist/wandelscript.cjs.js.map +0 -1
- package/dist/wandelscript.d.ts +0 -2
- package/dist/wandelscript.d.ts.map +0 -1
- package/dist/wandelscript.es.js +0 -5
- package/dist/wandelscript.es.js.map +0 -1
- package/src/3d.ts +0 -15
- package/src/components/jogging/JoggingBlocked.tsx +0 -37
- package/src/components/utils/errorHandling.test.ts +0 -41
- package/src/core.ts +0 -33
- package/src/lib/ConnectedMotionGroup.ts +0 -444
- package/src/lib/JoggerConnection.test.ts +0 -120
- package/src/lib/JoggerConnection.ts +0 -674
- package/src/lib/MotionStreamConnection.test.ts +0 -23
- package/src/lib/MotionStreamConnection.ts +0 -189
- package/src/lib/motionStateUpdate.test.ts +0 -28
- package/src/lib/motionStateUpdate.ts +0 -117
- package/src/wandelscript.ts +0 -2
|
@@ -1,1429 +0,0 @@
|
|
|
1
|
-
function I(i, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && e.indexOf(n) < 0 && (t[n] = i[n]);
|
|
4
|
-
if (i != null && typeof Object.getOwnPropertySymbols == "function") {
|
|
5
|
-
var o = 0;
|
|
6
|
-
for (n = Object.getOwnPropertySymbols(i); o < n.length; o++) e.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(i, n[o]) && (t[n[o]] = i[n[o]]);
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
}
|
|
10
|
-
var C = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
11
|
-
function Q(i) {
|
|
12
|
-
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
13
|
-
}
|
|
14
|
-
function ee(i, e) {
|
|
15
|
-
return i(e = { exports: {} }, e.exports), e.exports;
|
|
16
|
-
}
|
|
17
|
-
var O = ee((function(i, e) {
|
|
18
|
-
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
19
|
-
var t = (function() {
|
|
20
|
-
function n() {
|
|
21
|
-
var o = this;
|
|
22
|
-
this.locked = /* @__PURE__ */ new Map(), this.addToLocked = function(r, a) {
|
|
23
|
-
var h = o.locked.get(r);
|
|
24
|
-
h === void 0 ? a === void 0 ? o.locked.set(r, []) : o.locked.set(r, [a]) : a !== void 0 && (h.unshift(a), o.locked.set(r, h));
|
|
25
|
-
}, this.isLocked = function(r) {
|
|
26
|
-
return o.locked.has(r);
|
|
27
|
-
}, this.lock = function(r) {
|
|
28
|
-
return new Promise((function(a, h) {
|
|
29
|
-
o.isLocked(r) ? o.addToLocked(r, a) : (o.addToLocked(r), a());
|
|
30
|
-
}));
|
|
31
|
-
}, this.unlock = function(r) {
|
|
32
|
-
var a = o.locked.get(r);
|
|
33
|
-
if (a !== void 0 && a.length !== 0) {
|
|
34
|
-
var h = a.pop();
|
|
35
|
-
o.locked.set(r, a), h !== void 0 && setTimeout(h, 0);
|
|
36
|
-
} else o.locked.delete(r);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return n.getInstance = function() {
|
|
40
|
-
return n.instance === void 0 && (n.instance = new n()), n.instance;
|
|
41
|
-
}, n;
|
|
42
|
-
})();
|
|
43
|
-
e.default = function() {
|
|
44
|
-
return t.getInstance();
|
|
45
|
-
};
|
|
46
|
-
}));
|
|
47
|
-
Q(O);
|
|
48
|
-
var je = Q(ee((function(i, e) {
|
|
49
|
-
var t = C && C.__awaiter || function(s, c, d, l) {
|
|
50
|
-
return new (d || (d = Promise))((function(m, y) {
|
|
51
|
-
function g(w) {
|
|
52
|
-
try {
|
|
53
|
-
b(l.next(w));
|
|
54
|
-
} catch (f) {
|
|
55
|
-
y(f);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function k(w) {
|
|
59
|
-
try {
|
|
60
|
-
b(l.throw(w));
|
|
61
|
-
} catch (f) {
|
|
62
|
-
y(f);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function b(w) {
|
|
66
|
-
w.done ? m(w.value) : new d((function(f) {
|
|
67
|
-
f(w.value);
|
|
68
|
-
})).then(g, k);
|
|
69
|
-
}
|
|
70
|
-
b((l = l.apply(s, c || [])).next());
|
|
71
|
-
}));
|
|
72
|
-
}, n = C && C.__generator || function(s, c) {
|
|
73
|
-
var d, l, m, y, g = { label: 0, sent: function() {
|
|
74
|
-
if (1 & m[0]) throw m[1];
|
|
75
|
-
return m[1];
|
|
76
|
-
}, trys: [], ops: [] };
|
|
77
|
-
return y = { next: k(0), throw: k(1), return: k(2) }, typeof Symbol == "function" && (y[Symbol.iterator] = function() {
|
|
78
|
-
return this;
|
|
79
|
-
}), y;
|
|
80
|
-
function k(b) {
|
|
81
|
-
return function(w) {
|
|
82
|
-
return (function(f) {
|
|
83
|
-
if (d) throw new TypeError("Generator is already executing.");
|
|
84
|
-
for (; g; ) try {
|
|
85
|
-
if (d = 1, l && (m = 2 & f[0] ? l.return : f[0] ? l.throw || ((m = l.return) && m.call(l), 0) : l.next) && !(m = m.call(l, f[1])).done) return m;
|
|
86
|
-
switch (l = 0, m && (f = [2 & f[0], m.value]), f[0]) {
|
|
87
|
-
case 0:
|
|
88
|
-
case 1:
|
|
89
|
-
m = f;
|
|
90
|
-
break;
|
|
91
|
-
case 4:
|
|
92
|
-
return g.label++, { value: f[1], done: !1 };
|
|
93
|
-
case 5:
|
|
94
|
-
g.label++, l = f[1], f = [0];
|
|
95
|
-
continue;
|
|
96
|
-
case 7:
|
|
97
|
-
f = g.ops.pop(), g.trys.pop();
|
|
98
|
-
continue;
|
|
99
|
-
default:
|
|
100
|
-
if (m = g.trys, !((m = m.length > 0 && m[m.length - 1]) || f[0] !== 6 && f[0] !== 2)) {
|
|
101
|
-
g = 0;
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
if (f[0] === 3 && (!m || f[1] > m[0] && f[1] < m[3])) {
|
|
105
|
-
g.label = f[1];
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
if (f[0] === 6 && g.label < m[1]) {
|
|
109
|
-
g.label = m[1], m = f;
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
if (m && g.label < m[2]) {
|
|
113
|
-
g.label = m[2], g.ops.push(f);
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
m[2] && g.ops.pop(), g.trys.pop();
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
f = c.call(s, g);
|
|
120
|
-
} catch (S) {
|
|
121
|
-
f = [6, S], l = 0;
|
|
122
|
-
} finally {
|
|
123
|
-
d = m = 0;
|
|
124
|
-
}
|
|
125
|
-
if (5 & f[0]) throw f[1];
|
|
126
|
-
return { value: f[0] ? f[1] : void 0, done: !0 };
|
|
127
|
-
})([b, w]);
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
}, o = C;
|
|
131
|
-
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
132
|
-
var r = "browser-tabs-lock-key", a = { key: function(s) {
|
|
133
|
-
return t(o, void 0, void 0, (function() {
|
|
134
|
-
return n(this, (function(c) {
|
|
135
|
-
throw new Error("Unsupported");
|
|
136
|
-
}));
|
|
137
|
-
}));
|
|
138
|
-
}, getItem: function(s) {
|
|
139
|
-
return t(o, void 0, void 0, (function() {
|
|
140
|
-
return n(this, (function(c) {
|
|
141
|
-
throw new Error("Unsupported");
|
|
142
|
-
}));
|
|
143
|
-
}));
|
|
144
|
-
}, clear: function() {
|
|
145
|
-
return t(o, void 0, void 0, (function() {
|
|
146
|
-
return n(this, (function(s) {
|
|
147
|
-
return [2, window.localStorage.clear()];
|
|
148
|
-
}));
|
|
149
|
-
}));
|
|
150
|
-
}, removeItem: function(s) {
|
|
151
|
-
return t(o, void 0, void 0, (function() {
|
|
152
|
-
return n(this, (function(c) {
|
|
153
|
-
throw new Error("Unsupported");
|
|
154
|
-
}));
|
|
155
|
-
}));
|
|
156
|
-
}, setItem: function(s, c) {
|
|
157
|
-
return t(o, void 0, void 0, (function() {
|
|
158
|
-
return n(this, (function(d) {
|
|
159
|
-
throw new Error("Unsupported");
|
|
160
|
-
}));
|
|
161
|
-
}));
|
|
162
|
-
}, keySync: function(s) {
|
|
163
|
-
return window.localStorage.key(s);
|
|
164
|
-
}, getItemSync: function(s) {
|
|
165
|
-
return window.localStorage.getItem(s);
|
|
166
|
-
}, clearSync: function() {
|
|
167
|
-
return window.localStorage.clear();
|
|
168
|
-
}, removeItemSync: function(s) {
|
|
169
|
-
return window.localStorage.removeItem(s);
|
|
170
|
-
}, setItemSync: function(s, c) {
|
|
171
|
-
return window.localStorage.setItem(s, c);
|
|
172
|
-
} };
|
|
173
|
-
function h(s) {
|
|
174
|
-
return new Promise((function(c) {
|
|
175
|
-
return setTimeout(c, s);
|
|
176
|
-
}));
|
|
177
|
-
}
|
|
178
|
-
function u(s) {
|
|
179
|
-
for (var c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz", d = "", l = 0; l < s; l++)
|
|
180
|
-
d += c[Math.floor(Math.random() * c.length)];
|
|
181
|
-
return d;
|
|
182
|
-
}
|
|
183
|
-
var p = (function() {
|
|
184
|
-
function s(c) {
|
|
185
|
-
this.acquiredIatSet = /* @__PURE__ */ new Set(), this.storageHandler = void 0, this.id = Date.now().toString() + u(15), this.acquireLock = this.acquireLock.bind(this), this.releaseLock = this.releaseLock.bind(this), this.releaseLock__private__ = this.releaseLock__private__.bind(this), this.waitForSomethingToChange = this.waitForSomethingToChange.bind(this), this.refreshLockWhileAcquired = this.refreshLockWhileAcquired.bind(this), this.storageHandler = c, s.waiters === void 0 && (s.waiters = []);
|
|
186
|
-
}
|
|
187
|
-
return s.prototype.acquireLock = function(c, d) {
|
|
188
|
-
return d === void 0 && (d = 5e3), t(this, void 0, void 0, (function() {
|
|
189
|
-
var l, m, y, g, k, b, w;
|
|
190
|
-
return n(this, (function(f) {
|
|
191
|
-
switch (f.label) {
|
|
192
|
-
case 0:
|
|
193
|
-
l = Date.now() + u(4), m = Date.now() + d, y = r + "-" + c, g = this.storageHandler === void 0 ? a : this.storageHandler, f.label = 1;
|
|
194
|
-
case 1:
|
|
195
|
-
return Date.now() < m ? [4, h(30)] : [3, 8];
|
|
196
|
-
case 2:
|
|
197
|
-
return f.sent(), g.getItemSync(y) !== null ? [3, 5] : (k = this.id + "-" + c + "-" + l, [4, h(Math.floor(25 * Math.random()))]);
|
|
198
|
-
case 3:
|
|
199
|
-
return f.sent(), g.setItemSync(y, JSON.stringify({ id: this.id, iat: l, timeoutKey: k, timeAcquired: Date.now(), timeRefreshed: Date.now() })), [4, h(30)];
|
|
200
|
-
case 4:
|
|
201
|
-
return f.sent(), (b = g.getItemSync(y)) !== null && (w = JSON.parse(b)).id === this.id && w.iat === l ? (this.acquiredIatSet.add(l), this.refreshLockWhileAcquired(y, l), [2, !0]) : [3, 7];
|
|
202
|
-
case 5:
|
|
203
|
-
return s.lockCorrector(this.storageHandler === void 0 ? a : this.storageHandler), [4, this.waitForSomethingToChange(m)];
|
|
204
|
-
case 6:
|
|
205
|
-
f.sent(), f.label = 7;
|
|
206
|
-
case 7:
|
|
207
|
-
return l = Date.now() + u(4), [3, 1];
|
|
208
|
-
case 8:
|
|
209
|
-
return [2, !1];
|
|
210
|
-
}
|
|
211
|
-
}));
|
|
212
|
-
}));
|
|
213
|
-
}, s.prototype.refreshLockWhileAcquired = function(c, d) {
|
|
214
|
-
return t(this, void 0, void 0, (function() {
|
|
215
|
-
var l = this;
|
|
216
|
-
return n(this, (function(m) {
|
|
217
|
-
return setTimeout((function() {
|
|
218
|
-
return t(l, void 0, void 0, (function() {
|
|
219
|
-
var y, g, k;
|
|
220
|
-
return n(this, (function(b) {
|
|
221
|
-
switch (b.label) {
|
|
222
|
-
case 0:
|
|
223
|
-
return [4, O.default().lock(d)];
|
|
224
|
-
case 1:
|
|
225
|
-
return b.sent(), this.acquiredIatSet.has(d) ? (y = this.storageHandler === void 0 ? a : this.storageHandler, (g = y.getItemSync(c)) === null ? (O.default().unlock(d), [2]) : ((k = JSON.parse(g)).timeRefreshed = Date.now(), y.setItemSync(c, JSON.stringify(k)), O.default().unlock(d), this.refreshLockWhileAcquired(c, d), [2])) : (O.default().unlock(d), [2]);
|
|
226
|
-
}
|
|
227
|
-
}));
|
|
228
|
-
}));
|
|
229
|
-
}), 1e3), [2];
|
|
230
|
-
}));
|
|
231
|
-
}));
|
|
232
|
-
}, s.prototype.waitForSomethingToChange = function(c) {
|
|
233
|
-
return t(this, void 0, void 0, (function() {
|
|
234
|
-
return n(this, (function(d) {
|
|
235
|
-
switch (d.label) {
|
|
236
|
-
case 0:
|
|
237
|
-
return [4, new Promise((function(l) {
|
|
238
|
-
var m = !1, y = Date.now(), g = !1;
|
|
239
|
-
function k() {
|
|
240
|
-
if (g || (window.removeEventListener("storage", k), s.removeFromWaiting(k), clearTimeout(b), g = !0), !m) {
|
|
241
|
-
m = !0;
|
|
242
|
-
var w = 50 - (Date.now() - y);
|
|
243
|
-
w > 0 ? setTimeout(l, w) : l(null);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
window.addEventListener("storage", k), s.addToWaiting(k);
|
|
247
|
-
var b = setTimeout(k, Math.max(0, c - Date.now()));
|
|
248
|
-
}))];
|
|
249
|
-
case 1:
|
|
250
|
-
return d.sent(), [2];
|
|
251
|
-
}
|
|
252
|
-
}));
|
|
253
|
-
}));
|
|
254
|
-
}, s.addToWaiting = function(c) {
|
|
255
|
-
this.removeFromWaiting(c), s.waiters !== void 0 && s.waiters.push(c);
|
|
256
|
-
}, s.removeFromWaiting = function(c) {
|
|
257
|
-
s.waiters !== void 0 && (s.waiters = s.waiters.filter((function(d) {
|
|
258
|
-
return d !== c;
|
|
259
|
-
})));
|
|
260
|
-
}, s.notifyWaiters = function() {
|
|
261
|
-
s.waiters !== void 0 && s.waiters.slice().forEach((function(c) {
|
|
262
|
-
return c();
|
|
263
|
-
}));
|
|
264
|
-
}, s.prototype.releaseLock = function(c) {
|
|
265
|
-
return t(this, void 0, void 0, (function() {
|
|
266
|
-
return n(this, (function(d) {
|
|
267
|
-
switch (d.label) {
|
|
268
|
-
case 0:
|
|
269
|
-
return [4, this.releaseLock__private__(c)];
|
|
270
|
-
case 1:
|
|
271
|
-
return [2, d.sent()];
|
|
272
|
-
}
|
|
273
|
-
}));
|
|
274
|
-
}));
|
|
275
|
-
}, s.prototype.releaseLock__private__ = function(c) {
|
|
276
|
-
return t(this, void 0, void 0, (function() {
|
|
277
|
-
var d, l, m, y;
|
|
278
|
-
return n(this, (function(g) {
|
|
279
|
-
switch (g.label) {
|
|
280
|
-
case 0:
|
|
281
|
-
return d = this.storageHandler === void 0 ? a : this.storageHandler, l = r + "-" + c, (m = d.getItemSync(l)) === null ? [2] : (y = JSON.parse(m)).id !== this.id ? [3, 2] : [4, O.default().lock(y.iat)];
|
|
282
|
-
case 1:
|
|
283
|
-
g.sent(), this.acquiredIatSet.delete(y.iat), d.removeItemSync(l), O.default().unlock(y.iat), s.notifyWaiters(), g.label = 2;
|
|
284
|
-
case 2:
|
|
285
|
-
return [2];
|
|
286
|
-
}
|
|
287
|
-
}));
|
|
288
|
-
}));
|
|
289
|
-
}, s.lockCorrector = function(c) {
|
|
290
|
-
for (var d = Date.now() - 5e3, l = c, m = [], y = 0; ; ) {
|
|
291
|
-
var g = l.keySync(y);
|
|
292
|
-
if (g === null) break;
|
|
293
|
-
m.push(g), y++;
|
|
294
|
-
}
|
|
295
|
-
for (var k = !1, b = 0; b < m.length; b++) {
|
|
296
|
-
var w = m[b];
|
|
297
|
-
if (w.includes(r)) {
|
|
298
|
-
var f = l.getItemSync(w);
|
|
299
|
-
if (f !== null) {
|
|
300
|
-
var S = JSON.parse(f);
|
|
301
|
-
(S.timeRefreshed === void 0 && S.timeAcquired < d || S.timeRefreshed !== void 0 && S.timeRefreshed < d) && (l.removeItemSync(w), k = !0);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
k && s.notifyWaiters();
|
|
306
|
-
}, s.waiters = void 0, s;
|
|
307
|
-
})();
|
|
308
|
-
e.default = p;
|
|
309
|
-
})));
|
|
310
|
-
const Ke = { timeoutInSeconds: 60 }, be = { name: "auth0-spa-js", version: "2.11.0" }, ke = () => Date.now();
|
|
311
|
-
class v extends Error {
|
|
312
|
-
constructor(e, t) {
|
|
313
|
-
super(t), this.error = e, this.error_description = t, Object.setPrototypeOf(this, v.prototype);
|
|
314
|
-
}
|
|
315
|
-
static fromPayload({ error: e, error_description: t }) {
|
|
316
|
-
return new v(e, t);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
class te extends v {
|
|
320
|
-
constructor(e, t, n, o = null) {
|
|
321
|
-
super(e, t), this.state = n, this.appState = o, Object.setPrototypeOf(this, te.prototype);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
class ne extends v {
|
|
325
|
-
constructor(e, t, n, o, r = null) {
|
|
326
|
-
super(e, t), this.connection = n, this.state = o, this.appState = r, Object.setPrototypeOf(this, ne.prototype);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
class U extends v {
|
|
330
|
-
constructor() {
|
|
331
|
-
super("timeout", "Timeout"), Object.setPrototypeOf(this, U.prototype);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
class oe extends U {
|
|
335
|
-
constructor(e) {
|
|
336
|
-
super(), this.popup = e, Object.setPrototypeOf(this, oe.prototype);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
class ie extends v {
|
|
340
|
-
constructor(e) {
|
|
341
|
-
super("cancelled", "Popup closed"), this.popup = e, Object.setPrototypeOf(this, ie.prototype);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
class re extends v {
|
|
345
|
-
constructor() {
|
|
346
|
-
super("popup_open", "Unable to open a popup for loginWithPopup - window.open returned `null`"), Object.setPrototypeOf(this, re.prototype);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
class se extends v {
|
|
350
|
-
constructor(e, t, n) {
|
|
351
|
-
super(e, t), this.mfa_token = n, Object.setPrototypeOf(this, se.prototype);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
class V extends v {
|
|
355
|
-
constructor(e, t) {
|
|
356
|
-
super("missing_refresh_token", `Missing Refresh Token (audience: '${W(e, ["default"])}', scope: '${W(t)}')`), this.audience = e, this.scope = t, Object.setPrototypeOf(this, V.prototype);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
class ae extends v {
|
|
360
|
-
constructor(e, t) {
|
|
361
|
-
super("missing_scopes", `Missing requested scopes after refresh (audience: '${W(e, ["default"])}', missing scope: '${W(t)}')`), this.audience = e, this.scope = t, Object.setPrototypeOf(this, ae.prototype);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
class F extends v {
|
|
365
|
-
constructor(e) {
|
|
366
|
-
super("use_dpop_nonce", "Server rejected DPoP proof: wrong nonce"), this.newDpopNonce = e, Object.setPrototypeOf(this, F.prototype);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
function W(i, e = []) {
|
|
370
|
-
return i && !e.includes(i) ? i : "";
|
|
371
|
-
}
|
|
372
|
-
const J = () => window.crypto, N = () => {
|
|
373
|
-
const i = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";
|
|
374
|
-
let e = "";
|
|
375
|
-
return Array.from(J().getRandomValues(new Uint8Array(43))).forEach(((t) => e += i[t % i.length])), e;
|
|
376
|
-
}, G = (i) => btoa(i), xe = [{ key: "name", type: ["string"] }, { key: "version", type: ["string", "number"] }, { key: "env", type: ["object"] }], ze = (i) => Object.keys(i).reduce(((e, t) => {
|
|
377
|
-
const n = xe.find(((o) => o.key === t));
|
|
378
|
-
return n && n.type.includes(typeof i[t]) && (e[t] = i[t]), e;
|
|
379
|
-
}), {}), B = (i) => {
|
|
380
|
-
var { clientId: e } = i, t = I(i, ["clientId"]);
|
|
381
|
-
return new URLSearchParams(((n) => Object.keys(n).filter(((o) => n[o] !== void 0)).reduce(((o, r) => Object.assign(Object.assign({}, o), { [r]: n[r] })), {}))(Object.assign({ client_id: e }, t))).toString();
|
|
382
|
-
}, ue = async (i) => await J().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(i)), he = (i) => ((e) => decodeURIComponent(atob(e).split("").map(((t) => "%" + ("00" + t.charCodeAt(0).toString(16)).slice(-2))).join("")))(i.replace(/_/g, "/").replace(/-/g, "+")), de = (i) => {
|
|
383
|
-
const e = new Uint8Array(i);
|
|
384
|
-
return ((t) => {
|
|
385
|
-
const n = { "+": "-", "/": "_", "=": "" };
|
|
386
|
-
return t.replace(/[+/=]/g, ((o) => n[o]));
|
|
387
|
-
})(window.btoa(String.fromCharCode(...Array.from(e))));
|
|
388
|
-
}, Ee = new TextEncoder(), Ne = new TextDecoder();
|
|
389
|
-
function D(i) {
|
|
390
|
-
return typeof i == "string" ? Ee.encode(i) : Ne.decode(i);
|
|
391
|
-
}
|
|
392
|
-
function le(i) {
|
|
393
|
-
if (typeof i.modulusLength != "number" || i.modulusLength < 2048) throw new De(`${i.name} modulusLength must be at least 2048 bits`);
|
|
394
|
-
}
|
|
395
|
-
async function Re(i, e, t) {
|
|
396
|
-
if (t.usages.includes("sign") === !1) throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');
|
|
397
|
-
const n = `${A(D(JSON.stringify(i)))}.${A(D(JSON.stringify(e)))}`;
|
|
398
|
-
return `${n}.${A(await crypto.subtle.sign((function(o) {
|
|
399
|
-
switch (o.algorithm.name) {
|
|
400
|
-
case "ECDSA":
|
|
401
|
-
return { name: o.algorithm.name, hash: "SHA-256" };
|
|
402
|
-
case "RSA-PSS":
|
|
403
|
-
return le(o.algorithm), { name: o.algorithm.name, saltLength: 32 };
|
|
404
|
-
case "RSASSA-PKCS1-v1_5":
|
|
405
|
-
return le(o.algorithm), { name: o.algorithm.name };
|
|
406
|
-
case "Ed25519":
|
|
407
|
-
return { name: o.algorithm.name };
|
|
408
|
-
}
|
|
409
|
-
throw new K();
|
|
410
|
-
})(t), t, D(n)))}`;
|
|
411
|
-
}
|
|
412
|
-
let q;
|
|
413
|
-
Uint8Array.prototype.toBase64 ? q = (i) => (i instanceof ArrayBuffer && (i = new Uint8Array(i)), i.toBase64({ alphabet: "base64url", omitPadding: !0 })) : q = (e) => {
|
|
414
|
-
e instanceof ArrayBuffer && (e = new Uint8Array(e));
|
|
415
|
-
const t = [];
|
|
416
|
-
for (let n = 0; n < e.byteLength; n += 32768) t.push(String.fromCharCode.apply(null, e.subarray(n, n + 32768)));
|
|
417
|
-
return btoa(t.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
418
|
-
};
|
|
419
|
-
function A(i) {
|
|
420
|
-
return q(i);
|
|
421
|
-
}
|
|
422
|
-
class K extends Error {
|
|
423
|
-
constructor(e) {
|
|
424
|
-
var t;
|
|
425
|
-
super(e ?? "operation not supported"), this.name = this.constructor.name, (t = Error.captureStackTrace) === null || t === void 0 || t.call(Error, this, this.constructor);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
class De extends Error {
|
|
429
|
-
constructor(e) {
|
|
430
|
-
var t;
|
|
431
|
-
super(e), this.name = this.constructor.name, (t = Error.captureStackTrace) === null || t === void 0 || t.call(Error, this, this.constructor);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
function Ae(i) {
|
|
435
|
-
switch (i.algorithm.name) {
|
|
436
|
-
case "RSA-PSS":
|
|
437
|
-
return (function(e) {
|
|
438
|
-
if (e.algorithm.hash.name === "SHA-256") return "PS256";
|
|
439
|
-
throw new K("unsupported RsaHashedKeyAlgorithm hash name");
|
|
440
|
-
})(i);
|
|
441
|
-
case "RSASSA-PKCS1-v1_5":
|
|
442
|
-
return (function(e) {
|
|
443
|
-
if (e.algorithm.hash.name === "SHA-256") return "RS256";
|
|
444
|
-
throw new K("unsupported RsaHashedKeyAlgorithm hash name");
|
|
445
|
-
})(i);
|
|
446
|
-
case "ECDSA":
|
|
447
|
-
return (function(e) {
|
|
448
|
-
if (e.algorithm.namedCurve === "P-256") return "ES256";
|
|
449
|
-
throw new K("unsupported EcKeyAlgorithm namedCurve");
|
|
450
|
-
})(i);
|
|
451
|
-
case "Ed25519":
|
|
452
|
-
return "Ed25519";
|
|
453
|
-
default:
|
|
454
|
-
throw new K("unsupported CryptoKey algorithm name");
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
function ve(i) {
|
|
458
|
-
return i instanceof CryptoKey;
|
|
459
|
-
}
|
|
460
|
-
function _e(i) {
|
|
461
|
-
return ve(i) && i.type === "public";
|
|
462
|
-
}
|
|
463
|
-
async function Ue(i, e, t, n, o, r) {
|
|
464
|
-
const a = i == null ? void 0 : i.privateKey, h = i == null ? void 0 : i.publicKey;
|
|
465
|
-
if (!ve(u = a) || u.type !== "private") throw new TypeError('"keypair.privateKey" must be a private CryptoKey');
|
|
466
|
-
var u;
|
|
467
|
-
if (!_e(h)) throw new TypeError('"keypair.publicKey" must be a public CryptoKey');
|
|
468
|
-
if (h.extractable !== !0) throw new TypeError('"keypair.publicKey.extractable" must be true');
|
|
469
|
-
if (typeof e != "string") throw new TypeError('"htu" must be a string');
|
|
470
|
-
if (typeof t != "string") throw new TypeError('"htm" must be a string');
|
|
471
|
-
if (n !== void 0 && typeof n != "string") throw new TypeError('"nonce" must be a string or undefined');
|
|
472
|
-
if (o !== void 0 && typeof o != "string") throw new TypeError('"accessToken" must be a string or undefined');
|
|
473
|
-
return Re({ alg: Ae(a), typ: "dpop+jwt", jwk: await Se(h) }, Object.assign(Object.assign({}, r), { iat: Math.floor(Date.now() / 1e3), jti: crypto.randomUUID(), htm: t, nonce: n, htu: e, ath: o ? A(await crypto.subtle.digest("SHA-256", D(o))) : void 0 }), a);
|
|
474
|
-
}
|
|
475
|
-
async function Se(i) {
|
|
476
|
-
const { kty: e, e: t, n, x: o, y: r, crv: a } = await crypto.subtle.exportKey("jwk", i);
|
|
477
|
-
return { kty: e, crv: a, e: t, n, x: o, y: r };
|
|
478
|
-
}
|
|
479
|
-
const Le = ["authorization_code", "refresh_token", "urn:ietf:params:oauth:grant-type:token-exchange"];
|
|
480
|
-
function Ze() {
|
|
481
|
-
return (async function(i, e) {
|
|
482
|
-
var t;
|
|
483
|
-
let n;
|
|
484
|
-
if (i.length === 0) throw new TypeError('"alg" must be a non-empty string');
|
|
485
|
-
switch (i) {
|
|
486
|
-
case "PS256":
|
|
487
|
-
n = { name: "RSA-PSS", hash: "SHA-256", modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]) };
|
|
488
|
-
break;
|
|
489
|
-
case "RS256":
|
|
490
|
-
n = { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256", modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]) };
|
|
491
|
-
break;
|
|
492
|
-
case "ES256":
|
|
493
|
-
n = { name: "ECDSA", namedCurve: "P-256" };
|
|
494
|
-
break;
|
|
495
|
-
case "Ed25519":
|
|
496
|
-
n = { name: "Ed25519" };
|
|
497
|
-
break;
|
|
498
|
-
default:
|
|
499
|
-
throw new K();
|
|
500
|
-
}
|
|
501
|
-
return crypto.subtle.generateKey(n, (t = e == null ? void 0 : e.extractable) !== null && t !== void 0 && t, ["sign", "verify"]);
|
|
502
|
-
})("ES256", { extractable: !1 });
|
|
503
|
-
}
|
|
504
|
-
function He(i) {
|
|
505
|
-
return (async function(e) {
|
|
506
|
-
if (!_e(e)) throw new TypeError('"publicKey" must be a public CryptoKey');
|
|
507
|
-
if (e.extractable !== !0) throw new TypeError('"publicKey.extractable" must be true');
|
|
508
|
-
const t = await Se(e);
|
|
509
|
-
let n;
|
|
510
|
-
switch (t.kty) {
|
|
511
|
-
case "EC":
|
|
512
|
-
n = { crv: t.crv, kty: t.kty, x: t.x, y: t.y };
|
|
513
|
-
break;
|
|
514
|
-
case "OKP":
|
|
515
|
-
n = { crv: t.crv, kty: t.kty, x: t.x };
|
|
516
|
-
break;
|
|
517
|
-
case "RSA":
|
|
518
|
-
n = { e: t.e, kty: t.kty, n: t.n };
|
|
519
|
-
break;
|
|
520
|
-
default:
|
|
521
|
-
throw new K("unsupported JWK kty");
|
|
522
|
-
}
|
|
523
|
-
return A(await crypto.subtle.digest({ name: "SHA-256" }, D(JSON.stringify(n))));
|
|
524
|
-
})(i.publicKey);
|
|
525
|
-
}
|
|
526
|
-
function We({ keyPair: i, url: e, method: t, nonce: n, accessToken: o }) {
|
|
527
|
-
const r = (function(a) {
|
|
528
|
-
const h = new URL(a);
|
|
529
|
-
return h.search = "", h.hash = "", h.href;
|
|
530
|
-
})(e);
|
|
531
|
-
return Ue(i, r, t, n, o);
|
|
532
|
-
}
|
|
533
|
-
const Je = async (i, e) => {
|
|
534
|
-
const t = await fetch(i, e);
|
|
535
|
-
return { ok: t.ok, json: await t.json(), headers: (n = t.headers, [...n].reduce(((o, [r, a]) => (o[r] = a, o)), {})) };
|
|
536
|
-
var n;
|
|
537
|
-
}, Xe = async (i, e, t) => {
|
|
538
|
-
const n = new AbortController();
|
|
539
|
-
let o;
|
|
540
|
-
return e.signal = n.signal, Promise.race([Je(i, e), new Promise(((r, a) => {
|
|
541
|
-
o = setTimeout((() => {
|
|
542
|
-
n.abort(), a(new Error("Timeout when executing 'fetch'"));
|
|
543
|
-
}), t);
|
|
544
|
-
}))]).finally((() => {
|
|
545
|
-
clearTimeout(o);
|
|
546
|
-
}));
|
|
547
|
-
}, Ve = async (i, e, t, n, o, r, a, h) => {
|
|
548
|
-
return u = { auth: { audience: e, scope: t }, timeout: o, fetchUrl: i, fetchOptions: n, useFormData: a, useMrrt: h }, p = r, new Promise((function(s, c) {
|
|
549
|
-
const d = new MessageChannel();
|
|
550
|
-
d.port1.onmessage = function(l) {
|
|
551
|
-
l.data.error ? c(new Error(l.data.error)) : s(l.data), d.port1.close();
|
|
552
|
-
}, p.postMessage(u, [d.port2]);
|
|
553
|
-
}));
|
|
554
|
-
var u, p;
|
|
555
|
-
}, Fe = async (i, e, t, n, o, r, a = 1e4, h) => o ? Ve(i, e, t, n, a, o, r, h) : Xe(i, n, a);
|
|
556
|
-
async function Ie(i, e, t, n, o, r, a, h, u, p) {
|
|
557
|
-
if (u) {
|
|
558
|
-
const w = await u.generateProof({ url: i, method: o.method || "GET", nonce: await u.getNonce() });
|
|
559
|
-
o.headers = Object.assign(Object.assign({}, o.headers), { dpop: w });
|
|
560
|
-
}
|
|
561
|
-
let s, c = null;
|
|
562
|
-
for (let w = 0; w < 3; w++) try {
|
|
563
|
-
s = await Fe(i, t, n, o, r, a, e, h), c = null;
|
|
564
|
-
break;
|
|
565
|
-
} catch (f) {
|
|
566
|
-
c = f;
|
|
567
|
-
}
|
|
568
|
-
if (c) throw c;
|
|
569
|
-
const d = s.json, { error: l, error_description: m } = d, y = I(d, ["error", "error_description"]), { headers: g, ok: k } = s;
|
|
570
|
-
let b;
|
|
571
|
-
if (u && (b = g["dpop-nonce"], b && await u.setNonce(b)), !k) {
|
|
572
|
-
const w = m || `HTTP error. Unable to fetch ${i}`;
|
|
573
|
-
if (l === "mfa_required") throw new se(l, w, y.mfa_token);
|
|
574
|
-
if (l === "missing_refresh_token") throw new V(t, n);
|
|
575
|
-
if (l === "use_dpop_nonce") {
|
|
576
|
-
if (!u || !b || p) throw new F(b);
|
|
577
|
-
return Ie(i, e, t, n, o, r, a, h, u, !0);
|
|
578
|
-
}
|
|
579
|
-
throw new v(l || "request_error", w);
|
|
580
|
-
}
|
|
581
|
-
return y;
|
|
582
|
-
}
|
|
583
|
-
async function Ge(i, e) {
|
|
584
|
-
var { baseUrl: t, timeout: n, audience: o, scope: r, auth0Client: a, useFormData: h, useMrrt: u, dpop: p } = i, s = I(i, ["baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData", "useMrrt", "dpop"]);
|
|
585
|
-
const c = s.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange", d = s.grant_type === "refresh_token" && u, l = Object.assign(Object.assign(Object.assign(Object.assign({}, s), c && o && { audience: o }), c && r && { scope: r }), d && { audience: o, scope: r }), m = h ? B(l) : JSON.stringify(l), y = (g = s.grant_type, Le.includes(g));
|
|
586
|
-
var g;
|
|
587
|
-
return await Ie(`${t}/oauth/token`, n, o || "default", r, { method: "POST", body: m, headers: { "Content-Type": h ? "application/x-www-form-urlencoded" : "application/json", "Auth0-Client": btoa(JSON.stringify(ze(a || be))) } }, e, h, u, y ? p : void 0);
|
|
588
|
-
}
|
|
589
|
-
const H = (...i) => {
|
|
590
|
-
return (e = i.filter(Boolean).join(" ").trim().split(/\s+/), Array.from(new Set(e))).join(" ");
|
|
591
|
-
var e;
|
|
592
|
-
}, Z = (i, e, t) => {
|
|
593
|
-
let n;
|
|
594
|
-
return t && (n = i[t]), n || (n = i.default), H(n, e);
|
|
595
|
-
};
|
|
596
|
-
class _ {
|
|
597
|
-
constructor(e, t = "@@auth0spajs@@", n) {
|
|
598
|
-
this.prefix = t, this.suffix = n, this.clientId = e.clientId, this.scope = e.scope, this.audience = e.audience;
|
|
599
|
-
}
|
|
600
|
-
toKey() {
|
|
601
|
-
return [this.prefix, this.clientId, this.audience, this.scope, this.suffix].filter(Boolean).join("::");
|
|
602
|
-
}
|
|
603
|
-
static fromKey(e) {
|
|
604
|
-
const [t, n, o, r] = e.split("::");
|
|
605
|
-
return new _({ clientId: n, scope: r, audience: o }, t);
|
|
606
|
-
}
|
|
607
|
-
static fromCacheEntry(e) {
|
|
608
|
-
const { scope: t, audience: n, client_id: o } = e;
|
|
609
|
-
return new _({ scope: t, audience: n, clientId: o });
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
class Me {
|
|
613
|
-
set(e, t) {
|
|
614
|
-
localStorage.setItem(e, JSON.stringify(t));
|
|
615
|
-
}
|
|
616
|
-
get(e) {
|
|
617
|
-
const t = window.localStorage.getItem(e);
|
|
618
|
-
if (t) try {
|
|
619
|
-
return JSON.parse(t);
|
|
620
|
-
} catch {
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
remove(e) {
|
|
625
|
-
localStorage.removeItem(e);
|
|
626
|
-
}
|
|
627
|
-
allKeys() {
|
|
628
|
-
return Object.keys(window.localStorage).filter(((e) => e.startsWith("@@auth0spajs@@")));
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
class Pe {
|
|
632
|
-
constructor() {
|
|
633
|
-
this.enclosedCache = /* @__PURE__ */ (function() {
|
|
634
|
-
let e = {};
|
|
635
|
-
return { set(t, n) {
|
|
636
|
-
e[t] = n;
|
|
637
|
-
}, get(t) {
|
|
638
|
-
const n = e[t];
|
|
639
|
-
if (n) return n;
|
|
640
|
-
}, remove(t) {
|
|
641
|
-
delete e[t];
|
|
642
|
-
}, allKeys: () => Object.keys(e) };
|
|
643
|
-
})();
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
class Ye {
|
|
647
|
-
constructor(e, t, n) {
|
|
648
|
-
this.cache = e, this.keyManifest = t, this.nowProvider = n || ke;
|
|
649
|
-
}
|
|
650
|
-
async setIdToken(e, t, n) {
|
|
651
|
-
var o;
|
|
652
|
-
const r = this.getIdTokenCacheKey(e);
|
|
653
|
-
await this.cache.set(r, { id_token: t, decodedToken: n }), await ((o = this.keyManifest) === null || o === void 0 ? void 0 : o.add(r));
|
|
654
|
-
}
|
|
655
|
-
async getIdToken(e) {
|
|
656
|
-
const t = await this.cache.get(this.getIdTokenCacheKey(e.clientId));
|
|
657
|
-
if (!t && e.scope && e.audience) {
|
|
658
|
-
const n = await this.get(e);
|
|
659
|
-
return !n || !n.id_token || !n.decodedToken ? void 0 : { id_token: n.id_token, decodedToken: n.decodedToken };
|
|
660
|
-
}
|
|
661
|
-
if (t) return { id_token: t.id_token, decodedToken: t.decodedToken };
|
|
662
|
-
}
|
|
663
|
-
async get(e, t = 0, n = !1, o) {
|
|
664
|
-
var r;
|
|
665
|
-
let a = await this.cache.get(e.toKey());
|
|
666
|
-
if (!a) {
|
|
667
|
-
const p = await this.getCacheKeys();
|
|
668
|
-
if (!p) return;
|
|
669
|
-
const s = this.matchExistingCacheKey(e, p);
|
|
670
|
-
if (s && (a = await this.cache.get(s)), !s && n && o !== "cache-only") return this.getEntryWithRefreshToken(e, p);
|
|
671
|
-
}
|
|
672
|
-
if (!a) return;
|
|
673
|
-
const h = await this.nowProvider(), u = Math.floor(h / 1e3);
|
|
674
|
-
return a.expiresAt - t < u ? a.body.refresh_token ? this.modifiedCachedEntry(a, e) : (await this.cache.remove(e.toKey()), void await ((r = this.keyManifest) === null || r === void 0 ? void 0 : r.remove(e.toKey()))) : a.body;
|
|
675
|
-
}
|
|
676
|
-
async modifiedCachedEntry(e, t) {
|
|
677
|
-
return e.body = { refresh_token: e.body.refresh_token, audience: e.body.audience, scope: e.body.scope }, await this.cache.set(t.toKey(), e), { refresh_token: e.body.refresh_token, audience: e.body.audience, scope: e.body.scope };
|
|
678
|
-
}
|
|
679
|
-
async set(e) {
|
|
680
|
-
var t;
|
|
681
|
-
const n = new _({ clientId: e.client_id, scope: e.scope, audience: e.audience }), o = await this.wrapCacheEntry(e);
|
|
682
|
-
await this.cache.set(n.toKey(), o), await ((t = this.keyManifest) === null || t === void 0 ? void 0 : t.add(n.toKey()));
|
|
683
|
-
}
|
|
684
|
-
async remove(e, t, n) {
|
|
685
|
-
const o = new _({ clientId: e, scope: n, audience: t });
|
|
686
|
-
await this.cache.remove(o.toKey());
|
|
687
|
-
}
|
|
688
|
-
async clear(e) {
|
|
689
|
-
var t;
|
|
690
|
-
const n = await this.getCacheKeys();
|
|
691
|
-
n && (await n.filter(((o) => !e || o.includes(e))).reduce((async (o, r) => {
|
|
692
|
-
await o, await this.cache.remove(r);
|
|
693
|
-
}), Promise.resolve()), await ((t = this.keyManifest) === null || t === void 0 ? void 0 : t.clear()));
|
|
694
|
-
}
|
|
695
|
-
async wrapCacheEntry(e) {
|
|
696
|
-
const t = await this.nowProvider();
|
|
697
|
-
return { body: e, expiresAt: Math.floor(t / 1e3) + e.expires_in };
|
|
698
|
-
}
|
|
699
|
-
async getCacheKeys() {
|
|
700
|
-
var e;
|
|
701
|
-
return this.keyManifest ? (e = await this.keyManifest.get()) === null || e === void 0 ? void 0 : e.keys : this.cache.allKeys ? this.cache.allKeys() : void 0;
|
|
702
|
-
}
|
|
703
|
-
getIdTokenCacheKey(e) {
|
|
704
|
-
return new _({ clientId: e }, "@@auth0spajs@@", "@@user@@").toKey();
|
|
705
|
-
}
|
|
706
|
-
matchExistingCacheKey(e, t) {
|
|
707
|
-
return t.filter(((n) => {
|
|
708
|
-
var o;
|
|
709
|
-
const r = _.fromKey(n), a = new Set(r.scope && r.scope.split(" ")), h = ((o = e.scope) === null || o === void 0 ? void 0 : o.split(" ")) || [], u = r.scope && h.reduce(((p, s) => p && a.has(s)), !0);
|
|
710
|
-
return r.prefix === "@@auth0spajs@@" && r.clientId === e.clientId && r.audience === e.audience && u;
|
|
711
|
-
}))[0];
|
|
712
|
-
}
|
|
713
|
-
async getEntryWithRefreshToken(e, t) {
|
|
714
|
-
var n;
|
|
715
|
-
for (const o of t) {
|
|
716
|
-
const r = _.fromKey(o);
|
|
717
|
-
if (r.prefix === "@@auth0spajs@@" && r.clientId === e.clientId) {
|
|
718
|
-
const a = await this.cache.get(o);
|
|
719
|
-
if (!((n = a == null ? void 0 : a.body) === null || n === void 0) && n.refresh_token) return this.modifiedCachedEntry(a, e);
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
async updateEntry(e, t) {
|
|
724
|
-
var n;
|
|
725
|
-
const o = await this.getCacheKeys();
|
|
726
|
-
if (o) for (const r of o) {
|
|
727
|
-
const a = await this.cache.get(r);
|
|
728
|
-
if (((n = a == null ? void 0 : a.body) === null || n === void 0 ? void 0 : n.refresh_token) === e) {
|
|
729
|
-
const h = Object.assign(Object.assign({}, a.body), { refresh_token: t });
|
|
730
|
-
await this.set(h);
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
class $e {
|
|
736
|
-
constructor(e, t, n) {
|
|
737
|
-
this.storage = e, this.clientId = t, this.cookieDomain = n, this.storageKey = `a0.spajs.txs.${this.clientId}`;
|
|
738
|
-
}
|
|
739
|
-
create(e) {
|
|
740
|
-
this.storage.save(this.storageKey, e, { daysUntilExpire: 1, cookieDomain: this.cookieDomain });
|
|
741
|
-
}
|
|
742
|
-
get() {
|
|
743
|
-
return this.storage.get(this.storageKey);
|
|
744
|
-
}
|
|
745
|
-
remove() {
|
|
746
|
-
this.storage.remove(this.storageKey, { cookieDomain: this.cookieDomain });
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
const R = (i) => typeof i == "number", Be = ["iss", "aud", "exp", "nbf", "iat", "jti", "azp", "nonce", "auth_time", "at_hash", "c_hash", "acr", "amr", "sub_jwk", "cnf", "sip_from_tag", "sip_date", "sip_callid", "sip_cseq_num", "sip_via_branch", "orig", "dest", "mky", "events", "toe", "txn", "rph", "sid", "vot", "vtm"], qe = (i) => {
|
|
750
|
-
if (!i.id_token) throw new Error("ID token is required but missing");
|
|
751
|
-
const e = ((r) => {
|
|
752
|
-
const a = r.split("."), [h, u, p] = a;
|
|
753
|
-
if (a.length !== 3 || !h || !u || !p) throw new Error("ID token could not be decoded");
|
|
754
|
-
const s = JSON.parse(he(u)), c = { __raw: r }, d = {};
|
|
755
|
-
return Object.keys(s).forEach(((l) => {
|
|
756
|
-
c[l] = s[l], Be.includes(l) || (d[l] = s[l]);
|
|
757
|
-
})), { encoded: { header: h, payload: u, signature: p }, header: JSON.parse(he(h)), claims: c, user: d };
|
|
758
|
-
})(i.id_token);
|
|
759
|
-
if (!e.claims.iss) throw new Error("Issuer (iss) claim must be a string present in the ID token");
|
|
760
|
-
if (e.claims.iss !== i.iss) throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${i.iss}", found "${e.claims.iss}"`);
|
|
761
|
-
if (!e.user.sub) throw new Error("Subject (sub) claim must be a string present in the ID token");
|
|
762
|
-
if (e.header.alg !== "RS256") throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);
|
|
763
|
-
if (!e.claims.aud || typeof e.claims.aud != "string" && !Array.isArray(e.claims.aud)) throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");
|
|
764
|
-
if (Array.isArray(e.claims.aud)) {
|
|
765
|
-
if (!e.claims.aud.includes(i.aud)) throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${i.aud}" but was not one of "${e.claims.aud.join(", ")}"`);
|
|
766
|
-
if (e.claims.aud.length > 1) {
|
|
767
|
-
if (!e.claims.azp) throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");
|
|
768
|
-
if (e.claims.azp !== i.aud) throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${i.aud}", found "${e.claims.azp}"`);
|
|
769
|
-
}
|
|
770
|
-
} else if (e.claims.aud !== i.aud) throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${i.aud}" but found "${e.claims.aud}"`);
|
|
771
|
-
if (i.nonce) {
|
|
772
|
-
if (!e.claims.nonce) throw new Error("Nonce (nonce) claim must be a string present in the ID token");
|
|
773
|
-
if (e.claims.nonce !== i.nonce) throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${i.nonce}", found "${e.claims.nonce}"`);
|
|
774
|
-
}
|
|
775
|
-
if (i.max_age && !R(e.claims.auth_time)) throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");
|
|
776
|
-
if (e.claims.exp == null || !R(e.claims.exp)) throw new Error("Expiration Time (exp) claim must be a number present in the ID token");
|
|
777
|
-
if (!R(e.claims.iat)) throw new Error("Issued At (iat) claim must be a number present in the ID token");
|
|
778
|
-
const t = i.leeway || 60, n = new Date(i.now || Date.now()), o = /* @__PURE__ */ new Date(0);
|
|
779
|
-
if (o.setUTCSeconds(e.claims.exp + t), n > o) throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${n}) is after expiration time (${o})`);
|
|
780
|
-
if (e.claims.nbf != null && R(e.claims.nbf)) {
|
|
781
|
-
const r = /* @__PURE__ */ new Date(0);
|
|
782
|
-
if (r.setUTCSeconds(e.claims.nbf - t), n < r) throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${n}) is before ${r}`);
|
|
783
|
-
}
|
|
784
|
-
if (e.claims.auth_time != null && R(e.claims.auth_time)) {
|
|
785
|
-
const r = /* @__PURE__ */ new Date(0);
|
|
786
|
-
if (r.setUTCSeconds(parseInt(e.claims.auth_time) + i.max_age + t), n > r) throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${n}) is after last auth at ${r}`);
|
|
787
|
-
}
|
|
788
|
-
if (i.organization) {
|
|
789
|
-
const r = i.organization.trim();
|
|
790
|
-
if (r.startsWith("org_")) {
|
|
791
|
-
const a = r;
|
|
792
|
-
if (!e.claims.org_id) throw new Error("Organization ID (org_id) claim must be a string present in the ID token");
|
|
793
|
-
if (a !== e.claims.org_id) throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${a}", found "${e.claims.org_id}"`);
|
|
794
|
-
} else {
|
|
795
|
-
const a = r.toLowerCase();
|
|
796
|
-
if (!e.claims.org_name) throw new Error("Organization Name (org_name) claim must be a string present in the ID token");
|
|
797
|
-
if (a !== e.claims.org_name) throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${a}", found "${e.claims.org_name}"`);
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
return e;
|
|
801
|
-
};
|
|
802
|
-
var x = ee((function(i, e) {
|
|
803
|
-
var t = C && C.__assign || function() {
|
|
804
|
-
return t = Object.assign || function(u) {
|
|
805
|
-
for (var p, s = 1, c = arguments.length; s < c; s++) for (var d in p = arguments[s]) Object.prototype.hasOwnProperty.call(p, d) && (u[d] = p[d]);
|
|
806
|
-
return u;
|
|
807
|
-
}, t.apply(this, arguments);
|
|
808
|
-
};
|
|
809
|
-
function n(u, p) {
|
|
810
|
-
if (!p) return "";
|
|
811
|
-
var s = "; " + u;
|
|
812
|
-
return p === !0 ? s : s + "=" + p;
|
|
813
|
-
}
|
|
814
|
-
function o(u, p, s) {
|
|
815
|
-
return encodeURIComponent(u).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/\(/g, "%28").replace(/\)/g, "%29") + "=" + encodeURIComponent(p).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent) + (function(c) {
|
|
816
|
-
if (typeof c.expires == "number") {
|
|
817
|
-
var d = /* @__PURE__ */ new Date();
|
|
818
|
-
d.setMilliseconds(d.getMilliseconds() + 864e5 * c.expires), c.expires = d;
|
|
819
|
-
}
|
|
820
|
-
return n("Expires", c.expires ? c.expires.toUTCString() : "") + n("Domain", c.domain) + n("Path", c.path) + n("Secure", c.secure) + n("SameSite", c.sameSite);
|
|
821
|
-
})(s);
|
|
822
|
-
}
|
|
823
|
-
function r(u) {
|
|
824
|
-
for (var p = {}, s = u ? u.split("; ") : [], c = /(%[\dA-F]{2})+/gi, d = 0; d < s.length; d++) {
|
|
825
|
-
var l = s[d].split("="), m = l.slice(1).join("=");
|
|
826
|
-
m.charAt(0) === '"' && (m = m.slice(1, -1));
|
|
827
|
-
try {
|
|
828
|
-
p[l[0].replace(c, decodeURIComponent)] = m.replace(c, decodeURIComponent);
|
|
829
|
-
} catch {
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
return p;
|
|
833
|
-
}
|
|
834
|
-
function a() {
|
|
835
|
-
return r(document.cookie);
|
|
836
|
-
}
|
|
837
|
-
function h(u, p, s) {
|
|
838
|
-
document.cookie = o(u, p, t({ path: "/" }, s));
|
|
839
|
-
}
|
|
840
|
-
e.__esModule = !0, e.encode = o, e.parse = r, e.getAll = a, e.get = function(u) {
|
|
841
|
-
return a()[u];
|
|
842
|
-
}, e.set = h, e.remove = function(u, p) {
|
|
843
|
-
h(u, "", t(t({}, p), { expires: -1 }));
|
|
844
|
-
};
|
|
845
|
-
}));
|
|
846
|
-
Q(x), x.encode, x.parse, x.getAll;
|
|
847
|
-
var Qe = x.get, Te = x.set, Oe = x.remove;
|
|
848
|
-
const z = { get(i) {
|
|
849
|
-
const e = Qe(i);
|
|
850
|
-
if (e !== void 0) return JSON.parse(e);
|
|
851
|
-
}, save(i, e, t) {
|
|
852
|
-
let n = {};
|
|
853
|
-
window.location.protocol === "https:" && (n = { secure: !0, sameSite: "none" }), t != null && t.daysUntilExpire && (n.expires = t.daysUntilExpire), t != null && t.cookieDomain && (n.domain = t.cookieDomain), Te(i, JSON.stringify(e), n);
|
|
854
|
-
}, remove(i, e) {
|
|
855
|
-
let t = {};
|
|
856
|
-
e != null && e.cookieDomain && (t.domain = e.cookieDomain), Oe(i, t);
|
|
857
|
-
} }, et = { get(i) {
|
|
858
|
-
return z.get(i) || z.get(`_legacy_${i}`);
|
|
859
|
-
}, save(i, e, t) {
|
|
860
|
-
let n = {};
|
|
861
|
-
window.location.protocol === "https:" && (n = { secure: !0 }), t != null && t.daysUntilExpire && (n.expires = t.daysUntilExpire), t != null && t.cookieDomain && (n.domain = t.cookieDomain), Te(`_legacy_${i}`, JSON.stringify(e), n), z.save(i, e, t);
|
|
862
|
-
}, remove(i, e) {
|
|
863
|
-
let t = {};
|
|
864
|
-
e != null && e.cookieDomain && (t.domain = e.cookieDomain), Oe(i, t), z.remove(i, e), z.remove(`_legacy_${i}`, e);
|
|
865
|
-
} }, tt = { get(i) {
|
|
866
|
-
if (typeof sessionStorage > "u") return;
|
|
867
|
-
const e = sessionStorage.getItem(i);
|
|
868
|
-
return e != null ? JSON.parse(e) : void 0;
|
|
869
|
-
}, save(i, e) {
|
|
870
|
-
sessionStorage.setItem(i, JSON.stringify(e));
|
|
871
|
-
}, remove(i) {
|
|
872
|
-
sessionStorage.removeItem(i);
|
|
873
|
-
} };
|
|
874
|
-
var j;
|
|
875
|
-
(function(i) {
|
|
876
|
-
i.Code = "code", i.ConnectCode = "connect_code";
|
|
877
|
-
})(j || (j = {}));
|
|
878
|
-
function nt(i, e, t) {
|
|
879
|
-
var n = e === void 0 ? null : e, o = (function(u, p) {
|
|
880
|
-
var s = atob(u);
|
|
881
|
-
if (p) {
|
|
882
|
-
for (var c = new Uint8Array(s.length), d = 0, l = s.length; d < l; ++d) c[d] = s.charCodeAt(d);
|
|
883
|
-
return String.fromCharCode.apply(null, new Uint16Array(c.buffer));
|
|
884
|
-
}
|
|
885
|
-
return s;
|
|
886
|
-
})(i, t !== void 0 && t), r = o.indexOf(`
|
|
887
|
-
`, 10) + 1, a = o.substring(r) + (n ? "//# sourceMappingURL=" + n : ""), h = new Blob([a], { type: "application/javascript" });
|
|
888
|
-
return URL.createObjectURL(h);
|
|
889
|
-
}
|
|
890
|
-
var pe, me, fe, M, ot = (pe = "Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YSx1c2VNcnJ0OmZ9LHBvcnRzOltwXX0pPT57bGV0IGgsdSxsPXt9O2NvbnN0e2F1ZGllbmNlOmQsc2NvcGU6eX09cnx8e307dHJ5e2NvbnN0IHI9YT8oZT0+e2NvbnN0IHQ9bmV3IFVSTFNlYXJjaFBhcmFtcyhlKSxyPXt9O3JldHVybiB0LmZvckVhY2goKChlLHQpPT57clt0XT1lfSkpLHJ9KShjLmJvZHkpOkpTT04ucGFyc2UoYy5ib2R5KTtpZighci5yZWZyZXNoX3Rva2VuJiYicmVmcmVzaF90b2tlbiI9PT1yLmdyYW50X3R5cGUpe2lmKHU9KChlLHQpPT5vW24oZSx0KV0pKGQseSksIXUmJmYpe2NvbnN0IGU9by5sYXRlc3RfcmVmcmVzaF90b2tlbix0PSgoZSx0KT0+e2NvbnN0IHI9T2JqZWN0LmtleXMobykuZmluZCgocj0+e2lmKCJsYXRlc3RfcmVmcmVzaF90b2tlbiIhPT1yKXtjb25zdCBzPSgoZSx0KT0+dC5zdGFydHNXaXRoKGAke2V9fGApKSh0LHIpLG89ci5zcGxpdCgifCIpWzFdLnNwbGl0KCIgIiksbj1lLnNwbGl0KCIgIikuZXZlcnkoKGU9Pm8uaW5jbHVkZXMoZSkpKTtyZXR1cm4gcyYmbn19KSk7cmV0dXJuISFyfSkoeSxkKTtlJiYhdCYmKHU9ZSl9aWYoIXUpdGhyb3cgbmV3IHQoZCx5KTtjLmJvZHk9YT9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpfWxldCBqLGs7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGo9bmV3IEFib3J0Q29udHJvbGxlcixjLnNpZ25hbD1qLnNpZ25hbCk7dHJ5e2s9YXdhaXQgUHJvbWlzZS5yYWNlKFsoXz1lLG5ldyBQcm9taXNlKChlPT5zZXRUaW1lb3V0KGUsXykpKSksZmV0Y2goaSxPYmplY3QuYXNzaWduKHt9LGMpKV0pfWNhdGNoKGUpe3JldHVybiB2b2lkIHAucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfWlmKCFrKXJldHVybiBqJiZqLmFib3J0KCksdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjoiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIn0pO2c9ay5oZWFkZXJzLGw9Wy4uLmddLnJlZHVjZSgoKGUsW3Qscl0pPT4oZVt0XT1yLGUpKSx7fSksaD1hd2FpdCBrLmpzb24oKSxoLnJlZnJlc2hfdG9rZW4/KGYmJihvLmxhdGVzdF9yZWZyZXNoX3Rva2VuPWgucmVmcmVzaF90b2tlbixPPXUsYj1oLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVudHJpZXMobykuZm9yRWFjaCgoKFtlLHRdKT0+e3Q9PT1PJiYob1tlXT1iKX0pKSksKChlLHQscik9PntvW24odCxyKV09ZX0pKGgucmVmcmVzaF90b2tlbixkLHkpLGRlbGV0ZSBoLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KShkLHkpLHAucG9zdE1lc3NhZ2Uoe29rOmsub2ssanNvbjpoLGhlYWRlcnM6bH0pfWNhdGNoKGUpe3AucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOmx9KX12YXIgTyxiLGcsX30pKX0oKTsKCg==", me = null, fe = !1, function(i) {
|
|
891
|
-
return M = M || nt(pe, me, fe), new Worker(M, i);
|
|
892
|
-
});
|
|
893
|
-
const Y = {};
|
|
894
|
-
class it {
|
|
895
|
-
constructor(e, t) {
|
|
896
|
-
this.cache = e, this.clientId = t, this.manifestKey = this.createManifestKeyFrom(this.clientId);
|
|
897
|
-
}
|
|
898
|
-
async add(e) {
|
|
899
|
-
var t;
|
|
900
|
-
const n = new Set(((t = await this.cache.get(this.manifestKey)) === null || t === void 0 ? void 0 : t.keys) || []);
|
|
901
|
-
n.add(e), await this.cache.set(this.manifestKey, { keys: [...n] });
|
|
902
|
-
}
|
|
903
|
-
async remove(e) {
|
|
904
|
-
const t = await this.cache.get(this.manifestKey);
|
|
905
|
-
if (t) {
|
|
906
|
-
const n = new Set(t.keys);
|
|
907
|
-
return n.delete(e), n.size > 0 ? await this.cache.set(this.manifestKey, { keys: [...n] }) : await this.cache.remove(this.manifestKey);
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
get() {
|
|
911
|
-
return this.cache.get(this.manifestKey);
|
|
912
|
-
}
|
|
913
|
-
clear() {
|
|
914
|
-
return this.cache.remove(this.manifestKey);
|
|
915
|
-
}
|
|
916
|
-
createManifestKeyFrom(e) {
|
|
917
|
-
return `@@auth0spajs@@::${e}`;
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
const rt = { memory: () => new Pe().enclosedCache, localstorage: () => new Me() }, ge = (i) => rt[i], ye = (i) => {
|
|
921
|
-
const { openUrl: e, onRedirect: t } = i, n = I(i, ["openUrl", "onRedirect"]);
|
|
922
|
-
return Object.assign(Object.assign({}, n), { openUrl: e === !1 || e ? e : t });
|
|
923
|
-
}, we = (i, e) => {
|
|
924
|
-
const t = (e == null ? void 0 : e.split(" ")) || [];
|
|
925
|
-
return ((i == null ? void 0 : i.split(" ")) || []).every(((n) => t.includes(n)));
|
|
926
|
-
}, T = { NONCE: "nonce", KEYPAIR: "keypair" };
|
|
927
|
-
class st {
|
|
928
|
-
constructor(e) {
|
|
929
|
-
this.clientId = e;
|
|
930
|
-
}
|
|
931
|
-
getVersion() {
|
|
932
|
-
return 1;
|
|
933
|
-
}
|
|
934
|
-
createDbHandle() {
|
|
935
|
-
const e = window.indexedDB.open("auth0-spa-js", this.getVersion());
|
|
936
|
-
return new Promise(((t, n) => {
|
|
937
|
-
e.onupgradeneeded = () => Object.values(T).forEach(((o) => e.result.createObjectStore(o))), e.onerror = () => n(e.error), e.onsuccess = () => t(e.result);
|
|
938
|
-
}));
|
|
939
|
-
}
|
|
940
|
-
async getDbHandle() {
|
|
941
|
-
return this.dbHandle || (this.dbHandle = await this.createDbHandle()), this.dbHandle;
|
|
942
|
-
}
|
|
943
|
-
async executeDbRequest(e, t, n) {
|
|
944
|
-
const o = n((await this.getDbHandle()).transaction(e, t).objectStore(e));
|
|
945
|
-
return new Promise(((r, a) => {
|
|
946
|
-
o.onsuccess = () => r(o.result), o.onerror = () => a(o.error);
|
|
947
|
-
}));
|
|
948
|
-
}
|
|
949
|
-
buildKey(e) {
|
|
950
|
-
const t = e ? `_${e}` : "auth0";
|
|
951
|
-
return `${this.clientId}::${t}`;
|
|
952
|
-
}
|
|
953
|
-
setNonce(e, t) {
|
|
954
|
-
return this.save(T.NONCE, this.buildKey(t), e);
|
|
955
|
-
}
|
|
956
|
-
setKeyPair(e) {
|
|
957
|
-
return this.save(T.KEYPAIR, this.buildKey(), e);
|
|
958
|
-
}
|
|
959
|
-
async save(e, t, n) {
|
|
960
|
-
await this.executeDbRequest(e, "readwrite", ((o) => o.put(n, t)));
|
|
961
|
-
}
|
|
962
|
-
findNonce(e) {
|
|
963
|
-
return this.find(T.NONCE, this.buildKey(e));
|
|
964
|
-
}
|
|
965
|
-
findKeyPair() {
|
|
966
|
-
return this.find(T.KEYPAIR, this.buildKey());
|
|
967
|
-
}
|
|
968
|
-
find(e, t) {
|
|
969
|
-
return this.executeDbRequest(e, "readonly", ((n) => n.get(t)));
|
|
970
|
-
}
|
|
971
|
-
async deleteBy(e, t) {
|
|
972
|
-
const n = await this.executeDbRequest(e, "readonly", ((o) => o.getAllKeys()));
|
|
973
|
-
n == null || n.filter(t).map(((o) => this.executeDbRequest(e, "readwrite", ((r) => r.delete(o)))));
|
|
974
|
-
}
|
|
975
|
-
deleteByClientId(e, t) {
|
|
976
|
-
return this.deleteBy(e, ((n) => typeof n == "string" && n.startsWith(`${t}::`)));
|
|
977
|
-
}
|
|
978
|
-
clearNonces() {
|
|
979
|
-
return this.deleteByClientId(T.NONCE, this.clientId);
|
|
980
|
-
}
|
|
981
|
-
clearKeyPairs() {
|
|
982
|
-
return this.deleteByClientId(T.KEYPAIR, this.clientId);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
class at {
|
|
986
|
-
constructor(e) {
|
|
987
|
-
this.storage = new st(e);
|
|
988
|
-
}
|
|
989
|
-
getNonce(e) {
|
|
990
|
-
return this.storage.findNonce(e);
|
|
991
|
-
}
|
|
992
|
-
setNonce(e, t) {
|
|
993
|
-
return this.storage.setNonce(e, t);
|
|
994
|
-
}
|
|
995
|
-
async getOrGenerateKeyPair() {
|
|
996
|
-
let e = await this.storage.findKeyPair();
|
|
997
|
-
return e || (e = await Ze(), await this.storage.setKeyPair(e)), e;
|
|
998
|
-
}
|
|
999
|
-
async generateProof(e) {
|
|
1000
|
-
const t = await this.getOrGenerateKeyPair();
|
|
1001
|
-
return We(Object.assign({ keyPair: t }, e));
|
|
1002
|
-
}
|
|
1003
|
-
async calculateThumbprint() {
|
|
1004
|
-
return He(await this.getOrGenerateKeyPair());
|
|
1005
|
-
}
|
|
1006
|
-
async clear() {
|
|
1007
|
-
await Promise.all([this.storage.clearNonces(), this.storage.clearKeyPairs()]);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
var E;
|
|
1011
|
-
(function(i) {
|
|
1012
|
-
i.Bearer = "Bearer", i.DPoP = "DPoP";
|
|
1013
|
-
})(E || (E = {}));
|
|
1014
|
-
class ct {
|
|
1015
|
-
constructor(e, t) {
|
|
1016
|
-
this.hooks = t, this.config = Object.assign(Object.assign({}, e), { fetch: e.fetch || (typeof window > "u" ? fetch : window.fetch.bind(window)) });
|
|
1017
|
-
}
|
|
1018
|
-
isAbsoluteUrl(e) {
|
|
1019
|
-
return /^(https?:)?\/\//i.test(e);
|
|
1020
|
-
}
|
|
1021
|
-
buildUrl(e, t) {
|
|
1022
|
-
if (t) {
|
|
1023
|
-
if (this.isAbsoluteUrl(t)) return t;
|
|
1024
|
-
if (e) return `${e.replace(/\/?\/$/, "")}/${t.replace(/^\/+/, "")}`;
|
|
1025
|
-
}
|
|
1026
|
-
throw new TypeError("`url` must be absolute or `baseUrl` non-empty.");
|
|
1027
|
-
}
|
|
1028
|
-
getAccessToken(e) {
|
|
1029
|
-
return this.config.getAccessToken ? this.config.getAccessToken(e) : this.hooks.getAccessToken(e);
|
|
1030
|
-
}
|
|
1031
|
-
extractUrl(e) {
|
|
1032
|
-
return typeof e == "string" ? e : e instanceof URL ? e.href : e.url;
|
|
1033
|
-
}
|
|
1034
|
-
buildBaseRequest(e, t) {
|
|
1035
|
-
if (!this.config.baseUrl) return new Request(e, t);
|
|
1036
|
-
const n = this.buildUrl(this.config.baseUrl, this.extractUrl(e)), o = e instanceof Request ? new Request(n, e) : n;
|
|
1037
|
-
return new Request(o, t);
|
|
1038
|
-
}
|
|
1039
|
-
setAuthorizationHeader(e, t, n = E.Bearer) {
|
|
1040
|
-
e.headers.set("authorization", `${n} ${t}`);
|
|
1041
|
-
}
|
|
1042
|
-
async setDpopProofHeader(e, t) {
|
|
1043
|
-
if (!this.config.dpopNonceId) return;
|
|
1044
|
-
const n = await this.hooks.getDpopNonce(), o = await this.hooks.generateDpopProof({ accessToken: t, method: e.method, nonce: n, url: e.url });
|
|
1045
|
-
e.headers.set("dpop", o);
|
|
1046
|
-
}
|
|
1047
|
-
async prepareRequest(e, t) {
|
|
1048
|
-
const n = await this.getAccessToken(t);
|
|
1049
|
-
let o, r;
|
|
1050
|
-
typeof n == "string" ? (o = this.config.dpopNonceId ? E.DPoP : E.Bearer, r = n) : (o = n.token_type, r = n.access_token), this.setAuthorizationHeader(e, r, o), o === E.DPoP && await this.setDpopProofHeader(e, r);
|
|
1051
|
-
}
|
|
1052
|
-
getHeader(e, t) {
|
|
1053
|
-
return Array.isArray(e) ? new Headers(e).get(t) || "" : typeof e.get == "function" ? e.get(t) || "" : e[t] || "";
|
|
1054
|
-
}
|
|
1055
|
-
hasUseDpopNonceError(e) {
|
|
1056
|
-
if (e.status !== 401) return !1;
|
|
1057
|
-
const t = this.getHeader(e.headers, "www-authenticate");
|
|
1058
|
-
return t.includes("invalid_dpop_nonce") || t.includes("use_dpop_nonce");
|
|
1059
|
-
}
|
|
1060
|
-
async handleResponse(e, t) {
|
|
1061
|
-
const n = this.getHeader(e.headers, "dpop-nonce");
|
|
1062
|
-
if (n && await this.hooks.setDpopNonce(n), !this.hasUseDpopNonceError(e)) return e;
|
|
1063
|
-
if (!n || !t.onUseDpopNonceError) throw new F(n);
|
|
1064
|
-
return t.onUseDpopNonceError();
|
|
1065
|
-
}
|
|
1066
|
-
async internalFetchWithAuth(e, t, n, o) {
|
|
1067
|
-
const r = this.buildBaseRequest(e, t);
|
|
1068
|
-
await this.prepareRequest(r, o);
|
|
1069
|
-
const a = await this.config.fetch(r);
|
|
1070
|
-
return this.handleResponse(a, n);
|
|
1071
|
-
}
|
|
1072
|
-
fetchWithAuth(e, t, n) {
|
|
1073
|
-
const o = { onUseDpopNonceError: () => this.internalFetchWithAuth(e, t, Object.assign(Object.assign({}, o), { onUseDpopNonceError: void 0 }), n) };
|
|
1074
|
-
return this.internalFetchWithAuth(e, t, o, n);
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
class ut {
|
|
1078
|
-
constructor(e, t) {
|
|
1079
|
-
this.myAccountFetcher = e, this.apiBase = t;
|
|
1080
|
-
}
|
|
1081
|
-
async connectAccount(e) {
|
|
1082
|
-
const t = await this.myAccountFetcher.fetchWithAuth(`${this.apiBase}v1/connected-accounts/connect`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(e) });
|
|
1083
|
-
return this._handleResponse(t);
|
|
1084
|
-
}
|
|
1085
|
-
async completeAccount(e) {
|
|
1086
|
-
const t = await this.myAccountFetcher.fetchWithAuth(`${this.apiBase}v1/connected-accounts/complete`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(e) });
|
|
1087
|
-
return this._handleResponse(t);
|
|
1088
|
-
}
|
|
1089
|
-
async _handleResponse(e) {
|
|
1090
|
-
let t;
|
|
1091
|
-
try {
|
|
1092
|
-
t = await e.text(), t = JSON.parse(t);
|
|
1093
|
-
} catch (n) {
|
|
1094
|
-
throw new X({ type: "invalid_json", status: e.status, title: "Invalid JSON response", detail: t || String(n) });
|
|
1095
|
-
}
|
|
1096
|
-
if (e.ok) return t;
|
|
1097
|
-
throw new X(t);
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
class X extends Error {
|
|
1101
|
-
constructor({ type: e, status: t, title: n, detail: o, validation_errors: r }) {
|
|
1102
|
-
super(o), this.name = "MyAccountApiError", this.type = e, this.status = t, this.title = n, this.detail = o, this.validation_errors = r, Object.setPrototypeOf(this, X.prototype);
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
const $ = new je();
|
|
1106
|
-
class ht {
|
|
1107
|
-
constructor(e) {
|
|
1108
|
-
let t, n;
|
|
1109
|
-
if (this.userCache = new Pe().enclosedCache, this.activeLockKeys = /* @__PURE__ */ new Set(), this.defaultOptions = { authorizationParams: { scope: "openid profile email" }, useRefreshTokensFallback: !1, useFormData: !0 }, this._releaseLockOnPageHide = async () => {
|
|
1110
|
-
const u = Array.from(this.activeLockKeys);
|
|
1111
|
-
for (const p of u) await $.releaseLock(p);
|
|
1112
|
-
this.activeLockKeys.clear(), window.removeEventListener("pagehide", this._releaseLockOnPageHide);
|
|
1113
|
-
}, this.options = Object.assign(Object.assign(Object.assign({}, this.defaultOptions), e), { authorizationParams: Object.assign(Object.assign({}, this.defaultOptions.authorizationParams), e.authorizationParams) }), typeof window < "u" && (() => {
|
|
1114
|
-
if (!J()) throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");
|
|
1115
|
-
if (J().subtle === void 0) throw new Error(`
|
|
1116
|
-
auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.
|
|
1117
|
-
`);
|
|
1118
|
-
})(), e.cache && e.cacheLocation && console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."), e.cache) n = e.cache;
|
|
1119
|
-
else {
|
|
1120
|
-
if (t = e.cacheLocation || "memory", !ge(t)) throw new Error(`Invalid cache location "${t}"`);
|
|
1121
|
-
n = ge(t)();
|
|
1122
|
-
}
|
|
1123
|
-
this.httpTimeoutMs = e.httpTimeoutInSeconds ? 1e3 * e.httpTimeoutInSeconds : 1e4, this.cookieStorage = e.legacySameSiteCookie === !1 ? z : et, this.orgHintCookieName = `auth0.${this.options.clientId}.organization_hint`, this.isAuthenticatedCookieName = ((u) => `auth0.${u}.is.authenticated`)(this.options.clientId), this.sessionCheckExpiryDays = e.sessionCheckExpiryDays || 1;
|
|
1124
|
-
const o = e.useCookiesForTransactions ? this.cookieStorage : tt;
|
|
1125
|
-
var r;
|
|
1126
|
-
this.scope = ((u, p, ...s) => {
|
|
1127
|
-
if (typeof u != "object") return { default: H(p, u, ...s) };
|
|
1128
|
-
let c = { default: H(p, ...s) };
|
|
1129
|
-
return Object.keys(u).forEach(((d) => {
|
|
1130
|
-
const l = u[d];
|
|
1131
|
-
c[d] = H(p, l, ...s);
|
|
1132
|
-
})), c;
|
|
1133
|
-
})(this.options.authorizationParams.scope, "openid", this.options.useRefreshTokens ? "offline_access" : ""), this.transactionManager = new $e(o, this.options.clientId, this.options.cookieDomain), this.nowProvider = this.options.nowProvider || ke, this.cacheManager = new Ye(n, n.allKeys ? void 0 : new it(n, this.options.clientId), this.nowProvider), this.dpop = this.options.useDpop ? new at(this.options.clientId) : void 0, this.domainUrl = (r = this.options.domain, /^https?:\/\//.test(r) ? r : `https://${r}`), this.tokenIssuer = ((u, p) => u ? u.startsWith("https://") ? u : `https://${u}/` : `${p}/`)(this.options.issuer, this.domainUrl);
|
|
1134
|
-
const a = `${this.domainUrl}/me/`, h = this.createFetcher(Object.assign(Object.assign({}, this.options.useDpop && { dpopNonceId: "__auth0_my_account_api__" }), { getAccessToken: () => this.getTokenSilently({ authorizationParams: { scope: "create:me:connected_accounts", audience: a }, detailedResponse: !0 }) }));
|
|
1135
|
-
this.myAccountApi = new ut(h, a), typeof window < "u" && window.Worker && this.options.useRefreshTokens && t === "memory" && (this.options.workerUrl ? this.worker = new Worker(this.options.workerUrl) : this.worker = new ot());
|
|
1136
|
-
}
|
|
1137
|
-
_url(e) {
|
|
1138
|
-
const t = encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client || be)));
|
|
1139
|
-
return `${this.domainUrl}${e}&auth0Client=${t}`;
|
|
1140
|
-
}
|
|
1141
|
-
_authorizeUrl(e) {
|
|
1142
|
-
return this._url(`/authorize?${B(e)}`);
|
|
1143
|
-
}
|
|
1144
|
-
async _verifyIdToken(e, t, n) {
|
|
1145
|
-
const o = await this.nowProvider();
|
|
1146
|
-
return qe({ iss: this.tokenIssuer, aud: this.options.clientId, id_token: e, nonce: t, organization: n, leeway: this.options.leeway, max_age: (r = this.options.authorizationParams.max_age, typeof r != "string" ? r : parseInt(r, 10) || void 0), now: o });
|
|
1147
|
-
var r;
|
|
1148
|
-
}
|
|
1149
|
-
_processOrgHint(e) {
|
|
1150
|
-
e ? this.cookieStorage.save(this.orgHintCookieName, e, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }) : this.cookieStorage.remove(this.orgHintCookieName, { cookieDomain: this.options.cookieDomain });
|
|
1151
|
-
}
|
|
1152
|
-
async _prepareAuthorizeUrl(e, t, n) {
|
|
1153
|
-
var o;
|
|
1154
|
-
const r = G(N()), a = G(N()), h = N(), u = await ue(h), p = de(u), s = await ((o = this.dpop) === null || o === void 0 ? void 0 : o.calculateThumbprint()), c = ((l, m, y, g, k, b, w, f, S) => Object.assign(Object.assign(Object.assign({ client_id: l.clientId }, l.authorizationParams), y), { scope: Z(m, y.scope, y.audience), response_type: "code", response_mode: f || "query", state: g, nonce: k, redirect_uri: w || l.authorizationParams.redirect_uri, code_challenge: b, code_challenge_method: "S256", dpop_jkt: S }))(this.options, this.scope, e, r, a, p, e.redirect_uri || this.options.authorizationParams.redirect_uri || n, t == null ? void 0 : t.response_mode, s), d = this._authorizeUrl(c);
|
|
1155
|
-
return { nonce: a, code_verifier: h, scope: c.scope, audience: c.audience || "default", redirect_uri: c.redirect_uri, state: r, url: d };
|
|
1156
|
-
}
|
|
1157
|
-
async loginWithPopup(e, t) {
|
|
1158
|
-
var n;
|
|
1159
|
-
if (e = e || {}, !(t = t || {}).popup && (t.popup = ((h) => {
|
|
1160
|
-
const u = window.screenX + (window.innerWidth - 400) / 2, p = window.screenY + (window.innerHeight - 600) / 2;
|
|
1161
|
-
return window.open(h, "auth0:authorize:popup", `left=${u},top=${p},width=400,height=600,resizable,scrollbars=yes,status=1`);
|
|
1162
|
-
})(""), !t.popup)) throw new re();
|
|
1163
|
-
const o = await this._prepareAuthorizeUrl(e.authorizationParams || {}, { response_mode: "web_message" }, window.location.origin);
|
|
1164
|
-
t.popup.location.href = o.url;
|
|
1165
|
-
const r = await ((h) => new Promise(((u, p) => {
|
|
1166
|
-
let s;
|
|
1167
|
-
const c = setInterval((() => {
|
|
1168
|
-
h.popup && h.popup.closed && (clearInterval(c), clearTimeout(d), window.removeEventListener("message", s, !1), p(new ie(h.popup)));
|
|
1169
|
-
}), 1e3), d = setTimeout((() => {
|
|
1170
|
-
clearInterval(c), p(new oe(h.popup)), window.removeEventListener("message", s, !1);
|
|
1171
|
-
}), 1e3 * (h.timeoutInSeconds || 60));
|
|
1172
|
-
s = function(l) {
|
|
1173
|
-
if (l.data && l.data.type === "authorization_response") {
|
|
1174
|
-
if (clearTimeout(d), clearInterval(c), window.removeEventListener("message", s, !1), h.popup.close(), l.data.response.error) return p(v.fromPayload(l.data.response));
|
|
1175
|
-
u(l.data.response);
|
|
1176
|
-
}
|
|
1177
|
-
}, window.addEventListener("message", s);
|
|
1178
|
-
})))(Object.assign(Object.assign({}, t), { timeoutInSeconds: t.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || 60 }));
|
|
1179
|
-
if (o.state !== r.state) throw new v("state_mismatch", "Invalid state");
|
|
1180
|
-
const a = ((n = e.authorizationParams) === null || n === void 0 ? void 0 : n.organization) || this.options.authorizationParams.organization;
|
|
1181
|
-
await this._requestToken({ audience: o.audience, scope: o.scope, code_verifier: o.code_verifier, grant_type: "authorization_code", code: r.code, redirect_uri: o.redirect_uri }, { nonceIn: o.nonce, organization: a });
|
|
1182
|
-
}
|
|
1183
|
-
async getUser() {
|
|
1184
|
-
var e;
|
|
1185
|
-
const t = await this._getIdTokenFromCache();
|
|
1186
|
-
return (e = t == null ? void 0 : t.decodedToken) === null || e === void 0 ? void 0 : e.user;
|
|
1187
|
-
}
|
|
1188
|
-
async getIdTokenClaims() {
|
|
1189
|
-
var e;
|
|
1190
|
-
const t = await this._getIdTokenFromCache();
|
|
1191
|
-
return (e = t == null ? void 0 : t.decodedToken) === null || e === void 0 ? void 0 : e.claims;
|
|
1192
|
-
}
|
|
1193
|
-
async loginWithRedirect(e = {}) {
|
|
1194
|
-
var t;
|
|
1195
|
-
const n = ye(e), { openUrl: o, fragment: r, appState: a } = n, h = I(n, ["openUrl", "fragment", "appState"]), u = ((t = h.authorizationParams) === null || t === void 0 ? void 0 : t.organization) || this.options.authorizationParams.organization, p = await this._prepareAuthorizeUrl(h.authorizationParams || {}), { url: s } = p, c = I(p, ["url"]);
|
|
1196
|
-
this.transactionManager.create(Object.assign(Object.assign(Object.assign({}, c), { appState: a, response_type: j.Code }), u && { organization: u }));
|
|
1197
|
-
const d = r ? `${s}#${r}` : s;
|
|
1198
|
-
o ? await o(d) : window.location.assign(d);
|
|
1199
|
-
}
|
|
1200
|
-
async handleRedirectCallback(e = window.location.href) {
|
|
1201
|
-
const t = e.split("?").slice(1);
|
|
1202
|
-
if (t.length === 0) throw new Error("There are no query params available for parsing.");
|
|
1203
|
-
const n = this.transactionManager.get();
|
|
1204
|
-
if (!n) throw new v("missing_transaction", "Invalid state");
|
|
1205
|
-
this.transactionManager.remove();
|
|
1206
|
-
const o = ((r) => {
|
|
1207
|
-
r.indexOf("#") > -1 && (r = r.substring(0, r.indexOf("#")));
|
|
1208
|
-
const a = new URLSearchParams(r);
|
|
1209
|
-
return { state: a.get("state"), code: a.get("code") || void 0, connect_code: a.get("connect_code") || void 0, error: a.get("error") || void 0, error_description: a.get("error_description") || void 0 };
|
|
1210
|
-
})(t.join(""));
|
|
1211
|
-
return n.response_type === j.ConnectCode ? this._handleConnectAccountRedirectCallback(o, n) : this._handleLoginRedirectCallback(o, n);
|
|
1212
|
-
}
|
|
1213
|
-
async _handleLoginRedirectCallback(e, t) {
|
|
1214
|
-
const { code: n, state: o, error: r, error_description: a } = e;
|
|
1215
|
-
if (r) throw new te(r, a || r, o, t.appState);
|
|
1216
|
-
if (!t.code_verifier || t.state && t.state !== o) throw new v("state_mismatch", "Invalid state");
|
|
1217
|
-
const h = t.organization, u = t.nonce, p = t.redirect_uri;
|
|
1218
|
-
return await this._requestToken(Object.assign({ audience: t.audience, scope: t.scope, code_verifier: t.code_verifier, grant_type: "authorization_code", code: n }, p ? { redirect_uri: p } : {}), { nonceIn: u, organization: h }), { appState: t.appState, response_type: j.Code };
|
|
1219
|
-
}
|
|
1220
|
-
async _handleConnectAccountRedirectCallback(e, t) {
|
|
1221
|
-
const { connect_code: n, state: o, error: r, error_description: a } = e;
|
|
1222
|
-
if (r) throw new ne(r, a || r, t.connection, o, t.appState);
|
|
1223
|
-
if (!n) throw new v("missing_connect_code", "Missing connect code");
|
|
1224
|
-
if (!(t.code_verifier && t.state && t.auth_session && t.redirect_uri && t.state === o)) throw new v("state_mismatch", "Invalid state");
|
|
1225
|
-
const h = await this.myAccountApi.completeAccount({ auth_session: t.auth_session, connect_code: n, redirect_uri: t.redirect_uri, code_verifier: t.code_verifier });
|
|
1226
|
-
return Object.assign(Object.assign({}, h), { appState: t.appState, response_type: j.ConnectCode });
|
|
1227
|
-
}
|
|
1228
|
-
async checkSession(e) {
|
|
1229
|
-
if (!this.cookieStorage.get(this.isAuthenticatedCookieName)) {
|
|
1230
|
-
if (!this.cookieStorage.get("auth0.is.authenticated")) return;
|
|
1231
|
-
this.cookieStorage.save(this.isAuthenticatedCookieName, !0, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }), this.cookieStorage.remove("auth0.is.authenticated");
|
|
1232
|
-
}
|
|
1233
|
-
try {
|
|
1234
|
-
await this.getTokenSilently(e);
|
|
1235
|
-
} catch {
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
async getTokenSilently(e = {}) {
|
|
1239
|
-
var t, n;
|
|
1240
|
-
const o = Object.assign(Object.assign({ cacheMode: "on" }, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Z(this.scope, (t = e.authorizationParams) === null || t === void 0 ? void 0 : t.scope, ((n = e.authorizationParams) === null || n === void 0 ? void 0 : n.audience) || this.options.authorizationParams.audience) }) }), r = await ((a, h) => {
|
|
1241
|
-
let u = Y[h];
|
|
1242
|
-
return u || (u = a().finally((() => {
|
|
1243
|
-
delete Y[h], u = null;
|
|
1244
|
-
})), Y[h] = u), u;
|
|
1245
|
-
})((() => this._getTokenSilently(o)), `${this.options.clientId}::${o.authorizationParams.audience}::${o.authorizationParams.scope}`);
|
|
1246
|
-
return e.detailedResponse ? r : r == null ? void 0 : r.access_token;
|
|
1247
|
-
}
|
|
1248
|
-
async _getTokenSilently(e) {
|
|
1249
|
-
const { cacheMode: t } = e, n = I(e, ["cacheMode"]);
|
|
1250
|
-
if (t !== "off") {
|
|
1251
|
-
const h = await this._getEntryFromCache({ scope: n.authorizationParams.scope, audience: n.authorizationParams.audience || "default", clientId: this.options.clientId, cacheMode: t });
|
|
1252
|
-
if (h) return h;
|
|
1253
|
-
}
|
|
1254
|
-
if (t === "cache-only") return;
|
|
1255
|
-
const o = (r = this.options.clientId, a = n.authorizationParams.audience || "default", `auth0.lock.getTokenSilently.${r}.${a}`);
|
|
1256
|
-
var r, a;
|
|
1257
|
-
if (!await (async (h, u = 3) => {
|
|
1258
|
-
for (let p = 0; p < u; p++) if (await h()) return !0;
|
|
1259
|
-
return !1;
|
|
1260
|
-
})((() => $.acquireLock(o, 5e3)), 10)) throw new U();
|
|
1261
|
-
this.activeLockKeys.add(o), this.activeLockKeys.size === 1 && window.addEventListener("pagehide", this._releaseLockOnPageHide);
|
|
1262
|
-
try {
|
|
1263
|
-
if (t !== "off") {
|
|
1264
|
-
const l = await this._getEntryFromCache({ scope: n.authorizationParams.scope, audience: n.authorizationParams.audience || "default", clientId: this.options.clientId });
|
|
1265
|
-
if (l) return l;
|
|
1266
|
-
}
|
|
1267
|
-
const h = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(n) : await this._getTokenFromIFrame(n), { id_token: u, token_type: p, access_token: s, oauthTokenScope: c, expires_in: d } = h;
|
|
1268
|
-
return Object.assign(Object.assign({ id_token: u, token_type: p, access_token: s }, c ? { scope: c } : null), { expires_in: d });
|
|
1269
|
-
} finally {
|
|
1270
|
-
await $.releaseLock(o), this.activeLockKeys.delete(o), this.activeLockKeys.size === 0 && window.removeEventListener("pagehide", this._releaseLockOnPageHide);
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
async getTokenWithPopup(e = {}, t = {}) {
|
|
1274
|
-
var n, o;
|
|
1275
|
-
const r = Object.assign(Object.assign({}, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Z(this.scope, (n = e.authorizationParams) === null || n === void 0 ? void 0 : n.scope, ((o = e.authorizationParams) === null || o === void 0 ? void 0 : o.audience) || this.options.authorizationParams.audience) }) });
|
|
1276
|
-
return t = Object.assign(Object.assign({}, Ke), t), await this.loginWithPopup(r, t), (await this.cacheManager.get(new _({ scope: r.authorizationParams.scope, audience: r.authorizationParams.audience || "default", clientId: this.options.clientId }), void 0, this.options.useMrrt)).access_token;
|
|
1277
|
-
}
|
|
1278
|
-
async isAuthenticated() {
|
|
1279
|
-
return !!await this.getUser();
|
|
1280
|
-
}
|
|
1281
|
-
_buildLogoutUrl(e) {
|
|
1282
|
-
e.clientId !== null ? e.clientId = e.clientId || this.options.clientId : delete e.clientId;
|
|
1283
|
-
const t = e.logoutParams || {}, { federated: n } = t, o = I(t, ["federated"]), r = n ? "&federated" : "";
|
|
1284
|
-
return this._url(`/v2/logout?${B(Object.assign({ clientId: e.clientId }, o))}`) + r;
|
|
1285
|
-
}
|
|
1286
|
-
async logout(e = {}) {
|
|
1287
|
-
var t;
|
|
1288
|
-
const n = ye(e), { openUrl: o } = n, r = I(n, ["openUrl"]);
|
|
1289
|
-
e.clientId === null ? await this.cacheManager.clear() : await this.cacheManager.clear(e.clientId || this.options.clientId), this.cookieStorage.remove(this.orgHintCookieName, { cookieDomain: this.options.cookieDomain }), this.cookieStorage.remove(this.isAuthenticatedCookieName, { cookieDomain: this.options.cookieDomain }), this.userCache.remove("@@user@@"), await ((t = this.dpop) === null || t === void 0 ? void 0 : t.clear());
|
|
1290
|
-
const a = this._buildLogoutUrl(r);
|
|
1291
|
-
o ? await o(a) : o !== !1 && window.location.assign(a);
|
|
1292
|
-
}
|
|
1293
|
-
async _getTokenFromIFrame(e) {
|
|
1294
|
-
const t = Object.assign(Object.assign({}, e.authorizationParams), { prompt: "none" }), n = this.cookieStorage.get(this.orgHintCookieName);
|
|
1295
|
-
n && !t.organization && (t.organization = n);
|
|
1296
|
-
const { url: o, state: r, nonce: a, code_verifier: h, redirect_uri: u, scope: p, audience: s } = await this._prepareAuthorizeUrl(t, { response_mode: "web_message" }, window.location.origin);
|
|
1297
|
-
try {
|
|
1298
|
-
if (window.crossOriginIsolated) throw new v("login_required", "The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");
|
|
1299
|
-
const c = e.timeoutInSeconds || this.options.authorizeTimeoutInSeconds;
|
|
1300
|
-
let d;
|
|
1301
|
-
try {
|
|
1302
|
-
d = new URL(this.domainUrl).origin;
|
|
1303
|
-
} catch {
|
|
1304
|
-
d = this.domainUrl;
|
|
1305
|
-
}
|
|
1306
|
-
const l = await ((y, g, k = 60) => new Promise(((b, w) => {
|
|
1307
|
-
const f = window.document.createElement("iframe");
|
|
1308
|
-
f.setAttribute("width", "0"), f.setAttribute("height", "0"), f.style.display = "none";
|
|
1309
|
-
const S = () => {
|
|
1310
|
-
window.document.body.contains(f) && (window.document.body.removeChild(f), window.removeEventListener("message", L, !1));
|
|
1311
|
-
};
|
|
1312
|
-
let L;
|
|
1313
|
-
const Ce = setTimeout((() => {
|
|
1314
|
-
w(new U()), S();
|
|
1315
|
-
}), 1e3 * k);
|
|
1316
|
-
L = function(P) {
|
|
1317
|
-
if (P.origin != g || !P.data || P.data.type !== "authorization_response") return;
|
|
1318
|
-
const ce = P.source;
|
|
1319
|
-
ce && ce.close(), P.data.response.error ? w(v.fromPayload(P.data.response)) : b(P.data.response), clearTimeout(Ce), window.removeEventListener("message", L, !1), setTimeout(S, 2e3);
|
|
1320
|
-
}, window.addEventListener("message", L, !1), window.document.body.appendChild(f), f.setAttribute("src", y);
|
|
1321
|
-
})))(o, d, c);
|
|
1322
|
-
if (r !== l.state) throw new v("state_mismatch", "Invalid state");
|
|
1323
|
-
const m = await this._requestToken(Object.assign(Object.assign({}, e.authorizationParams), { code_verifier: h, code: l.code, grant_type: "authorization_code", redirect_uri: u, timeout: e.authorizationParams.timeout || this.httpTimeoutMs }), { nonceIn: a, organization: t.organization });
|
|
1324
|
-
return Object.assign(Object.assign({}, m), { scope: p, oauthTokenScope: m.scope, audience: s });
|
|
1325
|
-
} catch (c) {
|
|
1326
|
-
throw c.error === "login_required" && this.logout({ openUrl: !1 }), c;
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
async _getTokenUsingRefreshToken(e) {
|
|
1330
|
-
const t = await this.cacheManager.get(new _({ scope: e.authorizationParams.scope, audience: e.authorizationParams.audience || "default", clientId: this.options.clientId }), void 0, this.options.useMrrt);
|
|
1331
|
-
if (!(t && t.refresh_token || this.worker)) {
|
|
1332
|
-
if (this.options.useRefreshTokensFallback) return await this._getTokenFromIFrame(e);
|
|
1333
|
-
throw new V(e.authorizationParams.audience || "default", e.authorizationParams.scope);
|
|
1334
|
-
}
|
|
1335
|
-
const n = e.authorizationParams.redirect_uri || this.options.authorizationParams.redirect_uri || window.location.origin, o = typeof e.timeoutInSeconds == "number" ? 1e3 * e.timeoutInSeconds : null, r = ((s, c, d, l) => {
|
|
1336
|
-
var m;
|
|
1337
|
-
if (s && d && l) {
|
|
1338
|
-
if (c.audience !== d) return c.scope;
|
|
1339
|
-
const y = l.split(" "), g = ((m = c.scope) === null || m === void 0 ? void 0 : m.split(" ")) || [], k = g.every(((b) => y.includes(b)));
|
|
1340
|
-
return y.length >= g.length && k ? l : c.scope;
|
|
1341
|
-
}
|
|
1342
|
-
return c.scope;
|
|
1343
|
-
})(this.options.useMrrt, e.authorizationParams, t == null ? void 0 : t.audience, t == null ? void 0 : t.scope);
|
|
1344
|
-
try {
|
|
1345
|
-
const s = await this._requestToken(Object.assign(Object.assign(Object.assign({}, e.authorizationParams), { grant_type: "refresh_token", refresh_token: t && t.refresh_token, redirect_uri: n }), o && { timeout: o }), { scopesToRequest: r });
|
|
1346
|
-
if (s.refresh_token && this.options.useMrrt && (t != null && t.refresh_token) && await this.cacheManager.updateEntry(t.refresh_token, s.refresh_token), this.options.useMrrt && (a = t == null ? void 0 : t.audience, h = t == null ? void 0 : t.scope, u = e.authorizationParams.audience, p = e.authorizationParams.scope, (a !== u || !we(p, h)) && !we(r, s.scope))) {
|
|
1347
|
-
if (this.options.useRefreshTokensFallback) return await this._getTokenFromIFrame(e);
|
|
1348
|
-
await this.cacheManager.remove(this.options.clientId, e.authorizationParams.audience, e.authorizationParams.scope);
|
|
1349
|
-
const c = ((d, l) => {
|
|
1350
|
-
const m = (d == null ? void 0 : d.split(" ")) || [], y = (l == null ? void 0 : l.split(" ")) || [];
|
|
1351
|
-
return m.filter(((g) => y.indexOf(g) == -1)).join(",");
|
|
1352
|
-
})(r, s.scope);
|
|
1353
|
-
throw new ae(e.authorizationParams.audience || "default", c);
|
|
1354
|
-
}
|
|
1355
|
-
return Object.assign(Object.assign({}, s), { scope: e.authorizationParams.scope, oauthTokenScope: s.scope, audience: e.authorizationParams.audience || "default" });
|
|
1356
|
-
} catch (s) {
|
|
1357
|
-
if ((s.message.indexOf("Missing Refresh Token") > -1 || s.message && s.message.indexOf("invalid refresh token") > -1) && this.options.useRefreshTokensFallback) return await this._getTokenFromIFrame(e);
|
|
1358
|
-
throw s;
|
|
1359
|
-
}
|
|
1360
|
-
var a, h, u, p;
|
|
1361
|
-
}
|
|
1362
|
-
async _saveEntryInCache(e) {
|
|
1363
|
-
const { id_token: t, decodedToken: n } = e, o = I(e, ["id_token", "decodedToken"]);
|
|
1364
|
-
this.userCache.set("@@user@@", { id_token: t, decodedToken: n }), await this.cacheManager.setIdToken(this.options.clientId, e.id_token, e.decodedToken), await this.cacheManager.set(o);
|
|
1365
|
-
}
|
|
1366
|
-
async _getIdTokenFromCache() {
|
|
1367
|
-
const e = this.options.authorizationParams.audience || "default", t = this.scope[e], n = await this.cacheManager.getIdToken(new _({ clientId: this.options.clientId, audience: e, scope: t })), o = this.userCache.get("@@user@@");
|
|
1368
|
-
return n && n.id_token === (o == null ? void 0 : o.id_token) ? o : (this.userCache.set("@@user@@", n), n);
|
|
1369
|
-
}
|
|
1370
|
-
async _getEntryFromCache({ scope: e, audience: t, clientId: n, cacheMode: o }) {
|
|
1371
|
-
const r = await this.cacheManager.get(new _({ scope: e, audience: t, clientId: n }), 60, this.options.useMrrt, o);
|
|
1372
|
-
if (r && r.access_token) {
|
|
1373
|
-
const { token_type: a, access_token: h, oauthTokenScope: u, expires_in: p } = r, s = await this._getIdTokenFromCache();
|
|
1374
|
-
return s && Object.assign(Object.assign({ id_token: s.id_token, token_type: a || "Bearer", access_token: h }, u ? { scope: u } : null), { expires_in: p });
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
async _requestToken(e, t) {
|
|
1378
|
-
const { nonceIn: n, organization: o, scopesToRequest: r } = t || {}, a = await Ge(Object.assign(Object.assign({ baseUrl: this.domainUrl, client_id: this.options.clientId, auth0Client: this.options.auth0Client, useFormData: this.options.useFormData, timeout: this.httpTimeoutMs, useMrrt: this.options.useMrrt, dpop: this.dpop }, e), { scope: r || e.scope }), this.worker), h = await this._verifyIdToken(a.id_token, n, o);
|
|
1379
|
-
return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({}, a), { decodedToken: h, scope: e.scope, audience: e.audience || "default" }), a.scope ? { oauthTokenScope: a.scope } : null), { client_id: this.options.clientId })), this.cookieStorage.save(this.isAuthenticatedCookieName, !0, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }), this._processOrgHint(o || h.claims.org_id), Object.assign(Object.assign({}, a), { decodedToken: h });
|
|
1380
|
-
}
|
|
1381
|
-
async exchangeToken(e) {
|
|
1382
|
-
return this._requestToken({ grant_type: "urn:ietf:params:oauth:grant-type:token-exchange", subject_token: e.subject_token, subject_token_type: e.subject_token_type, scope: Z(this.scope, e.scope, e.audience || this.options.authorizationParams.audience), audience: e.audience || this.options.authorizationParams.audience, organization: e.organization || this.options.authorizationParams.organization });
|
|
1383
|
-
}
|
|
1384
|
-
_assertDpop(e) {
|
|
1385
|
-
if (!e) throw new Error("`useDpop` option must be enabled before using DPoP.");
|
|
1386
|
-
}
|
|
1387
|
-
getDpopNonce(e) {
|
|
1388
|
-
return this._assertDpop(this.dpop), this.dpop.getNonce(e);
|
|
1389
|
-
}
|
|
1390
|
-
setDpopNonce(e, t) {
|
|
1391
|
-
return this._assertDpop(this.dpop), this.dpop.setNonce(e, t);
|
|
1392
|
-
}
|
|
1393
|
-
generateDpopProof(e) {
|
|
1394
|
-
return this._assertDpop(this.dpop), this.dpop.generateProof(e);
|
|
1395
|
-
}
|
|
1396
|
-
createFetcher(e = {}) {
|
|
1397
|
-
return new ct(e, { isDpopEnabled: () => !!this.options.useDpop, getAccessToken: (t) => {
|
|
1398
|
-
var n;
|
|
1399
|
-
return this.getTokenSilently({ authorizationParams: { scope: (n = t == null ? void 0 : t.scope) === null || n === void 0 ? void 0 : n.join(" "), audience: t == null ? void 0 : t.audience }, detailedResponse: !0 });
|
|
1400
|
-
}, getDpopNonce: () => this.getDpopNonce(e.dpopNonceId), setDpopNonce: (t) => this.setDpopNonce(t, e.dpopNonceId), generateDpopProof: (t) => this.generateDpopProof(t) });
|
|
1401
|
-
}
|
|
1402
|
-
async connectAccountWithRedirect(e) {
|
|
1403
|
-
const { openUrl: t, appState: n, connection: o, scopes: r, authorization_params: a, redirectUri: h = this.options.authorizationParams.redirect_uri || window.location.origin } = e;
|
|
1404
|
-
if (!o) throw new Error("connection is required");
|
|
1405
|
-
const u = G(N()), p = N(), s = await ue(p), c = de(s), { connect_uri: d, connect_params: l, auth_session: m } = await this.myAccountApi.connectAccount({ connection: o, scopes: r, redirect_uri: h, state: u, code_challenge: c, code_challenge_method: "S256", authorization_params: a });
|
|
1406
|
-
this.transactionManager.create({ state: u, code_verifier: p, auth_session: m, redirect_uri: h, appState: n, connection: o, response_type: j.ConnectCode });
|
|
1407
|
-
const y = new URL(d);
|
|
1408
|
-
y.searchParams.set("ticket", l.ticket), t ? await t(y.toString()) : window.location.assign(y);
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1411
|
-
export {
|
|
1412
|
-
ht as Auth0Client,
|
|
1413
|
-
te as AuthenticationError,
|
|
1414
|
-
_ as CacheKey,
|
|
1415
|
-
ne as ConnectError,
|
|
1416
|
-
v as GenericError,
|
|
1417
|
-
Pe as InMemoryCache,
|
|
1418
|
-
Me as LocalStorageCache,
|
|
1419
|
-
se as MfaRequiredError,
|
|
1420
|
-
V as MissingRefreshTokenError,
|
|
1421
|
-
X as MyAccountApiError,
|
|
1422
|
-
ie as PopupCancelledError,
|
|
1423
|
-
re as PopupOpenError,
|
|
1424
|
-
oe as PopupTimeoutError,
|
|
1425
|
-
j as ResponseType,
|
|
1426
|
-
U as TimeoutError,
|
|
1427
|
-
F as UseDpopNonceError
|
|
1428
|
-
};
|
|
1429
|
-
//# sourceMappingURL=auth0-spa-js.production.esm-9WdmjTxR.js.map
|