@sesamy/sesamy-js 1.3.14 → 1.4.0

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