wineater-bot 3.9.2 → 3.9.4

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.
@@ -285,8 +285,8 @@ var Vn = { exports: {} };
285
285
  }), te.forEach(function(K) {
286
286
  ce[K.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: K.transient, value: K.trait_value };
287
287
  }), h.oldFlags = i({}, h.flags);
288
- var ge = l(h.oldFlags, ae), Ke = l((W = h.evaluationContext.identity) === null || W === void 0 ? void 0 : W.traits, ce);
289
- if ((ne || Object.keys(ce).length) && (h.evaluationContext.identity = { traits: ce }, ne && (h.evaluationContext.identity.identifier = ne)), h.flags = ae, h.updateStorage(), h._onChange(h.oldFlags, { isFromServer: !0, flagsChanged: ge, traitsChanged: Ke }, h._loadedState(null, a.SERVER)), h.datadogRum)
288
+ var me = l(h.oldFlags, ae), Ke = l((W = h.evaluationContext.identity) === null || W === void 0 ? void 0 : W.traits, ce);
289
+ if ((ne || Object.keys(ce).length) && (h.evaluationContext.identity = { traits: ce }, ne && (h.evaluationContext.identity.identifier = ne)), h.flags = ae, h.updateStorage(), h._onChange(h.oldFlags, { isFromServer: !0, flagsChanged: me, traitsChanged: Ke }, h._loadedState(null, a.SERVER)), h.datadogRum)
290
290
  try {
291
291
  if (h.datadogRum.trackTraits) {
292
292
  var Je = {};
@@ -398,12 +398,12 @@ var Vn = { exports: {} };
398
398
  h.log(ce, "Failed to parse x-flagsmith-document-updated-at", ne);
399
399
  }
400
400
  return h.log("Fetch response: " + q.status + " " + (g || "GET") + 0 + m), q.text().then(function(ce) {
401
- var ge = ce;
401
+ var me = ce;
402
402
  try {
403
- ge = JSON.parse(ce);
403
+ me = JSON.parse(ce);
404
404
  } catch {
405
405
  }
406
- return !ge && q.status && (ge = "API Response: ".concat(q.status)), q.status && q.status >= 200 && q.status < 300 ? ge : Promise.reject(new Error(ge));
406
+ return !me && q.status && (me = "API Response: ".concat(q.status)), q.status && q.status >= 200 && q.status < 300 ? me : Promise.reject(new Error(me));
407
407
  });
408
408
  }
409
409
  h.log("Received response with identity mismatch, ignoring response. Requested: ".concat(O, ", Current: ").concat(te));
@@ -423,34 +423,34 @@ var Vn = { exports: {} };
423
423
  return b.prototype.init = function(f) {
424
424
  var h, m, g;
425
425
  return r(this, void 0, void 0, function() {
426
- var S, k, A, B, W, O, q, ee, oe, te, ne, ae, ce, ge, Ke, Je, Me, se, K, _t, Xe, zn, Ye, Nt, Un, Hn, Ot, $n, Rt, Qe, Fe, Wn, ie = this;
426
+ var S, k, A, B, W, O, q, ee, oe, te, ne, ae, ce, me, Ke, Je, Me, se, K, _t, Xe, zn, Ye, Nt, Un, Hn, Ot, $n, Rt, Qe, Fe, Wn, ie = this;
427
427
  return o(this, function(fe) {
428
428
  switch (fe.label) {
429
429
  case 0:
430
430
  S = y(f.evaluationContext || this.evaluationContext), fe.label = 1;
431
431
  case 1:
432
- if (fe.trys.push([1, 13, , 14]), k = f.environmentID, A = f.api, B = A === void 0 ? E : A, W = f.headers, O = f.onChange, q = f.cacheFlags, ee = f.datadogRum, oe = f.onError, te = f.defaultFlags, ne = f.fetch, ae = f.preventFetch, ce = f.enableLogs, ge = f.enableDynatrace, Ke = f.enableAnalytics, Je = f.realtime, Me = f.eventSourceUrl, se = Me === void 0 ? "https://realtime.flagsmith.com/" : Me, K = f.AsyncStorage, _t = f.identity, Xe = f.traits, zn = f.state, Ye = f.cacheOptions, Nt = f.angularHttpClient, Un = f._trigger, Hn = f._triggerLoadingState, S.environment = k ? { apiKey: k } : S.environment, !S.environment || !S.environment.apiKey)
432
+ if (fe.trys.push([1, 13, , 14]), k = f.environmentID, A = f.api, B = A === void 0 ? E : A, W = f.headers, O = f.onChange, q = f.cacheFlags, ee = f.datadogRum, oe = f.onError, te = f.defaultFlags, ne = f.fetch, ae = f.preventFetch, ce = f.enableLogs, me = f.enableDynatrace, Ke = f.enableAnalytics, Je = f.realtime, Me = f.eventSourceUrl, se = Me === void 0 ? "https://realtime.flagsmith.com/" : Me, K = f.AsyncStorage, _t = f.identity, Xe = f.traits, zn = f.state, Ye = f.cacheOptions, Nt = f.angularHttpClient, Un = f._trigger, Hn = f._triggerLoadingState, S.environment = k ? { apiKey: k } : S.environment, !S.environment || !S.environment.apiKey)
433
433
  throw new Error("Please provide `evaluationContext.environment` with non-empty `apiKey`");
434
434
  if (S.identity = _t || Xe ? { identifier: _t, traits: Xe ? Object.fromEntries(Object.entries(Xe).map(function(le) {
435
435
  return [le[0], { value: le[1] }];
436
436
  })) : {} } : S.identity, this.evaluationContext = S, this.api = B, this.headers = W, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = O, Ot = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger = Un || this._trigger, this._triggerLoadingState = Hn || this._triggerLoadingState, this.onError = function(le) {
437
437
  ie.setLoadingState(i(i({}, ie.loadingState), { isFetching: !1, isLoading: !1, error: le })), oe == null || oe(le);
438
- }, this.enableLogs = ce || !1, this.cacheOptions = Ye ? { skipAPI: !!Ye.skipAPI, ttl: Ye.ttl || 0, loadStale: !!Ye.loadStale } : this.cacheOptions, !this.cacheOptions.ttl && this.cacheOptions.skipAPI && console.warn("Flagsmith: you have set a cache ttl of 0 and are skipping API calls, this means the API will not be hit unless you clear local storage."), ne && (d = ne), this.enableAnalytics = Ke || !1, this.flags = Object.assign({}, te) || {}, this.datadogRum = ee || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = C !== void 0 && !!q, K && (C = K), Je && typeof window < "u" && this.setupRealtime(se, S.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = i(i({}, this.loadingState), { isLoading: !1, source: a.DEFAULT_FLAGS })), this.setState(zn), this.log("Initialising with properties", f, this), ge && (typeof dtrum > "u" ? console.error("You have attempted to enable dynatrace but dtrum is undefined, please check you have the Dynatrace RUM JavaScript API installed.") : this.dtrum = dtrum), Nt && (d = /* @__PURE__ */ function(le) {
439
- return function(me, ve) {
440
- var Te = ve.headers, Y = ve.method, Pe = ve.body;
438
+ }, this.enableLogs = ce || !1, this.cacheOptions = Ye ? { skipAPI: !!Ye.skipAPI, ttl: Ye.ttl || 0, loadStale: !!Ye.loadStale } : this.cacheOptions, !this.cacheOptions.ttl && this.cacheOptions.skipAPI && console.warn("Flagsmith: you have set a cache ttl of 0 and are skipping API calls, this means the API will not be hit unless you clear local storage."), ne && (d = ne), this.enableAnalytics = Ke || !1, this.flags = Object.assign({}, te) || {}, this.datadogRum = ee || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = C !== void 0 && !!q, K && (C = K), Je && typeof window < "u" && this.setupRealtime(se, S.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = i(i({}, this.loadingState), { isLoading: !1, source: a.DEFAULT_FLAGS })), this.setState(zn), this.log("Initialising with properties", f, this), me && (typeof dtrum > "u" ? console.error("You have attempted to enable dynatrace but dtrum is undefined, please check you have the Dynatrace RUM JavaScript API installed.") : this.dtrum = dtrum), Nt && (d = /* @__PURE__ */ function(le) {
439
+ return function(ve, be) {
440
+ var Te = be.headers, Y = be.method, Pe = be.body;
441
441
  return new Promise(function(Re) {
442
442
  switch (Y) {
443
443
  case "GET":
444
- return le.get(me, { headers: Te }).subscribe(function(xe) {
444
+ return le.get(ve, { headers: Te }).subscribe(function(ke) {
445
445
  Re({ ok: !0, text: function() {
446
- return Promise.resolve(xe);
446
+ return Promise.resolve(ke);
447
447
  } });
448
448
  });
449
449
  case "POST":
450
450
  case "PUT":
451
- return le.post(me, Pe, { headers: Te }).subscribe(function(xe) {
451
+ return le.post(ve, Pe, { headers: Te }).subscribe(function(ke) {
452
452
  Re({ ok: !0, text: function() {
453
- return Promise.resolve(xe);
453
+ return Promise.resolve(ke);
454
454
  } });
455
455
  });
456
456
  }
@@ -463,29 +463,29 @@ var Vn = { exports: {} };
463
463
  ie.evaluationEvent = {};
464
464
  }
465
465
  ie.analyticsInterval = setInterval(ie.analyticsFlags, ie.ticks);
466
- }), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), C && this.canUseStorage && C.getItem(R, function(le, me) {
467
- if (me && ie.evaluationContext.environment) {
468
- var ve = JSON.parse(me);
469
- if (ve[ie.evaluationContext.environment.apiKey]) {
466
+ }), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), C && this.canUseStorage && C.getItem(R, function(le, ve) {
467
+ if (ve && ie.evaluationContext.environment) {
468
+ var be = JSON.parse(ve);
469
+ if (be[ie.evaluationContext.environment.apiKey]) {
470
470
  var Te = ie.getState();
471
- ie.log("Retrieved events from cache", me), ie.setState(i(i({}, Te), { evaluationEvent: ve[ie.evaluationContext.environment.apiKey] }));
471
+ ie.log("Retrieved events from cache", ve), ie.setState(i(i({}, Te), { evaluationEvent: be[ie.evaluationContext.environment.apiKey] }));
472
472
  }
473
473
  }
474
474
  })), !q)
475
475
  return [3, 9];
476
476
  if (!C || !this.canUseStorage)
477
477
  return [3, 8];
478
- $n = function(le, me) {
478
+ $n = function(le, ve) {
479
479
  return r(ie, void 0, void 0, function() {
480
- var ve, Te, Y, Pe, Re, xe, Dt, qn, Lt, At, Mt, Ft, Pt, Bt, jt, zt, Ut, Ht, $t, Wt, qt, Vt, Gt, Kt;
480
+ var be, Te, Y, Pe, Re, ke, Dt, qn, Lt, At, Mt, Ft, Pt, Bt, jt, zt, Ut, Ht, $t, Wt, qt, Vt, Gt, Kt;
481
481
  return o(this, function(Ie) {
482
482
  switch (Ie.label) {
483
483
  case 0:
484
- if (!me)
484
+ if (!ve)
485
485
  return [3, 7];
486
- ve = null, Te = null, Ie.label = 1;
486
+ be = null, Te = null, Ie.label = 1;
487
487
  case 1:
488
- return Ie.trys.push([1, 5, , 6]), Y = JSON.parse(me), Pe = !1, Re = !1, Y && Y.api === this.api && ((At = (Lt = Y.evaluationContext) === null || Lt === void 0 ? void 0 : Lt.environment) === null || At === void 0 ? void 0 : At.apiKey) === ((Mt = this.evaluationContext.environment) === null || Mt === void 0 ? void 0 : Mt.apiKey) && (xe = !0, this.evaluationContext.identity && ((Pt = (Ft = Y.evaluationContext) === null || Ft === void 0 ? void 0 : Ft.identity) === null || Pt === void 0 ? void 0 : Pt.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((jt = (Bt = Y.evaluationContext) === null || Bt === void 0 ? void 0 : Bt.identity) === null || jt === void 0 ? void 0 : jt.identifier) + " to " + this.evaluationContext.identity.identifier), xe = !1), this.cacheOptions.ttl && (!Y.ts || (/* @__PURE__ */ new Date()).valueOf() - Y.ts > this.cacheOptions.ttl) && (Y.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + Y.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - Y.ts) + "ms"), xe = !1) : Y.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + Y.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - Y.ts) + "ms"), Re = !0, xe = !0)), xe && (Pe = !0, Te = l((zt = this.evaluationContext.identity) === null || zt === void 0 ? void 0 : zt.traits, (Ht = (Ut = Y.evaluationContext) === null || Ut === void 0 ? void 0 : Ut.identity) === null || Ht === void 0 ? void 0 : Ht.traits), ve = l(this.flags, Y.flags), this.setState(i(i({}, Y), { evaluationContext: y(i(i({}, Y.evaluationContext), { identity: !(($t = Y.evaluationContext) === null || $t === void 0) && $t.identity ? i(i({}, (Wt = Y.evaluationContext) === null || Wt === void 0 ? void 0 : Wt.identity), { traits: i(i({}, ((Vt = (qt = Y.evaluationContext) === null || qt === void 0 ? void 0 : qt.identity) === null || Vt === void 0 ? void 0 : Vt.traits) || {}), Xe || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", Y))), Pe ? (Dt = !ae && (!this.cacheOptions.skipAPI || Re), this._onChange(null, { isFromServer: !1, flagsChanged: ve, traitsChanged: Te }, this._loadedState(null, a.CACHE, Dt)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && Pe && !Re && this.log("Skipping API, using cache"), Dt && this.getFlags(), [3, 4]) : [3, 2];
488
+ return Ie.trys.push([1, 5, , 6]), Y = JSON.parse(ve), Pe = !1, Re = !1, Y && Y.api === this.api && ((At = (Lt = Y.evaluationContext) === null || Lt === void 0 ? void 0 : Lt.environment) === null || At === void 0 ? void 0 : At.apiKey) === ((Mt = this.evaluationContext.environment) === null || Mt === void 0 ? void 0 : Mt.apiKey) && (ke = !0, this.evaluationContext.identity && ((Pt = (Ft = Y.evaluationContext) === null || Ft === void 0 ? void 0 : Ft.identity) === null || Pt === void 0 ? void 0 : Pt.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((jt = (Bt = Y.evaluationContext) === null || Bt === void 0 ? void 0 : Bt.identity) === null || jt === void 0 ? void 0 : jt.identifier) + " to " + this.evaluationContext.identity.identifier), ke = !1), this.cacheOptions.ttl && (!Y.ts || (/* @__PURE__ */ new Date()).valueOf() - Y.ts > this.cacheOptions.ttl) && (Y.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + Y.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - Y.ts) + "ms"), ke = !1) : Y.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + Y.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - Y.ts) + "ms"), Re = !0, ke = !0)), ke && (Pe = !0, Te = l((zt = this.evaluationContext.identity) === null || zt === void 0 ? void 0 : zt.traits, (Ht = (Ut = Y.evaluationContext) === null || Ut === void 0 ? void 0 : Ut.identity) === null || Ht === void 0 ? void 0 : Ht.traits), be = l(this.flags, Y.flags), this.setState(i(i({}, Y), { evaluationContext: y(i(i({}, Y.evaluationContext), { identity: !(($t = Y.evaluationContext) === null || $t === void 0) && $t.identity ? i(i({}, (Wt = Y.evaluationContext) === null || Wt === void 0 ? void 0 : Wt.identity), { traits: i(i({}, ((Vt = (qt = Y.evaluationContext) === null || qt === void 0 ? void 0 : qt.identity) === null || Vt === void 0 ? void 0 : Vt.traits) || {}), Xe || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", Y))), Pe ? (Dt = !ae && (!this.cacheOptions.skipAPI || Re), this._onChange(null, { isFromServer: !1, flagsChanged: be, traitsChanged: Te }, this._loadedState(null, a.CACHE, Dt)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && Pe && !Re && this.log("Skipping API, using cache"), Dt && this.getFlags(), [3, 4]) : [3, 2];
489
489
  case 2:
490
490
  return ae ? [3, 4] : [4, this.getFlags()];
491
491
  case 3:
@@ -919,7 +919,7 @@ var Bs = /* @__PURE__ */ qe(Oe, 9, 0), js = /* @__PURE__ */ qe(nt, 5, 0), Cn = f
919
919
  if (s.code = t, Error.captureStackTrace && Error.captureStackTrace(s, Us), !n)
920
920
  throw s;
921
921
  return s;
922
- }, be = function(t, e, n) {
922
+ }, ye = function(t, e, n) {
923
923
  n <<= e & 7;
924
924
  var s = e / 8 | 0;
925
925
  t[s] |= n, t[s + 1] |= n >> 8;
@@ -1004,7 +1004,7 @@ var Bs = /* @__PURE__ */ qe(Oe, 9, 0), js = /* @__PURE__ */ qe(nt, 5, 0), Cn = f
1004
1004
  t[i + r + 4] = n[r];
1005
1005
  return (i + 4 + s) * 8;
1006
1006
  }, dn = function(t, e, n, s, i, r, o, u, c, l, a) {
1007
- be(e, a++, n), ++i[256];
1007
+ ye(e, a++, n), ++i[256];
1008
1008
  for (var d = lt(i, 15), p = d.t, v = d.l, w = lt(r, 15), y = w.t, x = w.l, C = hn(p), F = C.c, R = C.n, E = hn(y), N = E.c, D = E.n, L = new re(19), I = 0; I < F.length; ++I)
1009
1009
  ++L[F[I] & 31];
1010
1010
  for (var I = 0; I < N.length; ++I)
@@ -1015,17 +1015,17 @@ var Bs = /* @__PURE__ */ qe(Oe, 9, 0), js = /* @__PURE__ */ qe(nt, 5, 0), Cn = f
1015
1015
  if (c >= 0 && z <= _ && z <= M)
1016
1016
  return _n(e, a, t.subarray(c, c + l));
1017
1017
  var V, G, $, b;
1018
- if (be(e, a, 1 + (M < _)), a += 2, M < _) {
1018
+ if (ye(e, a, 1 + (M < _)), a += 2, M < _) {
1019
1019
  V = qe(p, v, 0), G = p, $ = qe(y, x, 0), b = y;
1020
1020
  var f = qe(P, U, 0);
1021
- be(e, a, R - 257), be(e, a + 5, D - 1), be(e, a + 10, j - 4), a += 14;
1021
+ ye(e, a, R - 257), ye(e, a + 5, D - 1), ye(e, a + 10, j - 4), a += 14;
1022
1022
  for (var I = 0; I < j; ++I)
1023
- be(e, a + 3 * I, P[ln[I]]);
1023
+ ye(e, a + 3 * I, P[ln[I]]);
1024
1024
  a += 3 * j;
1025
1025
  for (var h = [F, N], m = 0; m < 2; ++m)
1026
1026
  for (var g = h[m], I = 0; I < g.length; ++I) {
1027
1027
  var S = g[I] & 31;
1028
- be(e, a, f[S]), a += P[S], S > 15 && (be(e, a, g[I] >> 5 & 127), a += g[I] >> 12);
1028
+ ye(e, a, f[S]), a += P[S], S > 15 && (ye(e, a, g[I] >> 5 & 127), a += g[I] >> 12);
1029
1029
  }
1030
1030
  } else
1031
1031
  V = Bs, G = Oe, $ = js, b = nt;
@@ -1033,7 +1033,7 @@ var Bs = /* @__PURE__ */ qe(Oe, 9, 0), js = /* @__PURE__ */ qe(nt, 5, 0), Cn = f
1033
1033
  var k = s[I];
1034
1034
  if (k > 255) {
1035
1035
  var S = k >> 18 & 31;
1036
- Ue(e, a, V[S + 257]), a += G[S + 257], S > 7 && (be(e, a, k >> 23 & 31), a += Et[S]);
1036
+ Ue(e, a, V[S + 257]), a += G[S + 257], S > 7 && (ye(e, a, k >> 23 & 31), a += Et[S]);
1037
1037
  var A = k & 31;
1038
1038
  Ue(e, a, $[A]), a += b[A], A > 3 && (Ue(e, a, k >> 5 & 8191), a += Tt[A]);
1039
1039
  } else
@@ -1160,7 +1160,7 @@ var Bs = /* @__PURE__ */ qe(Oe, 9, 0), js = /* @__PURE__ */ qe(nt, 5, 0), Cn = f
1160
1160
  var c = Ei({}, st[n].e);
1161
1161
  return wi(st[n].c + ";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=" + e.toString() + "}", n, c, Ti(c), s);
1162
1162
  }, Ci = function() {
1163
- return [de, re, kt, Et, Tt, ln, ft, un, Bs, Oe, js, nt, pt, Hs, Nn, qe, be, Ue, lt, gt, hn, He, _n, dn, Cn, zs, $s, On, Oi, Vs];
1163
+ return [de, re, kt, Et, Tt, ln, ft, un, Bs, Oe, js, nt, pt, Hs, Nn, qe, ye, Ue, lt, gt, hn, He, _n, dn, Cn, zs, $s, On, Oi, Vs];
1164
1164
  }, _i = function() {
1165
1165
  return [Gs, Ks, mt, qs, Ws];
1166
1166
  }, Vs = function(t) {
@@ -1572,15 +1572,15 @@ class Pi {
1572
1572
  return e.filter((r) => i.findIndex((o) => o.key === r.key) === -1);
1573
1573
  }
1574
1574
  }
1575
- const Yn = { htmlmasked: "hidden", masked: "obscured" }, Se = !(typeof window > "u"), Bi = Se && navigator.userAgent.match(/firefox|fxios/i), ji = 1e5;
1576
- let Rn = Se ? Date.now() - performance.now() : 0;
1575
+ const Yn = { htmlmasked: "hidden", masked: "obscured" }, xe = !(typeof window > "u"), Bi = xe && navigator.userAgent.match(/firefox|fxios/i), ji = 1e5;
1576
+ let Rn = xe ? Date.now() - performance.now() : 0;
1577
1577
  function Jt() {
1578
1578
  Rn = Date.now() - performance.now();
1579
1579
  }
1580
1580
  function Ge() {
1581
1581
  return Rn;
1582
1582
  }
1583
- const pe = Se && performance.now ? () => Math.round(performance.now() + Rn) : () => Date.now(), Xt = "repeat" in String.prototype ? (t) => "*".repeat(t.length) : (t) => t.replace(/./g, "*");
1583
+ const pe = xe && performance.now ? () => Math.round(performance.now() + Rn) : () => Date.now(), Xt = "repeat" in String.prototype ? (t) => "*".repeat(t.length) : (t) => t.replace(/./g, "*");
1584
1584
  function Js(t) {
1585
1585
  return t.trim().replace(/\s+/g, " ");
1586
1586
  }
@@ -2092,7 +2092,7 @@ function Er(t, e, n, s) {
2092
2092
  s
2093
2093
  ];
2094
2094
  }
2095
- const vn = Se && "performance" in window && "memory" in performance ? performance : { memory: {} }, Yt = Se ? (navigator.deviceMemory || 0) * 1024 : 0, Qt = vn.memory.jsHeapSizeLimit || 0;
2095
+ const vn = xe && "performance" in window && "memory" in performance ? performance : { memory: {} }, Yt = xe ? (navigator.deviceMemory || 0) * 1024 : 0, Qt = vn.memory.jsHeapSizeLimit || 0;
2096
2096
  function Tr(t, e) {
2097
2097
  if (!Object.assign({
2098
2098
  capturePerformance: !0
@@ -2987,10 +2987,10 @@ function xn(t) {
2987
2987
  function Zt(t) {
2988
2988
  return It(t) ? !0 : !xn(t);
2989
2989
  }
2990
- var ye;
2990
+ var we;
2991
2991
  (function(t) {
2992
2992
  t[t.New = 0] = "New", t[t.Removed = 1] = "Removed", t[t.Changed = 2] = "Changed";
2993
- })(ye || (ye = {}));
2993
+ })(we || (we = {}));
2994
2994
  class An {
2995
2995
  constructor(e, n = !1) {
2996
2996
  this.app = e, this.isTopContext = n, this.commited = [], this.recents = /* @__PURE__ */ new Map(), this.indexes = [], this.attributesMap = /* @__PURE__ */ new Map(), this.textSet = /* @__PURE__ */ new Set(), this.observer = Ys(this.app.safe((s) => {
@@ -3007,7 +3007,7 @@ class An {
3007
3007
  }
3008
3008
  const u = this.app.nodes.getID(r);
3009
3009
  if (u !== void 0) {
3010
- if (this.recents.has(u) || this.recents.set(u, ye.Changed), o === "attributes") {
3010
+ if (this.recents.has(u) || this.recents.set(u, we.Changed), o === "attributes") {
3011
3011
  const c = i.attributeName;
3012
3012
  if (c === null)
3013
3013
  continue;
@@ -3053,7 +3053,7 @@ class An {
3053
3053
  }
3054
3054
  bindNode(e) {
3055
3055
  const [n, s] = this.app.nodes.registerNode(e);
3056
- s ? this.recents.set(n, ye.New) : this.recents.get(n) !== ye.New && this.recents.set(n, ye.Removed);
3056
+ s ? this.recents.set(n, we.New) : this.recents.get(n) !== we.New && this.recents.set(n, we.Removed);
3057
3057
  }
3058
3058
  bindTree(e) {
3059
3059
  if (!Zt(e))
@@ -3073,7 +3073,7 @@ class An {
3073
3073
  }
3074
3074
  unbindTree(e) {
3075
3075
  const n = this.app.nodes.unregisterNode(e);
3076
- if (n !== void 0 && this.recents.get(n) === ye.Removed) {
3076
+ if (n !== void 0 && this.recents.get(n) === we.Removed) {
3077
3077
  this.app.send(Qi(n));
3078
3078
  const s = document.createTreeWalker(
3079
3079
  e,
@@ -3118,7 +3118,7 @@ class An {
3118
3118
  r = r.previousSibling;
3119
3119
  }
3120
3120
  r === null && (this.indexes[e] = 0);
3121
- const o = this.recents.get(e), u = o === ye.New, c = this.indexes[e];
3121
+ const o = this.recents.get(e), u = o === we.New, c = this.indexes[e];
3122
3122
  if (c === void 0)
3123
3123
  throw "commitNode: missing node index";
3124
3124
  if (u) {
@@ -3139,7 +3139,7 @@ class An {
3139
3139
  Sn(n) && (this.app.send(Xi(e, i, c)), this.sendNodeData(e, s, n.data));
3140
3140
  return !0;
3141
3141
  }
3142
- o === ye.Removed && i !== void 0 && this.app.send(Yi(e, i, c));
3142
+ o === we.Removed && i !== void 0 && this.app.send(Yi(e, i, c));
3143
3143
  const l = this.attributesMap.get(e);
3144
3144
  if (l !== void 0) {
3145
3145
  if (!Ee(n))
@@ -3164,7 +3164,7 @@ class An {
3164
3164
  commitNodes(e = !1) {
3165
3165
  let n;
3166
3166
  this.recents.forEach((s, i) => {
3167
- this.commitNode(i), s === ye.New && (n = this.app.nodes.getNode(i)) && this.app.nodes.callNodeCallbacks(n, e);
3167
+ this.commitNode(i), s === we.New && (n = this.app.nodes.getNode(i)) && this.app.nodes.callNodeCallbacks(n, e);
3168
3168
  }), this.clear();
3169
3169
  }
3170
3170
  // ISSSUE (nodeToBinde should be the same as node in all cases. Look at the comment about 0-node at the beginning of the file.)
@@ -3255,7 +3255,7 @@ class no {
3255
3255
  this.states.forEach((e) => e.clear()), this.states.clear();
3256
3256
  }
3257
3257
  }
3258
- const en = Se ? Element.prototype.attachShadow : () => new ShadowRoot();
3258
+ const en = xe ? Element.prototype.attachShadow : () => new ShadowRoot();
3259
3259
  class so extends An {
3260
3260
  constructor(e, n) {
3261
3261
  super(e, !0), this.iframeOffsets = new no(), this.contextCallbacks = [], this.contextsSet = /* @__PURE__ */ new Set(), this.iframeObservers = [], this.shadowRootObservers = [], this.options = Object.assign({
@@ -4227,7 +4227,7 @@ function fo(t) {
4227
4227
  const n = () => t.send(hr(Math.round(e.downlink * 1e3), e.type || "unknown"));
4228
4228
  n(), e.addEventListener("change", n);
4229
4229
  }
4230
- const oi = Se && "InstallTrigger" in window ? (t) => t.message + `
4230
+ const oi = xe && "InstallTrigger" in window ? (t) => t.message + `
4231
4231
  ` + t.stack : (t) => t.stack || t.message;
4232
4232
  function kn(t) {
4233
4233
  return t === void 0 ? "undefined" : t === null ? "null" : t instanceof Error ? oi(t) : Array.isArray(t) ? `Array(${t.length})` : String(t);
@@ -4638,7 +4638,7 @@ function Co(t) {
4638
4638
  const e = t.type;
4639
4639
  return e === "checkbox" || e === "radio";
4640
4640
  }
4641
- const _o = Se && "labels" in HTMLInputElement.prototype ? (t) => {
4641
+ const _o = xe && "labels" in HTMLInputElement.prototype ? (t) => {
4642
4642
  let e = t;
4643
4643
  for (; (e = e.parentNode) !== null; )
4644
4644
  if (Z(e, "label"))
@@ -5437,10 +5437,10 @@ function Zo(t) {
5437
5437
  function ea(t) {
5438
5438
  return t !== null && typeof t == "object";
5439
5439
  }
5440
- var we;
5440
+ var Se;
5441
5441
  (function(t) {
5442
5442
  t[t.UNSENT = 0] = "UNSENT", t[t.OPENED = 1] = "OPENED", t[t.HEADERS_RECEIVED = 2] = "HEADERS_RECEIVED", t[t.LOADING = 3] = "LOADING", t[t.DONE = 4] = "DONE";
5443
- })(we || (we = {}));
5443
+ })(Se || (Se = {}));
5444
5444
  class Fn {
5445
5445
  constructor(e = [], n, s) {
5446
5446
  this.ignoredHeaders = e, this.setSessionTokenHeader = n, this.sanitize = s, this.id = "", this.name = "", this.method = "", this.url = "", this.status = 0, this.statusText = "", this.cancelState = 0, this.readyState = 0, this.header = {}, this.responseType = "", this.requestHeader = {}, this.responseSize = 0, this.responseSizeText = "", this.startTime = 0, this.endTime = 0, this.duration = 0, this.getData = {}, this.requestData = null;
@@ -5559,7 +5559,7 @@ class sa {
5559
5559
  const n = this.resp.body.getReader;
5560
5560
  this.resp.body.getReader = () => {
5561
5561
  const s = n.apply(this.resp.body);
5562
- if (this.item.readyState === we.DONE)
5562
+ if (this.item.readyState === Se.DONE)
5563
5563
  return s;
5564
5564
  const i = s.read, r = s.cancel;
5565
5565
  return this.item.responseType = "arraybuffer", s.read = () => i.apply(s).then((o) => {
@@ -5675,7 +5675,7 @@ class oa {
5675
5675
  onReadyStateChange() {
5676
5676
  if (!(this.item.url && this.isServiceUrl(this.item.url)) && (this.item.readyState = this.XMLReq.readyState, this.item.responseType = this.XMLReq.responseType, this.item.endTime = performance.now(), this.item.duration = this.item.endTime - this.item.startTime, this.updateItemByReadyState(), setTimeout(() => {
5677
5677
  this.item.response = tt(this.item.responseType, this.item.response);
5678
- }, 0), this.XMLReq.readyState === we.DONE)) {
5678
+ }, 0), this.XMLReq.readyState === Se.DONE)) {
5679
5679
  const e = this.item.getMessage();
5680
5680
  e && this.sendMessage(e);
5681
5681
  }
@@ -5729,11 +5729,11 @@ class oa {
5729
5729
  */
5730
5730
  updateItemByReadyState() {
5731
5731
  switch (this.XMLReq.readyState) {
5732
- case we.UNSENT:
5733
- case we.OPENED:
5734
- this.item.status = we.UNSENT, this.item.statusText = "Pending", this.item.startTime || (this.item.startTime = performance.now());
5732
+ case Se.UNSENT:
5733
+ case Se.OPENED:
5734
+ this.item.status = Se.UNSENT, this.item.statusText = "Pending", this.item.startTime || (this.item.startTime = performance.now());
5735
5735
  break;
5736
- case we.HEADERS_RECEIVED:
5736
+ case Se.HEADERS_RECEIVED:
5737
5737
  this.item.status = this.XMLReq.status, this.item.statusText = "Loading", this.item.header = {};
5738
5738
  const e = this.XMLReq.getAllResponseHeaders() || "", n = e.split(`
5739
5739
  `);
@@ -5745,10 +5745,10 @@ class oa {
5745
5745
  this.item.header[o] = r.slice(1).join(": ");
5746
5746
  }
5747
5747
  break;
5748
- case we.LOADING:
5748
+ case Se.LOADING:
5749
5749
  this.item.status = this.XMLReq.status, this.item.statusText = "Loading", this.XMLReq.response && this.XMLReq.response.length && (this.item.responseSize = this.XMLReq.response.length, this.item.responseSizeText = xt(this.item.responseSize));
5750
5750
  break;
5751
- case we.DONE:
5751
+ case Se.DONE:
5752
5752
  this.item.status = this.XMLReq.status || this.item.status || 0, this.item.statusText = String(this.item.status), this.item.endTime = performance.now(), this.item.duration = this.item.endTime - (this.item.startTime || this.item.endTime), this.item.response = this.XMLReq.response, this.XMLReq.response && this.XMLReq.response.length && (this.item.responseSize = this.XMLReq.response.length, this.item.responseSizeText = xt(this.item.responseSize));
5753
5753
  break;
5754
5754
  default:
@@ -5995,7 +5995,7 @@ class ga {
5995
5995
  a != null && this.app.send(a);
5996
5996
  }
5997
5997
  }
5998
- }, this.crossdomainMode = !!(Hi() && ((u = e.crossdomain) != null && u.enabled)), !Se || !pa(e))
5998
+ }, this.crossdomainMode = !!(Hi() && ((u = e.crossdomain) != null && u.enabled)), !xe || !pa(e))
5999
5999
  return;
6000
6000
  if (window.__OPENREPLAY__) {
6001
6001
  console.error("OpenReplay: one tracker instance has been initialised already");
@@ -6094,7 +6094,7 @@ class ga {
6094
6094
  return this.browserEnvCheck() ? this.app === null ? Promise.reject("Browser doesn't support required api, or doNotTrack is active.") : this.app.start(e) : Promise.reject("Trying to start not in browser.");
6095
6095
  }
6096
6096
  browserEnvCheck() {
6097
- return Se ? !0 : (console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${vt}${dt}`), !1);
6097
+ return xe ? !0 : (console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${vt}${dt}`), !1);
6098
6098
  }
6099
6099
  /**
6100
6100
  * start buffering messages without starting the actual session, which gives user 30 seconds to "activate" and record
@@ -7786,7 +7786,7 @@ class ya {
7786
7786
  }
7787
7787
  }
7788
7788
  }
7789
- const J = new ya(), ke = {
7789
+ const J = new ya(), ge = {
7790
7790
  WIDGET_INITIALIZED: "widget_initialized",
7791
7791
  WIDGET_LOADED: "widget_loaded",
7792
7792
  SEARCH_PERFORMED: "search_performed",
@@ -7930,16 +7930,16 @@ class Sa {
7930
7930
  }
7931
7931
  async handleSearch() {
7932
7932
  const e = document.getElementById("wine-search-input").value.trim() + ";";
7933
- this.widget.trackEvent(ke.SEARCH_PERFORMED, { query: e }), this.widget.ui.animateCardDisappearance();
7933
+ this.widget.trackEvent(ge.SEARCH_PERFORMED, { query: e }), this.widget.ui.animateCardDisappearance();
7934
7934
  try {
7935
7935
  const n = await this.widget.api.getWineRecommendationsSearch(e);
7936
- n && n.length > 0 ? (console.log("Recommendations:", n), this.widget.displayResults(n, !0), this.widget.trackEvent(ke.SEARCH_RESULTS_DISPLAYED, {
7936
+ n && n.length > 0 ? (console.log("Recommendations:", n), this.widget.displayResults(n, !0), this.widget.trackEvent(ge.SEARCH_RESULTS_DISPLAYED, {
7937
7937
  results_count: n.length,
7938
7938
  results: n.map((s) => s.Title || s.title),
7939
7939
  query: e
7940
- })) : (console.log("No recommendations found."), this.widget.ui.displayNoResultsMessage(), this.widget.trackEvent(ke.NO_RESULTS_FOUND, { query: e }));
7940
+ })) : (console.log("No recommendations found."), this.widget.ui.displayNoResultsMessage(), this.widget.trackEvent(ge.NO_RESULTS_FOUND, { query: e }));
7941
7941
  } catch (n) {
7942
- console.error("Error fetching wine recommendations:", n.message), this.widget.ui.displayErrorMessage(), this.widget.trackEvent(ke.ERROR_OCCURRED, {
7942
+ console.error("Error fetching wine recommendations:", n.message), this.widget.ui.displayErrorMessage(), this.widget.trackEvent(ge.ERROR_OCCURRED, {
7943
7943
  error_message: n.message,
7944
7944
  query: e
7945
7945
  });
@@ -7976,7 +7976,7 @@ class xa {
7976
7976
  o.value = r, o.textContent = r.toUpperCase(), o.selected = r === s, i.appendChild(o);
7977
7977
  }), i.onchange = (r) => {
7978
7978
  const o = r.target.value;
7979
- this.widget.trackEvent(ke.LANGUAGE_CHANGED, {
7979
+ this.widget.trackEvent(ge.LANGUAGE_CHANGED, {
7980
7980
  from_language: s,
7981
7981
  to_language: o
7982
7982
  });
@@ -8039,7 +8039,9 @@ class ka {
8039
8039
  await this.initialized, bi(e, this.storeId, n, s);
8040
8040
  }
8041
8041
  async initialize() {
8042
- await J.fetchConfig("storeName"), this.storeId = J.storeId, this.ui.initializeWidget(), this.search.addEventListeners(), this.ui.initializeSearchAnimation(), this.search.loadInstantRecommendations(), this.language.createLanguageSwitcher();
8042
+ await J.fetchConfig("storeName"), this.storeId = J.storeId, this.ui.initializeWidget(), this.search.addEventListeners(), this.ui.initializeSearchAnimation(), this.search.loadInstantRecommendations(), this.language.createLanguageSwitcher(), this.trackEvent(ge.WIDGET_INITIALIZED, {
8043
+ store_id: this.storeId
8044
+ });
8043
8045
  }
8044
8046
  displayResults(e, n = !1) {
8045
8047
  const s = document.getElementById("wine-placeholder");
@@ -8084,26 +8086,22 @@ class ka {
8084
8086
  `;
8085
8087
  s.insertAdjacentHTML("beforeend", D);
8086
8088
  const L = s.children[a];
8087
- if (w) {
8088
- const I = L.querySelector(".buy-btn");
8089
- I == null || I.addEventListener("click", () => {
8090
- this.trackEvent(ke.BUY_BUTTON_CLICKED, {
8091
- wine_id: l.ID,
8092
- wine_title: l.title || l.Title,
8093
- wine_url: l.url || l.URL
8094
- });
8089
+ if (L.addEventListener("click", (I) => {
8090
+ !I.target.closest(".buy-btn") && !I.target.closest(".card-popup-close") && this.trackEvent(ge.WINE_CARD_CLICK, {
8091
+ wine_id: l.ID,
8092
+ wine_title: l.title || l.Title
8095
8093
  });
8096
- } else {
8094
+ }), !w && this.widgetType === "bar") {
8097
8095
  const I = L.querySelector("[data-toggle-info]"), T = L.querySelector(".card-popup"), P = L.querySelector(".card-popup-close");
8098
8096
  P == null || P.addEventListener("click", (U) => {
8099
- U.stopPropagation(), T.classList.add("hidden"), this.trackEvent(ke.WINE_DETAILS_CLOSED, {
8097
+ U.stopPropagation(), T.classList.add("hidden"), this.trackEvent(ge.WINE_DETAILS_CLOSED, {
8100
8098
  wine_id: l.ID,
8101
8099
  wine_title: l.title || l.Title
8102
8100
  });
8103
8101
  }), document.addEventListener("click", (U) => {
8104
8102
  U.target.closest(".card-popup") || U.target.closest(".mobile-fullscreen-popup") || U.target.closest("[data-toggle-info]") || (document.querySelectorAll(".card-popup").forEach((z) => z.classList.add("hidden")), document.querySelectorAll(".mobile-fullscreen-wrapper").forEach((z) => z.remove()));
8105
8103
  }), this.widgetType === "store" ? (L.addEventListener("mouseenter", () => {
8106
- T.classList.remove("hidden"), this.trackEvent(ke.WINE_CARD_HOVER, {
8104
+ T.classList.remove("hidden"), this.trackEvent(ge.WINE_CARD_HOVER, {
8107
8105
  wine_id: l.ID,
8108
8106
  wine_title: l.title || l.Title
8109
8107
  });
@@ -8119,12 +8117,21 @@ class ka {
8119
8117
  `, (j = _.querySelector(".card-popup-close")) == null || j.addEventListener("click", () => _.remove()), document.body.appendChild(_);
8120
8118
  } else
8121
8119
  T.classList.remove("hidden");
8122
- this.trackEvent(ke.WINE_DETAILS_VIEWED, {
8120
+ this.trackEvent(ge.WINE_DETAILS_VIEWED, {
8123
8121
  wine_id: l.ID,
8124
8122
  wine_title: l.title || l.Title,
8125
8123
  is_mobile: window.innerWidth <= 768
8126
8124
  });
8127
8125
  });
8126
+ } else {
8127
+ const I = L.querySelector(".buy-btn");
8128
+ I == null || I.addEventListener("click", () => {
8129
+ this.trackEvent(ge.BUY_BUTTON_CLICKED, {
8130
+ wine_id: l.ID,
8131
+ wine_title: l.title || l.Title,
8132
+ wine_url: l.url || l.URL
8133
+ });
8134
+ });
8128
8135
  }
8129
8136
  setTimeout(() => {
8130
8137
  L.style.opacity = "1", L.style.transform = "translateY(0)";