@sesamy/sesamy-js 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/sesamy-js.es.js +1525 -1141
- package/dist/sesamy-js.umd.js +17 -6
- package/package.json +3 -2
package/dist/sesamy-js.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var gr = Object.defineProperty;
|
|
2
|
+
var yr = (t, e, n) => e in t ? gr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var G = (t, e, n) => (yr(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
4
|
(function() {
|
|
5
5
|
const e = document.createElement("link").relList;
|
|
6
6
|
if (e && e.supports && e.supports("modulepreload"))
|
|
@@ -25,7 +25,7 @@ var Y = (t, e, n) => (ir(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
|
25
25
|
fetch(i.href, o);
|
|
26
26
|
}
|
|
27
27
|
})();
|
|
28
|
-
function
|
|
28
|
+
function it(t, e) {
|
|
29
29
|
const n = new CustomEvent(t, {
|
|
30
30
|
detail: e,
|
|
31
31
|
bubbles: !0,
|
|
@@ -44,14 +44,14 @@ function Q(t, e) {
|
|
|
44
44
|
}
|
|
45
45
|
return n;
|
|
46
46
|
}
|
|
47
|
-
var
|
|
48
|
-
function
|
|
47
|
+
var ue = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
48
|
+
function Tt(t) {
|
|
49
49
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function jt(t, e) {
|
|
52
52
|
return t(e = { exports: {} }, e.exports), e.exports;
|
|
53
53
|
}
|
|
54
|
-
var
|
|
54
|
+
var se = jt(function(t, e) {
|
|
55
55
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
56
56
|
var n = function() {
|
|
57
57
|
function r() {
|
|
@@ -82,95 +82,95 @@ var oe = _t(function(t, e) {
|
|
|
82
82
|
return n.getInstance();
|
|
83
83
|
};
|
|
84
84
|
});
|
|
85
|
-
|
|
86
|
-
var
|
|
87
|
-
var n =
|
|
88
|
-
return new (
|
|
89
|
-
function y
|
|
85
|
+
Tt(se);
|
|
86
|
+
var vr = Tt(jt(function(t, e) {
|
|
87
|
+
var n = ue && ue.__awaiter || function(u, c, h, d) {
|
|
88
|
+
return new (h || (h = Promise))(function(w, k) {
|
|
89
|
+
function v(y) {
|
|
90
90
|
try {
|
|
91
|
-
_(
|
|
92
|
-
} catch (
|
|
93
|
-
|
|
91
|
+
_(d.next(y));
|
|
92
|
+
} catch (l) {
|
|
93
|
+
k(l);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function I(y) {
|
|
97
97
|
try {
|
|
98
|
-
_(
|
|
99
|
-
} catch (
|
|
100
|
-
|
|
98
|
+
_(d.throw(y));
|
|
99
|
+
} catch (l) {
|
|
100
|
+
k(l);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
function _(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}).then(
|
|
103
|
+
function _(y) {
|
|
104
|
+
y.done ? w(y.value) : new h(function(l) {
|
|
105
|
+
l(y.value);
|
|
106
|
+
}).then(v, I);
|
|
107
107
|
}
|
|
108
|
-
_((
|
|
108
|
+
_((d = d.apply(u, c || [])).next());
|
|
109
109
|
});
|
|
110
|
-
}, r =
|
|
111
|
-
var
|
|
112
|
-
if (1 &
|
|
113
|
-
throw
|
|
114
|
-
return
|
|
110
|
+
}, r = ue && ue.__generator || function(u, c) {
|
|
111
|
+
var h, d, w, k, v = { label: 0, sent: function() {
|
|
112
|
+
if (1 & w[0])
|
|
113
|
+
throw w[1];
|
|
114
|
+
return w[1];
|
|
115
115
|
}, trys: [], ops: [] };
|
|
116
|
-
return
|
|
116
|
+
return k = { next: I(0), throw: I(1), return: I(2) }, typeof Symbol == "function" && (k[Symbol.iterator] = function() {
|
|
117
117
|
return this;
|
|
118
|
-
}),
|
|
119
|
-
function
|
|
120
|
-
return function(
|
|
121
|
-
return function(
|
|
122
|
-
if (
|
|
118
|
+
}), k;
|
|
119
|
+
function I(_) {
|
|
120
|
+
return function(y) {
|
|
121
|
+
return function(l) {
|
|
122
|
+
if (h)
|
|
123
123
|
throw new TypeError("Generator is already executing.");
|
|
124
|
-
for (;
|
|
124
|
+
for (; v; )
|
|
125
125
|
try {
|
|
126
|
-
if (
|
|
127
|
-
return
|
|
128
|
-
switch (
|
|
126
|
+
if (h = 1, d && (w = 2 & l[0] ? d.return : l[0] ? d.throw || ((w = d.return) && w.call(d), 0) : d.next) && !(w = w.call(d, l[1])).done)
|
|
127
|
+
return w;
|
|
128
|
+
switch (d = 0, w && (l = [2 & l[0], w.value]), l[0]) {
|
|
129
129
|
case 0:
|
|
130
130
|
case 1:
|
|
131
|
-
|
|
131
|
+
w = l;
|
|
132
132
|
break;
|
|
133
133
|
case 4:
|
|
134
|
-
return
|
|
134
|
+
return v.label++, { value: l[1], done: !1 };
|
|
135
135
|
case 5:
|
|
136
|
-
|
|
136
|
+
v.label++, d = l[1], l = [0];
|
|
137
137
|
continue;
|
|
138
138
|
case 7:
|
|
139
|
-
|
|
139
|
+
l = v.ops.pop(), v.trys.pop();
|
|
140
140
|
continue;
|
|
141
141
|
default:
|
|
142
|
-
if (
|
|
143
|
-
|
|
142
|
+
if (w = v.trys, !((w = w.length > 0 && w[w.length - 1]) || l[0] !== 6 && l[0] !== 2)) {
|
|
143
|
+
v = 0;
|
|
144
144
|
continue;
|
|
145
145
|
}
|
|
146
|
-
if (
|
|
147
|
-
|
|
146
|
+
if (l[0] === 3 && (!w || l[1] > w[0] && l[1] < w[3])) {
|
|
147
|
+
v.label = l[1];
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
|
-
if (
|
|
151
|
-
|
|
150
|
+
if (l[0] === 6 && v.label < w[1]) {
|
|
151
|
+
v.label = w[1], w = l;
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
|
-
if (
|
|
155
|
-
|
|
154
|
+
if (w && v.label < w[2]) {
|
|
155
|
+
v.label = w[2], v.ops.push(l);
|
|
156
156
|
break;
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
w[2] && v.ops.pop(), v.trys.pop();
|
|
159
159
|
continue;
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
l = c.call(u, v);
|
|
162
162
|
} catch (b) {
|
|
163
|
-
|
|
163
|
+
l = [6, b], d = 0;
|
|
164
164
|
} finally {
|
|
165
|
-
|
|
165
|
+
h = w = 0;
|
|
166
166
|
}
|
|
167
|
-
if (5 &
|
|
168
|
-
throw
|
|
169
|
-
return { value:
|
|
170
|
-
}([_,
|
|
167
|
+
if (5 & l[0])
|
|
168
|
+
throw l[1];
|
|
169
|
+
return { value: l[0] ? l[1] : void 0, done: !0 };
|
|
170
|
+
}([_, y]);
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
-
}, i =
|
|
173
|
+
}, i = ue;
|
|
174
174
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
175
175
|
var o = "browser-tabs-lock-key", a = { key: function(u) {
|
|
176
176
|
return n(i, void 0, void 0, function() {
|
|
@@ -198,7 +198,7 @@ var or = St(_t(function(t, e) {
|
|
|
198
198
|
});
|
|
199
199
|
}, setItem: function(u, c) {
|
|
200
200
|
return n(i, void 0, void 0, function() {
|
|
201
|
-
return r(this, function(
|
|
201
|
+
return r(this, function(h) {
|
|
202
202
|
throw new Error("Unsupported");
|
|
203
203
|
});
|
|
204
204
|
});
|
|
@@ -218,54 +218,54 @@ var or = St(_t(function(t, e) {
|
|
|
218
218
|
return setTimeout(c, u);
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
for (var c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",
|
|
223
|
-
|
|
224
|
-
return
|
|
221
|
+
function m(u) {
|
|
222
|
+
for (var c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz", h = "", d = 0; d < u; d++)
|
|
223
|
+
h += c[Math.floor(Math.random() * c.length)];
|
|
224
|
+
return h;
|
|
225
225
|
}
|
|
226
|
-
var
|
|
226
|
+
var p = function() {
|
|
227
227
|
function u(c) {
|
|
228
|
-
this.acquiredIatSet = /* @__PURE__ */ new Set(), this.storageHandler = void 0, this.id = Date.now().toString() +
|
|
228
|
+
this.acquiredIatSet = /* @__PURE__ */ new Set(), this.storageHandler = void 0, this.id = Date.now().toString() + m(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, u.waiters === void 0 && (u.waiters = []);
|
|
229
229
|
}
|
|
230
|
-
return u.prototype.acquireLock = function(c,
|
|
231
|
-
return
|
|
232
|
-
var
|
|
233
|
-
return r(this, function(
|
|
234
|
-
switch (
|
|
230
|
+
return u.prototype.acquireLock = function(c, h) {
|
|
231
|
+
return h === void 0 && (h = 5e3), n(this, void 0, void 0, function() {
|
|
232
|
+
var d, w, k, v, I, _, y;
|
|
233
|
+
return r(this, function(l) {
|
|
234
|
+
switch (l.label) {
|
|
235
235
|
case 0:
|
|
236
|
-
|
|
236
|
+
d = Date.now() + m(4), w = Date.now() + h, k = o + "-" + c, v = this.storageHandler === void 0 ? a : this.storageHandler, l.label = 1;
|
|
237
237
|
case 1:
|
|
238
|
-
return Date.now() <
|
|
238
|
+
return Date.now() < w ? [4, s(30)] : [3, 8];
|
|
239
239
|
case 2:
|
|
240
|
-
return
|
|
240
|
+
return l.sent(), v.getItemSync(k) !== null ? [3, 5] : (I = this.id + "-" + c + "-" + d, [4, s(Math.floor(25 * Math.random()))]);
|
|
241
241
|
case 3:
|
|
242
|
-
return
|
|
242
|
+
return l.sent(), v.setItemSync(k, JSON.stringify({ id: this.id, iat: d, timeoutKey: I, timeAcquired: Date.now(), timeRefreshed: Date.now() })), [4, s(30)];
|
|
243
243
|
case 4:
|
|
244
|
-
return
|
|
244
|
+
return l.sent(), (_ = v.getItemSync(k)) !== null && (y = JSON.parse(_)).id === this.id && y.iat === d ? (this.acquiredIatSet.add(d), this.refreshLockWhileAcquired(k, d), [2, !0]) : [3, 7];
|
|
245
245
|
case 5:
|
|
246
|
-
return u.lockCorrector(this.storageHandler === void 0 ? a : this.storageHandler), [4, this.waitForSomethingToChange(
|
|
246
|
+
return u.lockCorrector(this.storageHandler === void 0 ? a : this.storageHandler), [4, this.waitForSomethingToChange(w)];
|
|
247
247
|
case 6:
|
|
248
|
-
|
|
248
|
+
l.sent(), l.label = 7;
|
|
249
249
|
case 7:
|
|
250
|
-
return
|
|
250
|
+
return d = Date.now() + m(4), [3, 1];
|
|
251
251
|
case 8:
|
|
252
252
|
return [2, !1];
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
255
|
});
|
|
256
|
-
}, u.prototype.refreshLockWhileAcquired = function(c,
|
|
256
|
+
}, u.prototype.refreshLockWhileAcquired = function(c, h) {
|
|
257
257
|
return n(this, void 0, void 0, function() {
|
|
258
|
-
var
|
|
259
|
-
return r(this, function(
|
|
258
|
+
var d = this;
|
|
259
|
+
return r(this, function(w) {
|
|
260
260
|
return setTimeout(function() {
|
|
261
|
-
return n(
|
|
262
|
-
var
|
|
261
|
+
return n(d, void 0, void 0, function() {
|
|
262
|
+
var k, v, I;
|
|
263
263
|
return r(this, function(_) {
|
|
264
264
|
switch (_.label) {
|
|
265
265
|
case 0:
|
|
266
|
-
return [4,
|
|
266
|
+
return [4, se.default().lock(h)];
|
|
267
267
|
case 1:
|
|
268
|
-
return _.sent(), this.acquiredIatSet.has(
|
|
268
|
+
return _.sent(), this.acquiredIatSet.has(h) ? (k = this.storageHandler === void 0 ? a : this.storageHandler, (v = k.getItemSync(c)) === null ? (se.default().unlock(h), [2]) : ((I = JSON.parse(v)).timeRefreshed = Date.now(), k.setItemSync(c, JSON.stringify(I)), se.default().unlock(h), this.refreshLockWhileAcquired(c, h), [2])) : (se.default().unlock(h), [2]);
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
271
|
});
|
|
@@ -274,31 +274,31 @@ var or = St(_t(function(t, e) {
|
|
|
274
274
|
});
|
|
275
275
|
}, u.prototype.waitForSomethingToChange = function(c) {
|
|
276
276
|
return n(this, void 0, void 0, function() {
|
|
277
|
-
return r(this, function(
|
|
278
|
-
switch (
|
|
277
|
+
return r(this, function(h) {
|
|
278
|
+
switch (h.label) {
|
|
279
279
|
case 0:
|
|
280
|
-
return [4, new Promise(function(
|
|
281
|
-
var
|
|
282
|
-
function
|
|
283
|
-
if (
|
|
284
|
-
|
|
285
|
-
var
|
|
286
|
-
|
|
280
|
+
return [4, new Promise(function(d) {
|
|
281
|
+
var w = !1, k = Date.now(), v = !1;
|
|
282
|
+
function I() {
|
|
283
|
+
if (v || (window.removeEventListener("storage", I), u.removeFromWaiting(I), clearTimeout(_), v = !0), !w) {
|
|
284
|
+
w = !0;
|
|
285
|
+
var y = 50 - (Date.now() - k);
|
|
286
|
+
y > 0 ? setTimeout(d, y) : d(null);
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
window.addEventListener("storage",
|
|
290
|
-
var _ = setTimeout(
|
|
289
|
+
window.addEventListener("storage", I), u.addToWaiting(I);
|
|
290
|
+
var _ = setTimeout(I, Math.max(0, c - Date.now()));
|
|
291
291
|
})];
|
|
292
292
|
case 1:
|
|
293
|
-
return
|
|
293
|
+
return h.sent(), [2];
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
296
|
});
|
|
297
297
|
}, u.addToWaiting = function(c) {
|
|
298
298
|
this.removeFromWaiting(c), u.waiters !== void 0 && u.waiters.push(c);
|
|
299
299
|
}, u.removeFromWaiting = function(c) {
|
|
300
|
-
u.waiters !== void 0 && (u.waiters = u.waiters.filter(function(
|
|
301
|
-
return
|
|
300
|
+
u.waiters !== void 0 && (u.waiters = u.waiters.filter(function(h) {
|
|
301
|
+
return h !== c;
|
|
302
302
|
}));
|
|
303
303
|
}, u.notifyWaiters = function() {
|
|
304
304
|
u.waiters !== void 0 && u.waiters.slice().forEach(function(c) {
|
|
@@ -306,143 +306,143 @@ var or = St(_t(function(t, e) {
|
|
|
306
306
|
});
|
|
307
307
|
}, u.prototype.releaseLock = function(c) {
|
|
308
308
|
return n(this, void 0, void 0, function() {
|
|
309
|
-
return r(this, function(
|
|
310
|
-
switch (
|
|
309
|
+
return r(this, function(h) {
|
|
310
|
+
switch (h.label) {
|
|
311
311
|
case 0:
|
|
312
312
|
return [4, this.releaseLock__private__(c)];
|
|
313
313
|
case 1:
|
|
314
|
-
return [2,
|
|
314
|
+
return [2, h.sent()];
|
|
315
315
|
}
|
|
316
316
|
});
|
|
317
317
|
});
|
|
318
318
|
}, u.prototype.releaseLock__private__ = function(c) {
|
|
319
319
|
return n(this, void 0, void 0, function() {
|
|
320
|
-
var
|
|
321
|
-
return r(this, function(
|
|
322
|
-
switch (
|
|
320
|
+
var h, d, w, k;
|
|
321
|
+
return r(this, function(v) {
|
|
322
|
+
switch (v.label) {
|
|
323
323
|
case 0:
|
|
324
|
-
return
|
|
324
|
+
return h = this.storageHandler === void 0 ? a : this.storageHandler, d = o + "-" + c, (w = h.getItemSync(d)) === null ? [2] : (k = JSON.parse(w)).id !== this.id ? [3, 2] : [4, se.default().lock(k.iat)];
|
|
325
325
|
case 1:
|
|
326
|
-
|
|
326
|
+
v.sent(), this.acquiredIatSet.delete(k.iat), h.removeItemSync(d), se.default().unlock(k.iat), u.notifyWaiters(), v.label = 2;
|
|
327
327
|
case 2:
|
|
328
328
|
return [2];
|
|
329
329
|
}
|
|
330
330
|
});
|
|
331
331
|
});
|
|
332
332
|
}, u.lockCorrector = function(c) {
|
|
333
|
-
for (var
|
|
334
|
-
var
|
|
335
|
-
if (
|
|
333
|
+
for (var h = Date.now() - 5e3, d = c, w = [], k = 0; ; ) {
|
|
334
|
+
var v = d.keySync(k);
|
|
335
|
+
if (v === null)
|
|
336
336
|
break;
|
|
337
|
-
|
|
337
|
+
w.push(v), k++;
|
|
338
338
|
}
|
|
339
|
-
for (var
|
|
340
|
-
var
|
|
341
|
-
if (
|
|
342
|
-
var
|
|
343
|
-
if (
|
|
344
|
-
var b = JSON.parse(
|
|
345
|
-
(b.timeRefreshed === void 0 && b.timeAcquired <
|
|
339
|
+
for (var I = !1, _ = 0; _ < w.length; _++) {
|
|
340
|
+
var y = w[_];
|
|
341
|
+
if (y.includes(o)) {
|
|
342
|
+
var l = d.getItemSync(y);
|
|
343
|
+
if (l !== null) {
|
|
344
|
+
var b = JSON.parse(l);
|
|
345
|
+
(b.timeRefreshed === void 0 && b.timeAcquired < h || b.timeRefreshed !== void 0 && b.timeRefreshed < h) && (d.removeItemSync(y), I = !0);
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
|
-
|
|
349
|
+
I && u.notifyWaiters();
|
|
350
350
|
}, u.waiters = void 0, u;
|
|
351
351
|
}();
|
|
352
|
-
e.default =
|
|
352
|
+
e.default = p;
|
|
353
353
|
}));
|
|
354
|
-
const
|
|
355
|
-
let
|
|
354
|
+
const wr = { timeoutInSeconds: 60 }, Sn = { name: "auth0-spa-js", version: "2.1.3" }, En = () => Date.now();
|
|
355
|
+
let V = class kt extends Error {
|
|
356
356
|
constructor(e, n) {
|
|
357
|
-
super(n), this.error = e, this.error_description = n, Object.setPrototypeOf(this,
|
|
357
|
+
super(n), this.error = e, this.error_description = n, Object.setPrototypeOf(this, kt.prototype);
|
|
358
358
|
}
|
|
359
359
|
static fromPayload({ error: e, error_description: n }) {
|
|
360
|
-
return new
|
|
360
|
+
return new kt(e, n);
|
|
361
361
|
}
|
|
362
|
-
},
|
|
362
|
+
}, br = class On extends V {
|
|
363
363
|
constructor(e, n, r, i = null) {
|
|
364
|
-
super(e, n), this.state = r, this.appState = i, Object.setPrototypeOf(this,
|
|
364
|
+
super(e, n), this.state = r, this.appState = i, Object.setPrototypeOf(this, On.prototype);
|
|
365
365
|
}
|
|
366
|
-
},
|
|
366
|
+
}, It = class Pn extends V {
|
|
367
367
|
constructor() {
|
|
368
|
-
super("timeout", "Timeout"), Object.setPrototypeOf(this,
|
|
368
|
+
super("timeout", "Timeout"), Object.setPrototypeOf(this, Pn.prototype);
|
|
369
369
|
}
|
|
370
|
-
},
|
|
370
|
+
}, kr = class Tn extends It {
|
|
371
371
|
constructor(e) {
|
|
372
|
-
super(), this.popup = e, Object.setPrototypeOf(this,
|
|
372
|
+
super(), this.popup = e, Object.setPrototypeOf(this, Tn.prototype);
|
|
373
373
|
}
|
|
374
|
-
},
|
|
374
|
+
}, Ir = class jn extends V {
|
|
375
375
|
constructor(e) {
|
|
376
|
-
super("cancelled", "Popup closed"), this.popup = e, Object.setPrototypeOf(this,
|
|
376
|
+
super("cancelled", "Popup closed"), this.popup = e, Object.setPrototypeOf(this, jn.prototype);
|
|
377
377
|
}
|
|
378
|
-
},
|
|
378
|
+
}, _r = class xn extends V {
|
|
379
379
|
constructor(e, n, r) {
|
|
380
|
-
super(e, n), this.mfa_token = r, Object.setPrototypeOf(this,
|
|
380
|
+
super(e, n), this.mfa_token = r, Object.setPrototypeOf(this, xn.prototype);
|
|
381
381
|
}
|
|
382
|
-
},
|
|
382
|
+
}, Cn = class $n extends V {
|
|
383
383
|
constructor(e, n) {
|
|
384
|
-
super("missing_refresh_token", `Missing Refresh Token (audience: '${
|
|
384
|
+
super("missing_refresh_token", `Missing Refresh Token (audience: '${Rt(e, ["default"])}', scope: '${Rt(n)}')`), this.audience = e, this.scope = n, Object.setPrototypeOf(this, $n.prototype);
|
|
385
385
|
}
|
|
386
386
|
};
|
|
387
|
-
function
|
|
387
|
+
function Rt(t, e = []) {
|
|
388
388
|
return t && !e.includes(t) ? t : "";
|
|
389
389
|
}
|
|
390
|
-
const
|
|
390
|
+
const qe = () => window.crypto, dt = () => {
|
|
391
391
|
const t = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";
|
|
392
392
|
let e = "";
|
|
393
|
-
return Array.from(
|
|
394
|
-
},
|
|
393
|
+
return Array.from(qe().getRandomValues(new Uint8Array(43))).forEach((n) => e += t[n % t.length]), e;
|
|
394
|
+
}, Wt = (t) => btoa(t), _t = (t) => {
|
|
395
395
|
var { clientId: e } = t, n = Q(t, ["clientId"]);
|
|
396
396
|
return new URLSearchParams(((r) => Object.keys(r).filter((i) => r[i] !== void 0).reduce((i, o) => Object.assign(Object.assign({}, i), { [o]: r[o] }), {}))(Object.assign({ client_id: e }, n))).toString();
|
|
397
|
-
},
|
|
397
|
+
}, Zt = (t) => ((e) => decodeURIComponent(atob(e).split("").map((n) => "%" + ("00" + n.charCodeAt(0).toString(16)).slice(-2)).join("")))(t.replace(/_/g, "/").replace(/-/g, "+")), Sr = async (t, e) => {
|
|
398
398
|
const n = await fetch(t, e);
|
|
399
399
|
return { ok: n.ok, json: await n.json() };
|
|
400
|
-
},
|
|
400
|
+
}, Er = async (t, e, n) => {
|
|
401
401
|
const r = new AbortController();
|
|
402
402
|
let i;
|
|
403
|
-
return e.signal = r.signal, Promise.race([
|
|
403
|
+
return e.signal = r.signal, Promise.race([Sr(t, e), new Promise((o, a) => {
|
|
404
404
|
i = setTimeout(() => {
|
|
405
405
|
r.abort(), a(new Error("Timeout when executing 'fetch'"));
|
|
406
406
|
}, n);
|
|
407
407
|
})]).finally(() => {
|
|
408
408
|
clearTimeout(i);
|
|
409
409
|
});
|
|
410
|
-
},
|
|
411
|
-
return s = { auth: { audience: e, scope: n }, timeout: i, fetchUrl: t, fetchOptions: r, useFormData: a },
|
|
410
|
+
}, Or = async (t, e, n, r, i, o, a) => {
|
|
411
|
+
return s = { auth: { audience: e, scope: n }, timeout: i, fetchUrl: t, fetchOptions: r, useFormData: a }, m = o, new Promise(function(p, u) {
|
|
412
412
|
const c = new MessageChannel();
|
|
413
|
-
c.port1.onmessage = function(
|
|
414
|
-
|
|
415
|
-
},
|
|
413
|
+
c.port1.onmessage = function(h) {
|
|
414
|
+
h.data.error ? u(new Error(h.data.error)) : p(h.data), c.port1.close();
|
|
415
|
+
}, m.postMessage(s, [c.port2]);
|
|
416
416
|
});
|
|
417
|
-
var s,
|
|
418
|
-
},
|
|
419
|
-
async function
|
|
420
|
-
var { baseUrl: n, timeout: r, audience: i, scope: o, auth0Client: a, useFormData: s } = t,
|
|
421
|
-
const
|
|
422
|
-
return await async function(u, c,
|
|
423
|
-
let
|
|
417
|
+
var s, m;
|
|
418
|
+
}, Pr = async (t, e, n, r, i, o, a = 1e4) => i ? Or(t, e, n, r, a, i, o) : Er(t, r, a);
|
|
419
|
+
async function Tr(t, e) {
|
|
420
|
+
var { baseUrl: n, timeout: r, audience: i, scope: o, auth0Client: a, useFormData: s } = t, m = Q(t, ["baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData"]);
|
|
421
|
+
const p = s ? _t(m) : JSON.stringify(m);
|
|
422
|
+
return await async function(u, c, h, d, w, k, v) {
|
|
423
|
+
let I, _ = null;
|
|
424
424
|
for (let x = 0; x < 3; x++)
|
|
425
425
|
try {
|
|
426
|
-
|
|
426
|
+
I = await Pr(u, h, d, w, k, v, c), _ = null;
|
|
427
427
|
break;
|
|
428
428
|
} catch (D) {
|
|
429
429
|
_ = D;
|
|
430
430
|
}
|
|
431
431
|
if (_)
|
|
432
432
|
throw _;
|
|
433
|
-
const
|
|
434
|
-
if (!
|
|
433
|
+
const y = I.json, { error: l, error_description: b } = y, T = Q(y, ["error", "error_description"]), { ok: P } = I;
|
|
434
|
+
if (!P) {
|
|
435
435
|
const x = b || `HTTP error. Unable to fetch ${u}`;
|
|
436
|
-
throw
|
|
436
|
+
throw l === "mfa_required" ? new _r(l, x, T.mfa_token) : l === "missing_refresh_token" ? new Cn(h, d) : new V(l || "request_error", x);
|
|
437
437
|
}
|
|
438
|
-
return
|
|
439
|
-
}(`${n}/oauth/token`, r, i || "default", o, { method: "POST", body:
|
|
438
|
+
return T;
|
|
439
|
+
}(`${n}/oauth/token`, r, i || "default", o, { method: "POST", body: p, headers: { "Content-Type": s ? "application/x-www-form-urlencoded" : "application/json", "Auth0-Client": btoa(JSON.stringify(a || Sn)) } }, e, s);
|
|
440
440
|
}
|
|
441
|
-
const
|
|
441
|
+
const Xe = (...t) => {
|
|
442
442
|
return (e = t.filter(Boolean).join(" ").trim().split(/\s+/), Array.from(new Set(e))).join(" ");
|
|
443
443
|
var e;
|
|
444
444
|
};
|
|
445
|
-
let
|
|
445
|
+
let de = class St {
|
|
446
446
|
constructor(e, n = "@@auth0spajs@@", r) {
|
|
447
447
|
this.prefix = n, this.suffix = r, this.clientId = e.clientId, this.scope = e.scope, this.audience = e.audience;
|
|
448
448
|
}
|
|
@@ -451,13 +451,13 @@ let ue = class yt {
|
|
|
451
451
|
}
|
|
452
452
|
static fromKey(e) {
|
|
453
453
|
const [n, r, i, o] = e.split("::");
|
|
454
|
-
return new
|
|
454
|
+
return new St({ clientId: r, scope: o, audience: i }, n);
|
|
455
455
|
}
|
|
456
456
|
static fromCacheEntry(e) {
|
|
457
457
|
const { scope: n, audience: r, client_id: i } = e;
|
|
458
|
-
return new
|
|
458
|
+
return new St({ scope: n, audience: r, clientId: i });
|
|
459
459
|
}
|
|
460
|
-
},
|
|
460
|
+
}, jr = class {
|
|
461
461
|
set(e, n) {
|
|
462
462
|
localStorage.setItem(e, JSON.stringify(n));
|
|
463
463
|
}
|
|
@@ -476,7 +476,7 @@ let ue = class yt {
|
|
|
476
476
|
allKeys() {
|
|
477
477
|
return Object.keys(window.localStorage).filter((e) => e.startsWith("@@auth0spajs@@"));
|
|
478
478
|
}
|
|
479
|
-
},
|
|
479
|
+
}, An = class {
|
|
480
480
|
constructor() {
|
|
481
481
|
this.enclosedCache = /* @__PURE__ */ function() {
|
|
482
482
|
let e = {};
|
|
@@ -491,9 +491,9 @@ let ue = class yt {
|
|
|
491
491
|
}, allKeys: () => Object.keys(e) };
|
|
492
492
|
}();
|
|
493
493
|
}
|
|
494
|
-
},
|
|
494
|
+
}, xr = class {
|
|
495
495
|
constructor(e, n, r) {
|
|
496
|
-
this.cache = e, this.keyManifest = n, this.nowProvider = r ||
|
|
496
|
+
this.cache = e, this.keyManifest = n, this.nowProvider = r || En;
|
|
497
497
|
}
|
|
498
498
|
async setIdToken(e, n, r) {
|
|
499
499
|
var i;
|
|
@@ -516,8 +516,8 @@ let ue = class yt {
|
|
|
516
516
|
const s = await this.getCacheKeys();
|
|
517
517
|
if (!s)
|
|
518
518
|
return;
|
|
519
|
-
const
|
|
520
|
-
|
|
519
|
+
const m = this.matchExistingCacheKey(e, s);
|
|
520
|
+
m && (i = await this.cache.get(m));
|
|
521
521
|
}
|
|
522
522
|
if (!i)
|
|
523
523
|
return;
|
|
@@ -526,7 +526,7 @@ let ue = class yt {
|
|
|
526
526
|
}
|
|
527
527
|
async set(e) {
|
|
528
528
|
var n;
|
|
529
|
-
const r = new
|
|
529
|
+
const r = new de({ clientId: e.client_id, scope: e.scope, audience: e.audience }), i = await this.wrapCacheEntry(e);
|
|
530
530
|
await this.cache.set(r.toKey(), i), await ((n = this.keyManifest) === null || n === void 0 ? void 0 : n.add(r.toKey()));
|
|
531
531
|
}
|
|
532
532
|
async clear(e) {
|
|
@@ -545,16 +545,16 @@ let ue = class yt {
|
|
|
545
545
|
return this.keyManifest ? (e = await this.keyManifest.get()) === null || e === void 0 ? void 0 : e.keys : this.cache.allKeys ? this.cache.allKeys() : void 0;
|
|
546
546
|
}
|
|
547
547
|
getIdTokenCacheKey(e) {
|
|
548
|
-
return new
|
|
548
|
+
return new de({ clientId: e }, "@@auth0spajs@@", "@@user@@").toKey();
|
|
549
549
|
}
|
|
550
550
|
matchExistingCacheKey(e, n) {
|
|
551
551
|
return n.filter((r) => {
|
|
552
552
|
var i;
|
|
553
|
-
const o =
|
|
554
|
-
return o.prefix === "@@auth0spajs@@" && o.clientId === e.clientId && o.audience === e.audience &&
|
|
553
|
+
const o = de.fromKey(r), a = new Set(o.scope && o.scope.split(" ")), s = ((i = e.scope) === null || i === void 0 ? void 0 : i.split(" ")) || [], m = o.scope && s.reduce((p, u) => p && a.has(u), !0);
|
|
554
|
+
return o.prefix === "@@auth0spajs@@" && o.clientId === e.clientId && o.audience === e.audience && m;
|
|
555
555
|
})[0];
|
|
556
556
|
}
|
|
557
|
-
},
|
|
557
|
+
}, Cr = class {
|
|
558
558
|
constructor(e, n, r) {
|
|
559
559
|
this.storage = e, this.clientId = n, this.cookieDomain = r, this.storageKey = `a0.spajs.txs.${this.clientId}`;
|
|
560
560
|
}
|
|
@@ -568,17 +568,17 @@ let ue = class yt {
|
|
|
568
568
|
this.storage.remove(this.storageKey, { cookieDomain: this.cookieDomain });
|
|
569
569
|
}
|
|
570
570
|
};
|
|
571
|
-
const
|
|
571
|
+
const ze = (t) => typeof t == "number", $r = ["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"], Ar = (t) => {
|
|
572
572
|
if (!t.id_token)
|
|
573
573
|
throw new Error("ID token is required but missing");
|
|
574
574
|
const e = ((o) => {
|
|
575
|
-
const a = o.split("."), [s,
|
|
576
|
-
if (a.length !== 3 || !s || !
|
|
575
|
+
const a = o.split("."), [s, m, p] = a;
|
|
576
|
+
if (a.length !== 3 || !s || !m || !p)
|
|
577
577
|
throw new Error("ID token could not be decoded");
|
|
578
|
-
const u = JSON.parse(
|
|
579
|
-
return Object.keys(u).forEach((
|
|
580
|
-
c[
|
|
581
|
-
}), { encoded: { header: s, payload:
|
|
578
|
+
const u = JSON.parse(Zt(m)), c = { __raw: o }, h = {};
|
|
579
|
+
return Object.keys(u).forEach((d) => {
|
|
580
|
+
c[d] = u[d], $r.includes(d) || (h[d] = u[d]);
|
|
581
|
+
}), { encoded: { header: s, payload: m, signature: p }, header: JSON.parse(Zt(s)), claims: c, user: h };
|
|
582
582
|
})(t.id_token);
|
|
583
583
|
if (!e.claims.iss)
|
|
584
584
|
throw new Error("Issuer (iss) claim must be a string present in the ID token");
|
|
@@ -607,21 +607,21 @@ const Te = (t) => typeof t == "number", wr = ["iss", "aud", "exp", "nbf", "iat",
|
|
|
607
607
|
if (e.claims.nonce !== t.nonce)
|
|
608
608
|
throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`);
|
|
609
609
|
}
|
|
610
|
-
if (t.max_age && !
|
|
610
|
+
if (t.max_age && !ze(e.claims.auth_time))
|
|
611
611
|
throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");
|
|
612
|
-
if (e.claims.exp == null || !
|
|
612
|
+
if (e.claims.exp == null || !ze(e.claims.exp))
|
|
613
613
|
throw new Error("Expiration Time (exp) claim must be a number present in the ID token");
|
|
614
|
-
if (!
|
|
614
|
+
if (!ze(e.claims.iat))
|
|
615
615
|
throw new Error("Issued At (iat) claim must be a number present in the ID token");
|
|
616
616
|
const n = t.leeway || 60, r = new Date(t.now || Date.now()), i = /* @__PURE__ */ new Date(0);
|
|
617
617
|
if (i.setUTCSeconds(e.claims.exp + n), r > i)
|
|
618
618
|
throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${i})`);
|
|
619
|
-
if (e.claims.nbf != null &&
|
|
619
|
+
if (e.claims.nbf != null && ze(e.claims.nbf)) {
|
|
620
620
|
const o = /* @__PURE__ */ new Date(0);
|
|
621
621
|
if (o.setUTCSeconds(e.claims.nbf - n), r < o)
|
|
622
622
|
throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${r}) is before ${o}`);
|
|
623
623
|
}
|
|
624
|
-
if (e.claims.auth_time != null &&
|
|
624
|
+
if (e.claims.auth_time != null && ze(e.claims.auth_time)) {
|
|
625
625
|
const o = /* @__PURE__ */ new Date(0);
|
|
626
626
|
if (o.setUTCSeconds(parseInt(e.claims.auth_time) + t.max_age + n), r > o)
|
|
627
627
|
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 (${r}) is after last auth at ${o}`);
|
|
@@ -644,74 +644,74 @@ const Te = (t) => typeof t == "number", wr = ["iss", "aud", "exp", "nbf", "iat",
|
|
|
644
644
|
}
|
|
645
645
|
return e;
|
|
646
646
|
};
|
|
647
|
-
var
|
|
648
|
-
var n =
|
|
649
|
-
return n = Object.assign || function(
|
|
650
|
-
for (var
|
|
651
|
-
for (var
|
|
652
|
-
Object.prototype.hasOwnProperty.call(
|
|
653
|
-
return
|
|
647
|
+
var he = jt(function(t, e) {
|
|
648
|
+
var n = ue && ue.__assign || function() {
|
|
649
|
+
return n = Object.assign || function(m) {
|
|
650
|
+
for (var p, u = 1, c = arguments.length; u < c; u++)
|
|
651
|
+
for (var h in p = arguments[u])
|
|
652
|
+
Object.prototype.hasOwnProperty.call(p, h) && (m[h] = p[h]);
|
|
653
|
+
return m;
|
|
654
654
|
}, n.apply(this, arguments);
|
|
655
655
|
};
|
|
656
|
-
function r(
|
|
657
|
-
if (!
|
|
656
|
+
function r(m, p) {
|
|
657
|
+
if (!p)
|
|
658
658
|
return "";
|
|
659
|
-
var u = "; " +
|
|
660
|
-
return
|
|
659
|
+
var u = "; " + m;
|
|
660
|
+
return p === !0 ? u : u + "=" + p;
|
|
661
661
|
}
|
|
662
|
-
function i(
|
|
663
|
-
return encodeURIComponent(
|
|
662
|
+
function i(m, p, u) {
|
|
663
|
+
return encodeURIComponent(m).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) {
|
|
664
664
|
if (typeof c.expires == "number") {
|
|
665
|
-
var
|
|
666
|
-
|
|
665
|
+
var h = /* @__PURE__ */ new Date();
|
|
666
|
+
h.setMilliseconds(h.getMilliseconds() + 864e5 * c.expires), c.expires = h;
|
|
667
667
|
}
|
|
668
668
|
return r("Expires", c.expires ? c.expires.toUTCString() : "") + r("Domain", c.domain) + r("Path", c.path) + r("Secure", c.secure) + r("SameSite", c.sameSite);
|
|
669
669
|
}(u);
|
|
670
670
|
}
|
|
671
|
-
function o(
|
|
672
|
-
for (var
|
|
673
|
-
var
|
|
674
|
-
|
|
671
|
+
function o(m) {
|
|
672
|
+
for (var p = {}, u = m ? m.split("; ") : [], c = /(%[\dA-F]{2})+/gi, h = 0; h < u.length; h++) {
|
|
673
|
+
var d = u[h].split("="), w = d.slice(1).join("=");
|
|
674
|
+
w.charAt(0) === '"' && (w = w.slice(1, -1));
|
|
675
675
|
try {
|
|
676
|
-
|
|
676
|
+
p[d[0].replace(c, decodeURIComponent)] = w.replace(c, decodeURIComponent);
|
|
677
677
|
} catch {
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
|
-
return
|
|
680
|
+
return p;
|
|
681
681
|
}
|
|
682
682
|
function a() {
|
|
683
683
|
return o(document.cookie);
|
|
684
684
|
}
|
|
685
|
-
function s(
|
|
686
|
-
document.cookie = i(
|
|
685
|
+
function s(m, p, u) {
|
|
686
|
+
document.cookie = i(m, p, n({ path: "/" }, u));
|
|
687
687
|
}
|
|
688
|
-
e.__esModule = !0, e.encode = i, e.parse = o, e.getAll = a, e.get = function(
|
|
689
|
-
return a()[
|
|
690
|
-
}, e.set = s, e.remove = function(
|
|
691
|
-
s(
|
|
688
|
+
e.__esModule = !0, e.encode = i, e.parse = o, e.getAll = a, e.get = function(m) {
|
|
689
|
+
return a()[m];
|
|
690
|
+
}, e.set = s, e.remove = function(m, p) {
|
|
691
|
+
s(m, "", n(n({}, p), { expires: -1 }));
|
|
692
692
|
};
|
|
693
693
|
});
|
|
694
|
-
|
|
695
|
-
var
|
|
696
|
-
const
|
|
697
|
-
const e =
|
|
694
|
+
Tt(he), he.encode, he.parse, he.getAll;
|
|
695
|
+
var zr = he.get, zn = he.set, Nn = he.remove;
|
|
696
|
+
const we = { get(t) {
|
|
697
|
+
const e = zr(t);
|
|
698
698
|
if (e !== void 0)
|
|
699
699
|
return JSON.parse(e);
|
|
700
700
|
}, save(t, e, n) {
|
|
701
701
|
let r = {};
|
|
702
|
-
window.location.protocol === "https:" && (r = { secure: !0, sameSite: "none" }), n != null && n.daysUntilExpire && (r.expires = n.daysUntilExpire), n != null && n.cookieDomain && (r.domain = n.cookieDomain),
|
|
702
|
+
window.location.protocol === "https:" && (r = { secure: !0, sameSite: "none" }), n != null && n.daysUntilExpire && (r.expires = n.daysUntilExpire), n != null && n.cookieDomain && (r.domain = n.cookieDomain), zn(t, JSON.stringify(e), r);
|
|
703
703
|
}, remove(t, e) {
|
|
704
704
|
let n = {};
|
|
705
|
-
e != null && e.cookieDomain && (n.domain = e.cookieDomain),
|
|
706
|
-
} },
|
|
707
|
-
return
|
|
705
|
+
e != null && e.cookieDomain && (n.domain = e.cookieDomain), Nn(t, n);
|
|
706
|
+
} }, Nr = { get(t) {
|
|
707
|
+
return we.get(t) || we.get(`_legacy_${t}`);
|
|
708
708
|
}, save(t, e, n) {
|
|
709
709
|
let r = {};
|
|
710
|
-
window.location.protocol === "https:" && (r = { secure: !0 }), n != null && n.daysUntilExpire && (r.expires = n.daysUntilExpire), n != null && n.cookieDomain && (r.domain = n.cookieDomain),
|
|
710
|
+
window.location.protocol === "https:" && (r = { secure: !0 }), n != null && n.daysUntilExpire && (r.expires = n.daysUntilExpire), n != null && n.cookieDomain && (r.domain = n.cookieDomain), zn(`_legacy_${t}`, JSON.stringify(e), r), we.save(t, e, n);
|
|
711
711
|
}, remove(t, e) {
|
|
712
712
|
let n = {};
|
|
713
|
-
e != null && e.cookieDomain && (n.domain = e.cookieDomain),
|
|
714
|
-
} },
|
|
713
|
+
e != null && e.cookieDomain && (n.domain = e.cookieDomain), Nn(t, n), we.remove(t, e), we.remove(`_legacy_${t}`, e);
|
|
714
|
+
} }, Lr = { get(t) {
|
|
715
715
|
if (typeof sessionStorage > "u")
|
|
716
716
|
return;
|
|
717
717
|
const e = sessionStorage.getItem(t);
|
|
@@ -721,12 +721,12 @@ const ge = { get(t) {
|
|
|
721
721
|
}, remove(t) {
|
|
722
722
|
sessionStorage.removeItem(t);
|
|
723
723
|
} };
|
|
724
|
-
function
|
|
725
|
-
var r = e === void 0 ? null : e, i = function(
|
|
726
|
-
var u = atob(
|
|
727
|
-
if (
|
|
728
|
-
for (var c = new Uint8Array(u.length),
|
|
729
|
-
c[
|
|
724
|
+
function Dr(t, e, n) {
|
|
725
|
+
var r = e === void 0 ? null : e, i = function(m, p) {
|
|
726
|
+
var u = atob(m);
|
|
727
|
+
if (p) {
|
|
728
|
+
for (var c = new Uint8Array(u.length), h = 0, d = u.length; h < d; ++h)
|
|
729
|
+
c[h] = u.charCodeAt(h);
|
|
730
730
|
return String.fromCharCode.apply(null, new Uint16Array(c.buffer));
|
|
731
731
|
}
|
|
732
732
|
return u;
|
|
@@ -734,11 +734,11 @@ function _r(t, e, n) {
|
|
|
734
734
|
`, 10) + 1, a = i.substring(o) + (r ? "//# sourceMappingURL=" + r : ""), s = new Blob([a], { type: "application/javascript" });
|
|
735
735
|
return URL.createObjectURL(s);
|
|
736
736
|
}
|
|
737
|
-
var
|
|
738
|
-
return
|
|
737
|
+
var Kt, Mt, Xt, ht, Ur = (Kt = "Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=", Mt = null, Xt = !1, function(t) {
|
|
738
|
+
return ht = ht || Dr(Kt, Mt, Xt), new Worker(ht, t);
|
|
739
739
|
});
|
|
740
|
-
const
|
|
741
|
-
let
|
|
740
|
+
const ft = {};
|
|
741
|
+
let Rr = class {
|
|
742
742
|
constructor(e, n) {
|
|
743
743
|
this.cache = e, this.clientId = n, this.manifestKey = this.createManifestKeyFrom(this.clientId);
|
|
744
744
|
}
|
|
@@ -764,85 +764,85 @@ let Er = class {
|
|
|
764
764
|
return `@@auth0spajs@@::${e}`;
|
|
765
765
|
}
|
|
766
766
|
};
|
|
767
|
-
const
|
|
767
|
+
const Wr = { memory: () => new An().enclosedCache, localstorage: () => new jr() }, Ft = (t) => Wr[t], Ht = (t) => {
|
|
768
768
|
const { openUrl: e, onRedirect: n } = t, r = Q(t, ["openUrl", "onRedirect"]);
|
|
769
769
|
return Object.assign(Object.assign({}, r), { openUrl: e === !1 || e ? e : n });
|
|
770
|
-
},
|
|
771
|
-
let
|
|
770
|
+
}, pt = new vr();
|
|
771
|
+
let Zr = class {
|
|
772
772
|
constructor(e) {
|
|
773
773
|
let n, r;
|
|
774
|
-
if (this.userCache = new
|
|
775
|
-
await
|
|
774
|
+
if (this.userCache = new An().enclosedCache, this.defaultOptions = { authorizationParams: { scope: "openid profile email" }, useRefreshTokensFallback: !1, useFormData: !0 }, this._releaseLockOnPageHide = async () => {
|
|
775
|
+
await pt.releaseLock("auth0.lock.getTokenSilently"), window.removeEventListener("pagehide", this._releaseLockOnPageHide);
|
|
776
776
|
}, this.options = Object.assign(Object.assign(Object.assign({}, this.defaultOptions), e), { authorizationParams: Object.assign(Object.assign({}, this.defaultOptions.authorizationParams), e.authorizationParams) }), typeof window < "u" && (() => {
|
|
777
|
-
if (!
|
|
777
|
+
if (!qe())
|
|
778
778
|
throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");
|
|
779
|
-
if (
|
|
779
|
+
if (qe().subtle === void 0)
|
|
780
780
|
throw new Error(`
|
|
781
781
|
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.
|
|
782
782
|
`);
|
|
783
783
|
})(), 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)
|
|
784
784
|
r = e.cache;
|
|
785
785
|
else {
|
|
786
|
-
if (n = e.cacheLocation || "memory", !
|
|
786
|
+
if (n = e.cacheLocation || "memory", !Ft(n))
|
|
787
787
|
throw new Error(`Invalid cache location "${n}"`);
|
|
788
|
-
r =
|
|
788
|
+
r = Ft(n)();
|
|
789
789
|
}
|
|
790
|
-
this.httpTimeoutMs = e.httpTimeoutInSeconds ? 1e3 * e.httpTimeoutInSeconds : 1e4, this.cookieStorage = e.legacySameSiteCookie === !1 ?
|
|
791
|
-
const i = e.useCookiesForTransactions ? this.cookieStorage :
|
|
790
|
+
this.httpTimeoutMs = e.httpTimeoutInSeconds ? 1e3 * e.httpTimeoutInSeconds : 1e4, this.cookieStorage = e.legacySameSiteCookie === !1 ? we : Nr, this.orgHintCookieName = `auth0.${this.options.clientId}.organization_hint`, this.isAuthenticatedCookieName = ((a) => `auth0.${a}.is.authenticated`)(this.options.clientId), this.sessionCheckExpiryDays = e.sessionCheckExpiryDays || 1;
|
|
791
|
+
const i = e.useCookiesForTransactions ? this.cookieStorage : Lr;
|
|
792
792
|
var o;
|
|
793
|
-
this.scope =
|
|
793
|
+
this.scope = Xe("openid", this.options.authorizationParams.scope, this.options.useRefreshTokens ? "offline_access" : ""), this.transactionManager = new Cr(i, this.options.clientId, this.options.cookieDomain), this.nowProvider = this.options.nowProvider || En, this.cacheManager = new xr(r, r.allKeys ? void 0 : new Rr(r, this.options.clientId), this.nowProvider), this.domainUrl = (o = this.options.domain, /^https?:\/\//.test(o) ? o : `https://${o}`), this.tokenIssuer = ((a, s) => a ? a.startsWith("https://") ? a : `https://${a}/` : `${s}/`)(this.options.issuer, this.domainUrl), typeof window < "u" && window.Worker && this.options.useRefreshTokens && n === "memory" && (this.options.workerUrl ? this.worker = new Worker(this.options.workerUrl) : this.worker = new Ur());
|
|
794
794
|
}
|
|
795
795
|
_url(e) {
|
|
796
|
-
const n = encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client ||
|
|
796
|
+
const n = encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client || Sn)));
|
|
797
797
|
return `${this.domainUrl}${e}&auth0Client=${n}`;
|
|
798
798
|
}
|
|
799
799
|
_authorizeUrl(e) {
|
|
800
|
-
return this._url(`/authorize?${
|
|
800
|
+
return this._url(`/authorize?${_t(e)}`);
|
|
801
801
|
}
|
|
802
802
|
async _verifyIdToken(e, n, r) {
|
|
803
803
|
const i = await this.nowProvider();
|
|
804
|
-
return
|
|
804
|
+
return Ar({ iss: this.tokenIssuer, aud: this.options.clientId, id_token: e, nonce: n, organization: r, leeway: this.options.leeway, max_age: (o = this.options.authorizationParams.max_age, typeof o != "string" ? o : parseInt(o, 10) || void 0), now: i });
|
|
805
805
|
var o;
|
|
806
806
|
}
|
|
807
807
|
_processOrgHint(e) {
|
|
808
808
|
e ? this.cookieStorage.save(this.orgHintCookieName, e, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }) : this.cookieStorage.remove(this.orgHintCookieName, { cookieDomain: this.options.cookieDomain });
|
|
809
809
|
}
|
|
810
810
|
async _prepareAuthorizeUrl(e, n, r) {
|
|
811
|
-
const i =
|
|
811
|
+
const i = Wt(dt()), o = Wt(dt()), a = dt(), s = ((u) => {
|
|
812
812
|
const c = new Uint8Array(u);
|
|
813
|
-
return ((
|
|
814
|
-
const
|
|
815
|
-
return
|
|
813
|
+
return ((h) => {
|
|
814
|
+
const d = { "+": "-", "/": "_", "=": "" };
|
|
815
|
+
return h.replace(/[+/=]/g, (w) => d[w]);
|
|
816
816
|
})(window.btoa(String.fromCharCode(...Array.from(c))));
|
|
817
|
-
})(await (async (u) => await
|
|
818
|
-
return { nonce: o, code_verifier: a, scope:
|
|
817
|
+
})(await (async (u) => await qe().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(u)))(a)), m = ((u, c, h, d, w, k, v, I) => Object.assign(Object.assign(Object.assign({ client_id: u.clientId }, u.authorizationParams), h), { scope: Xe(c, h.scope), response_type: "code", response_mode: I || "query", state: d, nonce: w, redirect_uri: v || u.authorizationParams.redirect_uri, code_challenge: k, code_challenge_method: "S256" }))(this.options, this.scope, e, i, o, s, e.redirect_uri || this.options.authorizationParams.redirect_uri || r, n == null ? void 0 : n.response_mode), p = this._authorizeUrl(m);
|
|
818
|
+
return { nonce: o, code_verifier: a, scope: m.scope, audience: m.audience || "default", redirect_uri: m.redirect_uri, state: i, url: p };
|
|
819
819
|
}
|
|
820
820
|
async loginWithPopup(e, n) {
|
|
821
821
|
var r;
|
|
822
822
|
if (e = e || {}, !(n = n || {}).popup && (n.popup = ((s) => {
|
|
823
|
-
const
|
|
824
|
-
return window.open(s, "auth0:authorize:popup", `left=${
|
|
823
|
+
const m = window.screenX + (window.innerWidth - 400) / 2, p = window.screenY + (window.innerHeight - 600) / 2;
|
|
824
|
+
return window.open(s, "auth0:authorize:popup", `left=${m},top=${p},width=400,height=600,resizable,scrollbars=yes,status=1`);
|
|
825
825
|
})(""), !n.popup))
|
|
826
826
|
throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");
|
|
827
827
|
const i = await this._prepareAuthorizeUrl(e.authorizationParams || {}, { response_mode: "web_message" }, window.location.origin);
|
|
828
828
|
n.popup.location.href = i.url;
|
|
829
|
-
const o = await ((s) => new Promise((
|
|
829
|
+
const o = await ((s) => new Promise((m, p) => {
|
|
830
830
|
let u;
|
|
831
831
|
const c = setInterval(() => {
|
|
832
|
-
s.popup && s.popup.closed && (clearInterval(c), clearTimeout(
|
|
833
|
-
}, 1e3),
|
|
834
|
-
clearInterval(c),
|
|
832
|
+
s.popup && s.popup.closed && (clearInterval(c), clearTimeout(h), window.removeEventListener("message", u, !1), p(new Ir(s.popup)));
|
|
833
|
+
}, 1e3), h = setTimeout(() => {
|
|
834
|
+
clearInterval(c), p(new kr(s.popup)), window.removeEventListener("message", u, !1);
|
|
835
835
|
}, 1e3 * (s.timeoutInSeconds || 60));
|
|
836
|
-
u = function(
|
|
837
|
-
if (
|
|
838
|
-
if (clearTimeout(
|
|
839
|
-
return
|
|
840
|
-
|
|
836
|
+
u = function(d) {
|
|
837
|
+
if (d.data && d.data.type === "authorization_response") {
|
|
838
|
+
if (clearTimeout(h), clearInterval(c), window.removeEventListener("message", u, !1), s.popup.close(), d.data.response.error)
|
|
839
|
+
return p(V.fromPayload(d.data.response));
|
|
840
|
+
m(d.data.response);
|
|
841
841
|
}
|
|
842
842
|
}, window.addEventListener("message", u);
|
|
843
843
|
}))(Object.assign(Object.assign({}, n), { timeoutInSeconds: n.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || 60 }));
|
|
844
844
|
if (i.state !== o.state)
|
|
845
|
-
throw new
|
|
845
|
+
throw new V("state_mismatch", "Invalid state");
|
|
846
846
|
const a = ((r = e.authorizationParams) === null || r === void 0 ? void 0 : r.organization) || this.options.authorizationParams.organization;
|
|
847
847
|
await this._requestToken({ audience: i.audience, scope: i.scope, code_verifier: i.code_verifier, grant_type: "authorization_code", code: o.code, redirect_uri: i.redirect_uri }, { nonceIn: i.nonce, organization: a });
|
|
848
848
|
}
|
|
@@ -858,10 +858,10 @@ let xr = class {
|
|
|
858
858
|
}
|
|
859
859
|
async loginWithRedirect(e = {}) {
|
|
860
860
|
var n;
|
|
861
|
-
const r =
|
|
862
|
-
this.transactionManager.create(Object.assign(Object.assign(Object.assign({}, c), { appState: a }),
|
|
863
|
-
const
|
|
864
|
-
i ? await i(
|
|
861
|
+
const r = Ht(e), { openUrl: i, fragment: o, appState: a } = r, s = Q(r, ["openUrl", "fragment", "appState"]), m = ((n = s.authorizationParams) === null || n === void 0 ? void 0 : n.organization) || this.options.authorizationParams.organization, p = await this._prepareAuthorizeUrl(s.authorizationParams || {}), { url: u } = p, c = Q(p, ["url"]);
|
|
862
|
+
this.transactionManager.create(Object.assign(Object.assign(Object.assign({}, c), { appState: a }), m && { organization: m }));
|
|
863
|
+
const h = o ? `${u}#${o}` : u;
|
|
864
|
+
i ? await i(h) : window.location.assign(h);
|
|
865
865
|
}
|
|
866
866
|
async handleRedirectCallback(e = window.location.href) {
|
|
867
867
|
const n = e.split("?").slice(1);
|
|
@@ -869,17 +869,17 @@ let xr = class {
|
|
|
869
869
|
throw new Error("There are no query params available for parsing.");
|
|
870
870
|
const { state: r, code: i, error: o, error_description: a } = ((c) => {
|
|
871
871
|
c.indexOf("#") > -1 && (c = c.substring(0, c.indexOf("#")));
|
|
872
|
-
const
|
|
873
|
-
return { state:
|
|
872
|
+
const h = new URLSearchParams(c);
|
|
873
|
+
return { state: h.get("state"), code: h.get("code") || void 0, error: h.get("error") || void 0, error_description: h.get("error_description") || void 0 };
|
|
874
874
|
})(n.join("")), s = this.transactionManager.get();
|
|
875
875
|
if (!s)
|
|
876
|
-
throw new
|
|
876
|
+
throw new V("missing_transaction", "Invalid state");
|
|
877
877
|
if (this.transactionManager.remove(), o)
|
|
878
|
-
throw new
|
|
878
|
+
throw new br(o, a || o, r, s.appState);
|
|
879
879
|
if (!s.code_verifier || s.state && s.state !== r)
|
|
880
|
-
throw new
|
|
881
|
-
const
|
|
882
|
-
return await this._requestToken(Object.assign({ audience: s.audience, scope: s.scope, code_verifier: s.code_verifier, grant_type: "authorization_code", code: i }, u ? { redirect_uri: u } : {}), { nonceIn:
|
|
880
|
+
throw new V("state_mismatch", "Invalid state");
|
|
881
|
+
const m = s.organization, p = s.nonce, u = s.redirect_uri;
|
|
882
|
+
return await this._requestToken(Object.assign({ audience: s.audience, scope: s.scope, code_verifier: s.code_verifier, grant_type: "authorization_code", code: i }, u ? { redirect_uri: u } : {}), { nonceIn: p, organization: m }), { appState: s.appState };
|
|
883
883
|
}
|
|
884
884
|
async checkSession(e) {
|
|
885
885
|
if (!this.cookieStorage.get(this.isAuthenticatedCookieName)) {
|
|
@@ -894,11 +894,11 @@ let xr = class {
|
|
|
894
894
|
}
|
|
895
895
|
async getTokenSilently(e = {}) {
|
|
896
896
|
var n;
|
|
897
|
-
const r = Object.assign(Object.assign({ cacheMode: "on" }, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope:
|
|
898
|
-
let s =
|
|
897
|
+
const r = Object.assign(Object.assign({ cacheMode: "on" }, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Xe(this.scope, (n = e.authorizationParams) === null || n === void 0 ? void 0 : n.scope) }) }), i = await ((o, a) => {
|
|
898
|
+
let s = ft[a];
|
|
899
899
|
return s || (s = o().finally(() => {
|
|
900
|
-
delete
|
|
901
|
-
}),
|
|
900
|
+
delete ft[a], s = null;
|
|
901
|
+
}), ft[a] = s), s;
|
|
902
902
|
})(() => this._getTokenSilently(r), `${this.options.clientId}::${r.authorizationParams.audience}::${r.authorizationParams.scope}`);
|
|
903
903
|
return e.detailedResponse ? i : i == null ? void 0 : i.access_token;
|
|
904
904
|
}
|
|
@@ -915,25 +915,25 @@ let xr = class {
|
|
|
915
915
|
if (await i())
|
|
916
916
|
return !0;
|
|
917
917
|
return !1;
|
|
918
|
-
})(() =>
|
|
919
|
-
throw new
|
|
918
|
+
})(() => pt.acquireLock("auth0.lock.getTokenSilently", 5e3), 10))
|
|
919
|
+
throw new It();
|
|
920
920
|
try {
|
|
921
921
|
if (window.addEventListener("pagehide", this._releaseLockOnPageHide), n !== "off") {
|
|
922
|
-
const
|
|
923
|
-
if (
|
|
924
|
-
return
|
|
922
|
+
const p = await this._getEntryFromCache({ scope: r.authorizationParams.scope, audience: r.authorizationParams.audience || "default", clientId: this.options.clientId });
|
|
923
|
+
if (p)
|
|
924
|
+
return p;
|
|
925
925
|
}
|
|
926
|
-
const i = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(r) : await this._getTokenFromIFrame(r), { id_token: o, access_token: a, oauthTokenScope: s, expires_in:
|
|
927
|
-
return Object.assign(Object.assign({ id_token: o, access_token: a }, s ? { scope: s } : null), { expires_in:
|
|
926
|
+
const i = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(r) : await this._getTokenFromIFrame(r), { id_token: o, access_token: a, oauthTokenScope: s, expires_in: m } = i;
|
|
927
|
+
return Object.assign(Object.assign({ id_token: o, access_token: a }, s ? { scope: s } : null), { expires_in: m });
|
|
928
928
|
} finally {
|
|
929
|
-
await
|
|
929
|
+
await pt.releaseLock("auth0.lock.getTokenSilently"), window.removeEventListener("pagehide", this._releaseLockOnPageHide);
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
async getTokenWithPopup(e = {}, n = {}) {
|
|
934
934
|
var r;
|
|
935
|
-
const i = Object.assign(Object.assign({}, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope:
|
|
936
|
-
return n = Object.assign(Object.assign({},
|
|
935
|
+
const i = Object.assign(Object.assign({}, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Xe(this.scope, (r = e.authorizationParams) === null || r === void 0 ? void 0 : r.scope) }) });
|
|
936
|
+
return n = Object.assign(Object.assign({}, wr), n), await this.loginWithPopup(i, n), (await this.cacheManager.get(new de({ scope: i.authorizationParams.scope, audience: i.authorizationParams.audience || "default", clientId: this.options.clientId }))).access_token;
|
|
937
937
|
}
|
|
938
938
|
async isAuthenticated() {
|
|
939
939
|
return !!await this.getUser();
|
|
@@ -941,10 +941,10 @@ let xr = class {
|
|
|
941
941
|
_buildLogoutUrl(e) {
|
|
942
942
|
e.clientId !== null ? e.clientId = e.clientId || this.options.clientId : delete e.clientId;
|
|
943
943
|
const n = e.logoutParams || {}, { federated: r } = n, i = Q(n, ["federated"]), o = r ? "&federated" : "";
|
|
944
|
-
return this._url(`/v2/logout?${
|
|
944
|
+
return this._url(`/v2/logout?${_t(Object.assign({ clientId: e.clientId }, i))}`) + o;
|
|
945
945
|
}
|
|
946
946
|
async logout(e = {}) {
|
|
947
|
-
const n =
|
|
947
|
+
const n = Ht(e), { openUrl: r } = n, i = Q(n, ["openUrl"]);
|
|
948
948
|
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@@");
|
|
949
949
|
const o = this._buildLogoutUrl(i);
|
|
950
950
|
r ? await r(o) : r !== !1 && window.location.assign(o);
|
|
@@ -952,41 +952,41 @@ let xr = class {
|
|
|
952
952
|
async _getTokenFromIFrame(e) {
|
|
953
953
|
const n = Object.assign(Object.assign({}, e.authorizationParams), { prompt: "none" }), r = this.cookieStorage.get(this.orgHintCookieName);
|
|
954
954
|
r && !n.organization && (n.organization = r);
|
|
955
|
-
const { url: i, state: o, nonce: a, code_verifier: s, redirect_uri:
|
|
955
|
+
const { url: i, state: o, nonce: a, code_verifier: s, redirect_uri: m, scope: p, audience: u } = await this._prepareAuthorizeUrl(n, { response_mode: "web_message" }, window.location.origin);
|
|
956
956
|
try {
|
|
957
957
|
if (window.crossOriginIsolated)
|
|
958
|
-
throw new
|
|
959
|
-
const c = e.timeoutInSeconds || this.options.authorizeTimeoutInSeconds,
|
|
960
|
-
const
|
|
961
|
-
|
|
962
|
-
const
|
|
963
|
-
window.document.body.contains(
|
|
958
|
+
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.");
|
|
959
|
+
const c = e.timeoutInSeconds || this.options.authorizeTimeoutInSeconds, h = await ((w, k, v = 60) => new Promise((I, _) => {
|
|
960
|
+
const y = window.document.createElement("iframe");
|
|
961
|
+
y.setAttribute("width", "0"), y.setAttribute("height", "0"), y.style.display = "none";
|
|
962
|
+
const l = () => {
|
|
963
|
+
window.document.body.contains(y) && (window.document.body.removeChild(y), window.removeEventListener("message", b, !1));
|
|
964
964
|
};
|
|
965
965
|
let b;
|
|
966
|
-
const
|
|
967
|
-
_(new
|
|
968
|
-
}, 1e3 *
|
|
969
|
-
b = function(
|
|
970
|
-
if (
|
|
966
|
+
const T = setTimeout(() => {
|
|
967
|
+
_(new It()), l();
|
|
968
|
+
}, 1e3 * v);
|
|
969
|
+
b = function(P) {
|
|
970
|
+
if (P.origin != k || !P.data || P.data.type !== "authorization_response")
|
|
971
971
|
return;
|
|
972
|
-
const x =
|
|
973
|
-
x && x.close(),
|
|
974
|
-
}, window.addEventListener("message", b, !1), window.document.body.appendChild(
|
|
972
|
+
const x = P.source;
|
|
973
|
+
x && x.close(), P.data.response.error ? _(V.fromPayload(P.data.response)) : I(P.data.response), clearTimeout(T), window.removeEventListener("message", b, !1), setTimeout(l, 2e3);
|
|
974
|
+
}, window.addEventListener("message", b, !1), window.document.body.appendChild(y), y.setAttribute("src", w);
|
|
975
975
|
}))(i, this.domainUrl, c);
|
|
976
|
-
if (o !==
|
|
977
|
-
throw new
|
|
978
|
-
const
|
|
979
|
-
return Object.assign(Object.assign({},
|
|
976
|
+
if (o !== h.state)
|
|
977
|
+
throw new V("state_mismatch", "Invalid state");
|
|
978
|
+
const d = await this._requestToken(Object.assign(Object.assign({}, e.authorizationParams), { code_verifier: s, code: h.code, grant_type: "authorization_code", redirect_uri: m, timeout: e.authorizationParams.timeout || this.httpTimeoutMs }), { nonceIn: a, organization: n.organization });
|
|
979
|
+
return Object.assign(Object.assign({}, d), { scope: p, oauthTokenScope: d.scope, audience: u });
|
|
980
980
|
} catch (c) {
|
|
981
981
|
throw c.error === "login_required" && this.logout({ openUrl: !1 }), c;
|
|
982
982
|
}
|
|
983
983
|
}
|
|
984
984
|
async _getTokenUsingRefreshToken(e) {
|
|
985
|
-
const n = await this.cacheManager.get(new
|
|
985
|
+
const n = await this.cacheManager.get(new de({ scope: e.authorizationParams.scope, audience: e.authorizationParams.audience || "default", clientId: this.options.clientId }));
|
|
986
986
|
if (!(n && n.refresh_token || this.worker)) {
|
|
987
987
|
if (this.options.useRefreshTokensFallback)
|
|
988
988
|
return await this._getTokenFromIFrame(e);
|
|
989
|
-
throw new
|
|
989
|
+
throw new Cn(e.authorizationParams.audience || "default", e.authorizationParams.scope);
|
|
990
990
|
}
|
|
991
991
|
const r = e.authorizationParams.redirect_uri || this.options.authorizationParams.redirect_uri || window.location.origin, i = typeof e.timeoutInSeconds == "number" ? 1e3 * e.timeoutInSeconds : null;
|
|
992
992
|
try {
|
|
@@ -1003,196 +1003,564 @@ let xr = class {
|
|
|
1003
1003
|
this.userCache.set("@@user@@", { id_token: n, decodedToken: r }), await this.cacheManager.setIdToken(this.options.clientId, e.id_token, e.decodedToken), await this.cacheManager.set(i);
|
|
1004
1004
|
}
|
|
1005
1005
|
async _getIdTokenFromCache() {
|
|
1006
|
-
const e = this.options.authorizationParams.audience || "default", n = await this.cacheManager.getIdToken(new
|
|
1006
|
+
const e = this.options.authorizationParams.audience || "default", n = await this.cacheManager.getIdToken(new de({ clientId: this.options.clientId, audience: e, scope: this.scope })), r = this.userCache.get("@@user@@");
|
|
1007
1007
|
return n && n.id_token === (r == null ? void 0 : r.id_token) ? r : (this.userCache.set("@@user@@", n), n);
|
|
1008
1008
|
}
|
|
1009
1009
|
async _getEntryFromCache({ scope: e, audience: n, clientId: r }) {
|
|
1010
|
-
const i = await this.cacheManager.get(new
|
|
1010
|
+
const i = await this.cacheManager.get(new de({ scope: e, audience: n, clientId: r }), 60);
|
|
1011
1011
|
if (i && i.access_token) {
|
|
1012
|
-
const { access_token: o, oauthTokenScope: a, expires_in: s } = i,
|
|
1013
|
-
return
|
|
1012
|
+
const { access_token: o, oauthTokenScope: a, expires_in: s } = i, m = await this._getIdTokenFromCache();
|
|
1013
|
+
return m && Object.assign(Object.assign({ id_token: m.id_token, access_token: o }, a ? { scope: a } : null), { expires_in: s });
|
|
1014
1014
|
}
|
|
1015
1015
|
}
|
|
1016
1016
|
async _requestToken(e, n) {
|
|
1017
|
-
const { nonceIn: r, organization: i } = n || {}, o = await
|
|
1017
|
+
const { nonceIn: r, organization: i } = n || {}, o = await Tr(Object.assign({ baseUrl: this.domainUrl, client_id: this.options.clientId, auth0Client: this.options.auth0Client, useFormData: this.options.useFormData, timeout: this.httpTimeoutMs }, e), this.worker), a = await this._verifyIdToken(o.id_token, r, i);
|
|
1018
1018
|
return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({}, o), { decodedToken: a, scope: e.scope, audience: e.audience || "default" }), o.scope ? { oauthTokenScope: o.scope } : null), { client_id: this.options.clientId })), this.cookieStorage.save(this.isAuthenticatedCookieName, !0, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }), this._processOrgHint(i || a.claims.org_id), Object.assign(Object.assign({}, o), { decodedToken: a });
|
|
1019
1019
|
}
|
|
1020
1020
|
};
|
|
1021
|
-
async function
|
|
1022
|
-
const e = new
|
|
1021
|
+
async function Kr(t) {
|
|
1022
|
+
const e = new Zr(t);
|
|
1023
1023
|
return await e.checkSession(), e;
|
|
1024
1024
|
}
|
|
1025
|
-
const
|
|
1026
|
-
var
|
|
1027
|
-
let
|
|
1028
|
-
async function
|
|
1029
|
-
if (
|
|
1030
|
-
domain: `token.${
|
|
1025
|
+
const xt = "sesamy.com", Mr = "https://logs.sesamy.com/events";
|
|
1026
|
+
var oe = /* @__PURE__ */ ((t) => (t.READY = "sesamyReady", t.AUTHENTICATED = "sesamyAuthenticated", t.LOGOUT = "sesamyLogout", t.SOFT_PAYWALL = "sesamySoftPaywall", t))(oe || {});
|
|
1027
|
+
let F;
|
|
1028
|
+
async function Xr({ clientId: t }) {
|
|
1029
|
+
if (F = await Kr({
|
|
1030
|
+
domain: `token.${xt}`,
|
|
1031
1031
|
clientId: t,
|
|
1032
1032
|
cacheLocation: "localstorage"
|
|
1033
1033
|
}), window.location.search.includes("code="))
|
|
1034
1034
|
try {
|
|
1035
|
-
await
|
|
1036
|
-
const e = await
|
|
1037
|
-
|
|
1035
|
+
await F.handleRedirectCallback();
|
|
1036
|
+
const e = await F.getUser();
|
|
1037
|
+
it(oe.AUTHENTICATED, e), window.history.replaceState({}, document.title, "/");
|
|
1038
|
+
const n = await F.getTokenSilently();
|
|
1039
|
+
localStorage.setItem("accessToken", n);
|
|
1038
1040
|
} catch {
|
|
1039
1041
|
}
|
|
1040
1042
|
}
|
|
1041
|
-
async function
|
|
1042
|
-
if (!
|
|
1043
|
+
async function Fr() {
|
|
1044
|
+
if (!F)
|
|
1043
1045
|
throw new Error("Auth0 client not initialized");
|
|
1044
|
-
return
|
|
1046
|
+
return F.isAuthenticated();
|
|
1045
1047
|
}
|
|
1046
|
-
async function
|
|
1047
|
-
if (!
|
|
1048
|
+
async function Hr() {
|
|
1049
|
+
if (!F)
|
|
1048
1050
|
throw new Error("Auth0 client not initialized");
|
|
1049
|
-
return
|
|
1051
|
+
return F.getUser();
|
|
1050
1052
|
}
|
|
1051
|
-
function
|
|
1052
|
-
if (!
|
|
1053
|
+
function Jr() {
|
|
1054
|
+
if (!F)
|
|
1053
1055
|
throw new Error("Auth0 client not initialized");
|
|
1054
|
-
return
|
|
1056
|
+
return F.loginWithRedirect({
|
|
1055
1057
|
authorizationParams: {
|
|
1056
1058
|
redirect_uri: window.location.href
|
|
1057
1059
|
}
|
|
1058
1060
|
});
|
|
1059
1061
|
}
|
|
1060
|
-
async function
|
|
1061
|
-
if (!
|
|
1062
|
+
async function Vr() {
|
|
1063
|
+
if (!F)
|
|
1064
|
+
throw new Error("Auth0 client not initialized");
|
|
1065
|
+
return F.getTokenSilently();
|
|
1066
|
+
}
|
|
1067
|
+
async function Yr() {
|
|
1068
|
+
if (!F)
|
|
1062
1069
|
throw new Error("Auth0 client not initialized");
|
|
1063
|
-
return
|
|
1070
|
+
return it(oe.LOGOUT, {}), F.logout({
|
|
1064
1071
|
logoutParams: {
|
|
1065
1072
|
returnTo: window.location.href
|
|
1066
1073
|
}
|
|
1067
1074
|
});
|
|
1068
1075
|
}
|
|
1069
|
-
|
|
1076
|
+
const Gr = (t, e) => e.skipDedupe || e.method !== "GET", Br = (t, e) => e.method + "@" + t, qr = (t) => t.clone(), Ln = ({ skip: t = Gr, key: e = Br, resolver: n = qr } = {}) => {
|
|
1077
|
+
const r = /* @__PURE__ */ new Map();
|
|
1078
|
+
return (i) => (o, a) => {
|
|
1079
|
+
if (t(o, a))
|
|
1080
|
+
return i(o, a);
|
|
1081
|
+
const s = e(o, a);
|
|
1082
|
+
if (!r.has(s))
|
|
1083
|
+
r.set(s, []);
|
|
1084
|
+
else
|
|
1085
|
+
return new Promise((m, p) => {
|
|
1086
|
+
r.get(s).push([m, p]);
|
|
1087
|
+
});
|
|
1088
|
+
try {
|
|
1089
|
+
return i(o, a).then((m) => (r.get(s).forEach(([p]) => p(n(m))), r.delete(s), m)).catch((m) => {
|
|
1090
|
+
throw r.get(s).forEach(([p, u]) => u(m)), r.delete(s), m;
|
|
1091
|
+
});
|
|
1092
|
+
} catch (m) {
|
|
1093
|
+
return r.delete(s), Promise.reject(m);
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
}, Qr = (t, e) => t * e, ei = (t) => t && t.ok, Dn = ({ delayTimer: t = 500, delayRamp: e = Qr, maxAttempts: n = 10, until: r = ei, onRetry: i = null, retryOnNetworkError: o = !1, resolveWithLatestResponse: a = !1, skip: s } = {}) => (m) => (p, u) => {
|
|
1097
|
+
let c = 0;
|
|
1098
|
+
if (s && s(p, u))
|
|
1099
|
+
return m(p, u);
|
|
1100
|
+
const h = (d, w) => Promise.resolve(r(d, w)).then((k) => k ? d && a ? d : w ? Promise.reject(w) : d : (c++, !n || c <= n ? new Promise((v) => {
|
|
1101
|
+
const I = e(t, c);
|
|
1102
|
+
setTimeout(() => {
|
|
1103
|
+
typeof i == "function" ? Promise.resolve(i({
|
|
1104
|
+
response: d,
|
|
1105
|
+
error: w,
|
|
1106
|
+
url: p,
|
|
1107
|
+
options: u
|
|
1108
|
+
})).then((_ = {}) => {
|
|
1109
|
+
var y, l;
|
|
1110
|
+
v(m((y = _ && _.url) !== null && y !== void 0 ? y : p, (l = _ && _.options) !== null && l !== void 0 ? l : u));
|
|
1111
|
+
}) : v(m(p, u));
|
|
1112
|
+
}, I);
|
|
1113
|
+
}).then(h).catch((v) => {
|
|
1114
|
+
if (!o)
|
|
1115
|
+
throw v;
|
|
1116
|
+
return h(null, v);
|
|
1117
|
+
}) : d && a ? d : Promise.reject(w || new Error("Number of attempts exceeded."))));
|
|
1118
|
+
return m(p, u).then(h).catch((d) => {
|
|
1119
|
+
if (!o)
|
|
1120
|
+
throw d;
|
|
1121
|
+
return h(null, d);
|
|
1122
|
+
});
|
|
1123
|
+
}, ti = "application/json", Un = "Content-Type", ve = Symbol(), Rn = Symbol();
|
|
1124
|
+
function Jt(t = {}) {
|
|
1125
|
+
var e;
|
|
1126
|
+
return (e = Object.entries(t).find(([n]) => n.toLowerCase() === Un.toLowerCase())) === null || e === void 0 ? void 0 : e[1];
|
|
1127
|
+
}
|
|
1128
|
+
function Vt(t) {
|
|
1129
|
+
return /^application\/.*json.*/.test(t);
|
|
1130
|
+
}
|
|
1131
|
+
const fe = function(t, e, n = !1) {
|
|
1132
|
+
return Object.entries(e).reduce((r, [i, o]) => {
|
|
1133
|
+
const a = t[i];
|
|
1134
|
+
return Array.isArray(a) && Array.isArray(o) ? r[i] = n ? [...a, ...o] : o : typeof a == "object" && typeof o == "object" ? r[i] = fe(a, o, n) : r[i] = o, r;
|
|
1135
|
+
}, { ...t });
|
|
1136
|
+
}, Ee = {
|
|
1137
|
+
// Default options
|
|
1138
|
+
options: {},
|
|
1139
|
+
// Error type
|
|
1140
|
+
errorType: "text",
|
|
1141
|
+
// Polyfills
|
|
1142
|
+
polyfills: {
|
|
1143
|
+
// fetch: null,
|
|
1144
|
+
// FormData: null,
|
|
1145
|
+
// URLSearchParams: null,
|
|
1146
|
+
// performance: null,
|
|
1147
|
+
// PerformanceObserver: null,
|
|
1148
|
+
// AbortController: null
|
|
1149
|
+
},
|
|
1150
|
+
polyfill(t, e = !0, n = !1, ...r) {
|
|
1151
|
+
const i = this.polyfills[t] || (typeof self < "u" ? self[t] : null) || (typeof global < "u" ? global[t] : null);
|
|
1152
|
+
if (e && !i)
|
|
1153
|
+
throw new Error(t + " is not defined");
|
|
1154
|
+
return n && i ? new i(...r) : i;
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
function ni(t, e = !1) {
|
|
1158
|
+
Ee.options = e ? t : fe(Ee.options, t);
|
|
1159
|
+
}
|
|
1160
|
+
function ri(t, e = !1) {
|
|
1161
|
+
Ee.polyfills = e ? t : fe(Ee.polyfills, t);
|
|
1162
|
+
}
|
|
1163
|
+
function ii(t) {
|
|
1164
|
+
Ee.errorType = t;
|
|
1165
|
+
}
|
|
1166
|
+
const oi = (t) => (e) => t.reduceRight((n, r) => r(n), e) || e;
|
|
1167
|
+
class Wn extends Error {
|
|
1168
|
+
}
|
|
1169
|
+
const ai = (t) => {
|
|
1170
|
+
const e = /* @__PURE__ */ Object.create(null);
|
|
1171
|
+
t = t._addons.reduce((y, l) => l.beforeRequest && l.beforeRequest(y, t._options, e) || y, t);
|
|
1172
|
+
const { _url: n, _options: r, _config: i, _catchers: o, _resolvers: a, _middlewares: s, _addons: m } = t, p = new Map(o), u = fe(i.options, r);
|
|
1173
|
+
let c = n;
|
|
1174
|
+
const h = oi(s)((y, l) => (c = y, i.polyfill("fetch")(y, l)))(n, u), d = new Error(), w = h.catch((y) => {
|
|
1175
|
+
throw { [ve]: y };
|
|
1176
|
+
}).then((y) => {
|
|
1177
|
+
if (!y.ok) {
|
|
1178
|
+
const l = new Wn();
|
|
1179
|
+
if (l.cause = d, l.stack = l.stack + `
|
|
1180
|
+
CAUSE: ` + d.stack, l.response = y, l.url = c, y.type === "opaque")
|
|
1181
|
+
throw l;
|
|
1182
|
+
return y.text().then((b) => {
|
|
1183
|
+
var T;
|
|
1184
|
+
if (l.message = b, i.errorType === "json" || ((T = y.headers.get("Content-Type")) === null || T === void 0 ? void 0 : T.split(";")[0]) === "application/json")
|
|
1185
|
+
try {
|
|
1186
|
+
l.json = JSON.parse(b);
|
|
1187
|
+
} catch {
|
|
1188
|
+
}
|
|
1189
|
+
throw l.text = b, l.status = y.status, l;
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
return y;
|
|
1193
|
+
}), k = (y) => y.catch((l) => {
|
|
1194
|
+
const b = l.hasOwnProperty(ve), T = b ? l[ve] : l, P = (T == null ? void 0 : T.status) && p.get(T.status) || p.get(T == null ? void 0 : T.name) || b && p.has(ve) && p.get(ve);
|
|
1195
|
+
if (P)
|
|
1196
|
+
return P(T, t);
|
|
1197
|
+
const x = p.get(Rn);
|
|
1198
|
+
if (x)
|
|
1199
|
+
return x(T, t);
|
|
1200
|
+
throw T;
|
|
1201
|
+
}), v = (y) => (l) => /* If a callback is provided, then callback with the body result otherwise return the parsed body itself. */ k(y ? w.then((b) => b && b[y]()).then((b) => l ? l(b) : b) : w.then((b) => l ? l(b) : b)), I = {
|
|
1202
|
+
_wretchReq: t,
|
|
1203
|
+
_fetchReq: h,
|
|
1204
|
+
_sharedState: e,
|
|
1205
|
+
res: v(null),
|
|
1206
|
+
json: v("json"),
|
|
1207
|
+
blob: v("blob"),
|
|
1208
|
+
formData: v("formData"),
|
|
1209
|
+
arrayBuffer: v("arrayBuffer"),
|
|
1210
|
+
text: v("text"),
|
|
1211
|
+
error(y, l) {
|
|
1212
|
+
return p.set(y, l), this;
|
|
1213
|
+
},
|
|
1214
|
+
badRequest(y) {
|
|
1215
|
+
return this.error(400, y);
|
|
1216
|
+
},
|
|
1217
|
+
unauthorized(y) {
|
|
1218
|
+
return this.error(401, y);
|
|
1219
|
+
},
|
|
1220
|
+
forbidden(y) {
|
|
1221
|
+
return this.error(403, y);
|
|
1222
|
+
},
|
|
1223
|
+
notFound(y) {
|
|
1224
|
+
return this.error(404, y);
|
|
1225
|
+
},
|
|
1226
|
+
timeout(y) {
|
|
1227
|
+
return this.error(408, y);
|
|
1228
|
+
},
|
|
1229
|
+
internalError(y) {
|
|
1230
|
+
return this.error(500, y);
|
|
1231
|
+
},
|
|
1232
|
+
fetchError(y) {
|
|
1233
|
+
return this.error(ve, y);
|
|
1234
|
+
}
|
|
1235
|
+
}, _ = m.reduce((y, l) => ({
|
|
1236
|
+
...y,
|
|
1237
|
+
...typeof l.resolver == "function" ? l.resolver(y) : l.resolver
|
|
1238
|
+
}), I);
|
|
1239
|
+
return a.reduce((y, l) => l(y, t), _);
|
|
1240
|
+
}, si = {
|
|
1241
|
+
_url: "",
|
|
1242
|
+
_options: {},
|
|
1243
|
+
_config: Ee,
|
|
1244
|
+
_catchers: /* @__PURE__ */ new Map(),
|
|
1245
|
+
_resolvers: [],
|
|
1246
|
+
_deferred: [],
|
|
1247
|
+
_middlewares: [],
|
|
1248
|
+
_addons: [],
|
|
1249
|
+
addon(t) {
|
|
1250
|
+
return { ...this, _addons: [...this._addons, t], ...t.wretch };
|
|
1251
|
+
},
|
|
1252
|
+
errorType(t) {
|
|
1253
|
+
return {
|
|
1254
|
+
...this,
|
|
1255
|
+
_config: {
|
|
1256
|
+
...this._config,
|
|
1257
|
+
errorType: t
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
},
|
|
1261
|
+
polyfills(t, e = !1) {
|
|
1262
|
+
return {
|
|
1263
|
+
...this,
|
|
1264
|
+
_config: {
|
|
1265
|
+
...this._config,
|
|
1266
|
+
polyfills: e ? t : fe(this._config.polyfills, t)
|
|
1267
|
+
}
|
|
1268
|
+
};
|
|
1269
|
+
},
|
|
1270
|
+
url(t, e = !1) {
|
|
1271
|
+
if (e)
|
|
1272
|
+
return { ...this, _url: t };
|
|
1273
|
+
const n = this._url.split("?");
|
|
1274
|
+
return {
|
|
1275
|
+
...this,
|
|
1276
|
+
_url: n.length > 1 ? n[0] + t + "?" + n[1] : this._url + t
|
|
1277
|
+
};
|
|
1278
|
+
},
|
|
1279
|
+
options(t, e = !1) {
|
|
1280
|
+
return { ...this, _options: e ? t : fe(this._options, t) };
|
|
1281
|
+
},
|
|
1282
|
+
headers(t) {
|
|
1283
|
+
const e = t ? Array.isArray(t) ? Object.fromEntries(t) : "entries" in t ? Object.fromEntries(t.entries()) : t : {};
|
|
1284
|
+
return { ...this, _options: fe(this._options, { headers: e }) };
|
|
1285
|
+
},
|
|
1286
|
+
accept(t) {
|
|
1287
|
+
return this.headers({ Accept: t });
|
|
1288
|
+
},
|
|
1289
|
+
content(t) {
|
|
1290
|
+
return this.headers({ [Un]: t });
|
|
1291
|
+
},
|
|
1292
|
+
auth(t) {
|
|
1293
|
+
return this.headers({ Authorization: t });
|
|
1294
|
+
},
|
|
1295
|
+
catcher(t, e) {
|
|
1296
|
+
const n = new Map(this._catchers);
|
|
1297
|
+
return n.set(t, e), { ...this, _catchers: n };
|
|
1298
|
+
},
|
|
1299
|
+
catcherFallback(t) {
|
|
1300
|
+
return this.catcher(Rn, t);
|
|
1301
|
+
},
|
|
1302
|
+
resolve(t, e = !1) {
|
|
1303
|
+
return { ...this, _resolvers: e ? [t] : [...this._resolvers, t] };
|
|
1304
|
+
},
|
|
1305
|
+
defer(t, e = !1) {
|
|
1306
|
+
return {
|
|
1307
|
+
...this,
|
|
1308
|
+
_deferred: e ? [t] : [...this._deferred, t]
|
|
1309
|
+
};
|
|
1310
|
+
},
|
|
1311
|
+
middlewares(t, e = !1) {
|
|
1312
|
+
return {
|
|
1313
|
+
...this,
|
|
1314
|
+
_middlewares: e ? t : [...this._middlewares, ...t]
|
|
1315
|
+
};
|
|
1316
|
+
},
|
|
1317
|
+
fetch(t = this._options.method, e = "", n = null) {
|
|
1318
|
+
let r = this.url(e).options({ method: t });
|
|
1319
|
+
const i = Jt(r._options.headers), o = typeof n == "object" && (!r._options.headers || !i || Vt(i));
|
|
1320
|
+
return r = n ? o ? r.json(n, i) : r.body(n) : r, ai(r._deferred.reduce((a, s) => s(a, a._url, a._options), r));
|
|
1321
|
+
},
|
|
1322
|
+
get(t = "") {
|
|
1323
|
+
return this.fetch("GET", t);
|
|
1324
|
+
},
|
|
1325
|
+
delete(t = "") {
|
|
1326
|
+
return this.fetch("DELETE", t);
|
|
1327
|
+
},
|
|
1328
|
+
put(t, e = "") {
|
|
1329
|
+
return this.fetch("PUT", e, t);
|
|
1330
|
+
},
|
|
1331
|
+
post(t, e = "") {
|
|
1332
|
+
return this.fetch("POST", e, t);
|
|
1333
|
+
},
|
|
1334
|
+
patch(t, e = "") {
|
|
1335
|
+
return this.fetch("PATCH", e, t);
|
|
1336
|
+
},
|
|
1337
|
+
head(t = "") {
|
|
1338
|
+
return this.fetch("HEAD", t);
|
|
1339
|
+
},
|
|
1340
|
+
opts(t = "") {
|
|
1341
|
+
return this.fetch("OPTIONS", t);
|
|
1342
|
+
},
|
|
1343
|
+
body(t) {
|
|
1344
|
+
return { ...this, _options: { ...this._options, body: t } };
|
|
1345
|
+
},
|
|
1346
|
+
json(t, e) {
|
|
1347
|
+
const n = Jt(this._options.headers);
|
|
1348
|
+
return this.content(e || Vt(n) && n || ti).body(JSON.stringify(t));
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
function ae(t = "", e = {}) {
|
|
1352
|
+
return { ...si, _url: t, _options: e };
|
|
1353
|
+
}
|
|
1354
|
+
ae.default = ae;
|
|
1355
|
+
ae.options = ni;
|
|
1356
|
+
ae.errorType = ii;
|
|
1357
|
+
ae.polyfills = ri;
|
|
1358
|
+
ae.WretchError = Wn;
|
|
1359
|
+
const ci = (t) => (e, n) => new Promise(async (r, i) => {
|
|
1360
|
+
try {
|
|
1361
|
+
const o = await Vr(), a = {
|
|
1362
|
+
...n,
|
|
1363
|
+
headers: {
|
|
1364
|
+
...n.headers,
|
|
1365
|
+
Authorization: `Bearer ${o}`
|
|
1366
|
+
}
|
|
1367
|
+
};
|
|
1368
|
+
r(t(e, a));
|
|
1369
|
+
} catch (o) {
|
|
1370
|
+
console.error("Error fetching access token:", o), i(o);
|
|
1371
|
+
}
|
|
1372
|
+
}), je = ae(`https://api2.${xt}`).headers({ "Content-Type": "application/json" }).middlewares([
|
|
1373
|
+
ci,
|
|
1374
|
+
Ln(),
|
|
1375
|
+
Dn({
|
|
1376
|
+
delayTimer: 1e3,
|
|
1377
|
+
delayRamp: (t, e) => t * e,
|
|
1378
|
+
maxAttempts: 3,
|
|
1379
|
+
until: (t) => (t == null ? void 0 : t.ok) || !1,
|
|
1380
|
+
retryOnNetworkError: !1
|
|
1381
|
+
})
|
|
1382
|
+
]), ui = ae(`https://api2.${xt}`).headers({ "Content-Type": "application/json" }).middlewares([
|
|
1383
|
+
Ln(),
|
|
1384
|
+
Dn({
|
|
1385
|
+
delayTimer: 1e3,
|
|
1386
|
+
delayRamp: (t, e) => t * e,
|
|
1387
|
+
maxAttempts: 3,
|
|
1388
|
+
until: (t) => (t == null ? void 0 : t.ok) || !1,
|
|
1389
|
+
retryOnNetworkError: !1
|
|
1390
|
+
})
|
|
1391
|
+
]);
|
|
1392
|
+
async function li() {
|
|
1393
|
+
return je.get("/entitlements").json();
|
|
1394
|
+
}
|
|
1395
|
+
async function di(t) {
|
|
1396
|
+
const e = await je.get("/entitlements").json();
|
|
1397
|
+
return e == null ? void 0 : e.find((n) => n.id === t);
|
|
1398
|
+
}
|
|
1399
|
+
async function hi() {
|
|
1400
|
+
return je.get("/contracts").json();
|
|
1401
|
+
}
|
|
1402
|
+
async function fi(t) {
|
|
1403
|
+
const e = await je.get("/contracts").json();
|
|
1404
|
+
return e == null ? void 0 : e.find((n) => n.id === t);
|
|
1405
|
+
}
|
|
1406
|
+
async function pi() {
|
|
1407
|
+
return je.get("/bills").json();
|
|
1408
|
+
}
|
|
1409
|
+
async function mi(t) {
|
|
1410
|
+
const e = await je.get("/bills").json();
|
|
1411
|
+
return e == null ? void 0 : e.find((n) => n.id === t);
|
|
1412
|
+
}
|
|
1413
|
+
async function gi(t) {
|
|
1414
|
+
const e = localStorage.getItem("__anon_id");
|
|
1415
|
+
if (!e)
|
|
1416
|
+
throw new Error("User id not found");
|
|
1417
|
+
return ui.url("/articles/access").post({
|
|
1418
|
+
articleId: t.articleId,
|
|
1419
|
+
userId: e
|
|
1420
|
+
}).json();
|
|
1421
|
+
}
|
|
1422
|
+
async function yi(t) {
|
|
1423
|
+
const e = await gi({ articleId: t });
|
|
1424
|
+
return e.status !== "ok" && it(oe.SOFT_PAYWALL, {}), e;
|
|
1425
|
+
}
|
|
1426
|
+
function vi(t = "sesamy") {
|
|
1070
1427
|
window[t] = {
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1428
|
+
auth: {
|
|
1429
|
+
getUser: Hr,
|
|
1430
|
+
isAuthenticated: Fr,
|
|
1431
|
+
loginWithRedirect: Jr,
|
|
1432
|
+
logout: Yr
|
|
1433
|
+
},
|
|
1434
|
+
articles: {
|
|
1435
|
+
access: yi
|
|
1436
|
+
},
|
|
1437
|
+
getEntitlement: di,
|
|
1438
|
+
getEntitlements: li,
|
|
1439
|
+
getContract: fi,
|
|
1440
|
+
getContracts: hi,
|
|
1441
|
+
getBill: mi,
|
|
1442
|
+
getBills: pi
|
|
1075
1443
|
};
|
|
1076
1444
|
}
|
|
1077
|
-
function
|
|
1445
|
+
function Yt(t, e, n, r, i) {
|
|
1078
1446
|
for (e = e.split ? e.split(".") : e, r = 0; r < e.length; r++)
|
|
1079
1447
|
t = t ? t[e[r]] : i;
|
|
1080
1448
|
return t === i ? n : t;
|
|
1081
1449
|
}
|
|
1082
|
-
var
|
|
1083
|
-
},
|
|
1084
|
-
|
|
1085
|
-
var
|
|
1086
|
-
|
|
1450
|
+
var Fe = "undefined", Gt = "object", wi = function() {
|
|
1451
|
+
}, Zn = "any", Kn = "*", me = "__", et = typeof process < "u" ? process : {};
|
|
1452
|
+
et.env && et.env.NODE_ENV;
|
|
1453
|
+
var Y = typeof document < "u";
|
|
1454
|
+
et.versions != null && et.versions.node != null;
|
|
1087
1455
|
typeof Deno < "u" && Deno.core;
|
|
1088
|
-
|
|
1089
|
-
function
|
|
1456
|
+
Y && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
1457
|
+
function Mn(t, e) {
|
|
1090
1458
|
return e.charAt(0)[t]() + e.slice(1);
|
|
1091
1459
|
}
|
|
1092
|
-
var
|
|
1093
|
-
function
|
|
1094
|
-
return
|
|
1460
|
+
var bi = Mn.bind(null, "toUpperCase"), ki = Mn.bind(null, "toLowerCase");
|
|
1461
|
+
function Ii(t) {
|
|
1462
|
+
return Xn(t) ? bi("null") : typeof t == "object" ? Oi(t) : Object.prototype.toString.call(t).slice(8, -1);
|
|
1095
1463
|
}
|
|
1096
|
-
function
|
|
1464
|
+
function tt(t, e) {
|
|
1097
1465
|
e === void 0 && (e = !0);
|
|
1098
|
-
var n =
|
|
1099
|
-
return e ?
|
|
1466
|
+
var n = Ii(t);
|
|
1467
|
+
return e ? ki(n) : n;
|
|
1100
1468
|
}
|
|
1101
|
-
function
|
|
1469
|
+
function Ke(t, e) {
|
|
1102
1470
|
return typeof e === t;
|
|
1103
1471
|
}
|
|
1104
|
-
var
|
|
1105
|
-
|
|
1106
|
-
function
|
|
1472
|
+
var B = Ke.bind(null, "function"), re = Ke.bind(null, "string"), be = Ke.bind(null, "undefined"), _i = Ke.bind(null, "boolean");
|
|
1473
|
+
Ke.bind(null, "symbol");
|
|
1474
|
+
function Xn(t) {
|
|
1107
1475
|
return t === null;
|
|
1108
1476
|
}
|
|
1109
|
-
function
|
|
1110
|
-
return
|
|
1477
|
+
function Si(t) {
|
|
1478
|
+
return tt(t) === "number" && !isNaN(t);
|
|
1111
1479
|
}
|
|
1112
|
-
function
|
|
1113
|
-
return
|
|
1480
|
+
function Fn(t) {
|
|
1481
|
+
return tt(t) === "array";
|
|
1114
1482
|
}
|
|
1115
|
-
function
|
|
1116
|
-
if (!
|
|
1483
|
+
function X(t) {
|
|
1484
|
+
if (!Ei(t))
|
|
1117
1485
|
return !1;
|
|
1118
1486
|
for (var e = t; Object.getPrototypeOf(e) !== null; )
|
|
1119
1487
|
e = Object.getPrototypeOf(e);
|
|
1120
1488
|
return Object.getPrototypeOf(t) === e;
|
|
1121
1489
|
}
|
|
1122
|
-
function
|
|
1490
|
+
function Ei(t) {
|
|
1123
1491
|
return t && (typeof t == "object" || t !== null);
|
|
1124
1492
|
}
|
|
1125
|
-
function
|
|
1126
|
-
return
|
|
1493
|
+
function Oi(t) {
|
|
1494
|
+
return B(t.constructor) ? t.constructor.name : null;
|
|
1127
1495
|
}
|
|
1128
|
-
function
|
|
1129
|
-
return t instanceof Error || re(t.message) && t.constructor &&
|
|
1496
|
+
function Pi(t) {
|
|
1497
|
+
return t instanceof Error || re(t.message) && t.constructor && Si(t.constructor.stackTraceLimit);
|
|
1130
1498
|
}
|
|
1131
|
-
function
|
|
1132
|
-
if (typeof e != "object" ||
|
|
1499
|
+
function Hn(t, e) {
|
|
1500
|
+
if (typeof e != "object" || Xn(e))
|
|
1133
1501
|
return !1;
|
|
1134
1502
|
if (e instanceof t)
|
|
1135
1503
|
return !0;
|
|
1136
|
-
var n =
|
|
1137
|
-
if (
|
|
1504
|
+
var n = tt(new t(""));
|
|
1505
|
+
if (Pi(e))
|
|
1138
1506
|
for (; e; ) {
|
|
1139
|
-
if (
|
|
1507
|
+
if (tt(e) === n)
|
|
1140
1508
|
return !0;
|
|
1141
1509
|
e = Object.getPrototypeOf(e);
|
|
1142
1510
|
}
|
|
1143
1511
|
return !1;
|
|
1144
1512
|
}
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
function
|
|
1513
|
+
Hn.bind(null, TypeError);
|
|
1514
|
+
Hn.bind(null, SyntaxError);
|
|
1515
|
+
function ot(t, e) {
|
|
1148
1516
|
var n = t instanceof Element || t instanceof HTMLDocument;
|
|
1149
|
-
return n && e ?
|
|
1517
|
+
return n && e ? Ti(t, e) : n;
|
|
1150
1518
|
}
|
|
1151
|
-
function
|
|
1519
|
+
function Ti(t, e) {
|
|
1152
1520
|
return e === void 0 && (e = ""), t && t.nodeName === e.toUpperCase();
|
|
1153
1521
|
}
|
|
1154
|
-
function
|
|
1522
|
+
function at(t) {
|
|
1155
1523
|
var e = [].slice.call(arguments, 1);
|
|
1156
1524
|
return function() {
|
|
1157
1525
|
return t.apply(void 0, [].slice.call(arguments).concat(e));
|
|
1158
1526
|
};
|
|
1159
1527
|
}
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
function
|
|
1165
|
-
return t ?
|
|
1528
|
+
at(ot, "form");
|
|
1529
|
+
at(ot, "button");
|
|
1530
|
+
at(ot, "input");
|
|
1531
|
+
at(ot, "select");
|
|
1532
|
+
function ji(t) {
|
|
1533
|
+
return t ? Fn(t) ? t : [t] : [];
|
|
1166
1534
|
}
|
|
1167
|
-
function
|
|
1535
|
+
function Bt(t) {
|
|
1168
1536
|
try {
|
|
1169
1537
|
return decodeURIComponent(t.replace(/\+/g, " "));
|
|
1170
1538
|
} catch {
|
|
1171
1539
|
return null;
|
|
1172
1540
|
}
|
|
1173
1541
|
}
|
|
1174
|
-
function
|
|
1175
|
-
if (
|
|
1542
|
+
function xi() {
|
|
1543
|
+
if (Y) {
|
|
1176
1544
|
var t = navigator, e = t.languages;
|
|
1177
1545
|
return t.userLanguage || (e && e.length ? e[0] : t.language);
|
|
1178
1546
|
}
|
|
1179
1547
|
}
|
|
1180
|
-
function
|
|
1548
|
+
function Ci() {
|
|
1181
1549
|
try {
|
|
1182
1550
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1183
1551
|
} catch {
|
|
1184
1552
|
}
|
|
1185
1553
|
}
|
|
1186
|
-
function
|
|
1554
|
+
function $i(t) {
|
|
1187
1555
|
return function(e) {
|
|
1188
1556
|
for (var n, r = /* @__PURE__ */ Object.create(null), i = /([^&=]+)=?([^&]*)/g; n = i.exec(e); ) {
|
|
1189
|
-
var o =
|
|
1557
|
+
var o = Bt(n[1]), a = Bt(n[2]);
|
|
1190
1558
|
o.substring(o.length - 2) === "[]" ? (r[o = o.substring(0, o.length - 2)] || (r[o] = [])).push(a) : r[o] = a === "" || a;
|
|
1191
1559
|
}
|
|
1192
1560
|
for (var s in r) {
|
|
1193
|
-
var
|
|
1194
|
-
|
|
1195
|
-
return
|
|
1561
|
+
var m = s.split("[");
|
|
1562
|
+
m.length > 1 && (Ai(r, m.map(function(p) {
|
|
1563
|
+
return p.replace(/[?[\]\\ ]/g, "");
|
|
1196
1564
|
}), r[s]), delete r[s]);
|
|
1197
1565
|
}
|
|
1198
1566
|
return r;
|
|
@@ -1201,10 +1569,10 @@ function Br(t) {
|
|
|
1201
1569
|
var n = e.match(/\?(.*)/);
|
|
1202
1570
|
return n && n[1] ? n[1].split("#")[0] : "";
|
|
1203
1571
|
}
|
|
1204
|
-
return
|
|
1572
|
+
return Y && window.location.search.substring(1);
|
|
1205
1573
|
}(t));
|
|
1206
1574
|
}
|
|
1207
|
-
function
|
|
1575
|
+
function Ai(t, e, n) {
|
|
1208
1576
|
for (var r = e.length - 1, i = 0; i < r; ++i) {
|
|
1209
1577
|
var o = e[i];
|
|
1210
1578
|
if (o === "__proto__" || o === "constructor")
|
|
@@ -1213,27 +1581,27 @@ function qr(t, e, n) {
|
|
|
1213
1581
|
}
|
|
1214
1582
|
t[e[r]] = n;
|
|
1215
1583
|
}
|
|
1216
|
-
function
|
|
1584
|
+
function st() {
|
|
1217
1585
|
for (var t = "", e = 0, n = 4294967295 * Math.random() | 0; e++ < 36; ) {
|
|
1218
1586
|
var r = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[e - 1], i = 15 & n;
|
|
1219
1587
|
t += r == "-" || r == "4" ? r : (r == "x" ? i : 3 & i | 8).toString(16), n = e % 8 == 0 ? 4294967295 * Math.random() | 0 : n >> 4;
|
|
1220
1588
|
}
|
|
1221
1589
|
return t;
|
|
1222
1590
|
}
|
|
1223
|
-
var
|
|
1224
|
-
function
|
|
1225
|
-
return
|
|
1591
|
+
var De = "global", Oe = me + "global" + me, Pe = typeof self === Gt && self.self === self && self || typeof global === Gt && global.global === global && global || void 0;
|
|
1592
|
+
function ge(t) {
|
|
1593
|
+
return Pe[Oe][t];
|
|
1226
1594
|
}
|
|
1227
|
-
function
|
|
1228
|
-
return
|
|
1595
|
+
function ye(t, e) {
|
|
1596
|
+
return Pe[Oe][t] = e;
|
|
1229
1597
|
}
|
|
1230
|
-
function
|
|
1231
|
-
delete
|
|
1598
|
+
function xe(t) {
|
|
1599
|
+
delete Pe[Oe][t];
|
|
1232
1600
|
}
|
|
1233
|
-
function
|
|
1601
|
+
function Ce(t, e, n) {
|
|
1234
1602
|
var r;
|
|
1235
1603
|
try {
|
|
1236
|
-
if (
|
|
1604
|
+
if (Ct(t)) {
|
|
1237
1605
|
var i = window[t];
|
|
1238
1606
|
r = i[e].bind(i);
|
|
1239
1607
|
}
|
|
@@ -1241,99 +1609,99 @@ function Ee(t, e, n) {
|
|
|
1241
1609
|
}
|
|
1242
1610
|
return r || n;
|
|
1243
1611
|
}
|
|
1244
|
-
|
|
1245
|
-
var
|
|
1246
|
-
function
|
|
1247
|
-
if (typeof
|
|
1248
|
-
return
|
|
1612
|
+
Pe[Oe] || (Pe[Oe] = {});
|
|
1613
|
+
var He = {};
|
|
1614
|
+
function Ct(t) {
|
|
1615
|
+
if (typeof He[t] !== Fe)
|
|
1616
|
+
return He[t];
|
|
1249
1617
|
try {
|
|
1250
1618
|
var e = window[t];
|
|
1251
|
-
e.setItem(
|
|
1619
|
+
e.setItem(Fe, Fe), e.removeItem(Fe);
|
|
1252
1620
|
} catch {
|
|
1253
|
-
return
|
|
1621
|
+
return He[t] = !1;
|
|
1254
1622
|
}
|
|
1255
|
-
return
|
|
1623
|
+
return He[t] = !0;
|
|
1256
1624
|
}
|
|
1257
|
-
function
|
|
1258
|
-
return
|
|
1625
|
+
function O() {
|
|
1626
|
+
return O = Object.assign || function(t) {
|
|
1259
1627
|
for (var e = 1; e < arguments.length; e++) {
|
|
1260
1628
|
var n = arguments[e];
|
|
1261
1629
|
for (var r in n)
|
|
1262
1630
|
Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
1263
1631
|
}
|
|
1264
1632
|
return t;
|
|
1265
|
-
},
|
|
1633
|
+
}, O.apply(this, arguments);
|
|
1266
1634
|
}
|
|
1267
|
-
var ne = "function", ee = "undefined",
|
|
1635
|
+
var ne = "function", ee = "undefined", zi = "@@redux/" + Math.random().toString(36), qt = /* @__PURE__ */ function() {
|
|
1268
1636
|
return typeof Symbol === ne && Symbol.observable || "@@observable";
|
|
1269
|
-
}(),
|
|
1270
|
-
function
|
|
1637
|
+
}(), Je = " != " + ne;
|
|
1638
|
+
function Jn(t, e, n) {
|
|
1271
1639
|
var r;
|
|
1272
1640
|
if (typeof e === ne && typeof n === ee && (n = e, e = void 0), typeof n !== ee) {
|
|
1273
1641
|
if (typeof n !== ne)
|
|
1274
|
-
throw new Error("enhancer" +
|
|
1275
|
-
return n(
|
|
1642
|
+
throw new Error("enhancer" + Je);
|
|
1643
|
+
return n(Jn)(t, e);
|
|
1276
1644
|
}
|
|
1277
1645
|
if (typeof t !== ne)
|
|
1278
|
-
throw new Error("reducer" +
|
|
1279
|
-
var i = t, o = e, a = [], s = a,
|
|
1280
|
-
function
|
|
1646
|
+
throw new Error("reducer" + Je);
|
|
1647
|
+
var i = t, o = e, a = [], s = a, m = !1;
|
|
1648
|
+
function p() {
|
|
1281
1649
|
s === a && (s = a.slice());
|
|
1282
1650
|
}
|
|
1283
1651
|
function u() {
|
|
1284
1652
|
return o;
|
|
1285
1653
|
}
|
|
1286
|
-
function c(
|
|
1287
|
-
if (typeof
|
|
1288
|
-
throw new Error("Listener" +
|
|
1289
|
-
var
|
|
1290
|
-
return
|
|
1291
|
-
if (
|
|
1292
|
-
|
|
1293
|
-
var
|
|
1294
|
-
s.splice(
|
|
1654
|
+
function c(d) {
|
|
1655
|
+
if (typeof d !== ne)
|
|
1656
|
+
throw new Error("Listener" + Je);
|
|
1657
|
+
var w = !0;
|
|
1658
|
+
return p(), s.push(d), function() {
|
|
1659
|
+
if (w) {
|
|
1660
|
+
w = !1, p();
|
|
1661
|
+
var k = s.indexOf(d);
|
|
1662
|
+
s.splice(k, 1);
|
|
1295
1663
|
}
|
|
1296
1664
|
};
|
|
1297
1665
|
}
|
|
1298
|
-
function d
|
|
1299
|
-
if (!
|
|
1666
|
+
function h(d) {
|
|
1667
|
+
if (!X(d))
|
|
1300
1668
|
throw new Error("Act != obj");
|
|
1301
|
-
if (typeof
|
|
1669
|
+
if (typeof d.type === ee)
|
|
1302
1670
|
throw new Error("ActType " + ee);
|
|
1303
|
-
if (
|
|
1671
|
+
if (m)
|
|
1304
1672
|
throw new Error("Dispatch in reducer");
|
|
1305
1673
|
try {
|
|
1306
|
-
|
|
1674
|
+
m = !0, o = i(o, d);
|
|
1307
1675
|
} finally {
|
|
1308
|
-
|
|
1676
|
+
m = !1;
|
|
1309
1677
|
}
|
|
1310
|
-
for (var
|
|
1311
|
-
(0,
|
|
1312
|
-
return
|
|
1678
|
+
for (var w = a = s, k = 0; k < w.length; k++)
|
|
1679
|
+
(0, w[k])();
|
|
1680
|
+
return d;
|
|
1313
1681
|
}
|
|
1314
|
-
return
|
|
1315
|
-
if (typeof
|
|
1316
|
-
throw new Error("next reducer" +
|
|
1317
|
-
i =
|
|
1318
|
-
} })[
|
|
1319
|
-
var
|
|
1320
|
-
return (
|
|
1321
|
-
if (typeof
|
|
1682
|
+
return h({ type: "@@redux/INIT" }), (r = { dispatch: h, subscribe: c, getState: u, replaceReducer: function(d) {
|
|
1683
|
+
if (typeof d !== ne)
|
|
1684
|
+
throw new Error("next reducer" + Je);
|
|
1685
|
+
i = d, h({ type: "@@redux/INIT" });
|
|
1686
|
+
} })[qt] = function() {
|
|
1687
|
+
var d, w = c;
|
|
1688
|
+
return (d = { subscribe: function(k) {
|
|
1689
|
+
if (typeof k != "object")
|
|
1322
1690
|
throw new TypeError("Observer != obj");
|
|
1323
|
-
function
|
|
1324
|
-
|
|
1691
|
+
function v() {
|
|
1692
|
+
k.next && k.next(u());
|
|
1325
1693
|
}
|
|
1326
|
-
return
|
|
1327
|
-
} })[
|
|
1694
|
+
return v(), { unsubscribe: w(v) };
|
|
1695
|
+
} })[qt] = function() {
|
|
1328
1696
|
return this;
|
|
1329
|
-
},
|
|
1697
|
+
}, d;
|
|
1330
1698
|
}, r;
|
|
1331
1699
|
}
|
|
1332
|
-
function
|
|
1700
|
+
function Ni(t, e) {
|
|
1333
1701
|
var n = e && e.type;
|
|
1334
1702
|
return "action " + (n && n.toString() || "?") + "reducer " + t + " returns " + ee;
|
|
1335
1703
|
}
|
|
1336
|
-
function
|
|
1704
|
+
function Te() {
|
|
1337
1705
|
var t = [].slice.call(arguments);
|
|
1338
1706
|
return t.length === 0 ? function(e) {
|
|
1339
1707
|
return e;
|
|
@@ -1343,48 +1711,48 @@ function _e() {
|
|
|
1343
1711
|
};
|
|
1344
1712
|
});
|
|
1345
1713
|
}
|
|
1346
|
-
function
|
|
1714
|
+
function Li() {
|
|
1347
1715
|
var t = arguments;
|
|
1348
1716
|
return function(e) {
|
|
1349
1717
|
return function(n, r, i) {
|
|
1350
|
-
var o, a = e(n, r, i), s = a.dispatch,
|
|
1351
|
-
return s(
|
|
1718
|
+
var o, a = e(n, r, i), s = a.dispatch, m = { getState: a.getState, dispatch: function(p) {
|
|
1719
|
+
return s(p);
|
|
1352
1720
|
} };
|
|
1353
|
-
return o = [].slice.call(t).map(function(
|
|
1354
|
-
return m
|
|
1355
|
-
}),
|
|
1721
|
+
return o = [].slice.call(t).map(function(p) {
|
|
1722
|
+
return p(m);
|
|
1723
|
+
}), O({}, a, { dispatch: s = Te.apply(void 0, o)(a.dispatch) });
|
|
1356
1724
|
};
|
|
1357
1725
|
};
|
|
1358
1726
|
}
|
|
1359
|
-
var ie =
|
|
1727
|
+
var ie = me + "anon_id", pe = me + "user_id", Ie = me + "user_traits", te = "userId", ke = "anonymousId", Qe = ["bootstrap", "params", "campaign", "initializeStart", "initialize", "initializeEnd", "ready", "resetStart", "reset", "resetEnd", "pageStart", "page", "pageEnd", "pageAborted", "trackStart", "track", "trackEnd", "trackAborted", "identifyStart", "identify", "identifyEnd", "identifyAborted", "userIdChanged", "registerPlugins", "enablePlugin", "disablePlugin", "online", "offline", "setItemStart", "setItem", "setItemEnd", "setItemAborted", "removeItemStart", "removeItem", "removeItemEnd", "removeItemAborted"], Et = ["name", "EVENTS", "config", "loaded"], E = Qe.reduce(function(t, e) {
|
|
1360
1728
|
return t[e] = e, t;
|
|
1361
1729
|
}, { registerPluginType: function(t) {
|
|
1362
1730
|
return "registerPlugin:" + t;
|
|
1363
1731
|
}, pluginReadyType: function(t) {
|
|
1364
1732
|
return "ready:" + t;
|
|
1365
|
-
} }),
|
|
1366
|
-
function
|
|
1733
|
+
} }), Qt = /^utm_/, en = /^an_prop_/, tn = /^an_trait_/;
|
|
1734
|
+
function Di(t) {
|
|
1367
1735
|
var e = t.storage.setItem;
|
|
1368
1736
|
return function(n) {
|
|
1369
1737
|
return function(r) {
|
|
1370
1738
|
return function(i) {
|
|
1371
|
-
if (i.type ===
|
|
1372
|
-
var o = i.params, a = i.user, s = i.persistedUser,
|
|
1373
|
-
s.anonymousId !== a.anonymousId && e(ie, a.anonymousId),
|
|
1739
|
+
if (i.type === E.bootstrap) {
|
|
1740
|
+
var o = i.params, a = i.user, s = i.persistedUser, m = i.initialUser, p = s.userId === a.userId;
|
|
1741
|
+
s.anonymousId !== a.anonymousId && e(ie, a.anonymousId), p || e(pe, a.userId), m.traits && e(Ie, O({}, p && s.traits ? s.traits : {}, m.traits));
|
|
1374
1742
|
var u = Object.keys(i.params);
|
|
1375
1743
|
if (u.length) {
|
|
1376
|
-
var c = o.an_uid,
|
|
1377
|
-
if (
|
|
1378
|
-
var
|
|
1379
|
-
|
|
1744
|
+
var c = o.an_uid, h = o.an_event, d = u.reduce(function(w, k) {
|
|
1745
|
+
if (k.match(Qt) || k.match(/^(d|g)clid/)) {
|
|
1746
|
+
var v = k.replace(Qt, "");
|
|
1747
|
+
w.campaign[v === "campaign" ? "name" : v] = o[k];
|
|
1380
1748
|
}
|
|
1381
|
-
return
|
|
1749
|
+
return k.match(en) && (w.props[k.replace(en, "")] = o[k]), k.match(tn) && (w.traits[k.replace(tn, "")] = o[k]), w;
|
|
1382
1750
|
}, { campaign: {}, props: {}, traits: {} });
|
|
1383
|
-
n.dispatch(
|
|
1384
|
-
return t.identify(c,
|
|
1385
|
-
}, 0),
|
|
1386
|
-
return t.track(
|
|
1387
|
-
}, 0), Object.keys(
|
|
1751
|
+
n.dispatch(O({ type: E.params, raw: o }, d, c ? { userId: c } : {})), c && setTimeout(function() {
|
|
1752
|
+
return t.identify(c, d.traits);
|
|
1753
|
+
}, 0), h && setTimeout(function() {
|
|
1754
|
+
return t.track(h, d.props);
|
|
1755
|
+
}, 0), Object.keys(d.campaign).length && n.dispatch({ type: E.campaign, campaign: d.campaign });
|
|
1388
1756
|
}
|
|
1389
1757
|
}
|
|
1390
1758
|
return r(i);
|
|
@@ -1392,19 +1760,19 @@ function ni(t) {
|
|
|
1392
1760
|
};
|
|
1393
1761
|
};
|
|
1394
1762
|
}
|
|
1395
|
-
function
|
|
1763
|
+
function Ui(t) {
|
|
1396
1764
|
return function(e, n) {
|
|
1397
|
-
if (e === void 0 && (e = {}), n === void 0 && (n = {}), n.type ===
|
|
1765
|
+
if (e === void 0 && (e = {}), n === void 0 && (n = {}), n.type === E.setItemEnd) {
|
|
1398
1766
|
if (n.key === ie)
|
|
1399
|
-
return
|
|
1400
|
-
if (n.key ===
|
|
1401
|
-
return
|
|
1767
|
+
return O({}, e, { anonymousId: n.value });
|
|
1768
|
+
if (n.key === pe)
|
|
1769
|
+
return O({}, e, { userId: n.value });
|
|
1402
1770
|
}
|
|
1403
1771
|
switch (n.type) {
|
|
1404
|
-
case
|
|
1405
|
-
return Object.assign({}, e, { userId: n.userId, traits:
|
|
1406
|
-
case
|
|
1407
|
-
return [
|
|
1772
|
+
case E.identify:
|
|
1773
|
+
return Object.assign({}, e, { userId: n.userId, traits: O({}, e.traits, n.traits) });
|
|
1774
|
+
case E.reset:
|
|
1775
|
+
return [pe, ie, Ie].forEach(function(r) {
|
|
1408
1776
|
t.removeItem(r);
|
|
1409
1777
|
}), Object.assign({}, e, { userId: null, anonymousId: null, traits: {} });
|
|
1410
1778
|
default:
|
|
@@ -1412,357 +1780,363 @@ function ri(t) {
|
|
|
1412
1780
|
}
|
|
1413
1781
|
};
|
|
1414
1782
|
}
|
|
1415
|
-
function
|
|
1416
|
-
return { userId: t.getItem(
|
|
1783
|
+
function nn(t) {
|
|
1784
|
+
return { userId: t.getItem(pe), anonymousId: t.getItem(ie), traits: t.getItem(Ie) };
|
|
1417
1785
|
}
|
|
1418
|
-
var
|
|
1419
|
-
return
|
|
1786
|
+
var Ot = function(t) {
|
|
1787
|
+
return me + "TEMP" + me + t;
|
|
1420
1788
|
};
|
|
1421
|
-
function
|
|
1789
|
+
function Ri(t) {
|
|
1422
1790
|
var e = t.storage, n = e.setItem, r = e.removeItem, i = e.getItem;
|
|
1423
1791
|
return function(o) {
|
|
1424
1792
|
return function(a) {
|
|
1425
1793
|
return function(s) {
|
|
1426
|
-
var
|
|
1427
|
-
if (s.type ===
|
|
1428
|
-
r(
|
|
1429
|
-
}), [te,
|
|
1430
|
-
|
|
1431
|
-
})), s.type ===
|
|
1432
|
-
i(ie) || n(ie,
|
|
1433
|
-
var c = i(
|
|
1434
|
-
c && c !==
|
|
1794
|
+
var m = s.userId, p = s.traits, u = s.options;
|
|
1795
|
+
if (s.type === E.reset && ([pe, Ie, ie].forEach(function(d) {
|
|
1796
|
+
r(d);
|
|
1797
|
+
}), [te, ke, "traits"].forEach(function(d) {
|
|
1798
|
+
xe(Ot(d));
|
|
1799
|
+
})), s.type === E.identify) {
|
|
1800
|
+
i(ie) || n(ie, st());
|
|
1801
|
+
var c = i(pe), h = i(Ie) || {};
|
|
1802
|
+
c && c !== m && o.dispatch({ type: E.userIdChanged, old: { userId: c, traits: h }, new: { userId: m, traits: p }, options: u }), m && n(pe, m), p && n(Ie, O({}, h, p));
|
|
1435
1803
|
}
|
|
1436
1804
|
return a(s);
|
|
1437
1805
|
};
|
|
1438
1806
|
};
|
|
1439
1807
|
};
|
|
1440
1808
|
}
|
|
1441
|
-
var
|
|
1442
|
-
function
|
|
1443
|
-
|
|
1809
|
+
var Le = {};
|
|
1810
|
+
function rn(t, e) {
|
|
1811
|
+
Le[t] && B(Le[t]) && (Le[t](e), delete Le[t]);
|
|
1444
1812
|
}
|
|
1445
|
-
function
|
|
1813
|
+
function Vn(t, e, n) {
|
|
1446
1814
|
return new Promise(function(r, i) {
|
|
1447
|
-
return e() ? r(t) : n < 1 ? i(
|
|
1815
|
+
return e() ? r(t) : n < 1 ? i(O({}, t, { queue: !0 })) : new Promise(function(o) {
|
|
1448
1816
|
return setTimeout(o, 10);
|
|
1449
1817
|
}).then(function(o) {
|
|
1450
|
-
return
|
|
1818
|
+
return Vn(t, e, n - 10).then(r, i);
|
|
1451
1819
|
});
|
|
1452
1820
|
});
|
|
1453
1821
|
}
|
|
1454
|
-
function
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1822
|
+
function Wi(t) {
|
|
1823
|
+
return { abort: t };
|
|
1824
|
+
}
|
|
1825
|
+
function Yn(t, e, n) {
|
|
1826
|
+
var r = {}, i = e(), o = t.getState(), a = o.plugins, s = o.queue, m = o.user;
|
|
1827
|
+
if (!o.context.offline && s && s.actions && s.actions.length) {
|
|
1828
|
+
var p = s.actions.reduce(function(c, h, d) {
|
|
1829
|
+
return a[h.plugin].loaded ? (c.process.push(h), c.processIndex.push(d)) : (c.requeue.push(h), c.requeueIndex.push(d)), c;
|
|
1459
1830
|
}, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
|
|
1460
|
-
if (
|
|
1461
|
-
|
|
1462
|
-
var
|
|
1463
|
-
if (
|
|
1464
|
-
var
|
|
1465
|
-
return
|
|
1466
|
-
return
|
|
1467
|
-
},
|
|
1468
|
-
}(
|
|
1469
|
-
v({ payload:
|
|
1470
|
-
|
|
1471
|
-
|
|
1831
|
+
if (p.processIndex && p.processIndex.length) {
|
|
1832
|
+
p.processIndex.forEach(function(c) {
|
|
1833
|
+
var h = s.actions[c], d = h.plugin, w = h.payload.type, k = i[d][w];
|
|
1834
|
+
if (k && B(k)) {
|
|
1835
|
+
var v, I = function(l, b) {
|
|
1836
|
+
return l === void 0 && (l = {}), b === void 0 && (b = {}), [te, ke].reduce(function(T, P) {
|
|
1837
|
+
return l.hasOwnProperty(P) && b[P] && b[P] !== l[P] && (T[P] = b[P]), T;
|
|
1838
|
+
}, l);
|
|
1839
|
+
}(h.payload, m), _ = r[I.meta.rid];
|
|
1840
|
+
if (!_ && (v = k({ payload: I, config: a[d].config, instance: n, abort: Wi })) && X(v) && v.abort)
|
|
1841
|
+
return void (r[I.meta.rid] = !0);
|
|
1842
|
+
if (!_) {
|
|
1843
|
+
var y = w + ":" + d;
|
|
1844
|
+
t.dispatch(O({}, I, { type: y, _: { called: y, from: "queueDrain" } }));
|
|
1845
|
+
}
|
|
1472
1846
|
}
|
|
1473
1847
|
});
|
|
1474
|
-
var
|
|
1475
|
-
return !~
|
|
1848
|
+
var u = s.actions.filter(function(c, h) {
|
|
1849
|
+
return !~p.processIndex.indexOf(h);
|
|
1476
1850
|
});
|
|
1477
|
-
|
|
1851
|
+
s.actions = u;
|
|
1478
1852
|
}
|
|
1479
1853
|
}
|
|
1480
1854
|
}
|
|
1481
|
-
var
|
|
1482
|
-
var e = t.data, n = t.action, r = t.instance, i = t.state, o = t.allPlugins, a = t.allMatches, s = t.store,
|
|
1855
|
+
var mt = function(t) {
|
|
1856
|
+
var e = t.data, n = t.action, r = t.instance, i = t.state, o = t.allPlugins, a = t.allMatches, s = t.store, m = t.EVENTS;
|
|
1483
1857
|
try {
|
|
1484
|
-
var
|
|
1485
|
-
return
|
|
1858
|
+
var p = i.plugins, u = i.context, c = n.type, h = c.match(_e), d = e.exact.map(function(v) {
|
|
1859
|
+
return v.pluginName;
|
|
1486
1860
|
});
|
|
1487
|
-
|
|
1488
|
-
return
|
|
1861
|
+
h && (d = a.during.map(function(v) {
|
|
1862
|
+
return v.pluginName;
|
|
1489
1863
|
}));
|
|
1490
|
-
var
|
|
1491
|
-
return function(_,
|
|
1492
|
-
var b =
|
|
1493
|
-
|
|
1494
|
-
var x = _.type.match(
|
|
1495
|
-
return function(
|
|
1496
|
-
var K = U ? U.name : D, M =
|
|
1497
|
-
if (U && (!(M =
|
|
1864
|
+
var w = /* @__PURE__ */ function(v, I) {
|
|
1865
|
+
return function(_, y, l) {
|
|
1866
|
+
var b = y.config, T = y.name, P = T + "." + _.type;
|
|
1867
|
+
l && (P = l.event);
|
|
1868
|
+
var x = _.type.match(_e) ? /* @__PURE__ */ function(D, L, H, U, J) {
|
|
1869
|
+
return function(W, j) {
|
|
1870
|
+
var K = U ? U.name : D, M = j && Ze(j) ? j : H;
|
|
1871
|
+
if (U && (!(M = j && Ze(j) ? j : [D]).includes(D) || M.length !== 1))
|
|
1498
1872
|
throw new Error("Method " + L + " can only abort " + D + " plugin. " + JSON.stringify(M) + " input valid");
|
|
1499
|
-
return
|
|
1873
|
+
return O({}, J, { abort: { reason: W, plugins: M, caller: L, _: K } });
|
|
1500
1874
|
};
|
|
1501
|
-
}(
|
|
1875
|
+
}(T, P, I, l, _) : /* @__PURE__ */ function(D, L) {
|
|
1502
1876
|
return function() {
|
|
1503
1877
|
throw new Error(D.type + " action not cancellable. Remove abort in " + L);
|
|
1504
1878
|
};
|
|
1505
|
-
}(_,
|
|
1506
|
-
return { payload:
|
|
1879
|
+
}(_, P);
|
|
1880
|
+
return { payload: Zi(_), instance: v, config: b || {}, abort: x };
|
|
1507
1881
|
};
|
|
1508
|
-
}(r,
|
|
1509
|
-
var _ =
|
|
1510
|
-
return
|
|
1882
|
+
}(r, d), k = e.exact.reduce(function(v, I) {
|
|
1883
|
+
var _ = I.pluginName, y = I.methodName, l = !1;
|
|
1884
|
+
return y.match(/^initialize/) || y.match(/^reset/) || (l = !p[_].loaded), u.offline && y.match(/^(page|track|identify)/) && (l = !0), v["" + _] = l, v;
|
|
1511
1885
|
}, {});
|
|
1512
|
-
return Promise.resolve(e.exact.reduce(function(
|
|
1886
|
+
return Promise.resolve(e.exact.reduce(function(v, I, _) {
|
|
1513
1887
|
try {
|
|
1514
|
-
var
|
|
1515
|
-
return Promise.resolve(
|
|
1888
|
+
var y = I.pluginName;
|
|
1889
|
+
return Promise.resolve(v).then(function(l) {
|
|
1516
1890
|
function b() {
|
|
1517
|
-
return Promise.resolve(
|
|
1891
|
+
return Promise.resolve(l);
|
|
1518
1892
|
}
|
|
1519
|
-
var
|
|
1520
|
-
if (e.namespaced && e.namespaced[
|
|
1521
|
-
return Promise.resolve(e.namespaced[
|
|
1893
|
+
var T = function() {
|
|
1894
|
+
if (e.namespaced && e.namespaced[y])
|
|
1895
|
+
return Promise.resolve(e.namespaced[y].reduce(function(P, x, D) {
|
|
1522
1896
|
try {
|
|
1523
|
-
return Promise.resolve(
|
|
1524
|
-
return x.method &&
|
|
1525
|
-
var K =
|
|
1526
|
-
if (K && K.name ===
|
|
1527
|
-
var M =
|
|
1528
|
-
throw new Error([
|
|
1897
|
+
return Promise.resolve(P).then(function(L) {
|
|
1898
|
+
return x.method && B(x.method) ? (function(W, j) {
|
|
1899
|
+
var K = dn(W);
|
|
1900
|
+
if (K && K.name === j) {
|
|
1901
|
+
var M = dn(K.method);
|
|
1902
|
+
throw new Error([j + " plugin is calling method " + W, "Plugins cant call self", "Use " + K.method + " " + (M ? "or " + M.method : "") + " in " + j + " plugin insteadof " + W].join(`
|
|
1529
1903
|
`));
|
|
1530
1904
|
}
|
|
1531
|
-
}(x.methodName, x.pluginName), Promise.resolve(x.method({ payload: L, instance: r, abort: (
|
|
1532
|
-
return
|
|
1533
|
-
}), config:
|
|
1534
|
-
var
|
|
1535
|
-
return Promise.resolve(
|
|
1905
|
+
}(x.methodName, x.pluginName), Promise.resolve(x.method({ payload: L, instance: r, abort: (H = L, U = y, J = x.pluginName, function(W, j) {
|
|
1906
|
+
return O({}, H, { abort: { reason: W, plugins: j || [U], caller: c, from: J || U } });
|
|
1907
|
+
}), config: sn(x.pluginName, p, o), plugins: p })).then(function(W) {
|
|
1908
|
+
var j = X(W) ? W : {};
|
|
1909
|
+
return Promise.resolve(O({}, L, j));
|
|
1536
1910
|
})) : L;
|
|
1537
|
-
var
|
|
1911
|
+
var H, U, J;
|
|
1538
1912
|
});
|
|
1539
1913
|
} catch (L) {
|
|
1540
1914
|
return Promise.reject(L);
|
|
1541
1915
|
}
|
|
1542
|
-
}, Promise.resolve(n))).then(function(
|
|
1543
|
-
|
|
1916
|
+
}, Promise.resolve(n))).then(function(P) {
|
|
1917
|
+
l[y] = P;
|
|
1544
1918
|
});
|
|
1545
|
-
|
|
1919
|
+
l[y] = n;
|
|
1546
1920
|
}();
|
|
1547
|
-
return
|
|
1921
|
+
return T && T.then ? T.then(b) : b();
|
|
1548
1922
|
});
|
|
1549
|
-
} catch (
|
|
1550
|
-
return Promise.reject(
|
|
1923
|
+
} catch (l) {
|
|
1924
|
+
return Promise.reject(l);
|
|
1551
1925
|
}
|
|
1552
|
-
}, Promise.resolve({}))).then(function(
|
|
1553
|
-
return Promise.resolve(e.exact.reduce(function(
|
|
1926
|
+
}, Promise.resolve({}))).then(function(v) {
|
|
1927
|
+
return Promise.resolve(e.exact.reduce(function(I, _, y) {
|
|
1554
1928
|
try {
|
|
1555
|
-
var
|
|
1556
|
-
return Promise.resolve(
|
|
1557
|
-
var x =
|
|
1558
|
-
if (
|
|
1559
|
-
return
|
|
1560
|
-
if (
|
|
1561
|
-
return
|
|
1562
|
-
if (
|
|
1563
|
-
return s.dispatch({ type: "queue", plugin: b, payload: x, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(
|
|
1564
|
-
var D = v
|
|
1565
|
-
return Promise.resolve(
|
|
1566
|
-
var
|
|
1567
|
-
if (
|
|
1568
|
-
|
|
1929
|
+
var l = e.exact.length === y + 1, b = _.pluginName, T = o[b];
|
|
1930
|
+
return Promise.resolve(I).then(function(P) {
|
|
1931
|
+
var x = v[b] ? v[b] : {};
|
|
1932
|
+
if (h && (x = P), yt(x, b))
|
|
1933
|
+
return gt({ data: x, method: c, instance: r, pluginName: b, store: s }), Promise.resolve(P);
|
|
1934
|
+
if (yt(P, b))
|
|
1935
|
+
return l && gt({ data: P, method: c, instance: r, store: s }), Promise.resolve(P);
|
|
1936
|
+
if (k.hasOwnProperty(b) && k[b] === !0)
|
|
1937
|
+
return s.dispatch({ type: "queue", plugin: b, payload: x, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(P);
|
|
1938
|
+
var D = w(v[b], o[b]);
|
|
1939
|
+
return Promise.resolve(T[c]({ abort: D.abort, payload: x, instance: r, config: sn(b, p, o), plugins: p })).then(function(L) {
|
|
1940
|
+
var H = X(L) ? L : {}, U = O({}, P, H), J = v[b];
|
|
1941
|
+
if (yt(J, b))
|
|
1942
|
+
gt({ data: J, method: c, instance: r, pluginName: b, store: s });
|
|
1569
1943
|
else {
|
|
1570
|
-
var
|
|
1571
|
-
(
|
|
1944
|
+
var W = c + ":" + b;
|
|
1945
|
+
(W.match(/:/g) || []).length < 2 && !c.match(on) && !c.match(an) && r.dispatch(O({}, h ? U : x, { type: W, _: { called: W, from: "submethod" } }));
|
|
1572
1946
|
}
|
|
1573
1947
|
return Promise.resolve(U);
|
|
1574
1948
|
});
|
|
1575
1949
|
});
|
|
1576
|
-
} catch (
|
|
1577
|
-
return Promise.reject(
|
|
1950
|
+
} catch (P) {
|
|
1951
|
+
return Promise.reject(P);
|
|
1578
1952
|
}
|
|
1579
|
-
}, Promise.resolve(n))).then(function(
|
|
1580
|
-
if (!(c.match(
|
|
1581
|
-
if (
|
|
1582
|
-
return
|
|
1583
|
-
var _ =
|
|
1584
|
-
|
|
1953
|
+
}, Promise.resolve(n))).then(function(I) {
|
|
1954
|
+
if (!(c.match(_e) || c.match(/^registerPlugin/) || c.match(an) || c.match(on) || c.match(/^params/) || c.match(/^userIdChanged/))) {
|
|
1955
|
+
if (m.plugins.includes(c), I._ && I._.originalAction === c)
|
|
1956
|
+
return I;
|
|
1957
|
+
var _ = O({}, I, { _: { originalAction: I.type, called: I.type, from: "engineEnd" } });
|
|
1958
|
+
Gn(I, e.exact.length) && !c.match(/End$/) && (_ = O({}, _, { type: I.type + "Aborted" })), s.dispatch(_);
|
|
1585
1959
|
}
|
|
1586
|
-
return
|
|
1960
|
+
return I;
|
|
1587
1961
|
});
|
|
1588
1962
|
});
|
|
1589
|
-
} catch (
|
|
1590
|
-
return Promise.reject(
|
|
1963
|
+
} catch (v) {
|
|
1964
|
+
return Promise.reject(v);
|
|
1591
1965
|
}
|
|
1592
|
-
},
|
|
1593
|
-
function
|
|
1966
|
+
}, _e = /Start$/, on = /^bootstrap/, an = /^ready/;
|
|
1967
|
+
function gt(t) {
|
|
1594
1968
|
var e = t.pluginName, n = t.method + "Aborted" + (e ? ":" + e : "");
|
|
1595
|
-
t.store.dispatch(
|
|
1969
|
+
t.store.dispatch(O({}, t.data, { type: n, _: { called: n, from: "abort" } }));
|
|
1596
1970
|
}
|
|
1597
|
-
function
|
|
1971
|
+
function sn(t, e, n) {
|
|
1598
1972
|
var r = e[t] || n[t];
|
|
1599
1973
|
return r && r.config ? r.config : {};
|
|
1600
1974
|
}
|
|
1601
|
-
function
|
|
1975
|
+
function cn(t, e) {
|
|
1602
1976
|
return e.reduce(function(n, r) {
|
|
1603
1977
|
return r[t] ? n.concat({ methodName: t, pluginName: r.name, method: r[t] }) : n;
|
|
1604
1978
|
}, []);
|
|
1605
1979
|
}
|
|
1606
|
-
function
|
|
1607
|
-
var n = t.replace(
|
|
1980
|
+
function un(t, e) {
|
|
1981
|
+
var n = t.replace(_e, ""), r = e ? ":" + e : "";
|
|
1608
1982
|
return ["" + t + r, "" + n + r, n + "End" + r];
|
|
1609
1983
|
}
|
|
1610
|
-
function
|
|
1984
|
+
function yt(t, e) {
|
|
1611
1985
|
var n = t.abort;
|
|
1612
|
-
return !!n && (n === !0 ||
|
|
1986
|
+
return !!n && (n === !0 || ln(n, e) || n && ln(n.plugins, e));
|
|
1613
1987
|
}
|
|
1614
|
-
function
|
|
1988
|
+
function Gn(t, e) {
|
|
1615
1989
|
var n = t.abort;
|
|
1616
1990
|
if (!n)
|
|
1617
1991
|
return !1;
|
|
1618
1992
|
if (n === !0 || re(n))
|
|
1619
1993
|
return !0;
|
|
1620
1994
|
var r = n.plugins;
|
|
1621
|
-
return
|
|
1995
|
+
return Ze(n) && n.length === e || Ze(r) && r.length === e;
|
|
1622
1996
|
}
|
|
1623
|
-
function
|
|
1997
|
+
function Ze(t) {
|
|
1624
1998
|
return Array.isArray(t);
|
|
1625
1999
|
}
|
|
1626
|
-
function
|
|
1627
|
-
return !(!t || !
|
|
2000
|
+
function ln(t, e) {
|
|
2001
|
+
return !(!t || !Ze(t)) && t.includes(e);
|
|
1628
2002
|
}
|
|
1629
|
-
function
|
|
2003
|
+
function dn(t) {
|
|
1630
2004
|
var e = t.match(/(.*):(.*)/);
|
|
1631
2005
|
return !!e && { method: e[1], name: e[2] };
|
|
1632
2006
|
}
|
|
1633
|
-
function
|
|
2007
|
+
function Zi(t) {
|
|
1634
2008
|
return Object.keys(t).reduce(function(e, n) {
|
|
1635
|
-
return n === "type" || (e[n] =
|
|
2009
|
+
return n === "type" || (e[n] = X(t[n]) ? Object.assign({}, t[n]) : t[n]), e;
|
|
1636
2010
|
}, {});
|
|
1637
2011
|
}
|
|
1638
|
-
function
|
|
2012
|
+
function Ki(t, e, n) {
|
|
1639
2013
|
var r = {};
|
|
1640
2014
|
return function(i) {
|
|
1641
2015
|
return function(o) {
|
|
1642
2016
|
return function(a) {
|
|
1643
2017
|
try {
|
|
1644
|
-
var s,
|
|
1645
|
-
return s ?
|
|
1646
|
-
},
|
|
2018
|
+
var s, m = function(l) {
|
|
2019
|
+
return s ? l : o(c);
|
|
2020
|
+
}, p = a.type, u = a.plugins, c = a;
|
|
1647
2021
|
if (a.abort)
|
|
1648
2022
|
return Promise.resolve(o(a));
|
|
1649
|
-
if (
|
|
1650
|
-
return
|
|
1651
|
-
}, 0),
|
|
1652
|
-
var
|
|
1653
|
-
return u.includes(
|
|
1654
|
-
}).map(function(
|
|
1655
|
-
return
|
|
1656
|
-
}),
|
|
1657
|
-
var b =
|
|
1658
|
-
return
|
|
1659
|
-
return b({ config:
|
|
2023
|
+
if (p === E.enablePlugin && i.dispatch({ type: E.initializeStart, plugins: u, disabled: [], fromEnable: !0, meta: a.meta }), p === E.disablePlugin && setTimeout(function() {
|
|
2024
|
+
return rn(a.meta.rid, { payload: a });
|
|
2025
|
+
}, 0), p === E.initializeEnd) {
|
|
2026
|
+
var h = e(), d = Object.keys(h), w = d.filter(function(l) {
|
|
2027
|
+
return u.includes(l);
|
|
2028
|
+
}).map(function(l) {
|
|
2029
|
+
return h[l];
|
|
2030
|
+
}), k = [], v = [], I = a.disabled, _ = w.map(function(l) {
|
|
2031
|
+
var b = l.loaded, T = l.name, P = l.config;
|
|
2032
|
+
return Vn(l, function() {
|
|
2033
|
+
return b({ config: P });
|
|
1660
2034
|
}, 1e4).then(function(x) {
|
|
1661
|
-
return r[
|
|
1662
|
-
return !
|
|
1663
|
-
}) }), r[
|
|
2035
|
+
return r[T] || (i.dispatch({ type: E.pluginReadyType(T), name: T, events: Object.keys(l).filter(function(D) {
|
|
2036
|
+
return !Et.includes(D);
|
|
2037
|
+
}) }), r[T] = !0), k = k.concat(T), l;
|
|
1664
2038
|
}).catch(function(x) {
|
|
1665
2039
|
if (x instanceof Error)
|
|
1666
2040
|
throw new Error(x);
|
|
1667
|
-
return
|
|
2041
|
+
return v = v.concat(x.name), x;
|
|
1668
2042
|
});
|
|
1669
2043
|
});
|
|
1670
|
-
Promise.all(_).then(function(
|
|
1671
|
-
var b = { plugins:
|
|
2044
|
+
Promise.all(_).then(function(l) {
|
|
2045
|
+
var b = { plugins: k, failed: v, disabled: I };
|
|
1672
2046
|
setTimeout(function() {
|
|
1673
|
-
|
|
2047
|
+
d.length === _.length + I.length && i.dispatch(O({}, { type: E.ready }, b));
|
|
1674
2048
|
}, 0);
|
|
1675
2049
|
});
|
|
1676
2050
|
}
|
|
1677
|
-
var
|
|
1678
|
-
if (
|
|
1679
|
-
return /^ready:([^:]*)$/.test(
|
|
1680
|
-
return
|
|
1681
|
-
}, 0), Promise.resolve(function(
|
|
2051
|
+
var y = function() {
|
|
2052
|
+
if (p !== E.bootstrap)
|
|
2053
|
+
return /^ready:([^:]*)$/.test(p) && setTimeout(function() {
|
|
2054
|
+
return Yn(i, e, t);
|
|
2055
|
+
}, 0), Promise.resolve(function(l, b, T, P, x) {
|
|
1682
2056
|
try {
|
|
1683
|
-
var D =
|
|
1684
|
-
if (
|
|
1685
|
-
return Promise.resolve(
|
|
1686
|
-
var U =
|
|
1687
|
-
var
|
|
1688
|
-
return
|
|
1689
|
-
}).map(function(
|
|
1690
|
-
return K[
|
|
2057
|
+
var D = B(b) ? b() : b, L = l.type, H = L.replace(_e, "");
|
|
2058
|
+
if (l._ && l._.called)
|
|
2059
|
+
return Promise.resolve(l);
|
|
2060
|
+
var U = T.getState(), J = (K = D, (M = U.plugins) === void 0 && (M = {}), ($e = l.options) === void 0 && ($e = {}), Object.keys(K).filter(function(f) {
|
|
2061
|
+
var g = $e.plugins || {};
|
|
2062
|
+
return _i(g[f]) ? g[f] : g.all !== !1 && (!M[f] || M[f].enabled !== !1);
|
|
2063
|
+
}).map(function(f) {
|
|
2064
|
+
return K[f];
|
|
1691
2065
|
}));
|
|
1692
|
-
L ===
|
|
1693
|
-
var
|
|
1694
|
-
return
|
|
1695
|
-
}).map(function(
|
|
1696
|
-
return D[
|
|
2066
|
+
L === E.initializeStart && l.fromEnable && (J = Object.keys(U.plugins).filter(function(f) {
|
|
2067
|
+
var g = U.plugins[f];
|
|
2068
|
+
return l.plugins.includes(f) && !g.initialized;
|
|
2069
|
+
}).map(function(f) {
|
|
2070
|
+
return D[f];
|
|
1697
2071
|
}));
|
|
1698
|
-
var
|
|
1699
|
-
return
|
|
1700
|
-
}),
|
|
1701
|
-
var
|
|
1702
|
-
return
|
|
2072
|
+
var W = J.map(function(f) {
|
|
2073
|
+
return f.name;
|
|
2074
|
+
}), j = function(f, g, S) {
|
|
2075
|
+
var C = un(f).map(function($) {
|
|
2076
|
+
return cn($, g);
|
|
1703
2077
|
});
|
|
1704
|
-
return
|
|
1705
|
-
var
|
|
1706
|
-
return
|
|
1707
|
-
}),
|
|
1708
|
-
return
|
|
1709
|
-
}, { before:
|
|
1710
|
-
}(L,
|
|
1711
|
-
return Promise.resolve(
|
|
1712
|
-
function
|
|
1713
|
-
var
|
|
1714
|
-
if (L.match(
|
|
1715
|
-
return Promise.resolve(
|
|
1716
|
-
|
|
2078
|
+
return g.reduce(function($, A) {
|
|
2079
|
+
var Z = A.name, N = un(f, Z).map(function(Ae) {
|
|
2080
|
+
return cn(Ae, g);
|
|
2081
|
+
}), R = N[0], z = N[1], q = N[2];
|
|
2082
|
+
return R.length && ($.beforeNS[Z] = R), z.length && ($.duringNS[Z] = z), q.length && ($.afterNS[Z] = q), $;
|
|
2083
|
+
}, { before: C[0], beforeNS: {}, during: C[1], duringNS: {}, after: C[2], afterNS: {} });
|
|
2084
|
+
}(L, J);
|
|
2085
|
+
return Promise.resolve(mt({ action: l, data: { exact: j.before, namespaced: j.beforeNS }, state: U, allPlugins: D, allMatches: j, instance: T, store: P, EVENTS: x })).then(function(f) {
|
|
2086
|
+
function g() {
|
|
2087
|
+
var $ = function() {
|
|
2088
|
+
if (L.match(_e))
|
|
2089
|
+
return Promise.resolve(mt({ action: O({}, S, { type: H + "End" }), data: { exact: j.after, namespaced: j.afterNS }, state: U, allPlugins: D, allMatches: j, instance: T, store: P, EVENTS: x })).then(function(A) {
|
|
2090
|
+
A.meta && A.meta.hasCallback && rn(A.meta.rid, { payload: A });
|
|
1717
2091
|
});
|
|
1718
2092
|
}();
|
|
1719
|
-
return
|
|
1720
|
-
return
|
|
1721
|
-
}) :
|
|
2093
|
+
return $ && $.then ? $.then(function() {
|
|
2094
|
+
return f;
|
|
2095
|
+
}) : f;
|
|
1722
2096
|
}
|
|
1723
|
-
if (
|
|
1724
|
-
return
|
|
1725
|
-
var S,
|
|
1726
|
-
if (L !==
|
|
1727
|
-
return Promise.resolve(
|
|
1728
|
-
S =
|
|
2097
|
+
if (Gn(f, W.length))
|
|
2098
|
+
return f;
|
|
2099
|
+
var S, C = function() {
|
|
2100
|
+
if (L !== H)
|
|
2101
|
+
return Promise.resolve(mt({ action: O({}, f, { type: H }), data: { exact: j.during, namespaced: j.duringNS }, state: U, allPlugins: D, allMatches: j, instance: T, store: P, EVENTS: x })).then(function($) {
|
|
2102
|
+
S = $;
|
|
1729
2103
|
});
|
|
1730
|
-
S =
|
|
2104
|
+
S = f;
|
|
1731
2105
|
}();
|
|
1732
|
-
return
|
|
2106
|
+
return C && C.then ? C.then(g) : g();
|
|
1733
2107
|
});
|
|
1734
|
-
} catch (
|
|
1735
|
-
return Promise.reject(
|
|
2108
|
+
} catch (f) {
|
|
2109
|
+
return Promise.reject(f);
|
|
1736
2110
|
}
|
|
1737
|
-
var K, M,
|
|
1738
|
-
}(a, e, t, i, n)).then(function(
|
|
1739
|
-
return s = 1, o(
|
|
2111
|
+
var K, M, $e;
|
|
2112
|
+
}(a, e, t, i, n)).then(function(l) {
|
|
2113
|
+
return s = 1, o(l);
|
|
1740
2114
|
});
|
|
1741
2115
|
}();
|
|
1742
|
-
return Promise.resolve(
|
|
1743
|
-
} catch (
|
|
1744
|
-
return Promise.reject(
|
|
2116
|
+
return Promise.resolve(y && y.then ? y.then(m) : m(y));
|
|
2117
|
+
} catch (l) {
|
|
2118
|
+
return Promise.reject(l);
|
|
1745
2119
|
}
|
|
1746
2120
|
};
|
|
1747
2121
|
};
|
|
1748
2122
|
};
|
|
1749
2123
|
}
|
|
1750
|
-
function
|
|
2124
|
+
function Mi(t) {
|
|
1751
2125
|
return function(e) {
|
|
1752
2126
|
return function(n) {
|
|
1753
2127
|
return function(r) {
|
|
1754
2128
|
var i = r.type, o = r.key, a = r.value, s = r.options;
|
|
1755
|
-
if (i ===
|
|
2129
|
+
if (i === E.setItem || i === E.removeItem) {
|
|
1756
2130
|
if (r.abort)
|
|
1757
2131
|
return n(r);
|
|
1758
|
-
i ===
|
|
2132
|
+
i === E.setItem ? t.setItem(o, a, s) : t.removeItem(o, s);
|
|
1759
2133
|
}
|
|
1760
2134
|
return n(r);
|
|
1761
2135
|
};
|
|
1762
2136
|
};
|
|
1763
2137
|
};
|
|
1764
2138
|
}
|
|
1765
|
-
var
|
|
2139
|
+
var Xi = function() {
|
|
1766
2140
|
var t = this;
|
|
1767
2141
|
this.before = [], this.after = [], this.addMiddleware = function(e, n) {
|
|
1768
2142
|
t[n] = t[n].concat(e);
|
|
@@ -1780,441 +2154,441 @@ var ci = function() {
|
|
|
1780
2154
|
} }, a = t[e].map(function(s) {
|
|
1781
2155
|
return s(o);
|
|
1782
2156
|
});
|
|
1783
|
-
return
|
|
2157
|
+
return Te.apply(void 0, a)(r)(i);
|
|
1784
2158
|
};
|
|
1785
2159
|
};
|
|
1786
2160
|
};
|
|
1787
2161
|
};
|
|
1788
2162
|
};
|
|
1789
|
-
function
|
|
2163
|
+
function Fi(t) {
|
|
1790
2164
|
return function(e, n) {
|
|
1791
2165
|
e === void 0 && (e = {});
|
|
1792
2166
|
var r = {};
|
|
1793
2167
|
if (n.type === "initialize:aborted")
|
|
1794
2168
|
return e;
|
|
1795
2169
|
if (/^registerPlugin:([^:]*)$/.test(n.type)) {
|
|
1796
|
-
var i =
|
|
2170
|
+
var i = hn(n.type, "registerPlugin"), o = t()[i];
|
|
1797
2171
|
if (!o || !i)
|
|
1798
2172
|
return e;
|
|
1799
2173
|
var a = n.enabled, s = o.config;
|
|
1800
|
-
return r[i] = { enabled: a, initialized: !!a && !o.initialize, loaded: !!a && !!o.loaded({ config: s }), config: s },
|
|
2174
|
+
return r[i] = { enabled: a, initialized: !!a && !o.initialize, loaded: !!a && !!o.loaded({ config: s }), config: s }, O({}, e, r);
|
|
1801
2175
|
}
|
|
1802
2176
|
if (/^initialize:([^:]*)$/.test(n.type)) {
|
|
1803
|
-
var
|
|
1804
|
-
return
|
|
2177
|
+
var m = hn(n.type, E.initialize), p = t()[m];
|
|
2178
|
+
return p && m ? (r[m] = O({}, e[m], { initialized: !0, loaded: !!p.loaded({ config: p.config }) }), O({}, e, r)) : e;
|
|
1805
2179
|
}
|
|
1806
2180
|
if (/^ready:([^:]*)$/.test(n.type))
|
|
1807
|
-
return r[n.name] =
|
|
2181
|
+
return r[n.name] = O({}, e[n.name], { loaded: !0 }), O({}, e, r);
|
|
1808
2182
|
switch (n.type) {
|
|
1809
|
-
case
|
|
1810
|
-
return
|
|
1811
|
-
case
|
|
1812
|
-
return
|
|
2183
|
+
case E.disablePlugin:
|
|
2184
|
+
return O({}, e, fn(n.plugins, !1, e));
|
|
2185
|
+
case E.enablePlugin:
|
|
2186
|
+
return O({}, e, fn(n.plugins, !0, e));
|
|
1813
2187
|
default:
|
|
1814
2188
|
return e;
|
|
1815
2189
|
}
|
|
1816
2190
|
};
|
|
1817
2191
|
}
|
|
1818
|
-
function
|
|
2192
|
+
function hn(t, e) {
|
|
1819
2193
|
return t.substring(e.length + 1, t.length);
|
|
1820
2194
|
}
|
|
1821
|
-
function
|
|
2195
|
+
function fn(t, e, n) {
|
|
1822
2196
|
return t.reduce(function(r, i) {
|
|
1823
|
-
return r[i] =
|
|
2197
|
+
return r[i] = O({}, n[i], { enabled: e }), r;
|
|
1824
2198
|
}, n);
|
|
1825
2199
|
}
|
|
1826
|
-
function
|
|
2200
|
+
function Bn(t) {
|
|
1827
2201
|
try {
|
|
1828
2202
|
return JSON.parse(JSON.stringify(t));
|
|
1829
2203
|
} catch {
|
|
1830
2204
|
}
|
|
1831
2205
|
return t;
|
|
1832
2206
|
}
|
|
1833
|
-
var
|
|
1834
|
-
function
|
|
1835
|
-
t === void 0 && (t =
|
|
2207
|
+
var Hi = { last: {}, history: [] };
|
|
2208
|
+
function Ji(t, e) {
|
|
2209
|
+
t === void 0 && (t = Hi);
|
|
1836
2210
|
var n = e.options, r = e.meta;
|
|
1837
|
-
if (e.type ===
|
|
1838
|
-
var i =
|
|
1839
|
-
return
|
|
2211
|
+
if (e.type === E.track) {
|
|
2212
|
+
var i = Bn(O({ event: e.event, properties: e.properties }, Object.keys(n).length && { options: n }, { meta: r }));
|
|
2213
|
+
return O({}, t, { last: i, history: t.history.concat(i) });
|
|
1840
2214
|
}
|
|
1841
2215
|
return t;
|
|
1842
2216
|
}
|
|
1843
|
-
var
|
|
1844
|
-
function
|
|
1845
|
-
t === void 0 && (t =
|
|
2217
|
+
var Vi = { actions: [] };
|
|
2218
|
+
function Yi(t, e) {
|
|
2219
|
+
t === void 0 && (t = Vi);
|
|
1846
2220
|
var n = e.payload;
|
|
1847
2221
|
switch (e.type) {
|
|
1848
2222
|
case "queue":
|
|
1849
2223
|
var r;
|
|
1850
|
-
return r = n && n.type && n.type ===
|
|
2224
|
+
return r = n && n.type && n.type === E.identify ? [e].concat(t.actions) : t.actions.concat(e), O({}, t, { actions: r });
|
|
1851
2225
|
case "dequeue":
|
|
1852
2226
|
return [];
|
|
1853
2227
|
default:
|
|
1854
2228
|
return t;
|
|
1855
2229
|
}
|
|
1856
2230
|
}
|
|
1857
|
-
var
|
|
1858
|
-
function
|
|
2231
|
+
var qn = /#.*$/;
|
|
2232
|
+
function Gi(t) {
|
|
1859
2233
|
var e = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);
|
|
1860
|
-
return "/" + (e && e[3] ? e[3].split("?")[0].replace(
|
|
2234
|
+
return "/" + (e && e[3] ? e[3].split("?")[0].replace(qn, "") : "");
|
|
1861
2235
|
}
|
|
1862
|
-
var
|
|
1863
|
-
if (t === void 0 && (t = {}), !
|
|
2236
|
+
var Qn, er, tr, nr, Bi = function(t) {
|
|
2237
|
+
if (t === void 0 && (t = {}), !Y)
|
|
1864
2238
|
return t;
|
|
1865
|
-
var e = document, n = e.title, r = e.referrer, i = window, o = i.location, a = i.innerWidth, s = i.innerHeight,
|
|
1866
|
-
var
|
|
1867
|
-
if (
|
|
1868
|
-
for (var
|
|
1869
|
-
if (
|
|
1870
|
-
return
|
|
2239
|
+
var e = document, n = e.title, r = e.referrer, i = window, o = i.location, a = i.innerWidth, s = i.innerHeight, m = o.hash, p = o.search, u = function(h) {
|
|
2240
|
+
var d = function() {
|
|
2241
|
+
if (Y) {
|
|
2242
|
+
for (var w, k = document.getElementsByTagName("link"), v = 0; w = k[v]; v++)
|
|
2243
|
+
if (w.getAttribute("rel") === "canonical")
|
|
2244
|
+
return w.getAttribute("href");
|
|
1871
2245
|
}
|
|
1872
2246
|
}();
|
|
1873
|
-
return
|
|
1874
|
-
}(
|
|
1875
|
-
return r && r !== "" && (c.referrer = r),
|
|
1876
|
-
},
|
|
1877
|
-
function
|
|
1878
|
-
t === void 0 && (t =
|
|
2247
|
+
return d ? d.match(/\?/) ? d : d + h : window.location.href.replace(qn, "");
|
|
2248
|
+
}(p), c = { title: n, url: u, path: Gi(u), hash: m, search: p, width: a, height: s };
|
|
2249
|
+
return r && r !== "" && (c.referrer = r), O({}, c, t);
|
|
2250
|
+
}, qi = { last: {}, history: [] };
|
|
2251
|
+
function Qi(t, e) {
|
|
2252
|
+
t === void 0 && (t = qi);
|
|
1879
2253
|
var n = e.options;
|
|
1880
|
-
if (e.type ===
|
|
1881
|
-
var r =
|
|
1882
|
-
return
|
|
2254
|
+
if (e.type === E.page) {
|
|
2255
|
+
var r = Bn(O({ properties: e.properties, meta: e.meta }, Object.keys(n).length && { options: n }));
|
|
2256
|
+
return O({}, t, { last: r, history: t.history.concat(r) });
|
|
1883
2257
|
}
|
|
1884
2258
|
return t;
|
|
1885
2259
|
}
|
|
1886
|
-
|
|
1887
|
-
if (!
|
|
2260
|
+
Qn = function() {
|
|
2261
|
+
if (!Y)
|
|
1888
2262
|
return !1;
|
|
1889
2263
|
var t = navigator.appVersion;
|
|
1890
2264
|
return ~t.indexOf("Win") ? "Windows" : ~t.indexOf("Mac") ? "MacOS" : ~t.indexOf("X11") ? "UNIX" : ~t.indexOf("Linux") ? "Linux" : "Unknown OS";
|
|
1891
|
-
}(),
|
|
1892
|
-
var
|
|
1893
|
-
function
|
|
1894
|
-
t === void 0 && (t =
|
|
2265
|
+
}(), er = Y ? document.referrer : null, tr = xi(), nr = Ci();
|
|
2266
|
+
var pn = { initialized: !1, sessionId: st(), app: null, version: null, debug: !1, offline: !!Y && !navigator.onLine, os: { name: Qn }, userAgent: Y ? navigator.userAgent : "node", library: { name: "analytics", version: "0.12.7" }, timezone: nr, locale: tr, campaign: {}, referrer: er };
|
|
2267
|
+
function eo(t, e) {
|
|
2268
|
+
t === void 0 && (t = pn);
|
|
1895
2269
|
var n = t.initialized, r = e.campaign;
|
|
1896
2270
|
switch (e.type) {
|
|
1897
|
-
case
|
|
1898
|
-
return
|
|
1899
|
-
case
|
|
1900
|
-
return
|
|
1901
|
-
case
|
|
1902
|
-
return
|
|
2271
|
+
case E.campaign:
|
|
2272
|
+
return O({}, t, { campaign: r });
|
|
2273
|
+
case E.offline:
|
|
2274
|
+
return O({}, t, { offline: !0 });
|
|
2275
|
+
case E.online:
|
|
2276
|
+
return O({}, t, { offline: !1 });
|
|
1903
2277
|
default:
|
|
1904
|
-
return n ? t :
|
|
2278
|
+
return n ? t : O({}, pn, t, { initialized: !0 });
|
|
1905
2279
|
}
|
|
1906
2280
|
}
|
|
1907
|
-
var
|
|
1908
|
-
function
|
|
1909
|
-
if (
|
|
2281
|
+
var to = ["plugins", "reducers", "storage"];
|
|
2282
|
+
function no(t, e, n) {
|
|
2283
|
+
if (Y) {
|
|
1910
2284
|
var r = window[(n ? "add" : "remove") + "EventListener"];
|
|
1911
2285
|
t.split(" ").forEach(function(i) {
|
|
1912
2286
|
r(i, e);
|
|
1913
2287
|
});
|
|
1914
2288
|
}
|
|
1915
2289
|
}
|
|
1916
|
-
function
|
|
1917
|
-
var e =
|
|
2290
|
+
function ro(t) {
|
|
2291
|
+
var e = no.bind(null, "online offline", function(n) {
|
|
1918
2292
|
return Promise.resolve(!navigator.onLine).then(t);
|
|
1919
2293
|
});
|
|
1920
2294
|
return e(!0), function(n) {
|
|
1921
2295
|
return e(!1);
|
|
1922
2296
|
};
|
|
1923
2297
|
}
|
|
1924
|
-
function
|
|
1925
|
-
return
|
|
2298
|
+
function rr() {
|
|
2299
|
+
return ye("analytics", []), function(t) {
|
|
1926
2300
|
return function(e, n, r) {
|
|
1927
2301
|
var i = t(e, n, r), o = i.dispatch;
|
|
1928
2302
|
return Object.assign(i, { dispatch: function(a) {
|
|
1929
|
-
return
|
|
2303
|
+
return Pe[Oe].analytics.push(a.action || a), o(a);
|
|
1930
2304
|
} });
|
|
1931
2305
|
};
|
|
1932
2306
|
};
|
|
1933
2307
|
}
|
|
1934
|
-
function
|
|
2308
|
+
function mn(t) {
|
|
1935
2309
|
return function() {
|
|
1936
|
-
return
|
|
2310
|
+
return Te(Te.apply(null, arguments), rr());
|
|
1937
2311
|
};
|
|
1938
2312
|
}
|
|
1939
|
-
function
|
|
1940
|
-
return t ?
|
|
2313
|
+
function vt(t) {
|
|
2314
|
+
return t ? Fn(t) ? t : [t] : [];
|
|
1941
2315
|
}
|
|
1942
|
-
function
|
|
2316
|
+
function gn(t, e, n) {
|
|
1943
2317
|
t === void 0 && (t = {});
|
|
1944
|
-
var r, i, o =
|
|
1945
|
-
return e && (
|
|
1946
|
-
for (var s,
|
|
1947
|
-
if (
|
|
1948
|
-
s =
|
|
2318
|
+
var r, i, o = st();
|
|
2319
|
+
return e && (Le[o] = (r = e, i = function(a) {
|
|
2320
|
+
for (var s, m = a || Array.prototype.slice.call(arguments), p = 0; p < m.length; p++)
|
|
2321
|
+
if (B(m[p])) {
|
|
2322
|
+
s = m[p];
|
|
1949
2323
|
break;
|
|
1950
2324
|
}
|
|
1951
2325
|
return s;
|
|
1952
2326
|
}(n), function(a) {
|
|
1953
2327
|
i && i(a), r(a);
|
|
1954
|
-
})),
|
|
2328
|
+
})), O({}, t, { rid: o, ts: (/* @__PURE__ */ new Date()).getTime() }, e ? { hasCallback: !0 } : {});
|
|
1955
2329
|
}
|
|
1956
|
-
function
|
|
2330
|
+
function io(t) {
|
|
1957
2331
|
t === void 0 && (t = {});
|
|
1958
|
-
var e = t.reducers || {}, n = t.initialUser || {}, r = (t.plugins || []).reduce(function(
|
|
1959
|
-
if (
|
|
1960
|
-
return
|
|
1961
|
-
if (
|
|
2332
|
+
var e = t.reducers || {}, n = t.initialUser || {}, r = (t.plugins || []).reduce(function(f, g) {
|
|
2333
|
+
if (B(g))
|
|
2334
|
+
return f.middlewares = f.middlewares.concat(g), f;
|
|
2335
|
+
if (g.NAMESPACE && (g.name = g.NAMESPACE), !g.name)
|
|
1962
2336
|
throw new Error("https://lytics.dev/errors/1");
|
|
1963
|
-
|
|
1964
|
-
var S =
|
|
1965
|
-
return
|
|
2337
|
+
g.config || (g.config = {});
|
|
2338
|
+
var S = g.EVENTS ? Object.keys(g.EVENTS).map(function(A) {
|
|
2339
|
+
return g.EVENTS[A];
|
|
1966
2340
|
}) : [];
|
|
1967
|
-
|
|
2341
|
+
f.pluginEnabled[g.name] = !(g.enabled === !1 || g.config.enabled === !1), delete g.enabled, g.methods && (f.methods[g.name] = Object.keys(g.methods).reduce(function(A, Z) {
|
|
1968
2342
|
var N;
|
|
1969
|
-
return
|
|
1970
|
-
for (var
|
|
1971
|
-
z[q] =
|
|
2343
|
+
return A[Z] = (N = g.methods[Z], function() {
|
|
2344
|
+
for (var R = Array.prototype.slice.call(arguments), z = new Array(N.length), q = 0; q < R.length; q++)
|
|
2345
|
+
z[q] = R[q];
|
|
1972
2346
|
return z[z.length] = b, N.apply({ instance: b }, z);
|
|
1973
|
-
}),
|
|
1974
|
-
}, {}), delete
|
|
1975
|
-
var
|
|
1976
|
-
if (
|
|
1977
|
-
throw new Error(
|
|
1978
|
-
return
|
|
2347
|
+
}), A;
|
|
2348
|
+
}, {}), delete g.methods);
|
|
2349
|
+
var C = Object.keys(g).concat(S), $ = new Set(f.events.concat(C));
|
|
2350
|
+
if (f.events = Array.from($), f.pluginsArray = f.pluginsArray.concat(g), f.plugins[g.name])
|
|
2351
|
+
throw new Error(g.name + "AlreadyLoaded");
|
|
2352
|
+
return f.plugins[g.name] = g, f.plugins[g.name].loaded || (f.plugins[g.name].loaded = function() {
|
|
1979
2353
|
return !0;
|
|
1980
|
-
}),
|
|
1981
|
-
}, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), i = t.storage ? t.storage : { getItem:
|
|
1982
|
-
return function(
|
|
1983
|
-
return S.getState("user")[
|
|
2354
|
+
}), f;
|
|
2355
|
+
}, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), i = t.storage ? t.storage : { getItem: ge, setItem: ye, removeItem: xe }, o = /* @__PURE__ */ function(f) {
|
|
2356
|
+
return function(g, S, C) {
|
|
2357
|
+
return S.getState("user")[g] || (C && X(C) && C[g] ? C[g] : nn(f)[g] || ge(Ot(g)) || null);
|
|
1984
2358
|
};
|
|
1985
|
-
}(i), a = r.plugins, s = r.events.filter(function(
|
|
1986
|
-
return !
|
|
1987
|
-
}).sort(),
|
|
1988
|
-
return !
|
|
1989
|
-
})),
|
|
2359
|
+
}(i), a = r.plugins, s = r.events.filter(function(f) {
|
|
2360
|
+
return !Et.includes(f);
|
|
2361
|
+
}).sort(), m = new Set(s.concat(Qe).filter(function(f) {
|
|
2362
|
+
return !Et.includes(f);
|
|
2363
|
+
})), p = Array.from(m).sort(), u = function() {
|
|
1990
2364
|
return a;
|
|
1991
|
-
}, c = new
|
|
2365
|
+
}, c = new Xi(), h = c.addMiddleware, d = c.removeMiddleware, w = c.dynamicMiddlewares, k = function() {
|
|
1992
2366
|
throw new Error("Abort disabled inListener");
|
|
1993
|
-
},
|
|
1994
|
-
_.anonymousId || (_.anonymousId =
|
|
1995
|
-
var
|
|
2367
|
+
}, v = $i(), I = nn(i), _ = O({}, I, n, v.an_uid ? { userId: v.an_uid } : {}, v.an_aid ? { anonymousId: v.an_aid } : {});
|
|
2368
|
+
_.anonymousId || (_.anonymousId = st());
|
|
2369
|
+
var y = O({ enable: function(f, g) {
|
|
1996
2370
|
return new Promise(function(S) {
|
|
1997
|
-
|
|
2371
|
+
j.dispatch({ type: E.enablePlugin, plugins: vt(f), _: { originalAction: E.enablePlugin } }, S, [g]);
|
|
1998
2372
|
});
|
|
1999
|
-
}, disable: function(
|
|
2373
|
+
}, disable: function(f, g) {
|
|
2000
2374
|
return new Promise(function(S) {
|
|
2001
|
-
|
|
2375
|
+
j.dispatch({ type: E.disablePlugin, plugins: vt(f), _: { originalAction: E.disablePlugin } }, S, [g]);
|
|
2002
2376
|
});
|
|
2003
|
-
} }, r.methods),
|
|
2377
|
+
} }, r.methods), l = !1, b = { identify: function(f, g, S, C) {
|
|
2004
2378
|
try {
|
|
2005
|
-
var
|
|
2006
|
-
|
|
2007
|
-
var
|
|
2379
|
+
var $ = re(f) ? f : null, A = X(f) ? f : g, Z = S || {}, N = b.user();
|
|
2380
|
+
ye(Ot(te), $);
|
|
2381
|
+
var R = $ || A.userId || o(te, b, A);
|
|
2008
2382
|
return Promise.resolve(new Promise(function(z) {
|
|
2009
|
-
|
|
2383
|
+
j.dispatch(O({ type: E.identifyStart, userId: R, traits: A || {}, options: Z, anonymousId: N.anonymousId }, N.id && N.id !== $ && { previousId: N.id }), z, [g, S, C]);
|
|
2010
2384
|
}));
|
|
2011
2385
|
} catch (z) {
|
|
2012
2386
|
return Promise.reject(z);
|
|
2013
2387
|
}
|
|
2014
|
-
}, track: function(
|
|
2388
|
+
}, track: function(f, g, S, C) {
|
|
2015
2389
|
try {
|
|
2016
|
-
var
|
|
2017
|
-
if (
|
|
2390
|
+
var $ = X(f) ? f.event : f;
|
|
2391
|
+
if (!$ || !re($))
|
|
2018
2392
|
throw new Error("EventMissing");
|
|
2019
|
-
var
|
|
2393
|
+
var A = X(f) ? f : g || {}, Z = X(S) ? S : {};
|
|
2020
2394
|
return Promise.resolve(new Promise(function(N) {
|
|
2021
|
-
|
|
2395
|
+
j.dispatch({ type: E.trackStart, event: $, properties: A, options: Z, userId: o(te, b, g), anonymousId: o(ke, b, g) }, N, [g, S, C]);
|
|
2022
2396
|
}));
|
|
2023
2397
|
} catch (N) {
|
|
2024
2398
|
return Promise.reject(N);
|
|
2025
2399
|
}
|
|
2026
|
-
}, page: function(
|
|
2400
|
+
}, page: function(f, g, S) {
|
|
2027
2401
|
try {
|
|
2028
|
-
var
|
|
2029
|
-
return Promise.resolve(new Promise(function(
|
|
2030
|
-
|
|
2402
|
+
var C = X(f) ? f : {}, $ = X(g) ? g : {};
|
|
2403
|
+
return Promise.resolve(new Promise(function(A) {
|
|
2404
|
+
j.dispatch({ type: E.pageStart, properties: Bi(C), options: $, userId: o(te, b, C), anonymousId: o(ke, b, C) }, A, [f, g, S]);
|
|
2031
2405
|
}));
|
|
2032
|
-
} catch (
|
|
2033
|
-
return Promise.reject(
|
|
2406
|
+
} catch (A) {
|
|
2407
|
+
return Promise.reject(A);
|
|
2034
2408
|
}
|
|
2035
|
-
}, user: function(
|
|
2036
|
-
if (
|
|
2409
|
+
}, user: function(f) {
|
|
2410
|
+
if (f === te || f === "id")
|
|
2037
2411
|
return o(te, b);
|
|
2038
|
-
if (
|
|
2039
|
-
return o(
|
|
2040
|
-
var
|
|
2041
|
-
return
|
|
2042
|
-
}, reset: function(
|
|
2043
|
-
return new Promise(function(
|
|
2044
|
-
|
|
2412
|
+
if (f === ke || f === "anonId")
|
|
2413
|
+
return o(ke, b);
|
|
2414
|
+
var g = b.getState("user");
|
|
2415
|
+
return f ? Yt(g, f) : g;
|
|
2416
|
+
}, reset: function(f) {
|
|
2417
|
+
return new Promise(function(g) {
|
|
2418
|
+
j.dispatch({ type: E.resetStart }, g, f);
|
|
2045
2419
|
});
|
|
2046
|
-
}, ready: function(
|
|
2047
|
-
return
|
|
2048
|
-
|
|
2420
|
+
}, ready: function(f) {
|
|
2421
|
+
return l && f({ plugins: y, instance: b }), b.on(E.ready, function(g) {
|
|
2422
|
+
f(g), l = !0;
|
|
2049
2423
|
});
|
|
2050
|
-
}, on: function(
|
|
2051
|
-
if (!
|
|
2424
|
+
}, on: function(f, g) {
|
|
2425
|
+
if (!f || !B(g))
|
|
2052
2426
|
return !1;
|
|
2053
|
-
if (
|
|
2054
|
-
throw new Error(".on disabled for " +
|
|
2427
|
+
if (f === E.bootstrap)
|
|
2428
|
+
throw new Error(".on disabled for " + f);
|
|
2055
2429
|
var S = /Start$|Start:/;
|
|
2056
|
-
if (
|
|
2057
|
-
var
|
|
2058
|
-
return function(
|
|
2430
|
+
if (f === "*") {
|
|
2431
|
+
var C = function(N) {
|
|
2432
|
+
return function(R) {
|
|
2059
2433
|
return function(z) {
|
|
2060
|
-
return z.type.match(S) &&
|
|
2434
|
+
return z.type.match(S) && g({ payload: z, instance: b, plugins: a }), R(z);
|
|
2061
2435
|
};
|
|
2062
2436
|
};
|
|
2063
|
-
},
|
|
2064
|
-
return function(
|
|
2437
|
+
}, $ = function(N) {
|
|
2438
|
+
return function(R) {
|
|
2065
2439
|
return function(z) {
|
|
2066
|
-
return z.type.match(S) ||
|
|
2440
|
+
return z.type.match(S) || g({ payload: z, instance: b, plugins: a }), R(z);
|
|
2067
2441
|
};
|
|
2068
2442
|
};
|
|
2069
2443
|
};
|
|
2070
|
-
return
|
|
2071
|
-
|
|
2444
|
+
return h(C, Ve), h($, Ye), function() {
|
|
2445
|
+
d(C, Ve), d($, Ye);
|
|
2072
2446
|
};
|
|
2073
2447
|
}
|
|
2074
|
-
var
|
|
2075
|
-
return function(
|
|
2448
|
+
var A = f.match(S) ? Ve : Ye, Z = function(N) {
|
|
2449
|
+
return function(R) {
|
|
2076
2450
|
return function(z) {
|
|
2077
|
-
return z.type ===
|
|
2451
|
+
return z.type === f && g({ payload: z, instance: b, plugins: a, abort: k }), R(z);
|
|
2078
2452
|
};
|
|
2079
2453
|
};
|
|
2080
2454
|
};
|
|
2081
|
-
return
|
|
2082
|
-
return
|
|
2455
|
+
return h(Z, A), function() {
|
|
2456
|
+
return d(Z, A);
|
|
2083
2457
|
};
|
|
2084
|
-
}, once: function(
|
|
2085
|
-
if (!
|
|
2458
|
+
}, once: function(f, g) {
|
|
2459
|
+
if (!f || !B(g))
|
|
2086
2460
|
return !1;
|
|
2087
|
-
if (
|
|
2088
|
-
throw new Error(".once disabled for " +
|
|
2089
|
-
var S = b.on(
|
|
2090
|
-
|
|
2461
|
+
if (f === E.bootstrap)
|
|
2462
|
+
throw new Error(".once disabled for " + f);
|
|
2463
|
+
var S = b.on(f, function(C) {
|
|
2464
|
+
g({ payload: C.payload, instance: b, plugins: a, abort: k }), S();
|
|
2091
2465
|
});
|
|
2092
2466
|
return S;
|
|
2093
|
-
}, getState: function(
|
|
2094
|
-
var
|
|
2095
|
-
return
|
|
2096
|
-
}, dispatch: function(
|
|
2097
|
-
var
|
|
2098
|
-
if (
|
|
2099
|
-
throw new Error("reserved action " +
|
|
2100
|
-
var S =
|
|
2101
|
-
|
|
2102
|
-
}, enablePlugin:
|
|
2103
|
-
|
|
2104
|
-
}, removeItem: function(
|
|
2105
|
-
|
|
2106
|
-
} }, setAnonymousId: function(
|
|
2107
|
-
b.storage.setItem(ie,
|
|
2108
|
-
}, events: { core:
|
|
2109
|
-
return function(
|
|
2467
|
+
}, getState: function(f) {
|
|
2468
|
+
var g = j.getState();
|
|
2469
|
+
return f ? Yt(g, f) : Object.assign({}, g);
|
|
2470
|
+
}, dispatch: function(f) {
|
|
2471
|
+
var g = re(f) ? { type: f } : f;
|
|
2472
|
+
if (Qe.includes(g.type))
|
|
2473
|
+
throw new Error("reserved action " + g.type);
|
|
2474
|
+
var S = O({}, g, { _: O({ originalAction: g.type }, f._ || {}) });
|
|
2475
|
+
j.dispatch(S);
|
|
2476
|
+
}, enablePlugin: y.enable, disablePlugin: y.disable, plugins: y, storage: { getItem: i.getItem, setItem: function(f, g, S) {
|
|
2477
|
+
j.dispatch({ type: E.setItemStart, key: f, value: g, options: S });
|
|
2478
|
+
}, removeItem: function(f, g) {
|
|
2479
|
+
j.dispatch({ type: E.removeItemStart, key: f, options: g });
|
|
2480
|
+
} }, setAnonymousId: function(f, g) {
|
|
2481
|
+
b.storage.setItem(ie, f, g);
|
|
2482
|
+
}, events: { core: Qe, plugins: s } }, T = r.middlewares.concat([function(f) {
|
|
2483
|
+
return function(g) {
|
|
2110
2484
|
return function(S) {
|
|
2111
|
-
return S.meta || (S.meta =
|
|
2485
|
+
return S.meta || (S.meta = gn()), g(S);
|
|
2112
2486
|
};
|
|
2113
2487
|
};
|
|
2114
|
-
},
|
|
2115
|
-
if (
|
|
2488
|
+
}, w(Ve), Ki(b, u, { all: p, plugins: s }), Mi(i), Di(b), Ri(b), w(Ye)]), P = { context: eo, user: Ui(i), page: Qi, track: Ji, plugins: Fi(u), queue: Yi }, x = Te, D = Te;
|
|
2489
|
+
if (Y && t.debug) {
|
|
2116
2490
|
var L = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
|
2117
2491
|
L && (x = L({ trace: !0, traceLimit: 25 })), D = function() {
|
|
2118
|
-
return arguments.length === 0 ?
|
|
2492
|
+
return arguments.length === 0 ? rr() : X(typeof arguments[0]) ? mn() : mn().apply(null, arguments);
|
|
2119
2493
|
};
|
|
2120
2494
|
}
|
|
2121
|
-
var
|
|
2122
|
-
return Object.keys(
|
|
2123
|
-
return
|
|
2495
|
+
var H, U = function(f) {
|
|
2496
|
+
return Object.keys(f).reduce(function(g, S) {
|
|
2497
|
+
return to.includes(S) || (g[S] = f[S]), g;
|
|
2124
2498
|
}, {});
|
|
2125
|
-
}(t),
|
|
2126
|
-
var S =
|
|
2127
|
-
return
|
|
2128
|
-
}, {}),
|
|
2129
|
-
for (var
|
|
2130
|
-
var
|
|
2131
|
-
typeof
|
|
2499
|
+
}(t), J = r.pluginsArray.reduce(function(f, g) {
|
|
2500
|
+
var S = g.name, C = g.config, $ = g.loaded, A = r.pluginEnabled[S];
|
|
2501
|
+
return f[S] = { enabled: A, initialized: !!A && !g.initialize, loaded: !!$({ config: C }), config: C }, f;
|
|
2502
|
+
}, {}), W = { context: U, user: _, plugins: J }, j = Jn(function(f) {
|
|
2503
|
+
for (var g = Object.keys(f), S = {}, C = 0; C < g.length; C++) {
|
|
2504
|
+
var $ = g[C];
|
|
2505
|
+
typeof f[$] === ne && (S[$] = f[$]);
|
|
2132
2506
|
}
|
|
2133
|
-
var
|
|
2507
|
+
var A, Z = Object.keys(S);
|
|
2134
2508
|
try {
|
|
2135
2509
|
(function(N) {
|
|
2136
|
-
Object.keys(N).forEach(function(
|
|
2137
|
-
var z = N[
|
|
2138
|
-
if (typeof z(void 0, { type: "@@redux/INIT" }) === ee || typeof z(void 0, { type:
|
|
2139
|
-
throw new Error("reducer " +
|
|
2510
|
+
Object.keys(N).forEach(function(R) {
|
|
2511
|
+
var z = N[R];
|
|
2512
|
+
if (typeof z(void 0, { type: "@@redux/INIT" }) === ee || typeof z(void 0, { type: zi }) === ee)
|
|
2513
|
+
throw new Error("reducer " + R + " " + ee);
|
|
2140
2514
|
});
|
|
2141
2515
|
})(S);
|
|
2142
2516
|
} catch (N) {
|
|
2143
|
-
|
|
2517
|
+
A = N;
|
|
2144
2518
|
}
|
|
2145
|
-
return function(N,
|
|
2146
|
-
if (N === void 0 && (N = {}),
|
|
2147
|
-
throw
|
|
2148
|
-
for (var z = !1, q = {},
|
|
2149
|
-
var
|
|
2150
|
-
if (typeof
|
|
2151
|
-
var
|
|
2152
|
-
throw new Error(
|
|
2519
|
+
return function(N, R) {
|
|
2520
|
+
if (N === void 0 && (N = {}), A)
|
|
2521
|
+
throw A;
|
|
2522
|
+
for (var z = !1, q = {}, Ae = 0; Ae < Z.length; Ae++) {
|
|
2523
|
+
var Me = Z[Ae], Ut = N[Me], lt = (0, S[Me])(Ut, R);
|
|
2524
|
+
if (typeof lt === ee) {
|
|
2525
|
+
var mr = Ni(Me, R);
|
|
2526
|
+
throw new Error(mr);
|
|
2153
2527
|
}
|
|
2154
|
-
q[
|
|
2528
|
+
q[Me] = lt, z = z || lt !== Ut;
|
|
2155
2529
|
}
|
|
2156
2530
|
return z ? q : N;
|
|
2157
2531
|
};
|
|
2158
|
-
}(
|
|
2159
|
-
|
|
2160
|
-
var
|
|
2161
|
-
return
|
|
2532
|
+
}(O({}, P, e)), W, D(x(Li.apply(void 0, T))));
|
|
2533
|
+
j.dispatch = (H = j.dispatch, function(f, g, S) {
|
|
2534
|
+
var C = O({}, f, { meta: gn(f.meta, g, vt(S)) });
|
|
2535
|
+
return H.apply(null, [C]);
|
|
2162
2536
|
});
|
|
2163
2537
|
var K = Object.keys(a);
|
|
2164
|
-
|
|
2165
|
-
var M = K.filter(function(
|
|
2166
|
-
return r.pluginEnabled[
|
|
2167
|
-
}),
|
|
2168
|
-
return !r.pluginEnabled[
|
|
2538
|
+
j.dispatch({ type: E.bootstrap, plugins: K, config: U, params: v, user: _, initialUser: n, persistedUser: I });
|
|
2539
|
+
var M = K.filter(function(f) {
|
|
2540
|
+
return r.pluginEnabled[f];
|
|
2541
|
+
}), $e = K.filter(function(f) {
|
|
2542
|
+
return !r.pluginEnabled[f];
|
|
2169
2543
|
});
|
|
2170
|
-
return
|
|
2171
|
-
var S =
|
|
2172
|
-
S &&
|
|
2173
|
-
}),
|
|
2174
|
-
|
|
2175
|
-
}), function(
|
|
2544
|
+
return j.dispatch({ type: E.registerPlugins, plugins: K, enabled: r.pluginEnabled }), r.pluginsArray.map(function(f, g) {
|
|
2545
|
+
var S = f.bootstrap, C = f.config, $ = f.name;
|
|
2546
|
+
S && B(S) && S({ instance: b, config: C, payload: f }), j.dispatch({ type: E.registerPluginType($), name: $, enabled: r.pluginEnabled[$], plugin: f }), r.pluginsArray.length === g + 1 && j.dispatch({ type: E.initializeStart, plugins: M, disabled: $e });
|
|
2547
|
+
}), ro(function(f) {
|
|
2548
|
+
j.dispatch({ type: f ? E.offline : E.online });
|
|
2549
|
+
}), function(f, g, S) {
|
|
2176
2550
|
setInterval(function() {
|
|
2177
|
-
return
|
|
2551
|
+
return Yn(f, g, S);
|
|
2178
2552
|
}, 3e3);
|
|
2179
|
-
}(
|
|
2553
|
+
}(j, u, b), b;
|
|
2180
2554
|
}
|
|
2181
|
-
var
|
|
2182
|
-
function
|
|
2183
|
-
return
|
|
2555
|
+
var Ve = "before", Ye = "after", Ue = "cookie", le = ar(), ir = ct, oo = ct;
|
|
2556
|
+
function or(t) {
|
|
2557
|
+
return le ? ct(t, "", -1) : xe(t);
|
|
2184
2558
|
}
|
|
2185
|
-
function
|
|
2186
|
-
if (
|
|
2187
|
-
return
|
|
2559
|
+
function ar() {
|
|
2560
|
+
if (le !== void 0)
|
|
2561
|
+
return le;
|
|
2188
2562
|
var t = "cookiecookie";
|
|
2189
2563
|
try {
|
|
2190
|
-
|
|
2564
|
+
ct(t, t), le = document.cookie.indexOf(t) !== -1, or(t);
|
|
2191
2565
|
} catch {
|
|
2192
|
-
|
|
2566
|
+
le = !1;
|
|
2193
2567
|
}
|
|
2194
|
-
return
|
|
2568
|
+
return le;
|
|
2195
2569
|
}
|
|
2196
|
-
function
|
|
2570
|
+
function ct(t, e, n, r, i, o) {
|
|
2197
2571
|
if (typeof window < "u") {
|
|
2198
2572
|
var a = arguments.length > 1;
|
|
2199
|
-
return
|
|
2200
|
-
}
|
|
2201
|
-
}
|
|
2202
|
-
var
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
var
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
function
|
|
2573
|
+
return le === !1 && (a ? ye(t, e) : ge(t)), a ? document.cookie = t + "=" + encodeURIComponent(e) + (n ? "; expires=" + new Date(+/* @__PURE__ */ new Date() + 1e3 * n).toUTCString() + (r ? "; path=" + r : "") + (i ? "; domain=" + i : "") + (o ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + t + "=")[1] || "").split(";")[0]);
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
var Re = "localStorage", ao = Ct.bind(null, "localStorage");
|
|
2577
|
+
Ce("localStorage", "getItem", ge);
|
|
2578
|
+
Ce("localStorage", "setItem", ye);
|
|
2579
|
+
Ce("localStorage", "removeItem", xe);
|
|
2580
|
+
var We = "sessionStorage", so = Ct.bind(null, "sessionStorage");
|
|
2581
|
+
Ce("sessionStorage", "getItem", ge);
|
|
2582
|
+
Ce("sessionStorage", "setItem", ye);
|
|
2583
|
+
Ce("sessionStorage", "removeItem", xe);
|
|
2584
|
+
function Se(t) {
|
|
2211
2585
|
var e = t;
|
|
2212
2586
|
try {
|
|
2213
2587
|
if ((e = JSON.parse(t)) === "true")
|
|
2214
2588
|
return !0;
|
|
2215
2589
|
if (e === "false")
|
|
2216
2590
|
return !1;
|
|
2217
|
-
if (
|
|
2591
|
+
if (X(e))
|
|
2218
2592
|
return e;
|
|
2219
2593
|
parseFloat(e) === e && (e = parseFloat(e));
|
|
2220
2594
|
} catch {
|
|
@@ -2222,57 +2596,57 @@ function ke(t) {
|
|
|
2222
2596
|
if (e !== null && e !== "")
|
|
2223
2597
|
return e;
|
|
2224
2598
|
}
|
|
2225
|
-
var
|
|
2226
|
-
function
|
|
2599
|
+
var co = ao(), uo = so(), lo = ar();
|
|
2600
|
+
function sr(t, e) {
|
|
2227
2601
|
if (t) {
|
|
2228
|
-
var n =
|
|
2229
|
-
if (r && !
|
|
2602
|
+
var n = $t(e), r = !Lt(n), i = At(n) ? Se(localStorage.getItem(t)) : void 0;
|
|
2603
|
+
if (r && !be(i))
|
|
2230
2604
|
return i;
|
|
2231
|
-
var o =
|
|
2605
|
+
var o = zt(n) ? Se(ir(t)) : void 0;
|
|
2232
2606
|
if (r && o)
|
|
2233
2607
|
return o;
|
|
2234
|
-
var a =
|
|
2608
|
+
var a = Nt(n) ? Se(sessionStorage.getItem(t)) : void 0;
|
|
2235
2609
|
if (r && a)
|
|
2236
2610
|
return a;
|
|
2237
|
-
var s =
|
|
2611
|
+
var s = ge(t);
|
|
2238
2612
|
return r ? s : { localStorage: i, sessionStorage: a, cookie: o, global: s };
|
|
2239
2613
|
}
|
|
2240
2614
|
}
|
|
2241
|
-
function
|
|
2242
|
-
if (t && !
|
|
2243
|
-
var r = {}, i =
|
|
2244
|
-
return
|
|
2615
|
+
function ho(t, e, n) {
|
|
2616
|
+
if (t && !be(e)) {
|
|
2617
|
+
var r = {}, i = $t(n), o = JSON.stringify(e), a = !Lt(i);
|
|
2618
|
+
return At(i) && (r[Re] = Ge(Re, e, Se(localStorage.getItem(t))), localStorage.setItem(t, o), a) ? r[Re] : zt(i) && (r[Ue] = Ge(Ue, e, Se(ir(t))), oo(t, o), a) ? r[Ue] : Nt(i) && (r[We] = Ge(We, e, Se(sessionStorage.getItem(t))), sessionStorage.setItem(t, o), a) ? r[We] : (r[De] = Ge(De, e, ge(t)), ye(t, e), a ? r[De] : r);
|
|
2245
2619
|
}
|
|
2246
2620
|
}
|
|
2247
|
-
function
|
|
2621
|
+
function fo(t, e) {
|
|
2248
2622
|
if (t) {
|
|
2249
|
-
var n =
|
|
2250
|
-
return !
|
|
2623
|
+
var n = $t(e), r = sr(t, Kn), i = {};
|
|
2624
|
+
return !be(r.localStorage) && At(n) && (localStorage.removeItem(t), i[Re] = r.localStorage), !be(r.cookie) && zt(n) && (or(t), i[Ue] = r.cookie), !be(r.sessionStorage) && Nt(n) && (sessionStorage.removeItem(t), i[We] = r.sessionStorage), !be(r.global) && ut(n, De) && (xe(t), i[De] = r.global), i;
|
|
2251
2625
|
}
|
|
2252
2626
|
}
|
|
2253
|
-
function
|
|
2254
|
-
return t ? re(t) ? t : t.storage :
|
|
2627
|
+
function $t(t) {
|
|
2628
|
+
return t ? re(t) ? t : t.storage : Zn;
|
|
2255
2629
|
}
|
|
2256
|
-
function
|
|
2257
|
-
return
|
|
2630
|
+
function At(t) {
|
|
2631
|
+
return co && ut(t, Re);
|
|
2258
2632
|
}
|
|
2259
|
-
function
|
|
2260
|
-
return
|
|
2633
|
+
function zt(t) {
|
|
2634
|
+
return lo && ut(t, Ue);
|
|
2261
2635
|
}
|
|
2262
|
-
function
|
|
2263
|
-
return
|
|
2636
|
+
function Nt(t) {
|
|
2637
|
+
return uo && ut(t, We);
|
|
2264
2638
|
}
|
|
2265
|
-
function
|
|
2266
|
-
return t ===
|
|
2639
|
+
function Lt(t) {
|
|
2640
|
+
return t === Kn || t === "all";
|
|
2267
2641
|
}
|
|
2268
|
-
function
|
|
2269
|
-
return t ===
|
|
2642
|
+
function ut(t, e) {
|
|
2643
|
+
return t === Zn || t === e || Lt(t);
|
|
2270
2644
|
}
|
|
2271
|
-
function
|
|
2645
|
+
function Ge(t, e, n) {
|
|
2272
2646
|
return { location: t, current: e, previous: n };
|
|
2273
2647
|
}
|
|
2274
|
-
var
|
|
2275
|
-
function
|
|
2648
|
+
var po = { setItem: ho, getItem: sr, removeItem: fo };
|
|
2649
|
+
function mo(t, e, n) {
|
|
2276
2650
|
return e in t ? Object.defineProperty(t, e, {
|
|
2277
2651
|
value: n,
|
|
2278
2652
|
enumerable: !0,
|
|
@@ -2280,7 +2654,7 @@ function $i(t, e, n) {
|
|
|
2280
2654
|
writable: !0
|
|
2281
2655
|
}) : t[e] = n, t;
|
|
2282
2656
|
}
|
|
2283
|
-
function
|
|
2657
|
+
function yn(t, e) {
|
|
2284
2658
|
var n = Object.keys(t);
|
|
2285
2659
|
if (Object.getOwnPropertySymbols) {
|
|
2286
2660
|
var r = Object.getOwnPropertySymbols(t);
|
|
@@ -2290,24 +2664,24 @@ function un(t, e) {
|
|
|
2290
2664
|
}
|
|
2291
2665
|
return n;
|
|
2292
2666
|
}
|
|
2293
|
-
function
|
|
2667
|
+
function vn(t) {
|
|
2294
2668
|
for (var e = 1; e < arguments.length; e++) {
|
|
2295
2669
|
var n = arguments[e] != null ? arguments[e] : {};
|
|
2296
|
-
e % 2 ?
|
|
2297
|
-
|
|
2298
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) :
|
|
2670
|
+
e % 2 ? yn(Object(n), !0).forEach(function(r) {
|
|
2671
|
+
mo(t, r, n[r]);
|
|
2672
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : yn(Object(n)).forEach(function(r) {
|
|
2299
2673
|
Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
|
|
2300
2674
|
});
|
|
2301
2675
|
}
|
|
2302
2676
|
return t;
|
|
2303
2677
|
}
|
|
2304
|
-
function
|
|
2678
|
+
function go() {
|
|
2305
2679
|
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = {
|
|
2306
|
-
storage:
|
|
2680
|
+
storage: po
|
|
2307
2681
|
};
|
|
2308
|
-
return
|
|
2682
|
+
return io(vn(vn({}, e), t));
|
|
2309
2683
|
}
|
|
2310
|
-
function
|
|
2684
|
+
function yo(t, e) {
|
|
2311
2685
|
e = e || {};
|
|
2312
2686
|
var n, r, i = [], o = e.max || 1 / 0;
|
|
2313
2687
|
function a() {
|
|
@@ -2318,75 +2692,75 @@ function Ni(t, e) {
|
|
|
2318
2692
|
}
|
|
2319
2693
|
return s(), {
|
|
2320
2694
|
flush: a,
|
|
2321
|
-
push: function(
|
|
2322
|
-
return r = i.push(
|
|
2695
|
+
push: function(m) {
|
|
2696
|
+
return r = i.push(m), r >= o && a(), r;
|
|
2323
2697
|
},
|
|
2324
2698
|
size: function() {
|
|
2325
2699
|
return i.length;
|
|
2326
2700
|
},
|
|
2327
|
-
end: function(
|
|
2328
|
-
|
|
2701
|
+
end: function(m) {
|
|
2702
|
+
m && a(), clearInterval(n);
|
|
2329
2703
|
}
|
|
2330
2704
|
};
|
|
2331
2705
|
}
|
|
2332
|
-
const
|
|
2333
|
-
function
|
|
2706
|
+
const cr = "@sesamy/sesamy-js", ur = "1.0.4";
|
|
2707
|
+
function vo(t) {
|
|
2334
2708
|
if (!(typeof window > "u")) {
|
|
2335
2709
|
var e = window, n = e.addEventListener, r = e.history, i = e.location, o = i.pathname;
|
|
2336
2710
|
n("popstate", function() {
|
|
2337
2711
|
return t(i.pathname);
|
|
2338
2712
|
}), ["push", "replace"].map(function(a) {
|
|
2339
|
-
var s = "".concat(a, "State"),
|
|
2713
|
+
var s = "".concat(a, "State"), m = r[s];
|
|
2340
2714
|
r[s] = function() {
|
|
2341
|
-
var
|
|
2715
|
+
var p = arguments, u = bo(arguments[2]);
|
|
2342
2716
|
return o !== u && (o = u, setTimeout(function() {
|
|
2343
|
-
return t(
|
|
2344
|
-
}, 0)),
|
|
2717
|
+
return t(p[2]);
|
|
2718
|
+
}, 0)), m.apply(r, arguments);
|
|
2345
2719
|
};
|
|
2346
2720
|
});
|
|
2347
2721
|
}
|
|
2348
2722
|
}
|
|
2349
|
-
function
|
|
2723
|
+
function wo(t, e) {
|
|
2350
2724
|
var n = t.indexOf(e);
|
|
2351
2725
|
return n > -1 ? t.slice(0, n) : t;
|
|
2352
2726
|
}
|
|
2353
|
-
function
|
|
2727
|
+
function bo(t) {
|
|
2354
2728
|
return ["#", "?"].forEach(function(e) {
|
|
2355
|
-
return t =
|
|
2729
|
+
return t = wo(t, e);
|
|
2356
2730
|
}), t;
|
|
2357
2731
|
}
|
|
2358
|
-
function
|
|
2359
|
-
|
|
2360
|
-
|
|
2732
|
+
function ko() {
|
|
2733
|
+
vo(() => {
|
|
2734
|
+
ce.page();
|
|
2361
2735
|
});
|
|
2362
2736
|
}
|
|
2363
|
-
var
|
|
2364
|
-
function
|
|
2737
|
+
var wn = "EventListener";
|
|
2738
|
+
function Io(t) {
|
|
2365
2739
|
return function(e, n, r, i) {
|
|
2366
|
-
var o = r ||
|
|
2367
|
-
if (!
|
|
2740
|
+
var o = r || wi, a = i || !1;
|
|
2741
|
+
if (!Y)
|
|
2368
2742
|
return o;
|
|
2369
|
-
var s =
|
|
2370
|
-
if (!
|
|
2743
|
+
var s = nt(n), m = nt(e, !0);
|
|
2744
|
+
if (!m.length)
|
|
2371
2745
|
throw new Error("noElements");
|
|
2372
2746
|
if (!s.length)
|
|
2373
2747
|
throw new Error("noEvent");
|
|
2374
|
-
var
|
|
2748
|
+
var p = [];
|
|
2375
2749
|
return function u(c) {
|
|
2376
|
-
c && (
|
|
2377
|
-
for (var
|
|
2378
|
-
var
|
|
2379
|
-
|
|
2380
|
-
for (var
|
|
2381
|
-
|
|
2750
|
+
c && (p = []);
|
|
2751
|
+
for (var h = c ? "add" + wn : "remove" + wn, d = 0; d < m.length; d++) {
|
|
2752
|
+
var w = m[d];
|
|
2753
|
+
p[d] = c ? a && a.once ? _o(o) : o : p[d] || o;
|
|
2754
|
+
for (var k = 0; k < s.length; k++)
|
|
2755
|
+
w[h] ? w["on" + s[k]] = c ? p[d] : null : w[h](s[k], p[d], a);
|
|
2382
2756
|
}
|
|
2383
2757
|
return u.bind(null, !c);
|
|
2384
2758
|
}(t);
|
|
2385
2759
|
};
|
|
2386
2760
|
}
|
|
2387
|
-
function
|
|
2761
|
+
function nt(t, e) {
|
|
2388
2762
|
if (re(t))
|
|
2389
|
-
return e ?
|
|
2763
|
+
return e ? nt(document.querySelectorAll(t)) : (n = t).split(n.indexOf(",") > -1 ? "," : " ").map(function(a) {
|
|
2390
2764
|
return a.trim();
|
|
2391
2765
|
});
|
|
2392
2766
|
var n;
|
|
@@ -2395,31 +2769,31 @@ function Be(t, e) {
|
|
|
2395
2769
|
r[i] = t[i];
|
|
2396
2770
|
return r;
|
|
2397
2771
|
}
|
|
2398
|
-
var o =
|
|
2772
|
+
var o = ji(t);
|
|
2399
2773
|
return e ? o.map(function(a) {
|
|
2400
|
-
return re(a) ?
|
|
2774
|
+
return re(a) ? nt(a, !0) : a;
|
|
2401
2775
|
}).flat() : o;
|
|
2402
2776
|
}
|
|
2403
|
-
function
|
|
2777
|
+
function _o(t, e) {
|
|
2404
2778
|
var n;
|
|
2405
2779
|
return function() {
|
|
2406
2780
|
return t && (n = t.apply(e || this, arguments), t = null), n;
|
|
2407
2781
|
};
|
|
2408
2782
|
}
|
|
2409
|
-
var
|
|
2410
|
-
function
|
|
2411
|
-
return
|
|
2783
|
+
var wt = Io("Event");
|
|
2784
|
+
function lr(t, e) {
|
|
2785
|
+
return Y && B(window[t]) ? (n = window[t], r = e, (i = window) === void 0 && (i = null), B(n) ? function() {
|
|
2412
2786
|
n.apply(i, arguments), r.apply(i, arguments);
|
|
2413
2787
|
} : r) : window[t] = e;
|
|
2414
2788
|
var n, r, i;
|
|
2415
2789
|
}
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
var
|
|
2419
|
-
function
|
|
2420
|
-
if (
|
|
2790
|
+
lr.bind(null, "onerror");
|
|
2791
|
+
lr.bind(null, "onload");
|
|
2792
|
+
var dr = typeof window > "u", bn = "hidden";
|
|
2793
|
+
function So(t) {
|
|
2794
|
+
if (dr)
|
|
2421
2795
|
return !1;
|
|
2422
|
-
var e =
|
|
2796
|
+
var e = Eo(), n = "".concat(e.replace(/[H|h]idden/, ""), "visibilitychange"), r = function() {
|
|
2423
2797
|
return t(!!document[e]);
|
|
2424
2798
|
}, i = function() {
|
|
2425
2799
|
return document.addEventListener(n, r);
|
|
@@ -2428,31 +2802,31 @@ function Wi(t) {
|
|
|
2428
2802
|
return document.removeEventListener(n, r), i;
|
|
2429
2803
|
};
|
|
2430
2804
|
}
|
|
2431
|
-
function
|
|
2805
|
+
function Eo() {
|
|
2432
2806
|
var t = ["webkit", "moz", "ms", "o"];
|
|
2433
|
-
return
|
|
2807
|
+
return dr || bn in document ? bn : t.reduce(function(e, n) {
|
|
2434
2808
|
var r = n + "Hidden";
|
|
2435
2809
|
return !e && r in document ? r : e;
|
|
2436
2810
|
}, null);
|
|
2437
2811
|
}
|
|
2438
|
-
var
|
|
2439
|
-
function
|
|
2812
|
+
var Oo = ["mousemove", "mousedown", "touchmove", "touchstart", "touchend", "keydown"];
|
|
2813
|
+
function Po(t, e) {
|
|
2440
2814
|
e === void 0 && (e = {});
|
|
2441
2815
|
var n = /* @__PURE__ */ function(a, s) {
|
|
2442
|
-
var
|
|
2816
|
+
var m = this, p = !1;
|
|
2443
2817
|
return function(u) {
|
|
2444
|
-
|
|
2445
|
-
return
|
|
2818
|
+
p || (a.call(m, u), p = !0, setTimeout(function() {
|
|
2819
|
+
return p = !1;
|
|
2446
2820
|
}, s));
|
|
2447
2821
|
};
|
|
2448
2822
|
}(t, e.throttle || 1e4), r = [];
|
|
2449
2823
|
function i() {
|
|
2450
|
-
var a =
|
|
2824
|
+
var a = So(function(s) {
|
|
2451
2825
|
s || n({ type: "tabVisible" });
|
|
2452
2826
|
});
|
|
2453
|
-
return r = [a].concat(
|
|
2454
|
-
return
|
|
2455
|
-
})).concat(
|
|
2827
|
+
return r = [a].concat(Oo.map(function(s) {
|
|
2828
|
+
return wt(document, s, n);
|
|
2829
|
+
})).concat(wt(window, "load", n)).concat(wt(window, "scroll", n, { capture: !0, passive: !0 })), o;
|
|
2456
2830
|
}
|
|
2457
2831
|
function o() {
|
|
2458
2832
|
r.map(function(a) {
|
|
@@ -2463,42 +2837,42 @@ function Xi(t, e) {
|
|
|
2463
2837
|
return o(), i;
|
|
2464
2838
|
};
|
|
2465
2839
|
}
|
|
2466
|
-
function
|
|
2467
|
-
var e, n, r = t.onIdle, i = t.onWakeUp, o = t.onHeartbeat, a = t.timeout, s = a === void 0 ? 1e4 : a,
|
|
2840
|
+
function To(t) {
|
|
2841
|
+
var e, n, r = t.onIdle, i = t.onWakeUp, o = t.onHeartbeat, a = t.timeout, s = a === void 0 ? 1e4 : a, m = t.throttle, p = m === void 0 ? 2e3 : m, u = !1, c = !1, h = /* @__PURE__ */ new Date(), d = function() {
|
|
2468
2842
|
return clearTimeout(e);
|
|
2469
2843
|
};
|
|
2470
|
-
function v
|
|
2471
|
-
|
|
2472
|
-
u = !0, r && (n = /* @__PURE__ */ new Date(), r(
|
|
2844
|
+
function w(v) {
|
|
2845
|
+
d(), o && !u && o(Ne(h), v), i && u && (u = !1, i(Ne(n), v), h = /* @__PURE__ */ new Date()), e = setTimeout(function() {
|
|
2846
|
+
u = !0, r && (n = /* @__PURE__ */ new Date(), r(Ne(h), v));
|
|
2473
2847
|
}, s);
|
|
2474
2848
|
}
|
|
2475
|
-
var
|
|
2849
|
+
var k = Po(w, { throttle: p });
|
|
2476
2850
|
return { disable: function() {
|
|
2477
|
-
c = !0, u = !1,
|
|
2478
|
-
var
|
|
2851
|
+
c = !0, u = !1, d();
|
|
2852
|
+
var v = k();
|
|
2479
2853
|
return function() {
|
|
2480
|
-
return c = !1,
|
|
2854
|
+
return c = !1, h = /* @__PURE__ */ new Date(), w({ type: "load" }), v();
|
|
2481
2855
|
};
|
|
2482
2856
|
}, getStatus: function() {
|
|
2483
|
-
return { isIdle: u, isDisabled: c, active: u ? 0 :
|
|
2857
|
+
return { isIdle: u, isDisabled: c, active: u ? 0 : Ne(h, c), idle: u ? Ne(n, c) : 0 };
|
|
2484
2858
|
} };
|
|
2485
2859
|
}
|
|
2486
|
-
function
|
|
2860
|
+
function Ne(t, e) {
|
|
2487
2861
|
return e ? 0 : Math.round((/* @__PURE__ */ new Date() - t) / 1e3);
|
|
2488
2862
|
}
|
|
2489
|
-
const
|
|
2490
|
-
class
|
|
2863
|
+
const kn = 5e3;
|
|
2864
|
+
class jo {
|
|
2491
2865
|
constructor(e) {
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2866
|
+
G(this, "element");
|
|
2867
|
+
G(this, "isInViewport", !1);
|
|
2868
|
+
G(this, "isAwake", !1);
|
|
2869
|
+
G(this, "isFlushing");
|
|
2870
|
+
G(this, "observer");
|
|
2871
|
+
G(this, "lastEventAt", Date.now());
|
|
2872
|
+
G(this, "registeredView", !1);
|
|
2873
|
+
G(this, "viewCallback");
|
|
2874
|
+
G(this, "activeDurationCallback");
|
|
2875
|
+
G(this, "idleDurationCallback");
|
|
2502
2876
|
this.element = e.element, this.viewCallback = e.viewCallback, this.activeDurationCallback = e.activeDurationCallback, this.idleDurationCallback = e.idleDurationCallback, this.observer = new IntersectionObserver(
|
|
2503
2877
|
(n) => {
|
|
2504
2878
|
n.forEach((r) => {
|
|
@@ -2508,10 +2882,10 @@ class Fi {
|
|
|
2508
2882
|
{
|
|
2509
2883
|
threshold: 0
|
|
2510
2884
|
}
|
|
2511
|
-
), this.observer.observe(this.element),
|
|
2885
|
+
), this.observer.observe(this.element), To({
|
|
2512
2886
|
onIdle: (n) => this.handleAwake(!1, n),
|
|
2513
2887
|
onWakeUp: (n) => this.handleAwake(!0, n),
|
|
2514
|
-
timeout:
|
|
2888
|
+
timeout: kn
|
|
2515
2889
|
});
|
|
2516
2890
|
}
|
|
2517
2891
|
/**
|
|
@@ -2530,7 +2904,7 @@ class Fi {
|
|
|
2530
2904
|
), this.isInViewport = e;
|
|
2531
2905
|
}
|
|
2532
2906
|
handleAwake(e, n) {
|
|
2533
|
-
this.isAwake = e, this.lastEventAt = e ? Date.now() - n *
|
|
2907
|
+
this.isAwake = e, this.lastEventAt = e ? Date.now() - n * kn : Date.now(), this.isInViewport && this.trackAwake(e, n);
|
|
2534
2908
|
}
|
|
2535
2909
|
trackAwake(e, n) {
|
|
2536
2910
|
!e && this.activeDurationCallback && this.activeDurationCallback(n, this.isFlushing), e && this.idleDurationCallback && this.idleDurationCallback(n, this.isFlushing);
|
|
@@ -2539,56 +2913,56 @@ class Fi {
|
|
|
2539
2913
|
this.registeredView || (this.registeredView = !0, this.viewCallback && this.viewCallback());
|
|
2540
2914
|
}
|
|
2541
2915
|
}
|
|
2542
|
-
const
|
|
2543
|
-
function
|
|
2544
|
-
let t = sessionStorage.getItem(
|
|
2545
|
-
return t || (t = Math.random().toString(36).slice(2, 9), sessionStorage.setItem(
|
|
2916
|
+
const In = "sesamy_session_id";
|
|
2917
|
+
function xo() {
|
|
2918
|
+
let t = sessionStorage.getItem(In);
|
|
2919
|
+
return t || (t = Math.random().toString(36).slice(2, 9), sessionStorage.setItem(In, t)), t;
|
|
2546
2920
|
}
|
|
2547
|
-
let
|
|
2548
|
-
function
|
|
2921
|
+
let hr = !1, Pt, _n, rt;
|
|
2922
|
+
function Co({
|
|
2549
2923
|
clientId: t,
|
|
2550
2924
|
enabled: e = !0,
|
|
2551
|
-
endpoint: n =
|
|
2925
|
+
endpoint: n = Mr
|
|
2552
2926
|
}) {
|
|
2553
|
-
if (
|
|
2927
|
+
if (Pt = t, _n = e, rt = n, !_n)
|
|
2554
2928
|
return;
|
|
2555
|
-
|
|
2556
|
-
const r = new
|
|
2929
|
+
ko();
|
|
2930
|
+
const r = new jo({
|
|
2557
2931
|
element: document.body,
|
|
2558
2932
|
viewCallback: () => {
|
|
2559
|
-
|
|
2933
|
+
ce.page();
|
|
2560
2934
|
},
|
|
2561
2935
|
activeDurationCallback: (i, o) => {
|
|
2562
|
-
|
|
2936
|
+
ce.track("activeDuration", {
|
|
2563
2937
|
duration: i,
|
|
2564
2938
|
flushing: o
|
|
2565
2939
|
});
|
|
2566
2940
|
},
|
|
2567
2941
|
idleDurationCallback: (i, o) => {
|
|
2568
|
-
|
|
2942
|
+
ce.track("idleDuration", {
|
|
2569
2943
|
duration: i,
|
|
2570
2944
|
flushing: o
|
|
2571
2945
|
});
|
|
2572
2946
|
}
|
|
2573
2947
|
});
|
|
2574
|
-
|
|
2948
|
+
Ao(document.body, () => {
|
|
2575
2949
|
r.flush();
|
|
2576
|
-
}), window.addEventListener(
|
|
2950
|
+
}), window.addEventListener(oe.AUTHENTICATED, async (i) => {
|
|
2577
2951
|
const o = i;
|
|
2578
|
-
await
|
|
2579
|
-
}), window.addEventListener(
|
|
2580
|
-
await
|
|
2952
|
+
await ce.identify(o.detail.sub);
|
|
2953
|
+
}), window.addEventListener(oe.LOGOUT, async () => {
|
|
2954
|
+
await ce.track("logout", {}), Dt.flush(), await ce.reset();
|
|
2581
2955
|
});
|
|
2582
2956
|
}
|
|
2583
|
-
function
|
|
2957
|
+
function fr(t) {
|
|
2584
2958
|
return JSON.stringify(
|
|
2585
2959
|
t.map((e) => ({
|
|
2586
2960
|
...e,
|
|
2587
|
-
clientId:
|
|
2961
|
+
clientId: Pt,
|
|
2588
2962
|
requestId: Math.random().toString(36).slice(2, 9),
|
|
2589
|
-
sessionId:
|
|
2963
|
+
sessionId: xo(),
|
|
2590
2964
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2591
|
-
version:
|
|
2965
|
+
version: ur,
|
|
2592
2966
|
event: e.event,
|
|
2593
2967
|
context: {
|
|
2594
2968
|
page: {
|
|
@@ -2599,18 +2973,18 @@ function er(t) {
|
|
|
2599
2973
|
referrer: document.referrer
|
|
2600
2974
|
},
|
|
2601
2975
|
locale: navigator.language,
|
|
2602
|
-
library:
|
|
2976
|
+
library: cr,
|
|
2603
2977
|
userAgent: navigator.userAgent,
|
|
2604
|
-
clientId:
|
|
2978
|
+
clientId: Pt
|
|
2605
2979
|
}
|
|
2606
2980
|
}))
|
|
2607
2981
|
);
|
|
2608
2982
|
}
|
|
2609
|
-
const
|
|
2983
|
+
const Dt = yo(
|
|
2610
2984
|
async (t) => {
|
|
2611
2985
|
if (t.length > 0) {
|
|
2612
|
-
const e =
|
|
2613
|
-
|
|
2986
|
+
const e = fr(t);
|
|
2987
|
+
hr ? navigator.sendBeacon(rt, e) : (await fetch(rt, {
|
|
2614
2988
|
method: "POST",
|
|
2615
2989
|
body: e,
|
|
2616
2990
|
headers: {
|
|
@@ -2626,24 +3000,24 @@ const Ct = Ni(
|
|
|
2626
3000
|
// 3s
|
|
2627
3001
|
}
|
|
2628
3002
|
);
|
|
2629
|
-
function
|
|
3003
|
+
function bt(t) {
|
|
2630
3004
|
var e;
|
|
2631
3005
|
if (t.anonymousId)
|
|
2632
3006
|
if ((e = t.properties) != null && e.flushing) {
|
|
2633
3007
|
const n = { ...t };
|
|
2634
|
-
delete n.properties.flushing, navigator.sendBeacon(
|
|
3008
|
+
delete n.properties.flushing, navigator.sendBeacon(rt, fr([n]));
|
|
2635
3009
|
} else
|
|
2636
|
-
|
|
3010
|
+
Dt.push(t);
|
|
2637
3011
|
}
|
|
2638
|
-
const
|
|
2639
|
-
app:
|
|
2640
|
-
version:
|
|
3012
|
+
const ce = go({
|
|
3013
|
+
app: cr,
|
|
3014
|
+
version: ur,
|
|
2641
3015
|
plugins: [
|
|
2642
3016
|
{
|
|
2643
3017
|
name: "custom-analytics-plugin",
|
|
2644
3018
|
page: ({ payload: t }) => {
|
|
2645
3019
|
const { properties: e, anonymousId: n, userId: r, event: i } = t;
|
|
2646
|
-
|
|
3020
|
+
bt({
|
|
2647
3021
|
anonymousId: n,
|
|
2648
3022
|
userId: r,
|
|
2649
3023
|
properties: e,
|
|
@@ -2653,7 +3027,7 @@ const ae = zi({
|
|
|
2653
3027
|
},
|
|
2654
3028
|
track: ({ payload: t }) => {
|
|
2655
3029
|
const { properties: e, anonymousId: n, userId: r, event: i } = t;
|
|
2656
|
-
|
|
3030
|
+
bt({
|
|
2657
3031
|
anonymousId: n,
|
|
2658
3032
|
userId: r,
|
|
2659
3033
|
properties: e,
|
|
@@ -2663,7 +3037,7 @@ const ae = zi({
|
|
|
2663
3037
|
},
|
|
2664
3038
|
identify: ({ payload: t }) => {
|
|
2665
3039
|
const { properties: e, anonymousId: n, userId: r } = t;
|
|
2666
|
-
|
|
3040
|
+
bt({
|
|
2667
3041
|
anonymousId: n,
|
|
2668
3042
|
userId: r,
|
|
2669
3043
|
properties: e,
|
|
@@ -2673,45 +3047,45 @@ const ae = zi({
|
|
|
2673
3047
|
}
|
|
2674
3048
|
]
|
|
2675
3049
|
});
|
|
2676
|
-
function
|
|
2677
|
-
return
|
|
3050
|
+
function $o() {
|
|
3051
|
+
return hr = !0, Dt.flush();
|
|
2678
3052
|
}
|
|
2679
|
-
const
|
|
2680
|
-
function
|
|
2681
|
-
|
|
3053
|
+
const pr = /* @__PURE__ */ new Map();
|
|
3054
|
+
function Ao(t, e) {
|
|
3055
|
+
pr.set(t, e);
|
|
2682
3056
|
}
|
|
2683
3057
|
window.addEventListener("beforeunload", () => {
|
|
2684
|
-
|
|
3058
|
+
pr.forEach((t, e) => {
|
|
2685
3059
|
t.bind(e)();
|
|
2686
|
-
}),
|
|
3060
|
+
}), $o();
|
|
2687
3061
|
});
|
|
2688
|
-
async function
|
|
2689
|
-
|
|
3062
|
+
async function zo(t) {
|
|
3063
|
+
Co({
|
|
2690
3064
|
clientId: t.clientId,
|
|
2691
3065
|
// The default client id can be overridden by the config
|
|
2692
3066
|
...t.analytics
|
|
2693
|
-
}), await
|
|
3067
|
+
}), await Xr(t), vi(t.namespace), it(oe.READY, {});
|
|
2694
3068
|
}
|
|
2695
|
-
const
|
|
2696
|
-
if (
|
|
3069
|
+
const Be = document.getElementById("sesamy-js");
|
|
3070
|
+
if (Be != null && Be.textContent)
|
|
2697
3071
|
try {
|
|
2698
|
-
const t = JSON.parse(
|
|
2699
|
-
|
|
3072
|
+
const t = JSON.parse(Be.textContent);
|
|
3073
|
+
zo(t);
|
|
2700
3074
|
} catch (t) {
|
|
2701
3075
|
console.error("Failed to parse config", t);
|
|
2702
3076
|
}
|
|
2703
|
-
const
|
|
2704
|
-
class
|
|
3077
|
+
const No = "/sesamy.png";
|
|
3078
|
+
class Lo extends HTMLElement {
|
|
2705
3079
|
constructor() {
|
|
2706
3080
|
super();
|
|
2707
|
-
|
|
3081
|
+
G(this, "user");
|
|
2708
3082
|
}
|
|
2709
3083
|
async _handleProfile() {
|
|
2710
|
-
this.user = await window.sesamy.getUser(), this.render();
|
|
3084
|
+
this.user = await window.sesamy.auth.getUser(), this.render();
|
|
2711
3085
|
}
|
|
2712
3086
|
async connectedCallback() {
|
|
2713
3087
|
if (this.setupEventListeners(), !window.sesamy) {
|
|
2714
|
-
window.addEventListener(
|
|
3088
|
+
window.addEventListener(oe.READY, () => this._handleProfile());
|
|
2715
3089
|
return;
|
|
2716
3090
|
}
|
|
2717
3091
|
this._handleProfile();
|
|
@@ -2720,7 +3094,7 @@ class Qi extends HTMLElement {
|
|
|
2720
3094
|
this.innerHTML = `
|
|
2721
3095
|
<div>
|
|
2722
3096
|
<a href="https://docs.sesamy.com" target="_blank">
|
|
2723
|
-
<img src="${
|
|
3097
|
+
<img src="${No}" class="logo" alt="Vite logo" />
|
|
2724
3098
|
</a>
|
|
2725
3099
|
<h1>Sesamy JS</h1>
|
|
2726
3100
|
<p class="read-the-docs">
|
|
@@ -2749,13 +3123,23 @@ class Qi extends HTMLElement {
|
|
|
2749
3123
|
<div class="logout-wrap">
|
|
2750
3124
|
<a href="#" class="logout-btn" id="logout-btn"> Logout </a>
|
|
2751
3125
|
</div>
|
|
3126
|
+
<div>
|
|
3127
|
+
<a href="/entitlements.html">
|
|
3128
|
+
View Entitlements
|
|
3129
|
+
</a>
|
|
3130
|
+
</div>
|
|
3131
|
+
<div>
|
|
3132
|
+
<a href="/contracts.html">
|
|
3133
|
+
View Contracts
|
|
3134
|
+
</a>
|
|
3135
|
+
</div>
|
|
2752
3136
|
</div>`;
|
|
2753
3137
|
}
|
|
2754
3138
|
setupEventListeners() {
|
|
2755
3139
|
this.addEventListener("click", (n) => {
|
|
2756
3140
|
const r = n.target, i = r.closest("#logout-btn"), o = r.closest("#login-btn");
|
|
2757
|
-
i && window.sesamy.logout(), o && window.sesamy.loginWithRedirect();
|
|
3141
|
+
i && window.sesamy.auth.logout(), o && window.sesamy.auth.loginWithRedirect();
|
|
2758
3142
|
});
|
|
2759
3143
|
}
|
|
2760
3144
|
}
|
|
2761
|
-
customElements.define("sesamy-app",
|
|
3145
|
+
customElements.define("sesamy-app", Lo);
|