configcat-vue 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -133,788 +133,888 @@ var K;
133
133
  (function(t) {
134
134
  t[t.Fetched = 0] = "Fetched", t[t.NotModified = 1] = "NotModified", t[t.Errored = 2] = "Errored";
135
135
  })(K || (K = {}));
136
- var q = function() {
137
- function t(e, r, n, i) {
138
- this.status = e, this.config = r, this.errorMessage = n, this.errorException = i;
139
- }
140
- return t.success = function(e) {
141
- return new t(K.Fetched, e);
142
- }, t.notModified = function(e) {
143
- return new t(K.NotModified, e);
144
- }, t.error = function(e, r, n) {
145
- return new t(K.Errored, e, r ?? "Unknown error.", n);
146
- }, t;
147
- }(), ie = function(t) {
148
- B(e, t);
149
- function e(r) {
150
- for (var n = [], i = 1; i < arguments.length; i++)
151
- n[i - 1] = arguments[i];
152
- var o = t.call(this, function(s, a) {
153
- switch (s) {
154
- case "abort":
155
- return "Request was aborted.";
156
- case "timeout":
157
- var c = a[0];
158
- return "Request timed out. Timeout value: " + c + "ms";
159
- case "failure":
160
- var u = a[0], l = "Request failed due to a network or protocol error.";
161
- return u ? l + " " + (u instanceof Error ? u.message : u + "") : l;
162
- }
163
- }(r, n)) || this;
164
- return o.cause = r, o instanceof e || (Object.setPrototypeOf || function(s, a) {
165
- return s.__proto__ = a;
166
- })(o, e.prototype), o.args = n, o;
167
- }
168
- return e;
169
- }(Error), M = function() {
170
- function t(e, r, n, i) {
171
- this.configJson = e, this.config = r, this.timestamp = n, this.httpETag = i;
172
- }
173
- return t.equals = function(e, r) {
174
- return e.httpETag && r.httpETag ? e.httpETag === r.httpETag : e.configJson === r.configJson;
175
- }, t.prototype.with = function(e) {
176
- return new t(this.configJson, this.config, e, this.httpETag);
177
- }, Object.defineProperty(t.prototype, "isEmpty", {
178
- get: function() {
179
- return !this.config;
180
- },
181
- enumerable: !1,
182
- configurable: !0
183
- }), t.prototype.isExpired = function(e) {
184
- return this === t.empty || this.timestamp + e < t.generateTimestamp();
185
- }, t.generateTimestamp = function() {
186
- return new Date().getTime();
187
- }, t.serialize = function(e) {
188
- var r, n;
189
- return e.timestamp + `
136
+ var q = (
137
+ /** @class */
138
+ function() {
139
+ function t(e, r, n, i) {
140
+ this.status = e, this.config = r, this.errorMessage = n, this.errorException = i;
141
+ }
142
+ return t.success = function(e) {
143
+ return new t(K.Fetched, e);
144
+ }, t.notModified = function(e) {
145
+ return new t(K.NotModified, e);
146
+ }, t.error = function(e, r, n) {
147
+ return new t(K.Errored, e, r ?? "Unknown error.", n);
148
+ }, t;
149
+ }()
150
+ ), ie = (
151
+ /** @class */
152
+ function(t) {
153
+ B(e, t);
154
+ function e(r) {
155
+ for (var n = [], i = 1; i < arguments.length; i++)
156
+ n[i - 1] = arguments[i];
157
+ var o = t.call(this, function(s, a) {
158
+ switch (s) {
159
+ case "abort":
160
+ return "Request was aborted.";
161
+ case "timeout":
162
+ var c = a[0];
163
+ return "Request timed out. Timeout value: " + c + "ms";
164
+ case "failure":
165
+ var u = a[0], l = "Request failed due to a network or protocol error.";
166
+ return u ? l + " " + (u instanceof Error ? u.message : u + "") : l;
167
+ }
168
+ }(r, n)) || this;
169
+ return o.cause = r, o instanceof e || (Object.setPrototypeOf || function(s, a) {
170
+ return s.__proto__ = a;
171
+ })(o, e.prototype), o.args = n, o;
172
+ }
173
+ return e;
174
+ }(Error)
175
+ ), M = (
176
+ /** @class */
177
+ function() {
178
+ function t(e, r, n, i) {
179
+ this.configJson = e, this.config = r, this.timestamp = n, this.httpETag = i;
180
+ }
181
+ return t.equals = function(e, r) {
182
+ return e.httpETag && r.httpETag ? e.httpETag === r.httpETag : e.configJson === r.configJson;
183
+ }, t.prototype.with = function(e) {
184
+ return new t(this.configJson, this.config, e, this.httpETag);
185
+ }, Object.defineProperty(t.prototype, "isEmpty", {
186
+ get: function() {
187
+ return !this.config;
188
+ },
189
+ enumerable: !1,
190
+ configurable: !0
191
+ }), t.prototype.isExpired = function(e) {
192
+ return this === t.empty || this.timestamp + e < t.generateTimestamp();
193
+ }, t.generateTimestamp = function() {
194
+ return (/* @__PURE__ */ new Date()).getTime();
195
+ }, t.serialize = function(e) {
196
+ var r, n;
197
+ return e.timestamp + `
190
198
  ` + ((r = e.httpETag) !== null && r !== void 0 ? r : "") + `
191
199
  ` + ((n = e.configJson) !== null && n !== void 0 ? n : "");
192
- }, t.deserialize = function(e) {
193
- for (var r = Array(2), n = 0, i = 0; i < r.length; i++) {
194
- if (n = e.indexOf(`
200
+ }, t.deserialize = function(e) {
201
+ for (var r = Array(2), n = 0, i = 0; i < r.length; i++) {
202
+ if (n = e.indexOf(`
195
203
  `, n), n < 0)
196
- throw new Error("Number of values is fewer than expected.");
197
- r[i] = n++;
198
- }
199
- var o = r[0], s = e.substring(0, o), a = parseInt(s);
200
- if (isNaN(a))
201
- throw new Error("Invalid fetch time: " + s);
202
- n = o + 1, o = r[1], s = e.substring(n, o);
203
- var c = s.length > 0 ? s : void 0;
204
- n = o + 1, s = e.substring(n);
205
- var u, l;
206
- if (s.length > 0) {
207
- try {
208
- u = new de(JSON.parse(s));
209
- } catch {
210
- throw new Error("Invalid config JSON content: " + s);
204
+ throw new Error("Number of values is fewer than expected.");
205
+ r[i] = n++;
206
+ }
207
+ var o = r[0], s = e.substring(0, o), a = parseInt(s);
208
+ if (isNaN(a))
209
+ throw new Error("Invalid fetch time: " + s);
210
+ n = o + 1, o = r[1], s = e.substring(n, o);
211
+ var c = s.length > 0 ? s : void 0;
212
+ n = o + 1, s = e.substring(n);
213
+ var u, l;
214
+ if (s.length > 0) {
215
+ try {
216
+ u = new de(JSON.parse(s));
217
+ } catch {
218
+ throw new Error("Invalid config JSON content: " + s);
219
+ }
220
+ l = s;
211
221
  }
212
- l = s;
222
+ return new t(l, u, a, c);
223
+ }, t.serializationFormatVersion = "v2", t.empty = new t(void 0, void 0, 0, void 0), t;
224
+ }()
225
+ ), de = (
226
+ /** @class */
227
+ function() {
228
+ function t(e) {
229
+ this.settings = e.f ? Object.fromEntries(Object.entries(e.f).map(function(r) {
230
+ var n = r[0], i = r[1];
231
+ return [n, new _e(i)];
232
+ })) : {}, this.preferences = e.p ? new Ye(e.p) : void 0;
213
233
  }
214
- return new t(l, u, a, c);
215
- }, t.serializationFormatVersion = "v2", t.empty = new t(void 0, void 0, 0, void 0), t;
216
- }(), de = function() {
217
- function t(e) {
218
- this.settings = e.f ? Object.fromEntries(Object.entries(e.f).map(function(r) {
219
- var n = r[0], i = r[1];
220
- return [n, new ze(i)];
221
- })) : {}, this.preferences = e.p ? new Ye(e.p) : void 0;
222
- }
223
- return t;
224
- }(), X;
234
+ return t;
235
+ }()
236
+ ), X;
225
237
  (function(t) {
226
238
  t[t.No = 0] = "No", t[t.Should = 1] = "Should", t[t.Force = 2] = "Force";
227
239
  })(X || (X = {}));
228
- var Ye = function() {
229
- function t(e) {
230
- this.baseUrl = e.u, this.redirectMode = e.r;
231
- }
232
- return t;
233
- }(), Se;
240
+ var Ye = (
241
+ /** @class */
242
+ function() {
243
+ function t(e) {
244
+ this.baseUrl = e.u, this.redirectMode = e.r;
245
+ }
246
+ return t;
247
+ }()
248
+ ), Se;
234
249
  (function(t) {
235
250
  t[t.Boolean = 0] = "Boolean", t[t.String = 1] = "String", t[t.Int = 2] = "Int", t[t.Double = 3] = "Double";
236
251
  })(Se || (Se = {}));
237
- var ze = function() {
238
- function t(e) {
239
- var r, n, i, o;
240
- this.value = e.v, this.type = e.t, this.percentageOptions = (n = (r = e.p) === null || r === void 0 ? void 0 : r.map(function(s) {
241
- return new Ze(s);
242
- })) !== null && n !== void 0 ? n : [], this.targetingRules = (o = (i = e.r) === null || i === void 0 ? void 0 : i.map(function(s) {
243
- return new Xe(s);
244
- })) !== null && o !== void 0 ? o : [], this.variationId = e.i;
245
- }
246
- return t.fromValue = function(e) {
247
- return new t({
248
- t: -1,
249
- v: e
250
- });
251
- }, t;
252
- }(), g;
252
+ var _e = (
253
+ /** @class */
254
+ function() {
255
+ function t(e) {
256
+ var r, n, i, o;
257
+ this.value = e.v, this.type = e.t, this.percentageOptions = (n = (r = e.p) === null || r === void 0 ? void 0 : r.map(function(s) {
258
+ return new Ze(s);
259
+ })) !== null && n !== void 0 ? n : [], this.targetingRules = (o = (i = e.r) === null || i === void 0 ? void 0 : i.map(function(s) {
260
+ return new Xe(s);
261
+ })) !== null && o !== void 0 ? o : [], this.variationId = e.i;
262
+ }
263
+ return t.fromValue = function(e) {
264
+ return new t({
265
+ t: -1,
266
+ v: e
267
+ });
268
+ }, t;
269
+ }()
270
+ ), g;
253
271
  (function(t) {
254
272
  t[t.In = 0] = "In", t[t.NotIn = 1] = "NotIn", t[t.Contains = 2] = "Contains", t[t.NotContains = 3] = "NotContains", t[t.SemVerIn = 4] = "SemVerIn", t[t.SemVerNotIn = 5] = "SemVerNotIn", t[t.SemVerLessThan = 6] = "SemVerLessThan", t[t.SemVerLessThanEqual = 7] = "SemVerLessThanEqual", t[t.SemVerGreaterThan = 8] = "SemVerGreaterThan", t[t.SemVerGreaterThanEqual = 9] = "SemVerGreaterThanEqual", t[t.NumberEqual = 10] = "NumberEqual", t[t.NumberNotEqual = 11] = "NumberNotEqual", t[t.NumberLessThan = 12] = "NumberLessThan", t[t.NumberLessThanEqual = 13] = "NumberLessThanEqual", t[t.NumberGreaterThan = 14] = "NumberGreaterThan", t[t.NumberGreaterThanEqual = 15] = "NumberGreaterThanEqual", t[t.SensitiveOneOf = 16] = "SensitiveOneOf", t[t.SensitiveNotOneOf = 17] = "SensitiveNotOneOf";
255
273
  })(g || (g = {}));
256
- var Xe = function() {
257
- function t(e) {
258
- this.order = e.o, this.comparisonAttribute = e.a, this.comparator = e.t, this.comparisonValue = e.c, this.value = e.v, this.variationId = e.i;
259
- }
260
- return t;
261
- }(), Ze = function() {
262
- function t(e) {
263
- this.order = e.o, this.percentage = e.p, this.value = e.v, this.variationId = e.i;
264
- }
265
- return t;
266
- }(), ae = function() {
267
- function t(e, r) {
268
- this.errorMessage = e, this.errorException = r;
269
- }
270
- return Object.defineProperty(t.prototype, "isSuccess", {
271
- get: function() {
272
- return this.errorMessage === null;
273
- },
274
- enumerable: !1,
275
- configurable: !0
276
- }), t.from = function(e) {
277
- return e.status !== K.Errored ? t.success() : t.failure(e.errorMessage, e.errorException);
278
- }, t.success = function() {
279
- return new t(null);
280
- }, t.failure = function(e, r) {
281
- return new t(e, r);
282
- }, t;
283
- }(), T;
274
+ var Xe = (
275
+ /** @class */
276
+ function() {
277
+ function t(e) {
278
+ this.order = e.o, this.comparisonAttribute = e.a, this.comparator = e.t, this.comparisonValue = e.c, this.value = e.v, this.variationId = e.i;
279
+ }
280
+ return t;
281
+ }()
282
+ ), Ze = (
283
+ /** @class */
284
+ function() {
285
+ function t(e) {
286
+ this.order = e.o, this.percentage = e.p, this.value = e.v, this.variationId = e.i;
287
+ }
288
+ return t;
289
+ }()
290
+ ), ae = (
291
+ /** @class */
292
+ function() {
293
+ function t(e, r) {
294
+ this.errorMessage = e, this.errorException = r;
295
+ }
296
+ return Object.defineProperty(t.prototype, "isSuccess", {
297
+ /** Indicates whether the operation was successful or not. */
298
+ get: function() {
299
+ return this.errorMessage === null;
300
+ },
301
+ enumerable: !1,
302
+ configurable: !0
303
+ }), t.from = function(e) {
304
+ return e.status !== K.Errored ? t.success() : t.failure(e.errorMessage, e.errorException);
305
+ }, t.success = function() {
306
+ return new t(null);
307
+ }, t.failure = function(e, r) {
308
+ return new t(e, r);
309
+ }, t;
310
+ }()
311
+ ), T;
284
312
  (function(t) {
285
- t[t.Online = 0] = "Online", t[t.Offline = 1] = "Offline", t[t.Disposed = 2] = "Disposed";
313
+ t[t.NoFlagData = 0] = "NoFlagData", t[t.HasLocalOverrideFlagDataOnly = 1] = "HasLocalOverrideFlagDataOnly", t[t.HasCachedFlagDataOnly = 2] = "HasCachedFlagDataOnly", t[t.HasUpToDateFlagData = 3] = "HasUpToDateFlagData";
286
314
  })(T || (T = {}));
287
- var me = function() {
288
- function t(e, r) {
289
- this.configFetcher = e, this.options = r, this.pendingFetch = null, this.cacheKey = r.getCacheKey(), this.configFetcher = e, this.options = r, this.status = r.offline ? T.Offline : T.Online;
290
- }
291
- return t.prototype.dispose = function() {
292
- this.status = T.Disposed;
293
- }, Object.defineProperty(t.prototype, "disposed", {
294
- get: function() {
295
- return this.status === T.Disposed;
296
- },
297
- enumerable: !1,
298
- configurable: !0
299
- }), t.prototype.refreshConfigAsync = function() {
300
- return S(this, void 0, void 0, function() {
301
- var e, r, n, i, o;
302
- return O(this, function(s) {
303
- switch (s.label) {
304
- case 0:
305
- return [4, this.options.cache.get(this.cacheKey)];
306
- case 1:
307
- return e = s.sent(), this.isOffline ? [3, 3] : [4, this.refreshConfigCoreAsync(e)];
308
- case 2:
309
- return r = s.sent(), n = r[0], i = r[1], [2, [ae.from(n), i]];
310
- case 3:
311
- return o = this.options.logger.configServiceCannotInitiateHttpCalls().toString(), [2, [ae.failure(o), e]];
312
- }
313
- });
314
- });
315
- }, t.prototype.refreshConfigCoreAsync = function(e) {
316
- return S(this, void 0, void 0, function() {
317
- var r, n;
318
- return O(this, function(i) {
319
- switch (i.label) {
320
- case 0:
321
- return [4, this.fetchAsync(e)];
322
- case 1:
323
- return r = i.sent(), n = r.status === K.Fetched, n || r.config.timestamp > e.timestamp && (!r.config.isEmpty || e.isEmpty) ? [4, this.options.cache.set(this.cacheKey, r.config)] : [3, 3];
324
- case 2:
325
- i.sent(), this.onConfigUpdated(r.config), n && !M.equals(r.config, e) && this.onConfigChanged(r.config), e = r.config, i.label = 3;
326
- case 3:
327
- return [2, [r, e]];
328
- }
315
+ var I;
316
+ (function(t) {
317
+ t[t.Online = 0] = "Online", t[t.Offline = 1] = "Offline", t[t.Disposed = 2] = "Disposed";
318
+ })(I || (I = {}));
319
+ var me = (
320
+ /** @class */
321
+ function() {
322
+ function t(e, r) {
323
+ this.configFetcher = e, this.options = r, this.pendingFetch = null, this.cacheKey = r.getCacheKey(), this.configFetcher = e, this.options = r, this.status = r.offline ? I.Offline : I.Online;
324
+ }
325
+ return t.prototype.dispose = function() {
326
+ this.status = I.Disposed;
327
+ }, Object.defineProperty(t.prototype, "disposed", {
328
+ get: function() {
329
+ return this.status === I.Disposed;
330
+ },
331
+ enumerable: !1,
332
+ configurable: !0
333
+ }), t.prototype.refreshConfigAsync = function() {
334
+ return S(this, void 0, void 0, function() {
335
+ var e, r, n, i, o;
336
+ return O(this, function(s) {
337
+ switch (s.label) {
338
+ case 0:
339
+ return [4, this.options.cache.get(this.cacheKey)];
340
+ case 1:
341
+ return e = s.sent(), this.isOffline ? [3, 3] : [4, this.refreshConfigCoreAsync(e)];
342
+ case 2:
343
+ return r = s.sent(), n = r[0], i = r[1], [2, [ae.from(n), i]];
344
+ case 3:
345
+ return o = this.options.logger.configServiceCannotInitiateHttpCalls().toString(), [2, [ae.failure(o), e]];
346
+ }
347
+ });
329
348
  });
330
- });
331
- }, t.prototype.onConfigUpdated = function(e) {
332
- }, t.prototype.onConfigChanged = function(e) {
333
- var r;
334
- this.options.logger.debug("config changed"), this.options.hooks.emit("configChanged", (r = e.config) !== null && r !== void 0 ? r : new de({}));
335
- }, t.prototype.fetchAsync = function(e) {
336
- var r = this, n;
337
- return (n = this.pendingFetch) !== null && n !== void 0 ? n : this.pendingFetch = function() {
338
- return S(r, void 0, void 0, function() {
349
+ }, t.prototype.refreshConfigCoreAsync = function(e) {
350
+ return S(this, void 0, void 0, function() {
351
+ var r, n;
339
352
  return O(this, function(i) {
340
353
  switch (i.label) {
341
354
  case 0:
342
- return i.trys.push([0, , 2, 3]), [4, this.fetchLogicAsync(e)];
355
+ return [4, this.fetchAsync(e)];
343
356
  case 1:
344
- return [2, i.sent()];
357
+ return r = i.sent(), n = r.status === K.Fetched, n || r.config.timestamp > e.timestamp && (!r.config.isEmpty || e.isEmpty) ? [4, this.options.cache.set(this.cacheKey, r.config)] : [3, 3];
345
358
  case 2:
346
- return this.pendingFetch = null, [7];
359
+ i.sent(), this.onConfigUpdated(r.config), n && !M.equals(r.config, e) && this.onConfigChanged(r.config), e = r.config, i.label = 3;
347
360
  case 3:
348
- return [2];
361
+ return [2, [r, e]];
349
362
  }
350
363
  });
351
364
  });
352
- }();
353
- }, t.prototype.fetchLogicAsync = function(e) {
354
- var r;
355
- return S(this, void 0, void 0, function() {
356
- var n, i, o, s, a, c;
357
- return O(this, function(u) {
358
- switch (u.label) {
359
- case 0:
360
- n = this.options, n.logger.debug("ConfigServiceBase.fetchLogicAsync() - called."), u.label = 1;
361
- case 1:
362
- return u.trys.push([1, 3, , 4]), [4, this.fetchRequestAsync((r = e.httpETag) !== null && r !== void 0 ? r : null)];
363
- case 2:
364
- switch (o = u.sent(), s = o[0], a = o[1], s.statusCode) {
365
- case 200:
366
- return a ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was successful. Returning new config."), [2, q.success(new M(s.body, a, M.generateTimestamp(), s.eTag))]) : (i = n.logger.fetchReceived200WithInvalidBody().toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): " + s.statusCode + " " + s.reasonPhrase + " was received but the HTTP response content was invalid. Returning null."), [2, q.error(e, i)]);
367
- case 304:
368
- return e ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): content was not modified. Returning last config with updated timestamp."), [2, q.notModified(e.with(M.generateTimestamp()))]) : (i = n.logger.fetchReceived304WhenLocalCacheIsEmpty(s.statusCode, s.reasonPhrase).toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): " + s.statusCode + " " + s.reasonPhrase + " was received when no config is cached locally. Returning null."), [2, q.error(e, i)]);
369
- case 403:
370
- case 404:
371
- return i = n.logger.fetchFailedDueToInvalidSdkKey().toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning last config (if any) with updated timestamp."), [2, q.error(e.with(M.generateTimestamp()), i)];
372
- default:
373
- return i = n.logger.fetchFailedDueToUnexpectedHttpResponse(s.statusCode, s.reasonPhrase).toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."), [2, q.error(e, i)];
365
+ }, t.prototype.onConfigUpdated = function(e) {
366
+ }, t.prototype.onConfigChanged = function(e) {
367
+ var r;
368
+ this.options.logger.debug("config changed"), this.options.hooks.emit("configChanged", (r = e.config) !== null && r !== void 0 ? r : new de({}));
369
+ }, t.prototype.fetchAsync = function(e) {
370
+ var r = this, n;
371
+ return (n = this.pendingFetch) !== null && n !== void 0 ? n : this.pendingFetch = function() {
372
+ return S(r, void 0, void 0, function() {
373
+ return O(this, function(i) {
374
+ switch (i.label) {
375
+ case 0:
376
+ return i.trys.push([0, , 2, 3]), [4, this.fetchLogicAsync(e)];
377
+ case 1:
378
+ return [2, i.sent()];
379
+ case 2:
380
+ return this.pendingFetch = null, [
381
+ 7
382
+ /*endfinally*/
383
+ ];
384
+ case 3:
385
+ return [
386
+ 2
387
+ /*return*/
388
+ ];
374
389
  }
375
- return [3, 4];
376
- case 3:
377
- return c = u.sent(), i = (c instanceof ie && c.cause === "timeout" ? n.logger.fetchFailedDueToRequestTimeout(c.args[0], c) : n.logger.fetchFailedDueToUnexpectedError(c)).toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."), [2, q.error(e, i, c)];
378
- case 4:
379
- return [2];
380
- }
390
+ });
391
+ });
392
+ }();
393
+ }, t.prototype.fetchLogicAsync = function(e) {
394
+ var r;
395
+ return S(this, void 0, void 0, function() {
396
+ var n, i, o, s, a, c;
397
+ return O(this, function(u) {
398
+ switch (u.label) {
399
+ case 0:
400
+ n = this.options, n.logger.debug("ConfigServiceBase.fetchLogicAsync() - called."), u.label = 1;
401
+ case 1:
402
+ return u.trys.push([1, 3, , 4]), [4, this.fetchRequestAsync((r = e.httpETag) !== null && r !== void 0 ? r : null)];
403
+ case 2:
404
+ switch (o = u.sent(), s = o[0], a = o[1], s.statusCode) {
405
+ case 200:
406
+ return a ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was successful. Returning new config."), [2, q.success(new M(s.body, a, M.generateTimestamp(), s.eTag))]) : (i = n.logger.fetchReceived200WithInvalidBody().toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): " + s.statusCode + " " + s.reasonPhrase + " was received but the HTTP response content was invalid. Returning null."), [2, q.error(e, i)]);
407
+ case 304:
408
+ return e ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): content was not modified. Returning last config with updated timestamp."), [2, q.notModified(e.with(M.generateTimestamp()))]) : (i = n.logger.fetchReceived304WhenLocalCacheIsEmpty(s.statusCode, s.reasonPhrase).toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): " + s.statusCode + " " + s.reasonPhrase + " was received when no config is cached locally. Returning null."), [2, q.error(e, i)]);
409
+ case 403:
410
+ case 404:
411
+ return i = n.logger.fetchFailedDueToInvalidSdkKey().toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning last config (if any) with updated timestamp."), [2, q.error(e.with(M.generateTimestamp()), i)];
412
+ default:
413
+ return i = n.logger.fetchFailedDueToUnexpectedHttpResponse(s.statusCode, s.reasonPhrase).toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."), [2, q.error(e, i)];
414
+ }
415
+ return [3, 4];
416
+ case 3:
417
+ return c = u.sent(), i = (c instanceof ie && c.cause === "timeout" ? n.logger.fetchFailedDueToRequestTimeout(c.args[0], c) : n.logger.fetchFailedDueToUnexpectedError(c)).toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."), [2, q.error(e, i, c)];
418
+ case 4:
419
+ return [
420
+ 2
421
+ /*return*/
422
+ ];
423
+ }
424
+ });
381
425
  });
382
- });
383
- }, t.prototype.fetchRequestAsync = function(e, r) {
384
- return r === void 0 && (r = 2), S(this, void 0, void 0, function() {
385
- var n, i, o, s, a, c, u;
386
- return O(this, function(l) {
387
- switch (l.label) {
388
- case 0:
389
- n = this.options, n.logger.debug("ConfigServiceBase.fetchRequestAsync() - called."), i = 0, l.label = 1;
390
- case 1:
391
- return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): calling fetchLogic()" + (i > 0 ? ", retry " + i + "/" + r : "")), [4, this.configFetcher.fetchLogic(n, e)];
392
- case 2:
393
- if (o = l.sent(), o.statusCode !== 200)
394
- return [2, [o]];
395
- if (!o.body)
396
- return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): no response body."), [2, [o]];
397
- s = void 0;
398
- try {
399
- s = new de(JSON.parse(o.body));
400
- } catch {
401
- return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): invalid response body."), [2, [o]];
402
- }
403
- if (a = s.preferences, !a)
404
- return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): preferences is empty."), [2, [o, s]];
405
- if (c = a.baseUrl, !c || c === n.baseUrl)
406
- return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): baseUrl OK."), [2, [o, s]];
407
- if (u = a.redirectMode, n.baseUrlOverriden && u !== X.Force)
408
- return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): options.baseUrlOverriden && redirect !== 2."), [2, [o, s]];
409
- if (n.baseUrl = c, u === X.No)
410
- return [2, [o, s]];
411
- if (u === X.Should && n.logger.dataGovernanceIsOutOfSync(), i >= r)
412
- return n.logger.fetchFailedDueToRedirectLoop(), [2, [o, s]];
413
- l.label = 3;
414
- case 3:
415
- return i++, [3, 1];
416
- case 4:
417
- return [2];
418
- }
426
+ }, t.prototype.fetchRequestAsync = function(e, r) {
427
+ return r === void 0 && (r = 2), S(this, void 0, void 0, function() {
428
+ var n, i, o, s, a, c, u;
429
+ return O(this, function(l) {
430
+ switch (l.label) {
431
+ case 0:
432
+ n = this.options, n.logger.debug("ConfigServiceBase.fetchRequestAsync() - called."), i = 0, l.label = 1;
433
+ case 1:
434
+ return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): calling fetchLogic()" + (i > 0 ? ", retry " + i + "/" + r : "")), [4, this.configFetcher.fetchLogic(n, e)];
435
+ case 2:
436
+ if (o = l.sent(), o.statusCode !== 200)
437
+ return [2, [o]];
438
+ if (!o.body)
439
+ return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): no response body."), [2, [o]];
440
+ s = void 0;
441
+ try {
442
+ s = new de(JSON.parse(o.body));
443
+ } catch {
444
+ return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): invalid response body."), [2, [o]];
445
+ }
446
+ if (a = s.preferences, !a)
447
+ return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): preferences is empty."), [2, [o, s]];
448
+ if (c = a.baseUrl, !c || c === n.baseUrl)
449
+ return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): baseUrl OK."), [2, [o, s]];
450
+ if (u = a.redirectMode, n.baseUrlOverriden && u !== X.Force)
451
+ return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): options.baseUrlOverriden && redirect !== 2."), [2, [o, s]];
452
+ if (n.baseUrl = c, u === X.No)
453
+ return [2, [o, s]];
454
+ if (u === X.Should && n.logger.dataGovernanceIsOutOfSync(), i >= r)
455
+ return n.logger.fetchFailedDueToRedirectLoop(), [2, [o, s]];
456
+ l.label = 3;
457
+ case 3:
458
+ return i++, [3, 1];
459
+ case 4:
460
+ return [
461
+ 2
462
+ /*return*/
463
+ ];
464
+ }
465
+ });
419
466
  });
420
- });
421
- }, Object.defineProperty(t.prototype, "isOfflineExactly", {
422
- get: function() {
423
- return this.status === T.Offline;
424
- },
425
- enumerable: !1,
426
- configurable: !0
427
- }), Object.defineProperty(t.prototype, "isOffline", {
428
- get: function() {
429
- return this.status !== T.Online;
430
- },
431
- enumerable: !1,
432
- configurable: !0
433
- }), t.prototype.setOnlineCore = function() {
434
- }, t.prototype.setOnline = function() {
435
- this.status === T.Offline ? (this.setOnlineCore(), this.status = T.Online, this.options.logger.configServiceStatusChanged(T[this.status])) : this.disposed && this.options.logger.configServiceMethodHasNoEffectDueToDisposedClient("setOnline");
436
- }, t.prototype.setOfflineCore = function() {
437
- }, t.prototype.setOffline = function() {
438
- this.status === T.Online ? (this.setOfflineCore(), this.status = T.Offline, this.options.logger.configServiceStatusChanged(T[this.status])) : this.disposed && this.options.logger.configServiceMethodHasNoEffectDueToDisposedClient("setOffline");
439
- }, t.prototype.syncUpWithCache = function() {
440
- return S(this, void 0, void 0, function() {
441
- var e;
442
- return O(this, function(r) {
443
- switch (r.label) {
444
- case 0:
445
- return [4, this.options.cache.get(this.cacheKey)];
446
- case 1:
447
- return e = r.sent(), this.options.hooks.emit("clientReady", this.getReadyState(e)), [2];
448
- }
467
+ }, Object.defineProperty(t.prototype, "isOfflineExactly", {
468
+ get: function() {
469
+ return this.status === I.Offline;
470
+ },
471
+ enumerable: !1,
472
+ configurable: !0
473
+ }), Object.defineProperty(t.prototype, "isOffline", {
474
+ get: function() {
475
+ return this.status !== I.Online;
476
+ },
477
+ enumerable: !1,
478
+ configurable: !0
479
+ }), t.prototype.setOnlineCore = function() {
480
+ }, t.prototype.setOnline = function() {
481
+ this.status === I.Offline ? (this.setOnlineCore(), this.status = I.Online, this.options.logger.configServiceStatusChanged(I[this.status])) : this.disposed && this.options.logger.configServiceMethodHasNoEffectDueToDisposedClient("setOnline");
482
+ }, t.prototype.setOfflineCore = function() {
483
+ }, t.prototype.setOffline = function() {
484
+ this.status === I.Online ? (this.setOfflineCore(), this.status = I.Offline, this.options.logger.configServiceStatusChanged(I[this.status])) : this.disposed && this.options.logger.configServiceMethodHasNoEffectDueToDisposedClient("setOffline");
485
+ }, t.prototype.onCacheSynced = function(e) {
486
+ this.options.hooks.emit("clientReady", this.getCacheState(e));
487
+ }, t.prototype.syncUpWithCache = function() {
488
+ return S(this, void 0, void 0, function() {
489
+ var e;
490
+ return O(this, function(r) {
491
+ switch (r.label) {
492
+ case 0:
493
+ return [4, this.options.cache.get(this.cacheKey)];
494
+ case 1:
495
+ return e = r.sent(), this.onCacheSynced(e), [2, e];
496
+ }
497
+ });
449
498
  });
450
- });
451
- }, t;
452
- }(), Qe = function() {
453
- function t() {
454
- this.addListener = this.on, this.off = this.removeListener;
455
- }
456
- return t.prototype.on = function() {
457
- return this;
458
- }, t.prototype.once = function() {
459
- return this;
460
- }, t.prototype.removeListener = function() {
461
- return this;
462
- }, t.prototype.removeAllListeners = function() {
463
- return this;
464
- }, t.prototype.listeners = function() {
465
- return [];
466
- }, t.prototype.listenerCount = function() {
467
- return 0;
468
- }, t.prototype.eventNames = function() {
469
- return [];
470
- }, t.prototype.emit = function() {
471
- return !1;
472
- }, t;
473
- }(), L;
474
- (function(t) {
475
- t[t.NoFlagData = 0] = "NoFlagData", t[t.HasLocalOverrideFlagDataOnly = 1] = "HasLocalOverrideFlagDataOnly", t[t.HasCachedFlagDataOnly = 2] = "HasCachedFlagDataOnly", t[t.HasUpToDateFlagData = 3] = "HasUpToDateFlagData";
476
- })(L || (L = {}));
477
- var Oe = new Qe(), et = function() {
478
- function t(e) {
479
- this.addListener = this.on, this.off = this.removeListener, this.eventEmitter = e;
480
- }
481
- return t.prototype.tryDisconnect = function() {
482
- var e = this.eventEmitter;
483
- return this.eventEmitter = Oe, e !== Oe;
484
- }, t.prototype.on = function(e, r) {
485
- return this.eventEmitter.on(e, r), this;
486
- }, t.prototype.once = function(e, r) {
487
- return this.eventEmitter.once(e, r), this;
488
- }, t.prototype.removeListener = function(e, r) {
489
- return this.eventEmitter.removeListener(e, r), this;
490
- }, t.prototype.removeAllListeners = function(e) {
491
- return this.eventEmitter.removeAllListeners(e), this;
492
- }, t.prototype.listeners = function(e) {
493
- return this.eventEmitter.listeners(e);
494
- }, t.prototype.listenerCount = function(e) {
495
- return this.eventEmitter.listenerCount(e);
496
- }, t.prototype.eventNames = function() {
497
- return this.eventEmitter.eventNames();
498
- }, t.prototype.emit = function(e) {
499
- for (var r, n = [], i = 1; i < arguments.length; i++)
500
- n[i - 1] = arguments[i];
501
- return (r = this.eventEmitter).emit.apply(r, $e([e], n));
502
- }, t;
503
- }();
504
- function tt(t, e) {
499
+ }, t;
500
+ }()
501
+ );
502
+ function Qe(t, e) {
505
503
  var r, n = new Promise(function(i) {
506
504
  return r = setTimeout(i, t);
507
505
  });
508
- return e == null || e(function() {
506
+ return e && (e.clearTimer = function() {
509
507
  return clearTimeout(r);
510
508
  }), n;
511
509
  }
512
- function z(t, e) {
510
+ function _(t, e) {
513
511
  return e === void 0 && (e = !1), t instanceof Error ? e && t.stack ? t.stack : t.toString() : t + "";
514
512
  }
515
- var rt = function(t) {
516
- B(e, t);
517
- function e(r, n) {
518
- var i = t.call(this, r, n) || this;
519
- return i.signalInitialization = function() {
520
- }, i.pollIntervalMs = n.pollIntervalSeconds * 1e3, n.maxInitWaitTimeSeconds !== 0 ? (i.initialized = !1, i.initialization = new Promise(function(o) {
521
- return i.signalInitialization = function() {
522
- i.initialized = !0, o();
523
- };
524
- }), i.initialization.then(function() {
525
- return n.hooks.emit("clientReady", i.getReadyState(n.cache.getInMemory()));
526
- }), n.maxInitWaitTimeSeconds > 0 && setTimeout(function() {
527
- return i.signalInitialization();
528
- }, n.maxInitWaitTimeSeconds * 1e3)) : (i.initialized = !0, i.initialization = Promise.resolve(), n.hooks.emit("clientReady", i.getReadyState(n.cache.getInMemory()))), n.offline || i.startRefreshWorker(), i;
529
- }
530
- return e.prototype.waitForInitializationAsync = function() {
531
- return S(this, void 0, void 0, function() {
532
- var r, n, i = this;
533
- return O(this, function(o) {
534
- switch (o.label) {
535
- case 0:
536
- return this.options.maxInitWaitTimeSeconds < 0 ? [4, this.initialization] : [3, 2];
537
- case 1:
538
- return o.sent(), [2, !0];
539
- case 2:
540
- return [4, Promise.race([
541
- function() {
542
- return S(i, void 0, void 0, function() {
543
- return O(this, function(s) {
544
- switch (s.label) {
545
- case 0:
546
- return [4, this.initialization];
547
- case 1:
548
- return s.sent(), [2, !0];
549
- }
550
- });
551
- });
552
- }(),
553
- tt(this.options.maxInitWaitTimeSeconds * 1e3, function(s) {
554
- return r = s;
555
- })
556
- ])];
557
- case 3:
558
- return n = o.sent(), r(), [2, !!n];
559
- }
560
- });
561
- });
562
- }, e.prototype.getConfig = function() {
563
- return S(this, void 0, void 0, function() {
564
- function r(i) {
565
- i.debug("AutoPollConfigService.getConfig() - returning value from cache.");
566
- }
567
- var n;
568
- return O(this, function(i) {
569
- switch (i.label) {
570
- case 0:
571
- return this.options.logger.debug("AutoPollConfigService.getConfig() called."), !this.isOffline && !this.initialized ? [4, this.options.cache.get(this.cacheKey)] : [3, 3];
572
- case 1:
573
- return n = i.sent(), n.isExpired(this.pollIntervalMs) ? (this.options.logger.debug("AutoPollConfigService.getConfig() - cache is empty or expired, waiting for initialization."), [4, this.waitForInitializationAsync()]) : (r(this.options.logger), [2, n]);
574
- case 2:
575
- i.sent(), i.label = 3;
576
- case 3:
577
- return [4, this.options.cache.get(this.cacheKey)];
578
- case 4:
579
- return n = i.sent(), n.isExpired(this.pollIntervalMs) ? this.options.logger.debug("AutoPollConfigService.getConfig() - cache is empty or expired.") : r(this.options.logger), [2, n];
580
- }
513
+ function et(t) {
514
+ var e;
515
+ return typeof ((e = t) === null || e === void 0 ? void 0 : e.then) == "function";
516
+ }
517
+ var tt = (
518
+ /** @class */
519
+ function(t) {
520
+ B(e, t);
521
+ function e(r, n) {
522
+ var i = t.call(this, r, n) || this;
523
+ i.signalInitialization = function() {
524
+ }, i.pollIntervalMs = n.pollIntervalSeconds * 1e3;
525
+ var o = t.prototype.syncUpWithCache.call(i);
526
+ return n.maxInitWaitTimeSeconds !== 0 ? (i.initialized = !1, i.initialization = new Promise(function(s) {
527
+ return i.signalInitialization = function() {
528
+ i.initialized = !0, clearTimeout(i.initTimerId), s();
529
+ };
530
+ }), i.initialization.then(function() {
531
+ return t.prototype.onCacheSynced.call(i, n.cache.getInMemory());
532
+ }), n.maxInitWaitTimeSeconds > 0 && (i.initTimerId = setTimeout(function() {
533
+ return i.signalInitialization();
534
+ }, n.maxInitWaitTimeSeconds * 1e3))) : (i.initialized = !0, i.initialization = Promise.resolve(), o.then(function(s) {
535
+ return t.prototype.onCacheSynced.call(i, s);
536
+ })), n.offline || i.startRefreshWorker(o), i;
537
+ }
538
+ return e.prototype.onCacheSynced = function() {
539
+ }, e.prototype.waitForInitializationAsync = function() {
540
+ return S(this, void 0, void 0, function() {
541
+ var r, n;
542
+ return O(this, function(i) {
543
+ switch (i.label) {
544
+ case 0:
545
+ return this.options.maxInitWaitTimeSeconds < 0 ? [4, this.initialization] : [3, 2];
546
+ case 1:
547
+ return i.sent(), [2, !0];
548
+ case 2:
549
+ return r = {}, [4, Promise.race([
550
+ this.initialization.then(function() {
551
+ return !0;
552
+ }),
553
+ Qe(this.options.maxInitWaitTimeSeconds * 1e3, r).then(function() {
554
+ return !1;
555
+ })
556
+ ])];
557
+ case 3:
558
+ return n = i.sent(), r.clearTimer(), [2, n];
559
+ }
560
+ });
581
561
  });
582
- });
583
- }, e.prototype.refreshConfigAsync = function() {
584
- return this.options.logger.debug("AutoPollConfigService.refreshConfigAsync() called."), t.prototype.refreshConfigAsync.call(this);
585
- }, e.prototype.dispose = function() {
586
- this.options.logger.debug("AutoPollConfigService.dispose() called."), t.prototype.dispose.call(this), this.timerId && this.stopRefreshWorker();
587
- }, e.prototype.onConfigUpdated = function(r) {
588
- t.prototype.onConfigUpdated.call(this, r), this.signalInitialization();
589
- }, e.prototype.setOnlineCore = function() {
590
- this.startRefreshWorker();
591
- }, e.prototype.setOfflineCore = function() {
592
- this.stopRefreshWorker();
593
- }, e.prototype.startRefreshWorker = function() {
594
- return S(this, void 0, void 0, function() {
595
- var r, n, i = this;
596
- return O(this, function(o) {
597
- switch (o.label) {
598
- case 0:
599
- return this.options.logger.debug("AutoPollConfigService.startRefreshWorker() called."), r = this.pollIntervalMs, [4, this.options.cache.get(this.cacheKey)];
600
- case 1:
601
- return n = o.sent(), n.isExpired(this.pollIntervalMs) ? this.isOfflineExactly ? [3, 3] : [4, this.refreshConfigCoreAsync(n)] : [3, 4];
602
- case 2:
603
- o.sent(), o.label = 3;
604
- case 3:
605
- return [3, 5];
606
- case 4:
607
- this.signalInitialization(), o.label = 5;
608
- case 5:
609
- return this.options.logger.debug("AutoPollConfigService.startRefreshWorker() - calling refreshWorkerLogic()'s setTimeout."), this.timerId = setTimeout(function(s) {
610
- return i.refreshWorkerLogic(s);
611
- }, r, r), [2];
562
+ }, e.prototype.getConfig = function() {
563
+ return S(this, void 0, void 0, function() {
564
+ function r(i) {
565
+ i.debug("AutoPollConfigService.getConfig() - returning value from cache.");
612
566
  }
567
+ var n;
568
+ return O(this, function(i) {
569
+ switch (i.label) {
570
+ case 0:
571
+ return this.options.logger.debug("AutoPollConfigService.getConfig() called."), !this.isOffline && !this.initialized ? [4, this.options.cache.get(this.cacheKey)] : [3, 3];
572
+ case 1:
573
+ return n = i.sent(), n.isExpired(this.pollIntervalMs) ? (this.options.logger.debug("AutoPollConfigService.getConfig() - cache is empty or expired, waiting for initialization."), [4, this.waitForInitializationAsync()]) : (r(this.options.logger), [2, n]);
574
+ case 2:
575
+ i.sent(), i.label = 3;
576
+ case 3:
577
+ return [4, this.options.cache.get(this.cacheKey)];
578
+ case 4:
579
+ return n = i.sent(), n.isExpired(this.pollIntervalMs) ? this.options.logger.debug("AutoPollConfigService.getConfig() - cache is empty or expired.") : r(this.options.logger), [2, n];
580
+ }
581
+ });
613
582
  });
614
- });
615
- }, e.prototype.stopRefreshWorker = function() {
616
- this.options.logger.debug("AutoPollConfigService.stopRefreshWorker() - clearing setTimeout."), clearTimeout(this.timerId);
617
- }, e.prototype.refreshWorkerLogic = function(r) {
618
- return S(this, void 0, void 0, function() {
619
- var n, i = this;
620
- return O(this, function(o) {
621
- switch (o.label) {
622
- case 0:
623
- return this.disposed ? (this.options.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called on a disposed client."), [2]) : (this.options.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called."), this.isOffline ? [3, 3] : [4, this.options.cache.get(this.cacheKey)]);
624
- case 1:
625
- return n = o.sent(), [4, this.refreshConfigCoreAsync(n)];
626
- case 2:
627
- o.sent(), o.label = 3;
628
- case 3:
629
- return this.options.logger.debug("AutoPollConfigService.refreshWorkerLogic() - calling refreshWorkerLogic()'s setTimeout."), this.timerId = setTimeout(function(s) {
630
- return i.refreshWorkerLogic(s);
631
- }, r, r), [2];
632
- }
583
+ }, e.prototype.refreshConfigAsync = function() {
584
+ return this.options.logger.debug("AutoPollConfigService.refreshConfigAsync() called."), t.prototype.refreshConfigAsync.call(this);
585
+ }, e.prototype.dispose = function() {
586
+ this.options.logger.debug("AutoPollConfigService.dispose() called."), t.prototype.dispose.call(this), this.workerTimerId && this.stopRefreshWorker();
587
+ }, e.prototype.onConfigUpdated = function(r) {
588
+ t.prototype.onConfigUpdated.call(this, r), this.signalInitialization();
589
+ }, e.prototype.setOnlineCore = function() {
590
+ this.startRefreshWorker();
591
+ }, e.prototype.setOfflineCore = function() {
592
+ this.stopRefreshWorker();
593
+ }, e.prototype.startRefreshWorker = function(r) {
594
+ return S(this, void 0, void 0, function() {
595
+ var n, i, o = this;
596
+ return O(this, function(s) {
597
+ switch (s.label) {
598
+ case 0:
599
+ return this.options.logger.debug("AutoPollConfigService.startRefreshWorker() called."), n = this.pollIntervalMs, [4, r ?? this.options.cache.get(this.cacheKey)];
600
+ case 1:
601
+ return i = s.sent(), i.isExpired(this.pollIntervalMs) ? this.isOfflineExactly ? [3, 3] : [4, this.refreshConfigCoreAsync(i)] : [3, 4];
602
+ case 2:
603
+ s.sent(), s.label = 3;
604
+ case 3:
605
+ return [3, 5];
606
+ case 4:
607
+ this.signalInitialization(), s.label = 5;
608
+ case 5:
609
+ return this.options.logger.debug("AutoPollConfigService.startRefreshWorker() - calling refreshWorkerLogic()'s setTimeout."), this.workerTimerId = setTimeout(function(a) {
610
+ return o.refreshWorkerLogic(a);
611
+ }, n, n), [
612
+ 2
613
+ /*return*/
614
+ ];
615
+ }
616
+ });
633
617
  });
634
- });
635
- }, e.prototype.getReadyState = function(r) {
636
- return r.isEmpty ? L.NoFlagData : r.isExpired(this.pollIntervalMs) ? L.HasCachedFlagDataOnly : L.HasUpToDateFlagData;
637
- }, e;
638
- }(me), nt = function() {
639
- function t() {
640
- this.cachedConfig = M.empty;
641
- }
642
- return t.prototype.set = function(e, r) {
643
- this.cachedConfig = r;
644
- }, t.prototype.get = function(e) {
645
- return this.cachedConfig;
646
- }, t.prototype.getInMemory = function() {
647
- return this.cachedConfig;
648
- }, t;
649
- }(), _e = function() {
650
- function t(e, r) {
651
- this.cache = e, this.logger = r, this.cachedConfig = M.empty;
652
- }
653
- return t.prototype.set = function(e, r) {
654
- return S(this, void 0, void 0, function() {
655
- var n;
656
- return O(this, function(i) {
657
- switch (i.label) {
658
- case 0:
659
- if (i.trys.push([0, 2, , 3]), !r.isEmpty)
660
- this.cachedSerializedConfig = M.serialize(r), this.cachedConfig = r;
661
- else
662
- return this.cachedSerializedConfig = void 0, this.cachedConfig = r, [2];
663
- return [4, this.cache.set(e, this.cachedSerializedConfig)];
664
- case 1:
665
- return i.sent(), [3, 3];
666
- case 2:
667
- return n = i.sent(), this.logger.configServiceCacheWriteError(n), [3, 3];
668
- case 3:
669
- return [2];
670
- }
618
+ }, e.prototype.stopRefreshWorker = function() {
619
+ this.options.logger.debug("AutoPollConfigService.stopRefreshWorker() - clearing setTimeout."), clearTimeout(this.workerTimerId);
620
+ }, e.prototype.refreshWorkerLogic = function(r) {
621
+ return S(this, void 0, void 0, function() {
622
+ var n, i = this;
623
+ return O(this, function(o) {
624
+ switch (o.label) {
625
+ case 0:
626
+ return this.disposed ? (this.options.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called on a disposed client."), [
627
+ 2
628
+ /*return*/
629
+ ]) : (this.options.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called."), this.isOffline ? [3, 3] : [4, this.options.cache.get(this.cacheKey)]);
630
+ case 1:
631
+ return n = o.sent(), [4, this.refreshConfigCoreAsync(n)];
632
+ case 2:
633
+ o.sent(), o.label = 3;
634
+ case 3:
635
+ return this.options.logger.debug("AutoPollConfigService.refreshWorkerLogic() - calling refreshWorkerLogic()'s setTimeout."), this.workerTimerId = setTimeout(function(s) {
636
+ return i.refreshWorkerLogic(s);
637
+ }, r, r), [
638
+ 2
639
+ /*return*/
640
+ ];
641
+ }
642
+ });
671
643
  });
672
- });
673
- }, t.prototype.get = function(e) {
674
- return S(this, void 0, void 0, function() {
675
- var r, n;
676
- return O(this, function(i) {
677
- switch (i.label) {
678
- case 0:
679
- return i.trys.push([0, 2, , 3]), [4, this.cache.get(e)];
680
- case 1:
681
- return r = i.sent(), r == null || r === this.cachedSerializedConfig ? [2, this.cachedConfig] : (this.cachedConfig = M.deserialize(r), this.cachedSerializedConfig = r, [3, 3]);
682
- case 2:
683
- return n = i.sent(), this.logger.configServiceCacheReadError(n), [3, 3];
684
- case 3:
685
- return [2, this.cachedConfig];
686
- }
644
+ }, e.prototype.getCacheState = function(r) {
645
+ return r.isEmpty ? T.NoFlagData : r.isExpired(this.pollIntervalMs) ? T.HasCachedFlagDataOnly : T.HasUpToDateFlagData;
646
+ }, e;
647
+ }(me)
648
+ ), rt = (
649
+ /** @class */
650
+ function() {
651
+ function t() {
652
+ this.cachedConfig = M.empty;
653
+ }
654
+ return t.prototype.set = function(e, r) {
655
+ this.cachedConfig = r;
656
+ }, t.prototype.get = function(e) {
657
+ return this.cachedConfig;
658
+ }, t.prototype.getInMemory = function() {
659
+ return this.cachedConfig;
660
+ }, t;
661
+ }()
662
+ ), ze = (
663
+ /** @class */
664
+ function() {
665
+ function t(e, r) {
666
+ this.cache = e, this.logger = r, this.cachedConfig = M.empty;
667
+ }
668
+ return t.prototype.set = function(e, r) {
669
+ return S(this, void 0, void 0, function() {
670
+ var n;
671
+ return O(this, function(i) {
672
+ switch (i.label) {
673
+ case 0:
674
+ if (i.trys.push([0, 2, , 3]), !r.isEmpty)
675
+ this.cachedSerializedConfig = M.serialize(r), this.cachedConfig = r;
676
+ else
677
+ return this.cachedSerializedConfig = void 0, this.cachedConfig = r, [
678
+ 2
679
+ /*return*/
680
+ ];
681
+ return [4, this.cache.set(e, this.cachedSerializedConfig)];
682
+ case 1:
683
+ return i.sent(), [3, 3];
684
+ case 2:
685
+ return n = i.sent(), this.logger.configServiceCacheWriteError(n), [3, 3];
686
+ case 3:
687
+ return [
688
+ 2
689
+ /*return*/
690
+ ];
691
+ }
692
+ });
687
693
  });
688
- });
689
- }, t.prototype.getInMemory = function() {
690
- return this.cachedConfig;
691
- }, t;
692
- }(), v;
694
+ }, t.prototype.updateCachedConfig = function(e) {
695
+ e == null || e === this.cachedSerializedConfig || (this.cachedConfig = M.deserialize(e), this.cachedSerializedConfig = e);
696
+ }, t.prototype.get = function(e) {
697
+ var r = this;
698
+ try {
699
+ var n = this.cache.get(e);
700
+ if (et(n))
701
+ return function(i) {
702
+ return S(r, void 0, void 0, function() {
703
+ var o, s;
704
+ return O(this, function(a) {
705
+ switch (a.label) {
706
+ case 0:
707
+ return a.trys.push([0, 2, , 3]), o = this.updateCachedConfig, [4, i];
708
+ case 1:
709
+ return o.apply(this, [a.sent()]), [3, 3];
710
+ case 2:
711
+ return s = a.sent(), this.logger.configServiceCacheReadError(s), [3, 3];
712
+ case 3:
713
+ return [2, this.cachedConfig];
714
+ }
715
+ });
716
+ });
717
+ }(n);
718
+ this.updateCachedConfig(n);
719
+ } catch (i) {
720
+ this.logger.configServiceCacheReadError(i);
721
+ }
722
+ return Promise.resolve(this.cachedConfig);
723
+ }, t.prototype.getInMemory = function() {
724
+ return this.cachedConfig;
725
+ }, t;
726
+ }()
727
+ ), v;
693
728
  (function(t) {
694
729
  t[t.Debug = 4] = "Debug", t[t.Info = 3] = "Info", t[t.Warn = 2] = "Warn", t[t.Error = 1] = "Error", t[t.Off = -1] = "Off";
695
730
  })(v || (v = {}));
696
- var A = function() {
697
- function t(e, r, n) {
698
- this.strings = e, this.argNames = r, this.argValues = n;
699
- }
700
- return t.from = function() {
701
- for (var e = [], r = 0; r < arguments.length; r++)
702
- e[r] = arguments[r];
703
- return function(n) {
704
- for (var i = [], o = 1; o < arguments.length; o++)
705
- i[o - 1] = arguments[o];
706
- return new t(n, e, i);
707
- };
708
- }, Object.defineProperty(t.prototype, "defaultFormattedMessage", {
709
- get: function() {
710
- var e = this.cachedDefaultFormattedMessage;
711
- if (e === void 0) {
712
- e = "";
713
- for (var r = this, n = r.strings, i = r.argValues, o = 0; o < n.length - 1; o++)
714
- e += n[o], e += i[o];
715
- e += n[o], this.cachedDefaultFormattedMessage = e;
716
- }
717
- return e;
718
- },
719
- enumerable: !1,
720
- configurable: !0
721
- }), t.prototype.toString = function() {
722
- return this.defaultFormattedMessage;
723
- }, t;
724
- }(), it = function() {
725
- function t(e, r) {
726
- this.logger = e, this.hooks = r;
727
- }
728
- return Object.defineProperty(t.prototype, "level", {
729
- get: function() {
730
- var e;
731
- return (e = this.logger.level) !== null && e !== void 0 ? e : v.Warn;
732
- },
733
- enumerable: !1,
734
- configurable: !0
735
- }), t.prototype.isLogLevelEnabled = function(e) {
736
- return this.level >= e;
737
- }, t.prototype.log = function(e, r, n, i) {
738
- var o;
739
- return this.isLogLevelEnabled(e) && this.logger.log(e, r, n, i), e === v.Error && ((o = this.hooks) === null || o === void 0 || o.emit("clientError", n.toString(), i)), n;
740
- }, t.prototype.debug = function(e) {
741
- this.log(v.Debug, 0, e);
742
- }, t.prototype.configJsonIsNotPresent = function(e) {
743
- return this.log(v.Error, 1e3, A.from("DEFAULT_RETURN_VALUE")(Ce || (Ce = C(["Config JSON is not present. Returning ", "."], ["Config JSON is not present. Returning ", "."])), e));
744
- }, t.prototype.configJsonIsNotPresentSingle = function(e, r, n) {
745
- return this.log(v.Error, 1e3, A.from("KEY", "DEFAULT_PARAM_NAME", "DEFAULT_PARAM_VALUE")(Ae || (Ae = C(["Config JSON is not present when evaluating setting '", "'. Returning the `", "` parameter that you specified in your application: '", "'."], ["Config JSON is not present when evaluating setting '", "'. Returning the \\`", "\\` parameter that you specified in your application: '", "'."])), e, r, n));
746
- }, t.prototype.settingEvaluationFailedDueToMissingKey = function(e, r, n, i) {
747
- return this.log(v.Error, 1001, A.from("KEY", "DEFAULT_PARAM_NAME", "DEFAULT_PARAM_VALUE", "AVAILABLE_KEYS")(we || (we = C(["Failed to evaluate setting '", "' (the key was not found in config JSON). Returning the `", "` parameter that you specified in your application: '", "'. Available keys: [", "]."], ["Failed to evaluate setting '", "' (the key was not found in config JSON). Returning the \\`", "\\` parameter that you specified in your application: '", "'. Available keys: [", "]."])), e, r, n, i));
748
- }, t.prototype.settingEvaluationError = function(e, r, n) {
749
- return this.log(v.Error, 1002, A.from("METHOD_NAME", "DEFAULT_RETURN_VALUE")(Te || (Te = C(["Error occurred in the `", "` method. Returning ", "."], ["Error occurred in the \\`", "\\` method. Returning ", "."])), e, r), n);
750
- }, t.prototype.settingEvaluationErrorSingle = function(e, r, n, i, o) {
751
- return this.log(v.Error, 1002, A.from("METHOD_NAME", "KEY", "DEFAULT_PARAM_NAME", "DEFAULT_PARAM_VALUE")(Ie || (Ie = C(["Error occurred in the `", "` method while evaluating setting '", "'. Returning the `", "` parameter that you specified in your application: '", "'."], ["Error occurred in the \\`", "\\` method while evaluating setting '", "'. Returning the \\`", "\\` parameter that you specified in your application: '", "'."])), e, r, n, i), o);
752
- }, t.prototype.forceRefreshError = function(e, r) {
753
- return this.log(v.Error, 1003, A.from("METHOD_NAME")(Ne || (Ne = C(["Error occurred in the `", "` method."], ["Error occurred in the \\`", "\\` method."])), e), r);
754
- }, t.prototype.fetchFailedDueToInvalidSdkKey = function() {
755
- return this.log(v.Error, 1100, "Your SDK Key seems to be wrong. You can find the valid SDK Key at https://app.configcat.com/sdkkey");
756
- }, t.prototype.fetchFailedDueToUnexpectedHttpResponse = function(e, r) {
757
- return this.log(v.Error, 1101, A.from("STATUS_CODE", "REASON_PHRASE")(Re || (Re = C(["Unexpected HTTP response was received while trying to fetch config JSON: ", " ", ""], ["Unexpected HTTP response was received while trying to fetch config JSON: ", " ", ""])), e, r));
758
- }, t.prototype.fetchFailedDueToRequestTimeout = function(e, r) {
759
- return this.log(v.Error, 1102, A.from("TIMEOUT")(Le || (Le = C(["Request timed out while trying to fetch config JSON. Timeout value: ", "ms"], ["Request timed out while trying to fetch config JSON. Timeout value: ", "ms"])), e), r);
760
- }, t.prototype.fetchFailedDueToUnexpectedError = function(e) {
761
- return this.log(v.Error, 1103, "Unexpected error occurred while trying to fetch config JSON.", e);
762
- }, t.prototype.fetchFailedDueToRedirectLoop = function() {
763
- return this.log(v.Error, 1104, "Redirection loop encountered while trying to fetch config JSON. Please contact us at https://configcat.com/support/");
764
- }, t.prototype.fetchReceived200WithInvalidBody = function() {
765
- return this.log(v.Error, 1105, "Fetching config JSON was successful but the HTTP response content was invalid.");
766
- }, t.prototype.fetchReceived304WhenLocalCacheIsEmpty = function(e, r) {
767
- return this.log(v.Error, 1106, A.from("STATUS_CODE", "REASON_PHRASE")(De || (De = C(["Unexpected HTTP response was received when no config JSON is cached locally: ", " ", ""], ["Unexpected HTTP response was received when no config JSON is cached locally: ", " ", ""])), e, r));
768
- }, t.prototype.settingForVariationIdIsNotPresent = function(e) {
769
- return this.log(v.Error, 2011, A.from("VARIATION_ID")(Fe || (Fe = C(["Could not find the setting for the specified variation ID: '", "'."], ["Could not find the setting for the specified variation ID: '", "'."])), e));
770
- }, t.prototype.configServiceCacheReadError = function(e) {
771
- return this.log(v.Error, 2200, "Error occurred while reading the cache.", e);
772
- }, t.prototype.configServiceCacheWriteError = function(e) {
773
- return this.log(v.Error, 2201, "Error occurred while writing the cache.", e);
774
- }, t.prototype.clientIsAlreadyCreated = function(e) {
775
- return this.log(v.Warn, 3e3, A.from("SDK_KEY")(Pe || (Pe = C(["There is an existing client instance for the specified SDK Key. No new client instance will be created and the specified options are ignored. Returning the existing client instance. SDK Key: '", "'."], ["There is an existing client instance for the specified SDK Key. No new client instance will be created and the specified options are ignored. Returning the existing client instance. SDK Key: '", "'."])), e));
776
- }, t.prototype.targetingIsNotPossible = function(e) {
777
- return this.log(v.Warn, 3001, A.from("KEY")(Ue || (Ue = C(["Cannot evaluate targeting rules and % options for setting '", "' (User Object is missing). You should pass a User Object to the evaluation methods like `getValueAsync()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/"], ["Cannot evaluate targeting rules and % options for setting '", "' (User Object is missing). You should pass a User Object to the evaluation methods like \\`getValueAsync()\\` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/"])), e));
778
- }, t.prototype.dataGovernanceIsOutOfSync = function() {
779
- return this.log(v.Warn, 3002, "The `dataGovernance` parameter specified at the client initialization is not in sync with the preferences on the ConfigCat Dashboard. Read more: https://configcat.com/docs/advanced/data-governance/");
780
- }, t.prototype.configServiceCannotInitiateHttpCalls = function() {
781
- return this.log(v.Warn, 3200, "Client is in offline mode, it cannot initiate HTTP calls.");
782
- }, t.prototype.configServiceMethodHasNoEffectDueToDisposedClient = function(e) {
783
- return this.log(v.Warn, 3201, A.from("METHOD_NAME")(ke || (ke = C(["The client object is already disposed, thus `", "()` has no effect."], ["The client object is already disposed, thus \\`", "()\\` has no effect."])), e));
784
- }, t.prototype.configServiceMethodHasNoEffectDueToOverrideBehavior = function(e, r) {
785
- return this.log(v.Warn, 3202, A.from("OVERRIDE_BEHAVIOR", "METHOD_NAME")(Me || (Me = C(["Client is configured to use the `", "` override behavior, thus `", "()` has no effect."], ["Client is configured to use the \\`", "\\` override behavior, thus \\`", "()\\` has no effect."])), e, r));
786
- }, t.prototype.settingEvaluated = function(e) {
787
- return this.log(v.Info, 5e3, A.from("EVALUATE_LOG")(Ve || (Ve = C(["", ""], ["", ""])), e));
788
- }, t.prototype.configServiceStatusChanged = function(e) {
789
- return this.log(v.Info, 5200, A.from("MODE")(xe || (xe = C(["Switched to ", " mode."], ["Switched to ", " mode."])), e.toUpperCase()));
790
- }, t;
791
- }(), Be = function() {
792
- function t(e) {
793
- e === void 0 && (e = v.Warn), this.level = e, this.SOURCE = "ConfigCat";
794
- }
795
- return t.prototype.log = function(e, r, n, i) {
796
- var o = e === v.Debug ? [console.info, "DEBUG"] : e === v.Info ? [console.info, "INFO"] : e === v.Warn ? [console.warn, "WARN"] : e === v.Error ? [console.error, "ERROR"] : [console.log, v[e].toUpperCase()], s = o[0], a = o[1], c = i !== void 0 ? `
797
- ` + z(i, !0) : "";
798
- s(this.SOURCE + " - " + a + " - [" + r + "] " + n + c);
799
- }, t;
800
- }(), Ce, Ae, we, Te, Ie, Ne, Re, Le, De, Fe, Pe, Ue, ke, Me, Ve, xe;
731
+ var A = (
732
+ /** @class */
733
+ function() {
734
+ function t(e, r, n) {
735
+ this.strings = e, this.argNames = r, this.argValues = n;
736
+ }
737
+ return t.from = function() {
738
+ for (var e = [], r = 0; r < arguments.length; r++)
739
+ e[r] = arguments[r];
740
+ return function(n) {
741
+ for (var i = [], o = 1; o < arguments.length; o++)
742
+ i[o - 1] = arguments[o];
743
+ return new t(n, e, i);
744
+ };
745
+ }, Object.defineProperty(t.prototype, "defaultFormattedMessage", {
746
+ get: function() {
747
+ var e = this.cachedDefaultFormattedMessage;
748
+ if (e === void 0) {
749
+ e = "";
750
+ for (var r = this, n = r.strings, i = r.argValues, o = 0; o < n.length - 1; o++)
751
+ e += n[o], e += i[o];
752
+ e += n[o], this.cachedDefaultFormattedMessage = e;
753
+ }
754
+ return e;
755
+ },
756
+ enumerable: !1,
757
+ configurable: !0
758
+ }), t.prototype.toString = function() {
759
+ return this.defaultFormattedMessage;
760
+ }, t;
761
+ }()
762
+ ), nt = (
763
+ /** @class */
764
+ function() {
765
+ function t(e, r) {
766
+ this.logger = e, this.hooks = r;
767
+ }
768
+ return Object.defineProperty(t.prototype, "level", {
769
+ get: function() {
770
+ var e;
771
+ return (e = this.logger.level) !== null && e !== void 0 ? e : v.Warn;
772
+ },
773
+ enumerable: !1,
774
+ configurable: !0
775
+ }), t.prototype.isLogLevelEnabled = function(e) {
776
+ return this.level >= e;
777
+ }, t.prototype.log = function(e, r, n, i) {
778
+ var o;
779
+ return this.isLogLevelEnabled(e) && this.logger.log(e, r, n, i), e === v.Error && ((o = this.hooks) === null || o === void 0 || o.emit("clientError", n.toString(), i)), n;
780
+ }, t.prototype.debug = function(e) {
781
+ this.log(v.Debug, 0, e);
782
+ }, t.prototype.configJsonIsNotPresent = function(e) {
783
+ return this.log(v.Error, 1e3, A.from("DEFAULT_RETURN_VALUE")(Oe || (Oe = C(["Config JSON is not present. Returning ", "."], ["Config JSON is not present. Returning ", "."])), e));
784
+ }, t.prototype.configJsonIsNotPresentSingle = function(e, r, n) {
785
+ return this.log(v.Error, 1e3, A.from("KEY", "DEFAULT_PARAM_NAME", "DEFAULT_PARAM_VALUE")(Ce || (Ce = C(["Config JSON is not present when evaluating setting '", "'. Returning the `", "` parameter that you specified in your application: '", "'."], ["Config JSON is not present when evaluating setting '", "'. Returning the \\`", "\\` parameter that you specified in your application: '", "'."])), e, r, n));
786
+ }, t.prototype.settingEvaluationFailedDueToMissingKey = function(e, r, n, i) {
787
+ return this.log(v.Error, 1001, A.from("KEY", "DEFAULT_PARAM_NAME", "DEFAULT_PARAM_VALUE", "AVAILABLE_KEYS")(Ae || (Ae = C(["Failed to evaluate setting '", "' (the key was not found in config JSON). Returning the `", "` parameter that you specified in your application: '", "'. Available keys: [", "]."], ["Failed to evaluate setting '", "' (the key was not found in config JSON). Returning the \\`", "\\` parameter that you specified in your application: '", "'. Available keys: [", "]."])), e, r, n, i));
788
+ }, t.prototype.settingEvaluationError = function(e, r, n) {
789
+ return this.log(v.Error, 1002, A.from("METHOD_NAME", "DEFAULT_RETURN_VALUE")(Te || (Te = C(["Error occurred in the `", "` method. Returning ", "."], ["Error occurred in the \\`", "\\` method. Returning ", "."])), e, r), n);
790
+ }, t.prototype.settingEvaluationErrorSingle = function(e, r, n, i, o) {
791
+ return this.log(v.Error, 1002, A.from("METHOD_NAME", "KEY", "DEFAULT_PARAM_NAME", "DEFAULT_PARAM_VALUE")(we || (we = C(["Error occurred in the `", "` method while evaluating setting '", "'. Returning the `", "` parameter that you specified in your application: '", "'."], ["Error occurred in the \\`", "\\` method while evaluating setting '", "'. Returning the \\`", "\\` parameter that you specified in your application: '", "'."])), e, r, n, i), o);
792
+ }, t.prototype.forceRefreshError = function(e, r) {
793
+ return this.log(v.Error, 1003, A.from("METHOD_NAME")(Ie || (Ie = C(["Error occurred in the `", "` method."], ["Error occurred in the \\`", "\\` method."])), e), r);
794
+ }, t.prototype.fetchFailedDueToInvalidSdkKey = function() {
795
+ return this.log(v.Error, 1100, "Your SDK Key seems to be wrong. You can find the valid SDK Key at https://app.configcat.com/sdkkey");
796
+ }, t.prototype.fetchFailedDueToUnexpectedHttpResponse = function(e, r) {
797
+ return this.log(v.Error, 1101, A.from("STATUS_CODE", "REASON_PHRASE")(Ne || (Ne = C(["Unexpected HTTP response was received while trying to fetch config JSON: ", " ", ""], ["Unexpected HTTP response was received while trying to fetch config JSON: ", " ", ""])), e, r));
798
+ }, t.prototype.fetchFailedDueToRequestTimeout = function(e, r) {
799
+ return this.log(v.Error, 1102, A.from("TIMEOUT")(Le || (Le = C(["Request timed out while trying to fetch config JSON. Timeout value: ", "ms"], ["Request timed out while trying to fetch config JSON. Timeout value: ", "ms"])), e), r);
800
+ }, t.prototype.fetchFailedDueToUnexpectedError = function(e) {
801
+ return this.log(v.Error, 1103, "Unexpected error occurred while trying to fetch config JSON.", e);
802
+ }, t.prototype.fetchFailedDueToRedirectLoop = function() {
803
+ return this.log(v.Error, 1104, "Redirection loop encountered while trying to fetch config JSON. Please contact us at https://configcat.com/support/");
804
+ }, t.prototype.fetchReceived200WithInvalidBody = function() {
805
+ return this.log(v.Error, 1105, "Fetching config JSON was successful but the HTTP response content was invalid.");
806
+ }, t.prototype.fetchReceived304WhenLocalCacheIsEmpty = function(e, r) {
807
+ return this.log(v.Error, 1106, A.from("STATUS_CODE", "REASON_PHRASE")(Re || (Re = C(["Unexpected HTTP response was received when no config JSON is cached locally: ", " ", ""], ["Unexpected HTTP response was received when no config JSON is cached locally: ", " ", ""])), e, r));
808
+ }, t.prototype.settingForVariationIdIsNotPresent = function(e) {
809
+ return this.log(v.Error, 2011, A.from("VARIATION_ID")(De || (De = C(["Could not find the setting for the specified variation ID: '", "'."], ["Could not find the setting for the specified variation ID: '", "'."])), e));
810
+ }, t.prototype.configServiceCacheReadError = function(e) {
811
+ return this.log(v.Error, 2200, "Error occurred while reading the cache.", e);
812
+ }, t.prototype.configServiceCacheWriteError = function(e) {
813
+ return this.log(v.Error, 2201, "Error occurred while writing the cache.", e);
814
+ }, t.prototype.clientIsAlreadyCreated = function(e) {
815
+ return this.log(v.Warn, 3e3, A.from("SDK_KEY")(Fe || (Fe = C(["There is an existing client instance for the specified SDK Key. No new client instance will be created and the specified options are ignored. Returning the existing client instance. SDK Key: '", "'."], ["There is an existing client instance for the specified SDK Key. No new client instance will be created and the specified options are ignored. Returning the existing client instance. SDK Key: '", "'."])), e));
816
+ }, t.prototype.targetingIsNotPossible = function(e) {
817
+ return this.log(v.Warn, 3001, A.from("KEY")(Pe || (Pe = C(["Cannot evaluate targeting rules and % options for setting '", "' (User Object is missing). You should pass a User Object to the evaluation methods like `getValueAsync()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/"], ["Cannot evaluate targeting rules and % options for setting '", "' (User Object is missing). You should pass a User Object to the evaluation methods like \\`getValueAsync()\\` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/"])), e));
818
+ }, t.prototype.dataGovernanceIsOutOfSync = function() {
819
+ return this.log(v.Warn, 3002, "The `dataGovernance` parameter specified at the client initialization is not in sync with the preferences on the ConfigCat Dashboard. Read more: https://configcat.com/docs/advanced/data-governance/");
820
+ }, t.prototype.configServiceCannotInitiateHttpCalls = function() {
821
+ return this.log(v.Warn, 3200, "Client is in offline mode, it cannot initiate HTTP calls.");
822
+ }, t.prototype.configServiceMethodHasNoEffectDueToDisposedClient = function(e) {
823
+ return this.log(v.Warn, 3201, A.from("METHOD_NAME")(Ue || (Ue = C(["The client object is already disposed, thus `", "()` has no effect."], ["The client object is already disposed, thus \\`", "()\\` has no effect."])), e));
824
+ }, t.prototype.configServiceMethodHasNoEffectDueToOverrideBehavior = function(e, r) {
825
+ return this.log(v.Warn, 3202, A.from("OVERRIDE_BEHAVIOR", "METHOD_NAME")(ke || (ke = C(["Client is configured to use the `", "` override behavior, thus `", "()` has no effect."], ["Client is configured to use the \\`", "\\` override behavior, thus \\`", "()\\` has no effect."])), e, r));
826
+ }, t.prototype.settingEvaluated = function(e) {
827
+ return this.log(v.Info, 5e3, A.from("EVALUATE_LOG")(Me || (Me = C(["", ""], ["", ""])), e));
828
+ }, t.prototype.configServiceStatusChanged = function(e) {
829
+ return this.log(v.Info, 5200, A.from("MODE")(Ve || (Ve = C(["Switched to ", " mode."], ["Switched to ", " mode."])), e.toUpperCase()));
830
+ }, t;
831
+ }()
832
+ ), Be = (
833
+ /** @class */
834
+ function() {
835
+ function t(e) {
836
+ e === void 0 && (e = v.Warn), this.level = e, this.SOURCE = "ConfigCat";
837
+ }
838
+ return t.prototype.log = function(e, r, n, i) {
839
+ var o = e === v.Debug ? [console.info, "DEBUG"] : e === v.Info ? [console.info, "INFO"] : e === v.Warn ? [console.warn, "WARN"] : e === v.Error ? [console.error, "ERROR"] : [console.log, v[e].toUpperCase()], s = o[0], a = o[1], c = i !== void 0 ? `
840
+ ` + _(i, !0) : "";
841
+ s(this.SOURCE + " - " + a + " - [" + r + "] " + n + c);
842
+ }, t;
843
+ }()
844
+ ), Oe, Ce, Ae, Te, we, Ie, Ne, Le, Re, De, Fe, Pe, Ue, ke, Me, Ve;
801
845
  function J(t) {
802
846
  return !!t.fn;
803
847
  }
804
- var ot = function() {
805
- function t() {
806
- this.events = {}, this.eventCount = 0, this.addListener = this.on, this.off = this.removeListener;
807
- }
808
- return t.prototype.addListenerCore = function(e, r, n) {
809
- if (typeof r != "function")
810
- throw new TypeError("Listener must be a function");
811
- var i = this.events[e], o = { fn: r, once: n };
812
- return i ? J(i) ? this.events[e] = [i, o] : i.push(o) : (this.events[e] = o, this.eventCount++), this;
813
- }, t.prototype.removeListenerCore = function(e, r, n) {
814
- var i = this.events[e];
815
- if (!i)
848
+ var it = (
849
+ /** @class */
850
+ function() {
851
+ function t() {
852
+ this.events = {}, this.eventCount = 0, this.addListener = this.on, this.off = this.removeListener;
853
+ }
854
+ return t.prototype.addListenerCore = function(e, r, n) {
855
+ if (typeof r != "function")
856
+ throw new TypeError("Listener must be a function");
857
+ var i = this.events[e], o = { fn: r, once: n };
858
+ return i ? J(i) ? this.events[e] = [i, o] : i.push(o) : (this.events[e] = o, this.eventCount++), this;
859
+ }, t.prototype.removeListenerCore = function(e, r, n) {
860
+ var i = this.events[e];
861
+ if (!i)
862
+ return this;
863
+ if (J(i))
864
+ n(i, r) && this.removeEvent(e);
865
+ else
866
+ for (var o = i.length - 1; o >= 0; o--)
867
+ if (n(i[o], r)) {
868
+ i.splice(o, 1), i.length ? i.length === 1 && (this.events[e] = i[0]) : this.removeEvent(e);
869
+ break;
870
+ }
816
871
  return this;
817
- if (J(i))
818
- n(i, r) && this.removeEvent(e);
819
- else
820
- for (var o = i.length - 1; o >= 0; o--)
821
- if (n(i[o], r)) {
822
- i.splice(o, 1), i.length ? i.length === 1 && (this.events[e] = i[0]) : this.removeEvent(e);
823
- break;
872
+ }, t.prototype.removeEvent = function(e) {
873
+ --this.eventCount === 0 ? this.events = {} : delete this.events[e];
874
+ }, t.prototype.on = function(e, r) {
875
+ return this.addListenerCore(e, r, !1);
876
+ }, t.prototype.once = function(e, r) {
877
+ return this.addListenerCore(e, r, !0);
878
+ }, t.prototype.removeListener = function(e, r) {
879
+ if (typeof r != "function")
880
+ throw new TypeError("Listener must be a function");
881
+ return this.removeListenerCore(e, r, function(n, i) {
882
+ return n.fn === i;
883
+ });
884
+ }, t.prototype.removeAllListeners = function(e) {
885
+ return e ? this.events[e] && this.removeEvent(e) : (this.events = {}, this.eventCount = 0), this;
886
+ }, t.prototype.listeners = function(e) {
887
+ var r = this.events[e];
888
+ if (!r)
889
+ return [];
890
+ if (J(r))
891
+ return [r.fn];
892
+ for (var n = r.length, i = new Array(n), o = 0; o < n; o++)
893
+ i[o] = r[o].fn;
894
+ return i;
895
+ }, t.prototype.listenerCount = function(e) {
896
+ var r = this.events[e];
897
+ return r ? J(r) ? 1 : r.length : 0;
898
+ }, t.prototype.eventNames = function() {
899
+ var e = [];
900
+ if (this.eventCount === 0)
901
+ return e;
902
+ var r = this.events;
903
+ for (var n in r)
904
+ Object.prototype.hasOwnProperty.call(r, n) && e.push(n);
905
+ return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(r)) : e;
906
+ }, t.prototype.emit = function(e, r, n, i, o) {
907
+ var s, a, c = this.events[e];
908
+ if (!c)
909
+ return !1;
910
+ var u, l;
911
+ J(c) ? (s = [c, 1], u = s[0], l = s[1]) : (c = c.slice(), a = [c[0], c.length], u = a[0], l = a[1]);
912
+ for (var h = arguments.length - 1, p = 0; ; ) {
913
+ switch (u.once && this.removeListenerCore(e, u, function(y, E) {
914
+ return y === E;
915
+ }), h) {
916
+ case 0:
917
+ u.fn.call(this);
918
+ break;
919
+ case 1:
920
+ u.fn.call(this, r);
921
+ break;
922
+ case 2:
923
+ u.fn.call(this, r, n);
924
+ break;
925
+ case 3:
926
+ u.fn.call(this, r, n, i);
927
+ break;
928
+ case 4:
929
+ u.fn.call(this, r, n, i, o);
930
+ break;
931
+ default:
932
+ for (var f = new Array(h), d = 0; d < h; d++)
933
+ f[d] = arguments[d + 1];
934
+ u.fn.apply(this, f);
935
+ break;
824
936
  }
825
- return this;
826
- }, t.prototype.removeEvent = function(e) {
827
- --this.eventCount === 0 ? this.events = {} : delete this.events[e];
828
- }, t.prototype.on = function(e, r) {
829
- return this.addListenerCore(e, r, !1);
830
- }, t.prototype.once = function(e, r) {
831
- return this.addListenerCore(e, r, !0);
832
- }, t.prototype.removeListener = function(e, r) {
833
- if (typeof r != "function")
834
- throw new TypeError("Listener must be a function");
835
- return this.removeListenerCore(e, r, function(n, i) {
836
- return n.fn === i;
837
- });
838
- }, t.prototype.removeAllListeners = function(e) {
839
- return e ? this.events[e] && this.removeEvent(e) : (this.events = {}, this.eventCount = 0), this;
840
- }, t.prototype.listeners = function(e) {
841
- var r = this.events[e];
842
- if (!r)
843
- return [];
844
- if (J(r))
845
- return [r.fn];
846
- for (var n = r.length, i = new Array(n), o = 0; o < n; o++)
847
- i[o] = r[o].fn;
848
- return i;
849
- }, t.prototype.listenerCount = function(e) {
850
- var r = this.events[e];
851
- return r ? J(r) ? 1 : r.length : 0;
852
- }, t.prototype.eventNames = function() {
853
- var e = [];
854
- if (this.eventCount === 0)
855
- return e;
856
- var r = this.events;
857
- for (var n in r)
858
- Object.prototype.hasOwnProperty.call(r, n) && e.push(n);
859
- return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(r)) : e;
860
- }, t.prototype.emit = function(e, r, n, i, o) {
861
- var s, a, c = this.events[e];
862
- if (!c)
863
- return !1;
864
- var u, l;
865
- J(c) ? (s = [c, 1], u = s[0], l = s[1]) : (c = c.slice(), a = [c[0], c.length], u = a[0], l = a[1]);
866
- for (var h = arguments.length - 1, p = 0; ; ) {
867
- switch (u.once && this.removeListenerCore(e, u, function(y, E) {
868
- return y === E;
869
- }), h) {
870
- case 0:
871
- u.fn.call(this);
872
- break;
873
- case 1:
874
- u.fn.call(this, r);
875
- break;
876
- case 2:
877
- u.fn.call(this, r, n);
878
- break;
879
- case 3:
880
- u.fn.call(this, r, n, i);
881
- break;
882
- case 4:
883
- u.fn.call(this, r, n, i, o);
884
- break;
885
- default:
886
- for (var f = new Array(h), d = 0; d < h; d++)
887
- f[d] = arguments[d + 1];
888
- u.fn.apply(this, f);
937
+ if (++p >= l)
889
938
  break;
939
+ u = c[p];
890
940
  }
891
- if (++p >= l)
892
- break;
893
- u = c[p];
941
+ return !0;
942
+ }, t;
943
+ }()
944
+ ), ot = (
945
+ /** @class */
946
+ function() {
947
+ function t() {
948
+ this.addListener = this.on, this.off = this.removeListener;
894
949
  }
895
- return !0;
896
- }, t;
897
- }();
950
+ return t.prototype.on = function() {
951
+ return this;
952
+ }, t.prototype.once = function() {
953
+ return this;
954
+ }, t.prototype.removeListener = function() {
955
+ return this;
956
+ }, t.prototype.removeAllListeners = function() {
957
+ return this;
958
+ }, t.prototype.listeners = function() {
959
+ return [];
960
+ }, t.prototype.listenerCount = function() {
961
+ return 0;
962
+ }, t.prototype.eventNames = function() {
963
+ return [];
964
+ }, t.prototype.emit = function() {
965
+ return !1;
966
+ }, t;
967
+ }()
968
+ ), qt = T, xe = new ot(), st = (
969
+ /** @class */
970
+ function() {
971
+ function t(e) {
972
+ this.addListener = this.on, this.off = this.removeListener, this.eventEmitter = e;
973
+ }
974
+ return t.prototype.tryDisconnect = function() {
975
+ var e = this.eventEmitter;
976
+ return this.eventEmitter = xe, e !== xe;
977
+ }, t.prototype.on = function(e, r) {
978
+ return this.eventEmitter.on(e, r), this;
979
+ }, t.prototype.once = function(e, r) {
980
+ return this.eventEmitter.once(e, r), this;
981
+ }, t.prototype.removeListener = function(e, r) {
982
+ return this.eventEmitter.removeListener(e, r), this;
983
+ }, t.prototype.removeAllListeners = function(e) {
984
+ return this.eventEmitter.removeAllListeners(e), this;
985
+ }, t.prototype.listeners = function(e) {
986
+ return this.eventEmitter.listeners(e);
987
+ }, t.prototype.listenerCount = function(e) {
988
+ return this.eventEmitter.listenerCount(e);
989
+ }, t.prototype.eventNames = function() {
990
+ return this.eventEmitter.eventNames();
991
+ }, t.prototype.emit = function(e) {
992
+ for (var r, n = [], i = 1; i < arguments.length; i++)
993
+ n[i - 1] = arguments[i];
994
+ return (r = this.eventEmitter).emit.apply(r, $e([e], n));
995
+ }, t;
996
+ }()
997
+ );
898
998
  function oe(t) {
899
- function e(V, N) {
900
- var H = V << N | V >>> 32 - N;
999
+ function e(V, L) {
1000
+ var H = V << L | V >>> 32 - L;
901
1001
  return H;
902
1002
  }
903
1003
  function r(V) {
904
- for (var N = "", H, R = 7; R >= 0; R--)
905
- H = V >>> R * 4 & 15, N += H.toString(16);
906
- return N;
1004
+ for (var L = "", H, R = 7; R >= 0; R--)
1005
+ H = V >>> R * 4 & 15, L += H.toString(16);
1006
+ return L;
907
1007
  }
908
1008
  function n(V) {
909
1009
  V = V.replace(/\r\n/g, `
910
1010
  `);
911
- for (var N = "", H = 0; H < V.length; H++) {
1011
+ for (var L = "", H = 0; H < V.length; H++) {
912
1012
  var R = V.charCodeAt(H);
913
- R < 128 ? N += String.fromCharCode(R) : R > 127 && R < 2048 ? (N += String.fromCharCode(R >> 6 | 192), N += String.fromCharCode(R & 63 | 128)) : (N += String.fromCharCode(R >> 12 | 224), N += String.fromCharCode(R >> 6 & 63 | 128), N += String.fromCharCode(R & 63 | 128));
1013
+ R < 128 ? L += String.fromCharCode(R) : R > 127 && R < 2048 ? (L += String.fromCharCode(R >> 6 | 192), L += String.fromCharCode(R & 63 | 128)) : (L += String.fromCharCode(R >> 12 | 224), L += String.fromCharCode(R >> 6 & 63 | 128), L += String.fromCharCode(R & 63 | 128));
914
1014
  }
915
- return N;
1015
+ return L;
916
1016
  }
917
- var i, o, s, a = new Array(80), c = 1732584193, u = 4023233417, l = 2562383102, h = 271733878, p = 3285377520, f, d, y, E, I, U;
1017
+ var i, o, s, a = new Array(80), c = 1732584193, u = 4023233417, l = 2562383102, h = 271733878, p = 3285377520, f, d, y, E, N, U;
918
1018
  t = n(t);
919
1019
  var D = t.length, F = new Array();
920
1020
  for (o = 0; o < D - 3; o += 4)
@@ -940,15 +1040,15 @@ function oe(t) {
940
1040
  a[o] = F[i + o];
941
1041
  for (o = 16; o <= 79; o++)
942
1042
  a[o] = e(a[o - 3] ^ a[o - 8] ^ a[o - 14] ^ a[o - 16], 1);
943
- for (f = c, d = u, y = l, E = h, I = p, o = 0; o <= 19; o++)
944
- U = e(f, 5) + (d & y | ~d & E) + I + a[o] + 1518500249 & 4294967295, I = E, E = y, y = e(d, 30), d = f, f = U;
1043
+ for (f = c, d = u, y = l, E = h, N = p, o = 0; o <= 19; o++)
1044
+ U = e(f, 5) + (d & y | ~d & E) + N + a[o] + 1518500249 & 4294967295, N = E, E = y, y = e(d, 30), d = f, f = U;
945
1045
  for (o = 20; o <= 39; o++)
946
- U = e(f, 5) + (d ^ y ^ E) + I + a[o] + 1859775393 & 4294967295, I = E, E = y, y = e(d, 30), d = f, f = U;
1046
+ U = e(f, 5) + (d ^ y ^ E) + N + a[o] + 1859775393 & 4294967295, N = E, E = y, y = e(d, 30), d = f, f = U;
947
1047
  for (o = 40; o <= 59; o++)
948
- U = e(f, 5) + (d & y | d & E | y & E) + I + a[o] + 2400959708 & 4294967295, I = E, E = y, y = e(d, 30), d = f, f = U;
1048
+ U = e(f, 5) + (d & y | d & E | y & E) + N + a[o] + 2400959708 & 4294967295, N = E, E = y, y = e(d, 30), d = f, f = U;
949
1049
  for (o = 60; o <= 79; o++)
950
- U = e(f, 5) + (d ^ y ^ E) + I + a[o] + 3395469782 & 4294967295, I = E, E = y, y = e(d, 30), d = f, f = U;
951
- c = c + f & 4294967295, u = u + d & 4294967295, l = l + y & 4294967295, h = h + E & 4294967295, p = p + I & 4294967295;
1050
+ U = e(f, 5) + (d ^ y ^ E) + N + a[o] + 3395469782 & 4294967295, N = E, E = y, y = e(d, 30), d = f, f = U;
1051
+ c = c + f & 4294967295, u = u + d & 4294967295, l = l + y & 4294967295, h = h + E & 4294967295, p = p + N & 4294967295;
952
1052
  }
953
1053
  return (r(c) + r(u) + r(l) + r(h) + r(p)).toLowerCase();
954
1054
  }
@@ -960,170 +1060,194 @@ var ue;
960
1060
  (function(t) {
961
1061
  t[t.Global = 0] = "Global", t[t.EuOnly = 1] = "EuOnly";
962
1062
  })(ue || (ue = {}));
963
- var Ee = function() {
964
- function t(e, r, n, i, o) {
965
- var s = this, a, c, u;
966
- if (this.requestTimeoutMs = 3e4, this.baseUrlOverriden = !1, this.proxy = "", this.offline = !1, !e)
967
- throw new Error("Invalid 'apiKey' value");
968
- switch (this.apiKey = e, this.clientVersion = r, this.dataGovernance = (a = n == null ? void 0 : n.dataGovernance) !== null && a !== void 0 ? a : ue.Global, this.dataGovernance) {
969
- case ue.EuOnly:
970
- this.baseUrl = "https://cdn-eu.configcat.com";
971
- break;
972
- default:
973
- this.baseUrl = "https://cdn-global.configcat.com";
974
- break;
975
- }
976
- var l = (c = o == null ? void 0 : o()) !== null && c !== void 0 ? c : new ot();
977
- this.hooks = new et(l), this.readyPromise = new Promise(function(f) {
978
- return s.hooks.once("clientReady", f);
979
- });
980
- var h, p;
981
- if (n) {
982
- if (h = n.logger, p = n.cache, n.requestTimeoutMs) {
983
- if (n.requestTimeoutMs < 0)
984
- throw new Error("Invalid 'requestTimeoutMs' value");
985
- this.requestTimeoutMs = n.requestTimeoutMs;
1063
+ var Ee = (
1064
+ /** @class */
1065
+ function() {
1066
+ function t(e, r, n, i, o) {
1067
+ var s = this, a, c, u;
1068
+ if (this.requestTimeoutMs = 3e4, this.baseUrlOverriden = !1, this.proxy = "", this.offline = !1, !e)
1069
+ throw new Error("Invalid 'apiKey' value");
1070
+ switch (this.apiKey = e, this.clientVersion = r, this.dataGovernance = (a = n == null ? void 0 : n.dataGovernance) !== null && a !== void 0 ? a : ue.Global, this.dataGovernance) {
1071
+ case ue.EuOnly:
1072
+ this.baseUrl = "https://cdn-eu.configcat.com";
1073
+ break;
1074
+ default:
1075
+ this.baseUrl = "https://cdn-global.configcat.com";
1076
+ break;
986
1077
  }
987
- n.baseUrl && (this.baseUrl = n.baseUrl, this.baseUrlOverriden = !0), n.proxy && (this.proxy = n.proxy), n.flagOverrides && (this.flagOverrides = n.flagOverrides), n.defaultUser && (this.defaultUser = n.defaultUser), n.offline && (this.offline = n.offline), (u = n.setupHooks) === null || u === void 0 || u.call(n, this.hooks);
1078
+ var l = (c = o == null ? void 0 : o()) !== null && c !== void 0 ? c : new it();
1079
+ this.hooks = new st(l), this.readyPromise = new Promise(function(f) {
1080
+ return s.hooks.once("clientReady", f);
1081
+ });
1082
+ var h, p;
1083
+ if (n) {
1084
+ if (h = n.logger, p = n.cache, n.requestTimeoutMs) {
1085
+ if (n.requestTimeoutMs < 0)
1086
+ throw new Error("Invalid 'requestTimeoutMs' value");
1087
+ this.requestTimeoutMs = n.requestTimeoutMs;
1088
+ }
1089
+ n.baseUrl && (this.baseUrl = n.baseUrl, this.baseUrlOverriden = !0), n.proxy && (this.proxy = n.proxy), n.flagOverrides && (this.flagOverrides = n.flagOverrides), n.defaultUser && (this.defaultUser = n.defaultUser), n.offline && (this.offline = n.offline), (u = n.setupHooks) === null || u === void 0 || u.call(n, this.hooks);
1090
+ }
1091
+ this.logger = new nt(h ?? new Be(), this.hooks), this.cache = p ? new ze(p, this.logger) : i ? i(this) : new rt();
988
1092
  }
989
- this.logger = new it(h ?? new Be(), this.hooks), this.cache = p ? new _e(p, this.logger) : i ? i(this) : new nt();
990
- }
991
- return t.prototype.getUrl = function() {
992
- return this.baseUrl + "/configuration-files/" + this.apiKey + "/" + t.configFileName + "?sdk=" + this.clientVersion;
993
- }, t.prototype.getCacheKey = function() {
994
- return oe(this.apiKey + "_" + t.configFileName + "_" + M.serializationFormatVersion);
995
- }, t.configFileName = "config_v5.json", t;
996
- }(), He = function(t) {
997
- B(e, t);
998
- function e(r, n, i, o, s, a) {
999
- var c = t.call(this, r, n + "/a-" + i, o, s, a) || this;
1000
- c.pollIntervalSeconds = 60, c.maxInitWaitTimeSeconds = 5, o && (o.pollIntervalSeconds !== void 0 && o.pollIntervalSeconds !== null && (c.pollIntervalSeconds = o.pollIntervalSeconds), o.maxInitWaitTimeSeconds !== void 0 && o.maxInitWaitTimeSeconds !== null && (c.maxInitWaitTimeSeconds = o.maxInitWaitTimeSeconds));
1001
- var u = 2147483;
1002
- if (!(typeof c.pollIntervalSeconds == "number" && 1 <= c.pollIntervalSeconds && c.pollIntervalSeconds <= u))
1003
- throw new Error("Invalid 'pollIntervalSeconds' value");
1004
- if (!(typeof c.maxInitWaitTimeSeconds == "number" && c.maxInitWaitTimeSeconds <= u))
1005
- throw new Error("Invalid 'maxInitWaitTimeSeconds' value");
1006
- return c;
1007
- }
1008
- return e;
1009
- }(Ee), je = function(t) {
1010
- B(e, t);
1011
- function e(r, n, i, o, s, a) {
1012
- return t.call(this, r, n + "/m-" + i, o, s, a) || this;
1013
- }
1014
- return e;
1015
- }(Ee), qe = function(t) {
1016
- B(e, t);
1017
- function e(r, n, i, o, s, a) {
1018
- var c = t.call(this, r, n + "/l-" + i, o, s, a) || this;
1019
- if (c.cacheTimeToLiveSeconds = 60, o && o.cacheTimeToLiveSeconds !== void 0 && o.cacheTimeToLiveSeconds !== null && (c.cacheTimeToLiveSeconds = o.cacheTimeToLiveSeconds), !(typeof c.cacheTimeToLiveSeconds == "number" && 1 <= c.cacheTimeToLiveSeconds && c.cacheTimeToLiveSeconds <= 2147483647))
1020
- throw new Error("Invalid 'cacheTimeToLiveSeconds' value");
1021
- return c;
1022
- }
1023
- return e;
1024
- }(Ee), P;
1093
+ return t.prototype.getUrl = function() {
1094
+ return this.baseUrl + "/configuration-files/" + this.apiKey + "/" + t.configFileName + "?sdk=" + this.clientVersion;
1095
+ }, t.prototype.getCacheKey = function() {
1096
+ return oe(this.apiKey + "_" + t.configFileName + "_" + M.serializationFormatVersion);
1097
+ }, t.configFileName = "config_v5.json", t;
1098
+ }()
1099
+ ), He = (
1100
+ /** @class */
1101
+ function(t) {
1102
+ B(e, t);
1103
+ function e(r, n, i, o, s, a) {
1104
+ var c = t.call(this, r, n + "/a-" + i, o, s, a) || this;
1105
+ c.pollIntervalSeconds = 60, c.maxInitWaitTimeSeconds = 5, o && (o.pollIntervalSeconds !== void 0 && o.pollIntervalSeconds !== null && (c.pollIntervalSeconds = o.pollIntervalSeconds), o.maxInitWaitTimeSeconds !== void 0 && o.maxInitWaitTimeSeconds !== null && (c.maxInitWaitTimeSeconds = o.maxInitWaitTimeSeconds));
1106
+ var u = 2147483;
1107
+ if (!(typeof c.pollIntervalSeconds == "number" && 1 <= c.pollIntervalSeconds && c.pollIntervalSeconds <= u))
1108
+ throw new Error("Invalid 'pollIntervalSeconds' value");
1109
+ if (!(typeof c.maxInitWaitTimeSeconds == "number" && c.maxInitWaitTimeSeconds <= u))
1110
+ throw new Error("Invalid 'maxInitWaitTimeSeconds' value");
1111
+ return c;
1112
+ }
1113
+ return e;
1114
+ }(Ee)
1115
+ ), je = (
1116
+ /** @class */
1117
+ function(t) {
1118
+ B(e, t);
1119
+ function e(r, n, i, o, s, a) {
1120
+ return t.call(this, r, n + "/m-" + i, o, s, a) || this;
1121
+ }
1122
+ return e;
1123
+ }(Ee)
1124
+ ), qe = (
1125
+ /** @class */
1126
+ function(t) {
1127
+ B(e, t);
1128
+ function e(r, n, i, o, s, a) {
1129
+ var c = t.call(this, r, n + "/l-" + i, o, s, a) || this;
1130
+ if (c.cacheTimeToLiveSeconds = 60, o && o.cacheTimeToLiveSeconds !== void 0 && o.cacheTimeToLiveSeconds !== null && (c.cacheTimeToLiveSeconds = o.cacheTimeToLiveSeconds), !(typeof c.cacheTimeToLiveSeconds == "number" && 1 <= c.cacheTimeToLiveSeconds && c.cacheTimeToLiveSeconds <= 2147483647))
1131
+ throw new Error("Invalid 'cacheTimeToLiveSeconds' value");
1132
+ return c;
1133
+ }
1134
+ return e;
1135
+ }(Ee)
1136
+ ), P;
1025
1137
  (function(t) {
1026
1138
  t[t.LocalOnly = 0] = "LocalOnly", t[t.LocalOverRemote = 1] = "LocalOverRemote", t[t.RemoteOverLocal = 2] = "RemoteOverLocal";
1027
1139
  })(P || (P = {}));
1028
- var st = function() {
1029
- function t(e) {
1030
- this.map = {}, this.map = Object.fromEntries(Object.entries(e).map(function(r) {
1031
- var n = r[0], i = r[1];
1032
- return [n, ze.fromValue(i)];
1033
- }));
1034
- }
1035
- return t.prototype.getOverrides = function() {
1036
- return Promise.resolve(this.map);
1037
- }, t.prototype.getOverridesSync = function() {
1038
- return this.map;
1039
- }, t;
1040
- }(), at = function() {
1041
- function t(e, r) {
1042
- this.dataSource = e, this.behaviour = r;
1043
- }
1044
- return t;
1045
- }(), ut = function(t) {
1046
- B(e, t);
1047
- function e(r, n) {
1048
- var i = t.call(this, r, n) || this;
1049
- return i.cacheTimeToLiveMs = n.cacheTimeToLiveSeconds * 1e3, t.prototype.syncUpWithCache.call(i), i;
1050
- }
1051
- return e.prototype.getConfig = function() {
1052
- return S(this, void 0, void 0, function() {
1053
- function r(o, s) {
1054
- s === void 0 && (s = ""), o.debug("LazyLoadConfigService.getConfig(): cache is empty or expired" + s + ".");
1055
- }
1056
- var n, i;
1057
- return O(this, function(o) {
1058
- switch (o.label) {
1059
- case 0:
1060
- return this.options.logger.debug("LazyLoadConfigService.getConfig() called."), [4, this.options.cache.get(this.cacheKey)];
1061
- case 1:
1062
- return n = o.sent(), n.isExpired(this.cacheTimeToLiveMs) ? this.isOffline ? [3, 3] : (r(this.options.logger, ", calling refreshConfigCoreAsync()"), [4, this.refreshConfigCoreAsync(n)]) : [3, 5];
1063
- case 2:
1064
- return i = o.sent(), n = i[1], [3, 4];
1065
- case 3:
1066
- r(this.options.logger), o.label = 4;
1067
- case 4:
1068
- return [2, n];
1069
- case 5:
1070
- return this.options.logger.debug("LazyLoadConfigService.getConfig(): cache is valid, returning from cache."), [2, n];
1140
+ var at = (
1141
+ /** @class */
1142
+ function() {
1143
+ function t(e) {
1144
+ this.map = {}, this.map = Object.fromEntries(Object.entries(e).map(function(r) {
1145
+ var n = r[0], i = r[1];
1146
+ return [n, _e.fromValue(i)];
1147
+ }));
1148
+ }
1149
+ return t.prototype.getOverrides = function() {
1150
+ return Promise.resolve(this.map);
1151
+ }, t.prototype.getOverridesSync = function() {
1152
+ return this.map;
1153
+ }, t;
1154
+ }()
1155
+ ), ut = (
1156
+ /** @class */
1157
+ function() {
1158
+ function t(e, r) {
1159
+ this.dataSource = e, this.behaviour = r;
1160
+ }
1161
+ return t;
1162
+ }()
1163
+ ), ct = (
1164
+ /** @class */
1165
+ function(t) {
1166
+ B(e, t);
1167
+ function e(r, n) {
1168
+ var i = t.call(this, r, n) || this;
1169
+ return i.cacheTimeToLiveMs = n.cacheTimeToLiveSeconds * 1e3, t.prototype.syncUpWithCache.call(i), i;
1170
+ }
1171
+ return e.prototype.getConfig = function() {
1172
+ return S(this, void 0, void 0, function() {
1173
+ function r(o, s) {
1174
+ s === void 0 && (s = ""), o.debug("LazyLoadConfigService.getConfig(): cache is empty or expired" + s + ".");
1071
1175
  }
1176
+ var n, i;
1177
+ return O(this, function(o) {
1178
+ switch (o.label) {
1179
+ case 0:
1180
+ return this.options.logger.debug("LazyLoadConfigService.getConfig() called."), [4, this.options.cache.get(this.cacheKey)];
1181
+ case 1:
1182
+ return n = o.sent(), n.isExpired(this.cacheTimeToLiveMs) ? this.isOffline ? [3, 3] : (r(this.options.logger, ", calling refreshConfigCoreAsync()"), [4, this.refreshConfigCoreAsync(n)]) : [3, 5];
1183
+ case 2:
1184
+ return i = o.sent(), n = i[1], [3, 4];
1185
+ case 3:
1186
+ r(this.options.logger), o.label = 4;
1187
+ case 4:
1188
+ return [2, n];
1189
+ case 5:
1190
+ return this.options.logger.debug("LazyLoadConfigService.getConfig(): cache is valid, returning from cache."), [2, n];
1191
+ }
1192
+ });
1072
1193
  });
1073
- });
1074
- }, e.prototype.refreshConfigAsync = function() {
1075
- return this.options.logger.debug("LazyLoadConfigService.refreshConfigAsync() called."), t.prototype.refreshConfigAsync.call(this);
1076
- }, e.prototype.getReadyState = function(r) {
1077
- return r.isEmpty ? L.NoFlagData : r.isExpired(this.cacheTimeToLiveMs) ? L.HasCachedFlagDataOnly : L.HasUpToDateFlagData;
1078
- }, e;
1079
- }(me), ct = function(t) {
1080
- B(e, t);
1081
- function e(r, n) {
1082
- var i = t.call(this, r, n) || this;
1083
- return t.prototype.syncUpWithCache.call(i), i;
1084
- }
1085
- return e.prototype.getReadyState = function(r) {
1086
- return r.isEmpty ? L.NoFlagData : L.HasCachedFlagDataOnly;
1087
- }, e.prototype.getConfig = function() {
1088
- return S(this, void 0, void 0, function() {
1089
- return O(this, function(r) {
1090
- switch (r.label) {
1091
- case 0:
1092
- return this.options.logger.debug("ManualPollService.getConfig() called."), [4, this.options.cache.get(this.cacheKey)];
1093
- case 1:
1094
- return [2, r.sent()];
1095
- }
1194
+ }, e.prototype.refreshConfigAsync = function() {
1195
+ return this.options.logger.debug("LazyLoadConfigService.refreshConfigAsync() called."), t.prototype.refreshConfigAsync.call(this);
1196
+ }, e.prototype.getCacheState = function(r) {
1197
+ return r.isEmpty ? T.NoFlagData : r.isExpired(this.cacheTimeToLiveMs) ? T.HasCachedFlagDataOnly : T.HasUpToDateFlagData;
1198
+ }, e;
1199
+ }(me)
1200
+ ), lt = (
1201
+ /** @class */
1202
+ function(t) {
1203
+ B(e, t);
1204
+ function e(r, n) {
1205
+ var i = t.call(this, r, n) || this;
1206
+ return t.prototype.syncUpWithCache.call(i), i;
1207
+ }
1208
+ return e.prototype.getCacheState = function(r) {
1209
+ return r.isEmpty ? T.NoFlagData : T.HasCachedFlagDataOnly;
1210
+ }, e.prototype.getConfig = function() {
1211
+ return S(this, void 0, void 0, function() {
1212
+ return O(this, function(r) {
1213
+ switch (r.label) {
1214
+ case 0:
1215
+ return this.options.logger.debug("ManualPollService.getConfig() called."), [4, this.options.cache.get(this.cacheKey)];
1216
+ case 1:
1217
+ return [2, r.sent()];
1218
+ }
1219
+ });
1096
1220
  });
1097
- });
1098
- }, e.prototype.refreshConfigAsync = function() {
1099
- return this.options.logger.debug("ManualPollService.refreshConfigAsync() called."), t.prototype.refreshConfigAsync.call(this);
1100
- }, e;
1101
- }(me);
1102
- function lt() {
1103
- typeof Object.values > "u" && (Object.values = ft), typeof Object.entries > "u" && (Object.entries = ht), typeof Object.fromEntries > "u" && (Object.fromEntries = gt);
1221
+ }, e.prototype.refreshConfigAsync = function() {
1222
+ return this.options.logger.debug("ManualPollService.refreshConfigAsync() called."), t.prototype.refreshConfigAsync.call(this);
1223
+ }, e;
1224
+ }(me)
1225
+ );
1226
+ function ft() {
1227
+ typeof Object.values > "u" && (Object.values = ht), typeof Object.entries > "u" && (Object.entries = gt), typeof Object.fromEntries > "u" && (Object.fromEntries = pt);
1104
1228
  }
1105
- function ft(t) {
1229
+ function ht(t) {
1106
1230
  for (var e = [], r = 0, n = Object.keys(t); r < n.length; r++) {
1107
1231
  var i = n[r];
1108
1232
  e.push(t[i]);
1109
1233
  }
1110
1234
  return e;
1111
1235
  }
1112
- function ht(t) {
1236
+ function gt(t) {
1113
1237
  for (var e = [], r = 0, n = Object.keys(t); r < n.length; r++) {
1114
1238
  var i = n[r];
1115
1239
  e.push([i, t[i]]);
1116
1240
  }
1117
1241
  return e;
1118
1242
  }
1119
- function gt(t) {
1243
+ function pt(t) {
1120
1244
  var e, r = {};
1121
1245
  if (Array.isArray(t))
1122
1246
  for (var n = 0, i = t; n < i.length; n++) {
1123
1247
  var o = i[n], s = o[0], a = o[1];
1124
1248
  r[s] = a;
1125
1249
  }
1126
- else if (typeof Symbol < "u" && (t == null ? void 0 : t[Symbol.iterator]))
1250
+ else if (typeof Symbol < "u" && (t != null && t[Symbol.iterator]))
1127
1251
  for (var c = t[Symbol.iterator](), u = void 0, l = void 0; e = c.next(), u = e.value, l = e.done, !l; ) {
1128
1252
  var s = u[0], a = u[1];
1129
1253
  r[s] = a;
@@ -1132,7 +1256,7 @@ function gt(t) {
1132
1256
  throw new TypeError("Object.fromEntries() requires a single iterable argument");
1133
1257
  return r;
1134
1258
  }
1135
- function pt() {
1259
+ function dt() {
1136
1260
  var t = function(e) {
1137
1261
  this.target = e;
1138
1262
  };
@@ -1140,13 +1264,14 @@ function pt() {
1140
1264
  return this.target;
1141
1265
  }, t.isFallback = !0, t;
1142
1266
  }
1143
- var dt = function() {
1267
+ var vt = function() {
1144
1268
  return typeof WeakRef == "function";
1145
1269
  }, We = /^[0-9]+$/, $ = function(t, e) {
1146
1270
  var r = We.test(t), n = We.test(e);
1147
1271
  return r && n && (t = +t, e = +e), t === e ? 0 : r && !n ? -1 : n && !r ? 1 : t < e ? -1 : 1;
1148
- }, ve = 256, te = Number.MAX_SAFE_INTEGER || 9007199254740991, Z = [], b = [], m = {}, vt = 0, w = function(t, e) {
1149
- var r = vt++;
1272
+ }, ve = 256, te = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
1273
+ 9007199254740991, Z = [], b = [], m = {}, yt = 0, w = function(t, e) {
1274
+ var r = yt++;
1150
1275
  m[t] = r, b[r] = e, Z[r] = new RegExp(e);
1151
1276
  };
1152
1277
  w("NUMERICIDENTIFIER", "0|[1-9]\\d*");
@@ -1164,125 +1289,128 @@ w("FULLPLAIN", "v?" + b[m.MAINVERSION] + b[m.PRERELEASE] + "?" + b[m.BUILD] + "?
1164
1289
  w("FULL", "^" + b[m.FULLPLAIN] + "$");
1165
1290
  w("LOOSEPLAIN", "[v=\\s]*" + b[m.MAINVERSIONLOOSE] + b[m.PRERELEASELOOSE] + "?" + b[m.BUILD] + "?");
1166
1291
  w("LOOSE", "^" + b[m.LOOSEPLAIN] + "$");
1167
- var ce = function() {
1168
- function t(e, r) {
1169
- if ((!r || typeof r != "object") && (r = {
1170
- loose: !!r,
1171
- includePrerelease: !1
1172
- }), e instanceof t) {
1173
- if (e.loose === !!r.loose && e.includePrerelease === !!r.includePrerelease)
1174
- return e;
1175
- e = e.version;
1176
- } else if (typeof e != "string")
1177
- throw new TypeError("Invalid Version: " + e);
1178
- if (e.length > ve)
1179
- throw new TypeError("version is longer than " + ve + " characters");
1180
- this.options = r, this.loose = !!r.loose, this.includePrerelease = !!r.includePrerelease;
1181
- var n = e.trim().match(r.loose ? Z[m.LOOSE] : Z[m.FULL]);
1182
- if (!n)
1183
- throw new TypeError("Invalid Version: " + e);
1184
- if (this.raw = e, this.major = +n[1], this.minor = +n[2], this.patch = +n[3], this.major > te || this.major < 0)
1185
- throw new TypeError("Invalid major version");
1186
- if (this.minor > te || this.minor < 0)
1187
- throw new TypeError("Invalid minor version");
1188
- if (this.patch > te || this.patch < 0)
1189
- throw new TypeError("Invalid patch version");
1190
- n[4] ? this.prerelease = n[4].split(".").map(function(i) {
1191
- if (/^[0-9]+$/.test(i)) {
1192
- var o = +i;
1193
- if (o >= 0 && o < te)
1194
- return o;
1195
- }
1196
- return i;
1197
- }) : this.prerelease = [], this.build = n[5] ? n[5].split(".") : [], this.format();
1198
- }
1199
- return t.prototype.format = function() {
1200
- return this.version = this.major + "." + this.minor + "." + this.patch, this.prerelease.length && (this.version += "-" + this.prerelease.join(".")), this.version;
1201
- }, t.prototype.toString = function() {
1202
- return this.version;
1203
- }, t.prototype.compare = function(e) {
1204
- if (!(e instanceof t)) {
1205
- if (typeof e == "string" && e === this.version)
1206
- return 0;
1207
- e = new t(e, this.options);
1292
+ var ce = (
1293
+ /** @class */
1294
+ function() {
1295
+ function t(e, r) {
1296
+ if ((!r || typeof r != "object") && (r = {
1297
+ loose: !!r,
1298
+ includePrerelease: !1
1299
+ }), e instanceof t) {
1300
+ if (e.loose === !!r.loose && e.includePrerelease === !!r.includePrerelease)
1301
+ return e;
1302
+ e = e.version;
1303
+ } else if (typeof e != "string")
1304
+ throw new TypeError("Invalid Version: " + e);
1305
+ if (e.length > ve)
1306
+ throw new TypeError("version is longer than " + ve + " characters");
1307
+ this.options = r, this.loose = !!r.loose, this.includePrerelease = !!r.includePrerelease;
1308
+ var n = e.trim().match(r.loose ? Z[m.LOOSE] : Z[m.FULL]);
1309
+ if (!n)
1310
+ throw new TypeError("Invalid Version: " + e);
1311
+ if (this.raw = e, this.major = +n[1], this.minor = +n[2], this.patch = +n[3], this.major > te || this.major < 0)
1312
+ throw new TypeError("Invalid major version");
1313
+ if (this.minor > te || this.minor < 0)
1314
+ throw new TypeError("Invalid minor version");
1315
+ if (this.patch > te || this.patch < 0)
1316
+ throw new TypeError("Invalid patch version");
1317
+ n[4] ? this.prerelease = n[4].split(".").map(function(i) {
1318
+ if (/^[0-9]+$/.test(i)) {
1319
+ var o = +i;
1320
+ if (o >= 0 && o < te)
1321
+ return o;
1322
+ }
1323
+ return i;
1324
+ }) : this.prerelease = [], this.build = n[5] ? n[5].split(".") : [], this.format();
1208
1325
  }
1209
- return e.version === this.version ? 0 : this.compareMain(e) || this.comparePre(e);
1210
- }, t.prototype.compareMain = function(e) {
1211
- return e instanceof t || (e = new t(e, this.options)), $(this.major, e.major) || $(this.minor, e.minor) || $(this.patch, e.patch);
1212
- }, t.prototype.comparePre = function(e) {
1213
- if (e instanceof t || (e = new t(e, this.options)), this.prerelease.length && !e.prerelease.length)
1214
- return -1;
1215
- if (!this.prerelease.length && e.prerelease.length)
1216
- return 1;
1217
- if (!this.prerelease.length && !e.prerelease.length)
1218
- return 0;
1219
- var r = 0;
1220
- do {
1221
- var n = this.prerelease[r], i = e.prerelease[r];
1222
- if (n === void 0 && i === void 0)
1223
- return 0;
1224
- if (i === void 0)
1225
- return 1;
1226
- if (n === void 0)
1326
+ return t.prototype.format = function() {
1327
+ return this.version = this.major + "." + this.minor + "." + this.patch, this.prerelease.length && (this.version += "-" + this.prerelease.join(".")), this.version;
1328
+ }, t.prototype.toString = function() {
1329
+ return this.version;
1330
+ }, t.prototype.compare = function(e) {
1331
+ if (!(e instanceof t)) {
1332
+ if (typeof e == "string" && e === this.version)
1333
+ return 0;
1334
+ e = new t(e, this.options);
1335
+ }
1336
+ return e.version === this.version ? 0 : this.compareMain(e) || this.comparePre(e);
1337
+ }, t.prototype.compareMain = function(e) {
1338
+ return e instanceof t || (e = new t(e, this.options)), $(this.major, e.major) || $(this.minor, e.minor) || $(this.patch, e.patch);
1339
+ }, t.prototype.comparePre = function(e) {
1340
+ if (e instanceof t || (e = new t(e, this.options)), this.prerelease.length && !e.prerelease.length)
1227
1341
  return -1;
1228
- if (n === i)
1229
- continue;
1230
- return $(n, i);
1231
- } while (++r);
1232
- }, t.prototype.compareBuild = function(e) {
1233
- e instanceof t || (e = new t(e, this.options));
1234
- var r = 0;
1235
- do {
1236
- var n = this.build[r], i = e.build[r];
1237
- if (n === void 0 && i === void 0)
1238
- return 0;
1239
- if (i === void 0)
1342
+ if (!this.prerelease.length && e.prerelease.length)
1240
1343
  return 1;
1241
- if (n === void 0)
1242
- return -1;
1243
- if (n === i)
1244
- continue;
1245
- return $(n, i);
1246
- } while (++r);
1247
- }, t.prototype.inc = function(e, r) {
1248
- switch (e) {
1249
- case "premajor":
1250
- this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", r);
1251
- break;
1252
- case "preminor":
1253
- this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", r);
1254
- break;
1255
- case "prepatch":
1256
- this.prerelease.length = 0, this.inc("patch", r), this.inc("pre", r);
1257
- break;
1258
- case "prerelease":
1259
- this.prerelease.length === 0 && this.inc("patch", r), this.inc("pre", r);
1260
- break;
1261
- case "major":
1262
- (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
1263
- break;
1264
- case "minor":
1265
- (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
1266
- break;
1267
- case "patch":
1268
- this.prerelease.length === 0 && this.patch++, this.prerelease = [];
1269
- break;
1270
- case "pre":
1271
- if (this.prerelease.length === 0)
1272
- this.prerelease = [0];
1273
- else {
1274
- for (var n = this.prerelease.length; --n >= 0; )
1275
- typeof this.prerelease[n] == "number" && (this.prerelease[n]++, n = -2);
1276
- n === -1 && this.prerelease.push(0);
1277
- }
1278
- r && (this.prerelease[0] === r ? isNaN(this.prerelease[1]) && (this.prerelease = [r, 0]) : this.prerelease = [r, 0]);
1279
- break;
1280
- default:
1281
- throw new Error("invalid increment argument: " + e);
1282
- }
1283
- return this.format(), this.raw = this.version, this;
1284
- }, t;
1285
- }(), yt = function(t, e) {
1344
+ if (!this.prerelease.length && !e.prerelease.length)
1345
+ return 0;
1346
+ var r = 0;
1347
+ do {
1348
+ var n = this.prerelease[r], i = e.prerelease[r];
1349
+ if (n === void 0 && i === void 0)
1350
+ return 0;
1351
+ if (i === void 0)
1352
+ return 1;
1353
+ if (n === void 0)
1354
+ return -1;
1355
+ if (n === i)
1356
+ continue;
1357
+ return $(n, i);
1358
+ } while (++r);
1359
+ }, t.prototype.compareBuild = function(e) {
1360
+ e instanceof t || (e = new t(e, this.options));
1361
+ var r = 0;
1362
+ do {
1363
+ var n = this.build[r], i = e.build[r];
1364
+ if (n === void 0 && i === void 0)
1365
+ return 0;
1366
+ if (i === void 0)
1367
+ return 1;
1368
+ if (n === void 0)
1369
+ return -1;
1370
+ if (n === i)
1371
+ continue;
1372
+ return $(n, i);
1373
+ } while (++r);
1374
+ }, t.prototype.inc = function(e, r) {
1375
+ switch (e) {
1376
+ case "premajor":
1377
+ this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", r);
1378
+ break;
1379
+ case "preminor":
1380
+ this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", r);
1381
+ break;
1382
+ case "prepatch":
1383
+ this.prerelease.length = 0, this.inc("patch", r), this.inc("pre", r);
1384
+ break;
1385
+ case "prerelease":
1386
+ this.prerelease.length === 0 && this.inc("patch", r), this.inc("pre", r);
1387
+ break;
1388
+ case "major":
1389
+ (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
1390
+ break;
1391
+ case "minor":
1392
+ (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
1393
+ break;
1394
+ case "patch":
1395
+ this.prerelease.length === 0 && this.patch++, this.prerelease = [];
1396
+ break;
1397
+ case "pre":
1398
+ if (this.prerelease.length === 0)
1399
+ this.prerelease = [0];
1400
+ else {
1401
+ for (var n = this.prerelease.length; --n >= 0; )
1402
+ typeof this.prerelease[n] == "number" && (this.prerelease[n]++, n = -2);
1403
+ n === -1 && this.prerelease.push(0);
1404
+ }
1405
+ r && (this.prerelease[0] === r ? isNaN(this.prerelease[1]) && (this.prerelease = [r, 0]) : this.prerelease = [r, 0]);
1406
+ break;
1407
+ default:
1408
+ throw new Error("invalid increment argument: " + e);
1409
+ }
1410
+ return this.format(), this.raw = this.version, this;
1411
+ }, t;
1412
+ }()
1413
+ ), mt = function(t, e) {
1286
1414
  if ((!e || typeof e != "object") && (e = {
1287
1415
  loose: !!e,
1288
1416
  includePrerelease: !1
@@ -1301,257 +1429,266 @@ var ce = function() {
1301
1429
  }, G = function(t, e, r) {
1302
1430
  return new ce(t, r).compare(new ce(e, r));
1303
1431
  }, W = function(t) {
1304
- var e = yt(t, !1);
1432
+ var e = mt(t, !1);
1305
1433
  return e ? e.version : null;
1306
- }, mt = function(t, e) {
1307
- return G(t, e, !0) === 0;
1308
1434
  }, Et = function(t, e) {
1309
- return G(t, e, !1) === 0;
1435
+ return G(t, e, !0) === 0;
1310
1436
  }, bt = function(t, e) {
1311
- return G(t, e, !1) < 0;
1437
+ return G(t, e, !1) === 0;
1312
1438
  }, St = function(t, e) {
1313
- return G(t, e, !1) <= 0;
1439
+ return G(t, e, !1) < 0;
1314
1440
  }, Ot = function(t, e) {
1315
- return G(t, e, !1) > 0;
1441
+ return G(t, e, !1) <= 0;
1316
1442
  }, Ct = function(t, e) {
1443
+ return G(t, e, !1) > 0;
1444
+ }, At = function(t, e) {
1317
1445
  return G(t, e, !1) >= 0;
1318
- }, jt = function() {
1319
- function t(e, r, n, i) {
1320
- this.custom = {}, this.identifier = e, this.email = r, this.country = n, this.custom = i || {};
1321
- }
1322
- return t;
1323
- }(), At = function() {
1324
- function t(e) {
1325
- this.logger = e;
1326
- }
1327
- return t.prototype.evaluate = function(e, r, n, i, o) {
1328
- if (this.logger.debug("RolloutEvaluator.Evaluate() called."), e.type < 0 && !Je(e.value))
1329
- throw new TypeError(e.value === null ? "Setting value is null." : e.value === void 0 ? "Setting value is undefined." : "Setting value '" + e.value + "' is of an unsupported type (" + typeof e.value + ").");
1330
- var s = new wt();
1331
- s.user = i, s.keyName = r, s.returnValue = n;
1332
- var a;
1333
- try {
1334
- if (i) {
1335
- if (a = this.evaluateRules(e.targetingRules, i, s), a !== null || (a = this.evaluatePercentageRules(e.percentageOptions, r, i), e.percentageOptions && e.percentageOptions.length > 0 && s.opAppendLine("Evaluating % options => " + (a ? "user targeted" : "user not targeted")), a !== null))
1336
- return s.returnValue = a.value, a;
1337
- } else
1338
- (e.targetingRules && e.targetingRules.length > 0 || e.percentageOptions && e.percentageOptions.length > 0) && this.logger.targetingIsNotPossible(r);
1339
- return a = {
1340
- value: e.value,
1341
- variationId: e.variationId
1342
- }, s.returnValue = a.value, a;
1343
- } finally {
1344
- this.logger.settingEvaluated(s);
1446
+ }, Wt = (
1447
+ /** @class */
1448
+ function() {
1449
+ function t(e, r, n, i) {
1450
+ this.custom = {}, this.identifier = e, this.email = r, this.country = n, this.custom = i || {};
1345
1451
  }
1346
- }, t.prototype.evaluateRules = function(e, r, n) {
1347
- if (this.logger.debug("RolloutEvaluator.EvaluateRules() called."), e && e.length > 0)
1348
- for (var i = function(c) {
1349
- var u = e[c], l = o.getUserAttribute(r, u.comparisonAttribute), h = u.comparator, p = u.comparisonValue, f = "Evaluating rule: '" + l + "' " + o.ruleToString(h) + " '" + p + "' => ";
1350
- if (!l)
1351
- return f += "NO MATCH (Attribute is not defined on the user object)", n.opAppendLine(f), "continue";
1352
- var d = {
1353
- value: u.value,
1354
- variationId: u.variationId,
1355
- matchedTargetingRule: u
1356
- };
1357
- switch (h) {
1358
- case g.In:
1359
- for (var y = p.split(","), E = 0; E < y.length; E++)
1360
- if (y[E].trim() === l)
1361
- return f += "MATCH", n.opAppendLine(f), { value: d };
1362
- f += "no match";
1363
- break;
1364
- case g.NotIn:
1365
- if (!p.split(",").some(function(F) {
1366
- return F.trim() === l;
1367
- }))
1368
- return f += "MATCH", n.opAppendLine(f), { value: d };
1369
- f += "no match";
1370
- break;
1371
- case g.Contains:
1372
- if (l.indexOf(p) !== -1)
1373
- return f += "MATCH", n.opAppendLine(f), { value: d };
1374
- f += "no match";
1375
- break;
1376
- case g.NotContains:
1377
- if (l.indexOf(p) === -1)
1378
- return f += "MATCH", n.opAppendLine(f), { value: d };
1379
- f += "no match";
1380
- break;
1381
- case g.SemVerIn:
1382
- case g.SemVerNotIn:
1383
- case g.SemVerLessThan:
1384
- case g.SemVerLessThanEqual:
1385
- case g.SemVerGreaterThan:
1386
- case g.SemVerGreaterThanEqual:
1387
- if (o.evaluateSemver(l, p, h))
1388
- return f += "MATCH", n.opAppendLine(f), { value: d };
1389
- f += "no match";
1390
- break;
1391
- case g.NumberEqual:
1392
- case g.NumberNotEqual:
1393
- case g.NumberLessThan:
1394
- case g.NumberLessThanEqual:
1395
- case g.NumberGreaterThan:
1396
- case g.NumberGreaterThanEqual:
1397
- if (o.evaluateNumber(l, p, h))
1398
- return f += "MATCH", n.opAppendLine(f), { value: d };
1399
- f += "no match";
1400
- break;
1401
- case g.SensitiveOneOf: {
1402
- for (var I = p.split(","), U = oe(l), E = 0; E < I.length; E++)
1403
- if (I[E].trim() === U)
1404
- return f += "MATCH", n.opAppendLine(f), { value: d };
1405
- f += "no match";
1406
- break;
1407
- }
1408
- case g.SensitiveNotOneOf: {
1409
- var D = oe(l);
1410
- if (!p.split(",").some(function(F) {
1411
- return F.trim() === D;
1412
- }))
1413
- return f += "MATCH", n.opAppendLine(f), { value: d };
1414
- f += "no match";
1415
- break;
1416
- }
1417
- }
1418
- n.opAppendLine(f);
1419
- }, o = this, s = 0; s < e.length; s++) {
1420
- var a = i(s);
1421
- if (typeof a == "object")
1422
- return a.value;
1452
+ return t;
1453
+ }()
1454
+ ), Tt = (
1455
+ /** @class */
1456
+ function() {
1457
+ function t(e) {
1458
+ this.logger = e;
1459
+ }
1460
+ return t.prototype.evaluate = function(e, r, n, i, o) {
1461
+ if (this.logger.debug("RolloutEvaluator.Evaluate() called."), e.type < 0 && !Je(e.value))
1462
+ throw new TypeError(e.value === null ? "Setting value is null." : e.value === void 0 ? "Setting value is undefined." : "Setting value '" + e.value + "' is of an unsupported type (" + typeof e.value + ").");
1463
+ var s = new wt();
1464
+ s.user = i, s.keyName = r, s.returnValue = n;
1465
+ var a;
1466
+ try {
1467
+ if (i) {
1468
+ if (a = this.evaluateRules(e.targetingRules, i, s), a !== null || (a = this.evaluatePercentageRules(e.percentageOptions, r, i), e.percentageOptions && e.percentageOptions.length > 0 && s.opAppendLine("Evaluating % options => " + (a ? "user targeted" : "user not targeted")), a !== null))
1469
+ return s.returnValue = a.value, a;
1470
+ } else
1471
+ (e.targetingRules && e.targetingRules.length > 0 || e.percentageOptions && e.percentageOptions.length > 0) && this.logger.targetingIsNotPossible(r);
1472
+ return a = {
1473
+ value: e.value,
1474
+ variationId: e.variationId
1475
+ }, s.returnValue = a.value, a;
1476
+ } finally {
1477
+ this.logger.settingEvaluated(s);
1423
1478
  }
1424
- return null;
1425
- }, t.prototype.evaluatePercentageRules = function(e, r, n) {
1426
- if (this.logger.debug("RolloutEvaluator.EvaluateVariations() called."), e && e.length > 0)
1427
- for (var i = r + (n.identifier === null || n.identifier === void 0 ? "" : n.identifier), o = oe(i).substring(0, 7), s = parseInt(o, 16) % 100, a = 0, c = 0; c < e.length; c++) {
1428
- var u = e[c];
1429
- if (a += +u.percentage, s < a)
1430
- return {
1479
+ }, t.prototype.evaluateRules = function(e, r, n) {
1480
+ if (this.logger.debug("RolloutEvaluator.EvaluateRules() called."), e && e.length > 0)
1481
+ for (var i = function(c) {
1482
+ var u = e[c], l = o.getUserAttribute(r, u.comparisonAttribute), h = u.comparator, p = u.comparisonValue, f = "Evaluating rule: '" + l + "' " + o.ruleToString(h) + " '" + p + "' => ";
1483
+ if (!l)
1484
+ return f += "NO MATCH (Attribute is not defined on the user object)", n.opAppendLine(f), "continue";
1485
+ var d = {
1431
1486
  value: u.value,
1432
1487
  variationId: u.variationId,
1433
- matchedPercentageOption: u
1488
+ matchedTargetingRule: u
1434
1489
  };
1490
+ switch (h) {
1491
+ case g.In:
1492
+ for (var y = p.split(","), E = 0; E < y.length; E++)
1493
+ if (y[E].trim() === l)
1494
+ return f += "MATCH", n.opAppendLine(f), { value: d };
1495
+ f += "no match";
1496
+ break;
1497
+ case g.NotIn:
1498
+ if (!p.split(",").some(function(F) {
1499
+ return F.trim() === l;
1500
+ }))
1501
+ return f += "MATCH", n.opAppendLine(f), { value: d };
1502
+ f += "no match";
1503
+ break;
1504
+ case g.Contains:
1505
+ if (l.indexOf(p) !== -1)
1506
+ return f += "MATCH", n.opAppendLine(f), { value: d };
1507
+ f += "no match";
1508
+ break;
1509
+ case g.NotContains:
1510
+ if (l.indexOf(p) === -1)
1511
+ return f += "MATCH", n.opAppendLine(f), { value: d };
1512
+ f += "no match";
1513
+ break;
1514
+ case g.SemVerIn:
1515
+ case g.SemVerNotIn:
1516
+ case g.SemVerLessThan:
1517
+ case g.SemVerLessThanEqual:
1518
+ case g.SemVerGreaterThan:
1519
+ case g.SemVerGreaterThanEqual:
1520
+ if (o.evaluateSemver(l, p, h))
1521
+ return f += "MATCH", n.opAppendLine(f), { value: d };
1522
+ f += "no match";
1523
+ break;
1524
+ case g.NumberEqual:
1525
+ case g.NumberNotEqual:
1526
+ case g.NumberLessThan:
1527
+ case g.NumberLessThanEqual:
1528
+ case g.NumberGreaterThan:
1529
+ case g.NumberGreaterThanEqual:
1530
+ if (o.evaluateNumber(l, p, h))
1531
+ return f += "MATCH", n.opAppendLine(f), { value: d };
1532
+ f += "no match";
1533
+ break;
1534
+ case g.SensitiveOneOf: {
1535
+ for (var N = p.split(","), U = oe(l), E = 0; E < N.length; E++)
1536
+ if (N[E].trim() === U)
1537
+ return f += "MATCH", n.opAppendLine(f), { value: d };
1538
+ f += "no match";
1539
+ break;
1540
+ }
1541
+ case g.SensitiveNotOneOf: {
1542
+ var D = oe(l);
1543
+ if (!p.split(",").some(function(F) {
1544
+ return F.trim() === D;
1545
+ }))
1546
+ return f += "MATCH", n.opAppendLine(f), { value: d };
1547
+ f += "no match";
1548
+ break;
1549
+ }
1550
+ }
1551
+ n.opAppendLine(f);
1552
+ }, o = this, s = 0; s < e.length; s++) {
1553
+ var a = i(s);
1554
+ if (typeof a == "object")
1555
+ return a.value;
1556
+ }
1557
+ return null;
1558
+ }, t.prototype.evaluatePercentageRules = function(e, r, n) {
1559
+ if (this.logger.debug("RolloutEvaluator.EvaluateVariations() called."), e && e.length > 0)
1560
+ for (var i = r + (n.identifier === null || n.identifier === void 0 ? "" : n.identifier), o = oe(i).substring(0, 7), s = parseInt(o, 16) % 100, a = 0, c = 0; c < e.length; c++) {
1561
+ var u = e[c];
1562
+ if (a += +u.percentage, s < a)
1563
+ return {
1564
+ value: u.value,
1565
+ variationId: u.variationId,
1566
+ matchedPercentageOption: u
1567
+ };
1568
+ }
1569
+ return null;
1570
+ }, t.prototype.evaluateNumber = function(e, r, n) {
1571
+ this.logger.debug("RolloutEvaluator.EvaluateNumber() called.");
1572
+ var i, o;
1573
+ if (e && !Number.isNaN(Number.parseFloat(e.replace(",", "."))))
1574
+ i = Number.parseFloat(e.replace(",", "."));
1575
+ else
1576
+ return !1;
1577
+ if (r && !Number.isNaN(Number.parseFloat(r.replace(",", "."))))
1578
+ o = Number.parseFloat(r.replace(",", "."));
1579
+ else
1580
+ return !1;
1581
+ switch (n) {
1582
+ case g.NumberEqual:
1583
+ return i === o;
1584
+ case g.NumberNotEqual:
1585
+ return i !== o;
1586
+ case g.NumberLessThan:
1587
+ return i < o;
1588
+ case g.NumberLessThanEqual:
1589
+ return i <= o;
1590
+ case g.NumberGreaterThan:
1591
+ return i > o;
1592
+ case g.NumberGreaterThanEqual:
1593
+ return i >= o;
1435
1594
  }
1436
- return null;
1437
- }, t.prototype.evaluateNumber = function(e, r, n) {
1438
- this.logger.debug("RolloutEvaluator.EvaluateNumber() called.");
1439
- var i, o;
1440
- if (e && !Number.isNaN(Number.parseFloat(e.replace(",", "."))))
1441
- i = Number.parseFloat(e.replace(",", "."));
1442
- else
1443
- return !1;
1444
- if (r && !Number.isNaN(Number.parseFloat(r.replace(",", "."))))
1445
- o = Number.parseFloat(r.replace(",", "."));
1446
- else
1447
1595
  return !1;
1448
- switch (n) {
1449
- case g.NumberEqual:
1450
- return i === o;
1451
- case g.NumberNotEqual:
1452
- return i !== o;
1453
- case g.NumberLessThan:
1454
- return i < o;
1455
- case g.NumberLessThanEqual:
1456
- return i <= o;
1457
- case g.NumberGreaterThan:
1458
- return i > o;
1459
- case g.NumberGreaterThanEqual:
1460
- return i >= o;
1461
- }
1462
- return !1;
1463
- }, t.prototype.evaluateSemver = function(e, r, n) {
1464
- if (this.logger.debug("RolloutEvaluator.EvaluateSemver() called."), W(e) == null || r === void 0)
1596
+ }, t.prototype.evaluateSemver = function(e, r, n) {
1597
+ if (this.logger.debug("RolloutEvaluator.EvaluateSemver() called."), W(e) == null || r === void 0)
1598
+ return !1;
1599
+ switch (r = r.trim(), n) {
1600
+ case g.SemVerIn:
1601
+ for (var i = r.split(","), o = !1, s = 0; s < i.length; s++)
1602
+ if (!(!i[s] || i[s].trim() === "")) {
1603
+ if (W(i[s].trim()) == null)
1604
+ return !1;
1605
+ o || (o = Et(e, i[s].trim()));
1606
+ }
1607
+ return o;
1608
+ case g.SemVerNotIn:
1609
+ return !r.split(",").some(function(a) {
1610
+ return !a || a.trim() === "" || (a = W(a.trim()), a == null) ? !1 : bt(e, a);
1611
+ });
1612
+ case g.SemVerLessThan:
1613
+ return W(r) == null ? !1 : St(e, r);
1614
+ case g.SemVerLessThanEqual:
1615
+ return W(r) == null ? !1 : Ot(e, r);
1616
+ case g.SemVerGreaterThan:
1617
+ return W(r) == null ? !1 : Ct(e, r);
1618
+ case g.SemVerGreaterThanEqual:
1619
+ return W(r) == null ? !1 : At(e, r);
1620
+ }
1465
1621
  return !1;
1466
- switch (r = r.trim(), n) {
1467
- case g.SemVerIn:
1468
- for (var i = r.split(","), o = !1, s = 0; s < i.length; s++)
1469
- if (!(!i[s] || i[s].trim() === "")) {
1470
- if (W(i[s].trim()) == null)
1471
- return !1;
1472
- o || (o = mt(e, i[s].trim()));
1473
- }
1474
- return o;
1475
- case g.SemVerNotIn:
1476
- return !r.split(",").some(function(a) {
1477
- return !a || a.trim() === "" || (a = W(a.trim()), a == null) ? !1 : Et(e, a);
1478
- });
1479
- case g.SemVerLessThan:
1480
- return W(r) == null ? !1 : bt(e, r);
1481
- case g.SemVerLessThanEqual:
1482
- return W(r) == null ? !1 : St(e, r);
1483
- case g.SemVerGreaterThan:
1484
- return W(r) == null ? !1 : Ot(e, r);
1485
- case g.SemVerGreaterThanEqual:
1486
- return W(r) == null ? !1 : Ct(e, r);
1487
- }
1488
- return !1;
1489
- }, t.prototype.getUserAttribute = function(e, r) {
1490
- switch (r) {
1491
- case "Identifier":
1492
- return e.identifier;
1493
- case "Email":
1494
- return e.email;
1495
- case "Country":
1496
- return e.country;
1497
- default:
1498
- return (e.custom || {})[r];
1499
- }
1500
- }, t.prototype.ruleToString = function(e) {
1501
- switch (e) {
1502
- case g.In:
1503
- return "IS ONE OF";
1504
- case g.NotIn:
1505
- return "IS NOT ONE OF";
1506
- case g.Contains:
1507
- return "CONTAINS";
1508
- case g.NotContains:
1509
- return "DOES NOT CONTAIN";
1510
- case g.SemVerIn:
1511
- return "IS ONE OF (SemVer)";
1512
- case g.SemVerNotIn:
1513
- return "IS NOT ONE OF (SemVer)";
1514
- case g.SemVerLessThan:
1515
- return "< (SemVer)";
1516
- case g.SemVerLessThanEqual:
1517
- return "<= (SemVer)";
1518
- case g.SemVerGreaterThan:
1519
- return "> (SemVer)";
1520
- case g.SemVerGreaterThanEqual:
1521
- return ">= (SemVer)";
1522
- case g.NumberEqual:
1523
- return "= (Number)";
1524
- case g.NumberNotEqual:
1525
- return "!= (Number)";
1526
- case g.NumberLessThan:
1527
- return "< (Number)";
1528
- case g.NumberLessThanEqual:
1529
- return "<= (Number)";
1530
- case g.NumberGreaterThan:
1531
- return "> (Number)";
1532
- case g.NumberGreaterThanEqual:
1533
- return ">= (Number)";
1534
- case g.SensitiveOneOf:
1535
- return "IS ONE OF (Sensitive)";
1536
- case g.SensitiveNotOneOf:
1537
- return "IS NOT ONE OF (Sensitive)";
1538
- default:
1539
- return e + "";
1622
+ }, t.prototype.getUserAttribute = function(e, r) {
1623
+ switch (r) {
1624
+ case "Identifier":
1625
+ return e.identifier;
1626
+ case "Email":
1627
+ return e.email;
1628
+ case "Country":
1629
+ return e.country;
1630
+ default:
1631
+ return (e.custom || {})[r];
1632
+ }
1633
+ }, t.prototype.ruleToString = function(e) {
1634
+ switch (e) {
1635
+ case g.In:
1636
+ return "IS ONE OF";
1637
+ case g.NotIn:
1638
+ return "IS NOT ONE OF";
1639
+ case g.Contains:
1640
+ return "CONTAINS";
1641
+ case g.NotContains:
1642
+ return "DOES NOT CONTAIN";
1643
+ case g.SemVerIn:
1644
+ return "IS ONE OF (SemVer)";
1645
+ case g.SemVerNotIn:
1646
+ return "IS NOT ONE OF (SemVer)";
1647
+ case g.SemVerLessThan:
1648
+ return "< (SemVer)";
1649
+ case g.SemVerLessThanEqual:
1650
+ return "<= (SemVer)";
1651
+ case g.SemVerGreaterThan:
1652
+ return "> (SemVer)";
1653
+ case g.SemVerGreaterThanEqual:
1654
+ return ">= (SemVer)";
1655
+ case g.NumberEqual:
1656
+ return "= (Number)";
1657
+ case g.NumberNotEqual:
1658
+ return "!= (Number)";
1659
+ case g.NumberLessThan:
1660
+ return "< (Number)";
1661
+ case g.NumberLessThanEqual:
1662
+ return "<= (Number)";
1663
+ case g.NumberGreaterThan:
1664
+ return "> (Number)";
1665
+ case g.NumberGreaterThanEqual:
1666
+ return ">= (Number)";
1667
+ case g.SensitiveOneOf:
1668
+ return "IS ONE OF (Sensitive)";
1669
+ case g.SensitiveNotOneOf:
1670
+ return "IS NOT ONE OF (Sensitive)";
1671
+ default:
1672
+ return e + "";
1673
+ }
1674
+ }, t;
1675
+ }()
1676
+ ), wt = (
1677
+ /** @class */
1678
+ function() {
1679
+ function t() {
1680
+ this.operations = "";
1540
1681
  }
1541
- }, t;
1542
- }(), wt = function() {
1543
- function t() {
1544
- this.operations = "";
1545
- }
1546
- return t.prototype.opAppendLine = function(e) {
1547
- this.operations += " " + e + `
1682
+ return t.prototype.opAppendLine = function(e) {
1683
+ this.operations += " " + e + `
1548
1684
  `;
1549
- }, t.prototype.toString = function() {
1550
- return "Evaluate '" + this.keyName + `'
1685
+ }, t.prototype.toString = function() {
1686
+ return "Evaluate '" + this.keyName + `'
1551
1687
  User : ` + JSON.stringify(this.user) + `
1552
1688
  ` + this.operations + " Returning value : " + this.returnValue;
1553
- }, t;
1554
- }();
1689
+ }, t;
1690
+ }()
1691
+ );
1555
1692
  function Ge(t, e, r, n) {
1556
1693
  return {
1557
1694
  key: t,
@@ -1564,7 +1701,7 @@ function Ge(t, e, r, n) {
1564
1701
  matchedEvaluationPercentageRule: e.matchedPercentageOption
1565
1702
  };
1566
1703
  }
1567
- function _(t, e, r, n, i, o) {
1704
+ function z(t, e, r, n, i, o) {
1568
1705
  return {
1569
1706
  key: t,
1570
1707
  value: e,
@@ -1578,10 +1715,10 @@ function _(t, e, r, n, i, o) {
1578
1715
  function le(t, e, r, n, i, o, s) {
1579
1716
  var a;
1580
1717
  if (!e)
1581
- return a = s.configJsonIsNotPresentSingle(r, "defaultValue", n).toString(), _(r, n, x(o), i, a);
1718
+ return a = s.configJsonIsNotPresentSingle(r, "defaultValue", n).toString(), z(r, n, x(o), i, a);
1582
1719
  var c = e[r];
1583
1720
  if (!c)
1584
- return a = s.settingEvaluationFailedDueToMissingKey(r, "defaultValue", n, Tt(e)).toString(), _(r, n, x(o), i, a);
1721
+ return a = s.settingEvaluationFailedDueToMissingKey(r, "defaultValue", n, It(e)).toString(), z(r, n, x(o), i, a);
1585
1722
  var u = t.evaluate(c, r, n, i, o);
1586
1723
  if (n != null && typeof n != typeof u.value)
1587
1724
  throw new TypeError(`The type of a setting must match the type of the given default value.
@@ -1599,7 +1736,7 @@ function Ke(t, e, r, n, i, o) {
1599
1736
  var d = t.evaluate(p, h, null, r, n);
1600
1737
  f = Ge(h, d, x(n), r);
1601
1738
  } catch (y) {
1602
- s ?? (s = []), s.push(y), f = _(h, null, x(n), r, z(y), y);
1739
+ s ?? (s = []), s.push(y), f = z(h, null, x(n), r, _(y), y);
1603
1740
  }
1604
1741
  a.push(f);
1605
1742
  }
@@ -1614,377 +1751,395 @@ function Je(t) {
1614
1751
  function x(t) {
1615
1752
  return t ? new Date(t.timestamp) : void 0;
1616
1753
  }
1617
- function Tt(t) {
1754
+ function It(t) {
1618
1755
  return Object.keys(t).map(function(e) {
1619
1756
  return "'" + e + "'";
1620
1757
  }).join(", ");
1621
1758
  }
1622
- var It = function() {
1623
- function t() {
1624
- this.instances = {};
1625
- }
1626
- return t.prototype.getOrCreate = function(e, r) {
1627
- var n, i = this.instances[e.apiKey];
1628
- if (i) {
1629
- var o = i[0];
1630
- if (n = o.deref(), n)
1631
- return [n, !0];
1632
- }
1633
- var s = {};
1634
- n = new be(e, r, s);
1635
- var a = dt() ? WeakRef : pt();
1636
- return this.instances[e.apiKey] = [new a(n), s], [n, !1];
1637
- }, t.prototype.remove = function(e, r) {
1638
- var n = this.instances[e];
1639
- if (n) {
1640
- var i = n[0], o = n[1], s = !!i.deref();
1641
- if (!s || o === r)
1642
- return delete this.instances[e], s;
1643
- }
1644
- return !1;
1645
- }, t.prototype.clear = function() {
1646
- for (var e = [], r = 0, n = Object.entries(this.instances); r < n.length; r++) {
1647
- var i = n[r], o = i[0], s = i[1][0], a = s.deref();
1648
- a && e.push(a), delete this.instances[o];
1759
+ var Nt = (
1760
+ /** @class */
1761
+ function() {
1762
+ function t() {
1763
+ this.instances = {};
1649
1764
  }
1650
- return e;
1651
- }, t;
1652
- }(), Y = new It(), be = function() {
1653
- function t(e, r, n) {
1654
- var i;
1655
- if (this.cacheToken = n, this.addListener = this.on, this.off = this.removeListener, !e)
1656
- throw new Error("Invalid 'options' value");
1657
- if (this.options = e, this.options.logger.debug("Initializing ConfigCatClient. Options: " + JSON.stringify(this.options)), !r)
1658
- throw new Error("Invalid 'configCatKernel' value");
1659
- if (!r.configFetcher)
1660
- throw new Error("Invalid 'configCatKernel.configFetcher' value");
1661
- e.defaultUser && this.setDefaultUser(e.defaultUser), this.evaluator = new At(e.logger), ((i = e.flagOverrides) === null || i === void 0 ? void 0 : i.behaviour) !== P.LocalOnly ? this.configService = e instanceof He ? new rt(r.configFetcher, e) : e instanceof je ? new ct(r.configFetcher, e) : e instanceof qe ? new ut(r.configFetcher, e) : function() {
1662
- throw new Error("Invalid 'options' value");
1663
- }() : this.options.hooks.emit("clientReady", L.HasLocalOverrideFlagDataOnly), this.suppressFinalize = se(this, { sdkKey: e.apiKey, cacheToken: n, configService: this.configService, logger: e.logger });
1664
- }
1665
- return Object.defineProperty(t, "instanceCache", {
1666
- get: function() {
1667
- return Y;
1668
- },
1669
- enumerable: !1,
1670
- configurable: !0
1671
- }), t.get = function(e, r, n, i) {
1672
- if (!e)
1673
- throw new Error("Invalid 'sdkKey' value");
1674
- var o = r === j.AutoPoll ? He : r === j.ManualPoll ? je : r === j.LazyLoad ? qe : function() {
1675
- throw new Error("Invalid 'pollingMode' value");
1676
- }(), s = new o(e, i.sdkType, i.sdkVersion, n, i.defaultCacheFactory, i.eventEmitterFactory), a = Y.getOrCreate(s, i), c = a[0], u = a[1];
1677
- return u && n && s.logger.clientIsAlreadyCreated(e), c;
1678
- }, t.finalize = function(e) {
1679
- var r;
1680
- (r = e.logger) === null || r === void 0 || r.debug("finalize() called"), e.cacheToken && Y.remove(e.sdkKey, e.cacheToken), t.close(e.configService, e.logger);
1681
- }, t.close = function(e, r, n) {
1682
- r == null || r.debug("close() called"), n == null || n.tryDisconnect(), e == null || e.dispose();
1683
- }, t.prototype.dispose = function() {
1684
- var e = this.options;
1685
- e.logger.debug("dispose() called"), this.cacheToken && Y.remove(e.apiKey, this.cacheToken), t.close(this.configService, e.logger, e.hooks), this.suppressFinalize();
1686
- }, t.disposeAll = function() {
1687
- for (var e = Y.clear(), r, n = 0, i = e; n < i.length; n++) {
1688
- var o = i[n];
1689
- try {
1690
- t.close(o.configService, o.options.logger, o.options.hooks), o.suppressFinalize();
1691
- } catch (s) {
1692
- r ?? (r = []), r.push(s);
1765
+ return t.prototype.getOrCreate = function(e, r) {
1766
+ var n, i = this.instances[e.apiKey];
1767
+ if (i) {
1768
+ var o = i[0];
1769
+ if (n = o.deref(), n)
1770
+ return [n, !0];
1771
+ }
1772
+ var s = {};
1773
+ n = new be(e, r, s);
1774
+ var a = vt() ? WeakRef : dt();
1775
+ return this.instances[e.apiKey] = [new a(n), s], [n, !1];
1776
+ }, t.prototype.remove = function(e, r) {
1777
+ var n = this.instances[e];
1778
+ if (n) {
1779
+ var i = n[0], o = n[1], s = !!i.deref();
1780
+ if (!s || o === r)
1781
+ return delete this.instances[e], s;
1782
+ }
1783
+ return !1;
1784
+ }, t.prototype.clear = function() {
1785
+ for (var e = [], r = 0, n = Object.entries(this.instances); r < n.length; r++) {
1786
+ var i = n[r], o = i[0], s = i[1][0], a = s.deref();
1787
+ a && e.push(a), delete this.instances[o];
1693
1788
  }
1789
+ return e;
1790
+ }, t;
1791
+ }()
1792
+ ), Y = new Nt(), be = (
1793
+ /** @class */
1794
+ function() {
1795
+ function t(e, r, n) {
1796
+ var i;
1797
+ if (this.cacheToken = n, this.addListener = this.on, this.off = this.removeListener, !e)
1798
+ throw new Error("Invalid 'options' value");
1799
+ if (this.options = e, this.options.logger.debug("Initializing ConfigCatClient. Options: " + JSON.stringify(this.options)), !r)
1800
+ throw new Error("Invalid 'configCatKernel' value");
1801
+ if (!r.configFetcher)
1802
+ throw new Error("Invalid 'configCatKernel.configFetcher' value");
1803
+ e.defaultUser && this.setDefaultUser(e.defaultUser), this.evaluator = new Tt(e.logger), ((i = e.flagOverrides) === null || i === void 0 ? void 0 : i.behaviour) !== P.LocalOnly ? this.configService = e instanceof He ? new tt(r.configFetcher, e) : e instanceof je ? new lt(r.configFetcher, e) : e instanceof qe ? new ct(r.configFetcher, e) : function() {
1804
+ throw new Error("Invalid 'options' value");
1805
+ }() : this.options.hooks.emit("clientReady", T.HasLocalOverrideFlagDataOnly), this.suppressFinalize = se(this, { sdkKey: e.apiKey, cacheToken: n, configService: this.configService, logger: e.logger });
1694
1806
  }
1695
- if (r)
1696
- throw typeof AggregateError < "u" ? new AggregateError(r) : r.pop();
1697
- }, t.prototype.getValueAsync = function(e, r, n) {
1698
- return S(this, void 0, void 0, function() {
1699
- var i, o, s, a, c, u;
1700
- return O(this, function(l) {
1701
- switch (l.label) {
1702
- case 0:
1703
- this.options.logger.debug("getValueAsync() called."), fe(e), he(r), s = null, n ?? (n = this.defaultUser), l.label = 1;
1704
- case 1:
1705
- return l.trys.push([1, 3, , 4]), a = void 0, [4, this.getSettingsAsync()];
1706
- case 2:
1707
- return u = l.sent(), a = u[0], s = u[1], o = le(this.evaluator, a, e, r, n, s, this.options.logger), i = o.value, [3, 4];
1708
- case 3:
1709
- return c = l.sent(), this.options.logger.settingEvaluationErrorSingle("getValueAsync", e, "defaultValue", r, c), o = _(e, r, x(s), n, z(c), c), i = r, [3, 4];
1710
- case 4:
1711
- return this.options.hooks.emit("flagEvaluated", o), [2, i];
1807
+ return Object.defineProperty(t, "instanceCache", {
1808
+ get: function() {
1809
+ return Y;
1810
+ },
1811
+ enumerable: !1,
1812
+ configurable: !0
1813
+ }), t.get = function(e, r, n, i) {
1814
+ if (!e)
1815
+ throw new Error("Invalid 'sdkKey' value");
1816
+ var o = r === j.AutoPoll ? He : r === j.ManualPoll ? je : r === j.LazyLoad ? qe : function() {
1817
+ throw new Error("Invalid 'pollingMode' value");
1818
+ }(), s = new o(e, i.sdkType, i.sdkVersion, n, i.defaultCacheFactory, i.eventEmitterFactory), a = Y.getOrCreate(s, i), c = a[0], u = a[1];
1819
+ return u && n && s.logger.clientIsAlreadyCreated(e), c;
1820
+ }, t.finalize = function(e) {
1821
+ var r;
1822
+ (r = e.logger) === null || r === void 0 || r.debug("finalize() called"), e.cacheToken && Y.remove(e.sdkKey, e.cacheToken), t.close(e.configService, e.logger);
1823
+ }, t.close = function(e, r, n) {
1824
+ r == null || r.debug("close() called"), n == null || n.tryDisconnect(), e == null || e.dispose();
1825
+ }, t.prototype.dispose = function() {
1826
+ var e = this.options;
1827
+ e.logger.debug("dispose() called"), this.cacheToken && Y.remove(e.apiKey, this.cacheToken), t.close(this.configService, e.logger, e.hooks), this.suppressFinalize();
1828
+ }, t.disposeAll = function() {
1829
+ for (var e = Y.clear(), r, n = 0, i = e; n < i.length; n++) {
1830
+ var o = i[n];
1831
+ try {
1832
+ t.close(o.configService, o.options.logger, o.options.hooks), o.suppressFinalize();
1833
+ } catch (s) {
1834
+ r ?? (r = []), r.push(s);
1712
1835
  }
1836
+ }
1837
+ if (r)
1838
+ throw typeof AggregateError < "u" ? new AggregateError(r) : r.pop();
1839
+ }, t.prototype.getValueAsync = function(e, r, n) {
1840
+ return S(this, void 0, void 0, function() {
1841
+ var i, o, s, a, c, u;
1842
+ return O(this, function(l) {
1843
+ switch (l.label) {
1844
+ case 0:
1845
+ this.options.logger.debug("getValueAsync() called."), fe(e), he(r), s = null, n ?? (n = this.defaultUser), l.label = 1;
1846
+ case 1:
1847
+ return l.trys.push([1, 3, , 4]), a = void 0, [4, this.getSettingsAsync()];
1848
+ case 2:
1849
+ return u = l.sent(), a = u[0], s = u[1], o = le(this.evaluator, a, e, r, n, s, this.options.logger), i = o.value, [3, 4];
1850
+ case 3:
1851
+ return c = l.sent(), this.options.logger.settingEvaluationErrorSingle("getValueAsync", e, "defaultValue", r, c), o = z(e, r, x(s), n, _(c), c), i = r, [3, 4];
1852
+ case 4:
1853
+ return this.options.hooks.emit("flagEvaluated", o), [2, i];
1854
+ }
1855
+ });
1713
1856
  });
1714
- });
1715
- }, t.prototype.getValueDetailsAsync = function(e, r, n) {
1716
- return S(this, void 0, void 0, function() {
1717
- var i, o, s, a, c;
1718
- return O(this, function(u) {
1719
- switch (u.label) {
1720
- case 0:
1721
- this.options.logger.debug("getValueDetailsAsync() called."), fe(e), he(r), o = null, n ?? (n = this.defaultUser), u.label = 1;
1722
- case 1:
1723
- return u.trys.push([1, 3, , 4]), s = void 0, [4, this.getSettingsAsync()];
1724
- case 2:
1725
- return c = u.sent(), s = c[0], o = c[1], i = le(this.evaluator, s, e, r, n, o, this.options.logger), [3, 4];
1726
- case 3:
1727
- return a = u.sent(), this.options.logger.settingEvaluationErrorSingle("getValueDetailsAsync", e, "defaultValue", r, a), i = _(e, r, x(o), n, z(a), a), [3, 4];
1728
- case 4:
1729
- return this.options.hooks.emit("flagEvaluated", i), [2, i];
1730
- }
1857
+ }, t.prototype.getValueDetailsAsync = function(e, r, n) {
1858
+ return S(this, void 0, void 0, function() {
1859
+ var i, o, s, a, c;
1860
+ return O(this, function(u) {
1861
+ switch (u.label) {
1862
+ case 0:
1863
+ this.options.logger.debug("getValueDetailsAsync() called."), fe(e), he(r), o = null, n ?? (n = this.defaultUser), u.label = 1;
1864
+ case 1:
1865
+ return u.trys.push([1, 3, , 4]), s = void 0, [4, this.getSettingsAsync()];
1866
+ case 2:
1867
+ return c = u.sent(), s = c[0], o = c[1], i = le(this.evaluator, s, e, r, n, o, this.options.logger), [3, 4];
1868
+ case 3:
1869
+ return a = u.sent(), this.options.logger.settingEvaluationErrorSingle("getValueDetailsAsync", e, "defaultValue", r, a), i = z(e, r, x(o), n, _(a), a), [3, 4];
1870
+ case 4:
1871
+ return this.options.hooks.emit("flagEvaluated", i), [2, i];
1872
+ }
1873
+ });
1731
1874
  });
1732
- });
1733
- }, t.prototype.getAllKeysAsync = function() {
1734
- return S(this, void 0, void 0, function() {
1735
- var e, r, n;
1736
- return O(this, function(i) {
1737
- switch (i.label) {
1738
- case 0:
1739
- this.options.logger.debug("getAllKeysAsync() called."), e = "empty array", i.label = 1;
1740
- case 1:
1741
- return i.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
1742
- case 2:
1743
- return r = i.sent()[0], ye(r, this.options.logger, e) ? [2, Object.keys(r)] : [2, []];
1744
- case 3:
1745
- return n = i.sent(), this.options.logger.settingEvaluationError("getAllKeysAsync", e, n), [2, []];
1746
- case 4:
1747
- return [2];
1748
- }
1875
+ }, t.prototype.getAllKeysAsync = function() {
1876
+ return S(this, void 0, void 0, function() {
1877
+ var e, r, n;
1878
+ return O(this, function(i) {
1879
+ switch (i.label) {
1880
+ case 0:
1881
+ this.options.logger.debug("getAllKeysAsync() called."), e = "empty array", i.label = 1;
1882
+ case 1:
1883
+ return i.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
1884
+ case 2:
1885
+ return r = i.sent()[0], ye(r, this.options.logger, e) ? [2, Object.keys(r)] : [2, []];
1886
+ case 3:
1887
+ return n = i.sent(), this.options.logger.settingEvaluationError("getAllKeysAsync", e, n), [2, []];
1888
+ case 4:
1889
+ return [
1890
+ 2
1891
+ /*return*/
1892
+ ];
1893
+ }
1894
+ });
1749
1895
  });
1750
- });
1751
- }, t.prototype.getAllValuesAsync = function(e) {
1752
- return S(this, void 0, void 0, function() {
1753
- var r, n, i, o, s, a, c, u, l, h, p, f;
1754
- return O(this, function(d) {
1755
- switch (d.label) {
1756
- case 0:
1757
- this.options.logger.debug("getAllValuesAsync() called."), r = "empty array", e ?? (e = this.defaultUser), d.label = 1;
1758
- case 1:
1759
- return d.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
1760
- case 2:
1761
- return s = d.sent(), a = s[0], c = s[1], f = Ke(this.evaluator, a, e, c, this.options.logger, r), i = f[0], o = f[1], n = i.map(function(y) {
1762
- return new ne(y.key, y.value);
1763
- }), [3, 4];
1764
- case 3:
1765
- return u = d.sent(), this.options.logger.settingEvaluationError("getAllValuesAsync", r, u), [2, []];
1766
- case 4:
1767
- for (o != null && o.length && this.options.logger.settingEvaluationError("getAllValuesAsync", "evaluation result", typeof AggregateError < "u" ? new AggregateError(o) : o.pop()), l = 0, h = i; l < h.length; l++)
1768
- p = h[l], this.options.hooks.emit("flagEvaluated", p);
1769
- return [2, n];
1770
- }
1896
+ }, t.prototype.getAllValuesAsync = function(e) {
1897
+ return S(this, void 0, void 0, function() {
1898
+ var r, n, i, o, s, a, c, u, l, h, p, f;
1899
+ return O(this, function(d) {
1900
+ switch (d.label) {
1901
+ case 0:
1902
+ this.options.logger.debug("getAllValuesAsync() called."), r = "empty array", e ?? (e = this.defaultUser), d.label = 1;
1903
+ case 1:
1904
+ return d.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
1905
+ case 2:
1906
+ return s = d.sent(), a = s[0], c = s[1], f = Ke(this.evaluator, a, e, c, this.options.logger, r), i = f[0], o = f[1], n = i.map(function(y) {
1907
+ return new ne(y.key, y.value);
1908
+ }), [3, 4];
1909
+ case 3:
1910
+ return u = d.sent(), this.options.logger.settingEvaluationError("getAllValuesAsync", r, u), [2, []];
1911
+ case 4:
1912
+ for (o != null && o.length && this.options.logger.settingEvaluationError("getAllValuesAsync", "evaluation result", typeof AggregateError < "u" ? new AggregateError(o) : o.pop()), l = 0, h = i; l < h.length; l++)
1913
+ p = h[l], this.options.hooks.emit("flagEvaluated", p);
1914
+ return [2, n];
1915
+ }
1916
+ });
1771
1917
  });
1772
- });
1773
- }, t.prototype.getAllValueDetailsAsync = function(e) {
1774
- return S(this, void 0, void 0, function() {
1775
- var r, n, i, o, s, a, c, u, l, h, p;
1776
- return O(this, function(f) {
1777
- switch (f.label) {
1778
- case 0:
1779
- this.options.logger.debug("getAllValueDetailsAsync() called."), r = "empty array", e ?? (e = this.defaultUser), f.label = 1;
1780
- case 1:
1781
- return f.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
1782
- case 2:
1783
- return o = f.sent(), s = o[0], a = o[1], p = Ke(this.evaluator, s, e, a, this.options.logger, r), n = p[0], i = p[1], [3, 4];
1784
- case 3:
1785
- return c = f.sent(), this.options.logger.settingEvaluationError("getAllValueDetailsAsync", r, c), [2, []];
1786
- case 4:
1787
- for (i != null && i.length && this.options.logger.settingEvaluationError("getAllValueDetailsAsync", "evaluation result", typeof AggregateError < "u" ? new AggregateError(i) : i.pop()), u = 0, l = n; u < l.length; u++)
1788
- h = l[u], this.options.hooks.emit("flagEvaluated", h);
1789
- return [2, n];
1790
- }
1918
+ }, t.prototype.getAllValueDetailsAsync = function(e) {
1919
+ return S(this, void 0, void 0, function() {
1920
+ var r, n, i, o, s, a, c, u, l, h, p;
1921
+ return O(this, function(f) {
1922
+ switch (f.label) {
1923
+ case 0:
1924
+ this.options.logger.debug("getAllValueDetailsAsync() called."), r = "empty array", e ?? (e = this.defaultUser), f.label = 1;
1925
+ case 1:
1926
+ return f.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
1927
+ case 2:
1928
+ return o = f.sent(), s = o[0], a = o[1], p = Ke(this.evaluator, s, e, a, this.options.logger, r), n = p[0], i = p[1], [3, 4];
1929
+ case 3:
1930
+ return c = f.sent(), this.options.logger.settingEvaluationError("getAllValueDetailsAsync", r, c), [2, []];
1931
+ case 4:
1932
+ for (i != null && i.length && this.options.logger.settingEvaluationError("getAllValueDetailsAsync", "evaluation result", typeof AggregateError < "u" ? new AggregateError(i) : i.pop()), u = 0, l = n; u < l.length; u++)
1933
+ h = l[u], this.options.hooks.emit("flagEvaluated", h);
1934
+ return [2, n];
1935
+ }
1936
+ });
1791
1937
  });
1792
- });
1793
- }, t.prototype.getKeyAndValueAsync = function(e) {
1794
- return S(this, void 0, void 0, function() {
1795
- var r, n, i, o, s, a, c, u, p, l, h, p, f, d;
1796
- return O(this, function(y) {
1797
- switch (y.label) {
1798
- case 0:
1799
- this.options.logger.debug("getKeyAndValueAsync() called."), r = "null", y.label = 1;
1800
- case 1:
1801
- return y.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
1802
- case 2:
1803
- if (n = y.sent()[0], !ye(n, this.options.logger, r))
1804
- return [2, null];
1805
- for (i = 0, o = Object.entries(n); i < o.length; i++) {
1806
- if (s = o[i], a = s[0], c = s[1], e === c.variationId)
1807
- return [2, new ne(a, c.value)];
1808
- if (u = n[a].targetingRules, u && u.length > 0) {
1809
- for (p = 0; p < u.length; p++)
1810
- if (l = u[p], e === l.variationId)
1811
- return [2, new ne(a, l.value)];
1812
- }
1813
- if (h = n[a].percentageOptions, h && h.length > 0) {
1814
- for (p = 0; p < h.length; p++)
1815
- if (f = h[p], e === f.variationId)
1816
- return [2, new ne(a, f.value)];
1938
+ }, t.prototype.getKeyAndValueAsync = function(e) {
1939
+ return S(this, void 0, void 0, function() {
1940
+ var r, n, i, o, s, a, c, u, p, l, h, p, f, d;
1941
+ return O(this, function(y) {
1942
+ switch (y.label) {
1943
+ case 0:
1944
+ this.options.logger.debug("getKeyAndValueAsync() called."), r = "null", y.label = 1;
1945
+ case 1:
1946
+ return y.trys.push([1, 3, , 4]), [4, this.getSettingsAsync()];
1947
+ case 2:
1948
+ if (n = y.sent()[0], !ye(n, this.options.logger, r))
1949
+ return [2, null];
1950
+ for (i = 0, o = Object.entries(n); i < o.length; i++) {
1951
+ if (s = o[i], a = s[0], c = s[1], e === c.variationId)
1952
+ return [2, new ne(a, c.value)];
1953
+ if (u = n[a].targetingRules, u && u.length > 0) {
1954
+ for (p = 0; p < u.length; p++)
1955
+ if (l = u[p], e === l.variationId)
1956
+ return [2, new ne(a, l.value)];
1957
+ }
1958
+ if (h = n[a].percentageOptions, h && h.length > 0) {
1959
+ for (p = 0; p < h.length; p++)
1960
+ if (f = h[p], e === f.variationId)
1961
+ return [2, new ne(a, f.value)];
1962
+ }
1817
1963
  }
1818
- }
1819
- return this.options.logger.settingForVariationIdIsNotPresent(e), [3, 4];
1820
- case 3:
1821
- return d = y.sent(), this.options.logger.settingEvaluationError("getKeyAndValueAsync", r, d), [3, 4];
1822
- case 4:
1823
- return [2, null];
1824
- }
1964
+ return this.options.logger.settingForVariationIdIsNotPresent(e), [3, 4];
1965
+ case 3:
1966
+ return d = y.sent(), this.options.logger.settingEvaluationError("getKeyAndValueAsync", r, d), [3, 4];
1967
+ case 4:
1968
+ return [2, null];
1969
+ }
1970
+ });
1825
1971
  });
1826
- });
1827
- }, t.prototype.forceRefreshAsync = function() {
1828
- return S(this, void 0, void 0, function() {
1829
- var e, r;
1830
- return O(this, function(n) {
1831
- switch (n.label) {
1832
- case 0:
1833
- if (this.options.logger.debug("forceRefreshAsync() called."), !this.configService)
1834
- return [3, 5];
1835
- n.label = 1;
1836
- case 1:
1837
- return n.trys.push([1, 3, , 4]), [4, this.configService.refreshConfigAsync()];
1838
- case 2:
1839
- return e = n.sent()[0], [2, e];
1840
- case 3:
1841
- return r = n.sent(), this.options.logger.forceRefreshError("forceRefreshAsync", r), [2, ae.failure(z(r), r)];
1842
- case 4:
1843
- return [3, 6];
1844
- case 5:
1845
- return [2, ae.failure("Client is configured to use the LocalOnly override behavior, which prevents making HTTP requests.")];
1846
- case 6:
1847
- return [2];
1848
- }
1972
+ }, t.prototype.forceRefreshAsync = function() {
1973
+ return S(this, void 0, void 0, function() {
1974
+ var e, r;
1975
+ return O(this, function(n) {
1976
+ switch (n.label) {
1977
+ case 0:
1978
+ if (this.options.logger.debug("forceRefreshAsync() called."), !this.configService)
1979
+ return [3, 5];
1980
+ n.label = 1;
1981
+ case 1:
1982
+ return n.trys.push([1, 3, , 4]), [4, this.configService.refreshConfigAsync()];
1983
+ case 2:
1984
+ return e = n.sent()[0], [2, e];
1985
+ case 3:
1986
+ return r = n.sent(), this.options.logger.forceRefreshError("forceRefreshAsync", r), [2, ae.failure(_(r), r)];
1987
+ case 4:
1988
+ return [3, 6];
1989
+ case 5:
1990
+ return [2, ae.failure("Client is configured to use the LocalOnly override behavior, which prevents making HTTP requests.")];
1991
+ case 6:
1992
+ return [
1993
+ 2
1994
+ /*return*/
1995
+ ];
1996
+ }
1997
+ });
1849
1998
  });
1850
- });
1851
- }, t.prototype.setDefaultUser = function(e) {
1852
- this.defaultUser = e;
1853
- }, t.prototype.clearDefaultUser = function() {
1854
- this.defaultUser = void 0;
1855
- }, Object.defineProperty(t.prototype, "isOffline", {
1856
- get: function() {
1857
- var e, r;
1858
- return (r = (e = this.configService) === null || e === void 0 ? void 0 : e.isOffline) !== null && r !== void 0 ? r : !0;
1859
- },
1860
- enumerable: !1,
1861
- configurable: !0
1862
- }), t.prototype.setOnline = function() {
1863
- this.configService ? this.configService.setOnline() : this.options.logger.configServiceMethodHasNoEffectDueToOverrideBehavior(P[P.LocalOnly], "setOnline");
1864
- }, t.prototype.setOffline = function() {
1865
- var e;
1866
- (e = this.configService) === null || e === void 0 || e.setOffline();
1867
- }, t.prototype.waitForReady = function() {
1868
- return this.options.readyPromise;
1869
- }, t.prototype.snapshot = function() {
1870
- var e, r, n, i = this, o, s = function() {
1871
- var h = i.options.cache.getInMemory(), p = h.isEmpty ? null : h.config.settings;
1872
- return [p, h];
1873
- }, a, c, u = (o = this.options) === null || o === void 0 ? void 0 : o.flagOverrides;
1874
- if (u) {
1875
- var l = u.dataSource.getOverridesSync();
1876
- switch (u.behaviour) {
1877
- case P.LocalOnly:
1878
- return new re(l, null, this);
1879
- case P.LocalOverRemote:
1880
- return e = s(), a = e[0], c = e[1], new re(k(k({}, a ?? {}), l), c, this);
1881
- case P.RemoteOverLocal:
1882
- return r = s(), a = r[0], c = r[1], new re(k(k({}, l), a ?? {}), c, this);
1999
+ }, t.prototype.setDefaultUser = function(e) {
2000
+ this.defaultUser = e;
2001
+ }, t.prototype.clearDefaultUser = function() {
2002
+ this.defaultUser = void 0;
2003
+ }, Object.defineProperty(t.prototype, "isOffline", {
2004
+ get: function() {
2005
+ var e, r;
2006
+ return (r = (e = this.configService) === null || e === void 0 ? void 0 : e.isOffline) !== null && r !== void 0 ? r : !0;
2007
+ },
2008
+ enumerable: !1,
2009
+ configurable: !0
2010
+ }), t.prototype.setOnline = function() {
2011
+ this.configService ? this.configService.setOnline() : this.options.logger.configServiceMethodHasNoEffectDueToOverrideBehavior(P[P.LocalOnly], "setOnline");
2012
+ }, t.prototype.setOffline = function() {
2013
+ var e;
2014
+ (e = this.configService) === null || e === void 0 || e.setOffline();
2015
+ }, t.prototype.waitForReady = function() {
2016
+ return this.options.readyPromise;
2017
+ }, t.prototype.snapshot = function() {
2018
+ var e, r, n, i = this, o, s = function() {
2019
+ var h = i.options.cache.getInMemory(), p = h.isEmpty ? null : h.config.settings;
2020
+ return [p, h];
2021
+ }, a, c, u = (o = this.options) === null || o === void 0 ? void 0 : o.flagOverrides;
2022
+ if (u) {
2023
+ var l = u.dataSource.getOverridesSync();
2024
+ switch (u.behaviour) {
2025
+ case P.LocalOnly:
2026
+ return new re(l, null, this);
2027
+ case P.LocalOverRemote:
2028
+ return e = s(), a = e[0], c = e[1], new re(k(k({}, a ?? {}), l), c, this);
2029
+ case P.RemoteOverLocal:
2030
+ return r = s(), a = r[0], c = r[1], new re(k(k({}, l), a ?? {}), c, this);
2031
+ }
1883
2032
  }
1884
- }
1885
- return n = s(), a = n[0], c = n[1], new re(a, c, this);
1886
- }, t.prototype.getSettingsAsync = function() {
1887
- var e;
1888
- return S(this, void 0, void 0, function() {
1889
- var r, n, i, o, s, a, c, u, l = this;
1890
- return O(this, function(h) {
1891
- switch (h.label) {
1892
- case 0:
1893
- return this.options.logger.debug("getSettingsAsync() called."), r = function() {
1894
- return S(l, void 0, void 0, function() {
1895
- var p, f;
1896
- return O(this, function(d) {
1897
- switch (d.label) {
1898
- case 0:
1899
- return [4, this.configService.getConfig()];
1900
- case 1:
1901
- return p = d.sent(), f = p.isEmpty ? null : p.config.settings, [2, [f, p]];
1902
- }
2033
+ return n = s(), a = n[0], c = n[1], new re(a, c, this);
2034
+ }, t.prototype.getSettingsAsync = function() {
2035
+ var e;
2036
+ return S(this, void 0, void 0, function() {
2037
+ var r, n, i, o, s, a, c, u, l = this;
2038
+ return O(this, function(h) {
2039
+ switch (h.label) {
2040
+ case 0:
2041
+ return this.options.logger.debug("getSettingsAsync() called."), r = function() {
2042
+ return S(l, void 0, void 0, function() {
2043
+ var p, f;
2044
+ return O(this, function(d) {
2045
+ switch (d.label) {
2046
+ case 0:
2047
+ return [4, this.configService.getConfig()];
2048
+ case 1:
2049
+ return p = d.sent(), f = p.isEmpty ? null : p.config.settings, [2, [f, p]];
2050
+ }
2051
+ });
1903
2052
  });
1904
- });
1905
- }, n = (e = this.options) === null || e === void 0 ? void 0 : e.flagOverrides, n ? (i = void 0, o = void 0, [4, n.dataSource.getOverrides()]) : [3, 7];
1906
- case 1:
1907
- switch (s = h.sent(), a = n.behaviour, a) {
1908
- case P.LocalOnly:
1909
- return [3, 2];
1910
- case P.LocalOverRemote:
1911
- return [3, 3];
1912
- case P.RemoteOverLocal:
1913
- return [3, 5];
1914
- }
1915
- return [3, 7];
1916
- case 2:
1917
- return [2, [s, null]];
1918
- case 3:
1919
- return [4, r()];
1920
- case 4:
1921
- return c = h.sent(), i = c[0], o = c[1], [2, [k(k({}, i ?? {}), s), o]];
1922
- case 5:
1923
- return [4, r()];
1924
- case 6:
1925
- return u = h.sent(), i = u[0], o = u[1], [2, [k(k({}, s), i ?? {}), o]];
1926
- case 7:
1927
- return [4, r()];
1928
- case 8:
1929
- return [2, h.sent()];
1930
- }
2053
+ }, n = (e = this.options) === null || e === void 0 ? void 0 : e.flagOverrides, n ? (i = void 0, o = void 0, [4, n.dataSource.getOverrides()]) : [3, 7];
2054
+ case 1:
2055
+ switch (s = h.sent(), a = n.behaviour, a) {
2056
+ case P.LocalOnly:
2057
+ return [3, 2];
2058
+ case P.LocalOverRemote:
2059
+ return [3, 3];
2060
+ case P.RemoteOverLocal:
2061
+ return [3, 5];
2062
+ }
2063
+ return [3, 7];
2064
+ case 2:
2065
+ return [2, [s, null]];
2066
+ case 3:
2067
+ return [4, r()];
2068
+ case 4:
2069
+ return c = h.sent(), i = c[0], o = c[1], [2, [k(k({}, i ?? {}), s), o]];
2070
+ case 5:
2071
+ return [4, r()];
2072
+ case 6:
2073
+ return u = h.sent(), i = u[0], o = u[1], [2, [k(k({}, s), i ?? {}), o]];
2074
+ case 7:
2075
+ return [4, r()];
2076
+ case 8:
2077
+ return [2, h.sent()];
2078
+ }
2079
+ });
1931
2080
  });
1932
- });
1933
- }, t.prototype.on = function(e, r) {
1934
- return this.options.hooks.on(e, r), this;
1935
- }, t.prototype.once = function(e, r) {
1936
- return this.options.hooks.once(e, r), this;
1937
- }, t.prototype.removeListener = function(e, r) {
1938
- return this.options.hooks.removeListener(e, r), this;
1939
- }, t.prototype.removeAllListeners = function(e) {
1940
- return this.options.hooks.removeAllListeners(e), this;
1941
- }, t.prototype.listeners = function(e) {
1942
- return this.options.hooks.listeners(e);
1943
- }, t.prototype.listenerCount = function(e) {
1944
- return this.options.hooks.listenerCount(e);
1945
- }, t.prototype.eventNames = function() {
1946
- return this.options.hooks.eventNames();
1947
- }, t;
1948
- }(), re = function() {
1949
- function t(e, r, n) {
1950
- this.mergedSettings = e, this.remoteConfig = r, this.defaultUser = n.defaultUser, this.evaluator = n.evaluator, this.options = n.options;
1951
- }
1952
- return Object.defineProperty(t.prototype, "fetchedConfig", {
1953
- get: function() {
1954
- var e = this.remoteConfig;
1955
- return e && !e.isEmpty ? e.config : null;
1956
- },
1957
- enumerable: !1,
1958
- configurable: !0
1959
- }), t.prototype.getAllKeys = function() {
1960
- return this.mergedSettings ? Object.keys(this.mergedSettings) : [];
1961
- }, t.prototype.getValue = function(e, r, n) {
1962
- this.options.logger.debug("Snapshot.getValue() called."), fe(e), he(r);
1963
- var i, o;
1964
- n ?? (n = this.defaultUser);
1965
- try {
1966
- o = le(this.evaluator, this.mergedSettings, e, r, n, this.remoteConfig, this.options.logger), i = o.value;
1967
- } catch (s) {
1968
- this.options.logger.settingEvaluationErrorSingle("Snapshot.getValue", e, "defaultValue", r, s), o = _(e, r, x(this.remoteConfig), n, z(s), s), i = r;
2081
+ }, t.prototype.on = function(e, r) {
2082
+ return this.options.hooks.on(e, r), this;
2083
+ }, t.prototype.once = function(e, r) {
2084
+ return this.options.hooks.once(e, r), this;
2085
+ }, t.prototype.removeListener = function(e, r) {
2086
+ return this.options.hooks.removeListener(e, r), this;
2087
+ }, t.prototype.removeAllListeners = function(e) {
2088
+ return this.options.hooks.removeAllListeners(e), this;
2089
+ }, t.prototype.listeners = function(e) {
2090
+ return this.options.hooks.listeners(e);
2091
+ }, t.prototype.listenerCount = function(e) {
2092
+ return this.options.hooks.listenerCount(e);
2093
+ }, t.prototype.eventNames = function() {
2094
+ return this.options.hooks.eventNames();
2095
+ }, t;
2096
+ }()
2097
+ ), re = (
2098
+ /** @class */
2099
+ function() {
2100
+ function t(e, r, n) {
2101
+ this.mergedSettings = e, this.remoteConfig = r, this.defaultUser = n.defaultUser, this.evaluator = n.evaluator, this.options = n.options, this.cacheState = r ? n.configService.getCacheState(r) : T.HasLocalOverrideFlagDataOnly;
1969
2102
  }
1970
- return this.options.hooks.emit("flagEvaluated", o), i;
1971
- }, t.prototype.getValueDetails = function(e, r, n) {
1972
- this.options.logger.debug("Snapshot.getValueDetails() called."), fe(e), he(r);
1973
- var i;
1974
- n ?? (n = this.defaultUser);
1975
- try {
1976
- i = le(this.evaluator, this.mergedSettings, e, r, n, this.remoteConfig, this.options.logger);
1977
- } catch (o) {
1978
- this.options.logger.settingEvaluationErrorSingle("Snapshot.getValueDetails", e, "defaultValue", r, o), i = _(e, r, x(this.remoteConfig), n, z(o), o);
2103
+ return Object.defineProperty(t.prototype, "fetchedConfig", {
2104
+ get: function() {
2105
+ var e = this.remoteConfig;
2106
+ return e && !e.isEmpty ? e.config : null;
2107
+ },
2108
+ enumerable: !1,
2109
+ configurable: !0
2110
+ }), t.prototype.getAllKeys = function() {
2111
+ return this.mergedSettings ? Object.keys(this.mergedSettings) : [];
2112
+ }, t.prototype.getValue = function(e, r, n) {
2113
+ this.options.logger.debug("Snapshot.getValue() called."), fe(e), he(r);
2114
+ var i, o;
2115
+ n ?? (n = this.defaultUser);
2116
+ try {
2117
+ o = le(this.evaluator, this.mergedSettings, e, r, n, this.remoteConfig, this.options.logger), i = o.value;
2118
+ } catch (s) {
2119
+ this.options.logger.settingEvaluationErrorSingle("Snapshot.getValue", e, "defaultValue", r, s), o = z(e, r, x(this.remoteConfig), n, _(s), s), i = r;
2120
+ }
2121
+ return this.options.hooks.emit("flagEvaluated", o), i;
2122
+ }, t.prototype.getValueDetails = function(e, r, n) {
2123
+ this.options.logger.debug("Snapshot.getValueDetails() called."), fe(e), he(r);
2124
+ var i;
2125
+ n ?? (n = this.defaultUser);
2126
+ try {
2127
+ i = le(this.evaluator, this.mergedSettings, e, r, n, this.remoteConfig, this.options.logger);
2128
+ } catch (o) {
2129
+ this.options.logger.settingEvaluationErrorSingle("Snapshot.getValueDetails", e, "defaultValue", r, o), i = z(e, r, x(this.remoteConfig), n, _(o), o);
2130
+ }
2131
+ return this.options.hooks.emit("flagEvaluated", i), i;
2132
+ }, t;
2133
+ }()
2134
+ ), ne = (
2135
+ /** @class */
2136
+ function() {
2137
+ function t(e, r) {
2138
+ this.settingKey = e, this.settingValue = r;
1979
2139
  }
1980
- return this.options.hooks.emit("flagEvaluated", i), i;
1981
- }, t;
1982
- }(), ne = function() {
1983
- function t(e, r) {
1984
- this.settingKey = e, this.settingValue = r;
1985
- }
1986
- return t;
1987
- }();
2140
+ return t;
2141
+ }()
2142
+ );
1988
2143
  function fe(t) {
1989
2144
  if (!t)
1990
2145
  throw new Error("Invalid 'key' value");
@@ -2011,19 +2166,19 @@ var se = function(t, e) {
2011
2166
  };
2012
2167
  return se(t, e);
2013
2168
  };
2014
- lt();
2015
- function Nt(t, e, r, n) {
2169
+ ft();
2170
+ function Lt(t, e, r, n) {
2016
2171
  return be.get(t, e, r, n);
2017
2172
  }
2018
2173
  function Rt(t) {
2019
2174
  return new Be(t);
2020
2175
  }
2021
- const Lt = (t, e) => {
2176
+ const Dt = (t, e) => {
2022
2177
  const r = t.__vccOpts || t;
2023
2178
  for (const [n, i] of e)
2024
2179
  r[n] = i;
2025
2180
  return r;
2026
- }, Dt = {
2181
+ }, Ft = {
2027
2182
  emits: ["flagValueChanged"],
2028
2183
  props: {
2029
2184
  featureKey: {
@@ -2039,41 +2194,38 @@ const Lt = (t, e) => {
2039
2194
  data() {
2040
2195
  return {
2041
2196
  isFeatureFlagEnabled: null
2197
+ // `null` indicates that the feature flag value is not available yet
2042
2198
  };
2043
2199
  },
2044
2200
  beforeMount() {
2045
2201
  this.configChangedHandler = () => {
2046
- const r = this.$configCat.client.snapshot().getValue(this.featureKey, !1, this.userObject);
2047
- this.isFeatureFlagEnabled !== r && (this.isFeatureFlagEnabled = r, this.$emit("flagValueChanged", r));
2202
+ const n = this.$configCat.client.snapshot().getValue(this.featureKey, !1, this.userObject);
2203
+ this.isFeatureFlagEnabled !== n && (this.isFeatureFlagEnabled = n, this.$emit("flagValueChanged", n));
2048
2204
  };
2049
- const t = this.$configCat.clientReadyState;
2050
- if (t == L.HasUpToDateFlagData || t == L.HasLocalOverrideFlagDataOnly) {
2051
- const e = this.$configCat.client.snapshot();
2052
- this.isFeatureFlagEnabled = e.getValue(this.featureKey, !1, this.userObject), this.$configCat.client.on("configChanged", this.configChangedHandler);
2053
- } else
2054
- this.$configCat.client.getValueAsync(this.featureKey, !1, this.userObject).then((e) => {
2055
- const r = this.configChangedHandler;
2056
- !r || (this.isFeatureFlagEnabled = e, this.$configCat.client.on("configChanged", r));
2057
- });
2205
+ const t = this.$configCat.client.snapshot(), e = t.cacheState;
2206
+ e == T.HasUpToDateFlagData || e == T.HasLocalOverrideFlagDataOnly ? (this.isFeatureFlagEnabled = t.getValue(this.featureKey, !1, this.userObject), this.$configCat.client.on("configChanged", this.configChangedHandler)) : this.$configCat.client.getValueAsync(this.featureKey, !1, this.userObject).then((r) => {
2207
+ const n = this.configChangedHandler;
2208
+ n && (this.isFeatureFlagEnabled = r, this.$configCat.client.on("configChanged", n));
2209
+ });
2058
2210
  },
2059
2211
  unmounted() {
2060
2212
  const t = this.configChangedHandler;
2061
2213
  delete this.configChangedHandler, this.$configCat.client.off("configChanged", t);
2062
2214
  }
2063
- }, Ft = { key: 0 }, Pt = { key: 1 }, Ut = { key: 2 };
2064
- function kt(t, e, r, n, i, o) {
2215
+ }, Pt = { key: 0 }, Ut = { key: 1 }, kt = { key: 2 };
2216
+ function Mt(t, e, r, n, i, o) {
2065
2217
  return Q(), ee("div", null, [
2066
- i.isFeatureFlagEnabled === !0 ? (Q(), ee("div", Ft, [
2218
+ i.isFeatureFlagEnabled === !0 ? (Q(), ee("div", Pt, [
2067
2219
  ge(t.$slots, "default")
2068
- ])) : i.isFeatureFlagEnabled === !1 ? (Q(), ee("div", Pt, [
2220
+ ])) : i.isFeatureFlagEnabled === !1 ? (Q(), ee("div", Ut, [
2069
2221
  ge(t.$slots, "else")
2070
- ])) : (Q(), ee("div", Ut, [
2222
+ ])) : (Q(), ee("div", kt, [
2071
2223
  ge(t.$slots, "loading")
2072
2224
  ]))
2073
2225
  ]);
2074
2226
  }
2075
- const qt = /* @__PURE__ */ Lt(Dt, [["render", kt]]);
2076
- class Mt {
2227
+ const Kt = /* @__PURE__ */ Dt(Ft, [["render", Mt]]);
2228
+ class Vt {
2077
2229
  handleStateChange(e, r, n) {
2078
2230
  try {
2079
2231
  if (e.readyState === 4) {
@@ -2100,7 +2252,7 @@ class Mt {
2100
2252
  });
2101
2253
  }
2102
2254
  }
2103
- class Vt {
2255
+ class xt {
2104
2256
  set(e, r) {
2105
2257
  try {
2106
2258
  localStorage.setItem(e, btoa(r));
@@ -2116,48 +2268,48 @@ class Vt {
2116
2268
  }
2117
2269
  }
2118
2270
  }
2119
- const xt = "1.3.0", Wt = {
2271
+ const Ht = "1.4.0", _t = {
2120
2272
  install: (t, e) => {
2121
- var a;
2122
- const r = {
2123
- client: void 0,
2124
- clientReadyState: void 0
2125
- }, n = (a = e.clientOptions) == null ? void 0 : a.setupHooks, i = {
2126
- ...e.clientOptions,
2127
- setupHooks: (c) => {
2128
- c.once("clientReady", (u) => r.clientReadyState = u), n == null || n(c);
2129
- }
2130
- };
2131
- let o = e.pollingMode === "manual" ? j.ManualPoll : e.pollingMode === "lazy" ? j.LazyLoad : j.AutoPoll;
2132
- r.client = Nt(
2273
+ let r = (
2274
+ // https://configcat.com/docs/sdk-reference/js/#manual-polling
2275
+ e.pollingMode === "manual" ? j.ManualPoll : (
2276
+ // https://configcat.com/docs/sdk-reference/js/#lazy-loading
2277
+ e.pollingMode === "lazy" ? j.LazyLoad : (
2278
+ // Auto poll is default
2279
+ j.AutoPoll
2280
+ )
2281
+ )
2282
+ );
2283
+ const n = Lt(
2133
2284
  e.SDKKey,
2134
- o,
2135
- i,
2285
+ r,
2286
+ e.clientOptions,
2136
2287
  {
2137
2288
  sdkType: "ConfigCat-Vue",
2138
- sdkVersion: xt,
2139
- configFetcher: new Mt(),
2140
- defaultCacheFactory: (c) => new _e(new Vt(), c.logger)
2289
+ sdkVersion: Ht,
2290
+ configFetcher: new Vt(),
2291
+ defaultCacheFactory: (s) => new ze(new xt(), s.logger)
2141
2292
  }
2142
- ), t.config.globalProperties.$configCat = r;
2143
- const s = t.unmount;
2293
+ ), i = { client: n };
2294
+ t.config.globalProperties.$configCat = i;
2295
+ const o = t.unmount;
2144
2296
  t.unmount = function() {
2145
- s.apply(this, arguments), configCatClient.close();
2297
+ o.apply(this, arguments), n.dispose();
2146
2298
  };
2147
2299
  }
2148
2300
  };
2149
- function Kt(t) {
2301
+ function zt(t) {
2150
2302
  return Rt(t);
2151
2303
  }
2152
- function zt(t, e) {
2153
- return new at(new st(t), e);
2304
+ function Bt(t, e) {
2305
+ return new ut(new at(t), e);
2154
2306
  }
2155
2307
  export {
2156
- L as ClientReadyState,
2308
+ qt as ClientReadyState,
2157
2309
  g as Comparator,
2158
- Wt as ConfigCatPlugin,
2310
+ _t as ConfigCatPlugin,
2159
2311
  ue as DataGovernance,
2160
- qt as FeatureWrapper,
2312
+ Kt as FeatureWrapper,
2161
2313
  A as FormattableLogMessage,
2162
2314
  v as LogLevel,
2163
2315
  P as OverrideBehaviour,
@@ -2165,7 +2317,7 @@ export {
2165
2317
  ae as RefreshResult,
2166
2318
  ne as SettingKeyValue,
2167
2319
  Se as SettingType,
2168
- jt as User,
2169
- Kt as createConsoleLogger,
2170
- zt as createFlagOverridesFromMap
2320
+ Wt as User,
2321
+ zt as createConsoleLogger,
2322
+ Bt as createFlagOverridesFromMap
2171
2323
  };