@sesamy/sesamy-js 1.3.14 → 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 +891 -805
- 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,68 +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
|
|
1011
|
+
await F.handleRedirectCallback();
|
|
1012
|
+
const e = await F.getUser();
|
|
1013
1013
|
Et(Se.AUTHENTICATED, e);
|
|
1014
1014
|
const n = new URL(location.href), r = n.searchParams;
|
|
1015
1015
|
r.delete("code"), n.search = r.toString(), window.history.replaceState({}, document.title, n.toString());
|
|
1016
|
-
const i = await
|
|
1016
|
+
const i = await F.getTokenSilently();
|
|
1017
1017
|
localStorage.setItem("accessToken", i);
|
|
1018
1018
|
} catch {
|
|
1019
1019
|
}
|
|
1020
1020
|
}
|
|
1021
|
-
async function
|
|
1022
|
-
if (!
|
|
1021
|
+
async function Jr() {
|
|
1022
|
+
if (!F)
|
|
1023
1023
|
throw new Error("Auth0 client not initialized");
|
|
1024
|
-
return
|
|
1024
|
+
return F.isAuthenticated();
|
|
1025
1025
|
}
|
|
1026
|
-
async function
|
|
1027
|
-
if (!
|
|
1026
|
+
async function Xr() {
|
|
1027
|
+
if (!F)
|
|
1028
1028
|
throw new Error("Auth0 client not initialized");
|
|
1029
|
-
return
|
|
1029
|
+
return F.getUser();
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1032
|
-
if (!
|
|
1031
|
+
function Fr() {
|
|
1032
|
+
if (!F)
|
|
1033
1033
|
throw new Error("Auth0 client not initialized");
|
|
1034
|
-
return
|
|
1034
|
+
return F.loginWithRedirect({
|
|
1035
1035
|
authorizationParams: {
|
|
1036
1036
|
redirect_uri: window.location.href
|
|
1037
1037
|
}
|
|
1038
1038
|
});
|
|
1039
1039
|
}
|
|
1040
|
-
async function
|
|
1041
|
-
if (!
|
|
1040
|
+
async function Hr() {
|
|
1041
|
+
if (!F)
|
|
1042
1042
|
throw new Error("Auth0 client not initialized");
|
|
1043
|
-
return
|
|
1043
|
+
return F.getTokenSilently();
|
|
1044
1044
|
}
|
|
1045
|
-
async function
|
|
1046
|
-
if (!
|
|
1045
|
+
async function Vr() {
|
|
1046
|
+
if (!F)
|
|
1047
1047
|
throw new Error("Auth0 client not initialized");
|
|
1048
|
-
return Et(Se.LOGOUT, {}),
|
|
1048
|
+
return Et(Se.LOGOUT, {}), F.logout({
|
|
1049
1049
|
logoutParams: {
|
|
1050
1050
|
returnTo: window.location.href
|
|
1051
1051
|
}
|
|
1052
1052
|
});
|
|
1053
1053
|
}
|
|
1054
|
-
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 } = {}) => {
|
|
1055
1055
|
const r = /* @__PURE__ */ new Map();
|
|
1056
1056
|
return (i) => (o, a) => {
|
|
1057
1057
|
if (t(o, a))
|
|
@@ -1071,37 +1071,37 @@ const Vr = (t, e) => e.skipDedupe || e.method !== "GET", Yr = (t, e) => e.method
|
|
|
1071
1071
|
return r.delete(s), Promise.reject(p);
|
|
1072
1072
|
}
|
|
1073
1073
|
};
|
|
1074
|
-
},
|
|
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) => {
|
|
1075
1075
|
let c = 0;
|
|
1076
1076
|
if (s && s(f, u))
|
|
1077
1077
|
return p(f, u);
|
|
1078
|
-
const h = (d,
|
|
1079
|
-
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);
|
|
1080
1080
|
setTimeout(() => {
|
|
1081
1081
|
typeof i == "function" ? Promise.resolve(i({
|
|
1082
1082
|
response: d,
|
|
1083
|
-
error:
|
|
1083
|
+
error: w,
|
|
1084
1084
|
url: f,
|
|
1085
1085
|
options: u
|
|
1086
|
-
})).then((
|
|
1087
|
-
var
|
|
1088
|
-
|
|
1089
|
-
}) :
|
|
1090
|
-
},
|
|
1091
|
-
}).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) => {
|
|
1092
1092
|
if (!o)
|
|
1093
|
-
throw
|
|
1094
|
-
return h(null,
|
|
1095
|
-
}) : 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."))));
|
|
1096
1096
|
return p(f, u).then(h).catch((d) => {
|
|
1097
1097
|
if (!o)
|
|
1098
1098
|
throw d;
|
|
1099
1099
|
return h(null, d);
|
|
1100
1100
|
});
|
|
1101
|
-
},
|
|
1101
|
+
}, ei = "application/json", Un = "Content-Type", ye = Symbol(), Ln = Symbol();
|
|
1102
1102
|
function Ht(t = {}) {
|
|
1103
1103
|
var e;
|
|
1104
|
-
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];
|
|
1105
1105
|
}
|
|
1106
1106
|
function Vt(t) {
|
|
1107
1107
|
return /^application\/.*json.*/.test(t);
|
|
@@ -1132,90 +1132,90 @@ const he = function(t, e, n = !1) {
|
|
|
1132
1132
|
return n && i ? new i(...r) : i;
|
|
1133
1133
|
}
|
|
1134
1134
|
};
|
|
1135
|
-
function
|
|
1135
|
+
function ti(t, e = !1) {
|
|
1136
1136
|
Ee.options = e ? t : he(Ee.options, t);
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1138
|
+
function ni(t, e = !1) {
|
|
1139
1139
|
Ee.polyfills = e ? t : he(Ee.polyfills, t);
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function ri(t) {
|
|
1142
1142
|
Ee.errorType = t;
|
|
1143
1143
|
}
|
|
1144
|
-
const
|
|
1144
|
+
const ii = (t) => (e) => t.reduceRight((n, r) => r(n), e) || e;
|
|
1145
1145
|
class Rn extends Error {
|
|
1146
1146
|
}
|
|
1147
|
-
const
|
|
1147
|
+
const oi = (t) => {
|
|
1148
1148
|
const e = /* @__PURE__ */ Object.create(null);
|
|
1149
|
-
t = t._addons.reduce((
|
|
1149
|
+
t = t._addons.reduce((v, l) => l.beforeRequest && l.beforeRequest(v, t._options, e) || v, t);
|
|
1150
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);
|
|
1151
1151
|
let c = n;
|
|
1152
|
-
const h =
|
|
1153
|
-
throw { [ye]:
|
|
1154
|
-
}).then((
|
|
1155
|
-
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) {
|
|
1156
1156
|
const l = new Rn();
|
|
1157
1157
|
if (l.cause = d, l.stack = l.stack + `
|
|
1158
|
-
CAUSE: ` + d.stack, l.response =
|
|
1158
|
+
CAUSE: ` + d.stack, l.response = v, l.url = c, v.type === "opaque")
|
|
1159
1159
|
throw l;
|
|
1160
|
-
return
|
|
1161
|
-
var
|
|
1162
|
-
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")
|
|
1163
1163
|
try {
|
|
1164
|
-
l.json = JSON.parse(
|
|
1164
|
+
l.json = JSON.parse(b);
|
|
1165
1165
|
} catch {
|
|
1166
1166
|
}
|
|
1167
|
-
throw l.text =
|
|
1167
|
+
throw l.text = b, l.status = v.status, l;
|
|
1168
1168
|
});
|
|
1169
1169
|
}
|
|
1170
|
-
return
|
|
1171
|
-
}),
|
|
1172
|
-
const
|
|
1173
|
-
if (
|
|
1174
|
-
return
|
|
1175
|
-
const
|
|
1176
|
-
if (
|
|
1177
|
-
return
|
|
1178
|
-
throw
|
|
1179
|
-
}),
|
|
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 = {
|
|
1180
1180
|
_wretchReq: t,
|
|
1181
1181
|
_fetchReq: h,
|
|
1182
1182
|
_sharedState: e,
|
|
1183
|
-
res:
|
|
1184
|
-
json:
|
|
1185
|
-
blob:
|
|
1186
|
-
formData:
|
|
1187
|
-
arrayBuffer:
|
|
1188
|
-
text:
|
|
1189
|
-
error(
|
|
1190
|
-
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;
|
|
1191
1191
|
},
|
|
1192
|
-
badRequest(
|
|
1193
|
-
return this.error(400,
|
|
1192
|
+
badRequest(v) {
|
|
1193
|
+
return this.error(400, v);
|
|
1194
1194
|
},
|
|
1195
|
-
unauthorized(
|
|
1196
|
-
return this.error(401,
|
|
1195
|
+
unauthorized(v) {
|
|
1196
|
+
return this.error(401, v);
|
|
1197
1197
|
},
|
|
1198
|
-
forbidden(
|
|
1199
|
-
return this.error(403,
|
|
1198
|
+
forbidden(v) {
|
|
1199
|
+
return this.error(403, v);
|
|
1200
1200
|
},
|
|
1201
|
-
notFound(
|
|
1202
|
-
return this.error(404,
|
|
1201
|
+
notFound(v) {
|
|
1202
|
+
return this.error(404, v);
|
|
1203
1203
|
},
|
|
1204
|
-
timeout(
|
|
1205
|
-
return this.error(408,
|
|
1204
|
+
timeout(v) {
|
|
1205
|
+
return this.error(408, v);
|
|
1206
1206
|
},
|
|
1207
|
-
internalError(
|
|
1208
|
-
return this.error(500,
|
|
1207
|
+
internalError(v) {
|
|
1208
|
+
return this.error(500, v);
|
|
1209
1209
|
},
|
|
1210
|
-
fetchError(
|
|
1211
|
-
return this.error(ye,
|
|
1210
|
+
fetchError(v) {
|
|
1211
|
+
return this.error(ye, v);
|
|
1212
1212
|
}
|
|
1213
|
-
},
|
|
1214
|
-
...
|
|
1215
|
-
...typeof l.resolver == "function" ? l.resolver(
|
|
1216
|
-
}),
|
|
1217
|
-
return a.reduce((
|
|
1218
|
-
},
|
|
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 = {
|
|
1219
1219
|
_url: "",
|
|
1220
1220
|
_options: {},
|
|
1221
1221
|
_config: Ee,
|
|
@@ -1265,7 +1265,7 @@ CAUSE: ` + d.stack, l.response = w, l.url = c, w.type === "opaque")
|
|
|
1265
1265
|
return this.headers({ Accept: t });
|
|
1266
1266
|
},
|
|
1267
1267
|
content(t) {
|
|
1268
|
-
return this.headers({ [
|
|
1268
|
+
return this.headers({ [Un]: t });
|
|
1269
1269
|
},
|
|
1270
1270
|
auth(t) {
|
|
1271
1271
|
return this.headers({ Authorization: t });
|
|
@@ -1275,7 +1275,7 @@ CAUSE: ` + d.stack, l.response = w, l.url = c, w.type === "opaque")
|
|
|
1275
1275
|
return n.set(t, e), { ...this, _catchers: n };
|
|
1276
1276
|
},
|
|
1277
1277
|
catcherFallback(t) {
|
|
1278
|
-
return this.catcher(
|
|
1278
|
+
return this.catcher(Ln, t);
|
|
1279
1279
|
},
|
|
1280
1280
|
resolve(t, e = !1) {
|
|
1281
1281
|
return { ...this, _resolvers: e ? [t] : [...this._resolvers, t] };
|
|
@@ -1295,7 +1295,7 @@ CAUSE: ` + d.stack, l.response = w, l.url = c, w.type === "opaque")
|
|
|
1295
1295
|
fetch(t = this._options.method, e = "", n = null) {
|
|
1296
1296
|
let r = this.url(e).options({ method: t });
|
|
1297
1297
|
const i = Ht(r._options.headers), o = typeof n == "object" && (!r._options.headers || !i || Vt(i));
|
|
1298
|
-
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));
|
|
1299
1299
|
},
|
|
1300
1300
|
get(t = "") {
|
|
1301
1301
|
return this.fetch("GET", t);
|
|
@@ -1323,90 +1323,114 @@ CAUSE: ` + d.stack, l.response = w, l.url = c, w.type === "opaque")
|
|
|
1323
1323
|
},
|
|
1324
1324
|
json(t, e) {
|
|
1325
1325
|
const n = Ht(this._options.headers);
|
|
1326
|
-
return this.content(e || Vt(n) && n ||
|
|
1326
|
+
return this.content(e || Vt(n) && n || ei).body(JSON.stringify(t));
|
|
1327
1327
|
}
|
|
1328
1328
|
};
|
|
1329
1329
|
function oe(t = "", e = {}) {
|
|
1330
|
-
return { ...
|
|
1330
|
+
return { ...ai, _url: t, _options: e };
|
|
1331
1331
|
}
|
|
1332
1332
|
oe.default = oe;
|
|
1333
|
-
oe.options =
|
|
1334
|
-
oe.errorType =
|
|
1335
|
-
oe.polyfills =
|
|
1333
|
+
oe.options = ti;
|
|
1334
|
+
oe.errorType = ri;
|
|
1335
|
+
oe.polyfills = ni;
|
|
1336
1336
|
oe.WretchError = Rn;
|
|
1337
|
-
function
|
|
1338
|
-
const e = t.endpoint || `https://api2.${Dn}`, n = (
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
...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,
|
|
1354
1353
|
headers: {
|
|
1355
|
-
...
|
|
1356
|
-
Authorization: `Basic ${
|
|
1354
|
+
...A.headers,
|
|
1355
|
+
Authorization: `Basic ${R}`
|
|
1357
1356
|
}
|
|
1358
1357
|
};
|
|
1359
|
-
return
|
|
1358
|
+
return k(_, L);
|
|
1360
1359
|
}, i = oe(e).headers({ "Content-Type": "application/json" }).middlewares([
|
|
1361
|
-
n,
|
|
1360
|
+
n(),
|
|
1362
1361
|
Xt(),
|
|
1363
1362
|
Ft({
|
|
1364
1363
|
delayTimer: 1e3,
|
|
1365
|
-
delayRamp: (
|
|
1364
|
+
delayRamp: (k, _) => k * _,
|
|
1366
1365
|
maxAttempts: 3,
|
|
1367
|
-
until: (
|
|
1366
|
+
until: (k) => !!(k && (k.ok || k.status >= 400 && k.status < 500)),
|
|
1368
1367
|
retryOnNetworkError: !1
|
|
1369
1368
|
})
|
|
1370
1369
|
]), o = oe(e).headers({ "Content-Type": "application/json" }).middlewares([
|
|
1370
|
+
n(!1),
|
|
1371
1371
|
r,
|
|
1372
1372
|
Xt(),
|
|
1373
1373
|
Ft({
|
|
1374
1374
|
delayTimer: 1e3,
|
|
1375
|
-
delayRamp: (
|
|
1375
|
+
delayRamp: (k, _) => k * _,
|
|
1376
1376
|
maxAttempts: 3,
|
|
1377
|
-
until: (
|
|
1377
|
+
until: (k) => !!(k && (k.ok || k.status >= 400 && k.status < 500)),
|
|
1378
1378
|
retryOnNetworkError: !1
|
|
1379
1379
|
})
|
|
1380
1380
|
]);
|
|
1381
1381
|
async function a() {
|
|
1382
1382
|
return i.get("/entitlements").json();
|
|
1383
1383
|
}
|
|
1384
|
-
async function s(
|
|
1385
|
-
const
|
|
1386
|
-
return
|
|
1384
|
+
async function s(k) {
|
|
1385
|
+
const _ = await i.get("/entitlements").json();
|
|
1386
|
+
return _ == null ? void 0 : _.find((A) => A.id === k);
|
|
1387
1387
|
}
|
|
1388
1388
|
async function p() {
|
|
1389
1389
|
return i.get("/contracts").json();
|
|
1390
1390
|
}
|
|
1391
|
-
async function f(
|
|
1392
|
-
const
|
|
1393
|
-
return
|
|
1391
|
+
async function f(k) {
|
|
1392
|
+
const _ = await i.get("/contracts").json();
|
|
1393
|
+
return _ == null ? void 0 : _.find((A) => A.id === k);
|
|
1394
1394
|
}
|
|
1395
1395
|
async function u() {
|
|
1396
1396
|
return i.get("/bills").json();
|
|
1397
1397
|
}
|
|
1398
|
-
async function c(
|
|
1399
|
-
const
|
|
1400
|
-
return
|
|
1398
|
+
async function c(k) {
|
|
1399
|
+
const _ = await i.get("/bills").json();
|
|
1400
|
+
return _ == null ? void 0 : _.find((A) => A.id === k);
|
|
1401
1401
|
}
|
|
1402
|
-
async function h() {
|
|
1403
|
-
return await
|
|
1402
|
+
async function h(k, _) {
|
|
1403
|
+
return await i.url(`/user-metadata/${k}`).put(_).json();
|
|
1404
1404
|
}
|
|
1405
|
-
async function d(
|
|
1406
|
-
return await
|
|
1405
|
+
async function d(k) {
|
|
1406
|
+
return (await i.url(`/user-metadata/${k}`).delete().res()).ok;
|
|
1407
1407
|
}
|
|
1408
|
-
async function
|
|
1409
|
-
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();
|
|
1410
1434
|
}
|
|
1411
1435
|
return {
|
|
1412
1436
|
getEntitlements: a,
|
|
@@ -1415,36 +1439,80 @@ function ai(t) {
|
|
|
1415
1439
|
getContract: f,
|
|
1416
1440
|
getBills: u,
|
|
1417
1441
|
getBill: c,
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
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
|
|
1421
1453
|
};
|
|
1422
1454
|
}
|
|
1423
1455
|
const Zn = "@sesamy/sesamy-js", Tt = "1.3.2";
|
|
1424
|
-
function
|
|
1425
|
-
const {
|
|
1426
|
-
auth: {
|
|
1427
|
-
getUser: Jr,
|
|
1428
|
-
isAuthenticated: Mr,
|
|
1429
|
-
loginWithRedirect: Xr,
|
|
1430
|
-
logout: Hr
|
|
1431
|
-
},
|
|
1432
|
-
tags: {
|
|
1433
|
-
list: s,
|
|
1434
|
-
set: p,
|
|
1435
|
-
push: f
|
|
1436
|
-
},
|
|
1456
|
+
function ci(t) {
|
|
1457
|
+
const {
|
|
1437
1458
|
getEntitlement: e,
|
|
1438
1459
|
getEntitlements: n,
|
|
1439
1460
|
getContract: r,
|
|
1440
1461
|
getContracts: i,
|
|
1441
1462
|
getBill: o,
|
|
1442
1463
|
getBills: a,
|
|
1443
|
-
|
|
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
|
|
1444
1512
|
};
|
|
1445
|
-
return t.namespace && (window[t.namespace] =
|
|
1513
|
+
return t.namespace && (window[t.namespace] = E), E;
|
|
1446
1514
|
}
|
|
1447
|
-
function
|
|
1515
|
+
function ui() {
|
|
1448
1516
|
return Tt;
|
|
1449
1517
|
}
|
|
1450
1518
|
function Yt(t, e, n, r, i) {
|
|
@@ -1452,54 +1520,54 @@ function Yt(t, e, n, r, i) {
|
|
|
1452
1520
|
t = t ? t[e[r]] : i;
|
|
1453
1521
|
return t === i ? n : t;
|
|
1454
1522
|
}
|
|
1455
|
-
var Je = "undefined", Gt = "object",
|
|
1456
|
-
},
|
|
1523
|
+
var Je = "undefined", Gt = "object", li = function() {
|
|
1524
|
+
}, Mn = "any", Wn = "*", pe = "__", qe = typeof process < "u" ? process : {};
|
|
1457
1525
|
qe.env && qe.env.NODE_ENV;
|
|
1458
1526
|
var Y = typeof document < "u";
|
|
1459
1527
|
qe.versions != null && qe.versions.node != null;
|
|
1460
1528
|
typeof Deno < "u" && Deno.core;
|
|
1461
1529
|
Y && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
1462
|
-
function
|
|
1530
|
+
function Kn(t, e) {
|
|
1463
1531
|
return e.charAt(0)[t]() + e.slice(1);
|
|
1464
1532
|
}
|
|
1465
|
-
var
|
|
1466
|
-
function
|
|
1467
|
-
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);
|
|
1468
1536
|
}
|
|
1469
1537
|
function Qe(t, e) {
|
|
1470
1538
|
e === void 0 && (e = !0);
|
|
1471
|
-
var n =
|
|
1472
|
-
return e ?
|
|
1539
|
+
var n = fi(t);
|
|
1540
|
+
return e ? hi(n) : n;
|
|
1473
1541
|
}
|
|
1474
|
-
function
|
|
1542
|
+
function Me(t, e) {
|
|
1475
1543
|
return typeof e === t;
|
|
1476
1544
|
}
|
|
1477
|
-
var G =
|
|
1478
|
-
|
|
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");
|
|
1479
1547
|
function Jn(t) {
|
|
1480
1548
|
return t === null;
|
|
1481
1549
|
}
|
|
1482
|
-
function
|
|
1550
|
+
function mi(t) {
|
|
1483
1551
|
return Qe(t) === "number" && !isNaN(t);
|
|
1484
1552
|
}
|
|
1485
1553
|
function Xn(t) {
|
|
1486
1554
|
return Qe(t) === "array";
|
|
1487
1555
|
}
|
|
1488
|
-
function
|
|
1489
|
-
if (!
|
|
1556
|
+
function X(t) {
|
|
1557
|
+
if (!gi(t))
|
|
1490
1558
|
return !1;
|
|
1491
1559
|
for (var e = t; Object.getPrototypeOf(e) !== null; )
|
|
1492
1560
|
e = Object.getPrototypeOf(e);
|
|
1493
1561
|
return Object.getPrototypeOf(t) === e;
|
|
1494
1562
|
}
|
|
1495
|
-
function
|
|
1563
|
+
function gi(t) {
|
|
1496
1564
|
return t && (typeof t == "object" || t !== null);
|
|
1497
1565
|
}
|
|
1498
|
-
function
|
|
1566
|
+
function yi(t) {
|
|
1499
1567
|
return G(t.constructor) ? t.constructor.name : null;
|
|
1500
1568
|
}
|
|
1501
|
-
function
|
|
1502
|
-
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);
|
|
1503
1571
|
}
|
|
1504
1572
|
function Fn(t, e) {
|
|
1505
1573
|
if (typeof e != "object" || Jn(e))
|
|
@@ -1507,7 +1575,7 @@ function Fn(t, e) {
|
|
|
1507
1575
|
if (e instanceof t)
|
|
1508
1576
|
return !0;
|
|
1509
1577
|
var n = Qe(new t(""));
|
|
1510
|
-
if (
|
|
1578
|
+
if (vi(e))
|
|
1511
1579
|
for (; e; ) {
|
|
1512
1580
|
if (Qe(e) === n)
|
|
1513
1581
|
return !0;
|
|
@@ -1519,9 +1587,9 @@ Fn.bind(null, TypeError);
|
|
|
1519
1587
|
Fn.bind(null, SyntaxError);
|
|
1520
1588
|
function nt(t, e) {
|
|
1521
1589
|
var n = t instanceof Element || t instanceof HTMLDocument;
|
|
1522
|
-
return n && e ?
|
|
1590
|
+
return n && e ? wi(t, e) : n;
|
|
1523
1591
|
}
|
|
1524
|
-
function
|
|
1592
|
+
function wi(t, e) {
|
|
1525
1593
|
return e === void 0 && (e = ""), t && t.nodeName === e.toUpperCase();
|
|
1526
1594
|
}
|
|
1527
1595
|
function rt(t) {
|
|
@@ -1534,7 +1602,7 @@ rt(nt, "form");
|
|
|
1534
1602
|
rt(nt, "button");
|
|
1535
1603
|
rt(nt, "input");
|
|
1536
1604
|
rt(nt, "select");
|
|
1537
|
-
function
|
|
1605
|
+
function bi(t) {
|
|
1538
1606
|
return t ? Xn(t) ? t : [t] : [];
|
|
1539
1607
|
}
|
|
1540
1608
|
function Bt(t) {
|
|
@@ -1544,19 +1612,19 @@ function Bt(t) {
|
|
|
1544
1612
|
return null;
|
|
1545
1613
|
}
|
|
1546
1614
|
}
|
|
1547
|
-
function
|
|
1615
|
+
function ki() {
|
|
1548
1616
|
if (Y) {
|
|
1549
1617
|
var t = navigator, e = t.languages;
|
|
1550
1618
|
return t.userLanguage || (e && e.length ? e[0] : t.language);
|
|
1551
1619
|
}
|
|
1552
1620
|
}
|
|
1553
|
-
function
|
|
1621
|
+
function Ii() {
|
|
1554
1622
|
try {
|
|
1555
1623
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1556
1624
|
} catch {
|
|
1557
1625
|
}
|
|
1558
1626
|
}
|
|
1559
|
-
function
|
|
1627
|
+
function _i(t) {
|
|
1560
1628
|
return function(e) {
|
|
1561
1629
|
for (var n, r = /* @__PURE__ */ Object.create(null), i = /([^&=]+)=?([^&]*)/g; n = i.exec(e); ) {
|
|
1562
1630
|
var o = Bt(n[1]), a = Bt(n[2]);
|
|
@@ -1564,7 +1632,7 @@ function Ii(t) {
|
|
|
1564
1632
|
}
|
|
1565
1633
|
for (var s in r) {
|
|
1566
1634
|
var p = s.split("[");
|
|
1567
|
-
p.length > 1 && (
|
|
1635
|
+
p.length > 1 && (Si(r, p.map(function(f) {
|
|
1568
1636
|
return f.replace(/[?[\]\\ ]/g, "");
|
|
1569
1637
|
}), r[s]), delete r[s]);
|
|
1570
1638
|
}
|
|
@@ -1577,7 +1645,7 @@ function Ii(t) {
|
|
|
1577
1645
|
return Y && window.location.search.substring(1);
|
|
1578
1646
|
}(t));
|
|
1579
1647
|
}
|
|
1580
|
-
function
|
|
1648
|
+
function Si(t, e, n) {
|
|
1581
1649
|
for (var r = e.length - 1, i = 0; i < r; ++i) {
|
|
1582
1650
|
var o = e[i];
|
|
1583
1651
|
if (o === "__proto__" || o === "constructor")
|
|
@@ -1627,17 +1695,17 @@ function jt(t) {
|
|
|
1627
1695
|
}
|
|
1628
1696
|
return Xe[t] = !0;
|
|
1629
1697
|
}
|
|
1630
|
-
function
|
|
1631
|
-
return
|
|
1698
|
+
function T() {
|
|
1699
|
+
return T = Object.assign || function(t) {
|
|
1632
1700
|
for (var e = 1; e < arguments.length; e++) {
|
|
1633
1701
|
var n = arguments[e];
|
|
1634
1702
|
for (var r in n)
|
|
1635
1703
|
Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
1636
1704
|
}
|
|
1637
1705
|
return t;
|
|
1638
|
-
},
|
|
1706
|
+
}, T.apply(this, arguments);
|
|
1639
1707
|
}
|
|
1640
|
-
var ne = "function", ee = "undefined",
|
|
1708
|
+
var ne = "function", ee = "undefined", Ei = "@@redux/" + Math.random().toString(36), qt = /* @__PURE__ */ function() {
|
|
1641
1709
|
return typeof Symbol === ne && Symbol.observable || "@@observable";
|
|
1642
1710
|
}(), Fe = " != " + ne;
|
|
1643
1711
|
function Hn(t, e, n) {
|
|
@@ -1659,17 +1727,17 @@ function Hn(t, e, n) {
|
|
|
1659
1727
|
function c(d) {
|
|
1660
1728
|
if (typeof d !== ne)
|
|
1661
1729
|
throw new Error("Listener" + Fe);
|
|
1662
|
-
var
|
|
1730
|
+
var w = !0;
|
|
1663
1731
|
return f(), s.push(d), function() {
|
|
1664
|
-
if (
|
|
1665
|
-
|
|
1666
|
-
var
|
|
1667
|
-
s.splice(
|
|
1732
|
+
if (w) {
|
|
1733
|
+
w = !1, f();
|
|
1734
|
+
var I = s.indexOf(d);
|
|
1735
|
+
s.splice(I, 1);
|
|
1668
1736
|
}
|
|
1669
1737
|
};
|
|
1670
1738
|
}
|
|
1671
1739
|
function h(d) {
|
|
1672
|
-
if (!
|
|
1740
|
+
if (!X(d))
|
|
1673
1741
|
throw new Error("Act != obj");
|
|
1674
1742
|
if (typeof d.type === ee)
|
|
1675
1743
|
throw new Error("ActType " + ee);
|
|
@@ -1680,8 +1748,8 @@ function Hn(t, e, n) {
|
|
|
1680
1748
|
} finally {
|
|
1681
1749
|
p = !1;
|
|
1682
1750
|
}
|
|
1683
|
-
for (var
|
|
1684
|
-
(0,
|
|
1751
|
+
for (var w = a = s, I = 0; I < w.length; I++)
|
|
1752
|
+
(0, w[I])();
|
|
1685
1753
|
return d;
|
|
1686
1754
|
}
|
|
1687
1755
|
return h({ type: "@@redux/INIT" }), (r = { dispatch: h, subscribe: c, getState: u, replaceReducer: function(d) {
|
|
@@ -1689,20 +1757,20 @@ function Hn(t, e, n) {
|
|
|
1689
1757
|
throw new Error("next reducer" + Fe);
|
|
1690
1758
|
i = d, h({ type: "@@redux/INIT" });
|
|
1691
1759
|
} })[qt] = function() {
|
|
1692
|
-
var d,
|
|
1693
|
-
return (d = { subscribe: function(
|
|
1694
|
-
if (typeof
|
|
1760
|
+
var d, w = c;
|
|
1761
|
+
return (d = { subscribe: function(I) {
|
|
1762
|
+
if (typeof I != "object")
|
|
1695
1763
|
throw new TypeError("Observer != obj");
|
|
1696
|
-
function
|
|
1697
|
-
|
|
1764
|
+
function y() {
|
|
1765
|
+
I.next && I.next(u());
|
|
1698
1766
|
}
|
|
1699
|
-
return
|
|
1767
|
+
return y(), { unsubscribe: w(y) };
|
|
1700
1768
|
} })[qt] = function() {
|
|
1701
1769
|
return this;
|
|
1702
1770
|
}, d;
|
|
1703
1771
|
}, r;
|
|
1704
1772
|
}
|
|
1705
|
-
function
|
|
1773
|
+
function Oi(t, e) {
|
|
1706
1774
|
var n = e && e.type;
|
|
1707
1775
|
return "action " + (n && n.toString() || "?") + "reducer " + t + " returns " + ee;
|
|
1708
1776
|
}
|
|
@@ -1716,7 +1784,7 @@ function Te() {
|
|
|
1716
1784
|
};
|
|
1717
1785
|
});
|
|
1718
1786
|
}
|
|
1719
|
-
function
|
|
1787
|
+
function Pi() {
|
|
1720
1788
|
var t = arguments;
|
|
1721
1789
|
return function(e) {
|
|
1722
1790
|
return function(n, r, i) {
|
|
@@ -1725,39 +1793,39 @@ function Oi() {
|
|
|
1725
1793
|
} };
|
|
1726
1794
|
return o = [].slice.call(t).map(function(f) {
|
|
1727
1795
|
return f(p);
|
|
1728
|
-
}),
|
|
1796
|
+
}), T({}, a, { dispatch: s = Te.apply(void 0, o)(a.dispatch) });
|
|
1729
1797
|
};
|
|
1730
1798
|
};
|
|
1731
1799
|
}
|
|
1732
|
-
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) {
|
|
1733
1801
|
return t[e] = e, t;
|
|
1734
1802
|
}, { registerPluginType: function(t) {
|
|
1735
1803
|
return "registerPlugin:" + t;
|
|
1736
1804
|
}, pluginReadyType: function(t) {
|
|
1737
1805
|
return "ready:" + t;
|
|
1738
1806
|
} }), Qt = /^utm_/, en = /^an_prop_/, tn = /^an_trait_/;
|
|
1739
|
-
function
|
|
1807
|
+
function Ti(t) {
|
|
1740
1808
|
var e = t.storage.setItem;
|
|
1741
1809
|
return function(n) {
|
|
1742
1810
|
return function(r) {
|
|
1743
1811
|
return function(i) {
|
|
1744
|
-
if (i.type ===
|
|
1812
|
+
if (i.type === P.bootstrap) {
|
|
1745
1813
|
var o = i.params, a = i.user, s = i.persistedUser, p = i.initialUser, f = s.userId === a.userId;
|
|
1746
|
-
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));
|
|
1747
1815
|
var u = Object.keys(i.params);
|
|
1748
1816
|
if (u.length) {
|
|
1749
|
-
var c = o.an_uid, h = o.an_event, d = u.reduce(function(
|
|
1750
|
-
if (
|
|
1751
|
-
var
|
|
1752
|
-
|
|
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];
|
|
1753
1821
|
}
|
|
1754
|
-
return
|
|
1822
|
+
return I.match(en) && (w.props[I.replace(en, "")] = o[I]), I.match(tn) && (w.traits[I.replace(tn, "")] = o[I]), w;
|
|
1755
1823
|
}, { campaign: {}, props: {}, traits: {} });
|
|
1756
|
-
n.dispatch(
|
|
1824
|
+
n.dispatch(T({ type: P.params, raw: o }, d, c ? { userId: c } : {})), c && setTimeout(function() {
|
|
1757
1825
|
return t.identify(c, d.traits);
|
|
1758
1826
|
}, 0), h && setTimeout(function() {
|
|
1759
1827
|
return t.track(h, d.props);
|
|
1760
|
-
}, 0), Object.keys(d.campaign).length && n.dispatch({ type:
|
|
1828
|
+
}, 0), Object.keys(d.campaign).length && n.dispatch({ type: P.campaign, campaign: d.campaign });
|
|
1761
1829
|
}
|
|
1762
1830
|
}
|
|
1763
1831
|
return r(i);
|
|
@@ -1765,18 +1833,18 @@ function Pi(t) {
|
|
|
1765
1833
|
};
|
|
1766
1834
|
};
|
|
1767
1835
|
}
|
|
1768
|
-
function
|
|
1836
|
+
function ji(t) {
|
|
1769
1837
|
return function(e, n) {
|
|
1770
|
-
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) {
|
|
1771
1839
|
if (n.key === ie)
|
|
1772
|
-
return
|
|
1840
|
+
return T({}, e, { anonymousId: n.value });
|
|
1773
1841
|
if (n.key === fe)
|
|
1774
|
-
return
|
|
1842
|
+
return T({}, e, { userId: n.value });
|
|
1775
1843
|
}
|
|
1776
1844
|
switch (n.type) {
|
|
1777
|
-
case
|
|
1778
|
-
return Object.assign({}, e, { userId: n.userId, traits:
|
|
1779
|
-
case
|
|
1845
|
+
case P.identify:
|
|
1846
|
+
return Object.assign({}, e, { userId: n.userId, traits: T({}, e.traits, n.traits) });
|
|
1847
|
+
case P.reset:
|
|
1780
1848
|
return [fe, ie, ke].forEach(function(r) {
|
|
1781
1849
|
t.removeItem(r);
|
|
1782
1850
|
}), Object.assign({}, e, { userId: null, anonymousId: null, traits: {} });
|
|
@@ -1791,20 +1859,20 @@ function nn(t) {
|
|
|
1791
1859
|
var _t = function(t) {
|
|
1792
1860
|
return pe + "TEMP" + pe + t;
|
|
1793
1861
|
};
|
|
1794
|
-
function
|
|
1862
|
+
function xi(t) {
|
|
1795
1863
|
var e = t.storage, n = e.setItem, r = e.removeItem, i = e.getItem;
|
|
1796
1864
|
return function(o) {
|
|
1797
1865
|
return function(a) {
|
|
1798
1866
|
return function(s) {
|
|
1799
1867
|
var p = s.userId, f = s.traits, u = s.options;
|
|
1800
|
-
if (s.type ===
|
|
1868
|
+
if (s.type === P.reset && ([fe, ke, ie].forEach(function(d) {
|
|
1801
1869
|
r(d);
|
|
1802
1870
|
}), [te, be, "traits"].forEach(function(d) {
|
|
1803
1871
|
je(_t(d));
|
|
1804
|
-
})), s.type ===
|
|
1872
|
+
})), s.type === P.identify) {
|
|
1805
1873
|
i(ie) || n(ie, it());
|
|
1806
1874
|
var c = i(fe), h = i(ke) || {};
|
|
1807
|
-
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));
|
|
1808
1876
|
}
|
|
1809
1877
|
return a(s);
|
|
1810
1878
|
};
|
|
@@ -1817,14 +1885,14 @@ function rn(t, e) {
|
|
|
1817
1885
|
}
|
|
1818
1886
|
function Vn(t, e, n) {
|
|
1819
1887
|
return new Promise(function(r, i) {
|
|
1820
|
-
return e() ? r(t) : n < 1 ? i(
|
|
1888
|
+
return e() ? r(t) : n < 1 ? i(T({}, t, { queue: !0 })) : new Promise(function(o) {
|
|
1821
1889
|
return setTimeout(o, 10);
|
|
1822
1890
|
}).then(function(o) {
|
|
1823
1891
|
return Vn(t, e, n - 10).then(r, i);
|
|
1824
1892
|
});
|
|
1825
1893
|
});
|
|
1826
1894
|
}
|
|
1827
|
-
function
|
|
1895
|
+
function Ci(t) {
|
|
1828
1896
|
return { abort: t };
|
|
1829
1897
|
}
|
|
1830
1898
|
function Yn(t, e, n) {
|
|
@@ -1835,18 +1903,18 @@ function Yn(t, e, n) {
|
|
|
1835
1903
|
}, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
|
|
1836
1904
|
if (f.processIndex && f.processIndex.length) {
|
|
1837
1905
|
f.processIndex.forEach(function(c) {
|
|
1838
|
-
var h = s.actions[c], d = h.plugin,
|
|
1839
|
-
if (
|
|
1840
|
-
var
|
|
1841
|
-
return l === void 0 && (l = {}),
|
|
1842
|
-
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;
|
|
1843
1911
|
}, l);
|
|
1844
|
-
}(h.payload, p),
|
|
1845
|
-
if (!
|
|
1846
|
-
return void (r[
|
|
1847
|
-
if (!
|
|
1848
|
-
var
|
|
1849
|
-
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" } }));
|
|
1850
1918
|
}
|
|
1851
1919
|
}
|
|
1852
1920
|
});
|
|
@@ -1860,118 +1928,118 @@ function Yn(t, e, n) {
|
|
|
1860
1928
|
var ht = function(t) {
|
|
1861
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;
|
|
1862
1930
|
try {
|
|
1863
|
-
var f = i.plugins, u = i.context, c = n.type, h = c.match(Ie), d = e.exact.map(function(
|
|
1864
|
-
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;
|
|
1865
1933
|
});
|
|
1866
|
-
h && (d = a.during.map(function(
|
|
1867
|
-
return
|
|
1934
|
+
h && (d = a.during.map(function(y) {
|
|
1935
|
+
return y.pluginName;
|
|
1868
1936
|
}));
|
|
1869
|
-
var
|
|
1870
|
-
return function(
|
|
1871
|
-
var
|
|
1872
|
-
l && (
|
|
1873
|
-
var
|
|
1874
|
-
return function(
|
|
1875
|
-
var K =
|
|
1876
|
-
if (
|
|
1877
|
-
throw new Error("Method " +
|
|
1878
|
-
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 } });
|
|
1879
1947
|
};
|
|
1880
|
-
}(
|
|
1948
|
+
}(j, k, S, l, E) : /* @__PURE__ */ function(A, U) {
|
|
1881
1949
|
return function() {
|
|
1882
|
-
throw new Error(
|
|
1950
|
+
throw new Error(A.type + " action not cancellable. Remove abort in " + U);
|
|
1883
1951
|
};
|
|
1884
|
-
}(
|
|
1885
|
-
return { payload:
|
|
1952
|
+
}(E, k);
|
|
1953
|
+
return { payload: $i(E), instance: y, config: b || {}, abort: _ };
|
|
1886
1954
|
};
|
|
1887
|
-
}(r, d),
|
|
1888
|
-
var
|
|
1889
|
-
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;
|
|
1890
1958
|
}, {});
|
|
1891
|
-
return Promise.resolve(e.exact.reduce(function(
|
|
1959
|
+
return Promise.resolve(e.exact.reduce(function(y, S, E) {
|
|
1892
1960
|
try {
|
|
1893
|
-
var
|
|
1894
|
-
return Promise.resolve(
|
|
1895
|
-
function
|
|
1961
|
+
var v = S.pluginName;
|
|
1962
|
+
return Promise.resolve(y).then(function(l) {
|
|
1963
|
+
function b() {
|
|
1896
1964
|
return Promise.resolve(l);
|
|
1897
1965
|
}
|
|
1898
|
-
var
|
|
1899
|
-
if (e.namespaced && e.namespaced[
|
|
1900
|
-
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) {
|
|
1901
1969
|
try {
|
|
1902
|
-
return Promise.resolve(
|
|
1903
|
-
return
|
|
1904
|
-
var K = dn(
|
|
1905
|
-
if (K && K.name ===
|
|
1906
|
-
var
|
|
1907
|
-
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(`
|
|
1908
1976
|
`));
|
|
1909
1977
|
}
|
|
1910
|
-
}(
|
|
1911
|
-
return
|
|
1912
|
-
}), config: sn(
|
|
1913
|
-
var
|
|
1914
|
-
return Promise.resolve(
|
|
1915
|
-
})) :
|
|
1916
|
-
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;
|
|
1917
1985
|
});
|
|
1918
|
-
} catch (
|
|
1919
|
-
return Promise.reject(
|
|
1986
|
+
} catch (U) {
|
|
1987
|
+
return Promise.reject(U);
|
|
1920
1988
|
}
|
|
1921
|
-
}, Promise.resolve(n))).then(function(
|
|
1922
|
-
l[
|
|
1989
|
+
}, Promise.resolve(n))).then(function(k) {
|
|
1990
|
+
l[v] = k;
|
|
1923
1991
|
});
|
|
1924
|
-
l[
|
|
1992
|
+
l[v] = n;
|
|
1925
1993
|
}();
|
|
1926
|
-
return
|
|
1994
|
+
return j && j.then ? j.then(b) : b();
|
|
1927
1995
|
});
|
|
1928
1996
|
} catch (l) {
|
|
1929
1997
|
return Promise.reject(l);
|
|
1930
1998
|
}
|
|
1931
|
-
}, Promise.resolve({}))).then(function(
|
|
1932
|
-
return Promise.resolve(e.exact.reduce(function(
|
|
1999
|
+
}, Promise.resolve({}))).then(function(y) {
|
|
2000
|
+
return Promise.resolve(e.exact.reduce(function(S, E, v) {
|
|
1933
2001
|
try {
|
|
1934
|
-
var l = e.exact.length ===
|
|
1935
|
-
return Promise.resolve(
|
|
1936
|
-
var
|
|
1937
|
-
if (h && (
|
|
1938
|
-
return ft({ data:
|
|
1939
|
-
if (pt(
|
|
1940
|
-
return l && ft({ data:
|
|
1941
|
-
if (
|
|
1942
|
-
return s.dispatch({ type: "queue", plugin:
|
|
1943
|
-
var
|
|
1944
|
-
return Promise.resolve(
|
|
1945
|
-
var
|
|
1946
|
-
if (pt(H,
|
|
1947
|
-
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 });
|
|
1948
2016
|
else {
|
|
1949
|
-
var
|
|
1950
|
-
(
|
|
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" } }));
|
|
1951
2019
|
}
|
|
1952
|
-
return Promise.resolve(
|
|
2020
|
+
return Promise.resolve(L);
|
|
1953
2021
|
});
|
|
1954
2022
|
});
|
|
1955
|
-
} catch (
|
|
1956
|
-
return Promise.reject(
|
|
2023
|
+
} catch (k) {
|
|
2024
|
+
return Promise.reject(k);
|
|
1957
2025
|
}
|
|
1958
|
-
}, Promise.resolve(n))).then(function(
|
|
2026
|
+
}, Promise.resolve(n))).then(function(S) {
|
|
1959
2027
|
if (!(c.match(Ie) || c.match(/^registerPlugin/) || c.match(an) || c.match(on) || c.match(/^params/) || c.match(/^userIdChanged/))) {
|
|
1960
|
-
if (p.plugins.includes(c),
|
|
1961
|
-
return
|
|
1962
|
-
var
|
|
1963
|
-
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);
|
|
1964
2032
|
}
|
|
1965
|
-
return
|
|
2033
|
+
return S;
|
|
1966
2034
|
});
|
|
1967
2035
|
});
|
|
1968
|
-
} catch (
|
|
1969
|
-
return Promise.reject(
|
|
2036
|
+
} catch (y) {
|
|
2037
|
+
return Promise.reject(y);
|
|
1970
2038
|
}
|
|
1971
2039
|
}, Ie = /Start$/, on = /^bootstrap/, an = /^ready/;
|
|
1972
2040
|
function ft(t) {
|
|
1973
2041
|
var e = t.pluginName, n = t.method + "Aborted" + (e ? ":" + e : "");
|
|
1974
|
-
t.store.dispatch(
|
|
2042
|
+
t.store.dispatch(T({}, t.data, { type: n, _: { called: n, from: "abort" } }));
|
|
1975
2043
|
}
|
|
1976
2044
|
function sn(t, e, n) {
|
|
1977
2045
|
var r = e[t] || n[t];
|
|
@@ -2009,12 +2077,12 @@ function dn(t) {
|
|
|
2009
2077
|
var e = t.match(/(.*):(.*)/);
|
|
2010
2078
|
return !!e && { method: e[1], name: e[2] };
|
|
2011
2079
|
}
|
|
2012
|
-
function
|
|
2080
|
+
function $i(t) {
|
|
2013
2081
|
return Object.keys(t).reduce(function(e, n) {
|
|
2014
|
-
return n === "type" || (e[n] =
|
|
2082
|
+
return n === "type" || (e[n] = X(t[n]) ? Object.assign({}, t[n]) : t[n]), e;
|
|
2015
2083
|
}, {});
|
|
2016
2084
|
}
|
|
2017
|
-
function
|
|
2085
|
+
function Ai(t, e, n) {
|
|
2018
2086
|
var r = {};
|
|
2019
2087
|
return function(i) {
|
|
2020
2088
|
return function(o) {
|
|
@@ -2025,73 +2093,73 @@ function $i(t, e, n) {
|
|
|
2025
2093
|
}, f = a.type, u = a.plugins, c = a;
|
|
2026
2094
|
if (a.abort)
|
|
2027
2095
|
return Promise.resolve(o(a));
|
|
2028
|
-
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() {
|
|
2029
2097
|
return rn(a.meta.rid, { payload: a });
|
|
2030
|
-
}, 0), f ===
|
|
2031
|
-
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) {
|
|
2032
2100
|
return u.includes(l);
|
|
2033
2101
|
}).map(function(l) {
|
|
2034
2102
|
return h[l];
|
|
2035
|
-
}),
|
|
2036
|
-
var
|
|
2103
|
+
}), I = [], y = [], S = a.disabled, E = w.map(function(l) {
|
|
2104
|
+
var b = l.loaded, j = l.name, k = l.config;
|
|
2037
2105
|
return Vn(l, function() {
|
|
2038
|
-
return
|
|
2039
|
-
}, 1e4).then(function(
|
|
2040
|
-
return r[
|
|
2041
|
-
return !It.includes(
|
|
2042
|
-
}) }), r[
|
|
2043
|
-
}).catch(function(
|
|
2044
|
-
if (
|
|
2045
|
-
throw new Error(
|
|
2046
|
-
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), _;
|
|
2047
2115
|
});
|
|
2048
2116
|
});
|
|
2049
|
-
Promise.all(
|
|
2050
|
-
var
|
|
2117
|
+
Promise.all(E).then(function(l) {
|
|
2118
|
+
var b = { plugins: I, failed: y, disabled: S };
|
|
2051
2119
|
setTimeout(function() {
|
|
2052
|
-
d.length ===
|
|
2120
|
+
d.length === E.length + S.length && i.dispatch(T({}, { type: P.ready }, b));
|
|
2053
2121
|
}, 0);
|
|
2054
2122
|
});
|
|
2055
2123
|
}
|
|
2056
|
-
var
|
|
2057
|
-
if (f !==
|
|
2124
|
+
var v = function() {
|
|
2125
|
+
if (f !== P.bootstrap)
|
|
2058
2126
|
return /^ready:([^:]*)$/.test(f) && setTimeout(function() {
|
|
2059
2127
|
return Yn(i, e, t);
|
|
2060
|
-
}, 0), Promise.resolve(function(l,
|
|
2128
|
+
}, 0), Promise.resolve(function(l, b, j, k, _) {
|
|
2061
2129
|
try {
|
|
2062
|
-
var
|
|
2130
|
+
var A = G(b) ? b() : b, U = l.type, R = U.replace(Ie, "");
|
|
2063
2131
|
if (l._ && l._.called)
|
|
2064
2132
|
return Promise.resolve(l);
|
|
2065
|
-
var
|
|
2066
|
-
var
|
|
2067
|
-
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);
|
|
2068
2136
|
}).map(function(m) {
|
|
2069
2137
|
return K[m];
|
|
2070
2138
|
}));
|
|
2071
|
-
|
|
2072
|
-
var
|
|
2073
|
-
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;
|
|
2074
2142
|
}).map(function(m) {
|
|
2075
|
-
return
|
|
2143
|
+
return A[m];
|
|
2076
2144
|
}));
|
|
2077
|
-
var
|
|
2145
|
+
var M = H.map(function(m) {
|
|
2078
2146
|
return m.name;
|
|
2079
|
-
}),
|
|
2147
|
+
}), x = function(m, g, O) {
|
|
2080
2148
|
var C = un(m).map(function($) {
|
|
2081
|
-
return cn($,
|
|
2149
|
+
return cn($, g);
|
|
2082
2150
|
});
|
|
2083
|
-
return
|
|
2084
|
-
var W = z.name,
|
|
2085
|
-
return cn($e,
|
|
2086
|
-
}),
|
|
2087
|
-
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), $;
|
|
2088
2156
|
}, { before: C[0], beforeNS: {}, during: C[1], duringNS: {}, after: C[2], afterNS: {} });
|
|
2089
|
-
}(
|
|
2090
|
-
return Promise.resolve(ht({ action: l, data: { exact:
|
|
2091
|
-
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() {
|
|
2092
2160
|
var $ = function() {
|
|
2093
|
-
if (
|
|
2094
|
-
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) {
|
|
2095
2163
|
z.meta && z.meta.hasCallback && rn(z.meta.rid, { payload: z });
|
|
2096
2164
|
});
|
|
2097
2165
|
}();
|
|
@@ -2099,26 +2167,26 @@ function $i(t, e, n) {
|
|
|
2099
2167
|
return m;
|
|
2100
2168
|
}) : m;
|
|
2101
2169
|
}
|
|
2102
|
-
if (Gn(m,
|
|
2170
|
+
if (Gn(m, M.length))
|
|
2103
2171
|
return m;
|
|
2104
|
-
var
|
|
2105
|
-
if (
|
|
2106
|
-
return Promise.resolve(ht({ action:
|
|
2107
|
-
|
|
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 = $;
|
|
2108
2176
|
});
|
|
2109
|
-
|
|
2177
|
+
O = m;
|
|
2110
2178
|
}();
|
|
2111
|
-
return C && C.then ? C.then(
|
|
2179
|
+
return C && C.then ? C.then(g) : g();
|
|
2112
2180
|
});
|
|
2113
2181
|
} catch (m) {
|
|
2114
2182
|
return Promise.reject(m);
|
|
2115
2183
|
}
|
|
2116
|
-
var K,
|
|
2184
|
+
var K, J, Ce;
|
|
2117
2185
|
}(a, e, t, i, n)).then(function(l) {
|
|
2118
2186
|
return s = 1, o(l);
|
|
2119
2187
|
});
|
|
2120
2188
|
}();
|
|
2121
|
-
return Promise.resolve(
|
|
2189
|
+
return Promise.resolve(v && v.then ? v.then(p) : p(v));
|
|
2122
2190
|
} catch (l) {
|
|
2123
2191
|
return Promise.reject(l);
|
|
2124
2192
|
}
|
|
@@ -2131,17 +2199,17 @@ function zi(t) {
|
|
|
2131
2199
|
return function(n) {
|
|
2132
2200
|
return function(r) {
|
|
2133
2201
|
var i = r.type, o = r.key, a = r.value, s = r.options;
|
|
2134
|
-
if (i ===
|
|
2202
|
+
if (i === P.setItem || i === P.removeItem) {
|
|
2135
2203
|
if (r.abort)
|
|
2136
2204
|
return n(r);
|
|
2137
|
-
i ===
|
|
2205
|
+
i === P.setItem ? t.setItem(o, a, s) : t.removeItem(o, s);
|
|
2138
2206
|
}
|
|
2139
2207
|
return n(r);
|
|
2140
2208
|
};
|
|
2141
2209
|
};
|
|
2142
2210
|
};
|
|
2143
2211
|
}
|
|
2144
|
-
var
|
|
2212
|
+
var Ni = function() {
|
|
2145
2213
|
var t = this;
|
|
2146
2214
|
this.before = [], this.after = [], this.addMiddleware = function(e, n) {
|
|
2147
2215
|
t[n] = t[n].concat(e);
|
|
@@ -2165,7 +2233,7 @@ var Ai = function() {
|
|
|
2165
2233
|
};
|
|
2166
2234
|
};
|
|
2167
2235
|
};
|
|
2168
|
-
function
|
|
2236
|
+
function Di(t) {
|
|
2169
2237
|
return function(e, n) {
|
|
2170
2238
|
e === void 0 && (e = {});
|
|
2171
2239
|
var r = {};
|
|
@@ -2176,19 +2244,19 @@ function Ni(t) {
|
|
|
2176
2244
|
if (!o || !i)
|
|
2177
2245
|
return e;
|
|
2178
2246
|
var a = n.enabled, s = o.config;
|
|
2179
|
-
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);
|
|
2180
2248
|
}
|
|
2181
2249
|
if (/^initialize:([^:]*)$/.test(n.type)) {
|
|
2182
|
-
var p = hn(n.type,
|
|
2183
|
-
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;
|
|
2184
2252
|
}
|
|
2185
2253
|
if (/^ready:([^:]*)$/.test(n.type))
|
|
2186
|
-
return r[n.name] =
|
|
2254
|
+
return r[n.name] = T({}, e[n.name], { loaded: !0 }), T({}, e, r);
|
|
2187
2255
|
switch (n.type) {
|
|
2188
|
-
case
|
|
2189
|
-
return
|
|
2190
|
-
case
|
|
2191
|
-
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));
|
|
2192
2260
|
default:
|
|
2193
2261
|
return e;
|
|
2194
2262
|
}
|
|
@@ -2199,7 +2267,7 @@ function hn(t, e) {
|
|
|
2199
2267
|
}
|
|
2200
2268
|
function fn(t, e, n) {
|
|
2201
2269
|
return t.reduce(function(r, i) {
|
|
2202
|
-
return r[i] =
|
|
2270
|
+
return r[i] = T({}, n[i], { enabled: e }), r;
|
|
2203
2271
|
}, n);
|
|
2204
2272
|
}
|
|
2205
2273
|
function Bn(t) {
|
|
@@ -2209,24 +2277,24 @@ function Bn(t) {
|
|
|
2209
2277
|
}
|
|
2210
2278
|
return t;
|
|
2211
2279
|
}
|
|
2212
|
-
var
|
|
2280
|
+
var Ui = { last: {}, history: [] };
|
|
2213
2281
|
function Li(t, e) {
|
|
2214
|
-
t === void 0 && (t =
|
|
2282
|
+
t === void 0 && (t = Ui);
|
|
2215
2283
|
var n = e.options, r = e.meta;
|
|
2216
|
-
if (e.type ===
|
|
2217
|
-
var i = Bn(
|
|
2218
|
-
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) });
|
|
2219
2287
|
}
|
|
2220
2288
|
return t;
|
|
2221
2289
|
}
|
|
2222
|
-
var
|
|
2223
|
-
function
|
|
2224
|
-
t === void 0 && (t =
|
|
2290
|
+
var Ri = { actions: [] };
|
|
2291
|
+
function Zi(t, e) {
|
|
2292
|
+
t === void 0 && (t = Ri);
|
|
2225
2293
|
var n = e.payload;
|
|
2226
2294
|
switch (e.type) {
|
|
2227
2295
|
case "queue":
|
|
2228
2296
|
var r;
|
|
2229
|
-
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 });
|
|
2230
2298
|
case "dequeue":
|
|
2231
2299
|
return [];
|
|
2232
2300
|
default:
|
|
@@ -2234,7 +2302,7 @@ function Ri(t, e) {
|
|
|
2234
2302
|
}
|
|
2235
2303
|
}
|
|
2236
2304
|
var qn = /#.*$/;
|
|
2237
|
-
function
|
|
2305
|
+
function Mi(t) {
|
|
2238
2306
|
var e = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);
|
|
2239
2307
|
return "/" + (e && e[3] ? e[3].split("?")[0].replace(qn, "") : "");
|
|
2240
2308
|
}
|
|
@@ -2244,21 +2312,21 @@ var Qn, er, tr, nr, Wi = function(t) {
|
|
|
2244
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) {
|
|
2245
2313
|
var d = function() {
|
|
2246
2314
|
if (Y) {
|
|
2247
|
-
for (var
|
|
2248
|
-
if (
|
|
2249
|
-
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");
|
|
2250
2318
|
}
|
|
2251
2319
|
}();
|
|
2252
2320
|
return d ? d.match(/\?/) ? d : d + h : window.location.href.replace(qn, "");
|
|
2253
|
-
}(f), c = { title: n, url: u, path:
|
|
2254
|
-
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);
|
|
2255
2323
|
}, Ki = { last: {}, history: [] };
|
|
2256
|
-
function
|
|
2324
|
+
function Ji(t, e) {
|
|
2257
2325
|
t === void 0 && (t = Ki);
|
|
2258
2326
|
var n = e.options;
|
|
2259
|
-
if (e.type ===
|
|
2260
|
-
var r = Bn(
|
|
2261
|
-
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) });
|
|
2262
2330
|
}
|
|
2263
2331
|
return t;
|
|
2264
2332
|
}
|
|
@@ -2267,24 +2335,24 @@ Qn = function() {
|
|
|
2267
2335
|
return !1;
|
|
2268
2336
|
var t = navigator.appVersion;
|
|
2269
2337
|
return ~t.indexOf("Win") ? "Windows" : ~t.indexOf("Mac") ? "MacOS" : ~t.indexOf("X11") ? "UNIX" : ~t.indexOf("Linux") ? "Linux" : "Unknown OS";
|
|
2270
|
-
}(), er = Y ? document.referrer : null, tr =
|
|
2338
|
+
}(), er = Y ? document.referrer : null, tr = ki(), nr = Ii();
|
|
2271
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 };
|
|
2272
|
-
function
|
|
2340
|
+
function Xi(t, e) {
|
|
2273
2341
|
t === void 0 && (t = pn);
|
|
2274
2342
|
var n = t.initialized, r = e.campaign;
|
|
2275
2343
|
switch (e.type) {
|
|
2276
|
-
case
|
|
2277
|
-
return
|
|
2278
|
-
case
|
|
2279
|
-
return
|
|
2280
|
-
case
|
|
2281
|
-
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 });
|
|
2282
2350
|
default:
|
|
2283
|
-
return n ? t :
|
|
2351
|
+
return n ? t : T({}, pn, t, { initialized: !0 });
|
|
2284
2352
|
}
|
|
2285
2353
|
}
|
|
2286
|
-
var
|
|
2287
|
-
function
|
|
2354
|
+
var Fi = ["plugins", "reducers", "storage"];
|
|
2355
|
+
function Hi(t, e, n) {
|
|
2288
2356
|
if (Y) {
|
|
2289
2357
|
var r = window[(n ? "add" : "remove") + "EventListener"];
|
|
2290
2358
|
t.split(" ").forEach(function(i) {
|
|
@@ -2292,8 +2360,8 @@ function Fi(t, e, n) {
|
|
|
2292
2360
|
});
|
|
2293
2361
|
}
|
|
2294
2362
|
}
|
|
2295
|
-
function
|
|
2296
|
-
var e =
|
|
2363
|
+
function Vi(t) {
|
|
2364
|
+
var e = Hi.bind(null, "online offline", function(n) {
|
|
2297
2365
|
return Promise.resolve(!navigator.onLine).then(t);
|
|
2298
2366
|
});
|
|
2299
2367
|
return e(!0), function(n) {
|
|
@@ -2330,36 +2398,36 @@ function gn(t, e, n) {
|
|
|
2330
2398
|
return s;
|
|
2331
2399
|
}(n), function(a) {
|
|
2332
2400
|
i && i(a), r(a);
|
|
2333
|
-
})),
|
|
2401
|
+
})), T({}, t, { rid: o, ts: (/* @__PURE__ */ new Date()).getTime() }, e ? { hasCallback: !0 } : {});
|
|
2334
2402
|
}
|
|
2335
|
-
function
|
|
2403
|
+
function Yi(t) {
|
|
2336
2404
|
t === void 0 && (t = {});
|
|
2337
|
-
var e = t.reducers || {}, n = t.initialUser || {}, r = (t.plugins || []).reduce(function(m,
|
|
2338
|
-
if (G(
|
|
2339
|
-
return m.middlewares = m.middlewares.concat(
|
|
2340
|
-
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)
|
|
2341
2409
|
throw new Error("https://lytics.dev/errors/1");
|
|
2342
|
-
|
|
2343
|
-
var
|
|
2344
|
-
return
|
|
2410
|
+
g.config || (g.config = {});
|
|
2411
|
+
var O = g.EVENTS ? Object.keys(g.EVENTS).map(function(z) {
|
|
2412
|
+
return g.EVENTS[z];
|
|
2345
2413
|
}) : [];
|
|
2346
|
-
m.pluginEnabled[
|
|
2347
|
-
var
|
|
2348
|
-
return z[W] = (
|
|
2349
|
-
for (var
|
|
2350
|
-
|
|
2351
|
-
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);
|
|
2352
2420
|
}), z;
|
|
2353
|
-
}, {}), delete
|
|
2354
|
-
var C = Object.keys(
|
|
2355
|
-
if (m.events = Array.from($), m.pluginsArray = m.pluginsArray.concat(
|
|
2356
|
-
throw new Error(
|
|
2357
|
-
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() {
|
|
2358
2426
|
return !0;
|
|
2359
2427
|
}), m;
|
|
2360
2428
|
}, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), i = t.storage ? t.storage : { getItem: me, setItem: ge, removeItem: je }, o = /* @__PURE__ */ function(m) {
|
|
2361
|
-
return function(
|
|
2362
|
-
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);
|
|
2363
2431
|
};
|
|
2364
2432
|
}(i), a = r.plugins, s = r.events.filter(function(m) {
|
|
2365
2433
|
return !It.includes(m);
|
|
@@ -2367,82 +2435,82 @@ function Vi(t) {
|
|
|
2367
2435
|
return !It.includes(m);
|
|
2368
2436
|
})), f = Array.from(p).sort(), u = function() {
|
|
2369
2437
|
return a;
|
|
2370
|
-
}, c = new
|
|
2438
|
+
}, c = new Ni(), h = c.addMiddleware, d = c.removeMiddleware, w = c.dynamicMiddlewares, I = function() {
|
|
2371
2439
|
throw new Error("Abort disabled inListener");
|
|
2372
|
-
},
|
|
2373
|
-
|
|
2374
|
-
var
|
|
2375
|
-
return new Promise(function(
|
|
2376
|
-
|
|
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]);
|
|
2377
2445
|
});
|
|
2378
|
-
}, disable: function(m,
|
|
2379
|
-
return new Promise(function(
|
|
2380
|
-
|
|
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]);
|
|
2381
2449
|
});
|
|
2382
|
-
} }, r.methods), l = !1,
|
|
2450
|
+
} }, r.methods), l = !1, b = { identify: function(m, g, O, C) {
|
|
2383
2451
|
try {
|
|
2384
|
-
var $ = re(m) ? m : null, z =
|
|
2452
|
+
var $ = re(m) ? m : null, z = X(m) ? m : g, W = O || {}, D = b.user();
|
|
2385
2453
|
ge(_t(te), $);
|
|
2386
|
-
var
|
|
2387
|
-
return Promise.resolve(new Promise(function(
|
|
2388
|
-
|
|
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]);
|
|
2389
2457
|
}));
|
|
2390
|
-
} catch (
|
|
2391
|
-
return Promise.reject(
|
|
2458
|
+
} catch (N) {
|
|
2459
|
+
return Promise.reject(N);
|
|
2392
2460
|
}
|
|
2393
|
-
}, track: function(m,
|
|
2461
|
+
}, track: function(m, g, O, C) {
|
|
2394
2462
|
try {
|
|
2395
|
-
var $ =
|
|
2463
|
+
var $ = X(m) ? m.event : m;
|
|
2396
2464
|
if (!$ || !re($))
|
|
2397
2465
|
throw new Error("EventMissing");
|
|
2398
|
-
var z =
|
|
2399
|
-
return Promise.resolve(new Promise(function(
|
|
2400
|
-
|
|
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]);
|
|
2401
2469
|
}));
|
|
2402
|
-
} catch (
|
|
2403
|
-
return Promise.reject(
|
|
2470
|
+
} catch (D) {
|
|
2471
|
+
return Promise.reject(D);
|
|
2404
2472
|
}
|
|
2405
|
-
}, page: function(m,
|
|
2473
|
+
}, page: function(m, g, O) {
|
|
2406
2474
|
try {
|
|
2407
|
-
var C =
|
|
2475
|
+
var C = X(m) ? m : {}, $ = X(g) ? g : {};
|
|
2408
2476
|
return Promise.resolve(new Promise(function(z) {
|
|
2409
|
-
|
|
2477
|
+
x.dispatch({ type: P.pageStart, properties: Wi(C), options: $, userId: o(te, b, C), anonymousId: o(be, b, C) }, z, [m, g, O]);
|
|
2410
2478
|
}));
|
|
2411
2479
|
} catch (z) {
|
|
2412
2480
|
return Promise.reject(z);
|
|
2413
2481
|
}
|
|
2414
2482
|
}, user: function(m) {
|
|
2415
2483
|
if (m === te || m === "id")
|
|
2416
|
-
return o(te,
|
|
2484
|
+
return o(te, b);
|
|
2417
2485
|
if (m === be || m === "anonId")
|
|
2418
|
-
return o(be,
|
|
2419
|
-
var
|
|
2420
|
-
return m ? Yt(
|
|
2486
|
+
return o(be, b);
|
|
2487
|
+
var g = b.getState("user");
|
|
2488
|
+
return m ? Yt(g, m) : g;
|
|
2421
2489
|
}, reset: function(m) {
|
|
2422
|
-
return new Promise(function(
|
|
2423
|
-
|
|
2490
|
+
return new Promise(function(g) {
|
|
2491
|
+
x.dispatch({ type: P.resetStart }, g, m);
|
|
2424
2492
|
});
|
|
2425
2493
|
}, ready: function(m) {
|
|
2426
|
-
return l && m({ plugins:
|
|
2427
|
-
m(
|
|
2494
|
+
return l && m({ plugins: v, instance: b }), b.on(P.ready, function(g) {
|
|
2495
|
+
m(g), l = !0;
|
|
2428
2496
|
});
|
|
2429
|
-
}, on: function(m,
|
|
2430
|
-
if (!m || !G(
|
|
2497
|
+
}, on: function(m, g) {
|
|
2498
|
+
if (!m || !G(g))
|
|
2431
2499
|
return !1;
|
|
2432
|
-
if (m ===
|
|
2500
|
+
if (m === P.bootstrap)
|
|
2433
2501
|
throw new Error(".on disabled for " + m);
|
|
2434
|
-
var
|
|
2502
|
+
var O = /Start$|Start:/;
|
|
2435
2503
|
if (m === "*") {
|
|
2436
|
-
var C = function(
|
|
2437
|
-
return function(
|
|
2438
|
-
return function(
|
|
2439
|
-
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);
|
|
2440
2508
|
};
|
|
2441
2509
|
};
|
|
2442
|
-
}, $ = function(
|
|
2443
|
-
return function(
|
|
2444
|
-
return function(
|
|
2445
|
-
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);
|
|
2446
2514
|
};
|
|
2447
2515
|
};
|
|
2448
2516
|
};
|
|
@@ -2450,114 +2518,114 @@ function Vi(t) {
|
|
|
2450
2518
|
d(C, He), d($, Ve);
|
|
2451
2519
|
};
|
|
2452
2520
|
}
|
|
2453
|
-
var z = m.match(
|
|
2454
|
-
return function(
|
|
2455
|
-
return function(
|
|
2456
|
-
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);
|
|
2457
2525
|
};
|
|
2458
2526
|
};
|
|
2459
2527
|
};
|
|
2460
2528
|
return h(W, z), function() {
|
|
2461
2529
|
return d(W, z);
|
|
2462
2530
|
};
|
|
2463
|
-
}, once: function(m,
|
|
2464
|
-
if (!m || !G(
|
|
2531
|
+
}, once: function(m, g) {
|
|
2532
|
+
if (!m || !G(g))
|
|
2465
2533
|
return !1;
|
|
2466
|
-
if (m ===
|
|
2534
|
+
if (m === P.bootstrap)
|
|
2467
2535
|
throw new Error(".once disabled for " + m);
|
|
2468
|
-
var
|
|
2469
|
-
|
|
2536
|
+
var O = b.on(m, function(C) {
|
|
2537
|
+
g({ payload: C.payload, instance: b, plugins: a, abort: I }), O();
|
|
2470
2538
|
});
|
|
2471
|
-
return
|
|
2539
|
+
return O;
|
|
2472
2540
|
}, getState: function(m) {
|
|
2473
|
-
var
|
|
2474
|
-
return m ? Yt(
|
|
2541
|
+
var g = x.getState();
|
|
2542
|
+
return m ? Yt(g, m) : Object.assign({}, g);
|
|
2475
2543
|
}, dispatch: function(m) {
|
|
2476
|
-
var
|
|
2477
|
-
if (Be.includes(
|
|
2478
|
-
throw new Error("reserved action " +
|
|
2479
|
-
var
|
|
2480
|
-
|
|
2481
|
-
}, enablePlugin:
|
|
2482
|
-
|
|
2483
|
-
}, removeItem: function(m,
|
|
2484
|
-
|
|
2485
|
-
} }, setAnonymousId: function(m,
|
|
2486
|
-
|
|
2487
|
-
}, events: { core: Be, plugins: s } },
|
|
2488
|
-
return function(
|
|
2489
|
-
return function(
|
|
2490
|
-
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);
|
|
2491
2559
|
};
|
|
2492
2560
|
};
|
|
2493
|
-
},
|
|
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;
|
|
2494
2562
|
if (Y && t.debug) {
|
|
2495
|
-
var
|
|
2496
|
-
|
|
2497
|
-
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);
|
|
2498
2566
|
};
|
|
2499
2567
|
}
|
|
2500
|
-
var
|
|
2501
|
-
return Object.keys(m).reduce(function(
|
|
2502
|
-
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;
|
|
2503
2571
|
}, {});
|
|
2504
|
-
}(t), H = r.pluginsArray.reduce(function(m,
|
|
2505
|
-
var
|
|
2506
|
-
return m[
|
|
2507
|
-
}, {}),
|
|
2508
|
-
for (var
|
|
2509
|
-
var $ =
|
|
2510
|
-
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[$]);
|
|
2511
2579
|
}
|
|
2512
|
-
var z, W = Object.keys(
|
|
2580
|
+
var z, W = Object.keys(O);
|
|
2513
2581
|
try {
|
|
2514
|
-
(function(
|
|
2515
|
-
Object.keys(
|
|
2516
|
-
var
|
|
2517
|
-
if (typeof
|
|
2518
|
-
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);
|
|
2519
2587
|
});
|
|
2520
|
-
})(
|
|
2521
|
-
} catch (
|
|
2522
|
-
z =
|
|
2588
|
+
})(O);
|
|
2589
|
+
} catch (D) {
|
|
2590
|
+
z = D;
|
|
2523
2591
|
}
|
|
2524
|
-
return function(
|
|
2525
|
-
if (
|
|
2592
|
+
return function(D, Z) {
|
|
2593
|
+
if (D === void 0 && (D = {}), z)
|
|
2526
2594
|
throw z;
|
|
2527
|
-
for (var
|
|
2528
|
-
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);
|
|
2529
2597
|
if (typeof st === ee) {
|
|
2530
|
-
var
|
|
2531
|
-
throw new Error(
|
|
2598
|
+
var pr = Oi(We, Z);
|
|
2599
|
+
throw new Error(pr);
|
|
2532
2600
|
}
|
|
2533
|
-
q[
|
|
2601
|
+
q[We] = st, N = N || st !== Dt;
|
|
2534
2602
|
}
|
|
2535
|
-
return
|
|
2603
|
+
return N ? q : D;
|
|
2536
2604
|
};
|
|
2537
|
-
}(
|
|
2538
|
-
|
|
2539
|
-
var C =
|
|
2540
|
-
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]);
|
|
2541
2609
|
});
|
|
2542
2610
|
var K = Object.keys(a);
|
|
2543
|
-
|
|
2544
|
-
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) {
|
|
2545
2613
|
return r.pluginEnabled[m];
|
|
2546
2614
|
}), Ce = K.filter(function(m) {
|
|
2547
2615
|
return !r.pluginEnabled[m];
|
|
2548
2616
|
});
|
|
2549
|
-
return
|
|
2550
|
-
var
|
|
2551
|
-
|
|
2552
|
-
}),
|
|
2553
|
-
|
|
2554
|
-
}), 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) {
|
|
2555
2623
|
setInterval(function() {
|
|
2556
|
-
return Yn(m,
|
|
2624
|
+
return Yn(m, g, O);
|
|
2557
2625
|
}, 3e3);
|
|
2558
|
-
}(
|
|
2626
|
+
}(x, u, b), b;
|
|
2559
2627
|
}
|
|
2560
|
-
var He = "before", Ve = "after",
|
|
2628
|
+
var He = "before", Ve = "after", Ue = "cookie", ue = ar(), ir = ot, Gi = ot;
|
|
2561
2629
|
function or(t) {
|
|
2562
2630
|
return ue ? ot(t, "", -1) : je(t);
|
|
2563
2631
|
}
|
|
@@ -2578,11 +2646,11 @@ function ot(t, e, n, r, i, o) {
|
|
|
2578
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]);
|
|
2579
2647
|
}
|
|
2580
2648
|
}
|
|
2581
|
-
var
|
|
2649
|
+
var Le = "localStorage", Bi = jt.bind(null, "localStorage");
|
|
2582
2650
|
xe("localStorage", "getItem", me);
|
|
2583
2651
|
xe("localStorage", "setItem", ge);
|
|
2584
2652
|
xe("localStorage", "removeItem", je);
|
|
2585
|
-
var Re = "sessionStorage",
|
|
2653
|
+
var Re = "sessionStorage", qi = jt.bind(null, "sessionStorage");
|
|
2586
2654
|
xe("sessionStorage", "getItem", me);
|
|
2587
2655
|
xe("sessionStorage", "setItem", ge);
|
|
2588
2656
|
xe("sessionStorage", "removeItem", je);
|
|
@@ -2593,7 +2661,7 @@ function _e(t) {
|
|
|
2593
2661
|
return !0;
|
|
2594
2662
|
if (e === "false")
|
|
2595
2663
|
return !1;
|
|
2596
|
-
if (
|
|
2664
|
+
if (X(e))
|
|
2597
2665
|
return e;
|
|
2598
2666
|
parseFloat(e) === e && (e = parseFloat(e));
|
|
2599
2667
|
} catch {
|
|
@@ -2601,57 +2669,57 @@ function _e(t) {
|
|
|
2601
2669
|
if (e !== null && e !== "")
|
|
2602
2670
|
return e;
|
|
2603
2671
|
}
|
|
2604
|
-
var
|
|
2672
|
+
var Qi = Bi(), eo = qi(), to = ar();
|
|
2605
2673
|
function sr(t, e) {
|
|
2606
2674
|
if (t) {
|
|
2607
|
-
var n = xt(e), r = !
|
|
2675
|
+
var n = xt(e), r = !zt(n), i = Ct(n) ? _e(localStorage.getItem(t)) : void 0;
|
|
2608
2676
|
if (r && !we(i))
|
|
2609
2677
|
return i;
|
|
2610
2678
|
var o = $t(n) ? _e(ir(t)) : void 0;
|
|
2611
2679
|
if (r && o)
|
|
2612
2680
|
return o;
|
|
2613
|
-
var a =
|
|
2681
|
+
var a = At(n) ? _e(sessionStorage.getItem(t)) : void 0;
|
|
2614
2682
|
if (r && a)
|
|
2615
2683
|
return a;
|
|
2616
2684
|
var s = me(t);
|
|
2617
2685
|
return r ? s : { localStorage: i, sessionStorage: a, cookie: o, global: s };
|
|
2618
2686
|
}
|
|
2619
2687
|
}
|
|
2620
|
-
function
|
|
2688
|
+
function no(t, e, n) {
|
|
2621
2689
|
if (t && !we(e)) {
|
|
2622
|
-
var r = {}, i = xt(n), o = JSON.stringify(e), a = !
|
|
2623
|
-
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);
|
|
2624
2692
|
}
|
|
2625
2693
|
}
|
|
2626
|
-
function
|
|
2694
|
+
function ro(t, e) {
|
|
2627
2695
|
if (t) {
|
|
2628
|
-
var n = xt(e), r = sr(t,
|
|
2629
|
-
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;
|
|
2630
2698
|
}
|
|
2631
2699
|
}
|
|
2632
2700
|
function xt(t) {
|
|
2633
|
-
return t ? re(t) ? t : t.storage :
|
|
2701
|
+
return t ? re(t) ? t : t.storage : Mn;
|
|
2634
2702
|
}
|
|
2635
2703
|
function Ct(t) {
|
|
2636
|
-
return
|
|
2704
|
+
return Qi && at(t, Le);
|
|
2637
2705
|
}
|
|
2638
2706
|
function $t(t) {
|
|
2639
|
-
return
|
|
2640
|
-
}
|
|
2641
|
-
function zt(t) {
|
|
2642
|
-
return Qi && at(t, Re);
|
|
2707
|
+
return to && at(t, Ue);
|
|
2643
2708
|
}
|
|
2644
2709
|
function At(t) {
|
|
2645
|
-
return
|
|
2710
|
+
return eo && at(t, Re);
|
|
2711
|
+
}
|
|
2712
|
+
function zt(t) {
|
|
2713
|
+
return t === Wn || t === "all";
|
|
2646
2714
|
}
|
|
2647
2715
|
function at(t, e) {
|
|
2648
|
-
return t ===
|
|
2716
|
+
return t === Mn || t === e || zt(t);
|
|
2649
2717
|
}
|
|
2650
2718
|
function Ye(t, e, n) {
|
|
2651
2719
|
return { location: t, current: e, previous: n };
|
|
2652
2720
|
}
|
|
2653
|
-
var
|
|
2654
|
-
function
|
|
2721
|
+
var io = { setItem: no, getItem: sr, removeItem: ro };
|
|
2722
|
+
function oo(t, e, n) {
|
|
2655
2723
|
return e in t ? Object.defineProperty(t, e, {
|
|
2656
2724
|
value: n,
|
|
2657
2725
|
enumerable: !0,
|
|
@@ -2673,20 +2741,20 @@ function vn(t) {
|
|
|
2673
2741
|
for (var e = 1; e < arguments.length; e++) {
|
|
2674
2742
|
var n = arguments[e] != null ? arguments[e] : {};
|
|
2675
2743
|
e % 2 ? yn(Object(n), !0).forEach(function(r) {
|
|
2676
|
-
|
|
2744
|
+
oo(t, r, n[r]);
|
|
2677
2745
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : yn(Object(n)).forEach(function(r) {
|
|
2678
2746
|
Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
|
|
2679
2747
|
});
|
|
2680
2748
|
}
|
|
2681
2749
|
return t;
|
|
2682
2750
|
}
|
|
2683
|
-
function
|
|
2751
|
+
function ao() {
|
|
2684
2752
|
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = {
|
|
2685
|
-
storage:
|
|
2753
|
+
storage: io
|
|
2686
2754
|
};
|
|
2687
|
-
return
|
|
2755
|
+
return Yi(vn(vn({}, e), t));
|
|
2688
2756
|
}
|
|
2689
|
-
function
|
|
2757
|
+
function so(t, e) {
|
|
2690
2758
|
e = e || {};
|
|
2691
2759
|
var n, r, i = [], o = e.max || 1 / 0;
|
|
2692
2760
|
function a() {
|
|
@@ -2708,7 +2776,7 @@ function ao(t, e) {
|
|
|
2708
2776
|
}
|
|
2709
2777
|
};
|
|
2710
2778
|
}
|
|
2711
|
-
function
|
|
2779
|
+
function co(t) {
|
|
2712
2780
|
if (typeof window > "u")
|
|
2713
2781
|
return;
|
|
2714
2782
|
const { addEventListener: e, history: n, location: r } = window;
|
|
@@ -2720,27 +2788,27 @@ function so(t) {
|
|
|
2720
2788
|
const s = n[a];
|
|
2721
2789
|
n[a] = function(...p) {
|
|
2722
2790
|
var c;
|
|
2723
|
-
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);
|
|
2724
2792
|
return i !== u && (i = u, setTimeout(() => t(f), 0)), s.apply(n, p);
|
|
2725
2793
|
};
|
|
2726
2794
|
});
|
|
2727
2795
|
}
|
|
2728
|
-
function
|
|
2796
|
+
function uo(t, e) {
|
|
2729
2797
|
const n = t.indexOf(e);
|
|
2730
2798
|
return n > -1 ? t.slice(0, n) : t;
|
|
2731
2799
|
}
|
|
2732
|
-
function
|
|
2733
|
-
return ["#", "?"].forEach((e) => t =
|
|
2800
|
+
function lo(t) {
|
|
2801
|
+
return ["#", "?"].forEach((e) => t = uo(t, e)), t;
|
|
2734
2802
|
}
|
|
2735
|
-
function
|
|
2736
|
-
|
|
2803
|
+
function ho() {
|
|
2804
|
+
co(() => {
|
|
2737
2805
|
se.page();
|
|
2738
2806
|
});
|
|
2739
2807
|
}
|
|
2740
2808
|
var wn = "EventListener";
|
|
2741
|
-
function
|
|
2809
|
+
function fo(t) {
|
|
2742
2810
|
return function(e, n, r, i) {
|
|
2743
|
-
var o = r ||
|
|
2811
|
+
var o = r || li, a = i || !1;
|
|
2744
2812
|
if (!Y)
|
|
2745
2813
|
return o;
|
|
2746
2814
|
var s = et(n), p = et(e, !0);
|
|
@@ -2752,10 +2820,10 @@ function ho(t) {
|
|
|
2752
2820
|
return function u(c) {
|
|
2753
2821
|
c && (f = []);
|
|
2754
2822
|
for (var h = c ? "add" + wn : "remove" + wn, d = 0; d < p.length; d++) {
|
|
2755
|
-
var
|
|
2756
|
-
f[d] = c ? a && a.once ?
|
|
2757
|
-
for (var
|
|
2758
|
-
|
|
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);
|
|
2759
2827
|
}
|
|
2760
2828
|
return u.bind(null, !c);
|
|
2761
2829
|
}(t);
|
|
@@ -2772,18 +2840,18 @@ function et(t, e) {
|
|
|
2772
2840
|
r[i] = t[i];
|
|
2773
2841
|
return r;
|
|
2774
2842
|
}
|
|
2775
|
-
var o =
|
|
2843
|
+
var o = bi(t);
|
|
2776
2844
|
return e ? o.map(function(a) {
|
|
2777
2845
|
return re(a) ? et(a, !0) : a;
|
|
2778
2846
|
}).flat() : o;
|
|
2779
2847
|
}
|
|
2780
|
-
function
|
|
2848
|
+
function po(t, e) {
|
|
2781
2849
|
var n;
|
|
2782
2850
|
return function() {
|
|
2783
2851
|
return t && (n = t.apply(e || this, arguments), t = null), n;
|
|
2784
2852
|
};
|
|
2785
2853
|
}
|
|
2786
|
-
var gt =
|
|
2854
|
+
var gt = fo("Event");
|
|
2787
2855
|
function cr(t, e) {
|
|
2788
2856
|
return Y && G(window[t]) ? (n = window[t], r = e, (i = window) === void 0 && (i = null), G(n) ? function() {
|
|
2789
2857
|
n.apply(i, arguments), r.apply(i, arguments);
|
|
@@ -2793,10 +2861,10 @@ function cr(t, e) {
|
|
|
2793
2861
|
cr.bind(null, "onerror");
|
|
2794
2862
|
cr.bind(null, "onload");
|
|
2795
2863
|
var ur = typeof window > "u", bn = "hidden";
|
|
2796
|
-
function
|
|
2864
|
+
function mo(t) {
|
|
2797
2865
|
if (ur)
|
|
2798
2866
|
return !1;
|
|
2799
|
-
var e =
|
|
2867
|
+
var e = go(), n = "".concat(e.replace(/[H|h]idden/, ""), "visibilitychange"), r = function() {
|
|
2800
2868
|
return t(!!document[e]);
|
|
2801
2869
|
}, i = function() {
|
|
2802
2870
|
return document.addEventListener(n, r);
|
|
@@ -2805,15 +2873,15 @@ function po(t) {
|
|
|
2805
2873
|
return document.removeEventListener(n, r), i;
|
|
2806
2874
|
};
|
|
2807
2875
|
}
|
|
2808
|
-
function
|
|
2876
|
+
function go() {
|
|
2809
2877
|
var t = ["webkit", "moz", "ms", "o"];
|
|
2810
2878
|
return ur || bn in document ? bn : t.reduce(function(e, n) {
|
|
2811
2879
|
var r = n + "Hidden";
|
|
2812
2880
|
return !e && r in document ? r : e;
|
|
2813
2881
|
}, null);
|
|
2814
2882
|
}
|
|
2815
|
-
var
|
|
2816
|
-
function
|
|
2883
|
+
var yo = ["mousemove", "mousedown", "touchmove", "touchstart", "touchend", "keydown"];
|
|
2884
|
+
function vo(t, e) {
|
|
2817
2885
|
e === void 0 && (e = {});
|
|
2818
2886
|
var n = /* @__PURE__ */ function(a, s) {
|
|
2819
2887
|
var p = this, f = !1;
|
|
@@ -2824,10 +2892,10 @@ function yo(t, e) {
|
|
|
2824
2892
|
};
|
|
2825
2893
|
}(t, e.throttle || 1e4), r = [];
|
|
2826
2894
|
function i() {
|
|
2827
|
-
var a =
|
|
2895
|
+
var a = mo(function(s) {
|
|
2828
2896
|
s || n({ type: "tabVisible" });
|
|
2829
2897
|
});
|
|
2830
|
-
return r = [a].concat(
|
|
2898
|
+
return r = [a].concat(yo.map(function(s) {
|
|
2831
2899
|
return gt(document, s, n);
|
|
2832
2900
|
})).concat(gt(window, "load", n)).concat(gt(window, "scroll", n, { capture: !0, passive: !0 })), o;
|
|
2833
2901
|
}
|
|
@@ -2840,31 +2908,31 @@ function yo(t, e) {
|
|
|
2840
2908
|
return o(), i;
|
|
2841
2909
|
};
|
|
2842
2910
|
}
|
|
2843
|
-
function
|
|
2911
|
+
function wo(t) {
|
|
2844
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() {
|
|
2845
2913
|
return clearTimeout(e);
|
|
2846
2914
|
};
|
|
2847
|
-
function
|
|
2848
|
-
d(), o && !u && o(
|
|
2849
|
-
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));
|
|
2850
2918
|
}, s);
|
|
2851
2919
|
}
|
|
2852
|
-
var
|
|
2920
|
+
var I = vo(w, { throttle: f });
|
|
2853
2921
|
return { disable: function() {
|
|
2854
2922
|
c = !0, u = !1, d();
|
|
2855
|
-
var
|
|
2923
|
+
var y = I();
|
|
2856
2924
|
return function() {
|
|
2857
|
-
return c = !1, h = /* @__PURE__ */ new Date(),
|
|
2925
|
+
return c = !1, h = /* @__PURE__ */ new Date(), w({ type: "load" }), y();
|
|
2858
2926
|
};
|
|
2859
2927
|
}, getStatus: function() {
|
|
2860
|
-
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 };
|
|
2861
2929
|
} };
|
|
2862
2930
|
}
|
|
2863
|
-
function
|
|
2931
|
+
function ze(t, e) {
|
|
2864
2932
|
return e ? 0 : Math.round((/* @__PURE__ */ new Date() - t) / 1e3);
|
|
2865
2933
|
}
|
|
2866
2934
|
const kn = 5e3;
|
|
2867
|
-
class
|
|
2935
|
+
class bo {
|
|
2868
2936
|
constructor(e) {
|
|
2869
2937
|
B(this, "element");
|
|
2870
2938
|
B(this, "isInViewport", !1);
|
|
@@ -2885,7 +2953,7 @@ class wo {
|
|
|
2885
2953
|
{
|
|
2886
2954
|
threshold: 0
|
|
2887
2955
|
}
|
|
2888
|
-
), this.observer.observe(this.element),
|
|
2956
|
+
), this.observer.observe(this.element), wo({
|
|
2889
2957
|
onIdle: (n) => this.handleAwake(!1, n),
|
|
2890
2958
|
onWakeUp: (n) => this.handleAwake(!0, n),
|
|
2891
2959
|
timeout: kn
|
|
@@ -2895,51 +2963,60 @@ class wo {
|
|
|
2895
2963
|
* Flush the awake timer in case the page is unloading
|
|
2896
2964
|
*/
|
|
2897
2965
|
flush() {
|
|
2898
|
-
this.isFlushing = !0, this.handleAwake(!this.isAwake
|
|
2966
|
+
this.isFlushing = !0, this.handleAwake(!this.isAwake);
|
|
2899
2967
|
}
|
|
2900
2968
|
handleInViewPort(e) {
|
|
2901
|
-
e ? (this.isAwake = !0, this.trackInViewport()) : this.handleAwake(!1
|
|
2969
|
+
e ? (this.isAwake = !0, this.trackInViewport()) : this.handleAwake(!1), this.isInViewport = e;
|
|
2902
2970
|
}
|
|
2903
|
-
handleAwake(e, n) {
|
|
2971
|
+
handleAwake(e, n = Math.round((Date.now() - this.lastEventAt) / 1e3)) {
|
|
2904
2972
|
this.isAwake = e, this.lastEventAt = e ? Date.now() - n * kn : Date.now(), this.isInViewport && this.trackAwake(e, n);
|
|
2905
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
|
+
}
|
|
2906
2979
|
trackAwake(e, n) {
|
|
2907
|
-
!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);
|
|
2908
2981
|
}
|
|
2909
2982
|
trackInViewport() {
|
|
2910
2983
|
this.registeredView || (this.registeredView = !0, this.viewCallback && this.viewCallback());
|
|
2911
2984
|
}
|
|
2912
2985
|
}
|
|
2913
2986
|
const In = "sesamy_session_id";
|
|
2914
|
-
function
|
|
2987
|
+
function ko() {
|
|
2915
2988
|
let t = sessionStorage.getItem(In);
|
|
2916
2989
|
return t || (t = Math.random().toString(36).slice(2, 9), sessionStorage.setItem(In, t)), t;
|
|
2917
2990
|
}
|
|
2918
2991
|
let lr = !1, St, _n, tt;
|
|
2919
|
-
function
|
|
2992
|
+
function Io({ clientId: t, enabled: e = !0, endpoint: n = Wr }) {
|
|
2920
2993
|
if (St = t, _n = e, tt = n, !_n)
|
|
2921
2994
|
return;
|
|
2922
|
-
|
|
2923
|
-
const r = new
|
|
2995
|
+
ho();
|
|
2996
|
+
const r = new bo({
|
|
2924
2997
|
element: document.body,
|
|
2925
2998
|
viewCallback: () => {
|
|
2926
2999
|
se.page();
|
|
2927
3000
|
},
|
|
2928
|
-
activeDurationCallback: (i, o) => {
|
|
3001
|
+
activeDurationCallback: (i, o, a) => {
|
|
2929
3002
|
se.track("activeDuration", {
|
|
2930
3003
|
duration: i,
|
|
3004
|
+
durationStart: a,
|
|
2931
3005
|
flushing: o
|
|
2932
3006
|
});
|
|
2933
3007
|
},
|
|
2934
|
-
idleDurationCallback: (i, o) => {
|
|
3008
|
+
idleDurationCallback: (i, o, a) => {
|
|
2935
3009
|
se.track("idleDuration", {
|
|
2936
3010
|
duration: i,
|
|
3011
|
+
durationStart: a,
|
|
2937
3012
|
flushing: o
|
|
2938
3013
|
});
|
|
2939
3014
|
}
|
|
2940
3015
|
});
|
|
2941
|
-
|
|
3016
|
+
So(document.body, () => {
|
|
2942
3017
|
r.flush();
|
|
3018
|
+
}), Eo(document.body, () => {
|
|
3019
|
+
r.handleVisibilityChange();
|
|
2943
3020
|
}), window.addEventListener(Se.AUTHENTICATED, async (i) => {
|
|
2944
3021
|
const o = i;
|
|
2945
3022
|
await se.identify(o.detail.sub);
|
|
@@ -2953,7 +3030,7 @@ function dr(t) {
|
|
|
2953
3030
|
...e,
|
|
2954
3031
|
clientId: St,
|
|
2955
3032
|
requestId: Math.random().toString(36).slice(2, 9),
|
|
2956
|
-
sessionId:
|
|
3033
|
+
sessionId: ko(),
|
|
2957
3034
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2958
3035
|
version: Tt,
|
|
2959
3036
|
event: e.event,
|
|
@@ -2973,7 +3050,7 @@ function dr(t) {
|
|
|
2973
3050
|
}))
|
|
2974
3051
|
);
|
|
2975
3052
|
}
|
|
2976
|
-
const Nt =
|
|
3053
|
+
const Nt = so(
|
|
2977
3054
|
async (t) => {
|
|
2978
3055
|
if (t.length > 0) {
|
|
2979
3056
|
const e = dr(t);
|
|
@@ -3002,7 +3079,7 @@ function yt(t) {
|
|
|
3002
3079
|
} else
|
|
3003
3080
|
Nt.push(t);
|
|
3004
3081
|
}
|
|
3005
|
-
const se =
|
|
3082
|
+
const se = ao({
|
|
3006
3083
|
app: Zn,
|
|
3007
3084
|
version: Tt,
|
|
3008
3085
|
plugins: [
|
|
@@ -3040,20 +3117,29 @@ const se = oo({
|
|
|
3040
3117
|
}
|
|
3041
3118
|
]
|
|
3042
3119
|
});
|
|
3043
|
-
function
|
|
3120
|
+
function _o() {
|
|
3044
3121
|
return lr = !0, Nt.flush();
|
|
3045
3122
|
}
|
|
3046
3123
|
const hr = /* @__PURE__ */ new Map();
|
|
3047
|
-
function
|
|
3124
|
+
function So(t, e) {
|
|
3048
3125
|
hr.set(t, e);
|
|
3049
3126
|
}
|
|
3050
3127
|
window.addEventListener("beforeunload", () => {
|
|
3051
3128
|
hr.forEach((t, e) => {
|
|
3052
3129
|
t.bind(e)();
|
|
3053
|
-
}),
|
|
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
|
+
});
|
|
3054
3140
|
});
|
|
3055
|
-
async function
|
|
3056
|
-
|
|
3141
|
+
async function Oo(t) {
|
|
3142
|
+
Io({
|
|
3057
3143
|
clientId: t.clientId,
|
|
3058
3144
|
// The default client id can be overridden by the config
|
|
3059
3145
|
...t.analytics
|
|
@@ -3062,7 +3148,7 @@ async function So(t) {
|
|
|
3062
3148
|
// The default client id can be overridden by the config
|
|
3063
3149
|
...t.auth
|
|
3064
3150
|
});
|
|
3065
|
-
const e =
|
|
3151
|
+
const e = ci(t.api || {});
|
|
3066
3152
|
return Et(Se.READY, {}), e;
|
|
3067
3153
|
}
|
|
3068
3154
|
if (typeof document < "u") {
|
|
@@ -3070,11 +3156,11 @@ if (typeof document < "u") {
|
|
|
3070
3156
|
if (t != null && t.textContent)
|
|
3071
3157
|
try {
|
|
3072
3158
|
const e = JSON.parse(t.textContent);
|
|
3073
|
-
|
|
3159
|
+
Oo(e);
|
|
3074
3160
|
} catch (e) {
|
|
3075
3161
|
console.error("Failed to parse config", e);
|
|
3076
3162
|
}
|
|
3077
3163
|
}
|
|
3078
3164
|
export {
|
|
3079
|
-
|
|
3165
|
+
Oo as init
|
|
3080
3166
|
};
|