@sesamy/sesamy-js 1.3.13 → 1.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sesamy-js.cjs +5 -5
- package/dist/sesamy-js.d.ts +34 -15
- package/dist/sesamy-js.iife.js +5 -5
- package/dist/sesamy-js.mjs +895 -807
- package/package.json +1 -1
package/dist/sesamy-js.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var B = (t, e, n) => (
|
|
1
|
+
var mr = Object.defineProperty;
|
|
2
|
+
var gr = (t, e, n) => e in t ? mr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var B = (t, e, n) => (gr(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
4
|
function Et(t, e) {
|
|
5
5
|
const n = new CustomEvent(t, {
|
|
6
6
|
detail: e,
|
|
@@ -59,91 +59,91 @@ var ae = Pt(function(t, e) {
|
|
|
59
59
|
};
|
|
60
60
|
});
|
|
61
61
|
Ot(ae);
|
|
62
|
-
var
|
|
62
|
+
var yr = Ot(Pt(function(t, e) {
|
|
63
63
|
var n = ce && ce.__awaiter || function(u, c, h, d) {
|
|
64
|
-
return new (h || (h = Promise))(function(
|
|
65
|
-
function
|
|
64
|
+
return new (h || (h = Promise))(function(w, I) {
|
|
65
|
+
function y(v) {
|
|
66
66
|
try {
|
|
67
|
-
|
|
67
|
+
E(d.next(v));
|
|
68
68
|
} catch (l) {
|
|
69
|
-
|
|
69
|
+
I(l);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function S(v) {
|
|
73
73
|
try {
|
|
74
|
-
|
|
74
|
+
E(d.throw(v));
|
|
75
75
|
} catch (l) {
|
|
76
|
-
|
|
76
|
+
I(l);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
l(
|
|
82
|
-
}).then(
|
|
79
|
+
function E(v) {
|
|
80
|
+
v.done ? w(v.value) : new h(function(l) {
|
|
81
|
+
l(v.value);
|
|
82
|
+
}).then(y, S);
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
E((d = d.apply(u, c || [])).next());
|
|
85
85
|
});
|
|
86
86
|
}, r = ce && ce.__generator || function(u, c) {
|
|
87
|
-
var h, d,
|
|
88
|
-
if (1 &
|
|
89
|
-
throw
|
|
90
|
-
return
|
|
87
|
+
var h, d, w, I, y = { label: 0, sent: function() {
|
|
88
|
+
if (1 & w[0])
|
|
89
|
+
throw w[1];
|
|
90
|
+
return w[1];
|
|
91
91
|
}, trys: [], ops: [] };
|
|
92
|
-
return
|
|
92
|
+
return I = { next: S(0), throw: S(1), return: S(2) }, typeof Symbol == "function" && (I[Symbol.iterator] = function() {
|
|
93
93
|
return this;
|
|
94
|
-
}),
|
|
95
|
-
function
|
|
96
|
-
return function(
|
|
94
|
+
}), I;
|
|
95
|
+
function S(E) {
|
|
96
|
+
return function(v) {
|
|
97
97
|
return function(l) {
|
|
98
98
|
if (h)
|
|
99
99
|
throw new TypeError("Generator is already executing.");
|
|
100
|
-
for (;
|
|
100
|
+
for (; y; )
|
|
101
101
|
try {
|
|
102
|
-
if (h = 1, d && (
|
|
103
|
-
return
|
|
104
|
-
switch (d = 0,
|
|
102
|
+
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)
|
|
103
|
+
return w;
|
|
104
|
+
switch (d = 0, w && (l = [2 & l[0], w.value]), l[0]) {
|
|
105
105
|
case 0:
|
|
106
106
|
case 1:
|
|
107
|
-
|
|
107
|
+
w = l;
|
|
108
108
|
break;
|
|
109
109
|
case 4:
|
|
110
|
-
return
|
|
110
|
+
return y.label++, { value: l[1], done: !1 };
|
|
111
111
|
case 5:
|
|
112
|
-
|
|
112
|
+
y.label++, d = l[1], l = [0];
|
|
113
113
|
continue;
|
|
114
114
|
case 7:
|
|
115
|
-
l =
|
|
115
|
+
l = y.ops.pop(), y.trys.pop();
|
|
116
116
|
continue;
|
|
117
117
|
default:
|
|
118
|
-
if (
|
|
119
|
-
|
|
118
|
+
if (w = y.trys, !((w = w.length > 0 && w[w.length - 1]) || l[0] !== 6 && l[0] !== 2)) {
|
|
119
|
+
y = 0;
|
|
120
120
|
continue;
|
|
121
121
|
}
|
|
122
|
-
if (l[0] === 3 && (!
|
|
123
|
-
|
|
122
|
+
if (l[0] === 3 && (!w || l[1] > w[0] && l[1] < w[3])) {
|
|
123
|
+
y.label = l[1];
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
|
-
if (l[0] === 6 &&
|
|
127
|
-
|
|
126
|
+
if (l[0] === 6 && y.label < w[1]) {
|
|
127
|
+
y.label = w[1], w = l;
|
|
128
128
|
break;
|
|
129
129
|
}
|
|
130
|
-
if (
|
|
131
|
-
|
|
130
|
+
if (w && y.label < w[2]) {
|
|
131
|
+
y.label = w[2], y.ops.push(l);
|
|
132
132
|
break;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
w[2] && y.ops.pop(), y.trys.pop();
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
|
-
l = c.call(u,
|
|
138
|
-
} catch (
|
|
139
|
-
l = [6,
|
|
137
|
+
l = c.call(u, y);
|
|
138
|
+
} catch (b) {
|
|
139
|
+
l = [6, b], d = 0;
|
|
140
140
|
} finally {
|
|
141
|
-
h =
|
|
141
|
+
h = w = 0;
|
|
142
142
|
}
|
|
143
143
|
if (5 & l[0])
|
|
144
144
|
throw l[1];
|
|
145
145
|
return { value: l[0] ? l[1] : void 0, done: !0 };
|
|
146
|
-
}([
|
|
146
|
+
}([E, v]);
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
}, i = ce;
|
|
@@ -205,21 +205,21 @@ var gr = Ot(Pt(function(t, e) {
|
|
|
205
205
|
}
|
|
206
206
|
return u.prototype.acquireLock = function(c, h) {
|
|
207
207
|
return h === void 0 && (h = 5e3), n(this, void 0, void 0, function() {
|
|
208
|
-
var d,
|
|
208
|
+
var d, w, I, y, S, E, v;
|
|
209
209
|
return r(this, function(l) {
|
|
210
210
|
switch (l.label) {
|
|
211
211
|
case 0:
|
|
212
|
-
d = Date.now() + p(4),
|
|
212
|
+
d = Date.now() + p(4), w = Date.now() + h, I = o + "-" + c, y = this.storageHandler === void 0 ? a : this.storageHandler, l.label = 1;
|
|
213
213
|
case 1:
|
|
214
|
-
return Date.now() <
|
|
214
|
+
return Date.now() < w ? [4, s(30)] : [3, 8];
|
|
215
215
|
case 2:
|
|
216
|
-
return l.sent(),
|
|
216
|
+
return l.sent(), y.getItemSync(I) !== null ? [3, 5] : (S = this.id + "-" + c + "-" + d, [4, s(Math.floor(25 * Math.random()))]);
|
|
217
217
|
case 3:
|
|
218
|
-
return l.sent(),
|
|
218
|
+
return l.sent(), y.setItemSync(I, JSON.stringify({ id: this.id, iat: d, timeoutKey: S, timeAcquired: Date.now(), timeRefreshed: Date.now() })), [4, s(30)];
|
|
219
219
|
case 4:
|
|
220
|
-
return l.sent(), (
|
|
220
|
+
return l.sent(), (E = y.getItemSync(I)) !== null && (v = JSON.parse(E)).id === this.id && v.iat === d ? (this.acquiredIatSet.add(d), this.refreshLockWhileAcquired(I, d), [2, !0]) : [3, 7];
|
|
221
221
|
case 5:
|
|
222
|
-
return u.lockCorrector(this.storageHandler === void 0 ? a : this.storageHandler), [4, this.waitForSomethingToChange(
|
|
222
|
+
return u.lockCorrector(this.storageHandler === void 0 ? a : this.storageHandler), [4, this.waitForSomethingToChange(w)];
|
|
223
223
|
case 6:
|
|
224
224
|
l.sent(), l.label = 7;
|
|
225
225
|
case 7:
|
|
@@ -232,16 +232,16 @@ var gr = Ot(Pt(function(t, e) {
|
|
|
232
232
|
}, u.prototype.refreshLockWhileAcquired = function(c, h) {
|
|
233
233
|
return n(this, void 0, void 0, function() {
|
|
234
234
|
var d = this;
|
|
235
|
-
return r(this, function(
|
|
235
|
+
return r(this, function(w) {
|
|
236
236
|
return setTimeout(function() {
|
|
237
237
|
return n(d, void 0, void 0, function() {
|
|
238
|
-
var
|
|
239
|
-
return r(this, function(
|
|
240
|
-
switch (
|
|
238
|
+
var I, y, S;
|
|
239
|
+
return r(this, function(E) {
|
|
240
|
+
switch (E.label) {
|
|
241
241
|
case 0:
|
|
242
242
|
return [4, ae.default().lock(h)];
|
|
243
243
|
case 1:
|
|
244
|
-
return
|
|
244
|
+
return E.sent(), this.acquiredIatSet.has(h) ? (I = this.storageHandler === void 0 ? a : this.storageHandler, (y = I.getItemSync(c)) === null ? (ae.default().unlock(h), [2]) : ((S = JSON.parse(y)).timeRefreshed = Date.now(), I.setItemSync(c, JSON.stringify(S)), ae.default().unlock(h), this.refreshLockWhileAcquired(c, h), [2])) : (ae.default().unlock(h), [2]);
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
});
|
|
@@ -254,16 +254,16 @@ var gr = Ot(Pt(function(t, e) {
|
|
|
254
254
|
switch (h.label) {
|
|
255
255
|
case 0:
|
|
256
256
|
return [4, new Promise(function(d) {
|
|
257
|
-
var
|
|
258
|
-
function
|
|
259
|
-
if (
|
|
260
|
-
|
|
261
|
-
var
|
|
262
|
-
|
|
257
|
+
var w = !1, I = Date.now(), y = !1;
|
|
258
|
+
function S() {
|
|
259
|
+
if (y || (window.removeEventListener("storage", S), u.removeFromWaiting(S), clearTimeout(E), y = !0), !w) {
|
|
260
|
+
w = !0;
|
|
261
|
+
var v = 50 - (Date.now() - I);
|
|
262
|
+
v > 0 ? setTimeout(d, v) : d(null);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
window.addEventListener("storage",
|
|
266
|
-
var
|
|
265
|
+
window.addEventListener("storage", S), u.addToWaiting(S);
|
|
266
|
+
var E = setTimeout(S, Math.max(0, c - Date.now()));
|
|
267
267
|
})];
|
|
268
268
|
case 1:
|
|
269
269
|
return h.sent(), [2];
|
|
@@ -293,41 +293,41 @@ var gr = Ot(Pt(function(t, e) {
|
|
|
293
293
|
});
|
|
294
294
|
}, u.prototype.releaseLock__private__ = function(c) {
|
|
295
295
|
return n(this, void 0, void 0, function() {
|
|
296
|
-
var h, d,
|
|
297
|
-
return r(this, function(
|
|
298
|
-
switch (
|
|
296
|
+
var h, d, w, I;
|
|
297
|
+
return r(this, function(y) {
|
|
298
|
+
switch (y.label) {
|
|
299
299
|
case 0:
|
|
300
|
-
return h = this.storageHandler === void 0 ? a : this.storageHandler, d = o + "-" + c, (
|
|
300
|
+
return h = this.storageHandler === void 0 ? a : this.storageHandler, d = o + "-" + c, (w = h.getItemSync(d)) === null ? [2] : (I = JSON.parse(w)).id !== this.id ? [3, 2] : [4, ae.default().lock(I.iat)];
|
|
301
301
|
case 1:
|
|
302
|
-
|
|
302
|
+
y.sent(), this.acquiredIatSet.delete(I.iat), h.removeItemSync(d), ae.default().unlock(I.iat), u.notifyWaiters(), y.label = 2;
|
|
303
303
|
case 2:
|
|
304
304
|
return [2];
|
|
305
305
|
}
|
|
306
306
|
});
|
|
307
307
|
});
|
|
308
308
|
}, u.lockCorrector = function(c) {
|
|
309
|
-
for (var h = Date.now() - 5e3, d = c,
|
|
310
|
-
var
|
|
311
|
-
if (
|
|
309
|
+
for (var h = Date.now() - 5e3, d = c, w = [], I = 0; ; ) {
|
|
310
|
+
var y = d.keySync(I);
|
|
311
|
+
if (y === null)
|
|
312
312
|
break;
|
|
313
|
-
|
|
313
|
+
w.push(y), I++;
|
|
314
314
|
}
|
|
315
|
-
for (var
|
|
316
|
-
var
|
|
317
|
-
if (
|
|
318
|
-
var l = d.getItemSync(
|
|
315
|
+
for (var S = !1, E = 0; E < w.length; E++) {
|
|
316
|
+
var v = w[E];
|
|
317
|
+
if (v.includes(o)) {
|
|
318
|
+
var l = d.getItemSync(v);
|
|
319
319
|
if (l !== null) {
|
|
320
|
-
var
|
|
321
|
-
(
|
|
320
|
+
var b = JSON.parse(l);
|
|
321
|
+
(b.timeRefreshed === void 0 && b.timeAcquired < h || b.timeRefreshed !== void 0 && b.timeRefreshed < h) && (d.removeItemSync(v), S = !0);
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
|
|
325
|
+
S && u.notifyWaiters();
|
|
326
326
|
}, u.waiters = void 0, u;
|
|
327
327
|
}();
|
|
328
328
|
e.default = f;
|
|
329
329
|
}));
|
|
330
|
-
const
|
|
330
|
+
const vr = { timeoutInSeconds: 60 }, Sn = { name: "auth0-spa-js", version: "2.1.3" }, En = () => Date.now();
|
|
331
331
|
let V = class vt extends Error {
|
|
332
332
|
constructor(e, n) {
|
|
333
333
|
super(n), this.error = e, this.error_description = n, Object.setPrototypeOf(this, vt.prototype);
|
|
@@ -335,7 +335,7 @@ let V = class vt extends Error {
|
|
|
335
335
|
static fromPayload({ error: e, error_description: n }) {
|
|
336
336
|
return new vt(e, n);
|
|
337
337
|
}
|
|
338
|
-
},
|
|
338
|
+
}, wr = class On extends V {
|
|
339
339
|
constructor(e, n, r, i = null) {
|
|
340
340
|
super(e, n), this.state = r, this.appState = i, Object.setPrototypeOf(this, On.prototype);
|
|
341
341
|
}
|
|
@@ -343,47 +343,47 @@ let V = class vt extends Error {
|
|
|
343
343
|
constructor() {
|
|
344
344
|
super("timeout", "Timeout"), Object.setPrototypeOf(this, Pn.prototype);
|
|
345
345
|
}
|
|
346
|
-
},
|
|
346
|
+
}, br = class Tn extends wt {
|
|
347
347
|
constructor(e) {
|
|
348
348
|
super(), this.popup = e, Object.setPrototypeOf(this, Tn.prototype);
|
|
349
349
|
}
|
|
350
|
-
},
|
|
350
|
+
}, kr = class jn extends V {
|
|
351
351
|
constructor(e) {
|
|
352
352
|
super("cancelled", "Popup closed"), this.popup = e, Object.setPrototypeOf(this, jn.prototype);
|
|
353
353
|
}
|
|
354
|
-
},
|
|
354
|
+
}, Ir = class xn extends V {
|
|
355
355
|
constructor(e, n, r) {
|
|
356
356
|
super(e, n), this.mfa_token = r, Object.setPrototypeOf(this, xn.prototype);
|
|
357
357
|
}
|
|
358
358
|
}, Cn = class $n extends V {
|
|
359
359
|
constructor(e, n) {
|
|
360
|
-
super("missing_refresh_token", `Missing Refresh Token (audience: '${
|
|
360
|
+
super("missing_refresh_token", `Missing Refresh Token (audience: '${Ut(e, ["default"])}', scope: '${Ut(n)}')`), this.audience = e, this.scope = n, Object.setPrototypeOf(this, $n.prototype);
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
|
-
function
|
|
363
|
+
function Ut(t, e = []) {
|
|
364
364
|
return t && !e.includes(t) ? t : "";
|
|
365
365
|
}
|
|
366
366
|
const Ge = () => window.crypto, ct = () => {
|
|
367
367
|
const t = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";
|
|
368
368
|
let e = "";
|
|
369
369
|
return Array.from(Ge().getRandomValues(new Uint8Array(43))).forEach((n) => e += t[n % t.length]), e;
|
|
370
|
-
},
|
|
370
|
+
}, Lt = (t) => btoa(t), bt = (t) => {
|
|
371
371
|
var { clientId: e } = t, n = Q(t, ["clientId"]);
|
|
372
372
|
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();
|
|
373
|
-
}, Rt = (t) => ((e) => decodeURIComponent(atob(e).split("").map((n) => "%" + ("00" + n.charCodeAt(0).toString(16)).slice(-2)).join("")))(t.replace(/_/g, "/").replace(/-/g, "+")),
|
|
373
|
+
}, Rt = (t) => ((e) => decodeURIComponent(atob(e).split("").map((n) => "%" + ("00" + n.charCodeAt(0).toString(16)).slice(-2)).join("")))(t.replace(/_/g, "/").replace(/-/g, "+")), _r = async (t, e) => {
|
|
374
374
|
const n = await fetch(t, e);
|
|
375
375
|
return { ok: n.ok, json: await n.json() };
|
|
376
|
-
},
|
|
376
|
+
}, Sr = async (t, e, n) => {
|
|
377
377
|
const r = new AbortController();
|
|
378
378
|
let i;
|
|
379
|
-
return e.signal = r.signal, Promise.race([
|
|
379
|
+
return e.signal = r.signal, Promise.race([_r(t, e), new Promise((o, a) => {
|
|
380
380
|
i = setTimeout(() => {
|
|
381
381
|
r.abort(), a(new Error("Timeout when executing 'fetch'"));
|
|
382
382
|
}, n);
|
|
383
383
|
})]).finally(() => {
|
|
384
384
|
clearTimeout(i);
|
|
385
385
|
});
|
|
386
|
-
},
|
|
386
|
+
}, Er = async (t, e, n, r, i, o, a) => {
|
|
387
387
|
return s = { auth: { audience: e, scope: n }, timeout: i, fetchUrl: t, fetchOptions: r, useFormData: a }, p = o, new Promise(function(f, u) {
|
|
388
388
|
const c = new MessageChannel();
|
|
389
389
|
c.port1.onmessage = function(h) {
|
|
@@ -391,30 +391,30 @@ const Ge = () => window.crypto, ct = () => {
|
|
|
391
391
|
}, p.postMessage(s, [c.port2]);
|
|
392
392
|
});
|
|
393
393
|
var s, p;
|
|
394
|
-
},
|
|
395
|
-
async function
|
|
394
|
+
}, Or = async (t, e, n, r, i, o, a = 1e4) => i ? Er(t, e, n, r, a, i, o) : Sr(t, r, a);
|
|
395
|
+
async function Pr(t, e) {
|
|
396
396
|
var { baseUrl: n, timeout: r, audience: i, scope: o, auth0Client: a, useFormData: s } = t, p = Q(t, ["baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData"]);
|
|
397
397
|
const f = s ? bt(p) : JSON.stringify(p);
|
|
398
|
-
return await async function(u, c, h, d,
|
|
399
|
-
let
|
|
400
|
-
for (let
|
|
398
|
+
return await async function(u, c, h, d, w, I, y) {
|
|
399
|
+
let S, E = null;
|
|
400
|
+
for (let _ = 0; _ < 3; _++)
|
|
401
401
|
try {
|
|
402
|
-
|
|
402
|
+
S = await Or(u, h, d, w, I, y, c), E = null;
|
|
403
403
|
break;
|
|
404
|
-
} catch (
|
|
405
|
-
|
|
404
|
+
} catch (A) {
|
|
405
|
+
E = A;
|
|
406
406
|
}
|
|
407
|
-
if (
|
|
408
|
-
throw
|
|
409
|
-
const
|
|
410
|
-
if (!
|
|
411
|
-
const
|
|
412
|
-
throw l === "mfa_required" ? new
|
|
407
|
+
if (E)
|
|
408
|
+
throw E;
|
|
409
|
+
const v = S.json, { error: l, error_description: b } = v, j = Q(v, ["error", "error_description"]), { ok: k } = S;
|
|
410
|
+
if (!k) {
|
|
411
|
+
const _ = b || `HTTP error. Unable to fetch ${u}`;
|
|
412
|
+
throw l === "mfa_required" ? new Ir(l, _, j.mfa_token) : l === "missing_refresh_token" ? new Cn(h, d) : new V(l || "request_error", _);
|
|
413
413
|
}
|
|
414
|
-
return
|
|
414
|
+
return j;
|
|
415
415
|
}(`${n}/oauth/token`, r, i || "default", o, { method: "POST", body: f, headers: { "Content-Type": s ? "application/x-www-form-urlencoded" : "application/json", "Auth0-Client": btoa(JSON.stringify(a || Sn)) } }, e, s);
|
|
416
416
|
}
|
|
417
|
-
const
|
|
417
|
+
const Ke = (...t) => {
|
|
418
418
|
return (e = t.filter(Boolean).join(" ").trim().split(/\s+/), Array.from(new Set(e))).join(" ");
|
|
419
419
|
var e;
|
|
420
420
|
};
|
|
@@ -433,7 +433,7 @@ let le = class kt {
|
|
|
433
433
|
const { scope: n, audience: r, client_id: i } = e;
|
|
434
434
|
return new kt({ scope: n, audience: r, clientId: i });
|
|
435
435
|
}
|
|
436
|
-
},
|
|
436
|
+
}, Tr = class {
|
|
437
437
|
set(e, n) {
|
|
438
438
|
localStorage.setItem(e, JSON.stringify(n));
|
|
439
439
|
}
|
|
@@ -452,7 +452,7 @@ let le = class kt {
|
|
|
452
452
|
allKeys() {
|
|
453
453
|
return Object.keys(window.localStorage).filter((e) => e.startsWith("@@auth0spajs@@"));
|
|
454
454
|
}
|
|
455
|
-
},
|
|
455
|
+
}, An = class {
|
|
456
456
|
constructor() {
|
|
457
457
|
this.enclosedCache = /* @__PURE__ */ function() {
|
|
458
458
|
let e = {};
|
|
@@ -467,7 +467,7 @@ let le = class kt {
|
|
|
467
467
|
}, allKeys: () => Object.keys(e) };
|
|
468
468
|
}();
|
|
469
469
|
}
|
|
470
|
-
},
|
|
470
|
+
}, jr = class {
|
|
471
471
|
constructor(e, n, r) {
|
|
472
472
|
this.cache = e, this.keyManifest = n, this.nowProvider = r || En;
|
|
473
473
|
}
|
|
@@ -530,7 +530,7 @@ let le = class kt {
|
|
|
530
530
|
return o.prefix === "@@auth0spajs@@" && o.clientId === e.clientId && o.audience === e.audience && p;
|
|
531
531
|
})[0];
|
|
532
532
|
}
|
|
533
|
-
},
|
|
533
|
+
}, xr = class {
|
|
534
534
|
constructor(e, n, r) {
|
|
535
535
|
this.storage = e, this.clientId = n, this.cookieDomain = r, this.storageKey = `a0.spajs.txs.${this.clientId}`;
|
|
536
536
|
}
|
|
@@ -544,7 +544,7 @@ let le = class kt {
|
|
|
544
544
|
this.storage.remove(this.storageKey, { cookieDomain: this.cookieDomain });
|
|
545
545
|
}
|
|
546
546
|
};
|
|
547
|
-
const
|
|
547
|
+
const Ae = (t) => typeof t == "number", Cr = ["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"], $r = (t) => {
|
|
548
548
|
if (!t.id_token)
|
|
549
549
|
throw new Error("ID token is required but missing");
|
|
550
550
|
const e = ((o) => {
|
|
@@ -553,7 +553,7 @@ const ze = (t) => typeof t == "number", xr = ["iss", "aud", "exp", "nbf", "iat",
|
|
|
553
553
|
throw new Error("ID token could not be decoded");
|
|
554
554
|
const u = JSON.parse(Rt(p)), c = { __raw: o }, h = {};
|
|
555
555
|
return Object.keys(u).forEach((d) => {
|
|
556
|
-
c[d] = u[d],
|
|
556
|
+
c[d] = u[d], Cr.includes(d) || (h[d] = u[d]);
|
|
557
557
|
}), { encoded: { header: s, payload: p, signature: f }, header: JSON.parse(Rt(s)), claims: c, user: h };
|
|
558
558
|
})(t.id_token);
|
|
559
559
|
if (!e.claims.iss)
|
|
@@ -583,21 +583,21 @@ const ze = (t) => typeof t == "number", xr = ["iss", "aud", "exp", "nbf", "iat",
|
|
|
583
583
|
if (e.claims.nonce !== t.nonce)
|
|
584
584
|
throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`);
|
|
585
585
|
}
|
|
586
|
-
if (t.max_age && !
|
|
586
|
+
if (t.max_age && !Ae(e.claims.auth_time))
|
|
587
587
|
throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");
|
|
588
|
-
if (e.claims.exp == null || !
|
|
588
|
+
if (e.claims.exp == null || !Ae(e.claims.exp))
|
|
589
589
|
throw new Error("Expiration Time (exp) claim must be a number present in the ID token");
|
|
590
|
-
if (!
|
|
590
|
+
if (!Ae(e.claims.iat))
|
|
591
591
|
throw new Error("Issued At (iat) claim must be a number present in the ID token");
|
|
592
592
|
const n = t.leeway || 60, r = new Date(t.now || Date.now()), i = /* @__PURE__ */ new Date(0);
|
|
593
593
|
if (i.setUTCSeconds(e.claims.exp + n), r > i)
|
|
594
594
|
throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${i})`);
|
|
595
|
-
if (e.claims.nbf != null &&
|
|
595
|
+
if (e.claims.nbf != null && Ae(e.claims.nbf)) {
|
|
596
596
|
const o = /* @__PURE__ */ new Date(0);
|
|
597
597
|
if (o.setUTCSeconds(e.claims.nbf - n), r < o)
|
|
598
598
|
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}`);
|
|
599
599
|
}
|
|
600
|
-
if (e.claims.auth_time != null &&
|
|
600
|
+
if (e.claims.auth_time != null && Ae(e.claims.auth_time)) {
|
|
601
601
|
const o = /* @__PURE__ */ new Date(0);
|
|
602
602
|
if (o.setUTCSeconds(parseInt(e.claims.auth_time) + t.max_age + n), r > o)
|
|
603
603
|
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}`);
|
|
@@ -646,10 +646,10 @@ var de = Pt(function(t, e) {
|
|
|
646
646
|
}
|
|
647
647
|
function o(p) {
|
|
648
648
|
for (var f = {}, u = p ? p.split("; ") : [], c = /(%[\dA-F]{2})+/gi, h = 0; h < u.length; h++) {
|
|
649
|
-
var d = u[h].split("="),
|
|
650
|
-
|
|
649
|
+
var d = u[h].split("="), w = d.slice(1).join("=");
|
|
650
|
+
w.charAt(0) === '"' && (w = w.slice(1, -1));
|
|
651
651
|
try {
|
|
652
|
-
f[d[0].replace(c, decodeURIComponent)] =
|
|
652
|
+
f[d[0].replace(c, decodeURIComponent)] = w.replace(c, decodeURIComponent);
|
|
653
653
|
} catch {
|
|
654
654
|
}
|
|
655
655
|
}
|
|
@@ -668,14 +668,14 @@ var de = Pt(function(t, e) {
|
|
|
668
668
|
};
|
|
669
669
|
});
|
|
670
670
|
Ot(de), de.encode, de.parse, de.getAll;
|
|
671
|
-
var
|
|
671
|
+
var Ar = de.get, zn = de.set, Nn = de.remove;
|
|
672
672
|
const ve = { get(t) {
|
|
673
|
-
const e =
|
|
673
|
+
const e = Ar(t);
|
|
674
674
|
if (e !== void 0)
|
|
675
675
|
return JSON.parse(e);
|
|
676
676
|
}, save(t, e, n) {
|
|
677
677
|
let r = {};
|
|
678
|
-
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),
|
|
678
|
+
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);
|
|
679
679
|
}, remove(t, e) {
|
|
680
680
|
let n = {};
|
|
681
681
|
e != null && e.cookieDomain && (n.domain = e.cookieDomain), Nn(t, n);
|
|
@@ -683,11 +683,11 @@ const ve = { get(t) {
|
|
|
683
683
|
return ve.get(t) || ve.get(`_legacy_${t}`);
|
|
684
684
|
}, save(t, e, n) {
|
|
685
685
|
let r = {};
|
|
686
|
-
window.location.protocol === "https:" && (r = { secure: !0 }), n != null && n.daysUntilExpire && (r.expires = n.daysUntilExpire), n != null && n.cookieDomain && (r.domain = n.cookieDomain),
|
|
686
|
+
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), ve.save(t, e, n);
|
|
687
687
|
}, remove(t, e) {
|
|
688
688
|
let n = {};
|
|
689
689
|
e != null && e.cookieDomain && (n.domain = e.cookieDomain), Nn(t, n), ve.remove(t, e), ve.remove(`_legacy_${t}`, e);
|
|
690
|
-
} },
|
|
690
|
+
} }, Nr = { get(t) {
|
|
691
691
|
if (typeof sessionStorage > "u")
|
|
692
692
|
return;
|
|
693
693
|
const e = sessionStorage.getItem(t);
|
|
@@ -697,7 +697,7 @@ const ve = { get(t) {
|
|
|
697
697
|
}, remove(t) {
|
|
698
698
|
sessionStorage.removeItem(t);
|
|
699
699
|
} };
|
|
700
|
-
function
|
|
700
|
+
function Dr(t, e, n) {
|
|
701
701
|
var r = e === void 0 ? null : e, i = function(p, f) {
|
|
702
702
|
var u = atob(p);
|
|
703
703
|
if (f) {
|
|
@@ -710,8 +710,8 @@ function Nr(t, e, n) {
|
|
|
710
710
|
`, 10) + 1, a = i.substring(o) + (r ? "//# sourceMappingURL=" + r : ""), s = new Blob([a], { type: "application/javascript" });
|
|
711
711
|
return URL.createObjectURL(s);
|
|
712
712
|
}
|
|
713
|
-
var Zt,
|
|
714
|
-
return ut = ut ||
|
|
713
|
+
var Zt, Mt, Wt, ut, Ur = (Zt = "Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=", Mt = null, Wt = !1, function(t) {
|
|
714
|
+
return ut = ut || Dr(Zt, Mt, Wt), new Worker(ut, t);
|
|
715
715
|
});
|
|
716
716
|
const lt = {};
|
|
717
717
|
let Lr = class {
|
|
@@ -740,14 +740,14 @@ let Lr = class {
|
|
|
740
740
|
return `@@auth0spajs@@::${e}`;
|
|
741
741
|
}
|
|
742
742
|
};
|
|
743
|
-
const
|
|
743
|
+
const Rr = { memory: () => new An().enclosedCache, localstorage: () => new Tr() }, Kt = (t) => Rr[t], Jt = (t) => {
|
|
744
744
|
const { openUrl: e, onRedirect: n } = t, r = Q(t, ["openUrl", "onRedirect"]);
|
|
745
745
|
return Object.assign(Object.assign({}, r), { openUrl: e === !1 || e ? e : n });
|
|
746
|
-
}, dt = new
|
|
747
|
-
let
|
|
746
|
+
}, dt = new yr();
|
|
747
|
+
let Zr = class {
|
|
748
748
|
constructor(e) {
|
|
749
749
|
let n, r;
|
|
750
|
-
if (this.userCache = new
|
|
750
|
+
if (this.userCache = new An().enclosedCache, this.defaultOptions = { authorizationParams: { scope: "openid profile email" }, useRefreshTokensFallback: !1, useFormData: !0 }, this._releaseLockOnPageHide = async () => {
|
|
751
751
|
await dt.releaseLock("auth0.lock.getTokenSilently"), window.removeEventListener("pagehide", this._releaseLockOnPageHide);
|
|
752
752
|
}, this.options = Object.assign(Object.assign(Object.assign({}, this.defaultOptions), e), { authorizationParams: Object.assign(Object.assign({}, this.defaultOptions.authorizationParams), e.authorizationParams) }), typeof window < "u" && (() => {
|
|
753
753
|
if (!Ge())
|
|
@@ -759,14 +759,14 @@ let Rr = class {
|
|
|
759
759
|
})(), 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)
|
|
760
760
|
r = e.cache;
|
|
761
761
|
else {
|
|
762
|
-
if (n = e.cacheLocation || "memory", !
|
|
762
|
+
if (n = e.cacheLocation || "memory", !Kt(n))
|
|
763
763
|
throw new Error(`Invalid cache location "${n}"`);
|
|
764
|
-
r =
|
|
764
|
+
r = Kt(n)();
|
|
765
765
|
}
|
|
766
766
|
this.httpTimeoutMs = e.httpTimeoutInSeconds ? 1e3 * e.httpTimeoutInSeconds : 1e4, this.cookieStorage = e.legacySameSiteCookie === !1 ? ve : zr, this.orgHintCookieName = `auth0.${this.options.clientId}.organization_hint`, this.isAuthenticatedCookieName = ((a) => `auth0.${a}.is.authenticated`)(this.options.clientId), this.sessionCheckExpiryDays = e.sessionCheckExpiryDays || 1;
|
|
767
|
-
const i = e.useCookiesForTransactions ? this.cookieStorage :
|
|
767
|
+
const i = e.useCookiesForTransactions ? this.cookieStorage : Nr;
|
|
768
768
|
var o;
|
|
769
|
-
this.scope =
|
|
769
|
+
this.scope = Ke("openid", this.options.authorizationParams.scope, this.options.useRefreshTokens ? "offline_access" : ""), this.transactionManager = new xr(i, this.options.clientId, this.options.cookieDomain), this.nowProvider = this.options.nowProvider || En, this.cacheManager = new jr(r, r.allKeys ? void 0 : new Lr(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());
|
|
770
770
|
}
|
|
771
771
|
_url(e) {
|
|
772
772
|
const n = encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client || Sn)));
|
|
@@ -777,20 +777,20 @@ let Rr = class {
|
|
|
777
777
|
}
|
|
778
778
|
async _verifyIdToken(e, n, r) {
|
|
779
779
|
const i = await this.nowProvider();
|
|
780
|
-
return
|
|
780
|
+
return $r({ 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 });
|
|
781
781
|
var o;
|
|
782
782
|
}
|
|
783
783
|
_processOrgHint(e) {
|
|
784
784
|
e ? this.cookieStorage.save(this.orgHintCookieName, e, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }) : this.cookieStorage.remove(this.orgHintCookieName, { cookieDomain: this.options.cookieDomain });
|
|
785
785
|
}
|
|
786
786
|
async _prepareAuthorizeUrl(e, n, r) {
|
|
787
|
-
const i =
|
|
787
|
+
const i = Lt(ct()), o = Lt(ct()), a = ct(), s = ((u) => {
|
|
788
788
|
const c = new Uint8Array(u);
|
|
789
789
|
return ((h) => {
|
|
790
790
|
const d = { "+": "-", "/": "_", "=": "" };
|
|
791
|
-
return h.replace(/[+/=]/g, (
|
|
791
|
+
return h.replace(/[+/=]/g, (w) => d[w]);
|
|
792
792
|
})(window.btoa(String.fromCharCode(...Array.from(c))));
|
|
793
|
-
})(await (async (u) => await Ge().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(u)))(a)), p = ((u, c, h, d,
|
|
793
|
+
})(await (async (u) => await Ge().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(u)))(a)), p = ((u, c, h, d, w, I, y, S) => Object.assign(Object.assign(Object.assign({ client_id: u.clientId }, u.authorizationParams), h), { scope: Ke(c, h.scope), response_type: "code", response_mode: S || "query", state: d, nonce: w, redirect_uri: y || u.authorizationParams.redirect_uri, code_challenge: I, 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), f = this._authorizeUrl(p);
|
|
794
794
|
return { nonce: o, code_verifier: a, scope: p.scope, audience: p.audience || "default", redirect_uri: p.redirect_uri, state: i, url: f };
|
|
795
795
|
}
|
|
796
796
|
async loginWithPopup(e, n) {
|
|
@@ -805,9 +805,9 @@ let Rr = class {
|
|
|
805
805
|
const o = await ((s) => new Promise((p, f) => {
|
|
806
806
|
let u;
|
|
807
807
|
const c = setInterval(() => {
|
|
808
|
-
s.popup && s.popup.closed && (clearInterval(c), clearTimeout(h), window.removeEventListener("message", u, !1), f(new
|
|
808
|
+
s.popup && s.popup.closed && (clearInterval(c), clearTimeout(h), window.removeEventListener("message", u, !1), f(new kr(s.popup)));
|
|
809
809
|
}, 1e3), h = setTimeout(() => {
|
|
810
|
-
clearInterval(c), f(new
|
|
810
|
+
clearInterval(c), f(new br(s.popup)), window.removeEventListener("message", u, !1);
|
|
811
811
|
}, 1e3 * (s.timeoutInSeconds || 60));
|
|
812
812
|
u = function(d) {
|
|
813
813
|
if (d.data && d.data.type === "authorization_response") {
|
|
@@ -851,7 +851,7 @@ let Rr = class {
|
|
|
851
851
|
if (!s)
|
|
852
852
|
throw new V("missing_transaction", "Invalid state");
|
|
853
853
|
if (this.transactionManager.remove(), o)
|
|
854
|
-
throw new
|
|
854
|
+
throw new wr(o, a || o, r, s.appState);
|
|
855
855
|
if (!s.code_verifier || s.state && s.state !== r)
|
|
856
856
|
throw new V("state_mismatch", "Invalid state");
|
|
857
857
|
const p = s.organization, f = s.nonce, u = s.redirect_uri;
|
|
@@ -870,7 +870,7 @@ let Rr = class {
|
|
|
870
870
|
}
|
|
871
871
|
async getTokenSilently(e = {}) {
|
|
872
872
|
var n;
|
|
873
|
-
const r = Object.assign(Object.assign({ cacheMode: "on" }, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope:
|
|
873
|
+
const r = Object.assign(Object.assign({ cacheMode: "on" }, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Ke(this.scope, (n = e.authorizationParams) === null || n === void 0 ? void 0 : n.scope) }) }), i = await ((o, a) => {
|
|
874
874
|
let s = lt[a];
|
|
875
875
|
return s || (s = o().finally(() => {
|
|
876
876
|
delete lt[a], s = null;
|
|
@@ -908,8 +908,8 @@ let Rr = class {
|
|
|
908
908
|
}
|
|
909
909
|
async getTokenWithPopup(e = {}, n = {}) {
|
|
910
910
|
var r;
|
|
911
|
-
const i = Object.assign(Object.assign({}, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope:
|
|
912
|
-
return n = Object.assign(Object.assign({},
|
|
911
|
+
const i = Object.assign(Object.assign({}, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Ke(this.scope, (r = e.authorizationParams) === null || r === void 0 ? void 0 : r.scope) }) });
|
|
912
|
+
return n = Object.assign(Object.assign({}, vr), n), await this.loginWithPopup(i, n), (await this.cacheManager.get(new le({ scope: i.authorizationParams.scope, audience: i.authorizationParams.audience || "default", clientId: this.options.clientId }))).access_token;
|
|
913
913
|
}
|
|
914
914
|
async isAuthenticated() {
|
|
915
915
|
return !!await this.getUser();
|
|
@@ -932,22 +932,22 @@ let Rr = class {
|
|
|
932
932
|
try {
|
|
933
933
|
if (window.crossOriginIsolated)
|
|
934
934
|
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.");
|
|
935
|
-
const c = e.timeoutInSeconds || this.options.authorizeTimeoutInSeconds, h = await ((
|
|
936
|
-
const
|
|
937
|
-
|
|
935
|
+
const c = e.timeoutInSeconds || this.options.authorizeTimeoutInSeconds, h = await ((w, I, y = 60) => new Promise((S, E) => {
|
|
936
|
+
const v = window.document.createElement("iframe");
|
|
937
|
+
v.setAttribute("width", "0"), v.setAttribute("height", "0"), v.style.display = "none";
|
|
938
938
|
const l = () => {
|
|
939
|
-
window.document.body.contains(
|
|
939
|
+
window.document.body.contains(v) && (window.document.body.removeChild(v), window.removeEventListener("message", b, !1));
|
|
940
940
|
};
|
|
941
|
-
let
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
}, 1e3 *
|
|
945
|
-
|
|
946
|
-
if (
|
|
941
|
+
let b;
|
|
942
|
+
const j = setTimeout(() => {
|
|
943
|
+
E(new wt()), l();
|
|
944
|
+
}, 1e3 * y);
|
|
945
|
+
b = function(k) {
|
|
946
|
+
if (k.origin != I || !k.data || k.data.type !== "authorization_response")
|
|
947
947
|
return;
|
|
948
|
-
const
|
|
949
|
-
|
|
950
|
-
}, window.addEventListener("message",
|
|
948
|
+
const _ = k.source;
|
|
949
|
+
_ && _.close(), k.data.response.error ? E(V.fromPayload(k.data.response)) : S(k.data.response), clearTimeout(j), window.removeEventListener("message", b, !1), setTimeout(l, 2e3);
|
|
950
|
+
}, window.addEventListener("message", b, !1), window.document.body.appendChild(v), v.setAttribute("src", w);
|
|
951
951
|
}))(i, this.domainUrl, c);
|
|
952
952
|
if (o !== h.state)
|
|
953
953
|
throw new V("state_mismatch", "Invalid state");
|
|
@@ -990,66 +990,68 @@ let Rr = class {
|
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
992
|
async _requestToken(e, n) {
|
|
993
|
-
const { nonceIn: r, organization: i } = n || {}, o = await
|
|
993
|
+
const { nonceIn: r, organization: i } = n || {}, o = await Pr(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);
|
|
994
994
|
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 });
|
|
995
995
|
}
|
|
996
996
|
};
|
|
997
|
-
async function
|
|
998
|
-
const e = new
|
|
997
|
+
async function Mr(t) {
|
|
998
|
+
const e = new Zr(t);
|
|
999
999
|
return await e.checkSession(), e;
|
|
1000
1000
|
}
|
|
1001
1001
|
const Dn = "sesamy.com", Wr = "https://logs.sesamy.com/events";
|
|
1002
1002
|
var Se = /* @__PURE__ */ ((t) => (t.READY = "sesamyJsReady", t.AUTHENTICATED = "sesamyJsAuthenticated", t.LOGOUT = "sesamyJsLogout", t.SOFT_PAYWALL = "sesamyJsSoftPaywall", t))(Se || {});
|
|
1003
|
-
let
|
|
1003
|
+
let F;
|
|
1004
1004
|
async function Kr(t) {
|
|
1005
|
-
if (t.enabled !== !1 && (
|
|
1005
|
+
if (t.enabled !== !1 && (F = await Mr({
|
|
1006
1006
|
domain: t.endpoint || `token.${Dn}`,
|
|
1007
1007
|
clientId: t.clientId,
|
|
1008
1008
|
cacheLocation: "localstorage"
|
|
1009
1009
|
}), window.location.search.includes("code=")))
|
|
1010
1010
|
try {
|
|
1011
|
-
await
|
|
1012
|
-
const e = await
|
|
1013
|
-
Et(Se.AUTHENTICATED, e)
|
|
1014
|
-
const n =
|
|
1015
|
-
|
|
1011
|
+
await F.handleRedirectCallback();
|
|
1012
|
+
const e = await F.getUser();
|
|
1013
|
+
Et(Se.AUTHENTICATED, e);
|
|
1014
|
+
const n = new URL(location.href), r = n.searchParams;
|
|
1015
|
+
r.delete("code"), n.search = r.toString(), window.history.replaceState({}, document.title, n.toString());
|
|
1016
|
+
const i = await F.getTokenSilently();
|
|
1017
|
+
localStorage.setItem("accessToken", i);
|
|
1016
1018
|
} catch {
|
|
1017
1019
|
}
|
|
1018
1020
|
}
|
|
1019
|
-
async function
|
|
1020
|
-
if (!
|
|
1021
|
+
async function Jr() {
|
|
1022
|
+
if (!F)
|
|
1021
1023
|
throw new Error("Auth0 client not initialized");
|
|
1022
|
-
return
|
|
1024
|
+
return F.isAuthenticated();
|
|
1023
1025
|
}
|
|
1024
|
-
async function
|
|
1025
|
-
if (!
|
|
1026
|
+
async function Xr() {
|
|
1027
|
+
if (!F)
|
|
1026
1028
|
throw new Error("Auth0 client not initialized");
|
|
1027
|
-
return
|
|
1029
|
+
return F.getUser();
|
|
1028
1030
|
}
|
|
1029
|
-
function
|
|
1030
|
-
if (!
|
|
1031
|
+
function Fr() {
|
|
1032
|
+
if (!F)
|
|
1031
1033
|
throw new Error("Auth0 client not initialized");
|
|
1032
|
-
return
|
|
1034
|
+
return F.loginWithRedirect({
|
|
1033
1035
|
authorizationParams: {
|
|
1034
1036
|
redirect_uri: window.location.href
|
|
1035
1037
|
}
|
|
1036
1038
|
});
|
|
1037
1039
|
}
|
|
1038
|
-
async function
|
|
1039
|
-
if (!
|
|
1040
|
+
async function Hr() {
|
|
1041
|
+
if (!F)
|
|
1040
1042
|
throw new Error("Auth0 client not initialized");
|
|
1041
|
-
return
|
|
1043
|
+
return F.getTokenSilently();
|
|
1042
1044
|
}
|
|
1043
|
-
async function
|
|
1044
|
-
if (!
|
|
1045
|
+
async function Vr() {
|
|
1046
|
+
if (!F)
|
|
1045
1047
|
throw new Error("Auth0 client not initialized");
|
|
1046
|
-
return Et(Se.LOGOUT, {}),
|
|
1048
|
+
return Et(Se.LOGOUT, {}), F.logout({
|
|
1047
1049
|
logoutParams: {
|
|
1048
1050
|
returnTo: window.location.href
|
|
1049
1051
|
}
|
|
1050
1052
|
});
|
|
1051
1053
|
}
|
|
1052
|
-
const
|
|
1054
|
+
const Yr = (t, e) => e.skipDedupe || e.method !== "GET", Gr = (t, e) => e.method + "@" + t, Br = (t) => t.clone(), Xt = ({ skip: t = Yr, key: e = Gr, resolver: n = Br } = {}) => {
|
|
1053
1055
|
const r = /* @__PURE__ */ new Map();
|
|
1054
1056
|
return (i) => (o, a) => {
|
|
1055
1057
|
if (t(o, a))
|
|
@@ -1069,37 +1071,37 @@ const Vr = (t, e) => e.skipDedupe || e.method !== "GET", Yr = (t, e) => e.method
|
|
|
1069
1071
|
return r.delete(s), Promise.reject(p);
|
|
1070
1072
|
}
|
|
1071
1073
|
};
|
|
1072
|
-
},
|
|
1074
|
+
}, qr = (t, e) => t * e, Qr = (t) => t && t.ok, Ft = ({ delayTimer: t = 500, delayRamp: e = qr, maxAttempts: n = 10, until: r = Qr, onRetry: i = null, retryOnNetworkError: o = !1, resolveWithLatestResponse: a = !1, skip: s } = {}) => (p) => (f, u) => {
|
|
1073
1075
|
let c = 0;
|
|
1074
1076
|
if (s && s(f, u))
|
|
1075
1077
|
return p(f, u);
|
|
1076
|
-
const h = (d,
|
|
1077
|
-
const
|
|
1078
|
+
const h = (d, w) => Promise.resolve(r(d, w)).then((I) => I ? d && a ? d : w ? Promise.reject(w) : d : (c++, !n || c <= n ? new Promise((y) => {
|
|
1079
|
+
const S = e(t, c);
|
|
1078
1080
|
setTimeout(() => {
|
|
1079
1081
|
typeof i == "function" ? Promise.resolve(i({
|
|
1080
1082
|
response: d,
|
|
1081
|
-
error:
|
|
1083
|
+
error: w,
|
|
1082
1084
|
url: f,
|
|
1083
1085
|
options: u
|
|
1084
|
-
})).then((
|
|
1085
|
-
var
|
|
1086
|
-
|
|
1087
|
-
}) :
|
|
1088
|
-
},
|
|
1089
|
-
}).then(h).catch((
|
|
1086
|
+
})).then((E = {}) => {
|
|
1087
|
+
var v, l;
|
|
1088
|
+
y(p((v = E && E.url) !== null && v !== void 0 ? v : f, (l = E && E.options) !== null && l !== void 0 ? l : u));
|
|
1089
|
+
}) : y(p(f, u));
|
|
1090
|
+
}, S);
|
|
1091
|
+
}).then(h).catch((y) => {
|
|
1090
1092
|
if (!o)
|
|
1091
|
-
throw
|
|
1092
|
-
return h(null,
|
|
1093
|
-
}) : d && a ? d : Promise.reject(
|
|
1093
|
+
throw y;
|
|
1094
|
+
return h(null, y);
|
|
1095
|
+
}) : d && a ? d : Promise.reject(w || new Error("Number of attempts exceeded."))));
|
|
1094
1096
|
return p(f, u).then(h).catch((d) => {
|
|
1095
1097
|
if (!o)
|
|
1096
1098
|
throw d;
|
|
1097
1099
|
return h(null, d);
|
|
1098
1100
|
});
|
|
1099
|
-
},
|
|
1101
|
+
}, ei = "application/json", Un = "Content-Type", ye = Symbol(), Ln = Symbol();
|
|
1100
1102
|
function Ht(t = {}) {
|
|
1101
1103
|
var e;
|
|
1102
|
-
return (e = Object.entries(t).find(([n]) => n.toLowerCase() ===
|
|
1104
|
+
return (e = Object.entries(t).find(([n]) => n.toLowerCase() === Un.toLowerCase())) === null || e === void 0 ? void 0 : e[1];
|
|
1103
1105
|
}
|
|
1104
1106
|
function Vt(t) {
|
|
1105
1107
|
return /^application\/.*json.*/.test(t);
|
|
@@ -1130,90 +1132,90 @@ const he = function(t, e, n = !1) {
|
|
|
1130
1132
|
return n && i ? new i(...r) : i;
|
|
1131
1133
|
}
|
|
1132
1134
|
};
|
|
1133
|
-
function
|
|
1135
|
+
function ti(t, e = !1) {
|
|
1134
1136
|
Ee.options = e ? t : he(Ee.options, t);
|
|
1135
1137
|
}
|
|
1136
|
-
function
|
|
1138
|
+
function ni(t, e = !1) {
|
|
1137
1139
|
Ee.polyfills = e ? t : he(Ee.polyfills, t);
|
|
1138
1140
|
}
|
|
1139
|
-
function
|
|
1141
|
+
function ri(t) {
|
|
1140
1142
|
Ee.errorType = t;
|
|
1141
1143
|
}
|
|
1142
|
-
const
|
|
1144
|
+
const ii = (t) => (e) => t.reduceRight((n, r) => r(n), e) || e;
|
|
1143
1145
|
class Rn extends Error {
|
|
1144
1146
|
}
|
|
1145
|
-
const
|
|
1147
|
+
const oi = (t) => {
|
|
1146
1148
|
const e = /* @__PURE__ */ Object.create(null);
|
|
1147
|
-
t = t._addons.reduce((
|
|
1149
|
+
t = t._addons.reduce((v, l) => l.beforeRequest && l.beforeRequest(v, t._options, e) || v, t);
|
|
1148
1150
|
const { _url: n, _options: r, _config: i, _catchers: o, _resolvers: a, _middlewares: s, _addons: p } = t, f = new Map(o), u = he(i.options, r);
|
|
1149
1151
|
let c = n;
|
|
1150
|
-
const h =
|
|
1151
|
-
throw { [ye]:
|
|
1152
|
-
}).then((
|
|
1153
|
-
if (!
|
|
1152
|
+
const h = ii(s)((v, l) => (c = v, i.polyfill("fetch")(v, l)))(n, u), d = new Error(), w = h.catch((v) => {
|
|
1153
|
+
throw { [ye]: v };
|
|
1154
|
+
}).then((v) => {
|
|
1155
|
+
if (!v.ok) {
|
|
1154
1156
|
const l = new Rn();
|
|
1155
1157
|
if (l.cause = d, l.stack = l.stack + `
|
|
1156
|
-
CAUSE: ` + d.stack, l.response =
|
|
1158
|
+
CAUSE: ` + d.stack, l.response = v, l.url = c, v.type === "opaque")
|
|
1157
1159
|
throw l;
|
|
1158
|
-
return
|
|
1159
|
-
var
|
|
1160
|
-
if (l.message =
|
|
1160
|
+
return v.text().then((b) => {
|
|
1161
|
+
var j;
|
|
1162
|
+
if (l.message = b, i.errorType === "json" || ((j = v.headers.get("Content-Type")) === null || j === void 0 ? void 0 : j.split(";")[0]) === "application/json")
|
|
1161
1163
|
try {
|
|
1162
|
-
l.json = JSON.parse(
|
|
1164
|
+
l.json = JSON.parse(b);
|
|
1163
1165
|
} catch {
|
|
1164
1166
|
}
|
|
1165
|
-
throw l.text =
|
|
1167
|
+
throw l.text = b, l.status = v.status, l;
|
|
1166
1168
|
});
|
|
1167
1169
|
}
|
|
1168
|
-
return
|
|
1169
|
-
}),
|
|
1170
|
-
const
|
|
1171
|
-
if (
|
|
1172
|
-
return
|
|
1173
|
-
const
|
|
1174
|
-
if (
|
|
1175
|
-
return
|
|
1176
|
-
throw
|
|
1177
|
-
}),
|
|
1170
|
+
return v;
|
|
1171
|
+
}), I = (v) => v.catch((l) => {
|
|
1172
|
+
const b = l.hasOwnProperty(ye), j = b ? l[ye] : l, k = (j == null ? void 0 : j.status) && f.get(j.status) || f.get(j == null ? void 0 : j.name) || b && f.has(ye) && f.get(ye);
|
|
1173
|
+
if (k)
|
|
1174
|
+
return k(j, t);
|
|
1175
|
+
const _ = f.get(Ln);
|
|
1176
|
+
if (_)
|
|
1177
|
+
return _(j, t);
|
|
1178
|
+
throw j;
|
|
1179
|
+
}), y = (v) => (l) => /* If a callback is provided, then callback with the body result otherwise return the parsed body itself. */ I(v ? w.then((b) => b && b[v]()).then((b) => l ? l(b) : b) : w.then((b) => l ? l(b) : b)), S = {
|
|
1178
1180
|
_wretchReq: t,
|
|
1179
1181
|
_fetchReq: h,
|
|
1180
1182
|
_sharedState: e,
|
|
1181
|
-
res:
|
|
1182
|
-
json:
|
|
1183
|
-
blob:
|
|
1184
|
-
formData:
|
|
1185
|
-
arrayBuffer:
|
|
1186
|
-
text:
|
|
1187
|
-
error(
|
|
1188
|
-
return f.set(
|
|
1183
|
+
res: y(null),
|
|
1184
|
+
json: y("json"),
|
|
1185
|
+
blob: y("blob"),
|
|
1186
|
+
formData: y("formData"),
|
|
1187
|
+
arrayBuffer: y("arrayBuffer"),
|
|
1188
|
+
text: y("text"),
|
|
1189
|
+
error(v, l) {
|
|
1190
|
+
return f.set(v, l), this;
|
|
1189
1191
|
},
|
|
1190
|
-
badRequest(
|
|
1191
|
-
return this.error(400,
|
|
1192
|
+
badRequest(v) {
|
|
1193
|
+
return this.error(400, v);
|
|
1192
1194
|
},
|
|
1193
|
-
unauthorized(
|
|
1194
|
-
return this.error(401,
|
|
1195
|
+
unauthorized(v) {
|
|
1196
|
+
return this.error(401, v);
|
|
1195
1197
|
},
|
|
1196
|
-
forbidden(
|
|
1197
|
-
return this.error(403,
|
|
1198
|
+
forbidden(v) {
|
|
1199
|
+
return this.error(403, v);
|
|
1198
1200
|
},
|
|
1199
|
-
notFound(
|
|
1200
|
-
return this.error(404,
|
|
1201
|
+
notFound(v) {
|
|
1202
|
+
return this.error(404, v);
|
|
1201
1203
|
},
|
|
1202
|
-
timeout(
|
|
1203
|
-
return this.error(408,
|
|
1204
|
+
timeout(v) {
|
|
1205
|
+
return this.error(408, v);
|
|
1204
1206
|
},
|
|
1205
|
-
internalError(
|
|
1206
|
-
return this.error(500,
|
|
1207
|
+
internalError(v) {
|
|
1208
|
+
return this.error(500, v);
|
|
1207
1209
|
},
|
|
1208
|
-
fetchError(
|
|
1209
|
-
return this.error(ye,
|
|
1210
|
+
fetchError(v) {
|
|
1211
|
+
return this.error(ye, v);
|
|
1210
1212
|
}
|
|
1211
|
-
},
|
|
1212
|
-
...
|
|
1213
|
-
...typeof l.resolver == "function" ? l.resolver(
|
|
1214
|
-
}),
|
|
1215
|
-
return a.reduce((
|
|
1216
|
-
},
|
|
1213
|
+
}, E = p.reduce((v, l) => ({
|
|
1214
|
+
...v,
|
|
1215
|
+
...typeof l.resolver == "function" ? l.resolver(v) : l.resolver
|
|
1216
|
+
}), S);
|
|
1217
|
+
return a.reduce((v, l) => l(v, t), E);
|
|
1218
|
+
}, ai = {
|
|
1217
1219
|
_url: "",
|
|
1218
1220
|
_options: {},
|
|
1219
1221
|
_config: Ee,
|
|
@@ -1263,7 +1265,7 @@ CAUSE: ` + d.stack, l.response = w, l.url = c, w.type === "opaque")
|
|
|
1263
1265
|
return this.headers({ Accept: t });
|
|
1264
1266
|
},
|
|
1265
1267
|
content(t) {
|
|
1266
|
-
return this.headers({ [
|
|
1268
|
+
return this.headers({ [Un]: t });
|
|
1267
1269
|
},
|
|
1268
1270
|
auth(t) {
|
|
1269
1271
|
return this.headers({ Authorization: t });
|
|
@@ -1273,7 +1275,7 @@ CAUSE: ` + d.stack, l.response = w, l.url = c, w.type === "opaque")
|
|
|
1273
1275
|
return n.set(t, e), { ...this, _catchers: n };
|
|
1274
1276
|
},
|
|
1275
1277
|
catcherFallback(t) {
|
|
1276
|
-
return this.catcher(
|
|
1278
|
+
return this.catcher(Ln, t);
|
|
1277
1279
|
},
|
|
1278
1280
|
resolve(t, e = !1) {
|
|
1279
1281
|
return { ...this, _resolvers: e ? [t] : [...this._resolvers, t] };
|
|
@@ -1293,7 +1295,7 @@ CAUSE: ` + d.stack, l.response = w, l.url = c, w.type === "opaque")
|
|
|
1293
1295
|
fetch(t = this._options.method, e = "", n = null) {
|
|
1294
1296
|
let r = this.url(e).options({ method: t });
|
|
1295
1297
|
const i = Ht(r._options.headers), o = typeof n == "object" && (!r._options.headers || !i || Vt(i));
|
|
1296
|
-
return r = n ? o ? r.json(n, i) : r.body(n) : r,
|
|
1298
|
+
return r = n ? o ? r.json(n, i) : r.body(n) : r, oi(r._deferred.reduce((a, s) => s(a, a._url, a._options), r));
|
|
1297
1299
|
},
|
|
1298
1300
|
get(t = "") {
|
|
1299
1301
|
return this.fetch("GET", t);
|
|
@@ -1321,90 +1323,114 @@ CAUSE: ` + d.stack, l.response = w, l.url = c, w.type === "opaque")
|
|
|
1321
1323
|
},
|
|
1322
1324
|
json(t, e) {
|
|
1323
1325
|
const n = Ht(this._options.headers);
|
|
1324
|
-
return this.content(e || Vt(n) && n ||
|
|
1326
|
+
return this.content(e || Vt(n) && n || ei).body(JSON.stringify(t));
|
|
1325
1327
|
}
|
|
1326
1328
|
};
|
|
1327
1329
|
function oe(t = "", e = {}) {
|
|
1328
|
-
return { ...
|
|
1330
|
+
return { ...ai, _url: t, _options: e };
|
|
1329
1331
|
}
|
|
1330
1332
|
oe.default = oe;
|
|
1331
|
-
oe.options =
|
|
1332
|
-
oe.errorType =
|
|
1333
|
-
oe.polyfills =
|
|
1333
|
+
oe.options = ti;
|
|
1334
|
+
oe.errorType = ri;
|
|
1335
|
+
oe.polyfills = ni;
|
|
1334
1336
|
oe.WretchError = Rn;
|
|
1335
|
-
function
|
|
1336
|
-
const e = t.endpoint || `https://api2.${Dn}`, n = (
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
...I,
|
|
1337
|
+
function si(t) {
|
|
1338
|
+
const e = t.endpoint || `https://api2.${Dn}`, n = (k = !0) => (_) => async (A, U) => {
|
|
1339
|
+
let R = null;
|
|
1340
|
+
if (R = await Hr(), !R && k)
|
|
1341
|
+
throw new Error("No access token available");
|
|
1342
|
+
const L = {
|
|
1343
|
+
...U,
|
|
1344
|
+
headers: {
|
|
1345
|
+
...U.headers,
|
|
1346
|
+
...R ? { Authorization: `Bearer ${R}` } : {}
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
return _(A, L);
|
|
1350
|
+
}, r = (k) => (_, A) => {
|
|
1351
|
+
const U = localStorage.getItem("__anon_id"), R = btoa(`${U}:`), L = {
|
|
1352
|
+
...A,
|
|
1352
1353
|
headers: {
|
|
1353
|
-
...
|
|
1354
|
-
Authorization: `Basic ${
|
|
1354
|
+
...A.headers,
|
|
1355
|
+
Authorization: `Basic ${R}`
|
|
1355
1356
|
}
|
|
1356
1357
|
};
|
|
1357
|
-
return
|
|
1358
|
+
return k(_, L);
|
|
1358
1359
|
}, i = oe(e).headers({ "Content-Type": "application/json" }).middlewares([
|
|
1359
|
-
n,
|
|
1360
|
+
n(),
|
|
1360
1361
|
Xt(),
|
|
1361
1362
|
Ft({
|
|
1362
1363
|
delayTimer: 1e3,
|
|
1363
|
-
delayRamp: (
|
|
1364
|
+
delayRamp: (k, _) => k * _,
|
|
1364
1365
|
maxAttempts: 3,
|
|
1365
|
-
until: (
|
|
1366
|
+
until: (k) => !!(k && (k.ok || k.status >= 400 && k.status < 500)),
|
|
1366
1367
|
retryOnNetworkError: !1
|
|
1367
1368
|
})
|
|
1368
1369
|
]), o = oe(e).headers({ "Content-Type": "application/json" }).middlewares([
|
|
1370
|
+
n(!1),
|
|
1369
1371
|
r,
|
|
1370
1372
|
Xt(),
|
|
1371
1373
|
Ft({
|
|
1372
1374
|
delayTimer: 1e3,
|
|
1373
|
-
delayRamp: (
|
|
1375
|
+
delayRamp: (k, _) => k * _,
|
|
1374
1376
|
maxAttempts: 3,
|
|
1375
|
-
until: (
|
|
1377
|
+
until: (k) => !!(k && (k.ok || k.status >= 400 && k.status < 500)),
|
|
1376
1378
|
retryOnNetworkError: !1
|
|
1377
1379
|
})
|
|
1378
1380
|
]);
|
|
1379
1381
|
async function a() {
|
|
1380
1382
|
return i.get("/entitlements").json();
|
|
1381
1383
|
}
|
|
1382
|
-
async function s(
|
|
1383
|
-
const
|
|
1384
|
-
return
|
|
1384
|
+
async function s(k) {
|
|
1385
|
+
const _ = await i.get("/entitlements").json();
|
|
1386
|
+
return _ == null ? void 0 : _.find((A) => A.id === k);
|
|
1385
1387
|
}
|
|
1386
1388
|
async function p() {
|
|
1387
1389
|
return i.get("/contracts").json();
|
|
1388
1390
|
}
|
|
1389
|
-
async function f(
|
|
1390
|
-
const
|
|
1391
|
-
return
|
|
1391
|
+
async function f(k) {
|
|
1392
|
+
const _ = await i.get("/contracts").json();
|
|
1393
|
+
return _ == null ? void 0 : _.find((A) => A.id === k);
|
|
1392
1394
|
}
|
|
1393
1395
|
async function u() {
|
|
1394
1396
|
return i.get("/bills").json();
|
|
1395
1397
|
}
|
|
1396
|
-
async function c(
|
|
1397
|
-
const
|
|
1398
|
-
return
|
|
1398
|
+
async function c(k) {
|
|
1399
|
+
const _ = await i.get("/bills").json();
|
|
1400
|
+
return _ == null ? void 0 : _.find((A) => A.id === k);
|
|
1399
1401
|
}
|
|
1400
|
-
async function h() {
|
|
1401
|
-
return await
|
|
1402
|
+
async function h(k, _) {
|
|
1403
|
+
return await i.url(`/user-metadata/${k}`).put(_).json();
|
|
1402
1404
|
}
|
|
1403
|
-
async function d(
|
|
1404
|
-
return await
|
|
1405
|
+
async function d(k) {
|
|
1406
|
+
return (await i.url(`/user-metadata/${k}`).delete().res()).ok;
|
|
1405
1407
|
}
|
|
1406
|
-
async function
|
|
1407
|
-
return await
|
|
1408
|
+
async function w(k) {
|
|
1409
|
+
return (await i.url(`/user-metadata/${k}`).get().json())[k];
|
|
1410
|
+
}
|
|
1411
|
+
async function I() {
|
|
1412
|
+
return i.url("/user-metadata").get().json();
|
|
1413
|
+
}
|
|
1414
|
+
async function y() {
|
|
1415
|
+
return await i.url("/tags").get().json();
|
|
1416
|
+
}
|
|
1417
|
+
async function S(k) {
|
|
1418
|
+
return (await i.url(`/tags/${k}`).delete().res()).ok;
|
|
1419
|
+
}
|
|
1420
|
+
async function E(k) {
|
|
1421
|
+
return (await i.url("/tags").post(k).res()).ok;
|
|
1422
|
+
}
|
|
1423
|
+
async function v(k) {
|
|
1424
|
+
return (await o.url("/tallies").get().json())[k];
|
|
1425
|
+
}
|
|
1426
|
+
async function l() {
|
|
1427
|
+
return await o.url("/tallies").get().json();
|
|
1428
|
+
}
|
|
1429
|
+
async function b(k) {
|
|
1430
|
+
return (await o.url(`/tallies/${k}`).delete().res()).ok;
|
|
1431
|
+
}
|
|
1432
|
+
async function j(k, _) {
|
|
1433
|
+
return await o.url(`/tallies/${k}/push`).post(_).json();
|
|
1408
1434
|
}
|
|
1409
1435
|
return {
|
|
1410
1436
|
getEntitlements: a,
|
|
@@ -1413,36 +1439,80 @@ function ai(t) {
|
|
|
1413
1439
|
getContract: f,
|
|
1414
1440
|
getBills: u,
|
|
1415
1441
|
getBill: c,
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1442
|
+
setUserMetadata: h,
|
|
1443
|
+
deleteUserMetadata: d,
|
|
1444
|
+
getUserMetadata: w,
|
|
1445
|
+
listUserMetadata: I,
|
|
1446
|
+
getTags: y,
|
|
1447
|
+
deleteTag: S,
|
|
1448
|
+
setTag: E,
|
|
1449
|
+
getTally: v,
|
|
1450
|
+
getTallies: l,
|
|
1451
|
+
deleteTally: b,
|
|
1452
|
+
pushTally: j
|
|
1419
1453
|
};
|
|
1420
1454
|
}
|
|
1421
1455
|
const Zn = "@sesamy/sesamy-js", Tt = "1.3.2";
|
|
1422
|
-
function
|
|
1423
|
-
const {
|
|
1424
|
-
auth: {
|
|
1425
|
-
getUser: Jr,
|
|
1426
|
-
isAuthenticated: Mr,
|
|
1427
|
-
loginWithRedirect: Xr,
|
|
1428
|
-
logout: Hr
|
|
1429
|
-
},
|
|
1430
|
-
tags: {
|
|
1431
|
-
list: s,
|
|
1432
|
-
set: p,
|
|
1433
|
-
push: f
|
|
1434
|
-
},
|
|
1456
|
+
function ci(t) {
|
|
1457
|
+
const {
|
|
1435
1458
|
getEntitlement: e,
|
|
1436
1459
|
getEntitlements: n,
|
|
1437
1460
|
getContract: r,
|
|
1438
1461
|
getContracts: i,
|
|
1439
1462
|
getBill: o,
|
|
1440
1463
|
getBills: a,
|
|
1441
|
-
|
|
1464
|
+
getTags: s,
|
|
1465
|
+
deleteTag: p,
|
|
1466
|
+
setTag: f,
|
|
1467
|
+
getUserMetadata: u,
|
|
1468
|
+
listUserMetadata: c,
|
|
1469
|
+
setUserMetadata: h,
|
|
1470
|
+
deleteUserMetadata: d,
|
|
1471
|
+
getTally: w,
|
|
1472
|
+
getTallies: I,
|
|
1473
|
+
pushTally: y,
|
|
1474
|
+
deleteTally: S
|
|
1475
|
+
} = si(t), E = {
|
|
1476
|
+
auth: {
|
|
1477
|
+
getUser: Xr,
|
|
1478
|
+
isAuthenticated: Jr,
|
|
1479
|
+
loginWithRedirect: Fr,
|
|
1480
|
+
logout: Vr
|
|
1481
|
+
},
|
|
1482
|
+
tags: {
|
|
1483
|
+
list: s,
|
|
1484
|
+
set: f,
|
|
1485
|
+
delete: p
|
|
1486
|
+
},
|
|
1487
|
+
entitlements: {
|
|
1488
|
+
get: e,
|
|
1489
|
+
list: n
|
|
1490
|
+
},
|
|
1491
|
+
contracts: {
|
|
1492
|
+
get: r,
|
|
1493
|
+
list: i
|
|
1494
|
+
},
|
|
1495
|
+
bills: {
|
|
1496
|
+
get: o,
|
|
1497
|
+
list: a
|
|
1498
|
+
},
|
|
1499
|
+
userMetadata: {
|
|
1500
|
+
get: u,
|
|
1501
|
+
list: c,
|
|
1502
|
+
set: h,
|
|
1503
|
+
delete: d
|
|
1504
|
+
},
|
|
1505
|
+
tallies: {
|
|
1506
|
+
get: w,
|
|
1507
|
+
list: I,
|
|
1508
|
+
push: y,
|
|
1509
|
+
delete: S
|
|
1510
|
+
},
|
|
1511
|
+
getVersion: ui
|
|
1442
1512
|
};
|
|
1443
|
-
return t.namespace && (window[t.namespace] =
|
|
1513
|
+
return t.namespace && (window[t.namespace] = E), E;
|
|
1444
1514
|
}
|
|
1445
|
-
function
|
|
1515
|
+
function ui() {
|
|
1446
1516
|
return Tt;
|
|
1447
1517
|
}
|
|
1448
1518
|
function Yt(t, e, n, r, i) {
|
|
@@ -1450,54 +1520,54 @@ function Yt(t, e, n, r, i) {
|
|
|
1450
1520
|
t = t ? t[e[r]] : i;
|
|
1451
1521
|
return t === i ? n : t;
|
|
1452
1522
|
}
|
|
1453
|
-
var Je = "undefined", Gt = "object",
|
|
1454
|
-
},
|
|
1523
|
+
var Je = "undefined", Gt = "object", li = function() {
|
|
1524
|
+
}, Mn = "any", Wn = "*", pe = "__", qe = typeof process < "u" ? process : {};
|
|
1455
1525
|
qe.env && qe.env.NODE_ENV;
|
|
1456
1526
|
var Y = typeof document < "u";
|
|
1457
1527
|
qe.versions != null && qe.versions.node != null;
|
|
1458
1528
|
typeof Deno < "u" && Deno.core;
|
|
1459
1529
|
Y && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
1460
|
-
function
|
|
1530
|
+
function Kn(t, e) {
|
|
1461
1531
|
return e.charAt(0)[t]() + e.slice(1);
|
|
1462
1532
|
}
|
|
1463
|
-
var
|
|
1464
|
-
function
|
|
1465
|
-
return Jn(t) ?
|
|
1533
|
+
var di = Kn.bind(null, "toUpperCase"), hi = Kn.bind(null, "toLowerCase");
|
|
1534
|
+
function fi(t) {
|
|
1535
|
+
return Jn(t) ? di("null") : typeof t == "object" ? yi(t) : Object.prototype.toString.call(t).slice(8, -1);
|
|
1466
1536
|
}
|
|
1467
1537
|
function Qe(t, e) {
|
|
1468
1538
|
e === void 0 && (e = !0);
|
|
1469
|
-
var n =
|
|
1470
|
-
return e ?
|
|
1539
|
+
var n = fi(t);
|
|
1540
|
+
return e ? hi(n) : n;
|
|
1471
1541
|
}
|
|
1472
|
-
function
|
|
1542
|
+
function Me(t, e) {
|
|
1473
1543
|
return typeof e === t;
|
|
1474
1544
|
}
|
|
1475
|
-
var G =
|
|
1476
|
-
|
|
1545
|
+
var G = Me.bind(null, "function"), re = Me.bind(null, "string"), we = Me.bind(null, "undefined"), pi = Me.bind(null, "boolean");
|
|
1546
|
+
Me.bind(null, "symbol");
|
|
1477
1547
|
function Jn(t) {
|
|
1478
1548
|
return t === null;
|
|
1479
1549
|
}
|
|
1480
|
-
function
|
|
1550
|
+
function mi(t) {
|
|
1481
1551
|
return Qe(t) === "number" && !isNaN(t);
|
|
1482
1552
|
}
|
|
1483
1553
|
function Xn(t) {
|
|
1484
1554
|
return Qe(t) === "array";
|
|
1485
1555
|
}
|
|
1486
|
-
function
|
|
1487
|
-
if (!
|
|
1556
|
+
function X(t) {
|
|
1557
|
+
if (!gi(t))
|
|
1488
1558
|
return !1;
|
|
1489
1559
|
for (var e = t; Object.getPrototypeOf(e) !== null; )
|
|
1490
1560
|
e = Object.getPrototypeOf(e);
|
|
1491
1561
|
return Object.getPrototypeOf(t) === e;
|
|
1492
1562
|
}
|
|
1493
|
-
function
|
|
1563
|
+
function gi(t) {
|
|
1494
1564
|
return t && (typeof t == "object" || t !== null);
|
|
1495
1565
|
}
|
|
1496
|
-
function
|
|
1566
|
+
function yi(t) {
|
|
1497
1567
|
return G(t.constructor) ? t.constructor.name : null;
|
|
1498
1568
|
}
|
|
1499
|
-
function
|
|
1500
|
-
return t instanceof Error || re(t.message) && t.constructor &&
|
|
1569
|
+
function vi(t) {
|
|
1570
|
+
return t instanceof Error || re(t.message) && t.constructor && mi(t.constructor.stackTraceLimit);
|
|
1501
1571
|
}
|
|
1502
1572
|
function Fn(t, e) {
|
|
1503
1573
|
if (typeof e != "object" || Jn(e))
|
|
@@ -1505,7 +1575,7 @@ function Fn(t, e) {
|
|
|
1505
1575
|
if (e instanceof t)
|
|
1506
1576
|
return !0;
|
|
1507
1577
|
var n = Qe(new t(""));
|
|
1508
|
-
if (
|
|
1578
|
+
if (vi(e))
|
|
1509
1579
|
for (; e; ) {
|
|
1510
1580
|
if (Qe(e) === n)
|
|
1511
1581
|
return !0;
|
|
@@ -1517,9 +1587,9 @@ Fn.bind(null, TypeError);
|
|
|
1517
1587
|
Fn.bind(null, SyntaxError);
|
|
1518
1588
|
function nt(t, e) {
|
|
1519
1589
|
var n = t instanceof Element || t instanceof HTMLDocument;
|
|
1520
|
-
return n && e ?
|
|
1590
|
+
return n && e ? wi(t, e) : n;
|
|
1521
1591
|
}
|
|
1522
|
-
function
|
|
1592
|
+
function wi(t, e) {
|
|
1523
1593
|
return e === void 0 && (e = ""), t && t.nodeName === e.toUpperCase();
|
|
1524
1594
|
}
|
|
1525
1595
|
function rt(t) {
|
|
@@ -1532,7 +1602,7 @@ rt(nt, "form");
|
|
|
1532
1602
|
rt(nt, "button");
|
|
1533
1603
|
rt(nt, "input");
|
|
1534
1604
|
rt(nt, "select");
|
|
1535
|
-
function
|
|
1605
|
+
function bi(t) {
|
|
1536
1606
|
return t ? Xn(t) ? t : [t] : [];
|
|
1537
1607
|
}
|
|
1538
1608
|
function Bt(t) {
|
|
@@ -1542,19 +1612,19 @@ function Bt(t) {
|
|
|
1542
1612
|
return null;
|
|
1543
1613
|
}
|
|
1544
1614
|
}
|
|
1545
|
-
function
|
|
1615
|
+
function ki() {
|
|
1546
1616
|
if (Y) {
|
|
1547
1617
|
var t = navigator, e = t.languages;
|
|
1548
1618
|
return t.userLanguage || (e && e.length ? e[0] : t.language);
|
|
1549
1619
|
}
|
|
1550
1620
|
}
|
|
1551
|
-
function
|
|
1621
|
+
function Ii() {
|
|
1552
1622
|
try {
|
|
1553
1623
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1554
1624
|
} catch {
|
|
1555
1625
|
}
|
|
1556
1626
|
}
|
|
1557
|
-
function
|
|
1627
|
+
function _i(t) {
|
|
1558
1628
|
return function(e) {
|
|
1559
1629
|
for (var n, r = /* @__PURE__ */ Object.create(null), i = /([^&=]+)=?([^&]*)/g; n = i.exec(e); ) {
|
|
1560
1630
|
var o = Bt(n[1]), a = Bt(n[2]);
|
|
@@ -1562,7 +1632,7 @@ function Ii(t) {
|
|
|
1562
1632
|
}
|
|
1563
1633
|
for (var s in r) {
|
|
1564
1634
|
var p = s.split("[");
|
|
1565
|
-
p.length > 1 && (
|
|
1635
|
+
p.length > 1 && (Si(r, p.map(function(f) {
|
|
1566
1636
|
return f.replace(/[?[\]\\ ]/g, "");
|
|
1567
1637
|
}), r[s]), delete r[s]);
|
|
1568
1638
|
}
|
|
@@ -1575,7 +1645,7 @@ function Ii(t) {
|
|
|
1575
1645
|
return Y && window.location.search.substring(1);
|
|
1576
1646
|
}(t));
|
|
1577
1647
|
}
|
|
1578
|
-
function
|
|
1648
|
+
function Si(t, e, n) {
|
|
1579
1649
|
for (var r = e.length - 1, i = 0; i < r; ++i) {
|
|
1580
1650
|
var o = e[i];
|
|
1581
1651
|
if (o === "__proto__" || o === "constructor")
|
|
@@ -1625,17 +1695,17 @@ function jt(t) {
|
|
|
1625
1695
|
}
|
|
1626
1696
|
return Xe[t] = !0;
|
|
1627
1697
|
}
|
|
1628
|
-
function
|
|
1629
|
-
return
|
|
1698
|
+
function T() {
|
|
1699
|
+
return T = Object.assign || function(t) {
|
|
1630
1700
|
for (var e = 1; e < arguments.length; e++) {
|
|
1631
1701
|
var n = arguments[e];
|
|
1632
1702
|
for (var r in n)
|
|
1633
1703
|
Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
1634
1704
|
}
|
|
1635
1705
|
return t;
|
|
1636
|
-
},
|
|
1706
|
+
}, T.apply(this, arguments);
|
|
1637
1707
|
}
|
|
1638
|
-
var ne = "function", ee = "undefined",
|
|
1708
|
+
var ne = "function", ee = "undefined", Ei = "@@redux/" + Math.random().toString(36), qt = /* @__PURE__ */ function() {
|
|
1639
1709
|
return typeof Symbol === ne && Symbol.observable || "@@observable";
|
|
1640
1710
|
}(), Fe = " != " + ne;
|
|
1641
1711
|
function Hn(t, e, n) {
|
|
@@ -1657,17 +1727,17 @@ function Hn(t, e, n) {
|
|
|
1657
1727
|
function c(d) {
|
|
1658
1728
|
if (typeof d !== ne)
|
|
1659
1729
|
throw new Error("Listener" + Fe);
|
|
1660
|
-
var
|
|
1730
|
+
var w = !0;
|
|
1661
1731
|
return f(), s.push(d), function() {
|
|
1662
|
-
if (
|
|
1663
|
-
|
|
1664
|
-
var
|
|
1665
|
-
s.splice(
|
|
1732
|
+
if (w) {
|
|
1733
|
+
w = !1, f();
|
|
1734
|
+
var I = s.indexOf(d);
|
|
1735
|
+
s.splice(I, 1);
|
|
1666
1736
|
}
|
|
1667
1737
|
};
|
|
1668
1738
|
}
|
|
1669
1739
|
function h(d) {
|
|
1670
|
-
if (!
|
|
1740
|
+
if (!X(d))
|
|
1671
1741
|
throw new Error("Act != obj");
|
|
1672
1742
|
if (typeof d.type === ee)
|
|
1673
1743
|
throw new Error("ActType " + ee);
|
|
@@ -1678,8 +1748,8 @@ function Hn(t, e, n) {
|
|
|
1678
1748
|
} finally {
|
|
1679
1749
|
p = !1;
|
|
1680
1750
|
}
|
|
1681
|
-
for (var
|
|
1682
|
-
(0,
|
|
1751
|
+
for (var w = a = s, I = 0; I < w.length; I++)
|
|
1752
|
+
(0, w[I])();
|
|
1683
1753
|
return d;
|
|
1684
1754
|
}
|
|
1685
1755
|
return h({ type: "@@redux/INIT" }), (r = { dispatch: h, subscribe: c, getState: u, replaceReducer: function(d) {
|
|
@@ -1687,20 +1757,20 @@ function Hn(t, e, n) {
|
|
|
1687
1757
|
throw new Error("next reducer" + Fe);
|
|
1688
1758
|
i = d, h({ type: "@@redux/INIT" });
|
|
1689
1759
|
} })[qt] = function() {
|
|
1690
|
-
var d,
|
|
1691
|
-
return (d = { subscribe: function(
|
|
1692
|
-
if (typeof
|
|
1760
|
+
var d, w = c;
|
|
1761
|
+
return (d = { subscribe: function(I) {
|
|
1762
|
+
if (typeof I != "object")
|
|
1693
1763
|
throw new TypeError("Observer != obj");
|
|
1694
|
-
function
|
|
1695
|
-
|
|
1764
|
+
function y() {
|
|
1765
|
+
I.next && I.next(u());
|
|
1696
1766
|
}
|
|
1697
|
-
return
|
|
1767
|
+
return y(), { unsubscribe: w(y) };
|
|
1698
1768
|
} })[qt] = function() {
|
|
1699
1769
|
return this;
|
|
1700
1770
|
}, d;
|
|
1701
1771
|
}, r;
|
|
1702
1772
|
}
|
|
1703
|
-
function
|
|
1773
|
+
function Oi(t, e) {
|
|
1704
1774
|
var n = e && e.type;
|
|
1705
1775
|
return "action " + (n && n.toString() || "?") + "reducer " + t + " returns " + ee;
|
|
1706
1776
|
}
|
|
@@ -1714,7 +1784,7 @@ function Te() {
|
|
|
1714
1784
|
};
|
|
1715
1785
|
});
|
|
1716
1786
|
}
|
|
1717
|
-
function
|
|
1787
|
+
function Pi() {
|
|
1718
1788
|
var t = arguments;
|
|
1719
1789
|
return function(e) {
|
|
1720
1790
|
return function(n, r, i) {
|
|
@@ -1723,39 +1793,39 @@ function Oi() {
|
|
|
1723
1793
|
} };
|
|
1724
1794
|
return o = [].slice.call(t).map(function(f) {
|
|
1725
1795
|
return f(p);
|
|
1726
|
-
}),
|
|
1796
|
+
}), T({}, a, { dispatch: s = Te.apply(void 0, o)(a.dispatch) });
|
|
1727
1797
|
};
|
|
1728
1798
|
};
|
|
1729
1799
|
}
|
|
1730
|
-
var ie = pe + "anon_id", fe = pe + "user_id", ke = pe + "user_traits", te = "userId", be = "anonymousId", Be = ["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"], It = ["name", "EVENTS", "config", "loaded"],
|
|
1800
|
+
var ie = pe + "anon_id", fe = pe + "user_id", ke = pe + "user_traits", te = "userId", be = "anonymousId", Be = ["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"], It = ["name", "EVENTS", "config", "loaded"], P = Be.reduce(function(t, e) {
|
|
1731
1801
|
return t[e] = e, t;
|
|
1732
1802
|
}, { registerPluginType: function(t) {
|
|
1733
1803
|
return "registerPlugin:" + t;
|
|
1734
1804
|
}, pluginReadyType: function(t) {
|
|
1735
1805
|
return "ready:" + t;
|
|
1736
1806
|
} }), Qt = /^utm_/, en = /^an_prop_/, tn = /^an_trait_/;
|
|
1737
|
-
function
|
|
1807
|
+
function Ti(t) {
|
|
1738
1808
|
var e = t.storage.setItem;
|
|
1739
1809
|
return function(n) {
|
|
1740
1810
|
return function(r) {
|
|
1741
1811
|
return function(i) {
|
|
1742
|
-
if (i.type ===
|
|
1812
|
+
if (i.type === P.bootstrap) {
|
|
1743
1813
|
var o = i.params, a = i.user, s = i.persistedUser, p = i.initialUser, f = s.userId === a.userId;
|
|
1744
|
-
s.anonymousId !== a.anonymousId && e(ie, a.anonymousId), f || e(fe, a.userId), p.traits && e(ke,
|
|
1814
|
+
s.anonymousId !== a.anonymousId && e(ie, a.anonymousId), f || e(fe, a.userId), p.traits && e(ke, T({}, f && s.traits ? s.traits : {}, p.traits));
|
|
1745
1815
|
var u = Object.keys(i.params);
|
|
1746
1816
|
if (u.length) {
|
|
1747
|
-
var c = o.an_uid, h = o.an_event, d = u.reduce(function(
|
|
1748
|
-
if (
|
|
1749
|
-
var
|
|
1750
|
-
|
|
1817
|
+
var c = o.an_uid, h = o.an_event, d = u.reduce(function(w, I) {
|
|
1818
|
+
if (I.match(Qt) || I.match(/^(d|g)clid/)) {
|
|
1819
|
+
var y = I.replace(Qt, "");
|
|
1820
|
+
w.campaign[y === "campaign" ? "name" : y] = o[I];
|
|
1751
1821
|
}
|
|
1752
|
-
return
|
|
1822
|
+
return I.match(en) && (w.props[I.replace(en, "")] = o[I]), I.match(tn) && (w.traits[I.replace(tn, "")] = o[I]), w;
|
|
1753
1823
|
}, { campaign: {}, props: {}, traits: {} });
|
|
1754
|
-
n.dispatch(
|
|
1824
|
+
n.dispatch(T({ type: P.params, raw: o }, d, c ? { userId: c } : {})), c && setTimeout(function() {
|
|
1755
1825
|
return t.identify(c, d.traits);
|
|
1756
1826
|
}, 0), h && setTimeout(function() {
|
|
1757
1827
|
return t.track(h, d.props);
|
|
1758
|
-
}, 0), Object.keys(d.campaign).length && n.dispatch({ type:
|
|
1828
|
+
}, 0), Object.keys(d.campaign).length && n.dispatch({ type: P.campaign, campaign: d.campaign });
|
|
1759
1829
|
}
|
|
1760
1830
|
}
|
|
1761
1831
|
return r(i);
|
|
@@ -1763,18 +1833,18 @@ function Pi(t) {
|
|
|
1763
1833
|
};
|
|
1764
1834
|
};
|
|
1765
1835
|
}
|
|
1766
|
-
function
|
|
1836
|
+
function ji(t) {
|
|
1767
1837
|
return function(e, n) {
|
|
1768
|
-
if (e === void 0 && (e = {}), n === void 0 && (n = {}), n.type ===
|
|
1838
|
+
if (e === void 0 && (e = {}), n === void 0 && (n = {}), n.type === P.setItemEnd) {
|
|
1769
1839
|
if (n.key === ie)
|
|
1770
|
-
return
|
|
1840
|
+
return T({}, e, { anonymousId: n.value });
|
|
1771
1841
|
if (n.key === fe)
|
|
1772
|
-
return
|
|
1842
|
+
return T({}, e, { userId: n.value });
|
|
1773
1843
|
}
|
|
1774
1844
|
switch (n.type) {
|
|
1775
|
-
case
|
|
1776
|
-
return Object.assign({}, e, { userId: n.userId, traits:
|
|
1777
|
-
case
|
|
1845
|
+
case P.identify:
|
|
1846
|
+
return Object.assign({}, e, { userId: n.userId, traits: T({}, e.traits, n.traits) });
|
|
1847
|
+
case P.reset:
|
|
1778
1848
|
return [fe, ie, ke].forEach(function(r) {
|
|
1779
1849
|
t.removeItem(r);
|
|
1780
1850
|
}), Object.assign({}, e, { userId: null, anonymousId: null, traits: {} });
|
|
@@ -1789,20 +1859,20 @@ function nn(t) {
|
|
|
1789
1859
|
var _t = function(t) {
|
|
1790
1860
|
return pe + "TEMP" + pe + t;
|
|
1791
1861
|
};
|
|
1792
|
-
function
|
|
1862
|
+
function xi(t) {
|
|
1793
1863
|
var e = t.storage, n = e.setItem, r = e.removeItem, i = e.getItem;
|
|
1794
1864
|
return function(o) {
|
|
1795
1865
|
return function(a) {
|
|
1796
1866
|
return function(s) {
|
|
1797
1867
|
var p = s.userId, f = s.traits, u = s.options;
|
|
1798
|
-
if (s.type ===
|
|
1868
|
+
if (s.type === P.reset && ([fe, ke, ie].forEach(function(d) {
|
|
1799
1869
|
r(d);
|
|
1800
1870
|
}), [te, be, "traits"].forEach(function(d) {
|
|
1801
1871
|
je(_t(d));
|
|
1802
|
-
})), s.type ===
|
|
1872
|
+
})), s.type === P.identify) {
|
|
1803
1873
|
i(ie) || n(ie, it());
|
|
1804
1874
|
var c = i(fe), h = i(ke) || {};
|
|
1805
|
-
c && c !== p && o.dispatch({ type:
|
|
1875
|
+
c && c !== p && o.dispatch({ type: P.userIdChanged, old: { userId: c, traits: h }, new: { userId: p, traits: f }, options: u }), p && n(fe, p), f && n(ke, T({}, h, f));
|
|
1806
1876
|
}
|
|
1807
1877
|
return a(s);
|
|
1808
1878
|
};
|
|
@@ -1815,14 +1885,14 @@ function rn(t, e) {
|
|
|
1815
1885
|
}
|
|
1816
1886
|
function Vn(t, e, n) {
|
|
1817
1887
|
return new Promise(function(r, i) {
|
|
1818
|
-
return e() ? r(t) : n < 1 ? i(
|
|
1888
|
+
return e() ? r(t) : n < 1 ? i(T({}, t, { queue: !0 })) : new Promise(function(o) {
|
|
1819
1889
|
return setTimeout(o, 10);
|
|
1820
1890
|
}).then(function(o) {
|
|
1821
1891
|
return Vn(t, e, n - 10).then(r, i);
|
|
1822
1892
|
});
|
|
1823
1893
|
});
|
|
1824
1894
|
}
|
|
1825
|
-
function
|
|
1895
|
+
function Ci(t) {
|
|
1826
1896
|
return { abort: t };
|
|
1827
1897
|
}
|
|
1828
1898
|
function Yn(t, e, n) {
|
|
@@ -1833,18 +1903,18 @@ function Yn(t, e, n) {
|
|
|
1833
1903
|
}, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
|
|
1834
1904
|
if (f.processIndex && f.processIndex.length) {
|
|
1835
1905
|
f.processIndex.forEach(function(c) {
|
|
1836
|
-
var h = s.actions[c], d = h.plugin,
|
|
1837
|
-
if (
|
|
1838
|
-
var
|
|
1839
|
-
return l === void 0 && (l = {}),
|
|
1840
|
-
return l.hasOwnProperty(
|
|
1906
|
+
var h = s.actions[c], d = h.plugin, w = h.payload.type, I = i[d][w];
|
|
1907
|
+
if (I && G(I)) {
|
|
1908
|
+
var y, S = function(l, b) {
|
|
1909
|
+
return l === void 0 && (l = {}), b === void 0 && (b = {}), [te, be].reduce(function(j, k) {
|
|
1910
|
+
return l.hasOwnProperty(k) && b[k] && b[k] !== l[k] && (j[k] = b[k]), j;
|
|
1841
1911
|
}, l);
|
|
1842
|
-
}(h.payload, p),
|
|
1843
|
-
if (!
|
|
1844
|
-
return void (r[
|
|
1845
|
-
if (!
|
|
1846
|
-
var
|
|
1847
|
-
t.dispatch(
|
|
1912
|
+
}(h.payload, p), E = r[S.meta.rid];
|
|
1913
|
+
if (!E && (y = I({ payload: S, config: a[d].config, instance: n, abort: Ci })) && X(y) && y.abort)
|
|
1914
|
+
return void (r[S.meta.rid] = !0);
|
|
1915
|
+
if (!E) {
|
|
1916
|
+
var v = w + ":" + d;
|
|
1917
|
+
t.dispatch(T({}, S, { type: v, _: { called: v, from: "queueDrain" } }));
|
|
1848
1918
|
}
|
|
1849
1919
|
}
|
|
1850
1920
|
});
|
|
@@ -1858,118 +1928,118 @@ function Yn(t, e, n) {
|
|
|
1858
1928
|
var ht = function(t) {
|
|
1859
1929
|
var e = t.data, n = t.action, r = t.instance, i = t.state, o = t.allPlugins, a = t.allMatches, s = t.store, p = t.EVENTS;
|
|
1860
1930
|
try {
|
|
1861
|
-
var f = i.plugins, u = i.context, c = n.type, h = c.match(Ie), d = e.exact.map(function(
|
|
1862
|
-
return
|
|
1931
|
+
var f = i.plugins, u = i.context, c = n.type, h = c.match(Ie), d = e.exact.map(function(y) {
|
|
1932
|
+
return y.pluginName;
|
|
1863
1933
|
});
|
|
1864
|
-
h && (d = a.during.map(function(
|
|
1865
|
-
return
|
|
1934
|
+
h && (d = a.during.map(function(y) {
|
|
1935
|
+
return y.pluginName;
|
|
1866
1936
|
}));
|
|
1867
|
-
var
|
|
1868
|
-
return function(
|
|
1869
|
-
var
|
|
1870
|
-
l && (
|
|
1871
|
-
var
|
|
1872
|
-
return function(
|
|
1873
|
-
var K =
|
|
1874
|
-
if (
|
|
1875
|
-
throw new Error("Method " +
|
|
1876
|
-
return
|
|
1937
|
+
var w = /* @__PURE__ */ function(y, S) {
|
|
1938
|
+
return function(E, v, l) {
|
|
1939
|
+
var b = v.config, j = v.name, k = j + "." + E.type;
|
|
1940
|
+
l && (k = l.event);
|
|
1941
|
+
var _ = E.type.match(Ie) ? /* @__PURE__ */ function(A, U, R, L, H) {
|
|
1942
|
+
return function(M, x) {
|
|
1943
|
+
var K = L ? L.name : A, J = x && Ze(x) ? x : R;
|
|
1944
|
+
if (L && (!(J = x && Ze(x) ? x : [A]).includes(A) || J.length !== 1))
|
|
1945
|
+
throw new Error("Method " + U + " can only abort " + A + " plugin. " + JSON.stringify(J) + " input valid");
|
|
1946
|
+
return T({}, H, { abort: { reason: M, plugins: J, caller: U, _: K } });
|
|
1877
1947
|
};
|
|
1878
|
-
}(
|
|
1948
|
+
}(j, k, S, l, E) : /* @__PURE__ */ function(A, U) {
|
|
1879
1949
|
return function() {
|
|
1880
|
-
throw new Error(
|
|
1950
|
+
throw new Error(A.type + " action not cancellable. Remove abort in " + U);
|
|
1881
1951
|
};
|
|
1882
|
-
}(
|
|
1883
|
-
return { payload:
|
|
1952
|
+
}(E, k);
|
|
1953
|
+
return { payload: $i(E), instance: y, config: b || {}, abort: _ };
|
|
1884
1954
|
};
|
|
1885
|
-
}(r, d),
|
|
1886
|
-
var
|
|
1887
|
-
return
|
|
1955
|
+
}(r, d), I = e.exact.reduce(function(y, S) {
|
|
1956
|
+
var E = S.pluginName, v = S.methodName, l = !1;
|
|
1957
|
+
return v.match(/^initialize/) || v.match(/^reset/) || (l = !f[E].loaded), u.offline && v.match(/^(page|track|identify)/) && (l = !0), y["" + E] = l, y;
|
|
1888
1958
|
}, {});
|
|
1889
|
-
return Promise.resolve(e.exact.reduce(function(
|
|
1959
|
+
return Promise.resolve(e.exact.reduce(function(y, S, E) {
|
|
1890
1960
|
try {
|
|
1891
|
-
var
|
|
1892
|
-
return Promise.resolve(
|
|
1893
|
-
function
|
|
1961
|
+
var v = S.pluginName;
|
|
1962
|
+
return Promise.resolve(y).then(function(l) {
|
|
1963
|
+
function b() {
|
|
1894
1964
|
return Promise.resolve(l);
|
|
1895
1965
|
}
|
|
1896
|
-
var
|
|
1897
|
-
if (e.namespaced && e.namespaced[
|
|
1898
|
-
return Promise.resolve(e.namespaced[
|
|
1966
|
+
var j = function() {
|
|
1967
|
+
if (e.namespaced && e.namespaced[v])
|
|
1968
|
+
return Promise.resolve(e.namespaced[v].reduce(function(k, _, A) {
|
|
1899
1969
|
try {
|
|
1900
|
-
return Promise.resolve(
|
|
1901
|
-
return
|
|
1902
|
-
var K = dn(
|
|
1903
|
-
if (K && K.name ===
|
|
1904
|
-
var
|
|
1905
|
-
throw new Error([
|
|
1970
|
+
return Promise.resolve(k).then(function(U) {
|
|
1971
|
+
return _.method && G(_.method) ? (function(M, x) {
|
|
1972
|
+
var K = dn(M);
|
|
1973
|
+
if (K && K.name === x) {
|
|
1974
|
+
var J = dn(K.method);
|
|
1975
|
+
throw new Error([x + " plugin is calling method " + M, "Plugins cant call self", "Use " + K.method + " " + (J ? "or " + J.method : "") + " in " + x + " plugin insteadof " + M].join(`
|
|
1906
1976
|
`));
|
|
1907
1977
|
}
|
|
1908
|
-
}(
|
|
1909
|
-
return
|
|
1910
|
-
}), config: sn(
|
|
1911
|
-
var
|
|
1912
|
-
return Promise.resolve(
|
|
1913
|
-
})) :
|
|
1914
|
-
var
|
|
1978
|
+
}(_.methodName, _.pluginName), Promise.resolve(_.method({ payload: U, instance: r, abort: (R = U, L = v, H = _.pluginName, function(M, x) {
|
|
1979
|
+
return T({}, R, { abort: { reason: M, plugins: x || [L], caller: c, from: H || L } });
|
|
1980
|
+
}), config: sn(_.pluginName, f, o), plugins: f })).then(function(M) {
|
|
1981
|
+
var x = X(M) ? M : {};
|
|
1982
|
+
return Promise.resolve(T({}, U, x));
|
|
1983
|
+
})) : U;
|
|
1984
|
+
var R, L, H;
|
|
1915
1985
|
});
|
|
1916
|
-
} catch (
|
|
1917
|
-
return Promise.reject(
|
|
1986
|
+
} catch (U) {
|
|
1987
|
+
return Promise.reject(U);
|
|
1918
1988
|
}
|
|
1919
|
-
}, Promise.resolve(n))).then(function(
|
|
1920
|
-
l[
|
|
1989
|
+
}, Promise.resolve(n))).then(function(k) {
|
|
1990
|
+
l[v] = k;
|
|
1921
1991
|
});
|
|
1922
|
-
l[
|
|
1992
|
+
l[v] = n;
|
|
1923
1993
|
}();
|
|
1924
|
-
return
|
|
1994
|
+
return j && j.then ? j.then(b) : b();
|
|
1925
1995
|
});
|
|
1926
1996
|
} catch (l) {
|
|
1927
1997
|
return Promise.reject(l);
|
|
1928
1998
|
}
|
|
1929
|
-
}, Promise.resolve({}))).then(function(
|
|
1930
|
-
return Promise.resolve(e.exact.reduce(function(
|
|
1999
|
+
}, Promise.resolve({}))).then(function(y) {
|
|
2000
|
+
return Promise.resolve(e.exact.reduce(function(S, E, v) {
|
|
1931
2001
|
try {
|
|
1932
|
-
var l = e.exact.length ===
|
|
1933
|
-
return Promise.resolve(
|
|
1934
|
-
var
|
|
1935
|
-
if (h && (
|
|
1936
|
-
return ft({ data:
|
|
1937
|
-
if (pt(
|
|
1938
|
-
return l && ft({ data:
|
|
1939
|
-
if (
|
|
1940
|
-
return s.dispatch({ type: "queue", plugin:
|
|
1941
|
-
var
|
|
1942
|
-
return Promise.resolve(
|
|
1943
|
-
var
|
|
1944
|
-
if (pt(H,
|
|
1945
|
-
ft({ data: H, method: c, instance: r, pluginName:
|
|
2002
|
+
var l = e.exact.length === v + 1, b = E.pluginName, j = o[b];
|
|
2003
|
+
return Promise.resolve(S).then(function(k) {
|
|
2004
|
+
var _ = y[b] ? y[b] : {};
|
|
2005
|
+
if (h && (_ = k), pt(_, b))
|
|
2006
|
+
return ft({ data: _, method: c, instance: r, pluginName: b, store: s }), Promise.resolve(k);
|
|
2007
|
+
if (pt(k, b))
|
|
2008
|
+
return l && ft({ data: k, method: c, instance: r, store: s }), Promise.resolve(k);
|
|
2009
|
+
if (I.hasOwnProperty(b) && I[b] === !0)
|
|
2010
|
+
return s.dispatch({ type: "queue", plugin: b, payload: _, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(k);
|
|
2011
|
+
var A = w(y[b], o[b]);
|
|
2012
|
+
return Promise.resolve(j[c]({ abort: A.abort, payload: _, instance: r, config: sn(b, f, o), plugins: f })).then(function(U) {
|
|
2013
|
+
var R = X(U) ? U : {}, L = T({}, k, R), H = y[b];
|
|
2014
|
+
if (pt(H, b))
|
|
2015
|
+
ft({ data: H, method: c, instance: r, pluginName: b, store: s });
|
|
1946
2016
|
else {
|
|
1947
|
-
var
|
|
1948
|
-
(
|
|
2017
|
+
var M = c + ":" + b;
|
|
2018
|
+
(M.match(/:/g) || []).length < 2 && !c.match(on) && !c.match(an) && r.dispatch(T({}, h ? L : _, { type: M, _: { called: M, from: "submethod" } }));
|
|
1949
2019
|
}
|
|
1950
|
-
return Promise.resolve(
|
|
2020
|
+
return Promise.resolve(L);
|
|
1951
2021
|
});
|
|
1952
2022
|
});
|
|
1953
|
-
} catch (
|
|
1954
|
-
return Promise.reject(
|
|
2023
|
+
} catch (k) {
|
|
2024
|
+
return Promise.reject(k);
|
|
1955
2025
|
}
|
|
1956
|
-
}, Promise.resolve(n))).then(function(
|
|
2026
|
+
}, Promise.resolve(n))).then(function(S) {
|
|
1957
2027
|
if (!(c.match(Ie) || c.match(/^registerPlugin/) || c.match(an) || c.match(on) || c.match(/^params/) || c.match(/^userIdChanged/))) {
|
|
1958
|
-
if (p.plugins.includes(c),
|
|
1959
|
-
return
|
|
1960
|
-
var
|
|
1961
|
-
Gn(
|
|
2028
|
+
if (p.plugins.includes(c), S._ && S._.originalAction === c)
|
|
2029
|
+
return S;
|
|
2030
|
+
var E = T({}, S, { _: { originalAction: S.type, called: S.type, from: "engineEnd" } });
|
|
2031
|
+
Gn(S, e.exact.length) && !c.match(/End$/) && (E = T({}, E, { type: S.type + "Aborted" })), s.dispatch(E);
|
|
1962
2032
|
}
|
|
1963
|
-
return
|
|
2033
|
+
return S;
|
|
1964
2034
|
});
|
|
1965
2035
|
});
|
|
1966
|
-
} catch (
|
|
1967
|
-
return Promise.reject(
|
|
2036
|
+
} catch (y) {
|
|
2037
|
+
return Promise.reject(y);
|
|
1968
2038
|
}
|
|
1969
2039
|
}, Ie = /Start$/, on = /^bootstrap/, an = /^ready/;
|
|
1970
2040
|
function ft(t) {
|
|
1971
2041
|
var e = t.pluginName, n = t.method + "Aborted" + (e ? ":" + e : "");
|
|
1972
|
-
t.store.dispatch(
|
|
2042
|
+
t.store.dispatch(T({}, t.data, { type: n, _: { called: n, from: "abort" } }));
|
|
1973
2043
|
}
|
|
1974
2044
|
function sn(t, e, n) {
|
|
1975
2045
|
var r = e[t] || n[t];
|
|
@@ -2007,12 +2077,12 @@ function dn(t) {
|
|
|
2007
2077
|
var e = t.match(/(.*):(.*)/);
|
|
2008
2078
|
return !!e && { method: e[1], name: e[2] };
|
|
2009
2079
|
}
|
|
2010
|
-
function
|
|
2080
|
+
function $i(t) {
|
|
2011
2081
|
return Object.keys(t).reduce(function(e, n) {
|
|
2012
|
-
return n === "type" || (e[n] =
|
|
2082
|
+
return n === "type" || (e[n] = X(t[n]) ? Object.assign({}, t[n]) : t[n]), e;
|
|
2013
2083
|
}, {});
|
|
2014
2084
|
}
|
|
2015
|
-
function
|
|
2085
|
+
function Ai(t, e, n) {
|
|
2016
2086
|
var r = {};
|
|
2017
2087
|
return function(i) {
|
|
2018
2088
|
return function(o) {
|
|
@@ -2023,73 +2093,73 @@ function $i(t, e, n) {
|
|
|
2023
2093
|
}, f = a.type, u = a.plugins, c = a;
|
|
2024
2094
|
if (a.abort)
|
|
2025
2095
|
return Promise.resolve(o(a));
|
|
2026
|
-
if (f ===
|
|
2096
|
+
if (f === P.enablePlugin && i.dispatch({ type: P.initializeStart, plugins: u, disabled: [], fromEnable: !0, meta: a.meta }), f === P.disablePlugin && setTimeout(function() {
|
|
2027
2097
|
return rn(a.meta.rid, { payload: a });
|
|
2028
|
-
}, 0), f ===
|
|
2029
|
-
var h = e(), d = Object.keys(h),
|
|
2098
|
+
}, 0), f === P.initializeEnd) {
|
|
2099
|
+
var h = e(), d = Object.keys(h), w = d.filter(function(l) {
|
|
2030
2100
|
return u.includes(l);
|
|
2031
2101
|
}).map(function(l) {
|
|
2032
2102
|
return h[l];
|
|
2033
|
-
}),
|
|
2034
|
-
var
|
|
2103
|
+
}), I = [], y = [], S = a.disabled, E = w.map(function(l) {
|
|
2104
|
+
var b = l.loaded, j = l.name, k = l.config;
|
|
2035
2105
|
return Vn(l, function() {
|
|
2036
|
-
return
|
|
2037
|
-
}, 1e4).then(function(
|
|
2038
|
-
return r[
|
|
2039
|
-
return !It.includes(
|
|
2040
|
-
}) }), r[
|
|
2041
|
-
}).catch(function(
|
|
2042
|
-
if (
|
|
2043
|
-
throw new Error(
|
|
2044
|
-
return
|
|
2106
|
+
return b({ config: k });
|
|
2107
|
+
}, 1e4).then(function(_) {
|
|
2108
|
+
return r[j] || (i.dispatch({ type: P.pluginReadyType(j), name: j, events: Object.keys(l).filter(function(A) {
|
|
2109
|
+
return !It.includes(A);
|
|
2110
|
+
}) }), r[j] = !0), I = I.concat(j), l;
|
|
2111
|
+
}).catch(function(_) {
|
|
2112
|
+
if (_ instanceof Error)
|
|
2113
|
+
throw new Error(_);
|
|
2114
|
+
return y = y.concat(_.name), _;
|
|
2045
2115
|
});
|
|
2046
2116
|
});
|
|
2047
|
-
Promise.all(
|
|
2048
|
-
var
|
|
2117
|
+
Promise.all(E).then(function(l) {
|
|
2118
|
+
var b = { plugins: I, failed: y, disabled: S };
|
|
2049
2119
|
setTimeout(function() {
|
|
2050
|
-
d.length ===
|
|
2120
|
+
d.length === E.length + S.length && i.dispatch(T({}, { type: P.ready }, b));
|
|
2051
2121
|
}, 0);
|
|
2052
2122
|
});
|
|
2053
2123
|
}
|
|
2054
|
-
var
|
|
2055
|
-
if (f !==
|
|
2124
|
+
var v = function() {
|
|
2125
|
+
if (f !== P.bootstrap)
|
|
2056
2126
|
return /^ready:([^:]*)$/.test(f) && setTimeout(function() {
|
|
2057
2127
|
return Yn(i, e, t);
|
|
2058
|
-
}, 0), Promise.resolve(function(l,
|
|
2128
|
+
}, 0), Promise.resolve(function(l, b, j, k, _) {
|
|
2059
2129
|
try {
|
|
2060
|
-
var
|
|
2130
|
+
var A = G(b) ? b() : b, U = l.type, R = U.replace(Ie, "");
|
|
2061
2131
|
if (l._ && l._.called)
|
|
2062
2132
|
return Promise.resolve(l);
|
|
2063
|
-
var
|
|
2064
|
-
var
|
|
2065
|
-
return
|
|
2133
|
+
var L = j.getState(), H = (K = A, (J = L.plugins) === void 0 && (J = {}), (Ce = l.options) === void 0 && (Ce = {}), Object.keys(K).filter(function(m) {
|
|
2134
|
+
var g = Ce.plugins || {};
|
|
2135
|
+
return pi(g[m]) ? g[m] : g.all !== !1 && (!J[m] || J[m].enabled !== !1);
|
|
2066
2136
|
}).map(function(m) {
|
|
2067
2137
|
return K[m];
|
|
2068
2138
|
}));
|
|
2069
|
-
|
|
2070
|
-
var
|
|
2071
|
-
return l.plugins.includes(m) && !
|
|
2139
|
+
U === P.initializeStart && l.fromEnable && (H = Object.keys(L.plugins).filter(function(m) {
|
|
2140
|
+
var g = L.plugins[m];
|
|
2141
|
+
return l.plugins.includes(m) && !g.initialized;
|
|
2072
2142
|
}).map(function(m) {
|
|
2073
|
-
return
|
|
2143
|
+
return A[m];
|
|
2074
2144
|
}));
|
|
2075
|
-
var
|
|
2145
|
+
var M = H.map(function(m) {
|
|
2076
2146
|
return m.name;
|
|
2077
|
-
}),
|
|
2147
|
+
}), x = function(m, g, O) {
|
|
2078
2148
|
var C = un(m).map(function($) {
|
|
2079
|
-
return cn($,
|
|
2149
|
+
return cn($, g);
|
|
2080
2150
|
});
|
|
2081
|
-
return
|
|
2082
|
-
var W = z.name,
|
|
2083
|
-
return cn($e,
|
|
2084
|
-
}),
|
|
2085
|
-
return
|
|
2151
|
+
return g.reduce(function($, z) {
|
|
2152
|
+
var W = z.name, D = un(m, W).map(function($e) {
|
|
2153
|
+
return cn($e, g);
|
|
2154
|
+
}), Z = D[0], N = D[1], q = D[2];
|
|
2155
|
+
return Z.length && ($.beforeNS[W] = Z), N.length && ($.duringNS[W] = N), q.length && ($.afterNS[W] = q), $;
|
|
2086
2156
|
}, { before: C[0], beforeNS: {}, during: C[1], duringNS: {}, after: C[2], afterNS: {} });
|
|
2087
|
-
}(
|
|
2088
|
-
return Promise.resolve(ht({ action: l, data: { exact:
|
|
2089
|
-
function
|
|
2157
|
+
}(U, H);
|
|
2158
|
+
return Promise.resolve(ht({ action: l, data: { exact: x.before, namespaced: x.beforeNS }, state: L, allPlugins: A, allMatches: x, instance: j, store: k, EVENTS: _ })).then(function(m) {
|
|
2159
|
+
function g() {
|
|
2090
2160
|
var $ = function() {
|
|
2091
|
-
if (
|
|
2092
|
-
return Promise.resolve(ht({ action:
|
|
2161
|
+
if (U.match(Ie))
|
|
2162
|
+
return Promise.resolve(ht({ action: T({}, O, { type: R + "End" }), data: { exact: x.after, namespaced: x.afterNS }, state: L, allPlugins: A, allMatches: x, instance: j, store: k, EVENTS: _ })).then(function(z) {
|
|
2093
2163
|
z.meta && z.meta.hasCallback && rn(z.meta.rid, { payload: z });
|
|
2094
2164
|
});
|
|
2095
2165
|
}();
|
|
@@ -2097,26 +2167,26 @@ function $i(t, e, n) {
|
|
|
2097
2167
|
return m;
|
|
2098
2168
|
}) : m;
|
|
2099
2169
|
}
|
|
2100
|
-
if (Gn(m,
|
|
2170
|
+
if (Gn(m, M.length))
|
|
2101
2171
|
return m;
|
|
2102
|
-
var
|
|
2103
|
-
if (
|
|
2104
|
-
return Promise.resolve(ht({ action:
|
|
2105
|
-
|
|
2172
|
+
var O, C = function() {
|
|
2173
|
+
if (U !== R)
|
|
2174
|
+
return Promise.resolve(ht({ action: T({}, m, { type: R }), data: { exact: x.during, namespaced: x.duringNS }, state: L, allPlugins: A, allMatches: x, instance: j, store: k, EVENTS: _ })).then(function($) {
|
|
2175
|
+
O = $;
|
|
2106
2176
|
});
|
|
2107
|
-
|
|
2177
|
+
O = m;
|
|
2108
2178
|
}();
|
|
2109
|
-
return C && C.then ? C.then(
|
|
2179
|
+
return C && C.then ? C.then(g) : g();
|
|
2110
2180
|
});
|
|
2111
2181
|
} catch (m) {
|
|
2112
2182
|
return Promise.reject(m);
|
|
2113
2183
|
}
|
|
2114
|
-
var K,
|
|
2184
|
+
var K, J, Ce;
|
|
2115
2185
|
}(a, e, t, i, n)).then(function(l) {
|
|
2116
2186
|
return s = 1, o(l);
|
|
2117
2187
|
});
|
|
2118
2188
|
}();
|
|
2119
|
-
return Promise.resolve(
|
|
2189
|
+
return Promise.resolve(v && v.then ? v.then(p) : p(v));
|
|
2120
2190
|
} catch (l) {
|
|
2121
2191
|
return Promise.reject(l);
|
|
2122
2192
|
}
|
|
@@ -2129,17 +2199,17 @@ function zi(t) {
|
|
|
2129
2199
|
return function(n) {
|
|
2130
2200
|
return function(r) {
|
|
2131
2201
|
var i = r.type, o = r.key, a = r.value, s = r.options;
|
|
2132
|
-
if (i ===
|
|
2202
|
+
if (i === P.setItem || i === P.removeItem) {
|
|
2133
2203
|
if (r.abort)
|
|
2134
2204
|
return n(r);
|
|
2135
|
-
i ===
|
|
2205
|
+
i === P.setItem ? t.setItem(o, a, s) : t.removeItem(o, s);
|
|
2136
2206
|
}
|
|
2137
2207
|
return n(r);
|
|
2138
2208
|
};
|
|
2139
2209
|
};
|
|
2140
2210
|
};
|
|
2141
2211
|
}
|
|
2142
|
-
var
|
|
2212
|
+
var Ni = function() {
|
|
2143
2213
|
var t = this;
|
|
2144
2214
|
this.before = [], this.after = [], this.addMiddleware = function(e, n) {
|
|
2145
2215
|
t[n] = t[n].concat(e);
|
|
@@ -2163,7 +2233,7 @@ var Ai = function() {
|
|
|
2163
2233
|
};
|
|
2164
2234
|
};
|
|
2165
2235
|
};
|
|
2166
|
-
function
|
|
2236
|
+
function Di(t) {
|
|
2167
2237
|
return function(e, n) {
|
|
2168
2238
|
e === void 0 && (e = {});
|
|
2169
2239
|
var r = {};
|
|
@@ -2174,19 +2244,19 @@ function Ni(t) {
|
|
|
2174
2244
|
if (!o || !i)
|
|
2175
2245
|
return e;
|
|
2176
2246
|
var a = n.enabled, s = o.config;
|
|
2177
|
-
return r[i] = { enabled: a, initialized: !!a && !o.initialize, loaded: !!a && !!o.loaded({ config: s }), config: s },
|
|
2247
|
+
return r[i] = { enabled: a, initialized: !!a && !o.initialize, loaded: !!a && !!o.loaded({ config: s }), config: s }, T({}, e, r);
|
|
2178
2248
|
}
|
|
2179
2249
|
if (/^initialize:([^:]*)$/.test(n.type)) {
|
|
2180
|
-
var p = hn(n.type,
|
|
2181
|
-
return f && p ? (r[p] =
|
|
2250
|
+
var p = hn(n.type, P.initialize), f = t()[p];
|
|
2251
|
+
return f && p ? (r[p] = T({}, e[p], { initialized: !0, loaded: !!f.loaded({ config: f.config }) }), T({}, e, r)) : e;
|
|
2182
2252
|
}
|
|
2183
2253
|
if (/^ready:([^:]*)$/.test(n.type))
|
|
2184
|
-
return r[n.name] =
|
|
2254
|
+
return r[n.name] = T({}, e[n.name], { loaded: !0 }), T({}, e, r);
|
|
2185
2255
|
switch (n.type) {
|
|
2186
|
-
case
|
|
2187
|
-
return
|
|
2188
|
-
case
|
|
2189
|
-
return
|
|
2256
|
+
case P.disablePlugin:
|
|
2257
|
+
return T({}, e, fn(n.plugins, !1, e));
|
|
2258
|
+
case P.enablePlugin:
|
|
2259
|
+
return T({}, e, fn(n.plugins, !0, e));
|
|
2190
2260
|
default:
|
|
2191
2261
|
return e;
|
|
2192
2262
|
}
|
|
@@ -2197,7 +2267,7 @@ function hn(t, e) {
|
|
|
2197
2267
|
}
|
|
2198
2268
|
function fn(t, e, n) {
|
|
2199
2269
|
return t.reduce(function(r, i) {
|
|
2200
|
-
return r[i] =
|
|
2270
|
+
return r[i] = T({}, n[i], { enabled: e }), r;
|
|
2201
2271
|
}, n);
|
|
2202
2272
|
}
|
|
2203
2273
|
function Bn(t) {
|
|
@@ -2207,24 +2277,24 @@ function Bn(t) {
|
|
|
2207
2277
|
}
|
|
2208
2278
|
return t;
|
|
2209
2279
|
}
|
|
2210
|
-
var
|
|
2280
|
+
var Ui = { last: {}, history: [] };
|
|
2211
2281
|
function Li(t, e) {
|
|
2212
|
-
t === void 0 && (t =
|
|
2282
|
+
t === void 0 && (t = Ui);
|
|
2213
2283
|
var n = e.options, r = e.meta;
|
|
2214
|
-
if (e.type ===
|
|
2215
|
-
var i = Bn(
|
|
2216
|
-
return
|
|
2284
|
+
if (e.type === P.track) {
|
|
2285
|
+
var i = Bn(T({ event: e.event, properties: e.properties }, Object.keys(n).length && { options: n }, { meta: r }));
|
|
2286
|
+
return T({}, t, { last: i, history: t.history.concat(i) });
|
|
2217
2287
|
}
|
|
2218
2288
|
return t;
|
|
2219
2289
|
}
|
|
2220
|
-
var
|
|
2221
|
-
function
|
|
2222
|
-
t === void 0 && (t =
|
|
2290
|
+
var Ri = { actions: [] };
|
|
2291
|
+
function Zi(t, e) {
|
|
2292
|
+
t === void 0 && (t = Ri);
|
|
2223
2293
|
var n = e.payload;
|
|
2224
2294
|
switch (e.type) {
|
|
2225
2295
|
case "queue":
|
|
2226
2296
|
var r;
|
|
2227
|
-
return r = n && n.type && n.type ===
|
|
2297
|
+
return r = n && n.type && n.type === P.identify ? [e].concat(t.actions) : t.actions.concat(e), T({}, t, { actions: r });
|
|
2228
2298
|
case "dequeue":
|
|
2229
2299
|
return [];
|
|
2230
2300
|
default:
|
|
@@ -2232,7 +2302,7 @@ function Ri(t, e) {
|
|
|
2232
2302
|
}
|
|
2233
2303
|
}
|
|
2234
2304
|
var qn = /#.*$/;
|
|
2235
|
-
function
|
|
2305
|
+
function Mi(t) {
|
|
2236
2306
|
var e = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);
|
|
2237
2307
|
return "/" + (e && e[3] ? e[3].split("?")[0].replace(qn, "") : "");
|
|
2238
2308
|
}
|
|
@@ -2242,21 +2312,21 @@ var Qn, er, tr, nr, Wi = function(t) {
|
|
|
2242
2312
|
var e = document, n = e.title, r = e.referrer, i = window, o = i.location, a = i.innerWidth, s = i.innerHeight, p = o.hash, f = o.search, u = function(h) {
|
|
2243
2313
|
var d = function() {
|
|
2244
2314
|
if (Y) {
|
|
2245
|
-
for (var
|
|
2246
|
-
if (
|
|
2247
|
-
return
|
|
2315
|
+
for (var w, I = document.getElementsByTagName("link"), y = 0; w = I[y]; y++)
|
|
2316
|
+
if (w.getAttribute("rel") === "canonical")
|
|
2317
|
+
return w.getAttribute("href");
|
|
2248
2318
|
}
|
|
2249
2319
|
}();
|
|
2250
2320
|
return d ? d.match(/\?/) ? d : d + h : window.location.href.replace(qn, "");
|
|
2251
|
-
}(f), c = { title: n, url: u, path:
|
|
2252
|
-
return r && r !== "" && (c.referrer = r),
|
|
2321
|
+
}(f), c = { title: n, url: u, path: Mi(u), hash: p, search: f, width: a, height: s };
|
|
2322
|
+
return r && r !== "" && (c.referrer = r), T({}, c, t);
|
|
2253
2323
|
}, Ki = { last: {}, history: [] };
|
|
2254
|
-
function
|
|
2324
|
+
function Ji(t, e) {
|
|
2255
2325
|
t === void 0 && (t = Ki);
|
|
2256
2326
|
var n = e.options;
|
|
2257
|
-
if (e.type ===
|
|
2258
|
-
var r = Bn(
|
|
2259
|
-
return
|
|
2327
|
+
if (e.type === P.page) {
|
|
2328
|
+
var r = Bn(T({ properties: e.properties, meta: e.meta }, Object.keys(n).length && { options: n }));
|
|
2329
|
+
return T({}, t, { last: r, history: t.history.concat(r) });
|
|
2260
2330
|
}
|
|
2261
2331
|
return t;
|
|
2262
2332
|
}
|
|
@@ -2265,24 +2335,24 @@ Qn = function() {
|
|
|
2265
2335
|
return !1;
|
|
2266
2336
|
var t = navigator.appVersion;
|
|
2267
2337
|
return ~t.indexOf("Win") ? "Windows" : ~t.indexOf("Mac") ? "MacOS" : ~t.indexOf("X11") ? "UNIX" : ~t.indexOf("Linux") ? "Linux" : "Unknown OS";
|
|
2268
|
-
}(), er = Y ? document.referrer : null, tr =
|
|
2338
|
+
}(), er = Y ? document.referrer : null, tr = ki(), nr = Ii();
|
|
2269
2339
|
var pn = { initialized: !1, sessionId: it(), 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 };
|
|
2270
|
-
function
|
|
2340
|
+
function Xi(t, e) {
|
|
2271
2341
|
t === void 0 && (t = pn);
|
|
2272
2342
|
var n = t.initialized, r = e.campaign;
|
|
2273
2343
|
switch (e.type) {
|
|
2274
|
-
case
|
|
2275
|
-
return
|
|
2276
|
-
case
|
|
2277
|
-
return
|
|
2278
|
-
case
|
|
2279
|
-
return
|
|
2344
|
+
case P.campaign:
|
|
2345
|
+
return T({}, t, { campaign: r });
|
|
2346
|
+
case P.offline:
|
|
2347
|
+
return T({}, t, { offline: !0 });
|
|
2348
|
+
case P.online:
|
|
2349
|
+
return T({}, t, { offline: !1 });
|
|
2280
2350
|
default:
|
|
2281
|
-
return n ? t :
|
|
2351
|
+
return n ? t : T({}, pn, t, { initialized: !0 });
|
|
2282
2352
|
}
|
|
2283
2353
|
}
|
|
2284
|
-
var
|
|
2285
|
-
function
|
|
2354
|
+
var Fi = ["plugins", "reducers", "storage"];
|
|
2355
|
+
function Hi(t, e, n) {
|
|
2286
2356
|
if (Y) {
|
|
2287
2357
|
var r = window[(n ? "add" : "remove") + "EventListener"];
|
|
2288
2358
|
t.split(" ").forEach(function(i) {
|
|
@@ -2290,8 +2360,8 @@ function Fi(t, e, n) {
|
|
|
2290
2360
|
});
|
|
2291
2361
|
}
|
|
2292
2362
|
}
|
|
2293
|
-
function
|
|
2294
|
-
var e =
|
|
2363
|
+
function Vi(t) {
|
|
2364
|
+
var e = Hi.bind(null, "online offline", function(n) {
|
|
2295
2365
|
return Promise.resolve(!navigator.onLine).then(t);
|
|
2296
2366
|
});
|
|
2297
2367
|
return e(!0), function(n) {
|
|
@@ -2328,36 +2398,36 @@ function gn(t, e, n) {
|
|
|
2328
2398
|
return s;
|
|
2329
2399
|
}(n), function(a) {
|
|
2330
2400
|
i && i(a), r(a);
|
|
2331
|
-
})),
|
|
2401
|
+
})), T({}, t, { rid: o, ts: (/* @__PURE__ */ new Date()).getTime() }, e ? { hasCallback: !0 } : {});
|
|
2332
2402
|
}
|
|
2333
|
-
function
|
|
2403
|
+
function Yi(t) {
|
|
2334
2404
|
t === void 0 && (t = {});
|
|
2335
|
-
var e = t.reducers || {}, n = t.initialUser || {}, r = (t.plugins || []).reduce(function(m,
|
|
2336
|
-
if (G(
|
|
2337
|
-
return m.middlewares = m.middlewares.concat(
|
|
2338
|
-
if (
|
|
2405
|
+
var e = t.reducers || {}, n = t.initialUser || {}, r = (t.plugins || []).reduce(function(m, g) {
|
|
2406
|
+
if (G(g))
|
|
2407
|
+
return m.middlewares = m.middlewares.concat(g), m;
|
|
2408
|
+
if (g.NAMESPACE && (g.name = g.NAMESPACE), !g.name)
|
|
2339
2409
|
throw new Error("https://lytics.dev/errors/1");
|
|
2340
|
-
|
|
2341
|
-
var
|
|
2342
|
-
return
|
|
2410
|
+
g.config || (g.config = {});
|
|
2411
|
+
var O = g.EVENTS ? Object.keys(g.EVENTS).map(function(z) {
|
|
2412
|
+
return g.EVENTS[z];
|
|
2343
2413
|
}) : [];
|
|
2344
|
-
m.pluginEnabled[
|
|
2345
|
-
var
|
|
2346
|
-
return z[W] = (
|
|
2347
|
-
for (var
|
|
2348
|
-
|
|
2349
|
-
return
|
|
2414
|
+
m.pluginEnabled[g.name] = !(g.enabled === !1 || g.config.enabled === !1), delete g.enabled, g.methods && (m.methods[g.name] = Object.keys(g.methods).reduce(function(z, W) {
|
|
2415
|
+
var D;
|
|
2416
|
+
return z[W] = (D = g.methods[W], function() {
|
|
2417
|
+
for (var Z = Array.prototype.slice.call(arguments), N = new Array(D.length), q = 0; q < Z.length; q++)
|
|
2418
|
+
N[q] = Z[q];
|
|
2419
|
+
return N[N.length] = b, D.apply({ instance: b }, N);
|
|
2350
2420
|
}), z;
|
|
2351
|
-
}, {}), delete
|
|
2352
|
-
var C = Object.keys(
|
|
2353
|
-
if (m.events = Array.from($), m.pluginsArray = m.pluginsArray.concat(
|
|
2354
|
-
throw new Error(
|
|
2355
|
-
return m.plugins[
|
|
2421
|
+
}, {}), delete g.methods);
|
|
2422
|
+
var C = Object.keys(g).concat(O), $ = new Set(m.events.concat(C));
|
|
2423
|
+
if (m.events = Array.from($), m.pluginsArray = m.pluginsArray.concat(g), m.plugins[g.name])
|
|
2424
|
+
throw new Error(g.name + "AlreadyLoaded");
|
|
2425
|
+
return m.plugins[g.name] = g, m.plugins[g.name].loaded || (m.plugins[g.name].loaded = function() {
|
|
2356
2426
|
return !0;
|
|
2357
2427
|
}), m;
|
|
2358
2428
|
}, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), i = t.storage ? t.storage : { getItem: me, setItem: ge, removeItem: je }, o = /* @__PURE__ */ function(m) {
|
|
2359
|
-
return function(
|
|
2360
|
-
return
|
|
2429
|
+
return function(g, O, C) {
|
|
2430
|
+
return O.getState("user")[g] || (C && X(C) && C[g] ? C[g] : nn(m)[g] || me(_t(g)) || null);
|
|
2361
2431
|
};
|
|
2362
2432
|
}(i), a = r.plugins, s = r.events.filter(function(m) {
|
|
2363
2433
|
return !It.includes(m);
|
|
@@ -2365,82 +2435,82 @@ function Vi(t) {
|
|
|
2365
2435
|
return !It.includes(m);
|
|
2366
2436
|
})), f = Array.from(p).sort(), u = function() {
|
|
2367
2437
|
return a;
|
|
2368
|
-
}, c = new
|
|
2438
|
+
}, c = new Ni(), h = c.addMiddleware, d = c.removeMiddleware, w = c.dynamicMiddlewares, I = function() {
|
|
2369
2439
|
throw new Error("Abort disabled inListener");
|
|
2370
|
-
},
|
|
2371
|
-
|
|
2372
|
-
var
|
|
2373
|
-
return new Promise(function(
|
|
2374
|
-
|
|
2440
|
+
}, y = _i(), S = nn(i), E = T({}, S, n, y.an_uid ? { userId: y.an_uid } : {}, y.an_aid ? { anonymousId: y.an_aid } : {});
|
|
2441
|
+
E.anonymousId || (E.anonymousId = it());
|
|
2442
|
+
var v = T({ enable: function(m, g) {
|
|
2443
|
+
return new Promise(function(O) {
|
|
2444
|
+
x.dispatch({ type: P.enablePlugin, plugins: mt(m), _: { originalAction: P.enablePlugin } }, O, [g]);
|
|
2375
2445
|
});
|
|
2376
|
-
}, disable: function(m,
|
|
2377
|
-
return new Promise(function(
|
|
2378
|
-
|
|
2446
|
+
}, disable: function(m, g) {
|
|
2447
|
+
return new Promise(function(O) {
|
|
2448
|
+
x.dispatch({ type: P.disablePlugin, plugins: mt(m), _: { originalAction: P.disablePlugin } }, O, [g]);
|
|
2379
2449
|
});
|
|
2380
|
-
} }, r.methods), l = !1,
|
|
2450
|
+
} }, r.methods), l = !1, b = { identify: function(m, g, O, C) {
|
|
2381
2451
|
try {
|
|
2382
|
-
var $ = re(m) ? m : null, z =
|
|
2452
|
+
var $ = re(m) ? m : null, z = X(m) ? m : g, W = O || {}, D = b.user();
|
|
2383
2453
|
ge(_t(te), $);
|
|
2384
|
-
var
|
|
2385
|
-
return Promise.resolve(new Promise(function(
|
|
2386
|
-
|
|
2454
|
+
var Z = $ || z.userId || o(te, b, z);
|
|
2455
|
+
return Promise.resolve(new Promise(function(N) {
|
|
2456
|
+
x.dispatch(T({ type: P.identifyStart, userId: Z, traits: z || {}, options: W, anonymousId: D.anonymousId }, D.id && D.id !== $ && { previousId: D.id }), N, [g, O, C]);
|
|
2387
2457
|
}));
|
|
2388
|
-
} catch (
|
|
2389
|
-
return Promise.reject(
|
|
2458
|
+
} catch (N) {
|
|
2459
|
+
return Promise.reject(N);
|
|
2390
2460
|
}
|
|
2391
|
-
}, track: function(m,
|
|
2461
|
+
}, track: function(m, g, O, C) {
|
|
2392
2462
|
try {
|
|
2393
|
-
var $ =
|
|
2463
|
+
var $ = X(m) ? m.event : m;
|
|
2394
2464
|
if (!$ || !re($))
|
|
2395
2465
|
throw new Error("EventMissing");
|
|
2396
|
-
var z =
|
|
2397
|
-
return Promise.resolve(new Promise(function(
|
|
2398
|
-
|
|
2466
|
+
var z = X(m) ? m : g || {}, W = X(O) ? O : {};
|
|
2467
|
+
return Promise.resolve(new Promise(function(D) {
|
|
2468
|
+
x.dispatch({ type: P.trackStart, event: $, properties: z, options: W, userId: o(te, b, g), anonymousId: o(be, b, g) }, D, [g, O, C]);
|
|
2399
2469
|
}));
|
|
2400
|
-
} catch (
|
|
2401
|
-
return Promise.reject(
|
|
2470
|
+
} catch (D) {
|
|
2471
|
+
return Promise.reject(D);
|
|
2402
2472
|
}
|
|
2403
|
-
}, page: function(m,
|
|
2473
|
+
}, page: function(m, g, O) {
|
|
2404
2474
|
try {
|
|
2405
|
-
var C =
|
|
2475
|
+
var C = X(m) ? m : {}, $ = X(g) ? g : {};
|
|
2406
2476
|
return Promise.resolve(new Promise(function(z) {
|
|
2407
|
-
|
|
2477
|
+
x.dispatch({ type: P.pageStart, properties: Wi(C), options: $, userId: o(te, b, C), anonymousId: o(be, b, C) }, z, [m, g, O]);
|
|
2408
2478
|
}));
|
|
2409
2479
|
} catch (z) {
|
|
2410
2480
|
return Promise.reject(z);
|
|
2411
2481
|
}
|
|
2412
2482
|
}, user: function(m) {
|
|
2413
2483
|
if (m === te || m === "id")
|
|
2414
|
-
return o(te,
|
|
2484
|
+
return o(te, b);
|
|
2415
2485
|
if (m === be || m === "anonId")
|
|
2416
|
-
return o(be,
|
|
2417
|
-
var
|
|
2418
|
-
return m ? Yt(
|
|
2486
|
+
return o(be, b);
|
|
2487
|
+
var g = b.getState("user");
|
|
2488
|
+
return m ? Yt(g, m) : g;
|
|
2419
2489
|
}, reset: function(m) {
|
|
2420
|
-
return new Promise(function(
|
|
2421
|
-
|
|
2490
|
+
return new Promise(function(g) {
|
|
2491
|
+
x.dispatch({ type: P.resetStart }, g, m);
|
|
2422
2492
|
});
|
|
2423
2493
|
}, ready: function(m) {
|
|
2424
|
-
return l && m({ plugins:
|
|
2425
|
-
m(
|
|
2494
|
+
return l && m({ plugins: v, instance: b }), b.on(P.ready, function(g) {
|
|
2495
|
+
m(g), l = !0;
|
|
2426
2496
|
});
|
|
2427
|
-
}, on: function(m,
|
|
2428
|
-
if (!m || !G(
|
|
2497
|
+
}, on: function(m, g) {
|
|
2498
|
+
if (!m || !G(g))
|
|
2429
2499
|
return !1;
|
|
2430
|
-
if (m ===
|
|
2500
|
+
if (m === P.bootstrap)
|
|
2431
2501
|
throw new Error(".on disabled for " + m);
|
|
2432
|
-
var
|
|
2502
|
+
var O = /Start$|Start:/;
|
|
2433
2503
|
if (m === "*") {
|
|
2434
|
-
var C = function(
|
|
2435
|
-
return function(
|
|
2436
|
-
return function(
|
|
2437
|
-
return
|
|
2504
|
+
var C = function(D) {
|
|
2505
|
+
return function(Z) {
|
|
2506
|
+
return function(N) {
|
|
2507
|
+
return N.type.match(O) && g({ payload: N, instance: b, plugins: a }), Z(N);
|
|
2438
2508
|
};
|
|
2439
2509
|
};
|
|
2440
|
-
}, $ = function(
|
|
2441
|
-
return function(
|
|
2442
|
-
return function(
|
|
2443
|
-
return
|
|
2510
|
+
}, $ = function(D) {
|
|
2511
|
+
return function(Z) {
|
|
2512
|
+
return function(N) {
|
|
2513
|
+
return N.type.match(O) || g({ payload: N, instance: b, plugins: a }), Z(N);
|
|
2444
2514
|
};
|
|
2445
2515
|
};
|
|
2446
2516
|
};
|
|
@@ -2448,114 +2518,114 @@ function Vi(t) {
|
|
|
2448
2518
|
d(C, He), d($, Ve);
|
|
2449
2519
|
};
|
|
2450
2520
|
}
|
|
2451
|
-
var z = m.match(
|
|
2452
|
-
return function(
|
|
2453
|
-
return function(
|
|
2454
|
-
return
|
|
2521
|
+
var z = m.match(O) ? He : Ve, W = function(D) {
|
|
2522
|
+
return function(Z) {
|
|
2523
|
+
return function(N) {
|
|
2524
|
+
return N.type === m && g({ payload: N, instance: b, plugins: a, abort: I }), Z(N);
|
|
2455
2525
|
};
|
|
2456
2526
|
};
|
|
2457
2527
|
};
|
|
2458
2528
|
return h(W, z), function() {
|
|
2459
2529
|
return d(W, z);
|
|
2460
2530
|
};
|
|
2461
|
-
}, once: function(m,
|
|
2462
|
-
if (!m || !G(
|
|
2531
|
+
}, once: function(m, g) {
|
|
2532
|
+
if (!m || !G(g))
|
|
2463
2533
|
return !1;
|
|
2464
|
-
if (m ===
|
|
2534
|
+
if (m === P.bootstrap)
|
|
2465
2535
|
throw new Error(".once disabled for " + m);
|
|
2466
|
-
var
|
|
2467
|
-
|
|
2536
|
+
var O = b.on(m, function(C) {
|
|
2537
|
+
g({ payload: C.payload, instance: b, plugins: a, abort: I }), O();
|
|
2468
2538
|
});
|
|
2469
|
-
return
|
|
2539
|
+
return O;
|
|
2470
2540
|
}, getState: function(m) {
|
|
2471
|
-
var
|
|
2472
|
-
return m ? Yt(
|
|
2541
|
+
var g = x.getState();
|
|
2542
|
+
return m ? Yt(g, m) : Object.assign({}, g);
|
|
2473
2543
|
}, dispatch: function(m) {
|
|
2474
|
-
var
|
|
2475
|
-
if (Be.includes(
|
|
2476
|
-
throw new Error("reserved action " +
|
|
2477
|
-
var
|
|
2478
|
-
|
|
2479
|
-
}, enablePlugin:
|
|
2480
|
-
|
|
2481
|
-
}, removeItem: function(m,
|
|
2482
|
-
|
|
2483
|
-
} }, setAnonymousId: function(m,
|
|
2484
|
-
|
|
2485
|
-
}, events: { core: Be, plugins: s } },
|
|
2486
|
-
return function(
|
|
2487
|
-
return function(
|
|
2488
|
-
return
|
|
2544
|
+
var g = re(m) ? { type: m } : m;
|
|
2545
|
+
if (Be.includes(g.type))
|
|
2546
|
+
throw new Error("reserved action " + g.type);
|
|
2547
|
+
var O = T({}, g, { _: T({ originalAction: g.type }, m._ || {}) });
|
|
2548
|
+
x.dispatch(O);
|
|
2549
|
+
}, enablePlugin: v.enable, disablePlugin: v.disable, plugins: v, storage: { getItem: i.getItem, setItem: function(m, g, O) {
|
|
2550
|
+
x.dispatch({ type: P.setItemStart, key: m, value: g, options: O });
|
|
2551
|
+
}, removeItem: function(m, g) {
|
|
2552
|
+
x.dispatch({ type: P.removeItemStart, key: m, options: g });
|
|
2553
|
+
} }, setAnonymousId: function(m, g) {
|
|
2554
|
+
b.storage.setItem(ie, m, g);
|
|
2555
|
+
}, events: { core: Be, plugins: s } }, j = r.middlewares.concat([function(m) {
|
|
2556
|
+
return function(g) {
|
|
2557
|
+
return function(O) {
|
|
2558
|
+
return O.meta || (O.meta = gn()), g(O);
|
|
2489
2559
|
};
|
|
2490
2560
|
};
|
|
2491
|
-
},
|
|
2561
|
+
}, w(He), Ai(b, u, { all: f, plugins: s }), zi(i), Ti(b), xi(b), w(Ve)]), k = { context: Xi, user: ji(i), page: Ji, track: Li, plugins: Di(u), queue: Zi }, _ = Te, A = Te;
|
|
2492
2562
|
if (Y && t.debug) {
|
|
2493
|
-
var
|
|
2494
|
-
|
|
2495
|
-
return arguments.length === 0 ? rr() :
|
|
2563
|
+
var U = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
|
2564
|
+
U && (_ = U({ trace: !0, traceLimit: 25 })), A = function() {
|
|
2565
|
+
return arguments.length === 0 ? rr() : X(typeof arguments[0]) ? mn() : mn().apply(null, arguments);
|
|
2496
2566
|
};
|
|
2497
2567
|
}
|
|
2498
|
-
var
|
|
2499
|
-
return Object.keys(m).reduce(function(
|
|
2500
|
-
return
|
|
2568
|
+
var R, L = function(m) {
|
|
2569
|
+
return Object.keys(m).reduce(function(g, O) {
|
|
2570
|
+
return Fi.includes(O) || (g[O] = m[O]), g;
|
|
2501
2571
|
}, {});
|
|
2502
|
-
}(t), H = r.pluginsArray.reduce(function(m,
|
|
2503
|
-
var
|
|
2504
|
-
return m[
|
|
2505
|
-
}, {}),
|
|
2506
|
-
for (var
|
|
2507
|
-
var $ =
|
|
2508
|
-
typeof m[$] === ne && (
|
|
2572
|
+
}(t), H = r.pluginsArray.reduce(function(m, g) {
|
|
2573
|
+
var O = g.name, C = g.config, $ = g.loaded, z = r.pluginEnabled[O];
|
|
2574
|
+
return m[O] = { enabled: z, initialized: !!z && !g.initialize, loaded: !!$({ config: C }), config: C }, m;
|
|
2575
|
+
}, {}), M = { context: L, user: E, plugins: H }, x = Hn(function(m) {
|
|
2576
|
+
for (var g = Object.keys(m), O = {}, C = 0; C < g.length; C++) {
|
|
2577
|
+
var $ = g[C];
|
|
2578
|
+
typeof m[$] === ne && (O[$] = m[$]);
|
|
2509
2579
|
}
|
|
2510
|
-
var z, W = Object.keys(
|
|
2580
|
+
var z, W = Object.keys(O);
|
|
2511
2581
|
try {
|
|
2512
|
-
(function(
|
|
2513
|
-
Object.keys(
|
|
2514
|
-
var
|
|
2515
|
-
if (typeof
|
|
2516
|
-
throw new Error("reducer " +
|
|
2582
|
+
(function(D) {
|
|
2583
|
+
Object.keys(D).forEach(function(Z) {
|
|
2584
|
+
var N = D[Z];
|
|
2585
|
+
if (typeof N(void 0, { type: "@@redux/INIT" }) === ee || typeof N(void 0, { type: Ei }) === ee)
|
|
2586
|
+
throw new Error("reducer " + Z + " " + ee);
|
|
2517
2587
|
});
|
|
2518
|
-
})(
|
|
2519
|
-
} catch (
|
|
2520
|
-
z =
|
|
2588
|
+
})(O);
|
|
2589
|
+
} catch (D) {
|
|
2590
|
+
z = D;
|
|
2521
2591
|
}
|
|
2522
|
-
return function(
|
|
2523
|
-
if (
|
|
2592
|
+
return function(D, Z) {
|
|
2593
|
+
if (D === void 0 && (D = {}), z)
|
|
2524
2594
|
throw z;
|
|
2525
|
-
for (var
|
|
2526
|
-
var
|
|
2595
|
+
for (var N = !1, q = {}, $e = 0; $e < W.length; $e++) {
|
|
2596
|
+
var We = W[$e], Dt = D[We], st = (0, O[We])(Dt, Z);
|
|
2527
2597
|
if (typeof st === ee) {
|
|
2528
|
-
var
|
|
2529
|
-
throw new Error(
|
|
2598
|
+
var pr = Oi(We, Z);
|
|
2599
|
+
throw new Error(pr);
|
|
2530
2600
|
}
|
|
2531
|
-
q[
|
|
2601
|
+
q[We] = st, N = N || st !== Dt;
|
|
2532
2602
|
}
|
|
2533
|
-
return
|
|
2603
|
+
return N ? q : D;
|
|
2534
2604
|
};
|
|
2535
|
-
}(
|
|
2536
|
-
|
|
2537
|
-
var C =
|
|
2538
|
-
return
|
|
2605
|
+
}(T({}, k, e)), M, A(_(Pi.apply(void 0, j))));
|
|
2606
|
+
x.dispatch = (R = x.dispatch, function(m, g, O) {
|
|
2607
|
+
var C = T({}, m, { meta: gn(m.meta, g, mt(O)) });
|
|
2608
|
+
return R.apply(null, [C]);
|
|
2539
2609
|
});
|
|
2540
2610
|
var K = Object.keys(a);
|
|
2541
|
-
|
|
2542
|
-
var
|
|
2611
|
+
x.dispatch({ type: P.bootstrap, plugins: K, config: L, params: y, user: E, initialUser: n, persistedUser: S });
|
|
2612
|
+
var J = K.filter(function(m) {
|
|
2543
2613
|
return r.pluginEnabled[m];
|
|
2544
2614
|
}), Ce = K.filter(function(m) {
|
|
2545
2615
|
return !r.pluginEnabled[m];
|
|
2546
2616
|
});
|
|
2547
|
-
return
|
|
2548
|
-
var
|
|
2549
|
-
|
|
2550
|
-
}),
|
|
2551
|
-
|
|
2552
|
-
}), function(m,
|
|
2617
|
+
return x.dispatch({ type: P.registerPlugins, plugins: K, enabled: r.pluginEnabled }), r.pluginsArray.map(function(m, g) {
|
|
2618
|
+
var O = m.bootstrap, C = m.config, $ = m.name;
|
|
2619
|
+
O && G(O) && O({ instance: b, config: C, payload: m }), x.dispatch({ type: P.registerPluginType($), name: $, enabled: r.pluginEnabled[$], plugin: m }), r.pluginsArray.length === g + 1 && x.dispatch({ type: P.initializeStart, plugins: J, disabled: Ce });
|
|
2620
|
+
}), Vi(function(m) {
|
|
2621
|
+
x.dispatch({ type: m ? P.offline : P.online });
|
|
2622
|
+
}), function(m, g, O) {
|
|
2553
2623
|
setInterval(function() {
|
|
2554
|
-
return Yn(m,
|
|
2624
|
+
return Yn(m, g, O);
|
|
2555
2625
|
}, 3e3);
|
|
2556
|
-
}(
|
|
2626
|
+
}(x, u, b), b;
|
|
2557
2627
|
}
|
|
2558
|
-
var He = "before", Ve = "after",
|
|
2628
|
+
var He = "before", Ve = "after", Ue = "cookie", ue = ar(), ir = ot, Gi = ot;
|
|
2559
2629
|
function or(t) {
|
|
2560
2630
|
return ue ? ot(t, "", -1) : je(t);
|
|
2561
2631
|
}
|
|
@@ -2576,11 +2646,11 @@ function ot(t, e, n, r, i, o) {
|
|
|
2576
2646
|
return ue === !1 && (a ? ge(t, e) : me(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]);
|
|
2577
2647
|
}
|
|
2578
2648
|
}
|
|
2579
|
-
var
|
|
2649
|
+
var Le = "localStorage", Bi = jt.bind(null, "localStorage");
|
|
2580
2650
|
xe("localStorage", "getItem", me);
|
|
2581
2651
|
xe("localStorage", "setItem", ge);
|
|
2582
2652
|
xe("localStorage", "removeItem", je);
|
|
2583
|
-
var Re = "sessionStorage",
|
|
2653
|
+
var Re = "sessionStorage", qi = jt.bind(null, "sessionStorage");
|
|
2584
2654
|
xe("sessionStorage", "getItem", me);
|
|
2585
2655
|
xe("sessionStorage", "setItem", ge);
|
|
2586
2656
|
xe("sessionStorage", "removeItem", je);
|
|
@@ -2591,7 +2661,7 @@ function _e(t) {
|
|
|
2591
2661
|
return !0;
|
|
2592
2662
|
if (e === "false")
|
|
2593
2663
|
return !1;
|
|
2594
|
-
if (
|
|
2664
|
+
if (X(e))
|
|
2595
2665
|
return e;
|
|
2596
2666
|
parseFloat(e) === e && (e = parseFloat(e));
|
|
2597
2667
|
} catch {
|
|
@@ -2599,57 +2669,57 @@ function _e(t) {
|
|
|
2599
2669
|
if (e !== null && e !== "")
|
|
2600
2670
|
return e;
|
|
2601
2671
|
}
|
|
2602
|
-
var
|
|
2672
|
+
var Qi = Bi(), eo = qi(), to = ar();
|
|
2603
2673
|
function sr(t, e) {
|
|
2604
2674
|
if (t) {
|
|
2605
|
-
var n = xt(e), r = !
|
|
2675
|
+
var n = xt(e), r = !zt(n), i = Ct(n) ? _e(localStorage.getItem(t)) : void 0;
|
|
2606
2676
|
if (r && !we(i))
|
|
2607
2677
|
return i;
|
|
2608
2678
|
var o = $t(n) ? _e(ir(t)) : void 0;
|
|
2609
2679
|
if (r && o)
|
|
2610
2680
|
return o;
|
|
2611
|
-
var a =
|
|
2681
|
+
var a = At(n) ? _e(sessionStorage.getItem(t)) : void 0;
|
|
2612
2682
|
if (r && a)
|
|
2613
2683
|
return a;
|
|
2614
2684
|
var s = me(t);
|
|
2615
2685
|
return r ? s : { localStorage: i, sessionStorage: a, cookie: o, global: s };
|
|
2616
2686
|
}
|
|
2617
2687
|
}
|
|
2618
|
-
function
|
|
2688
|
+
function no(t, e, n) {
|
|
2619
2689
|
if (t && !we(e)) {
|
|
2620
|
-
var r = {}, i = xt(n), o = JSON.stringify(e), a = !
|
|
2621
|
-
return Ct(i) && (r[
|
|
2690
|
+
var r = {}, i = xt(n), o = JSON.stringify(e), a = !zt(i);
|
|
2691
|
+
return Ct(i) && (r[Le] = Ye(Le, e, _e(localStorage.getItem(t))), localStorage.setItem(t, o), a) ? r[Le] : $t(i) && (r[Ue] = Ye(Ue, e, _e(ir(t))), Gi(t, o), a) ? r[Ue] : At(i) && (r[Re] = Ye(Re, e, _e(sessionStorage.getItem(t))), sessionStorage.setItem(t, o), a) ? r[Re] : (r[De] = Ye(De, e, me(t)), ge(t, e), a ? r[De] : r);
|
|
2622
2692
|
}
|
|
2623
2693
|
}
|
|
2624
|
-
function
|
|
2694
|
+
function ro(t, e) {
|
|
2625
2695
|
if (t) {
|
|
2626
|
-
var n = xt(e), r = sr(t,
|
|
2627
|
-
return !we(r.localStorage) && Ct(n) && (localStorage.removeItem(t), i[
|
|
2696
|
+
var n = xt(e), r = sr(t, Wn), i = {};
|
|
2697
|
+
return !we(r.localStorage) && Ct(n) && (localStorage.removeItem(t), i[Le] = r.localStorage), !we(r.cookie) && $t(n) && (or(t), i[Ue] = r.cookie), !we(r.sessionStorage) && At(n) && (sessionStorage.removeItem(t), i[Re] = r.sessionStorage), !we(r.global) && at(n, De) && (je(t), i[De] = r.global), i;
|
|
2628
2698
|
}
|
|
2629
2699
|
}
|
|
2630
2700
|
function xt(t) {
|
|
2631
|
-
return t ? re(t) ? t : t.storage :
|
|
2701
|
+
return t ? re(t) ? t : t.storage : Mn;
|
|
2632
2702
|
}
|
|
2633
2703
|
function Ct(t) {
|
|
2634
|
-
return
|
|
2704
|
+
return Qi && at(t, Le);
|
|
2635
2705
|
}
|
|
2636
2706
|
function $t(t) {
|
|
2637
|
-
return
|
|
2638
|
-
}
|
|
2639
|
-
function zt(t) {
|
|
2640
|
-
return Qi && at(t, Re);
|
|
2707
|
+
return to && at(t, Ue);
|
|
2641
2708
|
}
|
|
2642
2709
|
function At(t) {
|
|
2643
|
-
return
|
|
2710
|
+
return eo && at(t, Re);
|
|
2711
|
+
}
|
|
2712
|
+
function zt(t) {
|
|
2713
|
+
return t === Wn || t === "all";
|
|
2644
2714
|
}
|
|
2645
2715
|
function at(t, e) {
|
|
2646
|
-
return t ===
|
|
2716
|
+
return t === Mn || t === e || zt(t);
|
|
2647
2717
|
}
|
|
2648
2718
|
function Ye(t, e, n) {
|
|
2649
2719
|
return { location: t, current: e, previous: n };
|
|
2650
2720
|
}
|
|
2651
|
-
var
|
|
2652
|
-
function
|
|
2721
|
+
var io = { setItem: no, getItem: sr, removeItem: ro };
|
|
2722
|
+
function oo(t, e, n) {
|
|
2653
2723
|
return e in t ? Object.defineProperty(t, e, {
|
|
2654
2724
|
value: n,
|
|
2655
2725
|
enumerable: !0,
|
|
@@ -2671,20 +2741,20 @@ function vn(t) {
|
|
|
2671
2741
|
for (var e = 1; e < arguments.length; e++) {
|
|
2672
2742
|
var n = arguments[e] != null ? arguments[e] : {};
|
|
2673
2743
|
e % 2 ? yn(Object(n), !0).forEach(function(r) {
|
|
2674
|
-
|
|
2744
|
+
oo(t, r, n[r]);
|
|
2675
2745
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : yn(Object(n)).forEach(function(r) {
|
|
2676
2746
|
Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
|
|
2677
2747
|
});
|
|
2678
2748
|
}
|
|
2679
2749
|
return t;
|
|
2680
2750
|
}
|
|
2681
|
-
function
|
|
2751
|
+
function ao() {
|
|
2682
2752
|
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = {
|
|
2683
|
-
storage:
|
|
2753
|
+
storage: io
|
|
2684
2754
|
};
|
|
2685
|
-
return
|
|
2755
|
+
return Yi(vn(vn({}, e), t));
|
|
2686
2756
|
}
|
|
2687
|
-
function
|
|
2757
|
+
function so(t, e) {
|
|
2688
2758
|
e = e || {};
|
|
2689
2759
|
var n, r, i = [], o = e.max || 1 / 0;
|
|
2690
2760
|
function a() {
|
|
@@ -2706,7 +2776,7 @@ function ao(t, e) {
|
|
|
2706
2776
|
}
|
|
2707
2777
|
};
|
|
2708
2778
|
}
|
|
2709
|
-
function
|
|
2779
|
+
function co(t) {
|
|
2710
2780
|
if (typeof window > "u")
|
|
2711
2781
|
return;
|
|
2712
2782
|
const { addEventListener: e, history: n, location: r } = window;
|
|
@@ -2718,27 +2788,27 @@ function so(t) {
|
|
|
2718
2788
|
const s = n[a];
|
|
2719
2789
|
n[a] = function(...p) {
|
|
2720
2790
|
var c;
|
|
2721
|
-
const f = ((c = p[2]) == null ? void 0 : c.toString()) || "", u =
|
|
2791
|
+
const f = ((c = p[2]) == null ? void 0 : c.toString()) || "", u = lo(f);
|
|
2722
2792
|
return i !== u && (i = u, setTimeout(() => t(f), 0)), s.apply(n, p);
|
|
2723
2793
|
};
|
|
2724
2794
|
});
|
|
2725
2795
|
}
|
|
2726
|
-
function
|
|
2796
|
+
function uo(t, e) {
|
|
2727
2797
|
const n = t.indexOf(e);
|
|
2728
2798
|
return n > -1 ? t.slice(0, n) : t;
|
|
2729
2799
|
}
|
|
2730
|
-
function
|
|
2731
|
-
return ["#", "?"].forEach((e) => t =
|
|
2800
|
+
function lo(t) {
|
|
2801
|
+
return ["#", "?"].forEach((e) => t = uo(t, e)), t;
|
|
2732
2802
|
}
|
|
2733
|
-
function
|
|
2734
|
-
|
|
2803
|
+
function ho() {
|
|
2804
|
+
co(() => {
|
|
2735
2805
|
se.page();
|
|
2736
2806
|
});
|
|
2737
2807
|
}
|
|
2738
2808
|
var wn = "EventListener";
|
|
2739
|
-
function
|
|
2809
|
+
function fo(t) {
|
|
2740
2810
|
return function(e, n, r, i) {
|
|
2741
|
-
var o = r ||
|
|
2811
|
+
var o = r || li, a = i || !1;
|
|
2742
2812
|
if (!Y)
|
|
2743
2813
|
return o;
|
|
2744
2814
|
var s = et(n), p = et(e, !0);
|
|
@@ -2750,10 +2820,10 @@ function ho(t) {
|
|
|
2750
2820
|
return function u(c) {
|
|
2751
2821
|
c && (f = []);
|
|
2752
2822
|
for (var h = c ? "add" + wn : "remove" + wn, d = 0; d < p.length; d++) {
|
|
2753
|
-
var
|
|
2754
|
-
f[d] = c ? a && a.once ?
|
|
2755
|
-
for (var
|
|
2756
|
-
|
|
2823
|
+
var w = p[d];
|
|
2824
|
+
f[d] = c ? a && a.once ? po(o) : o : f[d] || o;
|
|
2825
|
+
for (var I = 0; I < s.length; I++)
|
|
2826
|
+
w[h] ? w["on" + s[I]] = c ? f[d] : null : w[h](s[I], f[d], a);
|
|
2757
2827
|
}
|
|
2758
2828
|
return u.bind(null, !c);
|
|
2759
2829
|
}(t);
|
|
@@ -2770,18 +2840,18 @@ function et(t, e) {
|
|
|
2770
2840
|
r[i] = t[i];
|
|
2771
2841
|
return r;
|
|
2772
2842
|
}
|
|
2773
|
-
var o =
|
|
2843
|
+
var o = bi(t);
|
|
2774
2844
|
return e ? o.map(function(a) {
|
|
2775
2845
|
return re(a) ? et(a, !0) : a;
|
|
2776
2846
|
}).flat() : o;
|
|
2777
2847
|
}
|
|
2778
|
-
function
|
|
2848
|
+
function po(t, e) {
|
|
2779
2849
|
var n;
|
|
2780
2850
|
return function() {
|
|
2781
2851
|
return t && (n = t.apply(e || this, arguments), t = null), n;
|
|
2782
2852
|
};
|
|
2783
2853
|
}
|
|
2784
|
-
var gt =
|
|
2854
|
+
var gt = fo("Event");
|
|
2785
2855
|
function cr(t, e) {
|
|
2786
2856
|
return Y && G(window[t]) ? (n = window[t], r = e, (i = window) === void 0 && (i = null), G(n) ? function() {
|
|
2787
2857
|
n.apply(i, arguments), r.apply(i, arguments);
|
|
@@ -2791,10 +2861,10 @@ function cr(t, e) {
|
|
|
2791
2861
|
cr.bind(null, "onerror");
|
|
2792
2862
|
cr.bind(null, "onload");
|
|
2793
2863
|
var ur = typeof window > "u", bn = "hidden";
|
|
2794
|
-
function
|
|
2864
|
+
function mo(t) {
|
|
2795
2865
|
if (ur)
|
|
2796
2866
|
return !1;
|
|
2797
|
-
var e =
|
|
2867
|
+
var e = go(), n = "".concat(e.replace(/[H|h]idden/, ""), "visibilitychange"), r = function() {
|
|
2798
2868
|
return t(!!document[e]);
|
|
2799
2869
|
}, i = function() {
|
|
2800
2870
|
return document.addEventListener(n, r);
|
|
@@ -2803,15 +2873,15 @@ function po(t) {
|
|
|
2803
2873
|
return document.removeEventListener(n, r), i;
|
|
2804
2874
|
};
|
|
2805
2875
|
}
|
|
2806
|
-
function
|
|
2876
|
+
function go() {
|
|
2807
2877
|
var t = ["webkit", "moz", "ms", "o"];
|
|
2808
2878
|
return ur || bn in document ? bn : t.reduce(function(e, n) {
|
|
2809
2879
|
var r = n + "Hidden";
|
|
2810
2880
|
return !e && r in document ? r : e;
|
|
2811
2881
|
}, null);
|
|
2812
2882
|
}
|
|
2813
|
-
var
|
|
2814
|
-
function
|
|
2883
|
+
var yo = ["mousemove", "mousedown", "touchmove", "touchstart", "touchend", "keydown"];
|
|
2884
|
+
function vo(t, e) {
|
|
2815
2885
|
e === void 0 && (e = {});
|
|
2816
2886
|
var n = /* @__PURE__ */ function(a, s) {
|
|
2817
2887
|
var p = this, f = !1;
|
|
@@ -2822,10 +2892,10 @@ function yo(t, e) {
|
|
|
2822
2892
|
};
|
|
2823
2893
|
}(t, e.throttle || 1e4), r = [];
|
|
2824
2894
|
function i() {
|
|
2825
|
-
var a =
|
|
2895
|
+
var a = mo(function(s) {
|
|
2826
2896
|
s || n({ type: "tabVisible" });
|
|
2827
2897
|
});
|
|
2828
|
-
return r = [a].concat(
|
|
2898
|
+
return r = [a].concat(yo.map(function(s) {
|
|
2829
2899
|
return gt(document, s, n);
|
|
2830
2900
|
})).concat(gt(window, "load", n)).concat(gt(window, "scroll", n, { capture: !0, passive: !0 })), o;
|
|
2831
2901
|
}
|
|
@@ -2838,31 +2908,31 @@ function yo(t, e) {
|
|
|
2838
2908
|
return o(), i;
|
|
2839
2909
|
};
|
|
2840
2910
|
}
|
|
2841
|
-
function
|
|
2911
|
+
function wo(t) {
|
|
2842
2912
|
var e, n, r = t.onIdle, i = t.onWakeUp, o = t.onHeartbeat, a = t.timeout, s = a === void 0 ? 1e4 : a, p = t.throttle, f = p === void 0 ? 2e3 : p, u = !1, c = !1, h = /* @__PURE__ */ new Date(), d = function() {
|
|
2843
2913
|
return clearTimeout(e);
|
|
2844
2914
|
};
|
|
2845
|
-
function
|
|
2846
|
-
d(), o && !u && o(
|
|
2847
|
-
u = !0, r && (n = /* @__PURE__ */ new Date(), r(
|
|
2915
|
+
function w(y) {
|
|
2916
|
+
d(), o && !u && o(ze(h), y), i && u && (u = !1, i(ze(n), y), h = /* @__PURE__ */ new Date()), e = setTimeout(function() {
|
|
2917
|
+
u = !0, r && (n = /* @__PURE__ */ new Date(), r(ze(h), y));
|
|
2848
2918
|
}, s);
|
|
2849
2919
|
}
|
|
2850
|
-
var
|
|
2920
|
+
var I = vo(w, { throttle: f });
|
|
2851
2921
|
return { disable: function() {
|
|
2852
2922
|
c = !0, u = !1, d();
|
|
2853
|
-
var
|
|
2923
|
+
var y = I();
|
|
2854
2924
|
return function() {
|
|
2855
|
-
return c = !1, h = /* @__PURE__ */ new Date(),
|
|
2925
|
+
return c = !1, h = /* @__PURE__ */ new Date(), w({ type: "load" }), y();
|
|
2856
2926
|
};
|
|
2857
2927
|
}, getStatus: function() {
|
|
2858
|
-
return { isIdle: u, isDisabled: c, active: u ? 0 :
|
|
2928
|
+
return { isIdle: u, isDisabled: c, active: u ? 0 : ze(h, c), idle: u ? ze(n, c) : 0 };
|
|
2859
2929
|
} };
|
|
2860
2930
|
}
|
|
2861
|
-
function
|
|
2931
|
+
function ze(t, e) {
|
|
2862
2932
|
return e ? 0 : Math.round((/* @__PURE__ */ new Date() - t) / 1e3);
|
|
2863
2933
|
}
|
|
2864
2934
|
const kn = 5e3;
|
|
2865
|
-
class
|
|
2935
|
+
class bo {
|
|
2866
2936
|
constructor(e) {
|
|
2867
2937
|
B(this, "element");
|
|
2868
2938
|
B(this, "isInViewport", !1);
|
|
@@ -2883,7 +2953,7 @@ class wo {
|
|
|
2883
2953
|
{
|
|
2884
2954
|
threshold: 0
|
|
2885
2955
|
}
|
|
2886
|
-
), this.observer.observe(this.element),
|
|
2956
|
+
), this.observer.observe(this.element), wo({
|
|
2887
2957
|
onIdle: (n) => this.handleAwake(!1, n),
|
|
2888
2958
|
onWakeUp: (n) => this.handleAwake(!0, n),
|
|
2889
2959
|
timeout: kn
|
|
@@ -2893,51 +2963,60 @@ class wo {
|
|
|
2893
2963
|
* Flush the awake timer in case the page is unloading
|
|
2894
2964
|
*/
|
|
2895
2965
|
flush() {
|
|
2896
|
-
this.isFlushing = !0, this.handleAwake(!this.isAwake
|
|
2966
|
+
this.isFlushing = !0, this.handleAwake(!this.isAwake);
|
|
2897
2967
|
}
|
|
2898
2968
|
handleInViewPort(e) {
|
|
2899
|
-
e ? (this.isAwake = !0, this.trackInViewport()) : this.handleAwake(!1
|
|
2969
|
+
e ? (this.isAwake = !0, this.trackInViewport()) : this.handleAwake(!1), this.isInViewport = e;
|
|
2900
2970
|
}
|
|
2901
|
-
handleAwake(e, n) {
|
|
2971
|
+
handleAwake(e, n = Math.round((Date.now() - this.lastEventAt) / 1e3)) {
|
|
2902
2972
|
this.isAwake = e, this.lastEventAt = e ? Date.now() - n * kn : Date.now(), this.isInViewport && this.trackAwake(e, n);
|
|
2903
2973
|
}
|
|
2974
|
+
handleVisibilityChange() {
|
|
2975
|
+
this.isAwake = !1;
|
|
2976
|
+
const e = Math.round((Date.now() - this.lastEventAt) / 1e3);
|
|
2977
|
+
e > 1 && (this.lastEventAt = Date.now(), this.trackAwake(!1, e));
|
|
2978
|
+
}
|
|
2904
2979
|
trackAwake(e, n) {
|
|
2905
|
-
!e && this.activeDurationCallback && this.activeDurationCallback(n, this.isFlushing), e && this.idleDurationCallback && this.idleDurationCallback(n, this.isFlushing);
|
|
2980
|
+
!e && this.activeDurationCallback && this.activeDurationCallback(n, this.isFlushing, this.lastEventAt), e && this.idleDurationCallback && this.idleDurationCallback(n, this.isFlushing, this.lastEventAt);
|
|
2906
2981
|
}
|
|
2907
2982
|
trackInViewport() {
|
|
2908
2983
|
this.registeredView || (this.registeredView = !0, this.viewCallback && this.viewCallback());
|
|
2909
2984
|
}
|
|
2910
2985
|
}
|
|
2911
2986
|
const In = "sesamy_session_id";
|
|
2912
|
-
function
|
|
2987
|
+
function ko() {
|
|
2913
2988
|
let t = sessionStorage.getItem(In);
|
|
2914
2989
|
return t || (t = Math.random().toString(36).slice(2, 9), sessionStorage.setItem(In, t)), t;
|
|
2915
2990
|
}
|
|
2916
2991
|
let lr = !1, St, _n, tt;
|
|
2917
|
-
function
|
|
2992
|
+
function Io({ clientId: t, enabled: e = !0, endpoint: n = Wr }) {
|
|
2918
2993
|
if (St = t, _n = e, tt = n, !_n)
|
|
2919
2994
|
return;
|
|
2920
|
-
|
|
2921
|
-
const r = new
|
|
2995
|
+
ho();
|
|
2996
|
+
const r = new bo({
|
|
2922
2997
|
element: document.body,
|
|
2923
2998
|
viewCallback: () => {
|
|
2924
2999
|
se.page();
|
|
2925
3000
|
},
|
|
2926
|
-
activeDurationCallback: (i, o) => {
|
|
3001
|
+
activeDurationCallback: (i, o, a) => {
|
|
2927
3002
|
se.track("activeDuration", {
|
|
2928
3003
|
duration: i,
|
|
3004
|
+
durationStart: a,
|
|
2929
3005
|
flushing: o
|
|
2930
3006
|
});
|
|
2931
3007
|
},
|
|
2932
|
-
idleDurationCallback: (i, o) => {
|
|
3008
|
+
idleDurationCallback: (i, o, a) => {
|
|
2933
3009
|
se.track("idleDuration", {
|
|
2934
3010
|
duration: i,
|
|
3011
|
+
durationStart: a,
|
|
2935
3012
|
flushing: o
|
|
2936
3013
|
});
|
|
2937
3014
|
}
|
|
2938
3015
|
});
|
|
2939
|
-
|
|
3016
|
+
So(document.body, () => {
|
|
2940
3017
|
r.flush();
|
|
3018
|
+
}), Eo(document.body, () => {
|
|
3019
|
+
r.handleVisibilityChange();
|
|
2941
3020
|
}), window.addEventListener(Se.AUTHENTICATED, async (i) => {
|
|
2942
3021
|
const o = i;
|
|
2943
3022
|
await se.identify(o.detail.sub);
|
|
@@ -2951,7 +3030,7 @@ function dr(t) {
|
|
|
2951
3030
|
...e,
|
|
2952
3031
|
clientId: St,
|
|
2953
3032
|
requestId: Math.random().toString(36).slice(2, 9),
|
|
2954
|
-
sessionId:
|
|
3033
|
+
sessionId: ko(),
|
|
2955
3034
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2956
3035
|
version: Tt,
|
|
2957
3036
|
event: e.event,
|
|
@@ -2971,7 +3050,7 @@ function dr(t) {
|
|
|
2971
3050
|
}))
|
|
2972
3051
|
);
|
|
2973
3052
|
}
|
|
2974
|
-
const Nt =
|
|
3053
|
+
const Nt = so(
|
|
2975
3054
|
async (t) => {
|
|
2976
3055
|
if (t.length > 0) {
|
|
2977
3056
|
const e = dr(t);
|
|
@@ -3000,7 +3079,7 @@ function yt(t) {
|
|
|
3000
3079
|
} else
|
|
3001
3080
|
Nt.push(t);
|
|
3002
3081
|
}
|
|
3003
|
-
const se =
|
|
3082
|
+
const se = ao({
|
|
3004
3083
|
app: Zn,
|
|
3005
3084
|
version: Tt,
|
|
3006
3085
|
plugins: [
|
|
@@ -3038,20 +3117,29 @@ const se = oo({
|
|
|
3038
3117
|
}
|
|
3039
3118
|
]
|
|
3040
3119
|
});
|
|
3041
|
-
function
|
|
3120
|
+
function _o() {
|
|
3042
3121
|
return lr = !0, Nt.flush();
|
|
3043
3122
|
}
|
|
3044
3123
|
const hr = /* @__PURE__ */ new Map();
|
|
3045
|
-
function
|
|
3124
|
+
function So(t, e) {
|
|
3046
3125
|
hr.set(t, e);
|
|
3047
3126
|
}
|
|
3048
3127
|
window.addEventListener("beforeunload", () => {
|
|
3049
3128
|
hr.forEach((t, e) => {
|
|
3050
3129
|
t.bind(e)();
|
|
3051
|
-
}),
|
|
3130
|
+
}), _o();
|
|
3131
|
+
});
|
|
3132
|
+
const fr = /* @__PURE__ */ new Map();
|
|
3133
|
+
function Eo(t, e) {
|
|
3134
|
+
fr.set(t, e);
|
|
3135
|
+
}
|
|
3136
|
+
window.addEventListener("visibilitychange", () => {
|
|
3137
|
+
document.visibilityState !== "visible" && fr.forEach((t, e) => {
|
|
3138
|
+
t.bind(e)();
|
|
3139
|
+
});
|
|
3052
3140
|
});
|
|
3053
|
-
async function
|
|
3054
|
-
|
|
3141
|
+
async function Oo(t) {
|
|
3142
|
+
Io({
|
|
3055
3143
|
clientId: t.clientId,
|
|
3056
3144
|
// The default client id can be overridden by the config
|
|
3057
3145
|
...t.analytics
|
|
@@ -3060,7 +3148,7 @@ async function So(t) {
|
|
|
3060
3148
|
// The default client id can be overridden by the config
|
|
3061
3149
|
...t.auth
|
|
3062
3150
|
});
|
|
3063
|
-
const e =
|
|
3151
|
+
const e = ci(t.api || {});
|
|
3064
3152
|
return Et(Se.READY, {}), e;
|
|
3065
3153
|
}
|
|
3066
3154
|
if (typeof document < "u") {
|
|
@@ -3068,11 +3156,11 @@ if (typeof document < "u") {
|
|
|
3068
3156
|
if (t != null && t.textContent)
|
|
3069
3157
|
try {
|
|
3070
3158
|
const e = JSON.parse(t.textContent);
|
|
3071
|
-
|
|
3159
|
+
Oo(e);
|
|
3072
3160
|
} catch (e) {
|
|
3073
3161
|
console.error("Failed to parse config", e);
|
|
3074
3162
|
}
|
|
3075
3163
|
}
|
|
3076
3164
|
export {
|
|
3077
|
-
|
|
3165
|
+
Oo as init
|
|
3078
3166
|
};
|