@statsig/js-on-device-eval-client 0.0.1-beta.21 → 0.0.1-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@statsig/js-on-device-eval-client",
3
- "version": "0.0.1-beta.21",
3
+ "version": "0.0.1-beta.23",
4
4
  "dependencies": {
5
- "@statsig/client-core": "0.0.1-beta.21",
6
- "@statsig/sha256": "0.0.1-beta.21"
5
+ "@statsig/client-core": "0.0.1-beta.23",
6
+ "@statsig/sha256": "0.0.1-beta.23"
7
7
  },
8
8
  "jsdelivr": "./build/statsig-js-on-device-eval-client.min.js",
9
9
  "type": "commonjs",
@@ -7,14 +7,11 @@ declare global {
7
7
  }
8
8
  }
9
9
  export default class StatsigOnDeviceEvalClient extends StatsigClientBase<SpecsDataAdapter> implements OnDeviceEvaluationsInterface {
10
- private _network;
11
- private _options;
12
10
  private _store;
13
11
  private _evaluator;
14
12
  constructor(sdkKey: string, options?: StatsigOptions | null);
15
13
  initializeSync(): void;
16
14
  initializeAsync(): Promise<void>;
17
- shutdown(): Promise<void>;
18
15
  checkGate(name: string, user: StatsigUser, options?: FeatureGateEvaluationOptions): boolean;
19
16
  getFeatureGate(name: string, user: StatsigUser, options?: FeatureGateEvaluationOptions): FeatureGate;
20
17
  getDynamicConfig(name: string, user: StatsigUser, options?: DynamicConfigEvaluationOptions): DynamicConfig;
@@ -21,8 +21,6 @@ class StatsigOnDeviceEvalClient extends client_core_1.StatsigClientBase {
21
21
  super(sdkKey, (_a = options === null || options === void 0 ? void 0 : options.dataAdapter) !== null && _a !== void 0 ? _a : new StatsigSpecsDataAdapter_1.StatsigSpecsDataAdapter(), network, options);
22
22
  (0, client_core_1.monitorClass)(this._errorBoundary, this);
23
23
  (0, client_core_1.monitorClass)(this._errorBoundary, network);
24
- this._options = options !== null && options !== void 0 ? options : {};
25
- this._network = network;
26
24
  this._store = new SpecStore_1.default();
27
25
  this._evaluator = new Evaluator_1.default(this._store);
28
26
  }
@@ -46,11 +44,6 @@ class StatsigOnDeviceEvalClient extends client_core_1.StatsigClientBase {
46
44
  this._setStatus('Ready', result);
47
45
  });
48
46
  }
49
- shutdown() {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- yield this._logger.shutdown();
52
- });
53
- }
54
47
  checkGate(name, user, options) {
55
48
  return this.getFeatureGate(name, user, options).value;
56
49
  }
@@ -1 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StatsigOnDeviceEval=e():t.StatsigOnDeviceEval=e()}(this,()=>(()=>{"use strict";var n={496:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var e="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},i="undefined"!=typeof globalThis?globalThis:{},r=null!=(r=null!=(r=null!=(r=e.__STATSIG__)?r:n.__STATSIG__)?r:i.__STATSIG__)?r:{};e.__STATSIG__=r,n.__STATSIG__=r,i.__STATSIG__=r},856:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},320:function(t,e,n){var s=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCore=void 0;const i=n(512),r=n(780),o=n(104),u=n(283),a=n(296),l=n(444),c=n(412);e.DataAdapterCore=class{constructor(t,e){this.i=t,this.o=e,this.u=null,this.l=null,this.h={},this.v="statsig.last_modified_time."+e}attach(t,e){this.l=t,this.u=new i.ErrorBoundary(t),(0,o.monitorClass)(this.u,this)}getDataSync(t){var t=this._(t),e=this.h[t];return e||((e=this.p(t))?(this.m(t,e),this.h[t]):null)}getDataAsync(n,i){var r;return s(this,void 0,void 0,function*(){var t=null!=n?n:this.getDataSync(i),t=yield this.O(null!=(r=null==t?void 0:t.data)?r:null,i),e=this._(i);return t&&this.m(e,t),"Network"!==(null==t?void 0:t.source)&&"NetworkNotModified"!==(null==t?void 0:t.source)||(yield this.j(e,t)),t})}prefetchData(n){return s(this,void 0,void 0,function*(){var t=this._(n),e=yield this.getDataAsync(null,n);e&&this.m(t,Object.assign(Object.assign({},e),{source:"Prefetch"}))})}setData(t,e){e=this._(e);this.m(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.h=Object.assign(Object.assign({},this.h),t)}O(n,i){return s(this,void 0,void 0,function*(){var t,e=yield this.S(n,i);return e?(t=(0,c.typedJsonParse)(e,"has_updates","Failure while attempting to persist latest value"),n&&!1===(null==t?void 0:t.has_updates)?{source:"NetworkNotModified",data:n,receivedAt:Date.now()}:!0!==(null==t?void 0:t.has_updates)?null:{source:"Network",data:e,receivedAt:Date.now()}):(r.Log.debug("No response returned for latest value"),null)})}N(){return null!=this.l?this.l:(r.Log.error(this.i+" is not attached to a Client"),"")}_(t){t=(0,a.getUserStorageKey)(this.N(),t);return`${u.DataAdapterCachePrefix}.${this.o}.`+t}m(t,e){var n=Object.entries(this.h);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.h[n]),this.h[t]=e}p(t){var e=null==(e=l.Storage.getItemSync)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?Object.assign(Object.assign({},t),{source:"Cache"}):null}j(t,e){return s(this,void 0,void 0,function*(){yield l.Storage.setItem(t,JSON.stringify(e)),yield this.I(t)})}I(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,l.getObjectFromStorage)(this.v))?i:{},e=(t[n]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield l.Storage.removeItem(e[0])),yield(0,l.setObjectInStorage)(this.v,t)})}}},280:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(780),r="undefined"!=typeof performance&&void 0!==performance.mark;let s=[];e.captureDiagnostics=function(t,e){o.mark(t+":start"),e=e();const n=()=>{o.mark(t+":end"),(t+":end").startsWith("initialize:")&&o.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class o{static mark(t,e){r&&(t=performance.mark(t,{detail:e}),s.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith("https://api.statsig.com")),t={markers:s,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),s=[]}}e.Diagnostics=o},512:function(t,u,e){var n=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),a=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t){this.l=t,this.M=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.T(e,t,n)):i}catch(t){return this.T(e,t,n),null}}logError(t,e){this.T(t,e)}T(r,s,o){try{i.Log.warn("Caught error in "+r,{error:s});n(this,void 0,void 0,function*(){var t,e=null!=s?s:Error("[Statsig] Error was empty"),n=e instanceof Error,i=n?e.name:"No Name";this.M.has(i)||(this.M.add(i),t=a.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(e),e=JSON.stringify(Object.assign({tag:r,exception:i,info:n},t)),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.l,"STATSIG-SDK-TYPE":String(t.sdkType),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=o&&o({name:"error",error:s}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},788:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},728:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.EventLogger=void 0;const r=n(832),s=n(780),o=n(876),u=n(972),a=n(444),l=n(412),c=n(84),d=n(408),h="https://api.statsig.com/v1";e.EventLogger=class{constructor(t,e,n,i){this.l=t,this.D=e,this.A=n,this.P=i,this.C=[],this.qt={},this.Kt={},this.F=!1,this.L=Date.now(),this.V=!0===(null==i?void 0:i.disableLogging),this.R=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4;this.K=setInterval(()=>this.q(),n),this.Ft=(0,c.Lt)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",h),this.Vt=(0,c.Lt)(null==i?void 0:i.logEventBeaconUrl,null==i?void 0:i.api,"/log_event_beacon",h),d.VisibilityChangeObserver.add(this),this.J()}setLoggingDisabled(t){this.V=t}enqueue(t){this.U(t)&&(this.Jt(t),this.B(),this.C.length>this.R)&&this.q()}incrementNonExposureCount(t){var e=null!=(e=this.Kt[t])?e:0;this.Kt[t]=e+1}reset(){this.qt={}}onVisibilityChanged(t){"background"===t&&this.q()}shutdown(){return i(this,void 0,void 0,function*(){this.K&&(clearInterval(this.K),this.K=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.zt(),0!==this.C.length&&(t=this.C,this.C=[],yield this.W(t))})}B(){this.F||(this.F=!0,200<Date.now()-this.L)||setTimeout(()=>this.q(),200)}U(t){if((0,o.isExposureEvent)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.qt[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.qt).length&&(this.qt={}),this.qt[t]=n}return!0}q(){this.flush().catch(()=>{})}W(t){return i(this,void 0,void 0,function*(){if(this.V)this.Y(t);else try{(!d.VisibilityChangeObserver.isCurrentlyVisible()&&this.A.isBeaconSupported()?yield this.H(t):yield this.X(t)).success?this.D({name:"logs_flushed",events:t}):this.Y(t)}catch(t){s.Log.warn("Failed to flush events.")}})}X(e){return i(this,void 0,void 0,function*(){var t=yield this.A.post({sdkKey:this.l,data:{events:e},url:this.Ft,retries:3,params:{ec:String(e.length)}}),t=null!=t&&t.body?(0,l.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}H(t){return i(this,void 0,void 0,function*(){return{success:yield this.A.beacon({sdkKey:this.l,data:{events:t},url:this.Vt})}})}Y(t){for(;500<t.length;)t.shift();var e=this.Z();(0,a.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}J(){const e=this.Z();i(this,void 0,void 0,function*(){var t=yield(0,a.getObjectFromStorage)(e);t&&(yield a.Storage.removeItem(e),yield this.W(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}Z(){return"statsig.failed_logs."+(0,r.DJB2)(this.l)}Jt(t){t.user&&(t.user=Object.assign({},t.user),delete t.user.privateAttributes);var{sdkType:e,sdkVersion:n}=u.StatsigMetadataProvider.get();this.C.push(Object.assign(Object.assign({},t),{statsigMetadata:{sdkType:e,sdkVersion:n}}))}zt(){0!==Object.keys(this.Kt).length&&(this.Jt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this.Kt)}}),this.Kt={})}}},832:(t,e)=>{function n(e){let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)}Object.defineProperty(e,"__esModule",{value:!0}),e.DJB2Object=e.DJB2=void 0,e.DJB2=n,e.DJB2Object=function(t){return n(JSON.stringify(function n(i){if(null==i)return null;const t=Object.keys(i).sort();const r={};t.forEach(t=>{let e=i[t];e instanceof Object&&(e=n(e)),r[t]=e});return r}(t)))}},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},104:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.monitorClass=void 0;const s=n(280),o=n(688);function c(t,e,n,i){var r=i instanceof o.StatsigClientBase?i.tt.bind(i):void 0;return t.capture(e,()=>(0,s.captureDiagnostics)(e,()=>n.apply(i)),r)}function d(t){return"object"==typeof t&&(t=Object.getPrototypeOf(t))&&"object"==typeof t?t:null}e.monitorClass=function(e,t){try{{var n=e;var i=t;var r;const s=i;for(const o of function(t){const e=new Set;let n=d(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(s))if("constructor"!==o){const u=s[o];s[o]=function(...t){return c(n,o,()=>u.apply(this,t),i)}}for(const a of function(t){const e=new Set,n=d(t);return Object.getOwnPropertyNames((null===n||void 0===n?void 0:n.constructor)||{}).filter(t=>{var e;return"caller"!==t&&"arguments"!==t&&"callee"!==t&&"function"==typeof(null==(e=null===n||void 0===n?void 0:n.constructor)?void 0:e[t])}).forEach(t=>e.add(t)),Array.from(e)}(s)){const l=null==(r=null===s||void 0===s?void 0:s.constructor)?void 0:r[a];(null===s||void 0===s?void 0:s.constructor)[a]=function(...t){return c(n,s.constructor.name+"."+a,()=>l.apply(s.constructor,t),i)}}return}}catch(t){e.logError("monitorClass",t)}}},188:function(t,e,n){var r=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.NetworkCore=void 0;const h=n(280),v=n(780),s=n(612),o=n(604),u=n(972);e.NetworkCore=class{constructor(t,e){this.P=t,this.D=e,this.et=null!=(e=null==t?void 0:t.networkTimeoutMs)?e:1e4}post(e){return r(this,void 0,void 0,function*(){var t=yield this.nt(e);return this.it(Object.assign({method:"POST",body:t},e))})}get(t){return r(this,void 0,void 0,function*(){return this.it(Object.assign({method:"GET"},t))})}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return r(this,void 0,void 0,function*(){var t=this.rt(n),e=yield this.nt(n);return navigator.sendBeacon(t,e)})}it(c){var d;return r(this,void 0,void 0,function*(){var{method:e,body:n,retries:i}=c;const r=new AbortController;var t,s,o,u=setTimeout(()=>r.abort(`Timeout of ${this.et}ms expired.`),this.et),a=this.rt(c);let l=null;try{if(l=yield fetch(a,{method:e,body:n,headers:Object.assign({},c.headers),signal:r.signal}),clearTimeout(u),l.ok)return o=yield l.text(),h.Diagnostics.mark("_sendRequest:response-received",{status:l.status,contentLength:l.headers.get("content-length")}),{body:o,code:l.status};throw t=yield l.text().catch(()=>"No Text"),(s=new Error(`Failed to fetch: ${a} `+t)).name="NetworkError",s}catch(t){n=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(r,t);return h.Diagnostics.mark("_sendRequest:error",{error:n,status:null===l||void 0===l?void 0:l.status,contentLength:null===l||void 0===l?void 0:l.headers.get("content-length")}),!i||i<=0?(null!=(d=this.D)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${a}.`,n,t),null):this.it(Object.assign(Object.assign({},c),{retries:i-1}))}})}rt(t){var e=u.StatsigMetadataProvider.get(),e=Object.assign({k:t.sdkKey,st:e.sdkType,sv:e.sdkVersion,t:String(Date.now()),sid:s.SessionID.get(t.sdkKey)},t.params),e=Object.entries(e).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return t.url+(e?"?"+e:"")}nt(i){return r(this,void 0,void 0,function*(){var t=i["data"],e=yield o.StableID.get(i.sdkKey),n=s.SessionID.get(i.sdkKey);return JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},u.StatsigMetadataProvider.get()),{stableID:e,sessionID:n})}))})}}},264:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CombinationOverrideAdapter=void 0;e.CombinationOverrideAdapter=class{constructor(t){this.providers=t}getGateOverride(n,i){return this.ot(t=>{var e;return null!=(e=null==(e=t.getGateOverride)?void 0:e.call(t,n,i))?e:null})}getDynamicConfigOverride(n,i){return this.ot(t=>{var e;return null!=(e=null==(e=t.getDynamicConfigOverride)?void 0:e.call(t,n,i))?e:null})}ot(t){for(const n of this.providers){var e=t(n);if(e)return e}return null}}},612:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SessionID=void 0;const i=n(556),r={};e.SessionID={get:t=>(null==r[t]&&(r[t]=(0,i.getUUID)()),r[t])}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StableID=void 0;const r=n(832),s=n(780),o=n(444),u=n(556),a={};function l(t){return"statsig.stable_id."+(0,r.DJB2)(t)}function c(t,e){e=l(e);(0,o.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==a[e]&&(a[e]=function(t){t=l(t);return(0,o.getObjectFromStorage)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),a[e]}),setOverride:(t,e)=>{a[e]=Promise.resolve(t),c(t,e)}}},688:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClientBase=void 0,n(496);const s=n(512),o=n(728),u=n(780),a=n(604),l=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.l=t,this.loadingStatus="Uninitialized",this.ut={},null!=i&&i.disableStorage&&l.Storage.setDisabled(!0),null!=i&&i.overrideStableID&&a.StableID.setOverride(i.overrideStableID,t),u.Log.level=null!=(r=null==i?void 0:i.logLevel)?r:u.LogLevel.Warn,this.Pt=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.lt=new o.EventLogger(t,this.tt.bind(this),n,i),this.u=new s.ErrorBoundary(t);var r,n=null!=(r=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).instances)?r:{};n[t]=this,__STATSIG__.instances=n,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&this.lt.setLoggingDisabled(t.disableLogging),null!=t.disableStorage&&l.Storage.setDisabled(t.disableStorage)}flush(){return this.lt.flush()}on(t,e){this.ut[t]||(this.ut[t]=[]),this.ut[t].push(e)}off(t,e){this.ut[t]&&-1!==(e=this.ut[t].indexOf(e))&&this.ut[t].splice(e,1)}tt(e){var t;const n=t=>{try{t(e)}catch(t){u.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this.ut[e.name]&&this.ut[e.name].forEach(t=>n(t)),null!=(t=this.ut["*"])&&t.forEach(n)}ct(t,e){this.loadingStatus=t,this.tt({name:"values_updated",status:t,values:e})}dt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.lt.incrementNonExposureCount(t):this.lt.enqueue(e)}}},808:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},283:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLayerParameterExposure=e.createConfigExposure=e.createGateExposure=e.isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure";function a(t,e,n,i,r){return{eventName:t,user:e,value:null,metadata:function(t,e){e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut));t.receivedAt&&(e.receivedAt=String(t.receivedAt));return e}(n,i),secondaryExposures:r,time:Date.now()}}e.isExposureEvent=function({eventName:t}){return t===i||t===n},e.createGateExposure=function(t,e){return a(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createConfigExposure=function(t,e){return a(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createLayerParameterExposure=function(t,e,n){var i,r=e.__evaluation,s=!0===(null==(s=null==r?void 0:r.explicit_parameters)?void 0:s.includes(n));let o="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),a("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},u)}},972:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigMetadataProvider=void 0;let n={sdkVersion:"0.0.1-beta.21",sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=Object.assign(Object.assign({},n),t)}}},384:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},136:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.makeLayer=e.makeDynamicConfig=e.makeFeatureGate=void 0;const r="default";e.makeFeatureGate=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,value:!0===(null==n?void 0:n.value),__evaluation:n}},e.makeDynamicConfig=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,value:null!=(e=null==n?void 0:n.value)?e:{},__evaluation:n}},e.makeLayer=function(t,e,n,i){return{name:t,details:e,getValue:null!=i?i:()=>{},ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,Et:null!=(e=null==n?void 0:n.value)?e:{},__evaluation:n}}},296:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const i=n(832);e.normalizeUser=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,i.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}},444:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})},n=(Object.defineProperty(e,"__esModule",{value:!0}),e.setObjectInStorage=e.getObjectFromStorage=e.Storage=void 0,n(780));const r={},s={getProviderName:()=>"InMemory",getItemSync(t){return null!=(t=r[t])?t:null},getItem(t){return Promise.resolve(null!=(t=r[t])?t:null)},setItem(t,e){return r[t]=e,Promise.resolve()},removeItem(t){return delete r[t],Promise.resolve()},getAllKeys(){return Promise.resolve(Object.keys(r))}};let o=null;try{"undefined"!=typeof window&&"localStorage"in window&&(o={getProviderName:()=>"LocalStorage",getItemSync(t){return localStorage.getItem(t)},getItem(t){return Promise.resolve(localStorage.getItem(t))},setItem(t,e){return localStorage.setItem(t,e),Promise.resolve()},removeItem(t){return localStorage.removeItem(t),Promise.resolve()},getAllKeys(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:s,a=u;e.Storage={getProviderName:()=>a.getProviderName(),getItem:t=>a.getItem(t),setItem:(t,e)=>a.setItem(t,e),removeItem:t=>a.removeItem(t),getAllKeys:()=>a.getAllKeys(),getItemSync:t=>{var e;return null!=(e=null==(e=a.getItemSync)?void 0:e.call(a,t))?e:null},setProvider:t=>{u=t,a=t},setDisabled:t=>{a=t?s:u}},e.getObjectFromStorage=function(e){return i(this,void 0,void 0,function*(){var t=yield a.getItem(e);return JSON.parse(null!=t?t:"null")})},e.setObjectInStorage=function(t,e){return i(this,void 0,void 0,function*(){yield a.setItem(t,JSON.stringify(e))})}},412:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.typedJsonParse=void 0;const r=n(780);e.typedJsonParse=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return r.Log.error(n),null}},556:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Lt=void 0,e.Lt=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},408:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VisibilityChangeObserver=void 0;class n{static isCurrentlyVisible(){return"foreground"===this.ht}static add(t){this.ut.push(t)}static remove(t){t=this.ut.indexOf(t);-1!==t&&this.ut.splice(t,1)}static notify(e){e!==this.ht&&(this.ht=e,this.ut.forEach(t=>t.onVisibilityChanged(e)))}}(e.VisibilityChangeObserver=n).ut=[],n.ht="foreground","undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("focus",()=>n.notify("foreground")),window.addEventListener("blur",()=>n.notify("background")),window.addEventListener("beforeunload",()=>n.notify("background"))),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",()=>{n.notify("visible"===document.visibilityState?"foreground":"background")})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.Storage=e.EventLogger=void 0,n(496);const s=n(728),o=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}}),n(780)),u=(Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return o.Log}}),n(444));Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return u.Storage}}),r(n(496),e),r(n(856),e),r(n(320),e),r(n(512),e),r(n(500),e),r(n(788),e),r(n(832),e),r(n(780),e),r(n(104),e),r(n(188),e),r(n(264),e),r(n(604),e),r(n(688),e),r(n(808),e),r(n(283),e),r(n(876),e),r(n(972),e),r(n(384),e),r(n(136),e),r(n(296),e),r(n(444),e),r(n(412),e),r(n(84),e),r(n(539),e),r(n(556),e),r(n(408),e),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:s.EventLogger,Log:o.Log,Storage:u.Storage})},532:(t,e)=>{function u(t){return t.setUTCHours(0,0,0,0),t.getTime()}Object.defineProperty(e,"__esModule",{value:!0}),e.default={compareNumbers(t,e,n){if(null==t||null==e)return!1;var i=Number(t),r=Number(e);if(isNaN(i)||isNaN(r))return!1;switch(n){case"gt":return e<t;case"gte":return e<=t;case"lt":return t<e;case"lte":return t<=e;default:return!1}},compareVersions(t,e,n){if(null==t||null==e)return!1;var t=String(t),e=String(e),i=t=>{var e=t.indexOf("-");return-1!==e?t.substring(0,e):t},r=((t,e)=>{var n=t.split(".").map(t=>parseInt(t)),i=e.split(".").map(t=>parseInt(t));let r=0;for(;r<Math.max(n.length,i.length);){var s=r<n.length?n[r]:0,o=r<i.length?i[r]:0;if(s<o)return-1;if(o<s)return 1;r++}return 0})(i(t),i(e));switch(n){case"version_gt":return 0<r;case"version_gte":return 0<=r;case"version_lt":return r<0;case"version_lte":return r<=0;case"version_eq":return 0===r;case"version_neq":return 0!==r;default:return!1}},compareStringInArray(r,t,s){if(!Array.isArray(t))return!1;const o="any_case_sensitive"!==s&&"none_case_sensitive"!==s;var e=-1!==t.findIndex(t=>{var e=String(r),t=String(t),n=o?e.toLowerCase():e,i=o?t.toLowerCase():t;switch(s){case"any":case"none":case"any_case_sensitive":case"none_case_sensitive":return n===i;case"str_starts_with_any":return n.startsWith(i);case"str_ends_with_any":return n.endsWith(i);case"str_contains_any":case"str_contains_none":return n.includes(i);default:return!1}});switch(s){case"none":case"none_case_sensitive":case"str_contains_none":return!e;default:return e}},compareStringWithRegEx(t,e){try{var n=String(t);if(n.length<1e3)return new RegExp(String(e)).test(n)}catch(t){}return!1},compareTime(n,i,r){if(null==n||null==i)return!1;try{let t=new Date(String(n)),e=(isNaN(t.getTime())&&(t=new Date(Number(n))),new Date(String(i)));isNaN(e.getTime())&&(e=new Date(Number(i)));var s=t.getTime(),o=e.getTime();if(isNaN(s)||isNaN(o))return!1;switch(r){case"before":return s<o;case"after":return o<s;case"on":return u(t)===u(e);default:return!1}}catch(t){return!1}}}},947:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resultToLayerEval=e.resultToConfigEval=e.resultToGateEval=e.makeEvalResult=void 0,e.makeEvalResult=function(t){return Object.assign(Object.assign({},{unsupported:!1,bool_value:!1,rule_id:"",secondary_exposures:[],json_value:{},explicit_parameters:null,allocated_experiment_name:null,is_experiment_group:!1,group_name:null,undelegated_secondary_exposures:void 0}),t)},e.resultToGateEval=function(t,e){return{name:t.name,id_type:t.idType,rule_id:e.rule_id,value:e.bool_value,secondary_exposures:e.secondary_exposures}},e.resultToConfigEval=function(t,e){var n;return{name:t.name,id_type:t.idType,rule_id:e.rule_id,value:e.json_value,secondary_exposures:e.secondary_exposures,group:null!=(n=e.group_name)?n:"",group_name:null!=(n=e.group_name)?n:void 0,is_device_based:!1,is_experiment_active:t.isActive,is_user_in_experiment:e.is_experiment_group}},e.resultToLayerEval=function(t,e,n){return{name:t.name,rule_id:n.rule_id,value:n.json_value,secondary_exposures:n.secondary_exposures,undelegated_secondary_exposures:n.undelegated_secondary_exposures,allocated_experiment_name:null!=(t=n.allocated_experiment_name)?t:"",explicit_parameters:null!=(t=n.explicit_parameters)?t:[],group:null!=(t=n.group_name)?t:"",group_name:null!=(t=n.group_name)?t:void 0,is_device_based:!1,is_experiment_active:null==e?void 0:e.isActive,is_user_in_experiment:n.is_experiment_group}}},931:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const c=n(464),i=n(452),d=n(532),h=n(947);function v(t){return(0,i.SHA256)(t).dataView().getBigUint64(0,!1)}function u(t){return null!=t&&"object"==typeof t}e.default=class{constructor(t){this.vt=t}evaluateGate(t,e){var{spec:t,details:n}=this.Ct("gate",t);return t?{evaluation:(0,h.resultToGateEval)(t,this.ft(t,e)),details:n}:{evaluation:null,details:n}}evaluateConfig(t,e){var{spec:t,details:n}=this.Ct("config",t);return t?{evaluation:(0,h.resultToConfigEval)(t,this.ft(t,e)),details:n}:{evaluation:null,details:n}}evaluateLayer(t,e){var n,{spec:t,details:i}=this.Ct("layer",t);return t?(n=null!=(n=null==(e=this.ft(t,e))?void 0:e.allocated_experiment_name)?n:"",n=this.vt.getSpecAndSourceInfo("config",n).spec,{evaluation:(0,h.resultToLayerEval)(t,n,e),details:i}):{evaluation:null,details:i}}Ct(t,e){t=this.vt.getSpecAndSourceInfo(t,e);return{details:this.Gt(t),spec:t.spec}}Gt(t){var{source:t,spec:e,lcut:n,receivedAt:i}=t;return"Uninitialized"===t||"NoValues"===t?{reason:t}:{reason:t+":"+(null==e?"Unrecognized":"Recognized"),lcut:n,receivedAt:i}}ft(t,e){var n=u(t.defaultValue)?t.defaultValue:void 0;if(!t.enabled)return(0,h.makeEvalResult)({json_value:n,rule_id:"disabled"});var i=[];for(const o of t.rules){var r,s=this.gt(o,e);if(s.unsupported)return s;if(i.push(...s.secondary_exposures),s.bool_value)return this.bt(o.configDelegate,e,i)||(r=function(t,e,n){if(100===t.passPercentage)return!0;if(0===t.passPercentage)return!1;e=v(n.salt+"."+(null!=(n=t.salt)?n:t.id)+"."+(null!=(n=(0,c.getUnitIDFromUser)(e,t.idType))?n:""));return Number(e%BigInt(1e4))<100*t.passPercentage}(o,e,t),(0,h.makeEvalResult)({rule_id:s.rule_id,bool_value:r,json_value:r?s.json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,is_experiment_group:s.is_experiment_group,group_name:s.group_name}))}return(0,h.makeEvalResult)({json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,rule_id:"default"})}gt(t,e){var n=[];let i=!0;for(const s of t.conditions){var r=this.yt(s,e);if(r.unsupported)return r;n.push(...r.secondary_exposures),r.bool_value||(i=!1)}return(0,h.makeEvalResult)({rule_id:t.id,bool_value:i,json_value:u(t.returnValue)?t.returnValue:void 0,secondary_exposures:n,is_experiment_group:!0===t.isExperimentGroup,group_name:t.groupName})}yt(t,e){let n=null,i=!1;var r=t.field,s=t.targetValue,o=t.idType,u=t.type;switch(u){case"public":return(0,h.makeEvalResult)({bool_value:!0});case"pass_gate":case"fail_gate":var a=String(s),a=this.Ot(a,e);return(0,h.makeEvalResult)({bool_value:"fail_gate"===u?!a.bool_value:a.bool_value,secondary_exposures:a.secondary_exposures});case"multi_pass_gate":case"multi_fail_gate":return this.jt(s,u,e);case"user_field":case"ip_based":case"ua_based":n=function(t,e){var n;if(null==e||"object"!=typeof t||null==t)return null;var i=t;return null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=i[e])?n:i[e.toLowerCase()])?n:null==(i=null==t?void 0:t.custom)?void 0:i[e])?n:null==(i=null==t?void 0:t.custom)?void 0:i[e.toLowerCase()])?n:null==(i=null==t?void 0:t.privateAttributes)?void 0:i[e])?n:null==(i=null==t?void 0:t.privateAttributes)?void 0:i[e.toLowerCase()]}(e,r);break;case"environment_field":n=function(t,e){if(null==e)return null;t=t.statsigEnvironment;if(null!=t){const n=e.toLowerCase(),i=Object.keys(t).find(t=>t.toLowerCase()===n);return void 0!==i?t[i]:void 0}}(e,r);break;case"current_time":n=Date.now();break;case"user_bucket":a=v(null!==(a=String(null!=(a=null==(a=t.additionalValues)?void 0:a.salt)?a:"")+"."+(0,c.getUnitIDFromUser)(e,o))?a:"");n=Number(a%BigInt(1e3));break;case"unit_id":n=(0,c.getUnitIDFromUser)(e,o);break;default:return(0,h.makeEvalResult)({unsupported:!0})}var l=t.operator;switch(l){case"gt":case"gte":case"lt":case"lte":i=d.default.compareNumbers(n,s,l);break;case"version_gt":case"version_gte":case"version_lt":case"version_lte":case"version_eq":case"version_neq":i=d.default.compareVersions(n,s,l);break;case"any":case"none":case"str_starts_with_any":case"str_ends_with_any":case"str_contains_any":case"str_contains_none":case"any_case_sensitive":case"none_case_sensitive":i=d.default.compareStringInArray(n,s,l);break;case"str_matches":i=d.default.compareStringWithRegEx(n,s);break;case"before":case"after":case"on":i=d.default.compareTime(n,s,l);break;case"eq":i=n==s;break;case"neq":i=n!=s;break;case"in_segment_list":case"not_in_segment_list":return(0,h.makeEvalResult)({unsupported:!0})}return(0,h.makeEvalResult)({bool_value:i})}bt(t,e,n){var i;return t&&(i=this.vt.getSpecAndSourceInfo("config",t).spec,i)?(e=this.ft(i,e),(0,h.makeEvalResult)(Object.assign(Object.assign({},e),{allocated_experiment_name:t,explicit_parameters:i.explicitParameters,secondary_exposures:n.concat(e.secondary_exposures),undelegated_secondary_exposures:n}))):null}Ot(t,e){var n=[];let i=!1;var r=this.vt.getSpecAndSourceInfo("gate",t)["spec"];if(r){r=this.ft(r,e);if(r.unsupported)return r;i=r.bool_value,n.push(...r.secondary_exposures),n.push({gate:t,gateValue:String(i),ruleID:r.rule_id})}return(0,h.makeEvalResult)({bool_value:i,secondary_exposures:n})}jt(t,e,n){if(!Array.isArray(t))return(0,h.makeEvalResult)({unsupported:!0});var i="multi_pass_gate"===e,r=[];let s=!1;for(const u of t){if("string"!=typeof u)return(0,h.makeEvalResult)({unsupported:!0});var o=this.Ot(u,n);if(o.unsupported)return o;if(r.push(...o.secondary_exposures),i?!0===o.bool_value:!1===o.bool_value){s=!0;break}}return(0,h.makeEvalResult)({bool_value:s,secondary_exposures:r})}}},160:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const r=n(464);class s extends r.NetworkCore{constructor(t=null){super(t),this.Rt=(0,r.Lt)(null==t?void 0:t.downloadConfigSpecsUrl,null==t?void 0:t.api,"/download_config_specs","https://api.statsigcdn.com/v1")}fetchConfigSpecs(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.get({sdkKey:e,url:this.Rt});return null!=(n=null==t?void 0:t.body)?n:null})}}e.default=s},480:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(464);e.default=class{constructor(){this.wt=null,this.xt="Uninitialized",this.Nt=0,this.It=0}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse DownloadConfigSpecsResponse"))?void 0:e.has_updates)&&(this.Nt=e.time,this.It=t.receivedAt,this.xt=t.source,this.wt=e)}reset(){this.wt=null,this.xt="Loading"}finalize(){this.wt||(this.xt="NoValues")}getSpecAndSourceInfo(t,e){var t=this.Mt(t);return{spec:null!=(t=null==t?void 0:t.find(t=>t.name===e))?t:null,source:this.xt,lcut:this.Nt,receivedAt:this.It}}Mt(t){var e;switch(t){case"gate":return null==(e=this.wt)?void 0:e.feature_gates;case"config":return null==(e=this.wt)?void 0:e.dynamic_configs;case"layer":return null==(e=this.wt)?void 0:e.layer_configs}}}},348:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});n(464).StatsigMetadataProvider.add({sdkType:"js-on-device-eval-client"})},368:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const u=n(464),r=n(931),s=n(160),o=n(480),a=n(4);class l extends u.StatsigClientBase{constructor(t,e=null){var n=new s.default(e);super(t,null!=(t=null==e?void 0:e.dataAdapter)?t:new a.StatsigSpecsDataAdapter,n,e),(0,u.monitorClass)(this.u,this),(0,u.monitorClass)(this.u,n),this.P=null!=e?e:{},this.A=n,this.vt=new o.default,this.Tt=new r.default(this.vt)}initializeSync(){this.vt.reset();var t=this.dataAdapter.getDataSync();this.vt.setValuesFromDataAdapter(t),this.vt.finalize(),this.ct("Ready",t),this.Dt(t)}initializeAsync(){return i(this,void 0,void 0,function*(){this.vt.reset(),this.ct("Loading",null);var t=this.dataAdapter.getDataSync();this.vt.setValuesFromDataAdapter(t),t=yield this.dataAdapter.getDataAsync(t),this.vt.setValuesFromDataAdapter(t),this.vt.finalize(),this.ct("Ready",t)})}shutdown(){return i(this,void 0,void 0,function*(){yield this.lt.shutdown()})}checkGate(t,e,n){return this.getFeatureGate(t,e,n).value}getFeatureGate(t,e,n){e=(0,u.normalizeUser)(e,this.P.environment);var{evaluation:i,details:r}=this.Tt.evaluateGate(t,e),r=(0,u.makeFeatureGate)(t,r,i);return this.dt(t,(0,u.createGateExposure)(e,r),n),this.tt({name:"gate_evaluation",gate:r}),r}getDynamicConfig(t,e,n){t=this.kt("dynamic_config",t,e,n);return this.tt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e,n){t=this.kt("experiment",t,e,n);return this.tt({name:"experiment_evaluation",experiment:t}),t}getLayer(n,i,r){i=(0,u.normalizeUser)(i,this.P.environment);const{evaluation:s,details:t}=this.Tt.evaluateLayer(n,i),o=(0,u.makeLayer)(n,t,s,t=>{var e;return s&&t in s.value&&this.dt(n,(0,u.createLayerParameterExposure)(i,o,t),r),null!=(e=null==(e=null===s||void 0===s?void 0:s.value)?void 0:e[t])?e:null});return this.tt({name:"layer_evaluation",layer:o}),o}logEvent(t,e){this.lt.enqueue(Object.assign(Object.assign({},t),{user:e,time:Date.now()}))}Dt(t){this.dataAdapter.getDataAsync(t).catch(t=>{u.Log.error("An error occurred after update.",t)})}kt(t,e,n,i){n=(0,u.normalizeUser)(n,this.P.environment);var{evaluation:r,details:s}=this.Tt.evaluateConfig(e,n),s=(0,u.makeDynamicConfig)(e,s,r),r="experiment"===t?null==(t=null==(r=this.Pt)?void 0:r.getExperimentOverride)?void 0:t.call(r,s,n,i):null==(r=null==(t=this.Pt)?void 0:t.getDynamicConfigOverride)?void 0:r.call(t,s,n,i),t=null!=r?r:s;return this.dt(e,(0,u.createConfigExposure)(n,t),i),t}}e.default=l},4:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})},r=(Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigSpecsDataAdapter=void 0,n(464));const s=n(160);class o extends r.DataAdapterCore{constructor(){super("SpecsDataAdapter","specs"),this.A=null}attach(t,e){super.attach(t,e),this.A=new s.default(null!=e?e:{})}S(t,e){var n;return i(this,void 0,void 0,function*(){return null!=(n=yield null==(n=this.A)?void 0:n.fetchConfigSpecs(this.N()))?n:null})}}e.StatsigSpecsDataAdapter=o},452:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SHA256=void 0;const i=n(891);Object.defineProperty(e,"SHA256",{enumerable:!0,get:function(){return i.SHA256}})},891:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SHA256=void 0,e.SHA256=function(t){return(new i).update(t)};const n=[-2147483648,8388608,32768,128],o=[24,16,8,0],m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];class i{constructor(){this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.lastByteIndex=-1}update(n){if(!this.finalized){if("string"!=typeof n)throw new Error('Must be of type "string"');var i;let t=0,e;for(var r=n.length,s=this.blocks;t<r;){for(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e=this.start;t<r&&e<64;++t)(i=n.charCodeAt(t))<128?s[e>>2]|=i<<o[3&e++]:(i<2048?s[e>>2]|=(192|i>>6)<<o[3&e++]:(i<55296||57344<=i?s[e>>2]|=(224|i>>12)<<o[3&e++]:(i=65536+((1023&i)<<10|1023&n.charCodeAt(++t)),s[e>>2]|=(240|i>>18)<<o[3&e++],s[e>>2]|=(128|i>>12&63)<<o[3&e++]),s[e>>2]|=(128|i>>6&63)<<o[3&e++]),s[e>>2]|=(128|63&i)<<o[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,64<=e?(this.block=s[16],this.start=e-64,this.hash(),this.hashed=!0):this.start=e}4294967295<this.bytes&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296)}return this}finalize(){var t,e;this.finalized||(this.finalized=!0,t=this.blocks,e=this.lastByteIndex,t[16]=this.block,t[e>>2]|=n[3&e],this.block=t[16],56<=e&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash())}hash(){var t=this.blocks;let e=this.h0,n=this.h1,i=this.h2,r=this.h3,s=this.h4,o=this.h5,u=this.h6,a=this.h7,l,c,d,h,v,f,_,g,p,y,b;for(l=16;l<64;++l)v=t[l-15],c=(v>>>7|v<<25)^(v>>>18|v<<14)^v>>>3,v=t[l-2],d=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10,t[l]=t[l-16]+c+t[l-7]+d<<0;for(b=n&i,l=0;l<64;l+=4)this.first?(g=704751109,v=t[0]-210244248,a=v-1521486534<<0,r=v+143694565<<0,this.first=!1):(c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),g=e&n,h=g^e&i^b,_=s&o^~s&u,v=a+d+_+m[l]+t[l],f=c+h,a=r+v<<0,r=v+f<<0),c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),p=r&e,h=p^r&n^g,_=a&s^~a&o,v=u+d+_+m[l+1]+t[l+1],f=c+h,u=i+v<<0,i=v+f<<0,c=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),d=(u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7),y=i&r,h=y^i&e^p,_=u&a^~u&s,v=o+d+_+m[l+2]+t[l+2],f=c+h,o=n+v<<0,n=v+f<<0,c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),b=n&i,h=b^n&r^y,_=o&u^~o&a,v=s+d+_+m[l+3]+t[l+3],f=c+h,s=e+v<<0,e=v+f<<0;this.h0=this.h0+e<<0,this.h1=this.h1+n<<0,this.h2=this.h2+i<<0,this.h3=this.h3+r<<0,this.h4=this.h4+s<<0,this.h5=this.h5+o<<0,this.h6=this.h6+u<<0,this.h7=this.h7+a<<0}arrayBuffer(){return this.At().buffer}dataView(){return this.At().dataView}At(){this.finalize();var t=new ArrayBuffer(32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),e.setUint32(28,this.h7),{dataView:e,buffer:t}}}}},i={};function r(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,r)),e.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t,s=(r(348),r(368));s.default;const o=r(4);__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigSpecsDataAdapter:o.StatsigSpecsDataAdapter,StatsigOnDeviceEvalClient:s.default}),e.default=__STATSIG__}return t.default})());