@unleash/proxy-client-vue 1.0.0 → 1.1.0-beta.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.
package/dist/index.es.js CHANGED
@@ -1,170 +1,170 @@
1
- import { ref as N, reactive as mt, toRefs as gt, defineComponent as yt, provide as X, onMounted as bt, renderSlot as xt, inject as A, onUnmounted as nt } from "vue";
2
- var j = function(o, t) {
3
- return j = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
4
- e.__proto__ = r;
5
- } || function(e, r) {
6
- for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
7
- }, j(o, t);
1
+ import { ref as D, reactive as yt, toRefs as bt, defineComponent as xt, provide as tt, onMounted as Tt, onUnmounted as z, renderSlot as Et, inject as F, toValue as O, watch as it } from "vue";
2
+ var Y = function(o, t) {
3
+ return Y = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, n) {
4
+ e.__proto__ = n;
5
+ } || function(e, n) {
6
+ for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
7
+ }, Y(o, t);
8
8
  };
9
- function ot(o, t) {
9
+ function at(o, t) {
10
10
  if (typeof t != "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
11
11
  function e() {
12
12
  this.constructor = o;
13
13
  }
14
- j(o, t), o.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
14
+ Y(o, t), o.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
15
15
  }
16
16
  var p = function() {
17
17
  return p = Object.assign || function(o) {
18
- for (var t, e = 1, r = arguments.length; e < r; e++) for (var n in t = arguments[e]) Object.prototype.hasOwnProperty.call(t, n) && (o[n] = t[n]);
18
+ for (var t, e = 1, n = arguments.length; e < n; e++) for (var r in t = arguments[e]) Object.prototype.hasOwnProperty.call(t, r) && (o[r] = t[r]);
19
19
  return o;
20
20
  }, p.apply(this, arguments);
21
21
  };
22
- function g(o, t, e, r) {
23
- return new (e || (e = Promise))((function(n, s) {
22
+ function g(o, t, e, n) {
23
+ return new (e || (e = Promise))((function(r, s) {
24
24
  function i(c) {
25
25
  try {
26
- l(r.next(c));
27
- } catch (a) {
28
- s(a);
26
+ l(n.next(c));
27
+ } catch (u) {
28
+ s(u);
29
29
  }
30
30
  }
31
- function u(c) {
31
+ function a(c) {
32
32
  try {
33
- l(r.throw(c));
34
- } catch (a) {
35
- s(a);
33
+ l(n.throw(c));
34
+ } catch (u) {
35
+ s(u);
36
36
  }
37
37
  }
38
38
  function l(c) {
39
- var a;
40
- c.done ? n(c.value) : (a = c.value, a instanceof e ? a : new e((function(f) {
41
- f(a);
42
- }))).then(i, u);
39
+ var u;
40
+ c.done ? r(c.value) : (u = c.value, u instanceof e ? u : new e((function(f) {
41
+ f(u);
42
+ }))).then(i, a);
43
43
  }
44
- l((r = r.apply(o, t || [])).next());
44
+ l((n = n.apply(o, t || [])).next());
45
45
  }));
46
46
  }
47
47
  function y(o, t) {
48
- var e, r, n, s = { label: 0, sent: function() {
49
- if (1 & n[0]) throw n[1];
50
- return n[1];
48
+ var e, n, r, s = { label: 0, sent: function() {
49
+ if (1 & r[0]) throw r[1];
50
+ return r[1];
51
51
  }, trys: [], ops: [] }, i = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
52
- return i.next = u(0), i.throw = u(1), i.return = u(2), typeof Symbol == "function" && (i[Symbol.iterator] = function() {
52
+ return i.next = a(0), i.throw = a(1), i.return = a(2), typeof Symbol == "function" && (i[Symbol.iterator] = function() {
53
53
  return this;
54
54
  }), i;
55
- function u(l) {
55
+ function a(l) {
56
56
  return function(c) {
57
- return (function(a) {
57
+ return (function(u) {
58
58
  if (e) throw new TypeError("Generator is already executing.");
59
- for (; i && (i = 0, a[0] && (s = 0)), s; ) try {
60
- if (e = 1, r && (n = 2 & a[0] ? r.return : a[0] ? r.throw || ((n = r.return) && n.call(r), 0) : r.next) && !(n = n.call(r, a[1])).done) return n;
61
- switch (r = 0, n && (a = [2 & a[0], n.value]), a[0]) {
59
+ for (; i && (i = 0, u[0] && (s = 0)), s; ) try {
60
+ if (e = 1, n && (r = 2 & u[0] ? n.return : u[0] ? n.throw || ((r = n.return) && r.call(n), 0) : n.next) && !(r = r.call(n, u[1])).done) return r;
61
+ switch (n = 0, r && (u = [2 & u[0], r.value]), u[0]) {
62
62
  case 0:
63
63
  case 1:
64
- n = a;
64
+ r = u;
65
65
  break;
66
66
  case 4:
67
- return s.label++, { value: a[1], done: !1 };
67
+ return s.label++, { value: u[1], done: !1 };
68
68
  case 5:
69
- s.label++, r = a[1], a = [0];
69
+ s.label++, n = u[1], u = [0];
70
70
  continue;
71
71
  case 7:
72
- a = s.ops.pop(), s.trys.pop();
72
+ u = s.ops.pop(), s.trys.pop();
73
73
  continue;
74
74
  default:
75
- if (n = s.trys, !((n = n.length > 0 && n[n.length - 1]) || a[0] !== 6 && a[0] !== 2)) {
75
+ if (r = s.trys, !((r = r.length > 0 && r[r.length - 1]) || u[0] !== 6 && u[0] !== 2)) {
76
76
  s = 0;
77
77
  continue;
78
78
  }
79
- if (a[0] === 3 && (!n || a[1] > n[0] && a[1] < n[3])) {
80
- s.label = a[1];
79
+ if (u[0] === 3 && (!r || u[1] > r[0] && u[1] < r[3])) {
80
+ s.label = u[1];
81
81
  break;
82
82
  }
83
- if (a[0] === 6 && s.label < n[1]) {
84
- s.label = n[1], n = a;
83
+ if (u[0] === 6 && s.label < r[1]) {
84
+ s.label = r[1], r = u;
85
85
  break;
86
86
  }
87
- if (n && s.label < n[2]) {
88
- s.label = n[2], s.ops.push(a);
87
+ if (r && s.label < r[2]) {
88
+ s.label = r[2], s.ops.push(u);
89
89
  break;
90
90
  }
91
- n[2] && s.ops.pop(), s.trys.pop();
91
+ r[2] && s.ops.pop(), s.trys.pop();
92
92
  continue;
93
93
  }
94
- a = t.call(o, s);
94
+ u = t.call(o, s);
95
95
  } catch (f) {
96
- a = [6, f], r = 0;
96
+ u = [6, f], n = 0;
97
97
  } finally {
98
- e = n = 0;
98
+ e = r = 0;
99
99
  }
100
- if (5 & a[0]) throw a[1];
101
- return { value: a[0] ? a[1] : void 0, done: !0 };
100
+ if (5 & u[0]) throw u[1];
101
+ return { value: u[0] ? u[1] : void 0, done: !0 };
102
102
  })([l, c]);
103
103
  };
104
104
  }
105
105
  }
106
- function C(o, t, e) {
107
- if (e || arguments.length === 2) for (var r, n = 0, s = t.length; n < s; n++) !r && n in t || (r || (r = Array.prototype.slice.call(t, 0, n)), r[n] = t[n]);
108
- return o.concat(r || Array.prototype.slice.call(t));
106
+ function j(o, t, e) {
107
+ if (e || arguments.length === 2) for (var n, r = 0, s = t.length; r < s; r++) !n && r in t || (n || (n = Array.prototype.slice.call(t, 0, r)), n[r] = t[r]);
108
+ return o.concat(n || Array.prototype.slice.call(t));
109
109
  }
110
- var Z, P = { exports: {} }, st = (function() {
111
- if (Z) return P.exports;
110
+ var et, K = { exports: {} }, ut = (function() {
111
+ if (et) return K.exports;
112
112
  function o() {
113
113
  }
114
- return Z = 1, o.prototype = { on: function(t, e, r) {
115
- var n = this.e || (this.e = {});
116
- return (n[t] || (n[t] = [])).push({ fn: e, ctx: r }), this;
117
- }, once: function(t, e, r) {
118
- var n = this;
114
+ return et = 1, o.prototype = { on: function(t, e, n) {
115
+ var r = this.e || (this.e = {});
116
+ return (r[t] || (r[t] = [])).push({ fn: e, ctx: n }), this;
117
+ }, once: function(t, e, n) {
118
+ var r = this;
119
119
  function s() {
120
- n.off(t, s), e.apply(r, arguments);
120
+ r.off(t, s), e.apply(n, arguments);
121
121
  }
122
- return s._ = e, this.on(t, s, r);
122
+ return s._ = e, this.on(t, s, n);
123
123
  }, emit: function(t) {
124
- for (var e = [].slice.call(arguments, 1), r = ((this.e || (this.e = {}))[t] || []).slice(), n = 0, s = r.length; n < s; n++) r[n].fn.apply(r[n].ctx, e);
124
+ for (var e = [].slice.call(arguments, 1), n = ((this.e || (this.e = {}))[t] || []).slice(), r = 0, s = n.length; r < s; r++) n[r].fn.apply(n[r].ctx, e);
125
125
  return this;
126
126
  }, off: function(t, e) {
127
- var r = this.e || (this.e = {}), n = r[t], s = [];
128
- if (n && e) for (var i = 0, u = n.length; i < u; i++) n[i].fn !== e && n[i].fn._ !== e && s.push(n[i]);
129
- return s.length ? r[t] = s : delete r[t], this;
130
- } }, P.exports = o, P.exports.TinyEmitter = o, P.exports;
131
- })(), F = function(o) {
127
+ var n = this.e || (this.e = {}), r = n[t], s = [];
128
+ if (r && e) for (var i = 0, a = r.length; i < a; i++) r[i].fn !== e && r[i].fn._ !== e && s.push(r[i]);
129
+ return s.length ? n[t] = s : delete n[t], this;
130
+ } }, K.exports = o, K.exports.TinyEmitter = o, K.exports;
131
+ })(), J = function(o) {
132
132
  var t = o[1];
133
133
  return t != null;
134
- }, Tt = function(o) {
135
- var t = o.properties, e = t === void 0 ? {} : t, r = (function(s, i) {
136
- var u = {};
137
- for (var l in s) Object.prototype.hasOwnProperty.call(s, l) && i.indexOf(l) < 0 && (u[l] = s[l]);
134
+ }, Rt = function(o) {
135
+ var t = o.properties, e = t === void 0 ? {} : t, n = (function(s, i) {
136
+ var a = {};
137
+ for (var l in s) Object.prototype.hasOwnProperty.call(s, l) && i.indexOf(l) < 0 && (a[l] = s[l]);
138
138
  if (s != null && typeof Object.getOwnPropertySymbols == "function") {
139
139
  var c = 0;
140
- for (l = Object.getOwnPropertySymbols(s); c < l.length; c++) i.indexOf(l[c]) < 0 && Object.prototype.propertyIsEnumerable.call(s, l[c]) && (u[l[c]] = s[l[c]]);
140
+ for (l = Object.getOwnPropertySymbols(s); c < l.length; c++) i.indexOf(l[c]) < 0 && Object.prototype.propertyIsEnumerable.call(s, l[c]) && (a[l[c]] = s[l[c]]);
141
141
  }
142
- return u;
143
- })(o, ["properties"]), n = function(s) {
144
- return Object.entries(s).sort((function(i, u) {
145
- var l = i[0], c = u[0];
142
+ return a;
143
+ })(o, ["properties"]), r = function(s) {
144
+ return Object.entries(s).sort((function(i, a) {
145
+ var l = i[0], c = a[0];
146
146
  return l.localeCompare(c, void 0);
147
147
  }));
148
148
  };
149
- return JSON.stringify([n(r), n(e)]);
150
- }, V = function(o) {
149
+ return JSON.stringify([r(n), r(e)]);
150
+ }, rt = function(o) {
151
151
  return g(void 0, void 0, void 0, (function() {
152
152
  var t;
153
153
  return y(this, (function(e) {
154
154
  switch (e.label) {
155
155
  case 0:
156
- t = Tt(o), e.label = 1;
156
+ t = Rt(o), e.label = 1;
157
157
  case 1:
158
- return e.trys.push([1, 3, , 4]), [4, (r = t, g(void 0, void 0, void 0, (function() {
159
- var n, s, i, u, l;
158
+ return e.trys.push([1, 3, , 4]), [4, (n = t, g(void 0, void 0, void 0, (function() {
159
+ var r, s, i, a, l;
160
160
  return y(this, (function(c) {
161
161
  switch (c.label) {
162
162
  case 0:
163
- if (n = typeof globalThis < "u" && (!((u = globalThis.crypto) === null || u === void 0) && u.subtle) ? (l = globalThis.crypto) === null || l === void 0 ? void 0 : l.subtle : void 0, typeof TextEncoder > "u" || !(n != null && n.digest) || typeof Uint8Array > "u") throw new Error("Hashing function not available");
164
- return s = new TextEncoder().encode(r), [4, n.digest("SHA-256", s)];
163
+ if (r = typeof globalThis < "u" && (!((a = globalThis.crypto) === null || a === void 0) && a.subtle) ? (l = globalThis.crypto) === null || l === void 0 ? void 0 : l.subtle : void 0, typeof TextEncoder > "u" || !(r != null && r.digest) || typeof Uint8Array > "u") throw new Error("Hashing function not available");
164
+ return s = new TextEncoder().encode(n), [4, r.digest("SHA-256", s)];
165
165
  case 1:
166
- return i = c.sent(), [2, Array.from(new Uint8Array(i)).map((function(a) {
167
- return a.toString(16).padStart(2, "0");
166
+ return i = c.sent(), [2, Array.from(new Uint8Array(i)).map((function(u) {
167
+ return u.toString(16).padStart(2, "0");
168
168
  })).join("")];
169
169
  }
170
170
  }));
@@ -176,25 +176,25 @@ var Z, P = { exports: {} }, st = (function() {
176
176
  case 4:
177
177
  return [2];
178
178
  }
179
- var r;
179
+ var n;
180
180
  }));
181
181
  }));
182
- }, it = function(o) {
183
- var t, e = o.clientKey, r = o.appName, n = o.connectionId, s = o.customHeaders, i = o.headerName, u = i === void 0 ? "authorization" : i, l = o.etag, c = o.isPost, a = ((t = { accept: "application/json" })[u.toLocaleLowerCase()] = e, t["unleash-sdk"] = "unleash-js-sdk:3.8.2", t["unleash-appname"] = r, t);
184
- return c && (a["content-type"] = "application/json"), l && (a["if-none-match"] = l), Object.entries(s || {}).filter(F).forEach((function(f) {
182
+ }, ct = function(o) {
183
+ var t, e = o.clientKey, n = o.appName, r = o.connectionId, s = o.customHeaders, i = o.headerName, a = i === void 0 ? "authorization" : i, l = o.etag, c = o.isPost, u = ((t = { accept: "application/json" })[a.toLocaleLowerCase()] = e, t["unleash-sdk"] = "unleash-js-sdk:3.8.3", t["unleash-appname"] = n, t);
184
+ return c && (u["content-type"] = "application/json"), l && (u["if-none-match"] = l), Object.entries(s || {}).filter(J).forEach((function(f) {
185
185
  var x = f[0], T = f[1];
186
- return a[x.toLocaleLowerCase()] = T;
187
- })), a["unleash-connection-id"] = n, a;
188
- }, Et = function() {
186
+ return u[x.toLocaleLowerCase()] = T;
187
+ })), u["unleash-connection-id"] = r, u;
188
+ }, St = function() {
189
189
  }, wt = (function() {
190
190
  function o(t) {
191
- var e = t.onError, r = t.onSent, n = t.appName, s = t.metricsInterval, i = t.disableMetrics, u = i !== void 0 && i, l = t.url, c = t.clientKey, a = t.fetch, f = t.headerName, x = t.customHeaders, T = x === void 0 ? {} : x, b = t.metricsIntervalInitial, d = t.connectionId, v = t.metricRegistry;
192
- this.onError = e, this.onSent = r || Et, this.disabled = u, this.metricsInterval = 1e3 * s, this.metricsIntervalInitial = 1e3 * b, this.appName = n, this.url = l instanceof URL ? l : new URL(l), this.clientKey = c, this.bucket = this.createEmptyBucket(), this.fetch = a, this.headerName = f, this.customHeaders = T, this.connectionId = d, this.metricRegistry = v;
191
+ var e = t.onError, n = t.onSent, r = t.appName, s = t.metricsInterval, i = t.disableMetrics, a = i !== void 0 && i, l = t.url, c = t.clientKey, u = t.fetch, f = t.headerName, x = t.customHeaders, T = x === void 0 ? {} : x, b = t.metricsIntervalInitial, R = t.connectionId, S = t.metricRegistry;
192
+ this.onError = e, this.onSent = n || St, this.disabled = a, this.metricsInterval = 1e3 * s, this.metricsIntervalInitial = 1e3 * b, this.appName = r, this.url = l instanceof URL ? l : new URL(l), this.clientKey = c, this.bucket = this.createEmptyBucket(), this.fetch = u, this.headerName = f, this.customHeaders = T, this.connectionId = R, this.metricRegistry = S;
193
193
  }
194
194
  return o.prototype.start = function() {
195
195
  var t = this;
196
- if (this.disabled) return !1;
197
- this.setupMetricsFlushOnPageUnload(), typeof this.metricsInterval == "number" && this.metricsInterval > 0 && (this.metricsIntervalInitial > 0 ? setTimeout((function() {
196
+ if (this.disabled || this.timer || this.flushMetricsOnPageUnload) return !1;
197
+ this.setupMetricsFlushOnPageUnload(), typeof this.metricsInterval == "number" && this.metricsInterval > 0 && (this.metricsIntervalInitial > 0 ? this.timer = setTimeout((function() {
198
198
  t.startTimer(), t.sendMetrics();
199
199
  }), this.metricsIntervalInitial) : this.startTimer());
200
200
  }, o.prototype.stop = function() {
@@ -202,21 +202,21 @@ var Z, P = { exports: {} }, st = (function() {
202
202
  }, o.prototype.createEmptyBucket = function() {
203
203
  return { start: /* @__PURE__ */ new Date(), stop: null, toggles: {} };
204
204
  }, o.prototype.getHeaders = function() {
205
- return it({ clientKey: this.clientKey, appName: this.appName, connectionId: this.connectionId, customHeaders: this.customHeaders, headerName: this.headerName, isPost: !0 });
205
+ return ct({ clientKey: this.clientKey, appName: this.appName, connectionId: this.connectionId, customHeaders: this.customHeaders, headerName: this.headerName, isPost: !0 });
206
206
  }, o.prototype.sendMetrics = function() {
207
207
  return g(this, arguments, void 0, (function(t) {
208
- var e, r, n, s = (t === void 0 ? {} : t).fireAndForget, i = s !== void 0 && s;
209
- return y(this, (function(u) {
210
- switch (u.label) {
208
+ var e, n, r, s = (t === void 0 ? {} : t).fireAndForget, i = s !== void 0 && s;
209
+ return y(this, (function(a) {
210
+ switch (a.label) {
211
211
  case 0:
212
- if (e = "".concat(this.url.toString().replace(/\/$/, ""), "/client/metrics"), r = this.getPayload(), this.bucketIsEmpty(r) && (!r.impactMetrics || r.impactMetrics.length === 0)) return [2];
213
- u.label = 1;
212
+ if (e = "".concat(this.url.toString().replace(/\/$/, ""), "/client/metrics"), n = this.getPayload(), this.bucketIsEmpty(n) && (!n.impactMetrics || n.impactMetrics.length === 0)) return [2];
213
+ a.label = 1;
214
214
  case 1:
215
- return u.trys.push([1, 3, , 4]), [4, this.fetch(e, { cache: "no-cache", method: "POST", headers: this.getHeaders(), body: JSON.stringify(r), keepalive: i })];
215
+ return a.trys.push([1, 3, , 4]), [4, this.fetch(e, { cache: "no-cache", method: "POST", headers: this.getHeaders(), body: JSON.stringify(n), keepalive: i })];
216
216
  case 2:
217
- return u.sent(), this.onSent(r), [3, 4];
217
+ return a.sent(), this.onSent(n), [3, 4];
218
218
  case 3:
219
- return n = u.sent(), console.error("Unleash: unable to send feature metrics", n), this.onError(n), [3, 4];
219
+ return r = a.sent(), console.error("Unleash: unable to send feature metrics", r), this.onError(r), [3, 4];
220
220
  case 4:
221
221
  return [2];
222
222
  }
@@ -239,8 +239,8 @@ var Z, P = { exports: {} }, st = (function() {
239
239
  }, o.prototype.getPayload = function() {
240
240
  var t, e = p(p({}, this.bucket), { stop: /* @__PURE__ */ new Date() });
241
241
  this.bucket = this.createEmptyBucket();
242
- var r = { bucket: e, appName: this.appName, instanceId: "browser" }, n = ((t = this.metricRegistry) === null || t === void 0 ? void 0 : t.collect()) || [];
243
- return r.impactMetrics = n, r;
242
+ var n = { bucket: e, appName: this.appName, instanceId: "browser" }, r = ((t = this.metricRegistry) === null || t === void 0 ? void 0 : t.collect()) || [];
243
+ return n.impactMetrics = r, n;
244
244
  }, o.prototype.setupMetricsFlushOnPageUnload = function() {
245
245
  var t = this;
246
246
  typeof document > "u" || typeof window > "u" || typeof document.addEventListener != "function" || document.addEventListener("visibilitychange", this.flushMetricsOnPageUnload = function() {
@@ -249,13 +249,13 @@ var Z, P = { exports: {} }, st = (function() {
249
249
  }, o.prototype.removeMetricsFlushOnPageUnload = function() {
250
250
  this.flushMetricsOnPageUnload && (document.removeEventListener("visibilitychange", this.flushMetricsOnPageUnload), this.flushMetricsOnPageUnload = void 0);
251
251
  }, o;
252
- })(), St = (function() {
252
+ })(), It = (function() {
253
253
  function o() {
254
254
  this.store = /* @__PURE__ */ new Map();
255
255
  }
256
256
  return o.prototype.save = function(t, e) {
257
257
  return g(this, void 0, void 0, (function() {
258
- return y(this, (function(r) {
258
+ return y(this, (function(n) {
259
259
  return this.store.set(t, e), [2];
260
260
  }));
261
261
  }));
@@ -266,17 +266,17 @@ var Z, P = { exports: {} }, st = (function() {
266
266
  }));
267
267
  }));
268
268
  }, o;
269
- })(), Rt = (function() {
269
+ })(), kt = (function() {
270
270
  function o(t) {
271
271
  t === void 0 && (t = "unleash:repository"), this.prefix = t;
272
272
  }
273
273
  return o.prototype.save = function(t, e) {
274
274
  return g(this, void 0, void 0, (function() {
275
- var r, n;
275
+ var n, r;
276
276
  return y(this, (function(s) {
277
- r = JSON.stringify(e), n = "".concat(this.prefix, ":").concat(t);
277
+ n = JSON.stringify(e), r = "".concat(this.prefix, ":").concat(t);
278
278
  try {
279
- window.localStorage.setItem(n, r);
279
+ window.localStorage.setItem(r, n);
280
280
  } catch (i) {
281
281
  console.error(i);
282
282
  }
@@ -285,108 +285,108 @@ var Z, P = { exports: {} }, st = (function() {
285
285
  }));
286
286
  }, o.prototype.get = function(t) {
287
287
  try {
288
- var e = "".concat(this.prefix, ":").concat(t), r = window.localStorage.getItem(e);
289
- return r ? JSON.parse(r) : void 0;
290
- } catch (n) {
291
- console.error(n);
288
+ var e = "".concat(this.prefix, ":").concat(t), n = window.localStorage.getItem(e);
289
+ return n ? JSON.parse(n) : void 0;
290
+ } catch (r) {
291
+ console.error(r);
292
292
  }
293
293
  }, o;
294
- })(), at = function() {
294
+ })(), lt = function() {
295
295
  var o;
296
296
  return typeof globalThis < "u" && (!((o = globalThis.crypto) === null || o === void 0) && o.randomUUID) ? globalThis.crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function(t) {
297
297
  var e = 16 * Math.random() | 0;
298
298
  return (t === "x" ? e : 3 & e | 8).toString(16);
299
299
  }));
300
- }, It = (function() {
300
+ }, Ot = (function() {
301
301
  function o() {
302
302
  }
303
303
  return o.prototype.generateEventId = function() {
304
- return at();
305
- }, o.prototype.createImpressionEvent = function(t, e, r, n, s, i) {
306
- var u = this.createBaseEvent(t, e, r, n, s);
307
- return i ? p(p({}, u), { variant: i }) : u;
308
- }, o.prototype.createBaseEvent = function(t, e, r, n, s) {
309
- return { eventType: n, eventId: this.generateEventId(), context: t, enabled: e, featureName: r, impressionData: s };
304
+ return lt();
305
+ }, o.prototype.createImpressionEvent = function(t, e, n, r, s, i) {
306
+ var a = this.createBaseEvent(t, e, n, r, s);
307
+ return i ? p(p({}, a), { variant: i }) : a;
308
+ }, o.prototype.createBaseEvent = function(t, e, n, r, s) {
309
+ return { eventType: r, eventId: this.generateEventId(), context: t, enabled: e, featureName: n, impressionData: s };
310
310
  }, o;
311
311
  })();
312
- function ut(o) {
312
+ function ht(o) {
313
313
  return o !== void 0 && !Number.isFinite(o);
314
314
  }
315
- function _(o) {
315
+ function W(o) {
316
316
  return o ? Object.keys(o).sort().map((function(t) {
317
317
  return "".concat(t, "=").concat(o[t]);
318
318
  })).join(",") : "";
319
319
  }
320
- function ct(o) {
320
+ function ft(o) {
321
321
  var t = {};
322
322
  if (!o) return t;
323
- for (var e = 0, r = o.split(","); e < r.length; e++) {
324
- var n = r[e].split("="), s = n[0], i = n[1];
323
+ for (var e = 0, n = o.split(","); e < n.length; e++) {
324
+ var r = n[e].split("="), s = r[0], i = r[1];
325
325
  t[s] = i;
326
326
  }
327
327
  return t;
328
328
  }
329
- var kt = function(o) {
329
+ var Nt = function(o) {
330
330
  return "value" in o;
331
- }, tt = function(o) {
331
+ }, nt = function(o) {
332
332
  return "buckets" in o;
333
- }, Ot = (function() {
333
+ }, Ct = (function() {
334
334
  function o(t) {
335
335
  this.opts = t, this.values = /* @__PURE__ */ new Map();
336
336
  }
337
337
  return o.prototype.inc = function(t, e) {
338
- var r;
339
- if (!ut(t)) {
340
- var n = t ?? 1;
341
- if (!(n <= 0)) {
342
- var s = _(e), i = (r = this.values.get(s)) !== null && r !== void 0 ? r : 0;
343
- this.values.set(s, i + n);
338
+ var n;
339
+ if (!ht(t)) {
340
+ var r = t ?? 1;
341
+ if (!(r <= 0)) {
342
+ var s = W(e), i = (n = this.values.get(s)) !== null && n !== void 0 ? n : 0;
343
+ this.values.set(s, i + r);
344
344
  }
345
345
  }
346
346
  }, o.prototype.collect = function() {
347
347
  var t = Array.from(this.values.entries()).map((function(e) {
348
- var r = e[0], n = e[1];
349
- return { labels: ct(r), value: n };
348
+ var n = e[0], r = e[1];
349
+ return { labels: ft(n), value: r };
350
350
  }));
351
351
  return this.values.clear(), t.length === 0 && t.push({ labels: {}, value: 0 }), { name: this.opts.name, help: this.opts.help, type: "counter", samples: t };
352
352
  }, o;
353
- })(), Nt = (function() {
353
+ })(), Ut = (function() {
354
354
  function o(t) {
355
355
  this.opts = t, this.values = /* @__PURE__ */ new Map();
356
- var e = t.buckets && t.buckets.length > 0 ? t.buckets : [5e-3, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10], r = Array.from(new Set(e.filter((function(n) {
357
- return n !== 1 / 0;
358
- })))).sort((function(n, s) {
359
- return n - s;
356
+ var e = t.buckets && t.buckets.length > 0 ? t.buckets : [5e-3, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10], n = Array.from(new Set(e.filter((function(r) {
357
+ return r !== 1 / 0;
358
+ })))).sort((function(r, s) {
359
+ return r - s;
360
360
  }));
361
- this.buckets = C(C([], r, !0), [1 / 0], !1);
361
+ this.buckets = j(j([], n, !0), [1 / 0], !1);
362
362
  }
363
363
  return o.prototype.restore = function(t) {
364
- var e = _(t.labels), r = { count: t.count, sum: t.sum, buckets: new Map(t.buckets.map((function(n) {
365
- return [n.le === "+Inf" ? 1 / 0 : n.le, n.count];
364
+ var e = W(t.labels), n = { count: t.count, sum: t.sum, buckets: new Map(t.buckets.map((function(r) {
365
+ return [r.le === "+Inf" ? 1 / 0 : r.le, r.count];
366
366
  }))) };
367
- this.values.set(e, r);
367
+ this.values.set(e, n);
368
368
  }, o.prototype.observe = function(t, e) {
369
- var r;
370
- if (!ut(t)) {
371
- var n = _(e), s = this.values.get(n);
369
+ var n;
370
+ if (!ht(t)) {
371
+ var r = W(e), s = this.values.get(r);
372
372
  if (!s) {
373
- for (var i = /* @__PURE__ */ new Map(), u = 0, l = this.buckets; u < l.length; u++) {
374
- var c = l[u];
373
+ for (var i = /* @__PURE__ */ new Map(), a = 0, l = this.buckets; a < l.length; a++) {
374
+ var c = l[a];
375
375
  i.set(c, 0);
376
376
  }
377
- s = { count: 0, sum: 0, buckets: i }, this.values.set(n, s);
377
+ s = { count: 0, sum: 0, buckets: i }, this.values.set(r, s);
378
378
  }
379
379
  s.count++, s.sum += t;
380
- for (var a = 0, f = this.buckets; a < f.length; a++)
381
- if (t <= (c = f[a])) {
382
- var x = (r = s.buckets.get(c)) !== null && r !== void 0 ? r : 0;
380
+ for (var u = 0, f = this.buckets; u < f.length; u++)
381
+ if (t <= (c = f[u])) {
382
+ var x = (n = s.buckets.get(c)) !== null && n !== void 0 ? n : 0;
383
383
  s.buckets.set(c, x + 1);
384
384
  }
385
385
  }
386
386
  }, o.prototype.collect = function() {
387
387
  var t = Array.from(this.values.entries()).map((function(e) {
388
- var r = e[0], n = e[1];
389
- return { labels: ct(r), count: n.count, sum: n.sum, buckets: Array.from(n.buckets.entries()).map((function(s) {
388
+ var n = e[0], r = e[1];
389
+ return { labels: ft(n), count: r.count, sum: r.sum, buckets: Array.from(r.buckets.entries()).map((function(s) {
390
390
  var i = s[0];
391
391
  return { le: i === 1 / 0 ? "+Inf" : i, count: s[1] };
392
392
  })) };
@@ -395,7 +395,7 @@ var kt = function(o) {
395
395
  return { le: e === 1 / 0 ? "+Inf" : e, count: 0 };
396
396
  })) }), { name: this.opts.name, help: this.opts.help, type: "histogram", samples: t };
397
397
  }, o;
398
- })(), Ct = (function() {
398
+ })(), At = (function() {
399
399
  function o() {
400
400
  this.counters = /* @__PURE__ */ new Map(), this.histograms = /* @__PURE__ */ new Map();
401
401
  }
@@ -404,77 +404,77 @@ var kt = function(o) {
404
404
  }, o.prototype.getHistogram = function(t) {
405
405
  return this.histograms.get(t);
406
406
  }, o.prototype.counter = function(t) {
407
- var e = t.name, r = this.counters.get(e);
408
- return r || (r = new Ot(t), this.counters.set(e, r)), r;
407
+ var e = t.name, n = this.counters.get(e);
408
+ return n || (n = new Ct(t), this.counters.set(e, n)), n;
409
409
  }, o.prototype.histogram = function(t) {
410
- var e = t.name, r = this.histograms.get(e);
411
- return r || (r = new Nt(t), this.histograms.set(e, r)), r;
410
+ var e = t.name, n = this.histograms.get(e);
411
+ return n || (n = new Ut(t), this.histograms.set(e, n)), n;
412
412
  }, o.prototype.collect = function() {
413
- var t = Array.from(this.counters.values()).map((function(n) {
414
- return n.collect();
415
- })), e = Array.from(this.histograms.values()).map((function(n) {
416
- return n.collect();
417
- })), r = C(C([], t, !0), e, !0).filter((function(n) {
418
- return n.samples.length > 0;
413
+ var t = Array.from(this.counters.values()).map((function(r) {
414
+ return r.collect();
415
+ })), e = Array.from(this.histograms.values()).map((function(r) {
416
+ return r.collect();
417
+ })), n = j(j([], t, !0), e, !0).filter((function(r) {
418
+ return r.samples.length > 0;
419
419
  }));
420
- return r.length > 0 ? r : [];
420
+ return n.length > 0 ? n : [];
421
421
  }, o.prototype.restore = function(t) {
422
422
  for (var e = function(i) {
423
423
  switch (i.type) {
424
424
  case "counter":
425
- for (var u = r.counter({ name: i.name, help: i.help }), l = 0, c = i.samples; l < c.length; l++) {
426
- var a = c[l];
427
- kt(a) && u.inc(a.value, a.labels);
425
+ for (var a = n.counter({ name: i.name, help: i.help }), l = 0, c = i.samples; l < c.length; l++) {
426
+ var u = c[l];
427
+ Nt(u) && a.inc(u.value, u.labels);
428
428
  }
429
429
  break;
430
430
  case "histogram":
431
- var f = i.samples.find(tt);
431
+ var f = i.samples.find(nt);
432
432
  if (f) {
433
433
  var x = f.buckets.map((function(b) {
434
434
  return b.le === "+Inf" ? 1 / 0 : b.le;
435
- })), T = r.histogram({ name: i.name, help: i.help, buckets: x });
436
- i.samples.filter(tt).forEach((function(b) {
435
+ })), T = n.histogram({ name: i.name, help: i.help, buckets: x });
436
+ i.samples.filter(nt).forEach((function(b) {
437
437
  T.restore(b);
438
438
  }));
439
439
  }
440
440
  }
441
- }, r = this, n = 0, s = t; n < s.length; n++)
442
- e(s[n]);
441
+ }, n = this, r = 0, s = t; r < s.length; r++)
442
+ e(s[r]);
443
443
  }, o;
444
- })(), m = { INIT: "initialized", ERROR: "error", READY: "ready", UPDATE: "update", IMPRESSION: "impression", SENT: "sent", RECOVERED: "recovered", WARN: "warn" }, At = (function(o) {
445
- function t(e, r, n) {
444
+ })(), m = { INIT: "initialized", ERROR: "error", READY: "ready", UPDATE: "update", IMPRESSION: "impression", SENT: "sent", RECOVERED: "recovered", WARN: "warn" }, Pt = (function(o) {
445
+ function t(e, n, r) {
446
446
  var s = o.call(this) || this;
447
- return s.metricRegistry = e, s.appName = r, s.environment = n, s;
447
+ return s.metricRegistry = e, s.appName = n, s.environment = r, s;
448
448
  }
449
- return ot(t, o), t.prototype.defineCounter = function(e, r) {
450
- e && r ? this.metricRegistry.counter({ name: e, help: r, labelNames: ["featureName", "appName", "environment"] }) : this.emit(m.WARN, "Counter name or help cannot be empty: ".concat(e, ", ").concat(r, "."));
451
- }, t.prototype.defineHistogram = function(e, r, n) {
452
- e && r ? this.metricRegistry.histogram({ name: e, help: r, labelNames: ["featureName", "appName", "environment"], buckets: n }) : this.emit(m.WARN, "Histogram name or help cannot be empty: ".concat(e, ", ").concat(r, "."));
453
- }, t.prototype.incrementCounter = function(e, r) {
454
- var n = this.metricRegistry.getCounter(e);
455
- if (n) {
449
+ return at(t, o), t.prototype.defineCounter = function(e, n) {
450
+ e && n ? this.metricRegistry.counter({ name: e, help: n, labelNames: ["featureName", "appName", "environment"] }) : this.emit(m.WARN, "Counter name or help cannot be empty: ".concat(e, ", ").concat(n, "."));
451
+ }, t.prototype.defineHistogram = function(e, n, r) {
452
+ e && n ? this.metricRegistry.histogram({ name: e, help: n, labelNames: ["featureName", "appName", "environment"], buckets: r }) : this.emit(m.WARN, "Histogram name or help cannot be empty: ".concat(e, ", ").concat(n, "."));
453
+ }, t.prototype.incrementCounter = function(e, n) {
454
+ var r = this.metricRegistry.getCounter(e);
455
+ if (r) {
456
456
  var s = { appName: this.appName, environment: this.environment };
457
- n.inc(r, s);
457
+ r.inc(n, s);
458
458
  } else this.emit(m.WARN, "Counter ".concat(e, " not defined, this counter will not be incremented."));
459
- }, t.prototype.observeHistogram = function(e, r) {
460
- var n = this.metricRegistry.getHistogram(e);
461
- if (n) {
459
+ }, t.prototype.observeHistogram = function(e, n) {
460
+ var r = this.metricRegistry.getHistogram(e);
461
+ if (r) {
462
462
  var s = { appName: this.appName, environment: this.environment };
463
- n.observe(r, s);
463
+ r.observe(n, s);
464
464
  } else this.emit(m.WARN, "Histogram ".concat(e, " not defined, this histogram will not be updated."));
465
465
  }, t;
466
- })(st.TinyEmitter), Ut = ["userId", "sessionId", "remoteAddress", "currentTime"], et = function(o) {
467
- return Ut.includes(o);
468
- }, Pt = "isEnabled", Mt = "getVariant", Lt = { name: "disabled", enabled: !1, feature_enabled: !1 }, D = "repo", rt = "repoLastUpdateTimestamp", Ht = function() {
466
+ })(ut.TinyEmitter), Mt = ["userId", "sessionId", "remoteAddress", "currentTime"], ot = function(o) {
467
+ return Mt.includes(o);
468
+ }, Lt = "isEnabled", Ht = "getVariant", Dt = { name: "disabled", enabled: !1, feature_enabled: !1 }, q = "repo", st = "repoLastUpdateTimestamp", jt = function() {
469
469
  try {
470
470
  if (typeof window < "u" && "fetch" in window) return fetch.bind(window);
471
471
  if ("fetch" in globalThis) return fetch.bind(globalThis);
472
472
  } catch (o) {
473
473
  console.error('Unleash failed to resolve "fetch"', o);
474
474
  }
475
- }, Dt = (function(o) {
475
+ }, Ft = (function(o) {
476
476
  function t(e) {
477
- var r, n = e.storageProvider, s = e.url, i = e.clientKey, u = e.disableRefresh, l = u !== void 0 && u, c = e.refreshInterval, a = c === void 0 ? 30 : c, f = e.metricsInterval, x = f === void 0 ? 30 : f, T = e.metricsIntervalInitial, b = T === void 0 ? 2 : T, d = e.disableMetrics, v = d !== void 0 && d, E = e.appName, k = e.environment, U = k === void 0 ? "default" : k, M = e.context, K = e.fetch, L = K === void 0 ? Ht() : K, B = e.createAbortController, q = B === void 0 ? (function() {
477
+ var n, r = e.storageProvider, s = e.url, i = e.clientKey, a = e.disableRefresh, l = a !== void 0 && a, c = e.refreshInterval, u = c === void 0 ? 30 : c, f = e.metricsInterval, x = f === void 0 ? 30 : f, T = e.metricsIntervalInitial, b = T === void 0 ? 2 : T, R = e.disableMetrics, S = R !== void 0 && R, E = e.appName, w = e.environment, N = w === void 0 ? "default" : w, U = e.context, M = e.fetch, A = M === void 0 ? jt() : M, L = e.createAbortController, v = L === void 0 ? (function() {
478
478
  try {
479
479
  if (typeof window < "u" && "AbortController" in window) return function() {
480
480
  return new window.AbortController();
@@ -482,65 +482,65 @@ var kt = function(o) {
482
482
  if ("fetch" in globalThis) return function() {
483
483
  return new globalThis.AbortController();
484
484
  };
485
- } catch (I) {
486
- console.error('Unleash failed to resolve "AbortController" factory', I);
485
+ } catch (P) {
486
+ console.error('Unleash failed to resolve "AbortController" factory', P);
487
487
  }
488
- })() : B, R = e.bootstrap, Y = e.bootstrapOverride, ft = Y === void 0 || Y, W = e.headerName, z = W === void 0 ? "Authorization" : W, J = e.customHeaders, G = J === void 0 ? {} : J, $ = e.impressionDataAll, pt = $ !== void 0 && $, Q = e.usePOSTrequests, dt = Q !== void 0 && Q, w = e.experimental, h = o.call(this) || this;
489
- if (h.toggles = [], h.etag = "", h.readyEventEmitted = !1, h.fetchedFromServer = !1, h.usePOSTrequests = !1, h.started = !1, !s) throw new Error("url is required");
488
+ })() : L, d = e.bootstrap, I = e.bootstrapOverride, B = I === void 0 || I, G = e.headerName, $ = G === void 0 ? "Authorization" : G, Q = e.customHeaders, X = Q === void 0 ? {} : Q, Z = e.impressionDataAll, vt = Z !== void 0 && Z, V = e.usePOSTrequests, mt = V !== void 0 && V, k = e.experimental, h = o.call(this) || this;
489
+ if (h.toggles = [], h.etag = "", h.readyEventEmitted = !1, h.fetchedFromServer = !1, h.usePOSTrequests = !1, h.started = !1, h.stopCount = 0, !s) throw new Error("url is required");
490
490
  if (!i) throw new Error("clientKey is required");
491
491
  if (!E) throw new Error("appName is required.");
492
- h.eventsHandler = new It(), h.impressionDataAll = pt, h.toggles = R && R.length > 0 ? R : [], h.url = s instanceof URL ? s : new URL(s), h.clientKey = i, h.headerName = z, h.customHeaders = G, h.storage = n || (typeof window < "u" ? new Rt() : new St()), h.refreshInterval = l ? 0 : 1e3 * a, h.context = p({ appName: E, environment: U }, M), h.usePOSTrequests = dt, h.sdkState = "initializing";
493
- var O = w == null ? void 0 : w.metricsUrl;
494
- !O || O instanceof URL || (O = new URL(O)), h.experimental = p(p({}, w), { metricsUrl: O }), w != null && w.togglesStorageTTL && (w == null ? void 0 : w.togglesStorageTTL) > 0 && (h.experimental.togglesStorageTTL = 1e3 * w.togglesStorageTTL), h.lastRefreshTimestamp = 0, h.ready = new Promise((function(I) {
495
- h.init().then(I).catch((function(H) {
496
- console.error(H), h.sdkState = "error", h.emit(m.ERROR, H), h.lastError = H, I();
492
+ h.eventsHandler = new Ot(), h.impressionDataAll = vt, h.toggles = d && d.length > 0 ? d : [], h.url = s instanceof URL ? s : new URL(s), h.clientKey = i, h.headerName = $, h.customHeaders = X, h.storage = r || (typeof window < "u" ? new kt() : new It()), h.refreshInterval = l ? 0 : 1e3 * u, h.context = p({ appName: E, environment: N }, U), h.usePOSTrequests = mt, h.sdkState = "initializing";
493
+ var H = k == null ? void 0 : k.metricsUrl;
494
+ !H || H instanceof URL || (H = new URL(H)), h.experimental = p(p({}, k), { metricsUrl: H }), k != null && k.togglesStorageTTL && (k == null ? void 0 : k.togglesStorageTTL) > 0 && (h.experimental.togglesStorageTTL = 1e3 * k.togglesStorageTTL), h.lastRefreshTimestamp = 0, h.ready = new Promise((function(P) {
495
+ h.init().then(P).catch((function(_) {
496
+ console.error(_), h.sdkState = "error", h.emit(m.ERROR, _), h.lastError = _, P();
497
497
  }));
498
- })), L || console.error('Unleash: You must either provide your own "fetch" implementation or run in an environment where "fetch" is available.'), q || console.error('Unleash: You must either provide your own "AbortController" implementation or run in an environment where "AbortController" is available.'), h.fetch = L, h.createAbortController = q, h.bootstrap = R && R.length > 0 ? R : void 0, h.bootstrapOverride = ft, h.connectionId = at(), h.metricRegistry = new Ct();
499
- var vt = h.resolveEnvironment(i, U);
500
- return h.impactMetrics = new At(h.metricRegistry, E, vt), h.metrics = new wt({ onError: function(I) {
501
- return h.emit(m.ERROR, { type: "metrics", error: I });
502
- }, onSent: h.emit.bind(h, m.SENT), appName: E, metricsInterval: x, disableMetrics: v, url: ((r = h.experimental) === null || r === void 0 ? void 0 : r.metricsUrl) || h.url, clientKey: i, fetch: L, headerName: z, customHeaders: G, metricsIntervalInitial: b, connectionId: h.connectionId, metricRegistry: h.metricRegistry }), h;
498
+ })), A || console.error('Unleash: You must either provide your own "fetch" implementation or run in an environment where "fetch" is available.'), v || console.error('Unleash: You must either provide your own "AbortController" implementation or run in an environment where "AbortController" is available.'), h.fetch = A, h.createAbortController = v, h.bootstrap = d && d.length > 0 ? d : void 0, h.bootstrapOverride = B, h.connectionId = lt(), h.metricRegistry = new At();
499
+ var gt = h.resolveEnvironment(i, N);
500
+ return h.impactMetrics = new Pt(h.metricRegistry, E, gt), h.metrics = new wt({ onError: function(P) {
501
+ return h.emit(m.ERROR, { type: "metrics", error: P });
502
+ }, onSent: h.emit.bind(h, m.SENT), appName: E, metricsInterval: x, disableMetrics: S, url: ((n = h.experimental) === null || n === void 0 ? void 0 : n.metricsUrl) || h.url, clientKey: i, fetch: A, headerName: $, customHeaders: X, metricsIntervalInitial: b, connectionId: h.connectionId, metricRegistry: h.metricRegistry }), h;
503
503
  }
504
- return ot(t, o), t.prototype.getAllToggles = function() {
505
- return C([], this.toggles, !0);
504
+ return at(t, o), t.prototype.getAllToggles = function() {
505
+ return j([], this.toggles, !0);
506
506
  }, t.prototype.isEnabled = function(e) {
507
- var r, n = this.toggles.find((function(u) {
508
- return u.name === e;
509
- })), s = !!n && n.enabled;
510
- if (this.metrics.count(e, s), (n == null ? void 0 : n.impressionData) || this.impressionDataAll) {
511
- var i = this.eventsHandler.createImpressionEvent(this.context, s, e, Pt, (r = n == null ? void 0 : n.impressionData) !== null && r !== void 0 ? r : void 0);
507
+ var n, r = this.toggles.find((function(a) {
508
+ return a.name === e;
509
+ })), s = !!r && r.enabled;
510
+ if (this.metrics.count(e, s), (r == null ? void 0 : r.impressionData) || this.impressionDataAll) {
511
+ var i = this.eventsHandler.createImpressionEvent(this.context, s, e, Lt, (n = r == null ? void 0 : r.impressionData) !== null && n !== void 0 ? n : void 0);
512
512
  this.emit(m.IMPRESSION, i);
513
513
  }
514
514
  return s;
515
515
  }, t.prototype.getVariant = function(e) {
516
- var r, n = this.toggles.find((function(l) {
516
+ var n, r = this.toggles.find((function(l) {
517
517
  return l.name === e;
518
- })), s = (n == null ? void 0 : n.enabled) || !1, i = n ? n.variant : Lt;
519
- if (i.name && this.metrics.countVariant(e, i.name), this.metrics.count(e, s), (n == null ? void 0 : n.impressionData) || this.impressionDataAll) {
520
- var u = this.eventsHandler.createImpressionEvent(this.context, s, e, Mt, (r = n == null ? void 0 : n.impressionData) !== null && r !== void 0 ? r : void 0, i.name);
521
- this.emit(m.IMPRESSION, u);
518
+ })), s = (r == null ? void 0 : r.enabled) || !1, i = r ? r.variant : Dt;
519
+ if (i.name && this.metrics.countVariant(e, i.name), this.metrics.count(e, s), (r == null ? void 0 : r.impressionData) || this.impressionDataAll) {
520
+ var a = this.eventsHandler.createImpressionEvent(this.context, s, e, Ht, (n = r == null ? void 0 : r.impressionData) !== null && n !== void 0 ? n : void 0, i.name);
521
+ this.emit(m.IMPRESSION, a);
522
522
  }
523
523
  return p(p({}, i), { feature_enabled: s });
524
524
  }, t.prototype.updateToggles = function() {
525
525
  return g(this, void 0, void 0, (function() {
526
526
  var e = this;
527
- return y(this, (function(r) {
528
- switch (r.label) {
527
+ return y(this, (function(n) {
528
+ switch (n.label) {
529
529
  case 0:
530
530
  return this.timerRef || this.fetchedFromServer ? [4, this.fetchToggles()] : [3, 2];
531
531
  case 1:
532
- return r.sent(), [3, 4];
532
+ return n.sent(), [3, 4];
533
533
  case 2:
534
- return this.started ? [4, new Promise((function(n) {
534
+ return this.started ? [4, new Promise((function(r) {
535
535
  var s = function() {
536
536
  e.fetchToggles().then((function() {
537
- e.off(m.READY, s), n();
537
+ e.off(m.READY, s), r();
538
538
  }));
539
539
  };
540
540
  e.once(m.READY, s);
541
541
  }))] : [3, 4];
542
542
  case 3:
543
- r.sent(), r.label = 4;
543
+ n.sent(), n.label = 4;
544
544
  case 4:
545
545
  return [2];
546
546
  }
@@ -548,39 +548,39 @@ var kt = function(o) {
548
548
  }));
549
549
  }, t.prototype.updateContext = function(e) {
550
550
  return g(this, void 0, void 0, (function() {
551
- var r;
552
- return y(this, (function(n) {
553
- switch (n.label) {
551
+ var n;
552
+ return y(this, (function(r) {
553
+ switch (r.label) {
554
554
  case 0:
555
- return (e.appName || e.environment) && this.emit(m.WARN, "appName and environment are static. They can't be updated with updateContext."), r = { environment: this.context.environment, appName: this.context.appName, sessionId: this.context.sessionId }, this.context = p(p({}, r), e), [4, this.updateToggles()];
555
+ return n = { environment: this.context.environment, appName: this.context.appName, sessionId: this.context.sessionId }, this.context = p(p({}, n), e), [4, this.updateToggles()];
556
556
  case 1:
557
- return n.sent(), [2];
557
+ return r.sent(), [2];
558
558
  }
559
559
  }));
560
560
  }));
561
561
  }, t.prototype.getContext = function() {
562
562
  return p({}, this.context);
563
- }, t.prototype.setContextField = function(e, r) {
563
+ }, t.prototype.setContextField = function(e, n) {
564
564
  return g(this, void 0, void 0, (function() {
565
- var n, s, i;
566
- return y(this, (function(u) {
567
- switch (u.label) {
565
+ var r, s, i;
566
+ return y(this, (function(a) {
567
+ switch (a.label) {
568
568
  case 0:
569
- return et(e) ? this.context = p(p({}, this.context), ((s = {})[e] = r, s)) : (n = p(p({}, this.context.properties), ((i = {})[e] = r, i)), this.context = p(p({}, this.context), { properties: n })), [4, this.updateToggles()];
569
+ return ot(e) ? this.context = p(p({}, this.context), ((s = {})[e] = n, s)) : (r = p(p({}, this.context.properties), ((i = {})[e] = n, i)), this.context = p(p({}, this.context), { properties: r })), [4, this.updateToggles()];
570
570
  case 1:
571
- return u.sent(), [2];
571
+ return a.sent(), [2];
572
572
  }
573
573
  }));
574
574
  }));
575
575
  }, t.prototype.removeContextField = function(e) {
576
576
  return g(this, void 0, void 0, (function() {
577
- var r;
578
- return y(this, (function(n) {
579
- switch (n.label) {
577
+ var n;
578
+ return y(this, (function(r) {
579
+ switch (r.label) {
580
580
  case 0:
581
- return et(e) ? this.context = p(p({}, this.context), ((r = {})[e] = void 0, r)) : typeof this.context.properties == "object" && delete this.context.properties[e], [4, this.updateToggles()];
581
+ return ot(e) ? this.context = p(p({}, this.context), ((n = {})[e] = void 0, n)) : typeof this.context.properties == "object" && delete this.context.properties[e], [4, this.updateToggles()];
582
582
  case 1:
583
- return n.sent(), [2];
583
+ return r.sent(), [2];
584
584
  }
585
585
  }));
586
586
  }));
@@ -588,23 +588,23 @@ var kt = function(o) {
588
588
  this.readyEventEmitted = !0, this.emit(m.READY);
589
589
  }, t.prototype.init = function() {
590
590
  return g(this, void 0, void 0, (function() {
591
- var e, r, n;
591
+ var e, n, r;
592
592
  return y(this, (function(s) {
593
593
  switch (s.label) {
594
594
  case 0:
595
595
  return [4, this.resolveSessionId()];
596
596
  case 1:
597
- return e = s.sent(), this.context = p({ sessionId: e }, this.context), [4, this.storage.get(D)];
597
+ return e = s.sent(), this.context = p({ sessionId: e }, this.context), [4, this.storage.get(q)];
598
598
  case 2:
599
- return r = s.sent() || [], n = this, [4, this.getLastRefreshTimestamp()];
599
+ return n = s.sent() || [], r = this, [4, this.getLastRefreshTimestamp()];
600
600
  case 3:
601
- return n.lastRefreshTimestamp = s.sent(), !this.bootstrap || !this.bootstrapOverride && r.length !== 0 ? [3, 6] : [4, this.storage.save(D, this.bootstrap)];
601
+ return r.lastRefreshTimestamp = s.sent(), !this.bootstrap || !this.bootstrapOverride && n.length !== 0 ? [3, 6] : [4, this.storage.save(q, this.bootstrap)];
602
602
  case 4:
603
603
  return s.sent(), this.toggles = this.bootstrap, this.sdkState = "healthy", [4, this.storeLastRefreshTimestamp()];
604
604
  case 5:
605
605
  return s.sent(), this.setReady(), [3, 7];
606
606
  case 6:
607
- this.toggles = r, s.label = 7;
607
+ this.toggles = n, s.label = 7;
608
608
  case 7:
609
609
  return this.sdkState = "healthy", this.emit(m.INIT), [2];
610
610
  }
@@ -612,22 +612,22 @@ var kt = function(o) {
612
612
  }));
613
613
  }, t.prototype.start = function() {
614
614
  return g(this, void 0, void 0, (function() {
615
- var e, r = this;
616
- return y(this, (function(n) {
617
- switch (n.label) {
615
+ var e, n, r = this;
616
+ return y(this, (function(s) {
617
+ switch (s.label) {
618
618
  case 0:
619
- return this.started = !0, this.timerRef ? (console.error("Unleash SDK has already started, if you want to restart the SDK you should call client.stop() before starting again."), [2]) : [4, this.ready];
619
+ return this.started = !0, e = this.stopCount, this.timerRef ? (console.error("Unleash SDK has already started, if you want to restart the SDK you should call client.stop() before starting again."), [2]) : [4, this.ready];
620
620
  case 1:
621
- return n.sent(), this.metrics.start(), e = this.refreshInterval, [4, this.initialFetchToggles()];
621
+ return s.sent(), this.stopCount === e && this.metrics.start(), n = this.refreshInterval, [4, this.initialFetchToggles()];
622
622
  case 2:
623
- return n.sent(), e > 0 && (this.timerRef = setInterval((function() {
623
+ return s.sent(), this.stopCount === e && n > 0 && !this.timerRef && (this.timerRef = setInterval((function() {
624
624
  return r.fetchToggles();
625
- }), e)), [2];
625
+ }), n)), [2];
626
626
  }
627
627
  }));
628
628
  }));
629
629
  }, t.prototype.stop = function() {
630
- this.timerRef && (clearInterval(this.timerRef), this.timerRef = void 0), this.metrics.stop();
630
+ this.stopCount++, this.timerRef && (clearInterval(this.timerRef), this.timerRef = void 0), this.metrics.stop();
631
631
  }, t.prototype.isReady = function() {
632
632
  return this.readyEventEmitted;
633
633
  }, t.prototype.getError = function() {
@@ -637,29 +637,29 @@ var kt = function(o) {
637
637
  }, t.prototype.resolveSessionId = function() {
638
638
  return g(this, void 0, void 0, (function() {
639
639
  var e;
640
- return y(this, (function(r) {
641
- switch (r.label) {
640
+ return y(this, (function(n) {
641
+ switch (n.label) {
642
642
  case 0:
643
643
  return this.context.sessionId ? [2, this.context.sessionId] : [4, this.storage.get("sessionId")];
644
644
  case 1:
645
- return (e = r.sent()) ? [3, 3] : (e = Math.floor(1e9 * Math.random()), [4, this.storage.save("sessionId", e.toString(10))]);
645
+ return (e = n.sent()) ? [3, 3] : (e = Math.floor(1e9 * Math.random()), [4, this.storage.save("sessionId", e.toString(10))]);
646
646
  case 2:
647
- r.sent(), r.label = 3;
647
+ n.sent(), n.label = 3;
648
648
  case 3:
649
649
  return [2, e.toString(10)];
650
650
  }
651
651
  }));
652
652
  }));
653
653
  }, t.prototype.getHeaders = function() {
654
- return it({ clientKey: this.clientKey, connectionId: this.connectionId, appName: this.context.appName, customHeaders: this.customHeaders, headerName: this.headerName, etag: this.etag, isPost: this.usePOSTrequests });
654
+ return ct({ clientKey: this.clientKey, connectionId: this.connectionId, appName: this.context.appName, customHeaders: this.customHeaders, headerName: this.headerName, etag: this.etag, isPost: this.usePOSTrequests });
655
655
  }, t.prototype.storeToggles = function(e) {
656
656
  return g(this, void 0, void 0, (function() {
657
- return y(this, (function(r) {
658
- switch (r.label) {
657
+ return y(this, (function(n) {
658
+ switch (n.label) {
659
659
  case 0:
660
- return this.toggles = e, this.emit(m.UPDATE), [4, this.storage.save(D, e)];
660
+ return this.toggles = e, this.emit(m.UPDATE), [4, this.storage.save(q, e)];
661
661
  case 1:
662
- return r.sent(), [2];
662
+ return n.sent(), [2];
663
663
  }
664
664
  }));
665
665
  }));
@@ -669,19 +669,19 @@ var kt = function(o) {
669
669
  }, t.prototype.isUpToDate = function() {
670
670
  var e;
671
671
  if (!this.isTogglesStorageTTLEnabled()) return !1;
672
- var r = Date.now(), n = ((e = this.experimental) === null || e === void 0 ? void 0 : e.togglesStorageTTL) || 0;
673
- return this.lastRefreshTimestamp > 0 && this.lastRefreshTimestamp <= r && r - this.lastRefreshTimestamp <= n;
672
+ var n = Date.now(), r = ((e = this.experimental) === null || e === void 0 ? void 0 : e.togglesStorageTTL) || 0;
673
+ return this.lastRefreshTimestamp > 0 && this.lastRefreshTimestamp <= n && n - this.lastRefreshTimestamp <= r;
674
674
  }, t.prototype.getLastRefreshTimestamp = function() {
675
675
  return g(this, void 0, void 0, (function() {
676
- var e, r;
677
- return y(this, (function(n) {
678
- switch (n.label) {
676
+ var e, n;
677
+ return y(this, (function(r) {
678
+ switch (r.label) {
679
679
  case 0:
680
- return this.isTogglesStorageTTLEnabled() ? [4, this.storage.get(rt)] : [3, 3];
680
+ return this.isTogglesStorageTTLEnabled() ? [4, this.storage.get(st)] : [3, 3];
681
681
  case 1:
682
- return e = n.sent(), [4, V(this.context)];
682
+ return e = r.sent(), [4, rt(this.context)];
683
683
  case 2:
684
- return r = n.sent(), [2, (e == null ? void 0 : e.key) === r ? e.timestamp : 0];
684
+ return n = r.sent(), [2, (e == null ? void 0 : e.key) === n ? e.timestamp : 0];
685
685
  case 3:
686
686
  return [2, 0];
687
687
  }
@@ -689,15 +689,15 @@ var kt = function(o) {
689
689
  }));
690
690
  }, t.prototype.storeLastRefreshTimestamp = function() {
691
691
  return g(this, void 0, void 0, (function() {
692
- var e, r;
693
- return y(this, (function(n) {
694
- switch (n.label) {
692
+ var e, n;
693
+ return y(this, (function(r) {
694
+ switch (r.label) {
695
695
  case 0:
696
- return this.isTogglesStorageTTLEnabled() ? (this.lastRefreshTimestamp = Date.now(), r = {}, [4, V(this.context)]) : [3, 3];
696
+ return this.isTogglesStorageTTLEnabled() ? (this.lastRefreshTimestamp = Date.now(), n = {}, [4, rt(this.context)]) : [3, 3];
697
697
  case 1:
698
- return r.key = n.sent(), r.timestamp = this.lastRefreshTimestamp, e = r, [4, this.storage.save(rt, e)];
698
+ return n.key = r.sent(), n.timestamp = this.lastRefreshTimestamp, e = n, [4, this.storage.save(st, e)];
699
699
  case 2:
700
- n.sent(), n.label = 3;
700
+ r.sent(), r.label = 3;
701
701
  case 3:
702
702
  return [2];
703
703
  }
@@ -708,31 +708,31 @@ var kt = function(o) {
708
708
  this.fetchedFromServer || (this.fetchedFromServer = !0, this.setReady());
709
709
  }, t.prototype.fetchToggles = function() {
710
710
  return g(this, void 0, void 0, (function() {
711
- var e, r, n, s, i, u, l, c, a;
711
+ var e, n, r, s, i, a, l, c, u;
712
712
  return y(this, (function(f) {
713
713
  switch (f.label) {
714
714
  case 0:
715
715
  if (!this.fetch) return [3, 9];
716
- this.abortController && !this.abortController.signal.aborted && this.abortController.abort(), this.abortController = (a = this.createAbortController) === null || a === void 0 ? void 0 : a.call(this), e = this.abortController ? this.abortController.signal : void 0, f.label = 1;
716
+ this.abortController && !this.abortController.signal.aborted && this.abortController.abort(), this.abortController = (u = this.createAbortController) === null || u === void 0 ? void 0 : u.call(this), e = this.abortController ? this.abortController.signal : void 0, f.label = 1;
717
717
  case 1:
718
- return f.trys.push([1, 7, 8, 9]), r = this.usePOSTrequests, n = r ? this.url : (function(x, T) {
718
+ return f.trys.push([1, 7, 8, 9]), n = this.usePOSTrequests, r = n ? this.url : (function(x, T) {
719
719
  var b = new URL(x.toString());
720
- return Object.entries(T).filter(F).forEach((function(d) {
721
- var v = d[0], E = d[1];
722
- v === "properties" && E ? Object.entries(E).filter(F).forEach((function(k) {
723
- var U = k[0], M = k[1];
724
- return b.searchParams.append("properties[".concat(U, "]"), M);
725
- })) : b.searchParams.append(v, E);
720
+ return Object.entries(T).filter(J).forEach((function(R) {
721
+ var S = R[0], E = R[1];
722
+ S === "properties" && E ? Object.entries(E).filter(J).forEach((function(w) {
723
+ var N = w[0], U = w[1];
724
+ return b.searchParams.append("properties[".concat(N, "]"), U);
725
+ })) : b.searchParams.append(S, E);
726
726
  })), b;
727
- })(this.url, this.context), s = r ? "POST" : "GET", i = r ? JSON.stringify({ context: this.context }) : void 0, [4, this.fetch(n.toString(), { method: s, cache: "no-cache", headers: this.getHeaders(), body: i, signal: e })];
727
+ })(this.url, this.context), s = n ? "POST" : "GET", i = n ? JSON.stringify({ context: this.context }) : void 0, [4, this.fetch(r.toString(), { method: s, cache: "no-cache", headers: this.getHeaders(), body: i, signal: e })];
728
728
  case 2:
729
- return u = f.sent(), this.sdkState === "error" && u.status < 400 && (this.sdkState = "healthy", this.emit(m.RECOVERED)), u.ok ? (this.etag = u.headers.get("ETag") || "", [4, u.json()]) : [3, 5];
729
+ return a = f.sent(), this.sdkState === "error" && a.status < 400 && (this.sdkState = "healthy", this.emit(m.RECOVERED)), a.ok ? (this.etag = a.headers.get("ETag") || "", [4, a.json()]) : [3, 5];
730
730
  case 3:
731
731
  return l = f.sent(), [4, this.storeToggles(l.toggles)];
732
732
  case 4:
733
733
  return f.sent(), this.sdkState !== "healthy" && (this.sdkState = "healthy"), this.fetchedFromServer || (this.fetchedFromServer = !0, this.setReady()), this.storeLastRefreshTimestamp(), [3, 6];
734
734
  case 5:
735
- u.status === 304 ? this.storeLastRefreshTimestamp() : (console.error("Unleash: Fetching feature toggles did not have an ok response"), this.sdkState = "error", this.emit(m.ERROR, { type: "HttpError", code: u.status }), this.lastError = { type: "HttpError", code: u.status }), f.label = 6;
735
+ a.status === 304 ? this.storeLastRefreshTimestamp() : (console.error("Unleash: Fetching feature toggles did not have an ok response"), this.sdkState = "error", this.emit(m.ERROR, { type: "HttpError", code: a.status }), this.lastError = { type: "HttpError", code: a.status }), f.label = 6;
736
736
  case 6:
737
737
  return [3, 9];
738
738
  case 7:
@@ -744,142 +744,150 @@ var kt = function(o) {
744
744
  }
745
745
  }));
746
746
  }));
747
- }, t.prototype.resolveEnvironment = function(e, r) {
748
- return (function(n) {
749
- var s = n.indexOf(":");
747
+ }, t.prototype.resolveEnvironment = function(e, n) {
748
+ return (function(r) {
749
+ var s = r.indexOf(":");
750
750
  if (s !== -1) {
751
- var i = n.slice(s + 1), u = i.lastIndexOf(".");
752
- if (u !== -1) return i.slice(0, u);
751
+ var i = r.slice(s + 1), a = i.lastIndexOf(".");
752
+ if (a !== -1) return i.slice(0, a);
753
753
  }
754
- })(e) || r;
754
+ })(e) || n;
755
755
  }, t;
756
- })(st.TinyEmitter);
757
- const S = Symbol("Context state identifier"), lt = Symbol("Context update identifier");
758
- function ht({
756
+ })(ut.TinyEmitter);
757
+ const C = Symbol("Context state identifier"), pt = Symbol("Context update identifier");
758
+ function dt({
759
759
  config: o,
760
760
  unleashClient: t,
761
- startClient: e = !0
761
+ startClient: e = !0,
762
+ stopClient: n = !1
762
763
  }) {
763
- var T, b;
764
- const r = N(t), n = N(!1), s = N(null);
764
+ var w, N, U, M, A, L;
765
+ const r = D(
766
+ t ?? (o ? new Ft(o) : void 0)
767
+ ), s = D(
768
+ !!((w = r.value) != null && w.isReady() || !t && ((N = o == null ? void 0 : o.bootstrap) != null && N.length) && o.bootstrapOverride !== !1)
769
+ ), i = D(((U = r.value) == null ? void 0 : U.getError()) ?? null);
765
770
  !o && !t && console.warn(
766
- `You must provide either a config or an unleash client to the flag provider. If you are initializing the client in useEffect, you can avoid this warning by
767
- checking if the client exists before rendering.`
768
- ), !r.value && o && (r.value = new Dt(o)), (T = r.value) == null || T.on("ready", () => {
769
- n.value = !0;
770
- }), (b = r.value) == null || b.on("error", (d) => {
771
- s.value = d;
772
- });
773
- const a = mt({
774
- on: (d, ...v) => {
775
- var E;
776
- return (E = r.value) == null ? void 0 : E.on(d, ...v);
771
+ "You must provide either a config or an Unleash client to the flag provider."
772
+ );
773
+ const a = () => {
774
+ s.value = !0;
775
+ }, l = (v) => {
776
+ i.value = v;
777
+ }, c = () => {
778
+ i.value = null;
779
+ };
780
+ (M = r.value) == null || M.on("ready", a), (A = r.value) == null || A.on("error", l), (L = r.value) == null || L.on("recovered", c);
781
+ const b = yt({
782
+ on: (v, ...d) => {
783
+ var I;
784
+ return (I = r.value) == null ? void 0 : I.on(v, ...d);
777
785
  },
778
- updateContext: async (d) => {
779
- var v;
780
- await ((v = r.value) == null ? void 0 : v.updateContext(d));
786
+ updateContext: async (v) => {
787
+ var d;
788
+ await ((d = r.value) == null ? void 0 : d.updateContext(v));
781
789
  },
782
- isEnabled: (d) => {
783
- var v;
784
- return (v = r.value) == null ? void 0 : v.isEnabled(d);
790
+ isEnabled: (v) => {
791
+ var d;
792
+ return (d = r.value) == null ? void 0 : d.isEnabled(v);
785
793
  },
786
- getVariant: (d) => {
787
- var v;
788
- return (v = r.value) == null ? void 0 : v.getVariant(d);
794
+ getVariant: (v) => {
795
+ var d;
796
+ return (d = r.value) == null ? void 0 : d.getVariant(v);
789
797
  },
790
798
  client: r,
791
- flagsReady: n,
792
- flagsError: s
793
- }), f = (d, v) => {
794
- a[d] = v;
795
- }, x = () => {
796
- var d;
797
- (e || !t) && ((d = r == null ? void 0 : r.value) == null || d.start());
799
+ flagsReady: s,
800
+ flagsError: i
801
+ }), R = (v, d) => {
802
+ b[v] = d;
803
+ }, S = () => {
804
+ var v;
805
+ (e || !t) && ((v = r.value) == null || v.start());
806
+ }, E = () => {
807
+ var v, d, I, B;
808
+ (v = r.value) == null || v.off("ready", a), (d = r.value) == null || d.off("error", l), (I = r.value) == null || I.off("recovered", c), n && ((B = r.value) == null || B.stop());
798
809
  };
799
810
  return {
800
- context: gt(a),
801
- update: f,
802
- start: x
811
+ context: bt(b),
812
+ update: R,
813
+ start: S,
814
+ dispose: E
803
815
  };
804
816
  }
805
- const _t = /* @__PURE__ */ yt({
817
+ const _t = /* @__PURE__ */ xt({
806
818
  __name: "FlagProvider",
807
819
  props: {
808
820
  config: {},
809
821
  unleashClient: {},
810
- startClient: { type: Boolean, default: !0 }
822
+ startClient: { type: Boolean, default: !0 },
823
+ stopClient: { type: Boolean, default: !1 }
811
824
  },
812
825
  setup(o) {
813
- const { context: t, start: e, update: r } = ht({
826
+ const { context: t, start: e, update: n, dispose: r } = dt({
814
827
  config: o.config,
815
828
  unleashClient: o.unleashClient,
816
- startClient: o.startClient
829
+ startClient: o.startClient,
830
+ stopClient: o.stopClient
817
831
  });
818
- return X(S, t), X(lt, r), bt(() => {
819
- e();
820
- }), (n, s) => xt(n.$slots, "default");
832
+ return tt(C, t), tt(pt, n), Tt(e), z(r), (s, i) => Et(s.$slots, "default");
821
833
  }
822
- }), Kt = (o) => {
823
- const { isEnabled: t, client: e } = A(S, {}), r = N(!!(t != null && t.value(o)));
824
- function n() {
825
- const i = t == null ? void 0 : t.value(o);
826
- i !== r.value && (r.value = !!i);
834
+ }), qt = (o) => {
835
+ const { isEnabled: t, client: e } = F(C, {}), n = D(!!(t != null && t.value(O(o))));
836
+ function r() {
837
+ const i = t == null ? void 0 : t.value(O(o));
838
+ i !== n.value && (n.value = !!i);
827
839
  }
828
840
  function s() {
829
- r.value = !!(t != null && t.value(o));
841
+ n.value = !!(t != null && t.value(O(o)));
830
842
  }
831
- return e == null || e.value.on("ready", s), e == null || e.value.on("update", n), nt(() => {
832
- e == null || e.value.off("ready", s), e == null || e.value.off("update", n);
833
- }), r;
834
- }, Bt = () => {
835
- const { flagsReady: o, flagsError: t } = A(
836
- S,
843
+ return e == null || e.value.on("ready", s), e == null || e.value.on("update", r), it(() => O(o), r), z(() => {
844
+ e == null || e.value.off("ready", s), e == null || e.value.off("update", r);
845
+ }), n;
846
+ }, Yt = () => {
847
+ const { flagsReady: o, flagsError: t } = F(
848
+ C,
837
849
  {}
838
850
  );
839
851
  return { flagsReady: o, flagsError: t };
840
- }, jt = (o, t) => {
841
- var r, n, s, i;
842
- return !((o == null ? void 0 : o.name) === (t == null ? void 0 : t.name) && (o == null ? void 0 : o.enabled) === (t == null ? void 0 : t.enabled) && (o == null ? void 0 : o.feature_enabled) === (t == null ? void 0 : t.feature_enabled) && ((r = o == null ? void 0 : o.payload) == null ? void 0 : r.type) === ((n = t == null ? void 0 : t.payload) == null ? void 0 : n.type) && ((s = o == null ? void 0 : o.payload) == null ? void 0 : s.value) === ((i = t == null ? void 0 : t.payload) == null ? void 0 : i.value));
843
- }, qt = (o) => {
844
- const { getVariant: t, client: e } = A(S, {}), r = N(t == null ? void 0 : t.value(o));
845
- function n() {
846
- const i = t == null ? void 0 : t.value(o);
847
- jt(r == null ? void 0 : r.value, i) && (r.value = i);
852
+ }, Bt = (o, t) => {
853
+ var n, r, s, i;
854
+ return !((o == null ? void 0 : o.name) === (t == null ? void 0 : t.name) && (o == null ? void 0 : o.enabled) === (t == null ? void 0 : t.enabled) && (o == null ? void 0 : o.feature_enabled) === (t == null ? void 0 : t.feature_enabled) && ((n = o == null ? void 0 : o.payload) == null ? void 0 : n.type) === ((r = t == null ? void 0 : t.payload) == null ? void 0 : r.type) && ((s = o == null ? void 0 : o.payload) == null ? void 0 : s.value) === ((i = t == null ? void 0 : t.payload) == null ? void 0 : i.value));
855
+ }, Jt = (o) => {
856
+ const { getVariant: t, client: e } = F(C, {}), n = D(t == null ? void 0 : t.value(O(o)));
857
+ function r() {
858
+ const i = t == null ? void 0 : t.value(O(o));
859
+ Bt(n == null ? void 0 : n.value, i) && (n.value = i);
848
860
  }
849
861
  function s() {
850
- r.value = t == null ? void 0 : t.value(o);
862
+ n.value = t == null ? void 0 : t.value(O(o));
851
863
  }
852
- return e == null || e.value.on("ready", s), e == null || e.value.on("update", n), nt(() => {
853
- e == null || e.value.off("ready", s), e == null || e.value.off("update", n);
854
- }), r || {};
855
- }, Yt = () => {
856
- const { updateContext: o } = A(S, {});
857
- return o == null ? void 0 : o.value;
864
+ return e == null || e.value.on("ready", s), e == null || e.value.on("update", r), it(() => O(o), r), z(() => {
865
+ e == null || e.value.off("ready", s), e == null || e.value.off("update", r);
866
+ }), n || {};
858
867
  }, Wt = () => {
859
- const { client: o } = A(S, {});
868
+ const { updateContext: o } = F(C, {});
860
869
  return o == null ? void 0 : o.value;
861
- }, zt = {
862
- install(o, { config: t, unleashClient: e, startClient: r }) {
863
- const { context: n, update: s, start: i } = ht({
864
- config: t,
865
- unleashClient: e,
866
- startClient: r
867
- });
868
- o.provide(S, n), o.provide(lt, s), i();
870
+ }, zt = () => {
871
+ const { client: o } = F(C, {});
872
+ return o == null ? void 0 : o.value;
873
+ }, Gt = {
874
+ install(o, t) {
875
+ const { context: e, update: n, start: r, dispose: s } = dt(t);
876
+ o.provide(C, e), o.provide(pt, n), o.onUnmount(s), r();
869
877
  }
870
878
  };
871
879
  export {
872
- S as ContextStateSymbol,
873
- lt as ContextUpdateSymbol,
880
+ C as ContextStateSymbol,
881
+ pt as ContextUpdateSymbol,
874
882
  _t as FlagProvider,
875
- St as InMemoryStorageProvider,
876
- Rt as LocalStorageProvider,
877
- Dt as UnleashClient,
883
+ It as InMemoryStorageProvider,
884
+ kt as LocalStorageProvider,
885
+ Ft as UnleashClient,
878
886
  _t as default,
879
- zt as plugin,
880
- Kt as useFlag,
881
- Bt as useFlagsStatus,
882
- Wt as useUnleashClient,
883
- Yt as useUnleashContext,
884
- qt as useVariant
887
+ Gt as plugin,
888
+ qt as useFlag,
889
+ Yt as useFlagsStatus,
890
+ zt as useUnleashClient,
891
+ Wt as useUnleashContext,
892
+ Jt as useVariant
885
893
  };