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